diff options
author | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
commit | dc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch) | |
tree | 4ccb8fa5886b66fa9d480edef74236c27f035e16 /lib/chibios-contrib/os |
Diffstat (limited to 'lib/chibios-contrib/os')
792 files changed, 328310 insertions, 0 deletions
diff --git a/lib/chibios-contrib/os/.keep b/lib/chibios-contrib/os/.keep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/lib/chibios-contrib/os/.keep | |||
diff --git a/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F165x/ht32f165x.h b/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F165x/ht32f165x.h new file mode 100644 index 000000000..e16d32412 --- /dev/null +++ b/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F165x/ht32f165x.h | |||
@@ -0,0 +1,254 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014-2016 Fabio Utzig, http://fabioutzig.com | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining | ||
5 | * a copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
20 | * SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | #ifndef _HT32F165x_H_ | ||
24 | #define _HT32F165x_H_ | ||
25 | |||
26 | #if defined(HT32F1653) || defined(HT32F1654) | ||
27 | #define HT32F1653_4 | ||
28 | #elif defined(HT32F1655) || defined(HT32F1656) | ||
29 | #define HT32F1655_6 | ||
30 | #else | ||
31 | #error "Unknown HT32 device" | ||
32 | #endif | ||
33 | |||
34 | #if defined(HT32F1653_4) || defined(HT32F1655_6) | ||
35 | #define HT32 | ||
36 | #define HT32F165x | ||
37 | #endif | ||
38 | |||
39 | /* | ||
40 | * ============================================================== | ||
41 | * ---------- Interrupt Number Definition ----------------------- | ||
42 | * ============================================================== | ||
43 | */ | ||
44 | typedef enum IRQn | ||
45 | { | ||
46 | /****** Cortex-M3 Processor Exceptions Numbers ****************/ | ||
47 | InitialSP_IRQn = -16, | ||
48 | InitialPC_IRQn = -15, | ||
49 | NonMaskableInt_IRQn = -14, | ||
50 | HardFault_IRQn = -13, | ||
51 | MemoryManagement_IRQn = -12, | ||
52 | BusFault_IRQn = -11, | ||
53 | UsageFault_IRQn = -10, | ||
54 | |||
55 | SVCall_IRQn = -5, | ||
56 | DebugMonitor_IRQn = -4, | ||
57 | |||
58 | PendSV_IRQn = -2, | ||
59 | SysTick_IRQn = -1, | ||
60 | |||
61 | /****** HT32F165x Specific Interrupt Numbers ***********************/ | ||
62 | CKRDY_IRQn = 0, | ||
63 | LVD_IRQn = 1, | ||
64 | BOD_IRQn = 2, | ||
65 | WDT_IRQn = 3, | ||
66 | RTC_IRQn = 4, | ||
67 | FMC_IRQn = 5, | ||
68 | EVWUP_IRQn = 6, | ||
69 | LPWUP_IRQn = 7, | ||
70 | EXTI0_IRQn = 8, | ||
71 | EXTI1_IRQn = 9, | ||
72 | EXTI2_IRQn = 10, | ||
73 | EXTI3_IRQn = 11, | ||
74 | EXTI4_IRQn = 12, | ||
75 | EXTI5_IRQn = 13, | ||
76 | EXTI6_IRQn = 14, | ||
77 | EXTI7_IRQn = 15, | ||
78 | EXTI8_IRQn = 16, | ||
79 | EXTI9_IRQn = 17, | ||
80 | EXTI10_IRQn = 18, | ||
81 | EXTI11_IRQn = 19, | ||
82 | EXTI12_IRQn = 20, | ||
83 | EXTI13_IRQn = 21, | ||
84 | EXTI14_IRQn = 22, | ||
85 | EXTI15_IRQn = 23, | ||
86 | COMP_IRQn = 24, | ||
87 | ADC_IRQn = 25, | ||
88 | |||
89 | MCTM0_BRK_IRQn = 27, | ||
90 | MCTM0_UP_IRQn = 28, | ||
91 | MCTM0_TR_UP2_IRQn = 29, | ||
92 | MCTM0_CC_IRQn = 30, | ||
93 | MCTM1_BRK_IRQn = 31, | ||
94 | MCTM1_UP_IRQn = 32, | ||
95 | MCTM1_TR_UP2_IRQn = 33, | ||
96 | MCTM1_CC_IRQn = 34, | ||
97 | GPTM0_IRQn = 35, | ||
98 | GPTM1_IRQn = 36, | ||
99 | |||
100 | BFTM0_IRQn = 41, | ||
101 | BFTM1_IRQn = 42, | ||
102 | I2C0_IRQn = 43, | ||
103 | I2C1_IRQn = 44, | ||
104 | SPI0_IRQn = 45, | ||
105 | SPI1_IRQn = 46, | ||
106 | USART0_IRQn = 47, | ||
107 | USART1_IRQn = 48, | ||
108 | UART0_IRQn = 49, | ||
109 | UART1_IRQn = 50, | ||
110 | SCI_IRQn = 51, | ||
111 | I2C_IRQn = 52, | ||
112 | USB_IRQn = 53, | ||
113 | |||
114 | PDMA_CH0_IRQn = 55, | ||
115 | PDMA_CH1_IRQn = 56, | ||
116 | PDMA_CH2_IRQn = 57, | ||
117 | PDMA_CH3_IRQn = 58, | ||
118 | PDMA_CH4_IRQn = 59, | ||
119 | PDMA_CH5_IRQn = 60, | ||
120 | PDMA_CH6_IRQn = 61, | ||
121 | PDMA_CH7_IRQn = 62, | ||
122 | |||
123 | EBI_IRQn = 68, | ||
124 | } IRQn_Type; | ||
125 | |||
126 | /* | ||
127 | * ========================================================================== | ||
128 | * ----------- Processor and Core Peripheral Section ------------------------ | ||
129 | * ========================================================================== | ||
130 | */ | ||
131 | |||
132 | /** | ||
133 | * @brief HT32F165x Interrupt Number Definition, according to the selected device | ||
134 | * in @ref Library_configuration_section | ||
135 | */ | ||
136 | #define __FPU_PRESENT 0 | ||
137 | #define __MPU_PRESENT 0 | ||
138 | #define __NVIC_PRIO_BITS 4 | ||
139 | #define __Vendor_SysTickConfig 0 | ||
140 | #define __CM3_REV 0x0201 | ||
141 | |||
142 | #include "core_cm3.h" /* Cortex-M3 processor and core peripherals */ | ||
143 | |||
144 | /****************************************************************/ | ||
145 | /* Peripheral memory map */ | ||
146 | /****************************************************************/ | ||
147 | #define USART0_BASE ((uint32_t)0x40000000) | ||
148 | #define UART0_BASE ((uint32_t)0x40001000) | ||
149 | #define SPI0_BASE ((uint32_t)0x40004000) | ||
150 | #define ADC_BASE ((uint32_t)0x40010000) | ||
151 | #if defined(HT32F1655_6) | ||
152 | #define OPACMP0_BASE ((uint32_t)0x40018000) | ||
153 | #define OPACMP1_BASE ((uint32_t)0x40018100) | ||
154 | #endif | ||
155 | #define AFIO_BASE ((uint32_t)0x40022000) | ||
156 | #define EXTI_BASE ((uint32_t)0x40024000) | ||
157 | #define I2S_BASE ((uint32_t)0x40026000) | ||
158 | #define MCTM0_BASE ((uint32_t)0x4002C000) | ||
159 | #define MCTM1_BASE ((uint32_t)0x4002D000) | ||
160 | |||
161 | #define USART1_BASE ((uint32_t)0x40040000) | ||
162 | #define UART1_BASE ((uint32_t)0x40041000) | ||
163 | #define SCI_BASE ((uint32_t)0x40043000) | ||
164 | #define SPI1_BASE ((uint32_t)0x40044000) | ||
165 | #define I2C0_BASE ((uint32_t)0x40048000) | ||
166 | #define I2C1_BASE ((uint32_t)0x40049000) | ||
167 | #if defined(HT32F1653_4) | ||
168 | #define CMP0_BASE ((uint32_t)0x40058000) | ||
169 | #define CMP1_BASE ((uint32_t)0x40058100) | ||
170 | #endif | ||
171 | #define WDT_BASE ((uint32_t)0x40068000) | ||
172 | #define RTC_BASE ((uint32_t)0x4006A000) | ||
173 | #define PWRCU_BASE ((uint32_t)0x4006A000) | ||
174 | #define GPTM0_BASE ((uint32_t)0x4006E000) | ||
175 | #define GPTM1_BASE ((uint32_t)0x4006F000) | ||
176 | #define BFTM0_BASE ((uint32_t)0x40076000) | ||
177 | #define BFTM1_BASE ((uint32_t)0x40077000) | ||
178 | |||
179 | #define FMC_BASE ((uint32_t)0x40080000) | ||
180 | #define CKCU_BASE ((uint32_t)0x40088000) | ||
181 | #define RSTCU_BASE ((uint32_t)0x40088000) | ||
182 | #define CRC_BASE ((uint32_t)0x4008A000) | ||
183 | #define PDMA_BASE ((uint32_t)0x40090000) | ||
184 | #define EBI_BASE ((uint32_t)0x40098000) | ||
185 | #define USB_BASE ((uint32_t)0x400A8000) | ||
186 | #define USB_SRAM_BASE ((uint32_t)0x400AA000) | ||
187 | #define GPIO_A_BASE ((uint32_t)0x400B0000) | ||
188 | #define GPIO_B_BASE ((uint32_t)0x400B2000) | ||
189 | #define GPIO_C_BASE ((uint32_t)0x400B4000) | ||
190 | #define GPIO_D_BASE ((uint32_t)0x400B6000) | ||
191 | #if defined(HT32F1655_6) | ||
192 | #define GPIO_E_BASE ((uint32_t)0x400B8000) | ||
193 | #endif | ||
194 | |||
195 | // Registers Headers | ||
196 | #include "ht32f165x_reg.h" | ||
197 | |||
198 | /****************************************************************/ | ||
199 | /* Peripheral declaration */ | ||
200 | /****************************************************************/ | ||
201 | #define USART0 ((USART_TypeDef *) USART0_BASE) | ||
202 | #define UART0 ((USART_TypeDef *) UART0_BASE) | ||
203 | #define SPI0 ((SPI_TypeDef *) SPI0_BASE) | ||
204 | #define ADC ((ADC_TypeDef *) ADC_BASE) | ||
205 | #if defined(HT32F1655_6) | ||
206 | #define OPACMP0 ((OPACMP_TypeDef *) OPACMP0_BASE) | ||
207 | #define OPACMP1 ((OPACMP_TypeDef *) OPACMP1_BASE) | ||
208 | #endif | ||
209 | #define AFIO ((AFIO_TypeDef *) AFIO_BASE) | ||
210 | #define EXTI ((EXTI_TypeDef *) EXTI_BASE) | ||
211 | #define I2S ((I2S_TypeDef *) I2S_BASE) | ||
212 | #define MCTM0 ((TM_TypeDef *) MCTM0_BASE) | ||
213 | #define MCTM1 ((TM_TypeDef *) MCTM1_BASE) | ||
214 | |||
215 | #define USART1 ((USART_TypeDef *) USART1_BASE) | ||
216 | #define UART1 ((USART_TypeDef *) UART1_BASE) | ||
217 | #define SCI ((SCI_TypeDef *) SCI_BASE) | ||
218 | #define SPI1 ((SPI_TypeDef *) SPI1_BASE) | ||
219 | #define I2C0 ((I2C_TypeDef *) I2C0_BASE) | ||
220 | #define I2C1 ((I2C_TypeDef *) I2C1_BASE) | ||
221 | #if defined(HT32F1653_4) | ||
222 | #define CMP0 ((CMP_TypeDef *) CMP0_BASE) | ||
223 | #define CMP1 ((CMP_TypeDef *) CMP1_BASE) | ||
224 | #endif | ||
225 | #define WDT ((WDT_TypeDef *) WDT_BASE) | ||
226 | #define RTC ((RTC_TypeDef *) RTC_BASE) | ||
227 | #define PWRCU ((PWRCU_TypeDef *) PWRCU_BASE) | ||
228 | #define GPTM0 ((TM_TypeDef *) GPTM0_BASE) | ||
229 | #define GPTM1 ((TM_TypeDef *) GPTM1_BASE) | ||
230 | #define BFTM0 ((BFTM_TypeDef *) BFTM0_BASE) | ||
231 | #define BFTM1 ((BFTM_TypeDef *) BFTM1_BASE) | ||
232 | |||
233 | #define FMC ((FMC_TypeDef *) FMC_BASE) | ||
234 | #define CKCU ((CKCU_TypeDef *) CKCU_BASE) | ||
235 | #define RSTCU ((RSTCU_TypeDef *) RSTCU_BASE) | ||
236 | #define CRC ((CRC_TypeDef *) CRC_BASE) | ||
237 | #define PDMA ((PDMA_TypeDef *) PDMA_BASE) | ||
238 | #define EBI ((EBI_TypeDef *) EBI_BASE) | ||
239 | #define USB ((USB_TypeDef *) USB_BASE) | ||
240 | |||
241 | #define GPIOA ((GPIO_TypeDef *) GPIO_A_BASE) | ||
242 | #define GPIO_A GPIOA | ||
243 | #define GPIOB ((GPIO_TypeDef *) GPIO_B_BASE) | ||
244 | #define GPIO_B GPIOB | ||
245 | #define GPIOC ((GPIO_TypeDef *) GPIO_C_BASE) | ||
246 | #define GPIO_C GPIOC | ||
247 | #define GPIOD ((GPIO_TypeDef *) GPIO_D_BASE) | ||
248 | #define GPIO_D GPIOD | ||
249 | #if defined(HT32F1655_6) | ||
250 | #define GPIOE ((GPIO_TypeDef *) GPIO_E_BASE) | ||
251 | #define GPIO_E GPIOE | ||
252 | #endif | ||
253 | |||
254 | #endif | ||
diff --git a/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F165x/ht32f165x_reg.h b/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F165x/ht32f165x_reg.h new file mode 100644 index 000000000..b47416b56 --- /dev/null +++ b/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F165x/ht32f165x_reg.h | |||
@@ -0,0 +1,679 @@ | |||
1 | #ifndef HT32F165x_REG_H | ||
2 | #define HT32F165x_REG_H | ||
3 | |||
4 | #ifndef __IO | ||
5 | #define __IO volatile | ||
6 | #endif | ||
7 | |||
8 | // Constants | ||
9 | // ///////////////////////////////////////////////////////////////////////////// | ||
10 | #define AFIO_DEFAULT 0 | ||
11 | #define AFIO_GPIO 1 | ||
12 | #define AFIO_ADC 2 | ||
13 | #define AFIO_CMP 3 | ||
14 | #define AFIO_TM 4 | ||
15 | #define AFIO_SPI 5 | ||
16 | #define AFIO_USART 6 | ||
17 | #define AFIO_I2C 7 | ||
18 | #define AFIO_SMC 8 | ||
19 | #define AFIO_EBI 9 | ||
20 | #define AFIO_I2S 10 | ||
21 | #define AFIO_OTHER 15 | ||
22 | |||
23 | // Flash Memory Controller | ||
24 | // ///////////////////////////////////////////////////////////////////////////// | ||
25 | typedef struct { | ||
26 | __IO uint32_t TADR; //!< 0x000 Flash Target Address Register | ||
27 | __IO uint32_t WRDR; //!< 0x004 Flash Write Data Register | ||
28 | uint32_t RESERVED0[1]; //!< 0x008 Reserved | ||
29 | __IO uint32_t OCMR; //!< 0x00C Flash Operation Command Register | ||
30 | __IO uint32_t OPCR; //!< 0x010 Flash Operation Control Register | ||
31 | __IO uint32_t OIER; //!< 0x014 Flash Operation Interrupt Enable Register | ||
32 | __IO uint32_t OISR; //!< 0x018 Flash Operation Interrupt and Status Register | ||
33 | uint32_t RESERVED1[1]; //!< 0x01C Reserved | ||
34 | __IO uint32_t PPSR[4]; //!< 0x020 ~ 0x02C Flash Page Erase/Program Protection Status Register | ||
35 | __IO uint32_t CPSR; //!< 0x030 Flash Security Protection Status Register | ||
36 | uint32_t RESERVED2[51]; //!< 0x034 ~ 0x0FC Reserved | ||
37 | __IO uint32_t VMCR; //!< 0x100 Flash Vector Mapping Control Register | ||
38 | uint32_t RESERVED3[31]; //!< 0x104 ~ 0x17C Reserved | ||
39 | __IO uint32_t MDID; //!< 0x180 Manufacturer and Device ID Register | ||
40 | __IO uint32_t PNSR; //!< 0x184 Flash Page Number Status Register | ||
41 | __IO uint32_t PSSR; //!< 0x188 Flash Page Size Status Register | ||
42 | #if defined(HT32F165x) | ||
43 | uint32_t RESERVED4[29]; //!< 0x18C ~ 0x1FC Reserved | ||
44 | #else | ||
45 | __IO uint32_t DID; //!< 0x18C Device ID Register | ||
46 | uint32_t RESERVED4[28]; //!< 0x190 ~ 0x1FC Reserved | ||
47 | #endif | ||
48 | __IO uint32_t CFCR; //!< 0x200 Flash Cache and Pre-fetch Control Register | ||
49 | uint32_t RESERVED5[63]; //!< 0x204 ~ 0x2FC Reserved | ||
50 | __IO uint32_t SBVT[4]; //!< 0x300 ~ 0x30C SRAM Booting Vector (4x32Bit) | ||
51 | #if defined(HT32F165x) | ||
52 | #else | ||
53 | __IO uint32_t CID[4]; //!< 0x310 ~ 0x31C Custom ID Register | ||
54 | #endif | ||
55 | } FMC_TypeDef; | ||
56 | |||
57 | #define FMC_OCMR_CMD_MASK (0xF << 0) | ||
58 | #define FMC_OCMR_CMD_IDLE (0x0 << 0) | ||
59 | #define FMC_OCMR_CMD_WORD_PROGRAM (0x4 << 0) | ||
60 | #define FMC_OCMR_CMD_PAGE_ERASE (0x8 << 0) | ||
61 | #define FMC_OCMR_CMD_MASS_ERASE (0xA << 0) | ||
62 | #define FMC_OPCR_OPM_MASK (0xF << 1) | ||
63 | #define FMC_OPCR_OPM_IDLE (0x6 << 1) | ||
64 | #define FMC_OPCR_OPM_COMMIT (0xA << 1) | ||
65 | #define FMC_OPCR_OPM_FINISHED (0xE << 1) | ||
66 | #define FMC_CFCR_CE (1U << 12) | ||
67 | #define FMC_CFCR_WAIT_MASK (7U << 0) | ||
68 | #define FMC_CFCR_WAIT_0 (1U) | ||
69 | #define FMC_CFCR_WAIT_1 (2U) | ||
70 | #define FMC_CFCR_WAIT_2 (3U) | ||
71 | |||
72 | // Power Control Unit | ||
73 | // ///////////////////////////////////////////////////////////////////////////// | ||
74 | typedef struct { | ||
75 | uint32_t RESERVE0[64]; | ||
76 | __IO uint32_t BAKSR; //!< 0x000 Status Register | ||
77 | __IO uint32_t BAKCR; //!< 0x004 Control Register | ||
78 | __IO uint32_t BAKTEST; //!< 0x008 Test Register | ||
79 | __IO uint32_t HSIRCR; //!< 0x00C HSI Ready Counter Control Register | ||
80 | __IO uint32_t LVDCSR; //!< 0x010 Low Voltage/Brown Out Detect Control and Status Register | ||
81 | uint32_t RESERVE1[59]; //!< 0x014 ~ 0x0FC Reserved | ||
82 | __IO uint32_t BAKREG[10]; //!< 0x100 ~ 0x124 Backup Register 0 ~ 9 | ||
83 | } PWRCU_TypeDef; | ||
84 | |||
85 | // Clock Control Unit | ||
86 | // ///////////////////////////////////////////////////////////////////////////// | ||
87 | typedef struct { | ||
88 | __IO uint32_t GCFGR; //!< 0x000 Global Clock Configuration Register | ||
89 | __IO uint32_t GCCR; //!< 0x004 Global Clock Control Register | ||
90 | __IO uint32_t GCSR; //!< 0x008 Global Clock Status Register | ||
91 | __IO uint32_t GCIR; //!< 0x00C Global Clock Interrupt Register | ||
92 | uint32_t RESERVED0[2]; //!< 0x010 ~ 0x014 Reserved | ||
93 | __IO uint32_t PLLCFGR; //!< 0x018 PLL Configuration Register | ||
94 | __IO uint32_t PLLCR; //!< 0x01C PLL Control Register | ||
95 | __IO uint32_t AHBCFGR; //!< 0x020 AHB Configuration Register | ||
96 | __IO uint32_t AHBCCR; //!< 0x024 AHB Clock Control Register | ||
97 | __IO uint32_t APBCFGR; //!< 0x028 APB Configuration Register | ||
98 | __IO uint32_t APBCCR0; //!< 0x02C APB Clock Control Register 0 | ||
99 | __IO uint32_t APBCCR1; //!< 0x030 APB Clock Control Register 1 | ||
100 | __IO uint32_t CKST; //!< 0x034 Clock source status Register | ||
101 | #if defined(HT32F1653_4) | ||
102 | __IO uint32_t APBPCSR0; //!< 0x038 APB Peripheral Clock Selection Register 0 | ||
103 | __IO uint32_t APBPCSR1; //!< 0x03C APB Peripheral Clock Selection Register 1 | ||
104 | __IO uint32_t HSICR; //!< 0x040 HSI Control Register | ||
105 | __IO uint32_t HSIATCR; //!< 0x044 HSI Auto Trimming Counter Register | ||
106 | #else | ||
107 | uint32_t RESERVED1[4]; //!< 0x038 ~ 0x044 Reserved | ||
108 | #endif | ||
109 | uint32_t RESERVED2[174]; //!< 0x048 ~ 0x2FC Reserved | ||
110 | __IO uint32_t LPCR; //!< 0x300 Low Power Control Register | ||
111 | __IO uint32_t MCUDBGCR; //!< 0x304 MCU Debug Control Register | ||
112 | } CKCU_TypeDef; | ||
113 | |||
114 | #define CKCU_GCFGR_LPMOD_MASK (7U << 29) | ||
115 | #define CKCU_GCFGR_USBPRE_MASK (3U << 22) | ||
116 | #define CKCU_GCFGR_URPRE_MASK (3U << 20) | ||
117 | #define CKCU_GCFGR_PLLSRC (1U << 8) | ||
118 | #define CKCU_GCFGR_CKOUTSRC_MASK (7U << 0) | ||
119 | #define CKCU_GCFGR_CKOUTSRC_CK_REF (0U << 0) | ||
120 | #define CKCU_GCFGR_CKOUTSRC_CK_AHB (1U << 0) | ||
121 | #define CKCU_GCFGR_CKOUTSRC_CK_SYS (2U << 0) | ||
122 | #define CKCU_GCFGR_CKOUTSRC_CK_HSE (3U << 0) | ||
123 | #define CKCU_GCFGR_CKOUTSRC_CK_HSI (4U << 0) | ||
124 | #define CKCU_GCFGR_CKOUTSRC_CK_LSE (5U << 0) | ||
125 | #define CKCU_GCFGR_CKOUTSRC_CK_LSI (6U << 0) | ||
126 | #define CKCU_GCCR_PSRCEN (1U << 17) | ||
127 | #define CKCU_GCCR_CKMEN (1U << 16) | ||
128 | #define CKCU_GCCR_HSIEN (1U << 11) | ||
129 | #define CKCU_GCCR_HSEEN (1U << 10) | ||
130 | #define CKCU_GCCR_PLLEN (1U << 9) | ||
131 | #define CKCU_GCCR_SW_MASK (3U << 0) | ||
132 | #define CKCU_GCCR_SW_PLL (1U << 0) | ||
133 | #define CKCU_GCCR_SW_HSE (2U << 0) | ||
134 | #define CKCU_GCCR_SW_HSI (3U << 0) | ||
135 | #define CKCU_GCSR_LSIRDY (1U << 5) | ||
136 | #define CKCU_GCSR_LSERDY (1U << 4) | ||
137 | #define CKCU_GCSR_HSIRDY (1U << 3) | ||
138 | #define CKCU_GCSR_HSERDY (1U << 2) | ||
139 | #define CKCU_GCSR_PLLRDY (1U << 1) | ||
140 | #define CKCU_PLLCFGR_PFBD_MASK (0x3fU << 23) | ||
141 | #define CKCU_PLLCFGR_POTD_MASK (3U << 21) | ||
142 | #define CKCU_PLLCR_PLLBPS (1U << 31) | ||
143 | #define CKCU_AHBCFGR_AHBPRE_MASK (3U << 0) | ||
144 | #define CKCU_AHBCCR_PAEN (1U << 16) | ||
145 | #define CKCU_AHBCCR_CRCEN (1U << 13) | ||
146 | #define CKCU_AHBCCR_EBIEN (1U << 12) | ||
147 | #define CKCU_AHBCCR_CKREFEN (1U << 11) | ||
148 | #define CKCU_AHBCCR_USBEN (1U << 10) | ||
149 | #define CKCU_APBCFGR_ADCDIV_MASK (7U << 16) | ||
150 | #define CKCU_APBCCR0_I2SEN (1U << 25) | ||
151 | #define CKCU_APBCCR0_SCIEN (1U << 24) | ||
152 | #define CKCU_APBCCR0_EXTIEN (1U << 15) | ||
153 | #define CKCU_APBCCR0_AFIOEN (1U << 14) | ||
154 | #define CKCU_APBCCR0_UR1EN (1U << 11) | ||
155 | #define CKCU_APBCCR0_UR0EN (1U << 10) | ||
156 | #define CKCU_APBCCR0_USR1EN (1U << 9) | ||
157 | #define CKCU_APBCCR0_USR0EN (1U << 8) | ||
158 | #define CKCU_APBCCR0_SPI1EN (1U << 5) | ||
159 | #define CKCU_APBCCR0_SPI0EN (1U << 4) | ||
160 | #define CKCU_APBCCR0_I2C1EN (1U << 1) | ||
161 | #define CKCU_APBCCR0_I2C0EN (1U << 0) | ||
162 | #define CKCU_APBCCR1_ADCEN (1U << 24) | ||
163 | #define CKCU_APBCCR1_OPA1EN (1U << 23) | ||
164 | #define CKCU_APBCCR1_OPA0EN (1U << 22) | ||
165 | #define CKCU_APBCCR1_BFTM1EN (1U << 17) | ||
166 | #define CKCU_APBCCR1_BFTM0EN (1U << 16) | ||
167 | #define CKCU_APBCCR1_GPTM1EN (1U << 9) | ||
168 | #define CKCU_APBCCR1_GPTM0EN (1U << 8) | ||
169 | #define CKCU_APBCCR1_BKPREN (1U << 6) | ||
170 | #define CKCU_APBCCR1_WDTREN (1U << 4) | ||
171 | #define CKCU_APBCCR1_MCTM1EN (1U << 1) | ||
172 | #define CKCU_APBCCR1_MCTM0EN (1U << 0) | ||
173 | #define CKCU_CKST_CKSWST_MASK (3U << 30) | ||
174 | #define CKCU_CKST_HSIST_MASK (7U << 24) | ||
175 | #define CKCU_CKST_HSEST_MASK (3U << 16) | ||
176 | #define CKCU_CKST_PLLST_MASK (0xfU << 8) | ||
177 | #define CKCU_LPCR_USBSLEEP (1U << 8) | ||
178 | #define CKCU_LPCR_BKISO (1U << 0) | ||
179 | |||
180 | // Reset Control Unit | ||
181 | // ///////////////////////////////////////////////////////////////////////////// | ||
182 | typedef struct { | ||
183 | __IO uint32_t GRSR; //!< 0x000 Global Reset Status Register | ||
184 | __IO uint32_t AHBPRSTR; //!< 0x004 AHB Peripheral Reset Register | ||
185 | __IO uint32_t APBPRSTR0; //!< 0x008 APB Peripheral Reset Register 0 | ||
186 | __IO uint32_t APBPRSTR1; //!< 0x00C APB Peripheral Reset Register 1 | ||
187 | } RSTCU_TypeDef; | ||
188 | |||
189 | #define RSTCU_GRSR_PORSTF (1U << 3) | ||
190 | #define RSTCU_GRSR_WDTRSTF (1U << 2) | ||
191 | #define RSTCU_GRSR_EXTRSTF (1U << 1) | ||
192 | #define RSTCU_GRSR_SYSRSTF (1U << 0) | ||
193 | #define RSTCU_AHBPRSTR_PxRST(n) ((1U << 8) << (n)) | ||
194 | #define RSTCU_AHBPRSTR_CRCRST (1U << 7) | ||
195 | #define RSTCU_AHBPRSTR_EBIRST (1U << 6) | ||
196 | #define RSTCU_AHBPRSTR_USBRST (1U << 5) | ||
197 | #define RSTCU_AHBPRSTR_DMARST (1U << 0) | ||
198 | #define RSTCU_APBPRSTR0_I2SRST (1U << 25) | ||
199 | #define RSTCU_APBPRSTR0_SCIRST (1U << 24) | ||
200 | #define RSTCU_APBPRSTR0_EXTIRST (1U << 15) | ||
201 | #define RSTCU_APBPRSTR0_AFIORST (1U << 14) | ||
202 | #define RSTCU_APBPRSTR0_UR1RST (1U << 11) | ||
203 | #define RSTCU_APBPRSTR0_UR0RST (1U << 10) | ||
204 | #define RSTCU_APBPRSTR0_USR1RST (1U << 9) | ||
205 | #define RSTCU_APBPRSTR0_USR0RST (1U << 8) | ||
206 | #define RSTCU_APBPRSTR0_SPI1RST (1U << 5) | ||
207 | #define RSTCU_APBPRSTR0_SPI0RST (1U << 4) | ||
208 | #define RSTCU_APBPRSTR0_I2C1RST (1U << 1) | ||
209 | #define RSTCU_APBPRSTR0_I2C0RST (1U << 0) | ||
210 | #define RSTCU_APBPRSTR1_ADCRST (1U << 24) | ||
211 | #define RSTCU_APBPRSTR1_OPA1RST (1U << 23) | ||
212 | #define RSTCU_APBPRSTR1_OPA0RST (1U << 22) | ||
213 | #define RSTCU_APBPRSTR1_BFTM1RST (1U << 17) | ||
214 | #define RSTCU_APBPRSTR1_BFTM0RST (1U << 16) | ||
215 | #define RSTCU_APBPRSTR1_GPTM1RST (1U << 9) | ||
216 | #define RSTCU_APBPRSTR1_GPTM0RST (1U << 8) | ||
217 | #define RSTCU_APBPRSTR1_WDTRST (1U << 4) | ||
218 | #define RSTCU_APBPRSTR1_MCTM1RST (1U << 1) | ||
219 | #define RSTCU_APBPRSTR1_MCTM0RST (1U << 0) | ||
220 | |||
221 | // General Purpose I/O | ||
222 | // ///////////////////////////////////////////////////////////////////////////// | ||
223 | typedef struct { | ||
224 | __IO uint32_t DIRCR; //!< 0x000 Data Direction Control Register | ||
225 | __IO uint32_t INER; //!< 0x004 Input function enable register | ||
226 | __IO uint32_t PUR; //!< 0x008 Pull-Up Selection Register | ||
227 | __IO uint32_t PDR; //!< 0x00C Pull-Down Selection Register | ||
228 | __IO uint32_t ODR; //!< 0x010 Open Drain Selection Register | ||
229 | __IO uint32_t DRVR; //!< 0x014 Drive Current Selection Register | ||
230 | __IO uint32_t LOCKR; //!< 0x018 Lock Register | ||
231 | __IO uint32_t DINR; //!< 0x01c Data Input Register | ||
232 | __IO uint32_t DOUTR; //!< 0x020 Data Output Register | ||
233 | __IO uint32_t SRR; //!< 0x024 Output Set and Reset Control Register | ||
234 | __IO uint32_t RR; //!< 0x028 Output Reset Control Register | ||
235 | } GPIO_TypeDef; | ||
236 | |||
237 | // Alternate Function Input/Output | ||
238 | // ///////////////////////////////////////////////////////////////////////////// | ||
239 | typedef struct { | ||
240 | __IO uint32_t ESSR[2]; //!< 0x000 ~ 0x004 EXTI Source Selection Register 0 ~ 1 | ||
241 | uint32_t RESERVE0[6]; //!< 0x008 ~ 0x01C Reserved | ||
242 | union { | ||
243 | struct { | ||
244 | __IO uint32_t GPACFGR[2]; //!< 0x020 ~ 0x024 GPIO Port A Configuration Register 0 ~ 1 | ||
245 | __IO uint32_t GPBCFGR[2]; //!< 0x028 ~ 0x02C GPIO Port B Configuration Register 0 ~ 1 | ||
246 | __IO uint32_t GPCCFGR[2]; //!< 0x030 ~ 0x034 GPIO Port C Configuration Register 0 ~ 1 | ||
247 | __IO uint32_t GPDCFGR[2]; //!< 0x038 ~ 0x03C GPIO Port D Configuration Register 0 ~ 1 | ||
248 | #if defined(HT32F1655_6) | ||
249 | __IO uint32_t GPECFGR[2]; //!< 0x040 ~ 0x044 GPIO Port E Configuration Register 0 ~ 1 | ||
250 | #endif | ||
251 | }; | ||
252 | // alternate mapping | ||
253 | struct { | ||
254 | __IO uint32_t GPxCFGR[0][2]; //!< 0x020 ~ 0x044 GPIO Port x Configuration Register 0 ~ 1 | ||
255 | }; | ||
256 | }; | ||
257 | } AFIO_TypeDef; | ||
258 | |||
259 | // Nested Vectored Interrupt Controller | ||
260 | // ///////////////////////////////////////////////////////////////////////////// | ||
261 | // Implemented in Cortex-M3 Headers | ||
262 | |||
263 | // External Interrupt/Event Controller | ||
264 | // ///////////////////////////////////////////////////////////////////////////// | ||
265 | typedef struct { | ||
266 | __IO uint32_t CFGR0; //!< 0x000 EXTI Interrupt 0 Configuration Register | ||
267 | __IO uint32_t CFGR1; //!< 0x004 EXTI Interrupt 1 Configuration Register | ||
268 | __IO uint32_t CFGR2; //!< 0x008 EXTI Interrupt 2 Configuration Register | ||
269 | __IO uint32_t CFGR3; //!< 0x00C EXTI Interrupt 3 Configuration Register | ||
270 | __IO uint32_t CFGR4; //!< 0x010 EXTI Interrupt 4 Configuration Register | ||
271 | __IO uint32_t CFGR5; //!< 0x014 EXTI Interrupt 5 Configuration Register | ||
272 | __IO uint32_t CFGR6; //!< 0x018 EXTI Interrupt 6 Configuration Register | ||
273 | __IO uint32_t CFGR7; //!< 0x01C EXTI Interrupt 7 Configuration Register | ||
274 | __IO uint32_t CFGR8; //!< 0x020 EXTI Interrupt 8 Configuration Register | ||
275 | __IO uint32_t CFGR9; //!< 0x024 EXTI Interrupt 9 Configuration Register | ||
276 | __IO uint32_t CFGR10; //!< 0x028 EXTI Interrupt 10 Configuration Register | ||
277 | __IO uint32_t CFGR11; //!< 0x02C EXTI Interrupt 11 Configuration Register | ||
278 | __IO uint32_t CFGR12; //!< 0x030 EXTI Interrupt 12 Configuration Register | ||
279 | __IO uint32_t CFGR13; //!< 0x034 EXTI Interrupt 13 Configuration Register | ||
280 | __IO uint32_t CFGR14; //!< 0x038 EXTI Interrupt 14 Configuration Register | ||
281 | __IO uint32_t CFGR15; //!< 0x03C EXTI Interrupt 15 Configuration Register | ||
282 | __IO uint32_t CR; //!< 0x040 EXTI Interrupt Control Register | ||
283 | __IO uint32_t EDGEFLGR; //!< 0x044 EXTI Interrupt Edge Flag Register | ||
284 | __IO uint32_t EDGESR; //!< 0x048 EXTI Interrupt Edge Status Register | ||
285 | __IO uint32_t SSCR; //!< 0x04C EXTI Interrupt Software Set Command Register | ||
286 | __IO uint32_t WAKUPCR; //!< 0x050 EXTI Interrupt Wakeup Control Register | ||
287 | __IO uint32_t WAKUPPOLR; //!< 0x054 EXTI Interrupt Wakeup Polarity Register | ||
288 | __IO uint32_t WAKUPFLG; //!< 0x058 EXTI Interrupt Wakeup Flag Register | ||
289 | } EXTI_TypeDef; | ||
290 | |||
291 | // Analog To Digital Converter | ||
292 | // ///////////////////////////////////////////////////////////////////////////// | ||
293 | |||
294 | // Operational Amplifier / Comparator | ||
295 | // ///////////////////////////////////////////////////////////////////////////// | ||
296 | #if defined(HT32F1653_4) | ||
297 | typedef struct { | ||
298 | __IO uint32_t CR; //!< 0x000 Comparator Control Register | ||
299 | __IO uint32_t VALR; //!< 0x004 Comparator Voltage Reference Register | ||
300 | __IO uint32_t IER; //!< 0x008 Comparator Interrupt Enable Register | ||
301 | __IO uint32_t TFR; //!< 0x00C Comparator Transition Flag Register | ||
302 | } CMP_TypeDef; | ||
303 | #else | ||
304 | typedef struct { | ||
305 | __IO uint32_t OPACR; //!< 0x000 Operational Amplifier Control Register | ||
306 | __IO uint32_t OFVCR; //!< 0x004 Comparator Input Offset Voltage Cancellation Register | ||
307 | __IO uint32_t CMPIER; //!< 0x008 Comparator Interrupt Enable Register | ||
308 | __IO uint32_t CMPRSR; //!< 0x00C Comparator Raw Status Register | ||
309 | __IO uint32_t CMPISR; //!< 0x010 Comparator Masked Interrupt Status Register | ||
310 | __IO uint32_t CMPICLR; //!< 0x014 Comparator Interrupt Clear Register | ||
311 | } OPACMP_TypeDef; | ||
312 | #endif | ||
313 | |||
314 | // Basic Function Timers | ||
315 | // ///////////////////////////////////////////////////////////////////////////// | ||
316 | typedef struct { | ||
317 | __IO uint32_t CR; //!< 0x000 Control Register | ||
318 | __IO uint32_t SR; //!< 0x004 Status Register | ||
319 | __IO uint32_t CNTR; //!< 0x008 Counter Value Register | ||
320 | __IO uint32_t CMP; //!< 0x00C Compare Value Register | ||
321 | } BFTM_TypeDef; | ||
322 | |||
323 | #define BFTM_CR_CEN (1U << 2) | ||
324 | #define BFTM_CR_OSM (1U << 1) | ||
325 | #define BFTM_CR_MIEN (1U << 0) | ||
326 | #define BFTM_SR_MIF (1U << 0) | ||
327 | |||
328 | // General Purpose Timers | ||
329 | // Motor Control Timers | ||
330 | // ///////////////////////////////////////////////////////////////////////////// | ||
331 | typedef struct { | ||
332 | __IO uint32_t CNTCFR; //!< 0x000 Timer Counter Configuaration Register | ||
333 | __IO uint32_t MDCFR; //!< 0x004 Timer Mode Configuration Register | ||
334 | __IO uint32_t TRCFR; //!< 0x008 Timer Trigger Configuration Register | ||
335 | uint32_t RESERVED0[1]; //!< 0x00C Reserved | ||
336 | __IO uint32_t CTR; //!< 0x010 Timer Counter Register | ||
337 | uint32_t RESERVED1[3]; //!< 0x014 ~ 0x01C Reserved | ||
338 | __IO uint32_t CHnICFR[4]; //!< 0x020 ~ 0x02C Channel n Input Configuration Register | ||
339 | uint32_t RESERVED2[4]; //!< 0x030 ~ 0x03C Reserved | ||
340 | __IO uint32_t CHnOCFR[4]; //!< 0x040 ~ 0x04C Channel n Output Configuration Register | ||
341 | __IO uint32_t CHCTR; //!< 0x050 Channel Control Register | ||
342 | __IO uint32_t CHPOLR; //!< 0x054 Channel Polarity Control Register | ||
343 | uint32_t RESERVED3[5]; //!< 0x058 ~ 0x068 Reserved | ||
344 | // note: only available as MCTM | ||
345 | __IO uint32_t CHBRKCFR; //!< 0x06C Channel Break Configuration Register | ||
346 | __IO uint32_t CHBRKCTR; //!< 0x070 Channel Break Control Register | ||
347 | // end note | ||
348 | __IO uint32_t DICTR; //!< 0x074 Timer PDMA/Interrupt Control Register | ||
349 | __IO uint32_t EVGR; //!< 0x078 Timer Event Generator Register | ||
350 | __IO uint32_t INTSR; //!< 0x07C Timer Interrupt Status Register | ||
351 | __IO uint32_t CNTR; //!< 0x080 Timer Counter Register | ||
352 | __IO uint32_t PSCR; //!< 0x084 Timer Prescaler Register | ||
353 | __IO uint32_t CRR; //!< 0x088 Timer Counter Reload Register | ||
354 | // note: only available as MCTM | ||
355 | __IO uint32_t REPR; //!< 0x08C Timer Repetition Register | ||
356 | // end note | ||
357 | __IO uint32_t CHnCCR[4]; //!< 0x090 ~ 0x09C Channel n Capture/Compare Register | ||
358 | __IO uint32_t CHnACR[4]; //!< 0x0A0 ~ 0x0AC Channel n Asymmentric Compare Register | ||
359 | } TM_TypeDef; | ||
360 | |||
361 | #define TM_CNTCFR_CMSEL_MASK (3U << 16) | ||
362 | #define TM_CNTCFR_CMSEL_MODE_3 (3U << 16) | ||
363 | #define TM_CNTCFR_CMSEL_MODE_2 (2U << 16) | ||
364 | #define TM_CNTCFR_CMSEL_MODE_1 (1U << 16) | ||
365 | #define TM_CNTCFR_CMSEL_MODE_0 (0U << 16) | ||
366 | #define TM_CTR_CHCCDS (1U << 16) | ||
367 | #define TM_CTR_COMUS (1U << 9) | ||
368 | #define TM_CTR_COMPRE (1U << 8) | ||
369 | #define TM_CTR_CRBE (1U << 1) | ||
370 | #define TM_CTR_TME (1U << 0) | ||
371 | #define TM_CHnOCFR_CHnPRE (1U << 4) | ||
372 | #define TM_CHnOCFR_REFnCE (1U << 3) | ||
373 | #define TM_CHnOCFR_CHnOM(n) ((((n)>>0)&7)|((((n)>>3)&1)<<8)) | ||
374 | #define TM_CHBRKCTR_CHMOE (1U << 4) | ||
375 | |||
376 | // Real Time Clock | ||
377 | // ///////////////////////////////////////////////////////////////////////////// | ||
378 | |||
379 | // Watchdog Timer | ||
380 | // ///////////////////////////////////////////////////////////////////////////// | ||
381 | |||
382 | // I2C | ||
383 | // ///////////////////////////////////////////////////////////////////////////// | ||
384 | typedef struct { | ||
385 | __IO uint32_t CR; //!< 0x000 Control Register | ||
386 | __IO uint32_t IER; //!< 0x004 Interrupt Enable Register | ||
387 | __IO uint32_t ADDR; //!< 0x008 Address Register | ||
388 | __IO uint32_t SR; //!< 0x00C Status Register | ||
389 | __IO uint32_t SHPGR; //!< 0x010 SCL High Period Generation Register | ||
390 | __IO uint32_t SLPGR; //!< 0x014 SCL Low Period Generation Register | ||
391 | __IO uint32_t DR; //!< 0x018 Data Register | ||
392 | __IO uint32_t TAR; //!< 0x01C Target Register | ||
393 | __IO uint32_t ADDMR; //!< 0x020 Address Mask Register | ||
394 | __IO uint32_t ADDSR; //!< 0x024 Address Snoop Register | ||
395 | __IO uint32_t TOUT; //!< 0x028 Timeout Register | ||
396 | } I2C_TypeDef; | ||
397 | |||
398 | #define I2C_CR_SEQ_FILTER_MASK (3U << 14) | ||
399 | #define I2C_CR_SEQ_FILTER_2_PCLK (2U << 14) | ||
400 | #define I2C_CR_SEQ_FILTER_1_PCLK (1U << 14) | ||
401 | #define I2C_CR_SEQ_FILTER_DISABLE (0U << 14) | ||
402 | #define I2C_CR_COMB_FILTER_En (1U << 13) | ||
403 | #define I2C_CR_ENTOUT (1U << 12) | ||
404 | #define I2C_CR_DMANACK (1U << 10) | ||
405 | #define I2C_CR_RXDMAE (1U << 9) | ||
406 | #define I2C_CR_TXDMAE (1U << 8) | ||
407 | #define I2C_CR_ADRM (1U << 7) | ||
408 | #define I2C_CR_I2CEN (1U << 3) | ||
409 | #define I2C_CR_GCEN (1U << 2) | ||
410 | #define I2C_CR_STOP (1U << 1) | ||
411 | #define I2C_CR_AA (1U << 0) | ||
412 | #define I2C_IER_RXBFIE (1U << 18) | ||
413 | #define I2C_IER_TXDEIE (1U << 17) | ||
414 | #define I2C_IER_RXDNEIE (1U << 16) | ||
415 | #define I2C_IER_TOUTIE (1U << 11) | ||
416 | #define I2C_IER_BUSERRIE (1U << 10) | ||
417 | #define I2C_IER_RXNACKIE (1U << 9) | ||
418 | #define I2C_IER_ARBLOSIE (1U << 8) | ||
419 | #define I2C_IER_GCSIE (1U << 3) | ||
420 | #define I2C_IER_ADRSIE (1U << 2) | ||
421 | #define I2C_IER_STOIE (1U << 1) | ||
422 | #define I2C_IER_STAIE (1U << 0) | ||
423 | #define I2C_SR_TXNRX (1U << 21) | ||
424 | #define I2C_SR_MASTER (1U << 20) | ||
425 | #define I2C_SR_BUSBUSY (1U << 19) | ||
426 | #define I2C_SR_RXBF (1U << 18) | ||
427 | #define I2C_SR_TXDE (1U << 17) | ||
428 | #define I2C_SR_RXDNE (1U << 16) | ||
429 | #define I2C_SR_TOUTF (1U << 11) | ||
430 | #define I2C_SR_BUSERR (1U << 10) | ||
431 | #define I2C_SR_RXNACK (1U << 9) | ||
432 | #define I2C_SR_ARBLOS (1U << 8) | ||
433 | #define I2C_SR_GCS (1U << 3) | ||
434 | #define I2C_SR_ADRS (1U << 2) | ||
435 | #define I2C_SR_STO (1U << 1) | ||
436 | #define I2C_SR_STA (1U << 0) | ||
437 | #define I2C_TAR_RWD (1U << 10) | ||
438 | |||
439 | // SPI | ||
440 | // ///////////////////////////////////////////////////////////////////////////// | ||
441 | typedef struct { | ||
442 | __IO uint32_t CR0; //!< 0x000 Control Register 0 | ||
443 | __IO uint32_t CR1; //!< 0x004 Control Register 1 | ||
444 | __IO uint32_t IER; //!< 0x008 Interrupt Enable Register | ||
445 | __IO uint32_t CPR; //!< 0x00C Clock Prescaler Register | ||
446 | __IO uint32_t DR; //!< 0x010 Data Register | ||
447 | __IO uint32_t SR; //!< 0x014 Status Register | ||
448 | __IO uint32_t FCR; //!< 0x018 FIFO Control Register | ||
449 | __IO uint32_t FSR; //!< 0x01C FIFO Status Register | ||
450 | __IO uint32_t FTOCR; //!< 0x020 FIFO Time Out Counter Register | ||
451 | } SPI_TypeDef; | ||
452 | |||
453 | #define SPI_CR0_GUADTEN (1U << 7) | ||
454 | #define SPI_CR0_DUALEN (1U << 6) | ||
455 | #define SPI_CR0_SSELC (1U << 4) | ||
456 | #define SPI_CR0_SELOEN (1U << 3) | ||
457 | #define SPI_CR0_SPIEN (1U << 0) | ||
458 | #define SPI_CR1_MODE (1U << 14) | ||
459 | #define SPI_CR1_SELM (1U << 13) | ||
460 | #define SPI_CR1_FIRSTBIT (1U << 12) | ||
461 | #define SPI_CR1_SELAP (1U << 11) | ||
462 | #define SPI_CR1_FORMAT_MASK (7U << 8) | ||
463 | #define SPI_CR1_FORMAT_MODE0 (0x1U << 8) | ||
464 | #define SPI_CR1_FORMAT_MODE1 (0x2U << 8) | ||
465 | #define SPI_CR1_FORMAT_MODE2 (0x6U << 8) | ||
466 | #define SPI_CR1_FORMAT_MODE3 (0x5U << 8) | ||
467 | #define SPI_IER_RXBNEIEN (1U << 2) | ||
468 | #define SPI_IER_TXBEIEN (1U << 0) | ||
469 | #define SPI_SR_RXBNE (1U << 2) | ||
470 | #define SPI_SR_TXE (1U << 1) | ||
471 | #define SPI_SR_TXBE (1U << 0) | ||
472 | #define SPI_FCR_FIFOEN (1U << 10) | ||
473 | #define SPI_FSR_TXFS_MASK (0xfU << 0) | ||
474 | #define SPI_FSR_RXFS_MASK (0xfU << 4) | ||
475 | |||
476 | // USART | ||
477 | // UART | ||
478 | // ///////////////////////////////////////////////////////////////////////////// | ||
479 | typedef struct { | ||
480 | union { | ||
481 | __IO uint32_t RBR; //!< 0x000 Receive Buffer Register | ||
482 | __IO uint32_t TBR; //!< 0x000 Transmit Holding Register | ||
483 | __IO uint32_t DR; //!< 0x000 Data Register | ||
484 | }; | ||
485 | __IO uint32_t IER; //!< 0x004 Interrupt Enable Register | ||
486 | __IO uint32_t IIR; //!< 0x008 Interrupt Identification Register/FIFO Control Register | ||
487 | __IO uint32_t FCR; //!< 0x00C FIFO Control Register | ||
488 | __IO uint32_t LCR; //!< 0x010 Line Control Register | ||
489 | // note: only available as USART | ||
490 | __IO uint32_t MODCR; //!< 0x014 Modem Control Register | ||
491 | // end note | ||
492 | __IO uint32_t LSR; //!< 0x018 Line Status Register | ||
493 | // note: only available as USART | ||
494 | __IO uint32_t MODSR; //!< 0x01C Modem Status Register | ||
495 | // end note | ||
496 | __IO uint32_t TPR; //!< 0x020 Timing Parameter Register | ||
497 | __IO uint32_t MDR; //!< 0x024 Mode Register | ||
498 | // note: only available as USART | ||
499 | __IO uint32_t IrDACR; //!< 0x028 IrDA Control Register | ||
500 | __IO uint32_t RS485CR; //!< 0x02C RS485 Control Register | ||
501 | __IO uint32_t SYNCR; //!< 0x030 Synchronous Control Register | ||
502 | // end note | ||
503 | __IO uint32_t FSR; //!< 0x034 FIFO Status Register | ||
504 | __IO uint32_t DLR; //!< 0x038 Divisor Latch Register | ||
505 | uint32_t RESERVED0; //!< 0x03C Reserved | ||
506 | __IO uint32_t DEGTSTR; //!< 0x040 Debug/Test Register | ||
507 | } USART_TypeDef; | ||
508 | |||
509 | #define USART_FCR_FME (1 << 0) | ||
510 | #define USART_FCR_RFR (1 << 1) | ||
511 | #define USART_FCR_TFR (1 << 2) | ||
512 | #define USART_FCR_TFTL_MASK (0x3 << 4) | ||
513 | #define USART_FCR_TFTL_0BYTE (0x0 << 4) | ||
514 | #define USART_FCR_TFTL_2BYTE (0x1 << 4) | ||
515 | #define USART_FCR_TFTL_4BYTE (0x2 << 4) | ||
516 | #define USART_FCR_TFTL_8BYTE (0x3 << 4) | ||
517 | #define USART_FCR_RFTL_MASK (0x3 << 6) | ||
518 | #define USART_FCR_RFTL_1BYTE (0x0 << 6) | ||
519 | #define USART_FCR_RFTL_4BYTE (0x1 << 6) | ||
520 | #define USART_FCR_RFTL_8BYTE (0x2 << 6) | ||
521 | #define USART_FCR_RFTL_14BYTE (0x3 << 6) | ||
522 | #define USART_FCR_URTXEN (1 << 8) | ||
523 | #define USART_FCR_URRXEN (1 << 9) | ||
524 | #define USART_LCR_WLS_MASK (0x3 << 0) | ||
525 | #define USART_LCR_WLS_7BIT (0x0 << 0) | ||
526 | #define USART_LCR_WLS_8BIT (0x1 << 0) | ||
527 | #define USART_LCR_WLS_9BIT (0x2 << 0) | ||
528 | #define USART_LCR_NSB (1 << 2) | ||
529 | #define USART_LCR_PBE (1 << 3) | ||
530 | #define USART_LCR_EPE (1 << 4) | ||
531 | #define USART_LCR_SPE (1 << 5) | ||
532 | #define USART_LCR_BCB (1 << 6) | ||
533 | #define USART_LSR_RFDR (1 << 0) | ||
534 | #define USART_LSR_OEI (1 << 1) | ||
535 | #define USART_LSR_PEI (1 << 2) | ||
536 | #define USART_LSR_FEI (1 << 3) | ||
537 | #define USART_LSR_BII (1 << 4) | ||
538 | #define USART_LSR_TXFEMPT (1 << 5) | ||
539 | #define USART_LSR_TXEMPT (1 << 6) | ||
540 | #define USART_LSR_ERRRX (1 << 7) | ||
541 | #define USART_LSR_RSADDEF (1 << 8) | ||
542 | #define USART_MDR_MODE_MASK (0x3 << 0) | ||
543 | #define USART_MDR_MODE_NORMAL (0x0 << 0) | ||
544 | #define USART_MDR_MODE_IRDA (0x1 << 0) | ||
545 | #define USART_MDR_MODE_RS485 (0x2 << 0) | ||
546 | #define USART_MDR_MODE_SYNCHRONOUS (0x3 << 0) | ||
547 | #define USART_MDR_TRSM (1 << 2) | ||
548 | #define USART_MDR_TXDMAEN (1 << 4) | ||
549 | #define USART_MDR_RXDMAEN (1 << 5) | ||
550 | |||
551 | // Smart Card Interface | ||
552 | // ///////////////////////////////////////////////////////////////////////////// | ||
553 | |||
554 | // USB | ||
555 | // ///////////////////////////////////////////////////////////////////////////// | ||
556 | typedef struct { | ||
557 | __IO uint32_t CSR; //!< 0x000 USB Control and Status Register | ||
558 | __IO uint32_t IER; //!< 0x004 USB Interrupt Enable Register | ||
559 | __IO uint32_t ISR; //!< 0x008 USB Interrupt Status Register | ||
560 | __IO uint32_t FCR; //!< 0x00C USB Frame Count Register | ||
561 | __IO uint32_t DEVAR; //!< 0x010 USB Device Address Register | ||
562 | struct { | ||
563 | __IO uint32_t CSR; //!< 0x014 USB Endpoint n Control and Status Register | ||
564 | __IO uint32_t IER; //!< 0x018 USB Endpoint n Interrupt Enable Register | ||
565 | __IO uint32_t ISR; //!< 0x01C USB Endpoint n Interrupt Status Register | ||
566 | __IO uint32_t TCR; //!< 0x020 USB Endpoint n Transfer Count Register | ||
567 | __IO uint32_t CFGR; //!< 0x024 USB Endpoint n Configuration Register | ||
568 | } EP[8]; | ||
569 | } USB_TypeDef; | ||
570 | |||
571 | // USBCSR | ||
572 | #define USBCSR_FRES (0x002) // Force USB Reset Control | ||
573 | #define USBCSR_PDWN (0x004) // Power Down Mode Control | ||
574 | #define USBCSR_LPMODE (0x008) // Low-Power Mode Control | ||
575 | #define USBCSR_GENRSM (0x020) // Resume Request Generation Control | ||
576 | #define USBCSR_RXDP (0x040) // Received DP Line Status | ||
577 | #define USBCSR_RXDM (0x080) // Received DM Line Status | ||
578 | #define USBCSR_ADRSET (0x100) // Device Address Setting Control | ||
579 | #define USBCSR_SRAMRSTC (0x200) // USB SRAM Reset Condition | ||
580 | #define USBCSR_DPPUEN (0x400) // DP Pull Up Enable | ||
581 | #define USBCSR_DPWKEN (0x800) // DP Wake Up Enable | ||
582 | |||
583 | // USBIER | ||
584 | #define USBIER_UGIE (0x0001) // USB global Interrupt Enable | ||
585 | #define USBIER_SOFIE (0x0002) // Start Of Frame Interrupt Enable | ||
586 | #define USBIER_URSTIE (0x0004) // USB Reset Interrupt Enable | ||
587 | #define USBIER_RSMIE (0x0008) // Resume Interrupt Enable | ||
588 | #define USBIER_SUSPIE (0x0010) // Suspend Interrupt Enable | ||
589 | #define USBIER_ESOFIE (0x0020) // Expected Start Of Frame Enable | ||
590 | #define USBIER_EP0IE (0x0100) // Endpoint 0 Interrupt Enable | ||
591 | #define USBIER_EP1IE (0x0200) // Endpoint 1 Interrupt Enable | ||
592 | #define USBIER_EP2IE (0x0400) // Endpoint 2 Interrupt Enable | ||
593 | #define USBIER_EP3IE (0x0800) // Endpoint 3 Interrupt Enable | ||
594 | #define USBIER_EP4IE (0x1000) // Endpoint 4 Interrupt Enable | ||
595 | #define USBIER_EP5IE (0x2000) // Endpoint 5 Interrupt Enable | ||
596 | #define USBIER_EP6IE (0x4000) // Endpoint 6 Interrupt Enable | ||
597 | #define USBIER_EP7IE (0x8000) // Endpoint 7 Interrupt Enable | ||
598 | |||
599 | // USBISR | ||
600 | #define USBISR_SOFIF (0x0002) // Start Of Frame Interrupt Flag | ||
601 | #define USBISR_URSTIF (0x0004) // USB Reset Interrupt Flag | ||
602 | #define USBISR_RSMIF (0x0008) // Resume Interrupt Flag | ||
603 | #define USBISR_SUSPIF (0x0010) // Suspend Interrupt Flag | ||
604 | #define USBISR_ESOFIF (0x0020) // Expected Start Of Frame Interrupt | ||
605 | #define USBISR_EP0IF (1U << 8) // Endpoint 0 Interrupt Flag | ||
606 | #define USBISR_EP1IF (1U << 9) // Endpoint 1 Interrupt Flag | ||
607 | #define USBISR_EP2IF (1U << 10) // Endpoint 2 Interrupt Flag | ||
608 | #define USBISR_EP3IF (1U << 11) // Endpoint 3 Interrupt Flag | ||
609 | #define USBISR_EP4IF (1U << 12) // Endpoint 4 Interrupt Flag | ||
610 | #define USBISR_EP5IF (1U << 13) // Endpoint 5 Interrupt Flag | ||
611 | #define USBISR_EP6IF (1U << 14) // Endpoint 6 Interrupt Flag | ||
612 | #define USBISR_EP7IF (1U << 15) // Endpoint 7 Interrupt Flag | ||
613 | #define USBISR_EPnIF (0xFF00) // Endpoint Interrupt Mask | ||
614 | |||
615 | // USBFCR | ||
616 | #define USBFCR_FRNUM (0x7FF) // Frame Number | ||
617 | #define USBFCR_SOFLCK (1U << 16) // Start-of-Frame Lock Flag | ||
618 | #define USBFCR_LSOF (0x3U << 17) // Lost Start-of-Frame Number | ||
619 | |||
620 | // USBEPnCSR | ||
621 | #define USBEPnCSR_DTGTX (0x01) // Data Toggle Status, for IN transfer | ||
622 | #define USBEPnCSR_NAKTX (0x02) // NAK Status, for IN transfer | ||
623 | #define USBEPnCSR_STLTX (0x04) // STALL Status, for IN transfer | ||
624 | #define USBEPnCSR_DTGRX (0x08) // Data Toggle Status, for OUT transfer | ||
625 | #define USBEPnCSR_NAKRX (0x10) // NAK Status, for OUT transfer | ||
626 | #define USBEPnCSR_STLRX (0x20) // STALL Status, for OUT transfer | ||
627 | |||
628 | // USBEPnIER | ||
629 | #define USBEPnIER_OTRXIE (0x001) // OUT Token Received Interrupt Enable | ||
630 | #define USBEPnIER_ODRXIE (0x002) // OUT Data Received Interrupt Enable | ||
631 | #define USBEPnIER_ODOVIE (0x004) // OUT Data Buffer Overrun Interrupt Enable | ||
632 | #define USBEPnIER_ITRXIE (0x008) // IN Token Received Interrupt Enable | ||
633 | #define USBEPnIER_IDTXIE (0x010) // IN Data Transmitted Interrupt Enable | ||
634 | #define USBEPnIER_NAKIE (0x020) // NAK Transmitted Interrupt Enable | ||
635 | #define USBEPnIER_STLIE (0x040) // STALL Transmitted Interrupt Enable | ||
636 | #define USBEPnIER_UERIE (0x080) // USB Error Interrupt Enable | ||
637 | #define USBEPnIER_STRXIE (0x100) // SETUP Token Received Interrupt Enable | ||
638 | #define USBEPnIER_SDRXIE (0x200) // SETUP Data Received Interrupt Enable | ||
639 | #define USBEPnIER_SDERIE (0x400) // SETUP Data Error Interrupt Enable | ||
640 | #define USBEPnIER_ZLRXIE (0x800) // Zero Length Data Received Interrupt Enable | ||
641 | |||
642 | // USBEPnISR | ||
643 | #define USBEPnISR_OTRXIF (0x001) // OUT Token Received Interrupt Flag | ||
644 | #define USBEPnISR_ODRXIF (0x002) // OUT Data Received Interrupt Flag | ||
645 | #define USBEPnISR_ODOVIF (0x004) // OUT Data Buffer Overrun Interrupt Flag | ||
646 | #define USBEPnISR_ITRXIF (0x008) // IN Token Received Interrupt Flag | ||
647 | #define USBEPnISR_IDTXIF (0x010) // IN Data Transmitted Interrupt Flag | ||
648 | #define USBEPnISR_NAKIF (0x020) // NAK Transmitted Interrupt Flag | ||
649 | #define USBEPnISR_STLIF (0x040) // STALL Transmitted Interrupt Flag | ||
650 | #define USBEPnISR_UERIF (0x080) // USB Error Interrupt Flag | ||
651 | #define USBEPnISR_STRXIF (0x100) // SETUP Token Received Interrupt Flag | ||
652 | #define USBEPnISR_SDRXIF (0x200) // SETUP Data Received Interrupt Flag | ||
653 | #define USBEPnISR_SDERIF (0x400) // SETUP Data Error Interrupt Flag | ||
654 | #define USBEPnISR_ZLRXIF (0x800) // Zero Length Data Received Interrupt Flag | ||
655 | |||
656 | // USBEPnTCR | ||
657 | #define USBEPnTCR_TCNT (0x1FF) // Transfer Byte Count | ||
658 | |||
659 | // USBEPnCFGR | ||
660 | #define USBEPnCFGR_EPEN (1U << 31) // Endpoint Enable | ||
661 | #define USBEPnCFGR_EPTYPE (1U << 29) // Transfer Type | ||
662 | #define USBEPnCFGR_EPDIR (1U << 28) // Transfer Direction | ||
663 | #define USBEPnCFGR_EPADR (0xFU << 24) // Endpoint Address | ||
664 | #define USBEPnCFGR_EPLEN (0x7FU << 10) // Buffer Length | ||
665 | #define USBEPnCFGR_EPBUFA (0x3FF) // Endpoint Buffer Address | ||
666 | |||
667 | // Peripheral Direct Memory Access | ||
668 | // ///////////////////////////////////////////////////////////////////////////// | ||
669 | |||
670 | // Extend Bus Interface | ||
671 | // ///////////////////////////////////////////////////////////////////////////// | ||
672 | |||
673 | // Inter-IC Sound | ||
674 | // ///////////////////////////////////////////////////////////////////////////// | ||
675 | |||
676 | // CRC | ||
677 | // ///////////////////////////////////////////////////////////////////////////// | ||
678 | |||
679 | #endif // HT32F165x_REG_H | ||
diff --git a/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F523xx/ht32f523x2.h b/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F523xx/ht32f523x2.h new file mode 100644 index 000000000..ba4871636 --- /dev/null +++ b/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F523xx/ht32f523x2.h | |||
@@ -0,0 +1,199 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2020 Codetector <[email protected]> | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining | ||
5 | * a copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
20 | * SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | #pragma once | ||
24 | |||
25 | #if defined(HT32F52342) || defined(HT32F52352) | ||
26 | #define HT32F523x2 | ||
27 | #else | ||
28 | #error "Unknown HT32 device" | ||
29 | #endif | ||
30 | |||
31 | #if defined(HT32F523x2) | ||
32 | #define HT32 | ||
33 | #endif | ||
34 | |||
35 | /* | ||
36 | * ============================================================== | ||
37 | * ---------- Interrupt Number Definition ----------------------- | ||
38 | * ============================================================== | ||
39 | */ | ||
40 | typedef enum IRQn | ||
41 | { | ||
42 | /****** Cortex-M3 Processor Exceptions Numbers ****************/ | ||
43 | InitialSP_IRQn = -16, | ||
44 | InitialPC_IRQn = -15, | ||
45 | NonMaskableInt_IRQn = -14, | ||
46 | HardFault_IRQn = -13, | ||
47 | SVCall_IRQn = -5, | ||
48 | PendSV_IRQn = -2, | ||
49 | SysTick_IRQn = -1, | ||
50 | |||
51 | /****** HT32F165x Specific Interrupt Numbers ***********************/ | ||
52 | LVD_IRQn = 0, | ||
53 | RTC_IRQn = 1, | ||
54 | FMC_IRQn = 2, | ||
55 | WKUP_IRQn = 3, | ||
56 | EXTI0_1_IRQn = 4, | ||
57 | EXTI2_3_IRQn = 5, | ||
58 | EXTI4_15_IRQn = 6, | ||
59 | CMP_IRQn = 7, | ||
60 | ADC_IRQn = 8, | ||
61 | |||
62 | MCTM_IRQn = 10, | ||
63 | GPTM1_IRQn = 11, | ||
64 | GPTM0_IRQn = 12, | ||
65 | SCTM0_IRQn = 13, | ||
66 | SCTM1_IRQn = 14, | ||
67 | |||
68 | BFTM0_IRQn = 17, | ||
69 | BFTM1_IRQn = 18, | ||
70 | I2C0_IRQn = 19, | ||
71 | I2C1_IRQn = 20, | ||
72 | SPI0_IRQn = 21, | ||
73 | SPI1_IRQn = 22, | ||
74 | USART0_IRQn = 23, | ||
75 | USART1_IRQn = 24, | ||
76 | UART0_IRQn = 25, | ||
77 | UART1_IRQn = 26, | ||
78 | SCI_IRQn = 27, | ||
79 | I2S_IRQn = 28, | ||
80 | USB_IRQn = 29, | ||
81 | PDMA_CH0_1_IRQn = 30, | ||
82 | PDMA_CH2_5_IRQn = 31 | ||
83 | } IRQn_Type; | ||
84 | |||
85 | /* | ||
86 | * ========================================================================== | ||
87 | * ----------- Processor and Core Peripheral Section ------------------------ | ||
88 | * ========================================================================== | ||
89 | */ | ||
90 | |||
91 | /** | ||
92 | * @brief HT32F165x Interrupt Number Definition, according to the selected device | ||
93 | * in @ref Library_configuration_section | ||
94 | */ | ||
95 | #define __FPU_PRESENT 0 | ||
96 | #define __MPU_PRESENT 0 | ||
97 | #define __NVIC_PRIO_BITS 8 | ||
98 | #define __Vendor_SysTickConfig 0 | ||
99 | |||
100 | #include "core_cm0plus.h" /* Cortex-M0+ processor and core peripherals */ | ||
101 | |||
102 | /****************************************************************/ | ||
103 | /* Peripheral memory map */ | ||
104 | /****************************************************************/ | ||
105 | #define USART0_BASE ((uint32_t)0x40000000) | ||
106 | #define UART0_BASE ((uint32_t)0x40001000) | ||
107 | #define SPI0_BASE ((uint32_t)0x40004000) | ||
108 | #define ADC_BASE ((uint32_t)0x40010000) | ||
109 | |||
110 | #define AFIO_BASE ((uint32_t)0x40022000) | ||
111 | #define EXTI_BASE ((uint32_t)0x40024000) | ||
112 | #define I2S_BASE ((uint32_t)0x40026000) | ||
113 | #define MCTM0_BASE ((uint32_t)0x4002C000) | ||
114 | #define MCTM1_BASE ((uint32_t)0x4002D000) | ||
115 | |||
116 | #define USART1_BASE ((uint32_t)0x40040000) | ||
117 | #define UART1_BASE ((uint32_t)0x40041000) | ||
118 | #define SCI_BASE ((uint32_t)0x40043000) | ||
119 | #define SPI1_BASE ((uint32_t)0x40044000) | ||
120 | #define I2C0_BASE ((uint32_t)0x40048000) | ||
121 | #define I2C1_BASE ((uint32_t)0x40049000) | ||
122 | |||
123 | #define CMP0_BASE ((uint32_t)0x40058000) | ||
124 | #define CMP1_BASE ((uint32_t)0x40058100) | ||
125 | |||
126 | #define WDT_BASE ((uint32_t)0x40068000) | ||
127 | #define RTC_BASE ((uint32_t)0x4006A000) | ||
128 | #define PWRCU_BASE ((uint32_t)0x4006A000) | ||
129 | #define GPTM0_BASE ((uint32_t)0x4006E000) | ||
130 | #define GPTM1_BASE ((uint32_t)0x4006F000) | ||
131 | #define BFTM0_BASE ((uint32_t)0x40076000) | ||
132 | #define BFTM1_BASE ((uint32_t)0x40077000) | ||
133 | |||
134 | #define FMC_BASE ((uint32_t)0x40080000) | ||
135 | #define CKCU_BASE ((uint32_t)0x40088000) | ||
136 | #define RSTCU_BASE ((uint32_t)0x40088000) | ||
137 | #define CRC_BASE ((uint32_t)0x4008A000) | ||
138 | #define PDMA_BASE ((uint32_t)0x40090000) | ||
139 | #define EBI_BASE ((uint32_t)0x40098000) | ||
140 | #define USB_BASE ((uint32_t)0x400A8000) | ||
141 | #define USB_SRAM_BASE ((uint32_t)0x400AA000) | ||
142 | #define GPIO_A_BASE ((uint32_t)0x400B0000) | ||
143 | #define GPIO_B_BASE ((uint32_t)0x400B2000) | ||
144 | #define GPIO_C_BASE ((uint32_t)0x400B4000) | ||
145 | #define GPIO_D_BASE ((uint32_t)0x400B6000) | ||
146 | |||
147 | |||
148 | // Registers Headers | ||
149 | #include "ht32f523x2_reg.h" | ||
150 | |||
151 | /****************************************************************/ | ||
152 | /* Peripheral declaration */ | ||
153 | /****************************************************************/ | ||
154 | #define USART0 ((USART_TypeDef *) USART0_BASE) | ||
155 | #define UART0 ((USART_TypeDef *) UART0_BASE) | ||
156 | #define SPI0 ((SPI_TypeDef *) SPI0_BASE) | ||
157 | #define ADC ((ADC_TypeDef *) ADC_BASE) | ||
158 | |||
159 | #define AFIO ((AFIO_TypeDef *) AFIO_BASE) | ||
160 | #define EXTI ((EXTI_TypeDef *) EXTI_BASE) | ||
161 | #define I2S ((I2S_TypeDef *) I2S_BASE) | ||
162 | #define MCTM0 ((TM_TypeDef *) MCTM0_BASE) | ||
163 | #define MCTM1 ((TM_TypeDef *) MCTM1_BASE) | ||
164 | |||
165 | #define USART1 ((USART_TypeDef *) USART1_BASE) | ||
166 | #define UART1 ((USART_TypeDef *) UART1_BASE) | ||
167 | #define SCI ((SCI_TypeDef *) SCI_BASE) | ||
168 | #define SPI1 ((SPI_TypeDef *) SPI1_BASE) | ||
169 | #define I2C0 ((I2C_TypeDef *) I2C0_BASE) | ||
170 | #define I2C1 ((I2C_TypeDef *) I2C1_BASE) | ||
171 | |||
172 | #define CMP0 ((CMP_TypeDef *) CMP0_BASE) | ||
173 | #define CMP1 ((CMP_TypeDef *) CMP1_BASE) | ||
174 | |||
175 | #define WDT ((WDT_TypeDef *) WDT_BASE) | ||
176 | #define RTC ((RTC_TypeDef *) RTC_BASE) | ||
177 | #define PWRCU ((PWRCU_TypeDef *) PWRCU_BASE) | ||
178 | #define GPTM0 ((TM_TypeDef *) GPTM0_BASE) | ||
179 | #define GPTM1 ((TM_TypeDef *) GPTM1_BASE) | ||
180 | #define BFTM0 ((BFTM_TypeDef *) BFTM0_BASE) | ||
181 | #define BFTM1 ((BFTM_TypeDef *) BFTM1_BASE) | ||
182 | |||
183 | #define FMC ((FMC_TypeDef *) FMC_BASE) | ||
184 | #define CKCU ((CKCU_TypeDef *) CKCU_BASE) | ||
185 | #define RSTCU ((RSTCU_TypeDef *) RSTCU_BASE) | ||
186 | #define CRC ((CRC_TypeDef *) CRC_BASE) | ||
187 | #define PDMA ((PDMA_TypeDef *) PDMA_BASE) | ||
188 | #define EBI ((EBI_TypeDef *) EBI_BASE) | ||
189 | #define USB ((USB_TypeDef *) USB_BASE) | ||
190 | |||
191 | #define GPIOA ((GPIO_TypeDef *) GPIO_A_BASE) | ||
192 | #define GPIO_A GPIOA | ||
193 | #define GPIOB ((GPIO_TypeDef *) GPIO_B_BASE) | ||
194 | #define GPIO_B GPIOB | ||
195 | #define GPIOC ((GPIO_TypeDef *) GPIO_C_BASE) | ||
196 | #define GPIO_C GPIOC | ||
197 | #define GPIOD ((GPIO_TypeDef *) GPIO_D_BASE) | ||
198 | #define GPIO_D GPIOD | ||
199 | |||
diff --git a/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F523xx/ht32f523x2_reg.h b/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F523xx/ht32f523x2_reg.h new file mode 100644 index 000000000..d8aad785d --- /dev/null +++ b/lib/chibios-contrib/os/common/ext/CMSIS/HT32/HT32F523xx/ht32f523x2_reg.h | |||
@@ -0,0 +1,657 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #ifndef __IO | ||
4 | #define __IO volatile | ||
5 | #endif | ||
6 | |||
7 | // Constants | ||
8 | // ///////////////////////////////////////////////////////////////////////////// | ||
9 | #define AFIO_DEFAULT 0 | ||
10 | #define AFIO_GPIO 1 | ||
11 | #define AFIO_ADC 2 | ||
12 | #define AFIO_CMP 3 | ||
13 | #define AFIO_TM 4 | ||
14 | #define AFIO_SPI 5 | ||
15 | #define AFIO_USART 6 | ||
16 | #define AFIO_I2C 7 | ||
17 | #define AFIO_SMC 8 | ||
18 | #define AFIO_EBI 9 | ||
19 | #define AFIO_I2S 10 | ||
20 | #define AFIO_OTHER 15 | ||
21 | |||
22 | // Flash Memory Controller | ||
23 | // ///////////////////////////////////////////////////////////////////////////// | ||
24 | typedef struct { | ||
25 | __IO uint32_t TADR; //!< 0x000 Flash Target Address Register | ||
26 | __IO uint32_t WRDR; //!< 0x004 Flash Write Data Register | ||
27 | uint32_t RESERVED0[1]; //!< 0x008 Reserved | ||
28 | __IO uint32_t OCMR; //!< 0x00C Flash Operation Command Register | ||
29 | __IO uint32_t OPCR; //!< 0x010 Flash Operation Control Register | ||
30 | __IO uint32_t OIER; //!< 0x014 Flash Operation Interrupt Enable Register | ||
31 | __IO uint32_t OISR; //!< 0x018 Flash Operation Interrupt and Status Register | ||
32 | uint32_t RESERVED1[1]; //!< 0x01C Reserved | ||
33 | __IO uint32_t PPSR[4]; //!< 0x020 ~ 0x02C Flash Page Erase/Program Protection Status Register | ||
34 | __IO uint32_t CPSR; //!< 0x030 Flash Security Protection Status Register | ||
35 | uint32_t RESERVED2[51]; //!< 0x034 ~ 0x0FC Reserved | ||
36 | __IO uint32_t VMCR; //!< 0x100 Flash Vector Mapping Control Register | ||
37 | uint32_t RESERVED3[31]; //!< 0x104 ~ 0x17C Reserved | ||
38 | __IO uint32_t MDID; //!< 0x180 Manufacturer and Device ID Register | ||
39 | __IO uint32_t PNSR; //!< 0x184 Flash Page Number Status Register | ||
40 | __IO uint32_t PSSR; //!< 0x188 Flash Page Size Status Register | ||
41 | #if defined(HT32F165x) | ||
42 | uint32_t RESERVED4[29]; //!< 0x18C ~ 0x1FC Reserved | ||
43 | #else | ||
44 | __IO uint32_t DID; //!< 0x18C Device ID Register | ||
45 | uint32_t RESERVED4[28]; //!< 0x190 ~ 0x1FC Reserved | ||
46 | #endif | ||
47 | __IO uint32_t CFCR; //!< 0x200 Flash Cache and Pre-fetch Control Register | ||
48 | uint32_t RESERVED5[63]; //!< 0x204 ~ 0x2FC Reserved | ||
49 | __IO uint32_t SBVT[4]; //!< 0x300 ~ 0x30C SRAM Booting Vector (4x32Bit) | ||
50 | #if defined(HT32F165x) | ||
51 | #else | ||
52 | __IO uint32_t CID[4]; //!< 0x310 ~ 0x31C Custom ID Register | ||
53 | #endif | ||
54 | } FMC_TypeDef; | ||
55 | |||
56 | #define FMC_OCMR_CMD_MASK (0xF << 0) | ||
57 | #define FMC_OCMR_CMD_IDLE (0x0 << 0) | ||
58 | #define FMC_OCMR_CMD_WORD_PROGRAM (0x4 << 0) | ||
59 | #define FMC_OCMR_CMD_PAGE_ERASE (0x8 << 0) | ||
60 | #define FMC_OCMR_CMD_MASS_ERASE (0xA << 0) | ||
61 | #define FMC_OPCR_OPM_MASK (0xF << 1) | ||
62 | #define FMC_OPCR_OPM_IDLE (0x6 << 1) | ||
63 | #define FMC_OPCR_OPM_COMMIT (0xA << 1) | ||
64 | #define FMC_OPCR_OPM_FINISHED (0xE << 1) | ||
65 | #define FMC_CFCR_CE (1U << 12) | ||
66 | #define FMC_CFCR_WAIT_MASK (7U << 0) | ||
67 | #define FMC_CFCR_WAIT_0 (1U) | ||
68 | #define FMC_CFCR_WAIT_1 (2U) | ||
69 | |||
70 | // Power Control Unit | ||
71 | // ///////////////////////////////////////////////////////////////////////////// | ||
72 | typedef struct { | ||
73 | uint32_t RESERVE0[64]; | ||
74 | __IO uint32_t BAKSR; //!< 0x000 Status Register | ||
75 | __IO uint32_t BAKCR; //!< 0x004 Control Register | ||
76 | __IO uint32_t BAKTEST; //!< 0x008 Test Register | ||
77 | __IO uint32_t HSIRCR; //!< 0x00C HSI Ready Counter Control Register | ||
78 | __IO uint32_t LVDCSR; //!< 0x010 Low Voltage/Brown Out Detect Control and Status Register | ||
79 | uint32_t RESERVE1[59]; //!< 0x014 ~ 0x0FC Reserved | ||
80 | __IO uint32_t BAKREG[10]; //!< 0x100 ~ 0x124 Backup Register 0 ~ 9 | ||
81 | } PWRCU_TypeDef; | ||
82 | |||
83 | // Clock Control Unit | ||
84 | // ///////////////////////////////////////////////////////////////////////////// | ||
85 | typedef struct { | ||
86 | __IO uint32_t GCFGR; //!< 0x000 Global Clock Configuration Register | ||
87 | __IO uint32_t GCCR; //!< 0x004 Global Clock Control Register | ||
88 | __IO uint32_t GCSR; //!< 0x008 Global Clock Status Register | ||
89 | __IO uint32_t GCIR; //!< 0x00C Global Clock Interrupt Register | ||
90 | uint32_t RESERVED0[2]; //!< 0x010 ~ 0x014 Reserved | ||
91 | __IO uint32_t PLLCFGR; //!< 0x018 PLL Configuration Register | ||
92 | __IO uint32_t PLLCR; //!< 0x01C PLL Control Register | ||
93 | __IO uint32_t AHBCFGR; //!< 0x020 AHB Configuration Register | ||
94 | __IO uint32_t AHBCCR; //!< 0x024 AHB Clock Control Register | ||
95 | __IO uint32_t APBCFGR; //!< 0x028 APB Configuration Register | ||
96 | __IO uint32_t APBCCR0; //!< 0x02C APB Clock Control Register 0 | ||
97 | __IO uint32_t APBCCR1; //!< 0x030 APB Clock Control Register 1 | ||
98 | __IO uint32_t CKST; //!< 0x034 Clock source status Register | ||
99 | |||
100 | __IO uint32_t APBPCSR0; //!< 0x038 APB Peripheral Clock Selection Register 0 | ||
101 | __IO uint32_t APBPCSR1; //!< 0x03C APB Peripheral Clock Selection Register 1 | ||
102 | __IO uint32_t HSICR; //!< 0x040 HSI Control Register | ||
103 | __IO uint32_t HSIATCR; //!< 0x044 HSI Auto Trimming Counter Register | ||
104 | |||
105 | uint32_t RESERVED2[174]; //!< 0x048 ~ 0x2FC Reserved | ||
106 | __IO uint32_t LPCR; //!< 0x300 Low Power Control Register | ||
107 | __IO uint32_t MCUDBGCR; //!< 0x304 MCU Debug Control Register | ||
108 | } CKCU_TypeDef; | ||
109 | |||
110 | #define CKCU_GCFGR_LPMOD_MASK (7U << 29) | ||
111 | #define CKCU_GCFGR_USBPRE_MASK (3U << 22) | ||
112 | #define CKCU_GCFGR_PLLSRC (1U << 8) | ||
113 | #define CKCU_GCFGR_CKOUTSRC_MASK (7U << 0) | ||
114 | #define CKCU_GCFGR_CKOUTSRC_CK_REF (0U << 0) | ||
115 | #define CKCU_GCFGR_CKOUTSRC_CK_AHB (1U << 0) | ||
116 | #define CKCU_GCFGR_CKOUTSRC_CK_SYS (2U << 0) | ||
117 | #define CKCU_GCFGR_CKOUTSRC_CK_HSE (3U << 0) | ||
118 | #define CKCU_GCFGR_CKOUTSRC_CK_HSI (4U << 0) | ||
119 | #define CKCU_GCFGR_CKOUTSRC_CK_LSE (5U << 0) | ||
120 | #define CKCU_GCFGR_CKOUTSRC_CK_LSI (6U << 0) | ||
121 | #define CKCU_GCCR_PSRCEN (1U << 17) | ||
122 | #define CKCU_GCCR_CKMEN (1U << 16) | ||
123 | #define CKCU_GCCR_HSIEN (1U << 11) | ||
124 | #define CKCU_GCCR_HSEEN (1U << 10) | ||
125 | #define CKCU_GCCR_PLLEN (1U << 9) | ||
126 | #define CKCU_GCCR_SW_MASK (3U << 0) | ||
127 | #define CKCU_GCCR_SW_PLL (1U << 0) | ||
128 | #define CKCU_GCCR_SW_HSE (2U << 0) | ||
129 | #define CKCU_GCCR_SW_HSI (3U << 0) | ||
130 | #define CKCU_GCSR_LSIRDY (1U << 5) | ||
131 | #define CKCU_GCSR_LSERDY (1U << 4) | ||
132 | #define CKCU_GCSR_HSIRDY (1U << 3) | ||
133 | #define CKCU_GCSR_HSERDY (1U << 2) | ||
134 | #define CKCU_GCSR_PLLRDY (1U << 1) | ||
135 | #define CKCU_PLLCFGR_PFBD_MASK (0x3fU << 23) | ||
136 | #define CKCU_PLLCFGR_POTD_MASK (3U << 21) | ||
137 | #define CKCU_PLLCR_PLLBPS (1U << 31) | ||
138 | #define CKCU_AHBCFGR_AHBPRE_MASK (3U << 0) | ||
139 | #define CKCU_AHBCCR_PAEN (1U << 16) | ||
140 | #define CKCU_AHBCCR_CRCEN (1U << 13) | ||
141 | #define CKCU_AHBCCR_EBIEN (1U << 12) | ||
142 | #define CKCU_AHBCCR_CKREFEN (1U << 11) | ||
143 | #define CKCU_AHBCCR_USBEN (1U << 10) | ||
144 | #define CKCU_APBCFGR_ADCDIV_MASK (7U << 16) | ||
145 | #define CKCU_APBCCR0_I2SEN (1U << 25) | ||
146 | #define CKCU_APBCCR0_SCIEN (1U << 24) | ||
147 | #define CKCU_APBCCR0_EXTIEN (1U << 15) | ||
148 | #define CKCU_APBCCR0_AFIOEN (1U << 14) | ||
149 | #define CKCU_APBCCR0_UR1EN (1U << 11) | ||
150 | #define CKCU_APBCCR0_UR0EN (1U << 10) | ||
151 | #define CKCU_APBCCR0_USR1EN (1U << 9) | ||
152 | #define CKCU_APBCCR0_USR0EN (1U << 8) | ||
153 | #define CKCU_APBCCR0_SPI1EN (1U << 5) | ||
154 | #define CKCU_APBCCR0_SPI0EN (1U << 4) | ||
155 | #define CKCU_APBCCR0_I2C1EN (1U << 1) | ||
156 | #define CKCU_APBCCR0_I2C0EN (1U << 0) | ||
157 | #define CKCU_APBCCR1_ADCEN (1U << 24) | ||
158 | #define CKCU_APBCCR1_OPA1EN (1U << 23) | ||
159 | #define CKCU_APBCCR1_OPA0EN (1U << 22) | ||
160 | #define CKCU_APBCCR1_BFTM1EN (1U << 17) | ||
161 | #define CKCU_APBCCR1_BFTM0EN (1U << 16) | ||
162 | #define CKCU_APBCCR1_GPTM1EN (1U << 9) | ||
163 | #define CKCU_APBCCR1_GPTM0EN (1U << 8) | ||
164 | #define CKCU_APBCCR1_BKPREN (1U << 6) | ||
165 | #define CKCU_APBCCR1_WDTREN (1U << 4) | ||
166 | #define CKCU_APBCCR1_MCTM1EN (1U << 1) | ||
167 | #define CKCU_APBCCR1_MCTM0EN (1U << 0) | ||
168 | #define CKCU_CKST_CKSWST_MASK (3U << 30) | ||
169 | #define CKCU_CKST_HSIST_MASK (7U << 24) | ||
170 | #define CKCU_CKST_HSEST_MASK (3U << 16) | ||
171 | #define CKCU_CKST_PLLST_MASK (0xfU << 8) | ||
172 | #define CKCU_LPCR_USBSLEEP (1U << 8) | ||
173 | #define CKCU_LPCR_BKISO (1U << 0) | ||
174 | |||
175 | // Reset Control Unit | ||
176 | // ///////////////////////////////////////////////////////////////////////////// | ||
177 | typedef struct { | ||
178 | __IO uint32_t GRSR; //!< 0x000 Global Reset Status Register | ||
179 | __IO uint32_t AHBPRSTR; //!< 0x004 AHB Peripheral Reset Register | ||
180 | __IO uint32_t APBPRSTR0; //!< 0x008 APB Peripheral Reset Register 0 | ||
181 | __IO uint32_t APBPRSTR1; //!< 0x00C APB Peripheral Reset Register 1 | ||
182 | } RSTCU_TypeDef; | ||
183 | |||
184 | #define RSTCU_GRSR_PORSTF (1U << 3) | ||
185 | #define RSTCU_GRSR_WDTRSTF (1U << 2) | ||
186 | #define RSTCU_GRSR_EXTRSTF (1U << 1) | ||
187 | #define RSTCU_GRSR_SYSRSTF (1U << 0) | ||
188 | #define RSTCU_AHBPRSTR_PxRST(n) ((1U << 8) << (n)) | ||
189 | #define RSTCU_AHBPRSTR_CRCRST (1U << 7) | ||
190 | #define RSTCU_AHBPRSTR_EBIRST (1U << 6) | ||
191 | #define RSTCU_AHBPRSTR_USBRST (1U << 5) | ||
192 | #define RSTCU_AHBPRSTR_DMARST (1U << 0) | ||
193 | #define RSTCU_APBPRSTR0_I2SRST (1U << 25) | ||
194 | #define RSTCU_APBPRSTR0_SCIRST (1U << 24) | ||
195 | #define RSTCU_APBPRSTR0_EXTIRST (1U << 15) | ||
196 | #define RSTCU_APBPRSTR0_AFIORST (1U << 14) | ||
197 | #define RSTCU_APBPRSTR0_UR1RST (1U << 11) | ||
198 | #define RSTCU_APBPRSTR0_UR0RST (1U << 10) | ||
199 | #define RSTCU_APBPRSTR0_USR1RST (1U << 9) | ||
200 | #define RSTCU_APBPRSTR0_USR0RST (1U << 8) | ||
201 | #define RSTCU_APBPRSTR0_SPI1RST (1U << 5) | ||
202 | #define RSTCU_APBPRSTR0_SPI0RST (1U << 4) | ||
203 | #define RSTCU_APBPRSTR0_I2C1RST (1U << 1) | ||
204 | #define RSTCU_APBPRSTR0_I2C0RST (1U << 0) | ||
205 | #define RSTCU_APBPRSTR1_ADCRST (1U << 24) | ||
206 | #define RSTCU_APBPRSTR1_OPA1RST (1U << 23) | ||
207 | #define RSTCU_APBPRSTR1_OPA0RST (1U << 22) | ||
208 | #define RSTCU_APBPRSTR1_BFTM1RST (1U << 17) | ||
209 | #define RSTCU_APBPRSTR1_BFTM0RST (1U << 16) | ||
210 | #define RSTCU_APBPRSTR1_GPTM1RST (1U << 9) | ||
211 | #define RSTCU_APBPRSTR1_GPTM0RST (1U << 8) | ||
212 | #define RSTCU_APBPRSTR1_WDTRST (1U << 4) | ||
213 | #define RSTCU_APBPRSTR1_MCTM1RST (1U << 1) | ||
214 | #define RSTCU_APBPRSTR1_MCTM0RST (1U << 0) | ||
215 | |||
216 | // General Purpose I/O | ||
217 | // ///////////////////////////////////////////////////////////////////////////// | ||
218 | typedef struct { | ||
219 | __IO uint32_t DIRCR; //!< 0x000 Data Direction Control Register | ||
220 | __IO uint32_t INER; //!< 0x004 Input function enable register | ||
221 | __IO uint32_t PUR; //!< 0x008 Pull-Up Selection Register | ||
222 | __IO uint32_t PDR; //!< 0x00C Pull-Down Selection Register | ||
223 | __IO uint32_t ODR; //!< 0x010 Open Drain Selection Register | ||
224 | __IO uint32_t DRVR; //!< 0x014 Drive Current Selection Register | ||
225 | __IO uint32_t LOCKR; //!< 0x018 Lock Register | ||
226 | __IO uint32_t DINR; //!< 0x01c Data Input Register | ||
227 | __IO uint32_t DOUTR; //!< 0x020 Data Output Register | ||
228 | __IO uint32_t SRR; //!< 0x024 Output Set and Reset Control Register | ||
229 | __IO uint32_t RR; //!< 0x028 Output Reset Control Register | ||
230 | } GPIO_TypeDef; | ||
231 | |||
232 | // Alternate Function Input/Output | ||
233 | // ///////////////////////////////////////////////////////////////////////////// | ||
234 | typedef struct { | ||
235 | __IO uint32_t ESSR[2]; //!< 0x000 ~ 0x004 EXTI Source Selection Register 0 ~ 1 | ||
236 | uint32_t RESERVE0[6]; //!< 0x008 ~ 0x01C Reserved | ||
237 | union { | ||
238 | struct { | ||
239 | __IO uint32_t GPACFGR[2]; //!< 0x020 ~ 0x024 GPIO Port A Configuration Register 0 ~ 1 | ||
240 | __IO uint32_t GPBCFGR[2]; //!< 0x028 ~ 0x02C GPIO Port B Configuration Register 0 ~ 1 | ||
241 | __IO uint32_t GPCCFGR[2]; //!< 0x030 ~ 0x034 GPIO Port C Configuration Register 0 ~ 1 | ||
242 | __IO uint32_t GPDCFGR[2]; //!< 0x038 ~ 0x03C GPIO Port D Configuration Register 0 ~ 1 | ||
243 | }; | ||
244 | // alternate mapping | ||
245 | struct { | ||
246 | __IO uint32_t GPxCFGR[0][2]; //!< 0x020 ~ 0x03C GPIO Port x Configuration Register 0 ~ 1 | ||
247 | }; | ||
248 | }; | ||
249 | } AFIO_TypeDef; | ||
250 | |||
251 | // Nested Vectored Interrupt Controller | ||
252 | // ///////////////////////////////////////////////////////////////////////////// | ||
253 | // Implemented in Cortex-M3 Headers | ||
254 | |||
255 | // External Interrupt/Event Controller | ||
256 | // ///////////////////////////////////////////////////////////////////////////// | ||
257 | typedef struct { | ||
258 | __IO uint32_t CFGR0; //!< 0x000 EXTI Interrupt 0 Configuration Register | ||
259 | __IO uint32_t CFGR1; //!< 0x004 EXTI Interrupt 1 Configuration Register | ||
260 | __IO uint32_t CFGR2; //!< 0x008 EXTI Interrupt 2 Configuration Register | ||
261 | __IO uint32_t CFGR3; //!< 0x00C EXTI Interrupt 3 Configuration Register | ||
262 | __IO uint32_t CFGR4; //!< 0x010 EXTI Interrupt 4 Configuration Register | ||
263 | __IO uint32_t CFGR5; //!< 0x014 EXTI Interrupt 5 Configuration Register | ||
264 | __IO uint32_t CFGR6; //!< 0x018 EXTI Interrupt 6 Configuration Register | ||
265 | __IO uint32_t CFGR7; //!< 0x01C EXTI Interrupt 7 Configuration Register | ||
266 | __IO uint32_t CFGR8; //!< 0x020 EXTI Interrupt 8 Configuration Register | ||
267 | __IO uint32_t CFGR9; //!< 0x024 EXTI Interrupt 9 Configuration Register | ||
268 | __IO uint32_t CFGR10; //!< 0x028 EXTI Interrupt 10 Configuration Register | ||
269 | __IO uint32_t CFGR11; //!< 0x02C EXTI Interrupt 11 Configuration Register | ||
270 | __IO uint32_t CFGR12; //!< 0x030 EXTI Interrupt 12 Configuration Register | ||
271 | __IO uint32_t CFGR13; //!< 0x034 EXTI Interrupt 13 Configuration Register | ||
272 | __IO uint32_t CFGR14; //!< 0x038 EXTI Interrupt 14 Configuration Register | ||
273 | __IO uint32_t CFGR15; //!< 0x03C EXTI Interrupt 15 Configuration Register | ||
274 | __IO uint32_t CR; //!< 0x040 EXTI Interrupt Control Register | ||
275 | __IO uint32_t EDGEFLGR; //!< 0x044 EXTI Interrupt Edge Flag Register | ||
276 | __IO uint32_t EDGESR; //!< 0x048 EXTI Interrupt Edge Status Register | ||
277 | __IO uint32_t SSCR; //!< 0x04C EXTI Interrupt Software Set Command Register | ||
278 | __IO uint32_t WAKUPCR; //!< 0x050 EXTI Interrupt Wakeup Control Register | ||
279 | __IO uint32_t WAKUPPOLR; //!< 0x054 EXTI Interrupt Wakeup Polarity Register | ||
280 | __IO uint32_t WAKUPFLG; //!< 0x058 EXTI Interrupt Wakeup Flag Register | ||
281 | } EXTI_TypeDef; | ||
282 | |||
283 | // Analog To Digital Converter | ||
284 | // ///////////////////////////////////////////////////////////////////////////// | ||
285 | |||
286 | // Operational Amplifier / Comparator | ||
287 | // ///////////////////////////////////////////////////////////////////////////// | ||
288 | typedef struct { | ||
289 | __IO uint32_t CR; //!< 0x000 Comparator Control Register | ||
290 | __IO uint32_t VALR; //!< 0x004 Comparator Voltage Reference Register | ||
291 | __IO uint32_t IER; //!< 0x008 Comparator Interrupt Enable Register | ||
292 | __IO uint32_t TFR; //!< 0x00C Comparator Transition Flag Register | ||
293 | } CMP_TypeDef; | ||
294 | |||
295 | |||
296 | // Basic Function Timers | ||
297 | // ///////////////////////////////////////////////////////////////////////////// | ||
298 | typedef struct { | ||
299 | __IO uint32_t CR; //!< 0x000 Control Register | ||
300 | __IO uint32_t SR; //!< 0x004 Status Register | ||
301 | __IO uint32_t CNTR; //!< 0x008 Counter Value Register | ||
302 | __IO uint32_t CMP; //!< 0x00C Compare Value Register | ||
303 | } BFTM_TypeDef; | ||
304 | |||
305 | #define BFTM_CR_CEN (1U << 2) | ||
306 | #define BFTM_CR_OSM (1U << 1) | ||
307 | #define BFTM_CR_MIEN (1U << 0) | ||
308 | #define BFTM_SR_MIF (1U << 0) | ||
309 | |||
310 | // General Purpose Timers | ||
311 | // Motor Control Timers | ||
312 | // ///////////////////////////////////////////////////////////////////////////// | ||
313 | typedef struct { | ||
314 | __IO uint32_t CNTCFR; //!< 0x000 Timer Counter Configuaration Register | ||
315 | __IO uint32_t MDCFR; //!< 0x004 Timer Mode Configuration Register | ||
316 | __IO uint32_t TRCFR; //!< 0x008 Timer Trigger Configuration Register | ||
317 | uint32_t RESERVED0[1]; //!< 0x00C Reserved | ||
318 | __IO uint32_t CTR; //!< 0x010 Timer Counter Register | ||
319 | uint32_t RESERVED1[3]; //!< 0x014 ~ 0x01C Reserved | ||
320 | __IO uint32_t CHnICFR[4]; //!< 0x020 ~ 0x02C Channel n Input Configuration Register | ||
321 | uint32_t RESERVED2[4]; //!< 0x030 ~ 0x03C Reserved | ||
322 | __IO uint32_t CHnOCFR[4]; //!< 0x040 ~ 0x04C Channel n Output Configuration Register | ||
323 | __IO uint32_t CHCTR; //!< 0x050 Channel Control Register | ||
324 | __IO uint32_t CHPOLR; //!< 0x054 Channel Polarity Control Register | ||
325 | uint32_t RESERVED3[5]; //!< 0x058 ~ 0x068 Reserved | ||
326 | // note: only available as MCTM | ||
327 | __IO uint32_t CHBRKCFR; //!< 0x06C Channel Break Configuration Register | ||
328 | __IO uint32_t CHBRKCTR; //!< 0x070 Channel Break Control Register | ||
329 | // end note | ||
330 | __IO uint32_t DICTR; //!< 0x074 Timer PDMA/Interrupt Control Register | ||
331 | __IO uint32_t EVGR; //!< 0x078 Timer Event Generator Register | ||
332 | __IO uint32_t INTSR; //!< 0x07C Timer Interrupt Status Register | ||
333 | __IO uint32_t CNTR; //!< 0x080 Timer Counter Register | ||
334 | __IO uint32_t PSCR; //!< 0x084 Timer Prescaler Register | ||
335 | __IO uint32_t CRR; //!< 0x088 Timer Counter Reload Register | ||
336 | // note: only available as MCTM | ||
337 | __IO uint32_t REPR; //!< 0x08C Timer Repetition Register | ||
338 | // end note | ||
339 | __IO uint32_t CHnCCR[4]; //!< 0x090 ~ 0x09C Channel n Capture/Compare Register | ||
340 | __IO uint32_t CHnACR[4]; //!< 0x0A0 ~ 0x0AC Channel n Asymmentric Compare Register | ||
341 | } TM_TypeDef; | ||
342 | |||
343 | #define TM_CNTCFR_CMSEL_MASK (3U << 16) | ||
344 | #define TM_CNTCFR_CMSEL_MODE_3 (3U << 16) | ||
345 | #define TM_CNTCFR_CMSEL_MODE_2 (2U << 16) | ||
346 | #define TM_CNTCFR_CMSEL_MODE_1 (1U << 16) | ||
347 | #define TM_CNTCFR_CMSEL_MODE_0 (0U << 16) | ||
348 | #define TM_CTR_CHCCDS (1U << 16) | ||
349 | #define TM_CTR_COMUS (1U << 9) | ||
350 | #define TM_CTR_COMPRE (1U << 8) | ||
351 | #define TM_CTR_CRBE (1U << 1) | ||
352 | #define TM_CTR_TME (1U << 0) | ||
353 | #define TM_CHnOCFR_CHnPRE (1U << 4) | ||
354 | #define TM_CHnOCFR_REFnCE (1U << 3) | ||
355 | #define TM_CHnOCFR_CHnOM(n) ((((n)>>0)&7)|((((n)>>3)&1)<<8)) | ||
356 | #define TM_CHBRKCTR_CHMOE (1U << 4) | ||
357 | |||
358 | // Real Time Clock | ||
359 | // ///////////////////////////////////////////////////////////////////////////// | ||
360 | |||
361 | // Watchdog Timer | ||
362 | // ///////////////////////////////////////////////////////////////////////////// | ||
363 | |||
364 | // I2C | ||
365 | // ///////////////////////////////////////////////////////////////////////////// | ||
366 | typedef struct { | ||
367 | __IO uint32_t CR; //!< 0x000 Control Register | ||
368 | __IO uint32_t IER; //!< 0x004 Interrupt Enable Register | ||
369 | __IO uint32_t ADDR; //!< 0x008 Address Register | ||
370 | __IO uint32_t SR; //!< 0x00C Status Register | ||
371 | __IO uint32_t SHPGR; //!< 0x010 SCL High Period Generation Register | ||
372 | __IO uint32_t SLPGR; //!< 0x014 SCL Low Period Generation Register | ||
373 | __IO uint32_t DR; //!< 0x018 Data Register | ||
374 | __IO uint32_t TAR; //!< 0x01C Target Register | ||
375 | __IO uint32_t ADDMR; //!< 0x020 Address Mask Register | ||
376 | __IO uint32_t ADDSR; //!< 0x024 Address Snoop Register | ||
377 | __IO uint32_t TOUT; //!< 0x028 Timeout Register | ||
378 | } I2C_TypeDef; | ||
379 | |||
380 | #define I2C_CR_SEQ_FILTER_MASK (3U << 14) | ||
381 | #define I2C_CR_SEQ_FILTER_2_PCLK (2U << 14) | ||
382 | #define I2C_CR_SEQ_FILTER_1_PCLK (1U << 14) | ||
383 | #define I2C_CR_SEQ_FILTER_DISABLE (0U << 14) | ||
384 | #define I2C_CR_COMB_FILTER_En (1U << 13) | ||
385 | #define I2C_CR_ENTOUT (1U << 12) | ||
386 | #define I2C_CR_DMANACK (1U << 10) | ||
387 | #define I2C_CR_RXDMAE (1U << 9) | ||
388 | #define I2C_CR_TXDMAE (1U << 8) | ||
389 | #define I2C_CR_ADRM (1U << 7) | ||
390 | #define I2C_CR_I2CEN (1U << 3) | ||
391 | #define I2C_CR_GCEN (1U << 2) | ||
392 | #define I2C_CR_STOP (1U << 1) | ||
393 | #define I2C_CR_AA (1U << 0) | ||
394 | #define I2C_IER_RXBFIE (1U << 18) | ||
395 | #define I2C_IER_TXDEIE (1U << 17) | ||
396 | #define I2C_IER_RXDNEIE (1U << 16) | ||
397 | #define I2C_IER_TOUTIE (1U << 11) | ||
398 | #define I2C_IER_BUSERRIE (1U << 10) | ||
399 | #define I2C_IER_RXNACKIE (1U << 9) | ||
400 | #define I2C_IER_ARBLOSIE (1U << 8) | ||
401 | #define I2C_IER_GCSIE (1U << 3) | ||
402 | #define I2C_IER_ADRSIE (1U << 2) | ||
403 | #define I2C_IER_STOIE (1U << 1) | ||
404 | #define I2C_IER_STAIE (1U << 0) | ||
405 | #define I2C_SR_TXNRX (1U << 21) | ||
406 | #define I2C_SR_MASTER (1U << 20) | ||
407 | #define I2C_SR_BUSBUSY (1U << 19) | ||
408 | #define I2C_SR_RXBF (1U << 18) | ||
409 | #define I2C_SR_TXDE (1U << 17) | ||
410 | #define I2C_SR_RXDNE (1U << 16) | ||
411 | #define I2C_SR_TOUTF (1U << 11) | ||
412 | #define I2C_SR_BUSERR (1U << 10) | ||
413 | #define I2C_SR_RXNACK (1U << 9) | ||
414 | #define I2C_SR_ARBLOS (1U << 8) | ||
415 | #define I2C_SR_GCS (1U << 3) | ||
416 | #define I2C_SR_ADRS (1U << 2) | ||
417 | #define I2C_SR_STO (1U << 1) | ||
418 | #define I2C_SR_STA (1U << 0) | ||
419 | #define I2C_TAR_RWD (1U << 10) | ||
420 | |||
421 | // SPI | ||
422 | // ///////////////////////////////////////////////////////////////////////////// | ||
423 | typedef struct { | ||
424 | __IO uint32_t CR0; //!< 0x000 Control Register 0 | ||
425 | __IO uint32_t CR1; //!< 0x004 Control Register 1 | ||
426 | __IO uint32_t IER; //!< 0x008 Interrupt Enable Register | ||
427 | __IO uint32_t CPR; //!< 0x00C Clock Prescaler Register | ||
428 | __IO uint32_t DR; //!< 0x010 Data Register | ||
429 | __IO uint32_t SR; //!< 0x014 Status Register | ||
430 | __IO uint32_t FCR; //!< 0x018 FIFO Control Register | ||
431 | __IO uint32_t FSR; //!< 0x01C FIFO Status Register | ||
432 | __IO uint32_t FTOCR; //!< 0x020 FIFO Time Out Counter Register | ||
433 | } SPI_TypeDef; | ||
434 | |||
435 | #define SPI_CR0_GUADTEN (1U << 7) | ||
436 | #define SPI_CR0_DUALEN (1U << 6) | ||
437 | #define SPI_CR0_SSELC (1U << 4) | ||
438 | #define SPI_CR0_SELOEN (1U << 3) | ||
439 | #define SPI_CR0_SPIEN (1U << 0) | ||
440 | #define SPI_CR1_MODE (1U << 14) | ||
441 | #define SPI_CR1_SELM (1U << 13) | ||
442 | #define SPI_CR1_FIRSTBIT (1U << 12) | ||
443 | #define SPI_CR1_SELAP (1U << 11) | ||
444 | #define SPI_CR1_FORMAT_MASK (7U << 8) | ||
445 | #define SPI_CR1_FORMAT_MODE0 (0x1U << 8) | ||
446 | #define SPI_CR1_FORMAT_MODE1 (0x2U << 8) | ||
447 | #define SPI_CR1_FORMAT_MODE2 (0x6U << 8) | ||
448 | #define SPI_CR1_FORMAT_MODE3 (0x5U << 8) | ||
449 | #define SPI_IER_RXBNEIEN (1U << 2) | ||
450 | #define SPI_IER_TXBEIEN (1U << 0) | ||
451 | #define SPI_SR_RXBNE (1U << 2) | ||
452 | #define SPI_SR_TXE (1U << 1) | ||
453 | #define SPI_SR_TXBE (1U << 0) | ||
454 | #define SPI_FCR_FIFOEN (1U << 10) | ||
455 | #define SPI_FSR_TXFS_MASK (0xfU << 0) | ||
456 | #define SPI_FSR_RXFS_MASK (0xfU << 4) | ||
457 | |||
458 | // USART | ||
459 | // UART | ||
460 | // ///////////////////////////////////////////////////////////////////////////// | ||
461 | typedef struct { | ||
462 | __IO uint32_t DR; //!< 0x000 Data Register | ||
463 | __IO uint32_t CR; //!< 0x004 Control Register | ||
464 | // Only USART | ||
465 | __IO uint32_t FCR; //!< 0x008 FIFO Control Register | ||
466 | __IO uint32_t IER; //!< 0x00C Interrupt Enable Register | ||
467 | __IO uint32_t SIFR; //!< 0x010 Status & Interrupt Flag Register | ||
468 | |||
469 | __IO uint32_t TPR; //!< 0x014 Timing Parameter Register | ||
470 | |||
471 | __IO uint32_t IrDACR; //!< 0x018 IrDA Control Register | ||
472 | __IO uint32_t RS485CR; //!< 0x01C RS485 Control Register | ||
473 | __IO uint32_t SYNCR; //!< 0x020 Synchronous Control Register | ||
474 | // end note | ||
475 | __IO uint32_t DLR; //!< 0x024 Divider Latch Register | ||
476 | __IO uint32_t TSTR; //!< 0x028 Debug/Test Register | ||
477 | } USART_TypeDef; | ||
478 | |||
479 | // USART CR | ||
480 | #define UART_CR_MODE_MASK (0b11 << 0) | ||
481 | #define UART_CR_MODE_NORMAL (0 << 0) | ||
482 | #define UART_CR_TRSM (1 << 2) | ||
483 | #define UART_CR_HFCEN (1 << 3) | ||
484 | #define UART_CR_URTXEN (1 << 4) | ||
485 | #define UART_CR_URRXEN (1 << 5) | ||
486 | #define UART_CR_TXDMAEN (1 << 6) | ||
487 | #define UART_CR_RXDMAEN (1 << 7) | ||
488 | #define UART_CR_WLS_MASK (0b11 << 8) | ||
489 | #define UART_CR_WLS_7B (0b00 << 8) | ||
490 | #define UART_CR_WLS_8B (0b01 << 8) | ||
491 | #define UART_CR_WLS_9B (0b10 << 8) | ||
492 | #define UART_CR_NSB (1 << 10) | ||
493 | #define UART_CR_PBE (1 << 11) | ||
494 | #define UART_CR_EPE (1 << 12) | ||
495 | #define UART_CR_SPE (1 << 13) | ||
496 | #define UART_CR_BCB (1 << 14) | ||
497 | #define UART_CR_RTS (1 << 15) | ||
498 | // USART FCR (FIFO CR) | ||
499 | #define USART_FCR_TXR (1 << 0) | ||
500 | #define USART_FCR_RXR (1 << 1) | ||
501 | #define USART_FCR_TXTL_MASK (0b11 << 4) | ||
502 | #define USART_FCR_RXTL_MASK (0b11 << 6) | ||
503 | #define USART_FCR_TXFS_MASK (0xF << 16) | ||
504 | #define USART_FCR_RXFS_MASK (0xF << 24) | ||
505 | // USART SIFR Status and Interrupt Flag Register | ||
506 | #define USART_SIFR_RXDNE (1 << 0) | ||
507 | #define USART_SIFR_OEI (1 << 1) | ||
508 | #define USART_SIFR_PEI (1 << 2) | ||
509 | #define USART_SIFR_FEI (1 << 3) | ||
510 | #define USART_SIFR_BII (1 << 4) | ||
511 | #define USART_SIFR_RXDR (1 << 5) | ||
512 | #define USART_SIFR_RXTOF (1 << 6) | ||
513 | #define USART_SIFR_TXDE (1 << 7) | ||
514 | #define USART_SIFR_TXC (1 << 8) | ||
515 | #define USART_SIFR_RSADDE (1 << 9) | ||
516 | #define USART_SIFR_CTSC (1 << 10) | ||
517 | #define USART_SIFR_CTSS (1 << 11) | ||
518 | // USART IER | ||
519 | #define USART_IER_RXDRIE (1 << 0) | ||
520 | #define USART_IER_TXDEIE (1 << 1) | ||
521 | #define USART_IER_TXCIE (1 << 2) | ||
522 | #define USART_IER_OEIE (1 << 3) | ||
523 | #define USART_IER_PEIE (1 << 4) | ||
524 | #define USART_IER_FEIE (1 << 5) | ||
525 | #define USART_IER_BIE (1 << 6) | ||
526 | #define USART_IER_RSADDIE (1 << 7) | ||
527 | #define USART_IER_RXTOIE (1 << 8) | ||
528 | #define USART_IER_CTSIE (1 << 9) | ||
529 | |||
530 | |||
531 | // Smart Card Interface | ||
532 | // ///////////////////////////////////////////////////////////////////////////// | ||
533 | |||
534 | // USB | ||
535 | // ///////////////////////////////////////////////////////////////////////////// | ||
536 | typedef struct { | ||
537 | __IO uint32_t CSR; //!< 0x000 USB Control and Status Register | ||
538 | __IO uint32_t IER; //!< 0x004 USB Interrupt Enable Register | ||
539 | __IO uint32_t ISR; //!< 0x008 USB Interrupt Status Register | ||
540 | __IO uint32_t FCR; //!< 0x00C USB Frame Count Register | ||
541 | __IO uint32_t DEVAR; //!< 0x010 USB Device Address Register | ||
542 | struct { | ||
543 | __IO uint32_t CSR; //!< 0x014 USB Endpoint n Control and Status Register | ||
544 | __IO uint32_t IER; //!< 0x018 USB Endpoint n Interrupt Enable Register | ||
545 | __IO uint32_t ISR; //!< 0x01C USB Endpoint n Interrupt Status Register | ||
546 | __IO uint32_t TCR; //!< 0x020 USB Endpoint n Transfer Count Register | ||
547 | __IO uint32_t CFGR; //!< 0x024 USB Endpoint n Configuration Register | ||
548 | } EP[8]; | ||
549 | } USB_TypeDef; | ||
550 | |||
551 | // USBCSR | ||
552 | #define USBCSR_FRES (0x002) // Force USB Reset Control | ||
553 | #define USBCSR_PDWN (0x004) // Power Down Mode Control | ||
554 | #define USBCSR_LPMODE (0x008) // Low-Power Mode Control | ||
555 | #define USBCSR_GENRSM (0x020) // Resume Request Generation Control | ||
556 | #define USBCSR_RXDP (0x040) // Received DP Line Status | ||
557 | #define USBCSR_RXDM (0x080) // Received DM Line Status | ||
558 | #define USBCSR_ADRSET (0x100) // Device Address Setting Control | ||
559 | #define USBCSR_SRAMRSTC (0x200) // USB SRAM Reset Condition | ||
560 | #define USBCSR_DPPUEN (0x400) // DP Pull Up Enable | ||
561 | #define USBCSR_DPWKEN (0x800) // DP Wake Up Enable | ||
562 | |||
563 | // USBIER | ||
564 | #define USBIER_UGIE (0x0001) // USB global Interrupt Enable | ||
565 | #define USBIER_SOFIE (0x0002) // Start Of Frame Interrupt Enable | ||
566 | #define USBIER_URSTIE (0x0004) // USB Reset Interrupt Enable | ||
567 | #define USBIER_RSMIE (0x0008) // Resume Interrupt Enable | ||
568 | #define USBIER_SUSPIE (0x0010) // Suspend Interrupt Enable | ||
569 | #define USBIER_ESOFIE (0x0020) // Expected Start Of Frame Enable | ||
570 | #define USBIER_EP0IE (0x0100) // Endpoint 0 Interrupt Enable | ||
571 | #define USBIER_EP1IE (0x0200) // Endpoint 1 Interrupt Enable | ||
572 | #define USBIER_EP2IE (0x0400) // Endpoint 2 Interrupt Enable | ||
573 | #define USBIER_EP3IE (0x0800) // Endpoint 3 Interrupt Enable | ||
574 | #define USBIER_EP4IE (0x1000) // Endpoint 4 Interrupt Enable | ||
575 | #define USBIER_EP5IE (0x2000) // Endpoint 5 Interrupt Enable | ||
576 | #define USBIER_EP6IE (0x4000) // Endpoint 6 Interrupt Enable | ||
577 | #define USBIER_EP7IE (0x8000) // Endpoint 7 Interrupt Enable | ||
578 | |||
579 | // USBISR | ||
580 | #define USBISR_SOFIF (0x0002) // Start Of Frame Interrupt Flag | ||
581 | #define USBISR_URSTIF (0x0004) // USB Reset Interrupt Flag | ||
582 | #define USBISR_RSMIF (0x0008) // Resume Interrupt Flag | ||
583 | #define USBISR_SUSPIF (0x0010) // Suspend Interrupt Flag | ||
584 | #define USBISR_ESOFIF (0x0020) // Expected Start Of Frame Interrupt | ||
585 | #define USBISR_EP0IF (1U << 8) // Endpoint 0 Interrupt Flag | ||
586 | #define USBISR_EP1IF (1U << 9) // Endpoint 1 Interrupt Flag | ||
587 | #define USBISR_EP2IF (1U << 10) // Endpoint 2 Interrupt Flag | ||
588 | #define USBISR_EP3IF (1U << 11) // Endpoint 3 Interrupt Flag | ||
589 | #define USBISR_EP4IF (1U << 12) // Endpoint 4 Interrupt Flag | ||
590 | #define USBISR_EP5IF (1U << 13) // Endpoint 5 Interrupt Flag | ||
591 | #define USBISR_EP6IF (1U << 14) // Endpoint 6 Interrupt Flag | ||
592 | #define USBISR_EP7IF (1U << 15) // Endpoint 7 Interrupt Flag | ||
593 | #define USBISR_EPnIF (0xFF00) // Endpoint Interrupt Mask | ||
594 | |||
595 | // USBFCR | ||
596 | #define USBFCR_FRNUM (0x7FF) // Frame Number | ||
597 | #define USBFCR_SOFLCK (1U << 16) // Start-of-Frame Lock Flag | ||
598 | #define USBFCR_LSOF (0x3U << 17) // Lost Start-of-Frame Number | ||
599 | |||
600 | // USBEPnCSR | ||
601 | #define USBEPnCSR_DTGTX (0x01) // Data Toggle Status, for IN transfer | ||
602 | #define USBEPnCSR_NAKTX (0x02) // NAK Status, for IN transfer | ||
603 | #define USBEPnCSR_STLTX (0x04) // STALL Status, for IN transfer | ||
604 | #define USBEPnCSR_DTGRX (0x08) // Data Toggle Status, for OUT transfer | ||
605 | #define USBEPnCSR_NAKRX (0x10) // NAK Status, for OUT transfer | ||
606 | #define USBEPnCSR_STLRX (0x20) // STALL Status, for OUT transfer | ||
607 | |||
608 | // USBEPnIER | ||
609 | #define USBEPnIER_OTRXIE (0x001) // OUT Token Received Interrupt Enable | ||
610 | #define USBEPnIER_ODRXIE (0x002) // OUT Data Received Interrupt Enable | ||
611 | #define USBEPnIER_ODOVIE (0x004) // OUT Data Buffer Overrun Interrupt Enable | ||
612 | #define USBEPnIER_ITRXIE (0x008) // IN Token Received Interrupt Enable | ||
613 | #define USBEPnIER_IDTXIE (0x010) // IN Data Transmitted Interrupt Enable | ||
614 | #define USBEPnIER_NAKIE (0x020) // NAK Transmitted Interrupt Enable | ||
615 | #define USBEPnIER_STLIE (0x040) // STALL Transmitted Interrupt Enable | ||
616 | #define USBEPnIER_UERIE (0x080) // USB Error Interrupt Enable | ||
617 | #define USBEPnIER_STRXIE (0x100) // SETUP Token Received Interrupt Enable | ||
618 | #define USBEPnIER_SDRXIE (0x200) // SETUP Data Received Interrupt Enable | ||
619 | #define USBEPnIER_SDERIE (0x400) // SETUP Data Error Interrupt Enable | ||
620 | #define USBEPnIER_ZLRXIE (0x800) // Zero Length Data Received Interrupt Enable | ||
621 | |||
622 | // USBEPnISR | ||
623 | #define USBEPnISR_OTRXIF (0x001) // OUT Token Received Interrupt Flag | ||
624 | #define USBEPnISR_ODRXIF (0x002) // OUT Data Received Interrupt Flag | ||
625 | #define USBEPnISR_ODOVIF (0x004) // OUT Data Buffer Overrun Interrupt Flag | ||
626 | #define USBEPnISR_ITRXIF (0x008) // IN Token Received Interrupt Flag | ||
627 | #define USBEPnISR_IDTXIF (0x010) // IN Data Transmitted Interrupt Flag | ||
628 | #define USBEPnISR_NAKIF (0x020) // NAK Transmitted Interrupt Flag | ||
629 | #define USBEPnISR_STLIF (0x040) // STALL Transmitted Interrupt Flag | ||
630 | #define USBEPnISR_UERIF (0x080) // USB Error Interrupt Flag | ||
631 | #define USBEPnISR_STRXIF (0x100) // SETUP Token Received Interrupt Flag | ||
632 | #define USBEPnISR_SDRXIF (0x200) // SETUP Data Received Interrupt Flag | ||
633 | #define USBEPnISR_SDERIF (0x400) // SETUP Data Error Interrupt Flag | ||
634 | #define USBEPnISR_ZLRXIF (0x800) // Zero Length Data Received Interrupt Flag | ||
635 | |||
636 | // USBEPnTCR | ||
637 | #define USBEPnTCR_TCNT (0x1FF) // Transfer Byte Count | ||
638 | |||
639 | // USBEPnCFGR | ||
640 | #define USBEPnCFGR_EPEN (1U << 31) // Endpoint Enable | ||
641 | #define USBEPnCFGR_EPTYPE (1U << 29) // Transfer Type | ||
642 | #define USBEPnCFGR_EPDIR (1U << 28) // Transfer Direction | ||
643 | #define USBEPnCFGR_EPADR (0xFU << 24) // Endpoint Address | ||
644 | #define USBEPnCFGR_EPLEN (0x7FU << 10) // Buffer Length | ||
645 | #define USBEPnCFGR_EPBUFA (0x3FF) // Endpoint Buffer Address | ||
646 | |||
647 | // Peripheral Direct Memory Access | ||
648 | // ///////////////////////////////////////////////////////////////////////////// | ||
649 | |||
650 | // Extend Bus Interface | ||
651 | // ///////////////////////////////////////////////////////////////////////////// | ||
652 | |||
653 | // Inter-IC Sound | ||
654 | // ///////////////////////////////////////////////////////////////////////////// | ||
655 | |||
656 | // CRC | ||
657 | // ///////////////////////////////////////////////////////////////////////////// | ||
diff --git a/lib/chibios-contrib/os/common/ext/CMSIS/KINETIS/MK66F18.h b/lib/chibios-contrib/os/common/ext/CMSIS/KINETIS/MK66F18.h new file mode 100644 index 000000000..237089e0c --- /dev/null +++ b/lib/chibios-contrib/os/common/ext/CMSIS/KINETIS/MK66F18.h | |||
@@ -0,0 +1,21214 @@ | |||
1 | /* | ||
2 | ** ################################################################### | ||
3 | ** Processors: MK66FN2M0VLQ18 | ||
4 | ** MK66FN2M0VMD18 | ||
5 | ** MK66FX1M0VLQ18 | ||
6 | ** MK66FX1M0VMD18 | ||
7 | ** | ||
8 | ** Compilers: Keil ARM C/C++ Compiler | ||
9 | ** Freescale C/C++ for Embedded ARM | ||
10 | ** GNU C Compiler | ||
11 | ** IAR ANSI C/C++ Compiler for ARM | ||
12 | ** MCUXpresso Compiler | ||
13 | ** | ||
14 | ** Reference manual: K66P144M180SF5RMV2, Rev. 1, Mar 2015 | ||
15 | ** Version: rev. 3.0, 2015-03-25 | ||
16 | ** Build: b171205 | ||
17 | ** | ||
18 | ** Abstract: | ||
19 | ** CMSIS Peripheral Access Layer for MK66F18 | ||
20 | ** | ||
21 | ** The Clear BSD License | ||
22 | ** Copyright 1997-2016 Freescale Semiconductor, Inc. | ||
23 | ** Copyright 2016-2017 NXP | ||
24 | ** All rights reserved. | ||
25 | ** | ||
26 | ** Redistribution and use in source and binary forms, with or without | ||
27 | ** modification, are permitted (subject to the limitations in the | ||
28 | ** disclaimer below) provided that the following conditions are met: | ||
29 | ** | ||
30 | ** * Redistributions of source code must retain the above copyright | ||
31 | ** notice, this list of conditions and the following disclaimer. | ||
32 | ** | ||
33 | ** * Redistributions in binary form must reproduce the above copyright | ||
34 | ** notice, this list of conditions and the following disclaimer in the | ||
35 | ** documentation and/or other materials provided with the distribution. | ||
36 | ** | ||
37 | ** * Neither the name of the copyright holder nor the names of its | ||
38 | ** contributors may be used to endorse or promote products derived from | ||
39 | ** this software without specific prior written permission. | ||
40 | ** | ||
41 | ** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE | ||
42 | ** GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT | ||
43 | ** HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED | ||
44 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
45 | ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
46 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
47 | ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
48 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
49 | ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
50 | ** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
51 | ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
52 | ** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
53 | ** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
54 | ** | ||
55 | ** http: www.nxp.com | ||
56 | ** mail: [email protected] | ||
57 | ** | ||
58 | ** Revisions: | ||
59 | ** - rev. 1.0 (2013-09-02) | ||
60 | ** Initial version. | ||
61 | ** - rev. 2.0 (2014-02-17) | ||
62 | ** Register accessor macros added to the memory map. | ||
63 | ** Symbols for Processor Expert memory map compatibility added to the memory map. | ||
64 | ** Startup file for gcc has been updated according to CMSIS 3.2. | ||
65 | ** Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled. | ||
66 | ** Update according to reference manual rev. 2 | ||
67 | ** - rev. 2.1 (2014-04-16) | ||
68 | ** Update of SystemInit() and SystemCoreClockUpdate() functions. | ||
69 | ** - rev. 2.2 (2014-10-14) | ||
70 | ** Interrupt INT_LPTimer renamed to INT_LPTMR0, interrupt INT_Watchdog renamed to INT_WDOG_EWM. | ||
71 | ** - rev. 2.3 (2014-11-20) | ||
72 | ** Update according to reverence manual K65P169M180SF5RMV2_NDA, Rev. 0 Draft A, October 2014. | ||
73 | ** Update of SystemInit() to use 16MHz external crystal. | ||
74 | ** - rev. 2.4 (2015-02-19) | ||
75 | ** Renamed interrupt vector LLW to LLWU. | ||
76 | ** - rev. 3.0 (2015-03-25) | ||
77 | ** Registers updated according to the reference manual revision 1, March 2015 | ||
78 | ** - Revised 2018-05-04 by Michael Walker <[email protected]> to support ChibiOS LLD HAL | ||
79 | ** Register names and other names updated to match other Kinetis definitions for other MCUs | ||
80 | ** | ||
81 | ** ################################################################### | ||
82 | */ | ||
83 | |||
84 | /*! | ||
85 | * @file MK66F18.h | ||
86 | * @version 3.0 | ||
87 | * @date 2015-03-25 | ||
88 | * @brief CMSIS Peripheral Access Layer for MK66F18 | ||
89 | * | ||
90 | * CMSIS Peripheral Access Layer for MK66F18 | ||
91 | */ | ||
92 | |||
93 | #ifndef _MK66F18_H_ | ||
94 | #define _MK66F18_H_ /**< Symbol preventing repeated inclusion */ | ||
95 | |||
96 | /** Memory map major version (memory maps with equal major version number are | ||
97 | * compatible) */ | ||
98 | #define MCU_MEM_MAP_VERSION 0x0300U | ||
99 | /** Memory map minor version */ | ||
100 | #define MCU_MEM_MAP_VERSION_MINOR 0x0000U | ||
101 | |||
102 | /** | ||
103 | * @brief Macro to calculate address of an aliased word in the peripheral | ||
104 | * bitband area for a peripheral register and bit (bit band region 0x40000000 to | ||
105 | * 0x400FFFFF). | ||
106 | * @param Reg Register to access. | ||
107 | * @param Bit Bit number to access. | ||
108 | * @return Address of the aliased word in the peripheral bitband area. | ||
109 | */ | ||
110 | #define BITBAND_REGADDR(Reg,Bit) (0x42000000u + (32u*((uint32_t)&(Reg) - (uint32_t)0x40000000u)) + (4u*((uint32_t)(Bit)))) | ||
111 | /** | ||
112 | * @brief Macro to access a single bit of a peripheral register (bit band region | ||
113 | * 0x40000000 to 0x400FFFFF) using the bit-band alias region access. Can | ||
114 | * be used for peripherals with 32bit access allowed. | ||
115 | * @param Reg Register to access. | ||
116 | * @param Bit Bit number to access. | ||
117 | * @return Value of the targeted bit in the bit band region. | ||
118 | */ | ||
119 | #define BITBAND_REG32(Reg,Bit) (*((uint32_t volatile*)(BITBAND_REGADDR((Reg),(Bit))))) | ||
120 | #define BITBAND_REG(Reg,Bit) (BITBAND_REG32((Reg),(Bit))) | ||
121 | /** | ||
122 | * @brief Macro to access a single bit of a peripheral register (bit band region | ||
123 | * 0x40000000 to 0x400FFFFF) using the bit-band alias region access. Can | ||
124 | * be used for peripherals with 16bit access allowed. | ||
125 | * @param Reg Register to access. | ||
126 | * @param Bit Bit number to access. | ||
127 | * @return Value of the targeted bit in the bit band region. | ||
128 | */ | ||
129 | #define BITBAND_REG16(Reg,Bit) (*((uint16_t volatile*)(BITBAND_REGADDR((Reg),(Bit))))) | ||
130 | /** | ||
131 | * @brief Macro to access a single bit of a peripheral register (bit band region | ||
132 | * 0x40000000 to 0x400FFFFF) using the bit-band alias region access. Can | ||
133 | * be used for peripherals with 8bit access allowed. | ||
134 | * @param Reg Register to access. | ||
135 | * @param Bit Bit number to access. | ||
136 | * @return Value of the targeted bit in the bit band region. | ||
137 | */ | ||
138 | #define BITBAND_REG8(Reg,Bit) (*((uint8_t volatile*)(BITBAND_REGADDR((Reg),(Bit))))) | ||
139 | |||
140 | /* ---------------------------------------------------------------------------- | ||
141 | -- Interrupt vector numbers | ||
142 | ---------------------------------------------------------------------------- */ | ||
143 | |||
144 | /*! | ||
145 | * @addtogroup Interrupt_vector_numbers Interrupt vector numbers | ||
146 | * @{ | ||
147 | */ | ||
148 | |||
149 | /** Interrupt Number Definitions */ | ||
150 | #define NUMBER_OF_INT_VECTORS 116 /**< Number of interrupts in the Vector table */ | ||
151 | |||
152 | #define DMA0_IRQn DMA0_DMA16_IRQn | ||
153 | #define DMA1_IRQn DMA1_DMA17_IRQn | ||
154 | #define DMA2_IRQn DMA2_DMA18_IRQn | ||
155 | #define DMA3_IRQn DMA3_DMA19_IRQn | ||
156 | #define DMA4_IRQn DMA4_DMA20_IRQn | ||
157 | #define DMA5_IRQn DMA5_DMA21_IRQn | ||
158 | #define DMA6_IRQn DMA6_DMA22_IRQn | ||
159 | #define DMA7_IRQn DMA7_DMA23_IRQn | ||
160 | #define DMA8_IRQn DMA8_DMA24_IRQn | ||
161 | #define DMA9_IRQn DMA9_DMA25_IRQn | ||
162 | #define DMA10_IRQn DMA10_DMA26_IRQn | ||
163 | #define DMA11_IRQn DMA11_DMA27_IRQn | ||
164 | #define DMA12_IRQn DMA12_DMA28_IRQn | ||
165 | #define DMA13_IRQn DMA13_DMA29_IRQn | ||
166 | #define DMA14_IRQn DMA14_DMA30_IRQn | ||
167 | #define DMA15_IRQn DMA15_DMA21_IRQn | ||
168 | |||
169 | typedef enum IRQn { | ||
170 | /* Auxiliary constants */ | ||
171 | NotAvail_IRQn = -128, /**< Not available device specific interrupt */ | ||
172 | |||
173 | /* Core interrupts */ | ||
174 | NonMaskableInt_IRQn = -14, /**< Non Maskable Interrupt */ | ||
175 | HardFault_IRQn = -13, /**< Cortex-M4 SV Hard Fault Interrupt */ | ||
176 | MemoryManagement_IRQn = -12, /**< Cortex-M4 Memory Management Interrupt */ | ||
177 | BusFault_IRQn = -11, /**< Cortex-M4 Bus Fault Interrupt */ | ||
178 | UsageFault_IRQn = -10, /**< Cortex-M4 Usage Fault Interrupt */ | ||
179 | SVCall_IRQn = -5, /**< Cortex-M4 SV Call Interrupt */ | ||
180 | DebugMonitor_IRQn = -4, /**< Cortex-M4 Debug Monitor Interrupt */ | ||
181 | PendSV_IRQn = -2, /**< Cortex-M4 Pend SV Interrupt */ | ||
182 | SysTick_IRQn = -1, /**< Cortex-M4 System Tick Interrupt */ | ||
183 | |||
184 | /* Device specific interrupts */ | ||
185 | DMA0_DMA16_IRQn = 0, /**< DMA Channel 0, 16 Transfer Complete */ | ||
186 | DMA1_DMA17_IRQn = 1, /**< DMA Channel 1, 17 Transfer Complete */ | ||
187 | DMA2_DMA18_IRQn = 2, /**< DMA Channel 2, 18 Transfer Complete */ | ||
188 | DMA3_DMA19_IRQn = 3, /**< DMA Channel 3, 19 Transfer Complete */ | ||
189 | DMA4_DMA20_IRQn = 4, /**< DMA Channel 4, 20 Transfer Complete */ | ||
190 | DMA5_DMA21_IRQn = 5, /**< DMA Channel 5, 21 Transfer Complete */ | ||
191 | DMA6_DMA22_IRQn = 6, /**< DMA Channel 6, 22 Transfer Complete */ | ||
192 | DMA7_DMA23_IRQn = 7, /**< DMA Channel 7, 23 Transfer Complete */ | ||
193 | DMA8_DMA24_IRQn = 8, /**< DMA Channel 8, 24 Transfer Complete */ | ||
194 | DMA9_DMA25_IRQn = 9, /**< DMA Channel 9, 25 Transfer Complete */ | ||
195 | DMA10_DMA26_IRQn = 10, /**< DMA Channel 10, 26 Transfer Complete */ | ||
196 | DMA11_DMA27_IRQn = 11, /**< DMA Channel 11, 27 Transfer Complete */ | ||
197 | DMA12_DMA28_IRQn = 12, /**< DMA Channel 12, 28 Transfer Complete */ | ||
198 | DMA13_DMA29_IRQn = 13, /**< DMA Channel 13, 29 Transfer Complete */ | ||
199 | DMA14_DMA30_IRQn = 14, /**< DMA Channel 14, 30 Transfer Complete */ | ||
200 | DMA15_DMA31_IRQn = 15, /**< DMA Channel 15, 31 Transfer Complete */ | ||
201 | DMA_Error_IRQn = 16, /**< DMA Error Interrupt */ | ||
202 | MCM_IRQn = 17, /**< Normal Interrupt */ | ||
203 | FTFE_IRQn = 18, /**< FTFE Command complete interrupt */ | ||
204 | Read_Collision_IRQn = 19, /**< Read Collision Interrupt */ | ||
205 | LVD_LVW_IRQn = 20, /**< Low Voltage Detect, Low Voltage Warning */ | ||
206 | LLWU_IRQn = 21, /**< Low Leakage Wakeup Unit */ | ||
207 | WDOG_EWM_IRQn = 22, /**< WDOG Interrupt */ | ||
208 | RNG_IRQn = 23, /**< RNG Interrupt */ | ||
209 | I2C0_IRQn = 24, /**< I2C0 interrupt */ | ||
210 | I2C1_IRQn = 25, /**< I2C1 interrupt */ | ||
211 | SPI0_IRQn = 26, /**< SPI0 Interrupt */ | ||
212 | SPI1_IRQn = 27, /**< SPI1 Interrupt */ | ||
213 | I2S0_Tx_IRQn = 28, /**< I2S0 transmit interrupt */ | ||
214 | I2S0_Rx_IRQn = 29, /**< I2S0 receive interrupt */ | ||
215 | Reserved46_IRQn = 30, /**< Reserved interrupt 46 */ | ||
216 | UART0Status_IRQn = 31, /**< UART0 Receive/Transmit interrupt */ | ||
217 | UART0Error_IRQn = 32, /**< UART0 Error interrupt */ | ||
218 | UART1Status_IRQn = 33, /**< UART1 Receive/Transmit interrupt */ | ||
219 | UART1Error_IRQn = 34, /**< UART1 Error interrupt */ | ||
220 | UART2Status_IRQn = 35, /**< UART2 Receive/Transmit interrupt */ | ||
221 | UART2Error_IRQn = 36, /**< UART2 Error interrupt */ | ||
222 | UART3Status_IRQn = 37, /**< UART3 Receive/Transmit interrupt */ | ||
223 | UART3Error_IRQn = 38, /**< UART3 Error interrupt */ | ||
224 | ADC0_IRQn = 39, /**< ADC0 interrupt */ | ||
225 | CMP0_IRQn = 40, /**< CMP0 interrupt */ | ||
226 | CMP1_IRQn = 41, /**< CMP1 interrupt */ | ||
227 | FTM0_IRQn = 42, /**< FTM0 fault, overflow and channels interrupt */ | ||
228 | FTM1_IRQn = 43, /**< FTM1 fault, overflow and channels interrupt */ | ||
229 | FTM2_IRQn = 44, /**< FTM2 fault, overflow and channels interrupt */ | ||
230 | CMT_IRQn = 45, /**< CMT interrupt */ | ||
231 | RTC_IRQn = 46, /**< RTC interrupt */ | ||
232 | RTC_Seconds_IRQn = 47, /**< RTC seconds interrupt */ | ||
233 | PITChannel0_IRQn = 48, /**< PIT timer channel 0 interrupt */ | ||
234 | PITChannel1_IRQn = 49, /**< PIT timer channel 1 interrupt */ | ||
235 | PITChannel2_IRQn = 50, /**< PIT timer channel 2 interrupt */ | ||
236 | PITChannel3_IRQn = 51, /**< PIT timer channel 3 interrupt */ | ||
237 | PDB0_IRQn = 52, /**< PDB0 Interrupt */ | ||
238 | USB_OTG_IRQn = 53, /**< USB0 interrupt */ | ||
239 | USBDCD_IRQn = 54, /**< USBDCD Interrupt */ | ||
240 | Reserved71_IRQn = 55, /**< Reserved interrupt 71 */ | ||
241 | DAC0_IRQn = 56, /**< DAC0 interrupt */ | ||
242 | MCG_IRQn = 57, /**< MCG Interrupt */ | ||
243 | LPTMR0_IRQn = 58, /**< LPTimer interrupt */ | ||
244 | PINA_IRQn = 59, /**< Port A interrupt */ | ||
245 | PINB_IRQn = 60, /**< Port B interrupt */ | ||
246 | PINC_IRQn = 61, /**< Port C interrupt */ | ||
247 | PIND_IRQn = 62, /**< Port D interrupt */ | ||
248 | PINE_IRQn = 63, /**< Port E interrupt */ | ||
249 | SWI_IRQn = 64, /**< Software interrupt */ | ||
250 | SPI2_IRQn = 65, /**< SPI2 Interrupt */ | ||
251 | UART4Status_IRQn = 66, /**< UART4 Receive/Transmit interrupt */ | ||
252 | UART4Error_IRQn = 67, /**< UART4 Error interrupt */ | ||
253 | Reserved84_IRQn = 68, /**< Reserved interrupt 84 */ | ||
254 | Reserved85_IRQn = 69, /**< Reserved interrupt 85 */ | ||
255 | CMP2_IRQn = 70, /**< CMP2 interrupt */ | ||
256 | FTM3_IRQn = 71, /**< FTM3 fault, overflow and channels interrupt */ | ||
257 | DAC1_IRQn = 72, /**< DAC1 interrupt */ | ||
258 | ADC1_IRQn = 73, /**< ADC1 interrupt */ | ||
259 | I2C2_IRQn = 74, /**< I2C2 interrupt */ | ||
260 | CAN0_ORed_Message_buffer_IRQn = 75, /**< CAN0 OR'd message buffers interrupt */ | ||
261 | CAN0_Bus_Off_IRQn = 76, /**< CAN0 bus off interrupt */ | ||
262 | CAN0_Error_IRQn = 77, /**< CAN0 error interrupt */ | ||
263 | CAN0_Tx_Warning_IRQn = 78, /**< CAN0 Tx warning interrupt */ | ||
264 | CAN0_Rx_Warning_IRQn = 79, /**< CAN0 Rx warning interrupt */ | ||
265 | CAN0_Wake_Up_IRQn = 80, /**< CAN0 wake up interrupt */ | ||
266 | SDHC_IRQn = 81, /**< SDHC interrupt */ | ||
267 | ENET_1588_Timer_IRQn = 82, /**< Ethernet MAC IEEE 1588 Timer Interrupt */ | ||
268 | ENET_Transmit_IRQn = 83, /**< Ethernet MAC Transmit Interrupt */ | ||
269 | ENET_Receive_IRQn = 84, /**< Ethernet MAC Receive Interrupt */ | ||
270 | ENET_Error_IRQn = 85, /**< Ethernet MAC Error and miscelaneous Interrupt */ | ||
271 | LPUART0_IRQn = 86, /**< LPUART0 status/error interrupt */ | ||
272 | TSI0_IRQn = 87, /**< TSI0 interrupt */ | ||
273 | TPM1_IRQn = 88, /**< TPM1 fault, overflow and channels interrupt */ | ||
274 | TPM2_IRQn = 89, /**< TPM2 fault, overflow and channels interrupt */ | ||
275 | USBHSDCD_IRQn = 90, /**< USBHSDCD, USBHS Phy Interrupt */ | ||
276 | I2C3_IRQn = 91, /**< I2C3 interrupt */ | ||
277 | CMP3_IRQn = 92, /**< CMP3 interrupt */ | ||
278 | USBHS_IRQn = 93, /**< USB high speed OTG interrupt */ | ||
279 | CAN1_ORed_Message_buffer_IRQn = 94, /**< CAN1 OR'd message buffers interrupt */ | ||
280 | CAN1_Bus_Off_IRQn = 95, /**< CAN1 bus off interrupt */ | ||
281 | CAN1_Error_IRQn = 96, /**< CAN1 error interrupt */ | ||
282 | CAN1_Tx_Warning_IRQn = 97, /**< CAN1 Tx warning interrupt */ | ||
283 | CAN1_Rx_Warning_IRQn = 98, /**< CAN1 Rx warning interrupt */ | ||
284 | CAN1_Wake_Up_IRQn = 99 /**< CAN1 wake up interrupt */ | ||
285 | } IRQn_Type; | ||
286 | |||
287 | /*! | ||
288 | * @} | ||
289 | */ /* end of group Interrupt_vector_numbers */ | ||
290 | |||
291 | |||
292 | /* ---------------------------------------------------------------------------- | ||
293 | -- Cortex M4 Core Configuration | ||
294 | ---------------------------------------------------------------------------- */ | ||
295 | |||
296 | /*! | ||
297 | * @addtogroup Cortex_Core_Configuration Cortex M4 Core Configuration | ||
298 | * @{ | ||
299 | */ | ||
300 | |||
301 | #define __MPU_PRESENT 1 /**< Defines if an MPU is present or not */ | ||
302 | #define __NVIC_PRIO_BITS 4 /**< Number of priority bits implemented in the NVIC */ | ||
303 | #define __Vendor_SysTickConfig 0 /**< Vendor specific implementation of SysTickConfig is defined */ | ||
304 | #define __FPU_PRESENT 1 /**< Defines if an FPU is present or not */ | ||
305 | |||
306 | #include "core_cm4.h" /* Core Peripheral Access Layer */ | ||
307 | #include "system_MK66F18.h" /* Device specific configuration file */ | ||
308 | |||
309 | /*! | ||
310 | * @} | ||
311 | */ /* end of group Cortex_Core_Configuration */ | ||
312 | |||
313 | |||
314 | /* ---------------------------------------------------------------------------- | ||
315 | -- Mapping Information | ||
316 | ---------------------------------------------------------------------------- */ | ||
317 | |||
318 | /*! | ||
319 | * @addtogroup Mapping_Information Mapping Information | ||
320 | * @{ | ||
321 | */ | ||
322 | |||
323 | /** Mapping Information */ | ||
324 | /*! | ||
325 | * @addtogroup edma_request | ||
326 | * @{ | ||
327 | */ | ||
328 | |||
329 | /******************************************************************************* | ||
330 | * Definitions | ||
331 | ******************************************************************************/ | ||
332 | |||
333 | /*! | ||
334 | * @brief Structure for the DMA hardware request | ||
335 | * | ||
336 | * Defines the structure for the DMA hardware request collections. The user can configure the | ||
337 | * hardware request into DMAMUX to trigger the DMA transfer accordingly. The index | ||
338 | * of the hardware request varies according to the to SoC. | ||
339 | */ | ||
340 | typedef enum _dma_request_source | ||
341 | { | ||
342 | kDmaRequestMux0Disable = 0|0x100U, /**< DMAMUX TriggerDisabled. */ | ||
343 | kDmaRequestMux0TSI0 = 1|0x100U, /**< TSI0. */ | ||
344 | kDmaRequestMux0UART0Rx = 2|0x100U, /**< UART0 Receive. */ | ||
345 | kDmaRequestMux0UART0Tx = 3|0x100U, /**< UART0 Transmit. */ | ||
346 | kDmaRequestMux0UART1Rx = 4|0x100U, /**< UART1 Receive. */ | ||
347 | kDmaRequestMux0UART1Tx = 5|0x100U, /**< UART1 Transmit. */ | ||
348 | kDmaRequestMux0UART2Rx = 6|0x100U, /**< UART2 Receive. */ | ||
349 | kDmaRequestMux0UART2Tx = 7|0x100U, /**< UART2 Transmit. */ | ||
350 | kDmaRequestMux0UART3Rx = 8|0x100U, /**< UART3 Receive. */ | ||
351 | kDmaRequestMux0UART3Tx = 9|0x100U, /**< UART3 Transmit. */ | ||
352 | kDmaRequestMux0UART4 = 10|0x100U, /**< UART4 Transmit or Receive. */ | ||
353 | kDmaRequestMux0Reserved11 = 11|0x100U, /**< Reserved11 */ | ||
354 | kDmaRequestMux0I2S0Rx = 12|0x100U, /**< I2S0 Receive. */ | ||
355 | kDmaRequestMux0I2S0Tx = 13|0x100U, /**< I2S0 Transmit. */ | ||
356 | kDmaRequestMux0SPI0Rx = 14|0x100U, /**< SPI0 Receive. */ | ||
357 | kDmaRequestMux0SPI0Tx = 15|0x100U, /**< SPI0 Transmit. */ | ||
358 | kDmaRequestMux0SPI1Rx = 16|0x100U, /**< SPI1 Receive. */ | ||
359 | kDmaRequestMux0SPI1Tx = 17|0x100U, /**< SPI1 Transmit. */ | ||
360 | kDmaRequestMux0I2C0I2C3 = 18|0x100U, /**< I2C0 and I2C3. */ | ||
361 | kDmaRequestMux0I2C0 = 18|0x100U, /**< I2C0 and I2C3. */ | ||
362 | kDmaRequestMux0I2C3 = 18|0x100U, /**< I2C0 and I2C3. */ | ||
363 | kDmaRequestMux0I2C1I2C2 = 19|0x100U, /**< I2C1 and I2C2. */ | ||
364 | kDmaRequestMux0I2C1 = 19|0x100U, /**< I2C1 and I2C2. */ | ||
365 | kDmaRequestMux0I2C2 = 19|0x100U, /**< I2C1 and I2C2. */ | ||
366 | kDmaRequestMux0FTM0Channel0 = 20|0x100U, /**< FTM0 C0V. */ | ||
367 | kDmaRequestMux0FTM0Channel1 = 21|0x100U, /**< FTM0 C1V. */ | ||
368 | kDmaRequestMux0FTM0Channel2 = 22|0x100U, /**< FTM0 C2V. */ | ||
369 | kDmaRequestMux0FTM0Channel3 = 23|0x100U, /**< FTM0 C3V. */ | ||
370 | kDmaRequestMux0FTM0Channel4 = 24|0x100U, /**< FTM0 C4V. */ | ||
371 | kDmaRequestMux0FTM0Channel5 = 25|0x100U, /**< FTM0 C5V. */ | ||
372 | kDmaRequestMux0FTM0Channel6 = 26|0x100U, /**< FTM0 C6V. */ | ||
373 | kDmaRequestMux0FTM0Channel7 = 27|0x100U, /**< FTM0 C7V. */ | ||
374 | kDmaRequestMux0FTM1TPM1Channel0 = 28|0x100U, /**< FTM1 C0V and TPM1 C0V. */ | ||
375 | kDmaRequestMux0FTM1Channel0 = 28|0x100U, /**< FTM1 C0V and TPM1 C0V. */ | ||
376 | kDmaRequestMux0TPM1Channel0 = 28|0x100U, /**< FTM1 C0V and TPM1 C0V. */ | ||
377 | kDmaRequestMux0FTM1TPM1Channel1 = 29|0x100U, /**< FTM1 C1V and TPM1 C1V. */ | ||
378 | kDmaRequestMux0FTM1Channel1 = 29|0x100U, /**< FTM1 C1V and TPM1 C1V. */ | ||
379 | kDmaRequestMux0TPM1Channel1 = 29|0x100U, /**< FTM1 C1V and TPM1 C1V. */ | ||
380 | kDmaRequestMux0FTM2TPM2Channel0 = 30|0x100U, /**< FTM2 C0V and TPM2 C0V. */ | ||
381 | kDmaRequestMux0FTM2Channel0 = 30|0x100U, /**< FTM2 C0V and TPM2 C0V. */ | ||
382 | kDmaRequestMux0TPM2Channel0 = 30|0x100U, /**< FTM2 C0V and TPM2 C0V. */ | ||
383 | kDmaRequestMux0FTM2TPM2Channel1 = 31|0x100U, /**< FTM2 C1V and TPM2 C1V. */ | ||
384 | kDmaRequestMux0FTM2Channel1 = 31|0x100U, /**< FTM2 C1V and TPM2 C1V. */ | ||
385 | kDmaRequestMux0TPM2Channel1 = 31|0x100U, /**< FTM2 C1V and TPM2 C1V. */ | ||
386 | kDmaRequestMux0FTM3Channel0 = 32|0x100U, /**< FTM3 C0V. */ | ||
387 | kDmaRequestMux0FTM3Channel1 = 33|0x100U, /**< FTM3 C1V. */ | ||
388 | kDmaRequestMux0FTM3Channel2 = 34|0x100U, /**< FTM3 C2V. */ | ||
389 | kDmaRequestMux0FTM3Channel3 = 35|0x100U, /**< FTM3 C3V. */ | ||
390 | kDmaRequestMux0FTM3Channel4 = 36|0x100U, /**< FTM3 C4V. */ | ||
391 | kDmaRequestMux0FTM3Channel5 = 37|0x100U, /**< FTM3 C5V. */ | ||
392 | kDmaRequestMux0FTM3Channel6SPI2Rx = 38|0x100U, /**< FTM3 C6V and SPI2 Receive. */ | ||
393 | kDmaRequestMux0FTM3Channel6 = 38|0x100U, /**< FTM3 C6V and SPI2 Receive. */ | ||
394 | kDmaRequestMux0SPI2Rx = 38|0x100U, /**< FTM3 C6V and SPI2 Receive. */ | ||
395 | kDmaRequestMux0FTM3Channel7SPI2Tx = 39|0x100U, /**< FTM3 C7V and SPI2 Transmit. */ | ||
396 | kDmaRequestMux0FTM3Channel7 = 39|0x100U, /**< FTM3 C7V and SPI2 Transmit. */ | ||
397 | kDmaRequestMux0SPI2Tx = 39|0x100U, /**< FTM3 C7V and SPI2 Transmit. */ | ||
398 | kDmaRequestMux0ADC0 = 40|0x100U, /**< ADC0. */ | ||
399 | kDmaRequestMux0ADC1 = 41|0x100U, /**< ADC1. */ | ||
400 | kDmaRequestMux0CMP0 = 42|0x100U, /**< CMP0. */ | ||
401 | kDmaRequestMux0CMP1 = 43|0x100U, /**< CMP1. */ | ||
402 | kDmaRequestMux0CMP2CMP3 = 44|0x100U, /**< CMP2 and CMP3. */ | ||
403 | kDmaRequestMux0CMP2 = 44|0x100U, /**< CMP2 and CMP3. */ | ||
404 | kDmaRequestMux0CMP3 = 44|0x100U, /**< CMP2 and CMP3. */ | ||
405 | kDmaRequestMux0DAC0 = 45|0x100U, /**< DAC0. */ | ||
406 | kDmaRequestMux0DAC1 = 46|0x100U, /**< DAC1. */ | ||
407 | kDmaRequestMux0CMT = 47|0x100U, /**< CMT. */ | ||
408 | kDmaRequestMux0PDB = 48|0x100U, /**< PDB0. */ | ||
409 | kDmaRequestMux0PortA = 49|0x100U, /**< PTA. */ | ||
410 | kDmaRequestMux0PortB = 50|0x100U, /**< PTB. */ | ||
411 | kDmaRequestMux0PortC = 51|0x100U, /**< PTC. */ | ||
412 | kDmaRequestMux0PortD = 52|0x100U, /**< PTD. */ | ||
413 | kDmaRequestMux0PortE = 53|0x100U, /**< PTE. */ | ||
414 | kDmaRequestMux0IEEE1588Timer0 = 54|0x100U, /**< ENET IEEE 1588 timer 0. */ | ||
415 | kDmaRequestMux0IEEE1588Timer1TPM1Overflow = 55|0x100U, /**< ENET IEEE 1588 timer 1 and TPM1. */ | ||
416 | kDmaRequestMux0IEEE1588Timer1 = 55|0x100U, /**< ENET IEEE 1588 timer 1 and TPM1. */ | ||
417 | kDmaRequestMux0TPM1Overflow = 55|0x100U, /**< ENET IEEE 1588 timer 1 and TPM1. */ | ||
418 | kDmaRequestMux0IEEE1588Timer2TPM2Overflow = 56|0x100U, /**< ENET IEEE 1588 timer 2 and TPM2. */ | ||
419 | kDmaRequestMux0IEEE1588Timer2 = 56|0x100U, /**< ENET IEEE 1588 timer 2 and TPM2. */ | ||
420 | kDmaRequestMux0TPM2Overflow = 56|0x100U, /**< ENET IEEE 1588 timer 2 and TPM2. */ | ||
421 | kDmaRequestMux0IEEE1588Timer3 = 57|0x100U, /**< ENET IEEE 1588 timer 3. */ | ||
422 | kDmaRequestMux0LPUART0Rx = 58|0x100U, /**< LPUART0 Receive. */ | ||
423 | kDmaRequestMux0LPUART0Tx = 59|0x100U, /**< LPUART0 Transmit. */ | ||
424 | kDmaRequestMux0AlwaysOn60 = 60|0x100U, /**< DMAMUX Always Enabled slot. */ | ||
425 | kDmaRequestMux0AlwaysOn61 = 61|0x100U, /**< DMAMUX Always Enabled slot. */ | ||
426 | kDmaRequestMux0AlwaysOn62 = 62|0x100U, /**< DMAMUX Always Enabled slot. */ | ||
427 | kDmaRequestMux0AlwaysOn63 = 63|0x100U, /**< DMAMUX Always Enabled slot. */ | ||
428 | } dma_request_source_t; | ||
429 | |||
430 | /* @} */ | ||
431 | |||
432 | |||
433 | /*! | ||
434 | * @} | ||
435 | */ /* end of group Mapping_Information */ | ||
436 | |||
437 | |||
438 | /* ---------------------------------------------------------------------------- | ||
439 | -- Device Peripheral Access Layer | ||
440 | ---------------------------------------------------------------------------- */ | ||
441 | |||
442 | /*! | ||
443 | * @addtogroup Peripheral_access_layer Device Peripheral Access Layer | ||
444 | * @{ | ||
445 | */ | ||
446 | |||
447 | |||
448 | /* | ||
449 | ** Start of section using anonymous unions | ||
450 | */ | ||
451 | |||
452 | #if defined(__ARMCC_VERSION) | ||
453 | #if (__ARMCC_VERSION >= 6010050) | ||
454 | #pragma clang diagnostic push | ||
455 | #else | ||
456 | #pragma push | ||
457 | #pragma anon_unions | ||
458 | #endif | ||
459 | #elif defined(__CWCC__) | ||
460 | #pragma push | ||
461 | #pragma cpp_extensions on | ||
462 | #elif defined(__GNUC__) | ||
463 | /* anonymous unions are enabled by default */ | ||
464 | #elif defined(__IAR_SYSTEMS_ICC__) | ||
465 | #pragma language=extended | ||
466 | #else | ||
467 | #error Not supported compiler type | ||
468 | #endif | ||
469 | |||
470 | /* ---------------------------------------------------------------------------- | ||
471 | -- ADC Peripheral Access Layer | ||
472 | ---------------------------------------------------------------------------- */ | ||
473 | |||
474 | /*! | ||
475 | * @addtogroup ADCx_Peripheral_Access_Layer ADC Peripheral Access Layer | ||
476 | * @{ | ||
477 | */ | ||
478 | |||
479 | /** ADC - Register Layout Typedef */ | ||
480 | typedef struct { | ||
481 | __IO uint32_t SC1A; /**< ADC Status and Control Registers 1, array offset: 0x0, array step: 0x4 */ | ||
482 | __IO uint32_t SC1B; /**< ADC Status and Control Registers 1, array offset: 0x0, array step: 0x4 */ | ||
483 | __IO uint32_t CFG1; /**< ADC Configuration Register 1, offset: 0x8 */ | ||
484 | __IO uint32_t CFG2; /**< ADC Configuration Register 2, offset: 0xC */ | ||
485 | __I uint32_t RA; /**< ADC Data Result Register, array offset: 0x10, array step: 0x4 */ | ||
486 | __I uint32_t RB; /**< ADC Data Result Register, array offset: 0x10, array step: 0x4 */ | ||
487 | __IO uint32_t CV1; /**< Compare Value Registers, offset: 0x18 */ | ||
488 | __IO uint32_t CV2; /**< Compare Value Registers, offset: 0x1C */ | ||
489 | __IO uint32_t SC2; /**< Status and Control Register 2, offset: 0x20 */ | ||
490 | __IO uint32_t SC3; /**< Status and Control Register 3, offset: 0x24 */ | ||
491 | __IO uint32_t OFS; /**< ADC Offset Correction Register, offset: 0x28 */ | ||
492 | __IO uint32_t PG; /**< ADC Plus-Side Gain Register, offset: 0x2C */ | ||
493 | __IO uint32_t MG; /**< ADC Minus-Side Gain Register, offset: 0x30 */ | ||
494 | __IO uint32_t CLPD; /**< ADC Plus-Side General Calibration Value Register, offset: 0x34 */ | ||
495 | __IO uint32_t CLPS; /**< ADC Plus-Side General Calibration Value Register, offset: 0x38 */ | ||
496 | __IO uint32_t CLP4; /**< ADC Plus-Side General Calibration Value Register, offset: 0x3C */ | ||
497 | __IO uint32_t CLP3; /**< ADC Plus-Side General Calibration Value Register, offset: 0x40 */ | ||
498 | __IO uint32_t CLP2; /**< ADC Plus-Side General Calibration Value Register, offset: 0x44 */ | ||
499 | __IO uint32_t CLP1; /**< ADC Plus-Side General Calibration Value Register, offset: 0x48 */ | ||
500 | __IO uint32_t CLP0; /**< ADC Plus-Side General Calibration Value Register, offset: 0x4C */ | ||
501 | uint8_t RESERVED_0[4]; | ||
502 | __IO uint32_t CLMD; /**< ADC Minus-Side General Calibration Value Register, offset: 0x54 */ | ||
503 | __IO uint32_t CLMS; /**< ADC Minus-Side General Calibration Value Register, offset: 0x58 */ | ||
504 | __IO uint32_t CLM4; /**< ADC Minus-Side General Calibration Value Register, offset: 0x5C */ | ||
505 | __IO uint32_t CLM3; /**< ADC Minus-Side General Calibration Value Register, offset: 0x60 */ | ||
506 | __IO uint32_t CLM2; /**< ADC Minus-Side General Calibration Value Register, offset: 0x64 */ | ||
507 | __IO uint32_t CLM1; /**< ADC Minus-Side General Calibration Value Register, offset: 0x68 */ | ||
508 | __IO uint32_t CLM0; /**< ADC Minus-Side General Calibration Value Register, offset: 0x6C */ | ||
509 | } ADC_TypeDef; | ||
510 | |||
511 | /* ---------------------------------------------------------------------------- | ||
512 | -- ADC Register Masks | ||
513 | ---------------------------------------------------------------------------- */ | ||
514 | |||
515 | /*! | ||
516 | * @addtogroup ADCx_Register_Masks ADC Register Masks | ||
517 | * @{ | ||
518 | */ | ||
519 | |||
520 | /*! @name SC1 - ADC Status and Control Registers 1 */ | ||
521 | #define ADCx_SC1n_ADCH_MASK (0x1FU) | ||
522 | #define ADCx_SC1n_ADCH_SHIFT (0U) | ||
523 | #define ADCx_SC1n_ADCH(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC1n_ADCH_SHIFT)) & ADCx_SC1n_ADCH_MASK) | ||
524 | #define ADCx_SC1n_DIFF_MASK (0x20U) | ||
525 | #define ADCx_SC1n_DIFF_SHIFT (5U) | ||
526 | #define ADCx_SC1n_DIFF_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC1n_DIFF_SHIFT)) & ADCx_SC1n_DIFF_MASK) | ||
527 | #define ADCx_SC1n_DIFF ADCx_SC1n_DIFF_MASK | ||
528 | #define ADCx_SC1n_AIEN_MASK (0x40U) | ||
529 | #define ADCx_SC1n_AIEN_SHIFT (6U) | ||
530 | #define ADCx_SC1n_AIEN_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC1n_AIEN_SHIFT)) & ADCx_SC1n_AIEN_MASK) | ||
531 | #define ADCx_SC1n_AIEN ADCx_SC1n_AIEN_MASK | ||
532 | #define ADCx_SC1n_COCO_MASK (0x80U) | ||
533 | #define ADCx_SC1n_COCO_SHIFT (7U) | ||
534 | #define ADCx_SC1n_COCO_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC1n_COCO_SHIFT)) & ADCx_SC1n_COCO_MASK) | ||
535 | #define ADCx_SC1n_COCO ADCx_SC1n_COCO_MASK | ||
536 | |||
537 | /* The count of ADCx_SC1n */ | ||
538 | #define ADCx_SC1n_COUNT (2U) | ||
539 | |||
540 | /*! @name CFG1 - ADC Configuration Register 1 */ | ||
541 | #define ADCx_CFG1_ADICLK_MASK (0x3U) | ||
542 | #define ADCx_CFG1_ADICLK_SHIFT (0U) | ||
543 | #define ADCx_CFG1_ADICLK(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG1_ADICLK_SHIFT)) & ADCx_CFG1_ADICLK_MASK) | ||
544 | #define ADCx_CFG1_MODE_MASK (0xCU) | ||
545 | #define ADCx_CFG1_MODE_SHIFT (2U) | ||
546 | #define ADCx_CFG1_MODE_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG1_MODE_SHIFT)) & ADCx_CFG1_MODE_MASK) | ||
547 | #define ADCx_CFG1_MODE ADCx_CFG1_MODE_MASK | ||
548 | #define ADCx_CFG1_ADLSMP_MASK (0x10U) | ||
549 | #define ADCx_CFG1_ADLSMP_SHIFT (4U) | ||
550 | #define ADCx_CFG1_ADLSMP_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG1_ADLSMP_SHIFT)) & ADCx_CFG1_ADLSMP_MASK) | ||
551 | #define ADCx_CFG1_ADLSMP ADCx_CFG1_ADLSMP_MASK | ||
552 | #define ADCx_CFG1_ADIV_MASK (0x60U) | ||
553 | #define ADCx_CFG1_ADIV_SHIFT (5U) | ||
554 | #define ADCx_CFG1_ADIV(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG1_ADIV_SHIFT)) & ADCx_CFG1_ADIV_MASK) | ||
555 | #define ADCx_CFG1_ADLPC_MASK (0x80U) | ||
556 | #define ADCx_CFG1_ADLPC_SHIFT (7U) | ||
557 | #define ADCx_CFG1_ADLPC_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG1_ADLPC_SHIFT)) & ADCx_CFG1_ADLPC_MASK) | ||
558 | #define ADCx_CFG1_ADLPC ADCx_CFG1_ADLPC_MASK | ||
559 | |||
560 | /*! @name CFG2 - ADC Configuration Register 2 */ | ||
561 | #define ADCx_CFG2_ADLSTS_MASK (0x3U) | ||
562 | #define ADCx_CFG2_ADLSTS_SHIFT (0U) | ||
563 | #define ADCx_CFG2_ADLSTS_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG2_ADLSTS_SHIFT)) & ADCx_CFG2_ADLSTS_MASK) | ||
564 | #define ADCx_CFG2_ADLSTS ADCx_CFG2_ADLSTS_MASK | ||
565 | #define ADCx_CFG2_ADHSC_MASK (0x4U) | ||
566 | #define ADCx_CFG2_ADHSC_SHIFT (2U) | ||
567 | #define ADCx_CFG2_ADHSC_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG2_ADHSC_SHIFT)) & ADCx_CFG2_ADHSC_MASK) | ||
568 | #define ADCx_CFG2_ADHSC ADCx_CFG2_ADHSC_MASK | ||
569 | #define ADCx_CFG2_ADACKEN_MASK (0x8U) | ||
570 | #define ADCx_CFG2_ADACKEN_SHIFT (3U) | ||
571 | #define ADCx_CFG2_ADACKEN_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG2_ADACKEN_SHIFT)) & ADCx_CFG2_ADACKEN_MASK) | ||
572 | #define ADCx_CFG2_ADACKEN ADCx_CFG2_ADACKEN_MASK | ||
573 | #define ADCx_CFG2_MUXSEL_MASK (0x10U) | ||
574 | #define ADCx_CFG2_MUXSEL_SHIFT (4U) | ||
575 | #define ADCx_CFG2_MUXSEL_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CFG2_MUXSEL_SHIFT)) & ADCx_CFG2_MUXSEL_MASK) | ||
576 | #define ADCx_CFG2_MUXSEL ADCx_CFG2_MUXSEL_MASK | ||
577 | |||
578 | /*! @name R - ADC Data Result Register */ | ||
579 | #define ADCx_R_D_MASK (0xFFFFU) | ||
580 | #define ADCx_R_D_SHIFT (0U) | ||
581 | #define ADCx_R_D_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_R_D_SHIFT)) & ADCx_R_D_MASK) | ||
582 | #define ADCx_R_D ADCx_R_D_MASK | ||
583 | |||
584 | /* The count of ADCx_R */ | ||
585 | #define ADCx_R_COUNT (2U) | ||
586 | |||
587 | /*! @name CV1 - Compare Value Registers */ | ||
588 | #define ADCx_CV1_CV_MASK (0xFFFFU) | ||
589 | #define ADCx_CV1_CV_SHIFT (0U) | ||
590 | #define ADCx_CV1_CV_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CV1_CV_SHIFT)) & ADCx_CV1_CV_MASK) | ||
591 | #define ADCx_CV1_CV ADCx_CV1_CV_MASK | ||
592 | |||
593 | /*! @name CV2 - Compare Value Registers */ | ||
594 | #define ADCx_CV2_CV_MASK (0xFFFFU) | ||
595 | #define ADCx_CV2_CV_SHIFT (0U) | ||
596 | #define ADCx_CV2_CV_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CV2_CV_SHIFT)) & ADCx_CV2_CV_MASK) | ||
597 | #define ADCx_CV2_CV ADCx_CV2_CV_MASK | ||
598 | |||
599 | /*! @name SC2 - Status and Control Register 2 */ | ||
600 | #define ADCx_SC2_REFSEL_MASK (0x3U) | ||
601 | #define ADCx_SC2_REFSEL_SHIFT (0U) | ||
602 | #define ADCx_SC2_REFSEL_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC2_REFSEL_SHIFT)) & ADCx_SC2_REFSEL_MASK) | ||
603 | #define ADCx_SC2_REFSEL ADCx_SC2_REFSEL_MASK | ||
604 | #define ADCx_SC2_DMAEN_MASK (0x4U) | ||
605 | #define ADCx_SC2_DMAEN_SHIFT (2U) | ||
606 | #define ADCx_SC2_DMAEN_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC2_DMAEN_SHIFT)) & ADCx_SC2_DMAEN_MASK) | ||
607 | #define ADCx_SC2_DMAEN ADCx_SC2_DMAEN_MASK | ||
608 | #define ADCx_SC2_ACREN_MASK (0x8U) | ||
609 | #define ADCx_SC2_ACREN_SHIFT (3U) | ||
610 | #define ADCx_SC2_ACREN_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC2_ACREN_SHIFT)) & ADCx_SC2_ACREN_MASK) | ||
611 | #define ADCx_SC2_ACREN ADCx_SC2_ACREN_MASK | ||
612 | #define ADCx_SC2_ACFGT_MASK (0x10U) | ||
613 | #define ADCx_SC2_ACFGT_SHIFT (4U) | ||
614 | #define ADCx_SC2_ACFGT_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC2_ACFGT_SHIFT)) & ADCx_SC2_ACFGT_MASK) | ||
615 | #define ADCx_SC2_ACFGT ADCx_SC2_ACFGT_MASK | ||
616 | #define ADCx_SC2_ACFE_MASK (0x20U) | ||
617 | #define ADCx_SC2_ACFE_SHIFT (5U) | ||
618 | #define ADCx_SC2_ACFE_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC2_ACFE_SHIFT)) & ADCx_SC2_ACFE_MASK) | ||
619 | #define ADCx_SC2_ACFE ADCx_SC2_ACFE_MASK | ||
620 | #define ADCx_SC2_ADTRG_MASK (0x40U) | ||
621 | #define ADCx_SC2_ADTRG_SHIFT (6U) | ||
622 | #define ADCx_SC2_ADTRG_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC2_ADTRG_SHIFT)) & ADCx_SC2_ADTRG_MASK) | ||
623 | #define ADCx_SC2_ADTRG ADCx_SC2_ADTRG_MASK | ||
624 | #define ADCx_SC2_ADACT_MASK (0x80U) | ||
625 | #define ADCx_SC2_ADACT_SHIFT (7U) | ||
626 | #define ADCx_SC2_ADACT_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC2_ADACT_SHIFT)) & ADCx_SC2_ADACT_MASK) | ||
627 | #define ADCx_SC2_ADACT ADCx_SC2_ADACT_MASK | ||
628 | |||
629 | /*! @name SC3 - Status and Control Register 3 */ | ||
630 | #define ADCx_SC3_AVGS_MASK (0x3U) | ||
631 | #define ADCx_SC3_AVGS_SHIFT (0U) | ||
632 | #define ADCx_SC3_AVGS(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC3_AVGS_SHIFT)) & ADCx_SC3_AVGS_MASK) | ||
633 | #define ADCx_SC3_AVGE_MASK (0x4U) | ||
634 | #define ADCx_SC3_AVGE_SHIFT (2U) | ||
635 | #define ADCx_SC3_AVGE_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC3_AVGE_SHIFT)) & ADCx_SC3_AVGE_MASK) | ||
636 | #define ADCx_SC3_AVGE ADCx_SC3_AVGE_MASK | ||
637 | #define ADCx_SC3_ADCO_MASK (0x8U) | ||
638 | #define ADCx_SC3_ADCO_SHIFT (3U) | ||
639 | #define ADCx_SC3_ADCO_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC3_ADCO_SHIFT)) & ADCx_SC3_ADCO_MASK) | ||
640 | #define ADCx_SC3_ADCO ADCx_SC3_ADCO_MASK | ||
641 | #define ADCx_SC3_CALF_MASK (0x40U) | ||
642 | #define ADCx_SC3_CALF_SHIFT (6U) | ||
643 | #define ADCx_SC3_CALF_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC3_CALF_SHIFT)) & ADCx_SC3_CALF_MASK) | ||
644 | #define ADCx_SC3_CALF ADCx_SC3_CALF_MASK | ||
645 | #define ADCx_SC3_CAL_MASK (0x80U) | ||
646 | #define ADCx_SC3_CAL_SHIFT (7U) | ||
647 | #define ADCx_SC3_CAL_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_SC3_CAL_SHIFT)) & ADCx_SC3_CAL_MASK) | ||
648 | #define ADCx_SC3_CAL ADCx_SC3_CAL_MASK | ||
649 | |||
650 | /*! @name OFS - ADC Offset Correction Register */ | ||
651 | #define ADCx_OFS_OFS_MASK (0xFFFFU) | ||
652 | #define ADCx_OFS_OFS_SHIFT (0U) | ||
653 | #define ADCx_OFS_OFS_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_OFS_OFS_SHIFT)) & ADCx_OFS_OFS_MASK) | ||
654 | #define ADCx_OFS_OFS ADCx_OFS_OFS_MASK | ||
655 | |||
656 | /*! @name PG - ADC Plus-Side Gain Register */ | ||
657 | #define ADCx_PG_PG_MASK (0xFFFFU) | ||
658 | #define ADCx_PG_PG_SHIFT (0U) | ||
659 | #define ADCx_PG_PG_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_PG_PG_SHIFT)) & ADCx_PG_PG_MASK) | ||
660 | #define ADCx_PG_PG ADCx_PG_PG_MASK | ||
661 | |||
662 | /*! @name MG - ADC Minus-Side Gain Register */ | ||
663 | #define ADCx_MG_MG_MASK (0xFFFFU) | ||
664 | #define ADCx_MG_MG_SHIFT (0U) | ||
665 | #define ADCx_MG_MG_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_MG_MG_SHIFT)) & ADCx_MG_MG_MASK) | ||
666 | #define ADCx_MG_MG ADCx_MG_MG_MASK | ||
667 | |||
668 | /*! @name CLPD - ADC Plus-Side General Calibration Value Register */ | ||
669 | #define ADCx_CLPD_CLPD_MASK (0x3FU) | ||
670 | #define ADCx_CLPD_CLPD_SHIFT (0U) | ||
671 | #define ADCx_CLPD_CLPD_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLPD_CLPD_SHIFT)) & ADCx_CLPD_CLPD_MASK) | ||
672 | #define ADCx_CLPD_CLPD ADCx_CLPD_CLPD_MASK | ||
673 | |||
674 | /*! @name CLPS - ADC Plus-Side General Calibration Value Register */ | ||
675 | #define ADCx_CLPS_CLPS_MASK (0x3FU) | ||
676 | #define ADCx_CLPS_CLPS_SHIFT (0U) | ||
677 | #define ADCx_CLPS_CLPS_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLPS_CLPS_SHIFT)) & ADCx_CLPS_CLPS_MASK) | ||
678 | #define ADCx_CLPS_CLPS ADCx_CLPS_CLPS_MASK | ||
679 | |||
680 | /*! @name CLP4 - ADC Plus-Side General Calibration Value Register */ | ||
681 | #define ADCx_CLP4_CLP4_MASK (0x3FFU) | ||
682 | #define ADCx_CLP4_CLP4_SHIFT (0U) | ||
683 | #define ADCx_CLP4_CLP4_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLP4_CLP4_SHIFT)) & ADCx_CLP4_CLP4_MASK) | ||
684 | #define ADCx_CLP4_CLP4 ADCx_CLP4_CLP4_MASK | ||
685 | |||
686 | /*! @name CLP3 - ADC Plus-Side General Calibration Value Register */ | ||
687 | #define ADCx_CLP3_CLP3_MASK (0x1FFU) | ||
688 | #define ADCx_CLP3_CLP3_SHIFT (0U) | ||
689 | #define ADCx_CLP3_CLP3_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLP3_CLP3_SHIFT)) & ADCx_CLP3_CLP3_MASK) | ||
690 | #define ADCx_CLP3_CLP3 ADCx_CLP3_CLP3_MASK | ||
691 | |||
692 | /*! @name CLP2 - ADC Plus-Side General Calibration Value Register */ | ||
693 | #define ADCx_CLP2_CLP2_MASK (0xFFU) | ||
694 | #define ADCx_CLP2_CLP2_SHIFT (0U) | ||
695 | #define ADCx_CLP2_CLP2_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLP2_CLP2_SHIFT)) & ADCx_CLP2_CLP2_MASK) | ||
696 | #define ADCx_CLP2_CLP2 ADCx_CLP2_CLP2_MASK | ||
697 | |||
698 | /*! @name CLP1 - ADC Plus-Side General Calibration Value Register */ | ||
699 | #define ADCx_CLP1_CLP1_MASK (0x7FU) | ||
700 | #define ADCx_CLP1_CLP1_SHIFT (0U) | ||
701 | #define ADCx_CLP1_CLP1_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLP1_CLP1_SHIFT)) & ADCx_CLP1_CLP1_MASK) | ||
702 | #define ADCx_CLP1_CLP1 ADCx_CLP1_CLP1_MASK | ||
703 | |||
704 | /*! @name CLP0 - ADC Plus-Side General Calibration Value Register */ | ||
705 | #define ADCx_CLP0_CLP0_MASK (0x3FU) | ||
706 | #define ADCx_CLP0_CLP0_SHIFT (0U) | ||
707 | #define ADCx_CLP0_CLP0_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLP0_CLP0_SHIFT)) & ADCx_CLP0_CLP0_MASK) | ||
708 | #define ADCx_CLP0_CLP0 ADCx_CLP0_CLP0_MASK | ||
709 | |||
710 | /*! @name CLMD - ADC Minus-Side General Calibration Value Register */ | ||
711 | #define ADCx_CLMD_CLMD_MASK (0x3FU) | ||
712 | #define ADCx_CLMD_CLMD_SHIFT (0U) | ||
713 | #define ADCx_CLMD_CLMD_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLMD_CLMD_SHIFT)) & ADCx_CLMD_CLMD_MASK) | ||
714 | #define ADCx_CLMD_CLMD ADCx_CLMD_CLMD_MASK | ||
715 | |||
716 | /*! @name CLMS - ADC Minus-Side General Calibration Value Register */ | ||
717 | #define ADCx_CLMS_CLMS_MASK (0x3FU) | ||
718 | #define ADCx_CLMS_CLMS_SHIFT (0U) | ||
719 | #define ADCx_CLMS_CLMS_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLMS_CLMS_SHIFT)) & ADCx_CLMS_CLMS_MASK) | ||
720 | #define ADCx_CLMS_CLMS ADCx_CLMS_CLMS_MASK | ||
721 | |||
722 | /*! @name CLM4 - ADC Minus-Side General Calibration Value Register */ | ||
723 | #define ADCx_CLM4_CLM4_MASK (0x3FFU) | ||
724 | #define ADCx_CLM4_CLM4_SHIFT (0U) | ||
725 | #define ADCx_CLM4_CLM4_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLM4_CLM4_SHIFT)) & ADCx_CLM4_CLM4_MASK) | ||
726 | #define ADCx_CLM4_CLM4 ADCx_CLM4_CLM4_MASK | ||
727 | |||
728 | /*! @name CLM3 - ADC Minus-Side General Calibration Value Register */ | ||
729 | #define ADCx_CLM3_CLM3_MASK (0x1FFU) | ||
730 | #define ADCx_CLM3_CLM3_SHIFT (0U) | ||
731 | #define ADCx_CLM3_CLM3_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLM3_CLM3_SHIFT)) & ADCx_CLM3_CLM3_MASK) | ||
732 | #define ADCx_CLM3_CLM3 ADCx_CLM3_CLM3_MASK | ||
733 | |||
734 | /*! @name CLM2 - ADC Minus-Side General Calibration Value Register */ | ||
735 | #define ADCx_CLM2_CLM2_MASK (0xFFU) | ||
736 | #define ADCx_CLM2_CLM2_SHIFT (0U) | ||
737 | #define ADCx_CLM2_CLM2_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLM2_CLM2_SHIFT)) & ADCx_CLM2_CLM2_MASK) | ||
738 | #define ADCx_CLM2_CLM2 ADCx_CLM2_CLM2_MASK | ||
739 | |||
740 | /*! @name CLM1 - ADC Minus-Side General Calibration Value Register */ | ||
741 | #define ADCx_CLM1_CLM1_MASK (0x7FU) | ||
742 | #define ADCx_CLM1_CLM1_SHIFT (0U) | ||
743 | #define ADCx_CLM1_CLM1_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLM1_CLM1_SHIFT)) & ADCx_CLM1_CLM1_MASK) | ||
744 | #define ADCx_CLM1_CLM1 ADCx_CLM1_CLM1_MASK | ||
745 | |||
746 | /*! @name CLM0 - ADC Minus-Side General Calibration Value Register */ | ||
747 | #define ADCx_CLM0_CLM0_MASK (0x3FU) | ||
748 | #define ADCx_CLM0_CLM0_SHIFT (0U) | ||
749 | #define ADCx_CLM0_CLM0_SET(x) (((uint32_t)(((uint32_t)(x)) << ADCx_CLM0_CLM0_SHIFT)) & ADCx_CLM0_CLM0_MASK) | ||
750 | #define ADCx_CLM0_CLM0 ADCx_CLM0_CLM0_MASK | ||
751 | |||
752 | |||
753 | /*! | ||
754 | * @} | ||
755 | */ /* end of group ADCx_Register_Masks */ | ||
756 | |||
757 | |||
758 | /* ADC - Peripheral instance base addresses */ | ||
759 | /** Peripheral ADC0 base address */ | ||
760 | #define ADC0_BASE (0x4003B000u) | ||
761 | /** Peripheral ADC0 base pointer */ | ||
762 | #define ADC0 ((ADC_TypeDef *)ADC0_BASE) | ||
763 | /** Peripheral ADC1 base address */ | ||
764 | #define ADC1_BASE (0x400BB000u) | ||
765 | /** Peripheral ADC1 base pointer */ | ||
766 | #define ADC1 ((ADC_TypeDef *)ADC1_BASE) | ||
767 | /** Array initializer of ADC peripheral base addresses */ | ||
768 | #define ADCx_BASE_ADDRS { ADC0_BASE, ADC1_BASE } | ||
769 | /** Array initializer of ADC peripheral base pointers */ | ||
770 | #define ADCx_BASE_PTRS { ADC0, ADC1 } | ||
771 | /** Interrupt vectors for the ADC peripheral type */ | ||
772 | #define ADCx_IRQS { ADC0_IRQn, ADC1_IRQn } | ||
773 | |||
774 | /*! | ||
775 | * @} | ||
776 | */ /* end of group ADCx_Peripheral_Access_Layer */ | ||
777 | |||
778 | |||
779 | /* ---------------------------------------------------------------------------- | ||
780 | -- AIPS Peripheral Access Layer | ||
781 | ---------------------------------------------------------------------------- */ | ||
782 | |||
783 | /*! | ||
784 | * @addtogroup AIPS_Peripheral_Access_Layer AIPS Peripheral Access Layer | ||
785 | * @{ | ||
786 | */ | ||
787 | |||
788 | /** AIPS - Register Layout Typedef */ | ||
789 | typedef struct { | ||
790 | __IO uint32_t MPRA; /**< Master Privilege Register A, offset: 0x0 */ | ||
791 | uint8_t RESERVED_0[28]; | ||
792 | __IO uint32_t PACRA; /**< Peripheral Access Control Register, offset: 0x20 */ | ||
793 | __IO uint32_t PACRB; /**< Peripheral Access Control Register, offset: 0x24 */ | ||
794 | __IO uint32_t PACRC; /**< Peripheral Access Control Register, offset: 0x28 */ | ||
795 | __IO uint32_t PACRD; /**< Peripheral Access Control Register, offset: 0x2C */ | ||
796 | uint8_t RESERVED_1[16]; | ||
797 | __IO uint32_t PACRE; /**< Peripheral Access Control Register, offset: 0x40 */ | ||
798 | __IO uint32_t PACRF; /**< Peripheral Access Control Register, offset: 0x44 */ | ||
799 | __IO uint32_t PACRG; /**< Peripheral Access Control Register, offset: 0x48 */ | ||
800 | __IO uint32_t PACRH; /**< Peripheral Access Control Register, offset: 0x4C */ | ||
801 | __IO uint32_t PACRI; /**< Peripheral Access Control Register, offset: 0x50 */ | ||
802 | __IO uint32_t PACRJ; /**< Peripheral Access Control Register, offset: 0x54 */ | ||
803 | __IO uint32_t PACRK; /**< Peripheral Access Control Register, offset: 0x58 */ | ||
804 | __IO uint32_t PACRL; /**< Peripheral Access Control Register, offset: 0x5C */ | ||
805 | __IO uint32_t PACRM; /**< Peripheral Access Control Register, offset: 0x60 */ | ||
806 | __IO uint32_t PACRN; /**< Peripheral Access Control Register, offset: 0x64 */ | ||
807 | __IO uint32_t PACRO; /**< Peripheral Access Control Register, offset: 0x68 */ | ||
808 | __IO uint32_t PACRP; /**< Peripheral Access Control Register, offset: 0x6C */ | ||
809 | } AIPS_TypeDef; | ||
810 | |||
811 | /* ---------------------------------------------------------------------------- | ||
812 | -- AIPS Register Masks | ||
813 | ---------------------------------------------------------------------------- */ | ||
814 | |||
815 | /*! | ||
816 | * @addtogroup AIPS_Register_Masks AIPS Register Masks | ||
817 | * @{ | ||
818 | */ | ||
819 | |||
820 | /*! @name MPRA - Master Privilege Register A */ | ||
821 | #define AIPS_MPRA_MPL6_MASK (0x10U) | ||
822 | #define AIPS_MPRA_MPL6_SHIFT (4U) | ||
823 | #define AIPS_MPRA_MPL6_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MPL6_SHIFT)) & AIPS_MPRA_MPL6_MASK) | ||
824 | #define AIPS_MPRA_MPL6 AIPS_MPRA_MPL6_MASK | ||
825 | #define AIPS_MPRA_MTW6_MASK (0x20U) | ||
826 | #define AIPS_MPRA_MTW6_SHIFT (5U) | ||
827 | #define AIPS_MPRA_MTW6_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTW6_SHIFT)) & AIPS_MPRA_MTW6_MASK) | ||
828 | #define AIPS_MPRA_MTW6 AIPS_MPRA_MTW6_MASK | ||
829 | #define AIPS_MPRA_MTR6_MASK (0x40U) | ||
830 | #define AIPS_MPRA_MTR6_SHIFT (6U) | ||
831 | #define AIPS_MPRA_MTR6_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTR6_SHIFT)) & AIPS_MPRA_MTR6_MASK) | ||
832 | #define AIPS_MPRA_MTR6 AIPS_MPRA_MTR6_MASK | ||
833 | #define AIPS_MPRA_MPL5_MASK (0x100U) | ||
834 | #define AIPS_MPRA_MPL5_SHIFT (8U) | ||
835 | #define AIPS_MPRA_MPL5_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MPL5_SHIFT)) & AIPS_MPRA_MPL5_MASK) | ||
836 | #define AIPS_MPRA_MPL5 AIPS_MPRA_MPL5_MASK | ||
837 | #define AIPS_MPRA_MTW5_MASK (0x200U) | ||
838 | #define AIPS_MPRA_MTW5_SHIFT (9U) | ||
839 | #define AIPS_MPRA_MTW5_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTW5_SHIFT)) & AIPS_MPRA_MTW5_MASK) | ||
840 | #define AIPS_MPRA_MTW5 AIPS_MPRA_MTW5_MASK | ||
841 | #define AIPS_MPRA_MTR5_MASK (0x400U) | ||
842 | #define AIPS_MPRA_MTR5_SHIFT (10U) | ||
843 | #define AIPS_MPRA_MTR5_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTR5_SHIFT)) & AIPS_MPRA_MTR5_MASK) | ||
844 | #define AIPS_MPRA_MTR5 AIPS_MPRA_MTR5_MASK | ||
845 | #define AIPS_MPRA_MPL4_MASK (0x1000U) | ||
846 | #define AIPS_MPRA_MPL4_SHIFT (12U) | ||
847 | #define AIPS_MPRA_MPL4_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MPL4_SHIFT)) & AIPS_MPRA_MPL4_MASK) | ||
848 | #define AIPS_MPRA_MPL4 AIPS_MPRA_MPL4_MASK | ||
849 | #define AIPS_MPRA_MTW4_MASK (0x2000U) | ||
850 | #define AIPS_MPRA_MTW4_SHIFT (13U) | ||
851 | #define AIPS_MPRA_MTW4_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTW4_SHIFT)) & AIPS_MPRA_MTW4_MASK) | ||
852 | #define AIPS_MPRA_MTW4 AIPS_MPRA_MTW4_MASK | ||
853 | #define AIPS_MPRA_MTR4_MASK (0x4000U) | ||
854 | #define AIPS_MPRA_MTR4_SHIFT (14U) | ||
855 | #define AIPS_MPRA_MTR4_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTR4_SHIFT)) & AIPS_MPRA_MTR4_MASK) | ||
856 | #define AIPS_MPRA_MTR4 AIPS_MPRA_MTR4_MASK | ||
857 | #define AIPS_MPRA_MPL3_MASK (0x10000U) | ||
858 | #define AIPS_MPRA_MPL3_SHIFT (16U) | ||
859 | #define AIPS_MPRA_MPL3_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MPL3_SHIFT)) & AIPS_MPRA_MPL3_MASK) | ||
860 | #define AIPS_MPRA_MPL3 AIPS_MPRA_MPL3_MASK | ||
861 | #define AIPS_MPRA_MTW3_MASK (0x20000U) | ||
862 | #define AIPS_MPRA_MTW3_SHIFT (17U) | ||
863 | #define AIPS_MPRA_MTW3_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTW3_SHIFT)) & AIPS_MPRA_MTW3_MASK) | ||
864 | #define AIPS_MPRA_MTW3 AIPS_MPRA_MTW3_MASK | ||
865 | #define AIPS_MPRA_MTR3_MASK (0x40000U) | ||
866 | #define AIPS_MPRA_MTR3_SHIFT (18U) | ||
867 | #define AIPS_MPRA_MTR3_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTR3_SHIFT)) & AIPS_MPRA_MTR3_MASK) | ||
868 | #define AIPS_MPRA_MTR3 AIPS_MPRA_MTR3_MASK | ||
869 | #define AIPS_MPRA_MPL2_MASK (0x100000U) | ||
870 | #define AIPS_MPRA_MPL2_SHIFT (20U) | ||
871 | #define AIPS_MPRA_MPL2_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MPL2_SHIFT)) & AIPS_MPRA_MPL2_MASK) | ||
872 | #define AIPS_MPRA_MPL2 AIPS_MPRA_MPL2_MASK | ||
873 | #define AIPS_MPRA_MTW2_MASK (0x200000U) | ||
874 | #define AIPS_MPRA_MTW2_SHIFT (21U) | ||
875 | #define AIPS_MPRA_MTW2_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTW2_SHIFT)) & AIPS_MPRA_MTW2_MASK) | ||
876 | #define AIPS_MPRA_MTW2 AIPS_MPRA_MTW2_MASK | ||
877 | #define AIPS_MPRA_MTR2_MASK (0x400000U) | ||
878 | #define AIPS_MPRA_MTR2_SHIFT (22U) | ||
879 | #define AIPS_MPRA_MTR2_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTR2_SHIFT)) & AIPS_MPRA_MTR2_MASK) | ||
880 | #define AIPS_MPRA_MTR2 AIPS_MPRA_MTR2_MASK | ||
881 | #define AIPS_MPRA_MPL1_MASK (0x1000000U) | ||
882 | #define AIPS_MPRA_MPL1_SHIFT (24U) | ||
883 | #define AIPS_MPRA_MPL1_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MPL1_SHIFT)) & AIPS_MPRA_MPL1_MASK) | ||
884 | #define AIPS_MPRA_MPL1 AIPS_MPRA_MPL1_MASK | ||
885 | #define AIPS_MPRA_MTW1_MASK (0x2000000U) | ||
886 | #define AIPS_MPRA_MTW1_SHIFT (25U) | ||
887 | #define AIPS_MPRA_MTW1_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTW1_SHIFT)) & AIPS_MPRA_MTW1_MASK) | ||
888 | #define AIPS_MPRA_MTW1 AIPS_MPRA_MTW1_MASK | ||
889 | #define AIPS_MPRA_MTR1_MASK (0x4000000U) | ||
890 | #define AIPS_MPRA_MTR1_SHIFT (26U) | ||
891 | #define AIPS_MPRA_MTR1_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTR1_SHIFT)) & AIPS_MPRA_MTR1_MASK) | ||
892 | #define AIPS_MPRA_MTR1 AIPS_MPRA_MTR1_MASK | ||
893 | #define AIPS_MPRA_MPL0_MASK (0x10000000U) | ||
894 | #define AIPS_MPRA_MPL0_SHIFT (28U) | ||
895 | #define AIPS_MPRA_MPL0_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MPL0_SHIFT)) & AIPS_MPRA_MPL0_MASK) | ||
896 | #define AIPS_MPRA_MPL0 AIPS_MPRA_MPL0_MASK | ||
897 | #define AIPS_MPRA_MTW0_MASK (0x20000000U) | ||
898 | #define AIPS_MPRA_MTW0_SHIFT (29U) | ||
899 | #define AIPS_MPRA_MTW0_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTW0_SHIFT)) & AIPS_MPRA_MTW0_MASK) | ||
900 | #define AIPS_MPRA_MTW0 AIPS_MPRA_MTW0_MASK | ||
901 | #define AIPS_MPRA_MTR0_MASK (0x40000000U) | ||
902 | #define AIPS_MPRA_MTR0_SHIFT (30U) | ||
903 | #define AIPS_MPRA_MTR0_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_MPRA_MTR0_SHIFT)) & AIPS_MPRA_MTR0_MASK) | ||
904 | #define AIPS_MPRA_MTR0 AIPS_MPRA_MTR0_MASK | ||
905 | |||
906 | /*! @name PACRA - Peripheral Access Control Register */ | ||
907 | #define AIPS_PACRA_TP7_MASK (0x1U) | ||
908 | #define AIPS_PACRA_TP7_SHIFT (0U) | ||
909 | #define AIPS_PACRA_TP7_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_TP7_SHIFT)) & AIPS_PACRA_TP7_MASK) | ||
910 | #define AIPS_PACRA_TP7 AIPS_PACRA_TP7_MASK | ||
911 | #define AIPS_PACRA_WP7_MASK (0x2U) | ||
912 | #define AIPS_PACRA_WP7_SHIFT (1U) | ||
913 | #define AIPS_PACRA_WP7_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_WP7_SHIFT)) & AIPS_PACRA_WP7_MASK) | ||
914 | #define AIPS_PACRA_WP7 AIPS_PACRA_WP7_MASK | ||
915 | #define AIPS_PACRA_SP7_MASK (0x4U) | ||
916 | #define AIPS_PACRA_SP7_SHIFT (2U) | ||
917 | #define AIPS_PACRA_SP7_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_SP7_SHIFT)) & AIPS_PACRA_SP7_MASK) | ||
918 | #define AIPS_PACRA_SP7 AIPS_PACRA_SP7_MASK | ||
919 | #define AIPS_PACRA_TP6_MASK (0x10U) | ||
920 | #define AIPS_PACRA_TP6_SHIFT (4U) | ||
921 | #define AIPS_PACRA_TP6_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_TP6_SHIFT)) & AIPS_PACRA_TP6_MASK) | ||
922 | #define AIPS_PACRA_TP6 AIPS_PACRA_TP6_MASK | ||
923 | #define AIPS_PACRA_WP6_MASK (0x20U) | ||
924 | #define AIPS_PACRA_WP6_SHIFT (5U) | ||
925 | #define AIPS_PACRA_WP6_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_WP6_SHIFT)) & AIPS_PACRA_WP6_MASK) | ||
926 | #define AIPS_PACRA_WP6 AIPS_PACRA_WP6_MASK | ||
927 | #define AIPS_PACRA_SP6_MASK (0x40U) | ||
928 | #define AIPS_PACRA_SP6_SHIFT (6U) | ||
929 | #define AIPS_PACRA_SP6_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_SP6_SHIFT)) & AIPS_PACRA_SP6_MASK) | ||
930 | #define AIPS_PACRA_SP6 AIPS_PACRA_SP6_MASK | ||
931 | #define AIPS_PACRA_TP5_MASK (0x100U) | ||
932 | #define AIPS_PACRA_TP5_SHIFT (8U) | ||
933 | #define AIPS_PACRA_TP5_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_TP5_SHIFT)) & AIPS_PACRA_TP5_MASK) | ||
934 | #define AIPS_PACRA_TP5 AIPS_PACRA_TP5_MASK | ||
935 | #define AIPS_PACRA_WP5_MASK (0x200U) | ||
936 | #define AIPS_PACRA_WP5_SHIFT (9U) | ||
937 | #define AIPS_PACRA_WP5_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_WP5_SHIFT)) & AIPS_PACRA_WP5_MASK) | ||
938 | #define AIPS_PACRA_WP5 AIPS_PACRA_WP5_MASK | ||
939 | #define AIPS_PACRA_SP5_MASK (0x400U) | ||
940 | #define AIPS_PACRA_SP5_SHIFT (10U) | ||
941 | #define AIPS_PACRA_SP5_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_SP5_SHIFT)) & AIPS_PACRA_SP5_MASK) | ||
942 | #define AIPS_PACRA_SP5 AIPS_PACRA_SP5_MASK | ||
943 | #define AIPS_PACRA_TP4_MASK (0x1000U) | ||
944 | #define AIPS_PACRA_TP4_SHIFT (12U) | ||
945 | #define AIPS_PACRA_TP4_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_TP4_SHIFT)) & AIPS_PACRA_TP4_MASK) | ||
946 | #define AIPS_PACRA_TP4 AIPS_PACRA_TP4_MASK | ||
947 | #define AIPS_PACRA_WP4_MASK (0x2000U) | ||
948 | #define AIPS_PACRA_WP4_SHIFT (13U) | ||
949 | #define AIPS_PACRA_WP4_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_WP4_SHIFT)) & AIPS_PACRA_WP4_MASK) | ||
950 | #define AIPS_PACRA_WP4 AIPS_PACRA_WP4_MASK | ||
951 | #define AIPS_PACRA_SP4_MASK (0x4000U) | ||
952 | #define AIPS_PACRA_SP4_SHIFT (14U) | ||
953 | #define AIPS_PACRA_SP4_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_SP4_SHIFT)) & AIPS_PACRA_SP4_MASK) | ||
954 | #define AIPS_PACRA_SP4 AIPS_PACRA_SP4_MASK | ||
955 | #define AIPS_PACRA_TP3_MASK (0x10000U) | ||
956 | #define AIPS_PACRA_TP3_SHIFT (16U) | ||
957 | #define AIPS_PACRA_TP3_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_TP3_SHIFT)) & AIPS_PACRA_TP3_MASK) | ||
958 | #define AIPS_PACRA_TP3 AIPS_PACRA_TP3_MASK | ||
959 | #define AIPS_PACRA_WP3_MASK (0x20000U) | ||
960 | #define AIPS_PACRA_WP3_SHIFT (17U) | ||
961 | #define AIPS_PACRA_WP3_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_WP3_SHIFT)) & AIPS_PACRA_WP3_MASK) | ||
962 | #define AIPS_PACRA_WP3 AIPS_PACRA_WP3_MASK | ||
963 | #define AIPS_PACRA_SP3_MASK (0x40000U) | ||
964 | #define AIPS_PACRA_SP3_SHIFT (18U) | ||
965 | #define AIPS_PACRA_SP3_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_SP3_SHIFT)) & AIPS_PACRA_SP3_MASK) | ||
966 | #define AIPS_PACRA_SP3 AIPS_PACRA_SP3_MASK | ||
967 | #define AIPS_PACRA_TP2_MASK (0x100000U) | ||
968 | #define AIPS_PACRA_TP2_SHIFT (20U) | ||
969 | #define AIPS_PACRA_TP2_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_TP2_SHIFT)) & AIPS_PACRA_TP2_MASK) | ||
970 | #define AIPS_PACRA_TP2 AIPS_PACRA_TP2_MASK | ||
971 | #define AIPS_PACRA_WP2_MASK (0x200000U) | ||
972 | #define AIPS_PACRA_WP2_SHIFT (21U) | ||
973 | #define AIPS_PACRA_WP2_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_WP2_SHIFT)) & AIPS_PACRA_WP2_MASK) | ||
974 | #define AIPS_PACRA_WP2 AIPS_PACRA_WP2_MASK | ||
975 | #define AIPS_PACRA_SP2_MASK (0x400000U) | ||
976 | #define AIPS_PACRA_SP2_SHIFT (22U) | ||
977 | #define AIPS_PACRA_SP2_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_SP2_SHIFT)) & AIPS_PACRA_SP2_MASK) | ||
978 | #define AIPS_PACRA_SP2 AIPS_PACRA_SP2_MASK | ||
979 | #define AIPS_PACRA_TP1_MASK (0x1000000U) | ||
980 | #define AIPS_PACRA_TP1_SHIFT (24U) | ||
981 | #define AIPS_PACRA_TP1_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_TP1_SHIFT)) & AIPS_PACRA_TP1_MASK) | ||
982 | #define AIPS_PACRA_TP1 AIPS_PACRA_TP1_MASK | ||
983 | #define AIPS_PACRA_WP1_MASK (0x2000000U) | ||
984 | #define AIPS_PACRA_WP1_SHIFT (25U) | ||
985 | #define AIPS_PACRA_WP1_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_WP1_SHIFT)) & AIPS_PACRA_WP1_MASK) | ||
986 | #define AIPS_PACRA_WP1 AIPS_PACRA_WP1_MASK | ||
987 | #define AIPS_PACRA_SP1_MASK (0x4000000U) | ||
988 | #define AIPS_PACRA_SP1_SHIFT (26U) | ||
989 | #define AIPS_PACRA_SP1_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_SP1_SHIFT)) & AIPS_PACRA_SP1_MASK) | ||
990 | #define AIPS_PACRA_SP1 AIPS_PACRA_SP1_MASK | ||
991 | #define AIPS_PACRA_TP0_MASK (0x10000000U) | ||
992 | #define AIPS_PACRA_TP0_SHIFT (28U) | ||
993 | #define AIPS_PACRA_TP0_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_TP0_SHIFT)) & AIPS_PACRA_TP0_MASK) | ||
994 | #define AIPS_PACRA_TP0 AIPS_PACRA_TP0_MASK | ||
995 | #define AIPS_PACRA_WP0_MASK (0x20000000U) | ||
996 | #define AIPS_PACRA_WP0_SHIFT (29U) | ||
997 | #define AIPS_PACRA_WP0_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_WP0_SHIFT)) & AIPS_PACRA_WP0_MASK) | ||
998 | #define AIPS_PACRA_WP0 AIPS_PACRA_WP0_MASK | ||
999 | #define AIPS_PACRA_SP0_MASK (0x40000000U) | ||
1000 | #define AIPS_PACRA_SP0_SHIFT (30U) | ||
1001 | #define AIPS_PACRA_SP0_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRA_SP0_SHIFT)) & AIPS_PACRA_SP0_MASK) | ||
1002 | #define AIPS_PACRA_SP0 AIPS_PACRA_SP0_MASK | ||
1003 | |||
1004 | /*! @name PACRB - Peripheral Access Control Register */ | ||
1005 | #define AIPS_PACRB_TP7_MASK (0x1U) | ||
1006 | #define AIPS_PACRB_TP7_SHIFT (0U) | ||
1007 | #define AIPS_PACRB_TP7_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRB_TP7_SHIFT)) & AIPS_PACRB_TP7_MASK) | ||
1008 | #define AIPS_PACRB_TP7 AIPS_PACRB_TP7_MASK | ||
1009 | #define AIPS_PACRB_WP7_MASK (0x2U) | ||
1010 | #define AIPS_PACRB_WP7_SHIFT (1U) | ||
1011 | #define AIPS_PACRB_WP7_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRB_WP7_SHIFT)) & AIPS_PACRB_WP7_MASK) | ||
1012 | #define AIPS_PACRB_WP7 AIPS_PACRB_WP7_MASK | ||
1013 | #define AIPS_PACRB_SP7_MASK (0x4U) | ||
1014 | #define AIPS_PACRB_SP7_SHIFT (2U) | ||
1015 | #define AIPS_PACRB_SP7_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRB_SP7_SHIFT)) & AIPS_PACRB_SP7_MASK) | ||
1016 | #define AIPS_PACRB_SP7 AIPS_PACRB_SP7_MASK | ||
1017 | #define AIPS_PACRB_TP6_MASK (0x10U) | ||
1018 | #define AIPS_PACRB_TP6_SHIFT (4U) | ||
1019 | #define AIPS_PACRB_TP6_SET(x) (((uint32_t)(((uint32_t)(x)) << AIPS_PACRB_TP6_SHIFT)) & AIPS_PACRB_TP6_MASK) | ||
1020 | #define AIPS_PACRB_TP6 AIPS_PACRB_TP6_MASK | ||
1021 | #define AIPS_PACRB_WP6_MASK (0x20U) | ||
1022 | #define |