diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005')
37 files changed, 28379 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/LPC54005.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/LPC54005.h new file mode 100644 index 000000000..2e7faec90 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/LPC54005.h | |||
@@ -0,0 +1,17145 @@ | |||
1 | /* | ||
2 | ** ################################################################### | ||
3 | ** Processors: LPC54005JBD100 | ||
4 | ** LPC54005JET100 | ||
5 | ** | ||
6 | ** Compilers: GNU C Compiler | ||
7 | ** IAR ANSI C/C++ Compiler for ARM | ||
8 | ** Keil ARM C/C++ Compiler | ||
9 | ** MCUXpresso Compiler | ||
10 | ** | ||
11 | ** Reference manual: LPC540xx/LPC54S0xx User manual Rev.0.8 5 June 2018 | ||
12 | ** Version: rev. 1.2, 2017-06-08 | ||
13 | ** Build: b200304 | ||
14 | ** | ||
15 | ** Abstract: | ||
16 | ** CMSIS Peripheral Access Layer for LPC54005 | ||
17 | ** | ||
18 | ** Copyright 1997-2016 Freescale Semiconductor, Inc. | ||
19 | ** Copyright 2016-2020 NXP | ||
20 | ** All rights reserved. | ||
21 | ** | ||
22 | ** SPDX-License-Identifier: BSD-3-Clause | ||
23 | ** | ||
24 | ** http: www.nxp.com | ||
25 | ** mail: [email protected] | ||
26 | ** | ||
27 | ** Revisions: | ||
28 | ** - rev. 1.0 (2016-08-12) | ||
29 | ** Initial version. | ||
30 | ** - rev. 1.1 (2016-11-25) | ||
31 | ** Update CANFD and Classic CAN register. | ||
32 | ** Add MAC TIMERSTAMP registers. | ||
33 | ** - rev. 1.2 (2017-06-08) | ||
34 | ** Remove RTC_CTRL_RTC_OSC_BYPASS. | ||
35 | ** SYSCON_ARMTRCLKDIV rename to SYSCON_ARMTRACECLKDIV. | ||
36 | ** Remove RESET and HALT from SYSCON_AHBCLKDIV. | ||
37 | ** | ||
38 | ** ################################################################### | ||
39 | */ | ||
40 | |||
41 | /*! | ||
42 | * @file LPC54005.h | ||
43 | * @version 1.2 | ||
44 | * @date 2017-06-08 | ||
45 | * @brief CMSIS Peripheral Access Layer for LPC54005 | ||
46 | * | ||
47 | * CMSIS Peripheral Access Layer for LPC54005 | ||
48 | */ | ||
49 | |||
50 | #ifndef _LPC54005_H_ | ||
51 | #define _LPC54005_H_ /**< Symbol preventing repeated inclusion */ | ||
52 | |||
53 | /** Memory map major version (memory maps with equal major version number are | ||
54 | * compatible) */ | ||
55 | #define MCU_MEM_MAP_VERSION 0x0100U | ||
56 | /** Memory map minor version */ | ||
57 | #define MCU_MEM_MAP_VERSION_MINOR 0x0002U | ||
58 | |||
59 | |||
60 | /* ---------------------------------------------------------------------------- | ||
61 | -- Interrupt vector numbers | ||
62 | ---------------------------------------------------------------------------- */ | ||
63 | |||
64 | /*! | ||
65 | * @addtogroup Interrupt_vector_numbers Interrupt vector numbers | ||
66 | * @{ | ||
67 | */ | ||
68 | |||
69 | /** Interrupt Number Definitions */ | ||
70 | #define NUMBER_OF_INT_VECTORS 73 /**< Number of interrupts in the Vector table */ | ||
71 | |||
72 | typedef enum IRQn { | ||
73 | /* Auxiliary constants */ | ||
74 | NotAvail_IRQn = -128, /**< Not available device specific interrupt */ | ||
75 | |||
76 | /* Core interrupts */ | ||
77 | NonMaskableInt_IRQn = -14, /**< Non Maskable Interrupt */ | ||
78 | HardFault_IRQn = -13, /**< Cortex-M4 SV Hard Fault Interrupt */ | ||
79 | MemoryManagement_IRQn = -12, /**< Cortex-M4 Memory Management Interrupt */ | ||
80 | BusFault_IRQn = -11, /**< Cortex-M4 Bus Fault Interrupt */ | ||
81 | UsageFault_IRQn = -10, /**< Cortex-M4 Usage Fault Interrupt */ | ||
82 | SVCall_IRQn = -5, /**< Cortex-M4 SV Call Interrupt */ | ||
83 | DebugMonitor_IRQn = -4, /**< Cortex-M4 Debug Monitor Interrupt */ | ||
84 | PendSV_IRQn = -2, /**< Cortex-M4 Pend SV Interrupt */ | ||
85 | SysTick_IRQn = -1, /**< Cortex-M4 System Tick Interrupt */ | ||
86 | |||
87 | /* Device specific interrupts */ | ||
88 | WDT_BOD_IRQn = 0, /**< Windowed watchdog timer, Brownout detect */ | ||
89 | DMA0_IRQn = 1, /**< DMA controller */ | ||
90 | GINT0_IRQn = 2, /**< GPIO group 0 */ | ||
91 | GINT1_IRQn = 3, /**< GPIO group 1 */ | ||
92 | PIN_INT0_IRQn = 4, /**< Pin interrupt 0 or pattern match engine slice 0 */ | ||
93 | PIN_INT1_IRQn = 5, /**< Pin interrupt 1or pattern match engine slice 1 */ | ||
94 | PIN_INT2_IRQn = 6, /**< Pin interrupt 2 or pattern match engine slice 2 */ | ||
95 | PIN_INT3_IRQn = 7, /**< Pin interrupt 3 or pattern match engine slice 3 */ | ||
96 | UTICK0_IRQn = 8, /**< Micro-tick Timer */ | ||
97 | MRT0_IRQn = 9, /**< Multi-rate timer */ | ||
98 | CTIMER0_IRQn = 10, /**< Standard counter/timer CTIMER0 */ | ||
99 | CTIMER1_IRQn = 11, /**< Standard counter/timer CTIMER1 */ | ||
100 | SCT0_IRQn = 12, /**< SCTimer/PWM */ | ||
101 | CTIMER3_IRQn = 13, /**< Standard counter/timer CTIMER3 */ | ||
102 | FLEXCOMM0_IRQn = 14, /**< Flexcomm Interface 0 (USART, SPI, I2C, FLEXCOMM) */ | ||
103 | FLEXCOMM1_IRQn = 15, /**< Flexcomm Interface 1 (USART, SPI, I2C, FLEXCOMM) */ | ||
104 | FLEXCOMM2_IRQn = 16, /**< Flexcomm Interface 2 (USART, SPI, I2C, FLEXCOMM) */ | ||
105 | FLEXCOMM3_IRQn = 17, /**< Flexcomm Interface 3 (USART, SPI, I2C, FLEXCOMM) */ | ||
106 | FLEXCOMM4_IRQn = 18, /**< Flexcomm Interface 4 (USART, SPI, I2C, FLEXCOMM) */ | ||
107 | FLEXCOMM5_IRQn = 19, /**< Flexcomm Interface 5 (USART, SPI, I2C,, FLEXCOMM) */ | ||
108 | FLEXCOMM6_IRQn = 20, /**< Flexcomm Interface 6 (USART, SPI, I2C, I2S,, FLEXCOMM) */ | ||
109 | FLEXCOMM7_IRQn = 21, /**< Flexcomm Interface 7 (USART, SPI, I2C, I2S,, FLEXCOMM) */ | ||
110 | ADC0_SEQA_IRQn = 22, /**< ADC0 sequence A completion. */ | ||
111 | ADC0_SEQB_IRQn = 23, /**< ADC0 sequence B completion. */ | ||
112 | ADC0_THCMP_IRQn = 24, /**< ADC0 threshold compare and error. */ | ||
113 | DMIC0_IRQn = 25, /**< Digital microphone and DMIC subsystem */ | ||
114 | HWVAD0_IRQn = 26, /**< Hardware Voice Activity Detector */ | ||
115 | USB0_NEEDCLK_IRQn = 27, /**< USB Activity Wake-up Interrupt */ | ||
116 | USB0_IRQn = 28, /**< USB device */ | ||
117 | RTC_IRQn = 29, /**< RTC alarm and wake-up interrupts */ | ||
118 | FLEXCOMM10_IRQn = 30, /**< Flexcomm Interface 10 (SPI, FLEXCOMM) */ | ||
119 | Reserved47_IRQn = 31, /**< Reserved interrupt */ | ||
120 | PIN_INT4_IRQn = 32, /**< Pin interrupt 4 or pattern match engine slice 4 int */ | ||
121 | PIN_INT5_IRQn = 33, /**< Pin interrupt 5 or pattern match engine slice 5 int */ | ||
122 | PIN_INT6_IRQn = 34, /**< Pin interrupt 6 or pattern match engine slice 6 int */ | ||
123 | PIN_INT7_IRQn = 35, /**< Pin interrupt 7 or pattern match engine slice 7 int */ | ||
124 | CTIMER2_IRQn = 36, /**< Standard counter/timer CTIMER2 */ | ||
125 | CTIMER4_IRQn = 37, /**< Standard counter/timer CTIMER4 */ | ||
126 | RIT_IRQn = 38, /**< Repetitive Interrupt Timer */ | ||
127 | SPIFI0_IRQn = 39, /**< SPI flash interface */ | ||
128 | FLEXCOMM8_IRQn = 40, /**< Flexcomm Interface 8 (USART, SPI, I2C, FLEXCOMM) */ | ||
129 | FLEXCOMM9_IRQn = 41, /**< Flexcomm Interface 9 (USART, SPI, I2C, FLEXCOMM) */ | ||
130 | SDIO_IRQn = 42, /**< SD/MMC */ | ||
131 | CAN0_IRQ0_IRQn = 43, /**< CAN0 interrupt0 */ | ||
132 | CAN0_IRQ1_IRQn = 44, /**< CAN0 interrupt1 */ | ||
133 | CAN1_IRQ0_IRQn = 45, /**< CAN1 interrupt0 */ | ||
134 | CAN1_IRQ1_IRQn = 46, /**< CAN1 interrupt1 */ | ||
135 | USB1_IRQn = 47, /**< USB1 interrupt */ | ||
136 | USB1_NEEDCLK_IRQn = 48, /**< USB1 activity */ | ||
137 | ETHERNET_IRQn = 49, /**< Ethernet */ | ||
138 | ETHERNET_PMT_IRQn = 50, /**< Ethernet power management interrupt */ | ||
139 | ETHERNET_MACLP_IRQn = 51, /**< Ethernet MAC interrupt */ | ||
140 | Reserved68_IRQn = 52, /**< Reserved interrupt */ | ||
141 | LCD_IRQn = 53, /**< LCD interrupt */ | ||
142 | SHA_IRQn = 54, /**< SHA interrupt */ | ||
143 | SMARTCARD0_IRQn = 55, /**< Smart card 0 interrupt */ | ||
144 | SMARTCARD1_IRQn = 56 /**< Smart card 1 interrupt */ | ||
145 | } IRQn_Type; | ||
146 | |||
147 | /*! | ||
148 | * @} | ||
149 | */ /* end of group Interrupt_vector_numbers */ | ||
150 | |||
151 | |||
152 | /* ---------------------------------------------------------------------------- | ||
153 | -- Cortex M4 Core Configuration | ||
154 | ---------------------------------------------------------------------------- */ | ||
155 | |||
156 | /*! | ||
157 | * @addtogroup Cortex_Core_Configuration Cortex M4 Core Configuration | ||
158 | * @{ | ||
159 | */ | ||
160 | |||
161 | #define __MPU_PRESENT 1 /**< Defines if an MPU is present or not */ | ||
162 | #define __NVIC_PRIO_BITS 3 /**< Number of priority bits implemented in the NVIC */ | ||
163 | #define __Vendor_SysTickConfig 0 /**< Vendor specific implementation of SysTickConfig is defined */ | ||
164 | #define __FPU_PRESENT 1 /**< Defines if an FPU is present or not */ | ||
165 | |||
166 | #include "core_cm4.h" /* Core Peripheral Access Layer */ | ||
167 | #include "system_LPC54005.h" /* Device specific configuration file */ | ||
168 | |||
169 | /*! | ||
170 | * @} | ||
171 | */ /* end of group Cortex_Core_Configuration */ | ||
172 | |||
173 | |||
174 | /* ---------------------------------------------------------------------------- | ||
175 | -- Mapping Information | ||
176 | ---------------------------------------------------------------------------- */ | ||
177 | |||
178 | /*! | ||
179 | * @addtogroup Mapping_Information Mapping Information | ||
180 | * @{ | ||
181 | */ | ||
182 | |||
183 | /** Mapping Information */ | ||
184 | /*! | ||
185 | * @addtogroup dma_request | ||
186 | * @{ | ||
187 | */ | ||
188 | |||
189 | /******************************************************************************* | ||
190 | * Definitions | ||
191 | ******************************************************************************/ | ||
192 | |||
193 | /*! | ||
194 | * @brief Structure for the DMA hardware request | ||
195 | * | ||
196 | * Defines the structure for the DMA hardware request collections. The user can configure the | ||
197 | * hardware request to trigger the DMA transfer accordingly. The index | ||
198 | * of the hardware request varies according to the to SoC. | ||
199 | */ | ||
200 | typedef enum _dma_request_source | ||
201 | { | ||
202 | kDmaRequestFlexcomm0Rx = 0U, /**< Flexcomm Interface 0 RX/I2C Slave */ | ||
203 | kDmaRequestFlexcomm0Tx = 1U, /**< Flexcomm Interface 0 TX/I2C Master */ | ||
204 | kDmaRequestFlexcomm1Rx = 2U, /**< Flexcomm Interface 1 RX/I2C Slave */ | ||
205 | kDmaRequestFlexcomm1Tx = 3U, /**< Flexcomm Interface 1 TX/I2C Master */ | ||
206 | kDmaRequestFlexcomm2Rx = 4U, /**< Flexcomm Interface 2 RX/I2C Slave */ | ||
207 | kDmaRequestFlexcomm2Tx = 5U, /**< Flexcomm Interface 2 TX/I2C Master */ | ||
208 | kDmaRequestFlexcomm3Rx = 6U, /**< Flexcomm Interface 3 RX/I2C Slave */ | ||
209 | kDmaRequestFlexcomm3Tx = 7U, /**< Flexcomm Interface 3 TX/I2C Master */ | ||
210 | kDmaRequestFlexcomm4Rx = 8U, /**< Flexcomm Interface 4 RX/I2C Slave */ | ||
211 | kDmaRequestFlexcomm4Tx = 9U, /**< Flexcomm Interface 4 TX/I2C Master */ | ||
212 | kDmaRequestFlexcomm5Rx = 10U, /**< Flexcomm Interface 5 RX/I2C Slave */ | ||
213 | kDmaRequestFlexcomm5Tx = 11U, /**< Flexcomm Interface 5 TX/I2C Master */ | ||
214 | kDmaRequestFlexcomm6Rx = 12U, /**< Flexcomm Interface 6 RX/I2C Slave */ | ||
215 | kDmaRequestFlexcomm6Tx = 13U, /**< Flexcomm Interface 6 TX/I2C Master */ | ||
216 | kDmaRequestFlexcomm7Rx = 14U, /**< Flexcomm Interface 7 RX/I2C Slave */ | ||
217 | kDmaRequestFlexcomm7Tx = 15U, /**< Flexcomm Interface 7 TX/I2C Master */ | ||
218 | kDmaRequestDMIC0 = 16U, /**< Digital microphone interface 0 channel 0 */ | ||
219 | kDmaRequestDMIC1 = 17U, /**< Digital microphone interface 0 channel 1 */ | ||
220 | kDmaRequestSPIFI = 18U, /**< SPI Flash Interface */ | ||
221 | kDmaRequestSHA = 19U, /**< Secure Hash Algorithm */ | ||
222 | kDmaRequestFlexcomm8Rx = 20U, /**< Flexcomm Interface 8 RX/I2C Slave */ | ||
223 | kDmaRequestFlexcomm8Tx = 21U, /**< Flexcomm Interface 8 TX/I2C Slave */ | ||
224 | kDmaRequestFlexcomm9Rx = 22U, /**< Flexcomm Interface 9 RX/I2C Slave */ | ||
225 | kDmaRequestFlexcomm9Tx = 23U, /**< Flexcomm Interface 9 TX/I2C Slave */ | ||
226 | kDmaRequestSMARTCARD0_RX = 24U, /**< SMARTCARD0 RX */ | ||
227 | kDmaRequestSMARTCARD0_TX = 25U, /**< SMARTCARD0 TX */ | ||
228 | kDmaRequestSMARTCARD1_RX = 26U, /**< SMARTCARD1 RX */ | ||
229 | kDmaRequestSMARTCARD1_TX = 27U, /**< SMARTCARD1 TX */ | ||
230 | kDmaRequestFlexcomm10Rx = 28U, /**< Flexcomm Interface 10 RX */ | ||
231 | kDmaRequestFlexcomm10Tx = 29U, /**< Flexcomm Interface 10 TX */ | ||
232 | } dma_request_source_t; | ||
233 | |||
234 | /* @} */ | ||
235 | |||
236 | |||
237 | /*! | ||
238 | * @} | ||
239 | */ /* end of group Mapping_Information */ | ||
240 | |||
241 | |||
242 | /* ---------------------------------------------------------------------------- | ||
243 | -- Device Peripheral Access Layer | ||
244 | ---------------------------------------------------------------------------- */ | ||
245 | |||
246 | /*! | ||
247 | * @addtogroup Peripheral_access_layer Device Peripheral Access Layer | ||
248 | * @{ | ||
249 | */ | ||
250 | |||
251 | |||
252 | /* | ||
253 | ** Start of section using anonymous unions | ||
254 | */ | ||
255 | |||
256 | #if defined(__ARMCC_VERSION) | ||
257 | #if (__ARMCC_VERSION >= 6010050) | ||
258 | #pragma clang diagnostic push | ||
259 | #else | ||
260 | #pragma push | ||
261 | #pragma anon_unions | ||
262 | #endif | ||
263 | #elif defined(__GNUC__) | ||
264 | /* anonymous unions are enabled by default */ | ||
265 | #elif defined(__IAR_SYSTEMS_ICC__) | ||
266 | #pragma language=extended | ||
267 | #else | ||
268 | #error Not supported compiler type | ||
269 | #endif | ||
270 | |||
271 | /* ---------------------------------------------------------------------------- | ||
272 | -- ADC Peripheral Access Layer | ||
273 | ---------------------------------------------------------------------------- */ | ||
274 | |||
275 | /*! | ||
276 | * @addtogroup ADC_Peripheral_Access_Layer ADC Peripheral Access Layer | ||
277 | * @{ | ||
278 | */ | ||
279 | |||
280 | /** ADC - Register Layout Typedef */ | ||
281 | typedef struct { | ||
282 | __IO uint32_t CTRL; /**< ADC Control register. Contains the clock divide value, resolution selection, sampling time selection, and mode controls., offset: 0x0 */ | ||
283 | __IO uint32_t INSEL; /**< Input Select. Allows selection of the temperature sensor as an alternate input to ADC channel 0., offset: 0x4 */ | ||
284 | __IO uint32_t SEQ_CTRL[2]; /**< ADC Conversion Sequence-n control register: Controls triggering and channel selection for conversion sequence-n. Also specifies interrupt mode for sequence-n., array offset: 0x8, array step: 0x4 */ | ||
285 | __I uint32_t SEQ_GDAT[2]; /**< ADC Sequence-n Global Data register. This register contains the result of the most recent ADC conversion performed under sequence-n., array offset: 0x10, array step: 0x4 */ | ||
286 | uint8_t RESERVED_0[8]; | ||
287 | __I uint32_t DAT[12]; /**< ADC Channel 0 Data register. This register contains the result of the most recent conversion completed on channel 0., array offset: 0x20, array step: 0x4 */ | ||
288 | __IO uint32_t THR0_LOW; /**< ADC Low Compare Threshold register 0: Contains the lower threshold level for automatic threshold comparison for any channels linked to threshold pair 0., offset: 0x50 */ | ||
289 | __IO uint32_t THR1_LOW; /**< ADC Low Compare Threshold register 1: Contains the lower threshold level for automatic threshold comparison for any channels linked to threshold pair 1., offset: 0x54 */ | ||
290 | __IO uint32_t THR0_HIGH; /**< ADC High Compare Threshold register 0: Contains the upper threshold level for automatic threshold comparison for any channels linked to threshold pair 0., offset: 0x58 */ | ||
291 | __IO uint32_t THR1_HIGH; /**< ADC High Compare Threshold register 1: Contains the upper threshold level for automatic threshold comparison for any channels linked to threshold pair 1., offset: 0x5C */ | ||
292 | __IO uint32_t CHAN_THRSEL; /**< ADC Channel-Threshold Select register. Specifies which set of threshold compare registers are to be used for each channel, offset: 0x60 */ | ||
293 | __IO uint32_t INTEN; /**< ADC Interrupt Enable register. This register contains enable bits that enable the sequence-A, sequence-B, threshold compare and data overrun interrupts to be generated., offset: 0x64 */ | ||
294 | __IO uint32_t FLAGS; /**< ADC Flags register. Contains the four interrupt/DMA trigger flags and the individual component overrun and threshold-compare flags. (The overrun bits replicate information stored in the result registers)., offset: 0x68 */ | ||
295 | __IO uint32_t STARTUP; /**< ADC Startup register., offset: 0x6C */ | ||
296 | __IO uint32_t CALIB; /**< ADC Calibration register., offset: 0x70 */ | ||
297 | } ADC_Type; | ||
298 | |||
299 | /* ---------------------------------------------------------------------------- | ||
300 | -- ADC Register Masks | ||
301 | ---------------------------------------------------------------------------- */ | ||
302 | |||
303 | /*! | ||
304 | * @addtogroup ADC_Register_Masks ADC Register Masks | ||
305 | * @{ | ||
306 | */ | ||
307 | |||
308 | /*! @name CTRL - ADC Control register. Contains the clock divide value, resolution selection, sampling time selection, and mode controls. */ | ||
309 | /*! @{ */ | ||
310 | #define ADC_CTRL_CLKDIV_MASK (0xFFU) | ||
311 | #define ADC_CTRL_CLKDIV_SHIFT (0U) | ||
312 | /*! CLKDIV - In synchronous mode only, the system clock is divided by this value plus one to produce | ||
313 | * the clock for the ADC converter, which should be less than or equal to 72 MHz. Typically, | ||
314 | * software should program the smallest value in this field that yields this maximum clock rate or | ||
315 | * slightly less, but in certain cases (such as a high-impedance analog source) a slower clock may | ||
316 | * be desirable. This field is ignored in the asynchronous operating mode. | ||
317 | */ | ||
318 | #define ADC_CTRL_CLKDIV(x) (((uint32_t)(((uint32_t)(x)) << ADC_CTRL_CLKDIV_SHIFT)) & ADC_CTRL_CLKDIV_MASK) | ||
319 | #define ADC_CTRL_ASYNMODE_MASK (0x100U) | ||
320 | #define ADC_CTRL_ASYNMODE_SHIFT (8U) | ||
321 | /*! ASYNMODE - Select clock mode. | ||
322 | * 0b0..Synchronous mode. The ADC clock is derived from the system clock based on the divide value selected in | ||
323 | * the CLKDIV field. The ADC clock will be started in a controlled fashion in response to a trigger to | ||
324 | * eliminate any uncertainty in the launching of an ADC conversion in response to any synchronous (on-chip) trigger. | ||
325 | * In Synchronous mode with the SYNCBYPASS bit (in a sequence control register) set, sampling of the ADC | ||
326 | * input and start of conversion will initiate 2 system clocks after the leading edge of a (synchronous) trigger | ||
327 | * pulse. | ||
328 | * 0b1..Asynchronous mode. The ADC clock is based on the output of the ADC clock divider ADCCLKSEL in the SYSCON block. | ||
329 | */ | ||
330 | #define ADC_CTRL_ASYNMODE(x) (((uint32_t)(((uint32_t)(x)) << ADC_CTRL_ASYNMODE_SHIFT)) & ADC_CTRL_ASYNMODE_MASK) | ||
331 | #define ADC_CTRL_RESOL_MASK (0x600U) | ||
332 | #define ADC_CTRL_RESOL_SHIFT (9U) | ||
333 | /*! RESOL - The number of bits of ADC resolution. Accuracy can be reduced to achieve higher | ||
334 | * conversion rates. A single conversion (including one conversion in a burst or sequence) requires the | ||
335 | * selected number of bits of resolution plus 3 ADC clocks. This field must only be altered when | ||
336 | * the ADC is fully idle. Changing it during any kind of ADC operation may have unpredictable | ||
337 | * results. ADC clock frequencies for various resolutions must not exceed: - 5x the system clock rate | ||
338 | * for 12-bit resolution - 4.3x the system clock rate for 10-bit resolution - 3.6x the system | ||
339 | * clock for 8-bit resolution - 3x the bus clock rate for 6-bit resolution | ||
340 | * 0b00..6-bit resolution. An ADC conversion requires 9 ADC clocks, plus any clocks specified by the TSAMP field. | ||
341 | * 0b01..8-bit resolution. An ADC conversion requires 11 ADC clocks, plus any clocks specified by the TSAMP field. | ||
342 | * 0b10..10-bit resolution. An ADC conversion requires 13 ADC clocks, plus any clocks specified by the TSAMP field. | ||
343 | * 0b11..12-bit resolution. An ADC conversion requires 15 ADC clocks, plus any clocks specified by the TSAMP field. | ||
344 | */ | ||
345 | #define ADC_CTRL_RESOL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CTRL_RESOL_SHIFT)) & ADC_CTRL_RESOL_MASK) | ||
346 | #define ADC_CTRL_BYPASSCAL_MASK (0x800U) | ||
347 | #define ADC_CTRL_BYPASSCAL_SHIFT (11U) | ||
348 | /*! BYPASSCAL - Bypass Calibration. This bit may be set to avoid the need to calibrate if offset | ||
349 | * error is not a concern in the application. | ||
350 | * 0b0..Calibrate. The stored calibration value will be applied to the ADC during conversions to compensated for | ||
351 | * offset error. A calibration cycle must be performed each time the chip is powered-up. Re-calibration may | ||
352 | * be warranted periodically - especially if operating conditions have changed. | ||
353 | * 0b1..Bypass calibration. Calibration is not utilized. Less time is required when enabling the ADC - | ||
354 | * particularly following chip power-up. Attempts to launch a calibration cycle are blocked when this bit is set. | ||
355 | */ | ||
356 | #define ADC_CTRL_BYPASSCAL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CTRL_BYPASSCAL_SHIFT)) & ADC_CTRL_BYPASSCAL_MASK) | ||
357 | #define ADC_CTRL_TSAMP_MASK (0x7000U) | ||
358 | #define ADC_CTRL_TSAMP_SHIFT (12U) | ||
359 | /*! TSAMP - Sample Time. The default sampling period (TSAMP = '000') at the start of each conversion | ||
360 | * is 2.5 ADC clock periods. Depending on a variety of factors, including operating conditions | ||
361 | * and the output impedance of the analog source, longer sampling times may be required. See | ||
362 | * Section 28.7.10. The TSAMP field specifies the number of additional ADC clock cycles, from zero to | ||
363 | * seven, by which the sample period will be extended. The total conversion time will increase by | ||
364 | * the same number of clocks. 000 - The sample period will be the default 2.5 ADC clocks. A | ||
365 | * complete conversion with 12-bits of accuracy will require 15 clocks. 001- The sample period will | ||
366 | * be extended by one ADC clock to a total of 3.5 clock periods. A complete 12-bit conversion will | ||
367 | * require 16 clocks. 010 - The sample period will be extended by two clocks to 4.5 ADC clock | ||
368 | * cycles. A complete 12-bit conversion will require 17 ADC clocks. 111 - The sample period will be | ||
369 | * extended by seven clocks to 9.5 ADC clock cycles. A complete 12-bit conversion will require | ||
370 | * 22 ADC clocks. | ||
371 | */ | ||
372 | #define ADC_CTRL_TSAMP(x) (((uint32_t)(((uint32_t)(x)) << ADC_CTRL_TSAMP_SHIFT)) & ADC_CTRL_TSAMP_MASK) | ||
373 | /*! @} */ | ||
374 | |||
375 | /*! @name INSEL - Input Select. Allows selection of the temperature sensor as an alternate input to ADC channel 0. */ | ||
376 | /*! @{ */ | ||
377 | #define ADC_INSEL_SEL_MASK (0x3U) | ||
378 | #define ADC_INSEL_SEL_SHIFT (0U) | ||
379 | /*! SEL - Selects the input source for channel 0. All other values are reserved. | ||
380 | * 0b00..ADC0_IN0 function. | ||
381 | * 0b11..Internal temperature sensor. | ||
382 | */ | ||
383 | #define ADC_INSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_INSEL_SEL_SHIFT)) & ADC_INSEL_SEL_MASK) | ||
384 | /*! @} */ | ||
385 | |||
386 | /*! @name SEQ_CTRL - ADC Conversion Sequence-n control register: Controls triggering and channel selection for conversion sequence-n. Also specifies interrupt mode for sequence-n. */ | ||
387 | /*! @{ */ | ||
388 | #define ADC_SEQ_CTRL_CHANNELS_MASK (0xFFFU) | ||
389 | #define ADC_SEQ_CTRL_CHANNELS_SHIFT (0U) | ||
390 | /*! CHANNELS - Selects which one or more of the ADC channels will be sampled and converted when this | ||
391 | * sequence is launched. A 1 in any bit of this field will cause the corresponding channel to be | ||
392 | * included in the conversion sequence, where bit 0 corresponds to channel 0, bit 1 to channel 1 | ||
393 | * and so forth. When this conversion sequence is triggered, either by a hardware trigger or via | ||
394 | * software command, ADC conversions will be performed on each enabled channel, in sequence, | ||
395 | * beginning with the lowest-ordered channel. This field can ONLY be changed while SEQA_ENA (bit 31) | ||
396 | * is LOW. It is allowed to change this field and set bit 31 in the same write. | ||
397 | */ | ||
398 | #define ADC_SEQ_CTRL_CHANNELS(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_CHANNELS_SHIFT)) & ADC_SEQ_CTRL_CHANNELS_MASK) | ||
399 | #define ADC_SEQ_CTRL_TRIGGER_MASK (0x3F000U) | ||
400 | #define ADC_SEQ_CTRL_TRIGGER_SHIFT (12U) | ||
401 | /*! TRIGGER - Selects which of the available hardware trigger sources will cause this conversion | ||
402 | * sequence to be initiated. Program the trigger input number in this field. See Table 476. In order | ||
403 | * to avoid generating a spurious trigger, it is recommended writing to this field only when | ||
404 | * SEQA_ENA (bit 31) is low. It is safe to change this field and set bit 31 in the same write. | ||
405 | */ | ||
406 | #define ADC_SEQ_CTRL_TRIGGER(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_TRIGGER_SHIFT)) & ADC_SEQ_CTRL_TRIGGER_MASK) | ||
407 | #define ADC_SEQ_CTRL_TRIGPOL_MASK (0x40000U) | ||
408 | #define ADC_SEQ_CTRL_TRIGPOL_SHIFT (18U) | ||
409 | /*! TRIGPOL - Select the polarity of the selected input trigger for this conversion sequence. In | ||
410 | * order to avoid generating a spurious trigger, it is recommended writing to this field only when | ||
411 | * SEQA_ENA (bit 31) is low. It is safe to change this field and set bit 31 in the same write. | ||
412 | * 0b0..Negative edge. A negative edge launches the conversion sequence on the selected trigger input. | ||
413 | * 0b1..Positive edge. A positive edge launches the conversion sequence on the selected trigger input. | ||
414 | */ | ||
415 | #define ADC_SEQ_CTRL_TRIGPOL(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_TRIGPOL_SHIFT)) & ADC_SEQ_CTRL_TRIGPOL_MASK) | ||
416 | #define ADC_SEQ_CTRL_SYNCBYPASS_MASK (0x80000U) | ||
417 | #define ADC_SEQ_CTRL_SYNCBYPASS_SHIFT (19U) | ||
418 | /*! SYNCBYPASS - Setting this bit allows the hardware trigger input to bypass synchronization | ||
419 | * flip-flop stages and therefore shorten the time between the trigger input signal and the start of a | ||
420 | * conversion. There are slightly different criteria for whether or not this bit can be set | ||
421 | * depending on the clock operating mode: Synchronous mode (the ASYNMODE in the CTRL register = 0): | ||
422 | * Synchronization may be bypassed (this bit may be set) if the selected trigger source is already | ||
423 | * synchronous with the main system clock (eg. coming from an on-chip, system-clock-based timer). | ||
424 | * Whether this bit is set or not, a trigger pulse must be maintained for at least one system | ||
425 | * clock period. Asynchronous mode (the ASYNMODE in the CTRL register = 1): Synchronization may be | ||
426 | * bypassed (this bit may be set) if it is certain that the duration of a trigger input pulse | ||
427 | * will be at least one cycle of the ADC clock (regardless of whether the trigger comes from and | ||
428 | * on-chip or off-chip source). If this bit is NOT set, the trigger pulse must at least be | ||
429 | * maintained for one system clock period. | ||
430 | * 0b0..Enable trigger synchronization. The hardware trigger bypass is not enabled. | ||
431 | * 0b1..Bypass trigger synchronization. The hardware trigger bypass is enabled. | ||
432 | */ | ||
433 | #define ADC_SEQ_CTRL_SYNCBYPASS(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_SYNCBYPASS_SHIFT)) & ADC_SEQ_CTRL_SYNCBYPASS_MASK) | ||
434 | #define ADC_SEQ_CTRL_START_MASK (0x4000000U) | ||
435 | #define ADC_SEQ_CTRL_START_SHIFT (26U) | ||
436 | /*! START - Writing a 1 to this field will launch one pass through this conversion sequence. The | ||
437 | * behavior will be identical to a sequence triggered by a hardware trigger. Do not write 1 to this | ||
438 | * bit if the BURST bit is set. This bit is only set to a 1 momentarily when written to launch a | ||
439 | * conversion sequence. It will consequently always read back as a zero. | ||
440 | */ | ||
441 | #define ADC_SEQ_CTRL_START(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_START_SHIFT)) & ADC_SEQ_CTRL_START_MASK) | ||
442 | #define ADC_SEQ_CTRL_BURST_MASK (0x8000000U) | ||
443 | #define ADC_SEQ_CTRL_BURST_SHIFT (27U) | ||
444 | /*! BURST - Writing a 1 to this bit will cause this conversion sequence to be continuously cycled | ||
445 | * through. Other sequence A triggers will be ignored while this bit is set. Repeated conversions | ||
446 | * can be halted by clearing this bit. The sequence currently in progress will be completed before | ||
447 | * conversions are terminated. Note that a new sequence could begin just before BURST is cleared. | ||
448 | */ | ||
449 | #define ADC_SEQ_CTRL_BURST(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_BURST_SHIFT)) & ADC_SEQ_CTRL_BURST_MASK) | ||
450 | #define ADC_SEQ_CTRL_SINGLESTEP_MASK (0x10000000U) | ||
451 | #define ADC_SEQ_CTRL_SINGLESTEP_SHIFT (28U) | ||
452 | /*! SINGLESTEP - When this bit is set, a hardware trigger or a write to the START bit will launch a | ||
453 | * single conversion on the next channel in the sequence instead of the default response of | ||
454 | * launching an entire sequence of conversions. Once all of the channels comprising a sequence have | ||
455 | * been converted, a subsequent trigger will repeat the sequence beginning with the first enabled | ||
456 | * channel. Interrupt generation will still occur either after each individual conversion or at | ||
457 | * the end of the entire sequence, depending on the state of the MODE bit. | ||
458 | */ | ||
459 | #define ADC_SEQ_CTRL_SINGLESTEP(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_SINGLESTEP_SHIFT)) & ADC_SEQ_CTRL_SINGLESTEP_MASK) | ||
460 | #define ADC_SEQ_CTRL_LOWPRIO_MASK (0x20000000U) | ||
461 | #define ADC_SEQ_CTRL_LOWPRIO_SHIFT (29U) | ||
462 | /*! LOWPRIO - Set priority for sequence A. | ||
463 | * 0b0..Low priority. Any B trigger which occurs while an A conversion sequence is active will be ignored and lost. | ||
464 | * 0b1..High priority. Setting this bit to a 1 will permit any enabled B sequence trigger (including a B sequence | ||
465 | * software start) to immediately interrupt sequence A and launch a B sequence in it's place. The conversion | ||
466 | * currently in progress will be terminated. The A sequence that was interrupted will automatically resume | ||
467 | * after the B sequence completes. The channel whose conversion was terminated will be re-sampled and the | ||
468 | * conversion sequence will resume from that point. | ||
469 | */ | ||
470 | #define ADC_SEQ_CTRL_LOWPRIO(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_LOWPRIO_SHIFT)) & ADC_SEQ_CTRL_LOWPRIO_MASK) | ||
471 | #define ADC_SEQ_CTRL_MODE_MASK (0x40000000U) | ||
472 | #define ADC_SEQ_CTRL_MODE_SHIFT (30U) | ||
473 | /*! MODE - Indicates whether the primary method for retrieving conversion results for this sequence | ||
474 | * will be accomplished via reading the global data register (SEQA_GDAT) at the end of each | ||
475 | * conversion, or the individual channel result registers at the end of the entire sequence. Impacts | ||
476 | * when conversion-complete interrupt/DMA trigger for sequence-A will be generated and which | ||
477 | * overrun conditions contribute to an overrun interrupt as described below. | ||
478 | * 0b0..End of conversion. The sequence A interrupt/DMA trigger will be set at the end of each individual ADC | ||
479 | * conversion performed under sequence A. This flag will mirror the DATAVALID bit in the SEQA_GDAT register. The | ||
480 | * OVERRUN bit in the SEQA_GDAT register will contribute to generation of an overrun interrupt/DMA trigger | ||
481 | * if enabled. | ||
482 | * 0b1..End of sequence. The sequence A interrupt/DMA trigger will be set when the entire set of sequence-A | ||
483 | * conversions completes. This flag will need to be explicitly cleared by software or by the DMA-clear signal in | ||
484 | * this mode. The OVERRUN bit in the SEQA_GDAT register will NOT contribute to generation of an overrun | ||
485 | * interrupt/DMA trigger since it is assumed this register may not be utilized in this mode. | ||
486 | */ | ||
487 | #define ADC_SEQ_CTRL_MODE(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_MODE_SHIFT)) & ADC_SEQ_CTRL_MODE_MASK) | ||
488 | #define ADC_SEQ_CTRL_SEQ_ENA_MASK (0x80000000U) | ||
489 | #define ADC_SEQ_CTRL_SEQ_ENA_SHIFT (31U) | ||
490 | /*! SEQ_ENA - Sequence Enable. In order to avoid spuriously triggering the sequence, care should be | ||
491 | * taken to only set the SEQn_ENA bit when the selected trigger input is in its INACTIVE state | ||
492 | * (as defined by the TRIGPOL bit). If this condition is not met, the sequence will be triggered | ||
493 | * immediately upon being enabled. In order to avoid spuriously triggering the sequence, care | ||
494 | * should be taken to only set the SEQn_ENA bit when the selected trigger input is in its INACTIVE | ||
495 | * state (as defined by the TRIGPOL bit). If this condition is not met, the sequence will be | ||
496 | * triggered immediately upon being enabled. | ||
497 | * 0b0..Disabled. Sequence n is disabled. Sequence n triggers are ignored. If this bit is cleared while sequence | ||
498 | * n is in progress, the sequence will be halted at the end of the current conversion. After the sequence is | ||
499 | * re-enabled, a new trigger will be required to restart the sequence beginning with the next enabled channel. | ||
500 | * 0b1..Enabled. Sequence n is enabled. | ||
501 | */ | ||
502 | #define ADC_SEQ_CTRL_SEQ_ENA(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_CTRL_SEQ_ENA_SHIFT)) & ADC_SEQ_CTRL_SEQ_ENA_MASK) | ||
503 | /*! @} */ | ||
504 | |||
505 | /* The count of ADC_SEQ_CTRL */ | ||
506 | #define ADC_SEQ_CTRL_COUNT (2U) | ||
507 | |||
508 | /*! @name SEQ_GDAT - ADC Sequence-n Global Data register. This register contains the result of the most recent ADC conversion performed under sequence-n. */ | ||
509 | /*! @{ */ | ||
510 | #define ADC_SEQ_GDAT_RESULT_MASK (0xFFF0U) | ||
511 | #define ADC_SEQ_GDAT_RESULT_SHIFT (4U) | ||
512 | /*! RESULT - This field contains the 12-bit ADC conversion result from the most recent conversion | ||
513 | * performed under conversion sequence associated with this register. The result is a binary | ||
514 | * fraction representing the voltage on the currently-selected input channel as it falls within the | ||
515 | * range of VREFP to VREFN. Zero in the field indicates that the voltage on the input pin was less | ||
516 | * than, equal to, or close to that on VREFN, while 0xFFF indicates that the voltage on the input | ||
517 | * was close to, equal to, or greater than that on VREFP. DATAVALID = 1 indicates that this | ||
518 | * result has not yet been read. | ||
519 | */ | ||
520 | #define ADC_SEQ_GDAT_RESULT(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_GDAT_RESULT_SHIFT)) & ADC_SEQ_GDAT_RESULT_MASK) | ||
521 | #define ADC_SEQ_GDAT_THCMPRANGE_MASK (0x30000U) | ||
522 | #define ADC_SEQ_GDAT_THCMPRANGE_SHIFT (16U) | ||
523 | /*! THCMPRANGE - Indicates whether the result of the last conversion performed was above, below or | ||
524 | * within the range established by the designated threshold comparison registers (THRn_LOW and | ||
525 | * THRn_HIGH). | ||
526 | */ | ||
527 | #define ADC_SEQ_GDAT_THCMPRANGE(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_GDAT_THCMPRANGE_SHIFT)) & ADC_SEQ_GDAT_THCMPRANGE_MASK) | ||
528 | #define ADC_SEQ_GDAT_THCMPCROSS_MASK (0xC0000U) | ||
529 | #define ADC_SEQ_GDAT_THCMPCROSS_SHIFT (18U) | ||
530 | /*! THCMPCROSS - Indicates whether the result of the last conversion performed represented a | ||
531 | * crossing of the threshold level established by the designated LOW threshold comparison register | ||
532 | * (THRn_LOW) and, if so, in what direction the crossing occurred. | ||
533 | */ | ||
534 | #define ADC_SEQ_GDAT_THCMPCROSS(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_GDAT_THCMPCROSS_SHIFT)) & ADC_SEQ_GDAT_THCMPCROSS_MASK) | ||
535 | #define ADC_SEQ_GDAT_CHN_MASK (0x3C000000U) | ||
536 | #define ADC_SEQ_GDAT_CHN_SHIFT (26U) | ||
537 | /*! CHN - These bits contain the channel from which the RESULT bits were converted (e.g. 0000 | ||
538 | * identifies channel 0, 0001 channel 1, etc.). | ||
539 | */ | ||
540 | #define ADC_SEQ_GDAT_CHN(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_GDAT_CHN_SHIFT)) & ADC_SEQ_GDAT_CHN_MASK) | ||
541 | #define ADC_SEQ_GDAT_OVERRUN_MASK (0x40000000U) | ||
542 | #define ADC_SEQ_GDAT_OVERRUN_SHIFT (30U) | ||
543 | /*! OVERRUN - This bit is set if a new conversion result is loaded into the RESULT field before a | ||
544 | * previous result has been read - i.e. while the DATAVALID bit is set. This bit is cleared, along | ||
545 | * with the DATAVALID bit, whenever this register is read. This bit will contribute to an overrun | ||
546 | * interrupt/DMA trigger if the MODE bit (in SEQAA_CTRL) for the corresponding sequence is set | ||
547 | * to '0' (and if the overrun interrupt is enabled). | ||
548 | */ | ||
549 | #define ADC_SEQ_GDAT_OVERRUN(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_GDAT_OVERRUN_SHIFT)) & ADC_SEQ_GDAT_OVERRUN_MASK) | ||
550 | #define ADC_SEQ_GDAT_DATAVALID_MASK (0x80000000U) | ||
551 | #define ADC_SEQ_GDAT_DATAVALID_SHIFT (31U) | ||
552 | /*! DATAVALID - This bit is set to '1' at the end of each conversion when a new result is loaded | ||
553 | * into the RESULT field. It is cleared whenever this register is read. This bit will cause a | ||
554 | * conversion-complete interrupt for the corresponding sequence if the MODE bit (in SEQA_CTRL) for that | ||
555 | * sequence is set to 0 (and if the interrupt is enabled). | ||
556 | */ | ||
557 | #define ADC_SEQ_GDAT_DATAVALID(x) (((uint32_t)(((uint32_t)(x)) << ADC_SEQ_GDAT_DATAVALID_SHIFT)) & ADC_SEQ_GDAT_DATAVALID_MASK) | ||
558 | /*! @} */ | ||
559 | |||
560 | /* The count of ADC_SEQ_GDAT */ | ||
561 | #define ADC_SEQ_GDAT_COUNT (2U) | ||
562 | |||
563 | /*! @name DAT - ADC Channel 0 Data register. This register contains the result of the most recent conversion completed on channel 0. */ | ||
564 | /*! @{ */ | ||
565 | #define ADC_DAT_RESULT_MASK (0xFFF0U) | ||
566 | #define ADC_DAT_RESULT_SHIFT (4U) | ||
567 | /*! RESULT - This field contains the 12-bit ADC conversion result from the last conversion performed | ||
568 | * on this channel. This will be a binary fraction representing the voltage on the AD0[n] pin, | ||
569 | * as it falls within the range of VREFP to VREFN. Zero in the field indicates that the voltage on | ||
570 | * the input pin was less than, equal to, or close to that on VREFN, while 0xFFF indicates that | ||
571 | * the voltage on the input was close to, equal to, or greater than that on VREFP. | ||
572 | */ | ||
573 | #define ADC_DAT_RESULT(x) (((uint32_t)(((uint32_t)(x)) << ADC_DAT_RESULT_SHIFT)) & ADC_DAT_RESULT_MASK) | ||
574 | #define ADC_DAT_THCMPRANGE_MASK (0x30000U) | ||
575 | #define ADC_DAT_THCMPRANGE_SHIFT (16U) | ||
576 | /*! THCMPRANGE - Threshold Range Comparison result. 0x0 = In Range: The last completed conversion | ||
577 | * was greater than or equal to the value programmed into the designated LOW threshold register | ||
578 | * (THRn_LOW) but less than or equal to the value programmed into the designated HIGH threshold | ||
579 | * register (THRn_HIGH). 0x1 = Below Range: The last completed conversion on was less than the value | ||
580 | * programmed into the designated LOW threshold register (THRn_LOW). 0x2 = Above Range: The last | ||
581 | * completed conversion was greater than the value programmed into the designated HIGH threshold | ||
582 | * register (THRn_HIGH). 0x3 = Reserved. | ||
583 | */ | ||
584 | #define ADC_DAT_THCMPRANGE(x) (((uint32_t)(((uint32_t)(x)) << ADC_DAT_THCMPRANGE_SHIFT)) & ADC_DAT_THCMPRANGE_MASK) | ||
585 | #define ADC_DAT_THCMPCROSS_MASK (0xC0000U) | ||
586 | #define ADC_DAT_THCMPCROSS_SHIFT (18U) | ||
587 | /*! THCMPCROSS - Threshold Crossing Comparison result. 0x0 = No threshold Crossing detected: The | ||
588 | * most recent completed conversion on this channel had the same relationship (above or below) to | ||
589 | * the threshold value established by the designated LOW threshold register (THRn_LOW) as did the | ||
590 | * previous conversion on this channel. 0x1 = Reserved. 0x2 = Downward Threshold Crossing | ||
591 | * Detected. Indicates that a threshold crossing in the downward direction has occurred - i.e. the | ||
592 | * previous sample on this channel was above the threshold value established by the designated LOW | ||
593 | * threshold register (THRn_LOW) and the current sample is below that threshold. 0x3 = Upward | ||
594 | * Threshold Crossing Detected. Indicates that a threshold crossing in the upward direction has occurred | ||
595 | * - i.e. the previous sample on this channel was below the threshold value established by the | ||
596 | * designated LOW threshold register (THRn_LOW) and the current sample is above that threshold. | ||
597 | */ | ||
598 | #define ADC_DAT_THCMPCROSS(x) (((uint32_t)(((uint32_t)(x)) << ADC_DAT_THCMPCROSS_SHIFT)) & ADC_DAT_THCMPCROSS_MASK) | ||
599 | #define ADC_DAT_CHANNEL_MASK (0x3C000000U) | ||
600 | #define ADC_DAT_CHANNEL_SHIFT (26U) | ||
601 | /*! CHANNEL - This field is hard-coded to contain the channel number that this particular register | ||
602 | * relates to (i.e. this field will contain 0b0000 for the DAT0 register, 0b0001 for the DAT1 | ||
603 | * register, etc) | ||
604 | */ | ||
605 | #define ADC_DAT_CHANNEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_DAT_CHANNEL_SHIFT)) & ADC_DAT_CHANNEL_MASK) | ||
606 | #define ADC_DAT_OVERRUN_MASK (0x40000000U) | ||
607 | #define ADC_DAT_OVERRUN_SHIFT (30U) | ||
608 | /*! OVERRUN - This bit will be set to a 1 if a new conversion on this channel completes and | ||
609 | * overwrites the previous contents of the RESULT field before it has been read - i.e. while the DONE bit | ||
610 | * is set. This bit is cleared, along with the DONE bit, whenever this register is read or when | ||
611 | * the data related to this channel is read from either of the global SEQn_GDAT registers. This | ||
612 | * bit (in any of the 12 registers) will cause an overrun interrupt/DMA trigger to be asserted if | ||
613 | * the overrun interrupt is enabled. While it is allowed to include the same channels in both | ||
614 | * conversion sequences, doing so may cause erratic behavior of the DONE and OVERRUN bits in the | ||
615 | * data registers associated with any of the channels that are shared between the two sequences. Any | ||
616 | * erratic OVERRUN behavior will also affect overrun interrupt generation, if enabled. | ||
617 | */ | ||
618 | #define ADC_DAT_OVERRUN(x) (((uint32_t)(((uint32_t)(x)) << ADC_DAT_OVERRUN_SHIFT)) & ADC_DAT_OVERRUN_MASK) | ||
619 | #define ADC_DAT_DATAVALID_MASK (0x80000000U) | ||
620 | #define ADC_DAT_DATAVALID_SHIFT (31U) | ||
621 | /*! DATAVALID - This bit is set to 1 when an ADC conversion on this channel completes. This bit is | ||
622 | * cleared whenever this register is read or when the data related to this channel is read from | ||
623 | * either of the global SEQn_GDAT registers. While it is allowed to include the same channels in | ||
624 | * both conversion sequences, doing so may cause erratic behavior of the DONE and OVERRUN bits in | ||
625 | * the data registers associated with any of the channels that are shared between the two | ||
626 | * sequences. Any erratic OVERRUN behavior will also affect overrun interrupt generation, if enabled. | ||
627 | */ | ||
628 | #define ADC_DAT_DATAVALID(x) (((uint32_t)(((uint32_t)(x)) << ADC_DAT_DATAVALID_SHIFT)) & ADC_DAT_DATAVALID_MASK) | ||
629 | /*! @} */ | ||
630 | |||
631 | /* The count of ADC_DAT */ | ||
632 | #define ADC_DAT_COUNT (12U) | ||
633 | |||
634 | /*! @name THR0_LOW - ADC Low Compare Threshold register 0: Contains the lower threshold level for automatic threshold comparison for any channels linked to threshold pair 0. */ | ||
635 | /*! @{ */ | ||
636 | #define ADC_THR0_LOW_THRLOW_MASK (0xFFF0U) | ||
637 | #define ADC_THR0_LOW_THRLOW_SHIFT (4U) | ||
638 | /*! THRLOW - Low threshold value against which ADC results will be compared | ||
639 | */ | ||
640 | #define ADC_THR0_LOW_THRLOW(x) (((uint32_t)(((uint32_t)(x)) << ADC_THR0_LOW_THRLOW_SHIFT)) & ADC_THR0_LOW_THRLOW_MASK) | ||
641 | /*! @} */ | ||
642 | |||
643 | /*! @name THR1_LOW - ADC Low Compare Threshold register 1: Contains the lower threshold level for automatic threshold comparison for any channels linked to threshold pair 1. */ | ||
644 | /*! @{ */ | ||
645 | #define ADC_THR1_LOW_THRLOW_MASK (0xFFF0U) | ||
646 | #define ADC_THR1_LOW_THRLOW_SHIFT (4U) | ||
647 | /*! THRLOW - Low threshold value against which ADC results will be compared | ||
648 | */ | ||
649 | #define ADC_THR1_LOW_THRLOW(x) (((uint32_t)(((uint32_t)(x)) << ADC_THR1_LOW_THRLOW_SHIFT)) & ADC_THR1_LOW_THRLOW_MASK) | ||
650 | /*! @} */ | ||
651 | |||
652 | /*! @name THR0_HIGH - ADC High Compare Threshold register 0: Contains the upper threshold level for automatic threshold comparison for any channels linked to threshold pair 0. */ | ||
653 | /*! @{ */ | ||
654 | #define ADC_THR0_HIGH_THRHIGH_MASK (0xFFF0U) | ||
655 | #define ADC_THR0_HIGH_THRHIGH_SHIFT (4U) | ||
656 | /*! THRHIGH - High threshold value against which ADC results will be compared | ||
657 | */ | ||
658 | #define ADC_THR0_HIGH_THRHIGH(x) (((uint32_t)(((uint32_t)(x)) << ADC_THR0_HIGH_THRHIGH_SHIFT)) & ADC_THR0_HIGH_THRHIGH_MASK) | ||
659 | /*! @} */ | ||
660 | |||
661 | /*! @name THR1_HIGH - ADC High Compare Threshold register 1: Contains the upper threshold level for automatic threshold comparison for any channels linked to threshold pair 1. */ | ||
662 | /*! @{ */ | ||
663 | #define ADC_THR1_HIGH_THRHIGH_MASK (0xFFF0U) | ||
664 | #define ADC_THR1_HIGH_THRHIGH_SHIFT (4U) | ||
665 | /*! THRHIGH - High threshold value against which ADC results will be compared | ||
666 | */ | ||
667 | #define ADC_THR1_HIGH_THRHIGH(x) (((uint32_t)(((uint32_t)(x)) << ADC_THR1_HIGH_THRHIGH_SHIFT)) & ADC_THR1_HIGH_THRHIGH_MASK) | ||
668 | /*! @} */ | ||
669 | |||
670 | /*! @name CHAN_THRSEL - ADC Channel-Threshold Select register. Specifies which set of threshold compare registers are to be used for each channel */ | ||
671 | /*! @{ */ | ||
672 | #define ADC_CHAN_THRSEL_CH0_THRSEL_MASK (0x1U) | ||
673 | #define ADC_CHAN_THRSEL_CH0_THRSEL_SHIFT (0U) | ||
674 | /*! CH0_THRSEL - Threshold select for channel 0. | ||
675 | * 0b0..Threshold 0. Results for this channel will be compared against the threshold levels indicated in the THR0_LOW and THR0_HIGH registers. | ||
676 | * 0b1..Threshold 1. Results for this channel will be compared against the threshold levels indicated in the THR1_LOW and THR1_HIGH registers. | ||
677 | */ | ||
678 | #define ADC_CHAN_THRSEL_CH0_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH0_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH0_THRSEL_MASK) | ||
679 | #define ADC_CHAN_THRSEL_CH1_THRSEL_MASK (0x2U) | ||
680 | #define ADC_CHAN_THRSEL_CH1_THRSEL_SHIFT (1U) | ||
681 | /*! CH1_THRSEL - Threshold select for channel 1. See description for channel 0. | ||
682 | */ | ||
683 | #define ADC_CHAN_THRSEL_CH1_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH1_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH1_THRSEL_MASK) | ||
684 | #define ADC_CHAN_THRSEL_CH2_THRSEL_MASK (0x4U) | ||
685 | #define ADC_CHAN_THRSEL_CH2_THRSEL_SHIFT (2U) | ||
686 | /*! CH2_THRSEL - Threshold select for channel 2. See description for channel 0. | ||
687 | */ | ||
688 | #define ADC_CHAN_THRSEL_CH2_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH2_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH2_THRSEL_MASK) | ||
689 | #define ADC_CHAN_THRSEL_CH3_THRSEL_MASK (0x8U) | ||
690 | #define ADC_CHAN_THRSEL_CH3_THRSEL_SHIFT (3U) | ||
691 | /*! CH3_THRSEL - Threshold select for channel 3. See description for channel 0. | ||
692 | */ | ||
693 | #define ADC_CHAN_THRSEL_CH3_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH3_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH3_THRSEL_MASK) | ||
694 | #define ADC_CHAN_THRSEL_CH4_THRSEL_MASK (0x10U) | ||
695 | #define ADC_CHAN_THRSEL_CH4_THRSEL_SHIFT (4U) | ||
696 | /*! CH4_THRSEL - Threshold select for channel 4. See description for channel 0. | ||
697 | */ | ||
698 | #define ADC_CHAN_THRSEL_CH4_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH4_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH4_THRSEL_MASK) | ||
699 | #define ADC_CHAN_THRSEL_CH5_THRSEL_MASK (0x20U) | ||
700 | #define ADC_CHAN_THRSEL_CH5_THRSEL_SHIFT (5U) | ||
701 | /*! CH5_THRSEL - Threshold select for channel 5. See description for channel 0. | ||
702 | */ | ||
703 | #define ADC_CHAN_THRSEL_CH5_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH5_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH5_THRSEL_MASK) | ||
704 | #define ADC_CHAN_THRSEL_CH6_THRSEL_MASK (0x40U) | ||
705 | #define ADC_CHAN_THRSEL_CH6_THRSEL_SHIFT (6U) | ||
706 | /*! CH6_THRSEL - Threshold select for channel 6. See description for channel 0. | ||
707 | */ | ||
708 | #define ADC_CHAN_THRSEL_CH6_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH6_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH6_THRSEL_MASK) | ||
709 | #define ADC_CHAN_THRSEL_CH7_THRSEL_MASK (0x80U) | ||
710 | #define ADC_CHAN_THRSEL_CH7_THRSEL_SHIFT (7U) | ||
711 | /*! CH7_THRSEL - Threshold select for channel 7. See description for channel 0. | ||
712 | */ | ||
713 | #define ADC_CHAN_THRSEL_CH7_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH7_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH7_THRSEL_MASK) | ||
714 | #define ADC_CHAN_THRSEL_CH8_THRSEL_MASK (0x100U) | ||
715 | #define ADC_CHAN_THRSEL_CH8_THRSEL_SHIFT (8U) | ||
716 | /*! CH8_THRSEL - Threshold select for channel 8. See description for channel 0. | ||
717 | */ | ||
718 | #define ADC_CHAN_THRSEL_CH8_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH8_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH8_THRSEL_MASK) | ||
719 | #define ADC_CHAN_THRSEL_CH9_THRSEL_MASK (0x200U) | ||
720 | #define ADC_CHAN_THRSEL_CH9_THRSEL_SHIFT (9U) | ||
721 | /*! CH9_THRSEL - Threshold select for channel 9. See description for channel 0. | ||
722 | */ | ||
723 | #define ADC_CHAN_THRSEL_CH9_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH9_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH9_THRSEL_MASK) | ||
724 | #define ADC_CHAN_THRSEL_CH10_THRSEL_MASK (0x400U) | ||
725 | #define ADC_CHAN_THRSEL_CH10_THRSEL_SHIFT (10U) | ||
726 | /*! CH10_THRSEL - Threshold select for channel 10. See description for channel 0. | ||
727 | */ | ||
728 | #define ADC_CHAN_THRSEL_CH10_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH10_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH10_THRSEL_MASK) | ||
729 | #define ADC_CHAN_THRSEL_CH11_THRSEL_MASK (0x800U) | ||
730 | #define ADC_CHAN_THRSEL_CH11_THRSEL_SHIFT (11U) | ||
731 | /*! CH11_THRSEL - Threshold select for channel 11. See description for channel 0. | ||
732 | */ | ||
733 | #define ADC_CHAN_THRSEL_CH11_THRSEL(x) (((uint32_t)(((uint32_t)(x)) << ADC_CHAN_THRSEL_CH11_THRSEL_SHIFT)) & ADC_CHAN_THRSEL_CH11_THRSEL_MASK) | ||
734 | /*! @} */ | ||
735 | |||
736 | /*! @name INTEN - ADC Interrupt Enable register. This register contains enable bits that enable the sequence-A, sequence-B, threshold compare and data overrun interrupts to be generated. */ | ||
737 | /*! @{ */ | ||
738 | #define ADC_INTEN_SEQA_INTEN_MASK (0x1U) | ||
739 | #define ADC_INTEN_SEQA_INTEN_SHIFT (0U) | ||
740 | /*! SEQA_INTEN - Sequence A interrupt enable. | ||
741 | * 0b0..Disabled. The sequence A interrupt/DMA trigger is disabled. | ||
742 | * 0b1..Enabled. The sequence A interrupt/DMA trigger is enabled and will be asserted either upon completion of | ||
743 | * each individual conversion performed as part of sequence A, or upon completion of the entire A sequence of | ||
744 | * conversions, depending on the MODE bit in the SEQA_CTRL register. | ||
745 | */ | ||
746 | #define ADC_INTEN_SEQA_INTEN(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_SEQA_INTEN_SHIFT)) & ADC_INTEN_SEQA_INTEN_MASK) | ||
747 | #define ADC_INTEN_SEQB_INTEN_MASK (0x2U) | ||
748 | #define ADC_INTEN_SEQB_INTEN_SHIFT (1U) | ||
749 | /*! SEQB_INTEN - Sequence B interrupt enable. | ||
750 | * 0b0..Disabled. The sequence B interrupt/DMA trigger is disabled. | ||
751 | * 0b1..Enabled. The sequence B interrupt/DMA trigger is enabled and will be asserted either upon completion of | ||
752 | * each individual conversion performed as part of sequence B, or upon completion of the entire B sequence of | ||
753 | * conversions, depending on the MODE bit in the SEQB_CTRL register. | ||
754 | */ | ||
755 | #define ADC_INTEN_SEQB_INTEN(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_SEQB_INTEN_SHIFT)) & ADC_INTEN_SEQB_INTEN_MASK) | ||
756 | #define ADC_INTEN_OVR_INTEN_MASK (0x4U) | ||
757 | #define ADC_INTEN_OVR_INTEN_SHIFT (2U) | ||
758 | /*! OVR_INTEN - Overrun interrupt enable. | ||
759 | * 0b0..Disabled. The overrun interrupt is disabled. | ||
760 | * 0b1..Enabled. The overrun interrupt is enabled. Detection of an overrun condition on any of the 12 channel | ||
761 | * data registers will cause an overrun interrupt/DMA trigger. In addition, if the MODE bit for a particular | ||
762 | * sequence is 0, then an overrun in the global data register for that sequence will also cause this | ||
763 | * interrupt/DMA trigger to be asserted. | ||
764 | */ | ||
765 | #define ADC_INTEN_OVR_INTEN(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_OVR_INTEN_SHIFT)) & ADC_INTEN_OVR_INTEN_MASK) | ||
766 | #define ADC_INTEN_ADCMPINTEN0_MASK (0x18U) | ||
767 | #define ADC_INTEN_ADCMPINTEN0_SHIFT (3U) | ||
768 | /*! ADCMPINTEN0 - Threshold comparison interrupt enable for channel 0. | ||
769 | * 0b00..Disabled. | ||
770 | * 0b01..Outside threshold. | ||
771 | * 0b10..Crossing threshold. | ||
772 | * 0b11..Reserved | ||
773 | */ | ||
774 | #define ADC_INTEN_ADCMPINTEN0(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN0_SHIFT)) & ADC_INTEN_ADCMPINTEN0_MASK) | ||
775 | #define ADC_INTEN_ADCMPINTEN1_MASK (0x60U) | ||
776 | #define ADC_INTEN_ADCMPINTEN1_SHIFT (5U) | ||
777 | /*! ADCMPINTEN1 - Channel 1 threshold comparison interrupt enable. See description for channel 0. | ||
778 | */ | ||
779 | #define ADC_INTEN_ADCMPINTEN1(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN1_SHIFT)) & ADC_INTEN_ADCMPINTEN1_MASK) | ||
780 | #define ADC_INTEN_ADCMPINTEN2_MASK (0x180U) | ||
781 | #define ADC_INTEN_ADCMPINTEN2_SHIFT (7U) | ||
782 | /*! ADCMPINTEN2 - Channel 2 threshold comparison interrupt enable. See description for channel 0. | ||
783 | */ | ||
784 | #define ADC_INTEN_ADCMPINTEN2(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN2_SHIFT)) & ADC_INTEN_ADCMPINTEN2_MASK) | ||
785 | #define ADC_INTEN_ADCMPINTEN3_MASK (0x600U) | ||
786 | #define ADC_INTEN_ADCMPINTEN3_SHIFT (9U) | ||
787 | /*! ADCMPINTEN3 - Channel 3 threshold comparison interrupt enable. See description for channel 0. | ||
788 | */ | ||
789 | #define ADC_INTEN_ADCMPINTEN3(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN3_SHIFT)) & ADC_INTEN_ADCMPINTEN3_MASK) | ||
790 | #define ADC_INTEN_ADCMPINTEN4_MASK (0x1800U) | ||
791 | #define ADC_INTEN_ADCMPINTEN4_SHIFT (11U) | ||
792 | /*! ADCMPINTEN4 - Channel 4 threshold comparison interrupt enable. See description for channel 0. | ||
793 | */ | ||
794 | #define ADC_INTEN_ADCMPINTEN4(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN4_SHIFT)) & ADC_INTEN_ADCMPINTEN4_MASK) | ||
795 | #define ADC_INTEN_ADCMPINTEN5_MASK (0x6000U) | ||
796 | #define ADC_INTEN_ADCMPINTEN5_SHIFT (13U) | ||
797 | /*! ADCMPINTEN5 - Channel 5 threshold comparison interrupt enable. See description for channel 0. | ||
798 | */ | ||
799 | #define ADC_INTEN_ADCMPINTEN5(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN5_SHIFT)) & ADC_INTEN_ADCMPINTEN5_MASK) | ||
800 | #define ADC_INTEN_ADCMPINTEN6_MASK (0x18000U) | ||
801 | #define ADC_INTEN_ADCMPINTEN6_SHIFT (15U) | ||
802 | /*! ADCMPINTEN6 - Channel 6 threshold comparison interrupt enable. See description for channel 0. | ||
803 | */ | ||
804 | #define ADC_INTEN_ADCMPINTEN6(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN6_SHIFT)) & ADC_INTEN_ADCMPINTEN6_MASK) | ||
805 | #define ADC_INTEN_ADCMPINTEN7_MASK (0x60000U) | ||
806 | #define ADC_INTEN_ADCMPINTEN7_SHIFT (17U) | ||
807 | /*! ADCMPINTEN7 - Channel 7 threshold comparison interrupt enable. See description for channel 0. | ||
808 | */ | ||
809 | #define ADC_INTEN_ADCMPINTEN7(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN7_SHIFT)) & ADC_INTEN_ADCMPINTEN7_MASK) | ||
810 | #define ADC_INTEN_ADCMPINTEN8_MASK (0x180000U) | ||
811 | #define ADC_INTEN_ADCMPINTEN8_SHIFT (19U) | ||
812 | /*! ADCMPINTEN8 - Channel 8 threshold comparison interrupt enable. See description for channel 0. | ||
813 | */ | ||
814 | #define ADC_INTEN_ADCMPINTEN8(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN8_SHIFT)) & ADC_INTEN_ADCMPINTEN8_MASK) | ||
815 | #define ADC_INTEN_ADCMPINTEN9_MASK (0x600000U) | ||
816 | #define ADC_INTEN_ADCMPINTEN9_SHIFT (21U) | ||
817 | /*! ADCMPINTEN9 - Channel 9 threshold comparison interrupt enable. See description for channel 0. | ||
818 | */ | ||
819 | #define ADC_INTEN_ADCMPINTEN9(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN9_SHIFT)) & ADC_INTEN_ADCMPINTEN9_MASK) | ||
820 | #define ADC_INTEN_ADCMPINTEN10_MASK (0x1800000U) | ||
821 | #define ADC_INTEN_ADCMPINTEN10_SHIFT (23U) | ||
822 | /*! ADCMPINTEN10 - Channel 10 threshold comparison interrupt enable. See description for channel 0. | ||
823 | */ | ||
824 | #define ADC_INTEN_ADCMPINTEN10(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN10_SHIFT)) & ADC_INTEN_ADCMPINTEN10_MASK) | ||
825 | #define ADC_INTEN_ADCMPINTEN11_MASK (0x6000000U) | ||
826 | #define ADC_INTEN_ADCMPINTEN11_SHIFT (25U) | ||
827 | /*! ADCMPINTEN11 - Channel 21 threshold comparison interrupt enable. See description for channel 0. | ||
828 | */ | ||
829 | #define ADC_INTEN_ADCMPINTEN11(x) (((uint32_t)(((uint32_t)(x)) << ADC_INTEN_ADCMPINTEN11_SHIFT)) & ADC_INTEN_ADCMPINTEN11_MASK) | ||
830 | /*! @} */ | ||
831 | |||
832 | /*! @name FLAGS - ADC Flags register. Contains the four interrupt/DMA trigger flags and the individual component overrun and threshold-compare flags. (The overrun bits replicate information stored in the result registers). */ | ||
833 | /*! @{ */ | ||
834 | #define ADC_FLAGS_THCMP0_MASK (0x1U) | ||
835 | #define ADC_FLAGS_THCMP0_SHIFT (0U) | ||
836 | /*! THCMP0 - Threshold comparison event on Channel 0. Set to 1 upon either an out-of-range result or | ||
837 | * a threshold-crossing result if enabled to do so in the INTEN register. This bit is cleared by | ||
838 | * writing a 1. | ||
839 | */ | ||
840 | #define ADC_FLAGS_THCMP0(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP0_SHIFT)) & ADC_FLAGS_THCMP0_MASK) | ||
841 | #define ADC_FLAGS_THCMP1_MASK (0x2U) | ||
842 | #define ADC_FLAGS_THCMP1_SHIFT (1U) | ||
843 | /*! THCMP1 - Threshold comparison event on Channel 1. See description for channel 0. | ||
844 | */ | ||
845 | #define ADC_FLAGS_THCMP1(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP1_SHIFT)) & ADC_FLAGS_THCMP1_MASK) | ||
846 | #define ADC_FLAGS_THCMP2_MASK (0x4U) | ||
847 | #define ADC_FLAGS_THCMP2_SHIFT (2U) | ||
848 | /*! THCMP2 - Threshold comparison event on Channel 2. See description for channel 0. | ||
849 | */ | ||
850 | #define ADC_FLAGS_THCMP2(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP2_SHIFT)) & ADC_FLAGS_THCMP2_MASK) | ||
851 | #define ADC_FLAGS_THCMP3_MASK (0x8U) | ||
852 | #define ADC_FLAGS_THCMP3_SHIFT (3U) | ||
853 | /*! THCMP3 - Threshold comparison event on Channel 3. See description for channel 0. | ||
854 | */ | ||
855 | #define ADC_FLAGS_THCMP3(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP3_SHIFT)) & ADC_FLAGS_THCMP3_MASK) | ||
856 | #define ADC_FLAGS_THCMP4_MASK (0x10U) | ||
857 | #define ADC_FLAGS_THCMP4_SHIFT (4U) | ||
858 | /*! THCMP4 - Threshold comparison event on Channel 4. See description for channel 0. | ||
859 | */ | ||
860 | #define ADC_FLAGS_THCMP4(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP4_SHIFT)) & ADC_FLAGS_THCMP4_MASK) | ||
861 | #define ADC_FLAGS_THCMP5_MASK (0x20U) | ||
862 | #define ADC_FLAGS_THCMP5_SHIFT (5U) | ||
863 | /*! THCMP5 - Threshold comparison event on Channel 5. See description for channel 0. | ||
864 | */ | ||
865 | #define ADC_FLAGS_THCMP5(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP5_SHIFT)) & ADC_FLAGS_THCMP5_MASK) | ||
866 | #define ADC_FLAGS_THCMP6_MASK (0x40U) | ||
867 | #define ADC_FLAGS_THCMP6_SHIFT (6U) | ||
868 | /*! THCMP6 - Threshold comparison event on Channel 6. See description for channel 0. | ||
869 | */ | ||
870 | #define ADC_FLAGS_THCMP6(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP6_SHIFT)) & ADC_FLAGS_THCMP6_MASK) | ||
871 | #define ADC_FLAGS_THCMP7_MASK (0x80U) | ||
872 | #define ADC_FLAGS_THCMP7_SHIFT (7U) | ||
873 | /*! THCMP7 - Threshold comparison event on Channel 7. See description for channel 0. | ||
874 | */ | ||
875 | #define ADC_FLAGS_THCMP7(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP7_SHIFT)) & ADC_FLAGS_THCMP7_MASK) | ||
876 | #define ADC_FLAGS_THCMP8_MASK (0x100U) | ||
877 | #define ADC_FLAGS_THCMP8_SHIFT (8U) | ||
878 | /*! THCMP8 - Threshold comparison event on Channel 8. See description for channel 0. | ||
879 | */ | ||
880 | #define ADC_FLAGS_THCMP8(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP8_SHIFT)) & ADC_FLAGS_THCMP8_MASK) | ||
881 | #define ADC_FLAGS_THCMP9_MASK (0x200U) | ||
882 | #define ADC_FLAGS_THCMP9_SHIFT (9U) | ||
883 | /*! THCMP9 - Threshold comparison event on Channel 9. See description for channel 0. | ||
884 | */ | ||
885 | #define ADC_FLAGS_THCMP9(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP9_SHIFT)) & ADC_FLAGS_THCMP9_MASK) | ||
886 | #define ADC_FLAGS_THCMP10_MASK (0x400U) | ||
887 | #define ADC_FLAGS_THCMP10_SHIFT (10U) | ||
888 | /*! THCMP10 - Threshold comparison event on Channel 10. See description for channel 0. | ||
889 | */ | ||
890 | #define ADC_FLAGS_THCMP10(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP10_SHIFT)) & ADC_FLAGS_THCMP10_MASK) | ||
891 | #define ADC_FLAGS_THCMP11_MASK (0x800U) | ||
892 | #define ADC_FLAGS_THCMP11_SHIFT (11U) | ||
893 | /*! THCMP11 - Threshold comparison event on Channel 11. See description for channel 0. | ||
894 | */ | ||
895 | #define ADC_FLAGS_THCMP11(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP11_SHIFT)) & ADC_FLAGS_THCMP11_MASK) | ||
896 | #define ADC_FLAGS_OVERRUN0_MASK (0x1000U) | ||
897 | #define ADC_FLAGS_OVERRUN0_SHIFT (12U) | ||
898 | /*! OVERRUN0 - Mirrors the OVERRRUN status flag from the result register for ADC channel 0 | ||
899 | */ | ||
900 | #define ADC_FLAGS_OVERRUN0(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN0_SHIFT)) & ADC_FLAGS_OVERRUN0_MASK) | ||
901 | #define ADC_FLAGS_OVERRUN1_MASK (0x2000U) | ||
902 | #define ADC_FLAGS_OVERRUN1_SHIFT (13U) | ||
903 | /*! OVERRUN1 - Mirrors the OVERRRUN status flag from the result register for ADC channel 1 | ||
904 | */ | ||
905 | #define ADC_FLAGS_OVERRUN1(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN1_SHIFT)) & ADC_FLAGS_OVERRUN1_MASK) | ||
906 | #define ADC_FLAGS_OVERRUN2_MASK (0x4000U) | ||
907 | #define ADC_FLAGS_OVERRUN2_SHIFT (14U) | ||
908 | /*! OVERRUN2 - Mirrors the OVERRRUN status flag from the result register for ADC channel 2 | ||
909 | */ | ||
910 | #define ADC_FLAGS_OVERRUN2(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN2_SHIFT)) & ADC_FLAGS_OVERRUN2_MASK) | ||
911 | #define ADC_FLAGS_OVERRUN3_MASK (0x8000U) | ||
912 | #define ADC_FLAGS_OVERRUN3_SHIFT (15U) | ||
913 | /*! OVERRUN3 - Mirrors the OVERRRUN status flag from the result register for ADC channel 3 | ||
914 | */ | ||
915 | #define ADC_FLAGS_OVERRUN3(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN3_SHIFT)) & ADC_FLAGS_OVERRUN3_MASK) | ||
916 | #define ADC_FLAGS_OVERRUN4_MASK (0x10000U) | ||
917 | #define ADC_FLAGS_OVERRUN4_SHIFT (16U) | ||
918 | /*! OVERRUN4 - Mirrors the OVERRRUN status flag from the result register for ADC channel 4 | ||
919 | */ | ||
920 | #define ADC_FLAGS_OVERRUN4(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN4_SHIFT)) & ADC_FLAGS_OVERRUN4_MASK) | ||
921 | #define ADC_FLAGS_OVERRUN5_MASK (0x20000U) | ||
922 | #define ADC_FLAGS_OVERRUN5_SHIFT (17U) | ||
923 | /*! OVERRUN5 - Mirrors the OVERRRUN status flag from the result register for ADC channel 5 | ||
924 | */ | ||
925 | #define ADC_FLAGS_OVERRUN5(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN5_SHIFT)) & ADC_FLAGS_OVERRUN5_MASK) | ||
926 | #define ADC_FLAGS_OVERRUN6_MASK (0x40000U) | ||
927 | #define ADC_FLAGS_OVERRUN6_SHIFT (18U) | ||
928 | /*! OVERRUN6 - Mirrors the OVERRRUN status flag from the result register for ADC channel 6 | ||
929 | */ | ||
930 | #define ADC_FLAGS_OVERRUN6(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN6_SHIFT)) & ADC_FLAGS_OVERRUN6_MASK) | ||
931 | #define ADC_FLAGS_OVERRUN7_MASK (0x80000U) | ||
932 | #define ADC_FLAGS_OVERRUN7_SHIFT (19U) | ||
933 | /*! OVERRUN7 - Mirrors the OVERRRUN status flag from the result register for ADC channel 7 | ||
934 | */ | ||
935 | #define ADC_FLAGS_OVERRUN7(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN7_SHIFT)) & ADC_FLAGS_OVERRUN7_MASK) | ||
936 | #define ADC_FLAGS_OVERRUN8_MASK (0x100000U) | ||
937 | #define ADC_FLAGS_OVERRUN8_SHIFT (20U) | ||
938 | /*! OVERRUN8 - Mirrors the OVERRRUN status flag from the result register for ADC channel 8 | ||
939 | */ | ||
940 | #define ADC_FLAGS_OVERRUN8(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN8_SHIFT)) & ADC_FLAGS_OVERRUN8_MASK) | ||
941 | #define ADC_FLAGS_OVERRUN9_MASK (0x200000U) | ||
942 | #define ADC_FLAGS_OVERRUN9_SHIFT (21U) | ||
943 | /*! OVERRUN9 - Mirrors the OVERRRUN status flag from the result register for ADC channel 9 | ||
944 | */ | ||
945 | #define ADC_FLAGS_OVERRUN9(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN9_SHIFT)) & ADC_FLAGS_OVERRUN9_MASK) | ||
946 | #define ADC_FLAGS_OVERRUN10_MASK (0x400000U) | ||
947 | #define ADC_FLAGS_OVERRUN10_SHIFT (22U) | ||
948 | /*! OVERRUN10 - Mirrors the OVERRRUN status flag from the result register for ADC channel 10 | ||
949 | */ | ||
950 | #define ADC_FLAGS_OVERRUN10(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN10_SHIFT)) & ADC_FLAGS_OVERRUN10_MASK) | ||
951 | #define ADC_FLAGS_OVERRUN11_MASK (0x800000U) | ||
952 | #define ADC_FLAGS_OVERRUN11_SHIFT (23U) | ||
953 | /*! OVERRUN11 - Mirrors the OVERRRUN status flag from the result register for ADC channel 11 | ||
954 | */ | ||
955 | #define ADC_FLAGS_OVERRUN11(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVERRUN11_SHIFT)) & ADC_FLAGS_OVERRUN11_MASK) | ||
956 | #define ADC_FLAGS_SEQA_OVR_MASK (0x1000000U) | ||
957 | #define ADC_FLAGS_SEQA_OVR_SHIFT (24U) | ||
958 | /*! SEQA_OVR - Mirrors the global OVERRUN status flag in the SEQA_GDAT register | ||
959 | */ | ||
960 | #define ADC_FLAGS_SEQA_OVR(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_SEQA_OVR_SHIFT)) & ADC_FLAGS_SEQA_OVR_MASK) | ||
961 | #define ADC_FLAGS_SEQB_OVR_MASK (0x2000000U) | ||
962 | #define ADC_FLAGS_SEQB_OVR_SHIFT (25U) | ||
963 | /*! SEQB_OVR - Mirrors the global OVERRUN status flag in the SEQB_GDAT register | ||
964 | */ | ||
965 | #define ADC_FLAGS_SEQB_OVR(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_SEQB_OVR_SHIFT)) & ADC_FLAGS_SEQB_OVR_MASK) | ||
966 | #define ADC_FLAGS_SEQA_INT_MASK (0x10000000U) | ||
967 | #define ADC_FLAGS_SEQA_INT_SHIFT (28U) | ||
968 | /*! SEQA_INT - Sequence A interrupt/DMA trigger. If the MODE bit in the SEQA_CTRL register is 0, | ||
969 | * this flag will mirror the DATAVALID bit in the sequence A global data register (SEQA_GDAT), which | ||
970 | * is set at the end of every ADC conversion performed as part of sequence A. It will be cleared | ||
971 | * automatically when the SEQA_GDAT register is read. If the MODE bit in the SEQA_CTRL register | ||
972 | * is 1, this flag will be set upon completion of an entire A sequence. In this case it must be | ||
973 | * cleared by writing a 1 to this SEQA_INT bit. This interrupt must be enabled in the INTEN | ||
974 | * register. | ||
975 | */ | ||
976 | #define ADC_FLAGS_SEQA_INT(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_SEQA_INT_SHIFT)) & ADC_FLAGS_SEQA_INT_MASK) | ||
977 | #define ADC_FLAGS_SEQB_INT_MASK (0x20000000U) | ||
978 | #define ADC_FLAGS_SEQB_INT_SHIFT (29U) | ||
979 | /*! SEQB_INT - Sequence A interrupt/DMA trigger. If the MODE bit in the SEQB_CTRL register is 0, | ||
980 | * this flag will mirror the DATAVALID bit in the sequence A global data register (SEQB_GDAT), which | ||
981 | * is set at the end of every ADC conversion performed as part of sequence B. It will be cleared | ||
982 | * automatically when the SEQB_GDAT register is read. If the MODE bit in the SEQB_CTRL register | ||
983 | * is 1, this flag will be set upon completion of an entire B sequence. In this case it must be | ||
984 | * cleared by writing a 1 to this SEQB_INT bit. This interrupt must be enabled in the INTEN | ||
985 | * register. | ||
986 | */ | ||
987 | #define ADC_FLAGS_SEQB_INT(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_SEQB_INT_SHIFT)) & ADC_FLAGS_SEQB_INT_MASK) | ||
988 | #define ADC_FLAGS_THCMP_INT_MASK (0x40000000U) | ||
989 | #define ADC_FLAGS_THCMP_INT_SHIFT (30U) | ||
990 | /*! THCMP_INT - Threshold Comparison Interrupt. This bit will be set if any of the THCMP flags in | ||
991 | * the lower bits of this register are set to 1 (due to an enabled out-of-range or | ||
992 | * threshold-crossing event on any channel). Each type of threshold comparison interrupt on each channel must be | ||
993 | * individually enabled in the INTEN register to cause this interrupt. This bit will be cleared | ||
994 | * when all of the individual threshold flags are cleared via writing 1s to those bits. | ||
995 | */ | ||
996 | #define ADC_FLAGS_THCMP_INT(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_THCMP_INT_SHIFT)) & ADC_FLAGS_THCMP_INT_MASK) | ||
997 | #define ADC_FLAGS_OVR_INT_MASK (0x80000000U) | ||
998 | #define ADC_FLAGS_OVR_INT_SHIFT (31U) | ||
999 | /*! OVR_INT - Overrun Interrupt flag. Any overrun bit in any of the individual channel data | ||
1000 | * registers will cause this interrupt. In addition, if the MODE bit in either of the SEQn_CTRL registers | ||
1001 | * is 0 then the OVERRUN bit in the corresponding SEQn_GDAT register will also cause this | ||
1002 | * interrupt. This interrupt must be enabled in the INTEN register. This bit will be cleared when all | ||
1003 | * of the individual overrun bits have been cleared via reading the corresponding data registers. | ||
1004 | */ | ||
1005 | #define ADC_FLAGS_OVR_INT(x) (((uint32_t)(((uint32_t)(x)) << ADC_FLAGS_OVR_INT_SHIFT)) & ADC_FLAGS_OVR_INT_MASK) | ||
1006 | /*! @} */ | ||
1007 | |||
1008 | /*! @name STARTUP - ADC Startup register. */ | ||
1009 | /*! @{ */ | ||
1010 | #define ADC_STARTUP_ADC_ENA_MASK (0x1U) | ||
1011 | #define ADC_STARTUP_ADC_ENA_SHIFT (0U) | ||
1012 | /*! ADC_ENA - ADC Enable bit. This bit can only be set to a 1 by software. It is cleared | ||
1013 | * automatically whenever the ADC is powered down. This bit must not be set until at least 10 microseconds | ||
1014 | * after the ADC is powered up (typically by altering a system-level ADC power control bit). | ||
1015 | */ | ||
1016 | #define ADC_STARTUP_ADC_ENA(x) (((uint32_t)(((uint32_t)(x)) << ADC_STARTUP_ADC_ENA_SHIFT)) & ADC_STARTUP_ADC_ENA_MASK) | ||
1017 | #define ADC_STARTUP_ADC_INIT_MASK (0x2U) | ||
1018 | #define ADC_STARTUP_ADC_INIT_SHIFT (1U) | ||
1019 | /*! ADC_INIT - ADC Initialization. After enabling the ADC (setting the ADC_ENA bit), the API routine | ||
1020 | * will EITHER set this bit or the CALIB bit in the CALIB register, depending on whether or not | ||
1021 | * calibration is required. Setting this bit will launch the 'dummy' conversion cycle that is | ||
1022 | * required if a calibration is not performed. It will also reload the stored calibration value from | ||
1023 | * a previous calibration unless the BYPASSCAL bit is set. This bit should only be set AFTER the | ||
1024 | * ADC_ENA bit is set and after the CALIREQD bit is tested to determine whether a calibration or | ||
1025 | * an ADC dummy conversion cycle is required. It should not be set during the same write that | ||
1026 | * sets the ADC_ENA bit. This bit can only be set to a '1' by software. It is cleared automatically | ||
1027 | * when the 'dummy' conversion cycle completes. | ||
1028 | */ | ||
1029 | #define ADC_STARTUP_ADC_INIT(x) (((uint32_t)(((uint32_t)(x)) << ADC_STARTUP_ADC_INIT_SHIFT)) & ADC_STARTUP_ADC_INIT_MASK) | ||
1030 | /*! @} */ | ||
1031 | |||
1032 | /*! @name CALIB - ADC Calibration register. */ | ||
1033 | /*! @{ */ | ||
1034 | #define ADC_CALIB_CALIB_MASK (0x1U) | ||
1035 | #define ADC_CALIB_CALIB_SHIFT (0U) | ||
1036 | /*! CALIB - Calibration request. Setting this bit will launch an ADC calibration cycle. This bit can | ||
1037 | * only be set to a '1' by software. It is cleared automatically when the calibration cycle | ||
1038 | * completes. | ||
1039 | */ | ||
1040 | #define ADC_CALIB_CALIB(x) (((uint32_t)(((uint32_t)(x)) << ADC_CALIB_CALIB_SHIFT)) & ADC_CALIB_CALIB_MASK) | ||
1041 | #define ADC_CALIB_CALREQD_MASK (0x2U) | ||
1042 | #define ADC_CALIB_CALREQD_SHIFT (1U) | ||
1043 | /*! CALREQD - Calibration required. This read-only bit indicates if calibration is required when | ||
1044 | * enabling the ADC. CALREQD will be '1' if no calibration has been run since the chip was | ||
1045 | * powered-up and if the BYPASSCAL bit in the CTRL register is low. Software will test this bit to | ||
1046 | * determine whether to initiate a calibration cycle or whether to set the ADC_INIT bit (in the STARTUP | ||
1047 | * register) to launch the ADC initialization process which includes a 'dummy' conversion cycle. | ||
1048 | * Note: A 'dummy' conversion cycle requires approximately 6 ADC clocks as opposed to 81 clocks | ||
1049 | * required for calibration. | ||
1050 | */ | ||
1051 | #define ADC_CALIB_CALREQD(x) (((uint32_t)(((uint32_t)(x)) << ADC_CALIB_CALREQD_SHIFT)) & ADC_CALIB_CALREQD_MASK) | ||
1052 | #define ADC_CALIB_CALVALUE_MASK (0x1FCU) | ||
1053 | #define ADC_CALIB_CALVALUE_SHIFT (2U) | ||
1054 | /*! CALVALUE - Calibration Value. This read-only field displays the calibration value established | ||
1055 | * during last calibration cycle. This value is not typically of any use to the user. | ||
1056 | */ | ||
1057 | #define ADC_CALIB_CALVALUE(x) (((uint32_t)(((uint32_t)(x)) << ADC_CALIB_CALVALUE_SHIFT)) & ADC_CALIB_CALVALUE_MASK) | ||
1058 | /*! @} */ | ||
1059 | |||
1060 | |||
1061 | /*! | ||
1062 | * @} | ||
1063 | */ /* end of group ADC_Register_Masks */ | ||
1064 | |||
1065 | |||
1066 | /* ADC - Peripheral instance base addresses */ | ||
1067 | /** Peripheral ADC0 base address */ | ||
1068 | #define ADC0_BASE (0x400A0000u) | ||
1069 | /** Peripheral ADC0 base pointer */ | ||
1070 | #define ADC0 ((ADC_Type *)ADC0_BASE) | ||
1071 | /** Array initializer of ADC peripheral base addresses */ | ||
1072 | #define ADC_BASE_ADDRS { ADC0_BASE } | ||
1073 | /** Array initializer of ADC peripheral base pointers */ | ||
1074 | #define ADC_BASE_PTRS { ADC0 } | ||
1075 | /** Interrupt vectors for the ADC peripheral type */ | ||
1076 | #define ADC_SEQ_IRQS { ADC0_SEQA_IRQn, ADC0_SEQB_IRQn } | ||
1077 | #define ADC_THCMP_IRQS { ADC0_THCMP_IRQn } | ||
1078 | |||
1079 | /*! | ||
1080 | * @} | ||
1081 | */ /* end of group ADC_Peripheral_Access_Layer */ | ||
1082 | |||
1083 | |||
1084 | /* ---------------------------------------------------------------------------- | ||
1085 | -- ASYNC_SYSCON Peripheral Access Layer | ||
1086 | ---------------------------------------------------------------------------- */ | ||
1087 | |||
1088 | /*! | ||
1089 | * @addtogroup ASYNC_SYSCON_Peripheral_Access_Layer ASYNC_SYSCON Peripheral Access Layer | ||
1090 | * @{ | ||
1091 | */ | ||
1092 | |||
1093 | /** ASYNC_SYSCON - Register Layout Typedef */ | ||
1094 | typedef struct { | ||
1095 | __IO uint32_t ASYNCPRESETCTRL; /**< Async peripheral reset control, offset: 0x0 */ | ||
1096 | __O uint32_t ASYNCPRESETCTRLSET; /**< Set bits in ASYNCPRESETCTRL, offset: 0x4 */ | ||
1097 | __O uint32_t ASYNCPRESETCTRLCLR; /**< Clear bits in ASYNCPRESETCTRL, offset: 0x8 */ | ||
1098 | uint8_t RESERVED_0[4]; | ||
1099 | __IO uint32_t ASYNCAPBCLKCTRL; /**< Async peripheral clock control, offset: 0x10 */ | ||
1100 | __O uint32_t ASYNCAPBCLKCTRLSET; /**< Set bits in ASYNCAPBCLKCTRL, offset: 0x14 */ | ||
1101 | __O uint32_t ASYNCAPBCLKCTRLCLR; /**< Clear bits in ASYNCAPBCLKCTRL, offset: 0x18 */ | ||
1102 | uint8_t RESERVED_1[4]; | ||
1103 | __IO uint32_t ASYNCAPBCLKSELA; /**< Async APB clock source select A, offset: 0x20 */ | ||
1104 | } ASYNC_SYSCON_Type; | ||
1105 | |||
1106 | /* ---------------------------------------------------------------------------- | ||
1107 | -- ASYNC_SYSCON Register Masks | ||
1108 | ---------------------------------------------------------------------------- */ | ||
1109 | |||
1110 | /*! | ||
1111 | * @addtogroup ASYNC_SYSCON_Register_Masks ASYNC_SYSCON Register Masks | ||
1112 | * @{ | ||
1113 | */ | ||
1114 | |||
1115 | /*! @name ASYNCPRESETCTRL - Async peripheral reset control */ | ||
1116 | /*! @{ */ | ||
1117 | #define ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER3_MASK (0x2000U) | ||
1118 | #define ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER3_SHIFT (13U) | ||
1119 | /*! CTIMER3 - Standard counter/timer CTIMER3 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
1120 | */ | ||
1121 | #define ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER3(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER3_SHIFT)) & ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER3_MASK) | ||
1122 | #define ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER4_MASK (0x4000U) | ||
1123 | #define ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER4_SHIFT (14U) | ||
1124 | /*! CTIMER4 - Standard counter/timer CTIMER4 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
1125 | */ | ||
1126 | #define ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER4(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER4_SHIFT)) & ASYNC_SYSCON_ASYNCPRESETCTRL_CTIMER4_MASK) | ||
1127 | /*! @} */ | ||
1128 | |||
1129 | /*! @name ASYNCPRESETCTRLSET - Set bits in ASYNCPRESETCTRL */ | ||
1130 | /*! @{ */ | ||
1131 | #define ASYNC_SYSCON_ASYNCPRESETCTRLSET_ARST_SET_MASK (0xFFFFFFFFU) | ||
1132 | #define ASYNC_SYSCON_ASYNCPRESETCTRLSET_ARST_SET_SHIFT (0U) | ||
1133 | /*! ARST_SET - Writing ones to this register sets the corresponding bit or bits in the | ||
1134 | * ASYNCPRESETCTRL register, if they are implemented. Bits that do not correspond to defined bits in | ||
1135 | * ASYNCPRESETCTRL are reserved and only zeroes should be written to them. | ||
1136 | */ | ||
1137 | #define ASYNC_SYSCON_ASYNCPRESETCTRLSET_ARST_SET(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCPRESETCTRLSET_ARST_SET_SHIFT)) & ASYNC_SYSCON_ASYNCPRESETCTRLSET_ARST_SET_MASK) | ||
1138 | /*! @} */ | ||
1139 | |||
1140 | /*! @name ASYNCPRESETCTRLCLR - Clear bits in ASYNCPRESETCTRL */ | ||
1141 | /*! @{ */ | ||
1142 | #define ASYNC_SYSCON_ASYNCPRESETCTRLCLR_ARST_CLR_MASK (0xFFFFFFFFU) | ||
1143 | #define ASYNC_SYSCON_ASYNCPRESETCTRLCLR_ARST_CLR_SHIFT (0U) | ||
1144 | /*! ARST_CLR - Writing ones to this register clears the corresponding bit or bits in the | ||
1145 | * ASYNCPRESETCTRL register, if they are implemented. Bits that do not correspond to defined bits in | ||
1146 | * ASYNCPRESETCTRL are reserved and only zeroes should be written to them. | ||
1147 | */ | ||
1148 | #define ASYNC_SYSCON_ASYNCPRESETCTRLCLR_ARST_CLR(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCPRESETCTRLCLR_ARST_CLR_SHIFT)) & ASYNC_SYSCON_ASYNCPRESETCTRLCLR_ARST_CLR_MASK) | ||
1149 | /*! @} */ | ||
1150 | |||
1151 | /*! @name ASYNCAPBCLKCTRL - Async peripheral clock control */ | ||
1152 | /*! @{ */ | ||
1153 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER3_MASK (0x2000U) | ||
1154 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER3_SHIFT (13U) | ||
1155 | /*! CTIMER3 - Controls the clock for CTIMER3. 0 = Disable; 1 = Enable. | ||
1156 | */ | ||
1157 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER3(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER3_SHIFT)) & ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER3_MASK) | ||
1158 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER4_MASK (0x4000U) | ||
1159 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER4_SHIFT (14U) | ||
1160 | /*! CTIMER4 - Controls the clock for CTIMER4. 0 = Disable; 1 = Enable. | ||
1161 | */ | ||
1162 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER4(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER4_SHIFT)) & ASYNC_SYSCON_ASYNCAPBCLKCTRL_CTIMER4_MASK) | ||
1163 | /*! @} */ | ||
1164 | |||
1165 | /*! @name ASYNCAPBCLKCTRLSET - Set bits in ASYNCAPBCLKCTRL */ | ||
1166 | /*! @{ */ | ||
1167 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRLSET_ACLK_SET_MASK (0xFFFFFFFFU) | ||
1168 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRLSET_ACLK_SET_SHIFT (0U) | ||
1169 | /*! ACLK_SET - Writing ones to this register sets the corresponding bit or bits in the | ||
1170 | * ASYNCAPBCLKCTRL register, if they are implemented. Bits that do not correspond to defined bits in | ||
1171 | * ASYNCPRESETCTRL are reserved and only zeroes should be written to them. | ||
1172 | */ | ||
1173 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRLSET_ACLK_SET(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCAPBCLKCTRLSET_ACLK_SET_SHIFT)) & ASYNC_SYSCON_ASYNCAPBCLKCTRLSET_ACLK_SET_MASK) | ||
1174 | /*! @} */ | ||
1175 | |||
1176 | /*! @name ASYNCAPBCLKCTRLCLR - Clear bits in ASYNCAPBCLKCTRL */ | ||
1177 | /*! @{ */ | ||
1178 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRLCLR_ACLK_CLR_MASK (0xFFFFFFFFU) | ||
1179 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRLCLR_ACLK_CLR_SHIFT (0U) | ||
1180 | /*! ACLK_CLR - Writing ones to this register clears the corresponding bit or bits in the | ||
1181 | * ASYNCAPBCLKCTRL register, if they are implemented. Bits that do not correspond to defined bits in | ||
1182 | * ASYNCAPBCLKCTRL are reserved and only zeroes should be written to them. | ||
1183 | */ | ||
1184 | #define ASYNC_SYSCON_ASYNCAPBCLKCTRLCLR_ACLK_CLR(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCAPBCLKCTRLCLR_ACLK_CLR_SHIFT)) & ASYNC_SYSCON_ASYNCAPBCLKCTRLCLR_ACLK_CLR_MASK) | ||
1185 | /*! @} */ | ||
1186 | |||
1187 | /*! @name ASYNCAPBCLKSELA - Async APB clock source select A */ | ||
1188 | /*! @{ */ | ||
1189 | #define ASYNC_SYSCON_ASYNCAPBCLKSELA_SEL_MASK (0x3U) | ||
1190 | #define ASYNC_SYSCON_ASYNCAPBCLKSELA_SEL_SHIFT (0U) | ||
1191 | /*! SEL - Clock source for asynchronous clock source selector A | ||
1192 | * 0b00..Main clock (main_clk) | ||
1193 | * 0b01..FRO 12 MHz (fro_12m) | ||
1194 | * 0b10..Audio PLL clock.(AUDPLL_BYPASS) | ||
1195 | * 0b11..fc6 fclk (fc6_fclk) | ||
1196 | */ | ||
1197 | #define ASYNC_SYSCON_ASYNCAPBCLKSELA_SEL(x) (((uint32_t)(((uint32_t)(x)) << ASYNC_SYSCON_ASYNCAPBCLKSELA_SEL_SHIFT)) & ASYNC_SYSCON_ASYNCAPBCLKSELA_SEL_MASK) | ||
1198 | /*! @} */ | ||
1199 | |||
1200 | |||
1201 | /*! | ||
1202 | * @} | ||
1203 | */ /* end of group ASYNC_SYSCON_Register_Masks */ | ||
1204 | |||
1205 | |||
1206 | /* ASYNC_SYSCON - Peripheral instance base addresses */ | ||
1207 | /** Peripheral ASYNC_SYSCON base address */ | ||
1208 | #define ASYNC_SYSCON_BASE (0x40040000u) | ||
1209 | /** Peripheral ASYNC_SYSCON base pointer */ | ||
1210 | #define ASYNC_SYSCON ((ASYNC_SYSCON_Type *)ASYNC_SYSCON_BASE) | ||
1211 | /** Array initializer of ASYNC_SYSCON peripheral base addresses */ | ||
1212 | #define ASYNC_SYSCON_BASE_ADDRS { ASYNC_SYSCON_BASE } | ||
1213 | /** Array initializer of ASYNC_SYSCON peripheral base pointers */ | ||
1214 | #define ASYNC_SYSCON_BASE_PTRS { ASYNC_SYSCON } | ||
1215 | |||
1216 | /*! | ||
1217 | * @} | ||
1218 | */ /* end of group ASYNC_SYSCON_Peripheral_Access_Layer */ | ||
1219 | |||
1220 | |||
1221 | /* ---------------------------------------------------------------------------- | ||
1222 | -- CRC Peripheral Access Layer | ||
1223 | ---------------------------------------------------------------------------- */ | ||
1224 | |||
1225 | /*! | ||
1226 | * @addtogroup CRC_Peripheral_Access_Layer CRC Peripheral Access Layer | ||
1227 | * @{ | ||
1228 | */ | ||
1229 | |||
1230 | /** CRC - Register Layout Typedef */ | ||
1231 | typedef struct { | ||
1232 | __IO uint32_t MODE; /**< CRC mode register, offset: 0x0 */ | ||
1233 | __IO uint32_t SEED; /**< CRC seed register, offset: 0x4 */ | ||
1234 | union { /* offset: 0x8 */ | ||
1235 | __I uint32_t SUM; /**< CRC checksum register, offset: 0x8 */ | ||
1236 | __O uint32_t WR_DATA; /**< CRC data register, offset: 0x8 */ | ||
1237 | }; | ||
1238 | } CRC_Type; | ||
1239 | |||
1240 | /* ---------------------------------------------------------------------------- | ||
1241 | -- CRC Register Masks | ||
1242 | ---------------------------------------------------------------------------- */ | ||
1243 | |||
1244 | /*! | ||
1245 | * @addtogroup CRC_Register_Masks CRC Register Masks | ||
1246 | * @{ | ||
1247 | */ | ||
1248 | |||
1249 | /*! @name MODE - CRC mode register */ | ||
1250 | /*! @{ */ | ||
1251 | #define CRC_MODE_CRC_POLY_MASK (0x3U) | ||
1252 | #define CRC_MODE_CRC_POLY_SHIFT (0U) | ||
1253 | /*! CRC_POLY - CRC polynomial: 1X = CRC-32 polynomial 01 = CRC-16 polynomial 00 = CRC-CCITT polynomial | ||
1254 | */ | ||
1255 | #define CRC_MODE_CRC_POLY(x) (((uint32_t)(((uint32_t)(x)) << CRC_MODE_CRC_POLY_SHIFT)) & CRC_MODE_CRC_POLY_MASK) | ||
1256 | #define CRC_MODE_BIT_RVS_WR_MASK (0x4U) | ||
1257 | #define CRC_MODE_BIT_RVS_WR_SHIFT (2U) | ||
1258 | /*! BIT_RVS_WR - Data bit order: 1 = Bit order reverse for CRC_WR_DATA (per byte) 0 = No bit order reverse for CRC_WR_DATA (per byte) | ||
1259 | */ | ||
1260 | #define CRC_MODE_BIT_RVS_WR(x) (((uint32_t)(((uint32_t)(x)) << CRC_MODE_BIT_RVS_WR_SHIFT)) & CRC_MODE_BIT_RVS_WR_MASK) | ||
1261 | #define CRC_MODE_CMPL_WR_MASK (0x8U) | ||
1262 | #define CRC_MODE_CMPL_WR_SHIFT (3U) | ||
1263 | /*! CMPL_WR - Data complement: 1 = 1's complement for CRC_WR_DATA 0 = No 1's complement for CRC_WR_DATA | ||
1264 | */ | ||
1265 | #define CRC_MODE_CMPL_WR(x) (((uint32_t)(((uint32_t)(x)) << CRC_MODE_CMPL_WR_SHIFT)) & CRC_MODE_CMPL_WR_MASK) | ||
1266 | #define CRC_MODE_BIT_RVS_SUM_MASK (0x10U) | ||
1267 | #define CRC_MODE_BIT_RVS_SUM_SHIFT (4U) | ||
1268 | /*! BIT_RVS_SUM - CRC sum bit order: 1 = Bit order reverse for CRC_SUM 0 = No bit order reverse for CRC_SUM | ||
1269 | */ | ||
1270 | #define CRC_MODE_BIT_RVS_SUM(x) (((uint32_t)(((uint32_t)(x)) << CRC_MODE_BIT_RVS_SUM_SHIFT)) & CRC_MODE_BIT_RVS_SUM_MASK) | ||
1271 | #define CRC_MODE_CMPL_SUM_MASK (0x20U) | ||
1272 | #define CRC_MODE_CMPL_SUM_SHIFT (5U) | ||
1273 | /*! CMPL_SUM - CRC sum complement: 1 = 1's complement for CRC_SUM 0 = No 1's complement for CRC_SUM | ||
1274 | */ | ||
1275 | #define CRC_MODE_CMPL_SUM(x) (((uint32_t)(((uint32_t)(x)) << CRC_MODE_CMPL_SUM_SHIFT)) & CRC_MODE_CMPL_SUM_MASK) | ||
1276 | /*! @} */ | ||
1277 | |||
1278 | /*! @name SEED - CRC seed register */ | ||
1279 | /*! @{ */ | ||
1280 | #define CRC_SEED_CRC_SEED_MASK (0xFFFFFFFFU) | ||
1281 | #define CRC_SEED_CRC_SEED_SHIFT (0U) | ||
1282 | /*! CRC_SEED - A write access to this register will load CRC seed value to CRC_SUM register with | ||
1283 | * selected bit order and 1's complement pre-processes. A write access to this register will | ||
1284 | * overrule the CRC calculation in progresses. | ||
1285 | */ | ||
1286 | #define CRC_SEED_CRC_SEED(x) (((uint32_t)(((uint32_t)(x)) << CRC_SEED_CRC_SEED_SHIFT)) & CRC_SEED_CRC_SEED_MASK) | ||
1287 | /*! @} */ | ||
1288 | |||
1289 | /*! @name SUM - CRC checksum register */ | ||
1290 | /*! @{ */ | ||
1291 | #define CRC_SUM_CRC_SUM_MASK (0xFFFFFFFFU) | ||
1292 | #define CRC_SUM_CRC_SUM_SHIFT (0U) | ||
1293 | /*! CRC_SUM - The most recent CRC sum can be read through this register with selected bit order and 1's complement post-processes. | ||
1294 | */ | ||
1295 | #define CRC_SUM_CRC_SUM(x) (((uint32_t)(((uint32_t)(x)) << CRC_SUM_CRC_SUM_SHIFT)) & CRC_SUM_CRC_SUM_MASK) | ||
1296 | /*! @} */ | ||
1297 | |||
1298 | /*! @name WR_DATA - CRC data register */ | ||
1299 | /*! @{ */ | ||
1300 | #define CRC_WR_DATA_CRC_WR_DATA_MASK (0xFFFFFFFFU) | ||
1301 | #define CRC_WR_DATA_CRC_WR_DATA_SHIFT (0U) | ||
1302 | /*! CRC_WR_DATA - Data written to this register will be taken to perform CRC calculation with | ||
1303 | * selected bit order and 1's complement pre-process. Any write size 8, 16 or 32-bit are allowed and | ||
1304 | * accept back-to-back transactions. | ||
1305 | */ | ||
1306 | #define CRC_WR_DATA_CRC_WR_DATA(x) (((uint32_t)(((uint32_t)(x)) << CRC_WR_DATA_CRC_WR_DATA_SHIFT)) & CRC_WR_DATA_CRC_WR_DATA_MASK) | ||
1307 | /*! @} */ | ||
1308 | |||
1309 | |||
1310 | /*! | ||
1311 | * @} | ||
1312 | */ /* end of group CRC_Register_Masks */ | ||
1313 | |||
1314 | |||
1315 | /* CRC - Peripheral instance base addresses */ | ||
1316 | /** Peripheral CRC_ENGINE base address */ | ||
1317 | #define CRC_ENGINE_BASE (0x40095000u) | ||
1318 | /** Peripheral CRC_ENGINE base pointer */ | ||
1319 | #define CRC_ENGINE ((CRC_Type *)CRC_ENGINE_BASE) | ||
1320 | /** Array initializer of CRC peripheral base addresses */ | ||
1321 | #define CRC_BASE_ADDRS { CRC_ENGINE_BASE } | ||
1322 | /** Array initializer of CRC peripheral base pointers */ | ||
1323 | #define CRC_BASE_PTRS { CRC_ENGINE } | ||
1324 | |||
1325 | /*! | ||
1326 | * @} | ||
1327 | */ /* end of group CRC_Peripheral_Access_Layer */ | ||
1328 | |||
1329 | |||
1330 | /* ---------------------------------------------------------------------------- | ||
1331 | -- CTIMER Peripheral Access Layer | ||
1332 | ---------------------------------------------------------------------------- */ | ||
1333 | |||
1334 | /*! | ||
1335 | * @addtogroup CTIMER_Peripheral_Access_Layer CTIMER Peripheral Access Layer | ||
1336 | * @{ | ||
1337 | */ | ||
1338 | |||
1339 | /** CTIMER - Register Layout Typedef */ | ||
1340 | typedef struct { | ||
1341 | __IO uint32_t IR; /**< Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify which of eight possible interrupt sources are pending., offset: 0x0 */ | ||
1342 | __IO uint32_t TCR; /**< Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR., offset: 0x4 */ | ||
1343 | __IO uint32_t TC; /**< Timer Counter, offset: 0x8 */ | ||
1344 | __IO uint32_t PR; /**< Prescale Register, offset: 0xC */ | ||
1345 | __IO uint32_t PC; /**< Prescale Counter, offset: 0x10 */ | ||
1346 | __IO uint32_t MCR; /**< Match Control Register, offset: 0x14 */ | ||
1347 | __IO uint32_t MR[4]; /**< Match Register . MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC., array offset: 0x18, array step: 0x4 */ | ||
1348 | __IO uint32_t CCR; /**< Capture Control Register. The CCR controls which edges of the capture inputs are used to load the Capture Registers and whether or not an interrupt is generated when a capture takes place., offset: 0x28 */ | ||
1349 | __I uint32_t CR[4]; /**< Capture Register . CR is loaded with the value of TC when there is an event on the CAPn. input., array offset: 0x2C, array step: 0x4 */ | ||
1350 | __IO uint32_t EMR; /**< External Match Register. The EMR controls the match function and the external match pins., offset: 0x3C */ | ||
1351 | uint8_t RESERVED_0[48]; | ||
1352 | __IO uint32_t CTCR; /**< Count Control Register. The CTCR selects between Timer and Counter mode, and in Counter mode selects the signal and edge(s) for counting., offset: 0x70 */ | ||
1353 | __IO uint32_t PWMC; /**< PWM Control Register. The PWMCON enables PWM mode for the external match pins., offset: 0x74 */ | ||
1354 | __IO uint32_t MSR[4]; /**< Match Shadow Register, array offset: 0x78, array step: 0x4 */ | ||
1355 | } CTIMER_Type; | ||
1356 | |||
1357 | /* ---------------------------------------------------------------------------- | ||
1358 | -- CTIMER Register Masks | ||
1359 | ---------------------------------------------------------------------------- */ | ||
1360 | |||
1361 | /*! | ||
1362 | * @addtogroup CTIMER_Register_Masks CTIMER Register Masks | ||
1363 | * @{ | ||
1364 | */ | ||
1365 | |||
1366 | /*! @name IR - Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify which of eight possible interrupt sources are pending. */ | ||
1367 | /*! @{ */ | ||
1368 | #define CTIMER_IR_MR0INT_MASK (0x1U) | ||
1369 | #define CTIMER_IR_MR0INT_SHIFT (0U) | ||
1370 | /*! MR0INT - Interrupt flag for match channel 0. | ||
1371 | */ | ||
1372 | #define CTIMER_IR_MR0INT(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_IR_MR0INT_SHIFT)) & CTIMER_IR_MR0INT_MASK) | ||
1373 | #define CTIMER_IR_MR1INT_MASK (0x2U) | ||
1374 | #define CTIMER_IR_MR1INT_SHIFT (1U) | ||
1375 | /*! MR1INT - Interrupt flag for match channel 1. | ||
1376 | */ | ||
1377 | #define CTIMER_IR_MR1INT(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_IR_MR1INT_SHIFT)) & CTIMER_IR_MR1INT_MASK) | ||
1378 | #define CTIMER_IR_MR2INT_MASK (0x4U) | ||
1379 | #define CTIMER_IR_MR2INT_SHIFT (2U) | ||
1380 | /*! MR2INT - Interrupt flag for match channel 2. | ||
1381 | */ | ||
1382 | #define CTIMER_IR_MR2INT(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_IR_MR2INT_SHIFT)) & CTIMER_IR_MR2INT_MASK) | ||
1383 | #define CTIMER_IR_MR3INT_MASK (0x8U) | ||
1384 | #define CTIMER_IR_MR3INT_SHIFT (3U) | ||
1385 | /*! MR3INT - Interrupt flag for match channel 3. | ||
1386 | */ | ||
1387 | #define CTIMER_IR_MR3INT(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_IR_MR3INT_SHIFT)) & CTIMER_IR_MR3INT_MASK) | ||
1388 | #define CTIMER_IR_CR0INT_MASK (0x10U) | ||
1389 | #define CTIMER_IR_CR0INT_SHIFT (4U) | ||
1390 | /*! CR0INT - Interrupt flag for capture channel 0 event. | ||
1391 | */ | ||
1392 | #define CTIMER_IR_CR0INT(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_IR_CR0INT_SHIFT)) & CTIMER_IR_CR0INT_MASK) | ||
1393 | #define CTIMER_IR_CR1INT_MASK (0x20U) | ||
1394 | #define CTIMER_IR_CR1INT_SHIFT (5U) | ||
1395 | /*! CR1INT - Interrupt flag for capture channel 1 event. | ||
1396 | */ | ||
1397 | #define CTIMER_IR_CR1INT(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_IR_CR1INT_SHIFT)) & CTIMER_IR_CR1INT_MASK) | ||
1398 | #define CTIMER_IR_CR2INT_MASK (0x40U) | ||
1399 | #define CTIMER_IR_CR2INT_SHIFT (6U) | ||
1400 | /*! CR2INT - Interrupt flag for capture channel 2 event. | ||
1401 | */ | ||
1402 | #define CTIMER_IR_CR2INT(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_IR_CR2INT_SHIFT)) & CTIMER_IR_CR2INT_MASK) | ||
1403 | #define CTIMER_IR_CR3INT_MASK (0x80U) | ||
1404 | #define CTIMER_IR_CR3INT_SHIFT (7U) | ||
1405 | /*! CR3INT - Interrupt flag for capture channel 3 event. | ||
1406 | */ | ||
1407 | #define CTIMER_IR_CR3INT(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_IR_CR3INT_SHIFT)) & CTIMER_IR_CR3INT_MASK) | ||
1408 | /*! @} */ | ||
1409 | |||
1410 | /*! @name TCR - Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR. */ | ||
1411 | /*! @{ */ | ||
1412 | #define CTIMER_TCR_CEN_MASK (0x1U) | ||
1413 | #define CTIMER_TCR_CEN_SHIFT (0U) | ||
1414 | /*! CEN - Counter enable. | ||
1415 | * 0b0..Disabled.The counters are disabled. | ||
1416 | * 0b1..Enabled. The Timer Counter and Prescale Counter are enabled. | ||
1417 | */ | ||
1418 | #define CTIMER_TCR_CEN(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_TCR_CEN_SHIFT)) & CTIMER_TCR_CEN_MASK) | ||
1419 | #define CTIMER_TCR_CRST_MASK (0x2U) | ||
1420 | #define CTIMER_TCR_CRST_SHIFT (1U) | ||
1421 | /*! CRST - Counter reset. | ||
1422 | * 0b0..Disabled. Do nothing. | ||
1423 | * 0b1..Enabled. The Timer Counter and the Prescale Counter are synchronously reset on the next positive edge of | ||
1424 | * the APB bus clock. The counters remain reset until TCR[1] is returned to zero. | ||
1425 | */ | ||
1426 | #define CTIMER_TCR_CRST(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_TCR_CRST_SHIFT)) & CTIMER_TCR_CRST_MASK) | ||
1427 | /*! @} */ | ||
1428 | |||
1429 | /*! @name TC - Timer Counter */ | ||
1430 | /*! @{ */ | ||
1431 | #define CTIMER_TC_TCVAL_MASK (0xFFFFFFFFU) | ||
1432 | #define CTIMER_TC_TCVAL_SHIFT (0U) | ||
1433 | /*! TCVAL - Timer counter value. | ||
1434 | */ | ||
1435 | #define CTIMER_TC_TCVAL(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_TC_TCVAL_SHIFT)) & CTIMER_TC_TCVAL_MASK) | ||
1436 | /*! @} */ | ||
1437 | |||
1438 | /*! @name PR - Prescale Register */ | ||
1439 | /*! @{ */ | ||
1440 | #define CTIMER_PR_PRVAL_MASK (0xFFFFFFFFU) | ||
1441 | #define CTIMER_PR_PRVAL_SHIFT (0U) | ||
1442 | /*! PRVAL - Prescale counter value. | ||
1443 | */ | ||
1444 | #define CTIMER_PR_PRVAL(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_PR_PRVAL_SHIFT)) & CTIMER_PR_PRVAL_MASK) | ||
1445 | /*! @} */ | ||
1446 | |||
1447 | /*! @name PC - Prescale Counter */ | ||
1448 | /*! @{ */ | ||
1449 | #define CTIMER_PC_PCVAL_MASK (0xFFFFFFFFU) | ||
1450 | #define CTIMER_PC_PCVAL_SHIFT (0U) | ||
1451 | /*! PCVAL - Prescale counter value. | ||
1452 | */ | ||
1453 | #define CTIMER_PC_PCVAL(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_PC_PCVAL_SHIFT)) & CTIMER_PC_PCVAL_MASK) | ||
1454 | /*! @} */ | ||
1455 | |||
1456 | /*! @name MCR - Match Control Register */ | ||
1457 | /*! @{ */ | ||
1458 | #define CTIMER_MCR_MR0I_MASK (0x1U) | ||
1459 | #define CTIMER_MCR_MR0I_SHIFT (0U) | ||
1460 | /*! MR0I - Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC. | ||
1461 | */ | ||
1462 | #define CTIMER_MCR_MR0I(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR0I_SHIFT)) & CTIMER_MCR_MR0I_MASK) | ||
1463 | #define CTIMER_MCR_MR0R_MASK (0x2U) | ||
1464 | #define CTIMER_MCR_MR0R_SHIFT (1U) | ||
1465 | /*! MR0R - Reset on MR0: the TC will be reset if MR0 matches it. | ||
1466 | */ | ||
1467 | #define CTIMER_MCR_MR0R(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR0R_SHIFT)) & CTIMER_MCR_MR0R_MASK) | ||
1468 | #define CTIMER_MCR_MR0S_MASK (0x4U) | ||
1469 | #define CTIMER_MCR_MR0S_SHIFT (2U) | ||
1470 | /*! MR0S - Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches the TC. | ||
1471 | */ | ||
1472 | #define CTIMER_MCR_MR0S(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR0S_SHIFT)) & CTIMER_MCR_MR0S_MASK) | ||
1473 | #define CTIMER_MCR_MR1I_MASK (0x8U) | ||
1474 | #define CTIMER_MCR_MR1I_SHIFT (3U) | ||
1475 | /*! MR1I - Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC. | ||
1476 | */ | ||
1477 | #define CTIMER_MCR_MR1I(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR1I_SHIFT)) & CTIMER_MCR_MR1I_MASK) | ||
1478 | #define CTIMER_MCR_MR1R_MASK (0x10U) | ||
1479 | #define CTIMER_MCR_MR1R_SHIFT (4U) | ||
1480 | /*! MR1R - Reset on MR1: the TC will be reset if MR1 matches it. | ||
1481 | */ | ||
1482 | #define CTIMER_MCR_MR1R(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR1R_SHIFT)) & CTIMER_MCR_MR1R_MASK) | ||
1483 | #define CTIMER_MCR_MR1S_MASK (0x20U) | ||
1484 | #define CTIMER_MCR_MR1S_SHIFT (5U) | ||
1485 | /*! MR1S - Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches the TC. | ||
1486 | */ | ||
1487 | #define CTIMER_MCR_MR1S(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR1S_SHIFT)) & CTIMER_MCR_MR1S_MASK) | ||
1488 | #define CTIMER_MCR_MR2I_MASK (0x40U) | ||
1489 | #define CTIMER_MCR_MR2I_SHIFT (6U) | ||
1490 | /*! MR2I - Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC. | ||
1491 | */ | ||
1492 | #define CTIMER_MCR_MR2I(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR2I_SHIFT)) & CTIMER_MCR_MR2I_MASK) | ||
1493 | #define CTIMER_MCR_MR2R_MASK (0x80U) | ||
1494 | #define CTIMER_MCR_MR2R_SHIFT (7U) | ||
1495 | /*! MR2R - Reset on MR2: the TC will be reset if MR2 matches it. | ||
1496 | */ | ||
1497 | #define CTIMER_MCR_MR2R(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR2R_SHIFT)) & CTIMER_MCR_MR2R_MASK) | ||
1498 | #define CTIMER_MCR_MR2S_MASK (0x100U) | ||
1499 | #define CTIMER_MCR_MR2S_SHIFT (8U) | ||
1500 | /*! MR2S - Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches the TC. | ||
1501 | */ | ||
1502 | #define CTIMER_MCR_MR2S(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR2S_SHIFT)) & CTIMER_MCR_MR2S_MASK) | ||
1503 | #define CTIMER_MCR_MR3I_MASK (0x200U) | ||
1504 | #define CTIMER_MCR_MR3I_SHIFT (9U) | ||
1505 | /*! MR3I - Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC. | ||
1506 | */ | ||
1507 | #define CTIMER_MCR_MR3I(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR3I_SHIFT)) & CTIMER_MCR_MR3I_MASK) | ||
1508 | #define CTIMER_MCR_MR3R_MASK (0x400U) | ||
1509 | #define CTIMER_MCR_MR3R_SHIFT (10U) | ||
1510 | /*! MR3R - Reset on MR3: the TC will be reset if MR3 matches it. | ||
1511 | */ | ||
1512 | #define CTIMER_MCR_MR3R(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR3R_SHIFT)) & CTIMER_MCR_MR3R_MASK) | ||
1513 | #define CTIMER_MCR_MR3S_MASK (0x800U) | ||
1514 | #define CTIMER_MCR_MR3S_SHIFT (11U) | ||
1515 | /*! MR3S - Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches the TC. | ||
1516 | */ | ||
1517 | #define CTIMER_MCR_MR3S(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR3S_SHIFT)) & CTIMER_MCR_MR3S_MASK) | ||
1518 | #define CTIMER_MCR_MR0RL_MASK (0x1000000U) | ||
1519 | #define CTIMER_MCR_MR0RL_SHIFT (24U) | ||
1520 | /*! MR0RL - Reload MR0 with the contents of the Match 0 Shadow Register when the TC is reset to zero | ||
1521 | * (either via a match event or a write to bit 1 of the TCR). | ||
1522 | */ | ||
1523 | #define CTIMER_MCR_MR0RL(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR0RL_SHIFT)) & CTIMER_MCR_MR0RL_MASK) | ||
1524 | #define CTIMER_MCR_MR1RL_MASK (0x2000000U) | ||
1525 | #define CTIMER_MCR_MR1RL_SHIFT (25U) | ||
1526 | /*! MR1RL - Reload MR1 with the contents of the Match 1 Shadow Register when the TC is reset to zero | ||
1527 | * (either via a match event or a write to bit 1 of the TCR). | ||
1528 | */ | ||
1529 | #define CTIMER_MCR_MR1RL(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR1RL_SHIFT)) & CTIMER_MCR_MR1RL_MASK) | ||
1530 | #define CTIMER_MCR_MR2RL_MASK (0x4000000U) | ||
1531 | #define CTIMER_MCR_MR2RL_SHIFT (26U) | ||
1532 | /*! MR2RL - Reload MR2 with the contents of the Match 2 Shadow Register when the TC is reset to zero | ||
1533 | * (either via a match event or a write to bit 1 of the TCR). | ||
1534 | */ | ||
1535 | #define CTIMER_MCR_MR2RL(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR2RL_SHIFT)) & CTIMER_MCR_MR2RL_MASK) | ||
1536 | #define CTIMER_MCR_MR3RL_MASK (0x8000000U) | ||
1537 | #define CTIMER_MCR_MR3RL_SHIFT (27U) | ||
1538 | /*! MR3RL - Reload MR3 with the contents of the Match 3 Shadow Register when the TC is reset to zero | ||
1539 | * (either via a match event or a write to bit 1 of the TCR). | ||
1540 | */ | ||
1541 | #define CTIMER_MCR_MR3RL(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MCR_MR3RL_SHIFT)) & CTIMER_MCR_MR3RL_MASK) | ||
1542 | /*! @} */ | ||
1543 | |||
1544 | /*! @name MR - Match Register . MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC. */ | ||
1545 | /*! @{ */ | ||
1546 | #define CTIMER_MR_MATCH_MASK (0xFFFFFFFFU) | ||
1547 | #define CTIMER_MR_MATCH_SHIFT (0U) | ||
1548 | /*! MATCH - Timer counter match value. | ||
1549 | */ | ||
1550 | #define CTIMER_MR_MATCH(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MR_MATCH_SHIFT)) & CTIMER_MR_MATCH_MASK) | ||
1551 | /*! @} */ | ||
1552 | |||
1553 | /* The count of CTIMER_MR */ | ||
1554 | #define CTIMER_MR_COUNT (4U) | ||
1555 | |||
1556 | /*! @name CCR - Capture Control Register. The CCR controls which edges of the capture inputs are used to load the Capture Registers and whether or not an interrupt is generated when a capture takes place. */ | ||
1557 | /*! @{ */ | ||
1558 | #define CTIMER_CCR_CAP0RE_MASK (0x1U) | ||
1559 | #define CTIMER_CCR_CAP0RE_SHIFT (0U) | ||
1560 | /*! CAP0RE - Rising edge of capture channel 0: a sequence of 0 then 1 causes CR0 to be loaded with | ||
1561 | * the contents of TC. 0 = disabled. 1 = enabled. | ||
1562 | */ | ||
1563 | #define CTIMER_CCR_CAP0RE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP0RE_SHIFT)) & CTIMER_CCR_CAP0RE_MASK) | ||
1564 | #define CTIMER_CCR_CAP0FE_MASK (0x2U) | ||
1565 | #define CTIMER_CCR_CAP0FE_SHIFT (1U) | ||
1566 | /*! CAP0FE - Falling edge of capture channel 0: a sequence of 1 then 0 causes CR0 to be loaded with | ||
1567 | * the contents of TC. 0 = disabled. 1 = enabled. | ||
1568 | */ | ||
1569 | #define CTIMER_CCR_CAP0FE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP0FE_SHIFT)) & CTIMER_CCR_CAP0FE_MASK) | ||
1570 | #define CTIMER_CCR_CAP0I_MASK (0x4U) | ||
1571 | #define CTIMER_CCR_CAP0I_SHIFT (2U) | ||
1572 | /*! CAP0I - Generate interrupt on channel 0 capture event: a CR0 load generates an interrupt. | ||
1573 | */ | ||
1574 | #define CTIMER_CCR_CAP0I(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP0I_SHIFT)) & CTIMER_CCR_CAP0I_MASK) | ||
1575 | #define CTIMER_CCR_CAP1RE_MASK (0x8U) | ||
1576 | #define CTIMER_CCR_CAP1RE_SHIFT (3U) | ||
1577 | /*! CAP1RE - Rising edge of capture channel 1: a sequence of 0 then 1 causes CR1 to be loaded with | ||
1578 | * the contents of TC. 0 = disabled. 1 = enabled. | ||
1579 | */ | ||
1580 | #define CTIMER_CCR_CAP1RE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP1RE_SHIFT)) & CTIMER_CCR_CAP1RE_MASK) | ||
1581 | #define CTIMER_CCR_CAP1FE_MASK (0x10U) | ||
1582 | #define CTIMER_CCR_CAP1FE_SHIFT (4U) | ||
1583 | /*! CAP1FE - Falling edge of capture channel 1: a sequence of 1 then 0 causes CR1 to be loaded with | ||
1584 | * the contents of TC. 0 = disabled. 1 = enabled. | ||
1585 | */ | ||
1586 | #define CTIMER_CCR_CAP1FE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP1FE_SHIFT)) & CTIMER_CCR_CAP1FE_MASK) | ||
1587 | #define CTIMER_CCR_CAP1I_MASK (0x20U) | ||
1588 | #define CTIMER_CCR_CAP1I_SHIFT (5U) | ||
1589 | /*! CAP1I - Generate interrupt on channel 1 capture event: a CR1 load generates an interrupt. | ||
1590 | */ | ||
1591 | #define CTIMER_CCR_CAP1I(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP1I_SHIFT)) & CTIMER_CCR_CAP1I_MASK) | ||
1592 | #define CTIMER_CCR_CAP2RE_MASK (0x40U) | ||
1593 | #define CTIMER_CCR_CAP2RE_SHIFT (6U) | ||
1594 | /*! CAP2RE - Rising edge of capture channel 2: a sequence of 0 then 1 causes CR2 to be loaded with | ||
1595 | * the contents of TC. 0 = disabled. 1 = enabled. | ||
1596 | */ | ||
1597 | #define CTIMER_CCR_CAP2RE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP2RE_SHIFT)) & CTIMER_CCR_CAP2RE_MASK) | ||
1598 | #define CTIMER_CCR_CAP2FE_MASK (0x80U) | ||
1599 | #define CTIMER_CCR_CAP2FE_SHIFT (7U) | ||
1600 | /*! CAP2FE - Falling edge of capture channel 2: a sequence of 1 then 0 causes CR2 to be loaded with | ||
1601 | * the contents of TC. 0 = disabled. 1 = enabled. | ||
1602 | */ | ||
1603 | #define CTIMER_CCR_CAP2FE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP2FE_SHIFT)) & CTIMER_CCR_CAP2FE_MASK) | ||
1604 | #define CTIMER_CCR_CAP2I_MASK (0x100U) | ||
1605 | #define CTIMER_CCR_CAP2I_SHIFT (8U) | ||
1606 | /*! CAP2I - Generate interrupt on channel 2 capture event: a CR2 load generates an interrupt. | ||
1607 | */ | ||
1608 | #define CTIMER_CCR_CAP2I(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP2I_SHIFT)) & CTIMER_CCR_CAP2I_MASK) | ||
1609 | #define CTIMER_CCR_CAP3RE_MASK (0x200U) | ||
1610 | #define CTIMER_CCR_CAP3RE_SHIFT (9U) | ||
1611 | /*! CAP3RE - Rising edge of capture channel 3: a sequence of 0 then 1 causes CR3 to be loaded with | ||
1612 | * the contents of TC. 0 = disabled. 1 = enabled. | ||
1613 | */ | ||
1614 | #define CTIMER_CCR_CAP3RE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP3RE_SHIFT)) & CTIMER_CCR_CAP3RE_MASK) | ||
1615 | #define CTIMER_CCR_CAP3FE_MASK (0x400U) | ||
1616 | #define CTIMER_CCR_CAP3FE_SHIFT (10U) | ||
1617 | /*! CAP3FE - Falling edge of capture channel 3: a sequence of 1 then 0 causes CR3 to be loaded with | ||
1618 | * the contents of TC. 0 = disabled. 1 = enabled. | ||
1619 | */ | ||
1620 | #define CTIMER_CCR_CAP3FE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP3FE_SHIFT)) & CTIMER_CCR_CAP3FE_MASK) | ||
1621 | #define CTIMER_CCR_CAP3I_MASK (0x800U) | ||
1622 | #define CTIMER_CCR_CAP3I_SHIFT (11U) | ||
1623 | /*! CAP3I - Generate interrupt on channel 3 capture event: a CR3 load generates an interrupt. | ||
1624 | */ | ||
1625 | #define CTIMER_CCR_CAP3I(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CCR_CAP3I_SHIFT)) & CTIMER_CCR_CAP3I_MASK) | ||
1626 | /*! @} */ | ||
1627 | |||
1628 | /*! @name CR - Capture Register . CR is loaded with the value of TC when there is an event on the CAPn. input. */ | ||
1629 | /*! @{ */ | ||
1630 | #define CTIMER_CR_CAP_MASK (0xFFFFFFFFU) | ||
1631 | #define CTIMER_CR_CAP_SHIFT (0U) | ||
1632 | /*! CAP - Timer counter capture value. | ||
1633 | */ | ||
1634 | #define CTIMER_CR_CAP(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CR_CAP_SHIFT)) & CTIMER_CR_CAP_MASK) | ||
1635 | /*! @} */ | ||
1636 | |||
1637 | /* The count of CTIMER_CR */ | ||
1638 | #define CTIMER_CR_COUNT (4U) | ||
1639 | |||
1640 | /*! @name EMR - External Match Register. The EMR controls the match function and the external match pins. */ | ||
1641 | /*! @{ */ | ||
1642 | #define CTIMER_EMR_EM0_MASK (0x1U) | ||
1643 | #define CTIMER_EMR_EM0_SHIFT (0U) | ||
1644 | /*! EM0 - External Match 0. This bit reflects the state of output MAT0, whether or not this output | ||
1645 | * is connected to a pin. When a match occurs between the TC and MR0, this bit can either toggle, | ||
1646 | * go LOW, go HIGH, or do nothing, as selected by EMR[5:4]. This bit is driven to the MAT pins if | ||
1647 | * the match function is selected via IOCON. 0 = LOW. 1 = HIGH. | ||
1648 | */ | ||
1649 | #define CTIMER_EMR_EM0(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_EMR_EM0_SHIFT)) & CTIMER_EMR_EM0_MASK) | ||
1650 | #define CTIMER_EMR_EM1_MASK (0x2U) | ||
1651 | #define CTIMER_EMR_EM1_SHIFT (1U) | ||
1652 | /*! EM1 - External Match 1. This bit reflects the state of output MAT1, whether or not this output | ||
1653 | * is connected to a pin. When a match occurs between the TC and MR1, this bit can either toggle, | ||
1654 | * go LOW, go HIGH, or do nothing, as selected by EMR[7:6]. This bit is driven to the MAT pins if | ||
1655 | * the match function is selected via IOCON. 0 = LOW. 1 = HIGH. | ||
1656 | */ | ||
1657 | #define CTIMER_EMR_EM1(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_EMR_EM1_SHIFT)) & CTIMER_EMR_EM1_MASK) | ||
1658 | #define CTIMER_EMR_EM2_MASK (0x4U) | ||
1659 | #define CTIMER_EMR_EM2_SHIFT (2U) | ||
1660 | /*! EM2 - External Match 2. This bit reflects the state of output MAT2, whether or not this output | ||
1661 | * is connected to a pin. When a match occurs between the TC and MR2, this bit can either toggle, | ||
1662 | * go LOW, go HIGH, or do nothing, as selected by EMR[9:8]. This bit is driven to the MAT pins if | ||
1663 | * the match function is selected via IOCON. 0 = LOW. 1 = HIGH. | ||
1664 | */ | ||
1665 | #define CTIMER_EMR_EM2(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_EMR_EM2_SHIFT)) & CTIMER_EMR_EM2_MASK) | ||
1666 | #define CTIMER_EMR_EM3_MASK (0x8U) | ||
1667 | #define CTIMER_EMR_EM3_SHIFT (3U) | ||
1668 | /*! EM3 - External Match 3. This bit reflects the state of output MAT3, whether or not this output | ||
1669 | * is connected to a pin. When a match occurs between the TC and MR3, this bit can either toggle, | ||
1670 | * go LOW, go HIGH, or do nothing, as selected by MR[11:10]. This bit is driven to the MAT pins | ||
1671 | * if the match function is selected via IOCON. 0 = LOW. 1 = HIGH. | ||
1672 | */ | ||
1673 | #define CTIMER_EMR_EM3(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_EMR_EM3_SHIFT)) & CTIMER_EMR_EM3_MASK) | ||
1674 | #define CTIMER_EMR_EMC0_MASK (0x30U) | ||
1675 | #define CTIMER_EMR_EMC0_SHIFT (4U) | ||
1676 | /*! EMC0 - External Match Control 0. Determines the functionality of External Match 0. | ||
1677 | * 0b00..Do Nothing. | ||
1678 | * 0b01..Clear. Clear the corresponding External Match bit/output to 0 (MAT0 pin is LOW if pinned out). | ||
1679 | * 0b10..Set. Set the corresponding External Match bit/output to 1 (MAT0 pin is HIGH if pinned out). | ||
1680 | * 0b11..Toggle. Toggle the corresponding External Match bit/output. | ||
1681 | */ | ||
1682 | #define CTIMER_EMR_EMC0(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_EMR_EMC0_SHIFT)) & CTIMER_EMR_EMC0_MASK) | ||
1683 | #define CTIMER_EMR_EMC1_MASK (0xC0U) | ||
1684 | #define CTIMER_EMR_EMC1_SHIFT (6U) | ||
1685 | /*! EMC1 - External Match Control 1. Determines the functionality of External Match 1. | ||
1686 | * 0b00..Do Nothing. | ||
1687 | * 0b01..Clear. Clear the corresponding External Match bit/output to 0 (MAT1 pin is LOW if pinned out). | ||
1688 | * 0b10..Set. Set the corresponding External Match bit/output to 1 (MAT1 pin is HIGH if pinned out). | ||
1689 | * 0b11..Toggle. Toggle the corresponding External Match bit/output. | ||
1690 | */ | ||
1691 | #define CTIMER_EMR_EMC1(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_EMR_EMC1_SHIFT)) & CTIMER_EMR_EMC1_MASK) | ||
1692 | #define CTIMER_EMR_EMC2_MASK (0x300U) | ||
1693 | #define CTIMER_EMR_EMC2_SHIFT (8U) | ||
1694 | /*! EMC2 - External Match Control 2. Determines the functionality of External Match 2. | ||
1695 | * 0b00..Do Nothing. | ||
1696 | * 0b01..Clear. Clear the corresponding External Match bit/output to 0 (MAT2 pin is LOW if pinned out). | ||
1697 | * 0b10..Set. Set the corresponding External Match bit/output to 1 (MAT2 pin is HIGH if pinned out). | ||
1698 | * 0b11..Toggle. Toggle the corresponding External Match bit/output. | ||
1699 | */ | ||
1700 | #define CTIMER_EMR_EMC2(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_EMR_EMC2_SHIFT)) & CTIMER_EMR_EMC2_MASK) | ||
1701 | #define CTIMER_EMR_EMC3_MASK (0xC00U) | ||
1702 | #define CTIMER_EMR_EMC3_SHIFT (10U) | ||
1703 | /*! EMC3 - External Match Control 3. Determines the functionality of External Match 3. | ||
1704 | * 0b00..Do Nothing. | ||
1705 | * 0b01..Clear. Clear the corresponding External Match bit/output to 0 (MAT3 pin is LOW if pinned out). | ||
1706 | * 0b10..Set. Set the corresponding External Match bit/output to 1 (MAT3 pin is HIGH if pinned out). | ||
1707 | * 0b11..Toggle. Toggle the corresponding External Match bit/output. | ||
1708 | */ | ||
1709 | #define CTIMER_EMR_EMC3(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_EMR_EMC3_SHIFT)) & CTIMER_EMR_EMC3_MASK) | ||
1710 | /*! @} */ | ||
1711 | |||
1712 | /*! @name CTCR - Count Control Register. The CTCR selects between Timer and Counter mode, and in Counter mode selects the signal and edge(s) for counting. */ | ||
1713 | /*! @{ */ | ||
1714 | #define CTIMER_CTCR_CTMODE_MASK (0x3U) | ||
1715 | #define CTIMER_CTCR_CTMODE_SHIFT (0U) | ||
1716 | /*! CTMODE - Counter/Timer Mode This field selects which rising APB bus clock edges can increment | ||
1717 | * Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC). Timer Mode: the TC | ||
1718 | * is incremented when the Prescale Counter matches the Prescale Register. | ||
1719 | * 0b00..Timer Mode. Incremented every rising APB bus clock edge. | ||
1720 | * 0b01..Counter Mode rising edge. TC is incremented on rising edges on the CAP input selected by bits 3:2. | ||
1721 | * 0b10..Counter Mode falling edge. TC is incremented on falling edges on the CAP input selected by bits 3:2. | ||
1722 | * 0b11..Counter Mode dual edge. TC is incremented on both edges on the CAP input selected by bits 3:2. | ||
1723 | */ | ||
1724 | #define CTIMER_CTCR_CTMODE(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CTCR_CTMODE_SHIFT)) & CTIMER_CTCR_CTMODE_MASK) | ||
1725 | #define CTIMER_CTCR_CINSEL_MASK (0xCU) | ||
1726 | #define CTIMER_CTCR_CINSEL_SHIFT (2U) | ||
1727 | /*! CINSEL - Count Input Select When bits 1:0 in this register are not 00, these bits select which | ||
1728 | * CAP pin is sampled for clocking. Note: If Counter mode is selected for a particular CAPn input | ||
1729 | * in the CTCR, the 3 bits for that input in the Capture Control Register (CCR) must be | ||
1730 | * programmed as 000. However, capture and/or interrupt can be selected for the other 3 CAPn inputs in the | ||
1731 | * same timer. | ||
1732 | * 0b00..Channel 0. CAPn.0 for CTIMERn | ||
1733 | * 0b01..Channel 1. CAPn.1 for CTIMERn | ||
1734 | * 0b10..Channel 2. CAPn.2 for CTIMERn | ||
1735 | * 0b11..Channel 3. CAPn.3 for CTIMERn | ||
1736 | */ | ||
1737 | #define CTIMER_CTCR_CINSEL(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CTCR_CINSEL_SHIFT)) & CTIMER_CTCR_CINSEL_MASK) | ||
1738 | #define CTIMER_CTCR_ENCC_MASK (0x10U) | ||
1739 | #define CTIMER_CTCR_ENCC_SHIFT (4U) | ||
1740 | /*! ENCC - Setting this bit to 1 enables clearing of the timer and the prescaler when the | ||
1741 | * capture-edge event specified in bits 7:5 occurs. | ||
1742 | */ | ||
1743 | #define CTIMER_CTCR_ENCC(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CTCR_ENCC_SHIFT)) & CTIMER_CTCR_ENCC_MASK) | ||
1744 | #define CTIMER_CTCR_SELCC_MASK (0xE0U) | ||
1745 | #define CTIMER_CTCR_SELCC_SHIFT (5U) | ||
1746 | /*! SELCC - Edge select. When bit 4 is 1, these bits select which capture input edge will cause the | ||
1747 | * timer and prescaler to be cleared. These bits have no effect when bit 4 is low. Values 0x2 to | ||
1748 | * 0x3 and 0x6 to 0x7 are reserved. | ||
1749 | * 0b000..Channel 0 Rising Edge. Rising edge of the signal on capture channel 0 clears the timer (if bit 4 is set). | ||
1750 | * 0b001..Channel 0 Falling Edge. Falling edge of the signal on capture channel 0 clears the timer (if bit 4 is set). | ||
1751 | * 0b010..Channel 1 Rising Edge. Rising edge of the signal on capture channel 1 clears the timer (if bit 4 is set). | ||
1752 | * 0b011..Channel 1 Falling Edge. Falling edge of the signal on capture channel 1 clears the timer (if bit 4 is set). | ||
1753 | * 0b100..Channel 2 Rising Edge. Rising edge of the signal on capture channel 2 clears the timer (if bit 4 is set). | ||
1754 | * 0b101..Channel 2 Falling Edge. Falling edge of the signal on capture channel 2 clears the timer (if bit 4 is set). | ||
1755 | */ | ||
1756 | #define CTIMER_CTCR_SELCC(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_CTCR_SELCC_SHIFT)) & CTIMER_CTCR_SELCC_MASK) | ||
1757 | /*! @} */ | ||
1758 | |||
1759 | /*! @name PWMC - PWM Control Register. The PWMCON enables PWM mode for the external match pins. */ | ||
1760 | /*! @{ */ | ||
1761 | #define CTIMER_PWMC_PWMEN0_MASK (0x1U) | ||
1762 | #define CTIMER_PWMC_PWMEN0_SHIFT (0U) | ||
1763 | /*! PWMEN0 - PWM mode enable for channel0. | ||
1764 | * 0b0..Match. CTIMERn_MAT0 is controlled by EM0. | ||
1765 | * 0b1..PWM. PWM mode is enabled for CTIMERn_MAT0. | ||
1766 | */ | ||
1767 | #define CTIMER_PWMC_PWMEN0(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_PWMC_PWMEN0_SHIFT)) & CTIMER_PWMC_PWMEN0_MASK) | ||
1768 | #define CTIMER_PWMC_PWMEN1_MASK (0x2U) | ||
1769 | #define CTIMER_PWMC_PWMEN1_SHIFT (1U) | ||
1770 | /*! PWMEN1 - PWM mode enable for channel1. | ||
1771 | * 0b0..Match. CTIMERn_MAT01 is controlled by EM1. | ||
1772 | * 0b1..PWM. PWM mode is enabled for CTIMERn_MAT1. | ||
1773 | */ | ||
1774 | #define CTIMER_PWMC_PWMEN1(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_PWMC_PWMEN1_SHIFT)) & CTIMER_PWMC_PWMEN1_MASK) | ||
1775 | #define CTIMER_PWMC_PWMEN2_MASK (0x4U) | ||
1776 | #define CTIMER_PWMC_PWMEN2_SHIFT (2U) | ||
1777 | /*! PWMEN2 - PWM mode enable for channel2. | ||
1778 | * 0b0..Match. CTIMERn_MAT2 is controlled by EM2. | ||
1779 | * 0b1..PWM. PWM mode is enabled for CTIMERn_MAT2. | ||
1780 | */ | ||
1781 | #define CTIMER_PWMC_PWMEN2(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_PWMC_PWMEN2_SHIFT)) & CTIMER_PWMC_PWMEN2_MASK) | ||
1782 | #define CTIMER_PWMC_PWMEN3_MASK (0x8U) | ||
1783 | #define CTIMER_PWMC_PWMEN3_SHIFT (3U) | ||
1784 | /*! PWMEN3 - PWM mode enable for channel3. Note: It is recommended to use match channel 3 to set the PWM cycle. | ||
1785 | * 0b0..Match. CTIMERn_MAT3 is controlled by EM3. | ||
1786 | * 0b1..PWM. PWM mode is enabled for CT132Bn_MAT3. | ||
1787 | */ | ||
1788 | #define CTIMER_PWMC_PWMEN3(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_PWMC_PWMEN3_SHIFT)) & CTIMER_PWMC_PWMEN3_MASK) | ||
1789 | /*! @} */ | ||
1790 | |||
1791 | /*! @name MSR - Match Shadow Register */ | ||
1792 | /*! @{ */ | ||
1793 | #define CTIMER_MSR_SHADOWW_MASK (0xFFFFFFFFU) | ||
1794 | #define CTIMER_MSR_SHADOWW_SHIFT (0U) | ||
1795 | /*! SHADOWW - Timer counter match shadow value. | ||
1796 | */ | ||
1797 | #define CTIMER_MSR_SHADOWW(x) (((uint32_t)(((uint32_t)(x)) << CTIMER_MSR_SHADOWW_SHIFT)) & CTIMER_MSR_SHADOWW_MASK) | ||
1798 | /*! @} */ | ||
1799 | |||
1800 | /* The count of CTIMER_MSR */ | ||
1801 | #define CTIMER_MSR_COUNT (4U) | ||
1802 | |||
1803 | |||
1804 | /*! | ||
1805 | * @} | ||
1806 | */ /* end of group CTIMER_Register_Masks */ | ||
1807 | |||
1808 | |||
1809 | /* CTIMER - Peripheral instance base addresses */ | ||
1810 | /** Peripheral CTIMER0 base address */ | ||
1811 | #define CTIMER0_BASE (0x40008000u) | ||
1812 | /** Peripheral CTIMER0 base pointer */ | ||
1813 | #define CTIMER0 ((CTIMER_Type *)CTIMER0_BASE) | ||
1814 | /** Peripheral CTIMER1 base address */ | ||
1815 | #define CTIMER1_BASE (0x40009000u) | ||
1816 | /** Peripheral CTIMER1 base pointer */ | ||
1817 | #define CTIMER1 ((CTIMER_Type *)CTIMER1_BASE) | ||
1818 | /** Peripheral CTIMER2 base address */ | ||
1819 | #define CTIMER2_BASE (0x40028000u) | ||
1820 | /** Peripheral CTIMER2 base pointer */ | ||
1821 | #define CTIMER2 ((CTIMER_Type *)CTIMER2_BASE) | ||
1822 | /** Peripheral CTIMER3 base address */ | ||
1823 | #define CTIMER3_BASE (0x40048000u) | ||
1824 | /** Peripheral CTIMER3 base pointer */ | ||
1825 | #define CTIMER3 ((CTIMER_Type *)CTIMER3_BASE) | ||
1826 | /** Peripheral CTIMER4 base address */ | ||
1827 | #define CTIMER4_BASE (0x40049000u) | ||
1828 | /** Peripheral CTIMER4 base pointer */ | ||
1829 | #define CTIMER4 ((CTIMER_Type *)CTIMER4_BASE) | ||
1830 | /** Array initializer of CTIMER peripheral base addresses */ | ||
1831 | #define CTIMER_BASE_ADDRS { CTIMER0_BASE, CTIMER1_BASE, CTIMER2_BASE, CTIMER3_BASE, CTIMER4_BASE } | ||
1832 | /** Array initializer of CTIMER peripheral base pointers */ | ||
1833 | #define CTIMER_BASE_PTRS { CTIMER0, CTIMER1, CTIMER2, CTIMER3, CTIMER4 } | ||
1834 | /** Interrupt vectors for the CTIMER peripheral type */ | ||
1835 | #define CTIMER_IRQS { CTIMER0_IRQn, CTIMER1_IRQn, CTIMER2_IRQn, CTIMER3_IRQn, CTIMER4_IRQn } | ||
1836 | |||
1837 | /*! | ||
1838 | * @} | ||
1839 | */ /* end of group CTIMER_Peripheral_Access_Layer */ | ||
1840 | |||
1841 | |||
1842 | /* ---------------------------------------------------------------------------- | ||
1843 | -- DMA Peripheral Access Layer | ||
1844 | ---------------------------------------------------------------------------- */ | ||
1845 | |||
1846 | /*! | ||
1847 | * @addtogroup DMA_Peripheral_Access_Layer DMA Peripheral Access Layer | ||
1848 | * @{ | ||
1849 | */ | ||
1850 | |||
1851 | /** DMA - Register Layout Typedef */ | ||
1852 | typedef struct { | ||
1853 | __IO uint32_t CTRL; /**< DMA control., offset: 0x0 */ | ||
1854 | __I uint32_t INTSTAT; /**< Interrupt status., offset: 0x4 */ | ||
1855 | __IO uint32_t SRAMBASE; /**< SRAM address of the channel configuration table., offset: 0x8 */ | ||
1856 | uint8_t RESERVED_0[20]; | ||
1857 | struct { /* offset: 0x20, array step: 0x5C */ | ||
1858 | __IO uint32_t ENABLESET; /**< Channel Enable read and Set for all DMA channels., array offset: 0x20, array step: 0x5C */ | ||
1859 | uint8_t RESERVED_0[4]; | ||
1860 | __O uint32_t ENABLECLR; /**< Channel Enable Clear for all DMA channels., array offset: 0x28, array step: 0x5C */ | ||
1861 | uint8_t RESERVED_1[4]; | ||
1862 | __I uint32_t ACTIVE; /**< Channel Active status for all DMA channels., array offset: 0x30, array step: 0x5C */ | ||
1863 | uint8_t RESERVED_2[4]; | ||
1864 | __I uint32_t BUSY; /**< Channel Busy status for all DMA channels., array offset: 0x38, array step: 0x5C */ | ||
1865 | uint8_t RESERVED_3[4]; | ||
1866 | __IO uint32_t ERRINT; /**< Error Interrupt status for all DMA channels., array offset: 0x40, array step: 0x5C */ | ||
1867 | uint8_t RESERVED_4[4]; | ||
1868 | __IO uint32_t INTENSET; /**< Interrupt Enable read and Set for all DMA channels., array offset: 0x48, array step: 0x5C */ | ||
1869 | uint8_t RESERVED_5[4]; | ||
1870 | __O uint32_t INTENCLR; /**< Interrupt Enable Clear for all DMA channels., array offset: 0x50, array step: 0x5C */ | ||
1871 | uint8_t RESERVED_6[4]; | ||
1872 | __IO uint32_t INTA; /**< Interrupt A status for all DMA channels., array offset: 0x58, array step: 0x5C */ | ||
1873 | uint8_t RESERVED_7[4]; | ||
1874 | __IO uint32_t INTB; /**< Interrupt B status for all DMA channels., array offset: 0x60, array step: 0x5C */ | ||
1875 | uint8_t RESERVED_8[4]; | ||
1876 | __O uint32_t SETVALID; /**< Set ValidPending control bits for all DMA channels., array offset: 0x68, array step: 0x5C */ | ||
1877 | uint8_t RESERVED_9[4]; | ||
1878 | __O uint32_t SETTRIG; /**< Set Trigger control bits for all DMA channels., array offset: 0x70, array step: 0x5C */ | ||
1879 | uint8_t RESERVED_10[4]; | ||
1880 | __O uint32_t ABORT; /**< Channel Abort control for all DMA channels., array offset: 0x78, array step: 0x5C */ | ||
1881 | } COMMON[1]; | ||
1882 | uint8_t RESERVED_1[900]; | ||
1883 | struct { /* offset: 0x400, array step: 0x10 */ | ||
1884 | __IO uint32_t CFG; /**< Configuration register for DMA channel ., array offset: 0x400, array step: 0x10 */ | ||
1885 | __I uint32_t CTLSTAT; /**< Control and status register for DMA channel ., array offset: 0x404, array step: 0x10 */ | ||
1886 | __IO uint32_t XFERCFG; /**< Transfer configuration register for DMA channel ., array offset: 0x408, array step: 0x10 */ | ||
1887 | uint8_t RESERVED_0[4]; | ||
1888 | } CHANNEL[32]; | ||
1889 | } DMA_Type; | ||
1890 | |||
1891 | /* ---------------------------------------------------------------------------- | ||
1892 | -- DMA Register Masks | ||
1893 | ---------------------------------------------------------------------------- */ | ||
1894 | |||
1895 | /*! | ||
1896 | * @addtogroup DMA_Register_Masks DMA Register Masks | ||
1897 | * @{ | ||
1898 | */ | ||
1899 | |||
1900 | /*! @name CTRL - DMA control. */ | ||
1901 | /*! @{ */ | ||
1902 | #define DMA_CTRL_ENABLE_MASK (0x1U) | ||
1903 | #define DMA_CTRL_ENABLE_SHIFT (0U) | ||
1904 | /*! ENABLE - DMA controller master enable. | ||
1905 | * 0b0..Disabled. The DMA controller is disabled. This clears any triggers that were asserted at the point when | ||
1906 | * disabled, but does not prevent re-triggering when the DMA controller is re-enabled. | ||
1907 | * 0b1..Enabled. The DMA controller is enabled. | ||
1908 | */ | ||
1909 | #define DMA_CTRL_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << DMA_CTRL_ENABLE_SHIFT)) & DMA_CTRL_ENABLE_MASK) | ||
1910 | /*! @} */ | ||
1911 | |||
1912 | /*! @name INTSTAT - Interrupt status. */ | ||
1913 | /*! @{ */ | ||
1914 | #define DMA_INTSTAT_ACTIVEINT_MASK (0x2U) | ||
1915 | #define DMA_INTSTAT_ACTIVEINT_SHIFT (1U) | ||
1916 | /*! ACTIVEINT - Summarizes whether any enabled interrupts (other than error interrupts) are pending. | ||
1917 | * 0b0..Not pending. No enabled interrupts are pending. | ||
1918 | * 0b1..Pending. At least one enabled interrupt is pending. | ||
1919 | */ | ||
1920 | #define DMA_INTSTAT_ACTIVEINT(x) (((uint32_t)(((uint32_t)(x)) << DMA_INTSTAT_ACTIVEINT_SHIFT)) & DMA_INTSTAT_ACTIVEINT_MASK) | ||
1921 | #define DMA_INTSTAT_ACTIVEERRINT_MASK (0x4U) | ||
1922 | #define DMA_INTSTAT_ACTIVEERRINT_SHIFT (2U) | ||
1923 | /*! ACTIVEERRINT - Summarizes whether any error interrupts are pending. | ||
1924 | * 0b0..Not pending. No error interrupts are pending. | ||
1925 | * 0b1..Pending. At least one error interrupt is pending. | ||
1926 | */ | ||
1927 | #define DMA_INTSTAT_ACTIVEERRINT(x) (((uint32_t)(((uint32_t)(x)) << DMA_INTSTAT_ACTIVEERRINT_SHIFT)) & DMA_INTSTAT_ACTIVEERRINT_MASK) | ||
1928 | /*! @} */ | ||
1929 | |||
1930 | /*! @name SRAMBASE - SRAM address of the channel configuration table. */ | ||
1931 | /*! @{ */ | ||
1932 | #define DMA_SRAMBASE_OFFSET_MASK (0xFFFFFE00U) | ||
1933 | #define DMA_SRAMBASE_OFFSET_SHIFT (9U) | ||
1934 | /*! OFFSET - Address bits 31:9 of the beginning of the DMA descriptor table. For 18 channels, the | ||
1935 | * table must begin on a 512 byte boundary. | ||
1936 | */ | ||
1937 | #define DMA_SRAMBASE_OFFSET(x) (((uint32_t)(((uint32_t)(x)) << DMA_SRAMBASE_OFFSET_SHIFT)) & DMA_SRAMBASE_OFFSET_MASK) | ||
1938 | /*! @} */ | ||
1939 | |||
1940 | /*! @name COMMON_ENABLESET - Channel Enable read and Set for all DMA channels. */ | ||
1941 | /*! @{ */ | ||
1942 | #define DMA_COMMON_ENABLESET_ENA_MASK (0xFFFFFFFFU) | ||
1943 | #define DMA_COMMON_ENABLESET_ENA_SHIFT (0U) | ||
1944 | /*! ENA - Enable for DMA channels. Bit n enables or disables DMA channel n. The number of bits = | ||
1945 | * number of DMA channels in this device. Other bits are reserved. 0 = disabled. 1 = enabled. | ||
1946 | */ | ||
1947 | #define DMA_COMMON_ENABLESET_ENA(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_ENABLESET_ENA_SHIFT)) & DMA_COMMON_ENABLESET_ENA_MASK) | ||
1948 | /*! @} */ | ||
1949 | |||
1950 | /* The count of DMA_COMMON_ENABLESET */ | ||
1951 | #define DMA_COMMON_ENABLESET_COUNT (1U) | ||
1952 | |||
1953 | /*! @name COMMON_ENABLECLR - Channel Enable Clear for all DMA channels. */ | ||
1954 | /*! @{ */ | ||
1955 | #define DMA_COMMON_ENABLECLR_CLR_MASK (0xFFFFFFFFU) | ||
1956 | #define DMA_COMMON_ENABLECLR_CLR_SHIFT (0U) | ||
1957 | /*! CLR - Writing ones to this register clears the corresponding bits in ENABLESET0. Bit n clears | ||
1958 | * the channel enable bit n. The number of bits = number of DMA channels in this device. Other bits | ||
1959 | * are reserved. | ||
1960 | */ | ||
1961 | #define DMA_COMMON_ENABLECLR_CLR(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_ENABLECLR_CLR_SHIFT)) & DMA_COMMON_ENABLECLR_CLR_MASK) | ||
1962 | /*! @} */ | ||
1963 | |||
1964 | /* The count of DMA_COMMON_ENABLECLR */ | ||
1965 | #define DMA_COMMON_ENABLECLR_COUNT (1U) | ||
1966 | |||
1967 | /*! @name COMMON_ACTIVE - Channel Active status for all DMA channels. */ | ||
1968 | /*! @{ */ | ||
1969 | #define DMA_COMMON_ACTIVE_ACT_MASK (0xFFFFFFFFU) | ||
1970 | #define DMA_COMMON_ACTIVE_ACT_SHIFT (0U) | ||
1971 | /*! ACT - Active flag for DMA channel n. Bit n corresponds to DMA channel n. The number of bits = | ||
1972 | * number of DMA channels in this device. Other bits are reserved. 0 = not active. 1 = active. | ||
1973 | */ | ||
1974 | #define DMA_COMMON_ACTIVE_ACT(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_ACTIVE_ACT_SHIFT)) & DMA_COMMON_ACTIVE_ACT_MASK) | ||
1975 | /*! @} */ | ||
1976 | |||
1977 | /* The count of DMA_COMMON_ACTIVE */ | ||
1978 | #define DMA_COMMON_ACTIVE_COUNT (1U) | ||
1979 | |||
1980 | /*! @name COMMON_BUSY - Channel Busy status for all DMA channels. */ | ||
1981 | /*! @{ */ | ||
1982 | #define DMA_COMMON_BUSY_BSY_MASK (0xFFFFFFFFU) | ||
1983 | #define DMA_COMMON_BUSY_BSY_SHIFT (0U) | ||
1984 | /*! BSY - Busy flag for DMA channel n. Bit n corresponds to DMA channel n. The number of bits = | ||
1985 | * number of DMA channels in this device. Other bits are reserved. 0 = not busy. 1 = busy. | ||
1986 | */ | ||
1987 | #define DMA_COMMON_BUSY_BSY(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_BUSY_BSY_SHIFT)) & DMA_COMMON_BUSY_BSY_MASK) | ||
1988 | /*! @} */ | ||
1989 | |||
1990 | /* The count of DMA_COMMON_BUSY */ | ||
1991 | #define DMA_COMMON_BUSY_COUNT (1U) | ||
1992 | |||
1993 | /*! @name COMMON_ERRINT - Error Interrupt status for all DMA channels. */ | ||
1994 | /*! @{ */ | ||
1995 | #define DMA_COMMON_ERRINT_ERR_MASK (0xFFFFFFFFU) | ||
1996 | #define DMA_COMMON_ERRINT_ERR_SHIFT (0U) | ||
1997 | /*! ERR - Error Interrupt flag for DMA channel n. Bit n corresponds to DMA channel n. The number of | ||
1998 | * bits = number of DMA channels in this device. Other bits are reserved. 0 = error interrupt is | ||
1999 | * not active. 1 = error interrupt is active. | ||
2000 | */ | ||
2001 | #define DMA_COMMON_ERRINT_ERR(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_ERRINT_ERR_SHIFT)) & DMA_COMMON_ERRINT_ERR_MASK) | ||
2002 | /*! @} */ | ||
2003 | |||
2004 | /* The count of DMA_COMMON_ERRINT */ | ||
2005 | #define DMA_COMMON_ERRINT_COUNT (1U) | ||
2006 | |||
2007 | /*! @name COMMON_INTENSET - Interrupt Enable read and Set for all DMA channels. */ | ||
2008 | /*! @{ */ | ||
2009 | #define DMA_COMMON_INTENSET_INTEN_MASK (0xFFFFFFFFU) | ||
2010 | #define DMA_COMMON_INTENSET_INTEN_SHIFT (0U) | ||
2011 | /*! INTEN - Interrupt Enable read and set for DMA channel n. Bit n corresponds to DMA channel n. The | ||
2012 | * number of bits = number of DMA channels in this device. Other bits are reserved. 0 = | ||
2013 | * interrupt for DMA channel is disabled. 1 = interrupt for DMA channel is enabled. | ||
2014 | */ | ||
2015 | #define DMA_COMMON_INTENSET_INTEN(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_INTENSET_INTEN_SHIFT)) & DMA_COMMON_INTENSET_INTEN_MASK) | ||
2016 | /*! @} */ | ||
2017 | |||
2018 | /* The count of DMA_COMMON_INTENSET */ | ||
2019 | #define DMA_COMMON_INTENSET_COUNT (1U) | ||
2020 | |||
2021 | /*! @name COMMON_INTENCLR - Interrupt Enable Clear for all DMA channels. */ | ||
2022 | /*! @{ */ | ||
2023 | #define DMA_COMMON_INTENCLR_CLR_MASK (0xFFFFFFFFU) | ||
2024 | #define DMA_COMMON_INTENCLR_CLR_SHIFT (0U) | ||
2025 | /*! CLR - Writing ones to this register clears corresponding bits in the INTENSET0. Bit n | ||
2026 | * corresponds to DMA channel n. The number of bits = number of DMA channels in this device. Other bits are | ||
2027 | * reserved. | ||
2028 | */ | ||
2029 | #define DMA_COMMON_INTENCLR_CLR(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_INTENCLR_CLR_SHIFT)) & DMA_COMMON_INTENCLR_CLR_MASK) | ||
2030 | /*! @} */ | ||
2031 | |||
2032 | /* The count of DMA_COMMON_INTENCLR */ | ||
2033 | #define DMA_COMMON_INTENCLR_COUNT (1U) | ||
2034 | |||
2035 | /*! @name COMMON_INTA - Interrupt A status for all DMA channels. */ | ||
2036 | /*! @{ */ | ||
2037 | #define DMA_COMMON_INTA_IA_MASK (0xFFFFFFFFU) | ||
2038 | #define DMA_COMMON_INTA_IA_SHIFT (0U) | ||
2039 | /*! IA - Interrupt A status for DMA channel n. Bit n corresponds to DMA channel n. The number of | ||
2040 | * bits = number of DMA channels in this device. Other bits are reserved. 0 = the DMA channel | ||
2041 | * interrupt A is not active. 1 = the DMA channel interrupt A is active. | ||
2042 | */ | ||
2043 | #define DMA_COMMON_INTA_IA(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_INTA_IA_SHIFT)) & DMA_COMMON_INTA_IA_MASK) | ||
2044 | /*! @} */ | ||
2045 | |||
2046 | /* The count of DMA_COMMON_INTA */ | ||
2047 | #define DMA_COMMON_INTA_COUNT (1U) | ||
2048 | |||
2049 | /*! @name COMMON_INTB - Interrupt B status for all DMA channels. */ | ||
2050 | /*! @{ */ | ||
2051 | #define DMA_COMMON_INTB_IB_MASK (0xFFFFFFFFU) | ||
2052 | #define DMA_COMMON_INTB_IB_SHIFT (0U) | ||
2053 | /*! IB - Interrupt B status for DMA channel n. Bit n corresponds to DMA channel n. The number of | ||
2054 | * bits = number of DMA channels in this device. Other bits are reserved. 0 = the DMA channel | ||
2055 | * interrupt B is not active. 1 = the DMA channel interrupt B is active. | ||
2056 | */ | ||
2057 | #define DMA_COMMON_INTB_IB(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_INTB_IB_SHIFT)) & DMA_COMMON_INTB_IB_MASK) | ||
2058 | /*! @} */ | ||
2059 | |||
2060 | /* The count of DMA_COMMON_INTB */ | ||
2061 | #define DMA_COMMON_INTB_COUNT (1U) | ||
2062 | |||
2063 | /*! @name COMMON_SETVALID - Set ValidPending control bits for all DMA channels. */ | ||
2064 | /*! @{ */ | ||
2065 | #define DMA_COMMON_SETVALID_SV_MASK (0xFFFFFFFFU) | ||
2066 | #define DMA_COMMON_SETVALID_SV_SHIFT (0U) | ||
2067 | /*! SV - SETVALID control for DMA channel n. Bit n corresponds to DMA channel n. The number of bits | ||
2068 | * = number of DMA channels in this device. Other bits are reserved. 0 = no effect. 1 = sets the | ||
2069 | * VALIDPENDING control bit for DMA channel n | ||
2070 | */ | ||
2071 | #define DMA_COMMON_SETVALID_SV(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_SETVALID_SV_SHIFT)) & DMA_COMMON_SETVALID_SV_MASK) | ||
2072 | /*! @} */ | ||
2073 | |||
2074 | /* The count of DMA_COMMON_SETVALID */ | ||
2075 | #define DMA_COMMON_SETVALID_COUNT (1U) | ||
2076 | |||
2077 | /*! @name COMMON_SETTRIG - Set Trigger control bits for all DMA channels. */ | ||
2078 | /*! @{ */ | ||
2079 | #define DMA_COMMON_SETTRIG_TRIG_MASK (0xFFFFFFFFU) | ||
2080 | #define DMA_COMMON_SETTRIG_TRIG_SHIFT (0U) | ||
2081 | /*! TRIG - Set Trigger control bit for DMA channel 0. Bit n corresponds to DMA channel n. The number | ||
2082 | * of bits = number of DMA channels in this device. Other bits are reserved. 0 = no effect. 1 = | ||
2083 | * sets the TRIG bit for DMA channel n. | ||
2084 | */ | ||
2085 | #define DMA_COMMON_SETTRIG_TRIG(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_SETTRIG_TRIG_SHIFT)) & DMA_COMMON_SETTRIG_TRIG_MASK) | ||
2086 | /*! @} */ | ||
2087 | |||
2088 | /* The count of DMA_COMMON_SETTRIG */ | ||
2089 | #define DMA_COMMON_SETTRIG_COUNT (1U) | ||
2090 | |||
2091 | /*! @name COMMON_ABORT - Channel Abort control for all DMA channels. */ | ||
2092 | /*! @{ */ | ||
2093 | #define DMA_COMMON_ABORT_ABORTCTRL_MASK (0xFFFFFFFFU) | ||
2094 | #define DMA_COMMON_ABORT_ABORTCTRL_SHIFT (0U) | ||
2095 | /*! ABORTCTRL - Abort control for DMA channel 0. Bit n corresponds to DMA channel n. 0 = no effect. | ||
2096 | * 1 = aborts DMA operations on channel n. | ||
2097 | */ | ||
2098 | #define DMA_COMMON_ABORT_ABORTCTRL(x) (((uint32_t)(((uint32_t)(x)) << DMA_COMMON_ABORT_ABORTCTRL_SHIFT)) & DMA_COMMON_ABORT_ABORTCTRL_MASK) | ||
2099 | /*! @} */ | ||
2100 | |||
2101 | /* The count of DMA_COMMON_ABORT */ | ||
2102 | #define DMA_COMMON_ABORT_COUNT (1U) | ||
2103 | |||
2104 | /*! @name CHANNEL_CFG - Configuration register for DMA channel . */ | ||
2105 | /*! @{ */ | ||
2106 | #define DMA_CHANNEL_CFG_PERIPHREQEN_MASK (0x1U) | ||
2107 | #define DMA_CHANNEL_CFG_PERIPHREQEN_SHIFT (0U) | ||
2108 | /*! PERIPHREQEN - Peripheral request Enable. If a DMA channel is used to perform a memory-to-memory | ||
2109 | * move, any peripheral DMA request associated with that channel can be disabled to prevent any | ||
2110 | * interaction between the peripheral and the DMA controller. | ||
2111 | * 0b0..Disabled. Peripheral DMA requests are disabled. | ||
2112 | * 0b1..Enabled. Peripheral DMA requests are enabled. | ||
2113 | */ | ||
2114 | #define DMA_CHANNEL_CFG_PERIPHREQEN(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_PERIPHREQEN_SHIFT)) & DMA_CHANNEL_CFG_PERIPHREQEN_MASK) | ||
2115 | #define DMA_CHANNEL_CFG_HWTRIGEN_MASK (0x2U) | ||
2116 | #define DMA_CHANNEL_CFG_HWTRIGEN_SHIFT (1U) | ||
2117 | /*! HWTRIGEN - Hardware Triggering Enable for this channel. | ||
2118 | * 0b0..Disabled. Hardware triggering is not used. | ||
2119 | * 0b1..Enabled. Use hardware triggering. | ||
2120 | */ | ||
2121 | #define DMA_CHANNEL_CFG_HWTRIGEN(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_HWTRIGEN_SHIFT)) & DMA_CHANNEL_CFG_HWTRIGEN_MASK) | ||
2122 | #define DMA_CHANNEL_CFG_TRIGPOL_MASK (0x10U) | ||
2123 | #define DMA_CHANNEL_CFG_TRIGPOL_SHIFT (4U) | ||
2124 | /*! TRIGPOL - Trigger Polarity. Selects the polarity of a hardware trigger for this channel. | ||
2125 | * 0b0..Active low - falling edge. Hardware trigger is active low or falling edge triggered, based on TRIGTYPE. | ||
2126 | * 0b1..Active high - rising edge. Hardware trigger is active high or rising edge triggered, based on TRIGTYPE. | ||
2127 | */ | ||
2128 | #define DMA_CHANNEL_CFG_TRIGPOL(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_TRIGPOL_SHIFT)) & DMA_CHANNEL_CFG_TRIGPOL_MASK) | ||
2129 | #define DMA_CHANNEL_CFG_TRIGTYPE_MASK (0x20U) | ||
2130 | #define DMA_CHANNEL_CFG_TRIGTYPE_SHIFT (5U) | ||
2131 | /*! TRIGTYPE - Trigger Type. Selects hardware trigger as edge triggered or level triggered. | ||
2132 | * 0b0..Edge. Hardware trigger is edge triggered. Transfers will be initiated and completed, as specified for a single trigger. | ||
2133 | * 0b1..Level. Hardware trigger is level triggered. Note that when level triggering without burst (BURSTPOWER = | ||
2134 | * 0) is selected, only hardware triggers should be used on that channel. Transfers continue as long as the | ||
2135 | * trigger level is asserted. Once the trigger is de-asserted, the transfer will be paused until the trigger | ||
2136 | * is, again, asserted. However, the transfer will not be paused until any remaining transfers within the | ||
2137 | * current BURSTPOWER length are completed. | ||
2138 | */ | ||
2139 | #define DMA_CHANNEL_CFG_TRIGTYPE(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_TRIGTYPE_SHIFT)) & DMA_CHANNEL_CFG_TRIGTYPE_MASK) | ||
2140 | #define DMA_CHANNEL_CFG_TRIGBURST_MASK (0x40U) | ||
2141 | #define DMA_CHANNEL_CFG_TRIGBURST_SHIFT (6U) | ||
2142 | /*! TRIGBURST - Trigger Burst. Selects whether hardware triggers cause a single or burst transfer. | ||
2143 | * 0b0..Single transfer. Hardware trigger causes a single transfer. | ||
2144 | * 0b1..Burst transfer. When the trigger for this channel is set to edge triggered, a hardware trigger causes a | ||
2145 | * burst transfer, as defined by BURSTPOWER. When the trigger for this channel is set to level triggered, a | ||
2146 | * hardware trigger causes transfers to continue as long as the trigger is asserted, unless the transfer is | ||
2147 | * complete. | ||
2148 | */ | ||
2149 | #define DMA_CHANNEL_CFG_TRIGBURST(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_TRIGBURST_SHIFT)) & DMA_CHANNEL_CFG_TRIGBURST_MASK) | ||
2150 | #define DMA_CHANNEL_CFG_BURSTPOWER_MASK (0xF00U) | ||
2151 | #define DMA_CHANNEL_CFG_BURSTPOWER_SHIFT (8U) | ||
2152 | /*! BURSTPOWER - Burst Power is used in two ways. It always selects the address wrap size when | ||
2153 | * SRCBURSTWRAP and/or DSTBURSTWRAP modes are selected (see descriptions elsewhere in this register). | ||
2154 | * When the TRIGBURST field elsewhere in this register = 1, Burst Power selects how many | ||
2155 | * transfers are performed for each DMA trigger. This can be used, for example, with peripherals that | ||
2156 | * contain a FIFO that can initiate a DMA operation when the FIFO reaches a certain level. 0000: | ||
2157 | * Burst size = 1 (20). 0001: Burst size = 2 (21). 0010: Burst size = 4 (22). 1010: Burst size = | ||
2158 | * 1024 (210). This corresponds to the maximum supported transfer count. others: not supported. The | ||
2159 | * total transfer length as defined in the XFERCOUNT bits in the XFERCFG register must be an even | ||
2160 | * multiple of the burst size. | ||
2161 | */ | ||
2162 | #define DMA_CHANNEL_CFG_BURSTPOWER(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_BURSTPOWER_SHIFT)) & DMA_CHANNEL_CFG_BURSTPOWER_MASK) | ||
2163 | #define DMA_CHANNEL_CFG_SRCBURSTWRAP_MASK (0x4000U) | ||
2164 | #define DMA_CHANNEL_CFG_SRCBURSTWRAP_SHIFT (14U) | ||
2165 | /*! SRCBURSTWRAP - Source Burst Wrap. When enabled, the source data address for the DMA is | ||
2166 | * 'wrapped', meaning that the source address range for each burst will be the same. As an example, this | ||
2167 | * could be used to read several sequential registers from a peripheral for each DMA burst, | ||
2168 | * reading the same registers again for each burst. | ||
2169 | * 0b0..Disabled. Source burst wrapping is not enabled for this DMA channel. | ||
2170 | * 0b1..Enabled. Source burst wrapping is enabled for this DMA channel. | ||
2171 | */ | ||
2172 | #define DMA_CHANNEL_CFG_SRCBURSTWRAP(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_SRCBURSTWRAP_SHIFT)) & DMA_CHANNEL_CFG_SRCBURSTWRAP_MASK) | ||
2173 | #define DMA_CHANNEL_CFG_DSTBURSTWRAP_MASK (0x8000U) | ||
2174 | #define DMA_CHANNEL_CFG_DSTBURSTWRAP_SHIFT (15U) | ||
2175 | /*! DSTBURSTWRAP - Destination Burst Wrap. When enabled, the destination data address for the DMA is | ||
2176 | * 'wrapped', meaning that the destination address range for each burst will be the same. As an | ||
2177 | * example, this could be used to write several sequential registers to a peripheral for each DMA | ||
2178 | * burst, writing the same registers again for each burst. | ||
2179 | * 0b0..Disabled. Destination burst wrapping is not enabled for this DMA channel. | ||
2180 | * 0b1..Enabled. Destination burst wrapping is enabled for this DMA channel. | ||
2181 | */ | ||
2182 | #define DMA_CHANNEL_CFG_DSTBURSTWRAP(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_DSTBURSTWRAP_SHIFT)) & DMA_CHANNEL_CFG_DSTBURSTWRAP_MASK) | ||
2183 | #define DMA_CHANNEL_CFG_CHPRIORITY_MASK (0x70000U) | ||
2184 | #define DMA_CHANNEL_CFG_CHPRIORITY_SHIFT (16U) | ||
2185 | /*! CHPRIORITY - Priority of this channel when multiple DMA requests are pending. Eight priority | ||
2186 | * levels are supported: 0x0 = highest priority. 0x7 = lowest priority. | ||
2187 | */ | ||
2188 | #define DMA_CHANNEL_CFG_CHPRIORITY(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CFG_CHPRIORITY_SHIFT)) & DMA_CHANNEL_CFG_CHPRIORITY_MASK) | ||
2189 | /*! @} */ | ||
2190 | |||
2191 | /* The count of DMA_CHANNEL_CFG */ | ||
2192 | #define DMA_CHANNEL_CFG_COUNT (32U) | ||
2193 | |||
2194 | /*! @name CHANNEL_CTLSTAT - Control and status register for DMA channel . */ | ||
2195 | /*! @{ */ | ||
2196 | #define DMA_CHANNEL_CTLSTAT_VALIDPENDING_MASK (0x1U) | ||
2197 | #define DMA_CHANNEL_CTLSTAT_VALIDPENDING_SHIFT (0U) | ||
2198 | /*! VALIDPENDING - Valid pending flag for this channel. This bit is set when a 1 is written to the | ||
2199 | * corresponding bit in the related SETVALID register when CFGVALID = 1 for the same channel. | ||
2200 | * 0b0..No effect. No effect on DMA operation. | ||
2201 | * 0b1..Valid pending. | ||
2202 | */ | ||
2203 | #define DMA_CHANNEL_CTLSTAT_VALIDPENDING(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CTLSTAT_VALIDPENDING_SHIFT)) & DMA_CHANNEL_CTLSTAT_VALIDPENDING_MASK) | ||
2204 | #define DMA_CHANNEL_CTLSTAT_TRIG_MASK (0x4U) | ||
2205 | #define DMA_CHANNEL_CTLSTAT_TRIG_SHIFT (2U) | ||
2206 | /*! TRIG - Trigger flag. Indicates that the trigger for this channel is currently set. This bit is | ||
2207 | * cleared at the end of an entire transfer or upon reload when CLRTRIG = 1. | ||
2208 | * 0b0..Not triggered. The trigger for this DMA channel is not set. DMA operations will not be carried out. | ||
2209 | * 0b1..Triggered. The trigger for this DMA channel is set. DMA operations will be carried out. | ||
2210 | */ | ||
2211 | #define DMA_CHANNEL_CTLSTAT_TRIG(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_CTLSTAT_TRIG_SHIFT)) & DMA_CHANNEL_CTLSTAT_TRIG_MASK) | ||
2212 | /*! @} */ | ||
2213 | |||
2214 | /* The count of DMA_CHANNEL_CTLSTAT */ | ||
2215 | #define DMA_CHANNEL_CTLSTAT_COUNT (32U) | ||
2216 | |||
2217 | /*! @name CHANNEL_XFERCFG - Transfer configuration register for DMA channel . */ | ||
2218 | /*! @{ */ | ||
2219 | #define DMA_CHANNEL_XFERCFG_CFGVALID_MASK (0x1U) | ||
2220 | #define DMA_CHANNEL_XFERCFG_CFGVALID_SHIFT (0U) | ||
2221 | /*! CFGVALID - Configuration Valid flag. This bit indicates whether the current channel descriptor | ||
2222 | * is valid and can potentially be acted upon, if all other activation criteria are fulfilled. | ||
2223 | * 0b0..Not valid. The channel descriptor is not considered valid until validated by an associated SETVALID0 setting. | ||
2224 | * 0b1..Valid. The current channel descriptor is considered valid. | ||
2225 | */ | ||
2226 | #define DMA_CHANNEL_XFERCFG_CFGVALID(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_CFGVALID_SHIFT)) & DMA_CHANNEL_XFERCFG_CFGVALID_MASK) | ||
2227 | #define DMA_CHANNEL_XFERCFG_RELOAD_MASK (0x2U) | ||
2228 | #define DMA_CHANNEL_XFERCFG_RELOAD_SHIFT (1U) | ||
2229 | /*! RELOAD - Indicates whether the channel's control structure will be reloaded when the current | ||
2230 | * descriptor is exhausted. Reloading allows ping-pong and linked transfers. | ||
2231 | * 0b0..Disabled. Do not reload the channels' control structure when the current descriptor is exhausted. | ||
2232 | * 0b1..Enabled. Reload the channels' control structure when the current descriptor is exhausted. | ||
2233 | */ | ||
2234 | #define DMA_CHANNEL_XFERCFG_RELOAD(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_RELOAD_SHIFT)) & DMA_CHANNEL_XFERCFG_RELOAD_MASK) | ||
2235 | #define DMA_CHANNEL_XFERCFG_SWTRIG_MASK (0x4U) | ||
2236 | #define DMA_CHANNEL_XFERCFG_SWTRIG_SHIFT (2U) | ||
2237 | /*! SWTRIG - Software Trigger. | ||
2238 | * 0b0..Not set. When written by software, the trigger for this channel is not set. A new trigger, as defined by | ||
2239 | * the HWTRIGEN, TRIGPOL, and TRIGTYPE will be needed to start the channel. | ||
2240 | * 0b1..Set. When written by software, the trigger for this channel is set immediately. This feature should not | ||
2241 | * be used with level triggering when TRIGBURST = 0. | ||
2242 | */ | ||
2243 | #define DMA_CHANNEL_XFERCFG_SWTRIG(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_SWTRIG_SHIFT)) & DMA_CHANNEL_XFERCFG_SWTRIG_MASK) | ||
2244 | #define DMA_CHANNEL_XFERCFG_CLRTRIG_MASK (0x8U) | ||
2245 | #define DMA_CHANNEL_XFERCFG_CLRTRIG_SHIFT (3U) | ||
2246 | /*! CLRTRIG - Clear Trigger. | ||
2247 | * 0b0..Not cleared. The trigger is not cleared when this descriptor is exhausted. If there is a reload, the next descriptor will be started. | ||
2248 | * 0b1..Cleared. The trigger is cleared when this descriptor is exhausted | ||
2249 | */ | ||
2250 | #define DMA_CHANNEL_XFERCFG_CLRTRIG(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_CLRTRIG_SHIFT)) & DMA_CHANNEL_XFERCFG_CLRTRIG_MASK) | ||
2251 | #define DMA_CHANNEL_XFERCFG_SETINTA_MASK (0x10U) | ||
2252 | #define DMA_CHANNEL_XFERCFG_SETINTA_SHIFT (4U) | ||
2253 | /*! SETINTA - Set Interrupt flag A for this channel. There is no hardware distinction between | ||
2254 | * interrupt A and B. They can be used by software to assist with more complex descriptor usage. By | ||
2255 | * convention, interrupt A may be used when only one interrupt flag is needed. | ||
2256 | * 0b0..No effect. | ||
2257 | * 0b1..Set. The INTA flag for this channel will be set when the current descriptor is exhausted. | ||
2258 | */ | ||
2259 | #define DMA_CHANNEL_XFERCFG_SETINTA(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_SETINTA_SHIFT)) & DMA_CHANNEL_XFERCFG_SETINTA_MASK) | ||
2260 | #define DMA_CHANNEL_XFERCFG_SETINTB_MASK (0x20U) | ||
2261 | #define DMA_CHANNEL_XFERCFG_SETINTB_SHIFT (5U) | ||
2262 | /*! SETINTB - Set Interrupt flag B for this channel. There is no hardware distinction between | ||
2263 | * interrupt A and B. They can be used by software to assist with more complex descriptor usage. By | ||
2264 | * convention, interrupt A may be used when only one interrupt flag is needed. | ||
2265 | * 0b0..No effect. | ||
2266 | * 0b1..Set. The INTB flag for this channel will be set when the current descriptor is exhausted. | ||
2267 | */ | ||
2268 | #define DMA_CHANNEL_XFERCFG_SETINTB(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_SETINTB_SHIFT)) & DMA_CHANNEL_XFERCFG_SETINTB_MASK) | ||
2269 | #define DMA_CHANNEL_XFERCFG_WIDTH_MASK (0x300U) | ||
2270 | #define DMA_CHANNEL_XFERCFG_WIDTH_SHIFT (8U) | ||
2271 | /*! WIDTH - Transfer width used for this DMA channel. | ||
2272 | * 0b00..8-bit. 8-bit transfers are performed (8-bit source reads and destination writes). | ||
2273 | * 0b01..16-bit. 6-bit transfers are performed (16-bit source reads and destination writes). | ||
2274 | * 0b10..32-bit. 32-bit transfers are performed (32-bit source reads and destination writes). | ||
2275 | * 0b11..Reserved. Reserved setting, do not use. | ||
2276 | */ | ||
2277 | #define DMA_CHANNEL_XFERCFG_WIDTH(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_WIDTH_SHIFT)) & DMA_CHANNEL_XFERCFG_WIDTH_MASK) | ||
2278 | #define DMA_CHANNEL_XFERCFG_SRCINC_MASK (0x3000U) | ||
2279 | #define DMA_CHANNEL_XFERCFG_SRCINC_SHIFT (12U) | ||
2280 | /*! SRCINC - Determines whether the source address is incremented for each DMA transfer. | ||
2281 | * 0b00..No increment. The source address is not incremented for each transfer. This is the usual case when the source is a peripheral device. | ||
2282 | * 0b01..1 x width. The source address is incremented by the amount specified by Width for each transfer. This is | ||
2283 | * the usual case when the source is memory. | ||
2284 | * 0b10..2 x width. The source address is incremented by 2 times the amount specified by Width for each transfer. | ||
2285 | * 0b11..4 x width. The source address is incremented by 4 times the amount specified by Width for each transfer. | ||
2286 | */ | ||
2287 | #define DMA_CHANNEL_XFERCFG_SRCINC(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_SRCINC_SHIFT)) & DMA_CHANNEL_XFERCFG_SRCINC_MASK) | ||
2288 | #define DMA_CHANNEL_XFERCFG_DSTINC_MASK (0xC000U) | ||
2289 | #define DMA_CHANNEL_XFERCFG_DSTINC_SHIFT (14U) | ||
2290 | /*! DSTINC - Determines whether the destination address is incremented for each DMA transfer. | ||
2291 | * 0b00..No increment. The destination address is not incremented for each transfer. This is the usual case when | ||
2292 | * the destination is a peripheral device. | ||
2293 | * 0b01..1 x width. The destination address is incremented by the amount specified by Width for each transfer. | ||
2294 | * This is the usual case when the destination is memory. | ||
2295 | * 0b10..2 x width. The destination address is incremented by 2 times the amount specified by Width for each transfer. | ||
2296 | * 0b11..4 x width. The destination address is incremented by 4 times the amount specified by Width for each transfer. | ||
2297 | */ | ||
2298 | #define DMA_CHANNEL_XFERCFG_DSTINC(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_DSTINC_SHIFT)) & DMA_CHANNEL_XFERCFG_DSTINC_MASK) | ||
2299 | #define DMA_CHANNEL_XFERCFG_XFERCOUNT_MASK (0x3FF0000U) | ||
2300 | #define DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT (16U) | ||
2301 | /*! XFERCOUNT - Total number of transfers to be performed, minus 1 encoded. The number of bytes | ||
2302 | * transferred is: (XFERCOUNT + 1) x data width (as defined by the WIDTH field). The DMA controller | ||
2303 | * uses this bit field during transfer to count down. Hence, it cannot be used by software to read | ||
2304 | * back the size of the transfer, for instance, in an interrupt handler. 0x0 = a total of 1 | ||
2305 | * transfer will be performed. 0x1 = a total of 2 transfers will be performed. 0x3FF = a total of | ||
2306 | * 1,024 transfers will be performed. | ||
2307 | */ | ||
2308 | #define DMA_CHANNEL_XFERCFG_XFERCOUNT(x) (((uint32_t)(((uint32_t)(x)) << DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT)) & DMA_CHANNEL_XFERCFG_XFERCOUNT_MASK) | ||
2309 | /*! @} */ | ||
2310 | |||
2311 | /* The count of DMA_CHANNEL_XFERCFG */ | ||
2312 | #define DMA_CHANNEL_XFERCFG_COUNT (32U) | ||
2313 | |||
2314 | |||
2315 | /*! | ||
2316 | * @} | ||
2317 | */ /* end of group DMA_Register_Masks */ | ||
2318 | |||
2319 | |||
2320 | /* DMA - Peripheral instance base addresses */ | ||
2321 | /** Peripheral DMA0 base address */ | ||
2322 | #define DMA0_BASE (0x40082000u) | ||
2323 | /** Peripheral DMA0 base pointer */ | ||
2324 | #define DMA0 ((DMA_Type *)DMA0_BASE) | ||
2325 | /** Array initializer of DMA peripheral base addresses */ | ||
2326 | #define DMA_BASE_ADDRS { DMA0_BASE } | ||
2327 | /** Array initializer of DMA peripheral base pointers */ | ||
2328 | #define DMA_BASE_PTRS { DMA0 } | ||
2329 | /** Interrupt vectors for the DMA peripheral type */ | ||
2330 | #define DMA_IRQS { DMA0_IRQn } | ||
2331 | |||
2332 | /*! | ||
2333 | * @} | ||
2334 | */ /* end of group DMA_Peripheral_Access_Layer */ | ||
2335 | |||
2336 | |||
2337 | /* ---------------------------------------------------------------------------- | ||
2338 | -- DMIC Peripheral Access Layer | ||
2339 | ---------------------------------------------------------------------------- */ | ||
2340 | |||
2341 | /*! | ||
2342 | * @addtogroup DMIC_Peripheral_Access_Layer DMIC Peripheral Access Layer | ||
2343 | * @{ | ||
2344 | */ | ||
2345 | |||
2346 | /** DMIC - Register Layout Typedef */ | ||
2347 | typedef struct { | ||
2348 | struct { /* offset: 0x0, array step: 0x100 */ | ||
2349 | __IO uint32_t OSR; /**< Oversample Rate register 0, array offset: 0x0, array step: 0x100 */ | ||
2350 | __IO uint32_t DIVHFCLK; /**< DMIC Clock Register 0, array offset: 0x4, array step: 0x100 */ | ||
2351 | __IO uint32_t PREAC2FSCOEF; /**< Pre-Emphasis Filter Coefficient for 2 FS register, array offset: 0x8, array step: 0x100 */ | ||
2352 | __IO uint32_t PREAC4FSCOEF; /**< Pre-Emphasis Filter Coefficient for 4 FS register, array offset: 0xC, array step: 0x100 */ | ||
2353 | __IO uint32_t GAINSHIFT; /**< Decimator Gain Shift register, array offset: 0x10, array step: 0x100 */ | ||
2354 | uint8_t RESERVED_0[108]; | ||
2355 | __IO uint32_t FIFO_CTRL; /**< FIFO Control register 0, array offset: 0x80, array step: 0x100 */ | ||
2356 | __IO uint32_t FIFO_STATUS; /**< FIFO Status register 0, array offset: 0x84, array step: 0x100 */ | ||
2357 | __IO uint32_t FIFO_DATA; /**< FIFO Data Register 0, array offset: 0x88, array step: 0x100 */ | ||
2358 | __IO uint32_t PHY_CTRL; /**< PDM Source Configuration register 0, array offset: 0x8C, array step: 0x100 */ | ||
2359 | __IO uint32_t DC_CTRL; /**< DC Control register 0, array offset: 0x90, array step: 0x100 */ | ||
2360 | uint8_t RESERVED_1[108]; | ||
2361 | } CHANNEL[2]; | ||
2362 | uint8_t RESERVED_0[3328]; | ||
2363 | __IO uint32_t CHANEN; /**< Channel Enable register, offset: 0xF00 */ | ||
2364 | uint8_t RESERVED_1[8]; | ||
2365 | __IO uint32_t IOCFG; /**< I/O Configuration register, offset: 0xF0C */ | ||
2366 | __IO uint32_t USE2FS; /**< Use 2FS register, offset: 0xF10 */ | ||
2367 | uint8_t RESERVED_2[108]; | ||
2368 | __IO uint32_t HWVADGAIN; /**< HWVAD input gain register, offset: 0xF80 */ | ||
2369 | __IO uint32_t HWVADHPFS; /**< HWVAD filter control register, offset: 0xF84 */ | ||
2370 | __IO uint32_t HWVADST10; /**< HWVAD control register, offset: 0xF88 */ | ||
2371 | __IO uint32_t HWVADRSTT; /**< HWVAD filter reset register, offset: 0xF8C */ | ||
2372 | __IO uint32_t HWVADTHGN; /**< HWVAD noise estimator gain register, offset: 0xF90 */ | ||
2373 | __IO uint32_t HWVADTHGS; /**< HWVAD signal estimator gain register, offset: 0xF94 */ | ||
2374 | __I uint32_t HWVADLOWZ; /**< HWVAD noise envelope estimator register, offset: 0xF98 */ | ||
2375 | uint8_t RESERVED_3[96]; | ||
2376 | __I uint32_t ID; /**< Module Identification register, offset: 0xFFC */ | ||
2377 | } DMIC_Type; | ||
2378 | |||
2379 | /* ---------------------------------------------------------------------------- | ||
2380 | -- DMIC Register Masks | ||
2381 | ---------------------------------------------------------------------------- */ | ||
2382 | |||
2383 | /*! | ||
2384 | * @addtogroup DMIC_Register_Masks DMIC Register Masks | ||
2385 | * @{ | ||
2386 | */ | ||
2387 | |||
2388 | /*! @name CHANNEL_OSR - Oversample Rate register 0 */ | ||
2389 | /*! @{ */ | ||
2390 | #define DMIC_CHANNEL_OSR_OSR_MASK (0xFFU) | ||
2391 | #define DMIC_CHANNEL_OSR_OSR_SHIFT (0U) | ||
2392 | /*! OSR - Selects the oversample rate for the related input channel. | ||
2393 | */ | ||
2394 | #define DMIC_CHANNEL_OSR_OSR(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_OSR_OSR_SHIFT)) & DMIC_CHANNEL_OSR_OSR_MASK) | ||
2395 | /*! @} */ | ||
2396 | |||
2397 | /* The count of DMIC_CHANNEL_OSR */ | ||
2398 | #define DMIC_CHANNEL_OSR_COUNT (2U) | ||
2399 | |||
2400 | /*! @name CHANNEL_DIVHFCLK - DMIC Clock Register 0 */ | ||
2401 | /*! @{ */ | ||
2402 | #define DMIC_CHANNEL_DIVHFCLK_PDMDIV_MASK (0xFU) | ||
2403 | #define DMIC_CHANNEL_DIVHFCLK_PDMDIV_SHIFT (0U) | ||
2404 | /*! PDMDIV - PDM clock divider value. 0 = divide by 1 1 = divide by 2 2 = divide by 3 3 = divide by | ||
2405 | * 4 4 = divide by 6 5 = divide by 8 6 = divide by 12 7 = divide by 16 8 = divide by 24 9 = | ||
2406 | * divide by 32 10 = divide by 48 11 = divide by 64 12 = divide by 96 13 = divide by 128 others = | ||
2407 | * reserved. | ||
2408 | */ | ||
2409 | #define DMIC_CHANNEL_DIVHFCLK_PDMDIV(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_DIVHFCLK_PDMDIV_SHIFT)) & DMIC_CHANNEL_DIVHFCLK_PDMDIV_MASK) | ||
2410 | /*! @} */ | ||
2411 | |||
2412 | /* The count of DMIC_CHANNEL_DIVHFCLK */ | ||
2413 | #define DMIC_CHANNEL_DIVHFCLK_COUNT (2U) | ||
2414 | |||
2415 | /*! @name CHANNEL_PREAC2FSCOEF - Pre-Emphasis Filter Coefficient for 2 FS register */ | ||
2416 | /*! @{ */ | ||
2417 | #define DMIC_CHANNEL_PREAC2FSCOEF_COMP_MASK (0x3U) | ||
2418 | #define DMIC_CHANNEL_PREAC2FSCOEF_COMP_SHIFT (0U) | ||
2419 | /*! COMP - Pre-emphasis filer coefficient for 2 FS mode. 0 = Compensation = 0 1 = Compensation = 16 | ||
2420 | * 2 = Compensation = 15 3 = Compensation = 13 | ||
2421 | */ | ||
2422 | #define DMIC_CHANNEL_PREAC2FSCOEF_COMP(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_PREAC2FSCOEF_COMP_SHIFT)) & DMIC_CHANNEL_PREAC2FSCOEF_COMP_MASK) | ||
2423 | /*! @} */ | ||
2424 | |||
2425 | /* The count of DMIC_CHANNEL_PREAC2FSCOEF */ | ||
2426 | #define DMIC_CHANNEL_PREAC2FSCOEF_COUNT (2U) | ||
2427 | |||
2428 | /*! @name CHANNEL_PREAC4FSCOEF - Pre-Emphasis Filter Coefficient for 4 FS register */ | ||
2429 | /*! @{ */ | ||
2430 | #define DMIC_CHANNEL_PREAC4FSCOEF_COMP_MASK (0x3U) | ||
2431 | #define DMIC_CHANNEL_PREAC4FSCOEF_COMP_SHIFT (0U) | ||
2432 | /*! COMP - Pre-emphasis filer coefficient for 4 FS mode. 0 = Compensation = 0 1 = Compensation = 16 | ||
2433 | * 2 = Compensation = 15 3 = Compensation = 13 | ||
2434 | */ | ||
2435 | #define DMIC_CHANNEL_PREAC4FSCOEF_COMP(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_PREAC4FSCOEF_COMP_SHIFT)) & DMIC_CHANNEL_PREAC4FSCOEF_COMP_MASK) | ||
2436 | /*! @} */ | ||
2437 | |||
2438 | /* The count of DMIC_CHANNEL_PREAC4FSCOEF */ | ||
2439 | #define DMIC_CHANNEL_PREAC4FSCOEF_COUNT (2U) | ||
2440 | |||
2441 | /*! @name CHANNEL_GAINSHIFT - Decimator Gain Shift register */ | ||
2442 | /*! @{ */ | ||
2443 | #define DMIC_CHANNEL_GAINSHIFT_GAIN_MASK (0x3FU) | ||
2444 | #define DMIC_CHANNEL_GAINSHIFT_GAIN_SHIFT (0U) | ||
2445 | /*! GAIN - Gain control, as a positive or negative (two's complement) number of bits to shift. | ||
2446 | */ | ||
2447 | #define DMIC_CHANNEL_GAINSHIFT_GAIN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_GAINSHIFT_GAIN_SHIFT)) & DMIC_CHANNEL_GAINSHIFT_GAIN_MASK) | ||
2448 | /*! @} */ | ||
2449 | |||
2450 | /* The count of DMIC_CHANNEL_GAINSHIFT */ | ||
2451 | #define DMIC_CHANNEL_GAINSHIFT_COUNT (2U) | ||
2452 | |||
2453 | /*! @name CHANNEL_FIFO_CTRL - FIFO Control register 0 */ | ||
2454 | /*! @{ */ | ||
2455 | #define DMIC_CHANNEL_FIFO_CTRL_ENABLE_MASK (0x1U) | ||
2456 | #define DMIC_CHANNEL_FIFO_CTRL_ENABLE_SHIFT (0U) | ||
2457 | /*! ENABLE - FIFO enable. | ||
2458 | * 0b0..FIFO is not enabled. Enabling a DMIC channel with the FIFO disabled could be useful while data is being | ||
2459 | * streamed to the I2S, or in order to avoid a filter settling delay when a channel is re-enabled after a | ||
2460 | * period when the data was not needed. | ||
2461 | * 0b1..FIFO is enabled. The FIFO must be enabled in order for the CPU or DMA to read data from the DMIC via the FIFODATA register. | ||
2462 | */ | ||
2463 | #define DMIC_CHANNEL_FIFO_CTRL_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_CTRL_ENABLE_SHIFT)) & DMIC_CHANNEL_FIFO_CTRL_ENABLE_MASK) | ||
2464 | #define DMIC_CHANNEL_FIFO_CTRL_RESETN_MASK (0x2U) | ||
2465 | #define DMIC_CHANNEL_FIFO_CTRL_RESETN_SHIFT (1U) | ||
2466 | /*! RESETN - FIFO reset. | ||
2467 | * 0b0..Reset the FIFO. | ||
2468 | * 0b1..Normal operation | ||
2469 | */ | ||
2470 | #define DMIC_CHANNEL_FIFO_CTRL_RESETN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_CTRL_RESETN_SHIFT)) & DMIC_CHANNEL_FIFO_CTRL_RESETN_MASK) | ||
2471 | #define DMIC_CHANNEL_FIFO_CTRL_INTEN_MASK (0x4U) | ||
2472 | #define DMIC_CHANNEL_FIFO_CTRL_INTEN_SHIFT (2U) | ||
2473 | /*! INTEN - Interrupt enable. | ||
2474 | * 0b0..FIFO level interrupts are not enabled. | ||
2475 | * 0b1..FIFO level interrupts are enabled. | ||
2476 | */ | ||
2477 | #define DMIC_CHANNEL_FIFO_CTRL_INTEN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_CTRL_INTEN_SHIFT)) & DMIC_CHANNEL_FIFO_CTRL_INTEN_MASK) | ||
2478 | #define DMIC_CHANNEL_FIFO_CTRL_DMAEN_MASK (0x8U) | ||
2479 | #define DMIC_CHANNEL_FIFO_CTRL_DMAEN_SHIFT (3U) | ||
2480 | /*! DMAEN - DMA enable | ||
2481 | * 0b0..DMA requests are not enabled. | ||
2482 | * 0b1..DMA requests based on FIFO level are enabled. | ||
2483 | */ | ||
2484 | #define DMIC_CHANNEL_FIFO_CTRL_DMAEN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_CTRL_DMAEN_SHIFT)) & DMIC_CHANNEL_FIFO_CTRL_DMAEN_MASK) | ||
2485 | #define DMIC_CHANNEL_FIFO_CTRL_TRIGLVL_MASK (0x1F0000U) | ||
2486 | #define DMIC_CHANNEL_FIFO_CTRL_TRIGLVL_SHIFT (16U) | ||
2487 | /*! TRIGLVL - FIFO trigger level. Selects the data trigger level for interrupt or DMA operation. If | ||
2488 | * enabled to do so, the FIFO level can wake up the device just enough to perform DMA, then | ||
2489 | * return to the reduced power mode See Section 4.5.66 'Hardware Wake-up control register'. 0 = | ||
2490 | * trigger when the FIFO has received one entry (is no longer empty). 1 = trigger when the FIFO has | ||
2491 | * received two entries. 15 = trigger when the FIFO has received 16 entries (has become full). | ||
2492 | */ | ||
2493 | #define DMIC_CHANNEL_FIFO_CTRL_TRIGLVL(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_CTRL_TRIGLVL_SHIFT)) & DMIC_CHANNEL_FIFO_CTRL_TRIGLVL_MASK) | ||
2494 | /*! @} */ | ||
2495 | |||
2496 | /* The count of DMIC_CHANNEL_FIFO_CTRL */ | ||
2497 | #define DMIC_CHANNEL_FIFO_CTRL_COUNT (2U) | ||
2498 | |||
2499 | /*! @name CHANNEL_FIFO_STATUS - FIFO Status register 0 */ | ||
2500 | /*! @{ */ | ||
2501 | #define DMIC_CHANNEL_FIFO_STATUS_INT_MASK (0x1U) | ||
2502 | #define DMIC_CHANNEL_FIFO_STATUS_INT_SHIFT (0U) | ||
2503 | /*! INT - Interrupt flag. Asserted when FIFO data reaches the level specified in the FIFOCTRL | ||
2504 | * register. Writing a one to this bit clears the flag. Remark: note that the bus clock to the DMIC | ||
2505 | * subsystem must be running in order for an interrupt to occur. | ||
2506 | */ | ||
2507 | #define DMIC_CHANNEL_FIFO_STATUS_INT(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_STATUS_INT_SHIFT)) & DMIC_CHANNEL_FIFO_STATUS_INT_MASK) | ||
2508 | #define DMIC_CHANNEL_FIFO_STATUS_OVERRUN_MASK (0x2U) | ||
2509 | #define DMIC_CHANNEL_FIFO_STATUS_OVERRUN_SHIFT (1U) | ||
2510 | /*! OVERRUN - Overrun flag. Indicates that a FIFO overflow has occurred at some point. Writing a one | ||
2511 | * to this bit clears the flag. This flag does not cause an interrupt. | ||
2512 | */ | ||
2513 | #define DMIC_CHANNEL_FIFO_STATUS_OVERRUN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_STATUS_OVERRUN_SHIFT)) & DMIC_CHANNEL_FIFO_STATUS_OVERRUN_MASK) | ||
2514 | #define DMIC_CHANNEL_FIFO_STATUS_UNDERRUN_MASK (0x4U) | ||
2515 | #define DMIC_CHANNEL_FIFO_STATUS_UNDERRUN_SHIFT (2U) | ||
2516 | /*! UNDERRUN - Underrun flag. Indicates that a FIFO underflow has occurred at some point. Writing a one to this bit clears the flag. | ||
2517 | */ | ||
2518 | #define DMIC_CHANNEL_FIFO_STATUS_UNDERRUN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_STATUS_UNDERRUN_SHIFT)) & DMIC_CHANNEL_FIFO_STATUS_UNDERRUN_MASK) | ||
2519 | /*! @} */ | ||
2520 | |||
2521 | /* The count of DMIC_CHANNEL_FIFO_STATUS */ | ||
2522 | #define DMIC_CHANNEL_FIFO_STATUS_COUNT (2U) | ||
2523 | |||
2524 | /*! @name CHANNEL_FIFO_DATA - FIFO Data Register 0 */ | ||
2525 | /*! @{ */ | ||
2526 | #define DMIC_CHANNEL_FIFO_DATA_DATA_MASK (0xFFFFFFU) | ||
2527 | #define DMIC_CHANNEL_FIFO_DATA_DATA_SHIFT (0U) | ||
2528 | /*! DATA - Data from the top of the input filter FIFO. | ||
2529 | */ | ||
2530 | #define DMIC_CHANNEL_FIFO_DATA_DATA(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_FIFO_DATA_DATA_SHIFT)) & DMIC_CHANNEL_FIFO_DATA_DATA_MASK) | ||
2531 | /*! @} */ | ||
2532 | |||
2533 | /* The count of DMIC_CHANNEL_FIFO_DATA */ | ||
2534 | #define DMIC_CHANNEL_FIFO_DATA_COUNT (2U) | ||
2535 | |||
2536 | /*! @name CHANNEL_PHY_CTRL - PDM Source Configuration register 0 */ | ||
2537 | /*! @{ */ | ||
2538 | #define DMIC_CHANNEL_PHY_CTRL_PHY_FALL_MASK (0x1U) | ||
2539 | #define DMIC_CHANNEL_PHY_CTRL_PHY_FALL_SHIFT (0U) | ||
2540 | /*! PHY_FALL - Capture PDM_DATA | ||
2541 | * 0b0..Capture PDM_DATA on the rising edge of PDM_CLK. | ||
2542 | * 0b1..Capture PDM_DATA on the falling edge of PDM_CLK. | ||
2543 | */ | ||
2544 | #define DMIC_CHANNEL_PHY_CTRL_PHY_FALL(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_PHY_CTRL_PHY_FALL_SHIFT)) & DMIC_CHANNEL_PHY_CTRL_PHY_FALL_MASK) | ||
2545 | #define DMIC_CHANNEL_PHY_CTRL_PHY_HALF_MASK (0x2U) | ||
2546 | #define DMIC_CHANNEL_PHY_CTRL_PHY_HALF_SHIFT (1U) | ||
2547 | /*! PHY_HALF - Half rate sampling | ||
2548 | * 0b0..Standard half rate sampling. The clock to the DMIC is sent at the same rate as the decimator is providing. | ||
2549 | * 0b1..Use half rate sampling. The clock to the DMIC is sent at half the rate as the decimator is providing. | ||
2550 | */ | ||
2551 | #define DMIC_CHANNEL_PHY_CTRL_PHY_HALF(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_PHY_CTRL_PHY_HALF_SHIFT)) & DMIC_CHANNEL_PHY_CTRL_PHY_HALF_MASK) | ||
2552 | /*! @} */ | ||
2553 | |||
2554 | /* The count of DMIC_CHANNEL_PHY_CTRL */ | ||
2555 | #define DMIC_CHANNEL_PHY_CTRL_COUNT (2U) | ||
2556 | |||
2557 | /*! @name CHANNEL_DC_CTRL - DC Control register 0 */ | ||
2558 | /*! @{ */ | ||
2559 | #define DMIC_CHANNEL_DC_CTRL_DCPOLE_MASK (0x3U) | ||
2560 | #define DMIC_CHANNEL_DC_CTRL_DCPOLE_SHIFT (0U) | ||
2561 | /*! DCPOLE - DC block filter | ||
2562 | * 0b00..Flat response, no filter. | ||
2563 | * 0b01..155 Hz. | ||
2564 | * 0b10..78 Hz. | ||
2565 | * 0b11..39 Hz | ||
2566 | */ | ||
2567 | #define DMIC_CHANNEL_DC_CTRL_DCPOLE(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_DC_CTRL_DCPOLE_SHIFT)) & DMIC_CHANNEL_DC_CTRL_DCPOLE_MASK) | ||
2568 | #define DMIC_CHANNEL_DC_CTRL_DCGAIN_MASK (0xF0U) | ||
2569 | #define DMIC_CHANNEL_DC_CTRL_DCGAIN_SHIFT (4U) | ||
2570 | /*! DCGAIN - Fine gain adjustment in the form of a number of bits to downshift. | ||
2571 | */ | ||
2572 | #define DMIC_CHANNEL_DC_CTRL_DCGAIN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_DC_CTRL_DCGAIN_SHIFT)) & DMIC_CHANNEL_DC_CTRL_DCGAIN_MASK) | ||
2573 | #define DMIC_CHANNEL_DC_CTRL_SATURATEAT16BIT_MASK (0x100U) | ||
2574 | #define DMIC_CHANNEL_DC_CTRL_SATURATEAT16BIT_SHIFT (8U) | ||
2575 | /*! SATURATEAT16BIT - Selects 16-bit saturation. | ||
2576 | * 0b0..Results roll over if out range and do not saturate. | ||
2577 | * 0b1..If the result overflows, it saturates at 0xFFFF for positive overflow and 0x8000 for negative overflow. | ||
2578 | */ | ||
2579 | #define DMIC_CHANNEL_DC_CTRL_SATURATEAT16BIT(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANNEL_DC_CTRL_SATURATEAT16BIT_SHIFT)) & DMIC_CHANNEL_DC_CTRL_SATURATEAT16BIT_MASK) | ||
2580 | /*! @} */ | ||
2581 | |||
2582 | /* The count of DMIC_CHANNEL_DC_CTRL */ | ||
2583 | #define DMIC_CHANNEL_DC_CTRL_COUNT (2U) | ||
2584 | |||
2585 | /*! @name CHANEN - Channel Enable register */ | ||
2586 | /*! @{ */ | ||
2587 | #define DMIC_CHANEN_EN_CH0_MASK (0x1U) | ||
2588 | #define DMIC_CHANEN_EN_CH0_SHIFT (0U) | ||
2589 | /*! EN_CH0 - Enable channel 0. When 1, PDM channel 0 is enabled. | ||
2590 | */ | ||
2591 | #define DMIC_CHANEN_EN_CH0(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANEN_EN_CH0_SHIFT)) & DMIC_CHANEN_EN_CH0_MASK) | ||
2592 | #define DMIC_CHANEN_EN_CH1_MASK (0x2U) | ||
2593 | #define DMIC_CHANEN_EN_CH1_SHIFT (1U) | ||
2594 | /*! EN_CH1 - Enable channel 1. When 1, PDM channel 1 is enabled. | ||
2595 | */ | ||
2596 | #define DMIC_CHANEN_EN_CH1(x) (((uint32_t)(((uint32_t)(x)) << DMIC_CHANEN_EN_CH1_SHIFT)) & DMIC_CHANEN_EN_CH1_MASK) | ||
2597 | /*! @} */ | ||
2598 | |||
2599 | /*! @name IOCFG - I/O Configuration register */ | ||
2600 | /*! @{ */ | ||
2601 | #define DMIC_IOCFG_CLK_BYPASS0_MASK (0x1U) | ||
2602 | #define DMIC_IOCFG_CLK_BYPASS0_SHIFT (0U) | ||
2603 | /*! CLK_BYPASS0 - Bypass CLK0. When 1, PDM_DATA1 becomes the clock for PDM channel 0. This provides | ||
2604 | * for the possibility of an external codec taking over the PDM bus. | ||
2605 | */ | ||
2606 | #define DMIC_IOCFG_CLK_BYPASS0(x) (((uint32_t)(((uint32_t)(x)) << DMIC_IOCFG_CLK_BYPASS0_SHIFT)) & DMIC_IOCFG_CLK_BYPASS0_MASK) | ||
2607 | #define DMIC_IOCFG_CLK_BYPASS1_MASK (0x2U) | ||
2608 | #define DMIC_IOCFG_CLK_BYPASS1_SHIFT (1U) | ||
2609 | /*! CLK_BYPASS1 - Bypass CLK1. When 1, PDM_DATA1 becomes the clock for PDM channel 1. This provides | ||
2610 | * for the possibility of an external codec taking over the PDM bus. | ||
2611 | */ | ||
2612 | #define DMIC_IOCFG_CLK_BYPASS1(x) (((uint32_t)(((uint32_t)(x)) << DMIC_IOCFG_CLK_BYPASS1_SHIFT)) & DMIC_IOCFG_CLK_BYPASS1_MASK) | ||
2613 | #define DMIC_IOCFG_STEREO_DATA0_MASK (0x4U) | ||
2614 | #define DMIC_IOCFG_STEREO_DATA0_SHIFT (2U) | ||
2615 | /*! STEREO_DATA0 - Stereo PDM select. When 1, PDM_DATA0 is routed to both PDM channels in a | ||
2616 | * configuration that supports a single stereo digital microphone. | ||
2617 | */ | ||
2618 | #define DMIC_IOCFG_STEREO_DATA0(x) (((uint32_t)(((uint32_t)(x)) << DMIC_IOCFG_STEREO_DATA0_SHIFT)) & DMIC_IOCFG_STEREO_DATA0_MASK) | ||
2619 | /*! @} */ | ||
2620 | |||
2621 | /*! @name USE2FS - Use 2FS register */ | ||
2622 | /*! @{ */ | ||
2623 | #define DMIC_USE2FS_USE2FS_MASK (0x1U) | ||
2624 | #define DMIC_USE2FS_USE2FS_SHIFT (0U) | ||
2625 | /*! USE2FS - Use 2FS register | ||
2626 | * 0b0..Use 1FS output for PCM data. | ||
2627 | * 0b1..Use 2FS output for PCM data. | ||
2628 | */ | ||
2629 | #define DMIC_USE2FS_USE2FS(x) (((uint32_t)(((uint32_t)(x)) << DMIC_USE2FS_USE2FS_SHIFT)) & DMIC_USE2FS_USE2FS_MASK) | ||
2630 | /*! @} */ | ||
2631 | |||
2632 | /*! @name HWVADGAIN - HWVAD input gain register */ | ||
2633 | /*! @{ */ | ||
2634 | #define DMIC_HWVADGAIN_INPUTGAIN_MASK (0xFU) | ||
2635 | #define DMIC_HWVADGAIN_INPUTGAIN_SHIFT (0U) | ||
2636 | /*! INPUTGAIN - Shift value for input bits 0x00 -10 bits 0x01 -8 bits 0x02 -6 bits 0x03 -4 bits 0x04 | ||
2637 | * -2 bits 0x05 0 bits (default) 0x06 +2 bits 0x07 +4 bits 0x08 +6 bits 0x09 +8 bits 0x0A +10 | ||
2638 | * bits 0x0B +12 bits 0x0C +14 bits 0x0D to 0x0F Reserved. | ||
2639 | */ | ||
2640 | #define DMIC_HWVADGAIN_INPUTGAIN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_HWVADGAIN_INPUTGAIN_SHIFT)) & DMIC_HWVADGAIN_INPUTGAIN_MASK) | ||
2641 | /*! @} */ | ||
2642 | |||
2643 | /*! @name HWVADHPFS - HWVAD filter control register */ | ||
2644 | /*! @{ */ | ||
2645 | #define DMIC_HWVADHPFS_HPFS_MASK (0x3U) | ||
2646 | #define DMIC_HWVADHPFS_HPFS_SHIFT (0U) | ||
2647 | /*! HPFS - High pass filter | ||
2648 | * 0b00..First filter by-pass. | ||
2649 | * 0b01..High pass filter with -3dB cut-off at 1750Hz. | ||
2650 | * 0b10..High pass filter with -3dB cut-off at 215Hz. | ||
2651 | * 0b11..Reserved. | ||
2652 | */ | ||
2653 | #define DMIC_HWVADHPFS_HPFS(x) (((uint32_t)(((uint32_t)(x)) << DMIC_HWVADHPFS_HPFS_SHIFT)) & DMIC_HWVADHPFS_HPFS_MASK) | ||
2654 | /*! @} */ | ||
2655 | |||
2656 | /*! @name HWVADST10 - HWVAD control register */ | ||
2657 | /*! @{ */ | ||
2658 | #define DMIC_HWVADST10_ST10_MASK (0x1U) | ||
2659 | #define DMIC_HWVADST10_ST10_SHIFT (0U) | ||
2660 | /*! ST10 - Stage 0 | ||
2661 | * 0b0..Normal operation, waiting for HWVAD trigger event (stage 0). | ||
2662 | * 0b1..Reset internal interrupt flag by writing a '1' pulse. | ||
2663 | */ | ||
2664 | #define DMIC_HWVADST10_ST10(x) (((uint32_t)(((uint32_t)(x)) << DMIC_HWVADST10_ST10_SHIFT)) & DMIC_HWVADST10_ST10_MASK) | ||
2665 | /*! @} */ | ||
2666 | |||
2667 | /*! @name HWVADRSTT - HWVAD filter reset register */ | ||
2668 | /*! @{ */ | ||
2669 | #define DMIC_HWVADRSTT_RSTT_MASK (0x1U) | ||
2670 | #define DMIC_HWVADRSTT_RSTT_SHIFT (0U) | ||
2671 | /*! RSTT - Writing a 1 resets all filter values | ||
2672 | */ | ||
2673 | #define DMIC_HWVADRSTT_RSTT(x) (((uint32_t)(((uint32_t)(x)) << DMIC_HWVADRSTT_RSTT_SHIFT)) & DMIC_HWVADRSTT_RSTT_MASK) | ||
2674 | /*! @} */ | ||
2675 | |||
2676 | /*! @name HWVADTHGN - HWVAD noise estimator gain register */ | ||
2677 | /*! @{ */ | ||
2678 | #define DMIC_HWVADTHGN_THGN_MASK (0xFU) | ||
2679 | #define DMIC_HWVADTHGN_THGN_SHIFT (0U) | ||
2680 | /*! THGN - Gain value for the noise estimator. Values 0 to 14. 0 corresponds to a gain of 1. | ||
2681 | */ | ||
2682 | #define DMIC_HWVADTHGN_THGN(x) (((uint32_t)(((uint32_t)(x)) << DMIC_HWVADTHGN_THGN_SHIFT)) & DMIC_HWVADTHGN_THGN_MASK) | ||
2683 | /*! @} */ | ||
2684 | |||
2685 | /*! @name HWVADTHGS - HWVAD signal estimator gain register */ | ||
2686 | /*! @{ */ | ||
2687 | #define DMIC_HWVADTHGS_THGS_MASK (0xFU) | ||
2688 | #define DMIC_HWVADTHGS_THGS_SHIFT (0U) | ||
2689 | /*! THGS - Gain value for the signal estimator. Values 0 to 14. 0 corresponds to a gain of 1. | ||
2690 | */ | ||
2691 | #define DMIC_HWVADTHGS_THGS(x) (((uint32_t)(((uint32_t)(x)) << DMIC_HWVADTHGS_THGS_SHIFT)) & DMIC_HWVADTHGS_THGS_MASK) | ||
2692 | /*! @} */ | ||
2693 | |||
2694 | /*! @name HWVADLOWZ - HWVAD noise envelope estimator register */ | ||
2695 | /*! @{ */ | ||
2696 | #define DMIC_HWVADLOWZ_LOWZ_MASK (0xFFFFU) | ||
2697 | #define DMIC_HWVADLOWZ_LOWZ_SHIFT (0U) | ||
2698 | /*! LOWZ - Noise envelope estimator value. | ||
2699 | */ | ||
2700 | #define DMIC_HWVADLOWZ_LOWZ(x) (((uint32_t)(((uint32_t)(x)) << DMIC_HWVADLOWZ_LOWZ_SHIFT)) & DMIC_HWVADLOWZ_LOWZ_MASK) | ||
2701 | /*! @} */ | ||
2702 | |||
2703 | /*! @name ID - Module Identification register */ | ||
2704 | /*! @{ */ | ||
2705 | #define DMIC_ID_ID_MASK (0xFFFFFFFFU) | ||
2706 | #define DMIC_ID_ID_SHIFT (0U) | ||
2707 | /*! ID - Indicates module ID and the number of channels in this DMIC interface. | ||
2708 | */ | ||
2709 | #define DMIC_ID_ID(x) (((uint32_t)(((uint32_t)(x)) << DMIC_ID_ID_SHIFT)) & DMIC_ID_ID_MASK) | ||
2710 | /*! @} */ | ||
2711 | |||
2712 | |||
2713 | /*! | ||
2714 | * @} | ||
2715 | */ /* end of group DMIC_Register_Masks */ | ||
2716 | |||
2717 | |||
2718 | /* DMIC - Peripheral instance base addresses */ | ||
2719 | /** Peripheral DMIC0 base address */ | ||
2720 | #define DMIC0_BASE (0x40090000u) | ||
2721 | /** Peripheral DMIC0 base pointer */ | ||
2722 | #define DMIC0 ((DMIC_Type *)DMIC0_BASE) | ||
2723 | /** Array initializer of DMIC peripheral base addresses */ | ||
2724 | #define DMIC_BASE_ADDRS { DMIC0_BASE } | ||
2725 | /** Array initializer of DMIC peripheral base pointers */ | ||
2726 | #define DMIC_BASE_PTRS { DMIC0 } | ||
2727 | /** Interrupt vectors for the DMIC peripheral type */ | ||
2728 | #define DMIC_IRQS { DMIC0_IRQn } | ||
2729 | #define DMIC_HWVAD_IRQS { HWVAD0_IRQn } | ||
2730 | |||
2731 | /*! | ||
2732 | * @} | ||
2733 | */ /* end of group DMIC_Peripheral_Access_Layer */ | ||
2734 | |||
2735 | |||
2736 | /* ---------------------------------------------------------------------------- | ||
2737 | -- EMC Peripheral Access Layer | ||
2738 | ---------------------------------------------------------------------------- */ | ||
2739 | |||
2740 | /*! | ||
2741 | * @addtogroup EMC_Peripheral_Access_Layer EMC Peripheral Access Layer | ||
2742 | * @{ | ||
2743 | */ | ||
2744 | |||
2745 | /** EMC - Register Layout Typedef */ | ||
2746 | typedef struct { | ||
2747 | __IO uint32_t CONTROL; /**< Controls operation of the memory controller, offset: 0x0 */ | ||
2748 | __I uint32_t STATUS; /**< Provides EMC status information, offset: 0x4 */ | ||
2749 | __IO uint32_t CONFIG; /**< Configures operation of the memory controller, offset: 0x8 */ | ||
2750 | uint8_t RESERVED_0[20]; | ||
2751 | __IO uint32_t DYNAMICCONTROL; /**< Controls dynamic memory operation, offset: 0x20 */ | ||
2752 | __IO uint32_t DYNAMICREFRESH; /**< Configures dynamic memory refresh, offset: 0x24 */ | ||
2753 | __IO uint32_t DYNAMICREADCONFIG; /**< Configures dynamic memory read strategy, offset: 0x28 */ | ||
2754 | uint8_t RESERVED_1[4]; | ||
2755 | __IO uint32_t DYNAMICRP; /**< Precharge command period, offset: 0x30 */ | ||
2756 | __IO uint32_t DYNAMICRAS; /**< Active to precharge command period, offset: 0x34 */ | ||
2757 | __IO uint32_t DYNAMICSREX; /**< Self-refresh exit time, offset: 0x38 */ | ||
2758 | __IO uint32_t DYNAMICAPR; /**< Last-data-out to active command time, offset: 0x3C */ | ||
2759 | __IO uint32_t DYNAMICDAL; /**< Data-in to active command time, offset: 0x40 */ | ||
2760 | __IO uint32_t DYNAMICWR; /**< Write recovery time, offset: 0x44 */ | ||
2761 | __IO uint32_t DYNAMICRC; /**< Selects the active to active command period, offset: 0x48 */ | ||
2762 | __IO uint32_t DYNAMICRFC; /**< Selects the auto-refresh period, offset: 0x4C */ | ||
2763 | __IO uint32_t DYNAMICXSR; /**< Time for exit self-refresh to active command, offset: 0x50 */ | ||
2764 | __IO uint32_t DYNAMICRRD; /**< Latency for active bank A to active bank B, offset: 0x54 */ | ||
2765 | __IO uint32_t DYNAMICMRD; /**< Time for load mode register to active command, offset: 0x58 */ | ||
2766 | uint8_t RESERVED_2[36]; | ||
2767 | __IO uint32_t STATICEXTENDEDWAIT; /**< Time for long static memory read and write transfers, offset: 0x80 */ | ||
2768 | uint8_t RESERVED_3[124]; | ||
2769 | struct { /* offset: 0x100, array step: 0x20 */ | ||
2770 | __IO uint32_t DYNAMICCONFIG; /**< Configuration information for EMC_DYCSx, array offset: 0x100, array step: 0x20 */ | ||
2771 | __IO uint32_t DYNAMICRASCAS; /**< RAS and CAS latencies for EMC_DYCSx, array offset: 0x104, array step: 0x20 */ | ||
2772 | uint8_t RESERVED_0[24]; | ||
2773 | } DYNAMIC[4]; | ||
2774 | uint8_t RESERVED_4[128]; | ||
2775 | struct { /* offset: 0x200, array step: 0x20 */ | ||
2776 | __IO uint32_t STATICCONFIG; /**< Configuration for EMC_CSx, array offset: 0x200, array step: 0x20 */ | ||
2777 | __IO uint32_t STATICWAITWEN; /**< Delay from EMC_CSx to write enable, array offset: 0x204, array step: 0x20 */ | ||
2778 | __IO uint32_t STATICWAITOEN; /**< Delay from EMC_CSx or address change, whichever is later, to output enable, array offset: 0x208, array step: 0x20 */ | ||
2779 | __IO uint32_t STATICWAITRD; /**< Delay from EMC_CSx to a read access, array offset: 0x20C, array step: 0x20 */ | ||
2780 | __IO uint32_t STATICWAITPAGE; /**< Delay for asynchronous page mode sequential accesses for EMC_CSx, array offset: 0x210, array step: 0x20 */ | ||
2781 | __IO uint32_t STATICWAITWR; /**< Delay from EMC_CSx to a write access, array offset: 0x214, array step: 0x20 */ | ||
2782 | __IO uint32_t STATICWAITTURN; /**< Number of bus turnaround cycles EMC_CSx, array offset: 0x218, array step: 0x20 */ | ||
2783 | uint8_t RESERVED_0[4]; | ||
2784 | } STATIC[4]; | ||
2785 | } EMC_Type; | ||
2786 | |||
2787 | /* ---------------------------------------------------------------------------- | ||
2788 | -- EMC Register Masks | ||
2789 | ---------------------------------------------------------------------------- */ | ||
2790 | |||
2791 | /*! | ||
2792 | * @addtogroup EMC_Register_Masks EMC Register Masks | ||
2793 | * @{ | ||
2794 | */ | ||
2795 | |||
2796 | /*! @name CONTROL - Controls operation of the memory controller */ | ||
2797 | /*! @{ */ | ||
2798 | #define EMC_CONTROL_E_MASK (0x1U) | ||
2799 | #define EMC_CONTROL_E_SHIFT (0U) | ||
2800 | /*! E - EMC Enable. | ||
2801 | */ | ||
2802 | #define EMC_CONTROL_E(x) (((uint32_t)(((uint32_t)(x)) << EMC_CONTROL_E_SHIFT)) & EMC_CONTROL_E_MASK) | ||
2803 | #define EMC_CONTROL_M_MASK (0x2U) | ||
2804 | #define EMC_CONTROL_M_SHIFT (1U) | ||
2805 | /*! M - Address mirror. | ||
2806 | */ | ||
2807 | #define EMC_CONTROL_M(x) (((uint32_t)(((uint32_t)(x)) << EMC_CONTROL_M_SHIFT)) & EMC_CONTROL_M_MASK) | ||
2808 | #define EMC_CONTROL_L_MASK (0x4U) | ||
2809 | #define EMC_CONTROL_L_SHIFT (2U) | ||
2810 | /*! L - Low-power mode. | ||
2811 | */ | ||
2812 | #define EMC_CONTROL_L(x) (((uint32_t)(((uint32_t)(x)) << EMC_CONTROL_L_SHIFT)) & EMC_CONTROL_L_MASK) | ||
2813 | /*! @} */ | ||
2814 | |||
2815 | /*! @name STATUS - Provides EMC status information */ | ||
2816 | /*! @{ */ | ||
2817 | #define EMC_STATUS_B_MASK (0x1U) | ||
2818 | #define EMC_STATUS_B_SHIFT (0U) | ||
2819 | /*! B - Busy. | ||
2820 | */ | ||
2821 | #define EMC_STATUS_B(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATUS_B_SHIFT)) & EMC_STATUS_B_MASK) | ||
2822 | #define EMC_STATUS_S_MASK (0x2U) | ||
2823 | #define EMC_STATUS_S_SHIFT (1U) | ||
2824 | /*! S - Write buffer status. | ||
2825 | */ | ||
2826 | #define EMC_STATUS_S(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATUS_S_SHIFT)) & EMC_STATUS_S_MASK) | ||
2827 | #define EMC_STATUS_SA_MASK (0x4U) | ||
2828 | #define EMC_STATUS_SA_SHIFT (2U) | ||
2829 | /*! SA - Self-refresh acknowledge. | ||
2830 | */ | ||
2831 | #define EMC_STATUS_SA(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATUS_SA_SHIFT)) & EMC_STATUS_SA_MASK) | ||
2832 | /*! @} */ | ||
2833 | |||
2834 | /*! @name CONFIG - Configures operation of the memory controller */ | ||
2835 | /*! @{ */ | ||
2836 | #define EMC_CONFIG_EM_MASK (0x1U) | ||
2837 | #define EMC_CONFIG_EM_SHIFT (0U) | ||
2838 | /*! EM - Endian mode. | ||
2839 | */ | ||
2840 | #define EMC_CONFIG_EM(x) (((uint32_t)(((uint32_t)(x)) << EMC_CONFIG_EM_SHIFT)) & EMC_CONFIG_EM_MASK) | ||
2841 | #define EMC_CONFIG_CLKR_MASK (0x100U) | ||
2842 | #define EMC_CONFIG_CLKR_SHIFT (8U) | ||
2843 | /*! CLKR - This bit must contain 0 for proper operation of the EMC. | ||
2844 | */ | ||
2845 | #define EMC_CONFIG_CLKR(x) (((uint32_t)(((uint32_t)(x)) << EMC_CONFIG_CLKR_SHIFT)) & EMC_CONFIG_CLKR_MASK) | ||
2846 | /*! @} */ | ||
2847 | |||
2848 | /*! @name DYNAMICCONTROL - Controls dynamic memory operation */ | ||
2849 | /*! @{ */ | ||
2850 | #define EMC_DYNAMICCONTROL_CE_MASK (0x1U) | ||
2851 | #define EMC_DYNAMICCONTROL_CE_SHIFT (0U) | ||
2852 | /*! CE - Dynamic memory clock enable. | ||
2853 | */ | ||
2854 | #define EMC_DYNAMICCONTROL_CE(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICCONTROL_CE_SHIFT)) & EMC_DYNAMICCONTROL_CE_MASK) | ||
2855 | #define EMC_DYNAMICCONTROL_CS_MASK (0x2U) | ||
2856 | #define EMC_DYNAMICCONTROL_CS_SHIFT (1U) | ||
2857 | /*! CS - Dynamic memory clock control. | ||
2858 | */ | ||
2859 | #define EMC_DYNAMICCONTROL_CS(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICCONTROL_CS_SHIFT)) & EMC_DYNAMICCONTROL_CS_MASK) | ||
2860 | #define EMC_DYNAMICCONTROL_SR_MASK (0x4U) | ||
2861 | #define EMC_DYNAMICCONTROL_SR_SHIFT (2U) | ||
2862 | /*! SR - Self-refresh request, EMCSREFREQ. | ||
2863 | */ | ||
2864 | #define EMC_DYNAMICCONTROL_SR(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICCONTROL_SR_SHIFT)) & EMC_DYNAMICCONTROL_SR_MASK) | ||
2865 | #define EMC_DYNAMICCONTROL_MMC_MASK (0x20U) | ||
2866 | #define EMC_DYNAMICCONTROL_MMC_SHIFT (5U) | ||
2867 | /*! MMC - Memory clock control. | ||
2868 | */ | ||
2869 | #define EMC_DYNAMICCONTROL_MMC(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICCONTROL_MMC_SHIFT)) & EMC_DYNAMICCONTROL_MMC_MASK) | ||
2870 | #define EMC_DYNAMICCONTROL_I_MASK (0x180U) | ||
2871 | #define EMC_DYNAMICCONTROL_I_SHIFT (7U) | ||
2872 | /*! I - SDRAM initialization. | ||
2873 | */ | ||
2874 | #define EMC_DYNAMICCONTROL_I(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICCONTROL_I_SHIFT)) & EMC_DYNAMICCONTROL_I_MASK) | ||
2875 | /*! @} */ | ||
2876 | |||
2877 | /*! @name DYNAMICREFRESH - Configures dynamic memory refresh */ | ||
2878 | /*! @{ */ | ||
2879 | #define EMC_DYNAMICREFRESH_REFRESH_MASK (0x7FFU) | ||
2880 | #define EMC_DYNAMICREFRESH_REFRESH_SHIFT (0U) | ||
2881 | /*! REFRESH - Refresh timer. | ||
2882 | */ | ||
2883 | #define EMC_DYNAMICREFRESH_REFRESH(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICREFRESH_REFRESH_SHIFT)) & EMC_DYNAMICREFRESH_REFRESH_MASK) | ||
2884 | /*! @} */ | ||
2885 | |||
2886 | /*! @name DYNAMICREADCONFIG - Configures dynamic memory read strategy */ | ||
2887 | /*! @{ */ | ||
2888 | #define EMC_DYNAMICREADCONFIG_RD_MASK (0x3U) | ||
2889 | #define EMC_DYNAMICREADCONFIG_RD_SHIFT (0U) | ||
2890 | /*! RD - Read data strategy. | ||
2891 | */ | ||
2892 | #define EMC_DYNAMICREADCONFIG_RD(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICREADCONFIG_RD_SHIFT)) & EMC_DYNAMICREADCONFIG_RD_MASK) | ||
2893 | /*! @} */ | ||
2894 | |||
2895 | /*! @name DYNAMICRP - Precharge command period */ | ||
2896 | /*! @{ */ | ||
2897 | #define EMC_DYNAMICRP_TRP_MASK (0xFU) | ||
2898 | #define EMC_DYNAMICRP_TRP_SHIFT (0U) | ||
2899 | /*! TRP - Precharge command period. | ||
2900 | */ | ||
2901 | #define EMC_DYNAMICRP_TRP(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICRP_TRP_SHIFT)) & EMC_DYNAMICRP_TRP_MASK) | ||
2902 | /*! @} */ | ||
2903 | |||
2904 | /*! @name DYNAMICRAS - Active to precharge command period */ | ||
2905 | /*! @{ */ | ||
2906 | #define EMC_DYNAMICRAS_TRAS_MASK (0xFU) | ||
2907 | #define EMC_DYNAMICRAS_TRAS_SHIFT (0U) | ||
2908 | /*! TRAS - Active to precharge command period. | ||
2909 | */ | ||
2910 | #define EMC_DYNAMICRAS_TRAS(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICRAS_TRAS_SHIFT)) & EMC_DYNAMICRAS_TRAS_MASK) | ||
2911 | /*! @} */ | ||
2912 | |||
2913 | /*! @name DYNAMICSREX - Self-refresh exit time */ | ||
2914 | /*! @{ */ | ||
2915 | #define EMC_DYNAMICSREX_TSREX_MASK (0xFU) | ||
2916 | #define EMC_DYNAMICSREX_TSREX_SHIFT (0U) | ||
2917 | /*! TSREX - Self-refresh exit time. | ||
2918 | */ | ||
2919 | #define EMC_DYNAMICSREX_TSREX(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICSREX_TSREX_SHIFT)) & EMC_DYNAMICSREX_TSREX_MASK) | ||
2920 | /*! @} */ | ||
2921 | |||
2922 | /*! @name DYNAMICAPR - Last-data-out to active command time */ | ||
2923 | /*! @{ */ | ||
2924 | #define EMC_DYNAMICAPR_TAPR_MASK (0xFU) | ||
2925 | #define EMC_DYNAMICAPR_TAPR_SHIFT (0U) | ||
2926 | /*! TAPR - Last-data-out to active command time. | ||
2927 | */ | ||
2928 | #define EMC_DYNAMICAPR_TAPR(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICAPR_TAPR_SHIFT)) & EMC_DYNAMICAPR_TAPR_MASK) | ||
2929 | /*! @} */ | ||
2930 | |||
2931 | /*! @name DYNAMICDAL - Data-in to active command time */ | ||
2932 | /*! @{ */ | ||
2933 | #define EMC_DYNAMICDAL_TDAL_MASK (0xFU) | ||
2934 | #define EMC_DYNAMICDAL_TDAL_SHIFT (0U) | ||
2935 | /*! TDAL - Data-in to active command. | ||
2936 | */ | ||
2937 | #define EMC_DYNAMICDAL_TDAL(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICDAL_TDAL_SHIFT)) & EMC_DYNAMICDAL_TDAL_MASK) | ||
2938 | /*! @} */ | ||
2939 | |||
2940 | /*! @name DYNAMICWR - Write recovery time */ | ||
2941 | /*! @{ */ | ||
2942 | #define EMC_DYNAMICWR_TWR_MASK (0xFU) | ||
2943 | #define EMC_DYNAMICWR_TWR_SHIFT (0U) | ||
2944 | /*! TWR - Write recovery time. | ||
2945 | */ | ||
2946 | #define EMC_DYNAMICWR_TWR(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICWR_TWR_SHIFT)) & EMC_DYNAMICWR_TWR_MASK) | ||
2947 | /*! @} */ | ||
2948 | |||
2949 | /*! @name DYNAMICRC - Selects the active to active command period */ | ||
2950 | /*! @{ */ | ||
2951 | #define EMC_DYNAMICRC_TRC_MASK (0x1FU) | ||
2952 | #define EMC_DYNAMICRC_TRC_SHIFT (0U) | ||
2953 | /*! TRC - Active to active command period. | ||
2954 | */ | ||
2955 | #define EMC_DYNAMICRC_TRC(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICRC_TRC_SHIFT)) & EMC_DYNAMICRC_TRC_MASK) | ||
2956 | /*! @} */ | ||
2957 | |||
2958 | /*! @name DYNAMICRFC - Selects the auto-refresh period */ | ||
2959 | /*! @{ */ | ||
2960 | #define EMC_DYNAMICRFC_TRFC_MASK (0x1FU) | ||
2961 | #define EMC_DYNAMICRFC_TRFC_SHIFT (0U) | ||
2962 | /*! TRFC - Auto-refresh period and auto-refresh to active command period. | ||
2963 | */ | ||
2964 | #define EMC_DYNAMICRFC_TRFC(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICRFC_TRFC_SHIFT)) & EMC_DYNAMICRFC_TRFC_MASK) | ||
2965 | /*! @} */ | ||
2966 | |||
2967 | /*! @name DYNAMICXSR - Time for exit self-refresh to active command */ | ||
2968 | /*! @{ */ | ||
2969 | #define EMC_DYNAMICXSR_TXSR_MASK (0x1FU) | ||
2970 | #define EMC_DYNAMICXSR_TXSR_SHIFT (0U) | ||
2971 | /*! TXSR - Exit self-refresh to active command time. | ||
2972 | */ | ||
2973 | #define EMC_DYNAMICXSR_TXSR(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICXSR_TXSR_SHIFT)) & EMC_DYNAMICXSR_TXSR_MASK) | ||
2974 | /*! @} */ | ||
2975 | |||
2976 | /*! @name DYNAMICRRD - Latency for active bank A to active bank B */ | ||
2977 | /*! @{ */ | ||
2978 | #define EMC_DYNAMICRRD_TRRD_MASK (0xFU) | ||
2979 | #define EMC_DYNAMICRRD_TRRD_SHIFT (0U) | ||
2980 | /*! TRRD - Active bank A to active bank B latency 0x0 - 0xE = n + 1 clock cycles. | ||
2981 | */ | ||
2982 | #define EMC_DYNAMICRRD_TRRD(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICRRD_TRRD_SHIFT)) & EMC_DYNAMICRRD_TRRD_MASK) | ||
2983 | /*! @} */ | ||
2984 | |||
2985 | /*! @name DYNAMICMRD - Time for load mode register to active command */ | ||
2986 | /*! @{ */ | ||
2987 | #define EMC_DYNAMICMRD_TMRD_MASK (0xFU) | ||
2988 | #define EMC_DYNAMICMRD_TMRD_SHIFT (0U) | ||
2989 | /*! TMRD - Load mode register to active command time. | ||
2990 | */ | ||
2991 | #define EMC_DYNAMICMRD_TMRD(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMICMRD_TMRD_SHIFT)) & EMC_DYNAMICMRD_TMRD_MASK) | ||
2992 | /*! @} */ | ||
2993 | |||
2994 | /*! @name STATICEXTENDEDWAIT - Time for long static memory read and write transfers */ | ||
2995 | /*! @{ */ | ||
2996 | #define EMC_STATICEXTENDEDWAIT_EXTENDEDWAIT_MASK (0x3FFU) | ||
2997 | #define EMC_STATICEXTENDEDWAIT_EXTENDEDWAIT_SHIFT (0U) | ||
2998 | /*! EXTENDEDWAIT - Extended wait time out. | ||
2999 | */ | ||
3000 | #define EMC_STATICEXTENDEDWAIT_EXTENDEDWAIT(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATICEXTENDEDWAIT_EXTENDEDWAIT_SHIFT)) & EMC_STATICEXTENDEDWAIT_EXTENDEDWAIT_MASK) | ||
3001 | /*! @} */ | ||
3002 | |||
3003 | /*! @name DYNAMIC_DYNAMICCONFIG - Configuration information for EMC_DYCSx */ | ||
3004 | /*! @{ */ | ||
3005 | #define EMC_DYNAMIC_DYNAMICCONFIG_MD_MASK (0x18U) | ||
3006 | #define EMC_DYNAMIC_DYNAMICCONFIG_MD_SHIFT (3U) | ||
3007 | /*! MD - Memory device. | ||
3008 | */ | ||
3009 | #define EMC_DYNAMIC_DYNAMICCONFIG_MD(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMIC_DYNAMICCONFIG_MD_SHIFT)) & EMC_DYNAMIC_DYNAMICCONFIG_MD_MASK) | ||
3010 | #define EMC_DYNAMIC_DYNAMICCONFIG_AM0_MASK (0x1F80U) | ||
3011 | #define EMC_DYNAMIC_DYNAMICCONFIG_AM0_SHIFT (7U) | ||
3012 | /*! AM0 - See Table 933. | ||
3013 | */ | ||
3014 | #define EMC_DYNAMIC_DYNAMICCONFIG_AM0(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMIC_DYNAMICCONFIG_AM0_SHIFT)) & EMC_DYNAMIC_DYNAMICCONFIG_AM0_MASK) | ||
3015 | #define EMC_DYNAMIC_DYNAMICCONFIG_AM1_MASK (0x4000U) | ||
3016 | #define EMC_DYNAMIC_DYNAMICCONFIG_AM1_SHIFT (14U) | ||
3017 | /*! AM1 - See Table 933. | ||
3018 | */ | ||
3019 | #define EMC_DYNAMIC_DYNAMICCONFIG_AM1(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMIC_DYNAMICCONFIG_AM1_SHIFT)) & EMC_DYNAMIC_DYNAMICCONFIG_AM1_MASK) | ||
3020 | #define EMC_DYNAMIC_DYNAMICCONFIG_B_MASK (0x80000U) | ||
3021 | #define EMC_DYNAMIC_DYNAMICCONFIG_B_SHIFT (19U) | ||
3022 | /*! B - Buffer enable. | ||
3023 | */ | ||
3024 | #define EMC_DYNAMIC_DYNAMICCONFIG_B(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMIC_DYNAMICCONFIG_B_SHIFT)) & EMC_DYNAMIC_DYNAMICCONFIG_B_MASK) | ||
3025 | #define EMC_DYNAMIC_DYNAMICCONFIG_P_MASK (0x100000U) | ||
3026 | #define EMC_DYNAMIC_DYNAMICCONFIG_P_SHIFT (20U) | ||
3027 | /*! P - Write protect. | ||
3028 | */ | ||
3029 | #define EMC_DYNAMIC_DYNAMICCONFIG_P(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMIC_DYNAMICCONFIG_P_SHIFT)) & EMC_DYNAMIC_DYNAMICCONFIG_P_MASK) | ||
3030 | /*! @} */ | ||
3031 | |||
3032 | /* The count of EMC_DYNAMIC_DYNAMICCONFIG */ | ||
3033 | #define EMC_DYNAMIC_DYNAMICCONFIG_COUNT (4U) | ||
3034 | |||
3035 | /*! @name DYNAMIC_DYNAMICRASCAS - RAS and CAS latencies for EMC_DYCSx */ | ||
3036 | /*! @{ */ | ||
3037 | #define EMC_DYNAMIC_DYNAMICRASCAS_RAS_MASK (0x3U) | ||
3038 | #define EMC_DYNAMIC_DYNAMICRASCAS_RAS_SHIFT (0U) | ||
3039 | /*! RAS - RAS latency (active to read/write delay). | ||
3040 | */ | ||
3041 | #define EMC_DYNAMIC_DYNAMICRASCAS_RAS(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMIC_DYNAMICRASCAS_RAS_SHIFT)) & EMC_DYNAMIC_DYNAMICRASCAS_RAS_MASK) | ||
3042 | #define EMC_DYNAMIC_DYNAMICRASCAS_CAS_MASK (0x300U) | ||
3043 | #define EMC_DYNAMIC_DYNAMICRASCAS_CAS_SHIFT (8U) | ||
3044 | /*! CAS - CAS latency. | ||
3045 | */ | ||
3046 | #define EMC_DYNAMIC_DYNAMICRASCAS_CAS(x) (((uint32_t)(((uint32_t)(x)) << EMC_DYNAMIC_DYNAMICRASCAS_CAS_SHIFT)) & EMC_DYNAMIC_DYNAMICRASCAS_CAS_MASK) | ||
3047 | /*! @} */ | ||
3048 | |||
3049 | /* The count of EMC_DYNAMIC_DYNAMICRASCAS */ | ||
3050 | #define EMC_DYNAMIC_DYNAMICRASCAS_COUNT (4U) | ||
3051 | |||
3052 | /*! @name STATIC_STATICCONFIG - Configuration for EMC_CSx */ | ||
3053 | /*! @{ */ | ||
3054 | #define EMC_STATIC_STATICCONFIG_MW_MASK (0x3U) | ||
3055 | #define EMC_STATIC_STATICCONFIG_MW_SHIFT (0U) | ||
3056 | /*! MW - Memory width. | ||
3057 | */ | ||
3058 | #define EMC_STATIC_STATICCONFIG_MW(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICCONFIG_MW_SHIFT)) & EMC_STATIC_STATICCONFIG_MW_MASK) | ||
3059 | #define EMC_STATIC_STATICCONFIG_PM_MASK (0x8U) | ||
3060 | #define EMC_STATIC_STATICCONFIG_PM_SHIFT (3U) | ||
3061 | /*! PM - Page mode. | ||
3062 | */ | ||
3063 | #define EMC_STATIC_STATICCONFIG_PM(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICCONFIG_PM_SHIFT)) & EMC_STATIC_STATICCONFIG_PM_MASK) | ||
3064 | #define EMC_STATIC_STATICCONFIG_PC_MASK (0x40U) | ||
3065 | #define EMC_STATIC_STATICCONFIG_PC_SHIFT (6U) | ||
3066 | /*! PC - Chip select polarity. | ||
3067 | */ | ||
3068 | #define EMC_STATIC_STATICCONFIG_PC(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICCONFIG_PC_SHIFT)) & EMC_STATIC_STATICCONFIG_PC_MASK) | ||
3069 | #define EMC_STATIC_STATICCONFIG_PB_MASK (0x80U) | ||
3070 | #define EMC_STATIC_STATICCONFIG_PB_SHIFT (7U) | ||
3071 | /*! PB - Byte lane state. | ||
3072 | */ | ||
3073 | #define EMC_STATIC_STATICCONFIG_PB(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICCONFIG_PB_SHIFT)) & EMC_STATIC_STATICCONFIG_PB_MASK) | ||
3074 | #define EMC_STATIC_STATICCONFIG_EW_MASK (0x100U) | ||
3075 | #define EMC_STATIC_STATICCONFIG_EW_SHIFT (8U) | ||
3076 | /*! EW - Extended wait (EW) uses the EMCStaticExtendedWait register to time both the read and write | ||
3077 | * transfers rather than the EMCStaticWaitRd and EMCStaticWaitWr registers. | ||
3078 | */ | ||
3079 | #define EMC_STATIC_STATICCONFIG_EW(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICCONFIG_EW_SHIFT)) & EMC_STATIC_STATICCONFIG_EW_MASK) | ||
3080 | #define EMC_STATIC_STATICCONFIG_B_MASK (0x80000U) | ||
3081 | #define EMC_STATIC_STATICCONFIG_B_SHIFT (19U) | ||
3082 | /*! B - Buffer enable [2]. | ||
3083 | */ | ||
3084 | #define EMC_STATIC_STATICCONFIG_B(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICCONFIG_B_SHIFT)) & EMC_STATIC_STATICCONFIG_B_MASK) | ||
3085 | #define EMC_STATIC_STATICCONFIG_P_MASK (0x100000U) | ||
3086 | #define EMC_STATIC_STATICCONFIG_P_SHIFT (20U) | ||
3087 | /*! P - Write protect. | ||
3088 | */ | ||
3089 | #define EMC_STATIC_STATICCONFIG_P(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICCONFIG_P_SHIFT)) & EMC_STATIC_STATICCONFIG_P_MASK) | ||
3090 | /*! @} */ | ||
3091 | |||
3092 | /* The count of EMC_STATIC_STATICCONFIG */ | ||
3093 | #define EMC_STATIC_STATICCONFIG_COUNT (4U) | ||
3094 | |||
3095 | /*! @name STATIC_STATICWAITWEN - Delay from EMC_CSx to write enable */ | ||
3096 | /*! @{ */ | ||
3097 | #define EMC_STATIC_STATICWAITWEN_WAITWEN_MASK (0xFU) | ||
3098 | #define EMC_STATIC_STATICWAITWEN_WAITWEN_SHIFT (0U) | ||
3099 | /*! WAITWEN - Wait write enable. | ||
3100 | */ | ||
3101 | #define EMC_STATIC_STATICWAITWEN_WAITWEN(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICWAITWEN_WAITWEN_SHIFT)) & EMC_STATIC_STATICWAITWEN_WAITWEN_MASK) | ||
3102 | /*! @} */ | ||
3103 | |||
3104 | /* The count of EMC_STATIC_STATICWAITWEN */ | ||
3105 | #define EMC_STATIC_STATICWAITWEN_COUNT (4U) | ||
3106 | |||
3107 | /*! @name STATIC_STATICWAITOEN - Delay from EMC_CSx or address change, whichever is later, to output enable */ | ||
3108 | /*! @{ */ | ||
3109 | #define EMC_STATIC_STATICWAITOEN_WAITOEN_MASK (0xFU) | ||
3110 | #define EMC_STATIC_STATICWAITOEN_WAITOEN_SHIFT (0U) | ||
3111 | /*! WAITOEN - Wait output enable. | ||
3112 | */ | ||
3113 | #define EMC_STATIC_STATICWAITOEN_WAITOEN(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICWAITOEN_WAITOEN_SHIFT)) & EMC_STATIC_STATICWAITOEN_WAITOEN_MASK) | ||
3114 | /*! @} */ | ||
3115 | |||
3116 | /* The count of EMC_STATIC_STATICWAITOEN */ | ||
3117 | #define EMC_STATIC_STATICWAITOEN_COUNT (4U) | ||
3118 | |||
3119 | /*! @name STATIC_STATICWAITRD - Delay from EMC_CSx to a read access */ | ||
3120 | /*! @{ */ | ||
3121 | #define EMC_STATIC_STATICWAITRD_WAITRD_MASK (0x1FU) | ||
3122 | #define EMC_STATIC_STATICWAITRD_WAITRD_SHIFT (0U) | ||
3123 | /*! WAITRD - . | ||
3124 | */ | ||
3125 | #define EMC_STATIC_STATICWAITRD_WAITRD(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICWAITRD_WAITRD_SHIFT)) & EMC_STATIC_STATICWAITRD_WAITRD_MASK) | ||
3126 | /*! @} */ | ||
3127 | |||
3128 | /* The count of EMC_STATIC_STATICWAITRD */ | ||
3129 | #define EMC_STATIC_STATICWAITRD_COUNT (4U) | ||
3130 | |||
3131 | /*! @name STATIC_STATICWAITPAGE - Delay for asynchronous page mode sequential accesses for EMC_CSx */ | ||
3132 | /*! @{ */ | ||
3133 | #define EMC_STATIC_STATICWAITPAGE_WAITPAGE_MASK (0x1FU) | ||
3134 | #define EMC_STATIC_STATICWAITPAGE_WAITPAGE_SHIFT (0U) | ||
3135 | /*! WAITPAGE - Asynchronous page mode read after the first read wait states. | ||
3136 | */ | ||
3137 | #define EMC_STATIC_STATICWAITPAGE_WAITPAGE(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICWAITPAGE_WAITPAGE_SHIFT)) & EMC_STATIC_STATICWAITPAGE_WAITPAGE_MASK) | ||
3138 | /*! @} */ | ||
3139 | |||
3140 | /* The count of EMC_STATIC_STATICWAITPAGE */ | ||
3141 | #define EMC_STATIC_STATICWAITPAGE_COUNT (4U) | ||
3142 | |||
3143 | /*! @name STATIC_STATICWAITWR - Delay from EMC_CSx to a write access */ | ||
3144 | /*! @{ */ | ||
3145 | #define EMC_STATIC_STATICWAITWR_WAITWR_MASK (0x1FU) | ||
3146 | #define EMC_STATIC_STATICWAITWR_WAITWR_SHIFT (0U) | ||
3147 | /*! WAITWR - Write wait states. | ||
3148 | */ | ||
3149 | #define EMC_STATIC_STATICWAITWR_WAITWR(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICWAITWR_WAITWR_SHIFT)) & EMC_STATIC_STATICWAITWR_WAITWR_MASK) | ||
3150 | /*! @} */ | ||
3151 | |||
3152 | /* The count of EMC_STATIC_STATICWAITWR */ | ||
3153 | #define EMC_STATIC_STATICWAITWR_COUNT (4U) | ||
3154 | |||
3155 | /*! @name STATIC_STATICWAITTURN - Number of bus turnaround cycles EMC_CSx */ | ||
3156 | /*! @{ */ | ||
3157 | #define EMC_STATIC_STATICWAITTURN_WAITTURN_MASK (0xFU) | ||
3158 | #define EMC_STATIC_STATICWAITTURN_WAITTURN_SHIFT (0U) | ||
3159 | /*! WAITTURN - Bus turn-around cycles. | ||
3160 | */ | ||
3161 | #define EMC_STATIC_STATICWAITTURN_WAITTURN(x) (((uint32_t)(((uint32_t)(x)) << EMC_STATIC_STATICWAITTURN_WAITTURN_SHIFT)) & EMC_STATIC_STATICWAITTURN_WAITTURN_MASK) | ||
3162 | /*! @} */ | ||
3163 | |||
3164 | /* The count of EMC_STATIC_STATICWAITTURN */ | ||
3165 | #define EMC_STATIC_STATICWAITTURN_COUNT (4U) | ||
3166 | |||
3167 | |||
3168 | /*! | ||
3169 | * @} | ||
3170 | */ /* end of group EMC_Register_Masks */ | ||
3171 | |||
3172 | |||
3173 | /* EMC - Peripheral instance base addresses */ | ||
3174 | /** Peripheral EMC base address */ | ||
3175 | #define EMC_BASE (0x40081000u) | ||
3176 | /** Peripheral EMC base pointer */ | ||
3177 | #define EMC ((EMC_Type *)EMC_BASE) | ||
3178 | /** Array initializer of EMC peripheral base addresses */ | ||
3179 | #define EMC_BASE_ADDRS { EMC_BASE } | ||
3180 | /** Array initializer of EMC peripheral base pointers */ | ||
3181 | #define EMC_BASE_PTRS { EMC } | ||
3182 | |||
3183 | /*! | ||
3184 | * @} | ||
3185 | */ /* end of group EMC_Peripheral_Access_Layer */ | ||
3186 | |||
3187 | |||
3188 | /* ---------------------------------------------------------------------------- | ||
3189 | -- FLEXCOMM Peripheral Access Layer | ||
3190 | ---------------------------------------------------------------------------- */ | ||
3191 | |||
3192 | /*! | ||
3193 | * @addtogroup FLEXCOMM_Peripheral_Access_Layer FLEXCOMM Peripheral Access Layer | ||
3194 | * @{ | ||
3195 | */ | ||
3196 | |||
3197 | /** FLEXCOMM - Register Layout Typedef */ | ||
3198 | typedef struct { | ||
3199 | uint8_t RESERVED_0[4088]; | ||
3200 | __IO uint32_t PSELID; /**< Peripheral Select and Flexcomm ID register., offset: 0xFF8 */ | ||
3201 | __I uint32_t PID; /**< Peripheral identification register., offset: 0xFFC */ | ||
3202 | } FLEXCOMM_Type; | ||
3203 | |||
3204 | /* ---------------------------------------------------------------------------- | ||
3205 | -- FLEXCOMM Register Masks | ||
3206 | ---------------------------------------------------------------------------- */ | ||
3207 | |||
3208 | /*! | ||
3209 | * @addtogroup FLEXCOMM_Register_Masks FLEXCOMM Register Masks | ||
3210 | * @{ | ||
3211 | */ | ||
3212 | |||
3213 | /*! @name PSELID - Peripheral Select and Flexcomm ID register. */ | ||
3214 | /*! @{ */ | ||
3215 | #define FLEXCOMM_PSELID_PERSEL_MASK (0x7U) | ||
3216 | #define FLEXCOMM_PSELID_PERSEL_SHIFT (0U) | ||
3217 | /*! PERSEL - Peripheral Select. This field is writable by software. | ||
3218 | * 0b000..No peripheral selected. | ||
3219 | * 0b001..USART function selected. | ||
3220 | * 0b010..SPI function selected. | ||
3221 | * 0b011..I2C function selected. | ||
3222 | * 0b100..I2S transmit function selected. | ||
3223 | * 0b101..I2S receive function selected. | ||
3224 | * 0b110..Reserved | ||
3225 | * 0b111..Reserved | ||
3226 | */ | ||
3227 | #define FLEXCOMM_PSELID_PERSEL(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PSELID_PERSEL_SHIFT)) & FLEXCOMM_PSELID_PERSEL_MASK) | ||
3228 | #define FLEXCOMM_PSELID_LOCK_MASK (0x8U) | ||
3229 | #define FLEXCOMM_PSELID_LOCK_SHIFT (3U) | ||
3230 | /*! LOCK - Lock the peripheral select. This field is writable by software. | ||
3231 | * 0b0..Peripheral select can be changed by software. | ||
3232 | * 0b1..Peripheral select is locked and cannot be changed until this Flexcomm or the entire device is reset. | ||
3233 | */ | ||
3234 | #define FLEXCOMM_PSELID_LOCK(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PSELID_LOCK_SHIFT)) & FLEXCOMM_PSELID_LOCK_MASK) | ||
3235 | #define FLEXCOMM_PSELID_USARTPRESENT_MASK (0x10U) | ||
3236 | #define FLEXCOMM_PSELID_USARTPRESENT_SHIFT (4U) | ||
3237 | /*! USARTPRESENT - USART present indicator. This field is Read-only. | ||
3238 | * 0b0..This Flexcomm does not include the USART function. | ||
3239 | * 0b1..This Flexcomm includes the USART function. | ||
3240 | */ | ||
3241 | #define FLEXCOMM_PSELID_USARTPRESENT(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PSELID_USARTPRESENT_SHIFT)) & FLEXCOMM_PSELID_USARTPRESENT_MASK) | ||
3242 | #define FLEXCOMM_PSELID_SPIPRESENT_MASK (0x20U) | ||
3243 | #define FLEXCOMM_PSELID_SPIPRESENT_SHIFT (5U) | ||
3244 | /*! SPIPRESENT - SPI present indicator. This field is Read-only. | ||
3245 | * 0b0..This Flexcomm does not include the SPI function. | ||
3246 | * 0b1..This Flexcomm includes the SPI function. | ||
3247 | */ | ||
3248 | #define FLEXCOMM_PSELID_SPIPRESENT(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PSELID_SPIPRESENT_SHIFT)) & FLEXCOMM_PSELID_SPIPRESENT_MASK) | ||
3249 | #define FLEXCOMM_PSELID_I2CPRESENT_MASK (0x40U) | ||
3250 | #define FLEXCOMM_PSELID_I2CPRESENT_SHIFT (6U) | ||
3251 | /*! I2CPRESENT - I2C present indicator. This field is Read-only. | ||
3252 | * 0b0..This Flexcomm does not include the I2C function. | ||
3253 | * 0b1..This Flexcomm includes the I2C function. | ||
3254 | */ | ||
3255 | #define FLEXCOMM_PSELID_I2CPRESENT(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PSELID_I2CPRESENT_SHIFT)) & FLEXCOMM_PSELID_I2CPRESENT_MASK) | ||
3256 | #define FLEXCOMM_PSELID_I2SPRESENT_MASK (0x80U) | ||
3257 | #define FLEXCOMM_PSELID_I2SPRESENT_SHIFT (7U) | ||
3258 | /*! I2SPRESENT - I 2S present indicator. This field is Read-only. | ||
3259 | * 0b0..This Flexcomm does not include the I2S function. | ||
3260 | * 0b1..This Flexcomm includes the I2S function. | ||
3261 | */ | ||
3262 | #define FLEXCOMM_PSELID_I2SPRESENT(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PSELID_I2SPRESENT_SHIFT)) & FLEXCOMM_PSELID_I2SPRESENT_MASK) | ||
3263 | #define FLEXCOMM_PSELID_ID_MASK (0xFFFFF000U) | ||
3264 | #define FLEXCOMM_PSELID_ID_SHIFT (12U) | ||
3265 | /*! ID - Flexcomm ID. | ||
3266 | */ | ||
3267 | #define FLEXCOMM_PSELID_ID(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PSELID_ID_SHIFT)) & FLEXCOMM_PSELID_ID_MASK) | ||
3268 | /*! @} */ | ||
3269 | |||
3270 | /*! @name PID - Peripheral identification register. */ | ||
3271 | /*! @{ */ | ||
3272 | #define FLEXCOMM_PID_Minor_Rev_MASK (0xF00U) | ||
3273 | #define FLEXCOMM_PID_Minor_Rev_SHIFT (8U) | ||
3274 | /*! Minor_Rev - Minor revision of module implementation. | ||
3275 | */ | ||
3276 | #define FLEXCOMM_PID_Minor_Rev(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PID_Minor_Rev_SHIFT)) & FLEXCOMM_PID_Minor_Rev_MASK) | ||
3277 | #define FLEXCOMM_PID_Major_Rev_MASK (0xF000U) | ||
3278 | #define FLEXCOMM_PID_Major_Rev_SHIFT (12U) | ||
3279 | /*! Major_Rev - Major revision of module implementation. | ||
3280 | */ | ||
3281 | #define FLEXCOMM_PID_Major_Rev(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PID_Major_Rev_SHIFT)) & FLEXCOMM_PID_Major_Rev_MASK) | ||
3282 | #define FLEXCOMM_PID_ID_MASK (0xFFFF0000U) | ||
3283 | #define FLEXCOMM_PID_ID_SHIFT (16U) | ||
3284 | /*! ID - Module identifier for the selected function. | ||
3285 | */ | ||
3286 | #define FLEXCOMM_PID_ID(x) (((uint32_t)(((uint32_t)(x)) << FLEXCOMM_PID_ID_SHIFT)) & FLEXCOMM_PID_ID_MASK) | ||
3287 | /*! @} */ | ||
3288 | |||
3289 | |||
3290 | /*! | ||
3291 | * @} | ||
3292 | */ /* end of group FLEXCOMM_Register_Masks */ | ||
3293 | |||
3294 | |||
3295 | /* FLEXCOMM - Peripheral instance base addresses */ | ||
3296 | /** Peripheral FLEXCOMM0 base address */ | ||
3297 | #define FLEXCOMM0_BASE (0x40086000u) | ||
3298 | /** Peripheral FLEXCOMM0 base pointer */ | ||
3299 | #define FLEXCOMM0 ((FLEXCOMM_Type *)FLEXCOMM0_BASE) | ||
3300 | /** Peripheral FLEXCOMM1 base address */ | ||
3301 | #define FLEXCOMM1_BASE (0x40087000u) | ||
3302 | /** Peripheral FLEXCOMM1 base pointer */ | ||
3303 | #define FLEXCOMM1 ((FLEXCOMM_Type *)FLEXCOMM1_BASE) | ||
3304 | /** Peripheral FLEXCOMM2 base address */ | ||
3305 | #define FLEXCOMM2_BASE (0x40088000u) | ||
3306 | /** Peripheral FLEXCOMM2 base pointer */ | ||
3307 | #define FLEXCOMM2 ((FLEXCOMM_Type *)FLEXCOMM2_BASE) | ||
3308 | /** Peripheral FLEXCOMM3 base address */ | ||
3309 | #define FLEXCOMM3_BASE (0x40089000u) | ||
3310 | /** Peripheral FLEXCOMM3 base pointer */ | ||
3311 | #define FLEXCOMM3 ((FLEXCOMM_Type *)FLEXCOMM3_BASE) | ||
3312 | /** Peripheral FLEXCOMM4 base address */ | ||
3313 | #define FLEXCOMM4_BASE (0x4008A000u) | ||
3314 | /** Peripheral FLEXCOMM4 base pointer */ | ||
3315 | #define FLEXCOMM4 ((FLEXCOMM_Type *)FLEXCOMM4_BASE) | ||
3316 | /** Peripheral FLEXCOMM5 base address */ | ||
3317 | #define FLEXCOMM5_BASE (0x40096000u) | ||
3318 | /** Peripheral FLEXCOMM5 base pointer */ | ||
3319 | #define FLEXCOMM5 ((FLEXCOMM_Type *)FLEXCOMM5_BASE) | ||
3320 | /** Peripheral FLEXCOMM6 base address */ | ||
3321 | #define FLEXCOMM6_BASE (0x40097000u) | ||
3322 | /** Peripheral FLEXCOMM6 base pointer */ | ||
3323 | #define FLEXCOMM6 ((FLEXCOMM_Type *)FLEXCOMM6_BASE) | ||
3324 | /** Peripheral FLEXCOMM7 base address */ | ||
3325 | #define FLEXCOMM7_BASE (0x40098000u) | ||
3326 | /** Peripheral FLEXCOMM7 base pointer */ | ||
3327 | #define FLEXCOMM7 ((FLEXCOMM_Type *)FLEXCOMM7_BASE) | ||
3328 | /** Peripheral FLEXCOMM8 base address */ | ||
3329 | #define FLEXCOMM8_BASE (0x40099000u) | ||
3330 | /** Peripheral FLEXCOMM8 base pointer */ | ||
3331 | #define FLEXCOMM8 ((FLEXCOMM_Type *)FLEXCOMM8_BASE) | ||
3332 | /** Peripheral FLEXCOMM9 base address */ | ||
3333 | #define FLEXCOMM9_BASE (0x4009A000u) | ||
3334 | /** Peripheral FLEXCOMM9 base pointer */ | ||
3335 | #define FLEXCOMM9 ((FLEXCOMM_Type *)FLEXCOMM9_BASE) | ||
3336 | /** Peripheral FLEXCOMM10 base address */ | ||
3337 | #define FLEXCOMM10_BASE (0x4009F000u) | ||
3338 | /** Peripheral FLEXCOMM10 base pointer */ | ||
3339 | #define FLEXCOMM10 ((FLEXCOMM_Type *)FLEXCOMM10_BASE) | ||
3340 | /** Array initializer of FLEXCOMM peripheral base addresses */ | ||
3341 | #define FLEXCOMM_BASE_ADDRS { FLEXCOMM0_BASE, FLEXCOMM1_BASE, FLEXCOMM2_BASE, FLEXCOMM3_BASE, FLEXCOMM4_BASE, FLEXCOMM5_BASE, FLEXCOMM6_BASE, FLEXCOMM7_BASE, FLEXCOMM8_BASE, FLEXCOMM9_BASE, FLEXCOMM10_BASE } | ||
3342 | /** Array initializer of FLEXCOMM peripheral base pointers */ | ||
3343 | #define FLEXCOMM_BASE_PTRS { FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM8, FLEXCOMM9, FLEXCOMM10 } | ||
3344 | /** Interrupt vectors for the FLEXCOMM peripheral type */ | ||
3345 | #define FLEXCOMM_IRQS { FLEXCOMM0_IRQn, FLEXCOMM1_IRQn, FLEXCOMM2_IRQn, FLEXCOMM3_IRQn, FLEXCOMM4_IRQn, FLEXCOMM5_IRQn, FLEXCOMM6_IRQn, FLEXCOMM7_IRQn, FLEXCOMM8_IRQn, FLEXCOMM9_IRQn, FLEXCOMM10_IRQn } | ||
3346 | |||
3347 | /*! | ||
3348 | * @} | ||
3349 | */ /* end of group FLEXCOMM_Peripheral_Access_Layer */ | ||
3350 | |||
3351 | |||
3352 | /* ---------------------------------------------------------------------------- | ||
3353 | -- GINT Peripheral Access Layer | ||
3354 | ---------------------------------------------------------------------------- */ | ||
3355 | |||
3356 | /*! | ||
3357 | * @addtogroup GINT_Peripheral_Access_Layer GINT Peripheral Access Layer | ||
3358 | * @{ | ||
3359 | */ | ||
3360 | |||
3361 | /** GINT - Register Layout Typedef */ | ||
3362 | typedef struct { | ||
3363 | __IO uint32_t CTRL; /**< GPIO grouped interrupt control register, offset: 0x0 */ | ||
3364 | uint8_t RESERVED_0[28]; | ||
3365 | __IO uint32_t PORT_POL[2]; /**< GPIO grouped interrupt port 0 polarity register, array offset: 0x20, array step: 0x4 */ | ||
3366 | uint8_t RESERVED_1[24]; | ||
3367 | __IO uint32_t PORT_ENA[2]; /**< GPIO grouped interrupt port 0 enable register, array offset: 0x40, array step: 0x4 */ | ||
3368 | } GINT_Type; | ||
3369 | |||
3370 | /* ---------------------------------------------------------------------------- | ||
3371 | -- GINT Register Masks | ||
3372 | ---------------------------------------------------------------------------- */ | ||
3373 | |||
3374 | /*! | ||
3375 | * @addtogroup GINT_Register_Masks GINT Register Masks | ||
3376 | * @{ | ||
3377 | */ | ||
3378 | |||
3379 | /*! @name CTRL - GPIO grouped interrupt control register */ | ||
3380 | /*! @{ */ | ||
3381 | #define GINT_CTRL_INT_MASK (0x1U) | ||
3382 | #define GINT_CTRL_INT_SHIFT (0U) | ||
3383 | /*! INT - Group interrupt status. This bit is cleared by writing a one to it. Writing zero has no effect. | ||
3384 | * 0b0..No request. No interrupt request is pending. | ||
3385 | * 0b1..Request active. Interrupt request is active. | ||
3386 | */ | ||
3387 | #define GINT_CTRL_INT(x) (((uint32_t)(((uint32_t)(x)) << GINT_CTRL_INT_SHIFT)) & GINT_CTRL_INT_MASK) | ||
3388 | #define GINT_CTRL_COMB_MASK (0x2U) | ||
3389 | #define GINT_CTRL_COMB_SHIFT (1U) | ||
3390 | /*! COMB - Combine enabled inputs for group interrupt | ||
3391 | * 0b0..Or. OR functionality: A grouped interrupt is generated when any one of the enabled inputs is active (based on its programmed polarity). | ||
3392 | * 0b1..And. AND functionality: An interrupt is generated when all enabled bits are active (based on their programmed polarity). | ||
3393 | */ | ||
3394 | #define GINT_CTRL_COMB(x) (((uint32_t)(((uint32_t)(x)) << GINT_CTRL_COMB_SHIFT)) & GINT_CTRL_COMB_MASK) | ||
3395 | #define GINT_CTRL_TRIG_MASK (0x4U) | ||
3396 | #define GINT_CTRL_TRIG_SHIFT (2U) | ||
3397 | /*! TRIG - Group interrupt trigger | ||
3398 | * 0b0..Edge-triggered. | ||
3399 | * 0b1..Level-triggered. | ||
3400 | */ | ||
3401 | #define GINT_CTRL_TRIG(x) (((uint32_t)(((uint32_t)(x)) << GINT_CTRL_TRIG_SHIFT)) & GINT_CTRL_TRIG_MASK) | ||
3402 | /*! @} */ | ||
3403 | |||
3404 | /*! @name PORT_POL - GPIO grouped interrupt port 0 polarity register */ | ||
3405 | /*! @{ */ | ||
3406 | #define GINT_PORT_POL_POL_MASK (0xFFFFFFFFU) | ||
3407 | #define GINT_PORT_POL_POL_SHIFT (0U) | ||
3408 | /*! POL - Configure pin polarity of port m pins for group interrupt. Bit n corresponds to pin PIOm_n | ||
3409 | * of port m. 0 = the pin is active LOW. If the level on this pin is LOW, the pin contributes to | ||
3410 | * the group interrupt. 1 = the pin is active HIGH. If the level on this pin is HIGH, the pin | ||
3411 | * contributes to the group interrupt. | ||
3412 | */ | ||
3413 | #define GINT_PORT_POL_POL(x) (((uint32_t)(((uint32_t)(x)) << GINT_PORT_POL_POL_SHIFT)) & GINT_PORT_POL_POL_MASK) | ||
3414 | /*! @} */ | ||
3415 | |||
3416 | /* The count of GINT_PORT_POL */ | ||
3417 | #define GINT_PORT_POL_COUNT (2U) | ||
3418 | |||
3419 | /*! @name PORT_ENA - GPIO grouped interrupt port 0 enable register */ | ||
3420 | /*! @{ */ | ||
3421 | #define GINT_PORT_ENA_ENA_MASK (0xFFFFFFFFU) | ||
3422 | #define GINT_PORT_ENA_ENA_SHIFT (0U) | ||
3423 | /*! ENA - Enable port 0 pin for group interrupt. Bit n corresponds to pin Pm_n of port m. 0 = the | ||
3424 | * port 0 pin is disabled and does not contribute to the grouped interrupt. 1 = the port 0 pin is | ||
3425 | * enabled and contributes to the grouped interrupt. | ||
3426 | */ | ||
3427 | #define GINT_PORT_ENA_ENA(x) (((uint32_t)(((uint32_t)(x)) << GINT_PORT_ENA_ENA_SHIFT)) & GINT_PORT_ENA_ENA_MASK) | ||
3428 | /*! @} */ | ||
3429 | |||
3430 | /* The count of GINT_PORT_ENA */ | ||
3431 | #define GINT_PORT_ENA_COUNT (2U) | ||
3432 | |||
3433 | |||
3434 | /*! | ||
3435 | * @} | ||
3436 | */ /* end of group GINT_Register_Masks */ | ||
3437 | |||
3438 | |||
3439 | /* GINT - Peripheral instance base addresses */ | ||
3440 | /** Peripheral GINT0 base address */ | ||
3441 | #define GINT0_BASE (0x40002000u) | ||
3442 | /** Peripheral GINT0 base pointer */ | ||
3443 | #define GINT0 ((GINT_Type *)GINT0_BASE) | ||
3444 | /** Peripheral GINT1 base address */ | ||
3445 | #define GINT1_BASE (0x40003000u) | ||
3446 | /** Peripheral GINT1 base pointer */ | ||
3447 | #define GINT1 ((GINT_Type *)GINT1_BASE) | ||
3448 | /** Array initializer of GINT peripheral base addresses */ | ||
3449 | #define GINT_BASE_ADDRS { GINT0_BASE, GINT1_BASE } | ||
3450 | /** Array initializer of GINT peripheral base pointers */ | ||
3451 | #define GINT_BASE_PTRS { GINT0, GINT1 } | ||
3452 | /** Interrupt vectors for the GINT peripheral type */ | ||
3453 | #define GINT_IRQS { GINT0_IRQn, GINT1_IRQn } | ||
3454 | |||
3455 | /*! | ||
3456 | * @} | ||
3457 | */ /* end of group GINT_Peripheral_Access_Layer */ | ||
3458 | |||
3459 | |||
3460 | /* ---------------------------------------------------------------------------- | ||
3461 | -- GPIO Peripheral Access Layer | ||
3462 | ---------------------------------------------------------------------------- */ | ||
3463 | |||
3464 | /*! | ||
3465 | * @addtogroup GPIO_Peripheral_Access_Layer GPIO Peripheral Access Layer | ||
3466 | * @{ | ||
3467 | */ | ||
3468 | |||
3469 | /** GPIO - Register Layout Typedef */ | ||
3470 | typedef struct { | ||
3471 | __IO uint8_t B[6][32]; /**< Byte pin registers for all port 0 and 1 GPIO pins, array offset: 0x0, array step: index*0x20, index2*0x1 */ | ||
3472 | uint8_t RESERVED_0[3904]; | ||
3473 | __IO uint32_t W[6][32]; /**< Word pin registers for all port 0 and 1 GPIO pins, array offset: 0x1000, array step: index*0x80, index2*0x4 */ | ||
3474 | uint8_t RESERVED_1[3328]; | ||
3475 | __IO uint32_t DIR[6]; /**< Direction registers, array offset: 0x2000, array step: 0x4 */ | ||
3476 | uint8_t RESERVED_2[104]; | ||
3477 | __IO uint32_t MASK[6]; /**< Mask register, array offset: 0x2080, array step: 0x4 */ | ||
3478 | uint8_t RESERVED_3[104]; | ||
3479 | __IO uint32_t PIN[6]; /**< Port pin register, array offset: 0x2100, array step: 0x4 */ | ||
3480 | uint8_t RESERVED_4[104]; | ||
3481 | __IO uint32_t MPIN[6]; /**< Masked port register, array offset: 0x2180, array step: 0x4 */ | ||
3482 | uint8_t RESERVED_5[104]; | ||
3483 | __IO uint32_t SET[6]; /**< Write: Set register for port Read: output bits for port, array offset: 0x2200, array step: 0x4 */ | ||
3484 | uint8_t RESERVED_6[104]; | ||
3485 | __O uint32_t CLR[6]; /**< Clear port, array offset: 0x2280, array step: 0x4 */ | ||
3486 | uint8_t RESERVED_7[104]; | ||
3487 | __O uint32_t NOT[6]; /**< Toggle port, array offset: 0x2300, array step: 0x4 */ | ||
3488 | uint8_t RESERVED_8[104]; | ||
3489 | __O uint32_t DIRSET[6]; /**< Set pin direction bits for port, array offset: 0x2380, array step: 0x4 */ | ||
3490 | uint8_t RESERVED_9[104]; | ||
3491 | __O uint32_t DIRCLR[6]; /**< Clear pin direction bits for port, array offset: 0x2400, array step: 0x4 */ | ||
3492 | uint8_t RESERVED_10[104]; | ||
3493 | __O uint32_t DIRNOT[6]; /**< Toggle pin direction bits for port, array offset: 0x2480, array step: 0x4 */ | ||
3494 | } GPIO_Type; | ||
3495 | |||
3496 | /* ---------------------------------------------------------------------------- | ||
3497 | -- GPIO Register Masks | ||
3498 | ---------------------------------------------------------------------------- */ | ||
3499 | |||
3500 | /*! | ||
3501 | * @addtogroup GPIO_Register_Masks GPIO Register Masks | ||
3502 | * @{ | ||
3503 | */ | ||
3504 | |||
3505 | /*! @name B - Byte pin registers for all port 0 and 1 GPIO pins */ | ||
3506 | /*! @{ */ | ||
3507 | #define GPIO_B_PBYTE_MASK (0x1U) | ||
3508 | #define GPIO_B_PBYTE_SHIFT (0U) | ||
3509 | /*! PBYTE - Read: state of the pin PIOm_n, regardless of direction, masking, or alternate function, | ||
3510 | * except that pins configured as analog I/O always read as 0. One register for each port pin. | ||
3511 | * Supported pins depends on the specific device and package. Write: loads the pin's output bit. | ||
3512 | * One register for each port pin. Supported pins depends on the specific device and package. | ||
3513 | */ | ||
3514 | #define GPIO_B_PBYTE(x) (((uint8_t)(((uint8_t)(x)) << GPIO_B_PBYTE_SHIFT)) & GPIO_B_PBYTE_MASK) | ||
3515 | /*! @} */ | ||
3516 | |||
3517 | /* The count of GPIO_B */ | ||
3518 | #define GPIO_B_COUNT (6U) | ||
3519 | |||
3520 | /* The count of GPIO_B */ | ||
3521 | #define GPIO_B_COUNT2 (32U) | ||
3522 | |||
3523 | /*! @name W - Word pin registers for all port 0 and 1 GPIO pins */ | ||
3524 | /*! @{ */ | ||
3525 | #define GPIO_W_PWORD_MASK (0xFFFFFFFFU) | ||
3526 | #define GPIO_W_PWORD_SHIFT (0U) | ||
3527 | /*! PWORD - Read 0: pin PIOm_n is LOW. Write 0: clear output bit. Read 0xFFFF FFFF: pin PIOm_n is | ||
3528 | * HIGH. Write any value 0x0000 0001 to 0xFFFF FFFF: set output bit. Only 0 or 0xFFFF FFFF can be | ||
3529 | * read. Writing any value other than 0 will set the output bit. One register for each port pin. | ||
3530 | * Supported pins depends on the specific device and package. | ||
3531 | */ | ||
3532 | #define GPIO_W_PWORD(x) (((uint32_t)(((uint32_t)(x)) << GPIO_W_PWORD_SHIFT)) & GPIO_W_PWORD_MASK) | ||
3533 | /*! @} */ | ||
3534 | |||
3535 | /* The count of GPIO_W */ | ||
3536 | #define GPIO_W_COUNT (6U) | ||
3537 | |||
3538 | /* The count of GPIO_W */ | ||
3539 | #define GPIO_W_COUNT2 (32U) | ||
3540 | |||
3541 | /*! @name DIR - Direction registers */ | ||
3542 | /*! @{ */ | ||
3543 | #define GPIO_DIR_DIRP_MASK (0xFFFFFFFFU) | ||
3544 | #define GPIO_DIR_DIRP_SHIFT (0U) | ||
3545 | /*! DIRP - Selects pin direction for pin PIOm_n (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported | ||
3546 | * pins depends on the specific device and package. 0 = input. 1 = output. | ||
3547 | */ | ||
3548 | #define GPIO_DIR_DIRP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_DIR_DIRP_SHIFT)) & GPIO_DIR_DIRP_MASK) | ||
3549 | /*! @} */ | ||
3550 | |||
3551 | /* The count of GPIO_DIR */ | ||
3552 | #define GPIO_DIR_COUNT (6U) | ||
3553 | |||
3554 | /*! @name MASK - Mask register */ | ||
3555 | /*! @{ */ | ||
3556 | #define GPIO_MASK_MASKP_MASK (0xFFFFFFFFU) | ||
3557 | #define GPIO_MASK_MASKP_SHIFT (0U) | ||
3558 | /*! MASKP - Controls which bits corresponding to PIOm_n are active in the MPORT register (bit 0 = | ||
3559 | * PIOn_0, bit 1 = PIOn_1, etc.). Supported pins depends on the specific device and package. 0 = | ||
3560 | * Read MPORT: pin state; write MPORT: load output bit. 1 = Read MPORT: 0; write MPORT: output bit | ||
3561 | * not affected. | ||
3562 | */ | ||
3563 | #define GPIO_MASK_MASKP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_MASK_MASKP_SHIFT)) & GPIO_MASK_MASKP_MASK) | ||
3564 | /*! @} */ | ||
3565 | |||
3566 | /* The count of GPIO_MASK */ | ||
3567 | #define GPIO_MASK_COUNT (6U) | ||
3568 | |||
3569 | /*! @name PIN - Port pin register */ | ||
3570 | /*! @{ */ | ||
3571 | #define GPIO_PIN_PORT_MASK (0xFFFFFFFFU) | ||
3572 | #define GPIO_PIN_PORT_SHIFT (0U) | ||
3573 | /*! PORT - Reads pin states or loads output bits (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported | ||
3574 | * pins depends on the specific device and package. 0 = Read: pin is low; write: clear output bit. | ||
3575 | * 1 = Read: pin is high; write: set output bit. | ||
3576 | */ | ||
3577 | #define GPIO_PIN_PORT(x) (((uint32_t)(((uint32_t)(x)) << GPIO_PIN_PORT_SHIFT)) & GPIO_PIN_PORT_MASK) | ||
3578 | /*! @} */ | ||
3579 | |||
3580 | /* The count of GPIO_PIN */ | ||
3581 | #define GPIO_PIN_COUNT (6U) | ||
3582 | |||
3583 | /*! @name MPIN - Masked port register */ | ||
3584 | /*! @{ */ | ||
3585 | #define GPIO_MPIN_MPORTP_MASK (0xFFFFFFFFU) | ||
3586 | #define GPIO_MPIN_MPORTP_SHIFT (0U) | ||
3587 | /*! MPORTP - Masked port register (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins depends on | ||
3588 | * the specific device and package. 0 = Read: pin is LOW and/or the corresponding bit in the MASK | ||
3589 | * register is 1; write: clear output bit if the corresponding bit in the MASK register is 0. 1 | ||
3590 | * = Read: pin is HIGH and the corresponding bit in the MASK register is 0; write: set output bit | ||
3591 | * if the corresponding bit in the MASK register is 0. | ||
3592 | */ | ||
3593 | #define GPIO_MPIN_MPORTP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_MPIN_MPORTP_SHIFT)) & GPIO_MPIN_MPORTP_MASK) | ||
3594 | /*! @} */ | ||
3595 | |||
3596 | /* The count of GPIO_MPIN */ | ||
3597 | #define GPIO_MPIN_COUNT (6U) | ||
3598 | |||
3599 | /*! @name SET - Write: Set register for port Read: output bits for port */ | ||
3600 | /*! @{ */ | ||
3601 | #define GPIO_SET_SETP_MASK (0xFFFFFFFFU) | ||
3602 | #define GPIO_SET_SETP_SHIFT (0U) | ||
3603 | /*! SETP - Read or set output bits (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins depends on | ||
3604 | * the specific device and package. 0 = Read: output bit: write: no operation. 1 = Read: output | ||
3605 | * bit; write: set output bit. | ||
3606 | */ | ||
3607 | #define GPIO_SET_SETP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_SET_SETP_SHIFT)) & GPIO_SET_SETP_MASK) | ||
3608 | /*! @} */ | ||
3609 | |||
3610 | /* The count of GPIO_SET */ | ||
3611 | #define GPIO_SET_COUNT (6U) | ||
3612 | |||
3613 | /*! @name CLR - Clear port */ | ||
3614 | /*! @{ */ | ||
3615 | #define GPIO_CLR_CLRP_MASK (0xFFFFFFFFU) | ||
3616 | #define GPIO_CLR_CLRP_SHIFT (0U) | ||
3617 | /*! CLRP - Clear output bits (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins depends on the | ||
3618 | * specific device and package. 0 = No operation. 1 = Clear output bit. | ||
3619 | */ | ||
3620 | #define GPIO_CLR_CLRP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_CLR_CLRP_SHIFT)) & GPIO_CLR_CLRP_MASK) | ||
3621 | /*! @} */ | ||
3622 | |||
3623 | /* The count of GPIO_CLR */ | ||
3624 | #define GPIO_CLR_COUNT (6U) | ||
3625 | |||
3626 | /*! @name NOT - Toggle port */ | ||
3627 | /*! @{ */ | ||
3628 | #define GPIO_NOT_NOTP_MASK (0xFFFFFFFFU) | ||
3629 | #define GPIO_NOT_NOTP_SHIFT (0U) | ||
3630 | /*! NOTP - Toggle output bits (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins depends on the | ||
3631 | * specific device and package. 0 = no operation. 1 = Toggle output bit. | ||
3632 | */ | ||
3633 | #define GPIO_NOT_NOTP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_NOT_NOTP_SHIFT)) & GPIO_NOT_NOTP_MASK) | ||
3634 | /*! @} */ | ||
3635 | |||
3636 | /* The count of GPIO_NOT */ | ||
3637 | #define GPIO_NOT_COUNT (6U) | ||
3638 | |||
3639 | /*! @name DIRSET - Set pin direction bits for port */ | ||
3640 | /*! @{ */ | ||
3641 | #define GPIO_DIRSET_DIRSETP_MASK (0x1FFFFFFFU) | ||
3642 | #define GPIO_DIRSET_DIRSETP_SHIFT (0U) | ||
3643 | /*! DIRSETP - Set direction bits (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins depends on | ||
3644 | * the specific device and package. 0 = No operation. 1 = Set direction bit. | ||
3645 | */ | ||
3646 | #define GPIO_DIRSET_DIRSETP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_DIRSET_DIRSETP_SHIFT)) & GPIO_DIRSET_DIRSETP_MASK) | ||
3647 | /*! @} */ | ||
3648 | |||
3649 | /* The count of GPIO_DIRSET */ | ||
3650 | #define GPIO_DIRSET_COUNT (6U) | ||
3651 | |||
3652 | /*! @name DIRCLR - Clear pin direction bits for port */ | ||
3653 | /*! @{ */ | ||
3654 | #define GPIO_DIRCLR_DIRCLRP_MASK (0x1FFFFFFFU) | ||
3655 | #define GPIO_DIRCLR_DIRCLRP_SHIFT (0U) | ||
3656 | /*! DIRCLRP - Clear direction bits (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins depends on | ||
3657 | * the specific device and package. 0 = No operation. 1 = Clear direction bit. | ||
3658 | */ | ||
3659 | #define GPIO_DIRCLR_DIRCLRP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_DIRCLR_DIRCLRP_SHIFT)) & GPIO_DIRCLR_DIRCLRP_MASK) | ||
3660 | /*! @} */ | ||
3661 | |||
3662 | /* The count of GPIO_DIRCLR */ | ||
3663 | #define GPIO_DIRCLR_COUNT (6U) | ||
3664 | |||
3665 | /*! @name DIRNOT - Toggle pin direction bits for port */ | ||
3666 | /*! @{ */ | ||
3667 | #define GPIO_DIRNOT_DIRNOTP_MASK (0x1FFFFFFFU) | ||
3668 | #define GPIO_DIRNOT_DIRNOTP_SHIFT (0U) | ||
3669 | /*! DIRNOTP - Toggle direction bits (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins depends | ||
3670 | * on the specific device and package. 0 = no operation. 1 = Toggle direction bit. | ||
3671 | */ | ||
3672 | #define GPIO_DIRNOT_DIRNOTP(x) (((uint32_t)(((uint32_t)(x)) << GPIO_DIRNOT_DIRNOTP_SHIFT)) & GPIO_DIRNOT_DIRNOTP_MASK) | ||
3673 | /*! @} */ | ||
3674 | |||
3675 | /* The count of GPIO_DIRNOT */ | ||
3676 | #define GPIO_DIRNOT_COUNT (6U) | ||
3677 | |||
3678 | |||
3679 | /*! | ||
3680 | * @} | ||
3681 | */ /* end of group GPIO_Register_Masks */ | ||
3682 | |||
3683 | |||
3684 | /* GPIO - Peripheral instance base addresses */ | ||
3685 | /** Peripheral GPIO base address */ | ||
3686 | #define GPIO_BASE (0x4008C000u) | ||
3687 | /** Peripheral GPIO base pointer */ | ||
3688 | #define GPIO ((GPIO_Type *)GPIO_BASE) | ||
3689 | /** Array initializer of GPIO peripheral base addresses */ | ||
3690 | #define GPIO_BASE_ADDRS { GPIO_BASE } | ||
3691 | /** Array initializer of GPIO peripheral base pointers */ | ||
3692 | #define GPIO_BASE_PTRS { GPIO } | ||
3693 | |||
3694 | /*! | ||
3695 | * @} | ||
3696 | */ /* end of group GPIO_Peripheral_Access_Layer */ | ||
3697 | |||
3698 | |||
3699 | /* ---------------------------------------------------------------------------- | ||
3700 | -- I2C Peripheral Access Layer | ||
3701 | ---------------------------------------------------------------------------- */ | ||
3702 | |||
3703 | /*! | ||
3704 | * @addtogroup I2C_Peripheral_Access_Layer I2C Peripheral Access Layer | ||
3705 | * @{ | ||
3706 | */ | ||
3707 | |||
3708 | /** I2C - Register Layout Typedef */ | ||
3709 | typedef struct { | ||
3710 | uint8_t RESERVED_0[2048]; | ||
3711 | __IO uint32_t CFG; /**< Configuration for shared functions., offset: 0x800 */ | ||
3712 | __IO uint32_t STAT; /**< Status register for Master, Slave, and Monitor functions., offset: 0x804 */ | ||
3713 | __IO uint32_t INTENSET; /**< Interrupt Enable Set and read register., offset: 0x808 */ | ||
3714 | __O uint32_t INTENCLR; /**< Interrupt Enable Clear register., offset: 0x80C */ | ||
3715 | __IO uint32_t TIMEOUT; /**< Time-out value register., offset: 0x810 */ | ||
3716 | __IO uint32_t CLKDIV; /**< Clock pre-divider for the entire I2C interface. This determines what time increments are used for the MSTTIME register, and controls some timing of the Slave function., offset: 0x814 */ | ||
3717 | __I uint32_t INTSTAT; /**< Interrupt Status register for Master, Slave, and Monitor functions., offset: 0x818 */ | ||
3718 | uint8_t RESERVED_1[4]; | ||
3719 | __IO uint32_t MSTCTL; /**< Master control register., offset: 0x820 */ | ||
3720 | __IO uint32_t MSTTIME; /**< Master timing configuration., offset: 0x824 */ | ||
3721 | __IO uint32_t MSTDAT; /**< Combined Master receiver and transmitter data register., offset: 0x828 */ | ||
3722 | uint8_t RESERVED_2[20]; | ||
3723 | __IO uint32_t SLVCTL; /**< Slave control register., offset: 0x840 */ | ||
3724 | __IO uint32_t SLVDAT; /**< Combined Slave receiver and transmitter data register., offset: 0x844 */ | ||
3725 | __IO uint32_t SLVADR[4]; /**< Slave address register., array offset: 0x848, array step: 0x4 */ | ||
3726 | __IO uint32_t SLVQUAL0; /**< Slave Qualification for address 0., offset: 0x858 */ | ||
3727 | uint8_t RESERVED_3[36]; | ||
3728 | __I uint32_t MONRXDAT; /**< Monitor receiver data register., offset: 0x880 */ | ||
3729 | uint8_t RESERVED_4[1912]; | ||
3730 | __I uint32_t ID; /**< Peripheral identification register., offset: 0xFFC */ | ||
3731 | } I2C_Type; | ||
3732 | |||
3733 | /* ---------------------------------------------------------------------------- | ||
3734 | -- I2C Register Masks | ||
3735 | ---------------------------------------------------------------------------- */ | ||
3736 | |||
3737 | /*! | ||
3738 | * @addtogroup I2C_Register_Masks I2C Register Masks | ||
3739 | * @{ | ||
3740 | */ | ||
3741 | |||
3742 | /*! @name CFG - Configuration for shared functions. */ | ||
3743 | /*! @{ */ | ||
3744 | #define I2C_CFG_MSTEN_MASK (0x1U) | ||
3745 | #define I2C_CFG_MSTEN_SHIFT (0U) | ||
3746 | /*! MSTEN - Master Enable. When disabled, configurations settings for the Master function are not | ||
3747 | * changed, but the Master function is internally reset. | ||
3748 | * 0b0..Disabled. The I2C Master function is disabled. | ||
3749 | * 0b1..Enabled. The I2C Master function is enabled. | ||
3750 | */ | ||
3751 | #define I2C_CFG_MSTEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_CFG_MSTEN_SHIFT)) & I2C_CFG_MSTEN_MASK) | ||
3752 | #define I2C_CFG_SLVEN_MASK (0x2U) | ||
3753 | #define I2C_CFG_SLVEN_SHIFT (1U) | ||
3754 | /*! SLVEN - Slave Enable. When disabled, configurations settings for the Slave function are not | ||
3755 | * changed, but the Slave function is internally reset. | ||
3756 | * 0b0..Disabled. The I2C slave function is disabled. | ||
3757 | * 0b1..Enabled. The I2C slave function is enabled. | ||
3758 | */ | ||
3759 | #define I2C_CFG_SLVEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_CFG_SLVEN_SHIFT)) & I2C_CFG_SLVEN_MASK) | ||
3760 | #define I2C_CFG_MONEN_MASK (0x4U) | ||
3761 | #define I2C_CFG_MONEN_SHIFT (2U) | ||
3762 | /*! MONEN - Monitor Enable. When disabled, configurations settings for the Monitor function are not | ||
3763 | * changed, but the Monitor function is internally reset. | ||
3764 | * 0b0..Disabled. The I2C Monitor function is disabled. | ||
3765 | * 0b1..Enabled. The I2C Monitor function is enabled. | ||
3766 | */ | ||
3767 | #define I2C_CFG_MONEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_CFG_MONEN_SHIFT)) & I2C_CFG_MONEN_MASK) | ||
3768 | #define I2C_CFG_TIMEOUTEN_MASK (0x8U) | ||
3769 | #define I2C_CFG_TIMEOUTEN_SHIFT (3U) | ||
3770 | /*! TIMEOUTEN - I2C bus Time-out Enable. When disabled, the time-out function is internally reset. | ||
3771 | * 0b0..Disabled. Time-out function is disabled. | ||
3772 | * 0b1..Enabled. Time-out function is enabled. Both types of time-out flags will be generated and will cause | ||
3773 | * interrupts if they are enabled. Typically, only one time-out will be used in a system. | ||
3774 | */ | ||
3775 | #define I2C_CFG_TIMEOUTEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_CFG_TIMEOUTEN_SHIFT)) & I2C_CFG_TIMEOUTEN_MASK) | ||
3776 | #define I2C_CFG_MONCLKSTR_MASK (0x10U) | ||
3777 | #define I2C_CFG_MONCLKSTR_SHIFT (4U) | ||
3778 | /*! MONCLKSTR - Monitor function Clock Stretching. | ||
3779 | * 0b0..Disabled. The Monitor function will not perform clock stretching. Software or DMA may not always be able | ||
3780 | * to read data provided by the Monitor function before it is overwritten. This mode may be used when | ||
3781 | * non-invasive monitoring is critical. | ||
3782 | * 0b1..Enabled. The Monitor function will perform clock stretching in order to ensure that software or DMA can | ||
3783 | * read all incoming data supplied by the Monitor function. | ||
3784 | */ | ||
3785 | #define I2C_CFG_MONCLKSTR(x) (((uint32_t)(((uint32_t)(x)) << I2C_CFG_MONCLKSTR_SHIFT)) & I2C_CFG_MONCLKSTR_MASK) | ||
3786 | #define I2C_CFG_HSCAPABLE_MASK (0x20U) | ||
3787 | #define I2C_CFG_HSCAPABLE_SHIFT (5U) | ||
3788 | /*! HSCAPABLE - High-speed mode Capable enable. Since High Speed mode alters the way I2C pins drive | ||
3789 | * and filter, as well as the timing for certain I2C signalling, enabling High-speed mode applies | ||
3790 | * to all functions: Master, Slave, and Monitor. | ||
3791 | * 0b0..Fast-mode plus. The I 2C interface will support Standard-mode, Fast-mode, and Fast-mode Plus, to the | ||
3792 | * extent that the pin electronics support these modes. Any changes that need to be made to the pin controls, | ||
3793 | * such as changing the drive strength or filtering, must be made by software via the IOCON register associated | ||
3794 | * with each I2C pin, | ||
3795 | * 0b1..High-speed. In addition to Standard-mode, Fast-mode, and Fast-mode Plus, the I 2C interface will support | ||
3796 | * High-speed mode to the extent that the pin electronics support these modes. See Section 25.7.2.2 for more | ||
3797 | * information. | ||
3798 | */ | ||
3799 | #define I2C_CFG_HSCAPABLE(x) (((uint32_t)(((uint32_t)(x)) << I2C_CFG_HSCAPABLE_SHIFT)) & I2C_CFG_HSCAPABLE_MASK) | ||
3800 | /*! @} */ | ||
3801 | |||
3802 | /*! @name STAT - Status register for Master, Slave, and Monitor functions. */ | ||
3803 | /*! @{ */ | ||
3804 | #define I2C_STAT_MSTPENDING_MASK (0x1U) | ||
3805 | #define I2C_STAT_MSTPENDING_SHIFT (0U) | ||
3806 | /*! MSTPENDING - Master Pending. Indicates that the Master is waiting to continue communication on | ||
3807 | * the I2C-bus (pending) or is idle. When the master is pending, the MSTSTATE bits indicate what | ||
3808 | * type of software service if any the master expects. This flag will cause an interrupt when set | ||
3809 | * if, enabled via the INTENSET register. The MSTPENDING flag is not set when the DMA is handling | ||
3810 | * an event (if the MSTDMA bit in the MSTCTL register is set). If the master is in the idle | ||
3811 | * state, and no communication is needed, mask this interrupt. | ||
3812 | * 0b0..In progress. Communication is in progress and the Master function is busy and cannot currently accept a command. | ||
3813 | * 0b1..Pending. The Master function needs software service or is in the idle state. If the master is not in the | ||
3814 | * idle state, it is waiting to receive or transmit data or the NACK bit. | ||
3815 | */ | ||
3816 | #define I2C_STAT_MSTPENDING(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_MSTPENDING_SHIFT)) & I2C_STAT_MSTPENDING_MASK) | ||
3817 | #define I2C_STAT_MSTSTATE_MASK (0xEU) | ||
3818 | #define I2C_STAT_MSTSTATE_SHIFT (1U) | ||
3819 | /*! MSTSTATE - Master State code. The master state code reflects the master state when the | ||
3820 | * MSTPENDING bit is set, that is the master is pending or in the idle state. Each value of this field | ||
3821 | * indicates a specific required service for the Master function. All other values are reserved. See | ||
3822 | * Table 400 for details of state values and appropriate responses. | ||
3823 | * 0b000..Idle. The Master function is available to be used for a new transaction. | ||
3824 | * 0b001..Receive ready. Received data available (Master Receiver mode). Address plus Read was previously sent and Acknowledged by slave. | ||
3825 | * 0b010..Transmit ready. Data can be transmitted (Master Transmitter mode). Address plus Write was previously sent and Acknowledged by slave. | ||
3826 | * 0b011..NACK Address. Slave NACKed address. | ||
3827 | * 0b100..NACK Data. Slave NACKed transmitted data. | ||
3828 | */ | ||
3829 | #define I2C_STAT_MSTSTATE(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_MSTSTATE_SHIFT)) & I2C_STAT_MSTSTATE_MASK) | ||
3830 | #define I2C_STAT_MSTARBLOSS_MASK (0x10U) | ||
3831 | #define I2C_STAT_MSTARBLOSS_SHIFT (4U) | ||
3832 | /*! MSTARBLOSS - Master Arbitration Loss flag. This flag can be cleared by software writing a 1 to | ||
3833 | * this bit. It is also cleared automatically a 1 is written to MSTCONTINUE. | ||
3834 | * 0b0..No Arbitration Loss has occurred. | ||
3835 | * 0b1..Arbitration loss. The Master function has experienced an Arbitration Loss. At this point, the Master | ||
3836 | * function has already stopped driving the bus and gone to an idle state. Software can respond by doing nothing, | ||
3837 | * or by sending a Start in order to attempt to gain control of the bus when it next becomes idle. | ||
3838 | */ | ||
3839 | #define I2C_STAT_MSTARBLOSS(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_MSTARBLOSS_SHIFT)) & I2C_STAT_MSTARBLOSS_MASK) | ||
3840 | #define I2C_STAT_MSTSTSTPERR_MASK (0x40U) | ||
3841 | #define I2C_STAT_MSTSTSTPERR_SHIFT (6U) | ||
3842 | /*! MSTSTSTPERR - Master Start/Stop Error flag. This flag can be cleared by software writing a 1 to | ||
3843 | * this bit. It is also cleared automatically a 1 is written to MSTCONTINUE. | ||
3844 | * 0b0..No Start/Stop Error has occurred. | ||
3845 | * 0b1..The Master function has experienced a Start/Stop Error. A Start or Stop was detected at a time when it is | ||
3846 | * not allowed by the I2C specification. The Master interface has stopped driving the bus and gone to an | ||
3847 | * idle state, no action is required. A request for a Start could be made, or software could attempt to insure | ||
3848 | * that the bus has not stalled. | ||
3849 | */ | ||
3850 | #define I2C_STAT_MSTSTSTPERR(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_MSTSTSTPERR_SHIFT)) & I2C_STAT_MSTSTSTPERR_MASK) | ||
3851 | #define I2C_STAT_SLVPENDING_MASK (0x100U) | ||
3852 | #define I2C_STAT_SLVPENDING_SHIFT (8U) | ||
3853 | /*! SLVPENDING - Slave Pending. Indicates that the Slave function is waiting to continue | ||
3854 | * communication on the I2C-bus and needs software service. This flag will cause an interrupt when set if | ||
3855 | * enabled via INTENSET. The SLVPENDING flag is not set when the DMA is handling an event (if the | ||
3856 | * SLVDMA bit in the SLVCTL register is set). The SLVPENDING flag is read-only and is | ||
3857 | * automatically cleared when a 1 is written to the SLVCONTINUE bit in the SLVCTL register. The point in time | ||
3858 | * when SlvPending is set depends on whether the I2C interface is in HSCAPABLE mode. See Section | ||
3859 | * 25.7.2.2.2. When the I2C interface is configured to be HSCAPABLE, HS master codes are | ||
3860 | * detected automatically. Due to the requirements of the HS I2C specification, slave addresses must | ||
3861 | * also be detected automatically, since the address must be acknowledged before the clock can be | ||
3862 | * stretched. | ||
3863 | * 0b0..In progress. The Slave function does not currently need service. | ||
3864 | * 0b1..Pending. The Slave function needs service. Information on what is needed can be found in the adjacent SLVSTATE field. | ||
3865 | */ | ||
3866 | #define I2C_STAT_SLVPENDING(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_SLVPENDING_SHIFT)) & I2C_STAT_SLVPENDING_MASK) | ||
3867 | #define I2C_STAT_SLVSTATE_MASK (0x600U) | ||
3868 | #define I2C_STAT_SLVSTATE_SHIFT (9U) | ||
3869 | /*! SLVSTATE - Slave State code. Each value of this field indicates a specific required service for | ||
3870 | * the Slave function. All other values are reserved. See Table 401 for state values and actions. | ||
3871 | * note that the occurrence of some states and how they are handled are affected by DMA mode and | ||
3872 | * Automatic Operation modes. | ||
3873 | * 0b00..Slave address. Address plus R/W received. At least one of the four slave addresses has been matched by hardware. | ||
3874 | * 0b01..Slave receive. Received data is available (Slave Receiver mode). | ||
3875 | * 0b10..Slave transmit. Data can be transmitted (Slave Transmitter mode). | ||
3876 | */ | ||
3877 | #define I2C_STAT_SLVSTATE(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_SLVSTATE_SHIFT)) & I2C_STAT_SLVSTATE_MASK) | ||
3878 | #define I2C_STAT_SLVNOTSTR_MASK (0x800U) | ||
3879 | #define I2C_STAT_SLVNOTSTR_SHIFT (11U) | ||
3880 | /*! SLVNOTSTR - Slave Not Stretching. Indicates when the slave function is stretching the I2C clock. | ||
3881 | * This is needed in order to gracefully invoke Deep Sleep or Power-down modes during slave | ||
3882 | * operation. This read-only flag reflects the slave function status in real time. | ||
3883 | * 0b0..Stretching. The slave function is currently stretching the I2C bus clock. Deep-Sleep or Power-down mode cannot be entered at this time. | ||
3884 | * 0b1..Not stretching. The slave function is not currently stretching the I 2C bus clock. Deep-sleep or | ||
3885 | * Power-down mode could be entered at this time. | ||
3886 | */ | ||
3887 | #define I2C_STAT_SLVNOTSTR(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_SLVNOTSTR_SHIFT)) & I2C_STAT_SLVNOTSTR_MASK) | ||
3888 | #define I2C_STAT_SLVIDX_MASK (0x3000U) | ||
3889 | #define I2C_STAT_SLVIDX_SHIFT (12U) | ||
3890 | /*! SLVIDX - Slave address match Index. This field is valid when the I2C slave function has been | ||
3891 | * selected by receiving an address that matches one of the slave addresses defined by any enabled | ||
3892 | * slave address registers, and provides an identification of the address that was matched. It is | ||
3893 | * possible that more than one address could be matched, but only one match can be reported here. | ||
3894 | * 0b00..Address 0. Slave address 0 was matched. | ||
3895 | * 0b01..Address 1. Slave address 1 was matched. | ||
3896 | * 0b10..Address 2. Slave address 2 was matched. | ||
3897 | * 0b11..Address 3. Slave address 3 was matched. | ||
3898 | */ | ||
3899 | #define I2C_STAT_SLVIDX(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_SLVIDX_SHIFT)) & I2C_STAT_SLVIDX_MASK) | ||
3900 | #define I2C_STAT_SLVSEL_MASK (0x4000U) | ||
3901 | #define I2C_STAT_SLVSEL_SHIFT (14U) | ||
3902 | /*! SLVSEL - Slave selected flag. SLVSEL is set after an address match when software tells the Slave | ||
3903 | * function to acknowledge the address, or when the address has been automatically acknowledged. | ||
3904 | * It is cleared when another address cycle presents an address that does not match an enabled | ||
3905 | * address on the Slave function, when slave software decides to NACK a matched address, when | ||
3906 | * there is a Stop detected on the bus, when the master NACKs slave data, and in some combinations of | ||
3907 | * Automatic Operation. SLVSEL is not cleared if software NACKs data. | ||
3908 | * 0b0..Not selected. The Slave function is not currently selected. | ||
3909 | * 0b1..Selected. The Slave function is currently selected. | ||
3910 | */ | ||
3911 | #define I2C_STAT_SLVSEL(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_SLVSEL_SHIFT)) & I2C_STAT_SLVSEL_MASK) | ||
3912 | #define I2C_STAT_SLVDESEL_MASK (0x8000U) | ||
3913 | #define I2C_STAT_SLVDESEL_SHIFT (15U) | ||
3914 | /*! SLVDESEL - Slave Deselected flag. This flag will cause an interrupt when set if enabled via | ||
3915 | * INTENSET. This flag can be cleared by writing a 1 to this bit. | ||
3916 | * 0b0..Not deselected. The Slave function has not become deselected. This does not mean that it is currently | ||
3917 | * selected. That information can be found in the SLVSEL flag. | ||
3918 | * 0b1..Deselected. The Slave function has become deselected. This is specifically caused by the SLVSEL flag | ||
3919 | * changing from 1 to 0. See the description of SLVSEL for details on when that event occurs. | ||
3920 | */ | ||
3921 | #define I2C_STAT_SLVDESEL(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_SLVDESEL_SHIFT)) & I2C_STAT_SLVDESEL_MASK) | ||
3922 | #define I2C_STAT_MONRDY_MASK (0x10000U) | ||
3923 | #define I2C_STAT_MONRDY_SHIFT (16U) | ||
3924 | /*! MONRDY - Monitor Ready. This flag is cleared when the MONRXDAT register is read. | ||
3925 | * 0b0..No data. The Monitor function does not currently have data available. | ||
3926 | * 0b1..Data waiting. The Monitor function has data waiting to be read. | ||
3927 | */ | ||
3928 | #define I2C_STAT_MONRDY(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_MONRDY_SHIFT)) & I2C_STAT_MONRDY_MASK) | ||
3929 | #define I2C_STAT_MONOV_MASK (0x20000U) | ||
3930 | #define I2C_STAT_MONOV_SHIFT (17U) | ||
3931 | /*! MONOV - Monitor Overflow flag. | ||
3932 | * 0b0..No overrun. Monitor data has not overrun. | ||
3933 | * 0b1..Overrun. A Monitor data overrun has occurred. This can only happen when Monitor clock stretching not | ||
3934 | * enabled via the MONCLKSTR bit in the CFG register. Writing 1 to this bit clears the flag. | ||
3935 | */ | ||
3936 | #define I2C_STAT_MONOV(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_MONOV_SHIFT)) & I2C_STAT_MONOV_MASK) | ||
3937 | #define I2C_STAT_MONACTIVE_MASK (0x40000U) | ||
3938 | #define I2C_STAT_MONACTIVE_SHIFT (18U) | ||
3939 | /*! MONACTIVE - Monitor Active flag. Indicates when the Monitor function considers the I 2C bus to | ||
3940 | * be active. Active is defined here as when some Master is on the bus: a bus Start has occurred | ||
3941 | * more recently than a bus Stop. | ||
3942 | * 0b0..Inactive. The Monitor function considers the I2C bus to be inactive. | ||
3943 | * 0b1..Active. The Monitor function considers the I2C bus to be active. | ||
3944 | */ | ||
3945 | #define I2C_STAT_MONACTIVE(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_MONACTIVE_SHIFT)) & I2C_STAT_MONACTIVE_MASK) | ||
3946 | #define I2C_STAT_MONIDLE_MASK (0x80000U) | ||
3947 | #define I2C_STAT_MONIDLE_SHIFT (19U) | ||
3948 | /*! MONIDLE - Monitor Idle flag. This flag is set when the Monitor function sees the I2C bus change | ||
3949 | * from active to inactive. This can be used by software to decide when to process data | ||
3950 | * accumulated by the Monitor function. This flag will cause an interrupt when set if enabled via the | ||
3951 | * INTENSET register. The flag can be cleared by writing a 1 to this bit. | ||
3952 | * 0b0..Not idle. The I2C bus is not idle, or this flag has been cleared by software. | ||
3953 | * 0b1..Idle. The I2C bus has gone idle at least once since the last time this flag was cleared by software. | ||
3954 | */ | ||
3955 | #define I2C_STAT_MONIDLE(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_MONIDLE_SHIFT)) & I2C_STAT_MONIDLE_MASK) | ||
3956 | #define I2C_STAT_EVENTTIMEOUT_MASK (0x1000000U) | ||
3957 | #define I2C_STAT_EVENTTIMEOUT_SHIFT (24U) | ||
3958 | /*! EVENTTIMEOUT - Event Time-out Interrupt flag. Indicates when the time between events has been | ||
3959 | * longer than the time specified by the TIMEOUT register. Events include Start, Stop, and clock | ||
3960 | * edges. The flag is cleared by writing a 1 to this bit. No time-out is created when the I2C-bus | ||
3961 | * is idle. | ||
3962 | * 0b0..No time-out. I2C bus events have not caused a time-out. | ||
3963 | * 0b1..Event time-out. The time between I2C bus events has been longer than the time specified by the TIMEOUT register. | ||
3964 | */ | ||
3965 | #define I2C_STAT_EVENTTIMEOUT(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_EVENTTIMEOUT_SHIFT)) & I2C_STAT_EVENTTIMEOUT_MASK) | ||
3966 | #define I2C_STAT_SCLTIMEOUT_MASK (0x2000000U) | ||
3967 | #define I2C_STAT_SCLTIMEOUT_SHIFT (25U) | ||
3968 | /*! SCLTIMEOUT - SCL Time-out Interrupt flag. Indicates when SCL has remained low longer than the | ||
3969 | * time specific by the TIMEOUT register. The flag is cleared by writing a 1 to this bit. | ||
3970 | * 0b0..No time-out. SCL low time has not caused a time-out. | ||
3971 | * 0b1..Time-out. SCL low time has caused a time-out. | ||
3972 | */ | ||
3973 | #define I2C_STAT_SCLTIMEOUT(x) (((uint32_t)(((uint32_t)(x)) << I2C_STAT_SCLTIMEOUT_SHIFT)) & I2C_STAT_SCLTIMEOUT_MASK) | ||
3974 | /*! @} */ | ||
3975 | |||
3976 | /*! @name INTENSET - Interrupt Enable Set and read register. */ | ||
3977 | /*! @{ */ | ||
3978 | #define I2C_INTENSET_MSTPENDINGEN_MASK (0x1U) | ||
3979 | #define I2C_INTENSET_MSTPENDINGEN_SHIFT (0U) | ||
3980 | /*! MSTPENDINGEN - Master Pending interrupt Enable. | ||
3981 | * 0b0..Disabled. The MstPending interrupt is disabled. | ||
3982 | * 0b1..Enabled. The MstPending interrupt is enabled. | ||
3983 | */ | ||
3984 | #define I2C_INTENSET_MSTPENDINGEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_MSTPENDINGEN_SHIFT)) & I2C_INTENSET_MSTPENDINGEN_MASK) | ||
3985 | #define I2C_INTENSET_MSTARBLOSSEN_MASK (0x10U) | ||
3986 | #define I2C_INTENSET_MSTARBLOSSEN_SHIFT (4U) | ||
3987 | /*! MSTARBLOSSEN - Master Arbitration Loss interrupt Enable. | ||
3988 | * 0b0..Disabled. The MstArbLoss interrupt is disabled. | ||
3989 | * 0b1..Enabled. The MstArbLoss interrupt is enabled. | ||
3990 | */ | ||
3991 | #define I2C_INTENSET_MSTARBLOSSEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_MSTARBLOSSEN_SHIFT)) & I2C_INTENSET_MSTARBLOSSEN_MASK) | ||
3992 | #define I2C_INTENSET_MSTSTSTPERREN_MASK (0x40U) | ||
3993 | #define I2C_INTENSET_MSTSTSTPERREN_SHIFT (6U) | ||
3994 | /*! MSTSTSTPERREN - Master Start/Stop Error interrupt Enable. | ||
3995 | * 0b0..Disabled. The MstStStpErr interrupt is disabled. | ||
3996 | * 0b1..Enabled. The MstStStpErr interrupt is enabled. | ||
3997 | */ | ||
3998 | #define I2C_INTENSET_MSTSTSTPERREN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_MSTSTSTPERREN_SHIFT)) & I2C_INTENSET_MSTSTSTPERREN_MASK) | ||
3999 | #define I2C_INTENSET_SLVPENDINGEN_MASK (0x100U) | ||
4000 | #define I2C_INTENSET_SLVPENDINGEN_SHIFT (8U) | ||
4001 | /*! SLVPENDINGEN - Slave Pending interrupt Enable. | ||
4002 | * 0b0..Disabled. The SlvPending interrupt is disabled. | ||
4003 | * 0b1..Enabled. The SlvPending interrupt is enabled. | ||
4004 | */ | ||
4005 | #define I2C_INTENSET_SLVPENDINGEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_SLVPENDINGEN_SHIFT)) & I2C_INTENSET_SLVPENDINGEN_MASK) | ||
4006 | #define I2C_INTENSET_SLVNOTSTREN_MASK (0x800U) | ||
4007 | #define I2C_INTENSET_SLVNOTSTREN_SHIFT (11U) | ||
4008 | /*! SLVNOTSTREN - Slave Not Stretching interrupt Enable. | ||
4009 | * 0b0..Disabled. The SlvNotStr interrupt is disabled. | ||
4010 | * 0b1..Enabled. The SlvNotStr interrupt is enabled. | ||
4011 | */ | ||
4012 | #define I2C_INTENSET_SLVNOTSTREN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_SLVNOTSTREN_SHIFT)) & I2C_INTENSET_SLVNOTSTREN_MASK) | ||
4013 | #define I2C_INTENSET_SLVDESELEN_MASK (0x8000U) | ||
4014 | #define I2C_INTENSET_SLVDESELEN_SHIFT (15U) | ||
4015 | /*! SLVDESELEN - Slave Deselect interrupt Enable. | ||
4016 | * 0b0..Disabled. The SlvDeSel interrupt is disabled. | ||
4017 | * 0b1..Enabled. The SlvDeSel interrupt is enabled. | ||
4018 | */ | ||
4019 | #define I2C_INTENSET_SLVDESELEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_SLVDESELEN_SHIFT)) & I2C_INTENSET_SLVDESELEN_MASK) | ||
4020 | #define I2C_INTENSET_MONRDYEN_MASK (0x10000U) | ||
4021 | #define I2C_INTENSET_MONRDYEN_SHIFT (16U) | ||
4022 | /*! MONRDYEN - Monitor data Ready interrupt Enable. | ||
4023 | * 0b0..Disabled. The MonRdy interrupt is disabled. | ||
4024 | * 0b1..Enabled. The MonRdy interrupt is enabled. | ||
4025 | */ | ||
4026 | #define I2C_INTENSET_MONRDYEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_MONRDYEN_SHIFT)) & I2C_INTENSET_MONRDYEN_MASK) | ||
4027 | #define I2C_INTENSET_MONOVEN_MASK (0x20000U) | ||
4028 | #define I2C_INTENSET_MONOVEN_SHIFT (17U) | ||
4029 | /*! MONOVEN - Monitor Overrun interrupt Enable. | ||
4030 | * 0b0..Disabled. The MonOv interrupt is disabled. | ||
4031 | * 0b1..Enabled. The MonOv interrupt is enabled. | ||
4032 | */ | ||
4033 | #define I2C_INTENSET_MONOVEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_MONOVEN_SHIFT)) & I2C_INTENSET_MONOVEN_MASK) | ||
4034 | #define I2C_INTENSET_MONIDLEEN_MASK (0x80000U) | ||
4035 | #define I2C_INTENSET_MONIDLEEN_SHIFT (19U) | ||
4036 | /*! MONIDLEEN - Monitor Idle interrupt Enable. | ||
4037 | * 0b0..Disabled. The MonIdle interrupt is disabled. | ||
4038 | * 0b1..Enabled. The MonIdle interrupt is enabled. | ||
4039 | */ | ||
4040 | #define I2C_INTENSET_MONIDLEEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_MONIDLEEN_SHIFT)) & I2C_INTENSET_MONIDLEEN_MASK) | ||
4041 | #define I2C_INTENSET_EVENTTIMEOUTEN_MASK (0x1000000U) | ||
4042 | #define I2C_INTENSET_EVENTTIMEOUTEN_SHIFT (24U) | ||
4043 | /*! EVENTTIMEOUTEN - Event time-out interrupt Enable. | ||
4044 | * 0b0..Disabled. The Event time-out interrupt is disabled. | ||
4045 | * 0b1..Enabled. The Event time-out interrupt is enabled. | ||
4046 | */ | ||
4047 | #define I2C_INTENSET_EVENTTIMEOUTEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_EVENTTIMEOUTEN_SHIFT)) & I2C_INTENSET_EVENTTIMEOUTEN_MASK) | ||
4048 | #define I2C_INTENSET_SCLTIMEOUTEN_MASK (0x2000000U) | ||
4049 | #define I2C_INTENSET_SCLTIMEOUTEN_SHIFT (25U) | ||
4050 | /*! SCLTIMEOUTEN - SCL time-out interrupt Enable. | ||
4051 | * 0b0..Disabled. The SCL time-out interrupt is disabled. | ||
4052 | * 0b1..Enabled. The SCL time-out interrupt is enabled. | ||
4053 | */ | ||
4054 | #define I2C_INTENSET_SCLTIMEOUTEN(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENSET_SCLTIMEOUTEN_SHIFT)) & I2C_INTENSET_SCLTIMEOUTEN_MASK) | ||
4055 | /*! @} */ | ||
4056 | |||
4057 | /*! @name INTENCLR - Interrupt Enable Clear register. */ | ||
4058 | /*! @{ */ | ||
4059 | #define I2C_INTENCLR_MSTPENDINGCLR_MASK (0x1U) | ||
4060 | #define I2C_INTENCLR_MSTPENDINGCLR_SHIFT (0U) | ||
4061 | /*! MSTPENDINGCLR - Master Pending interrupt clear. Writing 1 to this bit clears the corresponding | ||
4062 | * bit in the INTENSET register if implemented. | ||
4063 | */ | ||
4064 | #define I2C_INTENCLR_MSTPENDINGCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_MSTPENDINGCLR_SHIFT)) & I2C_INTENCLR_MSTPENDINGCLR_MASK) | ||
4065 | #define I2C_INTENCLR_MSTARBLOSSCLR_MASK (0x10U) | ||
4066 | #define I2C_INTENCLR_MSTARBLOSSCLR_SHIFT (4U) | ||
4067 | /*! MSTARBLOSSCLR - Master Arbitration Loss interrupt clear. | ||
4068 | */ | ||
4069 | #define I2C_INTENCLR_MSTARBLOSSCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_MSTARBLOSSCLR_SHIFT)) & I2C_INTENCLR_MSTARBLOSSCLR_MASK) | ||
4070 | #define I2C_INTENCLR_MSTSTSTPERRCLR_MASK (0x40U) | ||
4071 | #define I2C_INTENCLR_MSTSTSTPERRCLR_SHIFT (6U) | ||
4072 | /*! MSTSTSTPERRCLR - Master Start/Stop Error interrupt clear. | ||
4073 | */ | ||
4074 | #define I2C_INTENCLR_MSTSTSTPERRCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_MSTSTSTPERRCLR_SHIFT)) & I2C_INTENCLR_MSTSTSTPERRCLR_MASK) | ||
4075 | #define I2C_INTENCLR_SLVPENDINGCLR_MASK (0x100U) | ||
4076 | #define I2C_INTENCLR_SLVPENDINGCLR_SHIFT (8U) | ||
4077 | /*! SLVPENDINGCLR - Slave Pending interrupt clear. | ||
4078 | */ | ||
4079 | #define I2C_INTENCLR_SLVPENDINGCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_SLVPENDINGCLR_SHIFT)) & I2C_INTENCLR_SLVPENDINGCLR_MASK) | ||
4080 | #define I2C_INTENCLR_SLVNOTSTRCLR_MASK (0x800U) | ||
4081 | #define I2C_INTENCLR_SLVNOTSTRCLR_SHIFT (11U) | ||
4082 | /*! SLVNOTSTRCLR - Slave Not Stretching interrupt clear. | ||
4083 | */ | ||
4084 | #define I2C_INTENCLR_SLVNOTSTRCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_SLVNOTSTRCLR_SHIFT)) & I2C_INTENCLR_SLVNOTSTRCLR_MASK) | ||
4085 | #define I2C_INTENCLR_SLVDESELCLR_MASK (0x8000U) | ||
4086 | #define I2C_INTENCLR_SLVDESELCLR_SHIFT (15U) | ||
4087 | /*! SLVDESELCLR - Slave Deselect interrupt clear. | ||
4088 | */ | ||
4089 | #define I2C_INTENCLR_SLVDESELCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_SLVDESELCLR_SHIFT)) & I2C_INTENCLR_SLVDESELCLR_MASK) | ||
4090 | #define I2C_INTENCLR_MONRDYCLR_MASK (0x10000U) | ||
4091 | #define I2C_INTENCLR_MONRDYCLR_SHIFT (16U) | ||
4092 | /*! MONRDYCLR - Monitor data Ready interrupt clear. | ||
4093 | */ | ||
4094 | #define I2C_INTENCLR_MONRDYCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_MONRDYCLR_SHIFT)) & I2C_INTENCLR_MONRDYCLR_MASK) | ||
4095 | #define I2C_INTENCLR_MONOVCLR_MASK (0x20000U) | ||
4096 | #define I2C_INTENCLR_MONOVCLR_SHIFT (17U) | ||
4097 | /*! MONOVCLR - Monitor Overrun interrupt clear. | ||
4098 | */ | ||
4099 | #define I2C_INTENCLR_MONOVCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_MONOVCLR_SHIFT)) & I2C_INTENCLR_MONOVCLR_MASK) | ||
4100 | #define I2C_INTENCLR_MONIDLECLR_MASK (0x80000U) | ||
4101 | #define I2C_INTENCLR_MONIDLECLR_SHIFT (19U) | ||
4102 | /*! MONIDLECLR - Monitor Idle interrupt clear. | ||
4103 | */ | ||
4104 | #define I2C_INTENCLR_MONIDLECLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_MONIDLECLR_SHIFT)) & I2C_INTENCLR_MONIDLECLR_MASK) | ||
4105 | #define I2C_INTENCLR_EVENTTIMEOUTCLR_MASK (0x1000000U) | ||
4106 | #define I2C_INTENCLR_EVENTTIMEOUTCLR_SHIFT (24U) | ||
4107 | /*! EVENTTIMEOUTCLR - Event time-out interrupt clear. | ||
4108 | */ | ||
4109 | #define I2C_INTENCLR_EVENTTIMEOUTCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_EVENTTIMEOUTCLR_SHIFT)) & I2C_INTENCLR_EVENTTIMEOUTCLR_MASK) | ||
4110 | #define I2C_INTENCLR_SCLTIMEOUTCLR_MASK (0x2000000U) | ||
4111 | #define I2C_INTENCLR_SCLTIMEOUTCLR_SHIFT (25U) | ||
4112 | /*! SCLTIMEOUTCLR - SCL time-out interrupt clear. | ||
4113 | */ | ||
4114 | #define I2C_INTENCLR_SCLTIMEOUTCLR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTENCLR_SCLTIMEOUTCLR_SHIFT)) & I2C_INTENCLR_SCLTIMEOUTCLR_MASK) | ||
4115 | /*! @} */ | ||
4116 | |||
4117 | /*! @name TIMEOUT - Time-out value register. */ | ||
4118 | /*! @{ */ | ||
4119 | #define I2C_TIMEOUT_TOMIN_MASK (0xFU) | ||
4120 | #define I2C_TIMEOUT_TOMIN_SHIFT (0U) | ||
4121 | /*! TOMIN - Time-out time value, bottom four bits. These are hard-wired to 0xF. This gives a minimum | ||
4122 | * time-out of 16 I2C function clocks and also a time-out resolution of 16 I2C function clocks. | ||
4123 | */ | ||
4124 | #define I2C_TIMEOUT_TOMIN(x) (((uint32_t)(((uint32_t)(x)) << I2C_TIMEOUT_TOMIN_SHIFT)) & I2C_TIMEOUT_TOMIN_MASK) | ||
4125 | #define I2C_TIMEOUT_TO_MASK (0xFFF0U) | ||
4126 | #define I2C_TIMEOUT_TO_SHIFT (4U) | ||
4127 | /*! TO - Time-out time value. Specifies the time-out interval value in increments of 16 I 2C | ||
4128 | * function clocks, as defined by the CLKDIV register. To change this value while I2C is in operation, | ||
4129 | * disable all time-outs, write a new value to TIMEOUT, then re-enable time-outs. 0x000 = A | ||
4130 | * time-out will occur after 16 counts of the I2C function clock. 0x001 = A time-out will occur after | ||
4131 | * 32 counts of the I2C function clock. 0xFFF = A time-out will occur after 65,536 counts of the | ||
4132 | * I2C function clock. | ||
4133 | */ | ||
4134 | #define I2C_TIMEOUT_TO(x) (((uint32_t)(((uint32_t)(x)) << I2C_TIMEOUT_TO_SHIFT)) & I2C_TIMEOUT_TO_MASK) | ||
4135 | /*! @} */ | ||
4136 | |||
4137 | /*! @name CLKDIV - Clock pre-divider for the entire I2C interface. This determines what time increments are used for the MSTTIME register, and controls some timing of the Slave function. */ | ||
4138 | /*! @{ */ | ||
4139 | #define I2C_CLKDIV_DIVVAL_MASK (0xFFFFU) | ||
4140 | #define I2C_CLKDIV_DIVVAL_SHIFT (0U) | ||
4141 | /*! DIVVAL - This field controls how the Flexcomm clock (FCLK) is used by the I2C functions that | ||
4142 | * need an internal clock in order to operate. 0x0000 = FCLK is used directly by the I2C. 0x0001 = | ||
4143 | * FCLK is divided by 2 before use. 0x0002 = FCLK is divided by 3 before use. 0xFFFF = FCLK is | ||
4144 | * divided by 65,536 before use. | ||
4145 | */ | ||
4146 | #define I2C_CLKDIV_DIVVAL(x) (((uint32_t)(((uint32_t)(x)) << I2C_CLKDIV_DIVVAL_SHIFT)) & I2C_CLKDIV_DIVVAL_MASK) | ||
4147 | /*! @} */ | ||
4148 | |||
4149 | /*! @name INTSTAT - Interrupt Status register for Master, Slave, and Monitor functions. */ | ||
4150 | /*! @{ */ | ||
4151 | #define I2C_INTSTAT_MSTPENDING_MASK (0x1U) | ||
4152 | #define I2C_INTSTAT_MSTPENDING_SHIFT (0U) | ||
4153 | /*! MSTPENDING - Master Pending. | ||
4154 | */ | ||
4155 | #define I2C_INTSTAT_MSTPENDING(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_MSTPENDING_SHIFT)) & I2C_INTSTAT_MSTPENDING_MASK) | ||
4156 | #define I2C_INTSTAT_MSTARBLOSS_MASK (0x10U) | ||
4157 | #define I2C_INTSTAT_MSTARBLOSS_SHIFT (4U) | ||
4158 | /*! MSTARBLOSS - Master Arbitration Loss flag. | ||
4159 | */ | ||
4160 | #define I2C_INTSTAT_MSTARBLOSS(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_MSTARBLOSS_SHIFT)) & I2C_INTSTAT_MSTARBLOSS_MASK) | ||
4161 | #define I2C_INTSTAT_MSTSTSTPERR_MASK (0x40U) | ||
4162 | #define I2C_INTSTAT_MSTSTSTPERR_SHIFT (6U) | ||
4163 | /*! MSTSTSTPERR - Master Start/Stop Error flag. | ||
4164 | */ | ||
4165 | #define I2C_INTSTAT_MSTSTSTPERR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_MSTSTSTPERR_SHIFT)) & I2C_INTSTAT_MSTSTSTPERR_MASK) | ||
4166 | #define I2C_INTSTAT_SLVPENDING_MASK (0x100U) | ||
4167 | #define I2C_INTSTAT_SLVPENDING_SHIFT (8U) | ||
4168 | /*! SLVPENDING - Slave Pending. | ||
4169 | */ | ||
4170 | #define I2C_INTSTAT_SLVPENDING(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_SLVPENDING_SHIFT)) & I2C_INTSTAT_SLVPENDING_MASK) | ||
4171 | #define I2C_INTSTAT_SLVNOTSTR_MASK (0x800U) | ||
4172 | #define I2C_INTSTAT_SLVNOTSTR_SHIFT (11U) | ||
4173 | /*! SLVNOTSTR - Slave Not Stretching status. | ||
4174 | */ | ||
4175 | #define I2C_INTSTAT_SLVNOTSTR(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_SLVNOTSTR_SHIFT)) & I2C_INTSTAT_SLVNOTSTR_MASK) | ||
4176 | #define I2C_INTSTAT_SLVDESEL_MASK (0x8000U) | ||
4177 | #define I2C_INTSTAT_SLVDESEL_SHIFT (15U) | ||
4178 | /*! SLVDESEL - Slave Deselected flag. | ||
4179 | */ | ||
4180 | #define I2C_INTSTAT_SLVDESEL(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_SLVDESEL_SHIFT)) & I2C_INTSTAT_SLVDESEL_MASK) | ||
4181 | #define I2C_INTSTAT_MONRDY_MASK (0x10000U) | ||
4182 | #define I2C_INTSTAT_MONRDY_SHIFT (16U) | ||
4183 | /*! MONRDY - Monitor Ready. | ||
4184 | */ | ||
4185 | #define I2C_INTSTAT_MONRDY(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_MONRDY_SHIFT)) & I2C_INTSTAT_MONRDY_MASK) | ||
4186 | #define I2C_INTSTAT_MONOV_MASK (0x20000U) | ||
4187 | #define I2C_INTSTAT_MONOV_SHIFT (17U) | ||
4188 | /*! MONOV - Monitor Overflow flag. | ||
4189 | */ | ||
4190 | #define I2C_INTSTAT_MONOV(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_MONOV_SHIFT)) & I2C_INTSTAT_MONOV_MASK) | ||
4191 | #define I2C_INTSTAT_MONIDLE_MASK (0x80000U) | ||
4192 | #define I2C_INTSTAT_MONIDLE_SHIFT (19U) | ||
4193 | /*! MONIDLE - Monitor Idle flag. | ||
4194 | */ | ||
4195 | #define I2C_INTSTAT_MONIDLE(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_MONIDLE_SHIFT)) & I2C_INTSTAT_MONIDLE_MASK) | ||
4196 | #define I2C_INTSTAT_EVENTTIMEOUT_MASK (0x1000000U) | ||
4197 | #define I2C_INTSTAT_EVENTTIMEOUT_SHIFT (24U) | ||
4198 | /*! EVENTTIMEOUT - Event time-out Interrupt flag. | ||
4199 | */ | ||
4200 | #define I2C_INTSTAT_EVENTTIMEOUT(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_EVENTTIMEOUT_SHIFT)) & I2C_INTSTAT_EVENTTIMEOUT_MASK) | ||
4201 | #define I2C_INTSTAT_SCLTIMEOUT_MASK (0x2000000U) | ||
4202 | #define I2C_INTSTAT_SCLTIMEOUT_SHIFT (25U) | ||
4203 | /*! SCLTIMEOUT - SCL time-out Interrupt flag. | ||
4204 | */ | ||
4205 | #define I2C_INTSTAT_SCLTIMEOUT(x) (((uint32_t)(((uint32_t)(x)) << I2C_INTSTAT_SCLTIMEOUT_SHIFT)) & I2C_INTSTAT_SCLTIMEOUT_MASK) | ||
4206 | /*! @} */ | ||
4207 | |||
4208 | /*! @name MSTCTL - Master control register. */ | ||
4209 | /*! @{ */ | ||
4210 | #define I2C_MSTCTL_MSTCONTINUE_MASK (0x1U) | ||
4211 | #define I2C_MSTCTL_MSTCONTINUE_SHIFT (0U) | ||
4212 | /*! MSTCONTINUE - Master Continue. This bit is write-only. | ||
4213 | * 0b0..No effect. | ||
4214 | * 0b1..Continue. Informs the Master function to continue to the next operation. This must done after writing | ||
4215 | * transmit data, reading received data, or any other housekeeping related to the next bus operation. | ||
4216 | */ | ||
4217 | #define I2C_MSTCTL_MSTCONTINUE(x) (((uint32_t)(((uint32_t)(x)) << I2C_MSTCTL_MSTCONTINUE_SHIFT)) & I2C_MSTCTL_MSTCONTINUE_MASK) | ||
4218 | #define I2C_MSTCTL_MSTSTART_MASK (0x2U) | ||
4219 | #define I2C_MSTCTL_MSTSTART_SHIFT (1U) | ||
4220 | /*! MSTSTART - Master Start control. This bit is write-only. | ||
4221 | * 0b0..No effect. | ||
4222 | * 0b1..Start. A Start will be generated on the I2C bus at the next allowed time. | ||
4223 | */ | ||
4224 | #define I2C_MSTCTL_MSTSTART(x) (((uint32_t)(((uint32_t)(x)) << I2C_MSTCTL_MSTSTART_SHIFT)) & I2C_MSTCTL_MSTSTART_MASK) | ||
4225 | #define I2C_MSTCTL_MSTSTOP_MASK (0x4U) | ||
4226 | #define I2C_MSTCTL_MSTSTOP_SHIFT (2U) | ||
4227 | /*! MSTSTOP - Master Stop control. This bit is write-only. | ||
4228 | * 0b0..No effect. | ||
4229 | * 0b1..Stop. A Stop will be generated on the I2C bus at the next allowed time, preceded by a NACK to the slave | ||
4230 | * if the master is receiving data from the slave (Master Receiver mode). | ||
4231 | */ | ||
4232 | #define I2C_MSTCTL_MSTSTOP(x) (((uint32_t)(((uint32_t)(x)) << I2C_MSTCTL_MSTSTOP_SHIFT)) & I2C_MSTCTL_MSTSTOP_MASK) | ||
4233 | #define I2C_MSTCTL_MSTDMA_MASK (0x8U) | ||
4234 | #define I2C_MSTCTL_MSTDMA_SHIFT (3U) | ||
4235 | /*! MSTDMA - Master DMA enable. Data operations of the I2C can be performed with DMA. Protocol type | ||
4236 | * operations such as Start, address, Stop, and address match must always be done with software, | ||
4237 | * typically via an interrupt. Address acknowledgement must also be done by software except when | ||
4238 | * the I2C is configured to be HSCAPABLE (and address acknowledgement is handled entirely by | ||
4239 | * hardware) or when Automatic Operation is enabled. When a DMA data transfer is complete, MSTDMA | ||
4240 | * must be cleared prior to beginning the next operation, typically a Start or Stop.This bit is | ||
4241 | * read/write. | ||
4242 | * 0b0..Disable. No DMA requests are generated for master operation. | ||
4243 | * 0b1..Enable. A DMA request is generated for I2C master data operations. When this I2C master is generating | ||
4244 | * Acknowledge bits in Master Receiver mode, the acknowledge is generated automatically. | ||
4245 | */ | ||
4246 | #define I2C_MSTCTL_MSTDMA(x) (((uint32_t)(((uint32_t)(x)) << I2C_MSTCTL_MSTDMA_SHIFT)) & I2C_MSTCTL_MSTDMA_MASK) | ||
4247 | /*! @} */ | ||
4248 | |||
4249 | /*! @name MSTTIME - Master timing configuration. */ | ||
4250 | /*! @{ */ | ||
4251 | #define I2C_MSTTIME_MSTSCLLOW_MASK (0x7U) | ||
4252 | #define I2C_MSTTIME_MSTSCLLOW_SHIFT (0U) | ||
4253 | /*! MSTSCLLOW - Master SCL Low time. Specifies the minimum low time that will be asserted by this | ||
4254 | * master on SCL. Other devices on the bus (masters or slaves) could lengthen this time. This | ||
4255 | * corresponds to the parameter t LOW in the I2C bus specification. I2C bus specification parameters | ||
4256 | * tBUF and tSU;STA have the same values and are also controlled by MSTSCLLOW. | ||
4257 | * 0b000..2 clocks. Minimum SCL low time is 2 clocks of the I2C clock pre-divider. | ||
4258 | * 0b001..3 clocks. Minimum SCL low time is 3 clocks of the I2C clock pre-divider. | ||
4259 | * 0b010..4 clocks. Minimum SCL low time is 4 clocks of the I2C clock pre-divider. | ||
4260 | * 0b011..5 clocks. Minimum SCL low time is 5 clocks of the I2C clock pre-divider. | ||
4261 | * 0b100..6 clocks. Minimum SCL low time is 6 clocks of the I2C clock pre-divider. | ||
4262 | * 0b101..7 clocks. Minimum SCL low time is 7 clocks of the I2C clock pre-divider. | ||
4263 | * 0b110..8 clocks. Minimum SCL low time is 8 clocks of the I2C clock pre-divider. | ||
4264 | * 0b111..9 clocks. Minimum SCL low time is 9 clocks of the I2C clock pre-divider. | ||
4265 | */ | ||
4266 | #define I2C_MSTTIME_MSTSCLLOW(x) (((uint32_t)(((uint32_t)(x)) << I2C_MSTTIME_MSTSCLLOW_SHIFT)) & I2C_MSTTIME_MSTSCLLOW_MASK) | ||
4267 | #define I2C_MSTTIME_MSTSCLHIGH_MASK (0x70U) | ||
4268 | #define I2C_MSTTIME_MSTSCLHIGH_SHIFT (4U) | ||
4269 | /*! MSTSCLHIGH - Master SCL High time. Specifies the minimum high time that will be asserted by this | ||
4270 | * master on SCL. Other masters in a multi-master system could shorten this time. This | ||
4271 | * corresponds to the parameter tHIGH in the I2C bus specification. I2C bus specification parameters | ||
4272 | * tSU;STO and tHD;STA have the same values and are also controlled by MSTSCLHIGH. | ||
4273 | * 0b000..2 clocks. Minimum SCL high time is 2 clock of the I2C clock pre-divider. | ||
4274 | * 0b001..3 clocks. Minimum SCL high time is 3 clocks of the I2C clock pre-divider . | ||
4275 | * 0b010..4 clocks. Minimum SCL high time is 4 clock of the I2C clock pre-divider. | ||
4276 | * 0b011..5 clocks. Minimum SCL high time is 5 clock of the I2C clock pre-divider. | ||
4277 | * 0b100..6 clocks. Minimum SCL high time is 6 clock of the I2C clock pre-divider. | ||
4278 | * 0b101..7 clocks. Minimum SCL high time is 7 clock of the I2C clock pre-divider. | ||
4279 | * 0b110..8 clocks. Minimum SCL high time is 8 clock of the I2C clock pre-divider. | ||
4280 | * 0b111..9 clocks. Minimum SCL high time is 9 clocks of the I2C clock pre-divider. | ||
4281 | */ | ||
4282 | #define I2C_MSTTIME_MSTSCLHIGH(x) (((uint32_t)(((uint32_t)(x)) << I2C_MSTTIME_MSTSCLHIGH_SHIFT)) & I2C_MSTTIME_MSTSCLHIGH_MASK) | ||
4283 | /*! @} */ | ||
4284 | |||
4285 | /*! @name MSTDAT - Combined Master receiver and transmitter data register. */ | ||
4286 | /*! @{ */ | ||
4287 | #define I2C_MSTDAT_DATA_MASK (0xFFU) | ||
4288 | #define I2C_MSTDAT_DATA_SHIFT (0U) | ||
4289 | /*! DATA - Master function data register. Read: read the most recently received data for the Master | ||
4290 | * function. Write: transmit data using the Master function. | ||
4291 | */ | ||
4292 | #define I2C_MSTDAT_DATA(x) (((uint32_t)(((uint32_t)(x)) << I2C_MSTDAT_DATA_SHIFT)) & I2C_MSTDAT_DATA_MASK) | ||
4293 | /*! @} */ | ||
4294 | |||
4295 | /*! @name SLVCTL - Slave control register. */ | ||
4296 | /*! @{ */ | ||
4297 | #define I2C_SLVCTL_SLVCONTINUE_MASK (0x1U) | ||
4298 | #define I2C_SLVCTL_SLVCONTINUE_SHIFT (0U) | ||
4299 | /*! SLVCONTINUE - Slave Continue. | ||
4300 | * 0b0..No effect. | ||
4301 | * 0b1..Continue. Informs the Slave function to continue to the next operation, by clearing the SLVPENDING flag | ||
4302 | * in the STAT register. This must be done after writing transmit data, reading received data, or any other | ||
4303 | * housekeeping related to the next bus operation. Automatic Operation has different requirements. SLVCONTINUE | ||
4304 | * should not be set unless SLVPENDING = 1. | ||
4305 | */ | ||
4306 | #define I2C_SLVCTL_SLVCONTINUE(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVCTL_SLVCONTINUE_SHIFT)) & I2C_SLVCTL_SLVCONTINUE_MASK) | ||
4307 | #define I2C_SLVCTL_SLVNACK_MASK (0x2U) | ||
4308 | #define I2C_SLVCTL_SLVNACK_SHIFT (1U) | ||
4309 | /*! SLVNACK - Slave NACK. | ||
4310 | * 0b0..No effect. | ||
4311 | * 0b1..NACK. Causes the Slave function to NACK the master when the slave is receiving data from the master (Slave Receiver mode). | ||
4312 | */ | ||
4313 | #define I2C_SLVCTL_SLVNACK(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVCTL_SLVNACK_SHIFT)) & I2C_SLVCTL_SLVNACK_MASK) | ||
4314 | #define I2C_SLVCTL_SLVDMA_MASK (0x8U) | ||
4315 | #define I2C_SLVCTL_SLVDMA_SHIFT (3U) | ||
4316 | /*! SLVDMA - Slave DMA enable. | ||
4317 | * 0b0..Disabled. No DMA requests are issued for Slave mode operation. | ||
4318 | * 0b1..Enabled. DMA requests are issued for I2C slave data transmission and reception. | ||
4319 | */ | ||
4320 | #define I2C_SLVCTL_SLVDMA(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVCTL_SLVDMA_SHIFT)) & I2C_SLVCTL_SLVDMA_MASK) | ||
4321 | #define I2C_SLVCTL_AUTOACK_MASK (0x100U) | ||
4322 | #define I2C_SLVCTL_AUTOACK_SHIFT (8U) | ||
4323 | /*! AUTOACK - Automatic Acknowledge.When this bit is set, it will cause an I2C header which matches | ||
4324 | * SLVADR0 and the direction set by AUTOMATCHREAD to be ACKed immediately; this is used with DMA | ||
4325 | * to allow processing of the data without intervention. If this bit is clear and a header | ||
4326 | * matches SLVADR0, the behavior is controlled by AUTONACK in the SLVADR0 register: allowing NACK or | ||
4327 | * interrupt. | ||
4328 | * 0b0..Normal, non-automatic operation. If AUTONACK = 0, an SlvPending interrupt is generated when a matching | ||
4329 | * address is received. If AUTONACK = 1, received addresses are NACKed (ignored). | ||
4330 | * 0b1..A header with matching SLVADR0 and matching direction as set by AUTOMATCHREAD will be ACKed immediately, | ||
4331 | * allowing the master to move on to the data bytes. If the address matches SLVADR0, but the direction does | ||
4332 | * not match AUTOMATCHREAD, the behavior will depend on the AUTONACK bit in the SLVADR0 register: if AUTONACK | ||
4333 | * is set, then it will be Nacked; else if AUTONACK is clear, then a SlvPending interrupt is generated. | ||
4334 | */ | ||
4335 | #define I2C_SLVCTL_AUTOACK(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVCTL_AUTOACK_SHIFT)) & I2C_SLVCTL_AUTOACK_MASK) | ||
4336 | #define I2C_SLVCTL_AUTOMATCHREAD_MASK (0x200U) | ||
4337 | #define I2C_SLVCTL_AUTOMATCHREAD_SHIFT (9U) | ||
4338 | /*! AUTOMATCHREAD - When AUTOACK is set, this bit controls whether it matches a read or write | ||
4339 | * request on the next header with an address matching SLVADR0. Since DMA needs to be configured to | ||
4340 | * match the transfer direction, the direction needs to be specified. This bit allows a direction to | ||
4341 | * be chosen for the next operation. | ||
4342 | * 0b0..The expected next operation in Automatic Mode is an I2C write. | ||
4343 | * 0b1..The expected next operation in Automatic Mode is an I2C read. | ||
4344 | */ | ||
4345 | #define I2C_SLVCTL_AUTOMATCHREAD(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVCTL_AUTOMATCHREAD_SHIFT)) & I2C_SLVCTL_AUTOMATCHREAD_MASK) | ||
4346 | /*! @} */ | ||
4347 | |||
4348 | /*! @name SLVDAT - Combined Slave receiver and transmitter data register. */ | ||
4349 | /*! @{ */ | ||
4350 | #define I2C_SLVDAT_DATA_MASK (0xFFU) | ||
4351 | #define I2C_SLVDAT_DATA_SHIFT (0U) | ||
4352 | /*! DATA - Slave function data register. Read: read the most recently received data for the Slave | ||
4353 | * function. Write: transmit data using the Slave function. | ||
4354 | */ | ||
4355 | #define I2C_SLVDAT_DATA(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVDAT_DATA_SHIFT)) & I2C_SLVDAT_DATA_MASK) | ||
4356 | /*! @} */ | ||
4357 | |||
4358 | /*! @name SLVADR - Slave address register. */ | ||
4359 | /*! @{ */ | ||
4360 | #define I2C_SLVADR_SADISABLE_MASK (0x1U) | ||
4361 | #define I2C_SLVADR_SADISABLE_SHIFT (0U) | ||
4362 | /*! SADISABLE - Slave Address n Disable. | ||
4363 | * 0b0..Enabled. Slave Address n is enabled. | ||
4364 | * 0b1..Ignored Slave Address n is ignored. | ||
4365 | */ | ||
4366 | #define I2C_SLVADR_SADISABLE(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVADR_SADISABLE_SHIFT)) & I2C_SLVADR_SADISABLE_MASK) | ||
4367 | #define I2C_SLVADR_SLVADR_MASK (0xFEU) | ||
4368 | #define I2C_SLVADR_SLVADR_SHIFT (1U) | ||
4369 | /*! SLVADR - Slave Address. Seven bit slave address that is compared to received addresses if enabled. | ||
4370 | */ | ||
4371 | #define I2C_SLVADR_SLVADR(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVADR_SLVADR_SHIFT)) & I2C_SLVADR_SLVADR_MASK) | ||
4372 | #define I2C_SLVADR_AUTONACK_MASK (0x8000U) | ||
4373 | #define I2C_SLVADR_AUTONACK_SHIFT (15U) | ||
4374 | /*! AUTONACK - Automatic NACK operation. Used in conjunction with AUTOACK and AUTOMATCHREAD, allows | ||
4375 | * software to ignore I2C traffic while handling previous I2C data or other operations. | ||
4376 | * 0b0..Normal operation, matching I2C addresses are not ignored. | ||
4377 | * 0b1..Automatic-only mode. All incoming addresses are ignored (NACKed), unless AUTOACK is set, it matches | ||
4378 | * SLVADRn, and AUTOMATCHREAD matches the direction. | ||
4379 | */ | ||
4380 | #define I2C_SLVADR_AUTONACK(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVADR_AUTONACK_SHIFT)) & I2C_SLVADR_AUTONACK_MASK) | ||
4381 | /*! @} */ | ||
4382 | |||
4383 | /* The count of I2C_SLVADR */ | ||
4384 | #define I2C_SLVADR_COUNT (4U) | ||
4385 | |||
4386 | /*! @name SLVQUAL0 - Slave Qualification for address 0. */ | ||
4387 | /*! @{ */ | ||
4388 | #define I2C_SLVQUAL0_QUALMODE0_MASK (0x1U) | ||
4389 | #define I2C_SLVQUAL0_QUALMODE0_SHIFT (0U) | ||
4390 | /*! QUALMODE0 - Qualify mode for slave address 0. | ||
4391 | * 0b0..Mask. The SLVQUAL0 field is used as a logical mask for matching address 0. | ||
4392 | * 0b1..Extend. The SLVQUAL0 field is used to extend address 0 matching in a range of addresses. | ||
4393 | */ | ||
4394 | #define I2C_SLVQUAL0_QUALMODE0(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVQUAL0_QUALMODE0_SHIFT)) & I2C_SLVQUAL0_QUALMODE0_MASK) | ||
4395 | #define I2C_SLVQUAL0_SLVQUAL0_MASK (0xFEU) | ||
4396 | #define I2C_SLVQUAL0_SLVQUAL0_SHIFT (1U) | ||
4397 | /*! SLVQUAL0 - Slave address Qualifier for address 0. A value of 0 causes the address in SLVADR0 to | ||
4398 | * be used as-is, assuming that it is enabled. If QUALMODE0 = 0, any bit in this field which is | ||
4399 | * set to 1 will cause an automatic match of the corresponding bit of the received address when it | ||
4400 | * is compared to the SLVADR0 register. If QUALMODE0 = 1, an address range is matched for | ||
4401 | * address 0. This range extends from the value defined by SLVADR0 to the address defined by SLVQUAL0 | ||
4402 | * (address matches when SLVADR0[7:1] <= received address <= SLVQUAL0[7:1]). | ||
4403 | */ | ||
4404 | #define I2C_SLVQUAL0_SLVQUAL0(x) (((uint32_t)(((uint32_t)(x)) << I2C_SLVQUAL0_SLVQUAL0_SHIFT)) & I2C_SLVQUAL0_SLVQUAL0_MASK) | ||
4405 | /*! @} */ | ||
4406 | |||
4407 | /*! @name MONRXDAT - Monitor receiver data register. */ | ||
4408 | /*! @{ */ | ||
4409 | #define I2C_MONRXDAT_MONRXDAT_MASK (0xFFU) | ||
4410 | #define I2C_MONRXDAT_MONRXDAT_SHIFT (0U) | ||
4411 | /*! MONRXDAT - Monitor function Receiver Data. This reflects every data byte that passes on the I2C pins. | ||
4412 | */ | ||
4413 | #define I2C_MONRXDAT_MONRXDAT(x) (((uint32_t)(((uint32_t)(x)) << I2C_MONRXDAT_MONRXDAT_SHIFT)) & I2C_MONRXDAT_MONRXDAT_MASK) | ||
4414 | #define I2C_MONRXDAT_MONSTART_MASK (0x100U) | ||
4415 | #define I2C_MONRXDAT_MONSTART_SHIFT (8U) | ||
4416 | /*! MONSTART - Monitor Received Start. | ||
4417 | * 0b0..No start detected. The Monitor function has not detected a Start event on the I2C bus. | ||
4418 | * 0b1..Start detected. The Monitor function has detected a Start event on the I2C bus. | ||
4419 | */ | ||
4420 | #define I2C_MONRXDAT_MONSTART(x) (((uint32_t)(((uint32_t)(x)) << I2C_MONRXDAT_MONSTART_SHIFT)) & I2C_MONRXDAT_MONSTART_MASK) | ||
4421 | #define I2C_MONRXDAT_MONRESTART_MASK (0x200U) | ||
4422 | #define I2C_MONRXDAT_MONRESTART_SHIFT (9U) | ||
4423 | /*! MONRESTART - Monitor Received Repeated Start. | ||
4424 | * 0b0..No repeated start detected. The Monitor function has not detected a Repeated Start event on the I2C bus. | ||
4425 | * 0b1..Repeated start detected. The Monitor function has detected a Repeated Start event on the I2C bus. | ||
4426 | */ | ||
4427 | #define I2C_MONRXDAT_MONRESTART(x) (((uint32_t)(((uint32_t)(x)) << I2C_MONRXDAT_MONRESTART_SHIFT)) & I2C_MONRXDAT_MONRESTART_MASK) | ||
4428 | #define I2C_MONRXDAT_MONNACK_MASK (0x400U) | ||
4429 | #define I2C_MONRXDAT_MONNACK_SHIFT (10U) | ||
4430 | /*! MONNACK - Monitor Received NACK. | ||
4431 | * 0b0..Acknowledged. The data currently being provided by the Monitor function was acknowledged by at least one master or slave receiver. | ||
4432 | * 0b1..Not acknowledged. The data currently being provided by the Monitor function was not acknowledged by any receiver. | ||
4433 | */ | ||
4434 | #define I2C_MONRXDAT_MONNACK(x) (((uint32_t)(((uint32_t)(x)) << I2C_MONRXDAT_MONNACK_SHIFT)) & I2C_MONRXDAT_MONNACK_MASK) | ||
4435 | /*! @} */ | ||
4436 | |||
4437 | /*! @name ID - Peripheral identification register. */ | ||
4438 | /*! @{ */ | ||
4439 | #define I2C_ID_APERTURE_MASK (0xFFU) | ||
4440 | #define I2C_ID_APERTURE_SHIFT (0U) | ||
4441 | /*! APERTURE - Aperture: encoded as (aperture size/4K) -1, so 0x00 means a 4K aperture. | ||
4442 | */ | ||
4443 | #define I2C_ID_APERTURE(x) (((uint32_t)(((uint32_t)(x)) << I2C_ID_APERTURE_SHIFT)) & I2C_ID_APERTURE_MASK) | ||
4444 | #define I2C_ID_MINOR_REV_MASK (0xF00U) | ||
4445 | #define I2C_ID_MINOR_REV_SHIFT (8U) | ||
4446 | /*! MINOR_REV - Minor revision of module implementation. | ||
4447 | */ | ||
4448 | #define I2C_ID_MINOR_REV(x) (((uint32_t)(((uint32_t)(x)) << I2C_ID_MINOR_REV_SHIFT)) & I2C_ID_MINOR_REV_MASK) | ||
4449 | #define I2C_ID_MAJOR_REV_MASK (0xF000U) | ||
4450 | #define I2C_ID_MAJOR_REV_SHIFT (12U) | ||
4451 | /*! MAJOR_REV - Major revision of module implementation. | ||
4452 | */ | ||
4453 | #define I2C_ID_MAJOR_REV(x) (((uint32_t)(((uint32_t)(x)) << I2C_ID_MAJOR_REV_SHIFT)) & I2C_ID_MAJOR_REV_MASK) | ||
4454 | #define I2C_ID_ID_MASK (0xFFFF0000U) | ||
4455 | #define I2C_ID_ID_SHIFT (16U) | ||
4456 | /*! ID - Module identifier for the selected function. | ||
4457 | */ | ||
4458 | #define I2C_ID_ID(x) (((uint32_t)(((uint32_t)(x)) << I2C_ID_ID_SHIFT)) & I2C_ID_ID_MASK) | ||
4459 | /*! @} */ | ||
4460 | |||
4461 | |||
4462 | /*! | ||
4463 | * @} | ||
4464 | */ /* end of group I2C_Register_Masks */ | ||
4465 | |||
4466 | |||
4467 | /* I2C - Peripheral instance base addresses */ | ||
4468 | /** Peripheral I2C0 base address */ | ||
4469 | #define I2C0_BASE (0x40086000u) | ||
4470 | /** Peripheral I2C0 base pointer */ | ||
4471 | #define I2C0 ((I2C_Type *)I2C0_BASE) | ||
4472 | /** Peripheral I2C1 base address */ | ||
4473 | #define I2C1_BASE (0x40087000u) | ||
4474 | /** Peripheral I2C1 base pointer */ | ||
4475 | #define I2C1 ((I2C_Type *)I2C1_BASE) | ||
4476 | /** Peripheral I2C2 base address */ | ||
4477 | #define I2C2_BASE (0x40088000u) | ||
4478 | /** Peripheral I2C2 base pointer */ | ||
4479 | #define I2C2 ((I2C_Type *)I2C2_BASE) | ||
4480 | /** Peripheral I2C3 base address */ | ||
4481 | #define I2C3_BASE (0x40089000u) | ||
4482 | /** Peripheral I2C3 base pointer */ | ||
4483 | #define I2C3 ((I2C_Type *)I2C3_BASE) | ||
4484 | /** Peripheral I2C4 base address */ | ||
4485 | #define I2C4_BASE (0x4008A000u) | ||
4486 | /** Peripheral I2C4 base pointer */ | ||
4487 | #define I2C4 ((I2C_Type *)I2C4_BASE) | ||
4488 | /** Peripheral I2C5 base address */ | ||
4489 | #define I2C5_BASE (0x40096000u) | ||
4490 | /** Peripheral I2C5 base pointer */ | ||
4491 | #define I2C5 ((I2C_Type *)I2C5_BASE) | ||
4492 | /** Peripheral I2C6 base address */ | ||
4493 | #define I2C6_BASE (0x40097000u) | ||
4494 | /** Peripheral I2C6 base pointer */ | ||
4495 | #define I2C6 ((I2C_Type *)I2C6_BASE) | ||
4496 | /** Peripheral I2C7 base address */ | ||
4497 | #define I2C7_BASE (0x40098000u) | ||
4498 | /** Peripheral I2C7 base pointer */ | ||
4499 | #define I2C7 ((I2C_Type *)I2C7_BASE) | ||
4500 | /** Peripheral I2C8 base address */ | ||
4501 | #define I2C8_BASE (0x40099000u) | ||
4502 | /** Peripheral I2C8 base pointer */ | ||
4503 | #define I2C8 ((I2C_Type *)I2C8_BASE) | ||
4504 | /** Peripheral I2C9 base address */ | ||
4505 | #define I2C9_BASE (0x4009A000u) | ||
4506 | /** Peripheral I2C9 base pointer */ | ||
4507 | #define I2C9 ((I2C_Type *)I2C9_BASE) | ||
4508 | /** Array initializer of I2C peripheral base addresses */ | ||
4509 | #define I2C_BASE_ADDRS { I2C0_BASE, I2C1_BASE, I2C2_BASE, I2C3_BASE, I2C4_BASE, I2C5_BASE, I2C6_BASE, I2C7_BASE, I2C8_BASE, I2C9_BASE } | ||
4510 | /** Array initializer of I2C peripheral base pointers */ | ||
4511 | #define I2C_BASE_PTRS { I2C0, I2C1, I2C2, I2C3, I2C4, I2C5, I2C6, I2C7, I2C8, I2C9 } | ||
4512 | /** Interrupt vectors for the I2C peripheral type */ | ||
4513 | #define I2C_IRQS { FLEXCOMM0_IRQn, FLEXCOMM1_IRQn, FLEXCOMM2_IRQn, FLEXCOMM3_IRQn, FLEXCOMM4_IRQn, FLEXCOMM5_IRQn, FLEXCOMM6_IRQn, FLEXCOMM7_IRQn, FLEXCOMM8_IRQn, FLEXCOMM9_IRQn } | ||
4514 | |||
4515 | /*! | ||
4516 | * @} | ||
4517 | */ /* end of group I2C_Peripheral_Access_Layer */ | ||
4518 | |||
4519 | |||
4520 | /* ---------------------------------------------------------------------------- | ||
4521 | -- I2S Peripheral Access Layer | ||
4522 | ---------------------------------------------------------------------------- */ | ||
4523 | |||
4524 | /*! | ||
4525 | * @addtogroup I2S_Peripheral_Access_Layer I2S Peripheral Access Layer | ||
4526 | * @{ | ||
4527 | */ | ||
4528 | |||
4529 | /** I2S - Register Layout Typedef */ | ||
4530 | typedef struct { | ||
4531 | uint8_t RESERVED_0[3072]; | ||
4532 | __IO uint32_t CFG1; /**< Configuration register 1 for the primary channel pair., offset: 0xC00 */ | ||
4533 | __IO uint32_t CFG2; /**< Configuration register 2 for the primary channel pair., offset: 0xC04 */ | ||
4534 | __IO uint32_t STAT; /**< Status register for the primary channel pair., offset: 0xC08 */ | ||
4535 | uint8_t RESERVED_1[16]; | ||
4536 | __IO uint32_t DIV; /**< Clock divider, used by all channel pairs., offset: 0xC1C */ | ||
4537 | struct { /* offset: 0xC20, array step: 0x20 */ | ||
4538 | __IO uint32_t PCFG1; /**< Configuration register 1 for channel pair, array offset: 0xC20, array step: 0x20 */ | ||
4539 | __IO uint32_t PCFG2; /**< Configuration register 2 for channel pair, array offset: 0xC24, array step: 0x20 */ | ||
4540 | __IO uint32_t PSTAT; /**< Status register for channel pair, array offset: 0xC28, array step: 0x20 */ | ||
4541 | uint8_t RESERVED_0[20]; | ||
4542 | } SECCHANNEL[3]; | ||
4543 | uint8_t RESERVED_2[384]; | ||
4544 | __IO uint32_t FIFOCFG; /**< FIFO configuration and enable register., offset: 0xE00 */ | ||
4545 | __IO uint32_t FIFOSTAT; /**< FIFO status register., offset: 0xE04 */ | ||
4546 | __IO uint32_t FIFOTRIG; /**< FIFO trigger settings for interrupt and DMA request., offset: 0xE08 */ | ||
4547 | uint8_t RESERVED_3[4]; | ||
4548 | __IO uint32_t FIFOINTENSET; /**< FIFO interrupt enable set (enable) and read register., offset: 0xE10 */ | ||
4549 | __IO uint32_t FIFOINTENCLR; /**< FIFO interrupt enable clear (disable) and read register., offset: 0xE14 */ | ||
4550 | __I uint32_t FIFOINTSTAT; /**< FIFO interrupt status register., offset: 0xE18 */ | ||
4551 | uint8_t RESERVED_4[4]; | ||
4552 | __O uint32_t FIFOWR; /**< FIFO write data., offset: 0xE20 */ | ||
4553 | __O uint32_t FIFOWR48H; /**< FIFO write data for upper data bits. May only be used if the I2S is configured for 2x 24-bit data and not using DMA., offset: 0xE24 */ | ||
4554 | uint8_t RESERVED_5[8]; | ||
4555 | __I uint32_t FIFORD; /**< FIFO read data., offset: 0xE30 */ | ||
4556 | __I uint32_t FIFORD48H; /**< FIFO read data for upper data bits. May only be used if the I2S is configured for 2x 24-bit data and not using DMA., offset: 0xE34 */ | ||
4557 | uint8_t RESERVED_6[8]; | ||
4558 | __I uint32_t FIFORDNOPOP; /**< FIFO data read with no FIFO pop., offset: 0xE40 */ | ||
4559 | __I uint32_t FIFORD48HNOPOP; /**< FIFO data read for upper data bits with no FIFO pop. May only be used if the I2S is configured for 2x 24-bit data and not using DMA., offset: 0xE44 */ | ||
4560 | uint8_t RESERVED_7[4020]; | ||
4561 | __I uint32_t ID; /**< I2S Module identification, offset: 0x1DFC */ | ||
4562 | } I2S_Type; | ||
4563 | |||
4564 | /* ---------------------------------------------------------------------------- | ||
4565 | -- I2S Register Masks | ||
4566 | ---------------------------------------------------------------------------- */ | ||
4567 | |||
4568 | /*! | ||
4569 | * @addtogroup I2S_Register_Masks I2S Register Masks | ||
4570 | * @{ | ||
4571 | */ | ||
4572 | |||
4573 | /*! @name CFG1 - Configuration register 1 for the primary channel pair. */ | ||
4574 | /*! @{ */ | ||
4575 | #define I2S_CFG1_MAINENABLE_MASK (0x1U) | ||
4576 | #define I2S_CFG1_MAINENABLE_SHIFT (0U) | ||
4577 | /*! MAINENABLE - Main enable for I 2S function in this Flexcomm | ||
4578 | * 0b0..All I 2S channel pairs in this Flexcomm are disabled and the internal state machines, counters, and flags | ||
4579 | * are reset. No other channel pairs can be enabled. | ||
4580 | * 0b1..This I 2S channel pair is enabled. Other channel pairs in this Flexcomm may be enabled in their individual PAIRENABLE bits. | ||
4581 | */ | ||
4582 | #define I2S_CFG1_MAINENABLE(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_MAINENABLE_SHIFT)) & I2S_CFG1_MAINENABLE_MASK) | ||
4583 | #define I2S_CFG1_DATAPAUSE_MASK (0x2U) | ||
4584 | #define I2S_CFG1_DATAPAUSE_SHIFT (1U) | ||
4585 | /*! DATAPAUSE - Data flow Pause. Allows pausing data flow between the I2S serializer/deserializer | ||
4586 | * and the FIFO. This could be done in order to change streams, or while restarting after a data | ||
4587 | * underflow or overflow. When paused, FIFO operations can be done without corrupting data that is | ||
4588 | * in the process of being sent or received. Once a data pause has been requested, the interface | ||
4589 | * may need to complete sending data that was in progress before interrupting the flow of data. | ||
4590 | * Software must check that the pause is actually in effect before taking action. This is done by | ||
4591 | * monitoring the DATAPAUSED flag in the STAT register. When DATAPAUSE is cleared, data transfer | ||
4592 | * will resume at the beginning of the next frame. | ||
4593 | * 0b0..Normal operation, or resuming normal operation at the next frame if the I2S has already been paused. | ||
4594 | * 0b1..A pause in the data flow is being requested. It is in effect when DATAPAUSED in STAT = 1. | ||
4595 | */ | ||
4596 | #define I2S_CFG1_DATAPAUSE(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_DATAPAUSE_SHIFT)) & I2S_CFG1_DATAPAUSE_MASK) | ||
4597 | #define I2S_CFG1_PAIRCOUNT_MASK (0xCU) | ||
4598 | #define I2S_CFG1_PAIRCOUNT_SHIFT (2U) | ||
4599 | /*! PAIRCOUNT - Provides the number of I2S channel pairs in this Flexcomm This is a read-only field | ||
4600 | * whose value may be different in other Flexcomms. 00 = there is 1 I2S channel pair in this | ||
4601 | * Flexcomm. 01 = there are 2 I2S channel pairs in this Flexcomm. 10 = there are 3 I2S channel pairs | ||
4602 | * in this Flexcomm. 11 = there are 4 I2S channel pairs in this Flexcomm. | ||
4603 | * 0b00..1 I2S channel pairs in this flexcomm | ||
4604 | * 0b01..2 I2S channel pairs in this flexcomm | ||
4605 | * 0b10..3 I2S channel pairs in this flexcomm | ||
4606 | * 0b11..4 I2S channel pairs in this flexcomm | ||
4607 | */ | ||
4608 | #define I2S_CFG1_PAIRCOUNT(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_PAIRCOUNT_SHIFT)) & I2S_CFG1_PAIRCOUNT_MASK) | ||
4609 | #define I2S_CFG1_MSTSLVCFG_MASK (0x30U) | ||
4610 | #define I2S_CFG1_MSTSLVCFG_SHIFT (4U) | ||
4611 | /*! MSTSLVCFG - Master / slave configuration selection, determining how SCK and WS are used by all channel pairs in this Flexcomm. | ||
4612 | * 0b00..Normal slave mode, the default mode. SCK and WS are received from a master and used to transmit or receive data. | ||
4613 | * 0b01..WS synchronized master. WS is received from another master and used to synchronize the generation of | ||
4614 | * SCK, when divided from the Flexcomm function clock. | ||
4615 | * 0b10..Master using an existing SCK. SCK is received and used directly to generate WS, as well as transmitting or receiving data. | ||
4616 | * 0b11..Normal master mode. SCK and WS are generated so they can be sent to one or more slave devices. | ||
4617 | */ | ||
4618 | #define I2S_CFG1_MSTSLVCFG(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_MSTSLVCFG_SHIFT)) & I2S_CFG1_MSTSLVCFG_MASK) | ||
4619 | #define I2S_CFG1_MODE_MASK (0xC0U) | ||
4620 | #define I2S_CFG1_MODE_SHIFT (6U) | ||
4621 | /*! MODE - Selects the basic I2S operating mode. Other configurations modify this to obtain all | ||
4622 | * supported cases. See Formats and modes for examples. | ||
4623 | * 0b00..I2S mode a.k.a. 'classic' mode. WS has a 50% duty cycle, with (for each enabled channel pair) one piece | ||
4624 | * of left channel data occurring during the first phase, and one pieces of right channel data occurring | ||
4625 | * during the second phase. In this mode, the data region begins one clock after the leading WS edge for the | ||
4626 | * frame. For a 50% WS duty cycle, FRAMELEN must define an even number of I2S clocks for the frame. If | ||
4627 | * FRAMELEN defines an odd number of clocks per frame, the extra clock will occur on the right. | ||
4628 | * 0b01..DSP mode where WS has a 50% duty cycle. See remark for mode 0. | ||
4629 | * 0b10..DSP mode where WS has a one clock long pulse at the beginning of each data frame. | ||
4630 | * 0b11..DSP mode where WS has a one data slot long pulse at the beginning of each data frame. | ||
4631 | */ | ||
4632 | #define I2S_CFG1_MODE(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_MODE_SHIFT)) & I2S_CFG1_MODE_MASK) | ||
4633 | #define I2S_CFG1_RIGHTLOW_MASK (0x100U) | ||
4634 | #define I2S_CFG1_RIGHTLOW_SHIFT (8U) | ||
4635 | /*! RIGHTLOW - Right channel data is in the Low portion of FIFO data. Essentially, this swaps left | ||
4636 | * and right channel data as it is transferred to or from the FIFO. This bit is not used if the | ||
4637 | * data width is greater than 24 bits or if PDMDATA = 1. Note that if the ONECHANNEL field (bit 10 | ||
4638 | * of this register) = 1, the one channel to be used is the nominally the left channel. POSITION | ||
4639 | * can still place that data in the frame where right channel data is normally located. if all | ||
4640 | * enabled channel pairs have ONECHANNEL = 1, then RIGHTLOW = 1 is not allowed. | ||
4641 | * 0b0..The right channel is taken from the high part of the FIFO data. For example, when data is 16 bits, FIFO | ||
4642 | * bits 31:16 are used for the right channel. | ||
4643 | * 0b1..The right channel is taken from the low part of the FIFO data. For example, when data is 16 bits, FIFO | ||
4644 | * bits 15:0 are used for the right channel. | ||
4645 | */ | ||
4646 | #define I2S_CFG1_RIGHTLOW(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_RIGHTLOW_SHIFT)) & I2S_CFG1_RIGHTLOW_MASK) | ||
4647 | #define I2S_CFG1_LEFTJUST_MASK (0x200U) | ||
4648 | #define I2S_CFG1_LEFTJUST_SHIFT (9U) | ||
4649 | /*! LEFTJUST - Left Justify data. | ||
4650 | * 0b0..Data is transferred between the FIFO and the I2S serializer/deserializer right justified, i.e. starting | ||
4651 | * from bit 0 and continuing to the position defined by DATALEN. This would correspond to right justified data | ||
4652 | * in the stream on the data bus. | ||
4653 | * 0b1..Data is transferred between the FIFO and the I2S serializer/deserializer left justified, i.e. starting | ||
4654 | * from the MSB of the FIFO entry and continuing for the number of bits defined by DATALEN. This would | ||
4655 | * correspond to left justified data in the stream on the data bus. | ||
4656 | */ | ||
4657 | #define I2S_CFG1_LEFTJUST(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_LEFTJUST_SHIFT)) & I2S_CFG1_LEFTJUST_MASK) | ||
4658 | #define I2S_CFG1_ONECHANNEL_MASK (0x400U) | ||
4659 | #define I2S_CFG1_ONECHANNEL_SHIFT (10U) | ||
4660 | /*! ONECHANNEL - Single channel mode. Applies to both transmit and receive. This configuration bit | ||
4661 | * applies only to the first I2S channel pair. Other channel pairs may select this mode | ||
4662 | * independently in their separate CFG1 registers. | ||
4663 | * 0b0..I2S data for this channel pair is treated as left and right channels. | ||
4664 | * 0b1..I2S data for this channel pair is treated as a single channel, functionally the left channel for this | ||
4665 | * pair. In mode 0 only, the right side of the frame begins at POSITION = 0x100. This is because mode 0 makes a | ||
4666 | * clear distinction between the left and right sides of the frame. When ONECHANNEL = 1, the single channel | ||
4667 | * of data may be placed on the right by setting POSITION to 0x100 + the data position within the right side | ||
4668 | * (e.g. 0x108 would place data starting at the 8th clock after the middle of the frame). In other modes, data | ||
4669 | * for the single channel of data is placed at the clock defined by POSITION. | ||
4670 | */ | ||
4671 | #define I2S_CFG1_ONECHANNEL(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_ONECHANNEL_SHIFT)) & I2S_CFG1_ONECHANNEL_MASK) | ||
4672 | #define I2S_CFG1_PDMDATA_MASK (0x800U) | ||
4673 | #define I2S_CFG1_PDMDATA_SHIFT (11U) | ||
4674 | /*! PDMDATA - PDM Data selection. This bit controls the data source for I2S transmit, and cannot be | ||
4675 | * set in Rx mode. This bit only has an effect if the device the Flexcomm resides in includes a | ||
4676 | * D-Mic subsystem. For the LPC5411x, this bit applies only to Flexcomm 7. | ||
4677 | * 0b0..Normal operation, data is transferred to or from the Flexcomm FIFO. | ||
4678 | * 0b1..The data source is the D-Mic subsystem. When PDMDATA = 1, only the primary channel pair can be used in | ||
4679 | * this Flexcomm. If ONECHANNEL = 1, only the PDM left data is used. the WS rate must match the Fs (sample | ||
4680 | * rate) of the D-Mic decimator. A rate mismatch will at some point cause the I2S to overrun or underrun. | ||
4681 | */ | ||
4682 | #define I2S_CFG1_PDMDATA(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_PDMDATA_SHIFT)) & I2S_CFG1_PDMDATA_MASK) | ||
4683 | #define I2S_CFG1_SCK_POL_MASK (0x1000U) | ||
4684 | #define I2S_CFG1_SCK_POL_SHIFT (12U) | ||
4685 | /*! SCK_POL - SCK polarity. | ||
4686 | * 0b0..Data is launched on SCK falling edges and sampled on SCK rising edges (standard for I2S). | ||
4687 | * 0b1..Data is launched on SCK rising edges and sampled on SCK falling edges. | ||
4688 | */ | ||
4689 | #define I2S_CFG1_SCK_POL(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_SCK_POL_SHIFT)) & I2S_CFG1_SCK_POL_MASK) | ||
4690 | #define I2S_CFG1_WS_POL_MASK (0x2000U) | ||
4691 | #define I2S_CFG1_WS_POL_SHIFT (13U) | ||
4692 | /*! WS_POL - WS polarity. | ||
4693 | * 0b0..Data frames begin at a falling edge of WS (standard for classic I2S). | ||
4694 | * 0b1..WS is inverted, resulting in a data frame beginning at a rising edge of WS (standard for most 'non-classic' variations of I2S). | ||
4695 | */ | ||
4696 | #define I2S_CFG1_WS_POL(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_WS_POL_SHIFT)) & I2S_CFG1_WS_POL_MASK) | ||
4697 | #define I2S_CFG1_DATALEN_MASK (0x1F0000U) | ||
4698 | #define I2S_CFG1_DATALEN_SHIFT (16U) | ||
4699 | /*! DATALEN - Data Length, minus 1 encoded, defines the number of data bits to be transmitted or | ||
4700 | * received for all I2S channel pairs in this Flexcomm. Note that data is only driven to or received | ||
4701 | * from SDA for the number of bits defined by DATALEN. DATALEN is also used in these ways by the | ||
4702 | * I2S: Determines the size of data transfers between the FIFO and the I2S | ||
4703 | * serializer/deserializer. See FIFO buffer configurations and usage In mode 1, 2, and 3, determines the location of | ||
4704 | * right data following left data in the frame. In mode 3 (where WS has a one data slot long pulse | ||
4705 | * at the beginning of each data frame) determines the duration of the WS pulse. Values: 0x00 to | ||
4706 | * 0x02 = not supported 0x03 = data is 4 bits in length 0x04 = data is 5 bits in length 0x1F = | ||
4707 | * data is 32 bits in length | ||
4708 | */ | ||
4709 | #define I2S_CFG1_DATALEN(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG1_DATALEN_SHIFT)) & I2S_CFG1_DATALEN_MASK) | ||
4710 | /*! @} */ | ||
4711 | |||
4712 | /*! @name CFG2 - Configuration register 2 for the primary channel pair. */ | ||
4713 | /*! @{ */ | ||
4714 | #define I2S_CFG2_FRAMELEN_MASK (0x1FFU) | ||
4715 | #define I2S_CFG2_FRAMELEN_SHIFT (0U) | ||
4716 | /*! FRAMELEN - Frame Length, minus 1 encoded, defines the number of clocks and data bits in the | ||
4717 | * frames that this channel pair participates in. See Frame format. 0x000 to 0x002 = not supported | ||
4718 | * 0x003 = frame is 4 bits in total length 0x004 = frame is 5 bits in total length 0x1FF = frame is | ||
4719 | * 512 bits in total length if FRAMELEN is an defines an odd length frame (e.g. 33 clocks) in | ||
4720 | * mode 0 or 1, the extra clock appears in the right half. When MODE = 3, FRAMELEN must be larger | ||
4721 | * than DATALEN in order for the WS pulse to be generated correctly. | ||
4722 | */ | ||
4723 | #define I2S_CFG2_FRAMELEN(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG2_FRAMELEN_SHIFT)) & I2S_CFG2_FRAMELEN_MASK) | ||
4724 | #define I2S_CFG2_POSITION_MASK (0x1FF0000U) | ||
4725 | #define I2S_CFG2_POSITION_SHIFT (16U) | ||
4726 | /*! POSITION - Data Position. Defines the location within the frame of the data for this channel | ||
4727 | * pair. POSITION + DATALEN must be less than FRAMELEN. See Frame format. When MODE = 0, POSITION | ||
4728 | * defines the location of data in both the left phase and right phase, starting one clock after | ||
4729 | * the WS edge. In other modes, POSITION defines the location of data within the entire frame. | ||
4730 | * ONECHANNEL = 1 while MODE = 0 is a special case, see the description of ONECHANNEL. The | ||
4731 | * combination of DATALEN and the POSITION fields of all channel pairs must be made such that the channels | ||
4732 | * do not overlap within the frame. 0x000 = data begins at bit position 0 (the first bit | ||
4733 | * position) within the frame or WS phase. 0x001 = data begins at bit position 1 within the frame or WS | ||
4734 | * phase. 0x002 = data begins at bit position 2 within the frame or WS phase. | ||
4735 | */ | ||
4736 | #define I2S_CFG2_POSITION(x) (((uint32_t)(((uint32_t)(x)) << I2S_CFG2_POSITION_SHIFT)) & I2S_CFG2_POSITION_MASK) | ||
4737 | /*! @} */ | ||
4738 | |||
4739 | /*! @name STAT - Status register for the primary channel pair. */ | ||
4740 | /*! @{ */ | ||
4741 | #define I2S_STAT_BUSY_MASK (0x1U) | ||
4742 | #define I2S_STAT_BUSY_SHIFT (0U) | ||
4743 | /*! BUSY - Busy status for the primary channel pair. Other BUSY flags may be found in the STAT register for each channel pair. | ||
4744 | * 0b0..The transmitter/receiver for channel pair is currently idle. | ||
4745 | * 0b1..The transmitter/receiver for channel pair is currently processing data. | ||
4746 | */ | ||
4747 | #define I2S_STAT_BUSY(x) (((uint32_t)(((uint32_t)(x)) << I2S_STAT_BUSY_SHIFT)) & I2S_STAT_BUSY_MASK) | ||
4748 | #define I2S_STAT_SLVFRMERR_MASK (0x2U) | ||
4749 | #define I2S_STAT_SLVFRMERR_SHIFT (1U) | ||
4750 | /*! SLVFRMERR - Slave Frame Error flag. This applies when at least one channel pair is operating as | ||
4751 | * a slave. An error indicates that the incoming WS signal did not transition as expected due to | ||
4752 | * a mismatch between FRAMELEN and the actual incoming I2S stream. | ||
4753 | * 0b0..No error has been recorded. | ||
4754 | * 0b1..An error has been recorded for some channel pair that is operating in slave mode. ERROR is cleared by writing a 1 to this bit position. | ||
4755 | */ | ||
4756 | #define I2S_STAT_SLVFRMERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_STAT_SLVFRMERR_SHIFT)) & I2S_STAT_SLVFRMERR_MASK) | ||
4757 | #define I2S_STAT_LR_MASK (0x4U) | ||
4758 | #define I2S_STAT_LR_SHIFT (2U) | ||
4759 | /*! LR - Left/Right indication. This flag is considered to be a debugging aid and is not expected to | ||
4760 | * be used by an I2S driver. Valid when one channel pair is busy. Indicates left or right data | ||
4761 | * being processed for the currently busy channel pair. | ||
4762 | * 0b0..Left channel. | ||
4763 | * 0b1..Right channel. | ||
4764 | */ | ||
4765 | #define I2S_STAT_LR(x) (((uint32_t)(((uint32_t)(x)) << I2S_STAT_LR_SHIFT)) & I2S_STAT_LR_MASK) | ||
4766 | #define I2S_STAT_DATAPAUSED_MASK (0x8U) | ||
4767 | #define I2S_STAT_DATAPAUSED_SHIFT (3U) | ||
4768 | /*! DATAPAUSED - Data Paused status flag. Applies to all I2S channels | ||
4769 | * 0b0..Data is not currently paused. A data pause may have been requested but is not yet in force, waiting for | ||
4770 | * an allowed pause point. Refer to the description of the DATAPAUSE control bit in the CFG1 register. | ||
4771 | * 0b1..A data pause has been requested and is now in force. | ||
4772 | */ | ||
4773 | #define I2S_STAT_DATAPAUSED(x) (((uint32_t)(((uint32_t)(x)) << I2S_STAT_DATAPAUSED_SHIFT)) & I2S_STAT_DATAPAUSED_MASK) | ||
4774 | /*! @} */ | ||
4775 | |||
4776 | /*! @name DIV - Clock divider, used by all channel pairs. */ | ||
4777 | /*! @{ */ | ||
4778 | #define I2S_DIV_DIV_MASK (0xFFFU) | ||
4779 | #define I2S_DIV_DIV_SHIFT (0U) | ||
4780 | /*! DIV - This field controls how this I2S block uses the Flexcomm function clock. 0x000 = The | ||
4781 | * Flexcomm function clock is used directly. 0x001 = The Flexcomm function clock is divided by 2. | ||
4782 | * 0x002 = The Flexcomm function clock is divided by 3. 0xFFF = The Flexcomm function clock is | ||
4783 | * divided by 4,096. | ||
4784 | */ | ||
4785 | #define I2S_DIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << I2S_DIV_DIV_SHIFT)) & I2S_DIV_DIV_MASK) | ||
4786 | /*! @} */ | ||
4787 | |||
4788 | /*! @name SECCHANNEL_PCFG1 - Configuration register 1 for channel pair */ | ||
4789 | /*! @{ */ | ||
4790 | #define I2S_SECCHANNEL_PCFG1_PAIRENABLE_MASK (0x1U) | ||
4791 | #define I2S_SECCHANNEL_PCFG1_PAIRENABLE_SHIFT (0U) | ||
4792 | /*! PAIRENABLE - Enable for this channel pair.. | ||
4793 | */ | ||
4794 | #define I2S_SECCHANNEL_PCFG1_PAIRENABLE(x) (((uint32_t)(((uint32_t)(x)) << I2S_SECCHANNEL_PCFG1_PAIRENABLE_SHIFT)) & I2S_SECCHANNEL_PCFG1_PAIRENABLE_MASK) | ||
4795 | #define I2S_SECCHANNEL_PCFG1_ONECHANNEL_MASK (0x400U) | ||
4796 | #define I2S_SECCHANNEL_PCFG1_ONECHANNEL_SHIFT (10U) | ||
4797 | /*! ONECHANNEL - Single channel mode. | ||
4798 | */ | ||
4799 | #define I2S_SECCHANNEL_PCFG1_ONECHANNEL(x) (((uint32_t)(((uint32_t)(x)) << I2S_SECCHANNEL_PCFG1_ONECHANNEL_SHIFT)) & I2S_SECCHANNEL_PCFG1_ONECHANNEL_MASK) | ||
4800 | /*! @} */ | ||
4801 | |||
4802 | /* The count of I2S_SECCHANNEL_PCFG1 */ | ||
4803 | #define I2S_SECCHANNEL_PCFG1_COUNT (3U) | ||
4804 | |||
4805 | /*! @name SECCHANNEL_PCFG2 - Configuration register 2 for channel pair */ | ||
4806 | /*! @{ */ | ||
4807 | #define I2S_SECCHANNEL_PCFG2_POSITION_MASK (0x1FF0000U) | ||
4808 | #define I2S_SECCHANNEL_PCFG2_POSITION_SHIFT (16U) | ||
4809 | /*! POSITION - Data Position. | ||
4810 | */ | ||
4811 | #define I2S_SECCHANNEL_PCFG2_POSITION(x) (((uint32_t)(((uint32_t)(x)) << I2S_SECCHANNEL_PCFG2_POSITION_SHIFT)) & I2S_SECCHANNEL_PCFG2_POSITION_MASK) | ||
4812 | /*! @} */ | ||
4813 | |||
4814 | /* The count of I2S_SECCHANNEL_PCFG2 */ | ||
4815 | #define I2S_SECCHANNEL_PCFG2_COUNT (3U) | ||
4816 | |||
4817 | /*! @name SECCHANNEL_PSTAT - Status register for channel pair */ | ||
4818 | /*! @{ */ | ||
4819 | #define I2S_SECCHANNEL_PSTAT_BUSY_MASK (0x1U) | ||
4820 | #define I2S_SECCHANNEL_PSTAT_BUSY_SHIFT (0U) | ||
4821 | /*! BUSY - Busy status for this channel pair. | ||
4822 | */ | ||
4823 | #define I2S_SECCHANNEL_PSTAT_BUSY(x) (((uint32_t)(((uint32_t)(x)) << I2S_SECCHANNEL_PSTAT_BUSY_SHIFT)) & I2S_SECCHANNEL_PSTAT_BUSY_MASK) | ||
4824 | #define I2S_SECCHANNEL_PSTAT_SLVFRMERR_MASK (0x2U) | ||
4825 | #define I2S_SECCHANNEL_PSTAT_SLVFRMERR_SHIFT (1U) | ||
4826 | /*! SLVFRMERR - Save Frame Error flag. | ||
4827 | */ | ||
4828 | #define I2S_SECCHANNEL_PSTAT_SLVFRMERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_SECCHANNEL_PSTAT_SLVFRMERR_SHIFT)) & I2S_SECCHANNEL_PSTAT_SLVFRMERR_MASK) | ||
4829 | #define I2S_SECCHANNEL_PSTAT_LR_MASK (0x4U) | ||
4830 | #define I2S_SECCHANNEL_PSTAT_LR_SHIFT (2U) | ||
4831 | /*! LR - Left/Right indication. | ||
4832 | */ | ||
4833 | #define I2S_SECCHANNEL_PSTAT_LR(x) (((uint32_t)(((uint32_t)(x)) << I2S_SECCHANNEL_PSTAT_LR_SHIFT)) & I2S_SECCHANNEL_PSTAT_LR_MASK) | ||
4834 | #define I2S_SECCHANNEL_PSTAT_DATAPAUSED_MASK (0x8U) | ||
4835 | #define I2S_SECCHANNEL_PSTAT_DATAPAUSED_SHIFT (3U) | ||
4836 | /*! DATAPAUSED - Data Paused status flag. | ||
4837 | */ | ||
4838 | #define I2S_SECCHANNEL_PSTAT_DATAPAUSED(x) (((uint32_t)(((uint32_t)(x)) << I2S_SECCHANNEL_PSTAT_DATAPAUSED_SHIFT)) & I2S_SECCHANNEL_PSTAT_DATAPAUSED_MASK) | ||
4839 | /*! @} */ | ||
4840 | |||
4841 | /* The count of I2S_SECCHANNEL_PSTAT */ | ||
4842 | #define I2S_SECCHANNEL_PSTAT_COUNT (3U) | ||
4843 | |||
4844 | /*! @name FIFOCFG - FIFO configuration and enable register. */ | ||
4845 | /*! @{ */ | ||
4846 | #define I2S_FIFOCFG_ENABLETX_MASK (0x1U) | ||
4847 | #define I2S_FIFOCFG_ENABLETX_SHIFT (0U) | ||
4848 | /*! ENABLETX - Enable the transmit FIFO. | ||
4849 | * 0b0..The transmit FIFO is not enabled. | ||
4850 | * 0b1..The transmit FIFO is enabled. | ||
4851 | */ | ||
4852 | #define I2S_FIFOCFG_ENABLETX(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_ENABLETX_SHIFT)) & I2S_FIFOCFG_ENABLETX_MASK) | ||
4853 | #define I2S_FIFOCFG_ENABLERX_MASK (0x2U) | ||
4854 | #define I2S_FIFOCFG_ENABLERX_SHIFT (1U) | ||
4855 | /*! ENABLERX - Enable the receive FIFO. | ||
4856 | * 0b0..The receive FIFO is not enabled. | ||
4857 | * 0b1..The receive FIFO is enabled. | ||
4858 | */ | ||
4859 | #define I2S_FIFOCFG_ENABLERX(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_ENABLERX_SHIFT)) & I2S_FIFOCFG_ENABLERX_MASK) | ||
4860 | #define I2S_FIFOCFG_TXI2SE0_MASK (0x4U) | ||
4861 | #define I2S_FIFOCFG_TXI2SE0_SHIFT (2U) | ||
4862 | /*! TXI2SE0 - Transmit I2S empty 0. Determines the value sent by the I2S in transmit mode if the TX | ||
4863 | * FIFO becomes empty. This value is sent repeatedly until the I2S is paused, the error is | ||
4864 | * cleared, new data is provided, and the I2S is un-paused. | ||
4865 | * 0b0..If the TX FIFO becomes empty, the last value is sent. This setting may be used when the data length is 24 | ||
4866 | * bits or less, or when MONO = 1 for this channel pair. | ||
4867 | * 0b1..If the TX FIFO becomes empty, 0 is sent. Use if the data length is greater than 24 bits or if zero fill is preferred. | ||
4868 | */ | ||
4869 | #define I2S_FIFOCFG_TXI2SE0(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_TXI2SE0_SHIFT)) & I2S_FIFOCFG_TXI2SE0_MASK) | ||
4870 | #define I2S_FIFOCFG_PACK48_MASK (0x8U) | ||
4871 | #define I2S_FIFOCFG_PACK48_SHIFT (3U) | ||
4872 | /*! PACK48 - Packing format for 48-bit data. This relates to how data is entered into or taken from the FIFO by software or DMA. | ||
4873 | * 0b0..48-bit I2S FIFO entries are handled as all 24-bit values. | ||
4874 | * 0b1..48-bit I2S FIFO entries are handled as alternating 32-bit and 16-bit values. | ||
4875 | */ | ||
4876 | #define I2S_FIFOCFG_PACK48(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_PACK48_SHIFT)) & I2S_FIFOCFG_PACK48_MASK) | ||
4877 | #define I2S_FIFOCFG_SIZE_MASK (0x30U) | ||
4878 | #define I2S_FIFOCFG_SIZE_SHIFT (4U) | ||
4879 | /*! SIZE - FIFO size configuration. This is a read-only field. 0x0 = FIFO is configured as 16 | ||
4880 | * entries of 8 bits. 0x1, 0x2, 0x3 = not applicable to USART. | ||
4881 | */ | ||
4882 | #define I2S_FIFOCFG_SIZE(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_SIZE_SHIFT)) & I2S_FIFOCFG_SIZE_MASK) | ||
4883 | #define I2S_FIFOCFG_DMATX_MASK (0x1000U) | ||
4884 | #define I2S_FIFOCFG_DMATX_SHIFT (12U) | ||
4885 | /*! DMATX - DMA configuration for transmit. | ||
4886 | * 0b0..DMA is not used for the transmit function. | ||
4887 | * 0b1..Trigger DMA for the transmit function if the FIFO is not full. Generally, data interrupts would be disabled if DMA is enabled. | ||
4888 | */ | ||
4889 | #define I2S_FIFOCFG_DMATX(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_DMATX_SHIFT)) & I2S_FIFOCFG_DMATX_MASK) | ||
4890 | #define I2S_FIFOCFG_DMARX_MASK (0x2000U) | ||
4891 | #define I2S_FIFOCFG_DMARX_SHIFT (13U) | ||
4892 | /*! DMARX - DMA configuration for receive. | ||
4893 | * 0b0..DMA is not used for the receive function. | ||
4894 | * 0b1..Trigger DMA for the receive function if the FIFO is not empty. Generally, data interrupts would be disabled if DMA is enabled. | ||
4895 | */ | ||
4896 | #define I2S_FIFOCFG_DMARX(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_DMARX_SHIFT)) & I2S_FIFOCFG_DMARX_MASK) | ||
4897 | #define I2S_FIFOCFG_WAKETX_MASK (0x4000U) | ||
4898 | #define I2S_FIFOCFG_WAKETX_SHIFT (14U) | ||
4899 | /*! WAKETX - Wake-up for transmit FIFO level. This allows the device to be woken from reduced power | ||
4900 | * modes (up to power-down, as long as the peripheral function works in that power mode) without | ||
4901 | * enabling the TXLVL interrupt. Only DMA wakes up, processes data, and goes back to sleep. The | ||
4902 | * CPU will remain stopped until woken by another cause, such as DMA completion. See Hardware | ||
4903 | * Wake-up control register. | ||
4904 | * 0b0..Only enabled interrupts will wake up the device form reduced power modes. | ||
4905 | * 0b1..A device wake-up for DMA will occur if the transmit FIFO level reaches the value specified by TXLVL in | ||
4906 | * FIFOTRIG, even when the TXLVL interrupt is not enabled. | ||
4907 | */ | ||
4908 | #define I2S_FIFOCFG_WAKETX(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_WAKETX_SHIFT)) & I2S_FIFOCFG_WAKETX_MASK) | ||
4909 | #define I2S_FIFOCFG_WAKERX_MASK (0x8000U) | ||
4910 | #define I2S_FIFOCFG_WAKERX_SHIFT (15U) | ||
4911 | /*! WAKERX - Wake-up for receive FIFO level. This allows the device to be woken from reduced power | ||
4912 | * modes (up to power-down, as long as the peripheral function works in that power mode) without | ||
4913 | * enabling the TXLVL interrupt. Only DMA wakes up, processes data, and goes back to sleep. The | ||
4914 | * CPU will remain stopped until woken by another cause, such as DMA completion. See Hardware | ||
4915 | * Wake-up control register. | ||
4916 | * 0b0..Only enabled interrupts will wake up the device form reduced power modes. | ||
4917 | * 0b1..A device wake-up for DMA will occur if the receive FIFO level reaches the value specified by RXLVL in | ||
4918 | * FIFOTRIG, even when the RXLVL interrupt is not enabled. | ||
4919 | */ | ||
4920 | #define I2S_FIFOCFG_WAKERX(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_WAKERX_SHIFT)) & I2S_FIFOCFG_WAKERX_MASK) | ||
4921 | #define I2S_FIFOCFG_EMPTYTX_MASK (0x10000U) | ||
4922 | #define I2S_FIFOCFG_EMPTYTX_SHIFT (16U) | ||
4923 | /*! EMPTYTX - Empty command for the transmit FIFO. When a 1 is written to this bit, the TX FIFO is emptied. | ||
4924 | */ | ||
4925 | #define I2S_FIFOCFG_EMPTYTX(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_EMPTYTX_SHIFT)) & I2S_FIFOCFG_EMPTYTX_MASK) | ||
4926 | #define I2S_FIFOCFG_EMPTYRX_MASK (0x20000U) | ||
4927 | #define I2S_FIFOCFG_EMPTYRX_SHIFT (17U) | ||
4928 | /*! EMPTYRX - Empty command for the receive FIFO. When a 1 is written to this bit, the RX FIFO is emptied. | ||
4929 | */ | ||
4930 | #define I2S_FIFOCFG_EMPTYRX(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOCFG_EMPTYRX_SHIFT)) & I2S_FIFOCFG_EMPTYRX_MASK) | ||
4931 | /*! @} */ | ||
4932 | |||
4933 | /*! @name FIFOSTAT - FIFO status register. */ | ||
4934 | /*! @{ */ | ||
4935 | #define I2S_FIFOSTAT_TXERR_MASK (0x1U) | ||
4936 | #define I2S_FIFOSTAT_TXERR_SHIFT (0U) | ||
4937 | /*! TXERR - TX FIFO error. Will be set if a transmit FIFO error occurs. This could be an overflow | ||
4938 | * caused by pushing data into a full FIFO, or by an underflow if the FIFO is empty when data is | ||
4939 | * needed. Cleared by writing a 1 to this bit. | ||
4940 | */ | ||
4941 | #define I2S_FIFOSTAT_TXERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_TXERR_SHIFT)) & I2S_FIFOSTAT_TXERR_MASK) | ||
4942 | #define I2S_FIFOSTAT_RXERR_MASK (0x2U) | ||
4943 | #define I2S_FIFOSTAT_RXERR_SHIFT (1U) | ||
4944 | /*! RXERR - RX FIFO error. Will be set if a receive FIFO overflow occurs, caused by software or DMA | ||
4945 | * not emptying the FIFO fast enough. Cleared by writing a 1 to this bit. | ||
4946 | */ | ||
4947 | #define I2S_FIFOSTAT_RXERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_RXERR_SHIFT)) & I2S_FIFOSTAT_RXERR_MASK) | ||
4948 | #define I2S_FIFOSTAT_PERINT_MASK (0x8U) | ||
4949 | #define I2S_FIFOSTAT_PERINT_SHIFT (3U) | ||
4950 | /*! PERINT - Peripheral interrupt. When 1, this indicates that the peripheral function has asserted | ||
4951 | * an interrupt. The details can be found by reading the peripheral's STAT register. | ||
4952 | */ | ||
4953 | #define I2S_FIFOSTAT_PERINT(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_PERINT_SHIFT)) & I2S_FIFOSTAT_PERINT_MASK) | ||
4954 | #define I2S_FIFOSTAT_TXEMPTY_MASK (0x10U) | ||
4955 | #define I2S_FIFOSTAT_TXEMPTY_SHIFT (4U) | ||
4956 | /*! TXEMPTY - Transmit FIFO empty. When 1, the transmit FIFO is empty. The peripheral may still be processing the last piece of data. | ||
4957 | */ | ||
4958 | #define I2S_FIFOSTAT_TXEMPTY(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_TXEMPTY_SHIFT)) & I2S_FIFOSTAT_TXEMPTY_MASK) | ||
4959 | #define I2S_FIFOSTAT_TXNOTFULL_MASK (0x20U) | ||
4960 | #define I2S_FIFOSTAT_TXNOTFULL_SHIFT (5U) | ||
4961 | /*! TXNOTFULL - Transmit FIFO not full. When 1, the transmit FIFO is not full, so more data can be | ||
4962 | * written. When 0, the transmit FIFO is full and another write would cause it to overflow. | ||
4963 | */ | ||
4964 | #define I2S_FIFOSTAT_TXNOTFULL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_TXNOTFULL_SHIFT)) & I2S_FIFOSTAT_TXNOTFULL_MASK) | ||
4965 | #define I2S_FIFOSTAT_RXNOTEMPTY_MASK (0x40U) | ||
4966 | #define I2S_FIFOSTAT_RXNOTEMPTY_SHIFT (6U) | ||
4967 | /*! RXNOTEMPTY - Receive FIFO not empty. When 1, the receive FIFO is not empty, so data can be read. When 0, the receive FIFO is empty. | ||
4968 | */ | ||
4969 | #define I2S_FIFOSTAT_RXNOTEMPTY(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_RXNOTEMPTY_SHIFT)) & I2S_FIFOSTAT_RXNOTEMPTY_MASK) | ||
4970 | #define I2S_FIFOSTAT_RXFULL_MASK (0x80U) | ||
4971 | #define I2S_FIFOSTAT_RXFULL_SHIFT (7U) | ||
4972 | /*! RXFULL - Receive FIFO full. When 1, the receive FIFO is full. Data needs to be read out to | ||
4973 | * prevent the peripheral from causing an overflow. | ||
4974 | */ | ||
4975 | #define I2S_FIFOSTAT_RXFULL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_RXFULL_SHIFT)) & I2S_FIFOSTAT_RXFULL_MASK) | ||
4976 | #define I2S_FIFOSTAT_TXLVL_MASK (0x1F00U) | ||
4977 | #define I2S_FIFOSTAT_TXLVL_SHIFT (8U) | ||
4978 | /*! TXLVL - Transmit FIFO current level. A 0 means the TX FIFO is currently empty, and the TXEMPTY | ||
4979 | * and TXNOTFULL flags will be 1. Other values tell how much data is actually in the TX FIFO at | ||
4980 | * the point where the read occurs. If the TX FIFO is full, the TXEMPTY and TXNOTFULL flags will be | ||
4981 | * 0. | ||
4982 | */ | ||
4983 | #define I2S_FIFOSTAT_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_TXLVL_SHIFT)) & I2S_FIFOSTAT_TXLVL_MASK) | ||
4984 | #define I2S_FIFOSTAT_RXLVL_MASK (0x1F0000U) | ||
4985 | #define I2S_FIFOSTAT_RXLVL_SHIFT (16U) | ||
4986 | /*! RXLVL - Receive FIFO current level. A 0 means the RX FIFO is currently empty, and the RXFULL and | ||
4987 | * RXNOTEMPTY flags will be 0. Other values tell how much data is actually in the RX FIFO at the | ||
4988 | * point where the read occurs. If the RX FIFO is full, the RXFULL and RXNOTEMPTY flags will be | ||
4989 | * 1. | ||
4990 | */ | ||
4991 | #define I2S_FIFOSTAT_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOSTAT_RXLVL_SHIFT)) & I2S_FIFOSTAT_RXLVL_MASK) | ||
4992 | /*! @} */ | ||
4993 | |||
4994 | /*! @name FIFOTRIG - FIFO trigger settings for interrupt and DMA request. */ | ||
4995 | /*! @{ */ | ||
4996 | #define I2S_FIFOTRIG_TXLVLENA_MASK (0x1U) | ||
4997 | #define I2S_FIFOTRIG_TXLVLENA_SHIFT (0U) | ||
4998 | /*! TXLVLENA - Transmit FIFO level trigger enable. This trigger will become an interrupt if enabled | ||
4999 | * in FIFOINTENSET, or a DMA trigger if DMATX in FIFOCFG is set. | ||
5000 | * 0b0..Transmit FIFO level does not generate a FIFO level trigger. | ||
5001 | * 0b1..An trigger will be generated if the transmit FIFO level reaches the value specified by the TXLVL field in this register. | ||
5002 | */ | ||
5003 | #define I2S_FIFOTRIG_TXLVLENA(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOTRIG_TXLVLENA_SHIFT)) & I2S_FIFOTRIG_TXLVLENA_MASK) | ||
5004 | #define I2S_FIFOTRIG_RXLVLENA_MASK (0x2U) | ||
5005 | #define I2S_FIFOTRIG_RXLVLENA_SHIFT (1U) | ||
5006 | /*! RXLVLENA - Receive FIFO level trigger enable. This trigger will become an interrupt if enabled | ||
5007 | * in FIFOINTENSET, or a DMA trigger if DMARX in FIFOCFG is set. | ||
5008 | * 0b0..Receive FIFO level does not generate a FIFO level trigger. | ||
5009 | * 0b1..An trigger will be generated if the receive FIFO level reaches the value specified by the RXLVL field in this register. | ||
5010 | */ | ||
5011 | #define I2S_FIFOTRIG_RXLVLENA(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOTRIG_RXLVLENA_SHIFT)) & I2S_FIFOTRIG_RXLVLENA_MASK) | ||
5012 | #define I2S_FIFOTRIG_TXLVL_MASK (0xF00U) | ||
5013 | #define I2S_FIFOTRIG_TXLVL_SHIFT (8U) | ||
5014 | /*! TXLVL - Transmit FIFO level trigger point. This field is used only when TXLVLENA = 1. If enabled | ||
5015 | * to do so, the FIFO level can wake up the device just enough to perform DMA, then return to | ||
5016 | * the reduced power mode. See Hardware Wake-up control register. 0 = trigger when the TX FIFO | ||
5017 | * becomes empty. 1 = trigger when the TX FIFO level decreases to one entry. 15 = trigger when the TX | ||
5018 | * FIFO level decreases to 15 entries (is no longer full). | ||
5019 | */ | ||
5020 | #define I2S_FIFOTRIG_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOTRIG_TXLVL_SHIFT)) & I2S_FIFOTRIG_TXLVL_MASK) | ||
5021 | #define I2S_FIFOTRIG_RXLVL_MASK (0xF0000U) | ||
5022 | #define I2S_FIFOTRIG_RXLVL_SHIFT (16U) | ||
5023 | /*! RXLVL - Receive FIFO level trigger point. The RX FIFO level is checked when a new piece of data | ||
5024 | * is received. This field is used only when RXLVLENA = 1. If enabled to do so, the FIFO level | ||
5025 | * can wake up the device just enough to perform DMA, then return to the reduced power mode. See | ||
5026 | * Hardware Wake-up control register. 0 = trigger when the RX FIFO has received one entry (is no | ||
5027 | * longer empty). 1 = trigger when the RX FIFO has received two entries. 15 = trigger when the RX | ||
5028 | * FIFO has received 16 entries (has become full). | ||
5029 | */ | ||
5030 | #define I2S_FIFOTRIG_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOTRIG_RXLVL_SHIFT)) & I2S_FIFOTRIG_RXLVL_MASK) | ||
5031 | /*! @} */ | ||
5032 | |||
5033 | /*! @name FIFOINTENSET - FIFO interrupt enable set (enable) and read register. */ | ||
5034 | /*! @{ */ | ||
5035 | #define I2S_FIFOINTENSET_TXERR_MASK (0x1U) | ||
5036 | #define I2S_FIFOINTENSET_TXERR_SHIFT (0U) | ||
5037 | /*! TXERR - Determines whether an interrupt occurs when a transmit error occurs, based on the TXERR flag in the FIFOSTAT register. | ||
5038 | * 0b0..No interrupt will be generated for a transmit error. | ||
5039 | * 0b1..An interrupt will be generated when a transmit error occurs. | ||
5040 | */ | ||
5041 | #define I2S_FIFOINTENSET_TXERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTENSET_TXERR_SHIFT)) & I2S_FIFOINTENSET_TXERR_MASK) | ||
5042 | #define I2S_FIFOINTENSET_RXERR_MASK (0x2U) | ||
5043 | #define I2S_FIFOINTENSET_RXERR_SHIFT (1U) | ||
5044 | /*! RXERR - Determines whether an interrupt occurs when a receive error occurs, based on the RXERR flag in the FIFOSTAT register. | ||
5045 | * 0b0..No interrupt will be generated for a receive error. | ||
5046 | * 0b1..An interrupt will be generated when a receive error occurs. | ||
5047 | */ | ||
5048 | #define I2S_FIFOINTENSET_RXERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTENSET_RXERR_SHIFT)) & I2S_FIFOINTENSET_RXERR_MASK) | ||
5049 | #define I2S_FIFOINTENSET_TXLVL_MASK (0x4U) | ||
5050 | #define I2S_FIFOINTENSET_TXLVL_SHIFT (2U) | ||
5051 | /*! TXLVL - Determines whether an interrupt occurs when a the transmit FIFO reaches the level | ||
5052 | * specified by the TXLVL field in the FIFOTRIG register. | ||
5053 | * 0b0..No interrupt will be generated based on the TX FIFO level. | ||
5054 | * 0b1..If TXLVLENA in the FIFOTRIG register = 1, an interrupt will be generated when the TX FIFO level decreases | ||
5055 | * to the level specified by TXLVL in the FIFOTRIG register. | ||
5056 | */ | ||
5057 | #define I2S_FIFOINTENSET_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTENSET_TXLVL_SHIFT)) & I2S_FIFOINTENSET_TXLVL_MASK) | ||
5058 | #define I2S_FIFOINTENSET_RXLVL_MASK (0x8U) | ||
5059 | #define I2S_FIFOINTENSET_RXLVL_SHIFT (3U) | ||
5060 | /*! RXLVL - Determines whether an interrupt occurs when a the receive FIFO reaches the level | ||
5061 | * specified by the TXLVL field in the FIFOTRIG register. | ||
5062 | * 0b0..No interrupt will be generated based on the RX FIFO level. | ||
5063 | * 0b1..If RXLVLENA in the FIFOTRIG register = 1, an interrupt will be generated when the when the RX FIFO level | ||
5064 | * increases to the level specified by RXLVL in the FIFOTRIG register. | ||
5065 | */ | ||
5066 | #define I2S_FIFOINTENSET_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTENSET_RXLVL_SHIFT)) & I2S_FIFOINTENSET_RXLVL_MASK) | ||
5067 | /*! @} */ | ||
5068 | |||
5069 | /*! @name FIFOINTENCLR - FIFO interrupt enable clear (disable) and read register. */ | ||
5070 | /*! @{ */ | ||
5071 | #define I2S_FIFOINTENCLR_TXERR_MASK (0x1U) | ||
5072 | #define I2S_FIFOINTENCLR_TXERR_SHIFT (0U) | ||
5073 | /*! TXERR - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
5074 | */ | ||
5075 | #define I2S_FIFOINTENCLR_TXERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTENCLR_TXERR_SHIFT)) & I2S_FIFOINTENCLR_TXERR_MASK) | ||
5076 | #define I2S_FIFOINTENCLR_RXERR_MASK (0x2U) | ||
5077 | #define I2S_FIFOINTENCLR_RXERR_SHIFT (1U) | ||
5078 | /*! RXERR - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
5079 | */ | ||
5080 | #define I2S_FIFOINTENCLR_RXERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTENCLR_RXERR_SHIFT)) & I2S_FIFOINTENCLR_RXERR_MASK) | ||
5081 | #define I2S_FIFOINTENCLR_TXLVL_MASK (0x4U) | ||
5082 | #define I2S_FIFOINTENCLR_TXLVL_SHIFT (2U) | ||
5083 | /*! TXLVL - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
5084 | */ | ||
5085 | #define I2S_FIFOINTENCLR_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTENCLR_TXLVL_SHIFT)) & I2S_FIFOINTENCLR_TXLVL_MASK) | ||
5086 | #define I2S_FIFOINTENCLR_RXLVL_MASK (0x8U) | ||
5087 | #define I2S_FIFOINTENCLR_RXLVL_SHIFT (3U) | ||
5088 | /*! RXLVL - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
5089 | */ | ||
5090 | #define I2S_FIFOINTENCLR_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTENCLR_RXLVL_SHIFT)) & I2S_FIFOINTENCLR_RXLVL_MASK) | ||
5091 | /*! @} */ | ||
5092 | |||
5093 | /*! @name FIFOINTSTAT - FIFO interrupt status register. */ | ||
5094 | /*! @{ */ | ||
5095 | #define I2S_FIFOINTSTAT_TXERR_MASK (0x1U) | ||
5096 | #define I2S_FIFOINTSTAT_TXERR_SHIFT (0U) | ||
5097 | /*! TXERR - TX FIFO error. | ||
5098 | */ | ||
5099 | #define I2S_FIFOINTSTAT_TXERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTSTAT_TXERR_SHIFT)) & I2S_FIFOINTSTAT_TXERR_MASK) | ||
5100 | #define I2S_FIFOINTSTAT_RXERR_MASK (0x2U) | ||
5101 | #define I2S_FIFOINTSTAT_RXERR_SHIFT (1U) | ||
5102 | /*! RXERR - RX FIFO error. | ||
5103 | */ | ||
5104 | #define I2S_FIFOINTSTAT_RXERR(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTSTAT_RXERR_SHIFT)) & I2S_FIFOINTSTAT_RXERR_MASK) | ||
5105 | #define I2S_FIFOINTSTAT_TXLVL_MASK (0x4U) | ||
5106 | #define I2S_FIFOINTSTAT_TXLVL_SHIFT (2U) | ||
5107 | /*! TXLVL - Transmit FIFO level interrupt. | ||
5108 | */ | ||
5109 | #define I2S_FIFOINTSTAT_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTSTAT_TXLVL_SHIFT)) & I2S_FIFOINTSTAT_TXLVL_MASK) | ||
5110 | #define I2S_FIFOINTSTAT_RXLVL_MASK (0x8U) | ||
5111 | #define I2S_FIFOINTSTAT_RXLVL_SHIFT (3U) | ||
5112 | /*! RXLVL - Receive FIFO level interrupt. | ||
5113 | */ | ||
5114 | #define I2S_FIFOINTSTAT_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTSTAT_RXLVL_SHIFT)) & I2S_FIFOINTSTAT_RXLVL_MASK) | ||
5115 | #define I2S_FIFOINTSTAT_PERINT_MASK (0x10U) | ||
5116 | #define I2S_FIFOINTSTAT_PERINT_SHIFT (4U) | ||
5117 | /*! PERINT - Peripheral interrupt. | ||
5118 | */ | ||
5119 | #define I2S_FIFOINTSTAT_PERINT(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOINTSTAT_PERINT_SHIFT)) & I2S_FIFOINTSTAT_PERINT_MASK) | ||
5120 | /*! @} */ | ||
5121 | |||
5122 | /*! @name FIFOWR - FIFO write data. */ | ||
5123 | /*! @{ */ | ||
5124 | #define I2S_FIFOWR_TXDATA_MASK (0xFFFFFFFFU) | ||
5125 | #define I2S_FIFOWR_TXDATA_SHIFT (0U) | ||
5126 | /*! TXDATA - Transmit data to the FIFO. The number of bits used depends on configuration details. | ||
5127 | */ | ||
5128 | #define I2S_FIFOWR_TXDATA(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOWR_TXDATA_SHIFT)) & I2S_FIFOWR_TXDATA_MASK) | ||
5129 | /*! @} */ | ||
5130 | |||
5131 | /*! @name FIFOWR48H - FIFO write data for upper data bits. May only be used if the I2S is configured for 2x 24-bit data and not using DMA. */ | ||
5132 | /*! @{ */ | ||
5133 | #define I2S_FIFOWR48H_TXDATA_MASK (0xFFFFFFU) | ||
5134 | #define I2S_FIFOWR48H_TXDATA_SHIFT (0U) | ||
5135 | /*! TXDATA - Transmit data to the FIFO. Whether this register is used and the number of bits used depends on configuration details. | ||
5136 | */ | ||
5137 | #define I2S_FIFOWR48H_TXDATA(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFOWR48H_TXDATA_SHIFT)) & I2S_FIFOWR48H_TXDATA_MASK) | ||
5138 | /*! @} */ | ||
5139 | |||
5140 | /*! @name FIFORD - FIFO read data. */ | ||
5141 | /*! @{ */ | ||
5142 | #define I2S_FIFORD_RXDATA_MASK (0xFFFFFFFFU) | ||
5143 | #define I2S_FIFORD_RXDATA_SHIFT (0U) | ||
5144 | /*! RXDATA - Received data from the FIFO. The number of bits used depends on configuration details. | ||
5145 | */ | ||
5146 | #define I2S_FIFORD_RXDATA(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFORD_RXDATA_SHIFT)) & I2S_FIFORD_RXDATA_MASK) | ||
5147 | /*! @} */ | ||
5148 | |||
5149 | /*! @name FIFORD48H - FIFO read data for upper data bits. May only be used if the I2S is configured for 2x 24-bit data and not using DMA. */ | ||
5150 | /*! @{ */ | ||
5151 | #define I2S_FIFORD48H_RXDATA_MASK (0xFFFFFFU) | ||
5152 | #define I2S_FIFORD48H_RXDATA_SHIFT (0U) | ||
5153 | /*! RXDATA - Received data from the FIFO. Whether this register is used and the number of bits used depends on configuration details. | ||
5154 | */ | ||
5155 | #define I2S_FIFORD48H_RXDATA(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFORD48H_RXDATA_SHIFT)) & I2S_FIFORD48H_RXDATA_MASK) | ||
5156 | /*! @} */ | ||
5157 | |||
5158 | /*! @name FIFORDNOPOP - FIFO data read with no FIFO pop. */ | ||
5159 | /*! @{ */ | ||
5160 | #define I2S_FIFORDNOPOP_RXDATA_MASK (0xFFFFFFFFU) | ||
5161 | #define I2S_FIFORDNOPOP_RXDATA_SHIFT (0U) | ||
5162 | /*! RXDATA - Received data from the FIFO. | ||
5163 | */ | ||
5164 | #define I2S_FIFORDNOPOP_RXDATA(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFORDNOPOP_RXDATA_SHIFT)) & I2S_FIFORDNOPOP_RXDATA_MASK) | ||
5165 | /*! @} */ | ||
5166 | |||
5167 | /*! @name FIFORD48HNOPOP - FIFO data read for upper data bits with no FIFO pop. May only be used if the I2S is configured for 2x 24-bit data and not using DMA. */ | ||
5168 | /*! @{ */ | ||
5169 | #define I2S_FIFORD48HNOPOP_RXDATA_MASK (0xFFFFFFU) | ||
5170 | #define I2S_FIFORD48HNOPOP_RXDATA_SHIFT (0U) | ||
5171 | /*! RXDATA - Received data from the FIFO. Whether this register is used and the number of bits used depends on configuration details. | ||
5172 | */ | ||
5173 | #define I2S_FIFORD48HNOPOP_RXDATA(x) (((uint32_t)(((uint32_t)(x)) << I2S_FIFORD48HNOPOP_RXDATA_SHIFT)) & I2S_FIFORD48HNOPOP_RXDATA_MASK) | ||
5174 | /*! @} */ | ||
5175 | |||
5176 | /*! @name ID - I2S Module identification */ | ||
5177 | /*! @{ */ | ||
5178 | #define I2S_ID_Aperture_MASK (0xFFU) | ||
5179 | #define I2S_ID_Aperture_SHIFT (0U) | ||
5180 | /*! Aperture - Aperture: encoded as (aperture size/4K) -1, so 0x00 means a 4K aperture. | ||
5181 | */ | ||
5182 | #define I2S_ID_Aperture(x) (((uint32_t)(((uint32_t)(x)) << I2S_ID_Aperture_SHIFT)) & I2S_ID_Aperture_MASK) | ||
5183 | #define I2S_ID_Minor_Rev_MASK (0xF00U) | ||
5184 | #define I2S_ID_Minor_Rev_SHIFT (8U) | ||
5185 | /*! Minor_Rev - Minor revision of module implementation, starting at 0. | ||
5186 | */ | ||
5187 | #define I2S_ID_Minor_Rev(x) (((uint32_t)(((uint32_t)(x)) << I2S_ID_Minor_Rev_SHIFT)) & I2S_ID_Minor_Rev_MASK) | ||
5188 | #define I2S_ID_Major_Rev_MASK (0xF000U) | ||
5189 | #define I2S_ID_Major_Rev_SHIFT (12U) | ||
5190 | /*! Major_Rev - Major revision of module implementation, starting at 0. | ||
5191 | */ | ||
5192 | #define I2S_ID_Major_Rev(x) (((uint32_t)(((uint32_t)(x)) << I2S_ID_Major_Rev_SHIFT)) & I2S_ID_Major_Rev_MASK) | ||
5193 | #define I2S_ID_ID_MASK (0xFFFF0000U) | ||
5194 | #define I2S_ID_ID_SHIFT (16U) | ||
5195 | /*! ID - Unique module identifier for this IP block. | ||
5196 | */ | ||
5197 | #define I2S_ID_ID(x) (((uint32_t)(((uint32_t)(x)) << I2S_ID_ID_SHIFT)) & I2S_ID_ID_MASK) | ||
5198 | /*! @} */ | ||
5199 | |||
5200 | |||
5201 | /*! | ||
5202 | * @} | ||
5203 | */ /* end of group I2S_Register_Masks */ | ||
5204 | |||
5205 | |||
5206 | /* I2S - Peripheral instance base addresses */ | ||
5207 | /** Peripheral I2S0 base address */ | ||
5208 | #define I2S0_BASE (0x40097000u) | ||
5209 | /** Peripheral I2S0 base pointer */ | ||
5210 | #define I2S0 ((I2S_Type *)I2S0_BASE) | ||
5211 | /** Peripheral I2S1 base address */ | ||
5212 | #define I2S1_BASE (0x40098000u) | ||
5213 | /** Peripheral I2S1 base pointer */ | ||
5214 | #define I2S1 ((I2S_Type *)I2S1_BASE) | ||
5215 | /** Array initializer of I2S peripheral base addresses */ | ||
5216 | #define I2S_BASE_ADDRS { I2S0_BASE, I2S1_BASE } | ||
5217 | /** Array initializer of I2S peripheral base pointers */ | ||
5218 | #define I2S_BASE_PTRS { I2S0, I2S1 } | ||
5219 | /** Interrupt vectors for the I2S peripheral type */ | ||
5220 | #define I2S_IRQS { FLEXCOMM6_IRQn, FLEXCOMM7_IRQn } | ||
5221 | |||
5222 | /*! | ||
5223 | * @} | ||
5224 | */ /* end of group I2S_Peripheral_Access_Layer */ | ||
5225 | |||
5226 | |||
5227 | /* ---------------------------------------------------------------------------- | ||
5228 | -- INPUTMUX Peripheral Access Layer | ||
5229 | ---------------------------------------------------------------------------- */ | ||
5230 | |||
5231 | /*! | ||
5232 | * @addtogroup INPUTMUX_Peripheral_Access_Layer INPUTMUX Peripheral Access Layer | ||
5233 | * @{ | ||
5234 | */ | ||
5235 | |||
5236 | /** INPUTMUX - Register Layout Typedef */ | ||
5237 | typedef struct { | ||
5238 | __IO uint32_t SCT0_INMUX[7]; /**< Trigger select register for DMA channel, array offset: 0x0, array step: 0x4 */ | ||
5239 | uint8_t RESERVED_0[164]; | ||
5240 | __IO uint32_t PINTSEL[8]; /**< Pin interrupt select register, array offset: 0xC0, array step: 0x4 */ | ||
5241 | __IO uint32_t DMA_ITRIG_INMUX[32]; /**< Trigger select register for DMA channel, array offset: 0xE0, array step: 0x4 */ | ||
5242 | __IO uint32_t DMA_OTRIG_INMUX[4]; /**< DMA output trigger selection to become DMA trigger, array offset: 0x160, array step: 0x4 */ | ||
5243 | uint8_t RESERVED_1[16]; | ||
5244 | __IO uint32_t FREQMEAS_REF; /**< Selection for frequency measurement reference clock, offset: 0x180 */ | ||
5245 | __IO uint32_t FREQMEAS_TARGET; /**< Selection for frequency measurement target clock, offset: 0x184 */ | ||
5246 | } INPUTMUX_Type; | ||
5247 | |||
5248 | /* ---------------------------------------------------------------------------- | ||
5249 | -- INPUTMUX Register Masks | ||
5250 | ---------------------------------------------------------------------------- */ | ||
5251 | |||
5252 | /*! | ||
5253 | * @addtogroup INPUTMUX_Register_Masks INPUTMUX Register Masks | ||
5254 | * @{ | ||
5255 | */ | ||
5256 | |||
5257 | /*! @name SCT0_INMUX - Trigger select register for DMA channel */ | ||
5258 | /*! @{ */ | ||
5259 | #define INPUTMUX_SCT0_INMUX_INP_N_MASK (0x1FU) | ||
5260 | #define INPUTMUX_SCT0_INMUX_INP_N_SHIFT (0U) | ||
5261 | /*! INP_N - Input number to SCT0 inputs 0 to 6.. | ||
5262 | */ | ||
5263 | #define INPUTMUX_SCT0_INMUX_INP_N(x) (((uint32_t)(((uint32_t)(x)) << INPUTMUX_SCT0_INMUX_INP_N_SHIFT)) & INPUTMUX_SCT0_INMUX_INP_N_MASK) | ||
5264 | /*! @} */ | ||
5265 | |||
5266 | /* The count of INPUTMUX_SCT0_INMUX */ | ||
5267 | #define INPUTMUX_SCT0_INMUX_COUNT (7U) | ||
5268 | |||
5269 | /*! @name PINTSEL - Pin interrupt select register */ | ||
5270 | /*! @{ */ | ||
5271 | #define INPUTMUX_PINTSEL_INTPIN_MASK (0xFFU) | ||
5272 | #define INPUTMUX_PINTSEL_INTPIN_SHIFT (0U) | ||
5273 | /*! INTPIN - Pin number select for pin interrupt or pattern match engine input. (PIO0_0 to PIO1_31 correspond to numbers 0 to 63). | ||
5274 | */ | ||
5275 | #define INPUTMUX_PINTSEL_INTPIN(x) (((uint32_t)(((uint32_t)(x)) << INPUTMUX_PINTSEL_INTPIN_SHIFT)) & INPUTMUX_PINTSEL_INTPIN_MASK) | ||
5276 | /*! @} */ | ||
5277 | |||
5278 | /* The count of INPUTMUX_PINTSEL */ | ||
5279 | #define INPUTMUX_PINTSEL_COUNT (8U) | ||
5280 | |||
5281 | /*! @name DMA_ITRIG_INMUX - Trigger select register for DMA channel */ | ||
5282 | /*! @{ */ | ||
5283 | #define INPUTMUX_DMA_ITRIG_INMUX_INP_MASK (0x1FU) | ||
5284 | #define INPUTMUX_DMA_ITRIG_INMUX_INP_SHIFT (0U) | ||
5285 | /*! INP - Trigger input number (decimal value) for DMA channel n (n = 0 to 31). 0 = ADC0 Sequence A | ||
5286 | * interrupt 1 = ADC0 Sequence B interrupt 2 = SCT0 DMA request 0 3 = SCT0 DMA request 1 4 = | ||
5287 | * Timer CTIMER0 Match 0 5 = Timer CTIMER0 Match 1 6 = Timer CTIMER1 Match 0 7 = Timer CTIMER2 Match | ||
5288 | * 0 8 = Timer CTIMER2 Match 1 9 = Timer CTIMER3 Match 0 10 = Timer CTIMER4 Match 0 11 = Timer | ||
5289 | * CTIMER4 Match 1 12 = Pin interrupt 0 13 = Pin interrupt 1 14 = Pin interrupt 2 15 = Pin | ||
5290 | * interrupt 3 16 = DMA output trigger mux 0 17 = DMA output trigger mux 1 18 = DMA output trigger mux 2 | ||
5291 | * 19 = DMA output trigger mux 3 | ||
5292 | */ | ||
5293 | #define INPUTMUX_DMA_ITRIG_INMUX_INP(x) (((uint32_t)(((uint32_t)(x)) << INPUTMUX_DMA_ITRIG_INMUX_INP_SHIFT)) & INPUTMUX_DMA_ITRIG_INMUX_INP_MASK) | ||
5294 | /*! @} */ | ||
5295 | |||
5296 | /* The count of INPUTMUX_DMA_ITRIG_INMUX */ | ||
5297 | #define INPUTMUX_DMA_ITRIG_INMUX_COUNT (32U) | ||
5298 | |||
5299 | /*! @name DMA_OTRIG_INMUX - DMA output trigger selection to become DMA trigger */ | ||
5300 | /*! @{ */ | ||
5301 | #define INPUTMUX_DMA_OTRIG_INMUX_INP_MASK (0x1FU) | ||
5302 | #define INPUTMUX_DMA_OTRIG_INMUX_INP_SHIFT (0U) | ||
5303 | /*! INP - DMA trigger output number (decimal value) for DMA channel n (n = 0 to 19). | ||
5304 | */ | ||
5305 | #define INPUTMUX_DMA_OTRIG_INMUX_INP(x) (((uint32_t)(((uint32_t)(x)) << INPUTMUX_DMA_OTRIG_INMUX_INP_SHIFT)) & INPUTMUX_DMA_OTRIG_INMUX_INP_MASK) | ||
5306 | /*! @} */ | ||
5307 | |||
5308 | /* The count of INPUTMUX_DMA_OTRIG_INMUX */ | ||
5309 | #define INPUTMUX_DMA_OTRIG_INMUX_COUNT (4U) | ||
5310 | |||
5311 | /*! @name FREQMEAS_REF - Selection for frequency measurement reference clock */ | ||
5312 | /*! @{ */ | ||
5313 | #define INPUTMUX_FREQMEAS_REF_CLKIN_MASK (0x1FU) | ||
5314 | #define INPUTMUX_FREQMEAS_REF_CLKIN_SHIFT (0U) | ||
5315 | /*! CLKIN - Clock source number (decimal value) for frequency measure function target clock: 0 = | ||
5316 | * CLK_IN 1 = FRO 12 MHz oscillator 2 = Watchdog oscillator 3 = 32 kHz RTC oscillator 4 = Main clock | ||
5317 | * (see Section 4.5.23) 5 = PIO0_4 6 = PIO0_20 7 = PIO0_24 8 = PIO1_4 | ||
5318 | */ | ||
5319 | #define INPUTMUX_FREQMEAS_REF_CLKIN(x) (((uint32_t)(((uint32_t)(x)) << INPUTMUX_FREQMEAS_REF_CLKIN_SHIFT)) & INPUTMUX_FREQMEAS_REF_CLKIN_MASK) | ||
5320 | /*! @} */ | ||
5321 | |||
5322 | /*! @name FREQMEAS_TARGET - Selection for frequency measurement target clock */ | ||
5323 | /*! @{ */ | ||
5324 | #define INPUTMUX_FREQMEAS_TARGET_CLKIN_MASK (0x1FU) | ||
5325 | #define INPUTMUX_FREQMEAS_TARGET_CLKIN_SHIFT (0U) | ||
5326 | /*! CLKIN - Clock source number (decimal value) for frequency measure function target clock: 0 = | ||
5327 | * CLK_IN 1 = FRO 12 MHz oscillator 2 = Watchdog oscillator 3 = 32 kHz RTC oscillator 4 = Main clock | ||
5328 | * (see Section 4.5.23) 5 = PIO0_4 6 = PIO0_20 7 = PIO0_24 8 = PIO1_4 | ||
5329 | */ | ||
5330 | #define INPUTMUX_FREQMEAS_TARGET_CLKIN(x) (((uint32_t)(((uint32_t)(x)) << INPUTMUX_FREQMEAS_TARGET_CLKIN_SHIFT)) & INPUTMUX_FREQMEAS_TARGET_CLKIN_MASK) | ||
5331 | /*! @} */ | ||
5332 | |||
5333 | |||
5334 | /*! | ||
5335 | * @} | ||
5336 | */ /* end of group INPUTMUX_Register_Masks */ | ||
5337 | |||
5338 | |||
5339 | /* INPUTMUX - Peripheral instance base addresses */ | ||
5340 | /** Peripheral INPUTMUX base address */ | ||
5341 | #define INPUTMUX_BASE (0x40005000u) | ||
5342 | /** Peripheral INPUTMUX base pointer */ | ||
5343 | #define INPUTMUX ((INPUTMUX_Type *)INPUTMUX_BASE) | ||
5344 | /** Array initializer of INPUTMUX peripheral base addresses */ | ||
5345 | #define INPUTMUX_BASE_ADDRS { INPUTMUX_BASE } | ||
5346 | /** Array initializer of INPUTMUX peripheral base pointers */ | ||
5347 | #define INPUTMUX_BASE_PTRS { INPUTMUX } | ||
5348 | |||
5349 | /*! | ||
5350 | * @} | ||
5351 | */ /* end of group INPUTMUX_Peripheral_Access_Layer */ | ||
5352 | |||
5353 | |||
5354 | /* ---------------------------------------------------------------------------- | ||
5355 | -- IOCON Peripheral Access Layer | ||
5356 | ---------------------------------------------------------------------------- */ | ||
5357 | |||
5358 | /*! | ||
5359 | * @addtogroup IOCON_Peripheral_Access_Layer IOCON Peripheral Access Layer | ||
5360 | * @{ | ||
5361 | */ | ||
5362 | |||
5363 | /** IOCON - Register Layout Typedef */ | ||
5364 | typedef struct { | ||
5365 | __IO uint32_t PIO[6][32]; /**< Digital I/O control for port 0 pins PIO0_0..Digital I/O control for port 5 pins PIO5_31, array offset: 0x0, array step: index*0x80, index2*0x4 */ | ||
5366 | } IOCON_Type; | ||
5367 | |||
5368 | /* ---------------------------------------------------------------------------- | ||
5369 | -- IOCON Register Masks | ||
5370 | ---------------------------------------------------------------------------- */ | ||
5371 | |||
5372 | /*! | ||
5373 | * @addtogroup IOCON_Register_Masks IOCON Register Masks | ||
5374 | * @{ | ||
5375 | */ | ||
5376 | |||
5377 | /*! @name PIO - Digital I/O control for port 0 pins PIO0_0..Digital I/O control for port 5 pins PIO5_31 */ | ||
5378 | /*! @{ */ | ||
5379 | #define IOCON_PIO_FUNC_MASK (0xFU) | ||
5380 | #define IOCON_PIO_FUNC_SHIFT (0U) | ||
5381 | /*! FUNC - Selects pin function. | ||
5382 | * 0b0000..Alternative connection 0. | ||
5383 | * 0b0001..Alternative connection 1. | ||
5384 | * 0b0010..Alternative connection 2. | ||
5385 | * 0b0011..Alternative connection 3. | ||
5386 | * 0b0100..Alternative connection 4. | ||
5387 | * 0b0101..Alternative connection 5. | ||
5388 | * 0b0110..Alternative connection 6. | ||
5389 | * 0b0111..Alternative connection 7. | ||
5390 | * 0b1000..Alternative connection 8. | ||
5391 | * 0b1001..Alternative connection 9. | ||
5392 | * 0b1010..Alternative connection 10. | ||
5393 | */ | ||
5394 | #define IOCON_PIO_FUNC(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_FUNC_SHIFT)) & IOCON_PIO_FUNC_MASK) | ||
5395 | #define IOCON_PIO_MODE_MASK (0x30U) | ||
5396 | #define IOCON_PIO_MODE_SHIFT (4U) | ||
5397 | /*! MODE - Selects function mode (on-chip pull-up/pull-down resistor control). | ||
5398 | * 0b00..Inactive. Inactive (no pull-down/pull-up resistor enabled). | ||
5399 | * 0b01..Pull-down. Pull-down resistor enabled. | ||
5400 | * 0b10..Pull-up. Pull-up resistor enabled. | ||
5401 | * 0b11..Repeater. Repeater mode. | ||
5402 | */ | ||
5403 | #define IOCON_PIO_MODE(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_MODE_SHIFT)) & IOCON_PIO_MODE_MASK) | ||
5404 | #define IOCON_PIO_ANAMODE_MASK (0x40U) | ||
5405 | #define IOCON_PIO_ANAMODE_SHIFT (6U) | ||
5406 | /*! ANAMODE - Enables or disables analog mode. | ||
5407 | * 0b0..Enable analog Mode. | ||
5408 | * 0b1..Disable analog Mode. | ||
5409 | */ | ||
5410 | #define IOCON_PIO_ANAMODE(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_ANAMODE_SHIFT)) & IOCON_PIO_ANAMODE_MASK) | ||
5411 | #define IOCON_PIO_I2CSLEW_MASK (0x40U) | ||
5412 | #define IOCON_PIO_I2CSLEW_SHIFT (6U) | ||
5413 | /*! I2CSLEW - Controls slew rate of I2C pad. | ||
5414 | * 0b0..I2C mode. | ||
5415 | * 0b1..GPIO mode. | ||
5416 | */ | ||
5417 | #define IOCON_PIO_I2CSLEW(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_I2CSLEW_SHIFT)) & IOCON_PIO_I2CSLEW_MASK) | ||
5418 | #define IOCON_PIO_INVERT_MASK (0x80U) | ||
5419 | #define IOCON_PIO_INVERT_SHIFT (7U) | ||
5420 | /*! INVERT - Input polarity. | ||
5421 | * 0b0..Disabled. Input function is not inverted. | ||
5422 | * 0b1..Enabled. Input is function inverted. | ||
5423 | */ | ||
5424 | #define IOCON_PIO_INVERT(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_INVERT_SHIFT)) & IOCON_PIO_INVERT_MASK) | ||
5425 | #define IOCON_PIO_DIGIMODE_MASK (0x100U) | ||
5426 | #define IOCON_PIO_DIGIMODE_SHIFT (8U) | ||
5427 | /*! DIGIMODE - Select Analog/Digital mode. | ||
5428 | * 0b0..Analog mode. | ||
5429 | * 0b1..Digital mode. | ||
5430 | */ | ||
5431 | #define IOCON_PIO_DIGIMODE(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_DIGIMODE_SHIFT)) & IOCON_PIO_DIGIMODE_MASK) | ||
5432 | #define IOCON_PIO_FILTEROFF_MASK (0x200U) | ||
5433 | #define IOCON_PIO_FILTEROFF_SHIFT (9U) | ||
5434 | /*! FILTEROFF - Controls input glitch filter. | ||
5435 | * 0b0..Filter enabled. Noise pulses below approximately 10 ns are filtered out. | ||
5436 | * 0b1..Filter disabled. No input filtering is done. | ||
5437 | */ | ||
5438 | #define IOCON_PIO_FILTEROFF(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_FILTEROFF_SHIFT)) & IOCON_PIO_FILTEROFF_MASK) | ||
5439 | #define IOCON_PIO_I2CDRIVE_MASK (0x400U) | ||
5440 | #define IOCON_PIO_I2CDRIVE_SHIFT (10U) | ||
5441 | /*! I2CDRIVE - Controls the current sink capability of the pin. | ||
5442 | * 0b0..Low drive. Output drive sink is 4 mA. This is sufficient for standard and fast mode I2C. | ||
5443 | * 0b1..High drive. Output drive sink is 20 mA. This is needed for Fast Mode Plus I 2C. Refer to the appropriate | ||
5444 | * specific device data sheet for details. | ||
5445 | */ | ||
5446 | #define IOCON_PIO_I2CDRIVE(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_I2CDRIVE_SHIFT)) & IOCON_PIO_I2CDRIVE_MASK) | ||
5447 | #define IOCON_PIO_SLEW_MASK (0x400U) | ||
5448 | #define IOCON_PIO_SLEW_SHIFT (10U) | ||
5449 | /*! SLEW - Driver slew rate. | ||
5450 | * 0b0..Standard mode, output slew rate control is enabled. More outputs can be switched simultaneously. | ||
5451 | * 0b1..Fast mode, slew rate control is disabled. Refer to the appropriate specific device data sheet for details. | ||
5452 | */ | ||
5453 | #define IOCON_PIO_SLEW(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_SLEW_SHIFT)) & IOCON_PIO_SLEW_MASK) | ||
5454 | #define IOCON_PIO_I2CFILTEROFF_MASK (0x800U) | ||
5455 | #define IOCON_PIO_I2CFILTEROFF_SHIFT (11U) | ||
5456 | /*! I2CFILTEROFF - Configures I2C features for standard mode, fast mode, and Fast Mode Plus operation. | ||
5457 | * 0b0..Enabled. I2C 50 ns glitch filter enabled. | ||
5458 | * 0b1..Disabled. I2C 50 ns glitch filter disabled. | ||
5459 | */ | ||
5460 | #define IOCON_PIO_I2CFILTEROFF(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_I2CFILTEROFF_SHIFT)) & IOCON_PIO_I2CFILTEROFF_MASK) | ||
5461 | #define IOCON_PIO_OD_MASK (0x800U) | ||
5462 | #define IOCON_PIO_OD_SHIFT (11U) | ||
5463 | /*! OD - Controls open-drain mode. | ||
5464 | * 0b0..Normal. Normal push-pull output | ||
5465 | * 0b1..Open-drain. Simulated open-drain output (high drive disabled). | ||
5466 | */ | ||
5467 | #define IOCON_PIO_OD(x) (((uint32_t)(((uint32_t)(x)) << IOCON_PIO_OD_SHIFT)) & IOCON_PIO_OD_MASK) | ||
5468 | /*! @} */ | ||
5469 | |||
5470 | /* The count of IOCON_PIO */ | ||
5471 | #define IOCON_PIO_COUNT (6U) | ||
5472 | |||
5473 | /* The count of IOCON_PIO */ | ||
5474 | #define IOCON_PIO_COUNT2 (32U) | ||
5475 | |||
5476 | |||
5477 | /*! | ||
5478 | * @} | ||
5479 | */ /* end of group IOCON_Register_Masks */ | ||
5480 | |||
5481 | |||
5482 | /* IOCON - Peripheral instance base addresses */ | ||
5483 | /** Peripheral IOCON base address */ | ||
5484 | #define IOCON_BASE (0x40001000u) | ||
5485 | /** Peripheral IOCON base pointer */ | ||
5486 | #define IOCON ((IOCON_Type *)IOCON_BASE) | ||
5487 | /** Array initializer of IOCON peripheral base addresses */ | ||
5488 | #define IOCON_BASE_ADDRS { IOCON_BASE } | ||
5489 | /** Array initializer of IOCON peripheral base pointers */ | ||
5490 | #define IOCON_BASE_PTRS { IOCON } | ||
5491 | |||
5492 | /*! | ||
5493 | * @} | ||
5494 | */ /* end of group IOCON_Peripheral_Access_Layer */ | ||
5495 | |||
5496 | |||
5497 | /* ---------------------------------------------------------------------------- | ||
5498 | -- MRT Peripheral Access Layer | ||
5499 | ---------------------------------------------------------------------------- */ | ||
5500 | |||
5501 | /*! | ||
5502 | * @addtogroup MRT_Peripheral_Access_Layer MRT Peripheral Access Layer | ||
5503 | * @{ | ||
5504 | */ | ||
5505 | |||
5506 | /** MRT - Register Layout Typedef */ | ||
5507 | typedef struct { | ||
5508 | struct { /* offset: 0x0, array step: 0x10 */ | ||
5509 | __IO uint32_t INTVAL; /**< MRT Time interval value register. This value is loaded into the TIMER register., array offset: 0x0, array step: 0x10 */ | ||
5510 | __I uint32_t TIMER; /**< MRT Timer register. This register reads the value of the down-counter., array offset: 0x4, array step: 0x10 */ | ||
5511 | __IO uint32_t CTRL; /**< MRT Control register. This register controls the MRT modes., array offset: 0x8, array step: 0x10 */ | ||
5512 | __IO uint32_t STAT; /**< MRT Status register., array offset: 0xC, array step: 0x10 */ | ||
5513 | } CHANNEL[4]; | ||
5514 | uint8_t RESERVED_0[176]; | ||
5515 | __IO uint32_t MODCFG; /**< Module Configuration register. This register provides information about this particular MRT instance, and allows choosing an overall mode for the idle channel feature., offset: 0xF0 */ | ||
5516 | __I uint32_t IDLE_CH; /**< Idle channel register. This register returns the number of the first idle channel., offset: 0xF4 */ | ||
5517 | __IO uint32_t IRQ_FLAG; /**< Global interrupt flag register, offset: 0xF8 */ | ||
5518 | } MRT_Type; | ||
5519 | |||
5520 | /* ---------------------------------------------------------------------------- | ||
5521 | -- MRT Register Masks | ||
5522 | ---------------------------------------------------------------------------- */ | ||
5523 | |||
5524 | /*! | ||
5525 | * @addtogroup MRT_Register_Masks MRT Register Masks | ||
5526 | * @{ | ||
5527 | */ | ||
5528 | |||
5529 | /*! @name CHANNEL_INTVAL - MRT Time interval value register. This value is loaded into the TIMER register. */ | ||
5530 | /*! @{ */ | ||
5531 | #define MRT_CHANNEL_INTVAL_IVALUE_MASK (0xFFFFFFU) | ||
5532 | #define MRT_CHANNEL_INTVAL_IVALUE_SHIFT (0U) | ||
5533 | /*! IVALUE - Time interval load value. This value is loaded into the TIMERn register and the MRT | ||
5534 | * channel n starts counting down from IVALUE -1. If the timer is idle, writing a non-zero value to | ||
5535 | * this bit field starts the timer immediately. If the timer is running, writing a zero to this | ||
5536 | * bit field does the following: If LOAD = 1, the timer stops immediately. If LOAD = 0, the timer | ||
5537 | * stops at the end of the time interval. | ||
5538 | */ | ||
5539 | #define MRT_CHANNEL_INTVAL_IVALUE(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_INTVAL_IVALUE_SHIFT)) & MRT_CHANNEL_INTVAL_IVALUE_MASK) | ||
5540 | #define MRT_CHANNEL_INTVAL_LOAD_MASK (0x80000000U) | ||
5541 | #define MRT_CHANNEL_INTVAL_LOAD_SHIFT (31U) | ||
5542 | /*! LOAD - Determines how the timer interval value IVALUE -1 is loaded into the TIMERn register. | ||
5543 | * This bit is write-only. Reading this bit always returns 0. | ||
5544 | * 0b0..No force load. The load from the INTVALn register to the TIMERn register is processed at the end of the | ||
5545 | * time interval if the repeat mode is selected. | ||
5546 | * 0b1..Force load. The INTVALn interval value IVALUE -1 is immediately loaded into the TIMERn register while TIMERn is running. | ||
5547 | */ | ||
5548 | #define MRT_CHANNEL_INTVAL_LOAD(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_INTVAL_LOAD_SHIFT)) & MRT_CHANNEL_INTVAL_LOAD_MASK) | ||
5549 | /*! @} */ | ||
5550 | |||
5551 | /* The count of MRT_CHANNEL_INTVAL */ | ||
5552 | #define MRT_CHANNEL_INTVAL_COUNT (4U) | ||
5553 | |||
5554 | /*! @name CHANNEL_TIMER - MRT Timer register. This register reads the value of the down-counter. */ | ||
5555 | /*! @{ */ | ||
5556 | #define MRT_CHANNEL_TIMER_VALUE_MASK (0xFFFFFFU) | ||
5557 | #define MRT_CHANNEL_TIMER_VALUE_SHIFT (0U) | ||
5558 | /*! VALUE - Holds the current timer value of the down-counter. The initial value of the TIMERn | ||
5559 | * register is loaded as IVALUE - 1 from the INTVALn register either at the end of the time interval | ||
5560 | * or immediately in the following cases: INTVALn register is updated in the idle state. INTVALn | ||
5561 | * register is updated with LOAD = 1. When the timer is in idle state, reading this bit fields | ||
5562 | * returns -1 (0x00FF FFFF). | ||
5563 | */ | ||
5564 | #define MRT_CHANNEL_TIMER_VALUE(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_TIMER_VALUE_SHIFT)) & MRT_CHANNEL_TIMER_VALUE_MASK) | ||
5565 | /*! @} */ | ||
5566 | |||
5567 | /* The count of MRT_CHANNEL_TIMER */ | ||
5568 | #define MRT_CHANNEL_TIMER_COUNT (4U) | ||
5569 | |||
5570 | /*! @name CHANNEL_CTRL - MRT Control register. This register controls the MRT modes. */ | ||
5571 | /*! @{ */ | ||
5572 | #define MRT_CHANNEL_CTRL_INTEN_MASK (0x1U) | ||
5573 | #define MRT_CHANNEL_CTRL_INTEN_SHIFT (0U) | ||
5574 | /*! INTEN - Enable the TIMERn interrupt. | ||
5575 | * 0b0..Disabled. TIMERn interrupt is disabled. | ||
5576 | * 0b1..Enabled. TIMERn interrupt is enabled. | ||
5577 | */ | ||
5578 | #define MRT_CHANNEL_CTRL_INTEN(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_CTRL_INTEN_SHIFT)) & MRT_CHANNEL_CTRL_INTEN_MASK) | ||
5579 | #define MRT_CHANNEL_CTRL_MODE_MASK (0x6U) | ||
5580 | #define MRT_CHANNEL_CTRL_MODE_SHIFT (1U) | ||
5581 | /*! MODE - Selects timer mode. | ||
5582 | * 0b00..Repeat interrupt mode. | ||
5583 | * 0b01..One-shot interrupt mode. | ||
5584 | * 0b10..One-shot stall mode. | ||
5585 | * 0b11..Reserved. | ||
5586 | */ | ||
5587 | #define MRT_CHANNEL_CTRL_MODE(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_CTRL_MODE_SHIFT)) & MRT_CHANNEL_CTRL_MODE_MASK) | ||
5588 | /*! @} */ | ||
5589 | |||
5590 | /* The count of MRT_CHANNEL_CTRL */ | ||
5591 | #define MRT_CHANNEL_CTRL_COUNT (4U) | ||
5592 | |||
5593 | /*! @name CHANNEL_STAT - MRT Status register. */ | ||
5594 | /*! @{ */ | ||
5595 | #define MRT_CHANNEL_STAT_INTFLAG_MASK (0x1U) | ||
5596 | #define MRT_CHANNEL_STAT_INTFLAG_SHIFT (0U) | ||
5597 | /*! INTFLAG - Monitors the interrupt flag. | ||
5598 | * 0b0..No pending interrupt. Writing a zero is equivalent to no operation. | ||
5599 | * 0b1..Pending interrupt. The interrupt is pending because TIMERn has reached the end of the time interval. If | ||
5600 | * the INTEN bit in the CONTROLn is also set to 1, the interrupt for timer channel n and the global interrupt | ||
5601 | * are raised. Writing a 1 to this bit clears the interrupt request. | ||
5602 | */ | ||
5603 | #define MRT_CHANNEL_STAT_INTFLAG(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_STAT_INTFLAG_SHIFT)) & MRT_CHANNEL_STAT_INTFLAG_MASK) | ||
5604 | #define MRT_CHANNEL_STAT_RUN_MASK (0x2U) | ||
5605 | #define MRT_CHANNEL_STAT_RUN_SHIFT (1U) | ||
5606 | /*! RUN - Indicates the state of TIMERn. This bit is read-only. | ||
5607 | * 0b0..Idle state. TIMERn is stopped. | ||
5608 | * 0b1..Running. TIMERn is running. | ||
5609 | */ | ||
5610 | #define MRT_CHANNEL_STAT_RUN(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_STAT_RUN_SHIFT)) & MRT_CHANNEL_STAT_RUN_MASK) | ||
5611 | #define MRT_CHANNEL_STAT_INUSE_MASK (0x4U) | ||
5612 | #define MRT_CHANNEL_STAT_INUSE_SHIFT (2U) | ||
5613 | /*! INUSE - Channel In Use flag. Operating details depend on the MULTITASK bit in the MODCFG | ||
5614 | * register, and affects the use of IDLE_CH. See Idle channel register for details of the two operating | ||
5615 | * modes. | ||
5616 | * 0b0..This channel is not in use. | ||
5617 | * 0b1..This channel is in use. | ||
5618 | */ | ||
5619 | #define MRT_CHANNEL_STAT_INUSE(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_STAT_INUSE_SHIFT)) & MRT_CHANNEL_STAT_INUSE_MASK) | ||
5620 | /*! @} */ | ||
5621 | |||
5622 | /* The count of MRT_CHANNEL_STAT */ | ||
5623 | #define MRT_CHANNEL_STAT_COUNT (4U) | ||
5624 | |||
5625 | /*! @name MODCFG - Module Configuration register. This register provides information about this particular MRT instance, and allows choosing an overall mode for the idle channel feature. */ | ||
5626 | /*! @{ */ | ||
5627 | #define MRT_MODCFG_NOC_MASK (0xFU) | ||
5628 | #define MRT_MODCFG_NOC_SHIFT (0U) | ||
5629 | /*! NOC - Identifies the number of channels in this MRT.(4 channels on this device.) | ||
5630 | */ | ||
5631 | #define MRT_MODCFG_NOC(x) (((uint32_t)(((uint32_t)(x)) << MRT_MODCFG_NOC_SHIFT)) & MRT_MODCFG_NOC_MASK) | ||
5632 | #define MRT_MODCFG_NOB_MASK (0x1F0U) | ||
5633 | #define MRT_MODCFG_NOB_SHIFT (4U) | ||
5634 | /*! NOB - Identifies the number of timer bits in this MRT. (24 bits wide on this device.) | ||
5635 | */ | ||
5636 | #define MRT_MODCFG_NOB(x) (((uint32_t)(((uint32_t)(x)) << MRT_MODCFG_NOB_SHIFT)) & MRT_MODCFG_NOB_MASK) | ||
5637 | #define MRT_MODCFG_MULTITASK_MASK (0x80000000U) | ||
5638 | #define MRT_MODCFG_MULTITASK_SHIFT (31U) | ||
5639 | /*! MULTITASK - Selects the operating mode for the INUSE flags and the IDLE_CH register. | ||
5640 | * 0b0..Hardware status mode. In this mode, the INUSE(n) flags for all channels are reset. | ||
5641 | * 0b1..Multi-task mode. | ||
5642 | */ | ||
5643 | #define MRT_MODCFG_MULTITASK(x) (((uint32_t)(((uint32_t)(x)) << MRT_MODCFG_MULTITASK_SHIFT)) & MRT_MODCFG_MULTITASK_MASK) | ||
5644 | /*! @} */ | ||
5645 | |||
5646 | /*! @name IDLE_CH - Idle channel register. This register returns the number of the first idle channel. */ | ||
5647 | /*! @{ */ | ||
5648 | #define MRT_IDLE_CH_CHAN_MASK (0xF0U) | ||
5649 | #define MRT_IDLE_CH_CHAN_SHIFT (4U) | ||
5650 | /*! CHAN - Idle channel. Reading the CHAN bits, returns the lowest idle timer channel. The number is | ||
5651 | * positioned such that it can be used as an offset from the MRT base address in order to access | ||
5652 | * the registers for the allocated channel. If all timer channels are running, CHAN = 0xF. See | ||
5653 | * text above for more details. | ||
5654 | */ | ||
5655 | #define MRT_IDLE_CH_CHAN(x) (((uint32_t)(((uint32_t)(x)) << MRT_IDLE_CH_CHAN_SHIFT)) & MRT_IDLE_CH_CHAN_MASK) | ||
5656 | /*! @} */ | ||
5657 | |||
5658 | /*! @name IRQ_FLAG - Global interrupt flag register */ | ||
5659 | /*! @{ */ | ||
5660 | #define MRT_IRQ_FLAG_GFLAG0_MASK (0x1U) | ||
5661 | #define MRT_IRQ_FLAG_GFLAG0_SHIFT (0U) | ||
5662 | /*! GFLAG0 - Monitors the interrupt flag of TIMER0. | ||
5663 | * 0b0..No pending interrupt. Writing a zero is equivalent to no operation. | ||
5664 | * 0b1..Pending interrupt. The interrupt is pending because TIMER0 has reached the end of the time interval. If | ||
5665 | * the INTEN bit in the CONTROL0 register is also set to 1, the interrupt for timer channel 0 and the global | ||
5666 | * interrupt are raised. Writing a 1 to this bit clears the interrupt request. | ||
5667 | */ | ||
5668 | #define MRT_IRQ_FLAG_GFLAG0(x) (((uint32_t)(((uint32_t)(x)) << MRT_IRQ_FLAG_GFLAG0_SHIFT)) & MRT_IRQ_FLAG_GFLAG0_MASK) | ||
5669 | #define MRT_IRQ_FLAG_GFLAG1_MASK (0x2U) | ||
5670 | #define MRT_IRQ_FLAG_GFLAG1_SHIFT (1U) | ||
5671 | /*! GFLAG1 - Monitors the interrupt flag of TIMER1. See description of channel 0. | ||
5672 | */ | ||
5673 | #define MRT_IRQ_FLAG_GFLAG1(x) (((uint32_t)(((uint32_t)(x)) << MRT_IRQ_FLAG_GFLAG1_SHIFT)) & MRT_IRQ_FLAG_GFLAG1_MASK) | ||
5674 | #define MRT_IRQ_FLAG_GFLAG2_MASK (0x4U) | ||
5675 | #define MRT_IRQ_FLAG_GFLAG2_SHIFT (2U) | ||
5676 | /*! GFLAG2 - Monitors the interrupt flag of TIMER2. See description of channel 0. | ||
5677 | */ | ||
5678 | #define MRT_IRQ_FLAG_GFLAG2(x) (((uint32_t)(((uint32_t)(x)) << MRT_IRQ_FLAG_GFLAG2_SHIFT)) & MRT_IRQ_FLAG_GFLAG2_MASK) | ||
5679 | #define MRT_IRQ_FLAG_GFLAG3_MASK (0x8U) | ||
5680 | #define MRT_IRQ_FLAG_GFLAG3_SHIFT (3U) | ||
5681 | /*! GFLAG3 - Monitors the interrupt flag of TIMER3. See description of channel 0. | ||
5682 | */ | ||
5683 | #define MRT_IRQ_FLAG_GFLAG3(x) (((uint32_t)(((uint32_t)(x)) << MRT_IRQ_FLAG_GFLAG3_SHIFT)) & MRT_IRQ_FLAG_GFLAG3_MASK) | ||
5684 | /*! @} */ | ||
5685 | |||
5686 | |||
5687 | /*! | ||
5688 | * @} | ||
5689 | */ /* end of group MRT_Register_Masks */ | ||
5690 | |||
5691 | |||
5692 | /* MRT - Peripheral instance base addresses */ | ||
5693 | /** Peripheral MRT0 base address */ | ||
5694 | #define MRT0_BASE (0x4000D000u) | ||
5695 | /** Peripheral MRT0 base pointer */ | ||
5696 | #define MRT0 ((MRT_Type *)MRT0_BASE) | ||
5697 | /** Array initializer of MRT peripheral base addresses */ | ||
5698 | #define MRT_BASE_ADDRS { MRT0_BASE } | ||
5699 | /** Array initializer of MRT peripheral base pointers */ | ||
5700 | #define MRT_BASE_PTRS { MRT0 } | ||
5701 | /** Interrupt vectors for the MRT peripheral type */ | ||
5702 | #define MRT_IRQS { MRT0_IRQn } | ||
5703 | |||
5704 | /*! | ||
5705 | * @} | ||
5706 | */ /* end of group MRT_Peripheral_Access_Layer */ | ||
5707 | |||
5708 | |||
5709 | /* ---------------------------------------------------------------------------- | ||
5710 | -- OTPC Peripheral Access Layer | ||
5711 | ---------------------------------------------------------------------------- */ | ||
5712 | |||
5713 | /*! | ||
5714 | * @addtogroup OTPC_Peripheral_Access_Layer OTPC Peripheral Access Layer | ||
5715 | * @{ | ||
5716 | */ | ||
5717 | |||
5718 | /** OTPC - Register Layout Typedef */ | ||
5719 | typedef struct { | ||
5720 | uint8_t RESERVED_0[16]; | ||
5721 | __I uint32_t AESKEY[8]; /**< Register for reading the AES key., array offset: 0x10, array step: 0x4 */ | ||
5722 | __I uint32_t ECRP; /**< ECRP options., offset: 0x30 */ | ||
5723 | uint8_t RESERVED_1[4]; | ||
5724 | __I uint32_t USER0; /**< User application specific options., offset: 0x38 */ | ||
5725 | __I uint32_t USER1; /**< User application specific options., offset: 0x3C */ | ||
5726 | } OTPC_Type; | ||
5727 | |||
5728 | /* ---------------------------------------------------------------------------- | ||
5729 | -- OTPC Register Masks | ||
5730 | ---------------------------------------------------------------------------- */ | ||
5731 | |||
5732 | /*! | ||
5733 | * @addtogroup OTPC_Register_Masks OTPC Register Masks | ||
5734 | * @{ | ||
5735 | */ | ||
5736 | |||
5737 | /*! @name AESKEY - Register for reading the AES key. */ | ||
5738 | /*! @{ */ | ||
5739 | #define OTPC_AESKEY_KEY_MASK (0xFFFFFFFFU) | ||
5740 | #define OTPC_AESKEY_KEY_SHIFT (0U) | ||
5741 | /*! KEY - AES key. | ||
5742 | */ | ||
5743 | #define OTPC_AESKEY_KEY(x) (((uint32_t)(((uint32_t)(x)) << OTPC_AESKEY_KEY_SHIFT)) & OTPC_AESKEY_KEY_MASK) | ||
5744 | /*! @} */ | ||
5745 | |||
5746 | /* The count of OTPC_AESKEY */ | ||
5747 | #define OTPC_AESKEY_COUNT (8U) | ||
5748 | |||
5749 | /*! @name ECRP - ECRP options. */ | ||
5750 | /*! @{ */ | ||
5751 | #define OTPC_ECRP_CRP_MASS_ERASE_DISABLE_MASK (0x10U) | ||
5752 | #define OTPC_ECRP_CRP_MASS_ERASE_DISABLE_SHIFT (4U) | ||
5753 | /*! CRP_MASS_ERASE_DISABLE - Disable or enable CRP mass erase. | ||
5754 | */ | ||
5755 | #define OTPC_ECRP_CRP_MASS_ERASE_DISABLE(x) (((uint32_t)(((uint32_t)(x)) << OTPC_ECRP_CRP_MASS_ERASE_DISABLE_SHIFT)) & OTPC_ECRP_CRP_MASS_ERASE_DISABLE_MASK) | ||
5756 | #define OTPC_ECRP_IAP_PROTECTION_ENABLE_MASK (0x20U) | ||
5757 | #define OTPC_ECRP_IAP_PROTECTION_ENABLE_SHIFT (5U) | ||
5758 | /*! IAP_PROTECTION_ENABLE - This bit controls the ability to enable checking for ECRP in IAP functions. | ||
5759 | */ | ||
5760 | #define OTPC_ECRP_IAP_PROTECTION_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << OTPC_ECRP_IAP_PROTECTION_ENABLE_SHIFT)) & OTPC_ECRP_IAP_PROTECTION_ENABLE_MASK) | ||
5761 | #define OTPC_ECRP_CRP_ISP_DISABLE_PIN_MASK (0x40U) | ||
5762 | #define OTPC_ECRP_CRP_ISP_DISABLE_PIN_SHIFT (6U) | ||
5763 | /*! CRP_ISP_DISABLE_PIN - This bit controls the ability to enter ISP mode using the ISP pin. | ||
5764 | */ | ||
5765 | #define OTPC_ECRP_CRP_ISP_DISABLE_PIN(x) (((uint32_t)(((uint32_t)(x)) << OTPC_ECRP_CRP_ISP_DISABLE_PIN_SHIFT)) & OTPC_ECRP_CRP_ISP_DISABLE_PIN_MASK) | ||
5766 | #define OTPC_ECRP_CRP_ISP_DISABLE_IAP_MASK (0x80U) | ||
5767 | #define OTPC_ECRP_CRP_ISP_DISABLE_IAP_SHIFT (7U) | ||
5768 | /*! CRP_ISP_DISABLE_IAP - This bit controls the ability to re-invoke ISP using IAP routines. | ||
5769 | */ | ||
5770 | #define OTPC_ECRP_CRP_ISP_DISABLE_IAP(x) (((uint32_t)(((uint32_t)(x)) << OTPC_ECRP_CRP_ISP_DISABLE_IAP_SHIFT)) & OTPC_ECRP_CRP_ISP_DISABLE_IAP_MASK) | ||
5771 | #define OTPC_ECRP_CRP_ALLOW_ZERO_MASK (0x200U) | ||
5772 | #define OTPC_ECRP_CRP_ALLOW_ZERO_SHIFT (9U) | ||
5773 | /*! CRP_ALLOW_ZERO - This bit controls how 0 is treated when read as a ECRP value.. | ||
5774 | */ | ||
5775 | #define OTPC_ECRP_CRP_ALLOW_ZERO(x) (((uint32_t)(((uint32_t)(x)) << OTPC_ECRP_CRP_ALLOW_ZERO_SHIFT)) & OTPC_ECRP_CRP_ALLOW_ZERO_MASK) | ||
5776 | #define OTPC_ECRP_JTAG_DISABLE_MASK (0x80000000U) | ||
5777 | #define OTPC_ECRP_JTAG_DISABLE_SHIFT (31U) | ||
5778 | /*! JTAG_DISABLE - 0 => Enable SWD/JTAG; 1 => Disable SWD/JTAG.. | ||
5779 | */ | ||
5780 | #define OTPC_ECRP_JTAG_DISABLE(x) (((uint32_t)(((uint32_t)(x)) << OTPC_ECRP_JTAG_DISABLE_SHIFT)) & OTPC_ECRP_JTAG_DISABLE_MASK) | ||
5781 | /*! @} */ | ||
5782 | |||
5783 | /*! @name USER0 - User application specific options. */ | ||
5784 | /*! @{ */ | ||
5785 | #define OTPC_USER0_USER0_MASK (0xFFFFFFFFU) | ||
5786 | #define OTPC_USER0_USER0_SHIFT (0U) | ||
5787 | /*! USER0 - User application specific option. | ||
5788 | */ | ||
5789 | #define OTPC_USER0_USER0(x) (((uint32_t)(((uint32_t)(x)) << OTPC_USER0_USER0_SHIFT)) & OTPC_USER0_USER0_MASK) | ||
5790 | /*! @} */ | ||
5791 | |||
5792 | /*! @name USER1 - User application specific options. */ | ||
5793 | /*! @{ */ | ||
5794 | #define OTPC_USER1_USER1_MASK (0xFFFFFFFFU) | ||
5795 | #define OTPC_USER1_USER1_SHIFT (0U) | ||
5796 | /*! USER1 - User application specific option. | ||
5797 | */ | ||
5798 | #define OTPC_USER1_USER1(x) (((uint32_t)(((uint32_t)(x)) << OTPC_USER1_USER1_SHIFT)) & OTPC_USER1_USER1_MASK) | ||
5799 | /*! @} */ | ||
5800 | |||
5801 | |||
5802 | /*! | ||
5803 | * @} | ||
5804 | */ /* end of group OTPC_Register_Masks */ | ||
5805 | |||
5806 | |||
5807 | /* OTPC - Peripheral instance base addresses */ | ||
5808 | /** Peripheral OTPC base address */ | ||
5809 | #define OTPC_BASE (0x40015000u) | ||
5810 | /** Peripheral OTPC base pointer */ | ||
5811 | #define OTPC ((OTPC_Type *)OTPC_BASE) | ||
5812 | /** Array initializer of OTPC peripheral base addresses */ | ||
5813 | #define OTPC_BASE_ADDRS { OTPC_BASE } | ||
5814 | /** Array initializer of OTPC peripheral base pointers */ | ||
5815 | #define OTPC_BASE_PTRS { OTPC } | ||
5816 | |||
5817 | /*! | ||
5818 | * @} | ||
5819 | */ /* end of group OTPC_Peripheral_Access_Layer */ | ||
5820 | |||
5821 | |||
5822 | /* ---------------------------------------------------------------------------- | ||
5823 | -- PINT Peripheral Access Layer | ||
5824 | ---------------------------------------------------------------------------- */ | ||
5825 | |||
5826 | /*! | ||
5827 | * @addtogroup PINT_Peripheral_Access_Layer PINT Peripheral Access Layer | ||
5828 | * @{ | ||
5829 | */ | ||
5830 | |||
5831 | /** PINT - Register Layout Typedef */ | ||
5832 | typedef struct { | ||
5833 | __IO uint32_t ISEL; /**< Pin Interrupt Mode register, offset: 0x0 */ | ||
5834 | __IO uint32_t IENR; /**< Pin interrupt level or rising edge interrupt enable register, offset: 0x4 */ | ||
5835 | __O uint32_t SIENR; /**< Pin interrupt level or rising edge interrupt set register, offset: 0x8 */ | ||
5836 | __O uint32_t CIENR; /**< Pin interrupt level (rising edge interrupt) clear register, offset: 0xC */ | ||
5837 | __IO uint32_t IENF; /**< Pin interrupt active level or falling edge interrupt enable register, offset: 0x10 */ | ||
5838 | __O uint32_t SIENF; /**< Pin interrupt active level or falling edge interrupt set register, offset: 0x14 */ | ||
5839 | __O uint32_t CIENF; /**< Pin interrupt active level or falling edge interrupt clear register, offset: 0x18 */ | ||
5840 | __IO uint32_t RISE; /**< Pin interrupt rising edge register, offset: 0x1C */ | ||
5841 | __IO uint32_t FALL; /**< Pin interrupt falling edge register, offset: 0x20 */ | ||
5842 | __IO uint32_t IST; /**< Pin interrupt status register, offset: 0x24 */ | ||
5843 | __IO uint32_t PMCTRL; /**< Pattern match interrupt control register, offset: 0x28 */ | ||
5844 | __IO uint32_t PMSRC; /**< Pattern match interrupt bit-slice source register, offset: 0x2C */ | ||
5845 | __IO uint32_t PMCFG; /**< Pattern match interrupt bit slice configuration register, offset: 0x30 */ | ||
5846 | } PINT_Type; | ||
5847 | |||
5848 | /* ---------------------------------------------------------------------------- | ||
5849 | -- PINT Register Masks | ||
5850 | ---------------------------------------------------------------------------- */ | ||
5851 | |||
5852 | /*! | ||
5853 | * @addtogroup PINT_Register_Masks PINT Register Masks | ||
5854 | * @{ | ||
5855 | */ | ||
5856 | |||
5857 | /*! @name ISEL - Pin Interrupt Mode register */ | ||
5858 | /*! @{ */ | ||
5859 | #define PINT_ISEL_PMODE_MASK (0xFFU) | ||
5860 | #define PINT_ISEL_PMODE_SHIFT (0U) | ||
5861 | /*! PMODE - Selects the interrupt mode for each pin interrupt. Bit n configures the pin interrupt | ||
5862 | * selected in PINTSELn. 0 = Edge sensitive 1 = Level sensitive | ||
5863 | */ | ||
5864 | #define PINT_ISEL_PMODE(x) (((uint32_t)(((uint32_t)(x)) << PINT_ISEL_PMODE_SHIFT)) & PINT_ISEL_PMODE_MASK) | ||
5865 | /*! @} */ | ||
5866 | |||
5867 | /*! @name IENR - Pin interrupt level or rising edge interrupt enable register */ | ||
5868 | /*! @{ */ | ||
5869 | #define PINT_IENR_ENRL_MASK (0xFFU) | ||
5870 | #define PINT_IENR_ENRL_SHIFT (0U) | ||
5871 | /*! ENRL - Enables the rising edge or level interrupt for each pin interrupt. Bit n configures the | ||
5872 | * pin interrupt selected in PINTSELn. 0 = Disable rising edge or level interrupt. 1 = Enable | ||
5873 | * rising edge or level interrupt. | ||
5874 | */ | ||
5875 | #define PINT_IENR_ENRL(x) (((uint32_t)(((uint32_t)(x)) << PINT_IENR_ENRL_SHIFT)) & PINT_IENR_ENRL_MASK) | ||
5876 | /*! @} */ | ||
5877 | |||
5878 | /*! @name SIENR - Pin interrupt level or rising edge interrupt set register */ | ||
5879 | /*! @{ */ | ||
5880 | #define PINT_SIENR_SETENRL_MASK (0xFFU) | ||
5881 | #define PINT_SIENR_SETENRL_SHIFT (0U) | ||
5882 | /*! SETENRL - Ones written to this address set bits in the IENR, thus enabling interrupts. Bit n | ||
5883 | * sets bit n in the IENR register. 0 = No operation. 1 = Enable rising edge or level interrupt. | ||
5884 | */ | ||
5885 | #define PINT_SIENR_SETENRL(x) (((uint32_t)(((uint32_t)(x)) << PINT_SIENR_SETENRL_SHIFT)) & PINT_SIENR_SETENRL_MASK) | ||
5886 | /*! @} */ | ||
5887 | |||
5888 | /*! @name CIENR - Pin interrupt level (rising edge interrupt) clear register */ | ||
5889 | /*! @{ */ | ||
5890 | #define PINT_CIENR_CENRL_MASK (0xFFU) | ||
5891 | #define PINT_CIENR_CENRL_SHIFT (0U) | ||
5892 | /*! CENRL - Ones written to this address clear bits in the IENR, thus disabling the interrupts. Bit | ||
5893 | * n clears bit n in the IENR register. 0 = No operation. 1 = Disable rising edge or level | ||
5894 | * interrupt. | ||
5895 | */ | ||
5896 | #define PINT_CIENR_CENRL(x) (((uint32_t)(((uint32_t)(x)) << PINT_CIENR_CENRL_SHIFT)) & PINT_CIENR_CENRL_MASK) | ||
5897 | /*! @} */ | ||
5898 | |||
5899 | /*! @name IENF - Pin interrupt active level or falling edge interrupt enable register */ | ||
5900 | /*! @{ */ | ||
5901 | #define PINT_IENF_ENAF_MASK (0xFFU) | ||
5902 | #define PINT_IENF_ENAF_SHIFT (0U) | ||
5903 | /*! ENAF - Enables the falling edge or configures the active level interrupt for each pin interrupt. | ||
5904 | * Bit n configures the pin interrupt selected in PINTSELn. 0 = Disable falling edge interrupt | ||
5905 | * or set active interrupt level LOW. 1 = Enable falling edge interrupt enabled or set active | ||
5906 | * interrupt level HIGH. | ||
5907 | */ | ||
5908 | #define PINT_IENF_ENAF(x) (((uint32_t)(((uint32_t)(x)) << PINT_IENF_ENAF_SHIFT)) & PINT_IENF_ENAF_MASK) | ||
5909 | /*! @} */ | ||
5910 | |||
5911 | /*! @name SIENF - Pin interrupt active level or falling edge interrupt set register */ | ||
5912 | /*! @{ */ | ||
5913 | #define PINT_SIENF_SETENAF_MASK (0xFFU) | ||
5914 | #define PINT_SIENF_SETENAF_SHIFT (0U) | ||
5915 | /*! SETENAF - Ones written to this address set bits in the IENF, thus enabling interrupts. Bit n | ||
5916 | * sets bit n in the IENF register. 0 = No operation. 1 = Select HIGH-active interrupt or enable | ||
5917 | * falling edge interrupt. | ||
5918 | */ | ||
5919 | #define PINT_SIENF_SETENAF(x) (((uint32_t)(((uint32_t)(x)) << PINT_SIENF_SETENAF_SHIFT)) & PINT_SIENF_SETENAF_MASK) | ||
5920 | /*! @} */ | ||
5921 | |||
5922 | /*! @name CIENF - Pin interrupt active level or falling edge interrupt clear register */ | ||
5923 | /*! @{ */ | ||
5924 | #define PINT_CIENF_CENAF_MASK (0xFFU) | ||
5925 | #define PINT_CIENF_CENAF_SHIFT (0U) | ||
5926 | /*! CENAF - Ones written to this address clears bits in the IENF, thus disabling interrupts. Bit n | ||
5927 | * clears bit n in the IENF register. 0 = No operation. 1 = LOW-active interrupt selected or | ||
5928 | * falling edge interrupt disabled. | ||
5929 | */ | ||
5930 | #define PINT_CIENF_CENAF(x) (((uint32_t)(((uint32_t)(x)) << PINT_CIENF_CENAF_SHIFT)) & PINT_CIENF_CENAF_MASK) | ||
5931 | /*! @} */ | ||
5932 | |||
5933 | /*! @name RISE - Pin interrupt rising edge register */ | ||
5934 | /*! @{ */ | ||
5935 | #define PINT_RISE_RDET_MASK (0xFFU) | ||
5936 | #define PINT_RISE_RDET_SHIFT (0U) | ||
5937 | /*! RDET - Rising edge detect. Bit n detects the rising edge of the pin selected in PINTSELn. Read | ||
5938 | * 0: No rising edge has been detected on this pin since Reset or the last time a one was written | ||
5939 | * to this bit. Write 0: no operation. Read 1: a rising edge has been detected since Reset or the | ||
5940 | * last time a one was written to this bit. Write 1: clear rising edge detection for this pin. | ||
5941 | */ | ||
5942 | #define PINT_RISE_RDET(x) (((uint32_t)(((uint32_t)(x)) << PINT_RISE_RDET_SHIFT)) & PINT_RISE_RDET_MASK) | ||
5943 | /*! @} */ | ||
5944 | |||
5945 | /*! @name FALL - Pin interrupt falling edge register */ | ||
5946 | /*! @{ */ | ||
5947 | #define PINT_FALL_FDET_MASK (0xFFU) | ||
5948 | #define PINT_FALL_FDET_SHIFT (0U) | ||
5949 | /*! FDET - Falling edge detect. Bit n detects the falling edge of the pin selected in PINTSELn. Read | ||
5950 | * 0: No falling edge has been detected on this pin since Reset or the last time a one was | ||
5951 | * written to this bit. Write 0: no operation. Read 1: a falling edge has been detected since Reset or | ||
5952 | * the last time a one was written to this bit. Write 1: clear falling edge detection for this | ||
5953 | * pin. | ||
5954 | */ | ||
5955 | #define PINT_FALL_FDET(x) (((uint32_t)(((uint32_t)(x)) << PINT_FALL_FDET_SHIFT)) & PINT_FALL_FDET_MASK) | ||
5956 | /*! @} */ | ||
5957 | |||
5958 | /*! @name IST - Pin interrupt status register */ | ||
5959 | /*! @{ */ | ||
5960 | #define PINT_IST_PSTAT_MASK (0xFFU) | ||
5961 | #define PINT_IST_PSTAT_SHIFT (0U) | ||
5962 | /*! PSTAT - Pin interrupt status. Bit n returns the status, clears the edge interrupt, or inverts | ||
5963 | * the active level of the pin selected in PINTSELn. Read 0: interrupt is not being requested for | ||
5964 | * this interrupt pin. Write 0: no operation. Read 1: interrupt is being requested for this | ||
5965 | * interrupt pin. Write 1 (edge-sensitive): clear rising- and falling-edge detection for this pin. | ||
5966 | * Write 1 (level-sensitive): switch the active level for this pin (in the IENF register). | ||
5967 | */ | ||
5968 | #define PINT_IST_PSTAT(x) (((uint32_t)(((uint32_t)(x)) << PINT_IST_PSTAT_SHIFT)) & PINT_IST_PSTAT_MASK) | ||
5969 | /*! @} */ | ||
5970 | |||
5971 | /*! @name PMCTRL - Pattern match interrupt control register */ | ||
5972 | /*! @{ */ | ||
5973 | #define PINT_PMCTRL_SEL_PMATCH_MASK (0x1U) | ||
5974 | #define PINT_PMCTRL_SEL_PMATCH_SHIFT (0U) | ||
5975 | /*! SEL_PMATCH - Specifies whether the 8 pin interrupts are controlled by the pin interrupt function or by the pattern match function. | ||
5976 | * 0b0..Pin interrupt. Interrupts are driven in response to the standard pin interrupt function. | ||
5977 | * 0b1..Pattern match. Interrupts are driven in response to pattern matches. | ||
5978 | */ | ||
5979 | #define PINT_PMCTRL_SEL_PMATCH(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCTRL_SEL_PMATCH_SHIFT)) & PINT_PMCTRL_SEL_PMATCH_MASK) | ||
5980 | #define PINT_PMCTRL_ENA_RXEV_MASK (0x2U) | ||
5981 | #define PINT_PMCTRL_ENA_RXEV_SHIFT (1U) | ||
5982 | /*! ENA_RXEV - Enables the RXEV output to the CPU and/or to a GPIO output when the specified boolean expression evaluates to true. | ||
5983 | * 0b0..Disabled. RXEV output to the CPU is disabled. | ||
5984 | * 0b1..Enabled. RXEV output to the CPU is enabled. | ||
5985 | */ | ||
5986 | #define PINT_PMCTRL_ENA_RXEV(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCTRL_ENA_RXEV_SHIFT)) & PINT_PMCTRL_ENA_RXEV_MASK) | ||
5987 | #define PINT_PMCTRL_PMAT_MASK (0xFF000000U) | ||
5988 | #define PINT_PMCTRL_PMAT_SHIFT (24U) | ||
5989 | /*! PMAT - This field displays the current state of pattern matches. A 1 in any bit of this field | ||
5990 | * indicates that the corresponding product term is matched by the current state of the appropriate | ||
5991 | * inputs. | ||
5992 | */ | ||
5993 | #define PINT_PMCTRL_PMAT(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCTRL_PMAT_SHIFT)) & PINT_PMCTRL_PMAT_MASK) | ||
5994 | /*! @} */ | ||
5995 | |||
5996 | /*! @name PMSRC - Pattern match interrupt bit-slice source register */ | ||
5997 | /*! @{ */ | ||
5998 | #define PINT_PMSRC_SRC0_MASK (0x700U) | ||
5999 | #define PINT_PMSRC_SRC0_SHIFT (8U) | ||
6000 | /*! SRC0 - Selects the input source for bit slice 0 | ||
6001 | * 0b000..Input 0. Selects the pin selected in the PINTSEL0 register as the source to bit slice 0. | ||
6002 | * 0b001..Input 1. Selects the pin selected in the PINTSEL1 register as the source to bit slice 0. | ||
6003 | * 0b010..Input 2. Selects the pin selected in the PINTSEL2 register as the source to bit slice 0. | ||
6004 | * 0b011..Input 3. Selects the pin selected in the PINTSEL3 register as the source to bit slice 0. | ||
6005 | * 0b100..Input 4. Selects the pin selected in the PINTSEL4 register as the source to bit slice 0. | ||
6006 | * 0b101..Input 5. Selects the pin selected in the PINTSEL5 register as the source to bit slice 0. | ||
6007 | * 0b110..Input 6. Selects the pin selected in the PINTSEL6 register as the source to bit slice 0. | ||
6008 | * 0b111..Input 7. Selects the pin selected in the PINTSEL7 register as the source to bit slice 0. | ||
6009 | */ | ||
6010 | #define PINT_PMSRC_SRC0(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMSRC_SRC0_SHIFT)) & PINT_PMSRC_SRC0_MASK) | ||
6011 | #define PINT_PMSRC_SRC1_MASK (0x3800U) | ||
6012 | #define PINT_PMSRC_SRC1_SHIFT (11U) | ||
6013 | /*! SRC1 - Selects the input source for bit slice 1 | ||
6014 | * 0b000..Input 0. Selects the pin selected in the PINTSEL0 register as the source to bit slice 1. | ||
6015 | * 0b001..Input 1. Selects the pin selected in the PINTSEL1 register as the source to bit slice 1. | ||
6016 | * 0b010..Input 2. Selects the pin selected in the PINTSEL2 register as the source to bit slice 1. | ||
6017 | * 0b011..Input 3. Selects the pin selected in the PINTSEL3 register as the source to bit slice 1. | ||
6018 | * 0b100..Input 4. Selects the pin selected in the PINTSEL4 register as the source to bit slice 1. | ||
6019 | * 0b101..Input 5. Selects the pin selected in the PINTSEL5 register as the source to bit slice 1. | ||
6020 | * 0b110..Input 6. Selects the pin selected in the PINTSEL6 register as the source to bit slice 1. | ||
6021 | * 0b111..Input 7. Selects the pin selected in the PINTSEL7 register as the source to bit slice 1. | ||
6022 | */ | ||
6023 | #define PINT_PMSRC_SRC1(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMSRC_SRC1_SHIFT)) & PINT_PMSRC_SRC1_MASK) | ||
6024 | #define PINT_PMSRC_SRC2_MASK (0x1C000U) | ||
6025 | #define PINT_PMSRC_SRC2_SHIFT (14U) | ||
6026 | /*! SRC2 - Selects the input source for bit slice 2 | ||
6027 | * 0b000..Input 0. Selects the pin selected in the PINTSEL0 register as the source to bit slice 2. | ||
6028 | * 0b001..Input 1. Selects the pin selected in the PINTSEL1 register as the source to bit slice 2. | ||
6029 | * 0b010..Input 2. Selects the pin selected in the PINTSEL2 register as the source to bit slice 2. | ||
6030 | * 0b011..Input 3. Selects the pin selected in the PINTSEL3 register as the source to bit slice 2. | ||
6031 | * 0b100..Input 4. Selects the pin selected in the PINTSEL4 register as the source to bit slice 2. | ||
6032 | * 0b101..Input 5. Selects the pin selected in the PINTSEL5 register as the source to bit slice 2. | ||
6033 | * 0b110..Input 6. Selects the pin selected in the PINTSEL6 register as the source to bit slice 2. | ||
6034 | * 0b111..Input 7. Selects the pin selected in the PINTSEL7 register as the source to bit slice 2. | ||
6035 | */ | ||
6036 | #define PINT_PMSRC_SRC2(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMSRC_SRC2_SHIFT)) & PINT_PMSRC_SRC2_MASK) | ||
6037 | #define PINT_PMSRC_SRC3_MASK (0xE0000U) | ||
6038 | #define PINT_PMSRC_SRC3_SHIFT (17U) | ||
6039 | /*! SRC3 - Selects the input source for bit slice 3 | ||
6040 | * 0b000..Input 0. Selects the pin selected in the PINTSEL0 register as the source to bit slice 3. | ||
6041 | * 0b001..Input 1. Selects the pin selected in the PINTSEL1 register as the source to bit slice 3. | ||
6042 | * 0b010..Input 2. Selects the pin selected in the PINTSEL2 register as the source to bit slice 3. | ||
6043 | * 0b011..Input 3. Selects the pin selected in the PINTSEL3 register as the source to bit slice 3. | ||
6044 | * 0b100..Input 4. Selects the pin selected in the PINTSEL4 register as the source to bit slice 3. | ||
6045 | * 0b101..Input 5. Selects the pin selected in the PINTSEL5 register as the source to bit slice 3. | ||
6046 | * 0b110..Input 6. Selects the pin selected in the PINTSEL6 register as the source to bit slice 3. | ||
6047 | * 0b111..Input 7. Selects the pin selected in the PINTSEL7 register as the source to bit slice 3. | ||
6048 | */ | ||
6049 | #define PINT_PMSRC_SRC3(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMSRC_SRC3_SHIFT)) & PINT_PMSRC_SRC3_MASK) | ||
6050 | #define PINT_PMSRC_SRC4_MASK (0x700000U) | ||
6051 | #define PINT_PMSRC_SRC4_SHIFT (20U) | ||
6052 | /*! SRC4 - Selects the input source for bit slice 4 | ||
6053 | * 0b000..Input 0. Selects the pin selected in the PINTSEL0 register as the source to bit slice 4. | ||
6054 | * 0b001..Input 1. Selects the pin selected in the PINTSEL1 register as the source to bit slice 4. | ||
6055 | * 0b010..Input 2. Selects the pin selected in the PINTSEL2 register as the source to bit slice 4. | ||
6056 | * 0b011..Input 3. Selects the pin selected in the PINTSEL3 register as the source to bit slice 4. | ||
6057 | * 0b100..Input 4. Selects the pin selected in the PINTSEL4 register as the source to bit slice 4. | ||
6058 | * 0b101..Input 5. Selects the pin selected in the PINTSEL5 register as the source to bit slice 4. | ||
6059 | * 0b110..Input 6. Selects the pin selected in the PINTSEL6 register as the source to bit slice 4. | ||
6060 | * 0b111..Input 7. Selects the pin selected in the PINTSEL7 register as the source to bit slice 4. | ||
6061 | */ | ||
6062 | #define PINT_PMSRC_SRC4(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMSRC_SRC4_SHIFT)) & PINT_PMSRC_SRC4_MASK) | ||
6063 | #define PINT_PMSRC_SRC5_MASK (0x3800000U) | ||
6064 | #define PINT_PMSRC_SRC5_SHIFT (23U) | ||
6065 | /*! SRC5 - Selects the input source for bit slice 5 | ||
6066 | * 0b000..Input 0. Selects the pin selected in the PINTSEL0 register as the source to bit slice 5. | ||
6067 | * 0b001..Input 1. Selects the pin selected in the PINTSEL1 register as the source to bit slice 5. | ||
6068 | * 0b010..Input 2. Selects the pin selected in the PINTSEL2 register as the source to bit slice 5. | ||
6069 | * 0b011..Input 3. Selects the pin selected in the PINTSEL3 register as the source to bit slice 5. | ||
6070 | * 0b100..Input 4. Selects the pin selected in the PINTSEL4 register as the source to bit slice 5. | ||
6071 | * 0b101..Input 5. Selects the pin selected in the PINTSEL5 register as the source to bit slice 5. | ||
6072 | * 0b110..Input 6. Selects the pin selected in the PINTSEL6 register as the source to bit slice 5. | ||
6073 | * 0b111..Input 7. Selects the pin selected in the PINTSEL7 register as the source to bit slice 5. | ||
6074 | */ | ||
6075 | #define PINT_PMSRC_SRC5(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMSRC_SRC5_SHIFT)) & PINT_PMSRC_SRC5_MASK) | ||
6076 | #define PINT_PMSRC_SRC6_MASK (0x1C000000U) | ||
6077 | #define PINT_PMSRC_SRC6_SHIFT (26U) | ||
6078 | /*! SRC6 - Selects the input source for bit slice 6 | ||
6079 | * 0b000..Input 0. Selects the pin selected in the PINTSEL0 register as the source to bit slice 6. | ||
6080 | * 0b001..Input 1. Selects the pin selected in the PINTSEL1 register as the source to bit slice 6. | ||
6081 | * 0b010..Input 2. Selects the pin selected in the PINTSEL2 register as the source to bit slice 6. | ||
6082 | * 0b011..Input 3. Selects the pin selected in the PINTSEL3 register as the source to bit slice 6. | ||
6083 | * 0b100..Input 4. Selects the pin selected in the PINTSEL4 register as the source to bit slice 6. | ||
6084 | * 0b101..Input 5. Selects the pin selected in the PINTSEL5 register as the source to bit slice 6. | ||
6085 | * 0b110..Input 6. Selects the pin selected in the PINTSEL6 register as the source to bit slice 6. | ||
6086 | * 0b111..Input 7. Selects the pin selected in the PINTSEL7 register as the source to bit slice 6. | ||
6087 | */ | ||
6088 | #define PINT_PMSRC_SRC6(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMSRC_SRC6_SHIFT)) & PINT_PMSRC_SRC6_MASK) | ||
6089 | #define PINT_PMSRC_SRC7_MASK (0xE0000000U) | ||
6090 | #define PINT_PMSRC_SRC7_SHIFT (29U) | ||
6091 | /*! SRC7 - Selects the input source for bit slice 7 | ||
6092 | * 0b000..Input 0. Selects the pin selected in the PINTSEL0 register as the source to bit slice 7. | ||
6093 | * 0b001..Input 1. Selects the pin selected in the PINTSEL1 register as the source to bit slice 7. | ||
6094 | * 0b010..Input 2. Selects the pin selected in the PINTSEL2 register as the source to bit slice 7. | ||
6095 | * 0b011..Input 3. Selects the pin selected in the PINTSEL3 register as the source to bit slice 7. | ||
6096 | * 0b100..Input 4. Selects the pin selected in the PINTSEL4 register as the source to bit slice 7. | ||
6097 | * 0b101..Input 5. Selects the pin selected in the PINTSEL5 register as the source to bit slice 7. | ||
6098 | * 0b110..Input 6. Selects the pin selected in the PINTSEL6 register as the source to bit slice 7. | ||
6099 | * 0b111..Input 7. Selects the pin selected in the PINTSEL7 register as the source to bit slice 7. | ||
6100 | */ | ||
6101 | #define PINT_PMSRC_SRC7(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMSRC_SRC7_SHIFT)) & PINT_PMSRC_SRC7_MASK) | ||
6102 | /*! @} */ | ||
6103 | |||
6104 | /*! @name PMCFG - Pattern match interrupt bit slice configuration register */ | ||
6105 | /*! @{ */ | ||
6106 | #define PINT_PMCFG_PROD_ENDPTS0_MASK (0x1U) | ||
6107 | #define PINT_PMCFG_PROD_ENDPTS0_SHIFT (0U) | ||
6108 | /*! PROD_ENDPTS0 - Determines whether slice 0 is an endpoint. | ||
6109 | * 0b0..No effect. Slice 0 is not an endpoint. | ||
6110 | * 0b1..endpoint. Slice 0 is the endpoint of a product term (minterm). Pin interrupt 0 in the NVIC is raised if the minterm evaluates as true. | ||
6111 | */ | ||
6112 | #define PINT_PMCFG_PROD_ENDPTS0(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_PROD_ENDPTS0_SHIFT)) & PINT_PMCFG_PROD_ENDPTS0_MASK) | ||
6113 | #define PINT_PMCFG_PROD_ENDPTS1_MASK (0x2U) | ||
6114 | #define PINT_PMCFG_PROD_ENDPTS1_SHIFT (1U) | ||
6115 | /*! PROD_ENDPTS1 - Determines whether slice 1 is an endpoint. | ||
6116 | * 0b0..No effect. Slice 1 is not an endpoint. | ||
6117 | * 0b1..endpoint. Slice 1 is the endpoint of a product term (minterm). Pin interrupt 1 in the NVIC is raised if the minterm evaluates as true. | ||
6118 | */ | ||
6119 | #define PINT_PMCFG_PROD_ENDPTS1(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_PROD_ENDPTS1_SHIFT)) & PINT_PMCFG_PROD_ENDPTS1_MASK) | ||
6120 | #define PINT_PMCFG_PROD_ENDPTS2_MASK (0x4U) | ||
6121 | #define PINT_PMCFG_PROD_ENDPTS2_SHIFT (2U) | ||
6122 | /*! PROD_ENDPTS2 - Determines whether slice 2 is an endpoint. | ||
6123 | * 0b0..No effect. Slice 2 is not an endpoint. | ||
6124 | * 0b1..endpoint. Slice 2 is the endpoint of a product term (minterm). Pin interrupt 2 in the NVIC is raised if the minterm evaluates as true. | ||
6125 | */ | ||
6126 | #define PINT_PMCFG_PROD_ENDPTS2(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_PROD_ENDPTS2_SHIFT)) & PINT_PMCFG_PROD_ENDPTS2_MASK) | ||
6127 | #define PINT_PMCFG_PROD_ENDPTS3_MASK (0x8U) | ||
6128 | #define PINT_PMCFG_PROD_ENDPTS3_SHIFT (3U) | ||
6129 | /*! PROD_ENDPTS3 - Determines whether slice 3 is an endpoint. | ||
6130 | * 0b0..No effect. Slice 3 is not an endpoint. | ||
6131 | * 0b1..endpoint. Slice 3 is the endpoint of a product term (minterm). Pin interrupt 3 in the NVIC is raised if the minterm evaluates as true. | ||
6132 | */ | ||
6133 | #define PINT_PMCFG_PROD_ENDPTS3(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_PROD_ENDPTS3_SHIFT)) & PINT_PMCFG_PROD_ENDPTS3_MASK) | ||
6134 | #define PINT_PMCFG_PROD_ENDPTS4_MASK (0x10U) | ||
6135 | #define PINT_PMCFG_PROD_ENDPTS4_SHIFT (4U) | ||
6136 | /*! PROD_ENDPTS4 - Determines whether slice 4 is an endpoint. | ||
6137 | * 0b0..No effect. Slice 4 is not an endpoint. | ||
6138 | * 0b1..endpoint. Slice 4 is the endpoint of a product term (minterm). Pin interrupt 4 in the NVIC is raised if the minterm evaluates as true. | ||
6139 | */ | ||
6140 | #define PINT_PMCFG_PROD_ENDPTS4(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_PROD_ENDPTS4_SHIFT)) & PINT_PMCFG_PROD_ENDPTS4_MASK) | ||
6141 | #define PINT_PMCFG_PROD_ENDPTS5_MASK (0x20U) | ||
6142 | #define PINT_PMCFG_PROD_ENDPTS5_SHIFT (5U) | ||
6143 | /*! PROD_ENDPTS5 - Determines whether slice 5 is an endpoint. | ||
6144 | * 0b0..No effect. Slice 5 is not an endpoint. | ||
6145 | * 0b1..endpoint. Slice 5 is the endpoint of a product term (minterm). Pin interrupt 5 in the NVIC is raised if the minterm evaluates as true. | ||
6146 | */ | ||
6147 | #define PINT_PMCFG_PROD_ENDPTS5(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_PROD_ENDPTS5_SHIFT)) & PINT_PMCFG_PROD_ENDPTS5_MASK) | ||
6148 | #define PINT_PMCFG_PROD_ENDPTS6_MASK (0x40U) | ||
6149 | #define PINT_PMCFG_PROD_ENDPTS6_SHIFT (6U) | ||
6150 | /*! PROD_ENDPTS6 - Determines whether slice 6 is an endpoint. | ||
6151 | * 0b0..No effect. Slice 6 is not an endpoint. | ||
6152 | * 0b1..endpoint. Slice 6 is the endpoint of a product term (minterm). Pin interrupt 6 in the NVIC is raised if the minterm evaluates as true. | ||
6153 | */ | ||
6154 | #define PINT_PMCFG_PROD_ENDPTS6(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_PROD_ENDPTS6_SHIFT)) & PINT_PMCFG_PROD_ENDPTS6_MASK) | ||
6155 | #define PINT_PMCFG_CFG0_MASK (0x700U) | ||
6156 | #define PINT_PMCFG_CFG0_SHIFT (8U) | ||
6157 | /*! CFG0 - Specifies the match contribution condition for bit slice 0. | ||
6158 | * 0b000..Constant HIGH. This bit slice always contributes to a product term match. | ||
6159 | * 0b001..Sticky rising edge. Match occurs if a rising edge on the specified input has occurred since the last | ||
6160 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6161 | * PMSRC registers are written to. | ||
6162 | * 0b010..Sticky falling edge. Match occurs if a falling edge on the specified input has occurred since the last | ||
6163 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6164 | * PMSRC registers are written to. | ||
6165 | * 0b011..Sticky rising or falling edge. Match occurs if either a rising or falling edge on the specified input | ||
6166 | * has occurred since the last time the edge detection for this bit slice was cleared. This bit is only | ||
6167 | * cleared when the PMCFG or the PMSRC registers are written to. | ||
6168 | * 0b100..High level. Match (for this bit slice) occurs when there is a high level on the input specified for this bit slice in the PMSRC register. | ||
6169 | * 0b101..Low level. Match occurs when there is a low level on the specified input. | ||
6170 | * 0b110..Constant 0. This bit slice never contributes to a match (should be used to disable any unused bit slices). | ||
6171 | * 0b111..Event. Non-sticky rising or falling edge. Match occurs on an event - i.e. when either a rising or | ||
6172 | * falling edge is first detected on the specified input (this is a non-sticky version of value 0x3) . This bit | ||
6173 | * is cleared after one clock cycle. | ||
6174 | */ | ||
6175 | #define PINT_PMCFG_CFG0(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_CFG0_SHIFT)) & PINT_PMCFG_CFG0_MASK) | ||
6176 | #define PINT_PMCFG_CFG1_MASK (0x3800U) | ||
6177 | #define PINT_PMCFG_CFG1_SHIFT (11U) | ||
6178 | /*! CFG1 - Specifies the match contribution condition for bit slice 1. | ||
6179 | * 0b000..Constant HIGH. This bit slice always contributes to a product term match. | ||
6180 | * 0b001..Sticky rising edge. Match occurs if a rising edge on the specified input has occurred since the last | ||
6181 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6182 | * PMSRC registers are written to. | ||
6183 | * 0b010..Sticky falling edge. Match occurs if a falling edge on the specified input has occurred since the last | ||
6184 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6185 | * PMSRC registers are written to. | ||
6186 | * 0b011..Sticky rising or falling edge. Match occurs if either a rising or falling edge on the specified input | ||
6187 | * has occurred since the last time the edge detection for this bit slice was cleared. This bit is only | ||
6188 | * cleared when the PMCFG or the PMSRC registers are written to. | ||
6189 | * 0b100..High level. Match (for this bit slice) occurs when there is a high level on the input specified for this bit slice in the PMSRC register. | ||
6190 | * 0b101..Low level. Match occurs when there is a low level on the specified input. | ||
6191 | * 0b110..Constant 0. This bit slice never contributes to a match (should be used to disable any unused bit slices). | ||
6192 | * 0b111..Event. Non-sticky rising or falling edge. Match occurs on an event - i.e. when either a rising or | ||
6193 | * falling edge is first detected on the specified input (this is a non-sticky version of value 0x3) . This bit | ||
6194 | * is cleared after one clock cycle. | ||
6195 | */ | ||
6196 | #define PINT_PMCFG_CFG1(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_CFG1_SHIFT)) & PINT_PMCFG_CFG1_MASK) | ||
6197 | #define PINT_PMCFG_CFG2_MASK (0x1C000U) | ||
6198 | #define PINT_PMCFG_CFG2_SHIFT (14U) | ||
6199 | /*! CFG2 - Specifies the match contribution condition for bit slice 2. | ||
6200 | * 0b000..Constant HIGH. This bit slice always contributes to a product term match. | ||
6201 | * 0b001..Sticky rising edge. Match occurs if a rising edge on the specified input has occurred since the last | ||
6202 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6203 | * PMSRC registers are written to. | ||
6204 | * 0b010..Sticky falling edge. Match occurs if a falling edge on the specified input has occurred since the last | ||
6205 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6206 | * PMSRC registers are written to. | ||
6207 | * 0b011..Sticky rising or falling edge. Match occurs if either a rising or falling edge on the specified input | ||
6208 | * has occurred since the last time the edge detection for this bit slice was cleared. This bit is only | ||
6209 | * cleared when the PMCFG or the PMSRC registers are written to. | ||
6210 | * 0b100..High level. Match (for this bit slice) occurs when there is a high level on the input specified for this bit slice in the PMSRC register. | ||
6211 | * 0b101..Low level. Match occurs when there is a low level on the specified input. | ||
6212 | * 0b110..Constant 0. This bit slice never contributes to a match (should be used to disable any unused bit slices). | ||
6213 | * 0b111..Event. Non-sticky rising or falling edge. Match occurs on an event - i.e. when either a rising or | ||
6214 | * falling edge is first detected on the specified input (this is a non-sticky version of value 0x3) . This bit | ||
6215 | * is cleared after one clock cycle. | ||
6216 | */ | ||
6217 | #define PINT_PMCFG_CFG2(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_CFG2_SHIFT)) & PINT_PMCFG_CFG2_MASK) | ||
6218 | #define PINT_PMCFG_CFG3_MASK (0xE0000U) | ||
6219 | #define PINT_PMCFG_CFG3_SHIFT (17U) | ||
6220 | /*! CFG3 - Specifies the match contribution condition for bit slice 3. | ||
6221 | * 0b000..Constant HIGH. This bit slice always contributes to a product term match. | ||
6222 | * 0b001..Sticky rising edge. Match occurs if a rising edge on the specified input has occurred since the last | ||
6223 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6224 | * PMSRC registers are written to. | ||
6225 | * 0b010..Sticky falling edge. Match occurs if a falling edge on the specified input has occurred since the last | ||
6226 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6227 | * PMSRC registers are written to. | ||
6228 | * 0b011..Sticky rising or falling edge. Match occurs if either a rising or falling edge on the specified input | ||
6229 | * has occurred since the last time the edge detection for this bit slice was cleared. This bit is only | ||
6230 | * cleared when the PMCFG or the PMSRC registers are written to. | ||
6231 | * 0b100..High level. Match (for this bit slice) occurs when there is a high level on the input specified for this bit slice in the PMSRC register. | ||
6232 | * 0b101..Low level. Match occurs when there is a low level on the specified input. | ||
6233 | * 0b110..Constant 0. This bit slice never contributes to a match (should be used to disable any unused bit slices). | ||
6234 | * 0b111..Event. Non-sticky rising or falling edge. Match occurs on an event - i.e. when either a rising or | ||
6235 | * falling edge is first detected on the specified input (this is a non-sticky version of value 0x3) . This bit | ||
6236 | * is cleared after one clock cycle. | ||
6237 | */ | ||
6238 | #define PINT_PMCFG_CFG3(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_CFG3_SHIFT)) & PINT_PMCFG_CFG3_MASK) | ||
6239 | #define PINT_PMCFG_CFG4_MASK (0x700000U) | ||
6240 | #define PINT_PMCFG_CFG4_SHIFT (20U) | ||
6241 | /*! CFG4 - Specifies the match contribution condition for bit slice 4. | ||
6242 | * 0b000..Constant HIGH. This bit slice always contributes to a product term match. | ||
6243 | * 0b001..Sticky rising edge. Match occurs if a rising edge on the specified input has occurred since the last | ||
6244 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6245 | * PMSRC registers are written to. | ||
6246 | * 0b010..Sticky falling edge. Match occurs if a falling edge on the specified input has occurred since the last | ||
6247 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6248 | * PMSRC registers are written to. | ||
6249 | * 0b011..Sticky rising or falling edge. Match occurs if either a rising or falling edge on the specified input | ||
6250 | * has occurred since the last time the edge detection for this bit slice was cleared. This bit is only | ||
6251 | * cleared when the PMCFG or the PMSRC registers are written to. | ||
6252 | * 0b100..High level. Match (for this bit slice) occurs when there is a high level on the input specified for this bit slice in the PMSRC register. | ||
6253 | * 0b101..Low level. Match occurs when there is a low level on the specified input. | ||
6254 | * 0b110..Constant 0. This bit slice never contributes to a match (should be used to disable any unused bit slices). | ||
6255 | * 0b111..Event. Non-sticky rising or falling edge. Match occurs on an event - i.e. when either a rising or | ||
6256 | * falling edge is first detected on the specified input (this is a non-sticky version of value 0x3) . This bit | ||
6257 | * is cleared after one clock cycle. | ||
6258 | */ | ||
6259 | #define PINT_PMCFG_CFG4(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_CFG4_SHIFT)) & PINT_PMCFG_CFG4_MASK) | ||
6260 | #define PINT_PMCFG_CFG5_MASK (0x3800000U) | ||
6261 | #define PINT_PMCFG_CFG5_SHIFT (23U) | ||
6262 | /*! CFG5 - Specifies the match contribution condition for bit slice 5. | ||
6263 | * 0b000..Constant HIGH. This bit slice always contributes to a product term match. | ||
6264 | * 0b001..Sticky rising edge. Match occurs if a rising edge on the specified input has occurred since the last | ||
6265 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6266 | * PMSRC registers are written to. | ||
6267 | * 0b010..Sticky falling edge. Match occurs if a falling edge on the specified input has occurred since the last | ||
6268 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6269 | * PMSRC registers are written to. | ||
6270 | * 0b011..Sticky rising or falling edge. Match occurs if either a rising or falling edge on the specified input | ||
6271 | * has occurred since the last time the edge detection for this bit slice was cleared. This bit is only | ||
6272 | * cleared when the PMCFG or the PMSRC registers are written to. | ||
6273 | * 0b100..High level. Match (for this bit slice) occurs when there is a high level on the input specified for this bit slice in the PMSRC register. | ||
6274 | * 0b101..Low level. Match occurs when there is a low level on the specified input. | ||
6275 | * 0b110..Constant 0. This bit slice never contributes to a match (should be used to disable any unused bit slices). | ||
6276 | * 0b111..Event. Non-sticky rising or falling edge. Match occurs on an event - i.e. when either a rising or | ||
6277 | * falling edge is first detected on the specified input (this is a non-sticky version of value 0x3) . This bit | ||
6278 | * is cleared after one clock cycle. | ||
6279 | */ | ||
6280 | #define PINT_PMCFG_CFG5(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_CFG5_SHIFT)) & PINT_PMCFG_CFG5_MASK) | ||
6281 | #define PINT_PMCFG_CFG6_MASK (0x1C000000U) | ||
6282 | #define PINT_PMCFG_CFG6_SHIFT (26U) | ||
6283 | /*! CFG6 - Specifies the match contribution condition for bit slice 6. | ||
6284 | * 0b000..Constant HIGH. This bit slice always contributes to a product term match. | ||
6285 | * 0b001..Sticky rising edge. Match occurs if a rising edge on the specified input has occurred since the last | ||
6286 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6287 | * PMSRC registers are written to. | ||
6288 | * 0b010..Sticky falling edge. Match occurs if a falling edge on the specified input has occurred since the last | ||
6289 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6290 | * PMSRC registers are written to. | ||
6291 | * 0b011..Sticky rising or falling edge. Match occurs if either a rising or falling edge on the specified input | ||
6292 | * has occurred since the last time the edge detection for this bit slice was cleared. This bit is only | ||
6293 | * cleared when the PMCFG or the PMSRC registers are written to. | ||
6294 | * 0b100..High level. Match (for this bit slice) occurs when there is a high level on the input specified for this bit slice in the PMSRC register. | ||
6295 | * 0b101..Low level. Match occurs when there is a low level on the specified input. | ||
6296 | * 0b110..Constant 0. This bit slice never contributes to a match (should be used to disable any unused bit slices). | ||
6297 | * 0b111..Event. Non-sticky rising or falling edge. Match occurs on an event - i.e. when either a rising or | ||
6298 | * falling edge is first detected on the specified input (this is a non-sticky version of value 0x3) . This bit | ||
6299 | * is cleared after one clock cycle. | ||
6300 | */ | ||
6301 | #define PINT_PMCFG_CFG6(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_CFG6_SHIFT)) & PINT_PMCFG_CFG6_MASK) | ||
6302 | #define PINT_PMCFG_CFG7_MASK (0xE0000000U) | ||
6303 | #define PINT_PMCFG_CFG7_SHIFT (29U) | ||
6304 | /*! CFG7 - Specifies the match contribution condition for bit slice 7. | ||
6305 | * 0b000..Constant HIGH. This bit slice always contributes to a product term match. | ||
6306 | * 0b001..Sticky rising edge. Match occurs if a rising edge on the specified input has occurred since the last | ||
6307 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6308 | * PMSRC registers are written to. | ||
6309 | * 0b010..Sticky falling edge. Match occurs if a falling edge on the specified input has occurred since the last | ||
6310 | * time the edge detection for this bit slice was cleared. This bit is only cleared when the PMCFG or the | ||
6311 | * PMSRC registers are written to. | ||
6312 | * 0b011..Sticky rising or falling edge. Match occurs if either a rising or falling edge on the specified input | ||
6313 | * has occurred since the last time the edge detection for this bit slice was cleared. This bit is only | ||
6314 | * cleared when the PMCFG or the PMSRC registers are written to. | ||
6315 | * 0b100..High level. Match (for this bit slice) occurs when there is a high level on the input specified for this bit slice in the PMSRC register. | ||
6316 | * 0b101..Low level. Match occurs when there is a low level on the specified input. | ||
6317 | * 0b110..Constant 0. This bit slice never contributes to a match (should be used to disable any unused bit slices). | ||
6318 | * 0b111..Event. Non-sticky rising or falling edge. Match occurs on an event - i.e. when either a rising or | ||
6319 | * falling edge is first detected on the specified input (this is a non-sticky version of value 0x3) . This bit | ||
6320 | * is cleared after one clock cycle. | ||
6321 | */ | ||
6322 | #define PINT_PMCFG_CFG7(x) (((uint32_t)(((uint32_t)(x)) << PINT_PMCFG_CFG7_SHIFT)) & PINT_PMCFG_CFG7_MASK) | ||
6323 | /*! @} */ | ||
6324 | |||
6325 | |||
6326 | /*! | ||
6327 | * @} | ||
6328 | */ /* end of group PINT_Register_Masks */ | ||
6329 | |||
6330 | |||
6331 | /* PINT - Peripheral instance base addresses */ | ||
6332 | /** Peripheral PINT base address */ | ||
6333 | #define PINT_BASE (0x40004000u) | ||
6334 | /** Peripheral PINT base pointer */ | ||
6335 | #define PINT ((PINT_Type *)PINT_BASE) | ||
6336 | /** Array initializer of PINT peripheral base addresses */ | ||
6337 | #define PINT_BASE_ADDRS { PINT_BASE } | ||
6338 | /** Array initializer of PINT peripheral base pointers */ | ||
6339 | #define PINT_BASE_PTRS { PINT } | ||
6340 | /** Interrupt vectors for the PINT peripheral type */ | ||
6341 | #define PINT_IRQS { PIN_INT0_IRQn, PIN_INT1_IRQn, PIN_INT2_IRQn, PIN_INT3_IRQn, PIN_INT4_IRQn, PIN_INT5_IRQn, PIN_INT6_IRQn, PIN_INT7_IRQn } | ||
6342 | |||
6343 | /*! | ||
6344 | * @} | ||
6345 | */ /* end of group PINT_Peripheral_Access_Layer */ | ||
6346 | |||
6347 | |||
6348 | /* ---------------------------------------------------------------------------- | ||
6349 | -- RIT Peripheral Access Layer | ||
6350 | ---------------------------------------------------------------------------- */ | ||
6351 | |||
6352 | /*! | ||
6353 | * @addtogroup RIT_Peripheral_Access_Layer RIT Peripheral Access Layer | ||
6354 | * @{ | ||
6355 | */ | ||
6356 | |||
6357 | /** RIT - Register Layout Typedef */ | ||
6358 | typedef struct { | ||
6359 | __IO uint32_t COMPVAL; /**< Compare value LSB register, offset: 0x0 */ | ||
6360 | __IO uint32_t MASK; /**< Mask LSB register, offset: 0x4 */ | ||
6361 | __IO uint32_t CTRL; /**< Control register, offset: 0x8 */ | ||
6362 | __IO uint32_t COUNTER; /**< Counter LSB register, offset: 0xC */ | ||
6363 | __IO uint32_t COMPVAL_H; /**< Compare value MSB register, offset: 0x10 */ | ||
6364 | __IO uint32_t MASK_H; /**< Mask MSB register, offset: 0x14 */ | ||
6365 | uint8_t RESERVED_0[4]; | ||
6366 | __IO uint32_t COUNTER_H; /**< Counter MSB register, offset: 0x1C */ | ||
6367 | } RIT_Type; | ||
6368 | |||
6369 | /* ---------------------------------------------------------------------------- | ||
6370 | -- RIT Register Masks | ||
6371 | ---------------------------------------------------------------------------- */ | ||
6372 | |||
6373 | /*! | ||
6374 | * @addtogroup RIT_Register_Masks RIT Register Masks | ||
6375 | * @{ | ||
6376 | */ | ||
6377 | |||
6378 | /*! @name COMPVAL - Compare value LSB register */ | ||
6379 | /*! @{ */ | ||
6380 | #define RIT_COMPVAL_RICOMP_MASK (0xFFFFFFFFU) | ||
6381 | #define RIT_COMPVAL_RICOMP_SHIFT (0U) | ||
6382 | /*! RICOMP - . | ||
6383 | */ | ||
6384 | #define RIT_COMPVAL_RICOMP(x) (((uint32_t)(((uint32_t)(x)) << RIT_COMPVAL_RICOMP_SHIFT)) & RIT_COMPVAL_RICOMP_MASK) | ||
6385 | /*! @} */ | ||
6386 | |||
6387 | /*! @name MASK - Mask LSB register */ | ||
6388 | /*! @{ */ | ||
6389 | #define RIT_MASK_RIMASK_MASK (0xFFFFFFFFU) | ||
6390 | #define RIT_MASK_RIMASK_SHIFT (0U) | ||
6391 | /*! RIMASK - Mask register. | ||
6392 | */ | ||
6393 | #define RIT_MASK_RIMASK(x) (((uint32_t)(((uint32_t)(x)) << RIT_MASK_RIMASK_SHIFT)) & RIT_MASK_RIMASK_MASK) | ||
6394 | /*! @} */ | ||
6395 | |||
6396 | /*! @name CTRL - Control register */ | ||
6397 | /*! @{ */ | ||
6398 | #define RIT_CTRL_RITINT_MASK (0x1U) | ||
6399 | #define RIT_CTRL_RITINT_SHIFT (0U) | ||
6400 | /*! RITINT - Interrupt flag. | ||
6401 | */ | ||
6402 | #define RIT_CTRL_RITINT(x) (((uint32_t)(((uint32_t)(x)) << RIT_CTRL_RITINT_SHIFT)) & RIT_CTRL_RITINT_MASK) | ||
6403 | #define RIT_CTRL_RITENCLR_MASK (0x2U) | ||
6404 | #define RIT_CTRL_RITENCLR_SHIFT (1U) | ||
6405 | /*! RITENCLR - Timer enable clear. | ||
6406 | */ | ||
6407 | #define RIT_CTRL_RITENCLR(x) (((uint32_t)(((uint32_t)(x)) << RIT_CTRL_RITENCLR_SHIFT)) & RIT_CTRL_RITENCLR_MASK) | ||
6408 | #define RIT_CTRL_RITENBR_MASK (0x4U) | ||
6409 | #define RIT_CTRL_RITENBR_SHIFT (2U) | ||
6410 | /*! RITENBR - Timer enable for debug. | ||
6411 | */ | ||
6412 | #define RIT_CTRL_RITENBR(x) (((uint32_t)(((uint32_t)(x)) << RIT_CTRL_RITENBR_SHIFT)) & RIT_CTRL_RITENBR_MASK) | ||
6413 | #define RIT_CTRL_RITEN_MASK (0x8U) | ||
6414 | #define RIT_CTRL_RITEN_SHIFT (3U) | ||
6415 | /*! RITEN - Timer enable. | ||
6416 | */ | ||
6417 | #define RIT_CTRL_RITEN(x) (((uint32_t)(((uint32_t)(x)) << RIT_CTRL_RITEN_SHIFT)) & RIT_CTRL_RITEN_MASK) | ||
6418 | /*! @} */ | ||
6419 | |||
6420 | /*! @name COUNTER - Counter LSB register */ | ||
6421 | /*! @{ */ | ||
6422 | #define RIT_COUNTER_RICOUNTER_MASK (0xFFFFFFFFU) | ||
6423 | #define RIT_COUNTER_RICOUNTER_SHIFT (0U) | ||
6424 | /*! RICOUNTER - 32 LSBs of the up counter. | ||
6425 | */ | ||
6426 | #define RIT_COUNTER_RICOUNTER(x) (((uint32_t)(((uint32_t)(x)) << RIT_COUNTER_RICOUNTER_SHIFT)) & RIT_COUNTER_RICOUNTER_MASK) | ||
6427 | /*! @} */ | ||
6428 | |||
6429 | /*! @name COMPVAL_H - Compare value MSB register */ | ||
6430 | /*! @{ */ | ||
6431 | #define RIT_COMPVAL_H_RICOMP_MASK (0xFFFFU) | ||
6432 | #define RIT_COMPVAL_H_RICOMP_SHIFT (0U) | ||
6433 | /*! RICOMP - Compare value MSB register. | ||
6434 | */ | ||
6435 | #define RIT_COMPVAL_H_RICOMP(x) (((uint32_t)(((uint32_t)(x)) << RIT_COMPVAL_H_RICOMP_SHIFT)) & RIT_COMPVAL_H_RICOMP_MASK) | ||
6436 | /*! @} */ | ||
6437 | |||
6438 | /*! @name MASK_H - Mask MSB register */ | ||
6439 | /*! @{ */ | ||
6440 | #define RIT_MASK_H_RIMASK_MASK (0xFFFFU) | ||
6441 | #define RIT_MASK_H_RIMASK_SHIFT (0U) | ||
6442 | /*! RIMASK - Mask register. | ||
6443 | */ | ||
6444 | #define RIT_MASK_H_RIMASK(x) (((uint32_t)(((uint32_t)(x)) << RIT_MASK_H_RIMASK_SHIFT)) & RIT_MASK_H_RIMASK_MASK) | ||
6445 | /*! @} */ | ||
6446 | |||
6447 | /*! @name COUNTER_H - Counter MSB register */ | ||
6448 | /*! @{ */ | ||
6449 | #define RIT_COUNTER_H_RICOUNTER_MASK (0xFFFFU) | ||
6450 | #define RIT_COUNTER_H_RICOUNTER_SHIFT (0U) | ||
6451 | /*! RICOUNTER - 16 LSBs of the up counter. | ||
6452 | */ | ||
6453 | #define RIT_COUNTER_H_RICOUNTER(x) (((uint32_t)(((uint32_t)(x)) << RIT_COUNTER_H_RICOUNTER_SHIFT)) & RIT_COUNTER_H_RICOUNTER_MASK) | ||
6454 | /*! @} */ | ||
6455 | |||
6456 | |||
6457 | /*! | ||
6458 | * @} | ||
6459 | */ /* end of group RIT_Register_Masks */ | ||
6460 | |||
6461 | |||
6462 | /* RIT - Peripheral instance base addresses */ | ||
6463 | /** Peripheral RIT base address */ | ||
6464 | #define RIT_BASE (0x4002D000u) | ||
6465 | /** Peripheral RIT base pointer */ | ||
6466 | #define RIT ((RIT_Type *)RIT_BASE) | ||
6467 | /** Array initializer of RIT peripheral base addresses */ | ||
6468 | #define RIT_BASE_ADDRS { RIT_BASE } | ||
6469 | /** Array initializer of RIT peripheral base pointers */ | ||
6470 | #define RIT_BASE_PTRS { RIT } | ||
6471 | /** Interrupt vectors for the RIT peripheral type */ | ||
6472 | #define RIT_IRQS { RIT_IRQn } | ||
6473 | |||
6474 | /*! | ||
6475 | * @} | ||
6476 | */ /* end of group RIT_Peripheral_Access_Layer */ | ||
6477 | |||
6478 | |||
6479 | /* ---------------------------------------------------------------------------- | ||
6480 | -- RTC Peripheral Access Layer | ||
6481 | ---------------------------------------------------------------------------- */ | ||
6482 | |||
6483 | /*! | ||
6484 | * @addtogroup RTC_Peripheral_Access_Layer RTC Peripheral Access Layer | ||
6485 | * @{ | ||
6486 | */ | ||
6487 | |||
6488 | /** RTC - Register Layout Typedef */ | ||
6489 | typedef struct { | ||
6490 | __IO uint32_t CTRL; /**< RTC control register, offset: 0x0 */ | ||
6491 | __IO uint32_t MATCH; /**< RTC match register, offset: 0x4 */ | ||
6492 | __IO uint32_t COUNT; /**< RTC counter register, offset: 0x8 */ | ||
6493 | __IO uint32_t WAKE; /**< High-resolution/wake-up timer control register, offset: 0xC */ | ||
6494 | uint8_t RESERVED_0[48]; | ||
6495 | __IO uint32_t GPREG[8]; /**< General Purpose register, array offset: 0x40, array step: 0x4 */ | ||
6496 | } RTC_Type; | ||
6497 | |||
6498 | /* ---------------------------------------------------------------------------- | ||
6499 | -- RTC Register Masks | ||
6500 | ---------------------------------------------------------------------------- */ | ||
6501 | |||
6502 | /*! | ||
6503 | * @addtogroup RTC_Register_Masks RTC Register Masks | ||
6504 | * @{ | ||
6505 | */ | ||
6506 | |||
6507 | /*! @name CTRL - RTC control register */ | ||
6508 | /*! @{ */ | ||
6509 | #define RTC_CTRL_SWRESET_MASK (0x1U) | ||
6510 | #define RTC_CTRL_SWRESET_SHIFT (0U) | ||
6511 | /*! SWRESET - Software reset control | ||
6512 | * 0b0..Not in reset. The RTC is not held in reset. This bit must be cleared prior to configuring or initiating any operation of the RTC. | ||
6513 | * 0b1..In reset. The RTC is held in reset. All register bits within the RTC will be forced to their reset value | ||
6514 | * except the OFD bit. This bit must be cleared before writing to any register in the RTC - including writes | ||
6515 | * to set any of the other bits within this register. Do not attempt to write to any bits of this register at | ||
6516 | * the same time that the reset bit is being cleared. | ||
6517 | */ | ||
6518 | #define RTC_CTRL_SWRESET(x) (((uint32_t)(((uint32_t)(x)) << RTC_CTRL_SWRESET_SHIFT)) & RTC_CTRL_SWRESET_MASK) | ||
6519 | #define RTC_CTRL_ALARM1HZ_MASK (0x4U) | ||
6520 | #define RTC_CTRL_ALARM1HZ_SHIFT (2U) | ||
6521 | /*! ALARM1HZ - RTC 1 Hz timer alarm flag status. | ||
6522 | * 0b0..No match. No match has occurred on the 1 Hz RTC timer. Writing a 0 has no effect. | ||
6523 | * 0b1..Match. A match condition has occurred on the 1 Hz RTC timer. This flag generates an RTC alarm interrupt | ||
6524 | * request RTC_ALARM which can also wake up the part from any low power mode. Writing a 1 clears this bit. | ||
6525 | */ | ||
6526 | #define RTC_CTRL_ALARM1HZ(x) (((uint32_t)(((uint32_t)(x)) << RTC_CTRL_ALARM1HZ_SHIFT)) & RTC_CTRL_ALARM1HZ_MASK) | ||
6527 | #define RTC_CTRL_WAKE1KHZ_MASK (0x8U) | ||
6528 | #define RTC_CTRL_WAKE1KHZ_SHIFT (3U) | ||
6529 | /*! WAKE1KHZ - RTC 1 kHz timer wake-up flag status. | ||
6530 | * 0b0..Run. The RTC 1 kHz timer is running. Writing a 0 has no effect. | ||
6531 | * 0b1..Time-out. The 1 kHz high-resolution/wake-up timer has timed out. This flag generates an RTC wake-up | ||
6532 | * interrupt request RTC-WAKE which can also wake up the part from any low power mode. Writing a 1 clears this bit. | ||
6533 | */ | ||
6534 | #define RTC_CTRL_WAKE1KHZ(x) (((uint32_t)(((uint32_t)(x)) << RTC_CTRL_WAKE1KHZ_SHIFT)) & RTC_CTRL_WAKE1KHZ_MASK) | ||
6535 | #define RTC_CTRL_ALARMDPD_EN_MASK (0x10U) | ||
6536 | #define RTC_CTRL_ALARMDPD_EN_SHIFT (4U) | ||
6537 | /*! ALARMDPD_EN - RTC 1 Hz timer alarm enable for Deep power-down. | ||
6538 | * 0b0..Disable. A match on the 1 Hz RTC timer will not bring the part out of Deep power-down mode. | ||
6539 | * 0b1..Enable. A match on the 1 Hz RTC timer bring the part out of Deep power-down mode. | ||
6540 | */ | ||
6541 | #define RTC_CTRL_ALARMDPD_EN(x) (((uint32_t)(((uint32_t)(x)) << RTC_CTRL_ALARMDPD_EN_SHIFT)) & RTC_CTRL_ALARMDPD_EN_MASK) | ||
6542 | #define RTC_CTRL_WAKEDPD_EN_MASK (0x20U) | ||
6543 | #define RTC_CTRL_WAKEDPD_EN_SHIFT (5U) | ||
6544 | /*! WAKEDPD_EN - RTC 1 kHz timer wake-up enable for Deep power-down. | ||
6545 | * 0b0..Disable. A match on the 1 kHz RTC timer will not bring the part out of Deep power-down mode. | ||
6546 | * 0b1..Enable. A match on the 1 kHz RTC timer bring the part out of Deep power-down mode. | ||
6547 | */ | ||
6548 | #define RTC_CTRL_WAKEDPD_EN(x) (((uint32_t)(((uint32_t)(x)) << RTC_CTRL_WAKEDPD_EN_SHIFT)) & RTC_CTRL_WAKEDPD_EN_MASK) | ||
6549 | #define RTC_CTRL_RTC1KHZ_EN_MASK (0x40U) | ||
6550 | #define RTC_CTRL_RTC1KHZ_EN_SHIFT (6U) | ||
6551 | /*! RTC1KHZ_EN - RTC 1 kHz clock enable. This bit can be set to 0 to conserve power if the 1 kHz | ||
6552 | * timer is not used. This bit has no effect when the RTC is disabled (bit 7 of this register is 0). | ||
6553 | * 0b0..Disable. A match on the 1 kHz RTC timer will not bring the part out of Deep power-down mode. | ||
6554 | * 0b1..Enable. The 1 kHz RTC timer is enabled. | ||
6555 | */ | ||
6556 | #define RTC_CTRL_RTC1KHZ_EN(x) (((uint32_t)(((uint32_t)(x)) << RTC_CTRL_RTC1KHZ_EN_SHIFT)) & RTC_CTRL_RTC1KHZ_EN_MASK) | ||
6557 | #define RTC_CTRL_RTC_EN_MASK (0x80U) | ||
6558 | #define RTC_CTRL_RTC_EN_SHIFT (7U) | ||
6559 | /*! RTC_EN - RTC enable. | ||
6560 | * 0b0..Disable. The RTC 1 Hz and 1 kHz clocks are shut down and the RTC operation is disabled. This bit should | ||
6561 | * be 0 when writing to load a value in the RTC counter register. | ||
6562 | * 0b1..Enable. The 1 Hz RTC clock is running and RTC operation is enabled. This bit must be set to initiate | ||
6563 | * operation of the RTC. The first clock to the RTC counter occurs 1 s after this bit is set. To also enable the | ||
6564 | * high-resolution, 1 kHz clock, set bit 6 in this register. | ||
6565 | */ | ||
6566 | #define RTC_CTRL_RTC_EN(x) (((uint32_t)(((uint32_t)(x)) << RTC_CTRL_RTC_EN_SHIFT)) & RTC_CTRL_RTC_EN_MASK) | ||
6567 | #define RTC_CTRL_RTC_OSC_PD_MASK (0x100U) | ||
6568 | #define RTC_CTRL_RTC_OSC_PD_SHIFT (8U) | ||
6569 | /*! RTC_OSC_PD - RTC oscillator power-down control. | ||
6570 | * 0b0..See RTC_OSC_BYPASS | ||
6571 | * 0b1..RTC oscillator is powered-down. | ||
6572 | */ | ||
6573 | #define RTC_CTRL_RTC_OSC_PD(x) (((uint32_t)(((uint32_t)(x)) << RTC_CTRL_RTC_OSC_PD_SHIFT)) & RTC_CTRL_RTC_OSC_PD_MASK) | ||
6574 | /*! @} */ | ||
6575 | |||
6576 | /*! @name MATCH - RTC match register */ | ||
6577 | /*! @{ */ | ||
6578 | #define RTC_MATCH_MATVAL_MASK (0xFFFFFFFFU) | ||
6579 | #define RTC_MATCH_MATVAL_SHIFT (0U) | ||
6580 | /*! MATVAL - Contains the match value against which the 1 Hz RTC timer will be compared to set the | ||
6581 | * alarm flag RTC_ALARM and generate an alarm interrupt/wake-up if enabled. | ||
6582 | */ | ||
6583 | #define RTC_MATCH_MATVAL(x) (((uint32_t)(((uint32_t)(x)) << RTC_MATCH_MATVAL_SHIFT)) & RTC_MATCH_MATVAL_MASK) | ||
6584 | /*! @} */ | ||
6585 | |||
6586 | /*! @name COUNT - RTC counter register */ | ||
6587 | /*! @{ */ | ||
6588 | #define RTC_COUNT_VAL_MASK (0xFFFFFFFFU) | ||
6589 | #define RTC_COUNT_VAL_SHIFT (0U) | ||
6590 | /*! VAL - A read reflects the current value of the main, 1 Hz RTC timer. A write loads a new initial | ||
6591 | * value into the timer. The RTC counter will count up continuously at a 1 Hz rate once the RTC | ||
6592 | * Software Reset is removed (by clearing bit 0 of the CTRL register). Only write to this | ||
6593 | * register when the RTC_EN bit in the RTC CTRL Register is 0. The counter increments one second after | ||
6594 | * the RTC_EN bit is set. | ||
6595 | */ | ||
6596 | #define RTC_COUNT_VAL(x) (((uint32_t)(((uint32_t)(x)) << RTC_COUNT_VAL_SHIFT)) & RTC_COUNT_VAL_MASK) | ||
6597 | /*! @} */ | ||
6598 | |||
6599 | /*! @name WAKE - High-resolution/wake-up timer control register */ | ||
6600 | /*! @{ */ | ||
6601 | #define RTC_WAKE_VAL_MASK (0xFFFFU) | ||
6602 | #define RTC_WAKE_VAL_SHIFT (0U) | ||
6603 | /*! VAL - A read reflects the current value of the high-resolution/wake-up timer. A write pre-loads | ||
6604 | * a start count value into the wake-up timer and initializes a count-down sequence. Do not write | ||
6605 | * to this register while counting is in progress. | ||
6606 | */ | ||
6607 | #define RTC_WAKE_VAL(x) (((uint32_t)(((uint32_t)(x)) << RTC_WAKE_VAL_SHIFT)) & RTC_WAKE_VAL_MASK) | ||
6608 | /*! @} */ | ||
6609 | |||
6610 | /*! @name GPREG - General Purpose register */ | ||
6611 | /*! @{ */ | ||
6612 | #define RTC_GPREG_GPDATA_MASK (0xFFFFFFFFU) | ||
6613 | #define RTC_GPREG_GPDATA_SHIFT (0U) | ||
6614 | /*! GPDATA - Data retained during Deep power-down mode or loss of main power as long as VBAT is supplied. | ||
6615 | */ | ||
6616 | #define RTC_GPREG_GPDATA(x) (((uint32_t)(((uint32_t)(x)) << RTC_GPREG_GPDATA_SHIFT)) & RTC_GPREG_GPDATA_MASK) | ||
6617 | /*! @} */ | ||
6618 | |||
6619 | /* The count of RTC_GPREG */ | ||
6620 | #define RTC_GPREG_COUNT (8U) | ||
6621 | |||
6622 | |||
6623 | /*! | ||
6624 | * @} | ||
6625 | */ /* end of group RTC_Register_Masks */ | ||
6626 | |||
6627 | |||
6628 | /* RTC - Peripheral instance base addresses */ | ||
6629 | /** Peripheral RTC base address */ | ||
6630 | #define RTC_BASE (0x4002C000u) | ||
6631 | /** Peripheral RTC base pointer */ | ||
6632 | #define RTC ((RTC_Type *)RTC_BASE) | ||
6633 | /** Array initializer of RTC peripheral base addresses */ | ||
6634 | #define RTC_BASE_ADDRS { RTC_BASE } | ||
6635 | /** Array initializer of RTC peripheral base pointers */ | ||
6636 | #define RTC_BASE_PTRS { RTC } | ||
6637 | /** Interrupt vectors for the RTC peripheral type */ | ||
6638 | #define RTC_IRQS { RTC_IRQn } | ||
6639 | |||
6640 | /*! | ||
6641 | * @} | ||
6642 | */ /* end of group RTC_Peripheral_Access_Layer */ | ||
6643 | |||
6644 | |||
6645 | /* ---------------------------------------------------------------------------- | ||
6646 | -- SCT Peripheral Access Layer | ||
6647 | ---------------------------------------------------------------------------- */ | ||
6648 | |||
6649 | /*! | ||
6650 | * @addtogroup SCT_Peripheral_Access_Layer SCT Peripheral Access Layer | ||
6651 | * @{ | ||
6652 | */ | ||
6653 | |||
6654 | /** SCT - Register Layout Typedef */ | ||
6655 | typedef struct { | ||
6656 | __IO uint32_t CONFIG; /**< SCT configuration register, offset: 0x0 */ | ||
6657 | union { /* offset: 0x4 */ | ||
6658 | struct { /* offset: 0x4 */ | ||
6659 | __IO uint16_t CTRLL; /**< SCT_CTRLL register, offset: 0x4 */ | ||
6660 | __IO uint16_t CTRLH; /**< SCT_CTRLH register, offset: 0x6 */ | ||
6661 | } CTRL_ACCESS16BIT; | ||
6662 | __IO uint32_t CTRL; /**< SCT control register, offset: 0x4 */ | ||
6663 | }; | ||
6664 | union { /* offset: 0x8 */ | ||
6665 | struct { /* offset: 0x8 */ | ||
6666 | __IO uint16_t LIMITL; /**< SCT_LIMITL register, offset: 0x8 */ | ||
6667 | __IO uint16_t LIMITH; /**< SCT_LIMITH register, offset: 0xA */ | ||
6668 | } LIMIT_ACCESS16BIT; | ||
6669 | __IO uint32_t LIMIT; /**< SCT limit event select register, offset: 0x8 */ | ||
6670 | }; | ||
6671 | union { /* offset: 0xC */ | ||
6672 | struct { /* offset: 0xC */ | ||
6673 | __IO uint16_t HALTL; /**< SCT_HALTL register, offset: 0xC */ | ||
6674 | __IO uint16_t HALTH; /**< SCT_HALTH register, offset: 0xE */ | ||
6675 | } HALT_ACCESS16BIT; | ||
6676 | __IO uint32_t HALT; /**< SCT halt event select register, offset: 0xC */ | ||
6677 | }; | ||
6678 | union { /* offset: 0x10 */ | ||
6679 | struct { /* offset: 0x10 */ | ||
6680 | __IO uint16_t STOPL; /**< SCT_STOPL register, offset: 0x10 */ | ||
6681 | __IO uint16_t STOPH; /**< SCT_STOPH register, offset: 0x12 */ | ||
6682 | } STOP_ACCESS16BIT; | ||
6683 | __IO uint32_t STOP; /**< SCT stop event select register, offset: 0x10 */ | ||
6684 | }; | ||
6685 | union { /* offset: 0x14 */ | ||
6686 | struct { /* offset: 0x14 */ | ||
6687 | __IO uint16_t STARTL; /**< SCT_STARTL register, offset: 0x14 */ | ||
6688 | __IO uint16_t STARTH; /**< SCT_STARTH register, offset: 0x16 */ | ||
6689 | } START_ACCESS16BIT; | ||
6690 | __IO uint32_t START; /**< SCT start event select register, offset: 0x14 */ | ||
6691 | }; | ||
6692 | uint8_t RESERVED_0[40]; | ||
6693 | union { /* offset: 0x40 */ | ||
6694 | struct { /* offset: 0x40 */ | ||
6695 | __IO uint16_t COUNTL; /**< SCT_COUNTL register, offset: 0x40 */ | ||
6696 | __IO uint16_t COUNTH; /**< SCT_COUNTH register, offset: 0x42 */ | ||
6697 | } COUNT_ACCESS16BIT; | ||
6698 | __IO uint32_t COUNT; /**< SCT counter register, offset: 0x40 */ | ||
6699 | }; | ||
6700 | union { /* offset: 0x44 */ | ||
6701 | struct { /* offset: 0x44 */ | ||
6702 | __IO uint16_t STATEL; /**< SCT_STATEL register, offset: 0x44 */ | ||
6703 | __IO uint16_t STATEH; /**< SCT_STATEH register, offset: 0x46 */ | ||
6704 | } STATE_ACCESS16BIT; | ||
6705 | __IO uint32_t STATE; /**< SCT state register, offset: 0x44 */ | ||
6706 | }; | ||
6707 | __I uint32_t INPUT; /**< SCT input register, offset: 0x48 */ | ||
6708 | union { /* offset: 0x4C */ | ||
6709 | struct { /* offset: 0x4C */ | ||
6710 | __IO uint16_t REGMODEL; /**< SCT_REGMODEL register, offset: 0x4C */ | ||
6711 | __IO uint16_t REGMODEH; /**< SCT_REGMODEH register, offset: 0x4E */ | ||
6712 | } REGMODE_ACCESS16BIT; | ||
6713 | __IO uint32_t REGMODE; /**< SCT match/capture mode register, offset: 0x4C */ | ||
6714 | }; | ||
6715 | __IO uint32_t OUTPUT; /**< SCT output register, offset: 0x50 */ | ||
6716 | __IO uint32_t OUTPUTDIRCTRL; /**< SCT output counter direction control register, offset: 0x54 */ | ||
6717 | __IO uint32_t RES; /**< SCT conflict resolution register, offset: 0x58 */ | ||
6718 | __IO uint32_t DMAREQ0; /**< SCT DMA request 0 register, offset: 0x5C */ | ||
6719 | __IO uint32_t DMAREQ1; /**< SCT DMA request 1 register, offset: 0x60 */ | ||
6720 | uint8_t RESERVED_1[140]; | ||
6721 | __IO uint32_t EVEN; /**< SCT event interrupt enable register, offset: 0xF0 */ | ||
6722 | __IO uint32_t EVFLAG; /**< SCT event flag register, offset: 0xF4 */ | ||
6723 | __IO uint32_t CONEN; /**< SCT conflict interrupt enable register, offset: 0xF8 */ | ||
6724 | __IO uint32_t CONFLAG; /**< SCT conflict flag register, offset: 0xFC */ | ||
6725 | union { /* offset: 0x100 */ | ||
6726 | union { /* offset: 0x100, array step: 0x4 */ | ||
6727 | struct { /* offset: 0x100, array step: 0x4 */ | ||
6728 | __IO uint16_t CAPL; /**< SCT_CAPL register, array offset: 0x100, array step: 0x4 */ | ||
6729 | __IO uint16_t CAPH; /**< SCT_CAPH register, array offset: 0x102, array step: 0x4 */ | ||
6730 | } CAP_ACCESS16BIT[16]; | ||
6731 | __IO uint32_t CAP[16]; /**< SCT capture register of capture channel, array offset: 0x100, array step: 0x4 */ | ||
6732 | }; | ||
6733 | union { /* offset: 0x100, array step: 0x4 */ | ||
6734 | struct { /* offset: 0x100, array step: 0x4 */ | ||
6735 | __IO uint16_t MATCHL; /**< SCT_MATCHL register, array offset: 0x100, array step: 0x4 */ | ||
6736 | __IO uint16_t MATCHH; /**< SCT_MATCHH register, array offset: 0x102, array step: 0x4 */ | ||
6737 | } MATCH_ACCESS16BIT[16]; | ||
6738 | __IO uint32_t MATCH[16]; /**< SCT match value register of match channels, array offset: 0x100, array step: 0x4 */ | ||
6739 | }; | ||
6740 | }; | ||
6741 | uint8_t RESERVED_2[192]; | ||
6742 | union { /* offset: 0x200 */ | ||
6743 | union { /* offset: 0x200, array step: 0x4 */ | ||
6744 | struct { /* offset: 0x200, array step: 0x4 */ | ||
6745 | __IO uint16_t CAPCTRLL; /**< SCT_CAPCTRLL register, array offset: 0x200, array step: 0x4 */ | ||
6746 | __IO uint16_t CAPCTRLH; /**< SCT_CAPCTRLH register, array offset: 0x202, array step: 0x4 */ | ||
6747 | } CAPCTRL_ACCESS16BIT[16]; | ||
6748 | __IO uint32_t CAPCTRL[16]; /**< SCT capture control register, array offset: 0x200, array step: 0x4 */ | ||
6749 | }; | ||
6750 | union { /* offset: 0x200, array step: 0x4 */ | ||
6751 | struct { /* offset: 0x200, array step: 0x4 */ | ||
6752 | __IO uint16_t MATCHRELL; /**< SCT_MATCHRELL register, array offset: 0x200, array step: 0x4 */ | ||
6753 | __IO uint16_t MATCHRELH; /**< SCT_MATCHRELH register, array offset: 0x202, array step: 0x4 */ | ||
6754 | } MATCHREL_ACCESS16BIT[16]; | ||
6755 | __IO uint32_t MATCHREL[16]; /**< SCT match reload value register, array offset: 0x200, array step: 0x4 */ | ||
6756 | }; | ||
6757 | }; | ||
6758 | uint8_t RESERVED_3[192]; | ||
6759 | struct { /* offset: 0x300, array step: 0x8 */ | ||
6760 | __IO uint32_t STATE; /**< SCT event state register 0, array offset: 0x300, array step: 0x8 */ | ||
6761 | __IO uint32_t CTRL; /**< SCT event control register 0, array offset: 0x304, array step: 0x8 */ | ||
6762 | } EV[16]; | ||
6763 | uint8_t RESERVED_4[384]; | ||
6764 | struct { /* offset: 0x500, array step: 0x8 */ | ||
6765 | __IO uint32_t SET; /**< SCT output 0 set register, array offset: 0x500, array step: 0x8 */ | ||
6766 | __IO uint32_t CLR; /**< SCT output 0 clear register, array offset: 0x504, array step: 0x8 */ | ||
6767 | } OUT[10]; | ||
6768 | } SCT_Type; | ||
6769 | |||
6770 | /* ---------------------------------------------------------------------------- | ||
6771 | -- SCT Register Masks | ||
6772 | ---------------------------------------------------------------------------- */ | ||
6773 | |||
6774 | /*! | ||
6775 | * @addtogroup SCT_Register_Masks SCT Register Masks | ||
6776 | * @{ | ||
6777 | */ | ||
6778 | |||
6779 | /*! @name CONFIG - SCT configuration register */ | ||
6780 | /*! @{ */ | ||
6781 | #define SCT_CONFIG_UNIFY_MASK (0x1U) | ||
6782 | #define SCT_CONFIG_UNIFY_SHIFT (0U) | ||
6783 | /*! UNIFY - SCT operation | ||
6784 | * 0b0..The SCT operates as two 16-bit counters named COUNTER_L and COUNTER_H. | ||
6785 | * 0b1..The SCT operates as a unified 32-bit counter. | ||
6786 | */ | ||
6787 | #define SCT_CONFIG_UNIFY(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFIG_UNIFY_SHIFT)) & SCT_CONFIG_UNIFY_MASK) | ||
6788 | #define SCT_CONFIG_CLKMODE_MASK (0x6U) | ||
6789 | #define SCT_CONFIG_CLKMODE_SHIFT (1U) | ||
6790 | /*! CLKMODE - SCT clock mode | ||
6791 | * 0b00..System Clock Mode. The system clock clocks the entire SCT module including the counter(s) and counter prescalers. | ||
6792 | * 0b01..Sampled System Clock Mode. The system clock clocks the SCT module, but the counter and prescalers are | ||
6793 | * only enabled to count when the designated edge is detected on the input selected by the CKSEL field. The | ||
6794 | * minimum pulse width on the selected clock-gate input is 1 bus clock period. This mode is the | ||
6795 | * high-performance, sampled-clock mode. | ||
6796 | * 0b10..SCT Input Clock Mode. The input/edge selected by the CKSEL field clocks the SCT module, including the | ||
6797 | * counters and prescalers, after first being synchronized to the system clock. The minimum pulse width on the | ||
6798 | * clock input is 1 bus clock period. This mode is the low-power, sampled-clock mode. | ||
6799 | * 0b11..Asynchronous Mode. The entire SCT module is clocked directly by the input/edge selected by the CKSEL | ||
6800 | * field. In this mode, the SCT outputs are switched synchronously to the SCT input clock - not the system | ||
6801 | * clock. The input clock rate must be at least half the system clock rate and can be the same or faster than | ||
6802 | * the system clock. | ||
6803 | */ | ||
6804 | #define SCT_CONFIG_CLKMODE(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFIG_CLKMODE_SHIFT)) & SCT_CONFIG_CLKMODE_MASK) | ||
6805 | #define SCT_CONFIG_CKSEL_MASK (0x78U) | ||
6806 | #define SCT_CONFIG_CKSEL_SHIFT (3U) | ||
6807 | /*! CKSEL - SCT clock select. The specific functionality of the designated input/edge is dependent | ||
6808 | * on the CLKMODE bit selection in this register. | ||
6809 | * 0b0000..Rising edges on input 0. | ||
6810 | * 0b0001..Falling edges on input 0. | ||
6811 | * 0b0010..Rising edges on input 1. | ||
6812 | * 0b0011..Falling edges on input 1. | ||
6813 | * 0b0100..Rising edges on input 2. | ||
6814 | * 0b0101..Falling edges on input 2. | ||
6815 | * 0b0110..Rising edges on input 3. | ||
6816 | * 0b0111..Falling edges on input 3. | ||
6817 | * 0b1000..Rising edges on input 4. | ||
6818 | * 0b1001..Falling edges on input 4. | ||
6819 | * 0b1010..Rising edges on input 5. | ||
6820 | * 0b1011..Falling edges on input 5. | ||
6821 | * 0b1100..Rising edges on input 6. | ||
6822 | * 0b1101..Falling edges on input 6. | ||
6823 | * 0b1110..Rising edges on input 7. | ||
6824 | * 0b1111..Falling edges on input 7. | ||
6825 | */ | ||
6826 | #define SCT_CONFIG_CKSEL(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFIG_CKSEL_SHIFT)) & SCT_CONFIG_CKSEL_MASK) | ||
6827 | #define SCT_CONFIG_NORELOAD_L_MASK (0x80U) | ||
6828 | #define SCT_CONFIG_NORELOAD_L_SHIFT (7U) | ||
6829 | /*! NORELOAD_L - A 1 in this bit prevents the lower match registers from being reloaded from their | ||
6830 | * respective reload registers. Setting this bit eliminates the need to write to the reload | ||
6831 | * registers MATCHREL if the match values are fixed. Software can write to set or clear this bit at any | ||
6832 | * time. This bit applies to both the higher and lower registers when the UNIFY bit is set. | ||
6833 | */ | ||
6834 | #define SCT_CONFIG_NORELOAD_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFIG_NORELOAD_L_SHIFT)) & SCT_CONFIG_NORELOAD_L_MASK) | ||
6835 | #define SCT_CONFIG_NORELOAD_H_MASK (0x100U) | ||
6836 | #define SCT_CONFIG_NORELOAD_H_SHIFT (8U) | ||
6837 | /*! NORELOAD_H - A 1 in this bit prevents the higher match registers from being reloaded from their | ||
6838 | * respective reload registers. Setting this bit eliminates the need to write to the reload | ||
6839 | * registers MATCHREL if the match values are fixed. Software can write to set or clear this bit at | ||
6840 | * any time. This bit is not used when the UNIFY bit is set. | ||
6841 | */ | ||
6842 | #define SCT_CONFIG_NORELOAD_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFIG_NORELOAD_H_SHIFT)) & SCT_CONFIG_NORELOAD_H_MASK) | ||
6843 | #define SCT_CONFIG_INSYNC_MASK (0x1FE00U) | ||
6844 | #define SCT_CONFIG_INSYNC_SHIFT (9U) | ||
6845 | /*! INSYNC - Synchronization for input N (bit 9 = input 0, bit 10 = input 1,, bit 12 = input 3); all | ||
6846 | * other bits are reserved. A 1 in one of these bits subjects the corresponding input to | ||
6847 | * synchronization to the SCT clock, before it is used to create an event. If an input is known to | ||
6848 | * already be synchronous to the SCT clock, this bit may be set to 0 for faster input response. (Note: | ||
6849 | * The SCT clock is the system clock for CKMODEs 0-2. It is the selected, asynchronous SCT input | ||
6850 | * clock for CKMODE3). Note that the INSYNC field only affects inputs used for event generation. | ||
6851 | * It does not apply to the clock input specified in the CKSEL field. | ||
6852 | */ | ||
6853 | #define SCT_CONFIG_INSYNC(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFIG_INSYNC_SHIFT)) & SCT_CONFIG_INSYNC_MASK) | ||
6854 | #define SCT_CONFIG_AUTOLIMIT_L_MASK (0x20000U) | ||
6855 | #define SCT_CONFIG_AUTOLIMIT_L_SHIFT (17U) | ||
6856 | /*! AUTOLIMIT_L - A one in this bit causes a match on match register 0 to be treated as a de-facto | ||
6857 | * LIMIT condition without the need to define an associated event. As with any LIMIT event, this | ||
6858 | * automatic limit causes the counter to be cleared to zero in unidirectional mode or to change | ||
6859 | * the direction of count in bi-directional mode. Software can write to set or clear this bit at | ||
6860 | * any time. This bit applies to both the higher and lower registers when the UNIFY bit is set. | ||
6861 | */ | ||
6862 | #define SCT_CONFIG_AUTOLIMIT_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFIG_AUTOLIMIT_L_SHIFT)) & SCT_CONFIG_AUTOLIMIT_L_MASK) | ||
6863 | #define SCT_CONFIG_AUTOLIMIT_H_MASK (0x40000U) | ||
6864 | #define SCT_CONFIG_AUTOLIMIT_H_SHIFT (18U) | ||
6865 | /*! AUTOLIMIT_H - A one in this bit will cause a match on match register 0 to be treated as a | ||
6866 | * de-facto LIMIT condition without the need to define an associated event. As with any LIMIT event, | ||
6867 | * this automatic limit causes the counter to be cleared to zero in unidirectional mode or to | ||
6868 | * change the direction of count in bi-directional mode. Software can write to set or clear this bit | ||
6869 | * at any time. This bit is not used when the UNIFY bit is set. | ||
6870 | */ | ||
6871 | #define SCT_CONFIG_AUTOLIMIT_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFIG_AUTOLIMIT_H_SHIFT)) & SCT_CONFIG_AUTOLIMIT_H_MASK) | ||
6872 | /*! @} */ | ||
6873 | |||
6874 | /*! @name CTRLL - SCT_CTRLL register */ | ||
6875 | /*! @{ */ | ||
6876 | #define SCT_CTRLL_DOWN_L_MASK (0x1U) | ||
6877 | #define SCT_CTRLL_DOWN_L_SHIFT (0U) | ||
6878 | /*! DOWN_L - This bit is 1 when the L or unified counter is counting down. Hardware sets this bit | ||
6879 | * when the counter is counting up, counter limit occurs, and BIDIR = 1.Hardware clears this bit | ||
6880 | * when the counter is counting down and a limit condition occurs or when the counter reaches 0. | ||
6881 | */ | ||
6882 | #define SCT_CTRLL_DOWN_L(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLL_DOWN_L_SHIFT)) & SCT_CTRLL_DOWN_L_MASK) | ||
6883 | #define SCT_CTRLL_STOP_L_MASK (0x2U) | ||
6884 | #define SCT_CTRLL_STOP_L_SHIFT (1U) | ||
6885 | /*! STOP_L - When this bit is 1 and HALT is 0, the L or unified counter does not run, but I/O events | ||
6886 | * related to the counter can occur. If a designated start event occurs, this bit is cleared and | ||
6887 | * counting resumes. | ||
6888 | */ | ||
6889 | #define SCT_CTRLL_STOP_L(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLL_STOP_L_SHIFT)) & SCT_CTRLL_STOP_L_MASK) | ||
6890 | #define SCT_CTRLL_HALT_L_MASK (0x4U) | ||
6891 | #define SCT_CTRLL_HALT_L_SHIFT (2U) | ||
6892 | /*! HALT_L - When this bit is 1, the L or unified counter does not run and no events can occur. A | ||
6893 | * reset sets this bit. When the HALT_L bit is one, the STOP_L bit is cleared. It is possible to | ||
6894 | * remove the halt condition while keeping the SCT in the stop condition (not running) with a | ||
6895 | * single write to this register to simultaneously clear the HALT bit and set the STOP bit. Once set, | ||
6896 | * only software can clear this bit to restore counter operation. This bit is set on reset. | ||
6897 | */ | ||
6898 | #define SCT_CTRLL_HALT_L(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLL_HALT_L_SHIFT)) & SCT_CTRLL_HALT_L_MASK) | ||
6899 | #define SCT_CTRLL_CLRCTR_L_MASK (0x8U) | ||
6900 | #define SCT_CTRLL_CLRCTR_L_SHIFT (3U) | ||
6901 | /*! CLRCTR_L - Writing a 1 to this bit clears the L or unified counter. This bit always reads as 0. | ||
6902 | */ | ||
6903 | #define SCT_CTRLL_CLRCTR_L(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLL_CLRCTR_L_SHIFT)) & SCT_CTRLL_CLRCTR_L_MASK) | ||
6904 | #define SCT_CTRLL_BIDIR_L_MASK (0x10U) | ||
6905 | #define SCT_CTRLL_BIDIR_L_SHIFT (4U) | ||
6906 | /*! BIDIR_L - L or unified counter direction select | ||
6907 | * 0b0..Up. The counter counts up to a limit condition, then is cleared to zero. | ||
6908 | * 0b1..Up-down. The counter counts up to a limit, then counts down to a limit condition or to 0. | ||
6909 | */ | ||
6910 | #define SCT_CTRLL_BIDIR_L(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLL_BIDIR_L_SHIFT)) & SCT_CTRLL_BIDIR_L_MASK) | ||
6911 | #define SCT_CTRLL_PRE_L_MASK (0x1FE0U) | ||
6912 | #define SCT_CTRLL_PRE_L_SHIFT (5U) | ||
6913 | /*! PRE_L - Specifies the factor by which the SCT clock is prescaled to produce the L or unified | ||
6914 | * counter clock. The counter clock is clocked at the rate of the SCT clock divided by PRE_L+1. | ||
6915 | * Clear the counter (by writing a 1 to the CLRCTR bit) whenever changing the PRE value. | ||
6916 | */ | ||
6917 | #define SCT_CTRLL_PRE_L(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLL_PRE_L_SHIFT)) & SCT_CTRLL_PRE_L_MASK) | ||
6918 | /*! @} */ | ||
6919 | |||
6920 | /*! @name CTRLH - SCT_CTRLH register */ | ||
6921 | /*! @{ */ | ||
6922 | #define SCT_CTRLH_DOWN_H_MASK (0x1U) | ||
6923 | #define SCT_CTRLH_DOWN_H_SHIFT (0U) | ||
6924 | /*! DOWN_H - This bit is 1 when the H counter is counting down. Hardware sets this bit when the | ||
6925 | * counter is counting, a counter limit condition occurs, and BIDIR is 1. Hardware clears this bit | ||
6926 | * when the counter is counting down and a limit condition occurs or when the counter reaches 0. | ||
6927 | */ | ||
6928 | #define SCT_CTRLH_DOWN_H(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLH_DOWN_H_SHIFT)) & SCT_CTRLH_DOWN_H_MASK) | ||
6929 | #define SCT_CTRLH_STOP_H_MASK (0x2U) | ||
6930 | #define SCT_CTRLH_STOP_H_SHIFT (1U) | ||
6931 | /*! STOP_H - When this bit is 1 and HALT is 0, the H counter does not, run but I/O events related to | ||
6932 | * the counter can occur. If such an event matches the mask in the Start register, this bit is | ||
6933 | * cleared and counting resumes. | ||
6934 | */ | ||
6935 | #define SCT_CTRLH_STOP_H(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLH_STOP_H_SHIFT)) & SCT_CTRLH_STOP_H_MASK) | ||
6936 | #define SCT_CTRLH_HALT_H_MASK (0x4U) | ||
6937 | #define SCT_CTRLH_HALT_H_SHIFT (2U) | ||
6938 | /*! HALT_H - When this bit is 1, the H counter does not run and no events can occur. A reset sets | ||
6939 | * this bit. When the HALT_H bit is one, the STOP_H bit is cleared. It is possible to remove the | ||
6940 | * halt condition while keeping the SCT in the stop condition (not running) with a single write to | ||
6941 | * this register to simultaneously clear the HALT bit and set the STOP bit. Once set, this bit | ||
6942 | * can only be cleared by software to restore counter operation. This bit is set on reset. | ||
6943 | */ | ||
6944 | #define SCT_CTRLH_HALT_H(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLH_HALT_H_SHIFT)) & SCT_CTRLH_HALT_H_MASK) | ||
6945 | #define SCT_CTRLH_CLRCTR_H_MASK (0x8U) | ||
6946 | #define SCT_CTRLH_CLRCTR_H_SHIFT (3U) | ||
6947 | /*! CLRCTR_H - Writing a 1 to this bit clears the H counter. This bit always reads as 0. | ||
6948 | */ | ||
6949 | #define SCT_CTRLH_CLRCTR_H(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLH_CLRCTR_H_SHIFT)) & SCT_CTRLH_CLRCTR_H_MASK) | ||
6950 | #define SCT_CTRLH_BIDIR_H_MASK (0x10U) | ||
6951 | #define SCT_CTRLH_BIDIR_H_SHIFT (4U) | ||
6952 | /*! BIDIR_H - Direction select | ||
6953 | * 0b0..The H counter counts up to its limit condition, then is cleared to zero. | ||
6954 | * 0b1..The H counter counts up to its limit, then counts down to a limit condition or to 0. | ||
6955 | */ | ||
6956 | #define SCT_CTRLH_BIDIR_H(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLH_BIDIR_H_SHIFT)) & SCT_CTRLH_BIDIR_H_MASK) | ||
6957 | #define SCT_CTRLH_PRE_H_MASK (0x1FE0U) | ||
6958 | #define SCT_CTRLH_PRE_H_SHIFT (5U) | ||
6959 | /*! PRE_H - Specifies the factor by which the SCT clock is prescaled to produce the H counter clock. | ||
6960 | * The counter clock is clocked at the rate of the SCT clock divided by PRELH+1. Clear the | ||
6961 | * counter (by writing a 1 to the CLRCTR bit) whenever changing the PRE value. | ||
6962 | */ | ||
6963 | #define SCT_CTRLH_PRE_H(x) (((uint16_t)(((uint16_t)(x)) << SCT_CTRLH_PRE_H_SHIFT)) & SCT_CTRLH_PRE_H_MASK) | ||
6964 | /*! @} */ | ||
6965 | |||
6966 | /*! @name CTRL - SCT control register */ | ||
6967 | /*! @{ */ | ||
6968 | #define SCT_CTRL_DOWN_L_MASK (0x1U) | ||
6969 | #define SCT_CTRL_DOWN_L_SHIFT (0U) | ||
6970 | /*! DOWN_L - This bit is 1 when the L or unified counter is counting down. Hardware sets this bit | ||
6971 | * when the counter is counting up, counter limit occurs, and BIDIR = 1.Hardware clears this bit | ||
6972 | * when the counter is counting down and a limit condition occurs or when the counter reaches 0. | ||
6973 | */ | ||
6974 | #define SCT_CTRL_DOWN_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_DOWN_L_SHIFT)) & SCT_CTRL_DOWN_L_MASK) | ||
6975 | #define SCT_CTRL_STOP_L_MASK (0x2U) | ||
6976 | #define SCT_CTRL_STOP_L_SHIFT (1U) | ||
6977 | /*! STOP_L - When this bit is 1 and HALT is 0, the L or unified counter does not run, but I/O events | ||
6978 | * related to the counter can occur. If a designated start event occurs, this bit is cleared and | ||
6979 | * counting resumes. | ||
6980 | */ | ||
6981 | #define SCT_CTRL_STOP_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_STOP_L_SHIFT)) & SCT_CTRL_STOP_L_MASK) | ||
6982 | #define SCT_CTRL_HALT_L_MASK (0x4U) | ||
6983 | #define SCT_CTRL_HALT_L_SHIFT (2U) | ||
6984 | /*! HALT_L - When this bit is 1, the L or unified counter does not run and no events can occur. A | ||
6985 | * reset sets this bit. When the HALT_L bit is one, the STOP_L bit is cleared. It is possible to | ||
6986 | * remove the halt condition while keeping the SCT in the stop condition (not running) with a | ||
6987 | * single write to this register to simultaneously clear the HALT bit and set the STOP bit. Once set, | ||
6988 | * only software can clear this bit to restore counter operation. This bit is set on reset. | ||
6989 | */ | ||
6990 | #define SCT_CTRL_HALT_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_HALT_L_SHIFT)) & SCT_CTRL_HALT_L_MASK) | ||
6991 | #define SCT_CTRL_CLRCTR_L_MASK (0x8U) | ||
6992 | #define SCT_CTRL_CLRCTR_L_SHIFT (3U) | ||
6993 | /*! CLRCTR_L - Writing a 1 to this bit clears the L or unified counter. This bit always reads as 0. | ||
6994 | */ | ||
6995 | #define SCT_CTRL_CLRCTR_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_CLRCTR_L_SHIFT)) & SCT_CTRL_CLRCTR_L_MASK) | ||
6996 | #define SCT_CTRL_BIDIR_L_MASK (0x10U) | ||
6997 | #define SCT_CTRL_BIDIR_L_SHIFT (4U) | ||
6998 | /*! BIDIR_L - L or unified counter direction select | ||
6999 | * 0b0..Up. The counter counts up to a limit condition, then is cleared to zero. | ||
7000 | * 0b1..Up-down. The counter counts up to a limit, then counts down to a limit condition or to 0. | ||
7001 | */ | ||
7002 | #define SCT_CTRL_BIDIR_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_BIDIR_L_SHIFT)) & SCT_CTRL_BIDIR_L_MASK) | ||
7003 | #define SCT_CTRL_PRE_L_MASK (0x1FE0U) | ||
7004 | #define SCT_CTRL_PRE_L_SHIFT (5U) | ||
7005 | /*! PRE_L - Specifies the factor by which the SCT clock is prescaled to produce the L or unified | ||
7006 | * counter clock. The counter clock is clocked at the rate of the SCT clock divided by PRE_L+1. | ||
7007 | * Clear the counter (by writing a 1 to the CLRCTR bit) whenever changing the PRE value. | ||
7008 | */ | ||
7009 | #define SCT_CTRL_PRE_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_PRE_L_SHIFT)) & SCT_CTRL_PRE_L_MASK) | ||
7010 | #define SCT_CTRL_DOWN_H_MASK (0x10000U) | ||
7011 | #define SCT_CTRL_DOWN_H_SHIFT (16U) | ||
7012 | /*! DOWN_H - This bit is 1 when the H counter is counting down. Hardware sets this bit when the | ||
7013 | * counter is counting, a counter limit condition occurs, and BIDIR is 1. Hardware clears this bit | ||
7014 | * when the counter is counting down and a limit condition occurs or when the counter reaches 0. | ||
7015 | */ | ||
7016 | #define SCT_CTRL_DOWN_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_DOWN_H_SHIFT)) & SCT_CTRL_DOWN_H_MASK) | ||
7017 | #define SCT_CTRL_STOP_H_MASK (0x20000U) | ||
7018 | #define SCT_CTRL_STOP_H_SHIFT (17U) | ||
7019 | /*! STOP_H - When this bit is 1 and HALT is 0, the H counter does not, run but I/O events related to | ||
7020 | * the counter can occur. If such an event matches the mask in the Start register, this bit is | ||
7021 | * cleared and counting resumes. | ||
7022 | */ | ||
7023 | #define SCT_CTRL_STOP_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_STOP_H_SHIFT)) & SCT_CTRL_STOP_H_MASK) | ||
7024 | #define SCT_CTRL_HALT_H_MASK (0x40000U) | ||
7025 | #define SCT_CTRL_HALT_H_SHIFT (18U) | ||
7026 | /*! HALT_H - When this bit is 1, the H counter does not run and no events can occur. A reset sets | ||
7027 | * this bit. When the HALT_H bit is one, the STOP_H bit is cleared. It is possible to remove the | ||
7028 | * halt condition while keeping the SCT in the stop condition (not running) with a single write to | ||
7029 | * this register to simultaneously clear the HALT bit and set the STOP bit. Once set, this bit | ||
7030 | * can only be cleared by software to restore counter operation. This bit is set on reset. | ||
7031 | */ | ||
7032 | #define SCT_CTRL_HALT_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_HALT_H_SHIFT)) & SCT_CTRL_HALT_H_MASK) | ||
7033 | #define SCT_CTRL_CLRCTR_H_MASK (0x80000U) | ||
7034 | #define SCT_CTRL_CLRCTR_H_SHIFT (19U) | ||
7035 | /*! CLRCTR_H - Writing a 1 to this bit clears the H counter. This bit always reads as 0. | ||
7036 | */ | ||
7037 | #define SCT_CTRL_CLRCTR_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_CLRCTR_H_SHIFT)) & SCT_CTRL_CLRCTR_H_MASK) | ||
7038 | #define SCT_CTRL_BIDIR_H_MASK (0x100000U) | ||
7039 | #define SCT_CTRL_BIDIR_H_SHIFT (20U) | ||
7040 | /*! BIDIR_H - Direction select | ||
7041 | * 0b0..The H counter counts up to its limit condition, then is cleared to zero. | ||
7042 | * 0b1..The H counter counts up to its limit, then counts down to a limit condition or to 0. | ||
7043 | */ | ||
7044 | #define SCT_CTRL_BIDIR_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_BIDIR_H_SHIFT)) & SCT_CTRL_BIDIR_H_MASK) | ||
7045 | #define SCT_CTRL_PRE_H_MASK (0x1FE00000U) | ||
7046 | #define SCT_CTRL_PRE_H_SHIFT (21U) | ||
7047 | /*! PRE_H - Specifies the factor by which the SCT clock is prescaled to produce the H counter clock. | ||
7048 | * The counter clock is clocked at the rate of the SCT clock divided by PRELH+1. Clear the | ||
7049 | * counter (by writing a 1 to the CLRCTR bit) whenever changing the PRE value. | ||
7050 | */ | ||
7051 | #define SCT_CTRL_PRE_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CTRL_PRE_H_SHIFT)) & SCT_CTRL_PRE_H_MASK) | ||
7052 | /*! @} */ | ||
7053 | |||
7054 | /*! @name LIMITL - SCT_LIMITL register */ | ||
7055 | /*! @{ */ | ||
7056 | #define SCT_LIMITL_LIMITL_MASK (0xFFFFU) | ||
7057 | #define SCT_LIMITL_LIMITL_SHIFT (0U) | ||
7058 | #define SCT_LIMITL_LIMITL(x) (((uint16_t)(((uint16_t)(x)) << SCT_LIMITL_LIMITL_SHIFT)) & SCT_LIMITL_LIMITL_MASK) | ||
7059 | /*! @} */ | ||
7060 | |||
7061 | /*! @name LIMITH - SCT_LIMITH register */ | ||
7062 | /*! @{ */ | ||
7063 | #define SCT_LIMITH_LIMITH_MASK (0xFFFFU) | ||
7064 | #define SCT_LIMITH_LIMITH_SHIFT (0U) | ||
7065 | #define SCT_LIMITH_LIMITH(x) (((uint16_t)(((uint16_t)(x)) << SCT_LIMITH_LIMITH_SHIFT)) & SCT_LIMITH_LIMITH_MASK) | ||
7066 | /*! @} */ | ||
7067 | |||
7068 | /*! @name LIMIT - SCT limit event select register */ | ||
7069 | /*! @{ */ | ||
7070 | #define SCT_LIMIT_LIMMSK_L_MASK (0xFFFFU) | ||
7071 | #define SCT_LIMIT_LIMMSK_L_SHIFT (0U) | ||
7072 | /*! LIMMSK_L - If bit n is one, event n is used as a counter limit for the L or unified counter | ||
7073 | * (event 0 = bit 0, event 1 = bit 1, etc.). The number of bits = number of events in this SCT. | ||
7074 | */ | ||
7075 | #define SCT_LIMIT_LIMMSK_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_LIMIT_LIMMSK_L_SHIFT)) & SCT_LIMIT_LIMMSK_L_MASK) | ||
7076 | #define SCT_LIMIT_LIMMSK_H_MASK (0xFFFF0000U) | ||
7077 | #define SCT_LIMIT_LIMMSK_H_SHIFT (16U) | ||
7078 | /*! LIMMSK_H - If bit n is one, event n is used as a counter limit for the H counter (event 0 = bit | ||
7079 | * 16, event 1 = bit 17, etc.). The number of bits = number of events in this SCT. | ||
7080 | */ | ||
7081 | #define SCT_LIMIT_LIMMSK_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_LIMIT_LIMMSK_H_SHIFT)) & SCT_LIMIT_LIMMSK_H_MASK) | ||
7082 | /*! @} */ | ||
7083 | |||
7084 | /*! @name HALTL - SCT_HALTL register */ | ||
7085 | /*! @{ */ | ||
7086 | #define SCT_HALTL_HALTL_MASK (0xFFFFU) | ||
7087 | #define SCT_HALTL_HALTL_SHIFT (0U) | ||
7088 | #define SCT_HALTL_HALTL(x) (((uint16_t)(((uint16_t)(x)) << SCT_HALTL_HALTL_SHIFT)) & SCT_HALTL_HALTL_MASK) | ||
7089 | /*! @} */ | ||
7090 | |||
7091 | /*! @name HALTH - SCT_HALTH register */ | ||
7092 | /*! @{ */ | ||
7093 | #define SCT_HALTH_HALTH_MASK (0xFFFFU) | ||
7094 | #define SCT_HALTH_HALTH_SHIFT (0U) | ||
7095 | #define SCT_HALTH_HALTH(x) (((uint16_t)(((uint16_t)(x)) << SCT_HALTH_HALTH_SHIFT)) & SCT_HALTH_HALTH_MASK) | ||
7096 | /*! @} */ | ||
7097 | |||
7098 | /*! @name HALT - SCT halt event select register */ | ||
7099 | /*! @{ */ | ||
7100 | #define SCT_HALT_HALTMSK_L_MASK (0xFFFFU) | ||
7101 | #define SCT_HALT_HALTMSK_L_SHIFT (0U) | ||
7102 | /*! HALTMSK_L - If bit n is one, event n sets the HALT_L bit in the CTRL register (event 0 = bit 0, | ||
7103 | * event 1 = bit 1, etc.). The number of bits = number of events in this SCT. | ||
7104 | */ | ||
7105 | #define SCT_HALT_HALTMSK_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_HALT_HALTMSK_L_SHIFT)) & SCT_HALT_HALTMSK_L_MASK) | ||
7106 | #define SCT_HALT_HALTMSK_H_MASK (0xFFFF0000U) | ||
7107 | #define SCT_HALT_HALTMSK_H_SHIFT (16U) | ||
7108 | /*! HALTMSK_H - If bit n is one, event n sets the HALT_H bit in the CTRL register (event 0 = bit 16, | ||
7109 | * event 1 = bit 17, etc.). The number of bits = number of events in this SCT. | ||
7110 | */ | ||
7111 | #define SCT_HALT_HALTMSK_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_HALT_HALTMSK_H_SHIFT)) & SCT_HALT_HALTMSK_H_MASK) | ||
7112 | /*! @} */ | ||
7113 | |||
7114 | /*! @name STOPL - SCT_STOPL register */ | ||
7115 | /*! @{ */ | ||
7116 | #define SCT_STOPL_STOPL_MASK (0xFFFFU) | ||
7117 | #define SCT_STOPL_STOPL_SHIFT (0U) | ||
7118 | #define SCT_STOPL_STOPL(x) (((uint16_t)(((uint16_t)(x)) << SCT_STOPL_STOPL_SHIFT)) & SCT_STOPL_STOPL_MASK) | ||
7119 | /*! @} */ | ||
7120 | |||
7121 | /*! @name STOPH - SCT_STOPH register */ | ||
7122 | /*! @{ */ | ||
7123 | #define SCT_STOPH_STOPH_MASK (0xFFFFU) | ||
7124 | #define SCT_STOPH_STOPH_SHIFT (0U) | ||
7125 | #define SCT_STOPH_STOPH(x) (((uint16_t)(((uint16_t)(x)) << SCT_STOPH_STOPH_SHIFT)) & SCT_STOPH_STOPH_MASK) | ||
7126 | /*! @} */ | ||
7127 | |||
7128 | /*! @name STOP - SCT stop event select register */ | ||
7129 | /*! @{ */ | ||
7130 | #define SCT_STOP_STOPMSK_L_MASK (0xFFFFU) | ||
7131 | #define SCT_STOP_STOPMSK_L_SHIFT (0U) | ||
7132 | /*! STOPMSK_L - If bit n is one, event n sets the STOP_L bit in the CTRL register (event 0 = bit 0, | ||
7133 | * event 1 = bit 1, etc.). The number of bits = number of events in this SCT. | ||
7134 | */ | ||
7135 | #define SCT_STOP_STOPMSK_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_STOP_STOPMSK_L_SHIFT)) & SCT_STOP_STOPMSK_L_MASK) | ||
7136 | #define SCT_STOP_STOPMSK_H_MASK (0xFFFF0000U) | ||
7137 | #define SCT_STOP_STOPMSK_H_SHIFT (16U) | ||
7138 | /*! STOPMSK_H - If bit n is one, event n sets the STOP_H bit in the CTRL register (event 0 = bit 16, | ||
7139 | * event 1 = bit 17, etc.). The number of bits = number of events in this SCT. | ||
7140 | */ | ||
7141 | #define SCT_STOP_STOPMSK_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_STOP_STOPMSK_H_SHIFT)) & SCT_STOP_STOPMSK_H_MASK) | ||
7142 | /*! @} */ | ||
7143 | |||
7144 | /*! @name STARTL - SCT_STARTL register */ | ||
7145 | /*! @{ */ | ||
7146 | #define SCT_STARTL_STARTL_MASK (0xFFFFU) | ||
7147 | #define SCT_STARTL_STARTL_SHIFT (0U) | ||
7148 | #define SCT_STARTL_STARTL(x) (((uint16_t)(((uint16_t)(x)) << SCT_STARTL_STARTL_SHIFT)) & SCT_STARTL_STARTL_MASK) | ||
7149 | /*! @} */ | ||
7150 | |||
7151 | /*! @name STARTH - SCT_STARTH register */ | ||
7152 | /*! @{ */ | ||
7153 | #define SCT_STARTH_STARTH_MASK (0xFFFFU) | ||
7154 | #define SCT_STARTH_STARTH_SHIFT (0U) | ||
7155 | #define SCT_STARTH_STARTH(x) (((uint16_t)(((uint16_t)(x)) << SCT_STARTH_STARTH_SHIFT)) & SCT_STARTH_STARTH_MASK) | ||
7156 | /*! @} */ | ||
7157 | |||
7158 | /*! @name START - SCT start event select register */ | ||
7159 | /*! @{ */ | ||
7160 | #define SCT_START_STARTMSK_L_MASK (0xFFFFU) | ||
7161 | #define SCT_START_STARTMSK_L_SHIFT (0U) | ||
7162 | /*! STARTMSK_L - If bit n is one, event n clears the STOP_L bit in the CTRL register (event 0 = bit | ||
7163 | * 0, event 1 = bit 1, etc.). The number of bits = number of events in this SCT. | ||
7164 | */ | ||
7165 | #define SCT_START_STARTMSK_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_START_STARTMSK_L_SHIFT)) & SCT_START_STARTMSK_L_MASK) | ||
7166 | #define SCT_START_STARTMSK_H_MASK (0xFFFF0000U) | ||
7167 | #define SCT_START_STARTMSK_H_SHIFT (16U) | ||
7168 | /*! STARTMSK_H - If bit n is one, event n clears the STOP_H bit in the CTRL register (event 0 = bit | ||
7169 | * 16, event 1 = bit 17, etc.). The number of bits = number of events in this SCT. | ||
7170 | */ | ||
7171 | #define SCT_START_STARTMSK_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_START_STARTMSK_H_SHIFT)) & SCT_START_STARTMSK_H_MASK) | ||
7172 | /*! @} */ | ||
7173 | |||
7174 | /*! @name COUNTL - SCT_COUNTL register */ | ||
7175 | /*! @{ */ | ||
7176 | #define SCT_COUNTL_COUNTL_MASK (0xFFFFU) | ||
7177 | #define SCT_COUNTL_COUNTL_SHIFT (0U) | ||
7178 | #define SCT_COUNTL_COUNTL(x) (((uint16_t)(((uint16_t)(x)) << SCT_COUNTL_COUNTL_SHIFT)) & SCT_COUNTL_COUNTL_MASK) | ||
7179 | /*! @} */ | ||
7180 | |||
7181 | /*! @name COUNTH - SCT_COUNTH register */ | ||
7182 | /*! @{ */ | ||
7183 | #define SCT_COUNTH_COUNTH_MASK (0xFFFFU) | ||
7184 | #define SCT_COUNTH_COUNTH_SHIFT (0U) | ||
7185 | #define SCT_COUNTH_COUNTH(x) (((uint16_t)(((uint16_t)(x)) << SCT_COUNTH_COUNTH_SHIFT)) & SCT_COUNTH_COUNTH_MASK) | ||
7186 | /*! @} */ | ||
7187 | |||
7188 | /*! @name COUNT - SCT counter register */ | ||
7189 | /*! @{ */ | ||
7190 | #define SCT_COUNT_CTR_L_MASK (0xFFFFU) | ||
7191 | #define SCT_COUNT_CTR_L_SHIFT (0U) | ||
7192 | /*! CTR_L - When UNIFY = 0, read or write the 16-bit L counter value. When UNIFY = 1, read or write | ||
7193 | * the lower 16 bits of the 32-bit unified counter. | ||
7194 | */ | ||
7195 | #define SCT_COUNT_CTR_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_COUNT_CTR_L_SHIFT)) & SCT_COUNT_CTR_L_MASK) | ||
7196 | #define SCT_COUNT_CTR_H_MASK (0xFFFF0000U) | ||
7197 | #define SCT_COUNT_CTR_H_SHIFT (16U) | ||
7198 | /*! CTR_H - When UNIFY = 0, read or write the 16-bit H counter value. When UNIFY = 1, read or write | ||
7199 | * the upper 16 bits of the 32-bit unified counter. | ||
7200 | */ | ||
7201 | #define SCT_COUNT_CTR_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_COUNT_CTR_H_SHIFT)) & SCT_COUNT_CTR_H_MASK) | ||
7202 | /*! @} */ | ||
7203 | |||
7204 | /*! @name STATEL - SCT_STATEL register */ | ||
7205 | /*! @{ */ | ||
7206 | #define SCT_STATEL_STATEL_MASK (0xFFFFU) | ||
7207 | #define SCT_STATEL_STATEL_SHIFT (0U) | ||
7208 | #define SCT_STATEL_STATEL(x) (((uint16_t)(((uint16_t)(x)) << SCT_STATEL_STATEL_SHIFT)) & SCT_STATEL_STATEL_MASK) | ||
7209 | /*! @} */ | ||
7210 | |||
7211 | /*! @name STATEH - SCT_STATEH register */ | ||
7212 | /*! @{ */ | ||
7213 | #define SCT_STATEH_STATEH_MASK (0xFFFFU) | ||
7214 | #define SCT_STATEH_STATEH_SHIFT (0U) | ||
7215 | #define SCT_STATEH_STATEH(x) (((uint16_t)(((uint16_t)(x)) << SCT_STATEH_STATEH_SHIFT)) & SCT_STATEH_STATEH_MASK) | ||
7216 | /*! @} */ | ||
7217 | |||
7218 | /*! @name STATE - SCT state register */ | ||
7219 | /*! @{ */ | ||
7220 | #define SCT_STATE_STATE_L_MASK (0x1FU) | ||
7221 | #define SCT_STATE_STATE_L_SHIFT (0U) | ||
7222 | /*! STATE_L - State variable. | ||
7223 | */ | ||
7224 | #define SCT_STATE_STATE_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_STATE_STATE_L_SHIFT)) & SCT_STATE_STATE_L_MASK) | ||
7225 | #define SCT_STATE_STATE_H_MASK (0x1F0000U) | ||
7226 | #define SCT_STATE_STATE_H_SHIFT (16U) | ||
7227 | /*! STATE_H - State variable. | ||
7228 | */ | ||
7229 | #define SCT_STATE_STATE_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_STATE_STATE_H_SHIFT)) & SCT_STATE_STATE_H_MASK) | ||
7230 | /*! @} */ | ||
7231 | |||
7232 | /*! @name INPUT - SCT input register */ | ||
7233 | /*! @{ */ | ||
7234 | #define SCT_INPUT_AIN0_MASK (0x1U) | ||
7235 | #define SCT_INPUT_AIN0_SHIFT (0U) | ||
7236 | /*! AIN0 - Input 0 state. Input 0 state on the last SCT clock edge. | ||
7237 | */ | ||
7238 | #define SCT_INPUT_AIN0(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN0_SHIFT)) & SCT_INPUT_AIN0_MASK) | ||
7239 | #define SCT_INPUT_AIN1_MASK (0x2U) | ||
7240 | #define SCT_INPUT_AIN1_SHIFT (1U) | ||
7241 | /*! AIN1 - Input 1 state. Input 1 state on the last SCT clock edge. | ||
7242 | */ | ||
7243 | #define SCT_INPUT_AIN1(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN1_SHIFT)) & SCT_INPUT_AIN1_MASK) | ||
7244 | #define SCT_INPUT_AIN2_MASK (0x4U) | ||
7245 | #define SCT_INPUT_AIN2_SHIFT (2U) | ||
7246 | /*! AIN2 - Input 2 state. Input 2 state on the last SCT clock edge. | ||
7247 | */ | ||
7248 | #define SCT_INPUT_AIN2(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN2_SHIFT)) & SCT_INPUT_AIN2_MASK) | ||
7249 | #define SCT_INPUT_AIN3_MASK (0x8U) | ||
7250 | #define SCT_INPUT_AIN3_SHIFT (3U) | ||
7251 | /*! AIN3 - Input 3 state. Input 3 state on the last SCT clock edge. | ||
7252 | */ | ||
7253 | #define SCT_INPUT_AIN3(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN3_SHIFT)) & SCT_INPUT_AIN3_MASK) | ||
7254 | #define SCT_INPUT_AIN4_MASK (0x10U) | ||
7255 | #define SCT_INPUT_AIN4_SHIFT (4U) | ||
7256 | /*! AIN4 - Input 4 state. Input 4 state on the last SCT clock edge. | ||
7257 | */ | ||
7258 | #define SCT_INPUT_AIN4(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN4_SHIFT)) & SCT_INPUT_AIN4_MASK) | ||
7259 | #define SCT_INPUT_AIN5_MASK (0x20U) | ||
7260 | #define SCT_INPUT_AIN5_SHIFT (5U) | ||
7261 | /*! AIN5 - Input 5 state. Input 5 state on the last SCT clock edge. | ||
7262 | */ | ||
7263 | #define SCT_INPUT_AIN5(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN5_SHIFT)) & SCT_INPUT_AIN5_MASK) | ||
7264 | #define SCT_INPUT_AIN6_MASK (0x40U) | ||
7265 | #define SCT_INPUT_AIN6_SHIFT (6U) | ||
7266 | /*! AIN6 - Input 6 state. Input 6 state on the last SCT clock edge. | ||
7267 | */ | ||
7268 | #define SCT_INPUT_AIN6(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN6_SHIFT)) & SCT_INPUT_AIN6_MASK) | ||
7269 | #define SCT_INPUT_AIN7_MASK (0x80U) | ||
7270 | #define SCT_INPUT_AIN7_SHIFT (7U) | ||
7271 | /*! AIN7 - Input 7 state. Input 7 state on the last SCT clock edge. | ||
7272 | */ | ||
7273 | #define SCT_INPUT_AIN7(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN7_SHIFT)) & SCT_INPUT_AIN7_MASK) | ||
7274 | #define SCT_INPUT_AIN8_MASK (0x100U) | ||
7275 | #define SCT_INPUT_AIN8_SHIFT (8U) | ||
7276 | /*! AIN8 - Input 8 state. Input 8 state on the last SCT clock edge. | ||
7277 | */ | ||
7278 | #define SCT_INPUT_AIN8(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN8_SHIFT)) & SCT_INPUT_AIN8_MASK) | ||
7279 | #define SCT_INPUT_AIN9_MASK (0x200U) | ||
7280 | #define SCT_INPUT_AIN9_SHIFT (9U) | ||
7281 | /*! AIN9 - Input 9 state. Input 9 state on the last SCT clock edge. | ||
7282 | */ | ||
7283 | #define SCT_INPUT_AIN9(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN9_SHIFT)) & SCT_INPUT_AIN9_MASK) | ||
7284 | #define SCT_INPUT_AIN10_MASK (0x400U) | ||
7285 | #define SCT_INPUT_AIN10_SHIFT (10U) | ||
7286 | /*! AIN10 - Input 10 state. Input 10 state on the last SCT clock edge. | ||
7287 | */ | ||
7288 | #define SCT_INPUT_AIN10(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN10_SHIFT)) & SCT_INPUT_AIN10_MASK) | ||
7289 | #define SCT_INPUT_AIN11_MASK (0x800U) | ||
7290 | #define SCT_INPUT_AIN11_SHIFT (11U) | ||
7291 | /*! AIN11 - Input 11 state. Input 11 state on the last SCT clock edge. | ||
7292 | */ | ||
7293 | #define SCT_INPUT_AIN11(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN11_SHIFT)) & SCT_INPUT_AIN11_MASK) | ||
7294 | #define SCT_INPUT_AIN12_MASK (0x1000U) | ||
7295 | #define SCT_INPUT_AIN12_SHIFT (12U) | ||
7296 | /*! AIN12 - Input 12 state. Input 12 state on the last SCT clock edge. | ||
7297 | */ | ||
7298 | #define SCT_INPUT_AIN12(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN12_SHIFT)) & SCT_INPUT_AIN12_MASK) | ||
7299 | #define SCT_INPUT_AIN13_MASK (0x2000U) | ||
7300 | #define SCT_INPUT_AIN13_SHIFT (13U) | ||
7301 | /*! AIN13 - Input 13 state. Input 13 state on the last SCT clock edge. | ||
7302 | */ | ||
7303 | #define SCT_INPUT_AIN13(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN13_SHIFT)) & SCT_INPUT_AIN13_MASK) | ||
7304 | #define SCT_INPUT_AIN14_MASK (0x4000U) | ||
7305 | #define SCT_INPUT_AIN14_SHIFT (14U) | ||
7306 | /*! AIN14 - Input 14 state. Input 14 state on the last SCT clock edge. | ||
7307 | */ | ||
7308 | #define SCT_INPUT_AIN14(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN14_SHIFT)) & SCT_INPUT_AIN14_MASK) | ||
7309 | #define SCT_INPUT_AIN15_MASK (0x8000U) | ||
7310 | #define SCT_INPUT_AIN15_SHIFT (15U) | ||
7311 | /*! AIN15 - Input 15 state. Input 15 state on the last SCT clock edge. | ||
7312 | */ | ||
7313 | #define SCT_INPUT_AIN15(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_AIN15_SHIFT)) & SCT_INPUT_AIN15_MASK) | ||
7314 | #define SCT_INPUT_SIN0_MASK (0x10000U) | ||
7315 | #define SCT_INPUT_SIN0_SHIFT (16U) | ||
7316 | /*! SIN0 - Input 0 state. Input 0 state following the synchronization specified by INSYNC. | ||
7317 | */ | ||
7318 | #define SCT_INPUT_SIN0(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN0_SHIFT)) & SCT_INPUT_SIN0_MASK) | ||
7319 | #define SCT_INPUT_SIN1_MASK (0x20000U) | ||
7320 | #define SCT_INPUT_SIN1_SHIFT (17U) | ||
7321 | /*! SIN1 - Input 1 state. Input 1 state following the synchronization specified by INSYNC. | ||
7322 | */ | ||
7323 | #define SCT_INPUT_SIN1(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN1_SHIFT)) & SCT_INPUT_SIN1_MASK) | ||
7324 | #define SCT_INPUT_SIN2_MASK (0x40000U) | ||
7325 | #define SCT_INPUT_SIN2_SHIFT (18U) | ||
7326 | /*! SIN2 - Input 2 state. Input 2 state following the synchronization specified by INSYNC. | ||
7327 | */ | ||
7328 | #define SCT_INPUT_SIN2(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN2_SHIFT)) & SCT_INPUT_SIN2_MASK) | ||
7329 | #define SCT_INPUT_SIN3_MASK (0x80000U) | ||
7330 | #define SCT_INPUT_SIN3_SHIFT (19U) | ||
7331 | /*! SIN3 - Input 3 state. Input 3 state following the synchronization specified by INSYNC. | ||
7332 | */ | ||
7333 | #define SCT_INPUT_SIN3(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN3_SHIFT)) & SCT_INPUT_SIN3_MASK) | ||
7334 | #define SCT_INPUT_SIN4_MASK (0x100000U) | ||
7335 | #define SCT_INPUT_SIN4_SHIFT (20U) | ||
7336 | /*! SIN4 - Input 4 state. Input 4 state following the synchronization specified by INSYNC. | ||
7337 | */ | ||
7338 | #define SCT_INPUT_SIN4(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN4_SHIFT)) & SCT_INPUT_SIN4_MASK) | ||
7339 | #define SCT_INPUT_SIN5_MASK (0x200000U) | ||
7340 | #define SCT_INPUT_SIN5_SHIFT (21U) | ||
7341 | /*! SIN5 - Input 5 state. Input 5 state following the synchronization specified by INSYNC. | ||
7342 | */ | ||
7343 | #define SCT_INPUT_SIN5(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN5_SHIFT)) & SCT_INPUT_SIN5_MASK) | ||
7344 | #define SCT_INPUT_SIN6_MASK (0x400000U) | ||
7345 | #define SCT_INPUT_SIN6_SHIFT (22U) | ||
7346 | /*! SIN6 - Input 6 state. Input 6 state following the synchronization specified by INSYNC. | ||
7347 | */ | ||
7348 | #define SCT_INPUT_SIN6(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN6_SHIFT)) & SCT_INPUT_SIN6_MASK) | ||
7349 | #define SCT_INPUT_SIN7_MASK (0x800000U) | ||
7350 | #define SCT_INPUT_SIN7_SHIFT (23U) | ||
7351 | /*! SIN7 - Input 7 state. Input 7 state following the synchronization specified by INSYNC. | ||
7352 | */ | ||
7353 | #define SCT_INPUT_SIN7(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN7_SHIFT)) & SCT_INPUT_SIN7_MASK) | ||
7354 | #define SCT_INPUT_SIN8_MASK (0x1000000U) | ||
7355 | #define SCT_INPUT_SIN8_SHIFT (24U) | ||
7356 | /*! SIN8 - Input 8 state. Input 8 state following the synchronization specified by INSYNC. | ||
7357 | */ | ||
7358 | #define SCT_INPUT_SIN8(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN8_SHIFT)) & SCT_INPUT_SIN8_MASK) | ||
7359 | #define SCT_INPUT_SIN9_MASK (0x2000000U) | ||
7360 | #define SCT_INPUT_SIN9_SHIFT (25U) | ||
7361 | /*! SIN9 - Input 9 state. Input 9 state following the synchronization specified by INSYNC. | ||
7362 | */ | ||
7363 | #define SCT_INPUT_SIN9(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN9_SHIFT)) & SCT_INPUT_SIN9_MASK) | ||
7364 | #define SCT_INPUT_SIN10_MASK (0x4000000U) | ||
7365 | #define SCT_INPUT_SIN10_SHIFT (26U) | ||
7366 | /*! SIN10 - Input 10 state. Input 10 state following the synchronization specified by INSYNC. | ||
7367 | */ | ||
7368 | #define SCT_INPUT_SIN10(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN10_SHIFT)) & SCT_INPUT_SIN10_MASK) | ||
7369 | #define SCT_INPUT_SIN11_MASK (0x8000000U) | ||
7370 | #define SCT_INPUT_SIN11_SHIFT (27U) | ||
7371 | /*! SIN11 - Input 11 state. Input 11 state following the synchronization specified by INSYNC. | ||
7372 | */ | ||
7373 | #define SCT_INPUT_SIN11(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN11_SHIFT)) & SCT_INPUT_SIN11_MASK) | ||
7374 | #define SCT_INPUT_SIN12_MASK (0x10000000U) | ||
7375 | #define SCT_INPUT_SIN12_SHIFT (28U) | ||
7376 | /*! SIN12 - Input 12 state. Input 12 state following the synchronization specified by INSYNC. | ||
7377 | */ | ||
7378 | #define SCT_INPUT_SIN12(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN12_SHIFT)) & SCT_INPUT_SIN12_MASK) | ||
7379 | #define SCT_INPUT_SIN13_MASK (0x20000000U) | ||
7380 | #define SCT_INPUT_SIN13_SHIFT (29U) | ||
7381 | /*! SIN13 - Input 13 state. Input 13 state following the synchronization specified by INSYNC. | ||
7382 | */ | ||
7383 | #define SCT_INPUT_SIN13(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN13_SHIFT)) & SCT_INPUT_SIN13_MASK) | ||
7384 | #define SCT_INPUT_SIN14_MASK (0x40000000U) | ||
7385 | #define SCT_INPUT_SIN14_SHIFT (30U) | ||
7386 | /*! SIN14 - Input 14 state. Input 14 state following the synchronization specified by INSYNC. | ||
7387 | */ | ||
7388 | #define SCT_INPUT_SIN14(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN14_SHIFT)) & SCT_INPUT_SIN14_MASK) | ||
7389 | #define SCT_INPUT_SIN15_MASK (0x80000000U) | ||
7390 | #define SCT_INPUT_SIN15_SHIFT (31U) | ||
7391 | /*! SIN15 - Input 15 state. Input 15 state following the synchronization specified by INSYNC. | ||
7392 | */ | ||
7393 | #define SCT_INPUT_SIN15(x) (((uint32_t)(((uint32_t)(x)) << SCT_INPUT_SIN15_SHIFT)) & SCT_INPUT_SIN15_MASK) | ||
7394 | /*! @} */ | ||
7395 | |||
7396 | /*! @name REGMODEL - SCT_REGMODEL register */ | ||
7397 | /*! @{ */ | ||
7398 | #define SCT_REGMODEL_REGMODEL_MASK (0xFFFFU) | ||
7399 | #define SCT_REGMODEL_REGMODEL_SHIFT (0U) | ||
7400 | #define SCT_REGMODEL_REGMODEL(x) (((uint16_t)(((uint16_t)(x)) << SCT_REGMODEL_REGMODEL_SHIFT)) & SCT_REGMODEL_REGMODEL_MASK) | ||
7401 | /*! @} */ | ||
7402 | |||
7403 | /*! @name REGMODEH - SCT_REGMODEH register */ | ||
7404 | /*! @{ */ | ||
7405 | #define SCT_REGMODEH_REGMODEH_MASK (0xFFFFU) | ||
7406 | #define SCT_REGMODEH_REGMODEH_SHIFT (0U) | ||
7407 | #define SCT_REGMODEH_REGMODEH(x) (((uint16_t)(((uint16_t)(x)) << SCT_REGMODEH_REGMODEH_SHIFT)) & SCT_REGMODEH_REGMODEH_MASK) | ||
7408 | /*! @} */ | ||
7409 | |||
7410 | /*! @name REGMODE - SCT match/capture mode register */ | ||
7411 | /*! @{ */ | ||
7412 | #define SCT_REGMODE_REGMOD_L_MASK (0xFFFFU) | ||
7413 | #define SCT_REGMODE_REGMOD_L_SHIFT (0U) | ||
7414 | /*! REGMOD_L - Each bit controls one match/capture register (register 0 = bit 0, register 1 = bit 1, | ||
7415 | * etc.). The number of bits = number of match/captures in this SCT. 0 = register operates as | ||
7416 | * match register. 1 = register operates as capture register. | ||
7417 | */ | ||
7418 | #define SCT_REGMODE_REGMOD_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_REGMODE_REGMOD_L_SHIFT)) & SCT_REGMODE_REGMOD_L_MASK) | ||
7419 | #define SCT_REGMODE_REGMOD_H_MASK (0xFFFF0000U) | ||
7420 | #define SCT_REGMODE_REGMOD_H_SHIFT (16U) | ||
7421 | /*! REGMOD_H - Each bit controls one match/capture register (register 0 = bit 16, register 1 = bit | ||
7422 | * 17, etc.). The number of bits = number of match/captures in this SCT. 0 = register operates as | ||
7423 | * match registers. 1 = register operates as capture registers. | ||
7424 | */ | ||
7425 | #define SCT_REGMODE_REGMOD_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_REGMODE_REGMOD_H_SHIFT)) & SCT_REGMODE_REGMOD_H_MASK) | ||
7426 | /*! @} */ | ||
7427 | |||
7428 | /*! @name OUTPUT - SCT output register */ | ||
7429 | /*! @{ */ | ||
7430 | #define SCT_OUTPUT_OUT_MASK (0xFFFFU) | ||
7431 | #define SCT_OUTPUT_OUT_SHIFT (0U) | ||
7432 | /*! OUT - Writing a 1 to bit n forces the corresponding output HIGH. Writing a 0 forces the | ||
7433 | * corresponding output LOW (output 0 = bit 0, output 1 = bit 1, etc.). The number of bits = number of | ||
7434 | * outputs in this SCT. | ||
7435 | */ | ||
7436 | #define SCT_OUTPUT_OUT(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUT_OUT_SHIFT)) & SCT_OUTPUT_OUT_MASK) | ||
7437 | /*! @} */ | ||
7438 | |||
7439 | /*! @name OUTPUTDIRCTRL - SCT output counter direction control register */ | ||
7440 | /*! @{ */ | ||
7441 | #define SCT_OUTPUTDIRCTRL_SETCLR0_MASK (0x3U) | ||
7442 | #define SCT_OUTPUTDIRCTRL_SETCLR0_SHIFT (0U) | ||
7443 | /*! SETCLR0 - Set/clear operation on output 0. Value 0x3 is reserved. Do not program this value. | ||
7444 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7445 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7446 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7447 | */ | ||
7448 | #define SCT_OUTPUTDIRCTRL_SETCLR0(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR0_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR0_MASK) | ||
7449 | #define SCT_OUTPUTDIRCTRL_SETCLR1_MASK (0xCU) | ||
7450 | #define SCT_OUTPUTDIRCTRL_SETCLR1_SHIFT (2U) | ||
7451 | /*! SETCLR1 - Set/clear operation on output 1. Value 0x3 is reserved. Do not program this value. | ||
7452 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7453 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7454 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7455 | */ | ||
7456 | #define SCT_OUTPUTDIRCTRL_SETCLR1(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR1_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR1_MASK) | ||
7457 | #define SCT_OUTPUTDIRCTRL_SETCLR2_MASK (0x30U) | ||
7458 | #define SCT_OUTPUTDIRCTRL_SETCLR2_SHIFT (4U) | ||
7459 | /*! SETCLR2 - Set/clear operation on output 2. Value 0x3 is reserved. Do not program this value. | ||
7460 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7461 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7462 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7463 | */ | ||
7464 | #define SCT_OUTPUTDIRCTRL_SETCLR2(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR2_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR2_MASK) | ||
7465 | #define SCT_OUTPUTDIRCTRL_SETCLR3_MASK (0xC0U) | ||
7466 | #define SCT_OUTPUTDIRCTRL_SETCLR3_SHIFT (6U) | ||
7467 | /*! SETCLR3 - Set/clear operation on output 3. Value 0x3 is reserved. Do not program this value. | ||
7468 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7469 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7470 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7471 | */ | ||
7472 | #define SCT_OUTPUTDIRCTRL_SETCLR3(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR3_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR3_MASK) | ||
7473 | #define SCT_OUTPUTDIRCTRL_SETCLR4_MASK (0x300U) | ||
7474 | #define SCT_OUTPUTDIRCTRL_SETCLR4_SHIFT (8U) | ||
7475 | /*! SETCLR4 - Set/clear operation on output 4. Value 0x3 is reserved. Do not program this value. | ||
7476 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7477 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7478 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7479 | */ | ||
7480 | #define SCT_OUTPUTDIRCTRL_SETCLR4(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR4_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR4_MASK) | ||
7481 | #define SCT_OUTPUTDIRCTRL_SETCLR5_MASK (0xC00U) | ||
7482 | #define SCT_OUTPUTDIRCTRL_SETCLR5_SHIFT (10U) | ||
7483 | /*! SETCLR5 - Set/clear operation on output 5. Value 0x3 is reserved. Do not program this value. | ||
7484 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7485 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7486 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7487 | */ | ||
7488 | #define SCT_OUTPUTDIRCTRL_SETCLR5(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR5_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR5_MASK) | ||
7489 | #define SCT_OUTPUTDIRCTRL_SETCLR6_MASK (0x3000U) | ||
7490 | #define SCT_OUTPUTDIRCTRL_SETCLR6_SHIFT (12U) | ||
7491 | /*! SETCLR6 - Set/clear operation on output 6. Value 0x3 is reserved. Do not program this value. | ||
7492 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7493 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7494 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7495 | */ | ||
7496 | #define SCT_OUTPUTDIRCTRL_SETCLR6(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR6_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR6_MASK) | ||
7497 | #define SCT_OUTPUTDIRCTRL_SETCLR7_MASK (0xC000U) | ||
7498 | #define SCT_OUTPUTDIRCTRL_SETCLR7_SHIFT (14U) | ||
7499 | /*! SETCLR7 - Set/clear operation on output 7. Value 0x3 is reserved. Do not program this value. | ||
7500 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7501 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7502 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7503 | */ | ||
7504 | #define SCT_OUTPUTDIRCTRL_SETCLR7(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR7_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR7_MASK) | ||
7505 | #define SCT_OUTPUTDIRCTRL_SETCLR8_MASK (0x30000U) | ||
7506 | #define SCT_OUTPUTDIRCTRL_SETCLR8_SHIFT (16U) | ||
7507 | /*! SETCLR8 - Set/clear operation on output 8. Value 0x3 is reserved. Do not program this value. | ||
7508 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7509 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7510 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7511 | */ | ||
7512 | #define SCT_OUTPUTDIRCTRL_SETCLR8(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR8_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR8_MASK) | ||
7513 | #define SCT_OUTPUTDIRCTRL_SETCLR9_MASK (0xC0000U) | ||
7514 | #define SCT_OUTPUTDIRCTRL_SETCLR9_SHIFT (18U) | ||
7515 | /*! SETCLR9 - Set/clear operation on output 9. Value 0x3 is reserved. Do not program this value. | ||
7516 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7517 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7518 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7519 | */ | ||
7520 | #define SCT_OUTPUTDIRCTRL_SETCLR9(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR9_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR9_MASK) | ||
7521 | #define SCT_OUTPUTDIRCTRL_SETCLR10_MASK (0x300000U) | ||
7522 | #define SCT_OUTPUTDIRCTRL_SETCLR10_SHIFT (20U) | ||
7523 | /*! SETCLR10 - Set/clear operation on output 10. Value 0x3 is reserved. Do not program this value. | ||
7524 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7525 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7526 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7527 | */ | ||
7528 | #define SCT_OUTPUTDIRCTRL_SETCLR10(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR10_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR10_MASK) | ||
7529 | #define SCT_OUTPUTDIRCTRL_SETCLR11_MASK (0xC00000U) | ||
7530 | #define SCT_OUTPUTDIRCTRL_SETCLR11_SHIFT (22U) | ||
7531 | /*! SETCLR11 - Set/clear operation on output 11. Value 0x3 is reserved. Do not program this value. | ||
7532 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7533 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7534 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7535 | */ | ||
7536 | #define SCT_OUTPUTDIRCTRL_SETCLR11(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR11_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR11_MASK) | ||
7537 | #define SCT_OUTPUTDIRCTRL_SETCLR12_MASK (0x3000000U) | ||
7538 | #define SCT_OUTPUTDIRCTRL_SETCLR12_SHIFT (24U) | ||
7539 | /*! SETCLR12 - Set/clear operation on output 12. Value 0x3 is reserved. Do not program this value. | ||
7540 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7541 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7542 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7543 | */ | ||
7544 | #define SCT_OUTPUTDIRCTRL_SETCLR12(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR12_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR12_MASK) | ||
7545 | #define SCT_OUTPUTDIRCTRL_SETCLR13_MASK (0xC000000U) | ||
7546 | #define SCT_OUTPUTDIRCTRL_SETCLR13_SHIFT (26U) | ||
7547 | /*! SETCLR13 - Set/clear operation on output 13. Value 0x3 is reserved. Do not program this value. | ||
7548 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7549 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7550 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7551 | */ | ||
7552 | #define SCT_OUTPUTDIRCTRL_SETCLR13(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR13_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR13_MASK) | ||
7553 | #define SCT_OUTPUTDIRCTRL_SETCLR14_MASK (0x30000000U) | ||
7554 | #define SCT_OUTPUTDIRCTRL_SETCLR14_SHIFT (28U) | ||
7555 | /*! SETCLR14 - Set/clear operation on output 14. Value 0x3 is reserved. Do not program this value. | ||
7556 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7557 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7558 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7559 | */ | ||
7560 | #define SCT_OUTPUTDIRCTRL_SETCLR14(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR14_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR14_MASK) | ||
7561 | #define SCT_OUTPUTDIRCTRL_SETCLR15_MASK (0xC0000000U) | ||
7562 | #define SCT_OUTPUTDIRCTRL_SETCLR15_SHIFT (30U) | ||
7563 | /*! SETCLR15 - Set/clear operation on output 15. Value 0x3 is reserved. Do not program this value. | ||
7564 | * 0b00..Set and clear do not depend on the direction of any counter. | ||
7565 | * 0b01..Set and clear are reversed when counter L or the unified counter is counting down. | ||
7566 | * 0b10..Set and clear are reversed when counter H is counting down. Do not use if UNIFY = 1. | ||
7567 | */ | ||
7568 | #define SCT_OUTPUTDIRCTRL_SETCLR15(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUTPUTDIRCTRL_SETCLR15_SHIFT)) & SCT_OUTPUTDIRCTRL_SETCLR15_MASK) | ||
7569 | /*! @} */ | ||
7570 | |||
7571 | /*! @name RES - SCT conflict resolution register */ | ||
7572 | /*! @{ */ | ||
7573 | #define SCT_RES_O0RES_MASK (0x3U) | ||
7574 | #define SCT_RES_O0RES_SHIFT (0U) | ||
7575 | /*! O0RES - Effect of simultaneous set and clear on output 0. | ||
7576 | * 0b00..No change. | ||
7577 | * 0b01..Set output (or clear based on the SETCLR0 field in the OUTPUTDIRCTRL register). | ||
7578 | * 0b10..Clear output (or set based on the SETCLR0 field). | ||
7579 | * 0b11..Toggle output. | ||
7580 | */ | ||
7581 | #define SCT_RES_O0RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O0RES_SHIFT)) & SCT_RES_O0RES_MASK) | ||
7582 | #define SCT_RES_O1RES_MASK (0xCU) | ||
7583 | #define SCT_RES_O1RES_SHIFT (2U) | ||
7584 | /*! O1RES - Effect of simultaneous set and clear on output 1. | ||
7585 | * 0b00..No change. | ||
7586 | * 0b01..Set output (or clear based on the SETCLR1 field in the OUTPUTDIRCTRL register). | ||
7587 | * 0b10..Clear output (or set based on the SETCLR1 field). | ||
7588 | * 0b11..Toggle output. | ||
7589 | */ | ||
7590 | #define SCT_RES_O1RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O1RES_SHIFT)) & SCT_RES_O1RES_MASK) | ||
7591 | #define SCT_RES_O2RES_MASK (0x30U) | ||
7592 | #define SCT_RES_O2RES_SHIFT (4U) | ||
7593 | /*! O2RES - Effect of simultaneous set and clear on output 2. | ||
7594 | * 0b00..No change. | ||
7595 | * 0b01..Set output (or clear based on the SETCLR2 field in the OUTPUTDIRCTRL register). | ||
7596 | * 0b10..Clear output n (or set based on the SETCLR2 field). | ||
7597 | * 0b11..Toggle output. | ||
7598 | */ | ||
7599 | #define SCT_RES_O2RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O2RES_SHIFT)) & SCT_RES_O2RES_MASK) | ||
7600 | #define SCT_RES_O3RES_MASK (0xC0U) | ||
7601 | #define SCT_RES_O3RES_SHIFT (6U) | ||
7602 | /*! O3RES - Effect of simultaneous set and clear on output 3. | ||
7603 | * 0b00..No change. | ||
7604 | * 0b01..Set output (or clear based on the SETCLR3 field in the OUTPUTDIRCTRL register). | ||
7605 | * 0b10..Clear output (or set based on the SETCLR3 field). | ||
7606 | * 0b11..Toggle output. | ||
7607 | */ | ||
7608 | #define SCT_RES_O3RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O3RES_SHIFT)) & SCT_RES_O3RES_MASK) | ||
7609 | #define SCT_RES_O4RES_MASK (0x300U) | ||
7610 | #define SCT_RES_O4RES_SHIFT (8U) | ||
7611 | /*! O4RES - Effect of simultaneous set and clear on output 4. | ||
7612 | * 0b00..No change. | ||
7613 | * 0b01..Set output (or clear based on the SETCLR4 field in the OUTPUTDIRCTRL register). | ||
7614 | * 0b10..Clear output (or set based on the SETCLR4 field). | ||
7615 | * 0b11..Toggle output. | ||
7616 | */ | ||
7617 | #define SCT_RES_O4RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O4RES_SHIFT)) & SCT_RES_O4RES_MASK) | ||
7618 | #define SCT_RES_O5RES_MASK (0xC00U) | ||
7619 | #define SCT_RES_O5RES_SHIFT (10U) | ||
7620 | /*! O5RES - Effect of simultaneous set and clear on output 5. | ||
7621 | * 0b00..No change. | ||
7622 | * 0b01..Set output (or clear based on the SETCLR5 field in the OUTPUTDIRCTRL register). | ||
7623 | * 0b10..Clear output (or set based on the SETCLR5 field). | ||
7624 | * 0b11..Toggle output. | ||
7625 | */ | ||
7626 | #define SCT_RES_O5RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O5RES_SHIFT)) & SCT_RES_O5RES_MASK) | ||
7627 | #define SCT_RES_O6RES_MASK (0x3000U) | ||
7628 | #define SCT_RES_O6RES_SHIFT (12U) | ||
7629 | /*! O6RES - Effect of simultaneous set and clear on output 6. | ||
7630 | * 0b00..No change. | ||
7631 | * 0b01..Set output (or clear based on the SETCLR6 field in the OUTPUTDIRCTRL register). | ||
7632 | * 0b10..Clear output (or set based on the SETCLR6 field). | ||
7633 | * 0b11..Toggle output. | ||
7634 | */ | ||
7635 | #define SCT_RES_O6RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O6RES_SHIFT)) & SCT_RES_O6RES_MASK) | ||
7636 | #define SCT_RES_O7RES_MASK (0xC000U) | ||
7637 | #define SCT_RES_O7RES_SHIFT (14U) | ||
7638 | /*! O7RES - Effect of simultaneous set and clear on output 7. | ||
7639 | * 0b00..No change. | ||
7640 | * 0b01..Set output (or clear based on the SETCLR7 field in the OUTPUTDIRCTRL register). | ||
7641 | * 0b10..Clear output n (or set based on the SETCLR7 field). | ||
7642 | * 0b11..Toggle output. | ||
7643 | */ | ||
7644 | #define SCT_RES_O7RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O7RES_SHIFT)) & SCT_RES_O7RES_MASK) | ||
7645 | #define SCT_RES_O8RES_MASK (0x30000U) | ||
7646 | #define SCT_RES_O8RES_SHIFT (16U) | ||
7647 | /*! O8RES - Effect of simultaneous set and clear on output 8. | ||
7648 | * 0b00..No change. | ||
7649 | * 0b01..Set output (or clear based on the SETCLR8 field in the OUTPUTDIRCTRL register). | ||
7650 | * 0b10..Clear output (or set based on the SETCLR8 field). | ||
7651 | * 0b11..Toggle output. | ||
7652 | */ | ||
7653 | #define SCT_RES_O8RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O8RES_SHIFT)) & SCT_RES_O8RES_MASK) | ||
7654 | #define SCT_RES_O9RES_MASK (0xC0000U) | ||
7655 | #define SCT_RES_O9RES_SHIFT (18U) | ||
7656 | /*! O9RES - Effect of simultaneous set and clear on output 9. | ||
7657 | * 0b00..No change. | ||
7658 | * 0b01..Set output (or clear based on the SETCLR9 field in the OUTPUTDIRCTRL register). | ||
7659 | * 0b10..Clear output (or set based on the SETCLR9 field). | ||
7660 | * 0b11..Toggle output. | ||
7661 | */ | ||
7662 | #define SCT_RES_O9RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O9RES_SHIFT)) & SCT_RES_O9RES_MASK) | ||
7663 | #define SCT_RES_O10RES_MASK (0x300000U) | ||
7664 | #define SCT_RES_O10RES_SHIFT (20U) | ||
7665 | /*! O10RES - Effect of simultaneous set and clear on output 10. | ||
7666 | * 0b00..No change. | ||
7667 | * 0b01..Set output (or clear based on the SETCLR10 field in the OUTPUTDIRCTRL register). | ||
7668 | * 0b10..Clear output (or set based on the SETCLR10 field). | ||
7669 | * 0b11..Toggle output. | ||
7670 | */ | ||
7671 | #define SCT_RES_O10RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O10RES_SHIFT)) & SCT_RES_O10RES_MASK) | ||
7672 | #define SCT_RES_O11RES_MASK (0xC00000U) | ||
7673 | #define SCT_RES_O11RES_SHIFT (22U) | ||
7674 | /*! O11RES - Effect of simultaneous set and clear on output 11. | ||
7675 | * 0b00..No change. | ||
7676 | * 0b01..Set output (or clear based on the SETCLR11 field in the OUTPUTDIRCTRL register). | ||
7677 | * 0b10..Clear output (or set based on the SETCLR11 field). | ||
7678 | * 0b11..Toggle output. | ||
7679 | */ | ||
7680 | #define SCT_RES_O11RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O11RES_SHIFT)) & SCT_RES_O11RES_MASK) | ||
7681 | #define SCT_RES_O12RES_MASK (0x3000000U) | ||
7682 | #define SCT_RES_O12RES_SHIFT (24U) | ||
7683 | /*! O12RES - Effect of simultaneous set and clear on output 12. | ||
7684 | * 0b00..No change. | ||
7685 | * 0b01..Set output (or clear based on the SETCLR12 field in the OUTPUTDIRCTRL register). | ||
7686 | * 0b10..Clear output (or set based on the SETCLR12 field). | ||
7687 | * 0b11..Toggle output. | ||
7688 | */ | ||
7689 | #define SCT_RES_O12RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O12RES_SHIFT)) & SCT_RES_O12RES_MASK) | ||
7690 | #define SCT_RES_O13RES_MASK (0xC000000U) | ||
7691 | #define SCT_RES_O13RES_SHIFT (26U) | ||
7692 | /*! O13RES - Effect of simultaneous set and clear on output 13. | ||
7693 | * 0b00..No change. | ||
7694 | * 0b01..Set output (or clear based on the SETCLR13 field in the OUTPUTDIRCTRL register). | ||
7695 | * 0b10..Clear output (or set based on the SETCLR13 field). | ||
7696 | * 0b11..Toggle output. | ||
7697 | */ | ||
7698 | #define SCT_RES_O13RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O13RES_SHIFT)) & SCT_RES_O13RES_MASK) | ||
7699 | #define SCT_RES_O14RES_MASK (0x30000000U) | ||
7700 | #define SCT_RES_O14RES_SHIFT (28U) | ||
7701 | /*! O14RES - Effect of simultaneous set and clear on output 14. | ||
7702 | * 0b00..No change. | ||
7703 | * 0b01..Set output (or clear based on the SETCLR14 field in the OUTPUTDIRCTRL register). | ||
7704 | * 0b10..Clear output (or set based on the SETCLR14 field). | ||
7705 | * 0b11..Toggle output. | ||
7706 | */ | ||
7707 | #define SCT_RES_O14RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O14RES_SHIFT)) & SCT_RES_O14RES_MASK) | ||
7708 | #define SCT_RES_O15RES_MASK (0xC0000000U) | ||
7709 | #define SCT_RES_O15RES_SHIFT (30U) | ||
7710 | /*! O15RES - Effect of simultaneous set and clear on output 15. | ||
7711 | * 0b00..No change. | ||
7712 | * 0b01..Set output (or clear based on the SETCLR15 field in the OUTPUTDIRCTRL register). | ||
7713 | * 0b10..Clear output (or set based on the SETCLR15 field). | ||
7714 | * 0b11..Toggle output. | ||
7715 | */ | ||
7716 | #define SCT_RES_O15RES(x) (((uint32_t)(((uint32_t)(x)) << SCT_RES_O15RES_SHIFT)) & SCT_RES_O15RES_MASK) | ||
7717 | /*! @} */ | ||
7718 | |||
7719 | /*! @name DMAREQ0 - SCT DMA request 0 register */ | ||
7720 | /*! @{ */ | ||
7721 | #define SCT_DMAREQ0_DEV_0_MASK (0xFFFFU) | ||
7722 | #define SCT_DMAREQ0_DEV_0_SHIFT (0U) | ||
7723 | /*! DEV_0 - If bit n is one, event n triggers DMA request 0 (event 0 = bit 0, event 1 = bit 1, | ||
7724 | * etc.). The number of bits = number of events in this SCT. | ||
7725 | */ | ||
7726 | #define SCT_DMAREQ0_DEV_0(x) (((uint32_t)(((uint32_t)(x)) << SCT_DMAREQ0_DEV_0_SHIFT)) & SCT_DMAREQ0_DEV_0_MASK) | ||
7727 | #define SCT_DMAREQ0_DRL0_MASK (0x40000000U) | ||
7728 | #define SCT_DMAREQ0_DRL0_SHIFT (30U) | ||
7729 | /*! DRL0 - A 1 in this bit triggers DMA request 0 when it loads the MATCH_L/Unified registers from the RELOAD_L/Unified registers. | ||
7730 | */ | ||
7731 | #define SCT_DMAREQ0_DRL0(x) (((uint32_t)(((uint32_t)(x)) << SCT_DMAREQ0_DRL0_SHIFT)) & SCT_DMAREQ0_DRL0_MASK) | ||
7732 | #define SCT_DMAREQ0_DRQ0_MASK (0x80000000U) | ||
7733 | #define SCT_DMAREQ0_DRQ0_SHIFT (31U) | ||
7734 | /*! DRQ0 - This read-only bit indicates the state of DMA Request 0. Note that if the related DMA | ||
7735 | * channel is enabled and properly set up, it is unlikely that software will see this flag, it will | ||
7736 | * be cleared rapidly by the DMA service. The flag remaining set could point to an issue with DMA | ||
7737 | * setup. | ||
7738 | */ | ||
7739 | #define SCT_DMAREQ0_DRQ0(x) (((uint32_t)(((uint32_t)(x)) << SCT_DMAREQ0_DRQ0_SHIFT)) & SCT_DMAREQ0_DRQ0_MASK) | ||
7740 | /*! @} */ | ||
7741 | |||
7742 | /*! @name DMAREQ1 - SCT DMA request 1 register */ | ||
7743 | /*! @{ */ | ||
7744 | #define SCT_DMAREQ1_DEV_1_MASK (0xFFFFU) | ||
7745 | #define SCT_DMAREQ1_DEV_1_SHIFT (0U) | ||
7746 | /*! DEV_1 - If bit n is one, event n triggers DMA request 1 (event 0 = bit 0, event 1 = bit 1, | ||
7747 | * etc.). The number of bits = number of events in this SCT. | ||
7748 | */ | ||
7749 | #define SCT_DMAREQ1_DEV_1(x) (((uint32_t)(((uint32_t)(x)) << SCT_DMAREQ1_DEV_1_SHIFT)) & SCT_DMAREQ1_DEV_1_MASK) | ||
7750 | #define SCT_DMAREQ1_DRL1_MASK (0x40000000U) | ||
7751 | #define SCT_DMAREQ1_DRL1_SHIFT (30U) | ||
7752 | /*! DRL1 - A 1 in this bit triggers DMA request 1 when it loads the Match L/Unified registers from the Reload L/Unified registers. | ||
7753 | */ | ||
7754 | #define SCT_DMAREQ1_DRL1(x) (((uint32_t)(((uint32_t)(x)) << SCT_DMAREQ1_DRL1_SHIFT)) & SCT_DMAREQ1_DRL1_MASK) | ||
7755 | #define SCT_DMAREQ1_DRQ1_MASK (0x80000000U) | ||
7756 | #define SCT_DMAREQ1_DRQ1_SHIFT (31U) | ||
7757 | /*! DRQ1 - This read-only bit indicates the state of DMA Request 1. Note that if the related DMA | ||
7758 | * channel is enabled and properly set up, it is unlikely that software will see this flag, it will | ||
7759 | * be cleared rapidly by the DMA service. The flag remaining set could point to an issue with DMA | ||
7760 | * setup. | ||
7761 | */ | ||
7762 | #define SCT_DMAREQ1_DRQ1(x) (((uint32_t)(((uint32_t)(x)) << SCT_DMAREQ1_DRQ1_SHIFT)) & SCT_DMAREQ1_DRQ1_MASK) | ||
7763 | /*! @} */ | ||
7764 | |||
7765 | /*! @name EVEN - SCT event interrupt enable register */ | ||
7766 | /*! @{ */ | ||
7767 | #define SCT_EVEN_IEN_MASK (0xFFFFU) | ||
7768 | #define SCT_EVEN_IEN_SHIFT (0U) | ||
7769 | /*! IEN - The SCT requests an interrupt when bit n of this register and the event flag register are | ||
7770 | * both one (event 0 = bit 0, event 1 = bit 1, etc.). The number of bits = number of events in | ||
7771 | * this SCT. | ||
7772 | */ | ||
7773 | #define SCT_EVEN_IEN(x) (((uint32_t)(((uint32_t)(x)) << SCT_EVEN_IEN_SHIFT)) & SCT_EVEN_IEN_MASK) | ||
7774 | /*! @} */ | ||
7775 | |||
7776 | /*! @name EVFLAG - SCT event flag register */ | ||
7777 | /*! @{ */ | ||
7778 | #define SCT_EVFLAG_FLAG_MASK (0xFFFFU) | ||
7779 | #define SCT_EVFLAG_FLAG_SHIFT (0U) | ||
7780 | /*! FLAG - Bit n is one if event n has occurred since reset or a 1 was last written to this bit | ||
7781 | * (event 0 = bit 0, event 1 = bit 1, etc.). The number of bits = number of events in this SCT. | ||
7782 | */ | ||
7783 | #define SCT_EVFLAG_FLAG(x) (((uint32_t)(((uint32_t)(x)) << SCT_EVFLAG_FLAG_SHIFT)) & SCT_EVFLAG_FLAG_MASK) | ||
7784 | /*! @} */ | ||
7785 | |||
7786 | /*! @name CONEN - SCT conflict interrupt enable register */ | ||
7787 | /*! @{ */ | ||
7788 | #define SCT_CONEN_NCEN_MASK (0xFFFFU) | ||
7789 | #define SCT_CONEN_NCEN_SHIFT (0U) | ||
7790 | /*! NCEN - The SCT requests an interrupt when bit n of this register and the SCT conflict flag | ||
7791 | * register are both one (output 0 = bit 0, output 1 = bit 1, etc.). The number of bits = number of | ||
7792 | * outputs in this SCT. | ||
7793 | */ | ||
7794 | #define SCT_CONEN_NCEN(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONEN_NCEN_SHIFT)) & SCT_CONEN_NCEN_MASK) | ||
7795 | /*! @} */ | ||
7796 | |||
7797 | /*! @name CONFLAG - SCT conflict flag register */ | ||
7798 | /*! @{ */ | ||
7799 | #define SCT_CONFLAG_NCFLAG_MASK (0xFFFFU) | ||
7800 | #define SCT_CONFLAG_NCFLAG_SHIFT (0U) | ||
7801 | /*! NCFLAG - Bit n is one if a no-change conflict event occurred on output n since reset or a 1 was | ||
7802 | * last written to this bit (output 0 = bit 0, output 1 = bit 1, etc.). The number of bits = | ||
7803 | * number of outputs in this SCT. | ||
7804 | */ | ||
7805 | #define SCT_CONFLAG_NCFLAG(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFLAG_NCFLAG_SHIFT)) & SCT_CONFLAG_NCFLAG_MASK) | ||
7806 | #define SCT_CONFLAG_BUSERRL_MASK (0x40000000U) | ||
7807 | #define SCT_CONFLAG_BUSERRL_SHIFT (30U) | ||
7808 | /*! BUSERRL - The most recent bus error from this SCT involved writing CTR L/Unified, STATE | ||
7809 | * L/Unified, MATCH L/Unified, or the Output register when the L/U counter was not halted. A word write | ||
7810 | * to certain L and H registers can be half successful and half unsuccessful. | ||
7811 | */ | ||
7812 | #define SCT_CONFLAG_BUSERRL(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFLAG_BUSERRL_SHIFT)) & SCT_CONFLAG_BUSERRL_MASK) | ||
7813 | #define SCT_CONFLAG_BUSERRH_MASK (0x80000000U) | ||
7814 | #define SCT_CONFLAG_BUSERRH_SHIFT (31U) | ||
7815 | /*! BUSERRH - The most recent bus error from this SCT involved writing CTR H, STATE H, MATCH H, or | ||
7816 | * the Output register when the H counter was not halted. | ||
7817 | */ | ||
7818 | #define SCT_CONFLAG_BUSERRH(x) (((uint32_t)(((uint32_t)(x)) << SCT_CONFLAG_BUSERRH_SHIFT)) & SCT_CONFLAG_BUSERRH_MASK) | ||
7819 | /*! @} */ | ||
7820 | |||
7821 | /*! @name CAPL - SCT_CAPL register */ | ||
7822 | /*! @{ */ | ||
7823 | #define SCT_CAPL_CAPL_MASK (0xFFFFU) | ||
7824 | #define SCT_CAPL_CAPL_SHIFT (0U) | ||
7825 | #define SCT_CAPL_CAPL(x) (((uint16_t)(((uint16_t)(x)) << SCT_CAPL_CAPL_SHIFT)) & SCT_CAPL_CAPL_MASK) | ||
7826 | /*! @} */ | ||
7827 | |||
7828 | /* The count of SCT_CAPL */ | ||
7829 | #define SCT_CAPL_COUNT (16U) | ||
7830 | |||
7831 | /*! @name CAPH - SCT_CAPH register */ | ||
7832 | /*! @{ */ | ||
7833 | #define SCT_CAPH_CAPH_MASK (0xFFFFU) | ||
7834 | #define SCT_CAPH_CAPH_SHIFT (0U) | ||
7835 | #define SCT_CAPH_CAPH(x) (((uint16_t)(((uint16_t)(x)) << SCT_CAPH_CAPH_SHIFT)) & SCT_CAPH_CAPH_MASK) | ||
7836 | /*! @} */ | ||
7837 | |||
7838 | /* The count of SCT_CAPH */ | ||
7839 | #define SCT_CAPH_COUNT (16U) | ||
7840 | |||
7841 | /*! @name CAP - SCT capture register of capture channel */ | ||
7842 | /*! @{ */ | ||
7843 | #define SCT_CAP_CAPn_L_MASK (0xFFFFU) | ||
7844 | #define SCT_CAP_CAPn_L_SHIFT (0U) | ||
7845 | /*! CAPn_L - When UNIFY = 0, read the 16-bit counter value at which this register was last captured. | ||
7846 | * When UNIFY = 1, read the lower 16 bits of the 32-bit value at which this register was last | ||
7847 | * captured. | ||
7848 | */ | ||
7849 | #define SCT_CAP_CAPn_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CAP_CAPn_L_SHIFT)) & SCT_CAP_CAPn_L_MASK) | ||
7850 | #define SCT_CAP_CAPn_H_MASK (0xFFFF0000U) | ||
7851 | #define SCT_CAP_CAPn_H_SHIFT (16U) | ||
7852 | /*! CAPn_H - When UNIFY = 0, read the 16-bit counter value at which this register was last captured. | ||
7853 | * When UNIFY = 1, read the upper 16 bits of the 32-bit value at which this register was last | ||
7854 | * captured. | ||
7855 | */ | ||
7856 | #define SCT_CAP_CAPn_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CAP_CAPn_H_SHIFT)) & SCT_CAP_CAPn_H_MASK) | ||
7857 | /*! @} */ | ||
7858 | |||
7859 | /* The count of SCT_CAP */ | ||
7860 | #define SCT_CAP_COUNT (16U) | ||
7861 | |||
7862 | /*! @name MATCHL - SCT_MATCHL register */ | ||
7863 | /*! @{ */ | ||
7864 | #define SCT_MATCHL_MATCHL_MASK (0xFFFFU) | ||
7865 | #define SCT_MATCHL_MATCHL_SHIFT (0U) | ||
7866 | #define SCT_MATCHL_MATCHL(x) (((uint16_t)(((uint16_t)(x)) << SCT_MATCHL_MATCHL_SHIFT)) & SCT_MATCHL_MATCHL_MASK) | ||
7867 | /*! @} */ | ||
7868 | |||
7869 | /* The count of SCT_MATCHL */ | ||
7870 | #define SCT_MATCHL_COUNT (16U) | ||
7871 | |||
7872 | /*! @name MATCHH - SCT_MATCHH register */ | ||
7873 | /*! @{ */ | ||
7874 | #define SCT_MATCHH_MATCHH_MASK (0xFFFFU) | ||
7875 | #define SCT_MATCHH_MATCHH_SHIFT (0U) | ||
7876 | #define SCT_MATCHH_MATCHH(x) (((uint16_t)(((uint16_t)(x)) << SCT_MATCHH_MATCHH_SHIFT)) & SCT_MATCHH_MATCHH_MASK) | ||
7877 | /*! @} */ | ||
7878 | |||
7879 | /* The count of SCT_MATCHH */ | ||
7880 | #define SCT_MATCHH_COUNT (16U) | ||
7881 | |||
7882 | /*! @name MATCH - SCT match value register of match channels */ | ||
7883 | /*! @{ */ | ||
7884 | #define SCT_MATCH_MATCHn_L_MASK (0xFFFFU) | ||
7885 | #define SCT_MATCH_MATCHn_L_SHIFT (0U) | ||
7886 | /*! MATCHn_L - When UNIFY = 0, read or write the 16-bit value to be compared to the L counter. When | ||
7887 | * UNIFY = 1, read or write the lower 16 bits of the 32-bit value to be compared to the unified | ||
7888 | * counter. | ||
7889 | */ | ||
7890 | #define SCT_MATCH_MATCHn_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_MATCH_MATCHn_L_SHIFT)) & SCT_MATCH_MATCHn_L_MASK) | ||
7891 | #define SCT_MATCH_MATCHn_H_MASK (0xFFFF0000U) | ||
7892 | #define SCT_MATCH_MATCHn_H_SHIFT (16U) | ||
7893 | /*! MATCHn_H - When UNIFY = 0, read or write the 16-bit value to be compared to the H counter. When | ||
7894 | * UNIFY = 1, read or write the upper 16 bits of the 32-bit value to be compared to the unified | ||
7895 | * counter. | ||
7896 | */ | ||
7897 | #define SCT_MATCH_MATCHn_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_MATCH_MATCHn_H_SHIFT)) & SCT_MATCH_MATCHn_H_MASK) | ||
7898 | /*! @} */ | ||
7899 | |||
7900 | /* The count of SCT_MATCH */ | ||
7901 | #define SCT_MATCH_COUNT (16U) | ||
7902 | |||
7903 | /*! @name CAPCTRLL - SCT_CAPCTRLL register */ | ||
7904 | /*! @{ */ | ||
7905 | #define SCT_CAPCTRLL_CAPCTRLL_MASK (0xFFFFU) | ||
7906 | #define SCT_CAPCTRLL_CAPCTRLL_SHIFT (0U) | ||
7907 | #define SCT_CAPCTRLL_CAPCTRLL(x) (((uint16_t)(((uint16_t)(x)) << SCT_CAPCTRLL_CAPCTRLL_SHIFT)) & SCT_CAPCTRLL_CAPCTRLL_MASK) | ||
7908 | /*! @} */ | ||
7909 | |||
7910 | /* The count of SCT_CAPCTRLL */ | ||
7911 | #define SCT_CAPCTRLL_COUNT (16U) | ||
7912 | |||
7913 | /*! @name CAPCTRLH - SCT_CAPCTRLH register */ | ||
7914 | /*! @{ */ | ||
7915 | #define SCT_CAPCTRLH_CAPCTRLH_MASK (0xFFFFU) | ||
7916 | #define SCT_CAPCTRLH_CAPCTRLH_SHIFT (0U) | ||
7917 | #define SCT_CAPCTRLH_CAPCTRLH(x) (((uint16_t)(((uint16_t)(x)) << SCT_CAPCTRLH_CAPCTRLH_SHIFT)) & SCT_CAPCTRLH_CAPCTRLH_MASK) | ||
7918 | /*! @} */ | ||
7919 | |||
7920 | /* The count of SCT_CAPCTRLH */ | ||
7921 | #define SCT_CAPCTRLH_COUNT (16U) | ||
7922 | |||
7923 | /*! @name CAPCTRL - SCT capture control register */ | ||
7924 | /*! @{ */ | ||
7925 | #define SCT_CAPCTRL_CAPCONn_L_MASK (0xFFFFU) | ||
7926 | #define SCT_CAPCTRL_CAPCONn_L_SHIFT (0U) | ||
7927 | /*! CAPCONn_L - If bit m is one, event m causes the CAPn_L (UNIFY = 0) or the CAPn (UNIFY = 1) | ||
7928 | * register to be loaded (event 0 = bit 0, event 1 = bit 1, etc.). The number of bits = number of | ||
7929 | * match/captures in this SCT. | ||
7930 | */ | ||
7931 | #define SCT_CAPCTRL_CAPCONn_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_CAPCTRL_CAPCONn_L_SHIFT)) & SCT_CAPCTRL_CAPCONn_L_MASK) | ||
7932 | #define SCT_CAPCTRL_CAPCONn_H_MASK (0xFFFF0000U) | ||
7933 | #define SCT_CAPCTRL_CAPCONn_H_SHIFT (16U) | ||
7934 | /*! CAPCONn_H - If bit m is one, event m causes the CAPn_H (UNIFY = 0) register to be loaded (event | ||
7935 | * 0 = bit 16, event 1 = bit 17, etc.). The number of bits = number of match/captures in this SCT. | ||
7936 | */ | ||
7937 | #define SCT_CAPCTRL_CAPCONn_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_CAPCTRL_CAPCONn_H_SHIFT)) & SCT_CAPCTRL_CAPCONn_H_MASK) | ||
7938 | /*! @} */ | ||
7939 | |||
7940 | /* The count of SCT_CAPCTRL */ | ||
7941 | #define SCT_CAPCTRL_COUNT (16U) | ||
7942 | |||
7943 | /*! @name MATCHRELL - SCT_MATCHRELL register */ | ||
7944 | /*! @{ */ | ||
7945 | #define SCT_MATCHRELL_MATCHRELL_MASK (0xFFFFU) | ||
7946 | #define SCT_MATCHRELL_MATCHRELL_SHIFT (0U) | ||
7947 | #define SCT_MATCHRELL_MATCHRELL(x) (((uint16_t)(((uint16_t)(x)) << SCT_MATCHRELL_MATCHRELL_SHIFT)) & SCT_MATCHRELL_MATCHRELL_MASK) | ||
7948 | /*! @} */ | ||
7949 | |||
7950 | /* The count of SCT_MATCHRELL */ | ||
7951 | #define SCT_MATCHRELL_COUNT (16U) | ||
7952 | |||
7953 | /*! @name MATCHRELH - SCT_MATCHRELH register */ | ||
7954 | /*! @{ */ | ||
7955 | #define SCT_MATCHRELH_MATCHRELH_MASK (0xFFFFU) | ||
7956 | #define SCT_MATCHRELH_MATCHRELH_SHIFT (0U) | ||
7957 | #define SCT_MATCHRELH_MATCHRELH(x) (((uint16_t)(((uint16_t)(x)) << SCT_MATCHRELH_MATCHRELH_SHIFT)) & SCT_MATCHRELH_MATCHRELH_MASK) | ||
7958 | /*! @} */ | ||
7959 | |||
7960 | /* The count of SCT_MATCHRELH */ | ||
7961 | #define SCT_MATCHRELH_COUNT (16U) | ||
7962 | |||
7963 | /*! @name MATCHREL - SCT match reload value register */ | ||
7964 | /*! @{ */ | ||
7965 | #define SCT_MATCHREL_RELOADn_L_MASK (0xFFFFU) | ||
7966 | #define SCT_MATCHREL_RELOADn_L_SHIFT (0U) | ||
7967 | /*! RELOADn_L - When UNIFY = 0, specifies the 16-bit value to be loaded into the MATCHn_L register. | ||
7968 | * When UNIFY = 1, specifies the lower 16 bits of the 32-bit value to be loaded into the MATCHn | ||
7969 | * register. | ||
7970 | */ | ||
7971 | #define SCT_MATCHREL_RELOADn_L(x) (((uint32_t)(((uint32_t)(x)) << SCT_MATCHREL_RELOADn_L_SHIFT)) & SCT_MATCHREL_RELOADn_L_MASK) | ||
7972 | #define SCT_MATCHREL_RELOADn_H_MASK (0xFFFF0000U) | ||
7973 | #define SCT_MATCHREL_RELOADn_H_SHIFT (16U) | ||
7974 | /*! RELOADn_H - When UNIFY = 0, specifies the 16-bit to be loaded into the MATCHn_H register. When | ||
7975 | * UNIFY = 1, specifies the upper 16 bits of the 32-bit value to be loaded into the MATCHn | ||
7976 | * register. | ||
7977 | */ | ||
7978 | #define SCT_MATCHREL_RELOADn_H(x) (((uint32_t)(((uint32_t)(x)) << SCT_MATCHREL_RELOADn_H_SHIFT)) & SCT_MATCHREL_RELOADn_H_MASK) | ||
7979 | /*! @} */ | ||
7980 | |||
7981 | /* The count of SCT_MATCHREL */ | ||
7982 | #define SCT_MATCHREL_COUNT (16U) | ||
7983 | |||
7984 | /*! @name EV_STATE - SCT event state register 0 */ | ||
7985 | /*! @{ */ | ||
7986 | #define SCT_EV_STATE_STATEMSKn_MASK (0xFFFFU) | ||
7987 | #define SCT_EV_STATE_STATEMSKn_SHIFT (0U) | ||
7988 | /*! STATEMSKn - If bit m is one, event n happens in state m of the counter selected by the HEVENT | ||
7989 | * bit (n = event number, m = state number; state 0 = bit 0, state 1= bit 1, etc.). The number of | ||
7990 | * bits = number of states in this SCT. | ||
7991 | */ | ||
7992 | #define SCT_EV_STATE_STATEMSKn(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_STATE_STATEMSKn_SHIFT)) & SCT_EV_STATE_STATEMSKn_MASK) | ||
7993 | /*! @} */ | ||
7994 | |||
7995 | /* The count of SCT_EV_STATE */ | ||
7996 | #define SCT_EV_STATE_COUNT (16U) | ||
7997 | |||
7998 | /*! @name EV_CTRL - SCT event control register 0 */ | ||
7999 | /*! @{ */ | ||
8000 | #define SCT_EV_CTRL_MATCHSEL_MASK (0xFU) | ||
8001 | #define SCT_EV_CTRL_MATCHSEL_SHIFT (0U) | ||
8002 | /*! MATCHSEL - Selects the Match register associated with this event (if any). A match can occur | ||
8003 | * only when the counter selected by the HEVENT bit is running. | ||
8004 | */ | ||
8005 | #define SCT_EV_CTRL_MATCHSEL(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_MATCHSEL_SHIFT)) & SCT_EV_CTRL_MATCHSEL_MASK) | ||
8006 | #define SCT_EV_CTRL_HEVENT_MASK (0x10U) | ||
8007 | #define SCT_EV_CTRL_HEVENT_SHIFT (4U) | ||
8008 | /*! HEVENT - Select L/H counter. Do not set this bit if UNIFY = 1. | ||
8009 | * 0b0..Selects the L state and the L match register selected by MATCHSEL. | ||
8010 | * 0b1..Selects the H state and the H match register selected by MATCHSEL. | ||
8011 | */ | ||
8012 | #define SCT_EV_CTRL_HEVENT(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_HEVENT_SHIFT)) & SCT_EV_CTRL_HEVENT_MASK) | ||
8013 | #define SCT_EV_CTRL_OUTSEL_MASK (0x20U) | ||
8014 | #define SCT_EV_CTRL_OUTSEL_SHIFT (5U) | ||
8015 | /*! OUTSEL - Input/output select | ||
8016 | * 0b0..Selects the inputs selected by IOSEL. | ||
8017 | * 0b1..Selects the outputs selected by IOSEL. | ||
8018 | */ | ||
8019 | #define SCT_EV_CTRL_OUTSEL(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_OUTSEL_SHIFT)) & SCT_EV_CTRL_OUTSEL_MASK) | ||
8020 | #define SCT_EV_CTRL_IOSEL_MASK (0x3C0U) | ||
8021 | #define SCT_EV_CTRL_IOSEL_SHIFT (6U) | ||
8022 | /*! IOSEL - Selects the input or output signal number associated with this event (if any). Do not | ||
8023 | * select an input in this register if CKMODE is 1x. In this case the clock input is an implicit | ||
8024 | * ingredient of every event. | ||
8025 | */ | ||
8026 | #define SCT_EV_CTRL_IOSEL(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_IOSEL_SHIFT)) & SCT_EV_CTRL_IOSEL_MASK) | ||
8027 | #define SCT_EV_CTRL_IOCOND_MASK (0xC00U) | ||
8028 | #define SCT_EV_CTRL_IOCOND_SHIFT (10U) | ||
8029 | /*! IOCOND - Selects the I/O condition for event n. (The detection of edges on outputs lag the | ||
8030 | * conditions that switch the outputs by one SCT clock). In order to guarantee proper edge/state | ||
8031 | * detection, an input must have a minimum pulse width of at least one SCT clock period . | ||
8032 | * 0b00..LOW | ||
8033 | * 0b01..Rise | ||
8034 | * 0b10..Fall | ||
8035 | * 0b11..HIGH | ||
8036 | */ | ||
8037 | #define SCT_EV_CTRL_IOCOND(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_IOCOND_SHIFT)) & SCT_EV_CTRL_IOCOND_MASK) | ||
8038 | #define SCT_EV_CTRL_COMBMODE_MASK (0x3000U) | ||
8039 | #define SCT_EV_CTRL_COMBMODE_SHIFT (12U) | ||
8040 | /*! COMBMODE - Selects how the specified match and I/O condition are used and combined. | ||
8041 | * 0b00..OR. The event occurs when either the specified match or I/O condition occurs. | ||
8042 | * 0b01..MATCH. Uses the specified match only. | ||
8043 | * 0b10..IO. Uses the specified I/O condition only. | ||
8044 | * 0b11..AND. The event occurs when the specified match and I/O condition occur simultaneously. | ||
8045 | */ | ||
8046 | #define SCT_EV_CTRL_COMBMODE(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_COMBMODE_SHIFT)) & SCT_EV_CTRL_COMBMODE_MASK) | ||
8047 | #define SCT_EV_CTRL_STATELD_MASK (0x4000U) | ||
8048 | #define SCT_EV_CTRL_STATELD_SHIFT (14U) | ||
8049 | /*! STATELD - This bit controls how the STATEV value modifies the state selected by HEVENT when this | ||
8050 | * event is the highest-numbered event occurring for that state. | ||
8051 | * 0b0..STATEV value is added into STATE (the carry-out is ignored). | ||
8052 | * 0b1..STATEV value is loaded into STATE. | ||
8053 | */ | ||
8054 | #define SCT_EV_CTRL_STATELD(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_STATELD_SHIFT)) & SCT_EV_CTRL_STATELD_MASK) | ||
8055 | #define SCT_EV_CTRL_STATEV_MASK (0xF8000U) | ||
8056 | #define SCT_EV_CTRL_STATEV_SHIFT (15U) | ||
8057 | /*! STATEV - This value is loaded into or added to the state selected by HEVENT, depending on | ||
8058 | * STATELD, when this event is the highest-numbered event occurring for that state. If STATELD and | ||
8059 | * STATEV are both zero, there is no change to the STATE value. | ||
8060 | */ | ||
8061 | #define SCT_EV_CTRL_STATEV(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_STATEV_SHIFT)) & SCT_EV_CTRL_STATEV_MASK) | ||
8062 | #define SCT_EV_CTRL_MATCHMEM_MASK (0x100000U) | ||
8063 | #define SCT_EV_CTRL_MATCHMEM_SHIFT (20U) | ||
8064 | /*! MATCHMEM - If this bit is one and the COMBMODE field specifies a match component to the | ||
8065 | * triggering of this event, then a match is considered to be active whenever the counter value is | ||
8066 | * GREATER THAN OR EQUAL TO the value specified in the match register when counting up, LESS THEN OR | ||
8067 | * EQUAL TO the match value when counting down. If this bit is zero, a match is only be active | ||
8068 | * during the cycle when the counter is equal to the match value. | ||
8069 | */ | ||
8070 | #define SCT_EV_CTRL_MATCHMEM(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_MATCHMEM_SHIFT)) & SCT_EV_CTRL_MATCHMEM_MASK) | ||
8071 | #define SCT_EV_CTRL_DIRECTION_MASK (0x600000U) | ||
8072 | #define SCT_EV_CTRL_DIRECTION_SHIFT (21U) | ||
8073 | /*! DIRECTION - Direction qualifier for event generation. This field only applies when the counters | ||
8074 | * are operating in BIDIR mode. If BIDIR = 0, the SCT ignores this field. Value 0x3 is reserved. | ||
8075 | * 0b00..Direction independent. This event is triggered regardless of the count direction. | ||
8076 | * 0b01..Counting up. This event is triggered only during up-counting when BIDIR = 1. | ||
8077 | * 0b10..Counting down. This event is triggered only during down-counting when BIDIR = 1. | ||
8078 | */ | ||
8079 | #define SCT_EV_CTRL_DIRECTION(x) (((uint32_t)(((uint32_t)(x)) << SCT_EV_CTRL_DIRECTION_SHIFT)) & SCT_EV_CTRL_DIRECTION_MASK) | ||
8080 | /*! @} */ | ||
8081 | |||
8082 | /* The count of SCT_EV_CTRL */ | ||
8083 | #define SCT_EV_CTRL_COUNT (16U) | ||
8084 | |||
8085 | /*! @name OUT_SET - SCT output 0 set register */ | ||
8086 | /*! @{ */ | ||
8087 | #define SCT_OUT_SET_SET_MASK (0xFFFFU) | ||
8088 | #define SCT_OUT_SET_SET_SHIFT (0U) | ||
8089 | /*! SET - A 1 in bit m selects event m to set output n (or clear it if SETCLRn = 0x1 or 0x2) output | ||
8090 | * 0 = bit 0, output 1 = bit 1, etc. The number of bits = number of events in this SCT. When the | ||
8091 | * counter is used in bi-directional mode, it is possible to reverse the action specified by the | ||
8092 | * output set and clear registers when counting down, See the OUTPUTCTRL register. | ||
8093 | */ | ||
8094 | #define SCT_OUT_SET_SET(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUT_SET_SET_SHIFT)) & SCT_OUT_SET_SET_MASK) | ||
8095 | /*! @} */ | ||
8096 | |||
8097 | /* The count of SCT_OUT_SET */ | ||
8098 | #define SCT_OUT_SET_COUNT (10U) | ||
8099 | |||
8100 | /*! @name OUT_CLR - SCT output 0 clear register */ | ||
8101 | /*! @{ */ | ||
8102 | #define SCT_OUT_CLR_CLR_MASK (0xFFFFU) | ||
8103 | #define SCT_OUT_CLR_CLR_SHIFT (0U) | ||
8104 | /*! CLR - A 1 in bit m selects event m to clear output n (or set it if SETCLRn = 0x1 or 0x2) event 0 | ||
8105 | * = bit 0, event 1 = bit 1, etc. The number of bits = number of events in this SCT. When the | ||
8106 | * counter is used in bi-directional mode, it is possible to reverse the action specified by the | ||
8107 | * output set and clear registers when counting down, See the OUTPUTCTRL register. | ||
8108 | */ | ||
8109 | #define SCT_OUT_CLR_CLR(x) (((uint32_t)(((uint32_t)(x)) << SCT_OUT_CLR_CLR_SHIFT)) & SCT_OUT_CLR_CLR_MASK) | ||
8110 | /*! @} */ | ||
8111 | |||
8112 | /* The count of SCT_OUT_CLR */ | ||
8113 | #define SCT_OUT_CLR_COUNT (10U) | ||
8114 | |||
8115 | |||
8116 | /*! | ||
8117 | * @} | ||
8118 | */ /* end of group SCT_Register_Masks */ | ||
8119 | |||
8120 | |||
8121 | /* SCT - Peripheral instance base addresses */ | ||
8122 | /** Peripheral SCT0 base address */ | ||
8123 | #define SCT0_BASE (0x40085000u) | ||
8124 | /** Peripheral SCT0 base pointer */ | ||
8125 | #define SCT0 ((SCT_Type *)SCT0_BASE) | ||
8126 | /** Array initializer of SCT peripheral base addresses */ | ||
8127 | #define SCT_BASE_ADDRS { SCT0_BASE } | ||
8128 | /** Array initializer of SCT peripheral base pointers */ | ||
8129 | #define SCT_BASE_PTRS { SCT0 } | ||
8130 | /** Interrupt vectors for the SCT peripheral type */ | ||
8131 | #define SCT_IRQS { SCT0_IRQn } | ||
8132 | |||
8133 | /*! | ||
8134 | * @} | ||
8135 | */ /* end of group SCT_Peripheral_Access_Layer */ | ||
8136 | |||
8137 | |||
8138 | /* ---------------------------------------------------------------------------- | ||
8139 | -- SDIF Peripheral Access Layer | ||
8140 | ---------------------------------------------------------------------------- */ | ||
8141 | |||
8142 | /*! | ||
8143 | * @addtogroup SDIF_Peripheral_Access_Layer SDIF Peripheral Access Layer | ||
8144 | * @{ | ||
8145 | */ | ||
8146 | |||
8147 | /** SDIF - Register Layout Typedef */ | ||
8148 | typedef struct { | ||
8149 | __IO uint32_t CTRL; /**< Control register, offset: 0x0 */ | ||
8150 | __IO uint32_t PWREN; /**< Power Enable register, offset: 0x4 */ | ||
8151 | __IO uint32_t CLKDIV; /**< Clock Divider register, offset: 0x8 */ | ||
8152 | uint8_t RESERVED_0[4]; | ||
8153 | __IO uint32_t CLKENA; /**< Clock Enable register, offset: 0x10 */ | ||
8154 | __IO uint32_t TMOUT; /**< Time-out register, offset: 0x14 */ | ||
8155 | __IO uint32_t CTYPE; /**< Card Type register, offset: 0x18 */ | ||
8156 | __IO uint32_t BLKSIZ; /**< Block Size register, offset: 0x1C */ | ||
8157 | __IO uint32_t BYTCNT; /**< Byte Count register, offset: 0x20 */ | ||
8158 | __IO uint32_t INTMASK; /**< Interrupt Mask register, offset: 0x24 */ | ||
8159 | __IO uint32_t CMDARG; /**< Command Argument register, offset: 0x28 */ | ||
8160 | __IO uint32_t CMD; /**< Command register, offset: 0x2C */ | ||
8161 | __I uint32_t RESP[4]; /**< Response register, array offset: 0x30, array step: 0x4 */ | ||
8162 | __I uint32_t MINTSTS; /**< Masked Interrupt Status register, offset: 0x40 */ | ||
8163 | __IO uint32_t RINTSTS; /**< Raw Interrupt Status register, offset: 0x44 */ | ||
8164 | __I uint32_t STATUS; /**< Status register, offset: 0x48 */ | ||
8165 | __IO uint32_t FIFOTH; /**< FIFO Threshold Watermark register, offset: 0x4C */ | ||
8166 | __I uint32_t CDETECT; /**< Card Detect register, offset: 0x50 */ | ||
8167 | __I uint32_t WRTPRT; /**< Write Protect register, offset: 0x54 */ | ||
8168 | uint8_t RESERVED_1[4]; | ||
8169 | __I uint32_t TCBCNT; /**< Transferred CIU Card Byte Count register, offset: 0x5C */ | ||
8170 | __I uint32_t TBBCNT; /**< Transferred Host to BIU-FIFO Byte Count register, offset: 0x60 */ | ||
8171 | __IO uint32_t DEBNCE; /**< Debounce Count register, offset: 0x64 */ | ||
8172 | uint8_t RESERVED_2[16]; | ||
8173 | __IO uint32_t RST_N; /**< Hardware Reset, offset: 0x78 */ | ||
8174 | uint8_t RESERVED_3[4]; | ||
8175 | __IO uint32_t BMOD; /**< Bus Mode register, offset: 0x80 */ | ||
8176 | __O uint32_t PLDMND; /**< Poll Demand register, offset: 0x84 */ | ||
8177 | __IO uint32_t DBADDR; /**< Descriptor List Base Address register, offset: 0x88 */ | ||
8178 | __IO uint32_t IDSTS; /**< Internal DMAC Status register, offset: 0x8C */ | ||
8179 | __IO uint32_t IDINTEN; /**< Internal DMAC Interrupt Enable register, offset: 0x90 */ | ||
8180 | __I uint32_t DSCADDR; /**< Current Host Descriptor Address register, offset: 0x94 */ | ||
8181 | __I uint32_t BUFADDR; /**< Current Buffer Descriptor Address register, offset: 0x98 */ | ||
8182 | uint8_t RESERVED_4[100]; | ||
8183 | __IO uint32_t CARDTHRCTL; /**< Card Threshold Control, offset: 0x100 */ | ||
8184 | __IO uint32_t BACKENDPWR; /**< Power control, offset: 0x104 */ | ||
8185 | uint8_t RESERVED_5[248]; | ||
8186 | __IO uint32_t FIFO[64]; /**< SDIF FIFO, array offset: 0x200, array step: 0x4 */ | ||
8187 | } SDIF_Type; | ||
8188 | |||
8189 | /* ---------------------------------------------------------------------------- | ||
8190 | -- SDIF Register Masks | ||
8191 | ---------------------------------------------------------------------------- */ | ||
8192 | |||
8193 | /*! | ||
8194 | * @addtogroup SDIF_Register_Masks SDIF Register Masks | ||
8195 | * @{ | ||
8196 | */ | ||
8197 | |||
8198 | /*! @name CTRL - Control register */ | ||
8199 | /*! @{ */ | ||
8200 | #define SDIF_CTRL_CONTROLLER_RESET_MASK (0x1U) | ||
8201 | #define SDIF_CTRL_CONTROLLER_RESET_SHIFT (0U) | ||
8202 | /*! CONTROLLER_RESET - Controller reset. | ||
8203 | */ | ||
8204 | #define SDIF_CTRL_CONTROLLER_RESET(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_CONTROLLER_RESET_SHIFT)) & SDIF_CTRL_CONTROLLER_RESET_MASK) | ||
8205 | #define SDIF_CTRL_FIFO_RESET_MASK (0x2U) | ||
8206 | #define SDIF_CTRL_FIFO_RESET_SHIFT (1U) | ||
8207 | /*! FIFO_RESET - Fifo reset. | ||
8208 | */ | ||
8209 | #define SDIF_CTRL_FIFO_RESET(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_FIFO_RESET_SHIFT)) & SDIF_CTRL_FIFO_RESET_MASK) | ||
8210 | #define SDIF_CTRL_DMA_RESET_MASK (0x4U) | ||
8211 | #define SDIF_CTRL_DMA_RESET_SHIFT (2U) | ||
8212 | /*! DMA_RESET - DMA reset. | ||
8213 | */ | ||
8214 | #define SDIF_CTRL_DMA_RESET(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_DMA_RESET_SHIFT)) & SDIF_CTRL_DMA_RESET_MASK) | ||
8215 | #define SDIF_CTRL_INT_ENABLE_MASK (0x10U) | ||
8216 | #define SDIF_CTRL_INT_ENABLE_SHIFT (4U) | ||
8217 | /*! INT_ENABLE - Global interrupt enable/disable bit. | ||
8218 | */ | ||
8219 | #define SDIF_CTRL_INT_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_INT_ENABLE_SHIFT)) & SDIF_CTRL_INT_ENABLE_MASK) | ||
8220 | #define SDIF_CTRL_READ_WAIT_MASK (0x40U) | ||
8221 | #define SDIF_CTRL_READ_WAIT_SHIFT (6U) | ||
8222 | /*! READ_WAIT - Read/wait. | ||
8223 | */ | ||
8224 | #define SDIF_CTRL_READ_WAIT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_READ_WAIT_SHIFT)) & SDIF_CTRL_READ_WAIT_MASK) | ||
8225 | #define SDIF_CTRL_SEND_IRQ_RESPONSE_MASK (0x80U) | ||
8226 | #define SDIF_CTRL_SEND_IRQ_RESPONSE_SHIFT (7U) | ||
8227 | /*! SEND_IRQ_RESPONSE - Send irq response. | ||
8228 | */ | ||
8229 | #define SDIF_CTRL_SEND_IRQ_RESPONSE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_SEND_IRQ_RESPONSE_SHIFT)) & SDIF_CTRL_SEND_IRQ_RESPONSE_MASK) | ||
8230 | #define SDIF_CTRL_ABORT_READ_DATA_MASK (0x100U) | ||
8231 | #define SDIF_CTRL_ABORT_READ_DATA_SHIFT (8U) | ||
8232 | /*! ABORT_READ_DATA - Abort read data. | ||
8233 | */ | ||
8234 | #define SDIF_CTRL_ABORT_READ_DATA(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_ABORT_READ_DATA_SHIFT)) & SDIF_CTRL_ABORT_READ_DATA_MASK) | ||
8235 | #define SDIF_CTRL_SEND_CCSD_MASK (0x200U) | ||
8236 | #define SDIF_CTRL_SEND_CCSD_SHIFT (9U) | ||
8237 | /*! SEND_CCSD - Send ccsd. | ||
8238 | */ | ||
8239 | #define SDIF_CTRL_SEND_CCSD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_SEND_CCSD_SHIFT)) & SDIF_CTRL_SEND_CCSD_MASK) | ||
8240 | #define SDIF_CTRL_SEND_AUTO_STOP_CCSD_MASK (0x400U) | ||
8241 | #define SDIF_CTRL_SEND_AUTO_STOP_CCSD_SHIFT (10U) | ||
8242 | /*! SEND_AUTO_STOP_CCSD - Send auto stop ccsd. | ||
8243 | */ | ||
8244 | #define SDIF_CTRL_SEND_AUTO_STOP_CCSD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_SEND_AUTO_STOP_CCSD_SHIFT)) & SDIF_CTRL_SEND_AUTO_STOP_CCSD_MASK) | ||
8245 | #define SDIF_CTRL_CEATA_DEVICE_INTERRUPT_STATUS_MASK (0x800U) | ||
8246 | #define SDIF_CTRL_CEATA_DEVICE_INTERRUPT_STATUS_SHIFT (11U) | ||
8247 | /*! CEATA_DEVICE_INTERRUPT_STATUS - CEATA device interrupt status. | ||
8248 | */ | ||
8249 | #define SDIF_CTRL_CEATA_DEVICE_INTERRUPT_STATUS(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_CEATA_DEVICE_INTERRUPT_STATUS_SHIFT)) & SDIF_CTRL_CEATA_DEVICE_INTERRUPT_STATUS_MASK) | ||
8250 | #define SDIF_CTRL_CARD_VOLTAGE_A0_MASK (0x10000U) | ||
8251 | #define SDIF_CTRL_CARD_VOLTAGE_A0_SHIFT (16U) | ||
8252 | /*! CARD_VOLTAGE_A0 - Controls the state of the SD_VOLT0 pin. | ||
8253 | */ | ||
8254 | #define SDIF_CTRL_CARD_VOLTAGE_A0(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_CARD_VOLTAGE_A0_SHIFT)) & SDIF_CTRL_CARD_VOLTAGE_A0_MASK) | ||
8255 | #define SDIF_CTRL_CARD_VOLTAGE_A1_MASK (0x20000U) | ||
8256 | #define SDIF_CTRL_CARD_VOLTAGE_A1_SHIFT (17U) | ||
8257 | /*! CARD_VOLTAGE_A1 - Controls the state of the SD_VOLT1 pin. | ||
8258 | */ | ||
8259 | #define SDIF_CTRL_CARD_VOLTAGE_A1(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_CARD_VOLTAGE_A1_SHIFT)) & SDIF_CTRL_CARD_VOLTAGE_A1_MASK) | ||
8260 | #define SDIF_CTRL_CARD_VOLTAGE_A2_MASK (0x40000U) | ||
8261 | #define SDIF_CTRL_CARD_VOLTAGE_A2_SHIFT (18U) | ||
8262 | /*! CARD_VOLTAGE_A2 - Controls the state of the SD_VOLT2 pin. | ||
8263 | */ | ||
8264 | #define SDIF_CTRL_CARD_VOLTAGE_A2(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_CARD_VOLTAGE_A2_SHIFT)) & SDIF_CTRL_CARD_VOLTAGE_A2_MASK) | ||
8265 | #define SDIF_CTRL_USE_INTERNAL_DMAC_MASK (0x2000000U) | ||
8266 | #define SDIF_CTRL_USE_INTERNAL_DMAC_SHIFT (25U) | ||
8267 | /*! USE_INTERNAL_DMAC - SD/MMC DMA use. | ||
8268 | */ | ||
8269 | #define SDIF_CTRL_USE_INTERNAL_DMAC(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTRL_USE_INTERNAL_DMAC_SHIFT)) & SDIF_CTRL_USE_INTERNAL_DMAC_MASK) | ||
8270 | /*! @} */ | ||
8271 | |||
8272 | /*! @name PWREN - Power Enable register */ | ||
8273 | /*! @{ */ | ||
8274 | #define SDIF_PWREN_POWER_ENABLE_MASK (0x1U) | ||
8275 | #define SDIF_PWREN_POWER_ENABLE_SHIFT (0U) | ||
8276 | /*! POWER_ENABLE - Power on/off switch for card; once power is turned on, software should wait for | ||
8277 | * regulator/switch ramp-up time before trying to initialize card. | ||
8278 | */ | ||
8279 | #define SDIF_PWREN_POWER_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_PWREN_POWER_ENABLE_SHIFT)) & SDIF_PWREN_POWER_ENABLE_MASK) | ||
8280 | /*! @} */ | ||
8281 | |||
8282 | /*! @name CLKDIV - Clock Divider register */ | ||
8283 | /*! @{ */ | ||
8284 | #define SDIF_CLKDIV_CLK_DIVIDER0_MASK (0xFFU) | ||
8285 | #define SDIF_CLKDIV_CLK_DIVIDER0_SHIFT (0U) | ||
8286 | /*! CLK_DIVIDER0 - Clock divider-0 value. | ||
8287 | */ | ||
8288 | #define SDIF_CLKDIV_CLK_DIVIDER0(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CLKDIV_CLK_DIVIDER0_SHIFT)) & SDIF_CLKDIV_CLK_DIVIDER0_MASK) | ||
8289 | /*! @} */ | ||
8290 | |||
8291 | /*! @name CLKENA - Clock Enable register */ | ||
8292 | /*! @{ */ | ||
8293 | #define SDIF_CLKENA_CCLK_ENABLE_MASK (0x1U) | ||
8294 | #define SDIF_CLKENA_CCLK_ENABLE_SHIFT (0U) | ||
8295 | /*! CCLK_ENABLE - Clock-enable control for SD card clock. | ||
8296 | */ | ||
8297 | #define SDIF_CLKENA_CCLK_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CLKENA_CCLK_ENABLE_SHIFT)) & SDIF_CLKENA_CCLK_ENABLE_MASK) | ||
8298 | #define SDIF_CLKENA_CCLK_LOW_POWER_MASK (0x10000U) | ||
8299 | #define SDIF_CLKENA_CCLK_LOW_POWER_SHIFT (16U) | ||
8300 | /*! CCLK_LOW_POWER - Low-power control for SD card clock. | ||
8301 | */ | ||
8302 | #define SDIF_CLKENA_CCLK_LOW_POWER(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CLKENA_CCLK_LOW_POWER_SHIFT)) & SDIF_CLKENA_CCLK_LOW_POWER_MASK) | ||
8303 | /*! @} */ | ||
8304 | |||
8305 | /*! @name TMOUT - Time-out register */ | ||
8306 | /*! @{ */ | ||
8307 | #define SDIF_TMOUT_RESPONSE_TIMEOUT_MASK (0xFFU) | ||
8308 | #define SDIF_TMOUT_RESPONSE_TIMEOUT_SHIFT (0U) | ||
8309 | /*! RESPONSE_TIMEOUT - Response time-out value. | ||
8310 | */ | ||
8311 | #define SDIF_TMOUT_RESPONSE_TIMEOUT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_TMOUT_RESPONSE_TIMEOUT_SHIFT)) & SDIF_TMOUT_RESPONSE_TIMEOUT_MASK) | ||
8312 | #define SDIF_TMOUT_DATA_TIMEOUT_MASK (0xFFFFFF00U) | ||
8313 | #define SDIF_TMOUT_DATA_TIMEOUT_SHIFT (8U) | ||
8314 | /*! DATA_TIMEOUT - Value for card Data Read time-out; same value also used for Data Starvation by Host time-out. | ||
8315 | */ | ||
8316 | #define SDIF_TMOUT_DATA_TIMEOUT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_TMOUT_DATA_TIMEOUT_SHIFT)) & SDIF_TMOUT_DATA_TIMEOUT_MASK) | ||
8317 | /*! @} */ | ||
8318 | |||
8319 | /*! @name CTYPE - Card Type register */ | ||
8320 | /*! @{ */ | ||
8321 | #define SDIF_CTYPE_CARD_WIDTH0_MASK (0x1U) | ||
8322 | #define SDIF_CTYPE_CARD_WIDTH0_SHIFT (0U) | ||
8323 | /*! CARD_WIDTH0 - Indicates if card is 1-bit or 4-bit: 0 - 1-bit mode 1 - 4-bit mode 1 and 4-bit | ||
8324 | * modes only work when 8-bit mode in CARD_WIDTH1 is not enabled (bit 16 in this register is set to | ||
8325 | * 0). | ||
8326 | */ | ||
8327 | #define SDIF_CTYPE_CARD_WIDTH0(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTYPE_CARD_WIDTH0_SHIFT)) & SDIF_CTYPE_CARD_WIDTH0_MASK) | ||
8328 | #define SDIF_CTYPE_CARD_WIDTH1_MASK (0x10000U) | ||
8329 | #define SDIF_CTYPE_CARD_WIDTH1_SHIFT (16U) | ||
8330 | /*! CARD_WIDTH1 - Indicates if card is 8-bit: 0 - Non 8-bit mode 1 - 8-bit mode. | ||
8331 | */ | ||
8332 | #define SDIF_CTYPE_CARD_WIDTH1(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CTYPE_CARD_WIDTH1_SHIFT)) & SDIF_CTYPE_CARD_WIDTH1_MASK) | ||
8333 | /*! @} */ | ||
8334 | |||
8335 | /*! @name BLKSIZ - Block Size register */ | ||
8336 | /*! @{ */ | ||
8337 | #define SDIF_BLKSIZ_BLOCK_SIZE_MASK (0xFFFFU) | ||
8338 | #define SDIF_BLKSIZ_BLOCK_SIZE_SHIFT (0U) | ||
8339 | /*! BLOCK_SIZE - Block size. | ||
8340 | */ | ||
8341 | #define SDIF_BLKSIZ_BLOCK_SIZE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BLKSIZ_BLOCK_SIZE_SHIFT)) & SDIF_BLKSIZ_BLOCK_SIZE_MASK) | ||
8342 | /*! @} */ | ||
8343 | |||
8344 | /*! @name BYTCNT - Byte Count register */ | ||
8345 | /*! @{ */ | ||
8346 | #define SDIF_BYTCNT_BYTE_COUNT_MASK (0xFFFFFFFFU) | ||
8347 | #define SDIF_BYTCNT_BYTE_COUNT_SHIFT (0U) | ||
8348 | /*! BYTE_COUNT - Number of bytes to be transferred; should be integer multiple of Block Size for block transfers. | ||
8349 | */ | ||
8350 | #define SDIF_BYTCNT_BYTE_COUNT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BYTCNT_BYTE_COUNT_SHIFT)) & SDIF_BYTCNT_BYTE_COUNT_MASK) | ||
8351 | /*! @} */ | ||
8352 | |||
8353 | /*! @name INTMASK - Interrupt Mask register */ | ||
8354 | /*! @{ */ | ||
8355 | #define SDIF_INTMASK_CDET_MASK (0x1U) | ||
8356 | #define SDIF_INTMASK_CDET_SHIFT (0U) | ||
8357 | /*! CDET - Card detect. | ||
8358 | */ | ||
8359 | #define SDIF_INTMASK_CDET(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_CDET_SHIFT)) & SDIF_INTMASK_CDET_MASK) | ||
8360 | #define SDIF_INTMASK_RE_MASK (0x2U) | ||
8361 | #define SDIF_INTMASK_RE_SHIFT (1U) | ||
8362 | /*! RE - Response error. | ||
8363 | */ | ||
8364 | #define SDIF_INTMASK_RE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_RE_SHIFT)) & SDIF_INTMASK_RE_MASK) | ||
8365 | #define SDIF_INTMASK_CDONE_MASK (0x4U) | ||
8366 | #define SDIF_INTMASK_CDONE_SHIFT (2U) | ||
8367 | /*! CDONE - Command done. | ||
8368 | */ | ||
8369 | #define SDIF_INTMASK_CDONE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_CDONE_SHIFT)) & SDIF_INTMASK_CDONE_MASK) | ||
8370 | #define SDIF_INTMASK_DTO_MASK (0x8U) | ||
8371 | #define SDIF_INTMASK_DTO_SHIFT (3U) | ||
8372 | /*! DTO - Data transfer over. | ||
8373 | */ | ||
8374 | #define SDIF_INTMASK_DTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_DTO_SHIFT)) & SDIF_INTMASK_DTO_MASK) | ||
8375 | #define SDIF_INTMASK_TXDR_MASK (0x10U) | ||
8376 | #define SDIF_INTMASK_TXDR_SHIFT (4U) | ||
8377 | /*! TXDR - Transmit FIFO data request. | ||
8378 | */ | ||
8379 | #define SDIF_INTMASK_TXDR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_TXDR_SHIFT)) & SDIF_INTMASK_TXDR_MASK) | ||
8380 | #define SDIF_INTMASK_RXDR_MASK (0x20U) | ||
8381 | #define SDIF_INTMASK_RXDR_SHIFT (5U) | ||
8382 | /*! RXDR - Receive FIFO data request. | ||
8383 | */ | ||
8384 | #define SDIF_INTMASK_RXDR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_RXDR_SHIFT)) & SDIF_INTMASK_RXDR_MASK) | ||
8385 | #define SDIF_INTMASK_RCRC_MASK (0x40U) | ||
8386 | #define SDIF_INTMASK_RCRC_SHIFT (6U) | ||
8387 | /*! RCRC - Response CRC error. | ||
8388 | */ | ||
8389 | #define SDIF_INTMASK_RCRC(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_RCRC_SHIFT)) & SDIF_INTMASK_RCRC_MASK) | ||
8390 | #define SDIF_INTMASK_DCRC_MASK (0x80U) | ||
8391 | #define SDIF_INTMASK_DCRC_SHIFT (7U) | ||
8392 | /*! DCRC - Data CRC error. | ||
8393 | */ | ||
8394 | #define SDIF_INTMASK_DCRC(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_DCRC_SHIFT)) & SDIF_INTMASK_DCRC_MASK) | ||
8395 | #define SDIF_INTMASK_RTO_MASK (0x100U) | ||
8396 | #define SDIF_INTMASK_RTO_SHIFT (8U) | ||
8397 | /*! RTO - Response time-out. | ||
8398 | */ | ||
8399 | #define SDIF_INTMASK_RTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_RTO_SHIFT)) & SDIF_INTMASK_RTO_MASK) | ||
8400 | #define SDIF_INTMASK_DRTO_MASK (0x200U) | ||
8401 | #define SDIF_INTMASK_DRTO_SHIFT (9U) | ||
8402 | /*! DRTO - Data read time-out. | ||
8403 | */ | ||
8404 | #define SDIF_INTMASK_DRTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_DRTO_SHIFT)) & SDIF_INTMASK_DRTO_MASK) | ||
8405 | #define SDIF_INTMASK_HTO_MASK (0x400U) | ||
8406 | #define SDIF_INTMASK_HTO_SHIFT (10U) | ||
8407 | /*! HTO - Data starvation-by-host time-out (HTO). | ||
8408 | */ | ||
8409 | #define SDIF_INTMASK_HTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_HTO_SHIFT)) & SDIF_INTMASK_HTO_MASK) | ||
8410 | #define SDIF_INTMASK_FRUN_MASK (0x800U) | ||
8411 | #define SDIF_INTMASK_FRUN_SHIFT (11U) | ||
8412 | /*! FRUN - FIFO underrun/overrun error. | ||
8413 | */ | ||
8414 | #define SDIF_INTMASK_FRUN(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_FRUN_SHIFT)) & SDIF_INTMASK_FRUN_MASK) | ||
8415 | #define SDIF_INTMASK_HLE_MASK (0x1000U) | ||
8416 | #define SDIF_INTMASK_HLE_SHIFT (12U) | ||
8417 | /*! HLE - Hardware locked write error. | ||
8418 | */ | ||
8419 | #define SDIF_INTMASK_HLE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_HLE_SHIFT)) & SDIF_INTMASK_HLE_MASK) | ||
8420 | #define SDIF_INTMASK_SBE_MASK (0x2000U) | ||
8421 | #define SDIF_INTMASK_SBE_SHIFT (13U) | ||
8422 | /*! SBE - Start-bit error. | ||
8423 | */ | ||
8424 | #define SDIF_INTMASK_SBE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_SBE_SHIFT)) & SDIF_INTMASK_SBE_MASK) | ||
8425 | #define SDIF_INTMASK_ACD_MASK (0x4000U) | ||
8426 | #define SDIF_INTMASK_ACD_SHIFT (14U) | ||
8427 | /*! ACD - Auto command done. | ||
8428 | */ | ||
8429 | #define SDIF_INTMASK_ACD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_ACD_SHIFT)) & SDIF_INTMASK_ACD_MASK) | ||
8430 | #define SDIF_INTMASK_EBE_MASK (0x8000U) | ||
8431 | #define SDIF_INTMASK_EBE_SHIFT (15U) | ||
8432 | /*! EBE - End-bit error (read)/Write no CRC. | ||
8433 | */ | ||
8434 | #define SDIF_INTMASK_EBE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_EBE_SHIFT)) & SDIF_INTMASK_EBE_MASK) | ||
8435 | #define SDIF_INTMASK_SDIO_INT_MASK_MASK (0x10000U) | ||
8436 | #define SDIF_INTMASK_SDIO_INT_MASK_SHIFT (16U) | ||
8437 | /*! SDIO_INT_MASK - Mask SDIO interrupt. | ||
8438 | */ | ||
8439 | #define SDIF_INTMASK_SDIO_INT_MASK(x) (((uint32_t)(((uint32_t)(x)) << SDIF_INTMASK_SDIO_INT_MASK_SHIFT)) & SDIF_INTMASK_SDIO_INT_MASK_MASK) | ||
8440 | /*! @} */ | ||
8441 | |||
8442 | /*! @name CMDARG - Command Argument register */ | ||
8443 | /*! @{ */ | ||
8444 | #define SDIF_CMDARG_CMD_ARG_MASK (0xFFFFFFFFU) | ||
8445 | #define SDIF_CMDARG_CMD_ARG_SHIFT (0U) | ||
8446 | /*! CMD_ARG - Value indicates command argument to be passed to card. | ||
8447 | */ | ||
8448 | #define SDIF_CMDARG_CMD_ARG(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMDARG_CMD_ARG_SHIFT)) & SDIF_CMDARG_CMD_ARG_MASK) | ||
8449 | /*! @} */ | ||
8450 | |||
8451 | /*! @name CMD - Command register */ | ||
8452 | /*! @{ */ | ||
8453 | #define SDIF_CMD_CMD_INDEX_MASK (0x3FU) | ||
8454 | #define SDIF_CMD_CMD_INDEX_SHIFT (0U) | ||
8455 | /*! CMD_INDEX - Command index. | ||
8456 | */ | ||
8457 | #define SDIF_CMD_CMD_INDEX(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_CMD_INDEX_SHIFT)) & SDIF_CMD_CMD_INDEX_MASK) | ||
8458 | #define SDIF_CMD_RESPONSE_EXPECT_MASK (0x40U) | ||
8459 | #define SDIF_CMD_RESPONSE_EXPECT_SHIFT (6U) | ||
8460 | /*! RESPONSE_EXPECT - Response expect. | ||
8461 | */ | ||
8462 | #define SDIF_CMD_RESPONSE_EXPECT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_RESPONSE_EXPECT_SHIFT)) & SDIF_CMD_RESPONSE_EXPECT_MASK) | ||
8463 | #define SDIF_CMD_RESPONSE_LENGTH_MASK (0x80U) | ||
8464 | #define SDIF_CMD_RESPONSE_LENGTH_SHIFT (7U) | ||
8465 | /*! RESPONSE_LENGTH - Response length. | ||
8466 | */ | ||
8467 | #define SDIF_CMD_RESPONSE_LENGTH(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_RESPONSE_LENGTH_SHIFT)) & SDIF_CMD_RESPONSE_LENGTH_MASK) | ||
8468 | #define SDIF_CMD_CHECK_RESPONSE_CRC_MASK (0x100U) | ||
8469 | #define SDIF_CMD_CHECK_RESPONSE_CRC_SHIFT (8U) | ||
8470 | /*! CHECK_RESPONSE_CRC - Check response CRC. | ||
8471 | */ | ||
8472 | #define SDIF_CMD_CHECK_RESPONSE_CRC(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_CHECK_RESPONSE_CRC_SHIFT)) & SDIF_CMD_CHECK_RESPONSE_CRC_MASK) | ||
8473 | #define SDIF_CMD_DATA_EXPECTED_MASK (0x200U) | ||
8474 | #define SDIF_CMD_DATA_EXPECTED_SHIFT (9U) | ||
8475 | /*! DATA_EXPECTED - Data expected. | ||
8476 | */ | ||
8477 | #define SDIF_CMD_DATA_EXPECTED(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_DATA_EXPECTED_SHIFT)) & SDIF_CMD_DATA_EXPECTED_MASK) | ||
8478 | #define SDIF_CMD_READ_WRITE_MASK (0x400U) | ||
8479 | #define SDIF_CMD_READ_WRITE_SHIFT (10U) | ||
8480 | /*! READ_WRITE - read/write. | ||
8481 | */ | ||
8482 | #define SDIF_CMD_READ_WRITE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_READ_WRITE_SHIFT)) & SDIF_CMD_READ_WRITE_MASK) | ||
8483 | #define SDIF_CMD_TRANSFER_MODE_MASK (0x800U) | ||
8484 | #define SDIF_CMD_TRANSFER_MODE_SHIFT (11U) | ||
8485 | /*! TRANSFER_MODE - Transfer mode. | ||
8486 | */ | ||
8487 | #define SDIF_CMD_TRANSFER_MODE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_TRANSFER_MODE_SHIFT)) & SDIF_CMD_TRANSFER_MODE_MASK) | ||
8488 | #define SDIF_CMD_SEND_AUTO_STOP_MASK (0x1000U) | ||
8489 | #define SDIF_CMD_SEND_AUTO_STOP_SHIFT (12U) | ||
8490 | /*! SEND_AUTO_STOP - Send auto stop. | ||
8491 | */ | ||
8492 | #define SDIF_CMD_SEND_AUTO_STOP(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_SEND_AUTO_STOP_SHIFT)) & SDIF_CMD_SEND_AUTO_STOP_MASK) | ||
8493 | #define SDIF_CMD_WAIT_PRVDATA_COMPLETE_MASK (0x2000U) | ||
8494 | #define SDIF_CMD_WAIT_PRVDATA_COMPLETE_SHIFT (13U) | ||
8495 | /*! WAIT_PRVDATA_COMPLETE - Wait prvdata complete. | ||
8496 | */ | ||
8497 | #define SDIF_CMD_WAIT_PRVDATA_COMPLETE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_WAIT_PRVDATA_COMPLETE_SHIFT)) & SDIF_CMD_WAIT_PRVDATA_COMPLETE_MASK) | ||
8498 | #define SDIF_CMD_STOP_ABORT_CMD_MASK (0x4000U) | ||
8499 | #define SDIF_CMD_STOP_ABORT_CMD_SHIFT (14U) | ||
8500 | /*! STOP_ABORT_CMD - Stop abort command. | ||
8501 | */ | ||
8502 | #define SDIF_CMD_STOP_ABORT_CMD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_STOP_ABORT_CMD_SHIFT)) & SDIF_CMD_STOP_ABORT_CMD_MASK) | ||
8503 | #define SDIF_CMD_SEND_INITIALIZATION_MASK (0x8000U) | ||
8504 | #define SDIF_CMD_SEND_INITIALIZATION_SHIFT (15U) | ||
8505 | /*! SEND_INITIALIZATION - Send initialization. | ||
8506 | */ | ||
8507 | #define SDIF_CMD_SEND_INITIALIZATION(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_SEND_INITIALIZATION_SHIFT)) & SDIF_CMD_SEND_INITIALIZATION_MASK) | ||
8508 | #define SDIF_CMD_UPDATE_CLOCK_REGISTERS_ONLY_MASK (0x200000U) | ||
8509 | #define SDIF_CMD_UPDATE_CLOCK_REGISTERS_ONLY_SHIFT (21U) | ||
8510 | /*! UPDATE_CLOCK_REGISTERS_ONLY - Update clock registers only. | ||
8511 | */ | ||
8512 | #define SDIF_CMD_UPDATE_CLOCK_REGISTERS_ONLY(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_UPDATE_CLOCK_REGISTERS_ONLY_SHIFT)) & SDIF_CMD_UPDATE_CLOCK_REGISTERS_ONLY_MASK) | ||
8513 | #define SDIF_CMD_READ_CEATA_DEVICE_MASK (0x400000U) | ||
8514 | #define SDIF_CMD_READ_CEATA_DEVICE_SHIFT (22U) | ||
8515 | /*! READ_CEATA_DEVICE - Read ceata device. | ||
8516 | */ | ||
8517 | #define SDIF_CMD_READ_CEATA_DEVICE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_READ_CEATA_DEVICE_SHIFT)) & SDIF_CMD_READ_CEATA_DEVICE_MASK) | ||
8518 | #define SDIF_CMD_CCS_EXPECTED_MASK (0x800000U) | ||
8519 | #define SDIF_CMD_CCS_EXPECTED_SHIFT (23U) | ||
8520 | /*! CCS_EXPECTED - CCS expected. | ||
8521 | */ | ||
8522 | #define SDIF_CMD_CCS_EXPECTED(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_CCS_EXPECTED_SHIFT)) & SDIF_CMD_CCS_EXPECTED_MASK) | ||
8523 | #define SDIF_CMD_ENABLE_BOOT_MASK (0x1000000U) | ||
8524 | #define SDIF_CMD_ENABLE_BOOT_SHIFT (24U) | ||
8525 | /*! ENABLE_BOOT - Enable Boot - this bit should be set only for mandatory boot mode. | ||
8526 | */ | ||
8527 | #define SDIF_CMD_ENABLE_BOOT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_ENABLE_BOOT_SHIFT)) & SDIF_CMD_ENABLE_BOOT_MASK) | ||
8528 | #define SDIF_CMD_EXPECT_BOOT_ACK_MASK (0x2000000U) | ||
8529 | #define SDIF_CMD_EXPECT_BOOT_ACK_SHIFT (25U) | ||
8530 | /*! EXPECT_BOOT_ACK - Expect Boot Acknowledge. | ||
8531 | */ | ||
8532 | #define SDIF_CMD_EXPECT_BOOT_ACK(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_EXPECT_BOOT_ACK_SHIFT)) & SDIF_CMD_EXPECT_BOOT_ACK_MASK) | ||
8533 | #define SDIF_CMD_DISABLE_BOOT_MASK (0x4000000U) | ||
8534 | #define SDIF_CMD_DISABLE_BOOT_SHIFT (26U) | ||
8535 | /*! DISABLE_BOOT - Disable Boot. | ||
8536 | */ | ||
8537 | #define SDIF_CMD_DISABLE_BOOT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_DISABLE_BOOT_SHIFT)) & SDIF_CMD_DISABLE_BOOT_MASK) | ||
8538 | #define SDIF_CMD_BOOT_MODE_MASK (0x8000000U) | ||
8539 | #define SDIF_CMD_BOOT_MODE_SHIFT (27U) | ||
8540 | /*! BOOT_MODE - Boot Mode. | ||
8541 | */ | ||
8542 | #define SDIF_CMD_BOOT_MODE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_BOOT_MODE_SHIFT)) & SDIF_CMD_BOOT_MODE_MASK) | ||
8543 | #define SDIF_CMD_VOLT_SWITCH_MASK (0x10000000U) | ||
8544 | #define SDIF_CMD_VOLT_SWITCH_SHIFT (28U) | ||
8545 | /*! VOLT_SWITCH - Voltage switch bit. | ||
8546 | */ | ||
8547 | #define SDIF_CMD_VOLT_SWITCH(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_VOLT_SWITCH_SHIFT)) & SDIF_CMD_VOLT_SWITCH_MASK) | ||
8548 | #define SDIF_CMD_USE_HOLD_REG_MASK (0x20000000U) | ||
8549 | #define SDIF_CMD_USE_HOLD_REG_SHIFT (29U) | ||
8550 | /*! USE_HOLD_REG - Use Hold Register. | ||
8551 | */ | ||
8552 | #define SDIF_CMD_USE_HOLD_REG(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_USE_HOLD_REG_SHIFT)) & SDIF_CMD_USE_HOLD_REG_MASK) | ||
8553 | #define SDIF_CMD_START_CMD_MASK (0x80000000U) | ||
8554 | #define SDIF_CMD_START_CMD_SHIFT (31U) | ||
8555 | /*! START_CMD - Start command. | ||
8556 | */ | ||
8557 | #define SDIF_CMD_START_CMD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CMD_START_CMD_SHIFT)) & SDIF_CMD_START_CMD_MASK) | ||
8558 | /*! @} */ | ||
8559 | |||
8560 | /*! @name RESP - Response register */ | ||
8561 | /*! @{ */ | ||
8562 | #define SDIF_RESP_RESPONSE_MASK (0xFFFFFFFFU) | ||
8563 | #define SDIF_RESP_RESPONSE_SHIFT (0U) | ||
8564 | /*! RESPONSE - Bits of response. | ||
8565 | */ | ||
8566 | #define SDIF_RESP_RESPONSE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RESP_RESPONSE_SHIFT)) & SDIF_RESP_RESPONSE_MASK) | ||
8567 | /*! @} */ | ||
8568 | |||
8569 | /* The count of SDIF_RESP */ | ||
8570 | #define SDIF_RESP_COUNT (4U) | ||
8571 | |||
8572 | /*! @name MINTSTS - Masked Interrupt Status register */ | ||
8573 | /*! @{ */ | ||
8574 | #define SDIF_MINTSTS_CDET_MASK (0x1U) | ||
8575 | #define SDIF_MINTSTS_CDET_SHIFT (0U) | ||
8576 | /*! CDET - Card detect. | ||
8577 | */ | ||
8578 | #define SDIF_MINTSTS_CDET(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_CDET_SHIFT)) & SDIF_MINTSTS_CDET_MASK) | ||
8579 | #define SDIF_MINTSTS_RE_MASK (0x2U) | ||
8580 | #define SDIF_MINTSTS_RE_SHIFT (1U) | ||
8581 | /*! RE - Response error. | ||
8582 | */ | ||
8583 | #define SDIF_MINTSTS_RE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_RE_SHIFT)) & SDIF_MINTSTS_RE_MASK) | ||
8584 | #define SDIF_MINTSTS_CDONE_MASK (0x4U) | ||
8585 | #define SDIF_MINTSTS_CDONE_SHIFT (2U) | ||
8586 | /*! CDONE - Command done. | ||
8587 | */ | ||
8588 | #define SDIF_MINTSTS_CDONE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_CDONE_SHIFT)) & SDIF_MINTSTS_CDONE_MASK) | ||
8589 | #define SDIF_MINTSTS_DTO_MASK (0x8U) | ||
8590 | #define SDIF_MINTSTS_DTO_SHIFT (3U) | ||
8591 | /*! DTO - Data transfer over. | ||
8592 | */ | ||
8593 | #define SDIF_MINTSTS_DTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_DTO_SHIFT)) & SDIF_MINTSTS_DTO_MASK) | ||
8594 | #define SDIF_MINTSTS_TXDR_MASK (0x10U) | ||
8595 | #define SDIF_MINTSTS_TXDR_SHIFT (4U) | ||
8596 | /*! TXDR - Transmit FIFO data request. | ||
8597 | */ | ||
8598 | #define SDIF_MINTSTS_TXDR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_TXDR_SHIFT)) & SDIF_MINTSTS_TXDR_MASK) | ||
8599 | #define SDIF_MINTSTS_RXDR_MASK (0x20U) | ||
8600 | #define SDIF_MINTSTS_RXDR_SHIFT (5U) | ||
8601 | /*! RXDR - Receive FIFO data request. | ||
8602 | */ | ||
8603 | #define SDIF_MINTSTS_RXDR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_RXDR_SHIFT)) & SDIF_MINTSTS_RXDR_MASK) | ||
8604 | #define SDIF_MINTSTS_RCRC_MASK (0x40U) | ||
8605 | #define SDIF_MINTSTS_RCRC_SHIFT (6U) | ||
8606 | /*! RCRC - Response CRC error. | ||
8607 | */ | ||
8608 | #define SDIF_MINTSTS_RCRC(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_RCRC_SHIFT)) & SDIF_MINTSTS_RCRC_MASK) | ||
8609 | #define SDIF_MINTSTS_DCRC_MASK (0x80U) | ||
8610 | #define SDIF_MINTSTS_DCRC_SHIFT (7U) | ||
8611 | /*! DCRC - Data CRC error. | ||
8612 | */ | ||
8613 | #define SDIF_MINTSTS_DCRC(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_DCRC_SHIFT)) & SDIF_MINTSTS_DCRC_MASK) | ||
8614 | #define SDIF_MINTSTS_RTO_MASK (0x100U) | ||
8615 | #define SDIF_MINTSTS_RTO_SHIFT (8U) | ||
8616 | /*! RTO - Response time-out. | ||
8617 | */ | ||
8618 | #define SDIF_MINTSTS_RTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_RTO_SHIFT)) & SDIF_MINTSTS_RTO_MASK) | ||
8619 | #define SDIF_MINTSTS_DRTO_MASK (0x200U) | ||
8620 | #define SDIF_MINTSTS_DRTO_SHIFT (9U) | ||
8621 | /*! DRTO - Data read time-out. | ||
8622 | */ | ||
8623 | #define SDIF_MINTSTS_DRTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_DRTO_SHIFT)) & SDIF_MINTSTS_DRTO_MASK) | ||
8624 | #define SDIF_MINTSTS_HTO_MASK (0x400U) | ||
8625 | #define SDIF_MINTSTS_HTO_SHIFT (10U) | ||
8626 | /*! HTO - Data starvation-by-host time-out (HTO). | ||
8627 | */ | ||
8628 | #define SDIF_MINTSTS_HTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_HTO_SHIFT)) & SDIF_MINTSTS_HTO_MASK) | ||
8629 | #define SDIF_MINTSTS_FRUN_MASK (0x800U) | ||
8630 | #define SDIF_MINTSTS_FRUN_SHIFT (11U) | ||
8631 | /*! FRUN - FIFO underrun/overrun error. | ||
8632 | */ | ||
8633 | #define SDIF_MINTSTS_FRUN(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_FRUN_SHIFT)) & SDIF_MINTSTS_FRUN_MASK) | ||
8634 | #define SDIF_MINTSTS_HLE_MASK (0x1000U) | ||
8635 | #define SDIF_MINTSTS_HLE_SHIFT (12U) | ||
8636 | /*! HLE - Hardware locked write error. | ||
8637 | */ | ||
8638 | #define SDIF_MINTSTS_HLE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_HLE_SHIFT)) & SDIF_MINTSTS_HLE_MASK) | ||
8639 | #define SDIF_MINTSTS_SBE_MASK (0x2000U) | ||
8640 | #define SDIF_MINTSTS_SBE_SHIFT (13U) | ||
8641 | /*! SBE - Start-bit error. | ||
8642 | */ | ||
8643 | #define SDIF_MINTSTS_SBE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_SBE_SHIFT)) & SDIF_MINTSTS_SBE_MASK) | ||
8644 | #define SDIF_MINTSTS_ACD_MASK (0x4000U) | ||
8645 | #define SDIF_MINTSTS_ACD_SHIFT (14U) | ||
8646 | /*! ACD - Auto command done. | ||
8647 | */ | ||
8648 | #define SDIF_MINTSTS_ACD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_ACD_SHIFT)) & SDIF_MINTSTS_ACD_MASK) | ||
8649 | #define SDIF_MINTSTS_EBE_MASK (0x8000U) | ||
8650 | #define SDIF_MINTSTS_EBE_SHIFT (15U) | ||
8651 | /*! EBE - End-bit error (read)/write no CRC. | ||
8652 | */ | ||
8653 | #define SDIF_MINTSTS_EBE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_EBE_SHIFT)) & SDIF_MINTSTS_EBE_MASK) | ||
8654 | #define SDIF_MINTSTS_SDIO_INTERRUPT_MASK (0x10000U) | ||
8655 | #define SDIF_MINTSTS_SDIO_INTERRUPT_SHIFT (16U) | ||
8656 | /*! SDIO_INTERRUPT - Interrupt from SDIO card. | ||
8657 | */ | ||
8658 | #define SDIF_MINTSTS_SDIO_INTERRUPT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_MINTSTS_SDIO_INTERRUPT_SHIFT)) & SDIF_MINTSTS_SDIO_INTERRUPT_MASK) | ||
8659 | /*! @} */ | ||
8660 | |||
8661 | /*! @name RINTSTS - Raw Interrupt Status register */ | ||
8662 | /*! @{ */ | ||
8663 | #define SDIF_RINTSTS_CDET_MASK (0x1U) | ||
8664 | #define SDIF_RINTSTS_CDET_SHIFT (0U) | ||
8665 | /*! CDET - Card detect. | ||
8666 | */ | ||
8667 | #define SDIF_RINTSTS_CDET(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_CDET_SHIFT)) & SDIF_RINTSTS_CDET_MASK) | ||
8668 | #define SDIF_RINTSTS_RE_MASK (0x2U) | ||
8669 | #define SDIF_RINTSTS_RE_SHIFT (1U) | ||
8670 | /*! RE - Response error. | ||
8671 | */ | ||
8672 | #define SDIF_RINTSTS_RE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_RE_SHIFT)) & SDIF_RINTSTS_RE_MASK) | ||
8673 | #define SDIF_RINTSTS_CDONE_MASK (0x4U) | ||
8674 | #define SDIF_RINTSTS_CDONE_SHIFT (2U) | ||
8675 | /*! CDONE - Command done. | ||
8676 | */ | ||
8677 | #define SDIF_RINTSTS_CDONE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_CDONE_SHIFT)) & SDIF_RINTSTS_CDONE_MASK) | ||
8678 | #define SDIF_RINTSTS_DTO_MASK (0x8U) | ||
8679 | #define SDIF_RINTSTS_DTO_SHIFT (3U) | ||
8680 | /*! DTO - Data transfer over. | ||
8681 | */ | ||
8682 | #define SDIF_RINTSTS_DTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_DTO_SHIFT)) & SDIF_RINTSTS_DTO_MASK) | ||
8683 | #define SDIF_RINTSTS_TXDR_MASK (0x10U) | ||
8684 | #define SDIF_RINTSTS_TXDR_SHIFT (4U) | ||
8685 | /*! TXDR - Transmit FIFO data request. | ||
8686 | */ | ||
8687 | #define SDIF_RINTSTS_TXDR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_TXDR_SHIFT)) & SDIF_RINTSTS_TXDR_MASK) | ||
8688 | #define SDIF_RINTSTS_RXDR_MASK (0x20U) | ||
8689 | #define SDIF_RINTSTS_RXDR_SHIFT (5U) | ||
8690 | /*! RXDR - Receive FIFO data request. | ||
8691 | */ | ||
8692 | #define SDIF_RINTSTS_RXDR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_RXDR_SHIFT)) & SDIF_RINTSTS_RXDR_MASK) | ||
8693 | #define SDIF_RINTSTS_RCRC_MASK (0x40U) | ||
8694 | #define SDIF_RINTSTS_RCRC_SHIFT (6U) | ||
8695 | /*! RCRC - Response CRC error. | ||
8696 | */ | ||
8697 | #define SDIF_RINTSTS_RCRC(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_RCRC_SHIFT)) & SDIF_RINTSTS_RCRC_MASK) | ||
8698 | #define SDIF_RINTSTS_DCRC_MASK (0x80U) | ||
8699 | #define SDIF_RINTSTS_DCRC_SHIFT (7U) | ||
8700 | /*! DCRC - Data CRC error. | ||
8701 | */ | ||
8702 | #define SDIF_RINTSTS_DCRC(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_DCRC_SHIFT)) & SDIF_RINTSTS_DCRC_MASK) | ||
8703 | #define SDIF_RINTSTS_RTO_BAR_MASK (0x100U) | ||
8704 | #define SDIF_RINTSTS_RTO_BAR_SHIFT (8U) | ||
8705 | /*! RTO_BAR - Response time-out (RTO)/Boot Ack Received (BAR). | ||
8706 | */ | ||
8707 | #define SDIF_RINTSTS_RTO_BAR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_RTO_BAR_SHIFT)) & SDIF_RINTSTS_RTO_BAR_MASK) | ||
8708 | #define SDIF_RINTSTS_DRTO_BDS_MASK (0x200U) | ||
8709 | #define SDIF_RINTSTS_DRTO_BDS_SHIFT (9U) | ||
8710 | /*! DRTO_BDS - Data read time-out (DRTO)/Boot Data Start (BDS). | ||
8711 | */ | ||
8712 | #define SDIF_RINTSTS_DRTO_BDS(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_DRTO_BDS_SHIFT)) & SDIF_RINTSTS_DRTO_BDS_MASK) | ||
8713 | #define SDIF_RINTSTS_HTO_MASK (0x400U) | ||
8714 | #define SDIF_RINTSTS_HTO_SHIFT (10U) | ||
8715 | /*! HTO - Data starvation-by-host time-out (HTO). | ||
8716 | */ | ||
8717 | #define SDIF_RINTSTS_HTO(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_HTO_SHIFT)) & SDIF_RINTSTS_HTO_MASK) | ||
8718 | #define SDIF_RINTSTS_FRUN_MASK (0x800U) | ||
8719 | #define SDIF_RINTSTS_FRUN_SHIFT (11U) | ||
8720 | /*! FRUN - FIFO underrun/overrun error. | ||
8721 | */ | ||
8722 | #define SDIF_RINTSTS_FRUN(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_FRUN_SHIFT)) & SDIF_RINTSTS_FRUN_MASK) | ||
8723 | #define SDIF_RINTSTS_HLE_MASK (0x1000U) | ||
8724 | #define SDIF_RINTSTS_HLE_SHIFT (12U) | ||
8725 | /*! HLE - Hardware locked write error. | ||
8726 | */ | ||
8727 | #define SDIF_RINTSTS_HLE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_HLE_SHIFT)) & SDIF_RINTSTS_HLE_MASK) | ||
8728 | #define SDIF_RINTSTS_SBE_MASK (0x2000U) | ||
8729 | #define SDIF_RINTSTS_SBE_SHIFT (13U) | ||
8730 | /*! SBE - Start-bit error. | ||
8731 | */ | ||
8732 | #define SDIF_RINTSTS_SBE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_SBE_SHIFT)) & SDIF_RINTSTS_SBE_MASK) | ||
8733 | #define SDIF_RINTSTS_ACD_MASK (0x4000U) | ||
8734 | #define SDIF_RINTSTS_ACD_SHIFT (14U) | ||
8735 | /*! ACD - Auto command done. | ||
8736 | */ | ||
8737 | #define SDIF_RINTSTS_ACD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_ACD_SHIFT)) & SDIF_RINTSTS_ACD_MASK) | ||
8738 | #define SDIF_RINTSTS_EBE_MASK (0x8000U) | ||
8739 | #define SDIF_RINTSTS_EBE_SHIFT (15U) | ||
8740 | /*! EBE - End-bit error (read)/write no CRC. | ||
8741 | */ | ||
8742 | #define SDIF_RINTSTS_EBE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_EBE_SHIFT)) & SDIF_RINTSTS_EBE_MASK) | ||
8743 | #define SDIF_RINTSTS_SDIO_INTERRUPT_MASK (0x10000U) | ||
8744 | #define SDIF_RINTSTS_SDIO_INTERRUPT_SHIFT (16U) | ||
8745 | /*! SDIO_INTERRUPT - Interrupt from SDIO card. | ||
8746 | */ | ||
8747 | #define SDIF_RINTSTS_SDIO_INTERRUPT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RINTSTS_SDIO_INTERRUPT_SHIFT)) & SDIF_RINTSTS_SDIO_INTERRUPT_MASK) | ||
8748 | /*! @} */ | ||
8749 | |||
8750 | /*! @name STATUS - Status register */ | ||
8751 | /*! @{ */ | ||
8752 | #define SDIF_STATUS_FIFO_RX_WATERMARK_MASK (0x1U) | ||
8753 | #define SDIF_STATUS_FIFO_RX_WATERMARK_SHIFT (0U) | ||
8754 | /*! FIFO_RX_WATERMARK - FIFO reached Receive watermark level; not qualified with data transfer. | ||
8755 | */ | ||
8756 | #define SDIF_STATUS_FIFO_RX_WATERMARK(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_FIFO_RX_WATERMARK_SHIFT)) & SDIF_STATUS_FIFO_RX_WATERMARK_MASK) | ||
8757 | #define SDIF_STATUS_FIFO_TX_WATERMARK_MASK (0x2U) | ||
8758 | #define SDIF_STATUS_FIFO_TX_WATERMARK_SHIFT (1U) | ||
8759 | /*! FIFO_TX_WATERMARK - FIFO reached Transmit watermark level; not qualified with data transfer. | ||
8760 | */ | ||
8761 | #define SDIF_STATUS_FIFO_TX_WATERMARK(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_FIFO_TX_WATERMARK_SHIFT)) & SDIF_STATUS_FIFO_TX_WATERMARK_MASK) | ||
8762 | #define SDIF_STATUS_FIFO_EMPTY_MASK (0x4U) | ||
8763 | #define SDIF_STATUS_FIFO_EMPTY_SHIFT (2U) | ||
8764 | /*! FIFO_EMPTY - FIFO is empty status. | ||
8765 | */ | ||
8766 | #define SDIF_STATUS_FIFO_EMPTY(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_FIFO_EMPTY_SHIFT)) & SDIF_STATUS_FIFO_EMPTY_MASK) | ||
8767 | #define SDIF_STATUS_FIFO_FULL_MASK (0x8U) | ||
8768 | #define SDIF_STATUS_FIFO_FULL_SHIFT (3U) | ||
8769 | /*! FIFO_FULL - FIFO is full status. | ||
8770 | */ | ||
8771 | #define SDIF_STATUS_FIFO_FULL(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_FIFO_FULL_SHIFT)) & SDIF_STATUS_FIFO_FULL_MASK) | ||
8772 | #define SDIF_STATUS_CMDFSMSTATES_MASK (0xF0U) | ||
8773 | #define SDIF_STATUS_CMDFSMSTATES_SHIFT (4U) | ||
8774 | /*! CMDFSMSTATES - Command FSM states: 0 - Idle 1 - Send init sequence 2 - Tx cmd start bit 3 - Tx | ||
8775 | * cmd tx bit 4 - Tx cmd index + arg 5 - Tx cmd crc7 6 - Tx cmd end bit 7 - Rx resp start bit 8 - | ||
8776 | * Rx resp IRQ response 9 - Rx resp tx bit 10 - Rx resp cmd idx 11 - Rx resp data 12 - Rx resp | ||
8777 | * crc7 13 - Rx resp end bit 14 - Cmd path wait NCC 15 - Wait; CMD-to-response turnaround NOTE: The | ||
8778 | * command FSM state is represented using 19 bits. | ||
8779 | */ | ||
8780 | #define SDIF_STATUS_CMDFSMSTATES(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_CMDFSMSTATES_SHIFT)) & SDIF_STATUS_CMDFSMSTATES_MASK) | ||
8781 | #define SDIF_STATUS_DATA_3_STATUS_MASK (0x100U) | ||
8782 | #define SDIF_STATUS_DATA_3_STATUS_SHIFT (8U) | ||
8783 | /*! DATA_3_STATUS - Raw selected card_data[3]; checks whether card is present 0 - card not present 1 - card present. | ||
8784 | */ | ||
8785 | #define SDIF_STATUS_DATA_3_STATUS(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_DATA_3_STATUS_SHIFT)) & SDIF_STATUS_DATA_3_STATUS_MASK) | ||
8786 | #define SDIF_STATUS_DATA_BUSY_MASK (0x200U) | ||
8787 | #define SDIF_STATUS_DATA_BUSY_SHIFT (9U) | ||
8788 | /*! DATA_BUSY - Inverted version of raw selected card_data[0] 0 - card data not busy 1 - card data busy. | ||
8789 | */ | ||
8790 | #define SDIF_STATUS_DATA_BUSY(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_DATA_BUSY_SHIFT)) & SDIF_STATUS_DATA_BUSY_MASK) | ||
8791 | #define SDIF_STATUS_DATA_STATE_MC_BUSY_MASK (0x400U) | ||
8792 | #define SDIF_STATUS_DATA_STATE_MC_BUSY_SHIFT (10U) | ||
8793 | /*! DATA_STATE_MC_BUSY - Data transmit or receive state-machine is busy. | ||
8794 | */ | ||
8795 | #define SDIF_STATUS_DATA_STATE_MC_BUSY(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_DATA_STATE_MC_BUSY_SHIFT)) & SDIF_STATUS_DATA_STATE_MC_BUSY_MASK) | ||
8796 | #define SDIF_STATUS_RESPONSE_INDEX_MASK (0x1F800U) | ||
8797 | #define SDIF_STATUS_RESPONSE_INDEX_SHIFT (11U) | ||
8798 | /*! RESPONSE_INDEX - Index of previous response, including any auto-stop sent by core. | ||
8799 | */ | ||
8800 | #define SDIF_STATUS_RESPONSE_INDEX(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_RESPONSE_INDEX_SHIFT)) & SDIF_STATUS_RESPONSE_INDEX_MASK) | ||
8801 | #define SDIF_STATUS_FIFO_COUNT_MASK (0x3FFE0000U) | ||
8802 | #define SDIF_STATUS_FIFO_COUNT_SHIFT (17U) | ||
8803 | /*! FIFO_COUNT - FIFO count - Number of filled locations in FIFO. | ||
8804 | */ | ||
8805 | #define SDIF_STATUS_FIFO_COUNT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_FIFO_COUNT_SHIFT)) & SDIF_STATUS_FIFO_COUNT_MASK) | ||
8806 | #define SDIF_STATUS_DMA_ACK_MASK (0x40000000U) | ||
8807 | #define SDIF_STATUS_DMA_ACK_SHIFT (30U) | ||
8808 | /*! DMA_ACK - DMA acknowledge signal state. | ||
8809 | */ | ||
8810 | #define SDIF_STATUS_DMA_ACK(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_DMA_ACK_SHIFT)) & SDIF_STATUS_DMA_ACK_MASK) | ||
8811 | #define SDIF_STATUS_DMA_REQ_MASK (0x80000000U) | ||
8812 | #define SDIF_STATUS_DMA_REQ_SHIFT (31U) | ||
8813 | /*! DMA_REQ - DMA request signal state. | ||
8814 | */ | ||
8815 | #define SDIF_STATUS_DMA_REQ(x) (((uint32_t)(((uint32_t)(x)) << SDIF_STATUS_DMA_REQ_SHIFT)) & SDIF_STATUS_DMA_REQ_MASK) | ||
8816 | /*! @} */ | ||
8817 | |||
8818 | /*! @name FIFOTH - FIFO Threshold Watermark register */ | ||
8819 | /*! @{ */ | ||
8820 | #define SDIF_FIFOTH_TX_WMARK_MASK (0xFFFU) | ||
8821 | #define SDIF_FIFOTH_TX_WMARK_SHIFT (0U) | ||
8822 | /*! TX_WMARK - FIFO threshold watermark level when transmitting data to card. | ||
8823 | */ | ||
8824 | #define SDIF_FIFOTH_TX_WMARK(x) (((uint32_t)(((uint32_t)(x)) << SDIF_FIFOTH_TX_WMARK_SHIFT)) & SDIF_FIFOTH_TX_WMARK_MASK) | ||
8825 | #define SDIF_FIFOTH_RX_WMARK_MASK (0xFFF0000U) | ||
8826 | #define SDIF_FIFOTH_RX_WMARK_SHIFT (16U) | ||
8827 | /*! RX_WMARK - FIFO threshold watermark level when receiving data to card. | ||
8828 | */ | ||
8829 | #define SDIF_FIFOTH_RX_WMARK(x) (((uint32_t)(((uint32_t)(x)) << SDIF_FIFOTH_RX_WMARK_SHIFT)) & SDIF_FIFOTH_RX_WMARK_MASK) | ||
8830 | #define SDIF_FIFOTH_DMA_MTS_MASK (0x70000000U) | ||
8831 | #define SDIF_FIFOTH_DMA_MTS_SHIFT (28U) | ||
8832 | /*! DMA_MTS - Burst size of multiple transaction; should be programmed same as DW-DMA controller | ||
8833 | * multiple-transaction-size SRC/DEST_MSIZE. | ||
8834 | */ | ||
8835 | #define SDIF_FIFOTH_DMA_MTS(x) (((uint32_t)(((uint32_t)(x)) << SDIF_FIFOTH_DMA_MTS_SHIFT)) & SDIF_FIFOTH_DMA_MTS_MASK) | ||
8836 | /*! @} */ | ||
8837 | |||
8838 | /*! @name CDETECT - Card Detect register */ | ||
8839 | /*! @{ */ | ||
8840 | #define SDIF_CDETECT_CARD_DETECT_MASK (0x1U) | ||
8841 | #define SDIF_CDETECT_CARD_DETECT_SHIFT (0U) | ||
8842 | /*! CARD_DETECT - Card detect. | ||
8843 | */ | ||
8844 | #define SDIF_CDETECT_CARD_DETECT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CDETECT_CARD_DETECT_SHIFT)) & SDIF_CDETECT_CARD_DETECT_MASK) | ||
8845 | /*! @} */ | ||
8846 | |||
8847 | /*! @name WRTPRT - Write Protect register */ | ||
8848 | /*! @{ */ | ||
8849 | #define SDIF_WRTPRT_WRITE_PROTECT_MASK (0x1U) | ||
8850 | #define SDIF_WRTPRT_WRITE_PROTECT_SHIFT (0U) | ||
8851 | /*! WRITE_PROTECT - Write protect. | ||
8852 | */ | ||
8853 | #define SDIF_WRTPRT_WRITE_PROTECT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_WRTPRT_WRITE_PROTECT_SHIFT)) & SDIF_WRTPRT_WRITE_PROTECT_MASK) | ||
8854 | /*! @} */ | ||
8855 | |||
8856 | /*! @name TCBCNT - Transferred CIU Card Byte Count register */ | ||
8857 | /*! @{ */ | ||
8858 | #define SDIF_TCBCNT_TRANS_CARD_BYTE_COUNT_MASK (0xFFFFFFFFU) | ||
8859 | #define SDIF_TCBCNT_TRANS_CARD_BYTE_COUNT_SHIFT (0U) | ||
8860 | /*! TRANS_CARD_BYTE_COUNT - Number of bytes transferred by CIU unit to card. | ||
8861 | */ | ||
8862 | #define SDIF_TCBCNT_TRANS_CARD_BYTE_COUNT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_TCBCNT_TRANS_CARD_BYTE_COUNT_SHIFT)) & SDIF_TCBCNT_TRANS_CARD_BYTE_COUNT_MASK) | ||
8863 | /*! @} */ | ||
8864 | |||
8865 | /*! @name TBBCNT - Transferred Host to BIU-FIFO Byte Count register */ | ||
8866 | /*! @{ */ | ||
8867 | #define SDIF_TBBCNT_TRANS_FIFO_BYTE_COUNT_MASK (0xFFFFFFFFU) | ||
8868 | #define SDIF_TBBCNT_TRANS_FIFO_BYTE_COUNT_SHIFT (0U) | ||
8869 | /*! TRANS_FIFO_BYTE_COUNT - Number of bytes transferred between Host/DMA memory and BIU FIFO. | ||
8870 | */ | ||
8871 | #define SDIF_TBBCNT_TRANS_FIFO_BYTE_COUNT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_TBBCNT_TRANS_FIFO_BYTE_COUNT_SHIFT)) & SDIF_TBBCNT_TRANS_FIFO_BYTE_COUNT_MASK) | ||
8872 | /*! @} */ | ||
8873 | |||
8874 | /*! @name DEBNCE - Debounce Count register */ | ||
8875 | /*! @{ */ | ||
8876 | #define SDIF_DEBNCE_DEBOUNCE_COUNT_MASK (0xFFFFFFU) | ||
8877 | #define SDIF_DEBNCE_DEBOUNCE_COUNT_SHIFT (0U) | ||
8878 | /*! DEBOUNCE_COUNT - Number of host clocks (SD_CLK) used by debounce filter logic for card detect; typical debounce time is 5-25 ms. | ||
8879 | */ | ||
8880 | #define SDIF_DEBNCE_DEBOUNCE_COUNT(x) (((uint32_t)(((uint32_t)(x)) << SDIF_DEBNCE_DEBOUNCE_COUNT_SHIFT)) & SDIF_DEBNCE_DEBOUNCE_COUNT_MASK) | ||
8881 | /*! @} */ | ||
8882 | |||
8883 | /*! @name RST_N - Hardware Reset */ | ||
8884 | /*! @{ */ | ||
8885 | #define SDIF_RST_N_CARD_RESET_MASK (0x1U) | ||
8886 | #define SDIF_RST_N_CARD_RESET_SHIFT (0U) | ||
8887 | /*! CARD_RESET - Hardware reset. | ||
8888 | */ | ||
8889 | #define SDIF_RST_N_CARD_RESET(x) (((uint32_t)(((uint32_t)(x)) << SDIF_RST_N_CARD_RESET_SHIFT)) & SDIF_RST_N_CARD_RESET_MASK) | ||
8890 | /*! @} */ | ||
8891 | |||
8892 | /*! @name BMOD - Bus Mode register */ | ||
8893 | /*! @{ */ | ||
8894 | #define SDIF_BMOD_SWR_MASK (0x1U) | ||
8895 | #define SDIF_BMOD_SWR_SHIFT (0U) | ||
8896 | /*! SWR - Software Reset. | ||
8897 | */ | ||
8898 | #define SDIF_BMOD_SWR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BMOD_SWR_SHIFT)) & SDIF_BMOD_SWR_MASK) | ||
8899 | #define SDIF_BMOD_FB_MASK (0x2U) | ||
8900 | #define SDIF_BMOD_FB_SHIFT (1U) | ||
8901 | /*! FB - Fixed Burst. | ||
8902 | */ | ||
8903 | #define SDIF_BMOD_FB(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BMOD_FB_SHIFT)) & SDIF_BMOD_FB_MASK) | ||
8904 | #define SDIF_BMOD_DSL_MASK (0x7CU) | ||
8905 | #define SDIF_BMOD_DSL_SHIFT (2U) | ||
8906 | /*! DSL - Descriptor Skip Length. | ||
8907 | */ | ||
8908 | #define SDIF_BMOD_DSL(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BMOD_DSL_SHIFT)) & SDIF_BMOD_DSL_MASK) | ||
8909 | #define SDIF_BMOD_DE_MASK (0x80U) | ||
8910 | #define SDIF_BMOD_DE_SHIFT (7U) | ||
8911 | /*! DE - SD/MMC DMA Enable. | ||
8912 | */ | ||
8913 | #define SDIF_BMOD_DE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BMOD_DE_SHIFT)) & SDIF_BMOD_DE_MASK) | ||
8914 | #define SDIF_BMOD_PBL_MASK (0x700U) | ||
8915 | #define SDIF_BMOD_PBL_SHIFT (8U) | ||
8916 | /*! PBL - Programmable Burst Length. | ||
8917 | */ | ||
8918 | #define SDIF_BMOD_PBL(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BMOD_PBL_SHIFT)) & SDIF_BMOD_PBL_MASK) | ||
8919 | /*! @} */ | ||
8920 | |||
8921 | /*! @name PLDMND - Poll Demand register */ | ||
8922 | /*! @{ */ | ||
8923 | #define SDIF_PLDMND_PD_MASK (0xFFFFFFFFU) | ||
8924 | #define SDIF_PLDMND_PD_SHIFT (0U) | ||
8925 | /*! PD - Poll Demand. | ||
8926 | */ | ||
8927 | #define SDIF_PLDMND_PD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_PLDMND_PD_SHIFT)) & SDIF_PLDMND_PD_MASK) | ||
8928 | /*! @} */ | ||
8929 | |||
8930 | /*! @name DBADDR - Descriptor List Base Address register */ | ||
8931 | /*! @{ */ | ||
8932 | #define SDIF_DBADDR_SDL_MASK (0xFFFFFFFFU) | ||
8933 | #define SDIF_DBADDR_SDL_SHIFT (0U) | ||
8934 | /*! SDL - Start of Descriptor List. | ||
8935 | */ | ||
8936 | #define SDIF_DBADDR_SDL(x) (((uint32_t)(((uint32_t)(x)) << SDIF_DBADDR_SDL_SHIFT)) & SDIF_DBADDR_SDL_MASK) | ||
8937 | /*! @} */ | ||
8938 | |||
8939 | /*! @name IDSTS - Internal DMAC Status register */ | ||
8940 | /*! @{ */ | ||
8941 | #define SDIF_IDSTS_TI_MASK (0x1U) | ||
8942 | #define SDIF_IDSTS_TI_SHIFT (0U) | ||
8943 | /*! TI - Transmit Interrupt. | ||
8944 | */ | ||
8945 | #define SDIF_IDSTS_TI(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_TI_SHIFT)) & SDIF_IDSTS_TI_MASK) | ||
8946 | #define SDIF_IDSTS_RI_MASK (0x2U) | ||
8947 | #define SDIF_IDSTS_RI_SHIFT (1U) | ||
8948 | /*! RI - Receive Interrupt. | ||
8949 | */ | ||
8950 | #define SDIF_IDSTS_RI(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_RI_SHIFT)) & SDIF_IDSTS_RI_MASK) | ||
8951 | #define SDIF_IDSTS_FBE_MASK (0x4U) | ||
8952 | #define SDIF_IDSTS_FBE_SHIFT (2U) | ||
8953 | /*! FBE - Fatal Bus Error Interrupt. | ||
8954 | */ | ||
8955 | #define SDIF_IDSTS_FBE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_FBE_SHIFT)) & SDIF_IDSTS_FBE_MASK) | ||
8956 | #define SDIF_IDSTS_DU_MASK (0x10U) | ||
8957 | #define SDIF_IDSTS_DU_SHIFT (4U) | ||
8958 | /*! DU - Descriptor Unavailable Interrupt. | ||
8959 | */ | ||
8960 | #define SDIF_IDSTS_DU(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_DU_SHIFT)) & SDIF_IDSTS_DU_MASK) | ||
8961 | #define SDIF_IDSTS_CES_MASK (0x20U) | ||
8962 | #define SDIF_IDSTS_CES_SHIFT (5U) | ||
8963 | /*! CES - Card Error Summary. | ||
8964 | */ | ||
8965 | #define SDIF_IDSTS_CES(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_CES_SHIFT)) & SDIF_IDSTS_CES_MASK) | ||
8966 | #define SDIF_IDSTS_NIS_MASK (0x100U) | ||
8967 | #define SDIF_IDSTS_NIS_SHIFT (8U) | ||
8968 | /*! NIS - Normal Interrupt Summary. | ||
8969 | */ | ||
8970 | #define SDIF_IDSTS_NIS(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_NIS_SHIFT)) & SDIF_IDSTS_NIS_MASK) | ||
8971 | #define SDIF_IDSTS_AIS_MASK (0x200U) | ||
8972 | #define SDIF_IDSTS_AIS_SHIFT (9U) | ||
8973 | /*! AIS - Abnormal Interrupt Summary. | ||
8974 | */ | ||
8975 | #define SDIF_IDSTS_AIS(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_AIS_SHIFT)) & SDIF_IDSTS_AIS_MASK) | ||
8976 | #define SDIF_IDSTS_EB_MASK (0x1C00U) | ||
8977 | #define SDIF_IDSTS_EB_SHIFT (10U) | ||
8978 | /*! EB - Error Bits. | ||
8979 | */ | ||
8980 | #define SDIF_IDSTS_EB(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_EB_SHIFT)) & SDIF_IDSTS_EB_MASK) | ||
8981 | #define SDIF_IDSTS_FSM_MASK (0x1E000U) | ||
8982 | #define SDIF_IDSTS_FSM_SHIFT (13U) | ||
8983 | /*! FSM - DMAC state machine present state. | ||
8984 | */ | ||
8985 | #define SDIF_IDSTS_FSM(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDSTS_FSM_SHIFT)) & SDIF_IDSTS_FSM_MASK) | ||
8986 | /*! @} */ | ||
8987 | |||
8988 | /*! @name IDINTEN - Internal DMAC Interrupt Enable register */ | ||
8989 | /*! @{ */ | ||
8990 | #define SDIF_IDINTEN_TI_MASK (0x1U) | ||
8991 | #define SDIF_IDINTEN_TI_SHIFT (0U) | ||
8992 | /*! TI - Transmit Interrupt Enable. | ||
8993 | */ | ||
8994 | #define SDIF_IDINTEN_TI(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDINTEN_TI_SHIFT)) & SDIF_IDINTEN_TI_MASK) | ||
8995 | #define SDIF_IDINTEN_RI_MASK (0x2U) | ||
8996 | #define SDIF_IDINTEN_RI_SHIFT (1U) | ||
8997 | /*! RI - Receive Interrupt Enable. | ||
8998 | */ | ||
8999 | #define SDIF_IDINTEN_RI(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDINTEN_RI_SHIFT)) & SDIF_IDINTEN_RI_MASK) | ||
9000 | #define SDIF_IDINTEN_FBE_MASK (0x4U) | ||
9001 | #define SDIF_IDINTEN_FBE_SHIFT (2U) | ||
9002 | /*! FBE - Fatal Bus Error Enable. | ||
9003 | */ | ||
9004 | #define SDIF_IDINTEN_FBE(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDINTEN_FBE_SHIFT)) & SDIF_IDINTEN_FBE_MASK) | ||
9005 | #define SDIF_IDINTEN_DU_MASK (0x10U) | ||
9006 | #define SDIF_IDINTEN_DU_SHIFT (4U) | ||
9007 | /*! DU - Descriptor Unavailable Interrupt. | ||
9008 | */ | ||
9009 | #define SDIF_IDINTEN_DU(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDINTEN_DU_SHIFT)) & SDIF_IDINTEN_DU_MASK) | ||
9010 | #define SDIF_IDINTEN_CES_MASK (0x20U) | ||
9011 | #define SDIF_IDINTEN_CES_SHIFT (5U) | ||
9012 | /*! CES - Card Error summary Interrupt Enable. | ||
9013 | */ | ||
9014 | #define SDIF_IDINTEN_CES(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDINTEN_CES_SHIFT)) & SDIF_IDINTEN_CES_MASK) | ||
9015 | #define SDIF_IDINTEN_NIS_MASK (0x100U) | ||
9016 | #define SDIF_IDINTEN_NIS_SHIFT (8U) | ||
9017 | /*! NIS - Normal Interrupt Summary Enable. | ||
9018 | */ | ||
9019 | #define SDIF_IDINTEN_NIS(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDINTEN_NIS_SHIFT)) & SDIF_IDINTEN_NIS_MASK) | ||
9020 | #define SDIF_IDINTEN_AIS_MASK (0x200U) | ||
9021 | #define SDIF_IDINTEN_AIS_SHIFT (9U) | ||
9022 | /*! AIS - Abnormal Interrupt Summary Enable. | ||
9023 | */ | ||
9024 | #define SDIF_IDINTEN_AIS(x) (((uint32_t)(((uint32_t)(x)) << SDIF_IDINTEN_AIS_SHIFT)) & SDIF_IDINTEN_AIS_MASK) | ||
9025 | /*! @} */ | ||
9026 | |||
9027 | /*! @name DSCADDR - Current Host Descriptor Address register */ | ||
9028 | /*! @{ */ | ||
9029 | #define SDIF_DSCADDR_HDA_MASK (0xFFFFFFFFU) | ||
9030 | #define SDIF_DSCADDR_HDA_SHIFT (0U) | ||
9031 | /*! HDA - Host Descriptor Address Pointer. | ||
9032 | */ | ||
9033 | #define SDIF_DSCADDR_HDA(x) (((uint32_t)(((uint32_t)(x)) << SDIF_DSCADDR_HDA_SHIFT)) & SDIF_DSCADDR_HDA_MASK) | ||
9034 | /*! @} */ | ||
9035 | |||
9036 | /*! @name BUFADDR - Current Buffer Descriptor Address register */ | ||
9037 | /*! @{ */ | ||
9038 | #define SDIF_BUFADDR_HBA_MASK (0xFFFFFFFFU) | ||
9039 | #define SDIF_BUFADDR_HBA_SHIFT (0U) | ||
9040 | /*! HBA - Host Buffer Address Pointer. | ||
9041 | */ | ||
9042 | #define SDIF_BUFADDR_HBA(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BUFADDR_HBA_SHIFT)) & SDIF_BUFADDR_HBA_MASK) | ||
9043 | /*! @} */ | ||
9044 | |||
9045 | /*! @name CARDTHRCTL - Card Threshold Control */ | ||
9046 | /*! @{ */ | ||
9047 | #define SDIF_CARDTHRCTL_CARDRDTHREN_MASK (0x1U) | ||
9048 | #define SDIF_CARDTHRCTL_CARDRDTHREN_SHIFT (0U) | ||
9049 | /*! CARDRDTHREN - Card Read Threshold Enable. | ||
9050 | */ | ||
9051 | #define SDIF_CARDTHRCTL_CARDRDTHREN(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CARDTHRCTL_CARDRDTHREN_SHIFT)) & SDIF_CARDTHRCTL_CARDRDTHREN_MASK) | ||
9052 | #define SDIF_CARDTHRCTL_BSYCLRINTEN_MASK (0x2U) | ||
9053 | #define SDIF_CARDTHRCTL_BSYCLRINTEN_SHIFT (1U) | ||
9054 | /*! BSYCLRINTEN - Busy Clear Interrupt Enable. | ||
9055 | */ | ||
9056 | #define SDIF_CARDTHRCTL_BSYCLRINTEN(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CARDTHRCTL_BSYCLRINTEN_SHIFT)) & SDIF_CARDTHRCTL_BSYCLRINTEN_MASK) | ||
9057 | #define SDIF_CARDTHRCTL_CARDTHRESHOLD_MASK (0xFF0000U) | ||
9058 | #define SDIF_CARDTHRCTL_CARDTHRESHOLD_SHIFT (16U) | ||
9059 | /*! CARDTHRESHOLD - Card Threshold size. | ||
9060 | */ | ||
9061 | #define SDIF_CARDTHRCTL_CARDTHRESHOLD(x) (((uint32_t)(((uint32_t)(x)) << SDIF_CARDTHRCTL_CARDTHRESHOLD_SHIFT)) & SDIF_CARDTHRCTL_CARDTHRESHOLD_MASK) | ||
9062 | /*! @} */ | ||
9063 | |||
9064 | /*! @name BACKENDPWR - Power control */ | ||
9065 | /*! @{ */ | ||
9066 | #define SDIF_BACKENDPWR_BACKENDPWR_MASK (0x1U) | ||
9067 | #define SDIF_BACKENDPWR_BACKENDPWR_SHIFT (0U) | ||
9068 | /*! BACKENDPWR - Back-end Power control for card application. | ||
9069 | */ | ||
9070 | #define SDIF_BACKENDPWR_BACKENDPWR(x) (((uint32_t)(((uint32_t)(x)) << SDIF_BACKENDPWR_BACKENDPWR_SHIFT)) & SDIF_BACKENDPWR_BACKENDPWR_MASK) | ||
9071 | /*! @} */ | ||
9072 | |||
9073 | /*! @name FIFO - SDIF FIFO */ | ||
9074 | /*! @{ */ | ||
9075 | #define SDIF_FIFO_DATA_MASK (0xFFFFFFFFU) | ||
9076 | #define SDIF_FIFO_DATA_SHIFT (0U) | ||
9077 | /*! DATA - SDIF FIFO. | ||
9078 | */ | ||
9079 | #define SDIF_FIFO_DATA(x) (((uint32_t)(((uint32_t)(x)) << SDIF_FIFO_DATA_SHIFT)) & SDIF_FIFO_DATA_MASK) | ||
9080 | /*! @} */ | ||
9081 | |||
9082 | /* The count of SDIF_FIFO */ | ||
9083 | #define SDIF_FIFO_COUNT (64U) | ||
9084 | |||
9085 | |||
9086 | /*! | ||
9087 | * @} | ||
9088 | */ /* end of group SDIF_Register_Masks */ | ||
9089 | |||
9090 | |||
9091 | /* SDIF - Peripheral instance base addresses */ | ||
9092 | /** Peripheral SDIF base address */ | ||
9093 | #define SDIF_BASE (0x4009B000u) | ||
9094 | /** Peripheral SDIF base pointer */ | ||
9095 | #define SDIF ((SDIF_Type *)SDIF_BASE) | ||
9096 | /** Array initializer of SDIF peripheral base addresses */ | ||
9097 | #define SDIF_BASE_ADDRS { SDIF_BASE } | ||
9098 | /** Array initializer of SDIF peripheral base pointers */ | ||
9099 | #define SDIF_BASE_PTRS { SDIF } | ||
9100 | /** Interrupt vectors for the SDIF peripheral type */ | ||
9101 | #define SDIF_IRQS { SDIO_IRQn } | ||
9102 | |||
9103 | /*! | ||
9104 | * @} | ||
9105 | */ /* end of group SDIF_Peripheral_Access_Layer */ | ||
9106 | |||
9107 | |||
9108 | /* ---------------------------------------------------------------------------- | ||
9109 | -- SHA Peripheral Access Layer | ||
9110 | ---------------------------------------------------------------------------- */ | ||
9111 | |||
9112 | /*! | ||
9113 | * @addtogroup SHA_Peripheral_Access_Layer SHA Peripheral Access Layer | ||
9114 | * @{ | ||
9115 | */ | ||
9116 | |||
9117 | /** SHA - Register Layout Typedef */ | ||
9118 | typedef struct { | ||
9119 | __IO uint32_t CTRL; /**< Control register, offset: 0x0 */ | ||
9120 | __IO uint32_t STATUS; /**< Status register, offset: 0x4 */ | ||
9121 | __IO uint32_t INTENSET; /**< Interrupt Enable register, offset: 0x8 */ | ||
9122 | __O uint32_t INTENCLR; /**< Interrupt Clear register, offset: 0xC */ | ||
9123 | __IO uint32_t MEMCTRL; /**< Memory Control register, offset: 0x10 */ | ||
9124 | __IO uint32_t MEMADDR; /**< Memory Address register, offset: 0x14 */ | ||
9125 | uint8_t RESERVED_0[8]; | ||
9126 | __O uint32_t INDATA; /**< Input Data register, offset: 0x20 */ | ||
9127 | __O uint32_t ALIAS[7]; /**< Alias register, array offset: 0x24, array step: 0x4 */ | ||
9128 | __I uint32_t DIGEST[8]; /**< Digest register, array offset: 0x40, array step: 0x4 */ | ||
9129 | } SHA_Type; | ||
9130 | |||
9131 | /* ---------------------------------------------------------------------------- | ||
9132 | -- SHA Register Masks | ||
9133 | ---------------------------------------------------------------------------- */ | ||
9134 | |||
9135 | /*! | ||
9136 | * @addtogroup SHA_Register_Masks SHA Register Masks | ||
9137 | * @{ | ||
9138 | */ | ||
9139 | |||
9140 | /*! @name CTRL - Control register */ | ||
9141 | /*! @{ */ | ||
9142 | #define SHA_CTRL_MODE_MASK (0x3U) | ||
9143 | #define SHA_CTRL_MODE_SHIFT (0U) | ||
9144 | /*! MODE - This field is used to select the operational mode of SHA block. | ||
9145 | */ | ||
9146 | #define SHA_CTRL_MODE(x) (((uint32_t)(((uint32_t)(x)) << SHA_CTRL_MODE_SHIFT)) & SHA_CTRL_MODE_MASK) | ||
9147 | #define SHA_CTRL_NEW_MASK (0x10U) | ||
9148 | #define SHA_CTRL_NEW_SHIFT (4U) | ||
9149 | /*! NEW - When this bit is set, a new hash operation is started. | ||
9150 | */ | ||
9151 | #define SHA_CTRL_NEW(x) (((uint32_t)(((uint32_t)(x)) << SHA_CTRL_NEW_SHIFT)) & SHA_CTRL_NEW_MASK) | ||
9152 | #define SHA_CTRL_DMA_MASK (0x100U) | ||
9153 | #define SHA_CTRL_DMA_SHIFT (8U) | ||
9154 | /*! DMA - When this bit is set, the DMA is used to fill INDATA. | ||
9155 | */ | ||
9156 | #define SHA_CTRL_DMA(x) (((uint32_t)(((uint32_t)(x)) << SHA_CTRL_DMA_SHIFT)) & SHA_CTRL_DMA_MASK) | ||
9157 | /*! @} */ | ||
9158 | |||
9159 | /*! @name STATUS - Status register */ | ||
9160 | /*! @{ */ | ||
9161 | #define SHA_STATUS_WAITING_MASK (0x1U) | ||
9162 | #define SHA_STATUS_WAITING_SHIFT (0U) | ||
9163 | /*! WAITING - This field indicates if the block is waiting for more data to process. | ||
9164 | */ | ||
9165 | #define SHA_STATUS_WAITING(x) (((uint32_t)(((uint32_t)(x)) << SHA_STATUS_WAITING_SHIFT)) & SHA_STATUS_WAITING_MASK) | ||
9166 | #define SHA_STATUS_DIGEST_MASK (0x2U) | ||
9167 | #define SHA_STATUS_DIGEST_SHIFT (1U) | ||
9168 | /*! DIGEST - This field indicates if a DIGEST is ready and waiting and there is no active next block that has already started. | ||
9169 | */ | ||
9170 | #define SHA_STATUS_DIGEST(x) (((uint32_t)(((uint32_t)(x)) << SHA_STATUS_DIGEST_SHIFT)) & SHA_STATUS_DIGEST_MASK) | ||
9171 | #define SHA_STATUS_ERROR_MASK (0x4U) | ||
9172 | #define SHA_STATUS_ERROR_SHIFT (2U) | ||
9173 | /*! ERROR - This field indicates if an error has occurred. | ||
9174 | */ | ||
9175 | #define SHA_STATUS_ERROR(x) (((uint32_t)(((uint32_t)(x)) << SHA_STATUS_ERROR_SHIFT)) & SHA_STATUS_ERROR_MASK) | ||
9176 | /*! @} */ | ||
9177 | |||
9178 | /*! @name INTENSET - Interrupt Enable register */ | ||
9179 | /*! @{ */ | ||
9180 | #define SHA_INTENSET_WAITING_MASK (0x1U) | ||
9181 | #define SHA_INTENSET_WAITING_SHIFT (0U) | ||
9182 | /*! WAITING - This field indicates if interrupt should be enabled when waiting for input data. | ||
9183 | */ | ||
9184 | #define SHA_INTENSET_WAITING(x) (((uint32_t)(((uint32_t)(x)) << SHA_INTENSET_WAITING_SHIFT)) & SHA_INTENSET_WAITING_MASK) | ||
9185 | #define SHA_INTENSET_DIGEST_MASK (0x2U) | ||
9186 | #define SHA_INTENSET_DIGEST_SHIFT (1U) | ||
9187 | /*! DIGEST - This field indicates if interrupt is generated when Digest is ready (completed a Hash or completed a full sequence). | ||
9188 | */ | ||
9189 | #define SHA_INTENSET_DIGEST(x) (((uint32_t)(((uint32_t)(x)) << SHA_INTENSET_DIGEST_SHIFT)) & SHA_INTENSET_DIGEST_MASK) | ||
9190 | #define SHA_INTENSET_ERROR_MASK (0x4U) | ||
9191 | #define SHA_INTENSET_ERROR_SHIFT (2U) | ||
9192 | /*! ERROR - This field indicates if interrupt is generated on an ERROR (as defined in STAT register). | ||
9193 | */ | ||
9194 | #define SHA_INTENSET_ERROR(x) (((uint32_t)(((uint32_t)(x)) << SHA_INTENSET_ERROR_SHIFT)) & SHA_INTENSET_ERROR_MASK) | ||
9195 | /*! @} */ | ||
9196 | |||
9197 | /*! @name INTENCLR - Interrupt Clear register */ | ||
9198 | /*! @{ */ | ||
9199 | #define SHA_INTENCLR_WAITING_MASK (0x1U) | ||
9200 | #define SHA_INTENCLR_WAITING_SHIFT (0U) | ||
9201 | /*! WAITING - Writing a 1 clears the interrupt enabled by the INTENSET register. | ||
9202 | */ | ||
9203 | #define SHA_INTENCLR_WAITING(x) (((uint32_t)(((uint32_t)(x)) << SHA_INTENCLR_WAITING_SHIFT)) & SHA_INTENCLR_WAITING_MASK) | ||
9204 | #define SHA_INTENCLR_DIGEST_MASK (0x2U) | ||
9205 | #define SHA_INTENCLR_DIGEST_SHIFT (1U) | ||
9206 | /*! DIGEST - Writing a 1 clears the interrupt enabled by the INTENSET register. | ||
9207 | */ | ||
9208 | #define SHA_INTENCLR_DIGEST(x) (((uint32_t)(((uint32_t)(x)) << SHA_INTENCLR_DIGEST_SHIFT)) & SHA_INTENCLR_DIGEST_MASK) | ||
9209 | #define SHA_INTENCLR_ERROR_MASK (0x4U) | ||
9210 | #define SHA_INTENCLR_ERROR_SHIFT (2U) | ||
9211 | /*! ERROR - Writing a 1 clears the interrupt enabled by the INTENSET register. | ||
9212 | */ | ||
9213 | #define SHA_INTENCLR_ERROR(x) (((uint32_t)(((uint32_t)(x)) << SHA_INTENCLR_ERROR_SHIFT)) & SHA_INTENCLR_ERROR_MASK) | ||
9214 | /*! @} */ | ||
9215 | |||
9216 | /*! @name MEMCTRL - Memory Control register */ | ||
9217 | /*! @{ */ | ||
9218 | #define SHA_MEMCTRL_MASTER_MASK (0x1U) | ||
9219 | #define SHA_MEMCTRL_MASTER_SHIFT (0U) | ||
9220 | /*! MASTER - This field is used to enable SHA block as AHB bus master. | ||
9221 | */ | ||
9222 | #define SHA_MEMCTRL_MASTER(x) (((uint32_t)(((uint32_t)(x)) << SHA_MEMCTRL_MASTER_SHIFT)) & SHA_MEMCTRL_MASTER_MASK) | ||
9223 | #define SHA_MEMCTRL_COUNT_MASK (0x7FF0000U) | ||
9224 | #define SHA_MEMCTRL_COUNT_SHIFT (16U) | ||
9225 | /*! COUNT - This field indicates the number of 512-bit blocks to copy starting at MEMADDR. | ||
9226 | */ | ||
9227 | #define SHA_MEMCTRL_COUNT(x) (((uint32_t)(((uint32_t)(x)) << SHA_MEMCTRL_COUNT_SHIFT)) & SHA_MEMCTRL_COUNT_MASK) | ||
9228 | /*! @} */ | ||
9229 | |||
9230 | /*! @name MEMADDR - Memory Address register */ | ||
9231 | /*! @{ */ | ||
9232 | #define SHA_MEMADDR_BASEADDR_MASK (0xFFFFFFFFU) | ||
9233 | #define SHA_MEMADDR_BASEADDR_SHIFT (0U) | ||
9234 | /*! BASEADDR - This field indicates the base address in Internal Flash, SRAM0, SRAMX, or SPIFI to start copying from. | ||
9235 | */ | ||
9236 | #define SHA_MEMADDR_BASEADDR(x) (((uint32_t)(((uint32_t)(x)) << SHA_MEMADDR_BASEADDR_SHIFT)) & SHA_MEMADDR_BASEADDR_MASK) | ||
9237 | /*! @} */ | ||
9238 | |||
9239 | /*! @name INDATA - Input Data register */ | ||
9240 | /*! @{ */ | ||
9241 | #define SHA_INDATA_DATA_MASK (0xFFFFFFFFU) | ||
9242 | #define SHA_INDATA_DATA_SHIFT (0U) | ||
9243 | /*! DATA - In this field the next word is written in little-endian format. | ||
9244 | */ | ||
9245 | #define SHA_INDATA_DATA(x) (((uint32_t)(((uint32_t)(x)) << SHA_INDATA_DATA_SHIFT)) & SHA_INDATA_DATA_MASK) | ||
9246 | /*! @} */ | ||
9247 | |||
9248 | /*! @name ALIAS - Alias register */ | ||
9249 | /*! @{ */ | ||
9250 | #define SHA_ALIAS_DATA_MASK (0xFFFFFFFFU) | ||
9251 | #define SHA_ALIAS_DATA_SHIFT (0U) | ||
9252 | /*! DATA - In this field the next word is written in little-endian format. | ||
9253 | */ | ||
9254 | #define SHA_ALIAS_DATA(x) (((uint32_t)(((uint32_t)(x)) << SHA_ALIAS_DATA_SHIFT)) & SHA_ALIAS_DATA_MASK) | ||
9255 | /*! @} */ | ||
9256 | |||
9257 | /* The count of SHA_ALIAS */ | ||
9258 | #define SHA_ALIAS_COUNT (7U) | ||
9259 | |||
9260 | /*! @name DIGEST - Digest register */ | ||
9261 | /*! @{ */ | ||
9262 | #define SHA_DIGEST_DIGEST_MASK (0xFFFFFFFFU) | ||
9263 | #define SHA_DIGEST_DIGEST_SHIFT (0U) | ||
9264 | /*! DIGEST - This field contains one word of the Digest. | ||
9265 | */ | ||
9266 | #define SHA_DIGEST_DIGEST(x) (((uint32_t)(((uint32_t)(x)) << SHA_DIGEST_DIGEST_SHIFT)) & SHA_DIGEST_DIGEST_MASK) | ||
9267 | /*! @} */ | ||
9268 | |||
9269 | /* The count of SHA_DIGEST */ | ||
9270 | #define SHA_DIGEST_COUNT (8U) | ||
9271 | |||
9272 | |||
9273 | /*! | ||
9274 | * @} | ||
9275 | */ /* end of group SHA_Register_Masks */ | ||
9276 | |||
9277 | |||
9278 | /* SHA - Peripheral instance base addresses */ | ||
9279 | /** Peripheral SHA0 base address */ | ||
9280 | #define SHA0_BASE (0x400A4000u) | ||
9281 | /** Peripheral SHA0 base pointer */ | ||
9282 | #define SHA0 ((SHA_Type *)SHA0_BASE) | ||
9283 | /** Array initializer of SHA peripheral base addresses */ | ||
9284 | #define SHA_BASE_ADDRS { SHA0_BASE } | ||
9285 | /** Array initializer of SHA peripheral base pointers */ | ||
9286 | #define SHA_BASE_PTRS { SHA0 } | ||
9287 | |||
9288 | /*! | ||
9289 | * @} | ||
9290 | */ /* end of group SHA_Peripheral_Access_Layer */ | ||
9291 | |||
9292 | |||
9293 | /* ---------------------------------------------------------------------------- | ||
9294 | -- SMARTCARD Peripheral Access Layer | ||
9295 | ---------------------------------------------------------------------------- */ | ||
9296 | |||
9297 | /*! | ||
9298 | * @addtogroup SMARTCARD_Peripheral_Access_Layer SMARTCARD Peripheral Access Layer | ||
9299 | * @{ | ||
9300 | */ | ||
9301 | |||
9302 | /** SMARTCARD - Register Layout Typedef */ | ||
9303 | typedef struct { | ||
9304 | union { /* offset: 0x0 */ | ||
9305 | __IO uint32_t DLL; /**< Divisor Latch LSB, offset: 0x0 */ | ||
9306 | __I uint32_t RBR; /**< Receiver Buffer Register, offset: 0x0 */ | ||
9307 | __O uint32_t THR; /**< Transmit Holding Register, offset: 0x0 */ | ||
9308 | }; | ||
9309 | union { /* offset: 0x4 */ | ||
9310 | __IO uint32_t DLM; /**< Divisor Latch MSB, offset: 0x4 */ | ||
9311 | __IO uint32_t IER; /**< Interrupt Enable Register, offset: 0x4 */ | ||
9312 | }; | ||
9313 | union { /* offset: 0x8 */ | ||
9314 | __O uint32_t FCR; /**< FIFO Control Register, offset: 0x8 */ | ||
9315 | __I uint32_t IIR; /**< Interrupt ID Register, offset: 0x8 */ | ||
9316 | }; | ||
9317 | __IO uint32_t LCR; /**< Line Control Register, offset: 0xC */ | ||
9318 | uint8_t RESERVED_0[4]; | ||
9319 | __I uint32_t LSR; /**< Line Status Register, offset: 0x14 */ | ||
9320 | uint8_t RESERVED_1[4]; | ||
9321 | __IO uint32_t SCR; /**< Scratch Pad Register, offset: 0x1C */ | ||
9322 | uint8_t RESERVED_2[12]; | ||
9323 | __IO uint32_t OSR; /**< Oversampling register, offset: 0x2C */ | ||
9324 | uint8_t RESERVED_3[24]; | ||
9325 | __IO uint32_t SCICTRL; /**< Smart Card Interface control register, offset: 0x48 */ | ||
9326 | } SMARTCARD_Type; | ||
9327 | |||
9328 | /* ---------------------------------------------------------------------------- | ||
9329 | -- SMARTCARD Register Masks | ||
9330 | ---------------------------------------------------------------------------- */ | ||
9331 | |||
9332 | /*! | ||
9333 | * @addtogroup SMARTCARD_Register_Masks SMARTCARD Register Masks | ||
9334 | * @{ | ||
9335 | */ | ||
9336 | |||
9337 | /*! @name DLL - Divisor Latch LSB */ | ||
9338 | /*! @{ */ | ||
9339 | #define SMARTCARD_DLL_DLLSB_MASK (0xFFU) | ||
9340 | #define SMARTCARD_DLL_DLLSB_SHIFT (0U) | ||
9341 | /*! DLLSB - The SCIn Divisor Latch LSB Register, along with the SCInDLM register, determines the baud rate of the SCIn. | ||
9342 | */ | ||
9343 | #define SMARTCARD_DLL_DLLSB(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_DLL_DLLSB_SHIFT)) & SMARTCARD_DLL_DLLSB_MASK) | ||
9344 | /*! @} */ | ||
9345 | |||
9346 | /*! @name RBR - Receiver Buffer Register */ | ||
9347 | /*! @{ */ | ||
9348 | #define SMARTCARD_RBR_RBR_MASK (0xFFU) | ||
9349 | #define SMARTCARD_RBR_RBR_SHIFT (0U) | ||
9350 | /*! RBR - The SCIn Receiver Buffer Register contains the oldest received byte in the SCIn Rx FIFO. | ||
9351 | */ | ||
9352 | #define SMARTCARD_RBR_RBR(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_RBR_RBR_SHIFT)) & SMARTCARD_RBR_RBR_MASK) | ||
9353 | /*! @} */ | ||
9354 | |||
9355 | /*! @name THR - Transmit Holding Register */ | ||
9356 | /*! @{ */ | ||
9357 | #define SMARTCARD_THR_THR_MASK (0xFFU) | ||
9358 | #define SMARTCARD_THR_THR_SHIFT (0U) | ||
9359 | /*! THR - Writing to the SCIn Transmit Holding Register causes the data to be stored in the SCIn transmit FIFO. | ||
9360 | */ | ||
9361 | #define SMARTCARD_THR_THR(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_THR_THR_SHIFT)) & SMARTCARD_THR_THR_MASK) | ||
9362 | /*! @} */ | ||
9363 | |||
9364 | /*! @name DLM - Divisor Latch MSB */ | ||
9365 | /*! @{ */ | ||
9366 | #define SMARTCARD_DLM_DLMSB_MASK (0xFFU) | ||
9367 | #define SMARTCARD_DLM_DLMSB_SHIFT (0U) | ||
9368 | /*! DLMSB - The SCIn Divisor Latch MSB Register, along with the DLL register, determines the baud rate of the SCIn. | ||
9369 | */ | ||
9370 | #define SMARTCARD_DLM_DLMSB(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_DLM_DLMSB_SHIFT)) & SMARTCARD_DLM_DLMSB_MASK) | ||
9371 | /*! @} */ | ||
9372 | |||
9373 | /*! @name IER - Interrupt Enable Register */ | ||
9374 | /*! @{ */ | ||
9375 | #define SMARTCARD_IER_RBRIE_MASK (0x1U) | ||
9376 | #define SMARTCARD_IER_RBRIE_SHIFT (0U) | ||
9377 | /*! RBRIE - RBR Interrupt Enable. | ||
9378 | */ | ||
9379 | #define SMARTCARD_IER_RBRIE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_IER_RBRIE_SHIFT)) & SMARTCARD_IER_RBRIE_MASK) | ||
9380 | #define SMARTCARD_IER_THREIE_MASK (0x2U) | ||
9381 | #define SMARTCARD_IER_THREIE_SHIFT (1U) | ||
9382 | /*! THREIE - THRE Interrupt Enable. | ||
9383 | */ | ||
9384 | #define SMARTCARD_IER_THREIE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_IER_THREIE_SHIFT)) & SMARTCARD_IER_THREIE_MASK) | ||
9385 | #define SMARTCARD_IER_RXIE_MASK (0x4U) | ||
9386 | #define SMARTCARD_IER_RXIE_SHIFT (2U) | ||
9387 | /*! RXIE - RX Line Status Interrupt Enable. | ||
9388 | */ | ||
9389 | #define SMARTCARD_IER_RXIE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_IER_RXIE_SHIFT)) & SMARTCARD_IER_RXIE_MASK) | ||
9390 | /*! @} */ | ||
9391 | |||
9392 | /*! @name FCR - FIFO Control Register */ | ||
9393 | /*! @{ */ | ||
9394 | #define SMARTCARD_FCR_FIFOEN_MASK (0x1U) | ||
9395 | #define SMARTCARD_FCR_FIFOEN_SHIFT (0U) | ||
9396 | /*! FIFOEN - FIFO Enable. | ||
9397 | */ | ||
9398 | #define SMARTCARD_FCR_FIFOEN(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_FCR_FIFOEN_SHIFT)) & SMARTCARD_FCR_FIFOEN_MASK) | ||
9399 | #define SMARTCARD_FCR_RXFIFORES_MASK (0x2U) | ||
9400 | #define SMARTCARD_FCR_RXFIFORES_SHIFT (1U) | ||
9401 | /*! RXFIFORES - RX FIFO Reset. | ||
9402 | */ | ||
9403 | #define SMARTCARD_FCR_RXFIFORES(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_FCR_RXFIFORES_SHIFT)) & SMARTCARD_FCR_RXFIFORES_MASK) | ||
9404 | #define SMARTCARD_FCR_TXFIFORES_MASK (0x4U) | ||
9405 | #define SMARTCARD_FCR_TXFIFORES_SHIFT (2U) | ||
9406 | /*! TXFIFORES - TX FIFO Reset. | ||
9407 | */ | ||
9408 | #define SMARTCARD_FCR_TXFIFORES(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_FCR_TXFIFORES_SHIFT)) & SMARTCARD_FCR_TXFIFORES_MASK) | ||
9409 | #define SMARTCARD_FCR_DMAMODE_MASK (0x8U) | ||
9410 | #define SMARTCARD_FCR_DMAMODE_SHIFT (3U) | ||
9411 | /*! DMAMODE - DMA Mode Select. | ||
9412 | */ | ||
9413 | #define SMARTCARD_FCR_DMAMODE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_FCR_DMAMODE_SHIFT)) & SMARTCARD_FCR_DMAMODE_MASK) | ||
9414 | #define SMARTCARD_FCR_RXTRIGLVL_MASK (0xC0U) | ||
9415 | #define SMARTCARD_FCR_RXTRIGLVL_SHIFT (6U) | ||
9416 | /*! RXTRIGLVL - RX Trigger Level. | ||
9417 | */ | ||
9418 | #define SMARTCARD_FCR_RXTRIGLVL(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_FCR_RXTRIGLVL_SHIFT)) & SMARTCARD_FCR_RXTRIGLVL_MASK) | ||
9419 | /*! @} */ | ||
9420 | |||
9421 | /*! @name IIR - Interrupt ID Register */ | ||
9422 | /*! @{ */ | ||
9423 | #define SMARTCARD_IIR_INTSTATUS_MASK (0x1U) | ||
9424 | #define SMARTCARD_IIR_INTSTATUS_SHIFT (0U) | ||
9425 | /*! INTSTATUS - Interrupt status. | ||
9426 | */ | ||
9427 | #define SMARTCARD_IIR_INTSTATUS(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_IIR_INTSTATUS_SHIFT)) & SMARTCARD_IIR_INTSTATUS_MASK) | ||
9428 | #define SMARTCARD_IIR_INTID_MASK (0xEU) | ||
9429 | #define SMARTCARD_IIR_INTID_SHIFT (1U) | ||
9430 | /*! INTID - Interrupt identification. | ||
9431 | */ | ||
9432 | #define SMARTCARD_IIR_INTID(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_IIR_INTID_SHIFT)) & SMARTCARD_IIR_INTID_MASK) | ||
9433 | #define SMARTCARD_IIR_FIFOENABLE_MASK (0xC0U) | ||
9434 | #define SMARTCARD_IIR_FIFOENABLE_SHIFT (6U) | ||
9435 | /*! FIFOENABLE - Copies of SCInFCR[0]. | ||
9436 | */ | ||
9437 | #define SMARTCARD_IIR_FIFOENABLE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_IIR_FIFOENABLE_SHIFT)) & SMARTCARD_IIR_FIFOENABLE_MASK) | ||
9438 | /*! @} */ | ||
9439 | |||
9440 | /*! @name LCR - Line Control Register */ | ||
9441 | /*! @{ */ | ||
9442 | #define SMARTCARD_LCR_WLS_MASK (0x3U) | ||
9443 | #define SMARTCARD_LCR_WLS_SHIFT (0U) | ||
9444 | /*! WLS - Word Length Select. | ||
9445 | */ | ||
9446 | #define SMARTCARD_LCR_WLS(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LCR_WLS_SHIFT)) & SMARTCARD_LCR_WLS_MASK) | ||
9447 | #define SMARTCARD_LCR_SBS_MASK (0x4U) | ||
9448 | #define SMARTCARD_LCR_SBS_SHIFT (2U) | ||
9449 | /*! SBS - Stop Bit Select. | ||
9450 | */ | ||
9451 | #define SMARTCARD_LCR_SBS(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LCR_SBS_SHIFT)) & SMARTCARD_LCR_SBS_MASK) | ||
9452 | #define SMARTCARD_LCR_PE_MASK (0x8U) | ||
9453 | #define SMARTCARD_LCR_PE_SHIFT (3U) | ||
9454 | /*! PE - Parity Enable. | ||
9455 | */ | ||
9456 | #define SMARTCARD_LCR_PE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LCR_PE_SHIFT)) & SMARTCARD_LCR_PE_MASK) | ||
9457 | #define SMARTCARD_LCR_PS_MASK (0x30U) | ||
9458 | #define SMARTCARD_LCR_PS_SHIFT (4U) | ||
9459 | /*! PS - Parity Select. | ||
9460 | */ | ||
9461 | #define SMARTCARD_LCR_PS(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LCR_PS_SHIFT)) & SMARTCARD_LCR_PS_MASK) | ||
9462 | #define SMARTCARD_LCR_DLAB_MASK (0x80U) | ||
9463 | #define SMARTCARD_LCR_DLAB_SHIFT (7U) | ||
9464 | /*! DLAB - Divisor Latch Access Bit. | ||
9465 | */ | ||
9466 | #define SMARTCARD_LCR_DLAB(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LCR_DLAB_SHIFT)) & SMARTCARD_LCR_DLAB_MASK) | ||
9467 | /*! @} */ | ||
9468 | |||
9469 | /*! @name LSR - Line Status Register */ | ||
9470 | /*! @{ */ | ||
9471 | #define SMARTCARD_LSR_RDR_MASK (0x1U) | ||
9472 | #define SMARTCARD_LSR_RDR_SHIFT (0U) | ||
9473 | /*! RDR - Receiver Data Ready. | ||
9474 | */ | ||
9475 | #define SMARTCARD_LSR_RDR(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LSR_RDR_SHIFT)) & SMARTCARD_LSR_RDR_MASK) | ||
9476 | #define SMARTCARD_LSR_OE_MASK (0x2U) | ||
9477 | #define SMARTCARD_LSR_OE_SHIFT (1U) | ||
9478 | /*! OE - Overrun Error. | ||
9479 | */ | ||
9480 | #define SMARTCARD_LSR_OE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LSR_OE_SHIFT)) & SMARTCARD_LSR_OE_MASK) | ||
9481 | #define SMARTCARD_LSR_PE_MASK (0x4U) | ||
9482 | #define SMARTCARD_LSR_PE_SHIFT (2U) | ||
9483 | /*! PE - Parity Error. | ||
9484 | */ | ||
9485 | #define SMARTCARD_LSR_PE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LSR_PE_SHIFT)) & SMARTCARD_LSR_PE_MASK) | ||
9486 | #define SMARTCARD_LSR_FE_MASK (0x8U) | ||
9487 | #define SMARTCARD_LSR_FE_SHIFT (3U) | ||
9488 | /*! FE - Framing Error. | ||
9489 | */ | ||
9490 | #define SMARTCARD_LSR_FE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LSR_FE_SHIFT)) & SMARTCARD_LSR_FE_MASK) | ||
9491 | #define SMARTCARD_LSR_THRE_MASK (0x20U) | ||
9492 | #define SMARTCARD_LSR_THRE_SHIFT (5U) | ||
9493 | /*! THRE - Transmitter Holding Register Empty. | ||
9494 | */ | ||
9495 | #define SMARTCARD_LSR_THRE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LSR_THRE_SHIFT)) & SMARTCARD_LSR_THRE_MASK) | ||
9496 | #define SMARTCARD_LSR_TEMT_MASK (0x40U) | ||
9497 | #define SMARTCARD_LSR_TEMT_SHIFT (6U) | ||
9498 | /*! TEMT - Transmitter Empty. | ||
9499 | */ | ||
9500 | #define SMARTCARD_LSR_TEMT(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LSR_TEMT_SHIFT)) & SMARTCARD_LSR_TEMT_MASK) | ||
9501 | #define SMARTCARD_LSR_RXFE_MASK (0x80U) | ||
9502 | #define SMARTCARD_LSR_RXFE_SHIFT (7U) | ||
9503 | /*! RXFE - Error in RX FIFO. | ||
9504 | */ | ||
9505 | #define SMARTCARD_LSR_RXFE(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_LSR_RXFE_SHIFT)) & SMARTCARD_LSR_RXFE_MASK) | ||
9506 | /*! @} */ | ||
9507 | |||
9508 | /*! @name SCR - Scratch Pad Register */ | ||
9509 | /*! @{ */ | ||
9510 | #define SMARTCARD_SCR_PAD_MASK (0xFFU) | ||
9511 | #define SMARTCARD_SCR_PAD_SHIFT (0U) | ||
9512 | /*! PAD - A readable, writable byte. | ||
9513 | */ | ||
9514 | #define SMARTCARD_SCR_PAD(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_SCR_PAD_SHIFT)) & SMARTCARD_SCR_PAD_MASK) | ||
9515 | /*! @} */ | ||
9516 | |||
9517 | /*! @name OSR - Oversampling register */ | ||
9518 | /*! @{ */ | ||
9519 | #define SMARTCARD_OSR_OSFRAC_MASK (0xEU) | ||
9520 | #define SMARTCARD_OSR_OSFRAC_SHIFT (1U) | ||
9521 | /*! OSFRAC - Fractional part of the oversampling ratio, in units of 1/8th of an input clock period. | ||
9522 | */ | ||
9523 | #define SMARTCARD_OSR_OSFRAC(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_OSR_OSFRAC_SHIFT)) & SMARTCARD_OSR_OSFRAC_MASK) | ||
9524 | #define SMARTCARD_OSR_OSINT_MASK (0xF0U) | ||
9525 | #define SMARTCARD_OSR_OSINT_SHIFT (4U) | ||
9526 | /*! OSINT - Integer part of the oversampling ratio, minus 1. | ||
9527 | */ | ||
9528 | #define SMARTCARD_OSR_OSINT(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_OSR_OSINT_SHIFT)) & SMARTCARD_OSR_OSINT_MASK) | ||
9529 | #define SMARTCARD_OSR_FDINT_MASK (0x7F00U) | ||
9530 | #define SMARTCARD_OSR_FDINT_SHIFT (8U) | ||
9531 | /*! FDINT - These bits act as a more-significant extension of the OSint field, allowing an | ||
9532 | * oversampling ratio up to 2048 as required by ISO7816-3. | ||
9533 | */ | ||
9534 | #define SMARTCARD_OSR_FDINT(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_OSR_FDINT_SHIFT)) & SMARTCARD_OSR_FDINT_MASK) | ||
9535 | /*! @} */ | ||
9536 | |||
9537 | /*! @name SCICTRL - Smart Card Interface control register */ | ||
9538 | /*! @{ */ | ||
9539 | #define SMARTCARD_SCICTRL_SCIEN_MASK (0x1U) | ||
9540 | #define SMARTCARD_SCICTRL_SCIEN_SHIFT (0U) | ||
9541 | /*! SCIEN - Smart Card Interface Enable. | ||
9542 | */ | ||
9543 | #define SMARTCARD_SCICTRL_SCIEN(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_SCICTRL_SCIEN_SHIFT)) & SMARTCARD_SCICTRL_SCIEN_MASK) | ||
9544 | #define SMARTCARD_SCICTRL_NACKDIS_MASK (0x2U) | ||
9545 | #define SMARTCARD_SCICTRL_NACKDIS_SHIFT (1U) | ||
9546 | /*! NACKDIS - NACK response disable. | ||
9547 | */ | ||
9548 | #define SMARTCARD_SCICTRL_NACKDIS(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_SCICTRL_NACKDIS_SHIFT)) & SMARTCARD_SCICTRL_NACKDIS_MASK) | ||
9549 | #define SMARTCARD_SCICTRL_PROTSEL_MASK (0x4U) | ||
9550 | #define SMARTCARD_SCICTRL_PROTSEL_SHIFT (2U) | ||
9551 | /*! PROTSEL - Protocol selection as defined in the ISO7816-3 standard. | ||
9552 | */ | ||
9553 | #define SMARTCARD_SCICTRL_PROTSEL(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_SCICTRL_PROTSEL_SHIFT)) & SMARTCARD_SCICTRL_PROTSEL_MASK) | ||
9554 | #define SMARTCARD_SCICTRL_TXRETRY_MASK (0xE0U) | ||
9555 | #define SMARTCARD_SCICTRL_TXRETRY_SHIFT (5U) | ||
9556 | /*! TXRETRY - Maximum number of retransmissions in case of a negative acknowledge (protocol T=0). | ||
9557 | */ | ||
9558 | #define SMARTCARD_SCICTRL_TXRETRY(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_SCICTRL_TXRETRY_SHIFT)) & SMARTCARD_SCICTRL_TXRETRY_MASK) | ||
9559 | #define SMARTCARD_SCICTRL_GUARDTIME_MASK (0xFF00U) | ||
9560 | #define SMARTCARD_SCICTRL_GUARDTIME_SHIFT (8U) | ||
9561 | /*! GUARDTIME - Extra guard time. | ||
9562 | */ | ||
9563 | #define SMARTCARD_SCICTRL_GUARDTIME(x) (((uint32_t)(((uint32_t)(x)) << SMARTCARD_SCICTRL_GUARDTIME_SHIFT)) & SMARTCARD_SCICTRL_GUARDTIME_MASK) | ||
9564 | /*! @} */ | ||
9565 | |||
9566 | |||
9567 | /*! | ||
9568 | * @} | ||
9569 | */ /* end of group SMARTCARD_Register_Masks */ | ||
9570 | |||
9571 | |||
9572 | /* SMARTCARD - Peripheral instance base addresses */ | ||
9573 | /** Peripheral SMARTCARD0 base address */ | ||
9574 | #define SMARTCARD0_BASE (0x40036000u) | ||
9575 | /** Peripheral SMARTCARD0 base pointer */ | ||
9576 | #define SMARTCARD0 ((SMARTCARD_Type *)SMARTCARD0_BASE) | ||
9577 | /** Peripheral SMARTCARD1 base address */ | ||
9578 | #define SMARTCARD1_BASE (0x40037000u) | ||
9579 | /** Peripheral SMARTCARD1 base pointer */ | ||
9580 | #define SMARTCARD1 ((SMARTCARD_Type *)SMARTCARD1_BASE) | ||
9581 | /** Array initializer of SMARTCARD peripheral base addresses */ | ||
9582 | #define SMARTCARD_BASE_ADDRS { SMARTCARD0_BASE, SMARTCARD1_BASE } | ||
9583 | /** Array initializer of SMARTCARD peripheral base pointers */ | ||
9584 | #define SMARTCARD_BASE_PTRS { SMARTCARD0, SMARTCARD1 } | ||
9585 | /** Interrupt vectors for the SMARTCARD peripheral type */ | ||
9586 | #define SMARTCARD_IRQS { SMARTCARD0_IRQn, SMARTCARD1_IRQn } | ||
9587 | |||
9588 | /*! | ||
9589 | * @} | ||
9590 | */ /* end of group SMARTCARD_Peripheral_Access_Layer */ | ||
9591 | |||
9592 | |||
9593 | /* ---------------------------------------------------------------------------- | ||
9594 | -- SPI Peripheral Access Layer | ||
9595 | ---------------------------------------------------------------------------- */ | ||
9596 | |||
9597 | /*! | ||
9598 | * @addtogroup SPI_Peripheral_Access_Layer SPI Peripheral Access Layer | ||
9599 | * @{ | ||
9600 | */ | ||
9601 | |||
9602 | /** SPI - Register Layout Typedef */ | ||
9603 | typedef struct { | ||
9604 | uint8_t RESERVED_0[1024]; | ||
9605 | __IO uint32_t CFG; /**< SPI Configuration register, offset: 0x400 */ | ||
9606 | __IO uint32_t DLY; /**< SPI Delay register, offset: 0x404 */ | ||
9607 | __IO uint32_t STAT; /**< SPI Status. Some status flags can be cleared by writing a 1 to that bit position., offset: 0x408 */ | ||
9608 | __IO uint32_t INTENSET; /**< SPI Interrupt Enable read and Set. A complete value may be read from this register. Writing a 1 to any implemented bit position causes that bit to be set., offset: 0x40C */ | ||
9609 | __O uint32_t INTENCLR; /**< SPI Interrupt Enable Clear. Writing a 1 to any implemented bit position causes the corresponding bit in INTENSET to be cleared., offset: 0x410 */ | ||
9610 | uint8_t RESERVED_1[16]; | ||
9611 | __IO uint32_t DIV; /**< SPI clock Divider, offset: 0x424 */ | ||
9612 | __I uint32_t INTSTAT; /**< SPI Interrupt Status, offset: 0x428 */ | ||
9613 | uint8_t RESERVED_2[2516]; | ||
9614 | __IO uint32_t FIFOCFG; /**< FIFO configuration and enable register., offset: 0xE00 */ | ||
9615 | __IO uint32_t FIFOSTAT; /**< FIFO status register., offset: 0xE04 */ | ||
9616 | __IO uint32_t FIFOTRIG; /**< FIFO trigger settings for interrupt and DMA request., offset: 0xE08 */ | ||
9617 | uint8_t RESERVED_3[4]; | ||
9618 | __IO uint32_t FIFOINTENSET; /**< FIFO interrupt enable set (enable) and read register., offset: 0xE10 */ | ||
9619 | __IO uint32_t FIFOINTENCLR; /**< FIFO interrupt enable clear (disable) and read register., offset: 0xE14 */ | ||
9620 | __I uint32_t FIFOINTSTAT; /**< FIFO interrupt status register., offset: 0xE18 */ | ||
9621 | uint8_t RESERVED_4[4]; | ||
9622 | __O uint32_t FIFOWR; /**< FIFO write data., offset: 0xE20 */ | ||
9623 | uint8_t RESERVED_5[12]; | ||
9624 | __I uint32_t FIFORD; /**< FIFO read data., offset: 0xE30 */ | ||
9625 | uint8_t RESERVED_6[12]; | ||
9626 | __I uint32_t FIFORDNOPOP; /**< FIFO data read with no FIFO pop., offset: 0xE40 */ | ||
9627 | uint8_t RESERVED_7[440]; | ||
9628 | __I uint32_t ID; /**< Peripheral identification register., offset: 0xFFC */ | ||
9629 | } SPI_Type; | ||
9630 | |||
9631 | /* ---------------------------------------------------------------------------- | ||
9632 | -- SPI Register Masks | ||
9633 | ---------------------------------------------------------------------------- */ | ||
9634 | |||
9635 | /*! | ||
9636 | * @addtogroup SPI_Register_Masks SPI Register Masks | ||
9637 | * @{ | ||
9638 | */ | ||
9639 | |||
9640 | /*! @name CFG - SPI Configuration register */ | ||
9641 | /*! @{ */ | ||
9642 | #define SPI_CFG_ENABLE_MASK (0x1U) | ||
9643 | #define SPI_CFG_ENABLE_SHIFT (0U) | ||
9644 | /*! ENABLE - SPI enable. | ||
9645 | * 0b0..Disabled. The SPI is disabled and the internal state machine and counters are reset. | ||
9646 | * 0b1..Enabled. The SPI is enabled for operation. | ||
9647 | */ | ||
9648 | #define SPI_CFG_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_ENABLE_SHIFT)) & SPI_CFG_ENABLE_MASK) | ||
9649 | #define SPI_CFG_MASTER_MASK (0x4U) | ||
9650 | #define SPI_CFG_MASTER_SHIFT (2U) | ||
9651 | /*! MASTER - Master mode select. | ||
9652 | * 0b0..Slave mode. The SPI will operate in slave mode. SCK, MOSI, and the SSEL signals are inputs, MISO is an output. | ||
9653 | * 0b1..Master mode. The SPI will operate in master mode. SCK, MOSI, and the SSEL signals are outputs, MISO is an input. | ||
9654 | */ | ||
9655 | #define SPI_CFG_MASTER(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_MASTER_SHIFT)) & SPI_CFG_MASTER_MASK) | ||
9656 | #define SPI_CFG_LSBF_MASK (0x8U) | ||
9657 | #define SPI_CFG_LSBF_SHIFT (3U) | ||
9658 | /*! LSBF - LSB First mode enable. | ||
9659 | * 0b0..Standard. Data is transmitted and received in standard MSB first order. | ||
9660 | * 0b1..Reverse. Data is transmitted and received in reverse order (LSB first). | ||
9661 | */ | ||
9662 | #define SPI_CFG_LSBF(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_LSBF_SHIFT)) & SPI_CFG_LSBF_MASK) | ||
9663 | #define SPI_CFG_CPHA_MASK (0x10U) | ||
9664 | #define SPI_CFG_CPHA_SHIFT (4U) | ||
9665 | /*! CPHA - Clock Phase select. | ||
9666 | * 0b0..Change. The SPI captures serial data on the first clock transition of the transfer (when the clock | ||
9667 | * changes away from the rest state). Data is changed on the following edge. | ||
9668 | * 0b1..Capture. The SPI changes serial data on the first clock transition of the transfer (when the clock | ||
9669 | * changes away from the rest state). Data is captured on the following edge. | ||
9670 | */ | ||
9671 | #define SPI_CFG_CPHA(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_CPHA_SHIFT)) & SPI_CFG_CPHA_MASK) | ||
9672 | #define SPI_CFG_CPOL_MASK (0x20U) | ||
9673 | #define SPI_CFG_CPOL_SHIFT (5U) | ||
9674 | /*! CPOL - Clock Polarity select. | ||
9675 | * 0b0..Low. The rest state of the clock (between transfers) is low. | ||
9676 | * 0b1..High. The rest state of the clock (between transfers) is high. | ||
9677 | */ | ||
9678 | #define SPI_CFG_CPOL(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_CPOL_SHIFT)) & SPI_CFG_CPOL_MASK) | ||
9679 | #define SPI_CFG_LOOP_MASK (0x80U) | ||
9680 | #define SPI_CFG_LOOP_SHIFT (7U) | ||
9681 | /*! LOOP - Loopback mode enable. Loopback mode applies only to Master mode, and connects transmit | ||
9682 | * and receive data connected together to allow simple software testing. | ||
9683 | * 0b0..Disabled. | ||
9684 | * 0b1..Enabled. | ||
9685 | */ | ||
9686 | #define SPI_CFG_LOOP(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_LOOP_SHIFT)) & SPI_CFG_LOOP_MASK) | ||
9687 | #define SPI_CFG_SPOL0_MASK (0x100U) | ||
9688 | #define SPI_CFG_SPOL0_SHIFT (8U) | ||
9689 | /*! SPOL0 - SSEL0 Polarity select. | ||
9690 | * 0b0..Low. The SSEL0 pin is active low. | ||
9691 | * 0b1..High. The SSEL0 pin is active high. | ||
9692 | */ | ||
9693 | #define SPI_CFG_SPOL0(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_SPOL0_SHIFT)) & SPI_CFG_SPOL0_MASK) | ||
9694 | #define SPI_CFG_SPOL1_MASK (0x200U) | ||
9695 | #define SPI_CFG_SPOL1_SHIFT (9U) | ||
9696 | /*! SPOL1 - SSEL1 Polarity select. | ||
9697 | * 0b0..Low. The SSEL1 pin is active low. | ||
9698 | * 0b1..High. The SSEL1 pin is active high. | ||
9699 | */ | ||
9700 | #define SPI_CFG_SPOL1(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_SPOL1_SHIFT)) & SPI_CFG_SPOL1_MASK) | ||
9701 | #define SPI_CFG_SPOL2_MASK (0x400U) | ||
9702 | #define SPI_CFG_SPOL2_SHIFT (10U) | ||
9703 | /*! SPOL2 - SSEL2 Polarity select. | ||
9704 | * 0b0..Low. The SSEL2 pin is active low. | ||
9705 | * 0b1..High. The SSEL2 pin is active high. | ||
9706 | */ | ||
9707 | #define SPI_CFG_SPOL2(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_SPOL2_SHIFT)) & SPI_CFG_SPOL2_MASK) | ||
9708 | #define SPI_CFG_SPOL3_MASK (0x800U) | ||
9709 | #define SPI_CFG_SPOL3_SHIFT (11U) | ||
9710 | /*! SPOL3 - SSEL3 Polarity select. | ||
9711 | * 0b0..Low. The SSEL3 pin is active low. | ||
9712 | * 0b1..High. The SSEL3 pin is active high. | ||
9713 | */ | ||
9714 | #define SPI_CFG_SPOL3(x) (((uint32_t)(((uint32_t)(x)) << SPI_CFG_SPOL3_SHIFT)) & SPI_CFG_SPOL3_MASK) | ||
9715 | /*! @} */ | ||
9716 | |||
9717 | /*! @name DLY - SPI Delay register */ | ||
9718 | /*! @{ */ | ||
9719 | #define SPI_DLY_PRE_DELAY_MASK (0xFU) | ||
9720 | #define SPI_DLY_PRE_DELAY_SHIFT (0U) | ||
9721 | /*! PRE_DELAY - Controls the amount of time between SSEL assertion and the beginning of a data | ||
9722 | * transfer. There is always one SPI clock time between SSEL assertion and the first clock edge. This | ||
9723 | * is not considered part of the pre-delay. 0x0 = No additional time is inserted. 0x1 = 1 SPI | ||
9724 | * clock time is inserted. 0x2 = 2 SPI clock times are inserted. 0xF = 15 SPI clock times are | ||
9725 | * inserted. | ||
9726 | */ | ||
9727 | #define SPI_DLY_PRE_DELAY(x) (((uint32_t)(((uint32_t)(x)) << SPI_DLY_PRE_DELAY_SHIFT)) & SPI_DLY_PRE_DELAY_MASK) | ||
9728 | #define SPI_DLY_POST_DELAY_MASK (0xF0U) | ||
9729 | #define SPI_DLY_POST_DELAY_SHIFT (4U) | ||
9730 | /*! POST_DELAY - Controls the amount of time between the end of a data transfer and SSEL | ||
9731 | * deassertion. 0x0 = No additional time is inserted. 0x1 = 1 SPI clock time is inserted. 0x2 = 2 SPI clock | ||
9732 | * times are inserted. 0xF = 15 SPI clock times are inserted. | ||
9733 | */ | ||
9734 | #define SPI_DLY_POST_DELAY(x) (((uint32_t)(((uint32_t)(x)) << SPI_DLY_POST_DELAY_SHIFT)) & SPI_DLY_POST_DELAY_MASK) | ||
9735 | #define SPI_DLY_FRAME_DELAY_MASK (0xF00U) | ||
9736 | #define SPI_DLY_FRAME_DELAY_SHIFT (8U) | ||
9737 | /*! FRAME_DELAY - If the EOF flag is set, controls the minimum amount of time between the current | ||
9738 | * frame and the next frame (or SSEL deassertion if EOT). 0x0 = No additional time is inserted. 0x1 | ||
9739 | * = 1 SPI clock time is inserted. 0x2 = 2 SPI clock times are inserted. 0xF = 15 SPI clock | ||
9740 | * times are inserted. | ||
9741 | */ | ||
9742 | #define SPI_DLY_FRAME_DELAY(x) (((uint32_t)(((uint32_t)(x)) << SPI_DLY_FRAME_DELAY_SHIFT)) & SPI_DLY_FRAME_DELAY_MASK) | ||
9743 | #define SPI_DLY_TRANSFER_DELAY_MASK (0xF000U) | ||
9744 | #define SPI_DLY_TRANSFER_DELAY_SHIFT (12U) | ||
9745 | /*! TRANSFER_DELAY - Controls the minimum amount of time that the SSEL is deasserted between | ||
9746 | * transfers. 0x0 = The minimum time that SSEL is deasserted is 1 SPI clock time. (Zero added time.) 0x1 | ||
9747 | * = The minimum time that SSEL is deasserted is 2 SPI clock times. 0x2 = The minimum time that | ||
9748 | * SSEL is deasserted is 3 SPI clock times. 0xF = The minimum time that SSEL is deasserted is 16 | ||
9749 | * SPI clock times. | ||
9750 | */ | ||
9751 | #define SPI_DLY_TRANSFER_DELAY(x) (((uint32_t)(((uint32_t)(x)) << SPI_DLY_TRANSFER_DELAY_SHIFT)) & SPI_DLY_TRANSFER_DELAY_MASK) | ||
9752 | /*! @} */ | ||
9753 | |||
9754 | /*! @name STAT - SPI Status. Some status flags can be cleared by writing a 1 to that bit position. */ | ||
9755 | /*! @{ */ | ||
9756 | #define SPI_STAT_SSA_MASK (0x10U) | ||
9757 | #define SPI_STAT_SSA_SHIFT (4U) | ||
9758 | /*! SSA - Slave Select Assert. This flag is set whenever any slave select transitions from | ||
9759 | * deasserted to asserted, in both master and slave modes. This allows determining when the SPI | ||
9760 | * transmit/receive functions become busy, and allows waking up the device from reduced power modes when a | ||
9761 | * slave mode access begins. This flag is cleared by software. | ||
9762 | */ | ||
9763 | #define SPI_STAT_SSA(x) (((uint32_t)(((uint32_t)(x)) << SPI_STAT_SSA_SHIFT)) & SPI_STAT_SSA_MASK) | ||
9764 | #define SPI_STAT_SSD_MASK (0x20U) | ||
9765 | #define SPI_STAT_SSD_SHIFT (5U) | ||
9766 | /*! SSD - Slave Select Deassert. This flag is set whenever any asserted slave selects transition to | ||
9767 | * deasserted, in both master and slave modes. This allows determining when the SPI | ||
9768 | * transmit/receive functions become idle. This flag is cleared by software. | ||
9769 | */ | ||
9770 | #define SPI_STAT_SSD(x) (((uint32_t)(((uint32_t)(x)) << SPI_STAT_SSD_SHIFT)) & SPI_STAT_SSD_MASK) | ||
9771 | #define SPI_STAT_STALLED_MASK (0x40U) | ||
9772 | #define SPI_STAT_STALLED_SHIFT (6U) | ||
9773 | /*! STALLED - Stalled status flag. This indicates whether the SPI is currently in a stall condition. | ||
9774 | */ | ||
9775 | #define SPI_STAT_STALLED(x) (((uint32_t)(((uint32_t)(x)) << SPI_STAT_STALLED_SHIFT)) & SPI_STAT_STALLED_MASK) | ||
9776 | #define SPI_STAT_ENDTRANSFER_MASK (0x80U) | ||
9777 | #define SPI_STAT_ENDTRANSFER_SHIFT (7U) | ||
9778 | /*! ENDTRANSFER - End Transfer control bit. Software can set this bit to force an end to the current | ||
9779 | * transfer when the transmitter finishes any activity already in progress, as if the EOT flag | ||
9780 | * had been set prior to the last transmission. This capability is included to support cases where | ||
9781 | * it is not known when transmit data is written that it will be the end of a transfer. The bit | ||
9782 | * is cleared when the transmitter becomes idle as the transfer comes to an end. Forcing an end | ||
9783 | * of transfer in this manner causes any specified FRAME_DELAY and TRANSFER_DELAY to be inserted. | ||
9784 | */ | ||
9785 | #define SPI_STAT_ENDTRANSFER(x) (((uint32_t)(((uint32_t)(x)) << SPI_STAT_ENDTRANSFER_SHIFT)) & SPI_STAT_ENDTRANSFER_MASK) | ||
9786 | #define SPI_STAT_MSTIDLE_MASK (0x100U) | ||
9787 | #define SPI_STAT_MSTIDLE_SHIFT (8U) | ||
9788 | /*! MSTIDLE - Master idle status flag. This bit is 1 whenever the SPI master function is fully idle. | ||
9789 | * This means that the transmit holding register is empty and the transmitter is not in the | ||
9790 | * process of sending data. | ||
9791 | */ | ||
9792 | #define SPI_STAT_MSTIDLE(x) (((uint32_t)(((uint32_t)(x)) << SPI_STAT_MSTIDLE_SHIFT)) & SPI_STAT_MSTIDLE_MASK) | ||
9793 | /*! @} */ | ||
9794 | |||
9795 | /*! @name INTENSET - SPI Interrupt Enable read and Set. A complete value may be read from this register. Writing a 1 to any implemented bit position causes that bit to be set. */ | ||
9796 | /*! @{ */ | ||
9797 | #define SPI_INTENSET_SSAEN_MASK (0x10U) | ||
9798 | #define SPI_INTENSET_SSAEN_SHIFT (4U) | ||
9799 | /*! SSAEN - Slave select assert interrupt enable. Determines whether an interrupt occurs when the Slave Select is asserted. | ||
9800 | * 0b0..Disabled. No interrupt will be generated when any Slave Select transitions from deasserted to asserted. | ||
9801 | * 0b1..Enabled. An interrupt will be generated when any Slave Select transitions from deasserted to asserted. | ||
9802 | */ | ||
9803 | #define SPI_INTENSET_SSAEN(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTENSET_SSAEN_SHIFT)) & SPI_INTENSET_SSAEN_MASK) | ||
9804 | #define SPI_INTENSET_SSDEN_MASK (0x20U) | ||
9805 | #define SPI_INTENSET_SSDEN_SHIFT (5U) | ||
9806 | /*! SSDEN - Slave select deassert interrupt enable. Determines whether an interrupt occurs when the Slave Select is deasserted. | ||
9807 | * 0b0..Disabled. No interrupt will be generated when all asserted Slave Selects transition to deasserted. | ||
9808 | * 0b1..Enabled. An interrupt will be generated when all asserted Slave Selects transition to deasserted. | ||
9809 | */ | ||
9810 | #define SPI_INTENSET_SSDEN(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTENSET_SSDEN_SHIFT)) & SPI_INTENSET_SSDEN_MASK) | ||
9811 | #define SPI_INTENSET_MSTIDLEEN_MASK (0x100U) | ||
9812 | #define SPI_INTENSET_MSTIDLEEN_SHIFT (8U) | ||
9813 | /*! MSTIDLEEN - Master idle interrupt enable. | ||
9814 | * 0b0..No interrupt will be generated when the SPI master function is idle. | ||
9815 | * 0b1..An interrupt will be generated when the SPI master function is fully idle. | ||
9816 | */ | ||
9817 | #define SPI_INTENSET_MSTIDLEEN(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTENSET_MSTIDLEEN_SHIFT)) & SPI_INTENSET_MSTIDLEEN_MASK) | ||
9818 | /*! @} */ | ||
9819 | |||
9820 | /*! @name INTENCLR - SPI Interrupt Enable Clear. Writing a 1 to any implemented bit position causes the corresponding bit in INTENSET to be cleared. */ | ||
9821 | /*! @{ */ | ||
9822 | #define SPI_INTENCLR_SSAEN_MASK (0x10U) | ||
9823 | #define SPI_INTENCLR_SSAEN_SHIFT (4U) | ||
9824 | /*! SSAEN - Writing 1 clears the corresponding bit in the INTENSET register. | ||
9825 | */ | ||
9826 | #define SPI_INTENCLR_SSAEN(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTENCLR_SSAEN_SHIFT)) & SPI_INTENCLR_SSAEN_MASK) | ||
9827 | #define SPI_INTENCLR_SSDEN_MASK (0x20U) | ||
9828 | #define SPI_INTENCLR_SSDEN_SHIFT (5U) | ||
9829 | /*! SSDEN - Writing 1 clears the corresponding bit in the INTENSET register. | ||
9830 | */ | ||
9831 | #define SPI_INTENCLR_SSDEN(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTENCLR_SSDEN_SHIFT)) & SPI_INTENCLR_SSDEN_MASK) | ||
9832 | #define SPI_INTENCLR_MSTIDLE_MASK (0x100U) | ||
9833 | #define SPI_INTENCLR_MSTIDLE_SHIFT (8U) | ||
9834 | /*! MSTIDLE - Writing 1 clears the corresponding bit in the INTENSET register. | ||
9835 | */ | ||
9836 | #define SPI_INTENCLR_MSTIDLE(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTENCLR_MSTIDLE_SHIFT)) & SPI_INTENCLR_MSTIDLE_MASK) | ||
9837 | /*! @} */ | ||
9838 | |||
9839 | /*! @name DIV - SPI clock Divider */ | ||
9840 | /*! @{ */ | ||
9841 | #define SPI_DIV_DIVVAL_MASK (0xFFFFU) | ||
9842 | #define SPI_DIV_DIVVAL_SHIFT (0U) | ||
9843 | /*! DIVVAL - Rate divider value. Specifies how the Flexcomm clock (FCLK) is divided to produce the | ||
9844 | * SPI clock rate in master mode. DIVVAL is -1 encoded such that the value 0 results in FCLK/1, | ||
9845 | * the value 1 results in FCLK/2, up to the maximum possible divide value of 0xFFFF, which results | ||
9846 | * in FCLK/65536. | ||
9847 | */ | ||
9848 | #define SPI_DIV_DIVVAL(x) (((uint32_t)(((uint32_t)(x)) << SPI_DIV_DIVVAL_SHIFT)) & SPI_DIV_DIVVAL_MASK) | ||
9849 | /*! @} */ | ||
9850 | |||
9851 | /*! @name INTSTAT - SPI Interrupt Status */ | ||
9852 | /*! @{ */ | ||
9853 | #define SPI_INTSTAT_SSA_MASK (0x10U) | ||
9854 | #define SPI_INTSTAT_SSA_SHIFT (4U) | ||
9855 | /*! SSA - Slave Select Assert. | ||
9856 | */ | ||
9857 | #define SPI_INTSTAT_SSA(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTSTAT_SSA_SHIFT)) & SPI_INTSTAT_SSA_MASK) | ||
9858 | #define SPI_INTSTAT_SSD_MASK (0x20U) | ||
9859 | #define SPI_INTSTAT_SSD_SHIFT (5U) | ||
9860 | /*! SSD - Slave Select Deassert. | ||
9861 | */ | ||
9862 | #define SPI_INTSTAT_SSD(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTSTAT_SSD_SHIFT)) & SPI_INTSTAT_SSD_MASK) | ||
9863 | #define SPI_INTSTAT_MSTIDLE_MASK (0x100U) | ||
9864 | #define SPI_INTSTAT_MSTIDLE_SHIFT (8U) | ||
9865 | /*! MSTIDLE - Master Idle status flag. | ||
9866 | */ | ||
9867 | #define SPI_INTSTAT_MSTIDLE(x) (((uint32_t)(((uint32_t)(x)) << SPI_INTSTAT_MSTIDLE_SHIFT)) & SPI_INTSTAT_MSTIDLE_MASK) | ||
9868 | /*! @} */ | ||
9869 | |||
9870 | /*! @name FIFOCFG - FIFO configuration and enable register. */ | ||
9871 | /*! @{ */ | ||
9872 | #define SPI_FIFOCFG_ENABLETX_MASK (0x1U) | ||
9873 | #define SPI_FIFOCFG_ENABLETX_SHIFT (0U) | ||
9874 | /*! ENABLETX - Enable the transmit FIFO. | ||
9875 | * 0b0..The transmit FIFO is not enabled. | ||
9876 | * 0b1..The transmit FIFO is enabled. | ||
9877 | */ | ||
9878 | #define SPI_FIFOCFG_ENABLETX(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_ENABLETX_SHIFT)) & SPI_FIFOCFG_ENABLETX_MASK) | ||
9879 | #define SPI_FIFOCFG_ENABLERX_MASK (0x2U) | ||
9880 | #define SPI_FIFOCFG_ENABLERX_SHIFT (1U) | ||
9881 | /*! ENABLERX - Enable the receive FIFO. | ||
9882 | * 0b0..The receive FIFO is not enabled. | ||
9883 | * 0b1..The receive FIFO is enabled. | ||
9884 | */ | ||
9885 | #define SPI_FIFOCFG_ENABLERX(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_ENABLERX_SHIFT)) & SPI_FIFOCFG_ENABLERX_MASK) | ||
9886 | #define SPI_FIFOCFG_SIZE_MASK (0x30U) | ||
9887 | #define SPI_FIFOCFG_SIZE_SHIFT (4U) | ||
9888 | /*! SIZE - FIFO size configuration. This is a read-only field. 0x0 = FIFO is configured as 16 | ||
9889 | * entries of 8 bits. 0x1, 0x2, 0x3 = not applicable to USART. | ||
9890 | */ | ||
9891 | #define SPI_FIFOCFG_SIZE(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_SIZE_SHIFT)) & SPI_FIFOCFG_SIZE_MASK) | ||
9892 | #define SPI_FIFOCFG_DMATX_MASK (0x1000U) | ||
9893 | #define SPI_FIFOCFG_DMATX_SHIFT (12U) | ||
9894 | /*! DMATX - DMA configuration for transmit. | ||
9895 | * 0b0..DMA is not used for the transmit function. | ||
9896 | * 0b1..Trigger DMA for the transmit function if the FIFO is not full. Generally, data interrupts would be disabled if DMA is enabled. | ||
9897 | */ | ||
9898 | #define SPI_FIFOCFG_DMATX(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_DMATX_SHIFT)) & SPI_FIFOCFG_DMATX_MASK) | ||
9899 | #define SPI_FIFOCFG_DMARX_MASK (0x2000U) | ||
9900 | #define SPI_FIFOCFG_DMARX_SHIFT (13U) | ||
9901 | /*! DMARX - DMA configuration for receive. | ||
9902 | * 0b0..DMA is not used for the receive function. | ||
9903 | * 0b1..Trigger DMA for the receive function if the FIFO is not empty. Generally, data interrupts would be disabled if DMA is enabled. | ||
9904 | */ | ||
9905 | #define SPI_FIFOCFG_DMARX(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_DMARX_SHIFT)) & SPI_FIFOCFG_DMARX_MASK) | ||
9906 | #define SPI_FIFOCFG_WAKETX_MASK (0x4000U) | ||
9907 | #define SPI_FIFOCFG_WAKETX_SHIFT (14U) | ||
9908 | /*! WAKETX - Wake-up for transmit FIFO level. This allows the device to be woken from reduced power | ||
9909 | * modes (up to power-down, as long as the peripheral function works in that power mode) without | ||
9910 | * enabling the TXLVL interrupt. Only DMA wakes up, processes data, and goes back to sleep. The | ||
9911 | * CPU will remain stopped until woken by another cause, such as DMA completion. See Hardware | ||
9912 | * Wake-up control register. | ||
9913 | * 0b0..Only enabled interrupts will wake up the device form reduced power modes. | ||
9914 | * 0b1..A device wake-up for DMA will occur if the transmit FIFO level reaches the value specified by TXLVL in | ||
9915 | * FIFOTRIG, even when the TXLVL interrupt is not enabled. | ||
9916 | */ | ||
9917 | #define SPI_FIFOCFG_WAKETX(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_WAKETX_SHIFT)) & SPI_FIFOCFG_WAKETX_MASK) | ||
9918 | #define SPI_FIFOCFG_WAKERX_MASK (0x8000U) | ||
9919 | #define SPI_FIFOCFG_WAKERX_SHIFT (15U) | ||
9920 | /*! WAKERX - Wake-up for receive FIFO level. This allows the device to be woken from reduced power | ||
9921 | * modes (up to power-down, as long as the peripheral function works in that power mode) without | ||
9922 | * enabling the TXLVL interrupt. Only DMA wakes up, processes data, and goes back to sleep. The | ||
9923 | * CPU will remain stopped until woken by another cause, such as DMA completion. See Hardware | ||
9924 | * Wake-up control register. | ||
9925 | * 0b0..Only enabled interrupts will wake up the device form reduced power modes. | ||
9926 | * 0b1..A device wake-up for DMA will occur if the receive FIFO level reaches the value specified by RXLVL in | ||
9927 | * FIFOTRIG, even when the RXLVL interrupt is not enabled. | ||
9928 | */ | ||
9929 | #define SPI_FIFOCFG_WAKERX(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_WAKERX_SHIFT)) & SPI_FIFOCFG_WAKERX_MASK) | ||
9930 | #define SPI_FIFOCFG_EMPTYTX_MASK (0x10000U) | ||
9931 | #define SPI_FIFOCFG_EMPTYTX_SHIFT (16U) | ||
9932 | /*! EMPTYTX - Empty command for the transmit FIFO. When a 1 is written to this bit, the TX FIFO is emptied. | ||
9933 | */ | ||
9934 | #define SPI_FIFOCFG_EMPTYTX(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_EMPTYTX_SHIFT)) & SPI_FIFOCFG_EMPTYTX_MASK) | ||
9935 | #define SPI_FIFOCFG_EMPTYRX_MASK (0x20000U) | ||
9936 | #define SPI_FIFOCFG_EMPTYRX_SHIFT (17U) | ||
9937 | /*! EMPTYRX - Empty command for the receive FIFO. When a 1 is written to this bit, the RX FIFO is emptied. | ||
9938 | */ | ||
9939 | #define SPI_FIFOCFG_EMPTYRX(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOCFG_EMPTYRX_SHIFT)) & SPI_FIFOCFG_EMPTYRX_MASK) | ||
9940 | /*! @} */ | ||
9941 | |||
9942 | /*! @name FIFOSTAT - FIFO status register. */ | ||
9943 | /*! @{ */ | ||
9944 | #define SPI_FIFOSTAT_TXERR_MASK (0x1U) | ||
9945 | #define SPI_FIFOSTAT_TXERR_SHIFT (0U) | ||
9946 | /*! TXERR - TX FIFO error. Will be set if a transmit FIFO error occurs. This could be an overflow | ||
9947 | * caused by pushing data into a full FIFO, or by an underflow if the FIFO is empty when data is | ||
9948 | * needed. Cleared by writing a 1 to this bit. | ||
9949 | */ | ||
9950 | #define SPI_FIFOSTAT_TXERR(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_TXERR_SHIFT)) & SPI_FIFOSTAT_TXERR_MASK) | ||
9951 | #define SPI_FIFOSTAT_RXERR_MASK (0x2U) | ||
9952 | #define SPI_FIFOSTAT_RXERR_SHIFT (1U) | ||
9953 | /*! RXERR - RX FIFO error. Will be set if a receive FIFO overflow occurs, caused by software or DMA | ||
9954 | * not emptying the FIFO fast enough. Cleared by writing a 1 to this bit. | ||
9955 | */ | ||
9956 | #define SPI_FIFOSTAT_RXERR(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_RXERR_SHIFT)) & SPI_FIFOSTAT_RXERR_MASK) | ||
9957 | #define SPI_FIFOSTAT_PERINT_MASK (0x8U) | ||
9958 | #define SPI_FIFOSTAT_PERINT_SHIFT (3U) | ||
9959 | /*! PERINT - Peripheral interrupt. When 1, this indicates that the peripheral function has asserted | ||
9960 | * an interrupt. The details can be found by reading the peripheral's STAT register. | ||
9961 | */ | ||
9962 | #define SPI_FIFOSTAT_PERINT(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_PERINT_SHIFT)) & SPI_FIFOSTAT_PERINT_MASK) | ||
9963 | #define SPI_FIFOSTAT_TXEMPTY_MASK (0x10U) | ||
9964 | #define SPI_FIFOSTAT_TXEMPTY_SHIFT (4U) | ||
9965 | /*! TXEMPTY - Transmit FIFO empty. When 1, the transmit FIFO is empty. The peripheral may still be processing the last piece of data. | ||
9966 | */ | ||
9967 | #define SPI_FIFOSTAT_TXEMPTY(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_TXEMPTY_SHIFT)) & SPI_FIFOSTAT_TXEMPTY_MASK) | ||
9968 | #define SPI_FIFOSTAT_TXNOTFULL_MASK (0x20U) | ||
9969 | #define SPI_FIFOSTAT_TXNOTFULL_SHIFT (5U) | ||
9970 | /*! TXNOTFULL - Transmit FIFO not full. When 1, the transmit FIFO is not full, so more data can be | ||
9971 | * written. When 0, the transmit FIFO is full and another write would cause it to overflow. | ||
9972 | */ | ||
9973 | #define SPI_FIFOSTAT_TXNOTFULL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_TXNOTFULL_SHIFT)) & SPI_FIFOSTAT_TXNOTFULL_MASK) | ||
9974 | #define SPI_FIFOSTAT_RXNOTEMPTY_MASK (0x40U) | ||
9975 | #define SPI_FIFOSTAT_RXNOTEMPTY_SHIFT (6U) | ||
9976 | /*! RXNOTEMPTY - Receive FIFO not empty. When 1, the receive FIFO is not empty, so data can be read. When 0, the receive FIFO is empty. | ||
9977 | */ | ||
9978 | #define SPI_FIFOSTAT_RXNOTEMPTY(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_RXNOTEMPTY_SHIFT)) & SPI_FIFOSTAT_RXNOTEMPTY_MASK) | ||
9979 | #define SPI_FIFOSTAT_RXFULL_MASK (0x80U) | ||
9980 | #define SPI_FIFOSTAT_RXFULL_SHIFT (7U) | ||
9981 | /*! RXFULL - Receive FIFO full. When 1, the receive FIFO is full. Data needs to be read out to | ||
9982 | * prevent the peripheral from causing an overflow. | ||
9983 | */ | ||
9984 | #define SPI_FIFOSTAT_RXFULL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_RXFULL_SHIFT)) & SPI_FIFOSTAT_RXFULL_MASK) | ||
9985 | #define SPI_FIFOSTAT_TXLVL_MASK (0x1F00U) | ||
9986 | #define SPI_FIFOSTAT_TXLVL_SHIFT (8U) | ||
9987 | /*! TXLVL - Transmit FIFO current level. A 0 means the TX FIFO is currently empty, and the TXEMPTY | ||
9988 | * and TXNOTFULL flags will be 1. Other values tell how much data is actually in the TX FIFO at | ||
9989 | * the point where the read occurs. If the TX FIFO is full, the TXEMPTY and TXNOTFULL flags will be | ||
9990 | * 0. | ||
9991 | */ | ||
9992 | #define SPI_FIFOSTAT_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_TXLVL_SHIFT)) & SPI_FIFOSTAT_TXLVL_MASK) | ||
9993 | #define SPI_FIFOSTAT_RXLVL_MASK (0x1F0000U) | ||
9994 | #define SPI_FIFOSTAT_RXLVL_SHIFT (16U) | ||
9995 | /*! RXLVL - Receive FIFO current level. A 0 means the RX FIFO is currently empty, and the RXFULL and | ||
9996 | * RXNOTEMPTY flags will be 0. Other values tell how much data is actually in the RX FIFO at the | ||
9997 | * point where the read occurs. If the RX FIFO is full, the RXFULL and RXNOTEMPTY flags will be | ||
9998 | * 1. | ||
9999 | */ | ||
10000 | #define SPI_FIFOSTAT_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOSTAT_RXLVL_SHIFT)) & SPI_FIFOSTAT_RXLVL_MASK) | ||
10001 | /*! @} */ | ||
10002 | |||
10003 | /*! @name FIFOTRIG - FIFO trigger settings for interrupt and DMA request. */ | ||
10004 | /*! @{ */ | ||
10005 | #define SPI_FIFOTRIG_TXLVLENA_MASK (0x1U) | ||
10006 | #define SPI_FIFOTRIG_TXLVLENA_SHIFT (0U) | ||
10007 | /*! TXLVLENA - Transmit FIFO level trigger enable. This trigger will become an interrupt if enabled | ||
10008 | * in FIFOINTENSET, or a DMA trigger if DMATX in FIFOCFG is set. | ||
10009 | * 0b0..Transmit FIFO level does not generate a FIFO level trigger. | ||
10010 | * 0b1..An trigger will be generated if the transmit FIFO level reaches the value specified by the TXLVL field in this register. | ||
10011 | */ | ||
10012 | #define SPI_FIFOTRIG_TXLVLENA(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOTRIG_TXLVLENA_SHIFT)) & SPI_FIFOTRIG_TXLVLENA_MASK) | ||
10013 | #define SPI_FIFOTRIG_RXLVLENA_MASK (0x2U) | ||
10014 | #define SPI_FIFOTRIG_RXLVLENA_SHIFT (1U) | ||
10015 | /*! RXLVLENA - Receive FIFO level trigger enable. This trigger will become an interrupt if enabled | ||
10016 | * in FIFOINTENSET, or a DMA trigger if DMARX in FIFOCFG is set. | ||
10017 | * 0b0..Receive FIFO level does not generate a FIFO level trigger. | ||
10018 | * 0b1..An trigger will be generated if the receive FIFO level reaches the value specified by the RXLVL field in this register. | ||
10019 | */ | ||
10020 | #define SPI_FIFOTRIG_RXLVLENA(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOTRIG_RXLVLENA_SHIFT)) & SPI_FIFOTRIG_RXLVLENA_MASK) | ||
10021 | #define SPI_FIFOTRIG_TXLVL_MASK (0xF00U) | ||
10022 | #define SPI_FIFOTRIG_TXLVL_SHIFT (8U) | ||
10023 | /*! TXLVL - Transmit FIFO level trigger point. This field is used only when TXLVLENA = 1. If enabled | ||
10024 | * to do so, the FIFO level can wake up the device just enough to perform DMA, then return to | ||
10025 | * the reduced power mode. See Hardware Wake-up control register. 0 = trigger when the TX FIFO | ||
10026 | * becomes empty. 1 = trigger when the TX FIFO level decreases to one entry. 15 = trigger when the TX | ||
10027 | * FIFO level decreases to 15 entries (is no longer full). | ||
10028 | */ | ||
10029 | #define SPI_FIFOTRIG_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOTRIG_TXLVL_SHIFT)) & SPI_FIFOTRIG_TXLVL_MASK) | ||
10030 | #define SPI_FIFOTRIG_RXLVL_MASK (0xF0000U) | ||
10031 | #define SPI_FIFOTRIG_RXLVL_SHIFT (16U) | ||
10032 | /*! RXLVL - Receive FIFO level trigger point. The RX FIFO level is checked when a new piece of data | ||
10033 | * is received. This field is used only when RXLVLENA = 1. If enabled to do so, the FIFO level | ||
10034 | * can wake up the device just enough to perform DMA, then return to the reduced power mode. See | ||
10035 | * Hardware Wake-up control register. 0 = trigger when the RX FIFO has received one entry (is no | ||
10036 | * longer empty). 1 = trigger when the RX FIFO has received two entries. 15 = trigger when the RX | ||
10037 | * FIFO has received 16 entries (has become full). | ||
10038 | */ | ||
10039 | #define SPI_FIFOTRIG_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOTRIG_RXLVL_SHIFT)) & SPI_FIFOTRIG_RXLVL_MASK) | ||
10040 | /*! @} */ | ||
10041 | |||
10042 | /*! @name FIFOINTENSET - FIFO interrupt enable set (enable) and read register. */ | ||
10043 | /*! @{ */ | ||
10044 | #define SPI_FIFOINTENSET_TXERR_MASK (0x1U) | ||
10045 | #define SPI_FIFOINTENSET_TXERR_SHIFT (0U) | ||
10046 | /*! TXERR - Determines whether an interrupt occurs when a transmit error occurs, based on the TXERR flag in the FIFOSTAT register. | ||
10047 | * 0b0..No interrupt will be generated for a transmit error. | ||
10048 | * 0b1..An interrupt will be generated when a transmit error occurs. | ||
10049 | */ | ||
10050 | #define SPI_FIFOINTENSET_TXERR(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTENSET_TXERR_SHIFT)) & SPI_FIFOINTENSET_TXERR_MASK) | ||
10051 | #define SPI_FIFOINTENSET_RXERR_MASK (0x2U) | ||
10052 | #define SPI_FIFOINTENSET_RXERR_SHIFT (1U) | ||
10053 | /*! RXERR - Determines whether an interrupt occurs when a receive error occurs, based on the RXERR flag in the FIFOSTAT register. | ||
10054 | * 0b0..No interrupt will be generated for a receive error. | ||
10055 | * 0b1..An interrupt will be generated when a receive error occurs. | ||
10056 | */ | ||
10057 | #define SPI_FIFOINTENSET_RXERR(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTENSET_RXERR_SHIFT)) & SPI_FIFOINTENSET_RXERR_MASK) | ||
10058 | #define SPI_FIFOINTENSET_TXLVL_MASK (0x4U) | ||
10059 | #define SPI_FIFOINTENSET_TXLVL_SHIFT (2U) | ||
10060 | /*! TXLVL - Determines whether an interrupt occurs when a the transmit FIFO reaches the level | ||
10061 | * specified by the TXLVL field in the FIFOTRIG register. | ||
10062 | * 0b0..No interrupt will be generated based on the TX FIFO level. | ||
10063 | * 0b1..If TXLVLENA in the FIFOTRIG register = 1, an interrupt will be generated when the TX FIFO level decreases | ||
10064 | * to the level specified by TXLVL in the FIFOTRIG register. | ||
10065 | */ | ||
10066 | #define SPI_FIFOINTENSET_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTENSET_TXLVL_SHIFT)) & SPI_FIFOINTENSET_TXLVL_MASK) | ||
10067 | #define SPI_FIFOINTENSET_RXLVL_MASK (0x8U) | ||
10068 | #define SPI_FIFOINTENSET_RXLVL_SHIFT (3U) | ||
10069 | /*! RXLVL - Determines whether an interrupt occurs when a the receive FIFO reaches the level | ||
10070 | * specified by the TXLVL field in the FIFOTRIG register. | ||
10071 | * 0b0..No interrupt will be generated based on the RX FIFO level. | ||
10072 | * 0b1..If RXLVLENA in the FIFOTRIG register = 1, an interrupt will be generated when the when the RX FIFO level | ||
10073 | * increases to the level specified by RXLVL in the FIFOTRIG register. | ||
10074 | */ | ||
10075 | #define SPI_FIFOINTENSET_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTENSET_RXLVL_SHIFT)) & SPI_FIFOINTENSET_RXLVL_MASK) | ||
10076 | /*! @} */ | ||
10077 | |||
10078 | /*! @name FIFOINTENCLR - FIFO interrupt enable clear (disable) and read register. */ | ||
10079 | /*! @{ */ | ||
10080 | #define SPI_FIFOINTENCLR_TXERR_MASK (0x1U) | ||
10081 | #define SPI_FIFOINTENCLR_TXERR_SHIFT (0U) | ||
10082 | /*! TXERR - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
10083 | */ | ||
10084 | #define SPI_FIFOINTENCLR_TXERR(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTENCLR_TXERR_SHIFT)) & SPI_FIFOINTENCLR_TXERR_MASK) | ||
10085 | #define SPI_FIFOINTENCLR_RXERR_MASK (0x2U) | ||
10086 | #define SPI_FIFOINTENCLR_RXERR_SHIFT (1U) | ||
10087 | /*! RXERR - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
10088 | */ | ||
10089 | #define SPI_FIFOINTENCLR_RXERR(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTENCLR_RXERR_SHIFT)) & SPI_FIFOINTENCLR_RXERR_MASK) | ||
10090 | #define SPI_FIFOINTENCLR_TXLVL_MASK (0x4U) | ||
10091 | #define SPI_FIFOINTENCLR_TXLVL_SHIFT (2U) | ||
10092 | /*! TXLVL - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
10093 | */ | ||
10094 | #define SPI_FIFOINTENCLR_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTENCLR_TXLVL_SHIFT)) & SPI_FIFOINTENCLR_TXLVL_MASK) | ||
10095 | #define SPI_FIFOINTENCLR_RXLVL_MASK (0x8U) | ||
10096 | #define SPI_FIFOINTENCLR_RXLVL_SHIFT (3U) | ||
10097 | /*! RXLVL - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
10098 | */ | ||
10099 | #define SPI_FIFOINTENCLR_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTENCLR_RXLVL_SHIFT)) & SPI_FIFOINTENCLR_RXLVL_MASK) | ||
10100 | /*! @} */ | ||
10101 | |||
10102 | /*! @name FIFOINTSTAT - FIFO interrupt status register. */ | ||
10103 | /*! @{ */ | ||
10104 | #define SPI_FIFOINTSTAT_TXERR_MASK (0x1U) | ||
10105 | #define SPI_FIFOINTSTAT_TXERR_SHIFT (0U) | ||
10106 | /*! TXERR - TX FIFO error. | ||
10107 | */ | ||
10108 | #define SPI_FIFOINTSTAT_TXERR(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTSTAT_TXERR_SHIFT)) & SPI_FIFOINTSTAT_TXERR_MASK) | ||
10109 | #define SPI_FIFOINTSTAT_RXERR_MASK (0x2U) | ||
10110 | #define SPI_FIFOINTSTAT_RXERR_SHIFT (1U) | ||
10111 | /*! RXERR - RX FIFO error. | ||
10112 | */ | ||
10113 | #define SPI_FIFOINTSTAT_RXERR(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTSTAT_RXERR_SHIFT)) & SPI_FIFOINTSTAT_RXERR_MASK) | ||
10114 | #define SPI_FIFOINTSTAT_TXLVL_MASK (0x4U) | ||
10115 | #define SPI_FIFOINTSTAT_TXLVL_SHIFT (2U) | ||
10116 | /*! TXLVL - Transmit FIFO level interrupt. | ||
10117 | */ | ||
10118 | #define SPI_FIFOINTSTAT_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTSTAT_TXLVL_SHIFT)) & SPI_FIFOINTSTAT_TXLVL_MASK) | ||
10119 | #define SPI_FIFOINTSTAT_RXLVL_MASK (0x8U) | ||
10120 | #define SPI_FIFOINTSTAT_RXLVL_SHIFT (3U) | ||
10121 | /*! RXLVL - Receive FIFO level interrupt. | ||
10122 | */ | ||
10123 | #define SPI_FIFOINTSTAT_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTSTAT_RXLVL_SHIFT)) & SPI_FIFOINTSTAT_RXLVL_MASK) | ||
10124 | #define SPI_FIFOINTSTAT_PERINT_MASK (0x10U) | ||
10125 | #define SPI_FIFOINTSTAT_PERINT_SHIFT (4U) | ||
10126 | /*! PERINT - Peripheral interrupt. | ||
10127 | */ | ||
10128 | #define SPI_FIFOINTSTAT_PERINT(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOINTSTAT_PERINT_SHIFT)) & SPI_FIFOINTSTAT_PERINT_MASK) | ||
10129 | /*! @} */ | ||
10130 | |||
10131 | /*! @name FIFOWR - FIFO write data. */ | ||
10132 | /*! @{ */ | ||
10133 | #define SPI_FIFOWR_TXDATA_MASK (0xFFFFU) | ||
10134 | #define SPI_FIFOWR_TXDATA_SHIFT (0U) | ||
10135 | /*! TXDATA - Transmit data to the FIFO. | ||
10136 | */ | ||
10137 | #define SPI_FIFOWR_TXDATA(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_TXDATA_SHIFT)) & SPI_FIFOWR_TXDATA_MASK) | ||
10138 | #define SPI_FIFOWR_TXSSEL0_N_MASK (0x10000U) | ||
10139 | #define SPI_FIFOWR_TXSSEL0_N_SHIFT (16U) | ||
10140 | /*! TXSSEL0_N - Transmit slave select. This field asserts SSEL0 in master mode. The output on the pin is active LOW by default. | ||
10141 | * 0b0..SSEL0 asserted. | ||
10142 | * 0b1..SSEL0 not asserted. | ||
10143 | */ | ||
10144 | #define SPI_FIFOWR_TXSSEL0_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_TXSSEL0_N_SHIFT)) & SPI_FIFOWR_TXSSEL0_N_MASK) | ||
10145 | #define SPI_FIFOWR_TXSSEL1_N_MASK (0x20000U) | ||
10146 | #define SPI_FIFOWR_TXSSEL1_N_SHIFT (17U) | ||
10147 | /*! TXSSEL1_N - Transmit slave select. This field asserts SSEL1 in master mode. The output on the pin is active LOW by default. | ||
10148 | * 0b0..SSEL1 asserted. | ||
10149 | * 0b1..SSEL1 not asserted. | ||
10150 | */ | ||
10151 | #define SPI_FIFOWR_TXSSEL1_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_TXSSEL1_N_SHIFT)) & SPI_FIFOWR_TXSSEL1_N_MASK) | ||
10152 | #define SPI_FIFOWR_TXSSEL2_N_MASK (0x40000U) | ||
10153 | #define SPI_FIFOWR_TXSSEL2_N_SHIFT (18U) | ||
10154 | /*! TXSSEL2_N - Transmit slave select. This field asserts SSEL2 in master mode. The output on the pin is active LOW by default. | ||
10155 | * 0b0..SSEL2 asserted. | ||
10156 | * 0b1..SSEL2 not asserted. | ||
10157 | */ | ||
10158 | #define SPI_FIFOWR_TXSSEL2_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_TXSSEL2_N_SHIFT)) & SPI_FIFOWR_TXSSEL2_N_MASK) | ||
10159 | #define SPI_FIFOWR_TXSSEL3_N_MASK (0x80000U) | ||
10160 | #define SPI_FIFOWR_TXSSEL3_N_SHIFT (19U) | ||
10161 | /*! TXSSEL3_N - Transmit slave select. This field asserts SSEL3 in master mode. The output on the pin is active LOW by default. | ||
10162 | * 0b0..SSEL3 asserted. | ||
10163 | * 0b1..SSEL3 not asserted. | ||
10164 | */ | ||
10165 | #define SPI_FIFOWR_TXSSEL3_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_TXSSEL3_N_SHIFT)) & SPI_FIFOWR_TXSSEL3_N_MASK) | ||
10166 | #define SPI_FIFOWR_EOT_MASK (0x100000U) | ||
10167 | #define SPI_FIFOWR_EOT_SHIFT (20U) | ||
10168 | /*! EOT - End of transfer. The asserted SSEL will be deasserted at the end of a transfer and remain | ||
10169 | * so far at least the time specified by the Transfer_delay value in the DLY register. | ||
10170 | * 0b0..SSEL not deasserted. This piece of data is not treated as the end of a transfer. SSEL will not be deasserted at the end of this data. | ||
10171 | * 0b1..SSEL deasserted. This piece of data is treated as the end of a transfer. SSEL will be deasserted at the end of this piece of data. | ||
10172 | */ | ||
10173 | #define SPI_FIFOWR_EOT(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_EOT_SHIFT)) & SPI_FIFOWR_EOT_MASK) | ||
10174 | #define SPI_FIFOWR_EOF_MASK (0x200000U) | ||
10175 | #define SPI_FIFOWR_EOF_SHIFT (21U) | ||
10176 | /*! EOF - End of frame. Between frames, a delay may be inserted, as defined by the Frame_delay value | ||
10177 | * in the DLY register. The end of a frame may not be particularly meaningful if the Frame_delay | ||
10178 | * value = 0. This control can be used as part of the support for frame lengths greater than 16 | ||
10179 | * bits. | ||
10180 | * 0b0..Data not EOF. This piece of data transmitted is not treated as the end of a frame. | ||
10181 | * 0b1..Data EOF. This piece of data is treated as the end of a frame, causing the Frame_delay time to be | ||
10182 | * inserted before subsequent data is transmitted. | ||
10183 | */ | ||
10184 | #define SPI_FIFOWR_EOF(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_EOF_SHIFT)) & SPI_FIFOWR_EOF_MASK) | ||
10185 | #define SPI_FIFOWR_RXIGNORE_MASK (0x400000U) | ||
10186 | #define SPI_FIFOWR_RXIGNORE_SHIFT (22U) | ||
10187 | /*! RXIGNORE - Receive Ignore. This allows data to be transmitted using the SPI without the need to | ||
10188 | * read unneeded data from the receiver. Setting this bit simplifies the transmit process and can | ||
10189 | * be used with the DMA. | ||
10190 | * 0b0..Read received data. Received data must be read in order to allow transmission to progress. SPI transmit | ||
10191 | * will halt when the receive data FIFO is full. In slave mode, an overrun error will occur if received data | ||
10192 | * is not read before new data is received. | ||
10193 | * 0b1..Ignore received data. Received data is ignored, allowing transmission without reading unneeded received | ||
10194 | * data. No receiver flags are generated. | ||
10195 | */ | ||
10196 | #define SPI_FIFOWR_RXIGNORE(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_RXIGNORE_SHIFT)) & SPI_FIFOWR_RXIGNORE_MASK) | ||
10197 | #define SPI_FIFOWR_LEN_MASK (0xF000000U) | ||
10198 | #define SPI_FIFOWR_LEN_SHIFT (24U) | ||
10199 | /*! LEN - Data Length. Specifies the data length from 4 to 16 bits. Note that transfer lengths | ||
10200 | * greater than 16 bits are supported by implementing multiple sequential transmits. 0x0-2 = Reserved. | ||
10201 | * 0x3 = Data transfer is 4 bits in length. 0x4 = Data transfer is 5 bits in length. 0xF = Data | ||
10202 | * transfer is 16 bits in length. | ||
10203 | */ | ||
10204 | #define SPI_FIFOWR_LEN(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFOWR_LEN_SHIFT)) & SPI_FIFOWR_LEN_MASK) | ||
10205 | /*! @} */ | ||
10206 | |||
10207 | /*! @name FIFORD - FIFO read data. */ | ||
10208 | /*! @{ */ | ||
10209 | #define SPI_FIFORD_RXDATA_MASK (0xFFFFU) | ||
10210 | #define SPI_FIFORD_RXDATA_SHIFT (0U) | ||
10211 | /*! RXDATA - Received data from the FIFO. | ||
10212 | */ | ||
10213 | #define SPI_FIFORD_RXDATA(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORD_RXDATA_SHIFT)) & SPI_FIFORD_RXDATA_MASK) | ||
10214 | #define SPI_FIFORD_RXSSEL0_N_MASK (0x10000U) | ||
10215 | #define SPI_FIFORD_RXSSEL0_N_SHIFT (16U) | ||
10216 | /*! RXSSEL0_N - Slave Select for receive. This field allows the state of the SSEL0 pin to be saved | ||
10217 | * along with received data. The value will reflect the SSEL0 pin for both master and slave | ||
10218 | * operation. A zero indicates that a slave select is active. The actual polarity of each slave select | ||
10219 | * pin is configured by the related SPOL bit in CFG. | ||
10220 | */ | ||
10221 | #define SPI_FIFORD_RXSSEL0_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORD_RXSSEL0_N_SHIFT)) & SPI_FIFORD_RXSSEL0_N_MASK) | ||
10222 | #define SPI_FIFORD_RXSSEL1_N_MASK (0x20000U) | ||
10223 | #define SPI_FIFORD_RXSSEL1_N_SHIFT (17U) | ||
10224 | /*! RXSSEL1_N - Slave Select for receive. This field allows the state of the SSEL1 pin to be saved | ||
10225 | * along with received data. The value will reflect the SSEL1 pin for both master and slave | ||
10226 | * operation. A zero indicates that a slave select is active. The actual polarity of each slave select | ||
10227 | * pin is configured by the related SPOL bit in CFG. | ||
10228 | */ | ||
10229 | #define SPI_FIFORD_RXSSEL1_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORD_RXSSEL1_N_SHIFT)) & SPI_FIFORD_RXSSEL1_N_MASK) | ||
10230 | #define SPI_FIFORD_RXSSEL2_N_MASK (0x40000U) | ||
10231 | #define SPI_FIFORD_RXSSEL2_N_SHIFT (18U) | ||
10232 | /*! RXSSEL2_N - Slave Select for receive. This field allows the state of the SSEL2 pin to be saved | ||
10233 | * along with received data. The value will reflect the SSEL2 pin for both master and slave | ||
10234 | * operation. A zero indicates that a slave select is active. The actual polarity of each slave select | ||
10235 | * pin is configured by the related SPOL bit in CFG. | ||
10236 | */ | ||
10237 | #define SPI_FIFORD_RXSSEL2_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORD_RXSSEL2_N_SHIFT)) & SPI_FIFORD_RXSSEL2_N_MASK) | ||
10238 | #define SPI_FIFORD_RXSSEL3_N_MASK (0x80000U) | ||
10239 | #define SPI_FIFORD_RXSSEL3_N_SHIFT (19U) | ||
10240 | /*! RXSSEL3_N - Slave Select for receive. This field allows the state of the SSEL3 pin to be saved | ||
10241 | * along with received data. The value will reflect the SSEL3 pin for both master and slave | ||
10242 | * operation. A zero indicates that a slave select is active. The actual polarity of each slave select | ||
10243 | * pin is configured by the related SPOL bit in CFG. | ||
10244 | */ | ||
10245 | #define SPI_FIFORD_RXSSEL3_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORD_RXSSEL3_N_SHIFT)) & SPI_FIFORD_RXSSEL3_N_MASK) | ||
10246 | #define SPI_FIFORD_SOT_MASK (0x100000U) | ||
10247 | #define SPI_FIFORD_SOT_SHIFT (20U) | ||
10248 | /*! SOT - Start of Transfer flag. This flag will be 1 if this is the first data after the SSELs went | ||
10249 | * from deasserted to asserted (i.e., any previous transfer has ended). This information can be | ||
10250 | * used to identify the first piece of data in cases where the transfer length is greater than 16 | ||
10251 | * bits. | ||
10252 | */ | ||
10253 | #define SPI_FIFORD_SOT(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORD_SOT_SHIFT)) & SPI_FIFORD_SOT_MASK) | ||
10254 | /*! @} */ | ||
10255 | |||
10256 | /*! @name FIFORDNOPOP - FIFO data read with no FIFO pop. */ | ||
10257 | /*! @{ */ | ||
10258 | #define SPI_FIFORDNOPOP_RXDATA_MASK (0xFFFFU) | ||
10259 | #define SPI_FIFORDNOPOP_RXDATA_SHIFT (0U) | ||
10260 | /*! RXDATA - Received data from the FIFO. | ||
10261 | */ | ||
10262 | #define SPI_FIFORDNOPOP_RXDATA(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORDNOPOP_RXDATA_SHIFT)) & SPI_FIFORDNOPOP_RXDATA_MASK) | ||
10263 | #define SPI_FIFORDNOPOP_RXSSEL0_N_MASK (0x10000U) | ||
10264 | #define SPI_FIFORDNOPOP_RXSSEL0_N_SHIFT (16U) | ||
10265 | /*! RXSSEL0_N - Slave Select for receive. | ||
10266 | */ | ||
10267 | #define SPI_FIFORDNOPOP_RXSSEL0_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORDNOPOP_RXSSEL0_N_SHIFT)) & SPI_FIFORDNOPOP_RXSSEL0_N_MASK) | ||
10268 | #define SPI_FIFORDNOPOP_RXSSEL1_N_MASK (0x20000U) | ||
10269 | #define SPI_FIFORDNOPOP_RXSSEL1_N_SHIFT (17U) | ||
10270 | /*! RXSSEL1_N - Slave Select for receive. | ||
10271 | */ | ||
10272 | #define SPI_FIFORDNOPOP_RXSSEL1_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORDNOPOP_RXSSEL1_N_SHIFT)) & SPI_FIFORDNOPOP_RXSSEL1_N_MASK) | ||
10273 | #define SPI_FIFORDNOPOP_RXSSEL2_N_MASK (0x40000U) | ||
10274 | #define SPI_FIFORDNOPOP_RXSSEL2_N_SHIFT (18U) | ||
10275 | /*! RXSSEL2_N - Slave Select for receive. | ||
10276 | */ | ||
10277 | #define SPI_FIFORDNOPOP_RXSSEL2_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORDNOPOP_RXSSEL2_N_SHIFT)) & SPI_FIFORDNOPOP_RXSSEL2_N_MASK) | ||
10278 | #define SPI_FIFORDNOPOP_RXSSEL3_N_MASK (0x80000U) | ||
10279 | #define SPI_FIFORDNOPOP_RXSSEL3_N_SHIFT (19U) | ||
10280 | /*! RXSSEL3_N - Slave Select for receive. | ||
10281 | */ | ||
10282 | #define SPI_FIFORDNOPOP_RXSSEL3_N(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORDNOPOP_RXSSEL3_N_SHIFT)) & SPI_FIFORDNOPOP_RXSSEL3_N_MASK) | ||
10283 | #define SPI_FIFORDNOPOP_SOT_MASK (0x100000U) | ||
10284 | #define SPI_FIFORDNOPOP_SOT_SHIFT (20U) | ||
10285 | /*! SOT - Start of transfer flag. | ||
10286 | */ | ||
10287 | #define SPI_FIFORDNOPOP_SOT(x) (((uint32_t)(((uint32_t)(x)) << SPI_FIFORDNOPOP_SOT_SHIFT)) & SPI_FIFORDNOPOP_SOT_MASK) | ||
10288 | /*! @} */ | ||
10289 | |||
10290 | /*! @name ID - Peripheral identification register. */ | ||
10291 | /*! @{ */ | ||
10292 | #define SPI_ID_APERTURE_MASK (0xFFU) | ||
10293 | #define SPI_ID_APERTURE_SHIFT (0U) | ||
10294 | /*! APERTURE - Aperture: encoded as (aperture size/4K) -1, so 0x00 means a 4K aperture. | ||
10295 | */ | ||
10296 | #define SPI_ID_APERTURE(x) (((uint32_t)(((uint32_t)(x)) << SPI_ID_APERTURE_SHIFT)) & SPI_ID_APERTURE_MASK) | ||
10297 | #define SPI_ID_MINOR_REV_MASK (0xF00U) | ||
10298 | #define SPI_ID_MINOR_REV_SHIFT (8U) | ||
10299 | /*! MINOR_REV - Minor revision of module implementation. | ||
10300 | */ | ||
10301 | #define SPI_ID_MINOR_REV(x) (((uint32_t)(((uint32_t)(x)) << SPI_ID_MINOR_REV_SHIFT)) & SPI_ID_MINOR_REV_MASK) | ||
10302 | #define SPI_ID_MAJOR_REV_MASK (0xF000U) | ||
10303 | #define SPI_ID_MAJOR_REV_SHIFT (12U) | ||
10304 | /*! MAJOR_REV - Major revision of module implementation. | ||
10305 | */ | ||
10306 | #define SPI_ID_MAJOR_REV(x) (((uint32_t)(((uint32_t)(x)) << SPI_ID_MAJOR_REV_SHIFT)) & SPI_ID_MAJOR_REV_MASK) | ||
10307 | #define SPI_ID_ID_MASK (0xFFFF0000U) | ||
10308 | #define SPI_ID_ID_SHIFT (16U) | ||
10309 | /*! ID - Module identifier for the selected function. | ||
10310 | */ | ||
10311 | #define SPI_ID_ID(x) (((uint32_t)(((uint32_t)(x)) << SPI_ID_ID_SHIFT)) & SPI_ID_ID_MASK) | ||
10312 | /*! @} */ | ||
10313 | |||
10314 | |||
10315 | /*! | ||
10316 | * @} | ||
10317 | */ /* end of group SPI_Register_Masks */ | ||
10318 | |||
10319 | |||
10320 | /* SPI - Peripheral instance base addresses */ | ||
10321 | /** Peripheral SPI0 base address */ | ||
10322 | #define SPI0_BASE (0x40086000u) | ||
10323 | /** Peripheral SPI0 base pointer */ | ||
10324 | #define SPI0 ((SPI_Type *)SPI0_BASE) | ||
10325 | /** Peripheral SPI1 base address */ | ||
10326 | #define SPI1_BASE (0x40087000u) | ||
10327 | /** Peripheral SPI1 base pointer */ | ||
10328 | #define SPI1 ((SPI_Type *)SPI1_BASE) | ||
10329 | /** Peripheral SPI2 base address */ | ||
10330 | #define SPI2_BASE (0x40088000u) | ||
10331 | /** Peripheral SPI2 base pointer */ | ||
10332 | #define SPI2 ((SPI_Type *)SPI2_BASE) | ||
10333 | /** Peripheral SPI3 base address */ | ||
10334 | #define SPI3_BASE (0x40089000u) | ||
10335 | /** Peripheral SPI3 base pointer */ | ||
10336 | #define SPI3 ((SPI_Type *)SPI3_BASE) | ||
10337 | /** Peripheral SPI4 base address */ | ||
10338 | #define SPI4_BASE (0x4008A000u) | ||
10339 | /** Peripheral SPI4 base pointer */ | ||
10340 | #define SPI4 ((SPI_Type *)SPI4_BASE) | ||
10341 | /** Peripheral SPI5 base address */ | ||
10342 | #define SPI5_BASE (0x40096000u) | ||
10343 | /** Peripheral SPI5 base pointer */ | ||
10344 | #define SPI5 ((SPI_Type *)SPI5_BASE) | ||
10345 | /** Peripheral SPI6 base address */ | ||
10346 | #define SPI6_BASE (0x40097000u) | ||
10347 | /** Peripheral SPI6 base pointer */ | ||
10348 | #define SPI6 ((SPI_Type *)SPI6_BASE) | ||
10349 | /** Peripheral SPI7 base address */ | ||
10350 | #define SPI7_BASE (0x40098000u) | ||
10351 | /** Peripheral SPI7 base pointer */ | ||
10352 | #define SPI7 ((SPI_Type *)SPI7_BASE) | ||
10353 | /** Peripheral SPI8 base address */ | ||
10354 | #define SPI8_BASE (0x40099000u) | ||
10355 | /** Peripheral SPI8 base pointer */ | ||
10356 | #define SPI8 ((SPI_Type *)SPI8_BASE) | ||
10357 | /** Peripheral SPI9 base address */ | ||
10358 | #define SPI9_BASE (0x4009A000u) | ||
10359 | /** Peripheral SPI9 base pointer */ | ||
10360 | #define SPI9 ((SPI_Type *)SPI9_BASE) | ||
10361 | /** Peripheral SPI10 base address */ | ||
10362 | #define SPI10_BASE (0x4009F000u) | ||
10363 | /** Peripheral SPI10 base pointer */ | ||
10364 | #define SPI10 ((SPI_Type *)SPI10_BASE) | ||
10365 | /** Array initializer of SPI peripheral base addresses */ | ||
10366 | #define SPI_BASE_ADDRS { SPI0_BASE, SPI1_BASE, SPI2_BASE, SPI3_BASE, SPI4_BASE, SPI5_BASE, SPI6_BASE, SPI7_BASE, SPI8_BASE, SPI9_BASE, SPI10_BASE } | ||
10367 | /** Array initializer of SPI peripheral base pointers */ | ||
10368 | #define SPI_BASE_PTRS { SPI0, SPI1, SPI2, SPI3, SPI4, SPI5, SPI6, SPI7, SPI8, SPI9, SPI10 } | ||
10369 | /** Interrupt vectors for the SPI peripheral type */ | ||
10370 | #define SPI_IRQS { FLEXCOMM0_IRQn, FLEXCOMM1_IRQn, FLEXCOMM2_IRQn, FLEXCOMM3_IRQn, FLEXCOMM4_IRQn, FLEXCOMM5_IRQn, FLEXCOMM6_IRQn, FLEXCOMM7_IRQn, FLEXCOMM8_IRQn, FLEXCOMM9_IRQn, FLEXCOMM10_IRQn } | ||
10371 | |||
10372 | /*! | ||
10373 | * @} | ||
10374 | */ /* end of group SPI_Peripheral_Access_Layer */ | ||
10375 | |||
10376 | |||
10377 | /* ---------------------------------------------------------------------------- | ||
10378 | -- SPIFI Peripheral Access Layer | ||
10379 | ---------------------------------------------------------------------------- */ | ||
10380 | |||
10381 | /*! | ||
10382 | * @addtogroup SPIFI_Peripheral_Access_Layer SPIFI Peripheral Access Layer | ||
10383 | * @{ | ||
10384 | */ | ||
10385 | |||
10386 | /** SPIFI - Register Layout Typedef */ | ||
10387 | typedef struct { | ||
10388 | __IO uint32_t CTRL; /**< SPIFI control register, offset: 0x0 */ | ||
10389 | __IO uint32_t CMD; /**< SPIFI command register, offset: 0x4 */ | ||
10390 | __IO uint32_t ADDR; /**< SPIFI address register, offset: 0x8 */ | ||
10391 | __IO uint32_t IDATA; /**< SPIFI intermediate data register, offset: 0xC */ | ||
10392 | __IO uint32_t CLIMIT; /**< SPIFI limit register, offset: 0x10 */ | ||
10393 | __IO uint32_t DATA; /**< SPIFI data register, offset: 0x14 */ | ||
10394 | __IO uint32_t MCMD; /**< SPIFI memory command register, offset: 0x18 */ | ||
10395 | __IO uint32_t STAT; /**< SPIFI status register, offset: 0x1C */ | ||
10396 | } SPIFI_Type; | ||
10397 | |||
10398 | /* ---------------------------------------------------------------------------- | ||
10399 | -- SPIFI Register Masks | ||
10400 | ---------------------------------------------------------------------------- */ | ||
10401 | |||
10402 | /*! | ||
10403 | * @addtogroup SPIFI_Register_Masks SPIFI Register Masks | ||
10404 | * @{ | ||
10405 | */ | ||
10406 | |||
10407 | /*! @name CTRL - SPIFI control register */ | ||
10408 | /*! @{ */ | ||
10409 | #define SPIFI_CTRL_TIMEOUT_MASK (0xFFFFU) | ||
10410 | #define SPIFI_CTRL_TIMEOUT_SHIFT (0U) | ||
10411 | /*! TIMEOUT - This field contains the number of serial clock periods without the processor reading | ||
10412 | * data in memory mode, which will cause the SPIFI hardware to terminate the command by driving | ||
10413 | * the CS pin high and negating the CMD bit in the Status register. (This allows the flash memory | ||
10414 | * to enter a lower-power state.) If the processor reads data from the flash region after a | ||
10415 | * time-out, the command in the Memory Command Register is issued again. | ||
10416 | */ | ||
10417 | #define SPIFI_CTRL_TIMEOUT(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_TIMEOUT_SHIFT)) & SPIFI_CTRL_TIMEOUT_MASK) | ||
10418 | #define SPIFI_CTRL_CSHIGH_MASK (0xF0000U) | ||
10419 | #define SPIFI_CTRL_CSHIGH_SHIFT (16U) | ||
10420 | /*! CSHIGH - This field controls the minimum CS high time, expressed as a number of serial clock periods minus one. | ||
10421 | */ | ||
10422 | #define SPIFI_CTRL_CSHIGH(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_CSHIGH_SHIFT)) & SPIFI_CTRL_CSHIGH_MASK) | ||
10423 | #define SPIFI_CTRL_D_PRFTCH_DIS_MASK (0x200000U) | ||
10424 | #define SPIFI_CTRL_D_PRFTCH_DIS_SHIFT (21U) | ||
10425 | /*! D_PRFTCH_DIS - This bit allows conditioning of memory mode prefetches based on the AHB HPROT | ||
10426 | * (instruction/data) access information. A 1 in this register means that the SPIFI will not attempt | ||
10427 | * a speculative prefetch when it encounters data accesses. | ||
10428 | */ | ||
10429 | #define SPIFI_CTRL_D_PRFTCH_DIS(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_D_PRFTCH_DIS_SHIFT)) & SPIFI_CTRL_D_PRFTCH_DIS_MASK) | ||
10430 | #define SPIFI_CTRL_INTEN_MASK (0x400000U) | ||
10431 | #define SPIFI_CTRL_INTEN_SHIFT (22U) | ||
10432 | /*! INTEN - If this bit is 1 when a command ends, the SPIFI will assert its interrupt request | ||
10433 | * output. See INTRQ in the status register for further details. | ||
10434 | */ | ||
10435 | #define SPIFI_CTRL_INTEN(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_INTEN_SHIFT)) & SPIFI_CTRL_INTEN_MASK) | ||
10436 | #define SPIFI_CTRL_MODE3_MASK (0x800000U) | ||
10437 | #define SPIFI_CTRL_MODE3_SHIFT (23U) | ||
10438 | /*! MODE3 - SPI Mode 3 select. | ||
10439 | * 0b0..SCK LOW. The SPIFI drives SCK low after the rising edge at which the last bit of each command is | ||
10440 | * captured, and keeps it low while CS is HIGH. | ||
10441 | * 0b1..SCK HIGH. the SPIFI keeps SCK high after the rising edge for the last bit of each command and while CS is | ||
10442 | * HIGH, and drives it low after it drives CS LOW. (Known serial flash devices can handle either mode, but | ||
10443 | * some devices may require a particular mode for proper operation.) MODE3, RFCLK, and FBCLK should not all be | ||
10444 | * 1, because in this case there is no final falling edge on SCK on which to sample the last data bit of the | ||
10445 | * frame. | ||
10446 | */ | ||
10447 | #define SPIFI_CTRL_MODE3(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_MODE3_SHIFT)) & SPIFI_CTRL_MODE3_MASK) | ||
10448 | #define SPIFI_CTRL_PRFTCH_DIS_MASK (0x8000000U) | ||
10449 | #define SPIFI_CTRL_PRFTCH_DIS_SHIFT (27U) | ||
10450 | /*! PRFTCH_DIS - Cache prefetching enable. The SPIFI includes an internal cache. A 1 in this bit disables prefetching of cache lines. | ||
10451 | * 0b0..Enable. Cache prefetching enabled. | ||
10452 | * 0b1..Disable. Disables prefetching of cache lines. | ||
10453 | */ | ||
10454 | #define SPIFI_CTRL_PRFTCH_DIS(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_PRFTCH_DIS_SHIFT)) & SPIFI_CTRL_PRFTCH_DIS_MASK) | ||
10455 | #define SPIFI_CTRL_DUAL_MASK (0x10000000U) | ||
10456 | #define SPIFI_CTRL_DUAL_SHIFT (28U) | ||
10457 | /*! DUAL - Select dual protocol. | ||
10458 | * 0b0..Quad protocol. This protocol uses IO3:0. | ||
10459 | * 0b1..Dual protocol. This protocol uses IO1:0. | ||
10460 | */ | ||
10461 | #define SPIFI_CTRL_DUAL(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_DUAL_SHIFT)) & SPIFI_CTRL_DUAL_MASK) | ||
10462 | #define SPIFI_CTRL_RFCLK_MASK (0x20000000U) | ||
10463 | #define SPIFI_CTRL_RFCLK_SHIFT (29U) | ||
10464 | /*! RFCLK - Select active clock edge for input data. | ||
10465 | * 0b0..Rising edge. Read data is sampled on rising edges on the clock, as in classic SPI operation. | ||
10466 | * 0b1..Falling edge. Read data is sampled on falling edges of the clock, allowing a full serial clock of of time | ||
10467 | * in order to maximize the serial clock frequency. MODE3, RFCLK, and FBCLK should not all be 1, because in | ||
10468 | * this case there is no final falling edge on SCK on which to sample the last data bit of the frame. | ||
10469 | */ | ||
10470 | #define SPIFI_CTRL_RFCLK(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_RFCLK_SHIFT)) & SPIFI_CTRL_RFCLK_MASK) | ||
10471 | #define SPIFI_CTRL_FBCLK_MASK (0x40000000U) | ||
10472 | #define SPIFI_CTRL_FBCLK_SHIFT (30U) | ||
10473 | /*! FBCLK - Feedback clock select. | ||
10474 | * 0b0..Internal clock. The SPIFI samples read data using an internal clock. | ||
10475 | * 0b1..Feedback clock. Read data is sampled using a feedback clock from the SCK pin. This allows slightly more | ||
10476 | * time for each received bit. MODE3, RFCLK, and FBCLK should not all be 1, because in this case there is no | ||
10477 | * final falling edge on SCK on which to sample the last data bit of the frame. | ||
10478 | */ | ||
10479 | #define SPIFI_CTRL_FBCLK(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_FBCLK_SHIFT)) & SPIFI_CTRL_FBCLK_MASK) | ||
10480 | #define SPIFI_CTRL_DMAEN_MASK (0x80000000U) | ||
10481 | #define SPIFI_CTRL_DMAEN_SHIFT (31U) | ||
10482 | /*! DMAEN - A 1 in this bit enables the DMA Request output from the SPIFI. Set this bit only when a | ||
10483 | * DMA channel is used to transfer data in peripheral mode. Do not set this bit when a DMA | ||
10484 | * channel is used for memory-to-memory transfers from the SPIFI memory area. DMAEN should only be used | ||
10485 | * in Command mode. | ||
10486 | */ | ||
10487 | #define SPIFI_CTRL_DMAEN(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CTRL_DMAEN_SHIFT)) & SPIFI_CTRL_DMAEN_MASK) | ||
10488 | /*! @} */ | ||
10489 | |||
10490 | /*! @name CMD - SPIFI command register */ | ||
10491 | /*! @{ */ | ||
10492 | #define SPIFI_CMD_DATALEN_MASK (0x3FFFU) | ||
10493 | #define SPIFI_CMD_DATALEN_SHIFT (0U) | ||
10494 | /*! DATALEN - Except when the POLL bit in this register is 1, this field controls how many data | ||
10495 | * bytes are in the command. 0 indicates that the command does not contain a data field. | ||
10496 | */ | ||
10497 | #define SPIFI_CMD_DATALEN(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CMD_DATALEN_SHIFT)) & SPIFI_CMD_DATALEN_MASK) | ||
10498 | #define SPIFI_CMD_POLL_MASK (0x4000U) | ||
10499 | #define SPIFI_CMD_POLL_SHIFT (14U) | ||
10500 | /*! POLL - This bit should be written as 1 only with an opcode that a) contains an input data field, | ||
10501 | * and b) causes the serial flash device to return byte status repetitively (e.g., a Read Status | ||
10502 | * command). When this bit is 1, the SPIFI hardware continues to read bytes until the test | ||
10503 | * specified by the DATALEN field is met. The hardware tests the bit in each status byte selected by | ||
10504 | * DATALEN bits 2:0, until a bit is found that is equal to DATALEN bit 3. When the test succeeds, | ||
10505 | * the SPIFI captures the byte that meets this test so that it can be read from the Data | ||
10506 | * Register, and terminates the command by raising CS. The end-of-command interrupt can be enabled to | ||
10507 | * inform software when this occurs | ||
10508 | */ | ||
10509 | #define SPIFI_CMD_POLL(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CMD_POLL_SHIFT)) & SPIFI_CMD_POLL_MASK) | ||
10510 | #define SPIFI_CMD_DOUT_MASK (0x8000U) | ||
10511 | #define SPIFI_CMD_DOUT_SHIFT (15U) | ||
10512 | /*! DOUT - If the DATALEN field is not zero, this bit controls the direction of the data: | ||
10513 | * 0b0..Input from serial flash. | ||
10514 | * 0b1..Output to serial flash. | ||
10515 | */ | ||
10516 | #define SPIFI_CMD_DOUT(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CMD_DOUT_SHIFT)) & SPIFI_CMD_DOUT_MASK) | ||
10517 | #define SPIFI_CMD_INTLEN_MASK (0x70000U) | ||
10518 | #define SPIFI_CMD_INTLEN_SHIFT (16U) | ||
10519 | /*! INTLEN - This field controls how many intermediate bytes precede the data. (Each such byte may | ||
10520 | * require 8 or 2 SCK cycles, depending on whether the intermediate field is in serial, 2-bit, or | ||
10521 | * 4-bit format.) Intermediate bytes are output by the SPIFI, and include post-address control | ||
10522 | * information, dummy and delay bytes. See the description of the Intermediate Data register for | ||
10523 | * the contents of such bytes. | ||
10524 | */ | ||
10525 | #define SPIFI_CMD_INTLEN(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CMD_INTLEN_SHIFT)) & SPIFI_CMD_INTLEN_MASK) | ||
10526 | #define SPIFI_CMD_FIELDFORM_MASK (0x180000U) | ||
10527 | #define SPIFI_CMD_FIELDFORM_SHIFT (19U) | ||
10528 | /*! FIELDFORM - This field controls how the fields of the command are sent. | ||
10529 | * 0b00..All serial. All fields of the command are serial. | ||
10530 | * 0b01..Quad/dual data. Data field is quad/dual, other fields are serial. | ||
10531 | * 0b10..Serial opcode. Opcode field is serial. Other fields are quad/dual. | ||
10532 | * 0b11..All quad/dual. All fields of the command are in quad/dual format. | ||
10533 | */ | ||
10534 | #define SPIFI_CMD_FIELDFORM(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CMD_FIELDFORM_SHIFT)) & SPIFI_CMD_FIELDFORM_MASK) | ||
10535 | #define SPIFI_CMD_FRAMEFORM_MASK (0xE00000U) | ||
10536 | #define SPIFI_CMD_FRAMEFORM_SHIFT (21U) | ||
10537 | /*! FRAMEFORM - This field controls the opcode and address fields. | ||
10538 | * 0b000..Reserved. | ||
10539 | * 0b001..Opcode. Opcode only, no address. | ||
10540 | * 0b010..Opcode one byte. Opcode, least significant byte of address. | ||
10541 | * 0b011..Opcode two bytes. Opcode, two least significant bytes of address. | ||
10542 | * 0b100..Opcode three bytes. Opcode, three least significant bytes of address. | ||
10543 | * 0b101..Opcode four bytes. Opcode, 4 bytes of address. | ||
10544 | * 0b110..No opcode three bytes. No opcode, 3 least significant bytes of address. | ||
10545 | * 0b111..No opcode four bytes. No opcode, 4 bytes of address. | ||
10546 | */ | ||
10547 | #define SPIFI_CMD_FRAMEFORM(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CMD_FRAMEFORM_SHIFT)) & SPIFI_CMD_FRAMEFORM_MASK) | ||
10548 | #define SPIFI_CMD_OPCODE_MASK (0xFF000000U) | ||
10549 | #define SPIFI_CMD_OPCODE_SHIFT (24U) | ||
10550 | /*! OPCODE - The opcode of the command (not used for some FRAMEFORM values). | ||
10551 | */ | ||
10552 | #define SPIFI_CMD_OPCODE(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CMD_OPCODE_SHIFT)) & SPIFI_CMD_OPCODE_MASK) | ||
10553 | /*! @} */ | ||
10554 | |||
10555 | /*! @name ADDR - SPIFI address register */ | ||
10556 | /*! @{ */ | ||
10557 | #define SPIFI_ADDR_ADDRESS_MASK (0xFFFFFFFFU) | ||
10558 | #define SPIFI_ADDR_ADDRESS_SHIFT (0U) | ||
10559 | /*! ADDRESS - Address. | ||
10560 | */ | ||
10561 | #define SPIFI_ADDR_ADDRESS(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_ADDR_ADDRESS_SHIFT)) & SPIFI_ADDR_ADDRESS_MASK) | ||
10562 | /*! @} */ | ||
10563 | |||
10564 | /*! @name IDATA - SPIFI intermediate data register */ | ||
10565 | /*! @{ */ | ||
10566 | #define SPIFI_IDATA_IDATA_MASK (0xFFFFFFFFU) | ||
10567 | #define SPIFI_IDATA_IDATA_SHIFT (0U) | ||
10568 | /*! IDATA - Value of intermediate bytes. | ||
10569 | */ | ||
10570 | #define SPIFI_IDATA_IDATA(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_IDATA_IDATA_SHIFT)) & SPIFI_IDATA_IDATA_MASK) | ||
10571 | /*! @} */ | ||
10572 | |||
10573 | /*! @name CLIMIT - SPIFI limit register */ | ||
10574 | /*! @{ */ | ||
10575 | #define SPIFI_CLIMIT_CLIMIT_MASK (0xFFFFFFFFU) | ||
10576 | #define SPIFI_CLIMIT_CLIMIT_SHIFT (0U) | ||
10577 | /*! CLIMIT - Zero-based upper limit of cacheable memory | ||
10578 | */ | ||
10579 | #define SPIFI_CLIMIT_CLIMIT(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_CLIMIT_CLIMIT_SHIFT)) & SPIFI_CLIMIT_CLIMIT_MASK) | ||
10580 | /*! @} */ | ||
10581 | |||
10582 | /*! @name DATA - SPIFI data register */ | ||
10583 | /*! @{ */ | ||
10584 | #define SPIFI_DATA_DATA_MASK (0xFFFFFFFFU) | ||
10585 | #define SPIFI_DATA_DATA_SHIFT (0U) | ||
10586 | /*! DATA - Input or output data | ||
10587 | */ | ||
10588 | #define SPIFI_DATA_DATA(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_DATA_DATA_SHIFT)) & SPIFI_DATA_DATA_MASK) | ||
10589 | /*! @} */ | ||
10590 | |||
10591 | /*! @name MCMD - SPIFI memory command register */ | ||
10592 | /*! @{ */ | ||
10593 | #define SPIFI_MCMD_POLL_MASK (0x4000U) | ||
10594 | #define SPIFI_MCMD_POLL_SHIFT (14U) | ||
10595 | /*! POLL - This bit should be written as 0. | ||
10596 | */ | ||
10597 | #define SPIFI_MCMD_POLL(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_MCMD_POLL_SHIFT)) & SPIFI_MCMD_POLL_MASK) | ||
10598 | #define SPIFI_MCMD_DOUT_MASK (0x8000U) | ||
10599 | #define SPIFI_MCMD_DOUT_SHIFT (15U) | ||
10600 | /*! DOUT - This bit should be written as 0. | ||
10601 | */ | ||
10602 | #define SPIFI_MCMD_DOUT(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_MCMD_DOUT_SHIFT)) & SPIFI_MCMD_DOUT_MASK) | ||
10603 | #define SPIFI_MCMD_INTLEN_MASK (0x70000U) | ||
10604 | #define SPIFI_MCMD_INTLEN_SHIFT (16U) | ||
10605 | /*! INTLEN - This field controls how many intermediate bytes precede the data. (Each such byte may | ||
10606 | * require 8 or 2 SCK cycles, depending on whether the intermediate field is in serial, 2-bit, or | ||
10607 | * 4-bit format.) Intermediate bytes are output by the SPIFI, and include post-address control | ||
10608 | * information, dummy and delay bytes. See the description of the Intermediate Data register for | ||
10609 | * the contents of such bytes. | ||
10610 | */ | ||
10611 | #define SPIFI_MCMD_INTLEN(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_MCMD_INTLEN_SHIFT)) & SPIFI_MCMD_INTLEN_MASK) | ||
10612 | #define SPIFI_MCMD_FIELDFORM_MASK (0x180000U) | ||
10613 | #define SPIFI_MCMD_FIELDFORM_SHIFT (19U) | ||
10614 | /*! FIELDFORM - This field controls how the fields of the command are sent. | ||
10615 | * 0b00..All serial. All fields of the command are serial. | ||
10616 | * 0b01..Quad/dual data. Data field is quad/dual, other fields are serial. | ||
10617 | * 0b10..Serial opcode. Opcode field is serial. Other fields are quad/dual. | ||
10618 | * 0b11..All quad/dual. All fields of the command are in quad/dual format. | ||
10619 | */ | ||
10620 | #define SPIFI_MCMD_FIELDFORM(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_MCMD_FIELDFORM_SHIFT)) & SPIFI_MCMD_FIELDFORM_MASK) | ||
10621 | #define SPIFI_MCMD_FRAMEFORM_MASK (0xE00000U) | ||
10622 | #define SPIFI_MCMD_FRAMEFORM_SHIFT (21U) | ||
10623 | /*! FRAMEFORM - This field controls the opcode and address fields. | ||
10624 | * 0b000..Reserved. | ||
10625 | * 0b001..Opcode. Opcode only, no address. | ||
10626 | * 0b010..Opcode one byte. Opcode, least-significant byte of address. | ||
10627 | * 0b011..Opcode two bytes. Opcode, 2 least-significant bytes of address. | ||
10628 | * 0b100..Opcode three bytes. Opcode, 3 least-significant bytes of address. | ||
10629 | * 0b101..Opcode four bytes. Opcode, 4 bytes of address. | ||
10630 | * 0b110..No opcode three bytes. No opcode, 3 least-significant bytes of address. | ||
10631 | * 0b111..No opcode, 4 bytes of address. | ||
10632 | */ | ||
10633 | #define SPIFI_MCMD_FRAMEFORM(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_MCMD_FRAMEFORM_SHIFT)) & SPIFI_MCMD_FRAMEFORM_MASK) | ||
10634 | #define SPIFI_MCMD_OPCODE_MASK (0xFF000000U) | ||
10635 | #define SPIFI_MCMD_OPCODE_SHIFT (24U) | ||
10636 | /*! OPCODE - The opcode of the command (not used for some FRAMEFORM values). | ||
10637 | */ | ||
10638 | #define SPIFI_MCMD_OPCODE(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_MCMD_OPCODE_SHIFT)) & SPIFI_MCMD_OPCODE_MASK) | ||
10639 | /*! @} */ | ||
10640 | |||
10641 | /*! @name STAT - SPIFI status register */ | ||
10642 | /*! @{ */ | ||
10643 | #define SPIFI_STAT_MCINIT_MASK (0x1U) | ||
10644 | #define SPIFI_STAT_MCINIT_SHIFT (0U) | ||
10645 | /*! MCINIT - This bit is set when software successfully writes the Memory Command register, and is | ||
10646 | * cleared by Reset or by writing a 1 to the RESET bit in this register. | ||
10647 | */ | ||
10648 | #define SPIFI_STAT_MCINIT(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_STAT_MCINIT_SHIFT)) & SPIFI_STAT_MCINIT_MASK) | ||
10649 | #define SPIFI_STAT_CMD_MASK (0x2U) | ||
10650 | #define SPIFI_STAT_CMD_SHIFT (1U) | ||
10651 | /*! CMD - This bit is 1 when the Command register is written. It is cleared by a hardware reset, a | ||
10652 | * write to the RESET bit in this register, or the deassertion of CS which indicates that the | ||
10653 | * command has completed communication with the SPI Flash. | ||
10654 | */ | ||
10655 | #define SPIFI_STAT_CMD(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_STAT_CMD_SHIFT)) & SPIFI_STAT_CMD_MASK) | ||
10656 | #define SPIFI_STAT_RESET_MASK (0x10U) | ||
10657 | #define SPIFI_STAT_RESET_SHIFT (4U) | ||
10658 | /*! RESET - Write a 1 to this bit to abort a current command or memory mode. This bit is cleared | ||
10659 | * when the hardware is ready for a new command to be written to the Command register. | ||
10660 | */ | ||
10661 | #define SPIFI_STAT_RESET(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_STAT_RESET_SHIFT)) & SPIFI_STAT_RESET_MASK) | ||
10662 | #define SPIFI_STAT_INTRQ_MASK (0x20U) | ||
10663 | #define SPIFI_STAT_INTRQ_SHIFT (5U) | ||
10664 | /*! INTRQ - This bit reflects the SPIFI interrupt request. Write a 1 to this bit to clear it. This | ||
10665 | * bit is set when a CMD was previously 1 and has been cleared due to the deassertion of CS. | ||
10666 | */ | ||
10667 | #define SPIFI_STAT_INTRQ(x) (((uint32_t)(((uint32_t)(x)) << SPIFI_STAT_INTRQ_SHIFT)) & SPIFI_STAT_INTRQ_MASK) | ||
10668 | /*! @} */ | ||
10669 | |||
10670 | |||
10671 | /*! | ||
10672 | * @} | ||
10673 | */ /* end of group SPIFI_Register_Masks */ | ||
10674 | |||
10675 | |||
10676 | /* SPIFI - Peripheral instance base addresses */ | ||
10677 | /** Peripheral SPIFI0 base address */ | ||
10678 | #define SPIFI0_BASE (0x40080000u) | ||
10679 | /** Peripheral SPIFI0 base pointer */ | ||
10680 | #define SPIFI0 ((SPIFI_Type *)SPIFI0_BASE) | ||
10681 | /** Array initializer of SPIFI peripheral base addresses */ | ||
10682 | #define SPIFI_BASE_ADDRS { SPIFI0_BASE } | ||
10683 | /** Array initializer of SPIFI peripheral base pointers */ | ||
10684 | #define SPIFI_BASE_PTRS { SPIFI0 } | ||
10685 | /** Interrupt vectors for the SPIFI peripheral type */ | ||
10686 | #define SPIFI_IRQS { SPIFI0_IRQn } | ||
10687 | |||
10688 | /*! | ||
10689 | * @} | ||
10690 | */ /* end of group SPIFI_Peripheral_Access_Layer */ | ||
10691 | |||
10692 | |||
10693 | /* ---------------------------------------------------------------------------- | ||
10694 | -- SYSCON Peripheral Access Layer | ||
10695 | ---------------------------------------------------------------------------- */ | ||
10696 | |||
10697 | /*! | ||
10698 | * @addtogroup SYSCON_Peripheral_Access_Layer SYSCON Peripheral Access Layer | ||
10699 | * @{ | ||
10700 | */ | ||
10701 | |||
10702 | /** SYSCON - Register Layout Typedef */ | ||
10703 | typedef struct { | ||
10704 | uint8_t RESERVED_0[16]; | ||
10705 | __IO uint32_t AHBMATPRIO; /**< AHB multilayer matrix priority control, offset: 0x10 */ | ||
10706 | uint8_t RESERVED_1[44]; | ||
10707 | __IO uint32_t SYSTCKCAL; /**< System tick counter calibration, offset: 0x40 */ | ||
10708 | uint8_t RESERVED_2[4]; | ||
10709 | __IO uint32_t NMISRC; /**< NMI Source Select, offset: 0x48 */ | ||
10710 | __IO uint32_t ASYNCAPBCTRL; /**< Asynchronous APB Control, offset: 0x4C */ | ||
10711 | uint8_t RESERVED_3[112]; | ||
10712 | __I uint32_t PIOPORCAP[2]; /**< POR captured value of port n, array offset: 0xC0, array step: 0x4 */ | ||
10713 | uint8_t RESERVED_4[8]; | ||
10714 | __I uint32_t PIORESCAP[2]; /**< Reset captured value of port n, array offset: 0xD0, array step: 0x4 */ | ||
10715 | uint8_t RESERVED_5[40]; | ||
10716 | __IO uint32_t PRESETCTRL[3]; /**< Peripheral reset control n, array offset: 0x100, array step: 0x4 */ | ||
10717 | uint8_t RESERVED_6[20]; | ||
10718 | __O uint32_t PRESETCTRLSET[3]; /**< Set bits in PRESETCTRLn, array offset: 0x120, array step: 0x4 */ | ||
10719 | uint8_t RESERVED_7[20]; | ||
10720 | __O uint32_t PRESETCTRLCLR[3]; /**< Clear bits in PRESETCTRLn, array offset: 0x140, array step: 0x4 */ | ||
10721 | uint8_t RESERVED_8[164]; | ||
10722 | __IO uint32_t SYSRSTSTAT; /**< System reset status register, offset: 0x1F0 */ | ||
10723 | uint8_t RESERVED_9[12]; | ||
10724 | __IO uint32_t AHBCLKCTRL[3]; /**< AHB Clock control n, array offset: 0x200, array step: 0x4 */ | ||
10725 | uint8_t RESERVED_10[20]; | ||
10726 | __O uint32_t AHBCLKCTRLSET[3]; /**< Set bits in AHBCLKCTRLn, array offset: 0x220, array step: 0x4 */ | ||
10727 | uint8_t RESERVED_11[20]; | ||
10728 | __O uint32_t AHBCLKCTRLCLR[3]; /**< Clear bits in AHBCLKCTRLn, array offset: 0x240, array step: 0x4 */ | ||
10729 | uint8_t RESERVED_12[48]; | ||
10730 | __IO uint32_t STICKCLKSEL; /**< Systick timer clock source selection, offset: 0x27C */ | ||
10731 | __IO uint32_t MAINCLKSELA; /**< Main clock source select A, offset: 0x280 */ | ||
10732 | __IO uint32_t MAINCLKSELB; /**< Main clock source select B, offset: 0x284 */ | ||
10733 | __IO uint32_t CLKOUTSELA; /**< CLKOUT clock source select A, offset: 0x288 */ | ||
10734 | uint8_t RESERVED_13[4]; | ||
10735 | __IO uint32_t SYSPLLCLKSEL; /**< PLL clock source select, offset: 0x290 */ | ||
10736 | uint8_t RESERVED_14[4]; | ||
10737 | __IO uint32_t AUDPLLCLKSEL; /**< Audio PLL clock source select, offset: 0x298 */ | ||
10738 | uint8_t RESERVED_15[4]; | ||
10739 | __IO uint32_t SPIFICLKSEL; /**< SPIFI clock source select, offset: 0x2A0 */ | ||
10740 | __IO uint32_t ADCCLKSEL; /**< ADC clock source select, offset: 0x2A4 */ | ||
10741 | __IO uint32_t USB0CLKSEL; /**< USB0 clock source select, offset: 0x2A8 */ | ||
10742 | __IO uint32_t USB1CLKSEL; /**< USB1 clock source select, offset: 0x2AC */ | ||
10743 | __IO uint32_t FCLKSEL[10]; /**< Flexcomm clock source select, array offset: 0x2B0, array step: 0x4 */ | ||
10744 | __IO uint32_t FCLKSEL10; /**< Flexcomm 10 clock source select, offset: 0x2D8 */ | ||
10745 | uint8_t RESERVED_16[4]; | ||
10746 | __IO uint32_t MCLKCLKSEL; /**< MCLK clock source select, offset: 0x2E0 */ | ||
10747 | uint8_t RESERVED_17[4]; | ||
10748 | __IO uint32_t FRGCLKSEL; /**< Fractional Rate Generator clock source select, offset: 0x2E8 */ | ||
10749 | __IO uint32_t DMICCLKSEL; /**< Digital microphone (DMIC) subsystem clock select, offset: 0x2EC */ | ||
10750 | __IO uint32_t SCTCLKSEL; /**< SCTimer/PWM clock source select, offset: 0x2F0 */ | ||
10751 | __IO uint32_t LCDCLKSEL; /**< LCD clock source select, offset: 0x2F4 */ | ||
10752 | __IO uint32_t SDIOCLKSEL; /**< SDIO clock source select, offset: 0x2F8 */ | ||
10753 | uint8_t RESERVED_18[4]; | ||
10754 | __IO uint32_t SYSTICKCLKDIV; /**< SYSTICK clock divider, offset: 0x300 */ | ||
10755 | __IO uint32_t ARMTRACECLKDIV; /**< ARM Trace clock divider, offset: 0x304 */ | ||
10756 | __IO uint32_t CAN0CLKDIV; /**< MCAN0 clock divider, offset: 0x308 */ | ||
10757 | __IO uint32_t CAN1CLKDIV; /**< MCAN1 clock divider, offset: 0x30C */ | ||
10758 | __IO uint32_t SC0CLKDIV; /**< Smartcard0 clock divider, offset: 0x310 */ | ||
10759 | __IO uint32_t SC1CLKDIV; /**< Smartcard1 clock divider, offset: 0x314 */ | ||
10760 | uint8_t RESERVED_19[104]; | ||
10761 | __IO uint32_t AHBCLKDIV; /**< AHB clock divider, offset: 0x380 */ | ||
10762 | __IO uint32_t CLKOUTDIV; /**< CLKOUT clock divider, offset: 0x384 */ | ||
10763 | __IO uint32_t FROHFDIV; /**< FROHF clock divider, offset: 0x388 */ | ||
10764 | uint8_t RESERVED_20[4]; | ||
10765 | __IO uint32_t SPIFICLKDIV; /**< SPIFI clock divider, offset: 0x390 */ | ||
10766 | __IO uint32_t ADCCLKDIV; /**< ADC clock divider, offset: 0x394 */ | ||
10767 | __IO uint32_t USB0CLKDIV; /**< USB0 clock divider, offset: 0x398 */ | ||
10768 | __IO uint32_t USB1CLKDIV; /**< USB1 clock divider, offset: 0x39C */ | ||
10769 | __IO uint32_t FRGCTRL; /**< Fractional rate divider, offset: 0x3A0 */ | ||
10770 | uint8_t RESERVED_21[4]; | ||
10771 | __IO uint32_t DMICCLKDIV; /**< DMIC clock divider, offset: 0x3A8 */ | ||
10772 | __IO uint32_t MCLKDIV; /**< I2S MCLK clock divider, offset: 0x3AC */ | ||
10773 | __IO uint32_t LCDCLKDIV; /**< LCD clock divider, offset: 0x3B0 */ | ||
10774 | __IO uint32_t SCTCLKDIV; /**< SCT/PWM clock divider, offset: 0x3B4 */ | ||
10775 | __IO uint32_t EMCCLKDIV; /**< EMC clock divider, offset: 0x3B8 */ | ||
10776 | __IO uint32_t SDIOCLKDIV; /**< SDIO clock divider, offset: 0x3BC */ | ||
10777 | uint8_t RESERVED_22[76]; | ||
10778 | __IO uint32_t USB0CLKCTRL; /**< USB0 clock control, offset: 0x40C */ | ||
10779 | __IO uint32_t USB0CLKSTAT; /**< USB0 clock status, offset: 0x410 */ | ||
10780 | uint8_t RESERVED_23[4]; | ||
10781 | __IO uint32_t FREQMECTRL; /**< Frequency measure register, offset: 0x418 */ | ||
10782 | uint8_t RESERVED_24[4]; | ||
10783 | __IO uint32_t MCLKIO; /**< MCLK input/output control, offset: 0x420 */ | ||
10784 | __IO uint32_t USB1CLKCTRL; /**< USB1 clock control, offset: 0x424 */ | ||
10785 | __IO uint32_t USB1CLKSTAT; /**< USB1 clock status, offset: 0x428 */ | ||
10786 | uint8_t RESERVED_25[24]; | ||
10787 | __IO uint32_t EMCSYSCTRL; /**< EMC system control, offset: 0x444 */ | ||
10788 | __IO uint32_t EMCDYCTRL; /**< EMC clock delay control, offset: 0x448 */ | ||
10789 | __IO uint32_t EMCCAL; /**< EMC delay chain calibration control, offset: 0x44C */ | ||
10790 | __IO uint32_t ETHPHYSEL; /**< Ethernet PHY Selection, offset: 0x450 */ | ||
10791 | __IO uint32_t ETHSBDCTRL; /**< Ethernet SBD flow control, offset: 0x454 */ | ||
10792 | uint8_t RESERVED_26[8]; | ||
10793 | __IO uint32_t SDIOCLKCTRL; /**< SDIO CCLKIN phase and delay control, offset: 0x460 */ | ||
10794 | uint8_t RESERVED_27[12]; | ||
10795 | __IO uint32_t KEYMUXSEL; /**< AES key source selection, offset: 0x470 */ | ||
10796 | uint8_t RESERVED_28[140]; | ||
10797 | __IO uint32_t FROCTRL; /**< FRO oscillator control, offset: 0x500 */ | ||
10798 | __IO uint32_t SYSOSCCTRL; /**< System oscillator control, offset: 0x504 */ | ||
10799 | __IO uint32_t WDTOSCCTRL; /**< Watchdog oscillator control, offset: 0x508 */ | ||
10800 | __IO uint32_t RTCOSCCTRL; /**< RTC oscillator 32 kHz output control, offset: 0x50C */ | ||
10801 | uint8_t RESERVED_29[12]; | ||
10802 | __IO uint32_t USBPLLCTRL; /**< USB PLL control, offset: 0x51C */ | ||
10803 | __IO uint32_t USBPLLSTAT; /**< USB PLL status, offset: 0x520 */ | ||
10804 | uint8_t RESERVED_30[92]; | ||
10805 | __IO uint32_t SYSPLLCTRL; /**< System PLL control, offset: 0x580 */ | ||
10806 | __IO uint32_t SYSPLLSTAT; /**< PLL status, offset: 0x584 */ | ||
10807 | __IO uint32_t SYSPLLNDEC; /**< PLL N divider, offset: 0x588 */ | ||
10808 | __IO uint32_t SYSPLLPDEC; /**< PLL P divider, offset: 0x58C */ | ||
10809 | __IO uint32_t SYSPLLMDEC; /**< System PLL M divider, offset: 0x590 */ | ||
10810 | uint8_t RESERVED_31[12]; | ||
10811 | __IO uint32_t AUDPLLCTRL; /**< Audio PLL control, offset: 0x5A0 */ | ||
10812 | __IO uint32_t AUDPLLSTAT; /**< Audio PLL status, offset: 0x5A4 */ | ||
10813 | __IO uint32_t AUDPLLNDEC; /**< Audio PLL N divider, offset: 0x5A8 */ | ||
10814 | __IO uint32_t AUDPLLPDEC; /**< Audio PLL P divider, offset: 0x5AC */ | ||
10815 | __IO uint32_t AUDPLLMDEC; /**< Audio PLL M divider, offset: 0x5B0 */ | ||
10816 | __IO uint32_t AUDPLLFRAC; /**< Audio PLL fractional divider control, offset: 0x5B4 */ | ||
10817 | uint8_t RESERVED_32[72]; | ||
10818 | __IO uint32_t PDSLEEPCFG[2]; /**< Sleep configuration register, array offset: 0x600, array step: 0x4 */ | ||
10819 | uint8_t RESERVED_33[8]; | ||
10820 | __IO uint32_t PDRUNCFG[2]; /**< Power configuration register, array offset: 0x610, array step: 0x4 */ | ||
10821 | uint8_t RESERVED_34[8]; | ||
10822 | __IO uint32_t PDRUNCFGSET[2]; /**< Power configuration set register, array offset: 0x620, array step: 0x4 */ | ||
10823 | uint8_t RESERVED_35[8]; | ||
10824 | __IO uint32_t PDRUNCFGCLR[2]; /**< Power configuration clear register, array offset: 0x630, array step: 0x4 */ | ||
10825 | uint8_t RESERVED_36[72]; | ||
10826 | __IO uint32_t STARTER[2]; /**< Start logic 0 wake-up enable register, array offset: 0x680, array step: 0x4 */ | ||
10827 | uint8_t RESERVED_37[24]; | ||
10828 | __O uint32_t STARTERSET[2]; /**< Set bits in STARTER, array offset: 0x6A0, array step: 0x4 */ | ||
10829 | uint8_t RESERVED_38[24]; | ||
10830 | __O uint32_t STARTERCLR[2]; /**< Clear bits in STARTER0, array offset: 0x6C0, array step: 0x4 */ | ||
10831 | uint8_t RESERVED_39[184]; | ||
10832 | __IO uint32_t HWWAKE; /**< Configures special cases of hardware wake-up, offset: 0x780 */ | ||
10833 | uint8_t RESERVED_40[1664]; | ||
10834 | __IO uint32_t AUTOCGOR; /**< Auto Clock-Gate Override Register, offset: 0xE04 */ | ||
10835 | uint8_t RESERVED_41[492]; | ||
10836 | __I uint32_t JTAGIDCODE; /**< JTAG ID code register, offset: 0xFF4 */ | ||
10837 | __I uint32_t DEVICE_ID0; /**< Part ID register, offset: 0xFF8 */ | ||
10838 | __I uint32_t DEVICE_ID1; /**< Boot ROM and die revision register, offset: 0xFFC */ | ||
10839 | uint8_t RESERVED_42[127044]; | ||
10840 | __IO uint32_t BODCTRL; /**< Brown-Out Detect control, offset: 0x20044 */ | ||
10841 | } SYSCON_Type; | ||
10842 | |||
10843 | /* ---------------------------------------------------------------------------- | ||
10844 | -- SYSCON Register Masks | ||
10845 | ---------------------------------------------------------------------------- */ | ||
10846 | |||
10847 | /*! | ||
10848 | * @addtogroup SYSCON_Register_Masks SYSCON Register Masks | ||
10849 | * @{ | ||
10850 | */ | ||
10851 | |||
10852 | /*! @name AHBMATPRIO - AHB multilayer matrix priority control */ | ||
10853 | /*! @{ */ | ||
10854 | #define SYSCON_AHBMATPRIO_PRI_ICODE_MASK (0x3U) | ||
10855 | #define SYSCON_AHBMATPRIO_PRI_ICODE_SHIFT (0U) | ||
10856 | /*! PRI_ICODE - I-Code bus priority. | ||
10857 | */ | ||
10858 | #define SYSCON_AHBMATPRIO_PRI_ICODE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_ICODE_SHIFT)) & SYSCON_AHBMATPRIO_PRI_ICODE_MASK) | ||
10859 | #define SYSCON_AHBMATPRIO_PRI_DCODE_MASK (0xCU) | ||
10860 | #define SYSCON_AHBMATPRIO_PRI_DCODE_SHIFT (2U) | ||
10861 | /*! PRI_DCODE - D-Code bus priority. | ||
10862 | */ | ||
10863 | #define SYSCON_AHBMATPRIO_PRI_DCODE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_DCODE_SHIFT)) & SYSCON_AHBMATPRIO_PRI_DCODE_MASK) | ||
10864 | #define SYSCON_AHBMATPRIO_PRI_SYS_MASK (0x30U) | ||
10865 | #define SYSCON_AHBMATPRIO_PRI_SYS_SHIFT (4U) | ||
10866 | /*! PRI_SYS - System bus priority. | ||
10867 | */ | ||
10868 | #define SYSCON_AHBMATPRIO_PRI_SYS(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_SYS_SHIFT)) & SYSCON_AHBMATPRIO_PRI_SYS_MASK) | ||
10869 | #define SYSCON_AHBMATPRIO_PRI_DMA_MASK (0xC0U) | ||
10870 | #define SYSCON_AHBMATPRIO_PRI_DMA_SHIFT (6U) | ||
10871 | /*! PRI_DMA - DMA controller priority. | ||
10872 | */ | ||
10873 | #define SYSCON_AHBMATPRIO_PRI_DMA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_DMA_SHIFT)) & SYSCON_AHBMATPRIO_PRI_DMA_MASK) | ||
10874 | #define SYSCON_AHBMATPRIO_PRI_ETH_MASK (0x300U) | ||
10875 | #define SYSCON_AHBMATPRIO_PRI_ETH_SHIFT (8U) | ||
10876 | /*! PRI_ETH - Ethernet DMA priority. | ||
10877 | */ | ||
10878 | #define SYSCON_AHBMATPRIO_PRI_ETH(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_ETH_SHIFT)) & SYSCON_AHBMATPRIO_PRI_ETH_MASK) | ||
10879 | #define SYSCON_AHBMATPRIO_PRI_LCD_MASK (0xC00U) | ||
10880 | #define SYSCON_AHBMATPRIO_PRI_LCD_SHIFT (10U) | ||
10881 | /*! PRI_LCD - LCD DMA priority. | ||
10882 | */ | ||
10883 | #define SYSCON_AHBMATPRIO_PRI_LCD(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_LCD_SHIFT)) & SYSCON_AHBMATPRIO_PRI_LCD_MASK) | ||
10884 | #define SYSCON_AHBMATPRIO_PRI_USB0_MASK (0x3000U) | ||
10885 | #define SYSCON_AHBMATPRIO_PRI_USB0_SHIFT (12U) | ||
10886 | /*! PRI_USB0 - USB0 DMA priority. | ||
10887 | */ | ||
10888 | #define SYSCON_AHBMATPRIO_PRI_USB0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_USB0_SHIFT)) & SYSCON_AHBMATPRIO_PRI_USB0_MASK) | ||
10889 | #define SYSCON_AHBMATPRIO_PRI_USB1_MASK (0xC000U) | ||
10890 | #define SYSCON_AHBMATPRIO_PRI_USB1_SHIFT (14U) | ||
10891 | /*! PRI_USB1 - USB1 DMA priority. | ||
10892 | */ | ||
10893 | #define SYSCON_AHBMATPRIO_PRI_USB1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_USB1_SHIFT)) & SYSCON_AHBMATPRIO_PRI_USB1_MASK) | ||
10894 | #define SYSCON_AHBMATPRIO_PRI_SDIO_MASK (0x30000U) | ||
10895 | #define SYSCON_AHBMATPRIO_PRI_SDIO_SHIFT (16U) | ||
10896 | /*! PRI_SDIO - SDIO priority. | ||
10897 | */ | ||
10898 | #define SYSCON_AHBMATPRIO_PRI_SDIO(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_SDIO_SHIFT)) & SYSCON_AHBMATPRIO_PRI_SDIO_MASK) | ||
10899 | #define SYSCON_AHBMATPRIO_PRI_MCAN1_MASK (0xC0000U) | ||
10900 | #define SYSCON_AHBMATPRIO_PRI_MCAN1_SHIFT (18U) | ||
10901 | /*! PRI_MCAN1 - MCAN1 priority. | ||
10902 | */ | ||
10903 | #define SYSCON_AHBMATPRIO_PRI_MCAN1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_MCAN1_SHIFT)) & SYSCON_AHBMATPRIO_PRI_MCAN1_MASK) | ||
10904 | #define SYSCON_AHBMATPRIO_PRI_MCAN2_MASK (0x300000U) | ||
10905 | #define SYSCON_AHBMATPRIO_PRI_MCAN2_SHIFT (20U) | ||
10906 | /*! PRI_MCAN2 - MCAN2 priority. | ||
10907 | */ | ||
10908 | #define SYSCON_AHBMATPRIO_PRI_MCAN2(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBMATPRIO_PRI_MCAN2_SHIFT)) & SYSCON_AHBMATPRIO_PRI_MCAN2_MASK) | ||
10909 | /*! @} */ | ||
10910 | |||
10911 | /*! @name SYSTCKCAL - System tick counter calibration */ | ||
10912 | /*! @{ */ | ||
10913 | #define SYSCON_SYSTCKCAL_CAL_MASK (0xFFFFFFU) | ||
10914 | #define SYSCON_SYSTCKCAL_CAL_SHIFT (0U) | ||
10915 | /*! CAL - System tick timer calibration value. | ||
10916 | */ | ||
10917 | #define SYSCON_SYSTCKCAL_CAL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSTCKCAL_CAL_SHIFT)) & SYSCON_SYSTCKCAL_CAL_MASK) | ||
10918 | #define SYSCON_SYSTCKCAL_SKEW_MASK (0x1000000U) | ||
10919 | #define SYSCON_SYSTCKCAL_SKEW_SHIFT (24U) | ||
10920 | /*! SKEW - Initial value for the Systick timer. | ||
10921 | */ | ||
10922 | #define SYSCON_SYSTCKCAL_SKEW(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSTCKCAL_SKEW_SHIFT)) & SYSCON_SYSTCKCAL_SKEW_MASK) | ||
10923 | #define SYSCON_SYSTCKCAL_NOREF_MASK (0x2000000U) | ||
10924 | #define SYSCON_SYSTCKCAL_NOREF_SHIFT (25U) | ||
10925 | /*! NOREF - Initial value for the Systick timer. | ||
10926 | */ | ||
10927 | #define SYSCON_SYSTCKCAL_NOREF(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSTCKCAL_NOREF_SHIFT)) & SYSCON_SYSTCKCAL_NOREF_MASK) | ||
10928 | /*! @} */ | ||
10929 | |||
10930 | /*! @name NMISRC - NMI Source Select */ | ||
10931 | /*! @{ */ | ||
10932 | #define SYSCON_NMISRC_IRQM4_MASK (0x3FU) | ||
10933 | #define SYSCON_NMISRC_IRQM4_SHIFT (0U) | ||
10934 | /*! IRQM4 - The IRQ number of the interrupt that acts as the Non-Maskable Interrupt (NMI) for the Cortex-M4, if enabled by NMIENM4. | ||
10935 | */ | ||
10936 | #define SYSCON_NMISRC_IRQM4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_NMISRC_IRQM4_SHIFT)) & SYSCON_NMISRC_IRQM4_MASK) | ||
10937 | #define SYSCON_NMISRC_NMIENM4_MASK (0x80000000U) | ||
10938 | #define SYSCON_NMISRC_NMIENM4_SHIFT (31U) | ||
10939 | /*! NMIENM4 - Write a 1 to this bit to enable the Non-Maskable Interrupt (NMI) source selected by IRQM4. | ||
10940 | */ | ||
10941 | #define SYSCON_NMISRC_NMIENM4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_NMISRC_NMIENM4_SHIFT)) & SYSCON_NMISRC_NMIENM4_MASK) | ||
10942 | /*! @} */ | ||
10943 | |||
10944 | /*! @name ASYNCAPBCTRL - Asynchronous APB Control */ | ||
10945 | /*! @{ */ | ||
10946 | #define SYSCON_ASYNCAPBCTRL_ENABLE_MASK (0x1U) | ||
10947 | #define SYSCON_ASYNCAPBCTRL_ENABLE_SHIFT (0U) | ||
10948 | /*! ENABLE - Enables the asynchronous APB bridge and subsystem. | ||
10949 | * 0b0..Disabled. Asynchronous APB bridge is disabled. | ||
10950 | * 0b1..Enabled. Asynchronous APB bridge is enabled. | ||
10951 | */ | ||
10952 | #define SYSCON_ASYNCAPBCTRL_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ASYNCAPBCTRL_ENABLE_SHIFT)) & SYSCON_ASYNCAPBCTRL_ENABLE_MASK) | ||
10953 | /*! @} */ | ||
10954 | |||
10955 | /*! @name PIOPORCAP - POR captured value of port n */ | ||
10956 | /*! @{ */ | ||
10957 | #define SYSCON_PIOPORCAP_PIOPORCAP_MASK (0xFFFFFFFFU) | ||
10958 | #define SYSCON_PIOPORCAP_PIOPORCAP_SHIFT (0U) | ||
10959 | /*! PIOPORCAP - State of PIOn_31 through PIOn_0 at power-on reset | ||
10960 | */ | ||
10961 | #define SYSCON_PIOPORCAP_PIOPORCAP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PIOPORCAP_PIOPORCAP_SHIFT)) & SYSCON_PIOPORCAP_PIOPORCAP_MASK) | ||
10962 | /*! @} */ | ||
10963 | |||
10964 | /* The count of SYSCON_PIOPORCAP */ | ||
10965 | #define SYSCON_PIOPORCAP_COUNT (2U) | ||
10966 | |||
10967 | /*! @name PIORESCAP - Reset captured value of port n */ | ||
10968 | /*! @{ */ | ||
10969 | #define SYSCON_PIORESCAP_PIORESCAP_MASK (0xFFFFFFFFU) | ||
10970 | #define SYSCON_PIORESCAP_PIORESCAP_SHIFT (0U) | ||
10971 | /*! PIORESCAP - State of PIOn_31 through PIOn_0 for resets other than POR. | ||
10972 | */ | ||
10973 | #define SYSCON_PIORESCAP_PIORESCAP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PIORESCAP_PIORESCAP_SHIFT)) & SYSCON_PIORESCAP_PIORESCAP_MASK) | ||
10974 | /*! @} */ | ||
10975 | |||
10976 | /* The count of SYSCON_PIORESCAP */ | ||
10977 | #define SYSCON_PIORESCAP_COUNT (2U) | ||
10978 | |||
10979 | /*! @name PRESETCTRL - Peripheral reset control n */ | ||
10980 | /*! @{ */ | ||
10981 | #define SYSCON_PRESETCTRL_MRT_RST_MASK (0x1U) | ||
10982 | #define SYSCON_PRESETCTRL_MRT_RST_SHIFT (0U) | ||
10983 | /*! MRT_RST - Multi-rate timer (MRT) reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
10984 | */ | ||
10985 | #define SYSCON_PRESETCTRL_MRT_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_MRT_RST_SHIFT)) & SYSCON_PRESETCTRL_MRT_RST_MASK) | ||
10986 | #define SYSCON_PRESETCTRL_LCD_RST_MASK (0x4U) | ||
10987 | #define SYSCON_PRESETCTRL_LCD_RST_SHIFT (2U) | ||
10988 | /*! LCD_RST - LCD reset control. | ||
10989 | */ | ||
10990 | #define SYSCON_PRESETCTRL_LCD_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_LCD_RST_SHIFT)) & SYSCON_PRESETCTRL_LCD_RST_MASK) | ||
10991 | #define SYSCON_PRESETCTRL_SCT0_RST_MASK (0x4U) | ||
10992 | #define SYSCON_PRESETCTRL_SCT0_RST_SHIFT (2U) | ||
10993 | /*! SCT0_RST - State configurable timer 0 (SCT0) reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
10994 | */ | ||
10995 | #define SYSCON_PRESETCTRL_SCT0_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_SCT0_RST_SHIFT)) & SYSCON_PRESETCTRL_SCT0_RST_MASK) | ||
10996 | #define SYSCON_PRESETCTRL_SDIO_RST_MASK (0x8U) | ||
10997 | #define SYSCON_PRESETCTRL_SDIO_RST_SHIFT (3U) | ||
10998 | /*! SDIO_RST - SDIO reset control. | ||
10999 | */ | ||
11000 | #define SYSCON_PRESETCTRL_SDIO_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_SDIO_RST_SHIFT)) & SYSCON_PRESETCTRL_SDIO_RST_MASK) | ||
11001 | #define SYSCON_PRESETCTRL_USB1H_RST_MASK (0x10U) | ||
11002 | #define SYSCON_PRESETCTRL_USB1H_RST_SHIFT (4U) | ||
11003 | /*! USB1H_RST - USB1 Host reset control. | ||
11004 | */ | ||
11005 | #define SYSCON_PRESETCTRL_USB1H_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_USB1H_RST_SHIFT)) & SYSCON_PRESETCTRL_USB1H_RST_MASK) | ||
11006 | #define SYSCON_PRESETCTRL_USB1D_RST_MASK (0x20U) | ||
11007 | #define SYSCON_PRESETCTRL_USB1D_RST_SHIFT (5U) | ||
11008 | /*! USB1D_RST - USB1 Device reset control. | ||
11009 | */ | ||
11010 | #define SYSCON_PRESETCTRL_USB1D_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_USB1D_RST_SHIFT)) & SYSCON_PRESETCTRL_USB1D_RST_MASK) | ||
11011 | #define SYSCON_PRESETCTRL_USB1RAM_RST_MASK (0x40U) | ||
11012 | #define SYSCON_PRESETCTRL_USB1RAM_RST_SHIFT (6U) | ||
11013 | /*! USB1RAM_RST - USB1 RAM reset control. | ||
11014 | */ | ||
11015 | #define SYSCON_PRESETCTRL_USB1RAM_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_USB1RAM_RST_SHIFT)) & SYSCON_PRESETCTRL_USB1RAM_RST_MASK) | ||
11016 | #define SYSCON_PRESETCTRL_EMC_RESET_MASK (0x80U) | ||
11017 | #define SYSCON_PRESETCTRL_EMC_RESET_SHIFT (7U) | ||
11018 | /*! EMC_RESET - EMC reset control. | ||
11019 | */ | ||
11020 | #define SYSCON_PRESETCTRL_EMC_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_EMC_RESET_SHIFT)) & SYSCON_PRESETCTRL_EMC_RESET_MASK) | ||
11021 | #define SYSCON_PRESETCTRL_MCAN0_RST_MASK (0x80U) | ||
11022 | #define SYSCON_PRESETCTRL_MCAN0_RST_SHIFT (7U) | ||
11023 | /*! MCAN0_RST - 0 = Clear reset to this function. | ||
11024 | */ | ||
11025 | #define SYSCON_PRESETCTRL_MCAN0_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_MCAN0_RST_SHIFT)) & SYSCON_PRESETCTRL_MCAN0_RST_MASK) | ||
11026 | #define SYSCON_PRESETCTRL_ETH_RST_MASK (0x100U) | ||
11027 | #define SYSCON_PRESETCTRL_ETH_RST_SHIFT (8U) | ||
11028 | /*! ETH_RST - Ethernet reset control. | ||
11029 | */ | ||
11030 | #define SYSCON_PRESETCTRL_ETH_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_ETH_RST_SHIFT)) & SYSCON_PRESETCTRL_ETH_RST_MASK) | ||
11031 | #define SYSCON_PRESETCTRL_MCAN1_RST_MASK (0x100U) | ||
11032 | #define SYSCON_PRESETCTRL_MCAN1_RST_SHIFT (8U) | ||
11033 | /*! MCAN1_RST - 0 = Clear reset to this function. | ||
11034 | */ | ||
11035 | #define SYSCON_PRESETCTRL_MCAN1_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_MCAN1_RST_SHIFT)) & SYSCON_PRESETCTRL_MCAN1_RST_MASK) | ||
11036 | #define SYSCON_PRESETCTRL_GPIO4_RST_MASK (0x200U) | ||
11037 | #define SYSCON_PRESETCTRL_GPIO4_RST_SHIFT (9U) | ||
11038 | /*! GPIO4_RST - GPIO4 reset control. | ||
11039 | */ | ||
11040 | #define SYSCON_PRESETCTRL_GPIO4_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_GPIO4_RST_SHIFT)) & SYSCON_PRESETCTRL_GPIO4_RST_MASK) | ||
11041 | #define SYSCON_PRESETCTRL_GPIO5_RST_MASK (0x400U) | ||
11042 | #define SYSCON_PRESETCTRL_GPIO5_RST_SHIFT (10U) | ||
11043 | /*! GPIO5_RST - GPIO5 reset control. | ||
11044 | */ | ||
11045 | #define SYSCON_PRESETCTRL_GPIO5_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_GPIO5_RST_SHIFT)) & SYSCON_PRESETCTRL_GPIO5_RST_MASK) | ||
11046 | #define SYSCON_PRESETCTRL_SPIFI_RST_MASK (0x400U) | ||
11047 | #define SYSCON_PRESETCTRL_SPIFI_RST_SHIFT (10U) | ||
11048 | /*! SPIFI_RST - SPIFI reset control. | ||
11049 | */ | ||
11050 | #define SYSCON_PRESETCTRL_SPIFI_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_SPIFI_RST_SHIFT)) & SYSCON_PRESETCTRL_SPIFI_RST_MASK) | ||
11051 | #define SYSCON_PRESETCTRL_UTICK_RST_MASK (0x400U) | ||
11052 | #define SYSCON_PRESETCTRL_UTICK_RST_SHIFT (10U) | ||
11053 | /*! UTICK_RST - Micro-tick Timer reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11054 | */ | ||
11055 | #define SYSCON_PRESETCTRL_UTICK_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_UTICK_RST_SHIFT)) & SYSCON_PRESETCTRL_UTICK_RST_MASK) | ||
11056 | #define SYSCON_PRESETCTRL_FC0_RST_MASK (0x800U) | ||
11057 | #define SYSCON_PRESETCTRL_FC0_RST_SHIFT (11U) | ||
11058 | /*! FC0_RST - Flexcomm 0 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11059 | */ | ||
11060 | #define SYSCON_PRESETCTRL_FC0_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC0_RST_SHIFT)) & SYSCON_PRESETCTRL_FC0_RST_MASK) | ||
11061 | #define SYSCON_PRESETCTRL_MUX_RST_MASK (0x800U) | ||
11062 | #define SYSCON_PRESETCTRL_MUX_RST_SHIFT (11U) | ||
11063 | /*! MUX_RST - Input mux reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11064 | */ | ||
11065 | #define SYSCON_PRESETCTRL_MUX_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_MUX_RST_SHIFT)) & SYSCON_PRESETCTRL_MUX_RST_MASK) | ||
11066 | #define SYSCON_PRESETCTRL_FC1_RST_MASK (0x1000U) | ||
11067 | #define SYSCON_PRESETCTRL_FC1_RST_SHIFT (12U) | ||
11068 | /*! FC1_RST - Flexcomm 1 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11069 | */ | ||
11070 | #define SYSCON_PRESETCTRL_FC1_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC1_RST_SHIFT)) & SYSCON_PRESETCTRL_FC1_RST_MASK) | ||
11071 | #define SYSCON_PRESETCTRL_OTP_RST_MASK (0x1000U) | ||
11072 | #define SYSCON_PRESETCTRL_OTP_RST_SHIFT (12U) | ||
11073 | /*! OTP_RST - OTP reset control. | ||
11074 | */ | ||
11075 | #define SYSCON_PRESETCTRL_OTP_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_OTP_RST_SHIFT)) & SYSCON_PRESETCTRL_OTP_RST_MASK) | ||
11076 | #define SYSCON_PRESETCTRL_FC2_RST_MASK (0x2000U) | ||
11077 | #define SYSCON_PRESETCTRL_FC2_RST_SHIFT (13U) | ||
11078 | /*! FC2_RST - Flexcomm 2 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11079 | */ | ||
11080 | #define SYSCON_PRESETCTRL_FC2_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC2_RST_SHIFT)) & SYSCON_PRESETCTRL_FC2_RST_MASK) | ||
11081 | #define SYSCON_PRESETCTRL_IOCON_RST_MASK (0x2000U) | ||
11082 | #define SYSCON_PRESETCTRL_IOCON_RST_SHIFT (13U) | ||
11083 | /*! IOCON_RST - IOCON reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11084 | */ | ||
11085 | #define SYSCON_PRESETCTRL_IOCON_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_IOCON_RST_SHIFT)) & SYSCON_PRESETCTRL_IOCON_RST_MASK) | ||
11086 | #define SYSCON_PRESETCTRL_RNG_RST_MASK (0x2000U) | ||
11087 | #define SYSCON_PRESETCTRL_RNG_RST_SHIFT (13U) | ||
11088 | /*! RNG_RST - RNG reset control. | ||
11089 | */ | ||
11090 | #define SYSCON_PRESETCTRL_RNG_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_RNG_RST_SHIFT)) & SYSCON_PRESETCTRL_RNG_RST_MASK) | ||
11091 | #define SYSCON_PRESETCTRL_FC3_RST_MASK (0x4000U) | ||
11092 | #define SYSCON_PRESETCTRL_FC3_RST_SHIFT (14U) | ||
11093 | /*! FC3_RST - Flexcomm 3 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11094 | */ | ||
11095 | #define SYSCON_PRESETCTRL_FC3_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC3_RST_SHIFT)) & SYSCON_PRESETCTRL_FC3_RST_MASK) | ||
11096 | #define SYSCON_PRESETCTRL_FC8_RST_MASK (0x4000U) | ||
11097 | #define SYSCON_PRESETCTRL_FC8_RST_SHIFT (14U) | ||
11098 | /*! FC8_RST - Flexcomm 8 reset control. | ||
11099 | */ | ||
11100 | #define SYSCON_PRESETCTRL_FC8_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC8_RST_SHIFT)) & SYSCON_PRESETCTRL_FC8_RST_MASK) | ||
11101 | #define SYSCON_PRESETCTRL_GPIO0_RST_MASK (0x4000U) | ||
11102 | #define SYSCON_PRESETCTRL_GPIO0_RST_SHIFT (14U) | ||
11103 | /*! GPIO0_RST - GPIO0 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11104 | */ | ||
11105 | #define SYSCON_PRESETCTRL_GPIO0_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_GPIO0_RST_SHIFT)) & SYSCON_PRESETCTRL_GPIO0_RST_MASK) | ||
11106 | #define SYSCON_PRESETCTRL_FC4_RST_MASK (0x8000U) | ||
11107 | #define SYSCON_PRESETCTRL_FC4_RST_SHIFT (15U) | ||
11108 | /*! FC4_RST - Flexcomm 4 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11109 | */ | ||
11110 | #define SYSCON_PRESETCTRL_FC4_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC4_RST_SHIFT)) & SYSCON_PRESETCTRL_FC4_RST_MASK) | ||
11111 | #define SYSCON_PRESETCTRL_FC9_RST_MASK (0x8000U) | ||
11112 | #define SYSCON_PRESETCTRL_FC9_RST_SHIFT (15U) | ||
11113 | /*! FC9_RST - Flexcomm 9 reset control. | ||
11114 | */ | ||
11115 | #define SYSCON_PRESETCTRL_FC9_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC9_RST_SHIFT)) & SYSCON_PRESETCTRL_FC9_RST_MASK) | ||
11116 | #define SYSCON_PRESETCTRL_GPIO1_RST_MASK (0x8000U) | ||
11117 | #define SYSCON_PRESETCTRL_GPIO1_RST_SHIFT (15U) | ||
11118 | /*! GPIO1_RST - GPIO1 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11119 | */ | ||
11120 | #define SYSCON_PRESETCTRL_GPIO1_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_GPIO1_RST_SHIFT)) & SYSCON_PRESETCTRL_GPIO1_RST_MASK) | ||
11121 | #define SYSCON_PRESETCTRL_FC5_RST_MASK (0x10000U) | ||
11122 | #define SYSCON_PRESETCTRL_FC5_RST_SHIFT (16U) | ||
11123 | /*! FC5_RST - Flexcomm 5 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11124 | */ | ||
11125 | #define SYSCON_PRESETCTRL_FC5_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC5_RST_SHIFT)) & SYSCON_PRESETCTRL_FC5_RST_MASK) | ||
11126 | #define SYSCON_PRESETCTRL_GPIO2_RST_MASK (0x10000U) | ||
11127 | #define SYSCON_PRESETCTRL_GPIO2_RST_SHIFT (16U) | ||
11128 | /*! GPIO2_RST - GPIO2 reset control. | ||
11129 | */ | ||
11130 | #define SYSCON_PRESETCTRL_GPIO2_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_GPIO2_RST_SHIFT)) & SYSCON_PRESETCTRL_GPIO2_RST_MASK) | ||
11131 | #define SYSCON_PRESETCTRL_USB0HMR_RST_MASK (0x10000U) | ||
11132 | #define SYSCON_PRESETCTRL_USB0HMR_RST_SHIFT (16U) | ||
11133 | /*! USB0HMR_RST - USB0 HOST master reset control. | ||
11134 | */ | ||
11135 | #define SYSCON_PRESETCTRL_USB0HMR_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_USB0HMR_RST_SHIFT)) & SYSCON_PRESETCTRL_USB0HMR_RST_MASK) | ||
11136 | #define SYSCON_PRESETCTRL_FC6_RST_MASK (0x20000U) | ||
11137 | #define SYSCON_PRESETCTRL_FC6_RST_SHIFT (17U) | ||
11138 | /*! FC6_RST - Flexcomm 6 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11139 | */ | ||
11140 | #define SYSCON_PRESETCTRL_FC6_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC6_RST_SHIFT)) & SYSCON_PRESETCTRL_FC6_RST_MASK) | ||
11141 | #define SYSCON_PRESETCTRL_GPIO3_RST_MASK (0x20000U) | ||
11142 | #define SYSCON_PRESETCTRL_GPIO3_RST_SHIFT (17U) | ||
11143 | /*! GPIO3_RST - GPIO3 reset control. | ||
11144 | */ | ||
11145 | #define SYSCON_PRESETCTRL_GPIO3_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_GPIO3_RST_SHIFT)) & SYSCON_PRESETCTRL_GPIO3_RST_MASK) | ||
11146 | #define SYSCON_PRESETCTRL_USB0HSL_RST_MASK (0x20000U) | ||
11147 | #define SYSCON_PRESETCTRL_USB0HSL_RST_SHIFT (17U) | ||
11148 | /*! USB0HSL_RST - USB0 HOST slave reset control. | ||
11149 | */ | ||
11150 | #define SYSCON_PRESETCTRL_USB0HSL_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_USB0HSL_RST_SHIFT)) & SYSCON_PRESETCTRL_USB0HSL_RST_MASK) | ||
11151 | #define SYSCON_PRESETCTRL_FC7_RST_MASK (0x40000U) | ||
11152 | #define SYSCON_PRESETCTRL_FC7_RST_SHIFT (18U) | ||
11153 | /*! FC7_RST - Flexcomm 7 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11154 | */ | ||
11155 | #define SYSCON_PRESETCTRL_FC7_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC7_RST_SHIFT)) & SYSCON_PRESETCTRL_FC7_RST_MASK) | ||
11156 | #define SYSCON_PRESETCTRL_PINT_RST_MASK (0x40000U) | ||
11157 | #define SYSCON_PRESETCTRL_PINT_RST_SHIFT (18U) | ||
11158 | /*! PINT_RST - Pin interrupt (PINT) reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11159 | */ | ||
11160 | #define SYSCON_PRESETCTRL_PINT_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_PINT_RST_SHIFT)) & SYSCON_PRESETCTRL_PINT_RST_MASK) | ||
11161 | #define SYSCON_PRESETCTRL_SHA_RST_MASK (0x40000U) | ||
11162 | #define SYSCON_PRESETCTRL_SHA_RST_SHIFT (18U) | ||
11163 | /*! SHA_RST - SHA reset control. | ||
11164 | */ | ||
11165 | #define SYSCON_PRESETCTRL_SHA_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_SHA_RST_SHIFT)) & SYSCON_PRESETCTRL_SHA_RST_MASK) | ||
11166 | #define SYSCON_PRESETCTRL_DMIC_RST_MASK (0x80000U) | ||
11167 | #define SYSCON_PRESETCTRL_DMIC_RST_SHIFT (19U) | ||
11168 | /*! DMIC_RST - Digital microphone interface reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11169 | */ | ||
11170 | #define SYSCON_PRESETCTRL_DMIC_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_DMIC_RST_SHIFT)) & SYSCON_PRESETCTRL_DMIC_RST_MASK) | ||
11171 | #define SYSCON_PRESETCTRL_GINT_RST_MASK (0x80000U) | ||
11172 | #define SYSCON_PRESETCTRL_GINT_RST_SHIFT (19U) | ||
11173 | /*! GINT_RST - Grouped interrupt (GINT) reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11174 | */ | ||
11175 | #define SYSCON_PRESETCTRL_GINT_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_GINT_RST_SHIFT)) & SYSCON_PRESETCTRL_GINT_RST_MASK) | ||
11176 | #define SYSCON_PRESETCTRL_SC0_RST_MASK (0x80000U) | ||
11177 | #define SYSCON_PRESETCTRL_SC0_RST_SHIFT (19U) | ||
11178 | /*! SC0_RST - Smart card 0 reset control. | ||
11179 | */ | ||
11180 | #define SYSCON_PRESETCTRL_SC0_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_SC0_RST_SHIFT)) & SYSCON_PRESETCTRL_SC0_RST_MASK) | ||
11181 | #define SYSCON_PRESETCTRL_DMA_RST_MASK (0x100000U) | ||
11182 | #define SYSCON_PRESETCTRL_DMA_RST_SHIFT (20U) | ||
11183 | /*! DMA_RST - DMA reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11184 | */ | ||
11185 | #define SYSCON_PRESETCTRL_DMA_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_DMA_RST_SHIFT)) & SYSCON_PRESETCTRL_DMA_RST_MASK) | ||
11186 | #define SYSCON_PRESETCTRL_SC1_RST_MASK (0x100000U) | ||
11187 | #define SYSCON_PRESETCTRL_SC1_RST_SHIFT (20U) | ||
11188 | /*! SC1_RST - Smart card 1 reset control. | ||
11189 | */ | ||
11190 | #define SYSCON_PRESETCTRL_SC1_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_SC1_RST_SHIFT)) & SYSCON_PRESETCTRL_SC1_RST_MASK) | ||
11191 | #define SYSCON_PRESETCTRL_CRC_RST_MASK (0x200000U) | ||
11192 | #define SYSCON_PRESETCTRL_CRC_RST_SHIFT (21U) | ||
11193 | /*! CRC_RST - CRC generator reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11194 | */ | ||
11195 | #define SYSCON_PRESETCTRL_CRC_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_CRC_RST_SHIFT)) & SYSCON_PRESETCTRL_CRC_RST_MASK) | ||
11196 | #define SYSCON_PRESETCTRL_FC10_RST_MASK (0x200000U) | ||
11197 | #define SYSCON_PRESETCTRL_FC10_RST_SHIFT (21U) | ||
11198 | /*! FC10_RST - Flexcomm 10 reset control. | ||
11199 | */ | ||
11200 | #define SYSCON_PRESETCTRL_FC10_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_FC10_RST_SHIFT)) & SYSCON_PRESETCTRL_FC10_RST_MASK) | ||
11201 | #define SYSCON_PRESETCTRL_CTIMER2_RST_MASK (0x400000U) | ||
11202 | #define SYSCON_PRESETCTRL_CTIMER2_RST_SHIFT (22U) | ||
11203 | /*! CTIMER2_RST - CTIMER2 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function | ||
11204 | */ | ||
11205 | #define SYSCON_PRESETCTRL_CTIMER2_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_CTIMER2_RST_SHIFT)) & SYSCON_PRESETCTRL_CTIMER2_RST_MASK) | ||
11206 | #define SYSCON_PRESETCTRL_WWDT_RST_MASK (0x400000U) | ||
11207 | #define SYSCON_PRESETCTRL_WWDT_RST_SHIFT (22U) | ||
11208 | /*! WWDT_RST - Watchdog timer reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11209 | */ | ||
11210 | #define SYSCON_PRESETCTRL_WWDT_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_WWDT_RST_SHIFT)) & SYSCON_PRESETCTRL_WWDT_RST_MASK) | ||
11211 | #define SYSCON_PRESETCTRL_USB0D_RST_MASK (0x2000000U) | ||
11212 | #define SYSCON_PRESETCTRL_USB0D_RST_SHIFT (25U) | ||
11213 | /*! USB0D_RST - USB0 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11214 | */ | ||
11215 | #define SYSCON_PRESETCTRL_USB0D_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_USB0D_RST_SHIFT)) & SYSCON_PRESETCTRL_USB0D_RST_MASK) | ||
11216 | #define SYSCON_PRESETCTRL_CTIMER0_RST_MASK (0x4000000U) | ||
11217 | #define SYSCON_PRESETCTRL_CTIMER0_RST_SHIFT (26U) | ||
11218 | /*! CTIMER0_RST - CTIMER0 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11219 | */ | ||
11220 | #define SYSCON_PRESETCTRL_CTIMER0_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_CTIMER0_RST_SHIFT)) & SYSCON_PRESETCTRL_CTIMER0_RST_MASK) | ||
11221 | #define SYSCON_PRESETCTRL_ADC0_RST_MASK (0x8000000U) | ||
11222 | #define SYSCON_PRESETCTRL_ADC0_RST_SHIFT (27U) | ||
11223 | /*! ADC0_RST - ADC0 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11224 | */ | ||
11225 | #define SYSCON_PRESETCTRL_ADC0_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_ADC0_RST_SHIFT)) & SYSCON_PRESETCTRL_ADC0_RST_MASK) | ||
11226 | #define SYSCON_PRESETCTRL_CTIMER1_RST_MASK (0x8000000U) | ||
11227 | #define SYSCON_PRESETCTRL_CTIMER1_RST_SHIFT (27U) | ||
11228 | /*! CTIMER1_RST - CTIMER1 reset control. 0 = Clear reset to this function. 1 = Assert reset to this function. | ||
11229 | */ | ||
11230 | #define SYSCON_PRESETCTRL_CTIMER1_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRL_CTIMER1_RST_SHIFT)) & SYSCON_PRESETCTRL_CTIMER1_RST_MASK) | ||
11231 | /*! @} */ | ||
11232 | |||
11233 | /* The count of SYSCON_PRESETCTRL */ | ||
11234 | #define SYSCON_PRESETCTRL_COUNT (3U) | ||
11235 | |||
11236 | /*! @name PRESETCTRLSET - Set bits in PRESETCTRLn */ | ||
11237 | /*! @{ */ | ||
11238 | #define SYSCON_PRESETCTRLSET_RST_SET_MASK (0xFFFFFFFFU) | ||
11239 | #define SYSCON_PRESETCTRLSET_RST_SET_SHIFT (0U) | ||
11240 | /*! RST_SET - Writing ones to this register sets the corresponding bit or bits in the PRESETCTRLn | ||
11241 | * register, if they are implemented. Bits that do not correspond to defined bits in PRESETCTRLn | ||
11242 | * are reserved and only zeroes should be written to them. | ||
11243 | */ | ||
11244 | #define SYSCON_PRESETCTRLSET_RST_SET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRLSET_RST_SET_SHIFT)) & SYSCON_PRESETCTRLSET_RST_SET_MASK) | ||
11245 | /*! @} */ | ||
11246 | |||
11247 | /* The count of SYSCON_PRESETCTRLSET */ | ||
11248 | #define SYSCON_PRESETCTRLSET_COUNT (3U) | ||
11249 | |||
11250 | /*! @name PRESETCTRLCLR - Clear bits in PRESETCTRLn */ | ||
11251 | /*! @{ */ | ||
11252 | #define SYSCON_PRESETCTRLCLR_RST_CLR_MASK (0xFFFFFFFFU) | ||
11253 | #define SYSCON_PRESETCTRLCLR_RST_CLR_SHIFT (0U) | ||
11254 | /*! RST_CLR - Writing ones to this register clears the corresponding bit or bits in the PRESETCTRLn | ||
11255 | * register, if they are implemented. Bits that do not correspond to defined bits in PRESETCTRLn | ||
11256 | * are reserved and only zeroes should be written to them. | ||
11257 | */ | ||
11258 | #define SYSCON_PRESETCTRLCLR_RST_CLR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PRESETCTRLCLR_RST_CLR_SHIFT)) & SYSCON_PRESETCTRLCLR_RST_CLR_MASK) | ||
11259 | /*! @} */ | ||
11260 | |||
11261 | /* The count of SYSCON_PRESETCTRLCLR */ | ||
11262 | #define SYSCON_PRESETCTRLCLR_COUNT (3U) | ||
11263 | |||
11264 | /*! @name SYSRSTSTAT - System reset status register */ | ||
11265 | /*! @{ */ | ||
11266 | #define SYSCON_SYSRSTSTAT_POR_MASK (0x1U) | ||
11267 | #define SYSCON_SYSRSTSTAT_POR_SHIFT (0U) | ||
11268 | /*! POR - POR reset status | ||
11269 | * 0b0..No POR detected | ||
11270 | * 0b1..POR detected. Writing a one clears this reset. | ||
11271 | */ | ||
11272 | #define SYSCON_SYSRSTSTAT_POR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSRSTSTAT_POR_SHIFT)) & SYSCON_SYSRSTSTAT_POR_MASK) | ||
11273 | #define SYSCON_SYSRSTSTAT_EXTRST_MASK (0x2U) | ||
11274 | #define SYSCON_SYSRSTSTAT_EXTRST_SHIFT (1U) | ||
11275 | /*! EXTRST - Status of the external RESET pin. External reset status | ||
11276 | * 0b0..No reset event detected. | ||
11277 | * 0b1..Reset detected. Writing a one clears this reset. | ||
11278 | */ | ||
11279 | #define SYSCON_SYSRSTSTAT_EXTRST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSRSTSTAT_EXTRST_SHIFT)) & SYSCON_SYSRSTSTAT_EXTRST_MASK) | ||
11280 | #define SYSCON_SYSRSTSTAT_WDT_MASK (0x4U) | ||
11281 | #define SYSCON_SYSRSTSTAT_WDT_SHIFT (2U) | ||
11282 | /*! WDT - Status of the Watchdog reset | ||
11283 | * 0b0..No WDT reset detected | ||
11284 | * 0b1..WDT reset detected. Writing a one clears this reset. | ||
11285 | */ | ||
11286 | #define SYSCON_SYSRSTSTAT_WDT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSRSTSTAT_WDT_SHIFT)) & SYSCON_SYSRSTSTAT_WDT_MASK) | ||
11287 | #define SYSCON_SYSRSTSTAT_BOD_MASK (0x8U) | ||
11288 | #define SYSCON_SYSRSTSTAT_BOD_SHIFT (3U) | ||
11289 | /*! BOD - Status of the Brown-out detect reset | ||
11290 | * 0b0..No BOD reset detected | ||
11291 | * 0b1..BOD reset detected. Writing a one clears this reset. | ||
11292 | */ | ||
11293 | #define SYSCON_SYSRSTSTAT_BOD(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSRSTSTAT_BOD_SHIFT)) & SYSCON_SYSRSTSTAT_BOD_MASK) | ||
11294 | #define SYSCON_SYSRSTSTAT_SYSRST_MASK (0x10U) | ||
11295 | #define SYSCON_SYSRSTSTAT_SYSRST_SHIFT (4U) | ||
11296 | /*! SYSRST - Status of the software system reset | ||
11297 | * 0b0..No System reset detected | ||
11298 | * 0b1..System reset detected. Writing a one clears this reset. | ||
11299 | */ | ||
11300 | #define SYSCON_SYSRSTSTAT_SYSRST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSRSTSTAT_SYSRST_SHIFT)) & SYSCON_SYSRSTSTAT_SYSRST_MASK) | ||
11301 | /*! @} */ | ||
11302 | |||
11303 | /*! @name AHBCLKCTRL - AHB Clock control n */ | ||
11304 | /*! @{ */ | ||
11305 | #define SYSCON_AHBCLKCTRL_MRT_MASK (0x1U) | ||
11306 | #define SYSCON_AHBCLKCTRL_MRT_SHIFT (0U) | ||
11307 | /*! MRT - Enables the clock for the Multi-Rate Timer. | ||
11308 | */ | ||
11309 | #define SYSCON_AHBCLKCTRL_MRT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_MRT_SHIFT)) & SYSCON_AHBCLKCTRL_MRT_MASK) | ||
11310 | #define SYSCON_AHBCLKCTRL_RIT_MASK (0x2U) | ||
11311 | #define SYSCON_AHBCLKCTRL_RIT_SHIFT (1U) | ||
11312 | /*! RIT - Enables the clock for the Repetitive Interrupt Timer. | ||
11313 | */ | ||
11314 | #define SYSCON_AHBCLKCTRL_RIT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_RIT_SHIFT)) & SYSCON_AHBCLKCTRL_RIT_MASK) | ||
11315 | #define SYSCON_AHBCLKCTRL_ROM_MASK (0x2U) | ||
11316 | #define SYSCON_AHBCLKCTRL_ROM_SHIFT (1U) | ||
11317 | /*! ROM - Enables the clock for the Boot ROM. 0 = Disable; 1 = Enable. | ||
11318 | */ | ||
11319 | #define SYSCON_AHBCLKCTRL_ROM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_ROM_SHIFT)) & SYSCON_AHBCLKCTRL_ROM_MASK) | ||
11320 | #define SYSCON_AHBCLKCTRL_LCD_MASK (0x4U) | ||
11321 | #define SYSCON_AHBCLKCTRL_LCD_SHIFT (2U) | ||
11322 | /*! LCD - Enables the clock for the LCD interface. | ||
11323 | */ | ||
11324 | #define SYSCON_AHBCLKCTRL_LCD(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_LCD_SHIFT)) & SYSCON_AHBCLKCTRL_LCD_MASK) | ||
11325 | #define SYSCON_AHBCLKCTRL_SCT0_MASK (0x4U) | ||
11326 | #define SYSCON_AHBCLKCTRL_SCT0_SHIFT (2U) | ||
11327 | /*! SCT0 - Enables the clock for SCT0. | ||
11328 | */ | ||
11329 | #define SYSCON_AHBCLKCTRL_SCT0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SCT0_SHIFT)) & SYSCON_AHBCLKCTRL_SCT0_MASK) | ||
11330 | #define SYSCON_AHBCLKCTRL_SDIO_MASK (0x8U) | ||
11331 | #define SYSCON_AHBCLKCTRL_SDIO_SHIFT (3U) | ||
11332 | /*! SDIO - Enables the clock for the SDIO interface. | ||
11333 | */ | ||
11334 | #define SYSCON_AHBCLKCTRL_SDIO(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SDIO_SHIFT)) & SYSCON_AHBCLKCTRL_SDIO_MASK) | ||
11335 | #define SYSCON_AHBCLKCTRL_SRAM1_MASK (0x8U) | ||
11336 | #define SYSCON_AHBCLKCTRL_SRAM1_SHIFT (3U) | ||
11337 | /*! SRAM1 - Enables the clock for SRAM1. 0 = Disable; 1 = Enable. | ||
11338 | */ | ||
11339 | #define SYSCON_AHBCLKCTRL_SRAM1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SRAM1_SHIFT)) & SYSCON_AHBCLKCTRL_SRAM1_MASK) | ||
11340 | #define SYSCON_AHBCLKCTRL_SRAM2_MASK (0x10U) | ||
11341 | #define SYSCON_AHBCLKCTRL_SRAM2_SHIFT (4U) | ||
11342 | /*! SRAM2 - Enables the clock for SRAM2. 0 = Disable; 1 = Enable. | ||
11343 | */ | ||
11344 | #define SYSCON_AHBCLKCTRL_SRAM2(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SRAM2_SHIFT)) & SYSCON_AHBCLKCTRL_SRAM2_MASK) | ||
11345 | #define SYSCON_AHBCLKCTRL_USB1H_MASK (0x10U) | ||
11346 | #define SYSCON_AHBCLKCTRL_USB1H_SHIFT (4U) | ||
11347 | /*! USB1H - Enables the clock for the USB1 host interface. | ||
11348 | */ | ||
11349 | #define SYSCON_AHBCLKCTRL_USB1H(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_USB1H_SHIFT)) & SYSCON_AHBCLKCTRL_USB1H_MASK) | ||
11350 | #define SYSCON_AHBCLKCTRL_SRAM3_MASK (0x20U) | ||
11351 | #define SYSCON_AHBCLKCTRL_SRAM3_SHIFT (5U) | ||
11352 | /*! SRAM3 - Enables the clock for SRAM3. | ||
11353 | */ | ||
11354 | #define SYSCON_AHBCLKCTRL_SRAM3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SRAM3_SHIFT)) & SYSCON_AHBCLKCTRL_SRAM3_MASK) | ||
11355 | #define SYSCON_AHBCLKCTRL_USB1D_MASK (0x20U) | ||
11356 | #define SYSCON_AHBCLKCTRL_USB1D_SHIFT (5U) | ||
11357 | /*! USB1D - Enables the clock for the USB1 device interface. | ||
11358 | */ | ||
11359 | #define SYSCON_AHBCLKCTRL_USB1D(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_USB1D_SHIFT)) & SYSCON_AHBCLKCTRL_USB1D_MASK) | ||
11360 | #define SYSCON_AHBCLKCTRL_USB1RAM_MASK (0x40U) | ||
11361 | #define SYSCON_AHBCLKCTRL_USB1RAM_SHIFT (6U) | ||
11362 | /*! USB1RAM - Enables the clock for the USB1 RAM interface. | ||
11363 | */ | ||
11364 | #define SYSCON_AHBCLKCTRL_USB1RAM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_USB1RAM_SHIFT)) & SYSCON_AHBCLKCTRL_USB1RAM_MASK) | ||
11365 | #define SYSCON_AHBCLKCTRL_EMC_MASK (0x80U) | ||
11366 | #define SYSCON_AHBCLKCTRL_EMC_SHIFT (7U) | ||
11367 | /*! EMC - Enables the clock for the EMC interface. | ||
11368 | */ | ||
11369 | #define SYSCON_AHBCLKCTRL_EMC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_EMC_SHIFT)) & SYSCON_AHBCLKCTRL_EMC_MASK) | ||
11370 | #define SYSCON_AHBCLKCTRL_MCAN0_MASK (0x80U) | ||
11371 | #define SYSCON_AHBCLKCTRL_MCAN0_SHIFT (7U) | ||
11372 | /*! MCAN0 - Enables the clock for MCAN0. | ||
11373 | */ | ||
11374 | #define SYSCON_AHBCLKCTRL_MCAN0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_MCAN0_SHIFT)) & SYSCON_AHBCLKCTRL_MCAN0_MASK) | ||
11375 | #define SYSCON_AHBCLKCTRL_ETH_MASK (0x100U) | ||
11376 | #define SYSCON_AHBCLKCTRL_ETH_SHIFT (8U) | ||
11377 | /*! ETH - Enables the clock for the ethernet interface. | ||
11378 | */ | ||
11379 | #define SYSCON_AHBCLKCTRL_ETH(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_ETH_SHIFT)) & SYSCON_AHBCLKCTRL_ETH_MASK) | ||
11380 | #define SYSCON_AHBCLKCTRL_MCAN1_MASK (0x100U) | ||
11381 | #define SYSCON_AHBCLKCTRL_MCAN1_SHIFT (8U) | ||
11382 | /*! MCAN1 - Enables the clock for MCAN1. | ||
11383 | */ | ||
11384 | #define SYSCON_AHBCLKCTRL_MCAN1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_MCAN1_SHIFT)) & SYSCON_AHBCLKCTRL_MCAN1_MASK) | ||
11385 | #define SYSCON_AHBCLKCTRL_GPIO4_MASK (0x200U) | ||
11386 | #define SYSCON_AHBCLKCTRL_GPIO4_SHIFT (9U) | ||
11387 | /*! GPIO4 - Enables the clock for the GPIO4 interface. | ||
11388 | */ | ||
11389 | #define SYSCON_AHBCLKCTRL_GPIO4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_GPIO4_SHIFT)) & SYSCON_AHBCLKCTRL_GPIO4_MASK) | ||
11390 | #define SYSCON_AHBCLKCTRL_GPIO5_MASK (0x400U) | ||
11391 | #define SYSCON_AHBCLKCTRL_GPIO5_SHIFT (10U) | ||
11392 | /*! GPIO5 - Enables the clock for the GPIO5 interface. | ||
11393 | */ | ||
11394 | #define SYSCON_AHBCLKCTRL_GPIO5(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_GPIO5_SHIFT)) & SYSCON_AHBCLKCTRL_GPIO5_MASK) | ||
11395 | #define SYSCON_AHBCLKCTRL_SPIFI_MASK (0x400U) | ||
11396 | #define SYSCON_AHBCLKCTRL_SPIFI_SHIFT (10U) | ||
11397 | /*! SPIFI - Enables the clock for the SPIFI. 0 = Disable; 1 = Enable. | ||
11398 | */ | ||
11399 | #define SYSCON_AHBCLKCTRL_SPIFI(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SPIFI_SHIFT)) & SYSCON_AHBCLKCTRL_SPIFI_MASK) | ||
11400 | #define SYSCON_AHBCLKCTRL_UTICK_MASK (0x400U) | ||
11401 | #define SYSCON_AHBCLKCTRL_UTICK_SHIFT (10U) | ||
11402 | /*! UTICK - Enables the clock for the Micro-tick Timer. 0 = Disable; 1 = Enable. | ||
11403 | */ | ||
11404 | #define SYSCON_AHBCLKCTRL_UTICK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_UTICK_SHIFT)) & SYSCON_AHBCLKCTRL_UTICK_MASK) | ||
11405 | #define SYSCON_AHBCLKCTRL_FLEXCOMM0_MASK (0x800U) | ||
11406 | #define SYSCON_AHBCLKCTRL_FLEXCOMM0_SHIFT (11U) | ||
11407 | /*! FLEXCOMM0 - Enables the clock for Flexcomm 0. 0 = Disable; 1 = Enable. | ||
11408 | */ | ||
11409 | #define SYSCON_AHBCLKCTRL_FLEXCOMM0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM0_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM0_MASK) | ||
11410 | #define SYSCON_AHBCLKCTRL_INPUTMUX_MASK (0x800U) | ||
11411 | #define SYSCON_AHBCLKCTRL_INPUTMUX_SHIFT (11U) | ||
11412 | /*! INPUTMUX - Enables the clock for the input muxes. 0 = Disable; 1 = Enable. | ||
11413 | */ | ||
11414 | #define SYSCON_AHBCLKCTRL_INPUTMUX(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_INPUTMUX_SHIFT)) & SYSCON_AHBCLKCTRL_INPUTMUX_MASK) | ||
11415 | #define SYSCON_AHBCLKCTRL_FLEXCOMM1_MASK (0x1000U) | ||
11416 | #define SYSCON_AHBCLKCTRL_FLEXCOMM1_SHIFT (12U) | ||
11417 | /*! FLEXCOMM1 - Enables the clock for Flexcomm 1. 0 = Disable; 1 = Enable. | ||
11418 | */ | ||
11419 | #define SYSCON_AHBCLKCTRL_FLEXCOMM1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM1_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM1_MASK) | ||
11420 | #define SYSCON_AHBCLKCTRL_OTP_MASK (0x1000U) | ||
11421 | #define SYSCON_AHBCLKCTRL_OTP_SHIFT (12U) | ||
11422 | /*! OTP - Enables the clock for the OTP interface. | ||
11423 | */ | ||
11424 | #define SYSCON_AHBCLKCTRL_OTP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_OTP_SHIFT)) & SYSCON_AHBCLKCTRL_OTP_MASK) | ||
11425 | #define SYSCON_AHBCLKCTRL_FLEXCOMM2_MASK (0x2000U) | ||
11426 | #define SYSCON_AHBCLKCTRL_FLEXCOMM2_SHIFT (13U) | ||
11427 | /*! FLEXCOMM2 - Enables the clock for Flexcomm 2. 0 = Disable; 1 = Enable. | ||
11428 | */ | ||
11429 | #define SYSCON_AHBCLKCTRL_FLEXCOMM2(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM2_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM2_MASK) | ||
11430 | #define SYSCON_AHBCLKCTRL_IOCON_MASK (0x2000U) | ||
11431 | #define SYSCON_AHBCLKCTRL_IOCON_SHIFT (13U) | ||
11432 | /*! IOCON - Enables the clock for the IOCON block. 0 = Disable; 1 = Enable. | ||
11433 | */ | ||
11434 | #define SYSCON_AHBCLKCTRL_IOCON(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_IOCON_SHIFT)) & SYSCON_AHBCLKCTRL_IOCON_MASK) | ||
11435 | #define SYSCON_AHBCLKCTRL_RNG_MASK (0x2000U) | ||
11436 | #define SYSCON_AHBCLKCTRL_RNG_SHIFT (13U) | ||
11437 | /*! RNG - Enables the clock for the RNG interface. | ||
11438 | */ | ||
11439 | #define SYSCON_AHBCLKCTRL_RNG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_RNG_SHIFT)) & SYSCON_AHBCLKCTRL_RNG_MASK) | ||
11440 | #define SYSCON_AHBCLKCTRL_FLEXCOMM3_MASK (0x4000U) | ||
11441 | #define SYSCON_AHBCLKCTRL_FLEXCOMM3_SHIFT (14U) | ||
11442 | /*! FLEXCOMM3 - Enables the clock for Flexcomm 3. 0 = Disable; 1 = Enable. | ||
11443 | */ | ||
11444 | #define SYSCON_AHBCLKCTRL_FLEXCOMM3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM3_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM3_MASK) | ||
11445 | #define SYSCON_AHBCLKCTRL_FLEXCOMM8_MASK (0x4000U) | ||
11446 | #define SYSCON_AHBCLKCTRL_FLEXCOMM8_SHIFT (14U) | ||
11447 | /*! FLEXCOMM8 - Enables the clock for the Flexcomm8 interface. | ||
11448 | */ | ||
11449 | #define SYSCON_AHBCLKCTRL_FLEXCOMM8(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM8_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM8_MASK) | ||
11450 | #define SYSCON_AHBCLKCTRL_GPIO0_MASK (0x4000U) | ||
11451 | #define SYSCON_AHBCLKCTRL_GPIO0_SHIFT (14U) | ||
11452 | /*! GPIO0 - Enables the clock for the GPIO0 port registers. 0 = Disable; 1 = Enable. | ||
11453 | */ | ||
11454 | #define SYSCON_AHBCLKCTRL_GPIO0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_GPIO0_SHIFT)) & SYSCON_AHBCLKCTRL_GPIO0_MASK) | ||
11455 | #define SYSCON_AHBCLKCTRL_FLEXCOMM4_MASK (0x8000U) | ||
11456 | #define SYSCON_AHBCLKCTRL_FLEXCOMM4_SHIFT (15U) | ||
11457 | /*! FLEXCOMM4 - Enables the clock for Flexcomm 4. 0 = Disable; 1 = Enable. | ||
11458 | */ | ||
11459 | #define SYSCON_AHBCLKCTRL_FLEXCOMM4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM4_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM4_MASK) | ||
11460 | #define SYSCON_AHBCLKCTRL_FLEXCOMM9_MASK (0x8000U) | ||
11461 | #define SYSCON_AHBCLKCTRL_FLEXCOMM9_SHIFT (15U) | ||
11462 | /*! FLEXCOMM9 - Enables the clock for the Flexcomm9 interface. | ||
11463 | */ | ||
11464 | #define SYSCON_AHBCLKCTRL_FLEXCOMM9(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM9_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM9_MASK) | ||
11465 | #define SYSCON_AHBCLKCTRL_GPIO1_MASK (0x8000U) | ||
11466 | #define SYSCON_AHBCLKCTRL_GPIO1_SHIFT (15U) | ||
11467 | /*! GPIO1 - Enables the clock for the GPIO1 port registers. 0 = Disable; 1 = Enable. | ||
11468 | */ | ||
11469 | #define SYSCON_AHBCLKCTRL_GPIO1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_GPIO1_SHIFT)) & SYSCON_AHBCLKCTRL_GPIO1_MASK) | ||
11470 | #define SYSCON_AHBCLKCTRL_FLEXCOMM5_MASK (0x10000U) | ||
11471 | #define SYSCON_AHBCLKCTRL_FLEXCOMM5_SHIFT (16U) | ||
11472 | /*! FLEXCOMM5 - Enables the clock for Flexcomm 5. 0 = Disable; 1 = Enable. | ||
11473 | */ | ||
11474 | #define SYSCON_AHBCLKCTRL_FLEXCOMM5(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM5_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM5_MASK) | ||
11475 | #define SYSCON_AHBCLKCTRL_GPIO2_MASK (0x10000U) | ||
11476 | #define SYSCON_AHBCLKCTRL_GPIO2_SHIFT (16U) | ||
11477 | /*! GPIO2 - Enables the clock for the GPIO2 port registers. | ||
11478 | */ | ||
11479 | #define SYSCON_AHBCLKCTRL_GPIO2(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_GPIO2_SHIFT)) & SYSCON_AHBCLKCTRL_GPIO2_MASK) | ||
11480 | #define SYSCON_AHBCLKCTRL_USB0HMR_MASK (0x10000U) | ||
11481 | #define SYSCON_AHBCLKCTRL_USB0HMR_SHIFT (16U) | ||
11482 | /*! USB0HMR - Enables the clock for the USB host master interface. | ||
11483 | */ | ||
11484 | #define SYSCON_AHBCLKCTRL_USB0HMR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_USB0HMR_SHIFT)) & SYSCON_AHBCLKCTRL_USB0HMR_MASK) | ||
11485 | #define SYSCON_AHBCLKCTRL_FLEXCOMM6_MASK (0x20000U) | ||
11486 | #define SYSCON_AHBCLKCTRL_FLEXCOMM6_SHIFT (17U) | ||
11487 | /*! FLEXCOMM6 - Enables the clock for Flexcomm 6. 0 = Disable; 1 = Enable. | ||
11488 | */ | ||
11489 | #define SYSCON_AHBCLKCTRL_FLEXCOMM6(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM6_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM6_MASK) | ||
11490 | #define SYSCON_AHBCLKCTRL_GPIO3_MASK (0x20000U) | ||
11491 | #define SYSCON_AHBCLKCTRL_GPIO3_SHIFT (17U) | ||
11492 | /*! GPIO3 - Enables the clock for the GPIO3 port registers. | ||
11493 | */ | ||
11494 | #define SYSCON_AHBCLKCTRL_GPIO3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_GPIO3_SHIFT)) & SYSCON_AHBCLKCTRL_GPIO3_MASK) | ||
11495 | #define SYSCON_AHBCLKCTRL_USB0HSL_MASK (0x20000U) | ||
11496 | #define SYSCON_AHBCLKCTRL_USB0HSL_SHIFT (17U) | ||
11497 | /*! USB0HSL - Enables the clock for the USB host slave interface. | ||
11498 | */ | ||
11499 | #define SYSCON_AHBCLKCTRL_USB0HSL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_USB0HSL_SHIFT)) & SYSCON_AHBCLKCTRL_USB0HSL_MASK) | ||
11500 | #define SYSCON_AHBCLKCTRL_FLEXCOMM7_MASK (0x40000U) | ||
11501 | #define SYSCON_AHBCLKCTRL_FLEXCOMM7_SHIFT (18U) | ||
11502 | /*! FLEXCOMM7 - Enables the clock for Flexcomm 7. 0 = Disable; 1 = Enable. | ||
11503 | */ | ||
11504 | #define SYSCON_AHBCLKCTRL_FLEXCOMM7(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM7_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM7_MASK) | ||
11505 | #define SYSCON_AHBCLKCTRL_PINT_MASK (0x40000U) | ||
11506 | #define SYSCON_AHBCLKCTRL_PINT_SHIFT (18U) | ||
11507 | /*! PINT - Enables the clock for the pin interrupt block.0 = Disable; 1 = Enable. | ||
11508 | */ | ||
11509 | #define SYSCON_AHBCLKCTRL_PINT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_PINT_SHIFT)) & SYSCON_AHBCLKCTRL_PINT_MASK) | ||
11510 | #define SYSCON_AHBCLKCTRL_SHA_MASK (0x40000U) | ||
11511 | #define SYSCON_AHBCLKCTRL_SHA_SHIFT (18U) | ||
11512 | /*! SHA - Enables the clock for the SHA interface. | ||
11513 | */ | ||
11514 | #define SYSCON_AHBCLKCTRL_SHA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SHA_SHIFT)) & SYSCON_AHBCLKCTRL_SHA_MASK) | ||
11515 | #define SYSCON_AHBCLKCTRL_DMIC_MASK (0x80000U) | ||
11516 | #define SYSCON_AHBCLKCTRL_DMIC_SHIFT (19U) | ||
11517 | /*! DMIC - Enables the clock for the digital microphone interface. 0 = Disable; 1 = Enable. | ||
11518 | */ | ||
11519 | #define SYSCON_AHBCLKCTRL_DMIC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_DMIC_SHIFT)) & SYSCON_AHBCLKCTRL_DMIC_MASK) | ||
11520 | #define SYSCON_AHBCLKCTRL_GINT_MASK (0x80000U) | ||
11521 | #define SYSCON_AHBCLKCTRL_GINT_SHIFT (19U) | ||
11522 | /*! GINT - Enables the clock for the grouped pin interrupt block. 0 = Disable; 1 = Enable. | ||
11523 | */ | ||
11524 | #define SYSCON_AHBCLKCTRL_GINT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_GINT_SHIFT)) & SYSCON_AHBCLKCTRL_GINT_MASK) | ||
11525 | #define SYSCON_AHBCLKCTRL_SC0_MASK (0x80000U) | ||
11526 | #define SYSCON_AHBCLKCTRL_SC0_SHIFT (19U) | ||
11527 | /*! SC0 - Enables the clock for the Smart card0 interface. | ||
11528 | */ | ||
11529 | #define SYSCON_AHBCLKCTRL_SC0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SC0_SHIFT)) & SYSCON_AHBCLKCTRL_SC0_MASK) | ||
11530 | #define SYSCON_AHBCLKCTRL_DMA_MASK (0x100000U) | ||
11531 | #define SYSCON_AHBCLKCTRL_DMA_SHIFT (20U) | ||
11532 | /*! DMA - Enables the clock for the DMA controller. 0 = Disable; 1 = Enable. | ||
11533 | */ | ||
11534 | #define SYSCON_AHBCLKCTRL_DMA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_DMA_SHIFT)) & SYSCON_AHBCLKCTRL_DMA_MASK) | ||
11535 | #define SYSCON_AHBCLKCTRL_SC1_MASK (0x100000U) | ||
11536 | #define SYSCON_AHBCLKCTRL_SC1_SHIFT (20U) | ||
11537 | /*! SC1 - Enables the clock for the Smart card1 interface. | ||
11538 | */ | ||
11539 | #define SYSCON_AHBCLKCTRL_SC1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_SC1_SHIFT)) & SYSCON_AHBCLKCTRL_SC1_MASK) | ||
11540 | #define SYSCON_AHBCLKCTRL_CRC_MASK (0x200000U) | ||
11541 | #define SYSCON_AHBCLKCTRL_CRC_SHIFT (21U) | ||
11542 | /*! CRC - Enables the clock for the CRC engine. 0 = Disable; 1 = Enable. | ||
11543 | */ | ||
11544 | #define SYSCON_AHBCLKCTRL_CRC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_CRC_SHIFT)) & SYSCON_AHBCLKCTRL_CRC_MASK) | ||
11545 | #define SYSCON_AHBCLKCTRL_FLEXCOMM10_MASK (0x200000U) | ||
11546 | #define SYSCON_AHBCLKCTRL_FLEXCOMM10_SHIFT (21U) | ||
11547 | /*! FLEXCOMM10 - Enables the clock for the Flexcomm10 interface. | ||
11548 | */ | ||
11549 | #define SYSCON_AHBCLKCTRL_FLEXCOMM10(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_FLEXCOMM10_SHIFT)) & SYSCON_AHBCLKCTRL_FLEXCOMM10_MASK) | ||
11550 | #define SYSCON_AHBCLKCTRL_CTIMER2_MASK (0x400000U) | ||
11551 | #define SYSCON_AHBCLKCTRL_CTIMER2_SHIFT (22U) | ||
11552 | /*! CTIMER2 - Enables the clock for CTIMER 2. 0 = Disable; 1 = Enable. | ||
11553 | */ | ||
11554 | #define SYSCON_AHBCLKCTRL_CTIMER2(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_CTIMER2_SHIFT)) & SYSCON_AHBCLKCTRL_CTIMER2_MASK) | ||
11555 | #define SYSCON_AHBCLKCTRL_WWDT_MASK (0x400000U) | ||
11556 | #define SYSCON_AHBCLKCTRL_WWDT_SHIFT (22U) | ||
11557 | /*! WWDT - Enables the clock for the Watchdog Timer. 0 = Disable; 1 = Enable. | ||
11558 | */ | ||
11559 | #define SYSCON_AHBCLKCTRL_WWDT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_WWDT_SHIFT)) & SYSCON_AHBCLKCTRL_WWDT_MASK) | ||
11560 | #define SYSCON_AHBCLKCTRL_RTC_MASK (0x800000U) | ||
11561 | #define SYSCON_AHBCLKCTRL_RTC_SHIFT (23U) | ||
11562 | /*! RTC - Enables the bus clock for the RTC. 0 = Disable; 1 = Enable. | ||
11563 | */ | ||
11564 | #define SYSCON_AHBCLKCTRL_RTC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_RTC_SHIFT)) & SYSCON_AHBCLKCTRL_RTC_MASK) | ||
11565 | #define SYSCON_AHBCLKCTRL_USB0D_MASK (0x2000000U) | ||
11566 | #define SYSCON_AHBCLKCTRL_USB0D_SHIFT (25U) | ||
11567 | /*! USB0D - Enables the clock for the USB0 device interface. 0 = Disable; 1 = Enable. | ||
11568 | */ | ||
11569 | #define SYSCON_AHBCLKCTRL_USB0D(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_USB0D_SHIFT)) & SYSCON_AHBCLKCTRL_USB0D_MASK) | ||
11570 | #define SYSCON_AHBCLKCTRL_CTIMER0_MASK (0x4000000U) | ||
11571 | #define SYSCON_AHBCLKCTRL_CTIMER0_SHIFT (26U) | ||
11572 | /*! CTIMER0 - Enables the clock for timer CTIMER0. 0 = Disable; 1 = Enable. | ||
11573 | */ | ||
11574 | #define SYSCON_AHBCLKCTRL_CTIMER0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_CTIMER0_SHIFT)) & SYSCON_AHBCLKCTRL_CTIMER0_MASK) | ||
11575 | #define SYSCON_AHBCLKCTRL_ADC0_MASK (0x8000000U) | ||
11576 | #define SYSCON_AHBCLKCTRL_ADC0_SHIFT (27U) | ||
11577 | /*! ADC0 - Enables the clock for the ADC0 register interface. | ||
11578 | */ | ||
11579 | #define SYSCON_AHBCLKCTRL_ADC0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_ADC0_SHIFT)) & SYSCON_AHBCLKCTRL_ADC0_MASK) | ||
11580 | #define SYSCON_AHBCLKCTRL_CTIMER1_MASK (0x8000000U) | ||
11581 | #define SYSCON_AHBCLKCTRL_CTIMER1_SHIFT (27U) | ||
11582 | /*! CTIMER1 - Enables the clock for timer CTIMER1. 0 = Disable; 1 = Enable. | ||
11583 | */ | ||
11584 | #define SYSCON_AHBCLKCTRL_CTIMER1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRL_CTIMER1_SHIFT)) & SYSCON_AHBCLKCTRL_CTIMER1_MASK) | ||
11585 | /*! @} */ | ||
11586 | |||
11587 | /* The count of SYSCON_AHBCLKCTRL */ | ||
11588 | #define SYSCON_AHBCLKCTRL_COUNT (3U) | ||
11589 | |||
11590 | /*! @name AHBCLKCTRLSET - Set bits in AHBCLKCTRLn */ | ||
11591 | /*! @{ */ | ||
11592 | #define SYSCON_AHBCLKCTRLSET_CLK_SET_MASK (0xFFFFFFFFU) | ||
11593 | #define SYSCON_AHBCLKCTRLSET_CLK_SET_SHIFT (0U) | ||
11594 | /*! CLK_SET - Writing ones to this register sets the corresponding bit or bits in the AHBCLKCTRLn | ||
11595 | * register, if they are implemented. Bits that do not correspond to defined bits in AHBCLKCTRLn | ||
11596 | * are reserved and only zeroes should be written to them. | ||
11597 | */ | ||
11598 | #define SYSCON_AHBCLKCTRLSET_CLK_SET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRLSET_CLK_SET_SHIFT)) & SYSCON_AHBCLKCTRLSET_CLK_SET_MASK) | ||
11599 | /*! @} */ | ||
11600 | |||
11601 | /* The count of SYSCON_AHBCLKCTRLSET */ | ||
11602 | #define SYSCON_AHBCLKCTRLSET_COUNT (3U) | ||
11603 | |||
11604 | /*! @name AHBCLKCTRLCLR - Clear bits in AHBCLKCTRLn */ | ||
11605 | /*! @{ */ | ||
11606 | #define SYSCON_AHBCLKCTRLCLR_CLK_CLR_MASK (0xFFFFFFFFU) | ||
11607 | #define SYSCON_AHBCLKCTRLCLR_CLK_CLR_SHIFT (0U) | ||
11608 | /*! CLK_CLR - Writing ones to this register clears the corresponding bit or bits in the AHBCLKCTRLn | ||
11609 | * register, if they are implemented. Bits that do not correspond to defined bits in AHBCLKCTRLn | ||
11610 | * are reserved and only zeroes should be written to them. | ||
11611 | */ | ||
11612 | #define SYSCON_AHBCLKCTRLCLR_CLK_CLR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKCTRLCLR_CLK_CLR_SHIFT)) & SYSCON_AHBCLKCTRLCLR_CLK_CLR_MASK) | ||
11613 | /*! @} */ | ||
11614 | |||
11615 | /* The count of SYSCON_AHBCLKCTRLCLR */ | ||
11616 | #define SYSCON_AHBCLKCTRLCLR_COUNT (3U) | ||
11617 | |||
11618 | /*! @name STICKCLKSEL - Systick timer clock source selection */ | ||
11619 | /*! @{ */ | ||
11620 | #define SYSCON_STICKCLKSEL_SEL_MASK (0x7U) | ||
11621 | #define SYSCON_STICKCLKSEL_SEL_SHIFT (0U) | ||
11622 | /*! SEL - Systick timer clock source selection | ||
11623 | * 0b000..Main clock (main_clk) | ||
11624 | * 0b001..Watchdog oscillator (wdt_clk) | ||
11625 | * 0b010..RTC oscillator 32 kHz output (32k_clk) | ||
11626 | * 0b011..FRO 12 MHz (fro_12m) | ||
11627 | * 0b100..Reserved setting | ||
11628 | * 0b101..Reserved setting | ||
11629 | * 0b110..Reserved setting | ||
11630 | * 0b111..None, this may be selected to reduce power when no output is needed. | ||
11631 | */ | ||
11632 | #define SYSCON_STICKCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STICKCLKSEL_SEL_SHIFT)) & SYSCON_STICKCLKSEL_SEL_MASK) | ||
11633 | /*! @} */ | ||
11634 | |||
11635 | /*! @name MAINCLKSELA - Main clock source select A */ | ||
11636 | /*! @{ */ | ||
11637 | #define SYSCON_MAINCLKSELA_SEL_MASK (0x3U) | ||
11638 | #define SYSCON_MAINCLKSELA_SEL_SHIFT (0U) | ||
11639 | /*! SEL - Clock source for main clock source selector A | ||
11640 | * 0b00..FRO 12 MHz (fro_12m) | ||
11641 | * 0b01..CLKIN (clk_in) | ||
11642 | * 0b10..Watchdog oscillator (wdt_clk) | ||
11643 | * 0b11..FRO 96 or 48 MHz (fro_hf) | ||
11644 | */ | ||
11645 | #define SYSCON_MAINCLKSELA_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_MAINCLKSELA_SEL_SHIFT)) & SYSCON_MAINCLKSELA_SEL_MASK) | ||
11646 | /*! @} */ | ||
11647 | |||
11648 | /*! @name MAINCLKSELB - Main clock source select B */ | ||
11649 | /*! @{ */ | ||
11650 | #define SYSCON_MAINCLKSELB_SEL_MASK (0x3U) | ||
11651 | #define SYSCON_MAINCLKSELB_SEL_SHIFT (0U) | ||
11652 | /*! SEL - Clock source for main clock source selector B. Selects the clock source for the main clock. | ||
11653 | * 0b00..MAINCLKSELA. Use the clock source selected in MAINCLKSELA register. | ||
11654 | * 0b01..Reserved setting | ||
11655 | * 0b10..System PLL output (pll_clk) | ||
11656 | * 0b11..RTC oscillator 32 kHz output (32k_clk) | ||
11657 | */ | ||
11658 | #define SYSCON_MAINCLKSELB_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_MAINCLKSELB_SEL_SHIFT)) & SYSCON_MAINCLKSELB_SEL_MASK) | ||
11659 | /*! @} */ | ||
11660 | |||
11661 | /*! @name CLKOUTSELA - CLKOUT clock source select A */ | ||
11662 | /*! @{ */ | ||
11663 | #define SYSCON_CLKOUTSELA_SEL_MASK (0x7U) | ||
11664 | #define SYSCON_CLKOUTSELA_SEL_SHIFT (0U) | ||
11665 | /*! SEL - CLKOUT clock source selection | ||
11666 | * 0b000..Main clock (main_clk) | ||
11667 | * 0b001..CLKIN (clk_in) | ||
11668 | * 0b010..Watchdog oscillator (wdt_clk) | ||
11669 | * 0b011..FRO 96 or 48 MHz (fro_hf) | ||
11670 | * 0b100..PLL output (pll_clk) | ||
11671 | * 0b101..USB PLL clock (usb_pll_clk) | ||
11672 | * 0b110..Audio PLL clock (audio_pll_clk) | ||
11673 | * 0b111..RTC oscillator 32 kHz output (32k_clk) | ||
11674 | */ | ||
11675 | #define SYSCON_CLKOUTSELA_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CLKOUTSELA_SEL_SHIFT)) & SYSCON_CLKOUTSELA_SEL_MASK) | ||
11676 | /*! @} */ | ||
11677 | |||
11678 | /*! @name SYSPLLCLKSEL - PLL clock source select */ | ||
11679 | /*! @{ */ | ||
11680 | #define SYSCON_SYSPLLCLKSEL_SEL_MASK (0x7U) | ||
11681 | #define SYSCON_SYSPLLCLKSEL_SEL_SHIFT (0U) | ||
11682 | /*! SEL - System PLL clock source selection. | ||
11683 | * 0b000..FRO 12 MHz (fro_12m) | ||
11684 | * 0b001..CLKIN (clk_in) | ||
11685 | * 0b011..RTC oscillator 32 kHz output (32k_clk) | ||
11686 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11687 | */ | ||
11688 | #define SYSCON_SYSPLLCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLCLKSEL_SEL_SHIFT)) & SYSCON_SYSPLLCLKSEL_SEL_MASK) | ||
11689 | /*! @} */ | ||
11690 | |||
11691 | /*! @name AUDPLLCLKSEL - Audio PLL clock source select */ | ||
11692 | /*! @{ */ | ||
11693 | #define SYSCON_AUDPLLCLKSEL_SEL_MASK (0x7U) | ||
11694 | #define SYSCON_AUDPLLCLKSEL_SEL_SHIFT (0U) | ||
11695 | /*! SEL - Audio PLL clock source selection. | ||
11696 | * 0b000..FRO 12 MHz (fro_12m) | ||
11697 | * 0b001..CLKIN (clk_in) | ||
11698 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11699 | */ | ||
11700 | #define SYSCON_AUDPLLCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLCLKSEL_SEL_SHIFT)) & SYSCON_AUDPLLCLKSEL_SEL_MASK) | ||
11701 | /*! @} */ | ||
11702 | |||
11703 | /*! @name SPIFICLKSEL - SPIFI clock source select */ | ||
11704 | /*! @{ */ | ||
11705 | #define SYSCON_SPIFICLKSEL_SEL_MASK (0x7U) | ||
11706 | #define SYSCON_SPIFICLKSEL_SEL_SHIFT (0U) | ||
11707 | /*! SEL - System PLL clock source selection | ||
11708 | * 0b000..Main clock (main_clk) | ||
11709 | * 0b001..System PLL output (pll_clk) | ||
11710 | * 0b010..USB PLL clock (usb_pll_clk) | ||
11711 | * 0b011..FRO 96 or 48 MHz (fro_hf) | ||
11712 | * 0b100..Audio PLL clock (audio_pll_clk) | ||
11713 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11714 | */ | ||
11715 | #define SYSCON_SPIFICLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SPIFICLKSEL_SEL_SHIFT)) & SYSCON_SPIFICLKSEL_SEL_MASK) | ||
11716 | /*! @} */ | ||
11717 | |||
11718 | /*! @name ADCCLKSEL - ADC clock source select */ | ||
11719 | /*! @{ */ | ||
11720 | #define SYSCON_ADCCLKSEL_SEL_MASK (0x7U) | ||
11721 | #define SYSCON_ADCCLKSEL_SEL_SHIFT (0U) | ||
11722 | /*! SEL - ADC clock source selection | ||
11723 | * 0b000..FRO 96 or 48 MHz (fro_hf) | ||
11724 | * 0b001..System PLL output (pll_clk) | ||
11725 | * 0b010..USB PLL clock (usb_pll_clk) | ||
11726 | * 0b011..Audio PLL clock (audio_pll_clk) | ||
11727 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11728 | */ | ||
11729 | #define SYSCON_ADCCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ADCCLKSEL_SEL_SHIFT)) & SYSCON_ADCCLKSEL_SEL_MASK) | ||
11730 | /*! @} */ | ||
11731 | |||
11732 | /*! @name USB0CLKSEL - USB0 clock source select */ | ||
11733 | /*! @{ */ | ||
11734 | #define SYSCON_USB0CLKSEL_SEL_MASK (0x7U) | ||
11735 | #define SYSCON_USB0CLKSEL_SEL_SHIFT (0U) | ||
11736 | /*! SEL - USB0 device clock source selection. | ||
11737 | * 0b000..FRO 96 or 48 MHz (fro_hf) | ||
11738 | * 0b001..System PLL output (pll_clk) | ||
11739 | * 0b010..USB PLL clock (usb_pll_clk) | ||
11740 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11741 | */ | ||
11742 | #define SYSCON_USB0CLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKSEL_SEL_SHIFT)) & SYSCON_USB0CLKSEL_SEL_MASK) | ||
11743 | /*! @} */ | ||
11744 | |||
11745 | /*! @name USB1CLKSEL - USB1 clock source select */ | ||
11746 | /*! @{ */ | ||
11747 | #define SYSCON_USB1CLKSEL_SEL_MASK (0x7U) | ||
11748 | #define SYSCON_USB1CLKSEL_SEL_SHIFT (0U) | ||
11749 | /*! SEL - USB1 PHY clock source selection. | ||
11750 | * 0b000..Main clock (main_clk) | ||
11751 | * 0b001..System PLL output (pll_clk) | ||
11752 | * 0b010..USB PLL clock (usb_pll_clk) | ||
11753 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11754 | */ | ||
11755 | #define SYSCON_USB1CLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKSEL_SEL_SHIFT)) & SYSCON_USB1CLKSEL_SEL_MASK) | ||
11756 | /*! @} */ | ||
11757 | |||
11758 | /*! @name FCLKSEL - Flexcomm clock source select */ | ||
11759 | /*! @{ */ | ||
11760 | #define SYSCON_FCLKSEL_SEL_MASK (0x7U) | ||
11761 | #define SYSCON_FCLKSEL_SEL_SHIFT (0U) | ||
11762 | /*! SEL - Flexcomm clock source selection. One per Flexcomm. | ||
11763 | * 0b000..FRO 12 MHz (fro_12m) | ||
11764 | * 0b001..FRO HF DIV (fro_hf_div) | ||
11765 | * 0b010..Audio PLL clock (audio_pll_clk) | ||
11766 | * 0b011..MCLK pin input, when selected in IOCON (mclk_in) | ||
11767 | * 0b100..FRG clock, the output of the fractional rate generator (frg_clk) | ||
11768 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11769 | */ | ||
11770 | #define SYSCON_FCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FCLKSEL_SEL_SHIFT)) & SYSCON_FCLKSEL_SEL_MASK) | ||
11771 | /*! @} */ | ||
11772 | |||
11773 | /* The count of SYSCON_FCLKSEL */ | ||
11774 | #define SYSCON_FCLKSEL_COUNT (10U) | ||
11775 | |||
11776 | /*! @name FCLKSEL10 - Flexcomm 10 clock source select */ | ||
11777 | /*! @{ */ | ||
11778 | #define SYSCON_FCLKSEL10_SEL_MASK (0x7U) | ||
11779 | #define SYSCON_FCLKSEL10_SEL_SHIFT (0U) | ||
11780 | /*! SEL - Flexcomm clock source selection. One per Flexcomm. | ||
11781 | * 0b000..Main clock (main_clk) | ||
11782 | * 0b001..System PLL output (pll_clk) | ||
11783 | * 0b010..USB PLL clock (usb_pll_clk) | ||
11784 | * 0b011..FRO 96 or 48 MHz (fro_hf) | ||
11785 | * 0b100..Audio PLL clock (audio_pll_clk) | ||
11786 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11787 | */ | ||
11788 | #define SYSCON_FCLKSEL10_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FCLKSEL10_SEL_SHIFT)) & SYSCON_FCLKSEL10_SEL_MASK) | ||
11789 | /*! @} */ | ||
11790 | |||
11791 | /*! @name MCLKCLKSEL - MCLK clock source select */ | ||
11792 | /*! @{ */ | ||
11793 | #define SYSCON_MCLKCLKSEL_SEL_MASK (0x7U) | ||
11794 | #define SYSCON_MCLKCLKSEL_SEL_SHIFT (0U) | ||
11795 | /*! SEL - MCLK source select. This may be used by Flexcomms that support I2S, and/or by the digital microphone subsystem. | ||
11796 | * 0b000..FRO HF DIV (fro_hf_div) | ||
11797 | * 0b001..Audio PLL clock (audio_pll_clk) | ||
11798 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11799 | */ | ||
11800 | #define SYSCON_MCLKCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_MCLKCLKSEL_SEL_SHIFT)) & SYSCON_MCLKCLKSEL_SEL_MASK) | ||
11801 | /*! @} */ | ||
11802 | |||
11803 | /*! @name FRGCLKSEL - Fractional Rate Generator clock source select */ | ||
11804 | /*! @{ */ | ||
11805 | #define SYSCON_FRGCLKSEL_SEL_MASK (0x7U) | ||
11806 | #define SYSCON_FRGCLKSEL_SEL_SHIFT (0U) | ||
11807 | /*! SEL - Fractional Rate Generator clock source select. | ||
11808 | * 0b000..Main clock (main_clk) | ||
11809 | * 0b001..System PLL output (pll_clk) | ||
11810 | * 0b010..FRO 12 MHz (fro_12m) | ||
11811 | * 0b011..FRO 96 or 48 MHz (fro_hf) | ||
11812 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11813 | */ | ||
11814 | #define SYSCON_FRGCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FRGCLKSEL_SEL_SHIFT)) & SYSCON_FRGCLKSEL_SEL_MASK) | ||
11815 | /*! @} */ | ||
11816 | |||
11817 | /*! @name DMICCLKSEL - Digital microphone (DMIC) subsystem clock select */ | ||
11818 | /*! @{ */ | ||
11819 | #define SYSCON_DMICCLKSEL_SEL_MASK (0x7U) | ||
11820 | #define SYSCON_DMICCLKSEL_SEL_SHIFT (0U) | ||
11821 | /*! SEL - DMIC (audio subsystem) clock source select. | ||
11822 | * 0b000..FRO 12 MHz (fro_12m) | ||
11823 | * 0b001..FRO HF DIV (fro_hf_div) | ||
11824 | * 0b010..Audio PLL clock (audio_pll_clk) | ||
11825 | * 0b011..MCLK pin input, when selected in IOCON (mclk_in) | ||
11826 | * 0b100..Main clock (main_clk) | ||
11827 | * 0b101..Watchdog oscillator (wdt_clk) | ||
11828 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11829 | */ | ||
11830 | #define SYSCON_DMICCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_DMICCLKSEL_SEL_SHIFT)) & SYSCON_DMICCLKSEL_SEL_MASK) | ||
11831 | /*! @} */ | ||
11832 | |||
11833 | /*! @name SCTCLKSEL - SCTimer/PWM clock source select */ | ||
11834 | /*! @{ */ | ||
11835 | #define SYSCON_SCTCLKSEL_SEL_MASK (0x7U) | ||
11836 | #define SYSCON_SCTCLKSEL_SEL_SHIFT (0U) | ||
11837 | /*! SEL - SCT clock source select. | ||
11838 | * 0b000..Main clock (main_clk) | ||
11839 | * 0b001..System PLL output (pll_clk) | ||
11840 | * 0b010..FRO 96 or 48 MHz (fro_hf) | ||
11841 | * 0b011..Audio PLL clock (audio_pll_clk) | ||
11842 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11843 | */ | ||
11844 | #define SYSCON_SCTCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SCTCLKSEL_SEL_SHIFT)) & SYSCON_SCTCLKSEL_SEL_MASK) | ||
11845 | /*! @} */ | ||
11846 | |||
11847 | /*! @name LCDCLKSEL - LCD clock source select */ | ||
11848 | /*! @{ */ | ||
11849 | #define SYSCON_LCDCLKSEL_SEL_MASK (0x3U) | ||
11850 | #define SYSCON_LCDCLKSEL_SEL_SHIFT (0U) | ||
11851 | /*! SEL - LCD clock source select. | ||
11852 | * 0b00..Main clock (main_clk) | ||
11853 | * 0b01..LCDCLKIN (LCDCLK_EXT) | ||
11854 | * 0b10..FRO 96 or 48 MHz (fro_hf) | ||
11855 | * 0b11..None, this may be selected in order to reduce power when no output is needed. | ||
11856 | */ | ||
11857 | #define SYSCON_LCDCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_LCDCLKSEL_SEL_SHIFT)) & SYSCON_LCDCLKSEL_SEL_MASK) | ||
11858 | /*! @} */ | ||
11859 | |||
11860 | /*! @name SDIOCLKSEL - SDIO clock source select */ | ||
11861 | /*! @{ */ | ||
11862 | #define SYSCON_SDIOCLKSEL_SEL_MASK (0x7U) | ||
11863 | #define SYSCON_SDIOCLKSEL_SEL_SHIFT (0U) | ||
11864 | /*! SEL - SDIO clock source select. | ||
11865 | * 0b000..Main clock (main_clk) | ||
11866 | * 0b001..System PLL output (pll_clk) | ||
11867 | * 0b010..USB PLL clock (usb_pll_clk) | ||
11868 | * 0b011..FRO 96 or 48 MHz (fro_hf) | ||
11869 | * 0b100..Audio PLL clock (audio_pll_clk) | ||
11870 | * 0b111..None, this may be selected in order to reduce power when no output is needed. | ||
11871 | */ | ||
11872 | #define SYSCON_SDIOCLKSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKSEL_SEL_SHIFT)) & SYSCON_SDIOCLKSEL_SEL_MASK) | ||
11873 | /*! @} */ | ||
11874 | |||
11875 | /*! @name SYSTICKCLKDIV - SYSTICK clock divider */ | ||
11876 | /*! @{ */ | ||
11877 | #define SYSCON_SYSTICKCLKDIV_DIV_MASK (0xFFU) | ||
11878 | #define SYSCON_SYSTICKCLKDIV_DIV_SHIFT (0U) | ||
11879 | /*! DIV - Clock divider value. 0: Divide by 1 up to 255: Divide by 256. | ||
11880 | */ | ||
11881 | #define SYSCON_SYSTICKCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSTICKCLKDIV_DIV_SHIFT)) & SYSCON_SYSTICKCLKDIV_DIV_MASK) | ||
11882 | #define SYSCON_SYSTICKCLKDIV_RESET_MASK (0x20000000U) | ||
11883 | #define SYSCON_SYSTICKCLKDIV_RESET_SHIFT (29U) | ||
11884 | /*! RESET - Resets the divider counter. Can be used to make sure a new divider value is used right | ||
11885 | * away rather than completing the previous count. | ||
11886 | */ | ||
11887 | #define SYSCON_SYSTICKCLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSTICKCLKDIV_RESET_SHIFT)) & SYSCON_SYSTICKCLKDIV_RESET_MASK) | ||
11888 | #define SYSCON_SYSTICKCLKDIV_HALT_MASK (0x40000000U) | ||
11889 | #define SYSCON_SYSTICKCLKDIV_HALT_SHIFT (30U) | ||
11890 | /*! HALT - Halts the divider counter. | ||
11891 | */ | ||
11892 | #define SYSCON_SYSTICKCLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSTICKCLKDIV_HALT_SHIFT)) & SYSCON_SYSTICKCLKDIV_HALT_MASK) | ||
11893 | #define SYSCON_SYSTICKCLKDIV_REQFLAG_MASK (0x80000000U) | ||
11894 | #define SYSCON_SYSTICKCLKDIV_REQFLAG_SHIFT (31U) | ||
11895 | /*! REQFLAG - Divider status flag. | ||
11896 | */ | ||
11897 | #define SYSCON_SYSTICKCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSTICKCLKDIV_REQFLAG_SHIFT)) & SYSCON_SYSTICKCLKDIV_REQFLAG_MASK) | ||
11898 | /*! @} */ | ||
11899 | |||
11900 | /*! @name ARMTRACECLKDIV - ARM Trace clock divider */ | ||
11901 | /*! @{ */ | ||
11902 | #define SYSCON_ARMTRACECLKDIV_DIV_MASK (0xFFU) | ||
11903 | #define SYSCON_ARMTRACECLKDIV_DIV_SHIFT (0U) | ||
11904 | /*! DIV - Clock divider value. | ||
11905 | */ | ||
11906 | #define SYSCON_ARMTRACECLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ARMTRACECLKDIV_DIV_SHIFT)) & SYSCON_ARMTRACECLKDIV_DIV_MASK) | ||
11907 | #define SYSCON_ARMTRACECLKDIV_RESET_MASK (0x20000000U) | ||
11908 | #define SYSCON_ARMTRACECLKDIV_RESET_SHIFT (29U) | ||
11909 | /*! RESET - Resets the divider counter. | ||
11910 | */ | ||
11911 | #define SYSCON_ARMTRACECLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ARMTRACECLKDIV_RESET_SHIFT)) & SYSCON_ARMTRACECLKDIV_RESET_MASK) | ||
11912 | #define SYSCON_ARMTRACECLKDIV_HALT_MASK (0x40000000U) | ||
11913 | #define SYSCON_ARMTRACECLKDIV_HALT_SHIFT (30U) | ||
11914 | /*! HALT - Halts the divider counter. | ||
11915 | */ | ||
11916 | #define SYSCON_ARMTRACECLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ARMTRACECLKDIV_HALT_SHIFT)) & SYSCON_ARMTRACECLKDIV_HALT_MASK) | ||
11917 | #define SYSCON_ARMTRACECLKDIV_REQFLAG_MASK (0x80000000U) | ||
11918 | #define SYSCON_ARMTRACECLKDIV_REQFLAG_SHIFT (31U) | ||
11919 | /*! REQFLAG - Divider status flag. | ||
11920 | */ | ||
11921 | #define SYSCON_ARMTRACECLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ARMTRACECLKDIV_REQFLAG_SHIFT)) & SYSCON_ARMTRACECLKDIV_REQFLAG_MASK) | ||
11922 | /*! @} */ | ||
11923 | |||
11924 | /*! @name CAN0CLKDIV - MCAN0 clock divider */ | ||
11925 | /*! @{ */ | ||
11926 | #define SYSCON_CAN0CLKDIV_DIV_MASK (0xFFU) | ||
11927 | #define SYSCON_CAN0CLKDIV_DIV_SHIFT (0U) | ||
11928 | /*! DIV - Clock divider value. | ||
11929 | */ | ||
11930 | #define SYSCON_CAN0CLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CAN0CLKDIV_DIV_SHIFT)) & SYSCON_CAN0CLKDIV_DIV_MASK) | ||
11931 | #define SYSCON_CAN0CLKDIV_RESET_MASK (0x20000000U) | ||
11932 | #define SYSCON_CAN0CLKDIV_RESET_SHIFT (29U) | ||
11933 | /*! RESET - Resets the divider counter. | ||
11934 | */ | ||
11935 | #define SYSCON_CAN0CLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CAN0CLKDIV_RESET_SHIFT)) & SYSCON_CAN0CLKDIV_RESET_MASK) | ||
11936 | #define SYSCON_CAN0CLKDIV_HALT_MASK (0x40000000U) | ||
11937 | #define SYSCON_CAN0CLKDIV_HALT_SHIFT (30U) | ||
11938 | /*! HALT - Halts the divider counter. | ||
11939 | */ | ||
11940 | #define SYSCON_CAN0CLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CAN0CLKDIV_HALT_SHIFT)) & SYSCON_CAN0CLKDIV_HALT_MASK) | ||
11941 | #define SYSCON_CAN0CLKDIV_REQFLAG_MASK (0x80000000U) | ||
11942 | #define SYSCON_CAN0CLKDIV_REQFLAG_SHIFT (31U) | ||
11943 | /*! REQFLAG - Divider status flag. | ||
11944 | */ | ||
11945 | #define SYSCON_CAN0CLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CAN0CLKDIV_REQFLAG_SHIFT)) & SYSCON_CAN0CLKDIV_REQFLAG_MASK) | ||
11946 | /*! @} */ | ||
11947 | |||
11948 | /*! @name CAN1CLKDIV - MCAN1 clock divider */ | ||
11949 | /*! @{ */ | ||
11950 | #define SYSCON_CAN1CLKDIV_DIV_MASK (0xFFU) | ||
11951 | #define SYSCON_CAN1CLKDIV_DIV_SHIFT (0U) | ||
11952 | /*! DIV - Clock divider value. 0: Divide by 1 up to 255: Divide by 256. | ||
11953 | */ | ||
11954 | #define SYSCON_CAN1CLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CAN1CLKDIV_DIV_SHIFT)) & SYSCON_CAN1CLKDIV_DIV_MASK) | ||
11955 | #define SYSCON_CAN1CLKDIV_RESET_MASK (0x20000000U) | ||
11956 | #define SYSCON_CAN1CLKDIV_RESET_SHIFT (29U) | ||
11957 | /*! RESET - Resets the divider counter. Can be used to make sure a new divider value is used right | ||
11958 | * away rather than completing the previous count. | ||
11959 | */ | ||
11960 | #define SYSCON_CAN1CLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CAN1CLKDIV_RESET_SHIFT)) & SYSCON_CAN1CLKDIV_RESET_MASK) | ||
11961 | #define SYSCON_CAN1CLKDIV_HALT_MASK (0x40000000U) | ||
11962 | #define SYSCON_CAN1CLKDIV_HALT_SHIFT (30U) | ||
11963 | /*! HALT - Halts the divider counter. | ||
11964 | */ | ||
11965 | #define SYSCON_CAN1CLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CAN1CLKDIV_HALT_SHIFT)) & SYSCON_CAN1CLKDIV_HALT_MASK) | ||
11966 | #define SYSCON_CAN1CLKDIV_REQFLAG_MASK (0x80000000U) | ||
11967 | #define SYSCON_CAN1CLKDIV_REQFLAG_SHIFT (31U) | ||
11968 | /*! REQFLAG - Divider status flag. | ||
11969 | */ | ||
11970 | #define SYSCON_CAN1CLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CAN1CLKDIV_REQFLAG_SHIFT)) & SYSCON_CAN1CLKDIV_REQFLAG_MASK) | ||
11971 | /*! @} */ | ||
11972 | |||
11973 | /*! @name SC0CLKDIV - Smartcard0 clock divider */ | ||
11974 | /*! @{ */ | ||
11975 | #define SYSCON_SC0CLKDIV_DIV_MASK (0xFFU) | ||
11976 | #define SYSCON_SC0CLKDIV_DIV_SHIFT (0U) | ||
11977 | /*! DIV - Clock divider value. | ||
11978 | */ | ||
11979 | #define SYSCON_SC0CLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SC0CLKDIV_DIV_SHIFT)) & SYSCON_SC0CLKDIV_DIV_MASK) | ||
11980 | #define SYSCON_SC0CLKDIV_RESET_MASK (0x20000000U) | ||
11981 | #define SYSCON_SC0CLKDIV_RESET_SHIFT (29U) | ||
11982 | /*! RESET - Resets the divider counter. | ||
11983 | */ | ||
11984 | #define SYSCON_SC0CLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SC0CLKDIV_RESET_SHIFT)) & SYSCON_SC0CLKDIV_RESET_MASK) | ||
11985 | #define SYSCON_SC0CLKDIV_HALT_MASK (0x40000000U) | ||
11986 | #define SYSCON_SC0CLKDIV_HALT_SHIFT (30U) | ||
11987 | /*! HALT - Halts the divider counter. | ||
11988 | */ | ||
11989 | #define SYSCON_SC0CLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SC0CLKDIV_HALT_SHIFT)) & SYSCON_SC0CLKDIV_HALT_MASK) | ||
11990 | #define SYSCON_SC0CLKDIV_REQFLAG_MASK (0x80000000U) | ||
11991 | #define SYSCON_SC0CLKDIV_REQFLAG_SHIFT (31U) | ||
11992 | /*! REQFLAG - Divider status flag. | ||
11993 | */ | ||
11994 | #define SYSCON_SC0CLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SC0CLKDIV_REQFLAG_SHIFT)) & SYSCON_SC0CLKDIV_REQFLAG_MASK) | ||
11995 | /*! @} */ | ||
11996 | |||
11997 | /*! @name SC1CLKDIV - Smartcard1 clock divider */ | ||
11998 | /*! @{ */ | ||
11999 | #define SYSCON_SC1CLKDIV_DIV_MASK (0xFFU) | ||
12000 | #define SYSCON_SC1CLKDIV_DIV_SHIFT (0U) | ||
12001 | /*! DIV - Clock divider value. | ||
12002 | */ | ||
12003 | #define SYSCON_SC1CLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SC1CLKDIV_DIV_SHIFT)) & SYSCON_SC1CLKDIV_DIV_MASK) | ||
12004 | #define SYSCON_SC1CLKDIV_RESET_MASK (0x20000000U) | ||
12005 | #define SYSCON_SC1CLKDIV_RESET_SHIFT (29U) | ||
12006 | /*! RESET - Resets the divider counter. | ||
12007 | */ | ||
12008 | #define SYSCON_SC1CLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SC1CLKDIV_RESET_SHIFT)) & SYSCON_SC1CLKDIV_RESET_MASK) | ||
12009 | #define SYSCON_SC1CLKDIV_HALT_MASK (0x40000000U) | ||
12010 | #define SYSCON_SC1CLKDIV_HALT_SHIFT (30U) | ||
12011 | /*! HALT - Halts the divider counter. | ||
12012 | */ | ||
12013 | #define SYSCON_SC1CLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SC1CLKDIV_HALT_SHIFT)) & SYSCON_SC1CLKDIV_HALT_MASK) | ||
12014 | #define SYSCON_SC1CLKDIV_REQFLAG_MASK (0x80000000U) | ||
12015 | #define SYSCON_SC1CLKDIV_REQFLAG_SHIFT (31U) | ||
12016 | /*! REQFLAG - Divider status flag. | ||
12017 | */ | ||
12018 | #define SYSCON_SC1CLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SC1CLKDIV_REQFLAG_SHIFT)) & SYSCON_SC1CLKDIV_REQFLAG_MASK) | ||
12019 | /*! @} */ | ||
12020 | |||
12021 | /*! @name AHBCLKDIV - AHB clock divider */ | ||
12022 | /*! @{ */ | ||
12023 | #define SYSCON_AHBCLKDIV_DIV_MASK (0xFFU) | ||
12024 | #define SYSCON_AHBCLKDIV_DIV_SHIFT (0U) | ||
12025 | /*! DIV - Clock divider value. 0: Divide by 1 up to 255: Divide by 256. | ||
12026 | */ | ||
12027 | #define SYSCON_AHBCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKDIV_DIV_SHIFT)) & SYSCON_AHBCLKDIV_DIV_MASK) | ||
12028 | #define SYSCON_AHBCLKDIV_REQFLAG_MASK (0x80000000U) | ||
12029 | #define SYSCON_AHBCLKDIV_REQFLAG_SHIFT (31U) | ||
12030 | /*! REQFLAG - Divider status flag. | ||
12031 | */ | ||
12032 | #define SYSCON_AHBCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AHBCLKDIV_REQFLAG_SHIFT)) & SYSCON_AHBCLKDIV_REQFLAG_MASK) | ||
12033 | /*! @} */ | ||
12034 | |||
12035 | /*! @name CLKOUTDIV - CLKOUT clock divider */ | ||
12036 | /*! @{ */ | ||
12037 | #define SYSCON_CLKOUTDIV_DIV_MASK (0xFFU) | ||
12038 | #define SYSCON_CLKOUTDIV_DIV_SHIFT (0U) | ||
12039 | /*! DIV - Clock divider value. 0: Divide by 1 up to 255: Divide by 256. | ||
12040 | */ | ||
12041 | #define SYSCON_CLKOUTDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CLKOUTDIV_DIV_SHIFT)) & SYSCON_CLKOUTDIV_DIV_MASK) | ||
12042 | #define SYSCON_CLKOUTDIV_RESET_MASK (0x20000000U) | ||
12043 | #define SYSCON_CLKOUTDIV_RESET_SHIFT (29U) | ||
12044 | /*! RESET - Resets the divider counter. Can be used to make sure a new divider value is used right | ||
12045 | * away rather than completing the previous count. | ||
12046 | */ | ||
12047 | #define SYSCON_CLKOUTDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CLKOUTDIV_RESET_SHIFT)) & SYSCON_CLKOUTDIV_RESET_MASK) | ||
12048 | #define SYSCON_CLKOUTDIV_HALT_MASK (0x40000000U) | ||
12049 | #define SYSCON_CLKOUTDIV_HALT_SHIFT (30U) | ||
12050 | /*! HALT - Halts the divider counter. The intent is to allow the divider clock source to be changed | ||
12051 | * without the risk of a glitch at the output. | ||
12052 | */ | ||
12053 | #define SYSCON_CLKOUTDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CLKOUTDIV_HALT_SHIFT)) & SYSCON_CLKOUTDIV_HALT_MASK) | ||
12054 | #define SYSCON_CLKOUTDIV_REQFLAG_MASK (0x80000000U) | ||
12055 | #define SYSCON_CLKOUTDIV_REQFLAG_SHIFT (31U) | ||
12056 | /*! REQFLAG - Divider status flag. | ||
12057 | */ | ||
12058 | #define SYSCON_CLKOUTDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_CLKOUTDIV_REQFLAG_SHIFT)) & SYSCON_CLKOUTDIV_REQFLAG_MASK) | ||
12059 | /*! @} */ | ||
12060 | |||
12061 | /*! @name FROHFDIV - FROHF clock divider */ | ||
12062 | /*! @{ */ | ||
12063 | #define SYSCON_FROHFDIV_DIV_MASK (0xFFU) | ||
12064 | #define SYSCON_FROHFDIV_DIV_SHIFT (0U) | ||
12065 | /*! DIV - Clock divider value. | ||
12066 | */ | ||
12067 | #define SYSCON_FROHFDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROHFDIV_DIV_SHIFT)) & SYSCON_FROHFDIV_DIV_MASK) | ||
12068 | #define SYSCON_FROHFDIV_RESET_MASK (0x20000000U) | ||
12069 | #define SYSCON_FROHFDIV_RESET_SHIFT (29U) | ||
12070 | /*! RESET - Resets the divider counter. | ||
12071 | */ | ||
12072 | #define SYSCON_FROHFDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROHFDIV_RESET_SHIFT)) & SYSCON_FROHFDIV_RESET_MASK) | ||
12073 | #define SYSCON_FROHFDIV_HALT_MASK (0x40000000U) | ||
12074 | #define SYSCON_FROHFDIV_HALT_SHIFT (30U) | ||
12075 | /*! HALT - Halts the divider counter. | ||
12076 | */ | ||
12077 | #define SYSCON_FROHFDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROHFDIV_HALT_SHIFT)) & SYSCON_FROHFDIV_HALT_MASK) | ||
12078 | #define SYSCON_FROHFDIV_REQFLAG_MASK (0x80000000U) | ||
12079 | #define SYSCON_FROHFDIV_REQFLAG_SHIFT (31U) | ||
12080 | /*! REQFLAG - Divider status flag. | ||
12081 | */ | ||
12082 | #define SYSCON_FROHFDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROHFDIV_REQFLAG_SHIFT)) & SYSCON_FROHFDIV_REQFLAG_MASK) | ||
12083 | /*! @} */ | ||
12084 | |||
12085 | /*! @name SPIFICLKDIV - SPIFI clock divider */ | ||
12086 | /*! @{ */ | ||
12087 | #define SYSCON_SPIFICLKDIV_DIV_MASK (0xFFU) | ||
12088 | #define SYSCON_SPIFICLKDIV_DIV_SHIFT (0U) | ||
12089 | /*! DIV - Clock divider value. | ||
12090 | */ | ||
12091 | #define SYSCON_SPIFICLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SPIFICLKDIV_DIV_SHIFT)) & SYSCON_SPIFICLKDIV_DIV_MASK) | ||
12092 | #define SYSCON_SPIFICLKDIV_RESET_MASK (0x20000000U) | ||
12093 | #define SYSCON_SPIFICLKDIV_RESET_SHIFT (29U) | ||
12094 | /*! RESET - Resets the divider counter. Can be used to make sure a new divider value is used right | ||
12095 | * away rather than completing the previous count. | ||
12096 | */ | ||
12097 | #define SYSCON_SPIFICLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SPIFICLKDIV_RESET_SHIFT)) & SYSCON_SPIFICLKDIV_RESET_MASK) | ||
12098 | #define SYSCON_SPIFICLKDIV_HALT_MASK (0x40000000U) | ||
12099 | #define SYSCON_SPIFICLKDIV_HALT_SHIFT (30U) | ||
12100 | /*! HALT - Halts the divider counter. The intent is to allow the divider clock source to be changed | ||
12101 | * without the risk of a glitch at the output. | ||
12102 | */ | ||
12103 | #define SYSCON_SPIFICLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SPIFICLKDIV_HALT_SHIFT)) & SYSCON_SPIFICLKDIV_HALT_MASK) | ||
12104 | #define SYSCON_SPIFICLKDIV_REQFLAG_MASK (0x80000000U) | ||
12105 | #define SYSCON_SPIFICLKDIV_REQFLAG_SHIFT (31U) | ||
12106 | /*! REQFLAG - Divider status flag. | ||
12107 | */ | ||
12108 | #define SYSCON_SPIFICLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SPIFICLKDIV_REQFLAG_SHIFT)) & SYSCON_SPIFICLKDIV_REQFLAG_MASK) | ||
12109 | /*! @} */ | ||
12110 | |||
12111 | /*! @name ADCCLKDIV - ADC clock divider */ | ||
12112 | /*! @{ */ | ||
12113 | #define SYSCON_ADCCLKDIV_DIV_MASK (0xFFU) | ||
12114 | #define SYSCON_ADCCLKDIV_DIV_SHIFT (0U) | ||
12115 | /*! DIV - Clock divider value. | ||
12116 | */ | ||
12117 | #define SYSCON_ADCCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ADCCLKDIV_DIV_SHIFT)) & SYSCON_ADCCLKDIV_DIV_MASK) | ||
12118 | #define SYSCON_ADCCLKDIV_RESET_MASK (0x20000000U) | ||
12119 | #define SYSCON_ADCCLKDIV_RESET_SHIFT (29U) | ||
12120 | /*! RESET - Resets the divider counter. | ||
12121 | */ | ||
12122 | #define SYSCON_ADCCLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ADCCLKDIV_RESET_SHIFT)) & SYSCON_ADCCLKDIV_RESET_MASK) | ||
12123 | #define SYSCON_ADCCLKDIV_HALT_MASK (0x40000000U) | ||
12124 | #define SYSCON_ADCCLKDIV_HALT_SHIFT (30U) | ||
12125 | /*! HALT - Halts the divider counter. | ||
12126 | */ | ||
12127 | #define SYSCON_ADCCLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ADCCLKDIV_HALT_SHIFT)) & SYSCON_ADCCLKDIV_HALT_MASK) | ||
12128 | #define SYSCON_ADCCLKDIV_REQFLAG_MASK (0x80000000U) | ||
12129 | #define SYSCON_ADCCLKDIV_REQFLAG_SHIFT (31U) | ||
12130 | /*! REQFLAG - Divider status flag. | ||
12131 | */ | ||
12132 | #define SYSCON_ADCCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ADCCLKDIV_REQFLAG_SHIFT)) & SYSCON_ADCCLKDIV_REQFLAG_MASK) | ||
12133 | /*! @} */ | ||
12134 | |||
12135 | /*! @name USB0CLKDIV - USB0 clock divider */ | ||
12136 | /*! @{ */ | ||
12137 | #define SYSCON_USB0CLKDIV_DIV_MASK (0xFFU) | ||
12138 | #define SYSCON_USB0CLKDIV_DIV_SHIFT (0U) | ||
12139 | /*! DIV - Clock divider value. | ||
12140 | */ | ||
12141 | #define SYSCON_USB0CLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKDIV_DIV_SHIFT)) & SYSCON_USB0CLKDIV_DIV_MASK) | ||
12142 | #define SYSCON_USB0CLKDIV_RESET_MASK (0x20000000U) | ||
12143 | #define SYSCON_USB0CLKDIV_RESET_SHIFT (29U) | ||
12144 | /*! RESET - Resets the divider counter. | ||
12145 | */ | ||
12146 | #define SYSCON_USB0CLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKDIV_RESET_SHIFT)) & SYSCON_USB0CLKDIV_RESET_MASK) | ||
12147 | #define SYSCON_USB0CLKDIV_HALT_MASK (0x40000000U) | ||
12148 | #define SYSCON_USB0CLKDIV_HALT_SHIFT (30U) | ||
12149 | /*! HALT - Halts the divider counter. | ||
12150 | */ | ||
12151 | #define SYSCON_USB0CLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKDIV_HALT_SHIFT)) & SYSCON_USB0CLKDIV_HALT_MASK) | ||
12152 | #define SYSCON_USB0CLKDIV_REQFLAG_MASK (0x80000000U) | ||
12153 | #define SYSCON_USB0CLKDIV_REQFLAG_SHIFT (31U) | ||
12154 | /*! REQFLAG - Divider status flag. | ||
12155 | */ | ||
12156 | #define SYSCON_USB0CLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKDIV_REQFLAG_SHIFT)) & SYSCON_USB0CLKDIV_REQFLAG_MASK) | ||
12157 | /*! @} */ | ||
12158 | |||
12159 | /*! @name USB1CLKDIV - USB1 clock divider */ | ||
12160 | /*! @{ */ | ||
12161 | #define SYSCON_USB1CLKDIV_DIV_MASK (0xFFU) | ||
12162 | #define SYSCON_USB1CLKDIV_DIV_SHIFT (0U) | ||
12163 | /*! DIV - Clock divider value. | ||
12164 | */ | ||
12165 | #define SYSCON_USB1CLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKDIV_DIV_SHIFT)) & SYSCON_USB1CLKDIV_DIV_MASK) | ||
12166 | #define SYSCON_USB1CLKDIV_RESET_MASK (0x20000000U) | ||
12167 | #define SYSCON_USB1CLKDIV_RESET_SHIFT (29U) | ||
12168 | /*! RESET - Resets the divider counter. | ||
12169 | */ | ||
12170 | #define SYSCON_USB1CLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKDIV_RESET_SHIFT)) & SYSCON_USB1CLKDIV_RESET_MASK) | ||
12171 | #define SYSCON_USB1CLKDIV_HALT_MASK (0x40000000U) | ||
12172 | #define SYSCON_USB1CLKDIV_HALT_SHIFT (30U) | ||
12173 | /*! HALT - Halts the divider counter. | ||
12174 | */ | ||
12175 | #define SYSCON_USB1CLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKDIV_HALT_SHIFT)) & SYSCON_USB1CLKDIV_HALT_MASK) | ||
12176 | #define SYSCON_USB1CLKDIV_REQFLAG_MASK (0x80000000U) | ||
12177 | #define SYSCON_USB1CLKDIV_REQFLAG_SHIFT (31U) | ||
12178 | /*! REQFLAG - Divider status flag. | ||
12179 | */ | ||
12180 | #define SYSCON_USB1CLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKDIV_REQFLAG_SHIFT)) & SYSCON_USB1CLKDIV_REQFLAG_MASK) | ||
12181 | /*! @} */ | ||
12182 | |||
12183 | /*! @name FRGCTRL - Fractional rate divider */ | ||
12184 | /*! @{ */ | ||
12185 | #define SYSCON_FRGCTRL_DIV_MASK (0xFFU) | ||
12186 | #define SYSCON_FRGCTRL_DIV_SHIFT (0U) | ||
12187 | /*! DIV - Denominator of the fractional divider. DIV is equal to the programmed value +1. Always set | ||
12188 | * to 0xFF to use with the fractional baud rate generator. | ||
12189 | */ | ||
12190 | #define SYSCON_FRGCTRL_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FRGCTRL_DIV_SHIFT)) & SYSCON_FRGCTRL_DIV_MASK) | ||
12191 | #define SYSCON_FRGCTRL_MULT_MASK (0xFF00U) | ||
12192 | #define SYSCON_FRGCTRL_MULT_SHIFT (8U) | ||
12193 | /*! MULT - Numerator of the fractional divider. MULT is equal to the programmed value. | ||
12194 | */ | ||
12195 | #define SYSCON_FRGCTRL_MULT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FRGCTRL_MULT_SHIFT)) & SYSCON_FRGCTRL_MULT_MASK) | ||
12196 | /*! @} */ | ||
12197 | |||
12198 | /*! @name DMICCLKDIV - DMIC clock divider */ | ||
12199 | /*! @{ */ | ||
12200 | #define SYSCON_DMICCLKDIV_DIV_MASK (0xFFU) | ||
12201 | #define SYSCON_DMICCLKDIV_DIV_SHIFT (0U) | ||
12202 | /*! DIV - Clock divider value. 0: Divide by 1 up to 255: Divide by 256. | ||
12203 | */ | ||
12204 | #define SYSCON_DMICCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_DMICCLKDIV_DIV_SHIFT)) & SYSCON_DMICCLKDIV_DIV_MASK) | ||
12205 | #define SYSCON_DMICCLKDIV_RESET_MASK (0x20000000U) | ||
12206 | #define SYSCON_DMICCLKDIV_RESET_SHIFT (29U) | ||
12207 | /*! RESET - Resets the divider counter. Can be used to make sure a new divider value is used right | ||
12208 | * away rather than completing the previous count. | ||
12209 | */ | ||
12210 | #define SYSCON_DMICCLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_DMICCLKDIV_RESET_SHIFT)) & SYSCON_DMICCLKDIV_RESET_MASK) | ||
12211 | #define SYSCON_DMICCLKDIV_HALT_MASK (0x40000000U) | ||
12212 | #define SYSCON_DMICCLKDIV_HALT_SHIFT (30U) | ||
12213 | /*! HALT - Halts the divider counter. The intent is to allow the divider clock source to be changed | ||
12214 | * without the risk of a glitch at the output. | ||
12215 | */ | ||
12216 | #define SYSCON_DMICCLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_DMICCLKDIV_HALT_SHIFT)) & SYSCON_DMICCLKDIV_HALT_MASK) | ||
12217 | #define SYSCON_DMICCLKDIV_REQFLAG_MASK (0x80000000U) | ||
12218 | #define SYSCON_DMICCLKDIV_REQFLAG_SHIFT (31U) | ||
12219 | /*! REQFLAG - Divider status flag. | ||
12220 | */ | ||
12221 | #define SYSCON_DMICCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_DMICCLKDIV_REQFLAG_SHIFT)) & SYSCON_DMICCLKDIV_REQFLAG_MASK) | ||
12222 | /*! @} */ | ||
12223 | |||
12224 | /*! @name MCLKDIV - I2S MCLK clock divider */ | ||
12225 | /*! @{ */ | ||
12226 | #define SYSCON_MCLKDIV_DIV_MASK (0xFFU) | ||
12227 | #define SYSCON_MCLKDIV_DIV_SHIFT (0U) | ||
12228 | /*! DIV - Clock divider value. 0: Divide by 1 up to 255: Divide by 256. | ||
12229 | */ | ||
12230 | #define SYSCON_MCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_MCLKDIV_DIV_SHIFT)) & SYSCON_MCLKDIV_DIV_MASK) | ||
12231 | #define SYSCON_MCLKDIV_RESET_MASK (0x20000000U) | ||
12232 | #define SYSCON_MCLKDIV_RESET_SHIFT (29U) | ||
12233 | /*! RESET - Resets the divider counter. | ||
12234 | */ | ||
12235 | #define SYSCON_MCLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_MCLKDIV_RESET_SHIFT)) & SYSCON_MCLKDIV_RESET_MASK) | ||
12236 | #define SYSCON_MCLKDIV_HALT_MASK (0x40000000U) | ||
12237 | #define SYSCON_MCLKDIV_HALT_SHIFT (30U) | ||
12238 | /*! HALT - Halts the divider counter. | ||
12239 | */ | ||
12240 | #define SYSCON_MCLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_MCLKDIV_HALT_SHIFT)) & SYSCON_MCLKDIV_HALT_MASK) | ||
12241 | #define SYSCON_MCLKDIV_REQFLAG_MASK (0x80000000U) | ||
12242 | #define SYSCON_MCLKDIV_REQFLAG_SHIFT (31U) | ||
12243 | /*! REQFLAG - Divider status flag. | ||
12244 | */ | ||
12245 | #define SYSCON_MCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_MCLKDIV_REQFLAG_SHIFT)) & SYSCON_MCLKDIV_REQFLAG_MASK) | ||
12246 | /*! @} */ | ||
12247 | |||
12248 | /*! @name LCDCLKDIV - LCD clock divider */ | ||
12249 | /*! @{ */ | ||
12250 | #define SYSCON_LCDCLKDIV_DIV_MASK (0xFFU) | ||
12251 | #define SYSCON_LCDCLKDIV_DIV_SHIFT (0U) | ||
12252 | /*! DIV - Clock divider value. | ||
12253 | */ | ||
12254 | #define SYSCON_LCDCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_LCDCLKDIV_DIV_SHIFT)) & SYSCON_LCDCLKDIV_DIV_MASK) | ||
12255 | #define SYSCON_LCDCLKDIV_RESET_MASK (0x20000000U) | ||
12256 | #define SYSCON_LCDCLKDIV_RESET_SHIFT (29U) | ||
12257 | /*! RESET - Resets the divider counter. | ||
12258 | */ | ||
12259 | #define SYSCON_LCDCLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_LCDCLKDIV_RESET_SHIFT)) & SYSCON_LCDCLKDIV_RESET_MASK) | ||
12260 | #define SYSCON_LCDCLKDIV_HALT_MASK (0x40000000U) | ||
12261 | #define SYSCON_LCDCLKDIV_HALT_SHIFT (30U) | ||
12262 | /*! HALT - Halts the divider counter. | ||
12263 | */ | ||
12264 | #define SYSCON_LCDCLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_LCDCLKDIV_HALT_SHIFT)) & SYSCON_LCDCLKDIV_HALT_MASK) | ||
12265 | #define SYSCON_LCDCLKDIV_REQFLAG_MASK (0x80000000U) | ||
12266 | #define SYSCON_LCDCLKDIV_REQFLAG_SHIFT (31U) | ||
12267 | /*! REQFLAG - Divider status flag. | ||
12268 | */ | ||
12269 | #define SYSCON_LCDCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_LCDCLKDIV_REQFLAG_SHIFT)) & SYSCON_LCDCLKDIV_REQFLAG_MASK) | ||
12270 | /*! @} */ | ||
12271 | |||
12272 | /*! @name SCTCLKDIV - SCT/PWM clock divider */ | ||
12273 | /*! @{ */ | ||
12274 | #define SYSCON_SCTCLKDIV_DIV_MASK (0xFFU) | ||
12275 | #define SYSCON_SCTCLKDIV_DIV_SHIFT (0U) | ||
12276 | /*! DIV - Clock divider value. | ||
12277 | */ | ||
12278 | #define SYSCON_SCTCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SCTCLKDIV_DIV_SHIFT)) & SYSCON_SCTCLKDIV_DIV_MASK) | ||
12279 | #define SYSCON_SCTCLKDIV_RESET_MASK (0x20000000U) | ||
12280 | #define SYSCON_SCTCLKDIV_RESET_SHIFT (29U) | ||
12281 | /*! RESET - Resets the divider counter. | ||
12282 | */ | ||
12283 | #define SYSCON_SCTCLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SCTCLKDIV_RESET_SHIFT)) & SYSCON_SCTCLKDIV_RESET_MASK) | ||
12284 | #define SYSCON_SCTCLKDIV_HALT_MASK (0x40000000U) | ||
12285 | #define SYSCON_SCTCLKDIV_HALT_SHIFT (30U) | ||
12286 | /*! HALT - Halts the divider counter. | ||
12287 | */ | ||
12288 | #define SYSCON_SCTCLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SCTCLKDIV_HALT_SHIFT)) & SYSCON_SCTCLKDIV_HALT_MASK) | ||
12289 | #define SYSCON_SCTCLKDIV_REQFLAG_MASK (0x80000000U) | ||
12290 | #define SYSCON_SCTCLKDIV_REQFLAG_SHIFT (31U) | ||
12291 | /*! REQFLAG - Divider status flag. | ||
12292 | */ | ||
12293 | #define SYSCON_SCTCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SCTCLKDIV_REQFLAG_SHIFT)) & SYSCON_SCTCLKDIV_REQFLAG_MASK) | ||
12294 | /*! @} */ | ||
12295 | |||
12296 | /*! @name EMCCLKDIV - EMC clock divider */ | ||
12297 | /*! @{ */ | ||
12298 | #define SYSCON_EMCCLKDIV_DIV_MASK (0xFFU) | ||
12299 | #define SYSCON_EMCCLKDIV_DIV_SHIFT (0U) | ||
12300 | /*! DIV - Clock divider value. | ||
12301 | */ | ||
12302 | #define SYSCON_EMCCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCCLKDIV_DIV_SHIFT)) & SYSCON_EMCCLKDIV_DIV_MASK) | ||
12303 | #define SYSCON_EMCCLKDIV_RESET_MASK (0x20000000U) | ||
12304 | #define SYSCON_EMCCLKDIV_RESET_SHIFT (29U) | ||
12305 | /*! RESET - Resets the divider counter. | ||
12306 | */ | ||
12307 | #define SYSCON_EMCCLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCCLKDIV_RESET_SHIFT)) & SYSCON_EMCCLKDIV_RESET_MASK) | ||
12308 | #define SYSCON_EMCCLKDIV_HALT_MASK (0x40000000U) | ||
12309 | #define SYSCON_EMCCLKDIV_HALT_SHIFT (30U) | ||
12310 | /*! HALT - Halts the divider counter. | ||
12311 | */ | ||
12312 | #define SYSCON_EMCCLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCCLKDIV_HALT_SHIFT)) & SYSCON_EMCCLKDIV_HALT_MASK) | ||
12313 | #define SYSCON_EMCCLKDIV_REQFLAG_MASK (0x80000000U) | ||
12314 | #define SYSCON_EMCCLKDIV_REQFLAG_SHIFT (31U) | ||
12315 | /*! REQFLAG - Divider status flag. | ||
12316 | */ | ||
12317 | #define SYSCON_EMCCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCCLKDIV_REQFLAG_SHIFT)) & SYSCON_EMCCLKDIV_REQFLAG_MASK) | ||
12318 | /*! @} */ | ||
12319 | |||
12320 | /*! @name SDIOCLKDIV - SDIO clock divider */ | ||
12321 | /*! @{ */ | ||
12322 | #define SYSCON_SDIOCLKDIV_DIV_MASK (0xFFU) | ||
12323 | #define SYSCON_SDIOCLKDIV_DIV_SHIFT (0U) | ||
12324 | /*! DIV - Clock divider value. | ||
12325 | */ | ||
12326 | #define SYSCON_SDIOCLKDIV_DIV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKDIV_DIV_SHIFT)) & SYSCON_SDIOCLKDIV_DIV_MASK) | ||
12327 | #define SYSCON_SDIOCLKDIV_RESET_MASK (0x20000000U) | ||
12328 | #define SYSCON_SDIOCLKDIV_RESET_SHIFT (29U) | ||
12329 | /*! RESET - Resets the divider counter. | ||
12330 | */ | ||
12331 | #define SYSCON_SDIOCLKDIV_RESET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKDIV_RESET_SHIFT)) & SYSCON_SDIOCLKDIV_RESET_MASK) | ||
12332 | #define SYSCON_SDIOCLKDIV_HALT_MASK (0x40000000U) | ||
12333 | #define SYSCON_SDIOCLKDIV_HALT_SHIFT (30U) | ||
12334 | /*! HALT - Halts the divider counter. | ||
12335 | */ | ||
12336 | #define SYSCON_SDIOCLKDIV_HALT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKDIV_HALT_SHIFT)) & SYSCON_SDIOCLKDIV_HALT_MASK) | ||
12337 | #define SYSCON_SDIOCLKDIV_REQFLAG_MASK (0x80000000U) | ||
12338 | #define SYSCON_SDIOCLKDIV_REQFLAG_SHIFT (31U) | ||
12339 | /*! REQFLAG - Divider status flag. | ||
12340 | */ | ||
12341 | #define SYSCON_SDIOCLKDIV_REQFLAG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKDIV_REQFLAG_SHIFT)) & SYSCON_SDIOCLKDIV_REQFLAG_MASK) | ||
12342 | /*! @} */ | ||
12343 | |||
12344 | /*! @name USB0CLKCTRL - USB0 clock control */ | ||
12345 | /*! @{ */ | ||
12346 | #define SYSCON_USB0CLKCTRL_AP_FS_DEV_CLK_MASK (0x1U) | ||
12347 | #define SYSCON_USB0CLKCTRL_AP_FS_DEV_CLK_SHIFT (0U) | ||
12348 | /*! AP_FS_DEV_CLK - USB0 Device USB0_NEEDCLK signal control. | ||
12349 | */ | ||
12350 | #define SYSCON_USB0CLKCTRL_AP_FS_DEV_CLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKCTRL_AP_FS_DEV_CLK_SHIFT)) & SYSCON_USB0CLKCTRL_AP_FS_DEV_CLK_MASK) | ||
12351 | #define SYSCON_USB0CLKCTRL_POL_FS_DEV_CLK_MASK (0x2U) | ||
12352 | #define SYSCON_USB0CLKCTRL_POL_FS_DEV_CLK_SHIFT (1U) | ||
12353 | /*! POL_FS_DEV_CLK - USB0 Device USB0_NEEDCLK polarity for triggering the USB0 wake-up interrupt. | ||
12354 | */ | ||
12355 | #define SYSCON_USB0CLKCTRL_POL_FS_DEV_CLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKCTRL_POL_FS_DEV_CLK_SHIFT)) & SYSCON_USB0CLKCTRL_POL_FS_DEV_CLK_MASK) | ||
12356 | #define SYSCON_USB0CLKCTRL_AP_FS_HOST_CLK_MASK (0x4U) | ||
12357 | #define SYSCON_USB0CLKCTRL_AP_FS_HOST_CLK_SHIFT (2U) | ||
12358 | /*! AP_FS_HOST_CLK - USB0 Host USB0_NEEDCLK signal control. | ||
12359 | */ | ||
12360 | #define SYSCON_USB0CLKCTRL_AP_FS_HOST_CLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKCTRL_AP_FS_HOST_CLK_SHIFT)) & SYSCON_USB0CLKCTRL_AP_FS_HOST_CLK_MASK) | ||
12361 | #define SYSCON_USB0CLKCTRL_POL_FS_HOST_CLK_MASK (0x8U) | ||
12362 | #define SYSCON_USB0CLKCTRL_POL_FS_HOST_CLK_SHIFT (3U) | ||
12363 | /*! POL_FS_HOST_CLK - USB0 Host USB0_NEEDCLK polarity for triggering the USB0 wake-up interrupt. | ||
12364 | */ | ||
12365 | #define SYSCON_USB0CLKCTRL_POL_FS_HOST_CLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKCTRL_POL_FS_HOST_CLK_SHIFT)) & SYSCON_USB0CLKCTRL_POL_FS_HOST_CLK_MASK) | ||
12366 | #define SYSCON_USB0CLKCTRL_PU_DISABLE_MASK (0x10U) | ||
12367 | #define SYSCON_USB0CLKCTRL_PU_DISABLE_SHIFT (4U) | ||
12368 | /*! PU_DISABLE - Internal pull-up disable control. | ||
12369 | */ | ||
12370 | #define SYSCON_USB0CLKCTRL_PU_DISABLE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKCTRL_PU_DISABLE_SHIFT)) & SYSCON_USB0CLKCTRL_PU_DISABLE_MASK) | ||
12371 | /*! @} */ | ||
12372 | |||
12373 | /*! @name USB0CLKSTAT - USB0 clock status */ | ||
12374 | /*! @{ */ | ||
12375 | #define SYSCON_USB0CLKSTAT_DEV_NEED_CLKST_MASK (0x1U) | ||
12376 | #define SYSCON_USB0CLKSTAT_DEV_NEED_CLKST_SHIFT (0U) | ||
12377 | /*! DEV_NEED_CLKST - USB0 Device USB0_NEEDCLK signal status. | ||
12378 | */ | ||
12379 | #define SYSCON_USB0CLKSTAT_DEV_NEED_CLKST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKSTAT_DEV_NEED_CLKST_SHIFT)) & SYSCON_USB0CLKSTAT_DEV_NEED_CLKST_MASK) | ||
12380 | #define SYSCON_USB0CLKSTAT_HOST_NEED_CLKST_MASK (0x2U) | ||
12381 | #define SYSCON_USB0CLKSTAT_HOST_NEED_CLKST_SHIFT (1U) | ||
12382 | /*! HOST_NEED_CLKST - USB0 Host USB0_NEEDCLK signal status. | ||
12383 | */ | ||
12384 | #define SYSCON_USB0CLKSTAT_HOST_NEED_CLKST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB0CLKSTAT_HOST_NEED_CLKST_SHIFT)) & SYSCON_USB0CLKSTAT_HOST_NEED_CLKST_MASK) | ||
12385 | /*! @} */ | ||
12386 | |||
12387 | /*! @name FREQMECTRL - Frequency measure register */ | ||
12388 | /*! @{ */ | ||
12389 | #define SYSCON_FREQMECTRL_CAPVAL_MASK (0x3FFFU) | ||
12390 | #define SYSCON_FREQMECTRL_CAPVAL_SHIFT (0U) | ||
12391 | /*! CAPVAL - Stores the capture result which is used to calculate the frequency of the target clock. This field is read-only. | ||
12392 | */ | ||
12393 | #define SYSCON_FREQMECTRL_CAPVAL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FREQMECTRL_CAPVAL_SHIFT)) & SYSCON_FREQMECTRL_CAPVAL_MASK) | ||
12394 | #define SYSCON_FREQMECTRL_PROG_MASK (0x80000000U) | ||
12395 | #define SYSCON_FREQMECTRL_PROG_SHIFT (31U) | ||
12396 | /*! PROG - Set this bit to one to initiate a frequency measurement cycle. Hardware clears this bit | ||
12397 | * when the measurement cycle has completed and there is valid capture data in the CAPVAL field | ||
12398 | * (bits 13:0). | ||
12399 | */ | ||
12400 | #define SYSCON_FREQMECTRL_PROG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FREQMECTRL_PROG_SHIFT)) & SYSCON_FREQMECTRL_PROG_MASK) | ||
12401 | /*! @} */ | ||
12402 | |||
12403 | /*! @name MCLKIO - MCLK input/output control */ | ||
12404 | /*! @{ */ | ||
12405 | #define SYSCON_MCLKIO_DIR_MASK (0x1U) | ||
12406 | #define SYSCON_MCLKIO_DIR_SHIFT (0U) | ||
12407 | /*! DIR - MCLK direction control. | ||
12408 | */ | ||
12409 | #define SYSCON_MCLKIO_DIR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_MCLKIO_DIR_SHIFT)) & SYSCON_MCLKIO_DIR_MASK) | ||
12410 | /*! @} */ | ||
12411 | |||
12412 | /*! @name USB1CLKCTRL - USB1 clock control */ | ||
12413 | /*! @{ */ | ||
12414 | #define SYSCON_USB1CLKCTRL_AP_FS_DEV_CLK_MASK (0x1U) | ||
12415 | #define SYSCON_USB1CLKCTRL_AP_FS_DEV_CLK_SHIFT (0U) | ||
12416 | /*! AP_FS_DEV_CLK - USB1 Device need_clock signal control. | ||
12417 | */ | ||
12418 | #define SYSCON_USB1CLKCTRL_AP_FS_DEV_CLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKCTRL_AP_FS_DEV_CLK_SHIFT)) & SYSCON_USB1CLKCTRL_AP_FS_DEV_CLK_MASK) | ||
12419 | #define SYSCON_USB1CLKCTRL_POL_FS_DEV_CLK_MASK (0x2U) | ||
12420 | #define SYSCON_USB1CLKCTRL_POL_FS_DEV_CLK_SHIFT (1U) | ||
12421 | /*! POL_FS_DEV_CLK - USB1 Device need_clock polarity for triggering the USB1 wake-up interrupt. | ||
12422 | */ | ||
12423 | #define SYSCON_USB1CLKCTRL_POL_FS_DEV_CLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKCTRL_POL_FS_DEV_CLK_SHIFT)) & SYSCON_USB1CLKCTRL_POL_FS_DEV_CLK_MASK) | ||
12424 | #define SYSCON_USB1CLKCTRL_AP_FS_HOST_CLK_MASK (0x4U) | ||
12425 | #define SYSCON_USB1CLKCTRL_AP_FS_HOST_CLK_SHIFT (2U) | ||
12426 | /*! AP_FS_HOST_CLK - USB1 Host need_clock signal control. | ||
12427 | */ | ||
12428 | #define SYSCON_USB1CLKCTRL_AP_FS_HOST_CLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKCTRL_AP_FS_HOST_CLK_SHIFT)) & SYSCON_USB1CLKCTRL_AP_FS_HOST_CLK_MASK) | ||
12429 | #define SYSCON_USB1CLKCTRL_POL_FS_HOST_CLK_MASK (0x8U) | ||
12430 | #define SYSCON_USB1CLKCTRL_POL_FS_HOST_CLK_SHIFT (3U) | ||
12431 | /*! POL_FS_HOST_CLK - USB1 Host need_clock polarity for triggering the USB1 wake-up interrupt. | ||
12432 | */ | ||
12433 | #define SYSCON_USB1CLKCTRL_POL_FS_HOST_CLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKCTRL_POL_FS_HOST_CLK_SHIFT)) & SYSCON_USB1CLKCTRL_POL_FS_HOST_CLK_MASK) | ||
12434 | #define SYSCON_USB1CLKCTRL_HS_DEV_WAKEUP_N_MASK (0x10U) | ||
12435 | #define SYSCON_USB1CLKCTRL_HS_DEV_WAKEUP_N_SHIFT (4U) | ||
12436 | /*! HS_DEV_WAKEUP_N - External user wake-up signal for device mode; asserting this signal (active | ||
12437 | * low) will result in exiting the low power mode; input to asynchronous control logic. | ||
12438 | */ | ||
12439 | #define SYSCON_USB1CLKCTRL_HS_DEV_WAKEUP_N(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKCTRL_HS_DEV_WAKEUP_N_SHIFT)) & SYSCON_USB1CLKCTRL_HS_DEV_WAKEUP_N_MASK) | ||
12440 | /*! @} */ | ||
12441 | |||
12442 | /*! @name USB1CLKSTAT - USB1 clock status */ | ||
12443 | /*! @{ */ | ||
12444 | #define SYSCON_USB1CLKSTAT_DEV_NEED_CLKST_MASK (0x1U) | ||
12445 | #define SYSCON_USB1CLKSTAT_DEV_NEED_CLKST_SHIFT (0U) | ||
12446 | /*! DEV_NEED_CLKST - USB1 Device USB1_NEEDCLK signal status. | ||
12447 | */ | ||
12448 | #define SYSCON_USB1CLKSTAT_DEV_NEED_CLKST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKSTAT_DEV_NEED_CLKST_SHIFT)) & SYSCON_USB1CLKSTAT_DEV_NEED_CLKST_MASK) | ||
12449 | #define SYSCON_USB1CLKSTAT_HOST_NEED_CLKST_MASK (0x2U) | ||
12450 | #define SYSCON_USB1CLKSTAT_HOST_NEED_CLKST_SHIFT (1U) | ||
12451 | /*! HOST_NEED_CLKST - USB1 Device host USB1_NEEDCLK signal status. | ||
12452 | */ | ||
12453 | #define SYSCON_USB1CLKSTAT_HOST_NEED_CLKST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USB1CLKSTAT_HOST_NEED_CLKST_SHIFT)) & SYSCON_USB1CLKSTAT_HOST_NEED_CLKST_MASK) | ||
12454 | /*! @} */ | ||
12455 | |||
12456 | /*! @name EMCSYSCTRL - EMC system control */ | ||
12457 | /*! @{ */ | ||
12458 | #define SYSCON_EMCSYSCTRL_EMCSC_MASK (0x1U) | ||
12459 | #define SYSCON_EMCSYSCTRL_EMCSC_SHIFT (0U) | ||
12460 | /*! EMCSC - EMC Shift Control. | ||
12461 | */ | ||
12462 | #define SYSCON_EMCSYSCTRL_EMCSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCSYSCTRL_EMCSC_SHIFT)) & SYSCON_EMCSYSCTRL_EMCSC_MASK) | ||
12463 | #define SYSCON_EMCSYSCTRL_EMCRD_MASK (0x2U) | ||
12464 | #define SYSCON_EMCSYSCTRL_EMCRD_SHIFT (1U) | ||
12465 | /*! EMCRD - EMC Reset Disable. | ||
12466 | */ | ||
12467 | #define SYSCON_EMCSYSCTRL_EMCRD(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCSYSCTRL_EMCRD_SHIFT)) & SYSCON_EMCSYSCTRL_EMCRD_MASK) | ||
12468 | #define SYSCON_EMCSYSCTRL_EMCBC_MASK (0x4U) | ||
12469 | #define SYSCON_EMCSYSCTRL_EMCBC_SHIFT (2U) | ||
12470 | /*! EMCBC - External Memory Controller burst control. | ||
12471 | */ | ||
12472 | #define SYSCON_EMCSYSCTRL_EMCBC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCSYSCTRL_EMCBC_SHIFT)) & SYSCON_EMCSYSCTRL_EMCBC_MASK) | ||
12473 | #define SYSCON_EMCSYSCTRL_EMCFBCLKINSEL_MASK (0x8U) | ||
12474 | #define SYSCON_EMCSYSCTRL_EMCFBCLKINSEL_SHIFT (3U) | ||
12475 | /*! EMCFBCLKINSEL - External Memory Controller clock select. | ||
12476 | */ | ||
12477 | #define SYSCON_EMCSYSCTRL_EMCFBCLKINSEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCSYSCTRL_EMCFBCLKINSEL_SHIFT)) & SYSCON_EMCSYSCTRL_EMCFBCLKINSEL_MASK) | ||
12478 | /*! @} */ | ||
12479 | |||
12480 | /*! @name EMCDYCTRL - EMC clock delay control */ | ||
12481 | /*! @{ */ | ||
12482 | #define SYSCON_EMCDYCTRL_CMD_DELAY_MASK (0x1FU) | ||
12483 | #define SYSCON_EMCDYCTRL_CMD_DELAY_SHIFT (0U) | ||
12484 | /*! CMD_DELAY - Programmable delay value for EMC outputs in command delayed mode. | ||
12485 | */ | ||
12486 | #define SYSCON_EMCDYCTRL_CMD_DELAY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCDYCTRL_CMD_DELAY_SHIFT)) & SYSCON_EMCDYCTRL_CMD_DELAY_MASK) | ||
12487 | #define SYSCON_EMCDYCTRL_FBCLK_DELAY_MASK (0x1F00U) | ||
12488 | #define SYSCON_EMCDYCTRL_FBCLK_DELAY_SHIFT (8U) | ||
12489 | /*! FBCLK_DELAY - Programmable delay value for the feedback clock that controls input data sampling. | ||
12490 | */ | ||
12491 | #define SYSCON_EMCDYCTRL_FBCLK_DELAY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCDYCTRL_FBCLK_DELAY_SHIFT)) & SYSCON_EMCDYCTRL_FBCLK_DELAY_MASK) | ||
12492 | /*! @} */ | ||
12493 | |||
12494 | /*! @name EMCCAL - EMC delay chain calibration control */ | ||
12495 | /*! @{ */ | ||
12496 | #define SYSCON_EMCCAL_CALVALUE_MASK (0xFFU) | ||
12497 | #define SYSCON_EMCCAL_CALVALUE_SHIFT (0U) | ||
12498 | /*! CALVALUE - Returns the count of the approximately 50 MHz ring oscillator that occur during 32 clocks of the FRO 12 MHz. | ||
12499 | */ | ||
12500 | #define SYSCON_EMCCAL_CALVALUE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCCAL_CALVALUE_SHIFT)) & SYSCON_EMCCAL_CALVALUE_MASK) | ||
12501 | #define SYSCON_EMCCAL_START_MASK (0x4000U) | ||
12502 | #define SYSCON_EMCCAL_START_SHIFT (14U) | ||
12503 | /*! START - Start control bit for the EMC calibration counter. | ||
12504 | */ | ||
12505 | #define SYSCON_EMCCAL_START(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCCAL_START_SHIFT)) & SYSCON_EMCCAL_START_MASK) | ||
12506 | #define SYSCON_EMCCAL_DONE_MASK (0x8000U) | ||
12507 | #define SYSCON_EMCCAL_DONE_SHIFT (15U) | ||
12508 | /*! DONE - Measurement completion flag. | ||
12509 | */ | ||
12510 | #define SYSCON_EMCCAL_DONE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_EMCCAL_DONE_SHIFT)) & SYSCON_EMCCAL_DONE_MASK) | ||
12511 | /*! @} */ | ||
12512 | |||
12513 | /*! @name ETHPHYSEL - Ethernet PHY Selection */ | ||
12514 | /*! @{ */ | ||
12515 | #define SYSCON_ETHPHYSEL_PHY_SEL_MASK (0x4U) | ||
12516 | #define SYSCON_ETHPHYSEL_PHY_SEL_SHIFT (2U) | ||
12517 | /*! PHY_SEL - PHY interface select. | ||
12518 | */ | ||
12519 | #define SYSCON_ETHPHYSEL_PHY_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ETHPHYSEL_PHY_SEL_SHIFT)) & SYSCON_ETHPHYSEL_PHY_SEL_MASK) | ||
12520 | /*! @} */ | ||
12521 | |||
12522 | /*! @name ETHSBDCTRL - Ethernet SBD flow control */ | ||
12523 | /*! @{ */ | ||
12524 | #define SYSCON_ETHSBDCTRL_SBD_CTRL_MASK (0x3U) | ||
12525 | #define SYSCON_ETHSBDCTRL_SBD_CTRL_SHIFT (0U) | ||
12526 | /*! SBD_CTRL - Sideband Flow Control. | ||
12527 | */ | ||
12528 | #define SYSCON_ETHSBDCTRL_SBD_CTRL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_ETHSBDCTRL_SBD_CTRL_SHIFT)) & SYSCON_ETHSBDCTRL_SBD_CTRL_MASK) | ||
12529 | /*! @} */ | ||
12530 | |||
12531 | /*! @name SDIOCLKCTRL - SDIO CCLKIN phase and delay control */ | ||
12532 | /*! @{ */ | ||
12533 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_PHASE_MASK (0x3U) | ||
12534 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_PHASE_SHIFT (0U) | ||
12535 | /*! CCLK_DRV_PHASE - Programmable delay value by which cclk_in_drv is phase-shifted with regard to cclk_in. | ||
12536 | */ | ||
12537 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_PHASE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKCTRL_CCLK_DRV_PHASE_SHIFT)) & SYSCON_SDIOCLKCTRL_CCLK_DRV_PHASE_MASK) | ||
12538 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_PHASE_MASK (0xCU) | ||
12539 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_PHASE_SHIFT (2U) | ||
12540 | /*! CCLK_SAMPLE_PHASE - Programmable delay value by which cclk_in_sample is delayed with regard to cclk_in. | ||
12541 | */ | ||
12542 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_PHASE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_PHASE_SHIFT)) & SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_PHASE_MASK) | ||
12543 | #define SYSCON_SDIOCLKCTRL_PHASE_ACTIVE_MASK (0x80U) | ||
12544 | #define SYSCON_SDIOCLKCTRL_PHASE_ACTIVE_SHIFT (7U) | ||
12545 | /*! PHASE_ACTIVE - sdio_clk by 2, before feeding into ccl_in, cclk_in_sample, and cclk_in_drv. | ||
12546 | */ | ||
12547 | #define SYSCON_SDIOCLKCTRL_PHASE_ACTIVE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKCTRL_PHASE_ACTIVE_SHIFT)) & SYSCON_SDIOCLKCTRL_PHASE_ACTIVE_MASK) | ||
12548 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_MASK (0x1F0000U) | ||
12549 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_SHIFT (16U) | ||
12550 | /*! CCLK_DRV_DELAY - Programmable delay value by which cclk_in_drv is delayed with regard to cclk_in. | ||
12551 | */ | ||
12552 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_SHIFT)) & SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_MASK) | ||
12553 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_ACTIVE_MASK (0x800000U) | ||
12554 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_ACTIVE_SHIFT (23U) | ||
12555 | /*! CCLK_DRV_DELAY_ACTIVE - Enables drive delay, as controlled by the CCLK_DRV_DELAY field. | ||
12556 | */ | ||
12557 | #define SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_ACTIVE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_ACTIVE_SHIFT)) & SYSCON_SDIOCLKCTRL_CCLK_DRV_DELAY_ACTIVE_MASK) | ||
12558 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_MASK (0x1F000000U) | ||
12559 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_SHIFT (24U) | ||
12560 | /*! CCLK_SAMPLE_DELAY - Programmable delay value by which cclk_in_sample is delayed with regard to cclk_in. | ||
12561 | */ | ||
12562 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_SHIFT)) & SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_MASK) | ||
12563 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_ACTIVE_MASK (0x80000000U) | ||
12564 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_ACTIVE_SHIFT (31U) | ||
12565 | /*! CCLK_SAMPLE_DELAY_ACTIVE - Enables sample delay, as controlled by the CCLK_SAMPLE_DELAY field. | ||
12566 | */ | ||
12567 | #define SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_ACTIVE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_ACTIVE_SHIFT)) & SYSCON_SDIOCLKCTRL_CCLK_SAMPLE_DELAY_ACTIVE_MASK) | ||
12568 | /*! @} */ | ||
12569 | |||
12570 | /*! @name KEYMUXSEL - AES key source selection */ | ||
12571 | /*! @{ */ | ||
12572 | #define SYSCON_KEYMUXSEL_SEL_MASK (0x3U) | ||
12573 | #define SYSCON_KEYMUXSEL_SEL_SHIFT (0U) | ||
12574 | /*! SEL - PHY interface select. | ||
12575 | */ | ||
12576 | #define SYSCON_KEYMUXSEL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_KEYMUXSEL_SEL_SHIFT)) & SYSCON_KEYMUXSEL_SEL_MASK) | ||
12577 | #define SYSCON_KEYMUXSEL_LOCK_MASK (0x80U) | ||
12578 | #define SYSCON_KEYMUXSEL_LOCK_SHIFT (7U) | ||
12579 | /*! LOCK - LOCK stat. | ||
12580 | */ | ||
12581 | #define SYSCON_KEYMUXSEL_LOCK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_KEYMUXSEL_LOCK_SHIFT)) & SYSCON_KEYMUXSEL_LOCK_MASK) | ||
12582 | /*! @} */ | ||
12583 | |||
12584 | /*! @name FROCTRL - FRO oscillator control */ | ||
12585 | /*! @{ */ | ||
12586 | #define SYSCON_FROCTRL_SEL_MASK (0x4000U) | ||
12587 | #define SYSCON_FROCTRL_SEL_SHIFT (14U) | ||
12588 | /*! SEL - Select the FRO HF output frequency. | ||
12589 | */ | ||
12590 | #define SYSCON_FROCTRL_SEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROCTRL_SEL_SHIFT)) & SYSCON_FROCTRL_SEL_MASK) | ||
12591 | #define SYSCON_FROCTRL_FREQTRIM_MASK (0xFF0000U) | ||
12592 | #define SYSCON_FROCTRL_FREQTRIM_SHIFT (16U) | ||
12593 | /*! FREQTRIM - Frequency trim. | ||
12594 | */ | ||
12595 | #define SYSCON_FROCTRL_FREQTRIM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROCTRL_FREQTRIM_SHIFT)) & SYSCON_FROCTRL_FREQTRIM_MASK) | ||
12596 | #define SYSCON_FROCTRL_USBCLKADJ_MASK (0x1000000U) | ||
12597 | #define SYSCON_FROCTRL_USBCLKADJ_SHIFT (24U) | ||
12598 | /*! USBCLKADJ - USB clock adjust mode. | ||
12599 | */ | ||
12600 | #define SYSCON_FROCTRL_USBCLKADJ(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROCTRL_USBCLKADJ_SHIFT)) & SYSCON_FROCTRL_USBCLKADJ_MASK) | ||
12601 | #define SYSCON_FROCTRL_USBMODCHG_MASK (0x2000000U) | ||
12602 | #define SYSCON_FROCTRL_USBMODCHG_SHIFT (25U) | ||
12603 | /*! USBMODCHG - USB Mode value Change flag. | ||
12604 | */ | ||
12605 | #define SYSCON_FROCTRL_USBMODCHG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROCTRL_USBMODCHG_SHIFT)) & SYSCON_FROCTRL_USBMODCHG_MASK) | ||
12606 | #define SYSCON_FROCTRL_HSPDCLK_MASK (0x40000000U) | ||
12607 | #define SYSCON_FROCTRL_HSPDCLK_SHIFT (30U) | ||
12608 | /*! HSPDCLK - High speed clock enable. | ||
12609 | */ | ||
12610 | #define SYSCON_FROCTRL_HSPDCLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_FROCTRL_HSPDCLK_SHIFT)) & SYSCON_FROCTRL_HSPDCLK_MASK) | ||
12611 | /*! @} */ | ||
12612 | |||
12613 | /*! @name SYSOSCCTRL - System oscillator control */ | ||
12614 | /*! @{ */ | ||
12615 | #define SYSCON_SYSOSCCTRL_FREQRANGE_MASK (0x2U) | ||
12616 | #define SYSCON_SYSOSCCTRL_FREQRANGE_SHIFT (1U) | ||
12617 | /*! FREQRANGE - Determines frequency range for system oscillator. | ||
12618 | */ | ||
12619 | #define SYSCON_SYSOSCCTRL_FREQRANGE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSOSCCTRL_FREQRANGE_SHIFT)) & SYSCON_SYSOSCCTRL_FREQRANGE_MASK) | ||
12620 | /*! @} */ | ||
12621 | |||
12622 | /*! @name WDTOSCCTRL - Watchdog oscillator control */ | ||
12623 | /*! @{ */ | ||
12624 | #define SYSCON_WDTOSCCTRL_DIVSEL_MASK (0x1FU) | ||
12625 | #define SYSCON_WDTOSCCTRL_DIVSEL_SHIFT (0U) | ||
12626 | /*! DIVSEL - Divider select. | ||
12627 | */ | ||
12628 | #define SYSCON_WDTOSCCTRL_DIVSEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_WDTOSCCTRL_DIVSEL_SHIFT)) & SYSCON_WDTOSCCTRL_DIVSEL_MASK) | ||
12629 | #define SYSCON_WDTOSCCTRL_FREQSEL_MASK (0x3E0U) | ||
12630 | #define SYSCON_WDTOSCCTRL_FREQSEL_SHIFT (5U) | ||
12631 | /*! FREQSEL - Frequency select. | ||
12632 | */ | ||
12633 | #define SYSCON_WDTOSCCTRL_FREQSEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT)) & SYSCON_WDTOSCCTRL_FREQSEL_MASK) | ||
12634 | /*! @} */ | ||
12635 | |||
12636 | /*! @name RTCOSCCTRL - RTC oscillator 32 kHz output control */ | ||
12637 | /*! @{ */ | ||
12638 | #define SYSCON_RTCOSCCTRL_EN_MASK (0x1U) | ||
12639 | #define SYSCON_RTCOSCCTRL_EN_SHIFT (0U) | ||
12640 | /*! EN - RTC 32 kHz clock enable. | ||
12641 | */ | ||
12642 | #define SYSCON_RTCOSCCTRL_EN(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_RTCOSCCTRL_EN_SHIFT)) & SYSCON_RTCOSCCTRL_EN_MASK) | ||
12643 | /*! @} */ | ||
12644 | |||
12645 | /*! @name USBPLLCTRL - USB PLL control */ | ||
12646 | /*! @{ */ | ||
12647 | #define SYSCON_USBPLLCTRL_MSEL_MASK (0xFFU) | ||
12648 | #define SYSCON_USBPLLCTRL_MSEL_SHIFT (0U) | ||
12649 | /*! MSEL - PLL feedback Divider value. | ||
12650 | */ | ||
12651 | #define SYSCON_USBPLLCTRL_MSEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USBPLLCTRL_MSEL_SHIFT)) & SYSCON_USBPLLCTRL_MSEL_MASK) | ||
12652 | #define SYSCON_USBPLLCTRL_PSEL_MASK (0x300U) | ||
12653 | #define SYSCON_USBPLLCTRL_PSEL_SHIFT (8U) | ||
12654 | /*! PSEL - PLL Divider value. | ||
12655 | */ | ||
12656 | #define SYSCON_USBPLLCTRL_PSEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USBPLLCTRL_PSEL_SHIFT)) & SYSCON_USBPLLCTRL_PSEL_MASK) | ||
12657 | #define SYSCON_USBPLLCTRL_NSEL_MASK (0xC00U) | ||
12658 | #define SYSCON_USBPLLCTRL_NSEL_SHIFT (10U) | ||
12659 | /*! NSEL - PLL feedback Divider value. | ||
12660 | */ | ||
12661 | #define SYSCON_USBPLLCTRL_NSEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USBPLLCTRL_NSEL_SHIFT)) & SYSCON_USBPLLCTRL_NSEL_MASK) | ||
12662 | #define SYSCON_USBPLLCTRL_DIRECT_MASK (0x1000U) | ||
12663 | #define SYSCON_USBPLLCTRL_DIRECT_SHIFT (12U) | ||
12664 | /*! DIRECT - Direct CCO clock output control. | ||
12665 | * 0b0..CCO Clock signal goes through post divider. | ||
12666 | * 0b1..CCO Clock signal goes directly to output(s).. | ||
12667 | */ | ||
12668 | #define SYSCON_USBPLLCTRL_DIRECT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USBPLLCTRL_DIRECT_SHIFT)) & SYSCON_USBPLLCTRL_DIRECT_MASK) | ||
12669 | #define SYSCON_USBPLLCTRL_BYPASS_MASK (0x2000U) | ||
12670 | #define SYSCON_USBPLLCTRL_BYPASS_SHIFT (13U) | ||
12671 | /*! BYPASS - Input clock bypass control. | ||
12672 | * 0b0..CCO clock is sent to post dividers.. | ||
12673 | * 0b1..PLL input clock is sent to post dividers.. | ||
12674 | */ | ||
12675 | #define SYSCON_USBPLLCTRL_BYPASS(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USBPLLCTRL_BYPASS_SHIFT)) & SYSCON_USBPLLCTRL_BYPASS_MASK) | ||
12676 | #define SYSCON_USBPLLCTRL_FBSEL_MASK (0x4000U) | ||
12677 | #define SYSCON_USBPLLCTRL_FBSEL_SHIFT (14U) | ||
12678 | /*! FBSEL - Feedback divider input clock control. | ||
12679 | */ | ||
12680 | #define SYSCON_USBPLLCTRL_FBSEL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USBPLLCTRL_FBSEL_SHIFT)) & SYSCON_USBPLLCTRL_FBSEL_MASK) | ||
12681 | /*! @} */ | ||
12682 | |||
12683 | /*! @name USBPLLSTAT - USB PLL status */ | ||
12684 | /*! @{ */ | ||
12685 | #define SYSCON_USBPLLSTAT_LOCK_MASK (0x1U) | ||
12686 | #define SYSCON_USBPLLSTAT_LOCK_SHIFT (0U) | ||
12687 | /*! LOCK - USBPLL lock indicator. | ||
12688 | */ | ||
12689 | #define SYSCON_USBPLLSTAT_LOCK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_USBPLLSTAT_LOCK_SHIFT)) & SYSCON_USBPLLSTAT_LOCK_MASK) | ||
12690 | /*! @} */ | ||
12691 | |||
12692 | /*! @name SYSPLLCTRL - System PLL control */ | ||
12693 | /*! @{ */ | ||
12694 | #define SYSCON_SYSPLLCTRL_SELR_MASK (0xFU) | ||
12695 | #define SYSCON_SYSPLLCTRL_SELR_SHIFT (0U) | ||
12696 | /*! SELR - Bandwidth select R value. | ||
12697 | */ | ||
12698 | #define SYSCON_SYSPLLCTRL_SELR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLCTRL_SELR_SHIFT)) & SYSCON_SYSPLLCTRL_SELR_MASK) | ||
12699 | #define SYSCON_SYSPLLCTRL_SELI_MASK (0x3F0U) | ||
12700 | #define SYSCON_SYSPLLCTRL_SELI_SHIFT (4U) | ||
12701 | /*! SELI - Bandwidth select I value. | ||
12702 | */ | ||
12703 | #define SYSCON_SYSPLLCTRL_SELI(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLCTRL_SELI_SHIFT)) & SYSCON_SYSPLLCTRL_SELI_MASK) | ||
12704 | #define SYSCON_SYSPLLCTRL_SELP_MASK (0x7C00U) | ||
12705 | #define SYSCON_SYSPLLCTRL_SELP_SHIFT (10U) | ||
12706 | /*! SELP - Bandwidth select P value. | ||
12707 | */ | ||
12708 | #define SYSCON_SYSPLLCTRL_SELP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLCTRL_SELP_SHIFT)) & SYSCON_SYSPLLCTRL_SELP_MASK) | ||
12709 | #define SYSCON_SYSPLLCTRL_BYPASS_MASK (0x8000U) | ||
12710 | #define SYSCON_SYSPLLCTRL_BYPASS_SHIFT (15U) | ||
12711 | /*! BYPASS - PLL bypass control. | ||
12712 | * 0b0..Bypass disabled. PLL CCO is sent to the PLL post-dividers. | ||
12713 | * 0b1..Bypass enabled. PLL input clock is sent directly to the PLL output (default). | ||
12714 | */ | ||
12715 | #define SYSCON_SYSPLLCTRL_BYPASS(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLCTRL_BYPASS_SHIFT)) & SYSCON_SYSPLLCTRL_BYPASS_MASK) | ||
12716 | #define SYSCON_SYSPLLCTRL_UPLIMOFF_MASK (0x20000U) | ||
12717 | #define SYSCON_SYSPLLCTRL_UPLIMOFF_SHIFT (17U) | ||
12718 | /*! UPLIMOFF - Disable upper frequency limiter. | ||
12719 | */ | ||
12720 | #define SYSCON_SYSPLLCTRL_UPLIMOFF(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLCTRL_UPLIMOFF_SHIFT)) & SYSCON_SYSPLLCTRL_UPLIMOFF_MASK) | ||
12721 | #define SYSCON_SYSPLLCTRL_DIRECTI_MASK (0x80000U) | ||
12722 | #define SYSCON_SYSPLLCTRL_DIRECTI_SHIFT (19U) | ||
12723 | /*! DIRECTI - PLL0 direct input enable. | ||
12724 | */ | ||
12725 | #define SYSCON_SYSPLLCTRL_DIRECTI(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLCTRL_DIRECTI_SHIFT)) & SYSCON_SYSPLLCTRL_DIRECTI_MASK) | ||
12726 | #define SYSCON_SYSPLLCTRL_DIRECTO_MASK (0x100000U) | ||
12727 | #define SYSCON_SYSPLLCTRL_DIRECTO_SHIFT (20U) | ||
12728 | /*! DIRECTO - PLL0 direct output enable. | ||
12729 | * 0b0..Disabled. The PLL output divider (P divider) is used to create the PLL output. | ||
12730 | * 0b1..Enabled. The PLL output divider (P divider) is bypassed, the PLL CCO output is used as the PLL output. | ||
12731 | */ | ||
12732 | #define SYSCON_SYSPLLCTRL_DIRECTO(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLCTRL_DIRECTO_SHIFT)) & SYSCON_SYSPLLCTRL_DIRECTO_MASK) | ||
12733 | /*! @} */ | ||
12734 | |||
12735 | /*! @name SYSPLLSTAT - PLL status */ | ||
12736 | /*! @{ */ | ||
12737 | #define SYSCON_SYSPLLSTAT_LOCK_MASK (0x1U) | ||
12738 | #define SYSCON_SYSPLLSTAT_LOCK_SHIFT (0U) | ||
12739 | /*! LOCK - PLL lock indicator. | ||
12740 | */ | ||
12741 | #define SYSCON_SYSPLLSTAT_LOCK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLSTAT_LOCK_SHIFT)) & SYSCON_SYSPLLSTAT_LOCK_MASK) | ||
12742 | /*! @} */ | ||
12743 | |||
12744 | /*! @name SYSPLLNDEC - PLL N divider */ | ||
12745 | /*! @{ */ | ||
12746 | #define SYSCON_SYSPLLNDEC_NDEC_MASK (0x3FFU) | ||
12747 | #define SYSCON_SYSPLLNDEC_NDEC_SHIFT (0U) | ||
12748 | /*! NDEC - Decoded N-divider coefficient value. | ||
12749 | */ | ||
12750 | #define SYSCON_SYSPLLNDEC_NDEC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLNDEC_NDEC_SHIFT)) & SYSCON_SYSPLLNDEC_NDEC_MASK) | ||
12751 | #define SYSCON_SYSPLLNDEC_NREQ_MASK (0x400U) | ||
12752 | #define SYSCON_SYSPLLNDEC_NREQ_SHIFT (10U) | ||
12753 | /*! NREQ - NDEC reload request. | ||
12754 | */ | ||
12755 | #define SYSCON_SYSPLLNDEC_NREQ(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLNDEC_NREQ_SHIFT)) & SYSCON_SYSPLLNDEC_NREQ_MASK) | ||
12756 | /*! @} */ | ||
12757 | |||
12758 | /*! @name SYSPLLPDEC - PLL P divider */ | ||
12759 | /*! @{ */ | ||
12760 | #define SYSCON_SYSPLLPDEC_PDEC_MASK (0x7FU) | ||
12761 | #define SYSCON_SYSPLLPDEC_PDEC_SHIFT (0U) | ||
12762 | /*! PDEC - Decoded P-divider coefficient value. | ||
12763 | */ | ||
12764 | #define SYSCON_SYSPLLPDEC_PDEC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLPDEC_PDEC_SHIFT)) & SYSCON_SYSPLLPDEC_PDEC_MASK) | ||
12765 | #define SYSCON_SYSPLLPDEC_PREQ_MASK (0x80U) | ||
12766 | #define SYSCON_SYSPLLPDEC_PREQ_SHIFT (7U) | ||
12767 | /*! PREQ - . | ||
12768 | */ | ||
12769 | #define SYSCON_SYSPLLPDEC_PREQ(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLPDEC_PREQ_SHIFT)) & SYSCON_SYSPLLPDEC_PREQ_MASK) | ||
12770 | /*! @} */ | ||
12771 | |||
12772 | /*! @name SYSPLLMDEC - System PLL M divider */ | ||
12773 | /*! @{ */ | ||
12774 | #define SYSCON_SYSPLLMDEC_MDEC_MASK (0x1FFFFU) | ||
12775 | #define SYSCON_SYSPLLMDEC_MDEC_SHIFT (0U) | ||
12776 | /*! MDEC - Decoded M-divider coefficient value. | ||
12777 | */ | ||
12778 | #define SYSCON_SYSPLLMDEC_MDEC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLMDEC_MDEC_SHIFT)) & SYSCON_SYSPLLMDEC_MDEC_MASK) | ||
12779 | #define SYSCON_SYSPLLMDEC_MREQ_MASK (0x20000U) | ||
12780 | #define SYSCON_SYSPLLMDEC_MREQ_SHIFT (17U) | ||
12781 | /*! MREQ - MDEC reload request. | ||
12782 | */ | ||
12783 | #define SYSCON_SYSPLLMDEC_MREQ(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_SYSPLLMDEC_MREQ_SHIFT)) & SYSCON_SYSPLLMDEC_MREQ_MASK) | ||
12784 | /*! @} */ | ||
12785 | |||
12786 | /*! @name AUDPLLCTRL - Audio PLL control */ | ||
12787 | /*! @{ */ | ||
12788 | #define SYSCON_AUDPLLCTRL_SELR_MASK (0xFU) | ||
12789 | #define SYSCON_AUDPLLCTRL_SELR_SHIFT (0U) | ||
12790 | /*! SELR - Bandwidth select R value. | ||
12791 | */ | ||
12792 | #define SYSCON_AUDPLLCTRL_SELR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLCTRL_SELR_SHIFT)) & SYSCON_AUDPLLCTRL_SELR_MASK) | ||
12793 | #define SYSCON_AUDPLLCTRL_SELI_MASK (0x3F0U) | ||
12794 | #define SYSCON_AUDPLLCTRL_SELI_SHIFT (4U) | ||
12795 | /*! SELI - Bandwidth select I value. | ||
12796 | */ | ||
12797 | #define SYSCON_AUDPLLCTRL_SELI(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLCTRL_SELI_SHIFT)) & SYSCON_AUDPLLCTRL_SELI_MASK) | ||
12798 | #define SYSCON_AUDPLLCTRL_SELP_MASK (0x7C00U) | ||
12799 | #define SYSCON_AUDPLLCTRL_SELP_SHIFT (10U) | ||
12800 | /*! SELP - . | ||
12801 | */ | ||
12802 | #define SYSCON_AUDPLLCTRL_SELP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLCTRL_SELP_SHIFT)) & SYSCON_AUDPLLCTRL_SELP_MASK) | ||
12803 | #define SYSCON_AUDPLLCTRL_BYPASS_MASK (0x8000U) | ||
12804 | #define SYSCON_AUDPLLCTRL_BYPASS_SHIFT (15U) | ||
12805 | /*! BYPASS - PLL bypass control. | ||
12806 | * 0b0..Bypass disabled. PLL CCO is sent to the PLL post-dividers. | ||
12807 | * 0b1..Bypass enabled. PLL input clock is sent directly to the PLL output (default). | ||
12808 | */ | ||
12809 | #define SYSCON_AUDPLLCTRL_BYPASS(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLCTRL_BYPASS_SHIFT)) & SYSCON_AUDPLLCTRL_BYPASS_MASK) | ||
12810 | #define SYSCON_AUDPLLCTRL_UPLIMOFF_MASK (0x20000U) | ||
12811 | #define SYSCON_AUDPLLCTRL_UPLIMOFF_SHIFT (17U) | ||
12812 | /*! UPLIMOFF - Disable upper frequency limiter. | ||
12813 | */ | ||
12814 | #define SYSCON_AUDPLLCTRL_UPLIMOFF(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLCTRL_UPLIMOFF_SHIFT)) & SYSCON_AUDPLLCTRL_UPLIMOFF_MASK) | ||
12815 | #define SYSCON_AUDPLLCTRL_DIRECTI_MASK (0x80000U) | ||
12816 | #define SYSCON_AUDPLLCTRL_DIRECTI_SHIFT (19U) | ||
12817 | /*! DIRECTI - PLL direct input enable. | ||
12818 | */ | ||
12819 | #define SYSCON_AUDPLLCTRL_DIRECTI(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLCTRL_DIRECTI_SHIFT)) & SYSCON_AUDPLLCTRL_DIRECTI_MASK) | ||
12820 | #define SYSCON_AUDPLLCTRL_DIRECTO_MASK (0x100000U) | ||
12821 | #define SYSCON_AUDPLLCTRL_DIRECTO_SHIFT (20U) | ||
12822 | /*! DIRECTO - PLL direct output enable | ||
12823 | * 0b0..Disabled. The PLL output divider (P divider) is used to create the PLL output. | ||
12824 | * 0b1..Enabled. The PLL output divider (P divider) is bypassed, the PLL CCO output is used as the PLL output. | ||
12825 | */ | ||
12826 | #define SYSCON_AUDPLLCTRL_DIRECTO(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLCTRL_DIRECTO_SHIFT)) & SYSCON_AUDPLLCTRL_DIRECTO_MASK) | ||
12827 | /*! @} */ | ||
12828 | |||
12829 | /*! @name AUDPLLSTAT - Audio PLL status */ | ||
12830 | /*! @{ */ | ||
12831 | #define SYSCON_AUDPLLSTAT_LOCK_MASK (0x1U) | ||
12832 | #define SYSCON_AUDPLLSTAT_LOCK_SHIFT (0U) | ||
12833 | /*! LOCK - PLL lock indicator. | ||
12834 | */ | ||
12835 | #define SYSCON_AUDPLLSTAT_LOCK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLSTAT_LOCK_SHIFT)) & SYSCON_AUDPLLSTAT_LOCK_MASK) | ||
12836 | /*! @} */ | ||
12837 | |||
12838 | /*! @name AUDPLLNDEC - Audio PLL N divider */ | ||
12839 | /*! @{ */ | ||
12840 | #define SYSCON_AUDPLLNDEC_NDEC_MASK (0x3FFU) | ||
12841 | #define SYSCON_AUDPLLNDEC_NDEC_SHIFT (0U) | ||
12842 | /*! NDEC - Decoded N-divider coefficient value. | ||
12843 | */ | ||
12844 | #define SYSCON_AUDPLLNDEC_NDEC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLNDEC_NDEC_SHIFT)) & SYSCON_AUDPLLNDEC_NDEC_MASK) | ||
12845 | #define SYSCON_AUDPLLNDEC_NREQ_MASK (0x400U) | ||
12846 | #define SYSCON_AUDPLLNDEC_NREQ_SHIFT (10U) | ||
12847 | /*! NREQ - NDEC reload request. | ||
12848 | */ | ||
12849 | #define SYSCON_AUDPLLNDEC_NREQ(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLNDEC_NREQ_SHIFT)) & SYSCON_AUDPLLNDEC_NREQ_MASK) | ||
12850 | /*! @} */ | ||
12851 | |||
12852 | /*! @name AUDPLLPDEC - Audio PLL P divider */ | ||
12853 | /*! @{ */ | ||
12854 | #define SYSCON_AUDPLLPDEC_PDEC_MASK (0x7FU) | ||
12855 | #define SYSCON_AUDPLLPDEC_PDEC_SHIFT (0U) | ||
12856 | /*! PDEC - Decoded P-divider coefficient value. | ||
12857 | */ | ||
12858 | #define SYSCON_AUDPLLPDEC_PDEC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLPDEC_PDEC_SHIFT)) & SYSCON_AUDPLLPDEC_PDEC_MASK) | ||
12859 | #define SYSCON_AUDPLLPDEC_PREQ_MASK (0x80U) | ||
12860 | #define SYSCON_AUDPLLPDEC_PREQ_SHIFT (7U) | ||
12861 | /*! PREQ - PDEC reload request. | ||
12862 | */ | ||
12863 | #define SYSCON_AUDPLLPDEC_PREQ(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLPDEC_PREQ_SHIFT)) & SYSCON_AUDPLLPDEC_PREQ_MASK) | ||
12864 | /*! @} */ | ||
12865 | |||
12866 | /*! @name AUDPLLMDEC - Audio PLL M divider */ | ||
12867 | /*! @{ */ | ||
12868 | #define SYSCON_AUDPLLMDEC_MDEC_MASK (0x1FFFFU) | ||
12869 | #define SYSCON_AUDPLLMDEC_MDEC_SHIFT (0U) | ||
12870 | /*! MDEC - Decoded M-divider coefficient value. | ||
12871 | */ | ||
12872 | #define SYSCON_AUDPLLMDEC_MDEC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLMDEC_MDEC_SHIFT)) & SYSCON_AUDPLLMDEC_MDEC_MASK) | ||
12873 | #define SYSCON_AUDPLLMDEC_MREQ_MASK (0x20000U) | ||
12874 | #define SYSCON_AUDPLLMDEC_MREQ_SHIFT (17U) | ||
12875 | /*! MREQ - MDEC reload request. | ||
12876 | */ | ||
12877 | #define SYSCON_AUDPLLMDEC_MREQ(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLMDEC_MREQ_SHIFT)) & SYSCON_AUDPLLMDEC_MREQ_MASK) | ||
12878 | /*! @} */ | ||
12879 | |||
12880 | /*! @name AUDPLLFRAC - Audio PLL fractional divider control */ | ||
12881 | /*! @{ */ | ||
12882 | #define SYSCON_AUDPLLFRAC_CTRL_MASK (0x3FFFFFU) | ||
12883 | #define SYSCON_AUDPLLFRAC_CTRL_SHIFT (0U) | ||
12884 | /*! CTRL - PLL fractional divider control word | ||
12885 | */ | ||
12886 | #define SYSCON_AUDPLLFRAC_CTRL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLFRAC_CTRL_SHIFT)) & SYSCON_AUDPLLFRAC_CTRL_MASK) | ||
12887 | #define SYSCON_AUDPLLFRAC_REQ_MASK (0x400000U) | ||
12888 | #define SYSCON_AUDPLLFRAC_REQ_SHIFT (22U) | ||
12889 | /*! REQ - Writing 1 to REQ signal loads CTRL value into fractional wrapper modulator. | ||
12890 | */ | ||
12891 | #define SYSCON_AUDPLLFRAC_REQ(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLFRAC_REQ_SHIFT)) & SYSCON_AUDPLLFRAC_REQ_MASK) | ||
12892 | #define SYSCON_AUDPLLFRAC_SEL_EXT_MASK (0x800000U) | ||
12893 | #define SYSCON_AUDPLLFRAC_SEL_EXT_SHIFT (23U) | ||
12894 | /*! SEL_EXT - Select fractional divider. | ||
12895 | */ | ||
12896 | #define SYSCON_AUDPLLFRAC_SEL_EXT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUDPLLFRAC_SEL_EXT_SHIFT)) & SYSCON_AUDPLLFRAC_SEL_EXT_MASK) | ||
12897 | /*! @} */ | ||
12898 | |||
12899 | /*! @name PDSLEEPCFG - Sleep configuration register */ | ||
12900 | /*! @{ */ | ||
12901 | #define SYSCON_PDSLEEPCFG_PDEN_USB1_PHY_MASK (0x1U) | ||
12902 | #define SYSCON_PDSLEEPCFG_PDEN_USB1_PHY_SHIFT (0U) | ||
12903 | /*! PDEN_USB1_PHY - USB1 high speed PHY (also, enable/disable bit 28 in PDRUNCFG0 register). | ||
12904 | */ | ||
12905 | #define SYSCON_PDSLEEPCFG_PDEN_USB1_PHY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_USB1_PHY_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_USB1_PHY_MASK) | ||
12906 | #define SYSCON_PDSLEEPCFG_PDEN_USB1_PLL_MASK (0x2U) | ||
12907 | #define SYSCON_PDSLEEPCFG_PDEN_USB1_PLL_SHIFT (1U) | ||
12908 | /*! PDEN_USB1_PLL - USB PLL (PLL1) power (also, enable/disable bit 26 in PDRUNCFG0 register). | ||
12909 | */ | ||
12910 | #define SYSCON_PDSLEEPCFG_PDEN_USB1_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_USB1_PLL_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_USB1_PLL_MASK) | ||
12911 | #define SYSCON_PDSLEEPCFG_PDEN_AUD_PLL_MASK (0x4U) | ||
12912 | #define SYSCON_PDSLEEPCFG_PDEN_AUD_PLL_SHIFT (2U) | ||
12913 | /*! PDEN_AUD_PLL - Audio PLL (PLL2) power and fractional divider (also, enable/disable bit 26 in PDRUNCFG0 register). | ||
12914 | */ | ||
12915 | #define SYSCON_PDSLEEPCFG_PDEN_AUD_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_AUD_PLL_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_AUD_PLL_MASK) | ||
12916 | #define SYSCON_PDSLEEPCFG_PDEN_SYSOSC_MASK (0x8U) | ||
12917 | #define SYSCON_PDSLEEPCFG_PDEN_SYSOSC_SHIFT (3U) | ||
12918 | /*! PDEN_SYSOSC - System Oscillator Power (also, enable/disable bit 9 in PDRUNCFG0 register). | ||
12919 | */ | ||
12920 | #define SYSCON_PDSLEEPCFG_PDEN_SYSOSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_SYSOSC_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_SYSOSC_MASK) | ||
12921 | #define SYSCON_PDSLEEPCFG_PDEN_FRO_MASK (0x10U) | ||
12922 | #define SYSCON_PDSLEEPCFG_PDEN_FRO_SHIFT (4U) | ||
12923 | /*! PDEN_FRO - FRO oscillator. | ||
12924 | */ | ||
12925 | #define SYSCON_PDSLEEPCFG_PDEN_FRO(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_FRO_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_FRO_MASK) | ||
12926 | #define SYSCON_PDSLEEPCFG_PDEN_TS_MASK (0x40U) | ||
12927 | #define SYSCON_PDSLEEPCFG_PDEN_TS_SHIFT (6U) | ||
12928 | /*! PDEN_TS - Temp sensor. | ||
12929 | */ | ||
12930 | #define SYSCON_PDSLEEPCFG_PDEN_TS(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_TS_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_TS_MASK) | ||
12931 | #define SYSCON_PDSLEEPCFG_PDEN_BOD_RST_MASK (0x80U) | ||
12932 | #define SYSCON_PDSLEEPCFG_PDEN_BOD_RST_SHIFT (7U) | ||
12933 | /*! PDEN_BOD_RST - Brown-out Detect reset. | ||
12934 | */ | ||
12935 | #define SYSCON_PDSLEEPCFG_PDEN_BOD_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_BOD_RST_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_BOD_RST_MASK) | ||
12936 | #define SYSCON_PDSLEEPCFG_PDEN_RNG_MASK (0x80U) | ||
12937 | #define SYSCON_PDSLEEPCFG_PDEN_RNG_SHIFT (7U) | ||
12938 | /*! PDEN_RNG - Random Number Generator Power. | ||
12939 | */ | ||
12940 | #define SYSCON_PDSLEEPCFG_PDEN_RNG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_RNG_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_RNG_MASK) | ||
12941 | #define SYSCON_PDSLEEPCFG_PDEN_BOD_INTR_MASK (0x100U) | ||
12942 | #define SYSCON_PDSLEEPCFG_PDEN_BOD_INTR_SHIFT (8U) | ||
12943 | /*! PDEN_BOD_INTR - Brown-out Detect interrupt. | ||
12944 | */ | ||
12945 | #define SYSCON_PDSLEEPCFG_PDEN_BOD_INTR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_BOD_INTR_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_BOD_INTR_MASK) | ||
12946 | #define SYSCON_PDSLEEPCFG_PDEN_VD2_ANA_MASK (0x200U) | ||
12947 | #define SYSCON_PDSLEEPCFG_PDEN_VD2_ANA_SHIFT (9U) | ||
12948 | /*! PDEN_VD2_ANA - Analog supply for System Oscillator (also enable/disable bit 3 in PDRUNCFG1 | ||
12949 | * register), Temperature Sensor (also, enable/disable bit 6), ADC (also, enable/disable bits 10, 19, | ||
12950 | * and 23). | ||
12951 | */ | ||
12952 | #define SYSCON_PDSLEEPCFG_PDEN_VD2_ANA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_VD2_ANA_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_VD2_ANA_MASK) | ||
12953 | #define SYSCON_PDSLEEPCFG_PDEN_ADC0_MASK (0x400U) | ||
12954 | #define SYSCON_PDSLEEPCFG_PDEN_ADC0_SHIFT (10U) | ||
12955 | /*! PDEN_ADC0 - ADC power. | ||
12956 | */ | ||
12957 | #define SYSCON_PDSLEEPCFG_PDEN_ADC0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_ADC0_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_ADC0_MASK) | ||
12958 | #define SYSCON_PDSLEEPCFG_PDEN_SRAMX_MASK (0x2000U) | ||
12959 | #define SYSCON_PDSLEEPCFG_PDEN_SRAMX_SHIFT (13U) | ||
12960 | /*! PDEN_SRAMX - PDEN_SRAMX controls SRAMX (also enable/disable bit 27). | ||
12961 | */ | ||
12962 | #define SYSCON_PDSLEEPCFG_PDEN_SRAMX(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_SRAMX_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_SRAMX_MASK) | ||
12963 | #define SYSCON_PDSLEEPCFG_PDEN_SRAM0_MASK (0x4000U) | ||
12964 | #define SYSCON_PDSLEEPCFG_PDEN_SRAM0_SHIFT (14U) | ||
12965 | /*! PDEN_SRAM0 - PDEN_SRAM0 controls SRAM0 (also enable/disable bit 27). | ||
12966 | */ | ||
12967 | #define SYSCON_PDSLEEPCFG_PDEN_SRAM0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_SRAM0_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_SRAM0_MASK) | ||
12968 | #define SYSCON_PDSLEEPCFG_PDEN_SRAM1_2_3_MASK (0x8000U) | ||
12969 | #define SYSCON_PDSLEEPCFG_PDEN_SRAM1_2_3_SHIFT (15U) | ||
12970 | /*! PDEN_SRAM1_2_3 - PDEN_SRAM1_2_3 controls SRAM1, SRAM2, and SRAM3 (also enable/disable bit 27). | ||
12971 | */ | ||
12972 | #define SYSCON_PDSLEEPCFG_PDEN_SRAM1_2_3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_SRAM1_2_3_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_SRAM1_2_3_MASK) | ||
12973 | #define SYSCON_PDSLEEPCFG_PDEN_USB_RAM_MASK (0x10000U) | ||
12974 | #define SYSCON_PDSLEEPCFG_PDEN_USB_RAM_SHIFT (16U) | ||
12975 | /*! PDEN_USB_RAM - PDEN_USB_SRAM controls USB_RAM (also enable/disable bit 27). | ||
12976 | */ | ||
12977 | #define SYSCON_PDSLEEPCFG_PDEN_USB_RAM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_USB_RAM_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_USB_RAM_MASK) | ||
12978 | #define SYSCON_PDSLEEPCFG_PDEN_ROM_MASK (0x20000U) | ||
12979 | #define SYSCON_PDSLEEPCFG_PDEN_ROM_SHIFT (17U) | ||
12980 | /*! PDEN_ROM - ROM (also enable/disable bit 27). | ||
12981 | */ | ||
12982 | #define SYSCON_PDSLEEPCFG_PDEN_ROM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_ROM_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_ROM_MASK) | ||
12983 | #define SYSCON_PDSLEEPCFG_PDEN_VDDA_MASK (0x80000U) | ||
12984 | #define SYSCON_PDSLEEPCFG_PDEN_VDDA_SHIFT (19U) | ||
12985 | /*! PDEN_VDDA - Vdda to the ADC, must be enabled for the ADC to work (also enable/disable bit 9, 10, and 23). | ||
12986 | */ | ||
12987 | #define SYSCON_PDSLEEPCFG_PDEN_VDDA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_VDDA_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_VDDA_MASK) | ||
12988 | #define SYSCON_PDSLEEPCFG_PDEN_WDT_OSC_MASK (0x100000U) | ||
12989 | #define SYSCON_PDSLEEPCFG_PDEN_WDT_OSC_SHIFT (20U) | ||
12990 | /*! PDEN_WDT_OSC - Watchdog oscillator. | ||
12991 | */ | ||
12992 | #define SYSCON_PDSLEEPCFG_PDEN_WDT_OSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_WDT_OSC_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_WDT_OSC_MASK) | ||
12993 | #define SYSCON_PDSLEEPCFG_PDEN_USB0_PHY_MASK (0x200000U) | ||
12994 | #define SYSCON_PDSLEEPCFG_PDEN_USB0_PHY_SHIFT (21U) | ||
12995 | /*! PDEN_USB0_PHY - USB0 PHY power (also enable/disable bit 28). | ||
12996 | */ | ||
12997 | #define SYSCON_PDSLEEPCFG_PDEN_USB0_PHY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_USB0_PHY_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_USB0_PHY_MASK) | ||
12998 | #define SYSCON_PDSLEEPCFG_PDEN_SYS_PLL_MASK (0x400000U) | ||
12999 | #define SYSCON_PDSLEEPCFG_PDEN_SYS_PLL_SHIFT (22U) | ||
13000 | /*! PDEN_SYS_PLL - System PLL (PLL0) power (also enable/disable bit 26). | ||
13001 | */ | ||
13002 | #define SYSCON_PDSLEEPCFG_PDEN_SYS_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_SYS_PLL_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_SYS_PLL_MASK) | ||
13003 | #define SYSCON_PDSLEEPCFG_PDEN_VREFP_MASK (0x800000U) | ||
13004 | #define SYSCON_PDSLEEPCFG_PDEN_VREFP_SHIFT (23U) | ||
13005 | /*! PDEN_VREFP - VREFP to the ADC must be enabled for the ADC to work (also enable/disable bit 9, 10, and 19). | ||
13006 | */ | ||
13007 | #define SYSCON_PDSLEEPCFG_PDEN_VREFP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_VREFP_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_VREFP_MASK) | ||
13008 | #define SYSCON_PDSLEEPCFG_PDEN_VD3_MASK (0x4000000U) | ||
13009 | #define SYSCON_PDSLEEPCFG_PDEN_VD3_SHIFT (26U) | ||
13010 | /*! PDEN_VD3 - Power control for all PLLs. | ||
13011 | */ | ||
13012 | #define SYSCON_PDSLEEPCFG_PDEN_VD3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_VD3_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_VD3_MASK) | ||
13013 | #define SYSCON_PDSLEEPCFG_PDEN_VD4_MASK (0x8000000U) | ||
13014 | #define SYSCON_PDSLEEPCFG_PDEN_VD4_SHIFT (27U) | ||
13015 | /*! PDEN_VD4 - Power control for all SRAMs and ROM. | ||
13016 | */ | ||
13017 | #define SYSCON_PDSLEEPCFG_PDEN_VD4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_VD4_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_VD4_MASK) | ||
13018 | #define SYSCON_PDSLEEPCFG_PDEN_VD5_MASK (0x10000000U) | ||
13019 | #define SYSCON_PDSLEEPCFG_PDEN_VD5_SHIFT (28U) | ||
13020 | /*! PDEN_VD5 - Power control both USB0 PHY and USB1 PHY. | ||
13021 | */ | ||
13022 | #define SYSCON_PDSLEEPCFG_PDEN_VD5(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_VD5_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_VD5_MASK) | ||
13023 | #define SYSCON_PDSLEEPCFG_PDEN_VD6_MASK (0x20000000U) | ||
13024 | #define SYSCON_PDSLEEPCFG_PDEN_VD6_SHIFT (29U) | ||
13025 | /*! PDEN_VD6 - Power control for EEPROM. | ||
13026 | */ | ||
13027 | #define SYSCON_PDSLEEPCFG_PDEN_VD6(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDSLEEPCFG_PDEN_VD6_SHIFT)) & SYSCON_PDSLEEPCFG_PDEN_VD6_MASK) | ||
13028 | /*! @} */ | ||
13029 | |||
13030 | /* The count of SYSCON_PDSLEEPCFG */ | ||
13031 | #define SYSCON_PDSLEEPCFG_COUNT (2U) | ||
13032 | |||
13033 | /*! @name PDRUNCFG - Power configuration register */ | ||
13034 | /*! @{ */ | ||
13035 | #define SYSCON_PDRUNCFG_PDEN_USB1_PHY_MASK (0x1U) | ||
13036 | #define SYSCON_PDRUNCFG_PDEN_USB1_PHY_SHIFT (0U) | ||
13037 | /*! PDEN_USB1_PHY - USB1 high speed PHY (also, enable/disable bit 28 in PDRUNCFG0 register). | ||
13038 | */ | ||
13039 | #define SYSCON_PDRUNCFG_PDEN_USB1_PHY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_USB1_PHY_SHIFT)) & SYSCON_PDRUNCFG_PDEN_USB1_PHY_MASK) | ||
13040 | #define SYSCON_PDRUNCFG_PDEN_USB1_PLL_MASK (0x2U) | ||
13041 | #define SYSCON_PDRUNCFG_PDEN_USB1_PLL_SHIFT (1U) | ||
13042 | /*! PDEN_USB1_PLL - USB PLL (PLL1) power (also, enable/disable bit 26 in PDRUNCFG0 register). | ||
13043 | */ | ||
13044 | #define SYSCON_PDRUNCFG_PDEN_USB1_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_USB1_PLL_SHIFT)) & SYSCON_PDRUNCFG_PDEN_USB1_PLL_MASK) | ||
13045 | #define SYSCON_PDRUNCFG_PDEN_AUD_PLL_MASK (0x4U) | ||
13046 | #define SYSCON_PDRUNCFG_PDEN_AUD_PLL_SHIFT (2U) | ||
13047 | /*! PDEN_AUD_PLL - Audio PLL (PLL2) power and fractional divider (also, enable/disable bit 26 in PDRUNCFG0 register). | ||
13048 | */ | ||
13049 | #define SYSCON_PDRUNCFG_PDEN_AUD_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_AUD_PLL_SHIFT)) & SYSCON_PDRUNCFG_PDEN_AUD_PLL_MASK) | ||
13050 | #define SYSCON_PDRUNCFG_PDEN_SYSOSC_MASK (0x8U) | ||
13051 | #define SYSCON_PDRUNCFG_PDEN_SYSOSC_SHIFT (3U) | ||
13052 | /*! PDEN_SYSOSC - System Oscillator Power (also, enable/disable bit 9 in PDRUNCFG0 register). | ||
13053 | */ | ||
13054 | #define SYSCON_PDRUNCFG_PDEN_SYSOSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_SYSOSC_SHIFT)) & SYSCON_PDRUNCFG_PDEN_SYSOSC_MASK) | ||
13055 | #define SYSCON_PDRUNCFG_PDEN_FRO_MASK (0x10U) | ||
13056 | #define SYSCON_PDRUNCFG_PDEN_FRO_SHIFT (4U) | ||
13057 | /*! PDEN_FRO - FRO oscillator. | ||
13058 | */ | ||
13059 | #define SYSCON_PDRUNCFG_PDEN_FRO(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_FRO_SHIFT)) & SYSCON_PDRUNCFG_PDEN_FRO_MASK) | ||
13060 | #define SYSCON_PDRUNCFG_PDEN_TS_MASK (0x40U) | ||
13061 | #define SYSCON_PDRUNCFG_PDEN_TS_SHIFT (6U) | ||
13062 | /*! PDEN_TS - Temp sensor. | ||
13063 | */ | ||
13064 | #define SYSCON_PDRUNCFG_PDEN_TS(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_TS_SHIFT)) & SYSCON_PDRUNCFG_PDEN_TS_MASK) | ||
13065 | #define SYSCON_PDRUNCFG_PDEN_BOD_RST_MASK (0x80U) | ||
13066 | #define SYSCON_PDRUNCFG_PDEN_BOD_RST_SHIFT (7U) | ||
13067 | /*! PDEN_BOD_RST - Brown-out Detect reset. | ||
13068 | */ | ||
13069 | #define SYSCON_PDRUNCFG_PDEN_BOD_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_BOD_RST_SHIFT)) & SYSCON_PDRUNCFG_PDEN_BOD_RST_MASK) | ||
13070 | #define SYSCON_PDRUNCFG_PDEN_RNG_MASK (0x80U) | ||
13071 | #define SYSCON_PDRUNCFG_PDEN_RNG_SHIFT (7U) | ||
13072 | /*! PDEN_RNG - Random Number Generator Power. | ||
13073 | */ | ||
13074 | #define SYSCON_PDRUNCFG_PDEN_RNG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_RNG_SHIFT)) & SYSCON_PDRUNCFG_PDEN_RNG_MASK) | ||
13075 | #define SYSCON_PDRUNCFG_PDEN_BOD_INTR_MASK (0x100U) | ||
13076 | #define SYSCON_PDRUNCFG_PDEN_BOD_INTR_SHIFT (8U) | ||
13077 | /*! PDEN_BOD_INTR - Brown-out Detect interrupt. | ||
13078 | */ | ||
13079 | #define SYSCON_PDRUNCFG_PDEN_BOD_INTR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_BOD_INTR_SHIFT)) & SYSCON_PDRUNCFG_PDEN_BOD_INTR_MASK) | ||
13080 | #define SYSCON_PDRUNCFG_PDEN_VD2_ANA_MASK (0x200U) | ||
13081 | #define SYSCON_PDRUNCFG_PDEN_VD2_ANA_SHIFT (9U) | ||
13082 | /*! PDEN_VD2_ANA - Analog supply for System Oscillator (also enable/disable bit 3 in PDRUNCFG1 | ||
13083 | * register), Temperature Sensor (also, enable/disable bit 6), ADC (also, enable/disable bits 10, 19, | ||
13084 | * and 23). | ||
13085 | */ | ||
13086 | #define SYSCON_PDRUNCFG_PDEN_VD2_ANA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_VD2_ANA_SHIFT)) & SYSCON_PDRUNCFG_PDEN_VD2_ANA_MASK) | ||
13087 | #define SYSCON_PDRUNCFG_PDEN_ADC0_MASK (0x400U) | ||
13088 | #define SYSCON_PDRUNCFG_PDEN_ADC0_SHIFT (10U) | ||
13089 | /*! PDEN_ADC0 - ADC power. | ||
13090 | */ | ||
13091 | #define SYSCON_PDRUNCFG_PDEN_ADC0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_ADC0_SHIFT)) & SYSCON_PDRUNCFG_PDEN_ADC0_MASK) | ||
13092 | #define SYSCON_PDRUNCFG_PDEN_SRAMX_MASK (0x2000U) | ||
13093 | #define SYSCON_PDRUNCFG_PDEN_SRAMX_SHIFT (13U) | ||
13094 | /*! PDEN_SRAMX - PPDEN_SRAMX controls only SRAMX address 0x0 to 0x0000FFFF.Bit 29 (PDEN_VD6) | ||
13095 | * controls SRAMX address 0x00010000 to 0x0002FFFF.. | ||
13096 | */ | ||
13097 | #define SYSCON_PDRUNCFG_PDEN_SRAMX(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_SRAMX_SHIFT)) & SYSCON_PDRUNCFG_PDEN_SRAMX_MASK) | ||
13098 | #define SYSCON_PDRUNCFG_PDEN_SRAM0_MASK (0x4000U) | ||
13099 | #define SYSCON_PDRUNCFG_PDEN_SRAM0_SHIFT (14U) | ||
13100 | /*! PDEN_SRAM0 - PDEN_SRAM0 controls SRAM0 (also enable/disable bit 27). | ||
13101 | */ | ||
13102 | #define SYSCON_PDRUNCFG_PDEN_SRAM0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_SRAM0_SHIFT)) & SYSCON_PDRUNCFG_PDEN_SRAM0_MASK) | ||
13103 | #define SYSCON_PDRUNCFG_PDEN_SRAM1_2_3_MASK (0x8000U) | ||
13104 | #define SYSCON_PDRUNCFG_PDEN_SRAM1_2_3_SHIFT (15U) | ||
13105 | /*! PDEN_SRAM1_2_3 - PDEN_SRAM1_2_3 controls SRAM1, SRAM2, and SRAM3 (also enable/disable bit 27). | ||
13106 | */ | ||
13107 | #define SYSCON_PDRUNCFG_PDEN_SRAM1_2_3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_SRAM1_2_3_SHIFT)) & SYSCON_PDRUNCFG_PDEN_SRAM1_2_3_MASK) | ||
13108 | #define SYSCON_PDRUNCFG_PDEN_USB_RAM_MASK (0x10000U) | ||
13109 | #define SYSCON_PDRUNCFG_PDEN_USB_RAM_SHIFT (16U) | ||
13110 | /*! PDEN_USB_RAM - PDEN_USB_SRAM controls USB_RAM (also enable/disable bit 27). | ||
13111 | */ | ||
13112 | #define SYSCON_PDRUNCFG_PDEN_USB_RAM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_USB_RAM_SHIFT)) & SYSCON_PDRUNCFG_PDEN_USB_RAM_MASK) | ||
13113 | #define SYSCON_PDRUNCFG_PDEN_ROM_MASK (0x20000U) | ||
13114 | #define SYSCON_PDRUNCFG_PDEN_ROM_SHIFT (17U) | ||
13115 | /*! PDEN_ROM - ROM (also enable/disable bit 27). | ||
13116 | */ | ||
13117 | #define SYSCON_PDRUNCFG_PDEN_ROM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_ROM_SHIFT)) & SYSCON_PDRUNCFG_PDEN_ROM_MASK) | ||
13118 | #define SYSCON_PDRUNCFG_PDEN_VDDA_MASK (0x80000U) | ||
13119 | #define SYSCON_PDRUNCFG_PDEN_VDDA_SHIFT (19U) | ||
13120 | /*! PDEN_VDDA - Vdda to the ADC, must be enabled for the ADC to work (also enable/disable bit 9, 10, and 23). | ||
13121 | */ | ||
13122 | #define SYSCON_PDRUNCFG_PDEN_VDDA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_VDDA_SHIFT)) & SYSCON_PDRUNCFG_PDEN_VDDA_MASK) | ||
13123 | #define SYSCON_PDRUNCFG_PDEN_WDT_OSC_MASK (0x100000U) | ||
13124 | #define SYSCON_PDRUNCFG_PDEN_WDT_OSC_SHIFT (20U) | ||
13125 | /*! PDEN_WDT_OSC - Watchdog oscillator. | ||
13126 | */ | ||
13127 | #define SYSCON_PDRUNCFG_PDEN_WDT_OSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_WDT_OSC_SHIFT)) & SYSCON_PDRUNCFG_PDEN_WDT_OSC_MASK) | ||
13128 | #define SYSCON_PDRUNCFG_PDEN_USB0_PHY_MASK (0x200000U) | ||
13129 | #define SYSCON_PDRUNCFG_PDEN_USB0_PHY_SHIFT (21U) | ||
13130 | /*! PDEN_USB0_PHY - USB0 PHY power (also enable/disable bit 28). | ||
13131 | */ | ||
13132 | #define SYSCON_PDRUNCFG_PDEN_USB0_PHY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_USB0_PHY_SHIFT)) & SYSCON_PDRUNCFG_PDEN_USB0_PHY_MASK) | ||
13133 | #define SYSCON_PDRUNCFG_PDEN_SYS_PLL_MASK (0x400000U) | ||
13134 | #define SYSCON_PDRUNCFG_PDEN_SYS_PLL_SHIFT (22U) | ||
13135 | /*! PDEN_SYS_PLL - System PLL (PLL0) power (also enable/disable bit 26). | ||
13136 | */ | ||
13137 | #define SYSCON_PDRUNCFG_PDEN_SYS_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_SYS_PLL_SHIFT)) & SYSCON_PDRUNCFG_PDEN_SYS_PLL_MASK) | ||
13138 | #define SYSCON_PDRUNCFG_PDEN_VREFP_MASK (0x800000U) | ||
13139 | #define SYSCON_PDRUNCFG_PDEN_VREFP_SHIFT (23U) | ||
13140 | /*! PDEN_VREFP - VREFP to the ADC must be enabled for the ADC to work (also enable/disable bit 9, 10, and 19). | ||
13141 | */ | ||
13142 | #define SYSCON_PDRUNCFG_PDEN_VREFP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_VREFP_SHIFT)) & SYSCON_PDRUNCFG_PDEN_VREFP_MASK) | ||
13143 | #define SYSCON_PDRUNCFG_PDEN_VD3_MASK (0x4000000U) | ||
13144 | #define SYSCON_PDRUNCFG_PDEN_VD3_SHIFT (26U) | ||
13145 | /*! PDEN_VD3 - Power control for all PLLs. | ||
13146 | */ | ||
13147 | #define SYSCON_PDRUNCFG_PDEN_VD3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_VD3_SHIFT)) & SYSCON_PDRUNCFG_PDEN_VD3_MASK) | ||
13148 | #define SYSCON_PDRUNCFG_PDEN_VD4_MASK (0x8000000U) | ||
13149 | #define SYSCON_PDRUNCFG_PDEN_VD4_SHIFT (27U) | ||
13150 | /*! PDEN_VD4 - Power control for all SRAMs and ROM. | ||
13151 | */ | ||
13152 | #define SYSCON_PDRUNCFG_PDEN_VD4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_VD4_SHIFT)) & SYSCON_PDRUNCFG_PDEN_VD4_MASK) | ||
13153 | #define SYSCON_PDRUNCFG_PDEN_VD5_MASK (0x10000000U) | ||
13154 | #define SYSCON_PDRUNCFG_PDEN_VD5_SHIFT (28U) | ||
13155 | /*! PDEN_VD5 - Power control both USB0 PHY and USB1 PHY. | ||
13156 | */ | ||
13157 | #define SYSCON_PDRUNCFG_PDEN_VD5(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_VD5_SHIFT)) & SYSCON_PDRUNCFG_PDEN_VD5_MASK) | ||
13158 | #define SYSCON_PDRUNCFG_PDEN_VD6_MASK (0x20000000U) | ||
13159 | #define SYSCON_PDRUNCFG_PDEN_VD6_SHIFT (29U) | ||
13160 | /*! PDEN_VD6 - Power control for OTP and SRAMX from address 0x00010000 to 0x0002FFFF. | ||
13161 | */ | ||
13162 | #define SYSCON_PDRUNCFG_PDEN_VD6(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFG_PDEN_VD6_SHIFT)) & SYSCON_PDRUNCFG_PDEN_VD6_MASK) | ||
13163 | /*! @} */ | ||
13164 | |||
13165 | /* The count of SYSCON_PDRUNCFG */ | ||
13166 | #define SYSCON_PDRUNCFG_COUNT (2U) | ||
13167 | |||
13168 | /*! @name PDRUNCFGSET - Power configuration set register */ | ||
13169 | /*! @{ */ | ||
13170 | #define SYSCON_PDRUNCFGSET_PDEN_USB1_PHY_MASK (0x1U) | ||
13171 | #define SYSCON_PDRUNCFGSET_PDEN_USB1_PHY_SHIFT (0U) | ||
13172 | /*! PDEN_USB1_PHY - USB1 high speed PHY (also, enable/disable bit 28 in PDRUNCFG0 register). | ||
13173 | */ | ||
13174 | #define SYSCON_PDRUNCFGSET_PDEN_USB1_PHY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_USB1_PHY_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_USB1_PHY_MASK) | ||
13175 | #define SYSCON_PDRUNCFGSET_PDEN_USB1_PLL_MASK (0x2U) | ||
13176 | #define SYSCON_PDRUNCFGSET_PDEN_USB1_PLL_SHIFT (1U) | ||
13177 | /*! PDEN_USB1_PLL - USB PLL (PLL1) power (also, enable/disable bit 26 in PDRUNCFG0 register). | ||
13178 | */ | ||
13179 | #define SYSCON_PDRUNCFGSET_PDEN_USB1_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_USB1_PLL_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_USB1_PLL_MASK) | ||
13180 | #define SYSCON_PDRUNCFGSET_PDEN_AUD_PLL_MASK (0x4U) | ||
13181 | #define SYSCON_PDRUNCFGSET_PDEN_AUD_PLL_SHIFT (2U) | ||
13182 | /*! PDEN_AUD_PLL - Audio PLL (PLL2) power and fractional divider (also, enable/disable bit 26 in PDRUNCFG0 register). | ||
13183 | */ | ||
13184 | #define SYSCON_PDRUNCFGSET_PDEN_AUD_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_AUD_PLL_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_AUD_PLL_MASK) | ||
13185 | #define SYSCON_PDRUNCFGSET_PDEN_SYSOSC_MASK (0x8U) | ||
13186 | #define SYSCON_PDRUNCFGSET_PDEN_SYSOSC_SHIFT (3U) | ||
13187 | /*! PDEN_SYSOSC - System Oscillator Power (also, enable/disable bit 9 in PDRUNCFG0 register). | ||
13188 | */ | ||
13189 | #define SYSCON_PDRUNCFGSET_PDEN_SYSOSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_SYSOSC_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_SYSOSC_MASK) | ||
13190 | #define SYSCON_PDRUNCFGSET_PDEN_FRO_MASK (0x10U) | ||
13191 | #define SYSCON_PDRUNCFGSET_PDEN_FRO_SHIFT (4U) | ||
13192 | /*! PDEN_FRO - FRO oscillator. | ||
13193 | */ | ||
13194 | #define SYSCON_PDRUNCFGSET_PDEN_FRO(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_FRO_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_FRO_MASK) | ||
13195 | #define SYSCON_PDRUNCFGSET_PDEN_TS_MASK (0x40U) | ||
13196 | #define SYSCON_PDRUNCFGSET_PDEN_TS_SHIFT (6U) | ||
13197 | /*! PDEN_TS - Temp sensor. | ||
13198 | */ | ||
13199 | #define SYSCON_PDRUNCFGSET_PDEN_TS(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_TS_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_TS_MASK) | ||
13200 | #define SYSCON_PDRUNCFGSET_PDEN_BOD_RST_MASK (0x80U) | ||
13201 | #define SYSCON_PDRUNCFGSET_PDEN_BOD_RST_SHIFT (7U) | ||
13202 | /*! PDEN_BOD_RST - Brown-out Detect reset. | ||
13203 | */ | ||
13204 | #define SYSCON_PDRUNCFGSET_PDEN_BOD_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_BOD_RST_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_BOD_RST_MASK) | ||
13205 | #define SYSCON_PDRUNCFGSET_PDEN_RNG_MASK (0x80U) | ||
13206 | #define SYSCON_PDRUNCFGSET_PDEN_RNG_SHIFT (7U) | ||
13207 | /*! PDEN_RNG - Random Number Generator Power. | ||
13208 | */ | ||
13209 | #define SYSCON_PDRUNCFGSET_PDEN_RNG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_RNG_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_RNG_MASK) | ||
13210 | #define SYSCON_PDRUNCFGSET_PDEN_BOD_INTR_MASK (0x100U) | ||
13211 | #define SYSCON_PDRUNCFGSET_PDEN_BOD_INTR_SHIFT (8U) | ||
13212 | /*! PDEN_BOD_INTR - Brown-out Detect interrupt. | ||
13213 | */ | ||
13214 | #define SYSCON_PDRUNCFGSET_PDEN_BOD_INTR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_BOD_INTR_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_BOD_INTR_MASK) | ||
13215 | #define SYSCON_PDRUNCFGSET_PDEN_VD2_ANA_MASK (0x200U) | ||
13216 | #define SYSCON_PDRUNCFGSET_PDEN_VD2_ANA_SHIFT (9U) | ||
13217 | /*! PDEN_VD2_ANA - Analog supply for System Oscillator (also enable/disable bit 3 in PDRUNCFG1 | ||
13218 | * register), Temperature Sensor (also, enable/disable bit 6), ADC (also, enable/disable bits 10, 19, | ||
13219 | * and 23). | ||
13220 | */ | ||
13221 | #define SYSCON_PDRUNCFGSET_PDEN_VD2_ANA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_VD2_ANA_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_VD2_ANA_MASK) | ||
13222 | #define SYSCON_PDRUNCFGSET_PDEN_ADC0_MASK (0x400U) | ||
13223 | #define SYSCON_PDRUNCFGSET_PDEN_ADC0_SHIFT (10U) | ||
13224 | /*! PDEN_ADC0 - ADC power. | ||
13225 | */ | ||
13226 | #define SYSCON_PDRUNCFGSET_PDEN_ADC0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_ADC0_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_ADC0_MASK) | ||
13227 | #define SYSCON_PDRUNCFGSET_PDEN_SRAMX_MASK (0x2000U) | ||
13228 | #define SYSCON_PDRUNCFGSET_PDEN_SRAMX_SHIFT (13U) | ||
13229 | /*! PDEN_SRAMX - PDEN_SRAMX controls SRAMX (also enable/disable bit 27). | ||
13230 | */ | ||
13231 | #define SYSCON_PDRUNCFGSET_PDEN_SRAMX(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_SRAMX_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_SRAMX_MASK) | ||
13232 | #define SYSCON_PDRUNCFGSET_PDEN_SRAM0_MASK (0x4000U) | ||
13233 | #define SYSCON_PDRUNCFGSET_PDEN_SRAM0_SHIFT (14U) | ||
13234 | /*! PDEN_SRAM0 - PDEN_SRAM0 controls SRAM0 (also enable/disable bit 27). | ||
13235 | */ | ||
13236 | #define SYSCON_PDRUNCFGSET_PDEN_SRAM0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_SRAM0_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_SRAM0_MASK) | ||
13237 | #define SYSCON_PDRUNCFGSET_PDEN_SRAM1_2_3_MASK (0x8000U) | ||
13238 | #define SYSCON_PDRUNCFGSET_PDEN_SRAM1_2_3_SHIFT (15U) | ||
13239 | /*! PDEN_SRAM1_2_3 - PDEN_SRAM1_2_3 controls SRAM1, SRAM2, and SRAM3 (also enable/disable bit 27). | ||
13240 | */ | ||
13241 | #define SYSCON_PDRUNCFGSET_PDEN_SRAM1_2_3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_SRAM1_2_3_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_SRAM1_2_3_MASK) | ||
13242 | #define SYSCON_PDRUNCFGSET_PDEN_USB_RAM_MASK (0x10000U) | ||
13243 | #define SYSCON_PDRUNCFGSET_PDEN_USB_RAM_SHIFT (16U) | ||
13244 | /*! PDEN_USB_RAM - PDEN_USB_SRAM controls USB_RAM (also enable/disable bit 27). | ||
13245 | */ | ||
13246 | #define SYSCON_PDRUNCFGSET_PDEN_USB_RAM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_USB_RAM_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_USB_RAM_MASK) | ||
13247 | #define SYSCON_PDRUNCFGSET_PDEN_ROM_MASK (0x20000U) | ||
13248 | #define SYSCON_PDRUNCFGSET_PDEN_ROM_SHIFT (17U) | ||
13249 | /*! PDEN_ROM - ROM (also enable/disable bit 27). | ||
13250 | */ | ||
13251 | #define SYSCON_PDRUNCFGSET_PDEN_ROM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_ROM_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_ROM_MASK) | ||
13252 | #define SYSCON_PDRUNCFGSET_PDEN_VDDA_MASK (0x80000U) | ||
13253 | #define SYSCON_PDRUNCFGSET_PDEN_VDDA_SHIFT (19U) | ||
13254 | /*! PDEN_VDDA - Vdda to the ADC, must be enabled for the ADC to work (also enable/disable bit 9, 10, and 23). | ||
13255 | */ | ||
13256 | #define SYSCON_PDRUNCFGSET_PDEN_VDDA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_VDDA_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_VDDA_MASK) | ||
13257 | #define SYSCON_PDRUNCFGSET_PDEN_WDT_OSC_MASK (0x100000U) | ||
13258 | #define SYSCON_PDRUNCFGSET_PDEN_WDT_OSC_SHIFT (20U) | ||
13259 | /*! PDEN_WDT_OSC - Watchdog oscillator. | ||
13260 | */ | ||
13261 | #define SYSCON_PDRUNCFGSET_PDEN_WDT_OSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_WDT_OSC_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_WDT_OSC_MASK) | ||
13262 | #define SYSCON_PDRUNCFGSET_PDEN_USB0_PHY_MASK (0x200000U) | ||
13263 | #define SYSCON_PDRUNCFGSET_PDEN_USB0_PHY_SHIFT (21U) | ||
13264 | /*! PDEN_USB0_PHY - USB0 PHY power (also enable/disable bit 28). | ||
13265 | */ | ||
13266 | #define SYSCON_PDRUNCFGSET_PDEN_USB0_PHY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_USB0_PHY_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_USB0_PHY_MASK) | ||
13267 | #define SYSCON_PDRUNCFGSET_PDEN_SYS_PLL_MASK (0x400000U) | ||
13268 | #define SYSCON_PDRUNCFGSET_PDEN_SYS_PLL_SHIFT (22U) | ||
13269 | /*! PDEN_SYS_PLL - System PLL (PLL0) power (also enable/disable bit 26). | ||
13270 | */ | ||
13271 | #define SYSCON_PDRUNCFGSET_PDEN_SYS_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_SYS_PLL_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_SYS_PLL_MASK) | ||
13272 | #define SYSCON_PDRUNCFGSET_PDEN_VREFP_MASK (0x800000U) | ||
13273 | #define SYSCON_PDRUNCFGSET_PDEN_VREFP_SHIFT (23U) | ||
13274 | /*! PDEN_VREFP - VREFP to the ADC must be enabled for the ADC to work (also enable/disable bit 9, 10, and 19). | ||
13275 | */ | ||
13276 | #define SYSCON_PDRUNCFGSET_PDEN_VREFP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_VREFP_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_VREFP_MASK) | ||
13277 | #define SYSCON_PDRUNCFGSET_PDEN_VD3_MASK (0x4000000U) | ||
13278 | #define SYSCON_PDRUNCFGSET_PDEN_VD3_SHIFT (26U) | ||
13279 | /*! PDEN_VD3 - Power control for all PLLs. | ||
13280 | */ | ||
13281 | #define SYSCON_PDRUNCFGSET_PDEN_VD3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_VD3_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_VD3_MASK) | ||
13282 | #define SYSCON_PDRUNCFGSET_PDEN_VD4_MASK (0x8000000U) | ||
13283 | #define SYSCON_PDRUNCFGSET_PDEN_VD4_SHIFT (27U) | ||
13284 | /*! PDEN_VD4 - Power control for all SRAMs and ROM. | ||
13285 | */ | ||
13286 | #define SYSCON_PDRUNCFGSET_PDEN_VD4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_VD4_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_VD4_MASK) | ||
13287 | #define SYSCON_PDRUNCFGSET_PDEN_VD5_MASK (0x10000000U) | ||
13288 | #define SYSCON_PDRUNCFGSET_PDEN_VD5_SHIFT (28U) | ||
13289 | /*! PDEN_VD5 - Power control both USB0 PHY and USB1 PHY. | ||
13290 | */ | ||
13291 | #define SYSCON_PDRUNCFGSET_PDEN_VD5(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_VD5_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_VD5_MASK) | ||
13292 | #define SYSCON_PDRUNCFGSET_PDEN_VD6_MASK (0x20000000U) | ||
13293 | #define SYSCON_PDRUNCFGSET_PDEN_VD6_SHIFT (29U) | ||
13294 | /*! PDEN_VD6 - Power control for EEPROM. | ||
13295 | */ | ||
13296 | #define SYSCON_PDRUNCFGSET_PDEN_VD6(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGSET_PDEN_VD6_SHIFT)) & SYSCON_PDRUNCFGSET_PDEN_VD6_MASK) | ||
13297 | /*! @} */ | ||
13298 | |||
13299 | /* The count of SYSCON_PDRUNCFGSET */ | ||
13300 | #define SYSCON_PDRUNCFGSET_COUNT (2U) | ||
13301 | |||
13302 | /*! @name PDRUNCFGCLR - Power configuration clear register */ | ||
13303 | /*! @{ */ | ||
13304 | #define SYSCON_PDRUNCFGCLR_PDEN_USB1_PHY_MASK (0x1U) | ||
13305 | #define SYSCON_PDRUNCFGCLR_PDEN_USB1_PHY_SHIFT (0U) | ||
13306 | /*! PDEN_USB1_PHY - USB1 high speed PHY (also, enable/disable bit 28 in PDRUNCFG0 register). | ||
13307 | */ | ||
13308 | #define SYSCON_PDRUNCFGCLR_PDEN_USB1_PHY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_USB1_PHY_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_USB1_PHY_MASK) | ||
13309 | #define SYSCON_PDRUNCFGCLR_PDEN_USB1_PLL_MASK (0x2U) | ||
13310 | #define SYSCON_PDRUNCFGCLR_PDEN_USB1_PLL_SHIFT (1U) | ||
13311 | /*! PDEN_USB1_PLL - USB PLL (PLL1) power (also, enable/disable bit 26 in PDRUNCFG0 register). | ||
13312 | */ | ||
13313 | #define SYSCON_PDRUNCFGCLR_PDEN_USB1_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_USB1_PLL_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_USB1_PLL_MASK) | ||
13314 | #define SYSCON_PDRUNCFGCLR_PDEN_AUD_PLL_MASK (0x4U) | ||
13315 | #define SYSCON_PDRUNCFGCLR_PDEN_AUD_PLL_SHIFT (2U) | ||
13316 | /*! PDEN_AUD_PLL - Audio PLL (PLL2) power and fractional divider (also, enable/disable bit 26 in PDRUNCFG0 register). | ||
13317 | */ | ||
13318 | #define SYSCON_PDRUNCFGCLR_PDEN_AUD_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_AUD_PLL_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_AUD_PLL_MASK) | ||
13319 | #define SYSCON_PDRUNCFGCLR_PDEN_SYSOSC_MASK (0x8U) | ||
13320 | #define SYSCON_PDRUNCFGCLR_PDEN_SYSOSC_SHIFT (3U) | ||
13321 | /*! PDEN_SYSOSC - System Oscillator Power (also, enable/disable bit 9 in PDRUNCFG0 register). | ||
13322 | */ | ||
13323 | #define SYSCON_PDRUNCFGCLR_PDEN_SYSOSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_SYSOSC_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_SYSOSC_MASK) | ||
13324 | #define SYSCON_PDRUNCFGCLR_PDEN_FRO_MASK (0x10U) | ||
13325 | #define SYSCON_PDRUNCFGCLR_PDEN_FRO_SHIFT (4U) | ||
13326 | /*! PDEN_FRO - FRO oscillator. | ||
13327 | */ | ||
13328 | #define SYSCON_PDRUNCFGCLR_PDEN_FRO(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_FRO_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_FRO_MASK) | ||
13329 | #define SYSCON_PDRUNCFGCLR_PDEN_TS_MASK (0x40U) | ||
13330 | #define SYSCON_PDRUNCFGCLR_PDEN_TS_SHIFT (6U) | ||
13331 | /*! PDEN_TS - Temp sensor. | ||
13332 | */ | ||
13333 | #define SYSCON_PDRUNCFGCLR_PDEN_TS(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_TS_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_TS_MASK) | ||
13334 | #define SYSCON_PDRUNCFGCLR_PDEN_BOD_RST_MASK (0x80U) | ||
13335 | #define SYSCON_PDRUNCFGCLR_PDEN_BOD_RST_SHIFT (7U) | ||
13336 | /*! PDEN_BOD_RST - Brown-out Detect reset. | ||
13337 | */ | ||
13338 | #define SYSCON_PDRUNCFGCLR_PDEN_BOD_RST(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_BOD_RST_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_BOD_RST_MASK) | ||
13339 | #define SYSCON_PDRUNCFGCLR_PDEN_RNG_MASK (0x80U) | ||
13340 | #define SYSCON_PDRUNCFGCLR_PDEN_RNG_SHIFT (7U) | ||
13341 | /*! PDEN_RNG - Random Number Generator Power. | ||
13342 | */ | ||
13343 | #define SYSCON_PDRUNCFGCLR_PDEN_RNG(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_RNG_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_RNG_MASK) | ||
13344 | #define SYSCON_PDRUNCFGCLR_PDEN_BOD_INTR_MASK (0x100U) | ||
13345 | #define SYSCON_PDRUNCFGCLR_PDEN_BOD_INTR_SHIFT (8U) | ||
13346 | /*! PDEN_BOD_INTR - Brown-out Detect interrupt. | ||
13347 | */ | ||
13348 | #define SYSCON_PDRUNCFGCLR_PDEN_BOD_INTR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_BOD_INTR_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_BOD_INTR_MASK) | ||
13349 | #define SYSCON_PDRUNCFGCLR_PDEN_VD2_ANA_MASK (0x200U) | ||
13350 | #define SYSCON_PDRUNCFGCLR_PDEN_VD2_ANA_SHIFT (9U) | ||
13351 | /*! PDEN_VD2_ANA - Analog supply for System Oscillator (also enable/disable bit 3 in PDRUNCFG1 | ||
13352 | * register), Temperature Sensor (also, enable/disable bit 6), ADC (also, enable/disable bits 10, 19, | ||
13353 | * and 23). | ||
13354 | */ | ||
13355 | #define SYSCON_PDRUNCFGCLR_PDEN_VD2_ANA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_VD2_ANA_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_VD2_ANA_MASK) | ||
13356 | #define SYSCON_PDRUNCFGCLR_PDEN_ADC0_MASK (0x400U) | ||
13357 | #define SYSCON_PDRUNCFGCLR_PDEN_ADC0_SHIFT (10U) | ||
13358 | /*! PDEN_ADC0 - ADC power. | ||
13359 | */ | ||
13360 | #define SYSCON_PDRUNCFGCLR_PDEN_ADC0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_ADC0_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_ADC0_MASK) | ||
13361 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAMX_MASK (0x2000U) | ||
13362 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAMX_SHIFT (13U) | ||
13363 | /*! PDEN_SRAMX - PDEN_SRAMX controls SRAMX (also enable/disable bit 27). | ||
13364 | */ | ||
13365 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAMX(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_SRAMX_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_SRAMX_MASK) | ||
13366 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAM0_MASK (0x4000U) | ||
13367 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAM0_SHIFT (14U) | ||
13368 | /*! PDEN_SRAM0 - PDEN_SRAM0 controls SRAM0 (also enable/disable bit 27). | ||
13369 | */ | ||
13370 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAM0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_SRAM0_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_SRAM0_MASK) | ||
13371 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAM1_2_3_MASK (0x8000U) | ||
13372 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAM1_2_3_SHIFT (15U) | ||
13373 | /*! PDEN_SRAM1_2_3 - PDEN_SRAM1_2_3 controls SRAM1, SRAM2, and SRAM3 (also enable/disable bit 27). | ||
13374 | */ | ||
13375 | #define SYSCON_PDRUNCFGCLR_PDEN_SRAM1_2_3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_SRAM1_2_3_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_SRAM1_2_3_MASK) | ||
13376 | #define SYSCON_PDRUNCFGCLR_PDEN_USB_RAM_MASK (0x10000U) | ||
13377 | #define SYSCON_PDRUNCFGCLR_PDEN_USB_RAM_SHIFT (16U) | ||
13378 | /*! PDEN_USB_RAM - PDEN_USB_SRAM controls USB_RAM (also enable/disable bit 27). | ||
13379 | */ | ||
13380 | #define SYSCON_PDRUNCFGCLR_PDEN_USB_RAM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_USB_RAM_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_USB_RAM_MASK) | ||
13381 | #define SYSCON_PDRUNCFGCLR_PDEN_ROM_MASK (0x20000U) | ||
13382 | #define SYSCON_PDRUNCFGCLR_PDEN_ROM_SHIFT (17U) | ||
13383 | /*! PDEN_ROM - ROM (also enable/disable bit 27). | ||
13384 | */ | ||
13385 | #define SYSCON_PDRUNCFGCLR_PDEN_ROM(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_ROM_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_ROM_MASK) | ||
13386 | #define SYSCON_PDRUNCFGCLR_PDEN_VDDA_MASK (0x80000U) | ||
13387 | #define SYSCON_PDRUNCFGCLR_PDEN_VDDA_SHIFT (19U) | ||
13388 | /*! PDEN_VDDA - Vdda to the ADC, must be enabled for the ADC to work (also enable/disable bit 9, 10, and 23). | ||
13389 | */ | ||
13390 | #define SYSCON_PDRUNCFGCLR_PDEN_VDDA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_VDDA_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_VDDA_MASK) | ||
13391 | #define SYSCON_PDRUNCFGCLR_PDEN_WDT_OSC_MASK (0x100000U) | ||
13392 | #define SYSCON_PDRUNCFGCLR_PDEN_WDT_OSC_SHIFT (20U) | ||
13393 | /*! PDEN_WDT_OSC - Watchdog oscillator. | ||
13394 | */ | ||
13395 | #define SYSCON_PDRUNCFGCLR_PDEN_WDT_OSC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_WDT_OSC_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_WDT_OSC_MASK) | ||
13396 | #define SYSCON_PDRUNCFGCLR_PDEN_USB0_PHY_MASK (0x200000U) | ||
13397 | #define SYSCON_PDRUNCFGCLR_PDEN_USB0_PHY_SHIFT (21U) | ||
13398 | /*! PDEN_USB0_PHY - USB0 PHY power (also enable/disable bit 28). | ||
13399 | */ | ||
13400 | #define SYSCON_PDRUNCFGCLR_PDEN_USB0_PHY(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_USB0_PHY_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_USB0_PHY_MASK) | ||
13401 | #define SYSCON_PDRUNCFGCLR_PDEN_SYS_PLL_MASK (0x400000U) | ||
13402 | #define SYSCON_PDRUNCFGCLR_PDEN_SYS_PLL_SHIFT (22U) | ||
13403 | /*! PDEN_SYS_PLL - System PLL (PLL0) power (also enable/disable bit 26). | ||
13404 | */ | ||
13405 | #define SYSCON_PDRUNCFGCLR_PDEN_SYS_PLL(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_SYS_PLL_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_SYS_PLL_MASK) | ||
13406 | #define SYSCON_PDRUNCFGCLR_PDEN_VREFP_MASK (0x800000U) | ||
13407 | #define SYSCON_PDRUNCFGCLR_PDEN_VREFP_SHIFT (23U) | ||
13408 | /*! PDEN_VREFP - VREFP to the ADC must be enabled for the ADC to work (also enable/disable bit 9, 10, and 19). | ||
13409 | */ | ||
13410 | #define SYSCON_PDRUNCFGCLR_PDEN_VREFP(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_VREFP_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_VREFP_MASK) | ||
13411 | #define SYSCON_PDRUNCFGCLR_PDEN_VD3_MASK (0x4000000U) | ||
13412 | #define SYSCON_PDRUNCFGCLR_PDEN_VD3_SHIFT (26U) | ||
13413 | /*! PDEN_VD3 - Power control for all PLLs. | ||
13414 | */ | ||
13415 | #define SYSCON_PDRUNCFGCLR_PDEN_VD3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_VD3_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_VD3_MASK) | ||
13416 | #define SYSCON_PDRUNCFGCLR_PDEN_VD4_MASK (0x8000000U) | ||
13417 | #define SYSCON_PDRUNCFGCLR_PDEN_VD4_SHIFT (27U) | ||
13418 | /*! PDEN_VD4 - Power control for all SRAMs and ROM. | ||
13419 | */ | ||
13420 | #define SYSCON_PDRUNCFGCLR_PDEN_VD4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_VD4_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_VD4_MASK) | ||
13421 | #define SYSCON_PDRUNCFGCLR_PDEN_VD5_MASK (0x10000000U) | ||
13422 | #define SYSCON_PDRUNCFGCLR_PDEN_VD5_SHIFT (28U) | ||
13423 | /*! PDEN_VD5 - Power control both USB0 PHY and USB1 PHY. | ||
13424 | */ | ||
13425 | #define SYSCON_PDRUNCFGCLR_PDEN_VD5(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_VD5_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_VD5_MASK) | ||
13426 | #define SYSCON_PDRUNCFGCLR_PDEN_VD6_MASK (0x20000000U) | ||
13427 | #define SYSCON_PDRUNCFGCLR_PDEN_VD6_SHIFT (29U) | ||
13428 | /*! PDEN_VD6 - Power control for EEPROM. | ||
13429 | */ | ||
13430 | #define SYSCON_PDRUNCFGCLR_PDEN_VD6(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_PDRUNCFGCLR_PDEN_VD6_SHIFT)) & SYSCON_PDRUNCFGCLR_PDEN_VD6_MASK) | ||
13431 | /*! @} */ | ||
13432 | |||
13433 | /* The count of SYSCON_PDRUNCFGCLR */ | ||
13434 | #define SYSCON_PDRUNCFGCLR_COUNT (2U) | ||
13435 | |||
13436 | /*! @name STARTER - Start logic 0 wake-up enable register */ | ||
13437 | /*! @{ */ | ||
13438 | #define SYSCON_STARTER_PINT4_MASK (0x1U) | ||
13439 | #define SYSCON_STARTER_PINT4_SHIFT (0U) | ||
13440 | /*! PINT4 - GPIO pin interrupt 4 wake-up. | ||
13441 | */ | ||
13442 | #define SYSCON_STARTER_PINT4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_PINT4_SHIFT)) & SYSCON_STARTER_PINT4_MASK) | ||
13443 | #define SYSCON_STARTER_WDT_BOD_MASK (0x1U) | ||
13444 | #define SYSCON_STARTER_WDT_BOD_SHIFT (0U) | ||
13445 | /*! WDT_BOD - WWDT and BOD interrupt wake-up. | ||
13446 | */ | ||
13447 | #define SYSCON_STARTER_WDT_BOD(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_WDT_BOD_SHIFT)) & SYSCON_STARTER_WDT_BOD_MASK) | ||
13448 | #define SYSCON_STARTER_DMA_MASK (0x2U) | ||
13449 | #define SYSCON_STARTER_DMA_SHIFT (1U) | ||
13450 | /*! DMA - DMA wake-up. | ||
13451 | */ | ||
13452 | #define SYSCON_STARTER_DMA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_DMA_SHIFT)) & SYSCON_STARTER_DMA_MASK) | ||
13453 | #define SYSCON_STARTER_PINT5_MASK (0x2U) | ||
13454 | #define SYSCON_STARTER_PINT5_SHIFT (1U) | ||
13455 | /*! PINT5 - GPIO pin interrupt 5 wake-up. | ||
13456 | */ | ||
13457 | #define SYSCON_STARTER_PINT5(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_PINT5_SHIFT)) & SYSCON_STARTER_PINT5_MASK) | ||
13458 | #define SYSCON_STARTER_GINT0_MASK (0x4U) | ||
13459 | #define SYSCON_STARTER_GINT0_SHIFT (2U) | ||
13460 | /*! GINT0 - Group interrupt 0 wake-up. | ||
13461 | */ | ||
13462 | #define SYSCON_STARTER_GINT0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_GINT0_SHIFT)) & SYSCON_STARTER_GINT0_MASK) | ||
13463 | #define SYSCON_STARTER_PINT6_MASK (0x4U) | ||
13464 | #define SYSCON_STARTER_PINT6_SHIFT (2U) | ||
13465 | /*! PINT6 - GPIO pin interrupt 6 wake-up. | ||
13466 | */ | ||
13467 | #define SYSCON_STARTER_PINT6(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_PINT6_SHIFT)) & SYSCON_STARTER_PINT6_MASK) | ||
13468 | #define SYSCON_STARTER_GINT1_MASK (0x8U) | ||
13469 | #define SYSCON_STARTER_GINT1_SHIFT (3U) | ||
13470 | /*! GINT1 - Group interrupt 1 wake-up. | ||
13471 | */ | ||
13472 | #define SYSCON_STARTER_GINT1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_GINT1_SHIFT)) & SYSCON_STARTER_GINT1_MASK) | ||
13473 | #define SYSCON_STARTER_PINT7_MASK (0x8U) | ||
13474 | #define SYSCON_STARTER_PINT7_SHIFT (3U) | ||
13475 | /*! PINT7 - GPIO pin interrupt 7 wake-up. | ||
13476 | */ | ||
13477 | #define SYSCON_STARTER_PINT7(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_PINT7_SHIFT)) & SYSCON_STARTER_PINT7_MASK) | ||
13478 | #define SYSCON_STARTER_PIN_INT0_MASK (0x10U) | ||
13479 | #define SYSCON_STARTER_PIN_INT0_SHIFT (4U) | ||
13480 | /*! PIN_INT0 - GPIO pin interrupt 0 wake-up. | ||
13481 | */ | ||
13482 | #define SYSCON_STARTER_PIN_INT0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_PIN_INT0_SHIFT)) & SYSCON_STARTER_PIN_INT0_MASK) | ||
13483 | #define SYSCON_STARTER_PIN_INT1_MASK (0x20U) | ||
13484 | #define SYSCON_STARTER_PIN_INT1_SHIFT (5U) | ||
13485 | /*! PIN_INT1 - GPIO pin interrupt 1 wake-up. | ||
13486 | */ | ||
13487 | #define SYSCON_STARTER_PIN_INT1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_PIN_INT1_SHIFT)) & SYSCON_STARTER_PIN_INT1_MASK) | ||
13488 | #define SYSCON_STARTER_PIN_INT2_MASK (0x40U) | ||
13489 | #define SYSCON_STARTER_PIN_INT2_SHIFT (6U) | ||
13490 | /*! PIN_INT2 - GPIO pin interrupt 2 wake-up. | ||
13491 | */ | ||
13492 | #define SYSCON_STARTER_PIN_INT2(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_PIN_INT2_SHIFT)) & SYSCON_STARTER_PIN_INT2_MASK) | ||
13493 | #define SYSCON_STARTER_PIN_INT3_MASK (0x80U) | ||
13494 | #define SYSCON_STARTER_PIN_INT3_SHIFT (7U) | ||
13495 | /*! PIN_INT3 - GPIO pin interrupt 3 wake-up. | ||
13496 | */ | ||
13497 | #define SYSCON_STARTER_PIN_INT3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_PIN_INT3_SHIFT)) & SYSCON_STARTER_PIN_INT3_MASK) | ||
13498 | #define SYSCON_STARTER_FLEXCOMM8_MASK (0x100U) | ||
13499 | #define SYSCON_STARTER_FLEXCOMM8_SHIFT (8U) | ||
13500 | /*! FLEXCOMM8 - Flexcomm Interface 8 wake-up. | ||
13501 | */ | ||
13502 | #define SYSCON_STARTER_FLEXCOMM8(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM8_SHIFT)) & SYSCON_STARTER_FLEXCOMM8_MASK) | ||
13503 | #define SYSCON_STARTER_UTICK_MASK (0x100U) | ||
13504 | #define SYSCON_STARTER_UTICK_SHIFT (8U) | ||
13505 | /*! UTICK - Micro-tick Timer wake-up. | ||
13506 | */ | ||
13507 | #define SYSCON_STARTER_UTICK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_UTICK_SHIFT)) & SYSCON_STARTER_UTICK_MASK) | ||
13508 | #define SYSCON_STARTER_FLEXCOMM9_MASK (0x200U) | ||
13509 | #define SYSCON_STARTER_FLEXCOMM9_SHIFT (9U) | ||
13510 | /*! FLEXCOMM9 - Flexcomm Interface 9 wake-up. | ||
13511 | */ | ||
13512 | #define SYSCON_STARTER_FLEXCOMM9(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM9_SHIFT)) & SYSCON_STARTER_FLEXCOMM9_MASK) | ||
13513 | #define SYSCON_STARTER_FLEXCOMM0_MASK (0x4000U) | ||
13514 | #define SYSCON_STARTER_FLEXCOMM0_SHIFT (14U) | ||
13515 | /*! FLEXCOMM0 - Flexcomm0 peripheral interrupt wake-up. | ||
13516 | */ | ||
13517 | #define SYSCON_STARTER_FLEXCOMM0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM0_SHIFT)) & SYSCON_STARTER_FLEXCOMM0_MASK) | ||
13518 | #define SYSCON_STARTER_FLEXCOMM1_MASK (0x8000U) | ||
13519 | #define SYSCON_STARTER_FLEXCOMM1_SHIFT (15U) | ||
13520 | /*! FLEXCOMM1 - Flexcomm1 peripheral interrupt wake-up. | ||
13521 | */ | ||
13522 | #define SYSCON_STARTER_FLEXCOMM1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM1_SHIFT)) & SYSCON_STARTER_FLEXCOMM1_MASK) | ||
13523 | #define SYSCON_STARTER_USB1_MASK (0x8000U) | ||
13524 | #define SYSCON_STARTER_USB1_SHIFT (15U) | ||
13525 | /*! USB1 - USB 1 wake-up. | ||
13526 | */ | ||
13527 | #define SYSCON_STARTER_USB1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_USB1_SHIFT)) & SYSCON_STARTER_USB1_MASK) | ||
13528 | #define SYSCON_STARTER_FLEXCOMM2_MASK (0x10000U) | ||
13529 | #define SYSCON_STARTER_FLEXCOMM2_SHIFT (16U) | ||
13530 | /*! FLEXCOMM2 - Flexcomm2 peripheral interrupt wake-up. | ||
13531 | */ | ||
13532 | #define SYSCON_STARTER_FLEXCOMM2(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM2_SHIFT)) & SYSCON_STARTER_FLEXCOMM2_MASK) | ||
13533 | #define SYSCON_STARTER_USB1_ACT_MASK (0x10000U) | ||
13534 | #define SYSCON_STARTER_USB1_ACT_SHIFT (16U) | ||
13535 | /*! USB1_ACT - USB 1 activity wake-up. | ||
13536 | */ | ||
13537 | #define SYSCON_STARTER_USB1_ACT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_USB1_ACT_SHIFT)) & SYSCON_STARTER_USB1_ACT_MASK) | ||
13538 | #define SYSCON_STARTER_FLEXCOMM3_MASK (0x20000U) | ||
13539 | #define SYSCON_STARTER_FLEXCOMM3_SHIFT (17U) | ||
13540 | /*! FLEXCOMM3 - Flexcomm3 peripheral interrupt wake-up. | ||
13541 | */ | ||
13542 | #define SYSCON_STARTER_FLEXCOMM3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM3_SHIFT)) & SYSCON_STARTER_FLEXCOMM3_MASK) | ||
13543 | #define SYSCON_STARTER_FLEXCOMM4_MASK (0x40000U) | ||
13544 | #define SYSCON_STARTER_FLEXCOMM4_SHIFT (18U) | ||
13545 | /*! FLEXCOMM4 - Flexcomm4 peripheral interrupt wake-up. | ||
13546 | */ | ||
13547 | #define SYSCON_STARTER_FLEXCOMM4(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM4_SHIFT)) & SYSCON_STARTER_FLEXCOMM4_MASK) | ||
13548 | #define SYSCON_STARTER_FLEXCOMM5_MASK (0x80000U) | ||
13549 | #define SYSCON_STARTER_FLEXCOMM5_SHIFT (19U) | ||
13550 | /*! FLEXCOMM5 - Flexcomm5 peripheral interrupt wake-up. | ||
13551 | */ | ||
13552 | #define SYSCON_STARTER_FLEXCOMM5(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM5_SHIFT)) & SYSCON_STARTER_FLEXCOMM5_MASK) | ||
13553 | #define SYSCON_STARTER_FLEXCOMM6_MASK (0x100000U) | ||
13554 | #define SYSCON_STARTER_FLEXCOMM6_SHIFT (20U) | ||
13555 | /*! FLEXCOMM6 - Flexcomm6 peripheral interrupt wake-up. | ||
13556 | */ | ||
13557 | #define SYSCON_STARTER_FLEXCOMM6(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM6_SHIFT)) & SYSCON_STARTER_FLEXCOMM6_MASK) | ||
13558 | #define SYSCON_STARTER_FLEXCOMM7_MASK (0x200000U) | ||
13559 | #define SYSCON_STARTER_FLEXCOMM7_SHIFT (21U) | ||
13560 | /*! FLEXCOMM7 - Flexcomm7 peripheral interrupt wake-up. | ||
13561 | */ | ||
13562 | #define SYSCON_STARTER_FLEXCOMM7(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM7_SHIFT)) & SYSCON_STARTER_FLEXCOMM7_MASK) | ||
13563 | #define SYSCON_STARTER_DMIC_MASK (0x2000000U) | ||
13564 | #define SYSCON_STARTER_DMIC_SHIFT (25U) | ||
13565 | /*! DMIC - Digital microphone interrupt wake-up. | ||
13566 | */ | ||
13567 | #define SYSCON_STARTER_DMIC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_DMIC_SHIFT)) & SYSCON_STARTER_DMIC_MASK) | ||
13568 | #define SYSCON_STARTER_HWVAD_MASK (0x4000000U) | ||
13569 | #define SYSCON_STARTER_HWVAD_SHIFT (26U) | ||
13570 | /*! HWVAD - Hardware voice activity detect interrupt wake-up. | ||
13571 | */ | ||
13572 | #define SYSCON_STARTER_HWVAD(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_HWVAD_SHIFT)) & SYSCON_STARTER_HWVAD_MASK) | ||
13573 | #define SYSCON_STARTER_USB0_NEEDCLK_MASK (0x8000000U) | ||
13574 | #define SYSCON_STARTER_USB0_NEEDCLK_SHIFT (27U) | ||
13575 | /*! USB0_NEEDCLK - USB activity interrupt wake-up. | ||
13576 | */ | ||
13577 | #define SYSCON_STARTER_USB0_NEEDCLK(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_USB0_NEEDCLK_SHIFT)) & SYSCON_STARTER_USB0_NEEDCLK_MASK) | ||
13578 | #define SYSCON_STARTER_USB0_MASK (0x10000000U) | ||
13579 | #define SYSCON_STARTER_USB0_SHIFT (28U) | ||
13580 | /*! USB0 - USB function interrupt wake-up. | ||
13581 | */ | ||
13582 | #define SYSCON_STARTER_USB0(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_USB0_SHIFT)) & SYSCON_STARTER_USB0_MASK) | ||
13583 | #define SYSCON_STARTER_RTC_MASK (0x20000000U) | ||
13584 | #define SYSCON_STARTER_RTC_SHIFT (29U) | ||
13585 | /*! RTC - RTC interrupt alarm and wake-up timer. | ||
13586 | */ | ||
13587 | #define SYSCON_STARTER_RTC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_RTC_SHIFT)) & SYSCON_STARTER_RTC_MASK) | ||
13588 | #define SYSCON_STARTER_FLEXCOMM10_MASK (0x40000000U) | ||
13589 | #define SYSCON_STARTER_FLEXCOMM10_SHIFT (30U) | ||
13590 | /*! FLEXCOMM10 - Flexcomm10 peripheral interrupt wake-up. | ||
13591 | */ | ||
13592 | #define SYSCON_STARTER_FLEXCOMM10(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTER_FLEXCOMM10_SHIFT)) & SYSCON_STARTER_FLEXCOMM10_MASK) | ||
13593 | /*! @} */ | ||
13594 | |||
13595 | /* The count of SYSCON_STARTER */ | ||
13596 | #define SYSCON_STARTER_COUNT (2U) | ||
13597 | |||
13598 | /*! @name STARTERSET - Set bits in STARTER */ | ||
13599 | /*! @{ */ | ||
13600 | #define SYSCON_STARTERSET_START_SET_MASK (0xFFFFFFFFU) | ||
13601 | #define SYSCON_STARTERSET_START_SET_SHIFT (0U) | ||
13602 | /*! START_SET - Writing ones to this register sets the corresponding bit or bits in the STARTER0 register, if they are implemented. | ||
13603 | */ | ||
13604 | #define SYSCON_STARTERSET_START_SET(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTERSET_START_SET_SHIFT)) & SYSCON_STARTERSET_START_SET_MASK) | ||
13605 | /*! @} */ | ||
13606 | |||
13607 | /* The count of SYSCON_STARTERSET */ | ||
13608 | #define SYSCON_STARTERSET_COUNT (2U) | ||
13609 | |||
13610 | /*! @name STARTERCLR - Clear bits in STARTER0 */ | ||
13611 | /*! @{ */ | ||
13612 | #define SYSCON_STARTERCLR_START_CLR_MASK (0xFFFFFFFFU) | ||
13613 | #define SYSCON_STARTERCLR_START_CLR_SHIFT (0U) | ||
13614 | /*! START_CLR - Writing ones to this register clears the corresponding bit or bits in the STARTER0 register, if they are implemented. | ||
13615 | */ | ||
13616 | #define SYSCON_STARTERCLR_START_CLR(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_STARTERCLR_START_CLR_SHIFT)) & SYSCON_STARTERCLR_START_CLR_MASK) | ||
13617 | /*! @} */ | ||
13618 | |||
13619 | /* The count of SYSCON_STARTERCLR */ | ||
13620 | #define SYSCON_STARTERCLR_COUNT (2U) | ||
13621 | |||
13622 | /*! @name HWWAKE - Configures special cases of hardware wake-up */ | ||
13623 | /*! @{ */ | ||
13624 | #define SYSCON_HWWAKE_FORCEWAKE_MASK (0x1U) | ||
13625 | #define SYSCON_HWWAKE_FORCEWAKE_SHIFT (0U) | ||
13626 | /*! FORCEWAKE - Force peripheral clocking to stay on during Deep Sleep and Power-down modes. When 1, | ||
13627 | * clocking to peripherals is prevented from being shut down when the CPU enters Deep Sleep and | ||
13628 | * Power-down modes. This is intended to allow a coprocessor to continue operating while the main | ||
13629 | * CPU(s) are shut down. | ||
13630 | */ | ||
13631 | #define SYSCON_HWWAKE_FORCEWAKE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_HWWAKE_FORCEWAKE_SHIFT)) & SYSCON_HWWAKE_FORCEWAKE_MASK) | ||
13632 | #define SYSCON_HWWAKE_FCWAKE_MASK (0x2U) | ||
13633 | #define SYSCON_HWWAKE_FCWAKE_SHIFT (1U) | ||
13634 | /*! FCWAKE - Wake for Flexcomms. When 1, any Flexcomm FIFO reaching the level specified by its own | ||
13635 | * TXLVL will cause peripheral clocking to wake up temporarily while the related status is | ||
13636 | * asserted. | ||
13637 | */ | ||
13638 | #define SYSCON_HWWAKE_FCWAKE(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_HWWAKE_FCWAKE_SHIFT)) & SYSCON_HWWAKE_FCWAKE_MASK) | ||
13639 | #define SYSCON_HWWAKE_WAKEDMIC_MASK (0x4U) | ||
13640 | #define SYSCON_HWWAKE_WAKEDMIC_SHIFT (2U) | ||
13641 | /*! WAKEDMIC - Wake for Digital Microphone. When 1, the digital microphone input FIFO reaching the | ||
13642 | * level specified by TRIGLVL of either channel will cause peripheral clocking to wake up | ||
13643 | * temporarily while the related status is asserted. | ||
13644 | */ | ||
13645 | #define SYSCON_HWWAKE_WAKEDMIC(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_HWWAKE_WAKEDMIC_SHIFT)) & SYSCON_HWWAKE_WAKEDMIC_MASK) | ||
13646 | #define SYSCON_HWWAKE_WAKEDMA_MASK (0x8U) | ||
13647 | #define SYSCON_HWWAKE_WAKEDMA_SHIFT (3U) | ||
13648 | /*! WAKEDMA - Wake for DMA. When 1, DMA being busy will cause peripheral clocking to remain running | ||
13649 | * until DMA completes. This is generally used in conjunction with bit 1 and/or 2 in order to | ||
13650 | * prevent peripheral clocking from being shut down as soon as the cause of wake-up is cleared, but | ||
13651 | * before DMA has completed its related activity. | ||
13652 | */ | ||
13653 | #define SYSCON_HWWAKE_WAKEDMA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_HWWAKE_WAKEDMA_SHIFT)) & SYSCON_HWWAKE_WAKEDMA_MASK) | ||
13654 | /*! @} */ | ||
13655 | |||
13656 | /*! @name AUTOCGOR - Auto Clock-Gate Override Register */ | ||
13657 | /*! @{ */ | ||
13658 | #define SYSCON_AUTOCGOR_RAM0X_MASK (0x2U) | ||
13659 | #define SYSCON_AUTOCGOR_RAM0X_SHIFT (1U) | ||
13660 | /*! RAM0X - When 1, automatic clock gating for RAMX and RAM0 are turned off. | ||
13661 | */ | ||
13662 | #define SYSCON_AUTOCGOR_RAM0X(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUTOCGOR_RAM0X_SHIFT)) & SYSCON_AUTOCGOR_RAM0X_MASK) | ||
13663 | #define SYSCON_AUTOCGOR_RAM1_MASK (0x4U) | ||
13664 | #define SYSCON_AUTOCGOR_RAM1_SHIFT (2U) | ||
13665 | /*! RAM1 - When 1, automatic clock gating for RAM1 are turned off. | ||
13666 | */ | ||
13667 | #define SYSCON_AUTOCGOR_RAM1(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUTOCGOR_RAM1_SHIFT)) & SYSCON_AUTOCGOR_RAM1_MASK) | ||
13668 | #define SYSCON_AUTOCGOR_RAM2_MASK (0x8U) | ||
13669 | #define SYSCON_AUTOCGOR_RAM2_SHIFT (3U) | ||
13670 | /*! RAM2 - When 1, automatic clock gating for RAM1 are turned off. | ||
13671 | */ | ||
13672 | #define SYSCON_AUTOCGOR_RAM2(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUTOCGOR_RAM2_SHIFT)) & SYSCON_AUTOCGOR_RAM2_MASK) | ||
13673 | #define SYSCON_AUTOCGOR_RAM3_MASK (0x10U) | ||
13674 | #define SYSCON_AUTOCGOR_RAM3_SHIFT (4U) | ||
13675 | /*! RAM3 - When 1, automatic clock gating for RAM1 are turned off. | ||
13676 | */ | ||
13677 | #define SYSCON_AUTOCGOR_RAM3(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_AUTOCGOR_RAM3_SHIFT)) & SYSCON_AUTOCGOR_RAM3_MASK) | ||
13678 | /*! @} */ | ||
13679 | |||
13680 | /*! @name JTAGIDCODE - JTAG ID code register */ | ||
13681 | /*! @{ */ | ||
13682 | #define SYSCON_JTAGIDCODE_JTAGID_MASK (0xFFFFFFFFU) | ||
13683 | #define SYSCON_JTAGIDCODE_JTAGID_SHIFT (0U) | ||
13684 | /*! JTAGID - JTAG ID code. | ||
13685 | */ | ||
13686 | #define SYSCON_JTAGIDCODE_JTAGID(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_JTAGIDCODE_JTAGID_SHIFT)) & SYSCON_JTAGIDCODE_JTAGID_MASK) | ||
13687 | /*! @} */ | ||
13688 | |||
13689 | /*! @name DEVICE_ID0 - Part ID register */ | ||
13690 | /*! @{ */ | ||
13691 | #define SYSCON_DEVICE_ID0_PARTID_MASK (0xFFFFFFFFU) | ||
13692 | #define SYSCON_DEVICE_ID0_PARTID_SHIFT (0U) | ||
13693 | /*! PARTID - Part ID | ||
13694 | */ | ||
13695 | #define SYSCON_DEVICE_ID0_PARTID(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_DEVICE_ID0_PARTID_SHIFT)) & SYSCON_DEVICE_ID0_PARTID_MASK) | ||
13696 | /*! @} */ | ||
13697 | |||
13698 | /*! @name DEVICE_ID1 - Boot ROM and die revision register */ | ||
13699 | /*! @{ */ | ||
13700 | #define SYSCON_DEVICE_ID1_REVID_MASK (0xFFFFFFFFU) | ||
13701 | #define SYSCON_DEVICE_ID1_REVID_SHIFT (0U) | ||
13702 | /*! REVID - Revision. | ||
13703 | */ | ||
13704 | #define SYSCON_DEVICE_ID1_REVID(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_DEVICE_ID1_REVID_SHIFT)) & SYSCON_DEVICE_ID1_REVID_MASK) | ||
13705 | /*! @} */ | ||
13706 | |||
13707 | /*! @name BODCTRL - Brown-Out Detect control */ | ||
13708 | /*! @{ */ | ||
13709 | #define SYSCON_BODCTRL_BODRSTLEV_MASK (0x3U) | ||
13710 | #define SYSCON_BODCTRL_BODRSTLEV_SHIFT (0U) | ||
13711 | /*! BODRSTLEV - BOD reset level | ||
13712 | * 0b00..Level 0: 1.5 V | ||
13713 | * 0b01..Level 1: 1.85 V | ||
13714 | * 0b10..Level 2: 2.0 V | ||
13715 | * 0b11..Level 3: 2.3 V | ||
13716 | */ | ||
13717 | #define SYSCON_BODCTRL_BODRSTLEV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_BODCTRL_BODRSTLEV_SHIFT)) & SYSCON_BODCTRL_BODRSTLEV_MASK) | ||
13718 | #define SYSCON_BODCTRL_BODRSTENA_MASK (0x4U) | ||
13719 | #define SYSCON_BODCTRL_BODRSTENA_SHIFT (2U) | ||
13720 | /*! BODRSTENA - BOD reset enable | ||
13721 | * 0b0..Disable reset function. | ||
13722 | * 0b1..Enable reset function. | ||
13723 | */ | ||
13724 | #define SYSCON_BODCTRL_BODRSTENA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_BODCTRL_BODRSTENA_SHIFT)) & SYSCON_BODCTRL_BODRSTENA_MASK) | ||
13725 | #define SYSCON_BODCTRL_BODINTLEV_MASK (0x18U) | ||
13726 | #define SYSCON_BODCTRL_BODINTLEV_SHIFT (3U) | ||
13727 | /*! BODINTLEV - BOD interrupt level | ||
13728 | * 0b00..Level 0: 2.05 V | ||
13729 | * 0b01..Level 1: 2.45 V | ||
13730 | * 0b10..Level 2: 2.75 V | ||
13731 | * 0b11..Level 3: 3.05 V | ||
13732 | */ | ||
13733 | #define SYSCON_BODCTRL_BODINTLEV(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_BODCTRL_BODINTLEV_SHIFT)) & SYSCON_BODCTRL_BODINTLEV_MASK) | ||
13734 | #define SYSCON_BODCTRL_BODINTENA_MASK (0x20U) | ||
13735 | #define SYSCON_BODCTRL_BODINTENA_SHIFT (5U) | ||
13736 | /*! BODINTENA - BOD interrupt enable | ||
13737 | * 0b0..Disable interrupt function. | ||
13738 | * 0b1..Enable interrupt function. | ||
13739 | */ | ||
13740 | #define SYSCON_BODCTRL_BODINTENA(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_BODCTRL_BODINTENA_SHIFT)) & SYSCON_BODCTRL_BODINTENA_MASK) | ||
13741 | #define SYSCON_BODCTRL_BODRSTSTAT_MASK (0x40U) | ||
13742 | #define SYSCON_BODCTRL_BODRSTSTAT_SHIFT (6U) | ||
13743 | /*! BODRSTSTAT - BOD reset status. When 1, a BOD reset has occurred. Cleared by writing 1 to this bit. | ||
13744 | */ | ||
13745 | #define SYSCON_BODCTRL_BODRSTSTAT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_BODCTRL_BODRSTSTAT_SHIFT)) & SYSCON_BODCTRL_BODRSTSTAT_MASK) | ||
13746 | #define SYSCON_BODCTRL_BODINTSTAT_MASK (0x80U) | ||
13747 | #define SYSCON_BODCTRL_BODINTSTAT_SHIFT (7U) | ||
13748 | /*! BODINTSTAT - BOD interrupt status. When 1, a BOD interrupt has occurred. Cleared by writing 1 to this bit. | ||
13749 | */ | ||
13750 | #define SYSCON_BODCTRL_BODINTSTAT(x) (((uint32_t)(((uint32_t)(x)) << SYSCON_BODCTRL_BODINTSTAT_SHIFT)) & SYSCON_BODCTRL_BODINTSTAT_MASK) | ||
13751 | /*! @} */ | ||
13752 | |||
13753 | |||
13754 | /*! | ||
13755 | * @} | ||
13756 | */ /* end of group SYSCON_Register_Masks */ | ||
13757 | |||
13758 | |||
13759 | /* SYSCON - Peripheral instance base addresses */ | ||
13760 | /** Peripheral SYSCON base address */ | ||
13761 | #define SYSCON_BASE (0x40000000u) | ||
13762 | /** Peripheral SYSCON base pointer */ | ||
13763 | #define SYSCON ((SYSCON_Type *)SYSCON_BASE) | ||
13764 | /** Array initializer of SYSCON peripheral base addresses */ | ||
13765 | #define SYSCON_BASE_ADDRS { SYSCON_BASE } | ||
13766 | /** Array initializer of SYSCON peripheral base pointers */ | ||
13767 | #define SYSCON_BASE_PTRS { SYSCON } | ||
13768 | |||
13769 | /*! | ||
13770 | * @} | ||
13771 | */ /* end of group SYSCON_Peripheral_Access_Layer */ | ||
13772 | |||
13773 | |||
13774 | /* ---------------------------------------------------------------------------- | ||
13775 | -- USART Peripheral Access Layer | ||
13776 | ---------------------------------------------------------------------------- */ | ||
13777 | |||
13778 | /*! | ||
13779 | * @addtogroup USART_Peripheral_Access_Layer USART Peripheral Access Layer | ||
13780 | * @{ | ||
13781 | */ | ||
13782 | |||
13783 | /** USART - Register Layout Typedef */ | ||
13784 | typedef struct { | ||
13785 | __IO uint32_t CFG; /**< USART Configuration register. Basic USART configuration settings that typically are not changed during operation., offset: 0x0 */ | ||
13786 | __IO uint32_t CTL; /**< USART Control register. USART control settings that are more likely to change during operation., offset: 0x4 */ | ||
13787 | __IO uint32_t STAT; /**< USART Status register. The complete status value can be read here. Writing ones clears some bits in the register. Some bits can be cleared by writing a 1 to them., offset: 0x8 */ | ||
13788 | __IO uint32_t INTENSET; /**< Interrupt Enable read and Set register for USART (not FIFO) status. Contains individual interrupt enable bits for each potential USART interrupt. A complete value may be read from this register. Writing a 1 to any implemented bit position causes that bit to be set., offset: 0xC */ | ||
13789 | __O uint32_t INTENCLR; /**< Interrupt Enable Clear register. Allows clearing any combination of bits in the INTENSET register. Writing a 1 to any implemented bit position causes the corresponding bit to be cleared., offset: 0x10 */ | ||
13790 | uint8_t RESERVED_0[12]; | ||
13791 | __IO uint32_t BRG; /**< Baud Rate Generator register. 16-bit integer baud rate divisor value., offset: 0x20 */ | ||
13792 | __I uint32_t INTSTAT; /**< Interrupt status register. Reflects interrupts that are currently enabled., offset: 0x24 */ | ||
13793 | __IO uint32_t OSR; /**< Oversample selection register for asynchronous communication., offset: 0x28 */ | ||
13794 | __IO uint32_t ADDR; /**< Address register for automatic address matching., offset: 0x2C */ | ||
13795 | uint8_t RESERVED_1[3536]; | ||
13796 | __IO uint32_t FIFOCFG; /**< FIFO configuration and enable register., offset: 0xE00 */ | ||
13797 | __IO uint32_t FIFOSTAT; /**< FIFO status register., offset: 0xE04 */ | ||
13798 | __IO uint32_t FIFOTRIG; /**< FIFO trigger settings for interrupt and DMA request., offset: 0xE08 */ | ||
13799 | uint8_t RESERVED_2[4]; | ||
13800 | __IO uint32_t FIFOINTENSET; /**< FIFO interrupt enable set (enable) and read register., offset: 0xE10 */ | ||
13801 | __IO uint32_t FIFOINTENCLR; /**< FIFO interrupt enable clear (disable) and read register., offset: 0xE14 */ | ||
13802 | __I uint32_t FIFOINTSTAT; /**< FIFO interrupt status register., offset: 0xE18 */ | ||
13803 | uint8_t RESERVED_3[4]; | ||
13804 | __O uint32_t FIFOWR; /**< FIFO write data., offset: 0xE20 */ | ||
13805 | uint8_t RESERVED_4[12]; | ||
13806 | __I uint32_t FIFORD; /**< FIFO read data., offset: 0xE30 */ | ||
13807 | uint8_t RESERVED_5[12]; | ||
13808 | __I uint32_t FIFORDNOPOP; /**< FIFO data read with no FIFO pop., offset: 0xE40 */ | ||
13809 | uint8_t RESERVED_6[440]; | ||
13810 | __I uint32_t ID; /**< Peripheral identification register., offset: 0xFFC */ | ||
13811 | } USART_Type; | ||
13812 | |||
13813 | /* ---------------------------------------------------------------------------- | ||
13814 | -- USART Register Masks | ||
13815 | ---------------------------------------------------------------------------- */ | ||
13816 | |||
13817 | /*! | ||
13818 | * @addtogroup USART_Register_Masks USART Register Masks | ||
13819 | * @{ | ||
13820 | */ | ||
13821 | |||
13822 | /*! @name CFG - USART Configuration register. Basic USART configuration settings that typically are not changed during operation. */ | ||
13823 | /*! @{ */ | ||
13824 | #define USART_CFG_ENABLE_MASK (0x1U) | ||
13825 | #define USART_CFG_ENABLE_SHIFT (0U) | ||
13826 | /*! ENABLE - USART Enable. | ||
13827 | * 0b0..Disabled. The USART is disabled and the internal state machine and counters are reset. While Enable = 0, | ||
13828 | * all USART interrupts and DMA transfers are disabled. When Enable is set again, CFG and most other control | ||
13829 | * bits remain unchanged. When re-enabled, the USART will immediately be ready to transmit because the | ||
13830 | * transmitter has been reset and is therefore available. | ||
13831 | * 0b1..Enabled. The USART is enabled for operation. | ||
13832 | */ | ||
13833 | #define USART_CFG_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_ENABLE_SHIFT)) & USART_CFG_ENABLE_MASK) | ||
13834 | #define USART_CFG_DATALEN_MASK (0xCU) | ||
13835 | #define USART_CFG_DATALEN_SHIFT (2U) | ||
13836 | /*! DATALEN - Selects the data size for the USART. | ||
13837 | * 0b00..7 bit Data length. | ||
13838 | * 0b01..8 bit Data length. | ||
13839 | * 0b10..9 bit data length. The 9th bit is commonly used for addressing in multidrop mode. See the ADDRDET bit in the CTL register. | ||
13840 | * 0b11..Reserved. | ||
13841 | */ | ||
13842 | #define USART_CFG_DATALEN(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_DATALEN_SHIFT)) & USART_CFG_DATALEN_MASK) | ||
13843 | #define USART_CFG_PARITYSEL_MASK (0x30U) | ||
13844 | #define USART_CFG_PARITYSEL_SHIFT (4U) | ||
13845 | /*! PARITYSEL - Selects what type of parity is used by the USART. | ||
13846 | * 0b00..No parity. | ||
13847 | * 0b01..Reserved. | ||
13848 | * 0b10..Even parity. Adds a bit to each character such that the number of 1s in a transmitted character is even, | ||
13849 | * and the number of 1s in a received character is expected to be even. | ||
13850 | * 0b11..Odd parity. Adds a bit to each character such that the number of 1s in a transmitted character is odd, | ||
13851 | * and the number of 1s in a received character is expected to be odd. | ||
13852 | */ | ||
13853 | #define USART_CFG_PARITYSEL(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_PARITYSEL_SHIFT)) & USART_CFG_PARITYSEL_MASK) | ||
13854 | #define USART_CFG_STOPLEN_MASK (0x40U) | ||
13855 | #define USART_CFG_STOPLEN_SHIFT (6U) | ||
13856 | /*! STOPLEN - Number of stop bits appended to transmitted data. Only a single stop bit is required for received data. | ||
13857 | * 0b0..1 stop bit. | ||
13858 | * 0b1..2 stop bits. This setting should only be used for asynchronous communication. | ||
13859 | */ | ||
13860 | #define USART_CFG_STOPLEN(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_STOPLEN_SHIFT)) & USART_CFG_STOPLEN_MASK) | ||
13861 | #define USART_CFG_MODE32K_MASK (0x80U) | ||
13862 | #define USART_CFG_MODE32K_SHIFT (7U) | ||
13863 | /*! MODE32K - Selects standard or 32 kHz clocking mode. | ||
13864 | * 0b0..Disabled. USART uses standard clocking. | ||
13865 | * 0b1..Enabled. USART uses the 32 kHz clock from the RTC oscillator as the clock source to the BRG, and uses a special bit clocking scheme. | ||
13866 | */ | ||
13867 | #define USART_CFG_MODE32K(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_MODE32K_SHIFT)) & USART_CFG_MODE32K_MASK) | ||
13868 | #define USART_CFG_LINMODE_MASK (0x100U) | ||
13869 | #define USART_CFG_LINMODE_SHIFT (8U) | ||
13870 | /*! LINMODE - LIN break mode enable. | ||
13871 | * 0b0..Disabled. Break detect and generate is configured for normal operation. | ||
13872 | * 0b1..Enabled. Break detect and generate is configured for LIN bus operation. | ||
13873 | */ | ||
13874 | #define USART_CFG_LINMODE(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_LINMODE_SHIFT)) & USART_CFG_LINMODE_MASK) | ||
13875 | #define USART_CFG_CTSEN_MASK (0x200U) | ||
13876 | #define USART_CFG_CTSEN_SHIFT (9U) | ||
13877 | /*! CTSEN - CTS Enable. Determines whether CTS is used for flow control. CTS can be from the input | ||
13878 | * pin, or from the USART's own RTS if loopback mode is enabled. | ||
13879 | * 0b0..No flow control. The transmitter does not receive any automatic flow control signal. | ||
13880 | * 0b1..Flow control enabled. The transmitter uses the CTS input (or RTS output in loopback mode) for flow control purposes. | ||
13881 | */ | ||
13882 | #define USART_CFG_CTSEN(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_CTSEN_SHIFT)) & USART_CFG_CTSEN_MASK) | ||
13883 | #define USART_CFG_SYNCEN_MASK (0x800U) | ||
13884 | #define USART_CFG_SYNCEN_SHIFT (11U) | ||
13885 | /*! SYNCEN - Selects synchronous or asynchronous operation. | ||
13886 | * 0b0..Asynchronous mode. | ||
13887 | * 0b1..Synchronous mode. | ||
13888 | */ | ||
13889 | #define USART_CFG_SYNCEN(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_SYNCEN_SHIFT)) & USART_CFG_SYNCEN_MASK) | ||
13890 | #define USART_CFG_CLKPOL_MASK (0x1000U) | ||
13891 | #define USART_CFG_CLKPOL_SHIFT (12U) | ||
13892 | /*! CLKPOL - Selects the clock polarity and sampling edge of received data in synchronous mode. | ||
13893 | * 0b0..Falling edge. Un_RXD is sampled on the falling edge of SCLK. | ||
13894 | * 0b1..Rising edge. Un_RXD is sampled on the rising edge of SCLK. | ||
13895 | */ | ||
13896 | #define USART_CFG_CLKPOL(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_CLKPOL_SHIFT)) & USART_CFG_CLKPOL_MASK) | ||
13897 | #define USART_CFG_SYNCMST_MASK (0x4000U) | ||
13898 | #define USART_CFG_SYNCMST_SHIFT (14U) | ||
13899 | /*! SYNCMST - Synchronous mode Master select. | ||
13900 | * 0b0..Slave. When synchronous mode is enabled, the USART is a slave. | ||
13901 | * 0b1..Master. When synchronous mode is enabled, the USART is a master. | ||
13902 | */ | ||
13903 | #define USART_CFG_SYNCMST(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_SYNCMST_SHIFT)) & USART_CFG_SYNCMST_MASK) | ||
13904 | #define USART_CFG_LOOP_MASK (0x8000U) | ||
13905 | #define USART_CFG_LOOP_SHIFT (15U) | ||
13906 | /*! LOOP - Selects data loopback mode. | ||
13907 | * 0b0..Normal operation. | ||
13908 | * 0b1..Loopback mode. This provides a mechanism to perform diagnostic loopback testing for USART data. Serial | ||
13909 | * data from the transmitter (Un_TXD) is connected internally to serial input of the receive (Un_RXD). Un_TXD | ||
13910 | * and Un_RTS activity will also appear on external pins if these functions are configured to appear on device | ||
13911 | * pins. The receiver RTS signal is also looped back to CTS and performs flow control if enabled by CTSEN. | ||
13912 | */ | ||
13913 | #define USART_CFG_LOOP(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_LOOP_SHIFT)) & USART_CFG_LOOP_MASK) | ||
13914 | #define USART_CFG_OETA_MASK (0x40000U) | ||
13915 | #define USART_CFG_OETA_SHIFT (18U) | ||
13916 | /*! OETA - Output Enable Turnaround time enable for RS-485 operation. | ||
13917 | * 0b0..Disabled. If selected by OESEL, the Output Enable signal deasserted at the end of the last stop bit of a transmission. | ||
13918 | * 0b1..Enabled. If selected by OESEL, the Output Enable signal remains asserted for one character time after the | ||
13919 | * end of the last stop bit of a transmission. OE will also remain asserted if another transmit begins | ||
13920 | * before it is deasserted. | ||
13921 | */ | ||
13922 | #define USART_CFG_OETA(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_OETA_SHIFT)) & USART_CFG_OETA_MASK) | ||
13923 | #define USART_CFG_AUTOADDR_MASK (0x80000U) | ||
13924 | #define USART_CFG_AUTOADDR_SHIFT (19U) | ||
13925 | /*! AUTOADDR - Automatic Address matching enable. | ||
13926 | * 0b0..Disabled. When addressing is enabled by ADDRDET, address matching is done by software. This provides the | ||
13927 | * possibility of versatile addressing (e.g. respond to more than one address). | ||
13928 | * 0b1..Enabled. When addressing is enabled by ADDRDET, address matching is done by hardware, using the value in | ||
13929 | * the ADDR register as the address to match. | ||
13930 | */ | ||
13931 | #define USART_CFG_AUTOADDR(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_AUTOADDR_SHIFT)) & USART_CFG_AUTOADDR_MASK) | ||
13932 | #define USART_CFG_OESEL_MASK (0x100000U) | ||
13933 | #define USART_CFG_OESEL_SHIFT (20U) | ||
13934 | /*! OESEL - Output Enable Select. | ||
13935 | * 0b0..Standard. The RTS signal is used as the standard flow control function. | ||
13936 | * 0b1..RS-485. The RTS signal configured to provide an output enable signal to control an RS-485 transceiver. | ||
13937 | */ | ||
13938 | #define USART_CFG_OESEL(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_OESEL_SHIFT)) & USART_CFG_OESEL_MASK) | ||
13939 | #define USART_CFG_OEPOL_MASK (0x200000U) | ||
13940 | #define USART_CFG_OEPOL_SHIFT (21U) | ||
13941 | /*! OEPOL - Output Enable Polarity. | ||
13942 | * 0b0..Low. If selected by OESEL, the output enable is active low. | ||
13943 | * 0b1..High. If selected by OESEL, the output enable is active high. | ||
13944 | */ | ||
13945 | #define USART_CFG_OEPOL(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_OEPOL_SHIFT)) & USART_CFG_OEPOL_MASK) | ||
13946 | #define USART_CFG_RXPOL_MASK (0x400000U) | ||
13947 | #define USART_CFG_RXPOL_SHIFT (22U) | ||
13948 | /*! RXPOL - Receive data polarity. | ||
13949 | * 0b0..Standard. The RX signal is used as it arrives from the pin. This means that the RX rest value is 1, start | ||
13950 | * bit is 0, data is not inverted, and the stop bit is 1. | ||
13951 | * 0b1..Inverted. The RX signal is inverted before being used by the USART. This means that the RX rest value is | ||
13952 | * 0, start bit is 1, data is inverted, and the stop bit is 0. | ||
13953 | */ | ||
13954 | #define USART_CFG_RXPOL(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_RXPOL_SHIFT)) & USART_CFG_RXPOL_MASK) | ||
13955 | #define USART_CFG_TXPOL_MASK (0x800000U) | ||
13956 | #define USART_CFG_TXPOL_SHIFT (23U) | ||
13957 | /*! TXPOL - Transmit data polarity. | ||
13958 | * 0b0..Standard. The TX signal is sent out without change. This means that the TX rest value is 1, start bit is | ||
13959 | * 0, data is not inverted, and the stop bit is 1. | ||
13960 | * 0b1..Inverted. The TX signal is inverted by the USART before being sent out. This means that the TX rest value | ||
13961 | * is 0, start bit is 1, data is inverted, and the stop bit is 0. | ||
13962 | */ | ||
13963 | #define USART_CFG_TXPOL(x) (((uint32_t)(((uint32_t)(x)) << USART_CFG_TXPOL_SHIFT)) & USART_CFG_TXPOL_MASK) | ||
13964 | /*! @} */ | ||
13965 | |||
13966 | /*! @name CTL - USART Control register. USART control settings that are more likely to change during operation. */ | ||
13967 | /*! @{ */ | ||
13968 | #define USART_CTL_TXBRKEN_MASK (0x2U) | ||
13969 | #define USART_CTL_TXBRKEN_SHIFT (1U) | ||
13970 | /*! TXBRKEN - Break Enable. | ||
13971 | * 0b0..Normal operation. | ||
13972 | * 0b1..Continuous break. Continuous break is sent immediately when this bit is set, and remains until this bit | ||
13973 | * is cleared. A break may be sent without danger of corrupting any currently transmitting character if the | ||
13974 | * transmitter is first disabled (TXDIS in CTL is set) and then waiting for the transmitter to be disabled | ||
13975 | * (TXDISINT in STAT = 1) before writing 1 to TXBRKEN. | ||
13976 | */ | ||
13977 | #define USART_CTL_TXBRKEN(x) (((uint32_t)(((uint32_t)(x)) << USART_CTL_TXBRKEN_SHIFT)) & USART_CTL_TXBRKEN_MASK) | ||
13978 | #define USART_CTL_ADDRDET_MASK (0x4U) | ||
13979 | #define USART_CTL_ADDRDET_SHIFT (2U) | ||
13980 | /*! ADDRDET - Enable address detect mode. | ||
13981 | * 0b0..Disabled. The USART presents all incoming data. | ||
13982 | * 0b1..Enabled. The USART receiver ignores incoming data that does not have the most significant bit of the data | ||
13983 | * (typically the 9th bit) = 1. When the data MSB bit = 1, the receiver treats the incoming data normally, | ||
13984 | * generating a received data interrupt. Software can then check the data to see if this is an address that | ||
13985 | * should be handled. If it is, the ADDRDET bit is cleared by software and further incoming data is handled | ||
13986 | * normally. | ||
13987 | */ | ||
13988 | #define USART_CTL_ADDRDET(x) (((uint32_t)(((uint32_t)(x)) << USART_CTL_ADDRDET_SHIFT)) & USART_CTL_ADDRDET_MASK) | ||
13989 | #define USART_CTL_TXDIS_MASK (0x40U) | ||
13990 | #define USART_CTL_TXDIS_SHIFT (6U) | ||
13991 | /*! TXDIS - Transmit Disable. | ||
13992 | * 0b0..Not disabled. USART transmitter is not disabled. | ||
13993 | * 0b1..Disabled. USART transmitter is disabled after any character currently being transmitted is complete. This | ||
13994 | * feature can be used to facilitate software flow control. | ||
13995 | */ | ||
13996 | #define USART_CTL_TXDIS(x) (((uint32_t)(((uint32_t)(x)) << USART_CTL_TXDIS_SHIFT)) & USART_CTL_TXDIS_MASK) | ||
13997 | #define USART_CTL_CC_MASK (0x100U) | ||
13998 | #define USART_CTL_CC_SHIFT (8U) | ||
13999 | /*! CC - Continuous Clock generation. By default, SCLK is only output while data is being transmitted in synchronous mode. | ||
14000 | * 0b0..Clock on character. In synchronous mode, SCLK cycles only when characters are being sent on Un_TXD or to | ||
14001 | * complete a character that is being received. | ||
14002 | * 0b1..Continuous clock. SCLK runs continuously in synchronous mode, allowing characters to be received on | ||
14003 | * Un_RxD independently from transmission on Un_TXD). | ||
14004 | */ | ||
14005 | #define USART_CTL_CC(x) (((uint32_t)(((uint32_t)(x)) << USART_CTL_CC_SHIFT)) & USART_CTL_CC_MASK) | ||
14006 | #define USART_CTL_CLRCCONRX_MASK (0x200U) | ||
14007 | #define USART_CTL_CLRCCONRX_SHIFT (9U) | ||
14008 | /*! CLRCCONRX - Clear Continuous Clock. | ||
14009 | * 0b0..No effect. No effect on the CC bit. | ||
14010 | * 0b1..Auto-clear. The CC bit is automatically cleared when a complete character has been received. This bit is cleared at the same time. | ||
14011 | */ | ||
14012 | #define USART_CTL_CLRCCONRX(x) (((uint32_t)(((uint32_t)(x)) << USART_CTL_CLRCCONRX_SHIFT)) & USART_CTL_CLRCCONRX_MASK) | ||
14013 | #define USART_CTL_AUTOBAUD_MASK (0x10000U) | ||
14014 | #define USART_CTL_AUTOBAUD_SHIFT (16U) | ||
14015 | /*! AUTOBAUD - Autobaud enable. | ||
14016 | * 0b0..Disabled. USART is in normal operating mode. | ||
14017 | * 0b1..Enabled. USART is in autobaud mode. This bit should only be set when the USART receiver is idle. The | ||
14018 | * first start bit of RX is measured and used the update the BRG register to match the received data rate. | ||
14019 | * AUTOBAUD is cleared once this process is complete, or if there is an AERR. | ||
14020 | */ | ||
14021 | #define USART_CTL_AUTOBAUD(x) (((uint32_t)(((uint32_t)(x)) << USART_CTL_AUTOBAUD_SHIFT)) & USART_CTL_AUTOBAUD_MASK) | ||
14022 | /*! @} */ | ||
14023 | |||
14024 | /*! @name STAT - USART Status register. The complete status value can be read here. Writing ones clears some bits in the register. Some bits can be cleared by writing a 1 to them. */ | ||
14025 | /*! @{ */ | ||
14026 | #define USART_STAT_RXIDLE_MASK (0x2U) | ||
14027 | #define USART_STAT_RXIDLE_SHIFT (1U) | ||
14028 | /*! RXIDLE - Receiver Idle. When 0, indicates that the receiver is currently in the process of | ||
14029 | * receiving data. When 1, indicates that the receiver is not currently in the process of receiving | ||
14030 | * data. | ||
14031 | */ | ||
14032 | #define USART_STAT_RXIDLE(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_RXIDLE_SHIFT)) & USART_STAT_RXIDLE_MASK) | ||
14033 | #define USART_STAT_TXIDLE_MASK (0x8U) | ||
14034 | #define USART_STAT_TXIDLE_SHIFT (3U) | ||
14035 | /*! TXIDLE - Transmitter Idle. When 0, indicates that the transmitter is currently in the process of | ||
14036 | * sending data.When 1, indicate that the transmitter is not currently in the process of sending | ||
14037 | * data. | ||
14038 | */ | ||
14039 | #define USART_STAT_TXIDLE(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_TXIDLE_SHIFT)) & USART_STAT_TXIDLE_MASK) | ||
14040 | #define USART_STAT_CTS_MASK (0x10U) | ||
14041 | #define USART_STAT_CTS_SHIFT (4U) | ||
14042 | /*! CTS - This bit reflects the current state of the CTS signal, regardless of the setting of the | ||
14043 | * CTSEN bit in the CFG register. This will be the value of the CTS input pin unless loopback mode | ||
14044 | * is enabled. | ||
14045 | */ | ||
14046 | #define USART_STAT_CTS(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_CTS_SHIFT)) & USART_STAT_CTS_MASK) | ||
14047 | #define USART_STAT_DELTACTS_MASK (0x20U) | ||
14048 | #define USART_STAT_DELTACTS_SHIFT (5U) | ||
14049 | /*! DELTACTS - This bit is set when a change in the state is detected for the CTS flag above. This bit is cleared by software. | ||
14050 | */ | ||
14051 | #define USART_STAT_DELTACTS(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_DELTACTS_SHIFT)) & USART_STAT_DELTACTS_MASK) | ||
14052 | #define USART_STAT_TXDISSTAT_MASK (0x40U) | ||
14053 | #define USART_STAT_TXDISSTAT_SHIFT (6U) | ||
14054 | /*! TXDISSTAT - Transmitter Disabled Status flag. When 1, this bit indicates that the USART | ||
14055 | * transmitter is fully idle after being disabled via the TXDIS bit in the CFG register (TXDIS = 1). | ||
14056 | */ | ||
14057 | #define USART_STAT_TXDISSTAT(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_TXDISSTAT_SHIFT)) & USART_STAT_TXDISSTAT_MASK) | ||
14058 | #define USART_STAT_RXBRK_MASK (0x400U) | ||
14059 | #define USART_STAT_RXBRK_SHIFT (10U) | ||
14060 | /*! RXBRK - Received Break. This bit reflects the current state of the receiver break detection | ||
14061 | * logic. It is set when the Un_RXD pin remains low for 16 bit times. Note that FRAMERRINT will also | ||
14062 | * be set when this condition occurs because the stop bit(s) for the character would be missing. | ||
14063 | * RXBRK is cleared when the Un_RXD pin goes high. | ||
14064 | */ | ||
14065 | #define USART_STAT_RXBRK(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_RXBRK_SHIFT)) & USART_STAT_RXBRK_MASK) | ||
14066 | #define USART_STAT_DELTARXBRK_MASK (0x800U) | ||
14067 | #define USART_STAT_DELTARXBRK_SHIFT (11U) | ||
14068 | /*! DELTARXBRK - This bit is set when a change in the state of receiver break detection occurs. Cleared by software. | ||
14069 | */ | ||
14070 | #define USART_STAT_DELTARXBRK(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_DELTARXBRK_SHIFT)) & USART_STAT_DELTARXBRK_MASK) | ||
14071 | #define USART_STAT_START_MASK (0x1000U) | ||
14072 | #define USART_STAT_START_SHIFT (12U) | ||
14073 | /*! START - This bit is set when a start is detected on the receiver input. Its purpose is primarily | ||
14074 | * to allow wake-up from Deep-sleep or Power-down mode immediately when a start is detected. | ||
14075 | * Cleared by software. | ||
14076 | */ | ||
14077 | #define USART_STAT_START(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_START_SHIFT)) & USART_STAT_START_MASK) | ||
14078 | #define USART_STAT_FRAMERRINT_MASK (0x2000U) | ||
14079 | #define USART_STAT_FRAMERRINT_SHIFT (13U) | ||
14080 | /*! FRAMERRINT - Framing Error interrupt flag. This flag is set when a character is received with a | ||
14081 | * missing stop bit at the expected location. This could be an indication of a baud rate or | ||
14082 | * configuration mismatch with the transmitting source. | ||
14083 | */ | ||
14084 | #define USART_STAT_FRAMERRINT(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_FRAMERRINT_SHIFT)) & USART_STAT_FRAMERRINT_MASK) | ||
14085 | #define USART_STAT_PARITYERRINT_MASK (0x4000U) | ||
14086 | #define USART_STAT_PARITYERRINT_SHIFT (14U) | ||
14087 | /*! PARITYERRINT - Parity Error interrupt flag. This flag is set when a parity error is detected in a received character. | ||
14088 | */ | ||
14089 | #define USART_STAT_PARITYERRINT(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_PARITYERRINT_SHIFT)) & USART_STAT_PARITYERRINT_MASK) | ||
14090 | #define USART_STAT_RXNOISEINT_MASK (0x8000U) | ||
14091 | #define USART_STAT_RXNOISEINT_SHIFT (15U) | ||
14092 | /*! RXNOISEINT - Received Noise interrupt flag. Three samples of received data are taken in order to | ||
14093 | * determine the value of each received data bit, except in synchronous mode. This acts as a | ||
14094 | * noise filter if one sample disagrees. This flag is set when a received data bit contains one | ||
14095 | * disagreeing sample. This could indicate line noise, a baud rate or character format mismatch, or | ||
14096 | * loss of synchronization during data reception. | ||
14097 | */ | ||
14098 | #define USART_STAT_RXNOISEINT(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_RXNOISEINT_SHIFT)) & USART_STAT_RXNOISEINT_MASK) | ||
14099 | #define USART_STAT_ABERR_MASK (0x10000U) | ||
14100 | #define USART_STAT_ABERR_SHIFT (16U) | ||
14101 | /*! ABERR - Auto baud Error. An auto baud error can occur if the BRG counts to its limit before the | ||
14102 | * end of the start bit that is being measured, essentially an auto baud time-out. | ||
14103 | */ | ||
14104 | #define USART_STAT_ABERR(x) (((uint32_t)(((uint32_t)(x)) << USART_STAT_ABERR_SHIFT)) & USART_STAT_ABERR_MASK) | ||
14105 | /*! @} */ | ||
14106 | |||
14107 | /*! @name INTENSET - Interrupt Enable read and Set register for USART (not FIFO) status. Contains individual interrupt enable bits for each potential USART interrupt. A complete value may be read from this register. Writing a 1 to any implemented bit position causes that bit to be set. */ | ||
14108 | /*! @{ */ | ||
14109 | #define USART_INTENSET_TXIDLEEN_MASK (0x8U) | ||
14110 | #define USART_INTENSET_TXIDLEEN_SHIFT (3U) | ||
14111 | /*! TXIDLEEN - When 1, enables an interrupt when the transmitter becomes idle (TXIDLE = 1). | ||
14112 | */ | ||
14113 | #define USART_INTENSET_TXIDLEEN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_TXIDLEEN_SHIFT)) & USART_INTENSET_TXIDLEEN_MASK) | ||
14114 | #define USART_INTENSET_DELTACTSEN_MASK (0x20U) | ||
14115 | #define USART_INTENSET_DELTACTSEN_SHIFT (5U) | ||
14116 | /*! DELTACTSEN - When 1, enables an interrupt when there is a change in the state of the CTS input. | ||
14117 | */ | ||
14118 | #define USART_INTENSET_DELTACTSEN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_DELTACTSEN_SHIFT)) & USART_INTENSET_DELTACTSEN_MASK) | ||
14119 | #define USART_INTENSET_TXDISEN_MASK (0x40U) | ||
14120 | #define USART_INTENSET_TXDISEN_SHIFT (6U) | ||
14121 | /*! TXDISEN - When 1, enables an interrupt when the transmitter is fully disabled as indicated by | ||
14122 | * the TXDISINT flag in STAT. See description of the TXDISINT bit for details. | ||
14123 | */ | ||
14124 | #define USART_INTENSET_TXDISEN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_TXDISEN_SHIFT)) & USART_INTENSET_TXDISEN_MASK) | ||
14125 | #define USART_INTENSET_DELTARXBRKEN_MASK (0x800U) | ||
14126 | #define USART_INTENSET_DELTARXBRKEN_SHIFT (11U) | ||
14127 | /*! DELTARXBRKEN - When 1, enables an interrupt when a change of state has occurred in the detection | ||
14128 | * of a received break condition (break condition asserted or deasserted). | ||
14129 | */ | ||
14130 | #define USART_INTENSET_DELTARXBRKEN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_DELTARXBRKEN_SHIFT)) & USART_INTENSET_DELTARXBRKEN_MASK) | ||
14131 | #define USART_INTENSET_STARTEN_MASK (0x1000U) | ||
14132 | #define USART_INTENSET_STARTEN_SHIFT (12U) | ||
14133 | /*! STARTEN - When 1, enables an interrupt when a received start bit has been detected. | ||
14134 | */ | ||
14135 | #define USART_INTENSET_STARTEN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_STARTEN_SHIFT)) & USART_INTENSET_STARTEN_MASK) | ||
14136 | #define USART_INTENSET_FRAMERREN_MASK (0x2000U) | ||
14137 | #define USART_INTENSET_FRAMERREN_SHIFT (13U) | ||
14138 | /*! FRAMERREN - When 1, enables an interrupt when a framing error has been detected. | ||
14139 | */ | ||
14140 | #define USART_INTENSET_FRAMERREN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_FRAMERREN_SHIFT)) & USART_INTENSET_FRAMERREN_MASK) | ||
14141 | #define USART_INTENSET_PARITYERREN_MASK (0x4000U) | ||
14142 | #define USART_INTENSET_PARITYERREN_SHIFT (14U) | ||
14143 | /*! PARITYERREN - When 1, enables an interrupt when a parity error has been detected. | ||
14144 | */ | ||
14145 | #define USART_INTENSET_PARITYERREN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_PARITYERREN_SHIFT)) & USART_INTENSET_PARITYERREN_MASK) | ||
14146 | #define USART_INTENSET_RXNOISEEN_MASK (0x8000U) | ||
14147 | #define USART_INTENSET_RXNOISEEN_SHIFT (15U) | ||
14148 | /*! RXNOISEEN - When 1, enables an interrupt when noise is detected. See description of the RXNOISEINT bit in Table 354. | ||
14149 | */ | ||
14150 | #define USART_INTENSET_RXNOISEEN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_RXNOISEEN_SHIFT)) & USART_INTENSET_RXNOISEEN_MASK) | ||
14151 | #define USART_INTENSET_ABERREN_MASK (0x10000U) | ||
14152 | #define USART_INTENSET_ABERREN_SHIFT (16U) | ||
14153 | /*! ABERREN - When 1, enables an interrupt when an auto baud error occurs. | ||
14154 | */ | ||
14155 | #define USART_INTENSET_ABERREN(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENSET_ABERREN_SHIFT)) & USART_INTENSET_ABERREN_MASK) | ||
14156 | /*! @} */ | ||
14157 | |||
14158 | /*! @name INTENCLR - Interrupt Enable Clear register. Allows clearing any combination of bits in the INTENSET register. Writing a 1 to any implemented bit position causes the corresponding bit to be cleared. */ | ||
14159 | /*! @{ */ | ||
14160 | #define USART_INTENCLR_TXIDLECLR_MASK (0x8U) | ||
14161 | #define USART_INTENCLR_TXIDLECLR_SHIFT (3U) | ||
14162 | /*! TXIDLECLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14163 | */ | ||
14164 | #define USART_INTENCLR_TXIDLECLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_TXIDLECLR_SHIFT)) & USART_INTENCLR_TXIDLECLR_MASK) | ||
14165 | #define USART_INTENCLR_DELTACTSCLR_MASK (0x20U) | ||
14166 | #define USART_INTENCLR_DELTACTSCLR_SHIFT (5U) | ||
14167 | /*! DELTACTSCLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14168 | */ | ||
14169 | #define USART_INTENCLR_DELTACTSCLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_DELTACTSCLR_SHIFT)) & USART_INTENCLR_DELTACTSCLR_MASK) | ||
14170 | #define USART_INTENCLR_TXDISCLR_MASK (0x40U) | ||
14171 | #define USART_INTENCLR_TXDISCLR_SHIFT (6U) | ||
14172 | /*! TXDISCLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14173 | */ | ||
14174 | #define USART_INTENCLR_TXDISCLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_TXDISCLR_SHIFT)) & USART_INTENCLR_TXDISCLR_MASK) | ||
14175 | #define USART_INTENCLR_DELTARXBRKCLR_MASK (0x800U) | ||
14176 | #define USART_INTENCLR_DELTARXBRKCLR_SHIFT (11U) | ||
14177 | /*! DELTARXBRKCLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14178 | */ | ||
14179 | #define USART_INTENCLR_DELTARXBRKCLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_DELTARXBRKCLR_SHIFT)) & USART_INTENCLR_DELTARXBRKCLR_MASK) | ||
14180 | #define USART_INTENCLR_STARTCLR_MASK (0x1000U) | ||
14181 | #define USART_INTENCLR_STARTCLR_SHIFT (12U) | ||
14182 | /*! STARTCLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14183 | */ | ||
14184 | #define USART_INTENCLR_STARTCLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_STARTCLR_SHIFT)) & USART_INTENCLR_STARTCLR_MASK) | ||
14185 | #define USART_INTENCLR_FRAMERRCLR_MASK (0x2000U) | ||
14186 | #define USART_INTENCLR_FRAMERRCLR_SHIFT (13U) | ||
14187 | /*! FRAMERRCLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14188 | */ | ||
14189 | #define USART_INTENCLR_FRAMERRCLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_FRAMERRCLR_SHIFT)) & USART_INTENCLR_FRAMERRCLR_MASK) | ||
14190 | #define USART_INTENCLR_PARITYERRCLR_MASK (0x4000U) | ||
14191 | #define USART_INTENCLR_PARITYERRCLR_SHIFT (14U) | ||
14192 | /*! PARITYERRCLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14193 | */ | ||
14194 | #define USART_INTENCLR_PARITYERRCLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_PARITYERRCLR_SHIFT)) & USART_INTENCLR_PARITYERRCLR_MASK) | ||
14195 | #define USART_INTENCLR_RXNOISECLR_MASK (0x8000U) | ||
14196 | #define USART_INTENCLR_RXNOISECLR_SHIFT (15U) | ||
14197 | /*! RXNOISECLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14198 | */ | ||
14199 | #define USART_INTENCLR_RXNOISECLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_RXNOISECLR_SHIFT)) & USART_INTENCLR_RXNOISECLR_MASK) | ||
14200 | #define USART_INTENCLR_ABERRCLR_MASK (0x10000U) | ||
14201 | #define USART_INTENCLR_ABERRCLR_SHIFT (16U) | ||
14202 | /*! ABERRCLR - Writing 1 clears the corresponding bit in the INTENSET register. | ||
14203 | */ | ||
14204 | #define USART_INTENCLR_ABERRCLR(x) (((uint32_t)(((uint32_t)(x)) << USART_INTENCLR_ABERRCLR_SHIFT)) & USART_INTENCLR_ABERRCLR_MASK) | ||
14205 | /*! @} */ | ||
14206 | |||
14207 | /*! @name BRG - Baud Rate Generator register. 16-bit integer baud rate divisor value. */ | ||
14208 | /*! @{ */ | ||
14209 | #define USART_BRG_BRGVAL_MASK (0xFFFFU) | ||
14210 | #define USART_BRG_BRGVAL_SHIFT (0U) | ||
14211 | /*! BRGVAL - This value is used to divide the USART input clock to determine the baud rate, based on | ||
14212 | * the input clock from the FRG. 0 = FCLK is used directly by the USART function. 1 = FCLK is | ||
14213 | * divided by 2 before use by the USART function. 2 = FCLK is divided by 3 before use by the USART | ||
14214 | * function. 0xFFFF = FCLK is divided by 65,536 before use by the USART function. | ||
14215 | */ | ||
14216 | #define USART_BRG_BRGVAL(x) (((uint32_t)(((uint32_t)(x)) << USART_BRG_BRGVAL_SHIFT)) & USART_BRG_BRGVAL_MASK) | ||
14217 | /*! @} */ | ||
14218 | |||
14219 | /*! @name INTSTAT - Interrupt status register. Reflects interrupts that are currently enabled. */ | ||
14220 | /*! @{ */ | ||
14221 | #define USART_INTSTAT_TXIDLE_MASK (0x8U) | ||
14222 | #define USART_INTSTAT_TXIDLE_SHIFT (3U) | ||
14223 | /*! TXIDLE - Transmitter Idle status. | ||
14224 | */ | ||
14225 | #define USART_INTSTAT_TXIDLE(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_TXIDLE_SHIFT)) & USART_INTSTAT_TXIDLE_MASK) | ||
14226 | #define USART_INTSTAT_DELTACTS_MASK (0x20U) | ||
14227 | #define USART_INTSTAT_DELTACTS_SHIFT (5U) | ||
14228 | /*! DELTACTS - This bit is set when a change in the state of the CTS input is detected. | ||
14229 | */ | ||
14230 | #define USART_INTSTAT_DELTACTS(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_DELTACTS_SHIFT)) & USART_INTSTAT_DELTACTS_MASK) | ||
14231 | #define USART_INTSTAT_TXDISINT_MASK (0x40U) | ||
14232 | #define USART_INTSTAT_TXDISINT_SHIFT (6U) | ||
14233 | /*! TXDISINT - Transmitter Disabled Interrupt flag. | ||
14234 | */ | ||
14235 | #define USART_INTSTAT_TXDISINT(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_TXDISINT_SHIFT)) & USART_INTSTAT_TXDISINT_MASK) | ||
14236 | #define USART_INTSTAT_DELTARXBRK_MASK (0x800U) | ||
14237 | #define USART_INTSTAT_DELTARXBRK_SHIFT (11U) | ||
14238 | /*! DELTARXBRK - This bit is set when a change in the state of receiver break detection occurs. | ||
14239 | */ | ||
14240 | #define USART_INTSTAT_DELTARXBRK(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_DELTARXBRK_SHIFT)) & USART_INTSTAT_DELTARXBRK_MASK) | ||
14241 | #define USART_INTSTAT_START_MASK (0x1000U) | ||
14242 | #define USART_INTSTAT_START_SHIFT (12U) | ||
14243 | /*! START - This bit is set when a start is detected on the receiver input. | ||
14244 | */ | ||
14245 | #define USART_INTSTAT_START(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_START_SHIFT)) & USART_INTSTAT_START_MASK) | ||
14246 | #define USART_INTSTAT_FRAMERRINT_MASK (0x2000U) | ||
14247 | #define USART_INTSTAT_FRAMERRINT_SHIFT (13U) | ||
14248 | /*! FRAMERRINT - Framing Error interrupt flag. | ||
14249 | */ | ||
14250 | #define USART_INTSTAT_FRAMERRINT(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_FRAMERRINT_SHIFT)) & USART_INTSTAT_FRAMERRINT_MASK) | ||
14251 | #define USART_INTSTAT_PARITYERRINT_MASK (0x4000U) | ||
14252 | #define USART_INTSTAT_PARITYERRINT_SHIFT (14U) | ||
14253 | /*! PARITYERRINT - Parity Error interrupt flag. | ||
14254 | */ | ||
14255 | #define USART_INTSTAT_PARITYERRINT(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_PARITYERRINT_SHIFT)) & USART_INTSTAT_PARITYERRINT_MASK) | ||
14256 | #define USART_INTSTAT_RXNOISEINT_MASK (0x8000U) | ||
14257 | #define USART_INTSTAT_RXNOISEINT_SHIFT (15U) | ||
14258 | /*! RXNOISEINT - Received Noise interrupt flag. | ||
14259 | */ | ||
14260 | #define USART_INTSTAT_RXNOISEINT(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_RXNOISEINT_SHIFT)) & USART_INTSTAT_RXNOISEINT_MASK) | ||
14261 | #define USART_INTSTAT_ABERRINT_MASK (0x10000U) | ||
14262 | #define USART_INTSTAT_ABERRINT_SHIFT (16U) | ||
14263 | /*! ABERRINT - Auto baud Error Interrupt flag. | ||
14264 | */ | ||
14265 | #define USART_INTSTAT_ABERRINT(x) (((uint32_t)(((uint32_t)(x)) << USART_INTSTAT_ABERRINT_SHIFT)) & USART_INTSTAT_ABERRINT_MASK) | ||
14266 | /*! @} */ | ||
14267 | |||
14268 | /*! @name OSR - Oversample selection register for asynchronous communication. */ | ||
14269 | /*! @{ */ | ||
14270 | #define USART_OSR_OSRVAL_MASK (0xFU) | ||
14271 | #define USART_OSR_OSRVAL_SHIFT (0U) | ||
14272 | /*! OSRVAL - Oversample Selection Value. 0 to 3 = not supported 0x4 = 5 function clocks are used to | ||
14273 | * transmit and receive each data bit. 0x5 = 6 function clocks are used to transmit and receive | ||
14274 | * each data bit. 0xF= 16 function clocks are used to transmit and receive each data bit. | ||
14275 | */ | ||
14276 | #define USART_OSR_OSRVAL(x) (((uint32_t)(((uint32_t)(x)) << USART_OSR_OSRVAL_SHIFT)) & USART_OSR_OSRVAL_MASK) | ||
14277 | /*! @} */ | ||
14278 | |||
14279 | /*! @name ADDR - Address register for automatic address matching. */ | ||
14280 | /*! @{ */ | ||
14281 | #define USART_ADDR_ADDRESS_MASK (0xFFU) | ||
14282 | #define USART_ADDR_ADDRESS_SHIFT (0U) | ||
14283 | /*! ADDRESS - 8-bit address used with automatic address matching. Used when address detection is | ||
14284 | * enabled (ADDRDET in CTL = 1) and automatic address matching is enabled (AUTOADDR in CFG = 1). | ||
14285 | */ | ||
14286 | #define USART_ADDR_ADDRESS(x) (((uint32_t)(((uint32_t)(x)) << USART_ADDR_ADDRESS_SHIFT)) & USART_ADDR_ADDRESS_MASK) | ||
14287 | /*! @} */ | ||
14288 | |||
14289 | /*! @name FIFOCFG - FIFO configuration and enable register. */ | ||
14290 | /*! @{ */ | ||
14291 | #define USART_FIFOCFG_ENABLETX_MASK (0x1U) | ||
14292 | #define USART_FIFOCFG_ENABLETX_SHIFT (0U) | ||
14293 | /*! ENABLETX - Enable the transmit FIFO. | ||
14294 | * 0b0..The transmit FIFO is not enabled. | ||
14295 | * 0b1..The transmit FIFO is enabled. | ||
14296 | */ | ||
14297 | #define USART_FIFOCFG_ENABLETX(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_ENABLETX_SHIFT)) & USART_FIFOCFG_ENABLETX_MASK) | ||
14298 | #define USART_FIFOCFG_ENABLERX_MASK (0x2U) | ||
14299 | #define USART_FIFOCFG_ENABLERX_SHIFT (1U) | ||
14300 | /*! ENABLERX - Enable the receive FIFO. | ||
14301 | * 0b0..The receive FIFO is not enabled. | ||
14302 | * 0b1..The receive FIFO is enabled. | ||
14303 | */ | ||
14304 | #define USART_FIFOCFG_ENABLERX(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_ENABLERX_SHIFT)) & USART_FIFOCFG_ENABLERX_MASK) | ||
14305 | #define USART_FIFOCFG_SIZE_MASK (0x30U) | ||
14306 | #define USART_FIFOCFG_SIZE_SHIFT (4U) | ||
14307 | /*! SIZE - FIFO size configuration. This is a read-only field. 0x0 = FIFO is configured as 16 | ||
14308 | * entries of 8 bits. 0x1, 0x2, 0x3 = not applicable to USART. | ||
14309 | */ | ||
14310 | #define USART_FIFOCFG_SIZE(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_SIZE_SHIFT)) & USART_FIFOCFG_SIZE_MASK) | ||
14311 | #define USART_FIFOCFG_DMATX_MASK (0x1000U) | ||
14312 | #define USART_FIFOCFG_DMATX_SHIFT (12U) | ||
14313 | /*! DMATX - DMA configuration for transmit. | ||
14314 | * 0b0..DMA is not used for the transmit function. | ||
14315 | * 0b1..Trigger DMA for the transmit function if the FIFO is not full. Generally, data interrupts would be disabled if DMA is enabled. | ||
14316 | */ | ||
14317 | #define USART_FIFOCFG_DMATX(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_DMATX_SHIFT)) & USART_FIFOCFG_DMATX_MASK) | ||
14318 | #define USART_FIFOCFG_DMARX_MASK (0x2000U) | ||
14319 | #define USART_FIFOCFG_DMARX_SHIFT (13U) | ||
14320 | /*! DMARX - DMA configuration for receive. | ||
14321 | * 0b0..DMA is not used for the receive function. | ||
14322 | * 0b1..Trigger DMA for the receive function if the FIFO is not empty. Generally, data interrupts would be disabled if DMA is enabled. | ||
14323 | */ | ||
14324 | #define USART_FIFOCFG_DMARX(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_DMARX_SHIFT)) & USART_FIFOCFG_DMARX_MASK) | ||
14325 | #define USART_FIFOCFG_WAKETX_MASK (0x4000U) | ||
14326 | #define USART_FIFOCFG_WAKETX_SHIFT (14U) | ||
14327 | /*! WAKETX - Wake-up for transmit FIFO level. This allows the device to be woken from reduced power | ||
14328 | * modes (up to power-down, as long as the peripheral function works in that power mode) without | ||
14329 | * enabling the TXLVL interrupt. Only DMA wakes up, processes data, and goes back to sleep. The | ||
14330 | * CPU will remain stopped until woken by another cause, such as DMA completion. See Hardware | ||
14331 | * Wake-up control register. | ||
14332 | * 0b0..Only enabled interrupts will wake up the device form reduced power modes. | ||
14333 | * 0b1..A device wake-up for DMA will occur if the transmit FIFO level reaches the value specified by TXLVL in | ||
14334 | * FIFOTRIG, even when the TXLVL interrupt is not enabled. | ||
14335 | */ | ||
14336 | #define USART_FIFOCFG_WAKETX(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_WAKETX_SHIFT)) & USART_FIFOCFG_WAKETX_MASK) | ||
14337 | #define USART_FIFOCFG_WAKERX_MASK (0x8000U) | ||
14338 | #define USART_FIFOCFG_WAKERX_SHIFT (15U) | ||
14339 | /*! WAKERX - Wake-up for receive FIFO level. This allows the device to be woken from reduced power | ||
14340 | * modes (up to power-down, as long as the peripheral function works in that power mode) without | ||
14341 | * enabling the TXLVL interrupt. Only DMA wakes up, processes data, and goes back to sleep. The | ||
14342 | * CPU will remain stopped until woken by another cause, such as DMA completion. See Hardware | ||
14343 | * Wake-up control register. | ||
14344 | * 0b0..Only enabled interrupts will wake up the device form reduced power modes. | ||
14345 | * 0b1..A device wake-up for DMA will occur if the receive FIFO level reaches the value specified by RXLVL in | ||
14346 | * FIFOTRIG, even when the RXLVL interrupt is not enabled. | ||
14347 | */ | ||
14348 | #define USART_FIFOCFG_WAKERX(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_WAKERX_SHIFT)) & USART_FIFOCFG_WAKERX_MASK) | ||
14349 | #define USART_FIFOCFG_EMPTYTX_MASK (0x10000U) | ||
14350 | #define USART_FIFOCFG_EMPTYTX_SHIFT (16U) | ||
14351 | /*! EMPTYTX - Empty command for the transmit FIFO. When a 1 is written to this bit, the TX FIFO is emptied. | ||
14352 | */ | ||
14353 | #define USART_FIFOCFG_EMPTYTX(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_EMPTYTX_SHIFT)) & USART_FIFOCFG_EMPTYTX_MASK) | ||
14354 | #define USART_FIFOCFG_EMPTYRX_MASK (0x20000U) | ||
14355 | #define USART_FIFOCFG_EMPTYRX_SHIFT (17U) | ||
14356 | /*! EMPTYRX - Empty command for the receive FIFO. When a 1 is written to this bit, the RX FIFO is emptied. | ||
14357 | */ | ||
14358 | #define USART_FIFOCFG_EMPTYRX(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOCFG_EMPTYRX_SHIFT)) & USART_FIFOCFG_EMPTYRX_MASK) | ||
14359 | /*! @} */ | ||
14360 | |||
14361 | /*! @name FIFOSTAT - FIFO status register. */ | ||
14362 | /*! @{ */ | ||
14363 | #define USART_FIFOSTAT_TXERR_MASK (0x1U) | ||
14364 | #define USART_FIFOSTAT_TXERR_SHIFT (0U) | ||
14365 | /*! TXERR - TX FIFO error. Will be set if a transmit FIFO error occurs. This could be an overflow | ||
14366 | * caused by pushing data into a full FIFO, or by an underflow if the FIFO is empty when data is | ||
14367 | * needed. Cleared by writing a 1 to this bit. | ||
14368 | */ | ||
14369 | #define USART_FIFOSTAT_TXERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_TXERR_SHIFT)) & USART_FIFOSTAT_TXERR_MASK) | ||
14370 | #define USART_FIFOSTAT_RXERR_MASK (0x2U) | ||
14371 | #define USART_FIFOSTAT_RXERR_SHIFT (1U) | ||
14372 | /*! RXERR - RX FIFO error. Will be set if a receive FIFO overflow occurs, caused by software or DMA | ||
14373 | * not emptying the FIFO fast enough. Cleared by writing a 1 to this bit. | ||
14374 | */ | ||
14375 | #define USART_FIFOSTAT_RXERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_RXERR_SHIFT)) & USART_FIFOSTAT_RXERR_MASK) | ||
14376 | #define USART_FIFOSTAT_PERINT_MASK (0x8U) | ||
14377 | #define USART_FIFOSTAT_PERINT_SHIFT (3U) | ||
14378 | /*! PERINT - Peripheral interrupt. When 1, this indicates that the peripheral function has asserted | ||
14379 | * an interrupt. The details can be found by reading the peripheral's STAT register. | ||
14380 | */ | ||
14381 | #define USART_FIFOSTAT_PERINT(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_PERINT_SHIFT)) & USART_FIFOSTAT_PERINT_MASK) | ||
14382 | #define USART_FIFOSTAT_TXEMPTY_MASK (0x10U) | ||
14383 | #define USART_FIFOSTAT_TXEMPTY_SHIFT (4U) | ||
14384 | /*! TXEMPTY - Transmit FIFO empty. When 1, the transmit FIFO is empty. The peripheral may still be processing the last piece of data. | ||
14385 | */ | ||
14386 | #define USART_FIFOSTAT_TXEMPTY(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_TXEMPTY_SHIFT)) & USART_FIFOSTAT_TXEMPTY_MASK) | ||
14387 | #define USART_FIFOSTAT_TXNOTFULL_MASK (0x20U) | ||
14388 | #define USART_FIFOSTAT_TXNOTFULL_SHIFT (5U) | ||
14389 | /*! TXNOTFULL - Transmit FIFO not full. When 1, the transmit FIFO is not full, so more data can be | ||
14390 | * written. When 0, the transmit FIFO is full and another write would cause it to overflow. | ||
14391 | */ | ||
14392 | #define USART_FIFOSTAT_TXNOTFULL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_TXNOTFULL_SHIFT)) & USART_FIFOSTAT_TXNOTFULL_MASK) | ||
14393 | #define USART_FIFOSTAT_RXNOTEMPTY_MASK (0x40U) | ||
14394 | #define USART_FIFOSTAT_RXNOTEMPTY_SHIFT (6U) | ||
14395 | /*! RXNOTEMPTY - Receive FIFO not empty. When 1, the receive FIFO is not empty, so data can be read. When 0, the receive FIFO is empty. | ||
14396 | */ | ||
14397 | #define USART_FIFOSTAT_RXNOTEMPTY(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_RXNOTEMPTY_SHIFT)) & USART_FIFOSTAT_RXNOTEMPTY_MASK) | ||
14398 | #define USART_FIFOSTAT_RXFULL_MASK (0x80U) | ||
14399 | #define USART_FIFOSTAT_RXFULL_SHIFT (7U) | ||
14400 | /*! RXFULL - Receive FIFO full. When 1, the receive FIFO is full. Data needs to be read out to | ||
14401 | * prevent the peripheral from causing an overflow. | ||
14402 | */ | ||
14403 | #define USART_FIFOSTAT_RXFULL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_RXFULL_SHIFT)) & USART_FIFOSTAT_RXFULL_MASK) | ||
14404 | #define USART_FIFOSTAT_TXLVL_MASK (0x1F00U) | ||
14405 | #define USART_FIFOSTAT_TXLVL_SHIFT (8U) | ||
14406 | /*! TXLVL - Transmit FIFO current level. A 0 means the TX FIFO is currently empty, and the TXEMPTY | ||
14407 | * and TXNOTFULL flags will be 1. Other values tell how much data is actually in the TX FIFO at | ||
14408 | * the point where the read occurs. If the TX FIFO is full, the TXEMPTY and TXNOTFULL flags will be | ||
14409 | * 0. | ||
14410 | */ | ||
14411 | #define USART_FIFOSTAT_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_TXLVL_SHIFT)) & USART_FIFOSTAT_TXLVL_MASK) | ||
14412 | #define USART_FIFOSTAT_RXLVL_MASK (0x1F0000U) | ||
14413 | #define USART_FIFOSTAT_RXLVL_SHIFT (16U) | ||
14414 | /*! RXLVL - Receive FIFO current level. A 0 means the RX FIFO is currently empty, and the RXFULL and | ||
14415 | * RXNOTEMPTY flags will be 0. Other values tell how much data is actually in the RX FIFO at the | ||
14416 | * point where the read occurs. If the RX FIFO is full, the RXFULL and RXNOTEMPTY flags will be | ||
14417 | * 1. | ||
14418 | */ | ||
14419 | #define USART_FIFOSTAT_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOSTAT_RXLVL_SHIFT)) & USART_FIFOSTAT_RXLVL_MASK) | ||
14420 | /*! @} */ | ||
14421 | |||
14422 | /*! @name FIFOTRIG - FIFO trigger settings for interrupt and DMA request. */ | ||
14423 | /*! @{ */ | ||
14424 | #define USART_FIFOTRIG_TXLVLENA_MASK (0x1U) | ||
14425 | #define USART_FIFOTRIG_TXLVLENA_SHIFT (0U) | ||
14426 | /*! TXLVLENA - Transmit FIFO level trigger enable. This trigger will become an interrupt if enabled | ||
14427 | * in FIFOINTENSET, or a DMA trigger if DMATX in FIFOCFG is set. | ||
14428 | * 0b0..Transmit FIFO level does not generate a FIFO level trigger. | ||
14429 | * 0b1..An trigger will be generated if the transmit FIFO level reaches the value specified by the TXLVL field in this register. | ||
14430 | */ | ||
14431 | #define USART_FIFOTRIG_TXLVLENA(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOTRIG_TXLVLENA_SHIFT)) & USART_FIFOTRIG_TXLVLENA_MASK) | ||
14432 | #define USART_FIFOTRIG_RXLVLENA_MASK (0x2U) | ||
14433 | #define USART_FIFOTRIG_RXLVLENA_SHIFT (1U) | ||
14434 | /*! RXLVLENA - Receive FIFO level trigger enable. This trigger will become an interrupt if enabled | ||
14435 | * in FIFOINTENSET, or a DMA trigger if DMARX in FIFOCFG is set. | ||
14436 | * 0b0..Receive FIFO level does not generate a FIFO level trigger. | ||
14437 | * 0b1..An trigger will be generated if the receive FIFO level reaches the value specified by the RXLVL field in this register. | ||
14438 | */ | ||
14439 | #define USART_FIFOTRIG_RXLVLENA(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOTRIG_RXLVLENA_SHIFT)) & USART_FIFOTRIG_RXLVLENA_MASK) | ||
14440 | #define USART_FIFOTRIG_TXLVL_MASK (0xF00U) | ||
14441 | #define USART_FIFOTRIG_TXLVL_SHIFT (8U) | ||
14442 | /*! TXLVL - Transmit FIFO level trigger point. This field is used only when TXLVLENA = 1. If enabled | ||
14443 | * to do so, the FIFO level can wake up the device just enough to perform DMA, then return to | ||
14444 | * the reduced power mode. See Hardware Wake-up control register. 0 = trigger when the TX FIFO | ||
14445 | * becomes empty. 1 = trigger when the TX FIFO level decreases to one entry. 15 = trigger when the TX | ||
14446 | * FIFO level decreases to 15 entries (is no longer full). | ||
14447 | */ | ||
14448 | #define USART_FIFOTRIG_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOTRIG_TXLVL_SHIFT)) & USART_FIFOTRIG_TXLVL_MASK) | ||
14449 | #define USART_FIFOTRIG_RXLVL_MASK (0xF0000U) | ||
14450 | #define USART_FIFOTRIG_RXLVL_SHIFT (16U) | ||
14451 | /*! RXLVL - Receive FIFO level trigger point. The RX FIFO level is checked when a new piece of data | ||
14452 | * is received. This field is used only when RXLVLENA = 1. If enabled to do so, the FIFO level | ||
14453 | * can wake up the device just enough to perform DMA, then return to the reduced power mode. See | ||
14454 | * Hardware Wake-up control register. 0 = trigger when the RX FIFO has received one entry (is no | ||
14455 | * longer empty). 1 = trigger when the RX FIFO has received two entries. 15 = trigger when the RX | ||
14456 | * FIFO has received 16 entries (has become full). | ||
14457 | */ | ||
14458 | #define USART_FIFOTRIG_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOTRIG_RXLVL_SHIFT)) & USART_FIFOTRIG_RXLVL_MASK) | ||
14459 | /*! @} */ | ||
14460 | |||
14461 | /*! @name FIFOINTENSET - FIFO interrupt enable set (enable) and read register. */ | ||
14462 | /*! @{ */ | ||
14463 | #define USART_FIFOINTENSET_TXERR_MASK (0x1U) | ||
14464 | #define USART_FIFOINTENSET_TXERR_SHIFT (0U) | ||
14465 | /*! TXERR - Determines whether an interrupt occurs when a transmit error occurs, based on the TXERR flag in the FIFOSTAT register. | ||
14466 | * 0b0..No interrupt will be generated for a transmit error. | ||
14467 | * 0b1..An interrupt will be generated when a transmit error occurs. | ||
14468 | */ | ||
14469 | #define USART_FIFOINTENSET_TXERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTENSET_TXERR_SHIFT)) & USART_FIFOINTENSET_TXERR_MASK) | ||
14470 | #define USART_FIFOINTENSET_RXERR_MASK (0x2U) | ||
14471 | #define USART_FIFOINTENSET_RXERR_SHIFT (1U) | ||
14472 | /*! RXERR - Determines whether an interrupt occurs when a receive error occurs, based on the RXERR flag in the FIFOSTAT register. | ||
14473 | * 0b0..No interrupt will be generated for a receive error. | ||
14474 | * 0b1..An interrupt will be generated when a receive error occurs. | ||
14475 | */ | ||
14476 | #define USART_FIFOINTENSET_RXERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTENSET_RXERR_SHIFT)) & USART_FIFOINTENSET_RXERR_MASK) | ||
14477 | #define USART_FIFOINTENSET_TXLVL_MASK (0x4U) | ||
14478 | #define USART_FIFOINTENSET_TXLVL_SHIFT (2U) | ||
14479 | /*! TXLVL - Determines whether an interrupt occurs when a the transmit FIFO reaches the level | ||
14480 | * specified by the TXLVL field in the FIFOTRIG register. | ||
14481 | * 0b0..No interrupt will be generated based on the TX FIFO level. | ||
14482 | * 0b1..If TXLVLENA in the FIFOTRIG register = 1, an interrupt will be generated when the TX FIFO level decreases | ||
14483 | * to the level specified by TXLVL in the FIFOTRIG register. | ||
14484 | */ | ||
14485 | #define USART_FIFOINTENSET_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTENSET_TXLVL_SHIFT)) & USART_FIFOINTENSET_TXLVL_MASK) | ||
14486 | #define USART_FIFOINTENSET_RXLVL_MASK (0x8U) | ||
14487 | #define USART_FIFOINTENSET_RXLVL_SHIFT (3U) | ||
14488 | /*! RXLVL - Determines whether an interrupt occurs when a the receive FIFO reaches the level | ||
14489 | * specified by the TXLVL field in the FIFOTRIG register. | ||
14490 | * 0b0..No interrupt will be generated based on the RX FIFO level. | ||
14491 | * 0b1..If RXLVLENA in the FIFOTRIG register = 1, an interrupt will be generated when the when the RX FIFO level | ||
14492 | * increases to the level specified by RXLVL in the FIFOTRIG register. | ||
14493 | */ | ||
14494 | #define USART_FIFOINTENSET_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTENSET_RXLVL_SHIFT)) & USART_FIFOINTENSET_RXLVL_MASK) | ||
14495 | /*! @} */ | ||
14496 | |||
14497 | /*! @name FIFOINTENCLR - FIFO interrupt enable clear (disable) and read register. */ | ||
14498 | /*! @{ */ | ||
14499 | #define USART_FIFOINTENCLR_TXERR_MASK (0x1U) | ||
14500 | #define USART_FIFOINTENCLR_TXERR_SHIFT (0U) | ||
14501 | /*! TXERR - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
14502 | */ | ||
14503 | #define USART_FIFOINTENCLR_TXERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTENCLR_TXERR_SHIFT)) & USART_FIFOINTENCLR_TXERR_MASK) | ||
14504 | #define USART_FIFOINTENCLR_RXERR_MASK (0x2U) | ||
14505 | #define USART_FIFOINTENCLR_RXERR_SHIFT (1U) | ||
14506 | /*! RXERR - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
14507 | */ | ||
14508 | #define USART_FIFOINTENCLR_RXERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTENCLR_RXERR_SHIFT)) & USART_FIFOINTENCLR_RXERR_MASK) | ||
14509 | #define USART_FIFOINTENCLR_TXLVL_MASK (0x4U) | ||
14510 | #define USART_FIFOINTENCLR_TXLVL_SHIFT (2U) | ||
14511 | /*! TXLVL - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
14512 | */ | ||
14513 | #define USART_FIFOINTENCLR_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTENCLR_TXLVL_SHIFT)) & USART_FIFOINTENCLR_TXLVL_MASK) | ||
14514 | #define USART_FIFOINTENCLR_RXLVL_MASK (0x8U) | ||
14515 | #define USART_FIFOINTENCLR_RXLVL_SHIFT (3U) | ||
14516 | /*! RXLVL - Writing one clears the corresponding bits in the FIFOINTENSET register. | ||
14517 | */ | ||
14518 | #define USART_FIFOINTENCLR_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTENCLR_RXLVL_SHIFT)) & USART_FIFOINTENCLR_RXLVL_MASK) | ||
14519 | /*! @} */ | ||
14520 | |||
14521 | /*! @name FIFOINTSTAT - FIFO interrupt status register. */ | ||
14522 | /*! @{ */ | ||
14523 | #define USART_FIFOINTSTAT_TXERR_MASK (0x1U) | ||
14524 | #define USART_FIFOINTSTAT_TXERR_SHIFT (0U) | ||
14525 | /*! TXERR - TX FIFO error. | ||
14526 | */ | ||
14527 | #define USART_FIFOINTSTAT_TXERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTSTAT_TXERR_SHIFT)) & USART_FIFOINTSTAT_TXERR_MASK) | ||
14528 | #define USART_FIFOINTSTAT_RXERR_MASK (0x2U) | ||
14529 | #define USART_FIFOINTSTAT_RXERR_SHIFT (1U) | ||
14530 | /*! RXERR - RX FIFO error. | ||
14531 | */ | ||
14532 | #define USART_FIFOINTSTAT_RXERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTSTAT_RXERR_SHIFT)) & USART_FIFOINTSTAT_RXERR_MASK) | ||
14533 | #define USART_FIFOINTSTAT_TXLVL_MASK (0x4U) | ||
14534 | #define USART_FIFOINTSTAT_TXLVL_SHIFT (2U) | ||
14535 | /*! TXLVL - Transmit FIFO level interrupt. | ||
14536 | */ | ||
14537 | #define USART_FIFOINTSTAT_TXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTSTAT_TXLVL_SHIFT)) & USART_FIFOINTSTAT_TXLVL_MASK) | ||
14538 | #define USART_FIFOINTSTAT_RXLVL_MASK (0x8U) | ||
14539 | #define USART_FIFOINTSTAT_RXLVL_SHIFT (3U) | ||
14540 | /*! RXLVL - Receive FIFO level interrupt. | ||
14541 | */ | ||
14542 | #define USART_FIFOINTSTAT_RXLVL(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTSTAT_RXLVL_SHIFT)) & USART_FIFOINTSTAT_RXLVL_MASK) | ||
14543 | #define USART_FIFOINTSTAT_PERINT_MASK (0x10U) | ||
14544 | #define USART_FIFOINTSTAT_PERINT_SHIFT (4U) | ||
14545 | /*! PERINT - Peripheral interrupt. | ||
14546 | */ | ||
14547 | #define USART_FIFOINTSTAT_PERINT(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOINTSTAT_PERINT_SHIFT)) & USART_FIFOINTSTAT_PERINT_MASK) | ||
14548 | /*! @} */ | ||
14549 | |||
14550 | /*! @name FIFOWR - FIFO write data. */ | ||
14551 | /*! @{ */ | ||
14552 | #define USART_FIFOWR_TXDATA_MASK (0x1FFU) | ||
14553 | #define USART_FIFOWR_TXDATA_SHIFT (0U) | ||
14554 | /*! TXDATA - Transmit data to the FIFO. | ||
14555 | */ | ||
14556 | #define USART_FIFOWR_TXDATA(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFOWR_TXDATA_SHIFT)) & USART_FIFOWR_TXDATA_MASK) | ||
14557 | /*! @} */ | ||
14558 | |||
14559 | /*! @name FIFORD - FIFO read data. */ | ||
14560 | /*! @{ */ | ||
14561 | #define USART_FIFORD_RXDATA_MASK (0x1FFU) | ||
14562 | #define USART_FIFORD_RXDATA_SHIFT (0U) | ||
14563 | /*! RXDATA - Received data from the FIFO. The number of bits used depends on the DATALEN and PARITYSEL settings. | ||
14564 | */ | ||
14565 | #define USART_FIFORD_RXDATA(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFORD_RXDATA_SHIFT)) & USART_FIFORD_RXDATA_MASK) | ||
14566 | #define USART_FIFORD_FRAMERR_MASK (0x2000U) | ||
14567 | #define USART_FIFORD_FRAMERR_SHIFT (13U) | ||
14568 | /*! FRAMERR - Framing Error status flag. This bit reflects the status for the data it is read along | ||
14569 | * with from the FIFO, and indicates that the character was received with a missing stop bit at | ||
14570 | * the expected location. This could be an indication of a baud rate or configuration mismatch | ||
14571 | * with the transmitting source. | ||
14572 | */ | ||
14573 | #define USART_FIFORD_FRAMERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFORD_FRAMERR_SHIFT)) & USART_FIFORD_FRAMERR_MASK) | ||
14574 | #define USART_FIFORD_PARITYERR_MASK (0x4000U) | ||
14575 | #define USART_FIFORD_PARITYERR_SHIFT (14U) | ||
14576 | /*! PARITYERR - Parity Error status flag. This bit reflects the status for the data it is read along | ||
14577 | * with from the FIFO. This bit will be set when a parity error is detected in a received | ||
14578 | * character. | ||
14579 | */ | ||
14580 | #define USART_FIFORD_PARITYERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFORD_PARITYERR_SHIFT)) & USART_FIFORD_PARITYERR_MASK) | ||
14581 | #define USART_FIFORD_RXNOISE_MASK (0x8000U) | ||
14582 | #define USART_FIFORD_RXNOISE_SHIFT (15U) | ||
14583 | /*! RXNOISE - Received Noise flag. See description of the RxNoiseInt bit in Table 354. | ||
14584 | */ | ||
14585 | #define USART_FIFORD_RXNOISE(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFORD_RXNOISE_SHIFT)) & USART_FIFORD_RXNOISE_MASK) | ||
14586 | /*! @} */ | ||
14587 | |||
14588 | /*! @name FIFORDNOPOP - FIFO data read with no FIFO pop. */ | ||
14589 | /*! @{ */ | ||
14590 | #define USART_FIFORDNOPOP_RXDATA_MASK (0x1FFU) | ||
14591 | #define USART_FIFORDNOPOP_RXDATA_SHIFT (0U) | ||
14592 | /*! RXDATA - Received data from the FIFO. The number of bits used depends on the DATALEN and PARITYSEL settings. | ||
14593 | */ | ||
14594 | #define USART_FIFORDNOPOP_RXDATA(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFORDNOPOP_RXDATA_SHIFT)) & USART_FIFORDNOPOP_RXDATA_MASK) | ||
14595 | #define USART_FIFORDNOPOP_FRAMERR_MASK (0x2000U) | ||
14596 | #define USART_FIFORDNOPOP_FRAMERR_SHIFT (13U) | ||
14597 | /*! FRAMERR - Framing Error status flag. This bit reflects the status for the data it is read along | ||
14598 | * with from the FIFO, and indicates that the character was received with a missing stop bit at | ||
14599 | * the expected location. This could be an indication of a baud rate or configuration mismatch | ||
14600 | * with the transmitting source. | ||
14601 | */ | ||
14602 | #define USART_FIFORDNOPOP_FRAMERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFORDNOPOP_FRAMERR_SHIFT)) & USART_FIFORDNOPOP_FRAMERR_MASK) | ||
14603 | #define USART_FIFORDNOPOP_PARITYERR_MASK (0x4000U) | ||
14604 | #define USART_FIFORDNOPOP_PARITYERR_SHIFT (14U) | ||
14605 | /*! PARITYERR - Parity Error status flag. This bit reflects the status for the data it is read along | ||
14606 | * with from the FIFO. This bit will be set when a parity error is detected in a received | ||
14607 | * character. | ||
14608 | */ | ||
14609 | #define USART_FIFORDNOPOP_PARITYERR(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFORDNOPOP_PARITYERR_SHIFT)) & USART_FIFORDNOPOP_PARITYERR_MASK) | ||
14610 | #define USART_FIFORDNOPOP_RXNOISE_MASK (0x8000U) | ||
14611 | #define USART_FIFORDNOPOP_RXNOISE_SHIFT (15U) | ||
14612 | /*! RXNOISE - Received Noise flag. See description of the RxNoiseInt bit in Table 354. | ||
14613 | */ | ||
14614 | #define USART_FIFORDNOPOP_RXNOISE(x) (((uint32_t)(((uint32_t)(x)) << USART_FIFORDNOPOP_RXNOISE_SHIFT)) & USART_FIFORDNOPOP_RXNOISE_MASK) | ||
14615 | /*! @} */ | ||
14616 | |||
14617 | /*! @name ID - Peripheral identification register. */ | ||
14618 | /*! @{ */ | ||
14619 | #define USART_ID_APERTURE_MASK (0xFFU) | ||
14620 | #define USART_ID_APERTURE_SHIFT (0U) | ||
14621 | /*! APERTURE - Aperture: encoded as (aperture size/4K) -1, so 0x00 means a 4K aperture. | ||
14622 | */ | ||
14623 | #define USART_ID_APERTURE(x) (((uint32_t)(((uint32_t)(x)) << USART_ID_APERTURE_SHIFT)) & USART_ID_APERTURE_MASK) | ||
14624 | #define USART_ID_MINOR_REV_MASK (0xF00U) | ||
14625 | #define USART_ID_MINOR_REV_SHIFT (8U) | ||
14626 | /*! MINOR_REV - Minor revision of module implementation. | ||
14627 | */ | ||
14628 | #define USART_ID_MINOR_REV(x) (((uint32_t)(((uint32_t)(x)) << USART_ID_MINOR_REV_SHIFT)) & USART_ID_MINOR_REV_MASK) | ||
14629 | #define USART_ID_MAJOR_REV_MASK (0xF000U) | ||
14630 | #define USART_ID_MAJOR_REV_SHIFT (12U) | ||
14631 | /*! MAJOR_REV - Major revision of module implementation. | ||
14632 | */ | ||
14633 | #define USART_ID_MAJOR_REV(x) (((uint32_t)(((uint32_t)(x)) << USART_ID_MAJOR_REV_SHIFT)) & USART_ID_MAJOR_REV_MASK) | ||
14634 | #define USART_ID_ID_MASK (0xFFFF0000U) | ||
14635 | #define USART_ID_ID_SHIFT (16U) | ||
14636 | /*! ID - Module identifier for the selected function. | ||
14637 | */ | ||
14638 | #define USART_ID_ID(x) (((uint32_t)(((uint32_t)(x)) << USART_ID_ID_SHIFT)) & USART_ID_ID_MASK) | ||
14639 | /*! @} */ | ||
14640 | |||
14641 | |||
14642 | /*! | ||
14643 | * @} | ||
14644 | */ /* end of group USART_Register_Masks */ | ||
14645 | |||
14646 | |||
14647 | /* USART - Peripheral instance base addresses */ | ||
14648 | /** Peripheral USART0 base address */ | ||
14649 | #define USART0_BASE (0x40086000u) | ||
14650 | /** Peripheral USART0 base pointer */ | ||
14651 | #define USART0 ((USART_Type *)USART0_BASE) | ||
14652 | /** Peripheral USART1 base address */ | ||
14653 | #define USART1_BASE (0x40087000u) | ||
14654 | /** Peripheral USART1 base pointer */ | ||
14655 | #define USART1 ((USART_Type *)USART1_BASE) | ||
14656 | /** Peripheral USART2 base address */ | ||
14657 | #define USART2_BASE (0x40088000u) | ||
14658 | /** Peripheral USART2 base pointer */ | ||
14659 | #define USART2 ((USART_Type *)USART2_BASE) | ||
14660 | /** Peripheral USART3 base address */ | ||
14661 | #define USART3_BASE (0x40089000u) | ||
14662 | /** Peripheral USART3 base pointer */ | ||
14663 | #define USART3 ((USART_Type *)USART3_BASE) | ||
14664 | /** Peripheral USART4 base address */ | ||
14665 | #define USART4_BASE (0x4008A000u) | ||
14666 | /** Peripheral USART4 base pointer */ | ||
14667 | #define USART4 ((USART_Type *)USART4_BASE) | ||
14668 | /** Peripheral USART5 base address */ | ||
14669 | #define USART5_BASE (0x40096000u) | ||
14670 | /** Peripheral USART5 base pointer */ | ||
14671 | #define USART5 ((USART_Type *)USART5_BASE) | ||
14672 | /** Peripheral USART6 base address */ | ||
14673 | #define USART6_BASE (0x40097000u) | ||
14674 | /** Peripheral USART6 base pointer */ | ||
14675 | #define USART6 ((USART_Type *)USART6_BASE) | ||
14676 | /** Peripheral USART7 base address */ | ||
14677 | #define USART7_BASE (0x40098000u) | ||
14678 | /** Peripheral USART7 base pointer */ | ||
14679 | #define USART7 ((USART_Type *)USART7_BASE) | ||
14680 | /** Peripheral USART8 base address */ | ||
14681 | #define USART8_BASE (0x40099000u) | ||
14682 | /** Peripheral USART8 base pointer */ | ||
14683 | #define USART8 ((USART_Type *)USART8_BASE) | ||
14684 | /** Peripheral USART9 base address */ | ||
14685 | #define USART9_BASE (0x4009A000u) | ||
14686 | /** Peripheral USART9 base pointer */ | ||
14687 | #define USART9 ((USART_Type *)USART9_BASE) | ||
14688 | /** Array initializer of USART peripheral base addresses */ | ||
14689 | #define USART_BASE_ADDRS { USART0_BASE, USART1_BASE, USART2_BASE, USART3_BASE, USART4_BASE, USART5_BASE, USART6_BASE, USART7_BASE, USART8_BASE, USART9_BASE } | ||
14690 | /** Array initializer of USART peripheral base pointers */ | ||
14691 | #define USART_BASE_PTRS { USART0, USART1, USART2, USART3, USART4, USART5, USART6, USART7, USART8, USART9 } | ||
14692 | /** Interrupt vectors for the USART peripheral type */ | ||
14693 | #define USART_IRQS { FLEXCOMM0_IRQn, FLEXCOMM1_IRQn, FLEXCOMM2_IRQn, FLEXCOMM3_IRQn, FLEXCOMM4_IRQn, FLEXCOMM5_IRQn, FLEXCOMM6_IRQn, FLEXCOMM7_IRQn, FLEXCOMM8_IRQn, FLEXCOMM9_IRQn } | ||
14694 | |||
14695 | /*! | ||
14696 | * @} | ||
14697 | */ /* end of group USART_Peripheral_Access_Layer */ | ||
14698 | |||
14699 | |||
14700 | /* ---------------------------------------------------------------------------- | ||
14701 | -- USB Peripheral Access Layer | ||
14702 | ---------------------------------------------------------------------------- */ | ||
14703 | |||
14704 | /*! | ||
14705 | * @addtogroup USB_Peripheral_Access_Layer USB Peripheral Access Layer | ||
14706 | * @{ | ||
14707 | */ | ||
14708 | |||
14709 | /** USB - Register Layout Typedef */ | ||
14710 | typedef struct { | ||
14711 | __IO uint32_t DEVCMDSTAT; /**< USB Device Command/Status register, offset: 0x0 */ | ||
14712 | __IO uint32_t INFO; /**< USB Info register, offset: 0x4 */ | ||
14713 | __IO uint32_t EPLISTSTART; /**< USB EP Command/Status List start address, offset: 0x8 */ | ||
14714 | __IO uint32_t DATABUFSTART; /**< USB Data buffer start address, offset: 0xC */ | ||
14715 | __IO uint32_t LPM; /**< USB Link Power Management register, offset: 0x10 */ | ||
14716 | __IO uint32_t EPSKIP; /**< USB Endpoint skip, offset: 0x14 */ | ||
14717 | __IO uint32_t EPINUSE; /**< USB Endpoint Buffer in use, offset: 0x18 */ | ||
14718 | __IO uint32_t EPBUFCFG; /**< USB Endpoint Buffer Configuration register, offset: 0x1C */ | ||
14719 | __IO uint32_t INTSTAT; /**< USB interrupt status register, offset: 0x20 */ | ||
14720 | __IO uint32_t INTEN; /**< USB interrupt enable register, offset: 0x24 */ | ||
14721 | __IO uint32_t INTSETSTAT; /**< USB set interrupt status register, offset: 0x28 */ | ||
14722 | uint8_t RESERVED_0[8]; | ||
14723 | __IO uint32_t EPTOGGLE; /**< USB Endpoint toggle register, offset: 0x34 */ | ||
14724 | } USB_Type; | ||
14725 | |||
14726 | /* ---------------------------------------------------------------------------- | ||
14727 | -- USB Register Masks | ||
14728 | ---------------------------------------------------------------------------- */ | ||
14729 | |||
14730 | /*! | ||
14731 | * @addtogroup USB_Register_Masks USB Register Masks | ||
14732 | * @{ | ||
14733 | */ | ||
14734 | |||
14735 | /*! @name DEVCMDSTAT - USB Device Command/Status register */ | ||
14736 | /*! @{ */ | ||
14737 | #define USB_DEVCMDSTAT_DEV_ADDR_MASK (0x7FU) | ||
14738 | #define USB_DEVCMDSTAT_DEV_ADDR_SHIFT (0U) | ||
14739 | /*! DEV_ADDR - USB device address. After bus reset, the address is reset to 0x00. If the enable bit | ||
14740 | * is set, the device will respond on packets for function address DEV_ADDR. When receiving a | ||
14741 | * SetAddress Control Request from the USB host, software must program the new address before | ||
14742 | * completing the status phase of the SetAddress Control Request. | ||
14743 | */ | ||
14744 | #define USB_DEVCMDSTAT_DEV_ADDR(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_DEV_ADDR_SHIFT)) & USB_DEVCMDSTAT_DEV_ADDR_MASK) | ||
14745 | #define USB_DEVCMDSTAT_DEV_EN_MASK (0x80U) | ||
14746 | #define USB_DEVCMDSTAT_DEV_EN_SHIFT (7U) | ||
14747 | /*! DEV_EN - USB device enable. If this bit is set, the HW will start responding on packets for function address DEV_ADDR. | ||
14748 | */ | ||
14749 | #define USB_DEVCMDSTAT_DEV_EN(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_DEV_EN_SHIFT)) & USB_DEVCMDSTAT_DEV_EN_MASK) | ||
14750 | #define USB_DEVCMDSTAT_SETUP_MASK (0x100U) | ||
14751 | #define USB_DEVCMDSTAT_SETUP_SHIFT (8U) | ||
14752 | /*! SETUP - SETUP token received. If a SETUP token is received and acknowledged by the device, this | ||
14753 | * bit is set. As long as this bit is set all received IN and OUT tokens will be NAKed by HW. SW | ||
14754 | * must clear this bit by writing a one. If this bit is zero, HW will handle the tokens to the | ||
14755 | * CTRL EP0 as indicated by the CTRL EP0 IN and OUT data information programmed by SW. | ||
14756 | */ | ||
14757 | #define USB_DEVCMDSTAT_SETUP(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_SETUP_SHIFT)) & USB_DEVCMDSTAT_SETUP_MASK) | ||
14758 | #define USB_DEVCMDSTAT_FORCE_NEEDCLK_MASK (0x200U) | ||
14759 | #define USB_DEVCMDSTAT_FORCE_NEEDCLK_SHIFT (9U) | ||
14760 | /*! FORCE_NEEDCLK - Forces the NEEDCLK output to always be on: | ||
14761 | * 0b0..USB_NEEDCLK has normal function. | ||
14762 | * 0b1..USB_NEEDCLK always 1. Clock will not be stopped in case of suspend. | ||
14763 | */ | ||
14764 | #define USB_DEVCMDSTAT_FORCE_NEEDCLK(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_FORCE_NEEDCLK_SHIFT)) & USB_DEVCMDSTAT_FORCE_NEEDCLK_MASK) | ||
14765 | #define USB_DEVCMDSTAT_LPM_SUP_MASK (0x800U) | ||
14766 | #define USB_DEVCMDSTAT_LPM_SUP_SHIFT (11U) | ||
14767 | /*! LPM_SUP - LPM Supported: | ||
14768 | * 0b0..LPM not supported. | ||
14769 | * 0b1..LPM supported. | ||
14770 | */ | ||
14771 | #define USB_DEVCMDSTAT_LPM_SUP(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_LPM_SUP_SHIFT)) & USB_DEVCMDSTAT_LPM_SUP_MASK) | ||
14772 | #define USB_DEVCMDSTAT_INTONNAK_AO_MASK (0x1000U) | ||
14773 | #define USB_DEVCMDSTAT_INTONNAK_AO_SHIFT (12U) | ||
14774 | /*! INTONNAK_AO - Interrupt on NAK for interrupt and bulk OUT EP | ||
14775 | * 0b0..Only acknowledged packets generate an interrupt | ||
14776 | * 0b1..Both acknowledged and NAKed packets generate interrupts. | ||
14777 | */ | ||
14778 | #define USB_DEVCMDSTAT_INTONNAK_AO(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_INTONNAK_AO_SHIFT)) & USB_DEVCMDSTAT_INTONNAK_AO_MASK) | ||
14779 | #define USB_DEVCMDSTAT_INTONNAK_AI_MASK (0x2000U) | ||
14780 | #define USB_DEVCMDSTAT_INTONNAK_AI_SHIFT (13U) | ||
14781 | /*! INTONNAK_AI - Interrupt on NAK for interrupt and bulk IN EP | ||
14782 | * 0b0..Only acknowledged packets generate an interrupt | ||
14783 | * 0b1..Both acknowledged and NAKed packets generate interrupts. | ||
14784 | */ | ||
14785 | #define USB_DEVCMDSTAT_INTONNAK_AI(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_INTONNAK_AI_SHIFT)) & USB_DEVCMDSTAT_INTONNAK_AI_MASK) | ||
14786 | #define USB_DEVCMDSTAT_INTONNAK_CO_MASK (0x4000U) | ||
14787 | #define USB_DEVCMDSTAT_INTONNAK_CO_SHIFT (14U) | ||
14788 | /*! INTONNAK_CO - Interrupt on NAK for control OUT EP | ||
14789 | * 0b0..Only acknowledged packets generate an interrupt | ||
14790 | * 0b1..Both acknowledged and NAKed packets generate interrupts. | ||
14791 | */ | ||
14792 | #define USB_DEVCMDSTAT_INTONNAK_CO(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_INTONNAK_CO_SHIFT)) & USB_DEVCMDSTAT_INTONNAK_CO_MASK) | ||
14793 | #define USB_DEVCMDSTAT_INTONNAK_CI_MASK (0x8000U) | ||
14794 | #define USB_DEVCMDSTAT_INTONNAK_CI_SHIFT (15U) | ||
14795 | /*! INTONNAK_CI - Interrupt on NAK for control IN EP | ||
14796 | * 0b0..Only acknowledged packets generate an interrupt | ||
14797 | * 0b1..Both acknowledged and NAKed packets generate interrupts. | ||
14798 | */ | ||
14799 | #define USB_DEVCMDSTAT_INTONNAK_CI(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_INTONNAK_CI_SHIFT)) & USB_DEVCMDSTAT_INTONNAK_CI_MASK) | ||
14800 | #define USB_DEVCMDSTAT_DCON_MASK (0x10000U) | ||
14801 | #define USB_DEVCMDSTAT_DCON_SHIFT (16U) | ||
14802 | /*! DCON - Device status - connect. The connect bit must be set by SW to indicate that the device | ||
14803 | * must signal a connect. The pull-up resistor on USB_DP will be enabled when this bit is set and | ||
14804 | * the VBUSDEBOUNCED bit is one. | ||
14805 | */ | ||
14806 | #define USB_DEVCMDSTAT_DCON(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_DCON_SHIFT)) & USB_DEVCMDSTAT_DCON_MASK) | ||
14807 | #define USB_DEVCMDSTAT_DSUS_MASK (0x20000U) | ||
14808 | #define USB_DEVCMDSTAT_DSUS_SHIFT (17U) | ||
14809 | /*! DSUS - Device status - suspend. The suspend bit indicates the current suspend state. It is set | ||
14810 | * to 1 when the device hasn't seen any activity on its upstream port for more than 3 | ||
14811 | * milliseconds. It is reset to 0 on any activity. When the device is suspended (Suspend bit DSUS = 1) and | ||
14812 | * the software writes a 0 to it, the device will generate a remote wake-up. This will only happen | ||
14813 | * when the device is connected (Connect bit = 1). When the device is not connected or not | ||
14814 | * suspended, a writing a 0 has no effect. Writing a 1 never has an effect. | ||
14815 | */ | ||
14816 | #define USB_DEVCMDSTAT_DSUS(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_DSUS_SHIFT)) & USB_DEVCMDSTAT_DSUS_MASK) | ||
14817 | #define USB_DEVCMDSTAT_LPM_SUS_MASK (0x80000U) | ||
14818 | #define USB_DEVCMDSTAT_LPM_SUS_SHIFT (19U) | ||
14819 | /*! LPM_SUS - Device status - LPM Suspend. This bit represents the current LPM suspend state. It is | ||
14820 | * set to 1 by HW when the device has acknowledged the LPM request from the USB host and the | ||
14821 | * Token Retry Time of 10 ms has elapsed. When the device is in the LPM suspended state (LPM suspend | ||
14822 | * bit = 1) and the software writes a zero to this bit, the device will generate a remote | ||
14823 | * walk-up. Software can only write a zero to this bit when the LPM_REWP bit is set to 1. HW resets this | ||
14824 | * bit when it receives a host initiated resume. HW only updates the LPM_SUS bit when the | ||
14825 | * LPM_SUPP bit is equal to one. | ||
14826 | */ | ||
14827 | #define USB_DEVCMDSTAT_LPM_SUS(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_LPM_SUS_SHIFT)) & USB_DEVCMDSTAT_LPM_SUS_MASK) | ||
14828 | #define USB_DEVCMDSTAT_LPM_REWP_MASK (0x100000U) | ||
14829 | #define USB_DEVCMDSTAT_LPM_REWP_SHIFT (20U) | ||
14830 | /*! LPM_REWP - LPM Remote Wake-up Enabled by USB host. HW sets this bit to one when the bRemoteWake | ||
14831 | * bit in the LPM extended token is set to 1. HW will reset this bit to 0 when it receives the | ||
14832 | * host initiated LPM resume, when a remote wake-up is sent by the device or when a USB bus reset | ||
14833 | * is received. Software can use this bit to check if the remote wake-up feature is enabled by the | ||
14834 | * host for the LPM transaction. | ||
14835 | */ | ||
14836 | #define USB_DEVCMDSTAT_LPM_REWP(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_LPM_REWP_SHIFT)) & USB_DEVCMDSTAT_LPM_REWP_MASK) | ||
14837 | #define USB_DEVCMDSTAT_DCON_C_MASK (0x1000000U) | ||
14838 | #define USB_DEVCMDSTAT_DCON_C_SHIFT (24U) | ||
14839 | /*! DCON_C - Device status - connect change. The Connect Change bit is set when the device's pull-up | ||
14840 | * resistor is disconnected because VBus disappeared. The bit is reset by writing a one to it. | ||
14841 | */ | ||
14842 | #define USB_DEVCMDSTAT_DCON_C(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_DCON_C_SHIFT)) & USB_DEVCMDSTAT_DCON_C_MASK) | ||
14843 | #define USB_DEVCMDSTAT_DSUS_C_MASK (0x2000000U) | ||
14844 | #define USB_DEVCMDSTAT_DSUS_C_SHIFT (25U) | ||
14845 | /*! DSUS_C - Device status - suspend change. The suspend change bit is set to 1 when the suspend bit | ||
14846 | * toggles. The suspend bit can toggle because: - The device goes in the suspended state - The | ||
14847 | * device is disconnected - The device receives resume signaling on its upstream port. The bit is | ||
14848 | * reset by writing a one to it. | ||
14849 | */ | ||
14850 | #define USB_DEVCMDSTAT_DSUS_C(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_DSUS_C_SHIFT)) & USB_DEVCMDSTAT_DSUS_C_MASK) | ||
14851 | #define USB_DEVCMDSTAT_DRES_C_MASK (0x4000000U) | ||
14852 | #define USB_DEVCMDSTAT_DRES_C_SHIFT (26U) | ||
14853 | /*! DRES_C - Device status - reset change. This bit is set when the device received a bus reset. On | ||
14854 | * a bus reset the device will automatically go to the default state (unconfigured and responding | ||
14855 | * to address 0). The bit is reset by writing a one to it. | ||
14856 | */ | ||
14857 | #define USB_DEVCMDSTAT_DRES_C(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_DRES_C_SHIFT)) & USB_DEVCMDSTAT_DRES_C_MASK) | ||
14858 | #define USB_DEVCMDSTAT_VBUSDEBOUNCED_MASK (0x10000000U) | ||
14859 | #define USB_DEVCMDSTAT_VBUSDEBOUNCED_SHIFT (28U) | ||
14860 | /*! VBUSDEBOUNCED - This bit indicates if Vbus is detected or not. The bit raises immediately when | ||
14861 | * Vbus becomes high. It drops to zero if Vbus is low for at least 3 ms. If this bit is high and | ||
14862 | * the DCon bit is set, the HW will enable the pull-up resistor to signal a connect. | ||
14863 | */ | ||
14864 | #define USB_DEVCMDSTAT_VBUSDEBOUNCED(x) (((uint32_t)(((uint32_t)(x)) << USB_DEVCMDSTAT_VBUSDEBOUNCED_SHIFT)) & USB_DEVCMDSTAT_VBUSDEBOUNCED_MASK) | ||
14865 | /*! @} */ | ||
14866 | |||
14867 | /*! @name INFO - USB Info register */ | ||
14868 | /*! @{ */ | ||
14869 | #define USB_INFO_FRAME_NR_MASK (0x7FFU) | ||
14870 | #define USB_INFO_FRAME_NR_SHIFT (0U) | ||
14871 | /*! FRAME_NR - Frame number. This contains the frame number of the last successfully received SOF. | ||
14872 | * In case no SOF was received by the device at the beginning of a frame, the frame number | ||
14873 | * returned is that of the last successfully received SOF. In case the SOF frame number contained a CRC | ||
14874 | * error, the frame number returned will be the corrupted frame number as received by the device. | ||
14875 | */ | ||
14876 | #define USB_INFO_FRAME_NR(x) (((uint32_t)(((uint32_t)(x)) << USB_INFO_FRAME_NR_SHIFT)) & USB_INFO_FRAME_NR_MASK) | ||
14877 | #define USB_INFO_ERR_CODE_MASK (0x7800U) | ||
14878 | #define USB_INFO_ERR_CODE_SHIFT (11U) | ||
14879 | /*! ERR_CODE - The error code which last occurred: | ||
14880 | * 0b0000..No error | ||
14881 | * 0b0001..PID encoding error | ||
14882 | * 0b0010..PID unknown | ||
14883 | * 0b0011..Packet unexpected | ||
14884 | * 0b0100..Token CRC error | ||
14885 | * 0b0101..Data CRC error | ||
14886 | * 0b0110..Time out | ||
14887 | * 0b0111..Babble | ||
14888 | * 0b1000..Truncated EOP | ||
14889 | * 0b1001..Sent/Received NAK | ||
14890 | * 0b1010..Sent Stall | ||
14891 | * 0b1011..Overrun | ||
14892 | * 0b1100..Sent empty packet | ||
14893 | * 0b1101..Bitstuff error | ||
14894 | * 0b1110..Sync error | ||
14895 | * 0b1111..Wrong data toggle | ||
14896 | */ | ||
14897 | #define USB_INFO_ERR_CODE(x) (((uint32_t)(((uint32_t)(x)) << USB_INFO_ERR_CODE_SHIFT)) & USB_INFO_ERR_CODE_MASK) | ||
14898 | #define USB_INFO_MINREV_MASK (0xFF0000U) | ||
14899 | #define USB_INFO_MINREV_SHIFT (16U) | ||
14900 | /*! MINREV - Minor Revision. | ||
14901 | */ | ||
14902 | #define USB_INFO_MINREV(x) (((uint32_t)(((uint32_t)(x)) << USB_INFO_MINREV_SHIFT)) & USB_INFO_MINREV_MASK) | ||
14903 | #define USB_INFO_MAJREV_MASK (0xFF000000U) | ||
14904 | #define USB_INFO_MAJREV_SHIFT (24U) | ||
14905 | /*! MAJREV - Major Revision. | ||
14906 | */ | ||
14907 | #define USB_INFO_MAJREV(x) (((uint32_t)(((uint32_t)(x)) << USB_INFO_MAJREV_SHIFT)) & USB_INFO_MAJREV_MASK) | ||
14908 | /*! @} */ | ||
14909 | |||
14910 | /*! @name EPLISTSTART - USB EP Command/Status List start address */ | ||
14911 | /*! @{ */ | ||
14912 | #define USB_EPLISTSTART_EP_LIST_MASK (0xFFFFFF00U) | ||
14913 | #define USB_EPLISTSTART_EP_LIST_SHIFT (8U) | ||
14914 | /*! EP_LIST - Start address of the USB EP Command/Status List. | ||
14915 | */ | ||
14916 | #define USB_EPLISTSTART_EP_LIST(x) (((uint32_t)(((uint32_t)(x)) << USB_EPLISTSTART_EP_LIST_SHIFT)) & USB_EPLISTSTART_EP_LIST_MASK) | ||
14917 | /*! @} */ | ||
14918 | |||
14919 | /*! @name DATABUFSTART - USB Data buffer start address */ | ||
14920 | /*! @{ */ | ||
14921 | #define USB_DATABUFSTART_DA_BUF_MASK (0xFFC00000U) | ||
14922 | #define USB_DATABUFSTART_DA_BUF_SHIFT (22U) | ||
14923 | /*! DA_BUF - Start address of the buffer pointer page where all endpoint data buffers are located. | ||
14924 | */ | ||
14925 | #define USB_DATABUFSTART_DA_BUF(x) (((uint32_t)(((uint32_t)(x)) << USB_DATABUFSTART_DA_BUF_SHIFT)) & USB_DATABUFSTART_DA_BUF_MASK) | ||
14926 | /*! @} */ | ||
14927 | |||
14928 | /*! @name LPM - USB Link Power Management register */ | ||
14929 | /*! @{ */ | ||
14930 | #define USB_LPM_HIRD_HW_MASK (0xFU) | ||
14931 | #define USB_LPM_HIRD_HW_SHIFT (0U) | ||
14932 | /*! HIRD_HW - Host Initiated Resume Duration - HW. This is the HIRD value from the last received LPM token | ||
14933 | */ | ||
14934 | #define USB_LPM_HIRD_HW(x) (((uint32_t)(((uint32_t)(x)) << USB_LPM_HIRD_HW_SHIFT)) & USB_LPM_HIRD_HW_MASK) | ||
14935 | #define USB_LPM_HIRD_SW_MASK (0xF0U) | ||
14936 | #define USB_LPM_HIRD_SW_SHIFT (4U) | ||
14937 | /*! HIRD_SW - Host Initiated Resume Duration - SW. This is the time duration required by the USB | ||
14938 | * device system to come out of LPM initiated suspend after receiving the host initiated LPM resume. | ||
14939 | */ | ||
14940 | #define USB_LPM_HIRD_SW(x) (((uint32_t)(((uint32_t)(x)) << USB_LPM_HIRD_SW_SHIFT)) & USB_LPM_HIRD_SW_MASK) | ||
14941 | #define USB_LPM_DATA_PENDING_MASK (0x100U) | ||
14942 | #define USB_LPM_DATA_PENDING_SHIFT (8U) | ||
14943 | /*! DATA_PENDING - As long as this bit is set to one and LPM supported bit is set to one, HW will | ||
14944 | * return a NYET handshake on every LPM token it receives. If LPM supported bit is set to one and | ||
14945 | * this bit is zero, HW will return an ACK handshake on every LPM token it receives. If SW has | ||
14946 | * still data pending and LPM is supported, it must set this bit to 1. | ||
14947 | */ | ||
14948 | #define USB_LPM_DATA_PENDING(x) (((uint32_t)(((uint32_t)(x)) << USB_LPM_DATA_PENDING_SHIFT)) & USB_LPM_DATA_PENDING_MASK) | ||
14949 | /*! @} */ | ||
14950 | |||
14951 | /*! @name EPSKIP - USB Endpoint skip */ | ||
14952 | /*! @{ */ | ||
14953 | #define USB_EPSKIP_SKIP_MASK (0x3FFU) | ||
14954 | #define USB_EPSKIP_SKIP_SHIFT (0U) | ||
14955 | /*! SKIP - Endpoint skip: Writing 1 to one of these bits, will indicate to HW that it must | ||
14956 | * deactivate the buffer assigned to this endpoint and return control back to software. When HW has | ||
14957 | * deactivated the endpoint, it will clear this bit, but it will not modify the EPINUSE bit. An | ||
14958 | * interrupt will be generated when the Active bit goes from 1 to 0. Note: In case of double-buffering, | ||
14959 | * HW will only clear the Active bit of the buffer indicated by the EPINUSE bit. | ||
14960 | */ | ||
14961 | #define USB_EPSKIP_SKIP(x) (((uint32_t)(((uint32_t)(x)) << USB_EPSKIP_SKIP_SHIFT)) & USB_EPSKIP_SKIP_MASK) | ||
14962 | /*! @} */ | ||
14963 | |||
14964 | /*! @name EPINUSE - USB Endpoint Buffer in use */ | ||
14965 | /*! @{ */ | ||
14966 | #define USB_EPINUSE_BUF_MASK (0x3FCU) | ||
14967 | #define USB_EPINUSE_BUF_SHIFT (2U) | ||
14968 | /*! BUF - Buffer in use: This register has one bit per physical endpoint. 0: HW is accessing buffer | ||
14969 | * 0. 1: HW is accessing buffer 1. | ||
14970 | */ | ||
14971 | #define USB_EPINUSE_BUF(x) (((uint32_t)(((uint32_t)(x)) << USB_EPINUSE_BUF_SHIFT)) & USB_EPINUSE_BUF_MASK) | ||
14972 | /*! @} */ | ||
14973 | |||
14974 | /*! @name EPBUFCFG - USB Endpoint Buffer Configuration register */ | ||
14975 | /*! @{ */ | ||
14976 | #define USB_EPBUFCFG_BUF_SB_MASK (0x3FCU) | ||
14977 | #define USB_EPBUFCFG_BUF_SB_SHIFT (2U) | ||
14978 | /*! BUF_SB - Buffer usage: This register has one bit per physical endpoint. 0: Single-buffer. 1: | ||
14979 | * Double-buffer. If the bit is set to single-buffer (0), it will not toggle the corresponding | ||
14980 | * EPINUSE bit when it clears the active bit. If the bit is set to double-buffer (1), HW will toggle | ||
14981 | * the EPINUSE bit when it clears the Active bit for the buffer. | ||
14982 | */ | ||
14983 | #define USB_EPBUFCFG_BUF_SB(x) (((uint32_t)(((uint32_t)(x)) << USB_EPBUFCFG_BUF_SB_SHIFT)) & USB_EPBUFCFG_BUF_SB_MASK) | ||
14984 | /*! @} */ | ||
14985 | |||
14986 | /*! @name INTSTAT - USB interrupt status register */ | ||
14987 | /*! @{ */ | ||
14988 | #define USB_INTSTAT_EP0OUT_MASK (0x1U) | ||
14989 | #define USB_INTSTAT_EP0OUT_SHIFT (0U) | ||
14990 | /*! EP0OUT - Interrupt status register bit for the Control EP0 OUT direction. This bit will be set | ||
14991 | * if NBytes transitions to zero or the skip bit is set by software or a SETUP packet is | ||
14992 | * successfully received for the control EP0. If the IntOnNAK_CO is set, this bit will also be set when a | ||
14993 | * NAK is transmitted for the Control EP0 OUT direction. Software can clear this bit by writing a | ||
14994 | * one to it. | ||
14995 | */ | ||
14996 | #define USB_INTSTAT_EP0OUT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP0OUT_SHIFT)) & USB_INTSTAT_EP0OUT_MASK) | ||
14997 | #define USB_INTSTAT_EP0IN_MASK (0x2U) | ||
14998 | #define USB_INTSTAT_EP0IN_SHIFT (1U) | ||
14999 | /*! EP0IN - Interrupt status register bit for the Control EP0 IN direction. This bit will be set if | ||
15000 | * NBytes transitions to zero or the skip bit is set by software. If the IntOnNAK_CI is set, this | ||
15001 | * bit will also be set when a NAK is transmitted for the Control EP0 IN direction. Software can | ||
15002 | * clear this bit by writing a one to it. | ||
15003 | */ | ||
15004 | #define USB_INTSTAT_EP0IN(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP0IN_SHIFT)) & USB_INTSTAT_EP0IN_MASK) | ||
15005 | #define USB_INTSTAT_EP1OUT_MASK (0x4U) | ||
15006 | #define USB_INTSTAT_EP1OUT_SHIFT (2U) | ||
15007 | /*! EP1OUT - Interrupt status register bit for the EP1 OUT direction. This bit will be set if the | ||
15008 | * corresponding Active bit is cleared by HW. This is done in case the programmed NBytes | ||
15009 | * transitions to zero or the skip bit is set by software. If the IntOnNAK_AO is set, this bit will also be | ||
15010 | * set when a NAK is transmitted for the EP1 OUT direction. Software can clear this bit by | ||
15011 | * writing a one to it. | ||
15012 | */ | ||
15013 | #define USB_INTSTAT_EP1OUT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP1OUT_SHIFT)) & USB_INTSTAT_EP1OUT_MASK) | ||
15014 | #define USB_INTSTAT_EP1IN_MASK (0x8U) | ||
15015 | #define USB_INTSTAT_EP1IN_SHIFT (3U) | ||
15016 | /*! EP1IN - Interrupt status register bit for the EP1 IN direction. This bit will be set if the | ||
15017 | * corresponding Active bit is cleared by HW. This is done in case the programmed NBytes transitions | ||
15018 | * to zero or the skip bit is set by software. If the IntOnNAK_AI is set, this bit will also be | ||
15019 | * set when a NAK is transmitted for the EP1 IN direction. Software can clear this bit by writing | ||
15020 | * a one to it. | ||
15021 | */ | ||
15022 | #define USB_INTSTAT_EP1IN(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP1IN_SHIFT)) & USB_INTSTAT_EP1IN_MASK) | ||
15023 | #define USB_INTSTAT_EP2OUT_MASK (0x10U) | ||
15024 | #define USB_INTSTAT_EP2OUT_SHIFT (4U) | ||
15025 | /*! EP2OUT - Interrupt status register bit for the EP2 OUT direction. This bit will be set if the | ||
15026 | * corresponding Active bit is cleared by HW. This is done in case the programmed NBytes | ||
15027 | * transitions to zero or the skip bit is set by software. If the IntOnNAK_AO is set, this bit will also be | ||
15028 | * set when a NAK is transmitted for the EP2 OUT direction. Software can clear this bit by | ||
15029 | * writing a one to it. | ||
15030 | */ | ||
15031 | #define USB_INTSTAT_EP2OUT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP2OUT_SHIFT)) & USB_INTSTAT_EP2OUT_MASK) | ||
15032 | #define USB_INTSTAT_EP2IN_MASK (0x20U) | ||
15033 | #define USB_INTSTAT_EP2IN_SHIFT (5U) | ||
15034 | /*! EP2IN - Interrupt status register bit for the EP2 IN direction. This bit will be set if the | ||
15035 | * corresponding Active bit is cleared by HW. This is done in case the programmed NBytes transitions | ||
15036 | * to zero or the skip bit is set by software. If the IntOnNAK_AI is set, this bit will also be | ||
15037 | * set when a NAK is transmitted for the EP2 IN direction. Software can clear this bit by writing | ||
15038 | * a one to it. | ||
15039 | */ | ||
15040 | #define USB_INTSTAT_EP2IN(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP2IN_SHIFT)) & USB_INTSTAT_EP2IN_MASK) | ||
15041 | #define USB_INTSTAT_EP3OUT_MASK (0x40U) | ||
15042 | #define USB_INTSTAT_EP3OUT_SHIFT (6U) | ||
15043 | /*! EP3OUT - Interrupt status register bit for the EP3 OUT direction. This bit will be set if the | ||
15044 | * corresponding Active bit is cleared by HW. This is done in case the programmed NBytes | ||
15045 | * transitions to zero or the skip bit is set by software. If the IntOnNAK_AO is set, this bit will also be | ||
15046 | * set when a NAK is transmitted for the EP3 OUT direction. Software can clear this bit by | ||
15047 | * writing a one to it. | ||
15048 | */ | ||
15049 | #define USB_INTSTAT_EP3OUT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP3OUT_SHIFT)) & USB_INTSTAT_EP3OUT_MASK) | ||
15050 | #define USB_INTSTAT_EP3IN_MASK (0x80U) | ||
15051 | #define USB_INTSTAT_EP3IN_SHIFT (7U) | ||
15052 | /*! EP3IN - Interrupt status register bit for the EP3 IN direction. This bit will be set if the | ||
15053 | * corresponding Active bit is cleared by HW. This is done in case the programmed NBytes transitions | ||
15054 | * to zero or the skip bit is set by software. If the IntOnNAK_AI is set, this bit will also be | ||
15055 | * set when a NAK is transmitted for the EP3 IN direction. Software can clear this bit by writing | ||
15056 | * a one to it. | ||
15057 | */ | ||
15058 | #define USB_INTSTAT_EP3IN(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP3IN_SHIFT)) & USB_INTSTAT_EP3IN_MASK) | ||
15059 | #define USB_INTSTAT_EP4OUT_MASK (0x100U) | ||
15060 | #define USB_INTSTAT_EP4OUT_SHIFT (8U) | ||
15061 | /*! EP4OUT - Interrupt status register bit for the EP4 OUT direction. This bit will be set if the | ||
15062 | * corresponding Active bit is cleared by HW. This is done in case the programmed NBytes | ||
15063 | * transitions to zero or the skip bit is set by software. If the IntOnNAK_AO is set, this bit will also be | ||
15064 | * set when a NAK is transmitted for the EP4 OUT direction. Software can clear this bit by | ||
15065 | * writing a one to it. | ||
15066 | */ | ||
15067 | #define USB_INTSTAT_EP4OUT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP4OUT_SHIFT)) & USB_INTSTAT_EP4OUT_MASK) | ||
15068 | #define USB_INTSTAT_EP4IN_MASK (0x200U) | ||
15069 | #define USB_INTSTAT_EP4IN_SHIFT (9U) | ||
15070 | /*! EP4IN - Interrupt status register bit for the EP4 IN direction. This bit will be set if the | ||
15071 | * corresponding Active bit is cleared by HW. This is done in case the programmed NBytes transitions | ||
15072 | * to zero or the skip bit is set by software. If the IntOnNAK_AI is set, this bit will also be | ||
15073 | * set when a NAK is transmitted for the EP4 IN direction. Software can clear this bit by writing | ||
15074 | * a one to it. | ||
15075 | */ | ||
15076 | #define USB_INTSTAT_EP4IN(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_EP4IN_SHIFT)) & USB_INTSTAT_EP4IN_MASK) | ||
15077 | #define USB_INTSTAT_FRAME_INT_MASK (0x40000000U) | ||
15078 | #define USB_INTSTAT_FRAME_INT_SHIFT (30U) | ||
15079 | /*! FRAME_INT - Frame interrupt. This bit is set to one every millisecond when the VbusDebounced bit | ||
15080 | * and the DCON bit are set. This bit can be used by software when handling isochronous | ||
15081 | * endpoints. Software can clear this bit by writing a one to it. | ||
15082 | */ | ||
15083 | #define USB_INTSTAT_FRAME_INT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_FRAME_INT_SHIFT)) & USB_INTSTAT_FRAME_INT_MASK) | ||
15084 | #define USB_INTSTAT_DEV_INT_MASK (0x80000000U) | ||
15085 | #define USB_INTSTAT_DEV_INT_SHIFT (31U) | ||
15086 | /*! DEV_INT - Device status interrupt. This bit is set by HW when one of the bits in the Device | ||
15087 | * Status Change register are set. Software can clear this bit by writing a one to it. | ||
15088 | */ | ||
15089 | #define USB_INTSTAT_DEV_INT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSTAT_DEV_INT_SHIFT)) & USB_INTSTAT_DEV_INT_MASK) | ||
15090 | /*! @} */ | ||
15091 | |||
15092 | /*! @name INTEN - USB interrupt enable register */ | ||
15093 | /*! @{ */ | ||
15094 | #define USB_INTEN_EP_INT_EN_MASK (0x3FFU) | ||
15095 | #define USB_INTEN_EP_INT_EN_SHIFT (0U) | ||
15096 | /*! EP_INT_EN - If this bit is set and the corresponding USB interrupt status bit is set, a HW | ||
15097 | * interrupt is generated on the interrupt line indicated by the corresponding USB interrupt routing | ||
15098 | * bit. | ||
15099 | */ | ||
15100 | #define USB_INTEN_EP_INT_EN(x) (((uint32_t)(((uint32_t)(x)) << USB_INTEN_EP_INT_EN_SHIFT)) & USB_INTEN_EP_INT_EN_MASK) | ||
15101 | #define USB_INTEN_FRAME_INT_EN_MASK (0x40000000U) | ||
15102 | #define USB_INTEN_FRAME_INT_EN_SHIFT (30U) | ||
15103 | /*! FRAME_INT_EN - If this bit is set and the corresponding USB interrupt status bit is set, a HW | ||
15104 | * interrupt is generated on the interrupt line indicated by the corresponding USB interrupt | ||
15105 | * routing bit. | ||
15106 | */ | ||
15107 | #define USB_INTEN_FRAME_INT_EN(x) (((uint32_t)(((uint32_t)(x)) << USB_INTEN_FRAME_INT_EN_SHIFT)) & USB_INTEN_FRAME_INT_EN_MASK) | ||
15108 | #define USB_INTEN_DEV_INT_EN_MASK (0x80000000U) | ||
15109 | #define USB_INTEN_DEV_INT_EN_SHIFT (31U) | ||
15110 | /*! DEV_INT_EN - If this bit is set and the corresponding USB interrupt status bit is set, a HW | ||
15111 | * interrupt is generated on the interrupt line indicated by the corresponding USB interrupt routing | ||
15112 | * bit. | ||
15113 | */ | ||
15114 | #define USB_INTEN_DEV_INT_EN(x) (((uint32_t)(((uint32_t)(x)) << USB_INTEN_DEV_INT_EN_SHIFT)) & USB_INTEN_DEV_INT_EN_MASK) | ||
15115 | /*! @} */ | ||
15116 | |||
15117 | /*! @name INTSETSTAT - USB set interrupt status register */ | ||
15118 | /*! @{ */ | ||
15119 | #define USB_INTSETSTAT_EP_SET_INT_MASK (0x3FFU) | ||
15120 | #define USB_INTSETSTAT_EP_SET_INT_SHIFT (0U) | ||
15121 | /*! EP_SET_INT - If software writes a one to one of these bits, the corresponding USB interrupt | ||
15122 | * status bit is set. When this register is read, the same value as the USB interrupt status register | ||
15123 | * is returned. | ||
15124 | */ | ||
15125 | #define USB_INTSETSTAT_EP_SET_INT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSETSTAT_EP_SET_INT_SHIFT)) & USB_INTSETSTAT_EP_SET_INT_MASK) | ||
15126 | #define USB_INTSETSTAT_FRAME_SET_INT_MASK (0x40000000U) | ||
15127 | #define USB_INTSETSTAT_FRAME_SET_INT_SHIFT (30U) | ||
15128 | /*! FRAME_SET_INT - If software writes a one to one of these bits, the corresponding USB interrupt | ||
15129 | * status bit is set. When this register is read, the same value as the USB interrupt status | ||
15130 | * register is returned. | ||
15131 | */ | ||
15132 | #define USB_INTSETSTAT_FRAME_SET_INT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSETSTAT_FRAME_SET_INT_SHIFT)) & USB_INTSETSTAT_FRAME_SET_INT_MASK) | ||
15133 | #define USB_INTSETSTAT_DEV_SET_INT_MASK (0x80000000U) | ||
15134 | #define USB_INTSETSTAT_DEV_SET_INT_SHIFT (31U) | ||
15135 | /*! DEV_SET_INT - If software writes a one to one of these bits, the corresponding USB interrupt | ||
15136 | * status bit is set. When this register is read, the same value as the USB interrupt status | ||
15137 | * register is returned. | ||
15138 | */ | ||
15139 | #define USB_INTSETSTAT_DEV_SET_INT(x) (((uint32_t)(((uint32_t)(x)) << USB_INTSETSTAT_DEV_SET_INT_SHIFT)) & USB_INTSETSTAT_DEV_SET_INT_MASK) | ||
15140 | /*! @} */ | ||
15141 | |||
15142 | /*! @name EPTOGGLE - USB Endpoint toggle register */ | ||
15143 | /*! @{ */ | ||
15144 | #define USB_EPTOGGLE_TOGGLE_MASK (0x3FFU) | ||
15145 | #define USB_EPTOGGLE_TOGGLE_SHIFT (0U) | ||
15146 | /*! TOGGLE - Endpoint data toggle: This field indicates the current value of the data toggle for the corresponding endpoint. | ||
15147 | */ | ||
15148 | #define USB_EPTOGGLE_TOGGLE(x) (((uint32_t)(((uint32_t)(x)) << USB_EPTOGGLE_TOGGLE_SHIFT)) & USB_EPTOGGLE_TOGGLE_MASK) | ||
15149 | /*! @} */ | ||
15150 | |||
15151 | |||
15152 | /*! | ||
15153 | * @} | ||
15154 | */ /* end of group USB_Register_Masks */ | ||
15155 | |||
15156 | |||
15157 | /* USB - Peripheral instance base addresses */ | ||
15158 | /** Peripheral USB0 base address */ | ||
15159 | #define USB0_BASE (0x40084000u) | ||
15160 | /** Peripheral USB0 base pointer */ | ||
15161 | #define USB0 ((USB_Type *)USB0_BASE) | ||
15162 | /** Array initializer of USB peripheral base addresses */ | ||
15163 | #define USB_BASE_ADDRS { USB0_BASE } | ||
15164 | /** Array initializer of USB peripheral base pointers */ | ||
15165 | #define USB_BASE_PTRS { USB0 } | ||
15166 | /** Interrupt vectors for the USB peripheral type */ | ||
15167 | #define USB_IRQS { USB0_IRQn } | ||
15168 | #define USB_NEEDCLK_IRQS { USB0_NEEDCLK_IRQn } | ||
15169 | |||
15170 | /*! | ||
15171 | * @} | ||
15172 | */ /* end of group USB_Peripheral_Access_Layer */ | ||
15173 | |||
15174 | |||
15175 | /* ---------------------------------------------------------------------------- | ||
15176 | -- USBFSH Peripheral Access Layer | ||
15177 | ---------------------------------------------------------------------------- */ | ||
15178 | |||
15179 | /*! | ||
15180 | * @addtogroup USBFSH_Peripheral_Access_Layer USBFSH Peripheral Access Layer | ||
15181 | * @{ | ||
15182 | */ | ||
15183 | |||
15184 | /** USBFSH - Register Layout Typedef */ | ||
15185 | typedef struct { | ||
15186 | __I uint32_t HCREVISION; /**< BCD representation of the version of the HCI specification that is implemented by the Host Controller (HC), offset: 0x0 */ | ||
15187 | __IO uint32_t HCCONTROL; /**< Defines the operating modes of the HC, offset: 0x4 */ | ||
15188 | __IO uint32_t HCCOMMANDSTATUS; /**< This register is used to receive the commands from the Host Controller Driver (HCD), offset: 0x8 */ | ||
15189 | __IO uint32_t HCINTERRUPTSTATUS; /**< Indicates the status on various events that cause hardware interrupts by setting the appropriate bits, offset: 0xC */ | ||
15190 | __IO uint32_t HCINTERRUPTENABLE; /**< Controls the bits in the HcInterruptStatus register and indicates which events will generate a hardware interrupt, offset: 0x10 */ | ||
15191 | __IO uint32_t HCINTERRUPTDISABLE; /**< The bits in this register are used to disable corresponding bits in the HCInterruptStatus register and in turn disable that event leading to hardware interrupt, offset: 0x14 */ | ||
15192 | __IO uint32_t HCHCCA; /**< Contains the physical address of the host controller communication area, offset: 0x18 */ | ||
15193 | __I uint32_t HCPERIODCURRENTED; /**< Contains the physical address of the current isochronous or interrupt endpoint descriptor, offset: 0x1C */ | ||
15194 | __IO uint32_t HCCONTROLHEADED; /**< Contains the physical address of the first endpoint descriptor of the control list, offset: 0x20 */ | ||
15195 | __IO uint32_t HCCONTROLCURRENTED; /**< Contains the physical address of the current endpoint descriptor of the control list, offset: 0x24 */ | ||
15196 | __IO uint32_t HCBULKHEADED; /**< Contains the physical address of the first endpoint descriptor of the bulk list, offset: 0x28 */ | ||
15197 | __IO uint32_t HCBULKCURRENTED; /**< Contains the physical address of the current endpoint descriptor of the bulk list, offset: 0x2C */ | ||
15198 | __I uint32_t HCDONEHEAD; /**< Contains the physical address of the last transfer descriptor added to the 'Done' queue, offset: 0x30 */ | ||
15199 | __IO uint32_t HCFMINTERVAL; /**< Defines the bit time interval in a frame and the full speed maximum packet size which would not cause an overrun, offset: 0x34 */ | ||
15200 | __I uint32_t HCFMREMAINING; /**< A 14-bit counter showing the bit time remaining in the current frame, offset: 0x38 */ | ||
15201 | __I uint32_t HCFMNUMBER; /**< Contains a 16-bit counter and provides the timing reference among events happening in the HC and the HCD, offset: 0x3C */ | ||
15202 | __IO uint32_t HCPERIODICSTART; /**< Contains a programmable 14-bit value which determines the earliest time HC should start processing a periodic list, offset: 0x40 */ | ||
15203 | __IO uint32_t HCLSTHRESHOLD; /**< Contains 11-bit value which is used by the HC to determine whether to commit to transfer a maximum of 8-byte LS packet before EOF, offset: 0x44 */ | ||
15204 | __IO uint32_t HCRHDESCRIPTORA; /**< First of the two registers which describes the characteristics of the root hub, offset: 0x48 */ | ||
15205 | __IO uint32_t HCRHDESCRIPTORB; /**< Second of the two registers which describes the characteristics of the Root Hub, offset: 0x4C */ | ||
15206 | __IO uint32_t HCRHSTATUS; /**< This register is divided into two parts, offset: 0x50 */ | ||
15207 | __IO uint32_t HCRHPORTSTATUS; /**< Controls and reports the port events on a per-port basis, offset: 0x54 */ | ||
15208 | uint8_t RESERVED_0[4]; | ||
15209 | __IO uint32_t PORTMODE; /**< Controls the port if it is attached to the host block or the device block, offset: 0x5C */ | ||
15210 | } USBFSH_Type; | ||
15211 | |||
15212 | /* ---------------------------------------------------------------------------- | ||
15213 | -- USBFSH Register Masks | ||
15214 | ---------------------------------------------------------------------------- */ | ||
15215 | |||
15216 | /*! | ||
15217 | * @addtogroup USBFSH_Register_Masks USBFSH Register Masks | ||
15218 | * @{ | ||
15219 | */ | ||
15220 | |||
15221 | /*! @name HCREVISION - BCD representation of the version of the HCI specification that is implemented by the Host Controller (HC) */ | ||
15222 | /*! @{ */ | ||
15223 | #define USBFSH_HCREVISION_REV_MASK (0xFFU) | ||
15224 | #define USBFSH_HCREVISION_REV_SHIFT (0U) | ||
15225 | /*! REV - Revision. | ||
15226 | */ | ||
15227 | #define USBFSH_HCREVISION_REV(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCREVISION_REV_SHIFT)) & USBFSH_HCREVISION_REV_MASK) | ||
15228 | /*! @} */ | ||
15229 | |||
15230 | /*! @name HCCONTROL - Defines the operating modes of the HC */ | ||
15231 | /*! @{ */ | ||
15232 | #define USBFSH_HCCONTROL_CBSR_MASK (0x3U) | ||
15233 | #define USBFSH_HCCONTROL_CBSR_SHIFT (0U) | ||
15234 | /*! CBSR - ControlBulkServiceRatio. | ||
15235 | */ | ||
15236 | #define USBFSH_HCCONTROL_CBSR(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_CBSR_SHIFT)) & USBFSH_HCCONTROL_CBSR_MASK) | ||
15237 | #define USBFSH_HCCONTROL_PLE_MASK (0x4U) | ||
15238 | #define USBFSH_HCCONTROL_PLE_SHIFT (2U) | ||
15239 | /*! PLE - PeriodicListEnable. | ||
15240 | */ | ||
15241 | #define USBFSH_HCCONTROL_PLE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_PLE_SHIFT)) & USBFSH_HCCONTROL_PLE_MASK) | ||
15242 | #define USBFSH_HCCONTROL_IE_MASK (0x8U) | ||
15243 | #define USBFSH_HCCONTROL_IE_SHIFT (3U) | ||
15244 | /*! IE - IsochronousEnable. | ||
15245 | */ | ||
15246 | #define USBFSH_HCCONTROL_IE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_IE_SHIFT)) & USBFSH_HCCONTROL_IE_MASK) | ||
15247 | #define USBFSH_HCCONTROL_CLE_MASK (0x10U) | ||
15248 | #define USBFSH_HCCONTROL_CLE_SHIFT (4U) | ||
15249 | /*! CLE - ControlListEnable. | ||
15250 | */ | ||
15251 | #define USBFSH_HCCONTROL_CLE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_CLE_SHIFT)) & USBFSH_HCCONTROL_CLE_MASK) | ||
15252 | #define USBFSH_HCCONTROL_BLE_MASK (0x20U) | ||
15253 | #define USBFSH_HCCONTROL_BLE_SHIFT (5U) | ||
15254 | /*! BLE - BulkListEnable This bit is set to enable the processing of the Bulk list in the next Frame. | ||
15255 | */ | ||
15256 | #define USBFSH_HCCONTROL_BLE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_BLE_SHIFT)) & USBFSH_HCCONTROL_BLE_MASK) | ||
15257 | #define USBFSH_HCCONTROL_HCFS_MASK (0xC0U) | ||
15258 | #define USBFSH_HCCONTROL_HCFS_SHIFT (6U) | ||
15259 | /*! HCFS - HostControllerFunctionalState for USB 00b: USBRESET 01b: USBRESUME 10b: USBOPERATIONAL | ||
15260 | * 11b: USBSUSPEND A transition to USBOPERATIONAL from another state causes SOFgeneration to begin | ||
15261 | * 1 ms later. | ||
15262 | */ | ||
15263 | #define USBFSH_HCCONTROL_HCFS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_HCFS_SHIFT)) & USBFSH_HCCONTROL_HCFS_MASK) | ||
15264 | #define USBFSH_HCCONTROL_IR_MASK (0x100U) | ||
15265 | #define USBFSH_HCCONTROL_IR_SHIFT (8U) | ||
15266 | /*! IR - InterruptRouting This bit determines the routing of interrupts generated by events registered in HcInterruptStatus. | ||
15267 | */ | ||
15268 | #define USBFSH_HCCONTROL_IR(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_IR_SHIFT)) & USBFSH_HCCONTROL_IR_MASK) | ||
15269 | #define USBFSH_HCCONTROL_RWC_MASK (0x200U) | ||
15270 | #define USBFSH_HCCONTROL_RWC_SHIFT (9U) | ||
15271 | /*! RWC - RemoteWakeupConnected This bit indicates whether HC supports remote wake-up signaling. | ||
15272 | */ | ||
15273 | #define USBFSH_HCCONTROL_RWC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_RWC_SHIFT)) & USBFSH_HCCONTROL_RWC_MASK) | ||
15274 | #define USBFSH_HCCONTROL_RWE_MASK (0x400U) | ||
15275 | #define USBFSH_HCCONTROL_RWE_SHIFT (10U) | ||
15276 | /*! RWE - RemoteWakeupEnable This bit is used by HCD to enable or disable the remote wake-up feature | ||
15277 | * upon the detection of upstream resume signaling. | ||
15278 | */ | ||
15279 | #define USBFSH_HCCONTROL_RWE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROL_RWE_SHIFT)) & USBFSH_HCCONTROL_RWE_MASK) | ||
15280 | /*! @} */ | ||
15281 | |||
15282 | /*! @name HCCOMMANDSTATUS - This register is used to receive the commands from the Host Controller Driver (HCD) */ | ||
15283 | /*! @{ */ | ||
15284 | #define USBFSH_HCCOMMANDSTATUS_HCR_MASK (0x1U) | ||
15285 | #define USBFSH_HCCOMMANDSTATUS_HCR_SHIFT (0U) | ||
15286 | /*! HCR - HostControllerReset This bit is set by HCD to initiate a software reset of HC. | ||
15287 | */ | ||
15288 | #define USBFSH_HCCOMMANDSTATUS_HCR(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCOMMANDSTATUS_HCR_SHIFT)) & USBFSH_HCCOMMANDSTATUS_HCR_MASK) | ||
15289 | #define USBFSH_HCCOMMANDSTATUS_CLF_MASK (0x2U) | ||
15290 | #define USBFSH_HCCOMMANDSTATUS_CLF_SHIFT (1U) | ||
15291 | /*! CLF - ControlListFilled This bit is used to indicate whether there are any TDs on the Control list. | ||
15292 | */ | ||
15293 | #define USBFSH_HCCOMMANDSTATUS_CLF(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCOMMANDSTATUS_CLF_SHIFT)) & USBFSH_HCCOMMANDSTATUS_CLF_MASK) | ||
15294 | #define USBFSH_HCCOMMANDSTATUS_BLF_MASK (0x4U) | ||
15295 | #define USBFSH_HCCOMMANDSTATUS_BLF_SHIFT (2U) | ||
15296 | /*! BLF - BulkListFilled This bit is used to indicate whether there are any TDs on the Bulk list. | ||
15297 | */ | ||
15298 | #define USBFSH_HCCOMMANDSTATUS_BLF(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCOMMANDSTATUS_BLF_SHIFT)) & USBFSH_HCCOMMANDSTATUS_BLF_MASK) | ||
15299 | #define USBFSH_HCCOMMANDSTATUS_OCR_MASK (0x8U) | ||
15300 | #define USBFSH_HCCOMMANDSTATUS_OCR_SHIFT (3U) | ||
15301 | /*! OCR - OwnershipChangeRequest This bit is set by an OS HCD to request a change of control of the HC. | ||
15302 | */ | ||
15303 | #define USBFSH_HCCOMMANDSTATUS_OCR(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCOMMANDSTATUS_OCR_SHIFT)) & USBFSH_HCCOMMANDSTATUS_OCR_MASK) | ||
15304 | #define USBFSH_HCCOMMANDSTATUS_SOC_MASK (0xC0U) | ||
15305 | #define USBFSH_HCCOMMANDSTATUS_SOC_SHIFT (6U) | ||
15306 | /*! SOC - SchedulingOverrunCount These bits are incremented on each scheduling overrun error. | ||
15307 | */ | ||
15308 | #define USBFSH_HCCOMMANDSTATUS_SOC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCOMMANDSTATUS_SOC_SHIFT)) & USBFSH_HCCOMMANDSTATUS_SOC_MASK) | ||
15309 | /*! @} */ | ||
15310 | |||
15311 | /*! @name HCINTERRUPTSTATUS - Indicates the status on various events that cause hardware interrupts by setting the appropriate bits */ | ||
15312 | /*! @{ */ | ||
15313 | #define USBFSH_HCINTERRUPTSTATUS_SO_MASK (0x1U) | ||
15314 | #define USBFSH_HCINTERRUPTSTATUS_SO_SHIFT (0U) | ||
15315 | /*! SO - SchedulingOverrun This bit is set when the USB schedule for the current Frame overruns and | ||
15316 | * after the update of HccaFrameNumber. | ||
15317 | */ | ||
15318 | #define USBFSH_HCINTERRUPTSTATUS_SO(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTSTATUS_SO_SHIFT)) & USBFSH_HCINTERRUPTSTATUS_SO_MASK) | ||
15319 | #define USBFSH_HCINTERRUPTSTATUS_WDH_MASK (0x2U) | ||
15320 | #define USBFSH_HCINTERRUPTSTATUS_WDH_SHIFT (1U) | ||
15321 | /*! WDH - WritebackDoneHead This bit is set immediately after HC has written HcDoneHead to HccaDoneHead. | ||
15322 | */ | ||
15323 | #define USBFSH_HCINTERRUPTSTATUS_WDH(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTSTATUS_WDH_SHIFT)) & USBFSH_HCINTERRUPTSTATUS_WDH_MASK) | ||
15324 | #define USBFSH_HCINTERRUPTSTATUS_SF_MASK (0x4U) | ||
15325 | #define USBFSH_HCINTERRUPTSTATUS_SF_SHIFT (2U) | ||
15326 | /*! SF - StartofFrame This bit is set by HC at each start of a frame and after the update of HccaFrameNumber. | ||
15327 | */ | ||
15328 | #define USBFSH_HCINTERRUPTSTATUS_SF(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTSTATUS_SF_SHIFT)) & USBFSH_HCINTERRUPTSTATUS_SF_MASK) | ||
15329 | #define USBFSH_HCINTERRUPTSTATUS_RD_MASK (0x8U) | ||
15330 | #define USBFSH_HCINTERRUPTSTATUS_RD_SHIFT (3U) | ||
15331 | /*! RD - ResumeDetected This bit is set when HC detects that a device on the USB is asserting resume signaling. | ||
15332 | */ | ||
15333 | #define USBFSH_HCINTERRUPTSTATUS_RD(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTSTATUS_RD_SHIFT)) & USBFSH_HCINTERRUPTSTATUS_RD_MASK) | ||
15334 | #define USBFSH_HCINTERRUPTSTATUS_UE_MASK (0x10U) | ||
15335 | #define USBFSH_HCINTERRUPTSTATUS_UE_SHIFT (4U) | ||
15336 | /*! UE - UnrecoverableError This bit is set when HC detects a system error not related to USB. | ||
15337 | */ | ||
15338 | #define USBFSH_HCINTERRUPTSTATUS_UE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTSTATUS_UE_SHIFT)) & USBFSH_HCINTERRUPTSTATUS_UE_MASK) | ||
15339 | #define USBFSH_HCINTERRUPTSTATUS_FNO_MASK (0x20U) | ||
15340 | #define USBFSH_HCINTERRUPTSTATUS_FNO_SHIFT (5U) | ||
15341 | /*! FNO - FrameNumberOverflow This bit is set when the MSb of HcFmNumber (bit 15) changes value, | ||
15342 | * from 0 to 1 or from 1 to 0, and after HccaFrameNumber has been updated. | ||
15343 | */ | ||
15344 | #define USBFSH_HCINTERRUPTSTATUS_FNO(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTSTATUS_FNO_SHIFT)) & USBFSH_HCINTERRUPTSTATUS_FNO_MASK) | ||
15345 | #define USBFSH_HCINTERRUPTSTATUS_RHSC_MASK (0x40U) | ||
15346 | #define USBFSH_HCINTERRUPTSTATUS_RHSC_SHIFT (6U) | ||
15347 | /*! RHSC - RootHubStatusChange This bit is set when the content of HcRhStatus or the content of any | ||
15348 | * of HcRhPortStatus[NumberofDownstreamPort] has changed. | ||
15349 | */ | ||
15350 | #define USBFSH_HCINTERRUPTSTATUS_RHSC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTSTATUS_RHSC_SHIFT)) & USBFSH_HCINTERRUPTSTATUS_RHSC_MASK) | ||
15351 | #define USBFSH_HCINTERRUPTSTATUS_OC_MASK (0xFFFFFC00U) | ||
15352 | #define USBFSH_HCINTERRUPTSTATUS_OC_SHIFT (10U) | ||
15353 | /*! OC - OwnershipChange This bit is set by HC when HCD sets the OwnershipChangeRequest field in HcCommandStatus. | ||
15354 | */ | ||
15355 | #define USBFSH_HCINTERRUPTSTATUS_OC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTSTATUS_OC_SHIFT)) & USBFSH_HCINTERRUPTSTATUS_OC_MASK) | ||
15356 | /*! @} */ | ||
15357 | |||
15358 | /*! @name HCINTERRUPTENABLE - Controls the bits in the HcInterruptStatus register and indicates which events will generate a hardware interrupt */ | ||
15359 | /*! @{ */ | ||
15360 | #define USBFSH_HCINTERRUPTENABLE_SO_MASK (0x1U) | ||
15361 | #define USBFSH_HCINTERRUPTENABLE_SO_SHIFT (0U) | ||
15362 | /*! SO - Scheduling Overrun interrupt. | ||
15363 | */ | ||
15364 | #define USBFSH_HCINTERRUPTENABLE_SO(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_SO_SHIFT)) & USBFSH_HCINTERRUPTENABLE_SO_MASK) | ||
15365 | #define USBFSH_HCINTERRUPTENABLE_WDH_MASK (0x2U) | ||
15366 | #define USBFSH_HCINTERRUPTENABLE_WDH_SHIFT (1U) | ||
15367 | /*! WDH - HcDoneHead Writeback interrupt. | ||
15368 | */ | ||
15369 | #define USBFSH_HCINTERRUPTENABLE_WDH(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_WDH_SHIFT)) & USBFSH_HCINTERRUPTENABLE_WDH_MASK) | ||
15370 | #define USBFSH_HCINTERRUPTENABLE_SF_MASK (0x4U) | ||
15371 | #define USBFSH_HCINTERRUPTENABLE_SF_SHIFT (2U) | ||
15372 | /*! SF - Start of Frame interrupt. | ||
15373 | */ | ||
15374 | #define USBFSH_HCINTERRUPTENABLE_SF(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_SF_SHIFT)) & USBFSH_HCINTERRUPTENABLE_SF_MASK) | ||
15375 | #define USBFSH_HCINTERRUPTENABLE_RD_MASK (0x8U) | ||
15376 | #define USBFSH_HCINTERRUPTENABLE_RD_SHIFT (3U) | ||
15377 | /*! RD - Resume Detect interrupt. | ||
15378 | */ | ||
15379 | #define USBFSH_HCINTERRUPTENABLE_RD(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_RD_SHIFT)) & USBFSH_HCINTERRUPTENABLE_RD_MASK) | ||
15380 | #define USBFSH_HCINTERRUPTENABLE_UE_MASK (0x10U) | ||
15381 | #define USBFSH_HCINTERRUPTENABLE_UE_SHIFT (4U) | ||
15382 | /*! UE - Unrecoverable Error interrupt. | ||
15383 | */ | ||
15384 | #define USBFSH_HCINTERRUPTENABLE_UE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_UE_SHIFT)) & USBFSH_HCINTERRUPTENABLE_UE_MASK) | ||
15385 | #define USBFSH_HCINTERRUPTENABLE_FNO_MASK (0x20U) | ||
15386 | #define USBFSH_HCINTERRUPTENABLE_FNO_SHIFT (5U) | ||
15387 | /*! FNO - Frame Number Overflow interrupt. | ||
15388 | */ | ||
15389 | #define USBFSH_HCINTERRUPTENABLE_FNO(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_FNO_SHIFT)) & USBFSH_HCINTERRUPTENABLE_FNO_MASK) | ||
15390 | #define USBFSH_HCINTERRUPTENABLE_RHSC_MASK (0x40U) | ||
15391 | #define USBFSH_HCINTERRUPTENABLE_RHSC_SHIFT (6U) | ||
15392 | /*! RHSC - Root Hub Status Change interrupt. | ||
15393 | */ | ||
15394 | #define USBFSH_HCINTERRUPTENABLE_RHSC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_RHSC_SHIFT)) & USBFSH_HCINTERRUPTENABLE_RHSC_MASK) | ||
15395 | #define USBFSH_HCINTERRUPTENABLE_OC_MASK (0x40000000U) | ||
15396 | #define USBFSH_HCINTERRUPTENABLE_OC_SHIFT (30U) | ||
15397 | /*! OC - Ownership Change interrupt. | ||
15398 | */ | ||
15399 | #define USBFSH_HCINTERRUPTENABLE_OC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_OC_SHIFT)) & USBFSH_HCINTERRUPTENABLE_OC_MASK) | ||
15400 | #define USBFSH_HCINTERRUPTENABLE_MIE_MASK (0x80000000U) | ||
15401 | #define USBFSH_HCINTERRUPTENABLE_MIE_SHIFT (31U) | ||
15402 | /*! MIE - Master Interrupt Enable. | ||
15403 | */ | ||
15404 | #define USBFSH_HCINTERRUPTENABLE_MIE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTENABLE_MIE_SHIFT)) & USBFSH_HCINTERRUPTENABLE_MIE_MASK) | ||
15405 | /*! @} */ | ||
15406 | |||
15407 | /*! @name HCINTERRUPTDISABLE - The bits in this register are used to disable corresponding bits in the HCInterruptStatus register and in turn disable that event leading to hardware interrupt */ | ||
15408 | /*! @{ */ | ||
15409 | #define USBFSH_HCINTERRUPTDISABLE_SO_MASK (0x1U) | ||
15410 | #define USBFSH_HCINTERRUPTDISABLE_SO_SHIFT (0U) | ||
15411 | /*! SO - Scheduling Overrun interrupt. | ||
15412 | */ | ||
15413 | #define USBFSH_HCINTERRUPTDISABLE_SO(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_SO_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_SO_MASK) | ||
15414 | #define USBFSH_HCINTERRUPTDISABLE_WDH_MASK (0x2U) | ||
15415 | #define USBFSH_HCINTERRUPTDISABLE_WDH_SHIFT (1U) | ||
15416 | /*! WDH - HcDoneHead Writeback interrupt. | ||
15417 | */ | ||
15418 | #define USBFSH_HCINTERRUPTDISABLE_WDH(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_WDH_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_WDH_MASK) | ||
15419 | #define USBFSH_HCINTERRUPTDISABLE_SF_MASK (0x4U) | ||
15420 | #define USBFSH_HCINTERRUPTDISABLE_SF_SHIFT (2U) | ||
15421 | /*! SF - Start of Frame interrupt. | ||
15422 | */ | ||
15423 | #define USBFSH_HCINTERRUPTDISABLE_SF(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_SF_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_SF_MASK) | ||
15424 | #define USBFSH_HCINTERRUPTDISABLE_RD_MASK (0x8U) | ||
15425 | #define USBFSH_HCINTERRUPTDISABLE_RD_SHIFT (3U) | ||
15426 | /*! RD - Resume Detect interrupt. | ||
15427 | */ | ||
15428 | #define USBFSH_HCINTERRUPTDISABLE_RD(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_RD_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_RD_MASK) | ||
15429 | #define USBFSH_HCINTERRUPTDISABLE_UE_MASK (0x10U) | ||
15430 | #define USBFSH_HCINTERRUPTDISABLE_UE_SHIFT (4U) | ||
15431 | /*! UE - Unrecoverable Error interrupt. | ||
15432 | */ | ||
15433 | #define USBFSH_HCINTERRUPTDISABLE_UE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_UE_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_UE_MASK) | ||
15434 | #define USBFSH_HCINTERRUPTDISABLE_FNO_MASK (0x20U) | ||
15435 | #define USBFSH_HCINTERRUPTDISABLE_FNO_SHIFT (5U) | ||
15436 | /*! FNO - Frame Number Overflow interrupt. | ||
15437 | */ | ||
15438 | #define USBFSH_HCINTERRUPTDISABLE_FNO(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_FNO_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_FNO_MASK) | ||
15439 | #define USBFSH_HCINTERRUPTDISABLE_RHSC_MASK (0x40U) | ||
15440 | #define USBFSH_HCINTERRUPTDISABLE_RHSC_SHIFT (6U) | ||
15441 | /*! RHSC - Root Hub Status Change interrupt. | ||
15442 | */ | ||
15443 | #define USBFSH_HCINTERRUPTDISABLE_RHSC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_RHSC_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_RHSC_MASK) | ||
15444 | #define USBFSH_HCINTERRUPTDISABLE_OC_MASK (0x40000000U) | ||
15445 | #define USBFSH_HCINTERRUPTDISABLE_OC_SHIFT (30U) | ||
15446 | /*! OC - Ownership Change interrupt. | ||
15447 | */ | ||
15448 | #define USBFSH_HCINTERRUPTDISABLE_OC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_OC_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_OC_MASK) | ||
15449 | #define USBFSH_HCINTERRUPTDISABLE_MIE_MASK (0x80000000U) | ||
15450 | #define USBFSH_HCINTERRUPTDISABLE_MIE_SHIFT (31U) | ||
15451 | /*! MIE - A 0 written to this field is ignored by HC. | ||
15452 | */ | ||
15453 | #define USBFSH_HCINTERRUPTDISABLE_MIE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCINTERRUPTDISABLE_MIE_SHIFT)) & USBFSH_HCINTERRUPTDISABLE_MIE_MASK) | ||
15454 | /*! @} */ | ||
15455 | |||
15456 | /*! @name HCHCCA - Contains the physical address of the host controller communication area */ | ||
15457 | /*! @{ */ | ||
15458 | #define USBFSH_HCHCCA_HCCA_MASK (0xFFFFFF00U) | ||
15459 | #define USBFSH_HCHCCA_HCCA_SHIFT (8U) | ||
15460 | /*! HCCA - Base address of the Host Controller Communication Area. | ||
15461 | */ | ||
15462 | #define USBFSH_HCHCCA_HCCA(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCHCCA_HCCA_SHIFT)) & USBFSH_HCHCCA_HCCA_MASK) | ||
15463 | /*! @} */ | ||
15464 | |||
15465 | /*! @name HCPERIODCURRENTED - Contains the physical address of the current isochronous or interrupt endpoint descriptor */ | ||
15466 | /*! @{ */ | ||
15467 | #define USBFSH_HCPERIODCURRENTED_PCED_MASK (0xFFFFFFF0U) | ||
15468 | #define USBFSH_HCPERIODCURRENTED_PCED_SHIFT (4U) | ||
15469 | /*! PCED - The content of this register is updated by HC after a periodic ED is processed. | ||
15470 | */ | ||
15471 | #define USBFSH_HCPERIODCURRENTED_PCED(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCPERIODCURRENTED_PCED_SHIFT)) & USBFSH_HCPERIODCURRENTED_PCED_MASK) | ||
15472 | /*! @} */ | ||
15473 | |||
15474 | /*! @name HCCONTROLHEADED - Contains the physical address of the first endpoint descriptor of the control list */ | ||
15475 | /*! @{ */ | ||
15476 | #define USBFSH_HCCONTROLHEADED_CHED_MASK (0xFFFFFFF0U) | ||
15477 | #define USBFSH_HCCONTROLHEADED_CHED_SHIFT (4U) | ||
15478 | /*! CHED - HC traverses the Control list starting with the HcControlHeadED pointer. | ||
15479 | */ | ||
15480 | #define USBFSH_HCCONTROLHEADED_CHED(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROLHEADED_CHED_SHIFT)) & USBFSH_HCCONTROLHEADED_CHED_MASK) | ||
15481 | /*! @} */ | ||
15482 | |||
15483 | /*! @name HCCONTROLCURRENTED - Contains the physical address of the current endpoint descriptor of the control list */ | ||
15484 | /*! @{ */ | ||
15485 | #define USBFSH_HCCONTROLCURRENTED_CCED_MASK (0xFFFFFFF0U) | ||
15486 | #define USBFSH_HCCONTROLCURRENTED_CCED_SHIFT (4U) | ||
15487 | /*! CCED - ControlCurrentED. | ||
15488 | */ | ||
15489 | #define USBFSH_HCCONTROLCURRENTED_CCED(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCCONTROLCURRENTED_CCED_SHIFT)) & USBFSH_HCCONTROLCURRENTED_CCED_MASK) | ||
15490 | /*! @} */ | ||
15491 | |||
15492 | /*! @name HCBULKHEADED - Contains the physical address of the first endpoint descriptor of the bulk list */ | ||
15493 | /*! @{ */ | ||
15494 | #define USBFSH_HCBULKHEADED_BHED_MASK (0xFFFFFFF0U) | ||
15495 | #define USBFSH_HCBULKHEADED_BHED_SHIFT (4U) | ||
15496 | /*! BHED - BulkHeadED HC traverses the bulk list starting with the HcBulkHeadED pointer. | ||
15497 | */ | ||
15498 | #define USBFSH_HCBULKHEADED_BHED(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCBULKHEADED_BHED_SHIFT)) & USBFSH_HCBULKHEADED_BHED_MASK) | ||
15499 | /*! @} */ | ||
15500 | |||
15501 | /*! @name HCBULKCURRENTED - Contains the physical address of the current endpoint descriptor of the bulk list */ | ||
15502 | /*! @{ */ | ||
15503 | #define USBFSH_HCBULKCURRENTED_BCED_MASK (0xFFFFFFF0U) | ||
15504 | #define USBFSH_HCBULKCURRENTED_BCED_SHIFT (4U) | ||
15505 | /*! BCED - BulkCurrentED This is advanced to the next ED after the HC has served the current one. | ||
15506 | */ | ||
15507 | #define USBFSH_HCBULKCURRENTED_BCED(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCBULKCURRENTED_BCED_SHIFT)) & USBFSH_HCBULKCURRENTED_BCED_MASK) | ||
15508 | /*! @} */ | ||
15509 | |||
15510 | /*! @name HCDONEHEAD - Contains the physical address of the last transfer descriptor added to the 'Done' queue */ | ||
15511 | /*! @{ */ | ||
15512 | #define USBFSH_HCDONEHEAD_DH_MASK (0xFFFFFFF0U) | ||
15513 | #define USBFSH_HCDONEHEAD_DH_SHIFT (4U) | ||
15514 | /*! DH - DoneHead When a TD is completed, HC writes the content of HcDoneHead to the NextTD field of the TD. | ||
15515 | */ | ||
15516 | #define USBFSH_HCDONEHEAD_DH(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCDONEHEAD_DH_SHIFT)) & USBFSH_HCDONEHEAD_DH_MASK) | ||
15517 | /*! @} */ | ||
15518 | |||
15519 | /*! @name HCFMINTERVAL - Defines the bit time interval in a frame and the full speed maximum packet size which would not cause an overrun */ | ||
15520 | /*! @{ */ | ||
15521 | #define USBFSH_HCFMINTERVAL_FI_MASK (0x3FFFU) | ||
15522 | #define USBFSH_HCFMINTERVAL_FI_SHIFT (0U) | ||
15523 | /*! FI - FrameInterval This specifies the interval between two consecutive SOFs in bit times. | ||
15524 | */ | ||
15525 | #define USBFSH_HCFMINTERVAL_FI(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCFMINTERVAL_FI_SHIFT)) & USBFSH_HCFMINTERVAL_FI_MASK) | ||
15526 | #define USBFSH_HCFMINTERVAL_FSMPS_MASK (0x7FFF0000U) | ||
15527 | #define USBFSH_HCFMINTERVAL_FSMPS_SHIFT (16U) | ||
15528 | /*! FSMPS - FSLargestDataPacket This field specifies a value which is loaded into the Largest Data | ||
15529 | * Packet Counter at the beginning of each frame. | ||
15530 | */ | ||
15531 | #define USBFSH_HCFMINTERVAL_FSMPS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCFMINTERVAL_FSMPS_SHIFT)) & USBFSH_HCFMINTERVAL_FSMPS_MASK) | ||
15532 | #define USBFSH_HCFMINTERVAL_FIT_MASK (0x80000000U) | ||
15533 | #define USBFSH_HCFMINTERVAL_FIT_SHIFT (31U) | ||
15534 | /*! FIT - FrameIntervalToggle HCD toggles this bit whenever it loads a new value to FrameInterval. | ||
15535 | */ | ||
15536 | #define USBFSH_HCFMINTERVAL_FIT(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCFMINTERVAL_FIT_SHIFT)) & USBFSH_HCFMINTERVAL_FIT_MASK) | ||
15537 | /*! @} */ | ||
15538 | |||
15539 | /*! @name HCFMREMAINING - A 14-bit counter showing the bit time remaining in the current frame */ | ||
15540 | /*! @{ */ | ||
15541 | #define USBFSH_HCFMREMAINING_FR_MASK (0x3FFFU) | ||
15542 | #define USBFSH_HCFMREMAINING_FR_SHIFT (0U) | ||
15543 | /*! FR - FrameRemaining This counter is decremented at each bit time. | ||
15544 | */ | ||
15545 | #define USBFSH_HCFMREMAINING_FR(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCFMREMAINING_FR_SHIFT)) & USBFSH_HCFMREMAINING_FR_MASK) | ||
15546 | #define USBFSH_HCFMREMAINING_FRT_MASK (0x80000000U) | ||
15547 | #define USBFSH_HCFMREMAINING_FRT_SHIFT (31U) | ||
15548 | /*! FRT - FrameRemainingToggle This bit is loaded from the FrameIntervalToggle field of HcFmInterval | ||
15549 | * whenever FrameRemaining reaches 0. | ||
15550 | */ | ||
15551 | #define USBFSH_HCFMREMAINING_FRT(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCFMREMAINING_FRT_SHIFT)) & USBFSH_HCFMREMAINING_FRT_MASK) | ||
15552 | /*! @} */ | ||
15553 | |||
15554 | /*! @name HCFMNUMBER - Contains a 16-bit counter and provides the timing reference among events happening in the HC and the HCD */ | ||
15555 | /*! @{ */ | ||
15556 | #define USBFSH_HCFMNUMBER_FN_MASK (0xFFFFU) | ||
15557 | #define USBFSH_HCFMNUMBER_FN_SHIFT (0U) | ||
15558 | /*! FN - FrameNumber This is incremented when HcFmRemaining is re-loaded. | ||
15559 | */ | ||
15560 | #define USBFSH_HCFMNUMBER_FN(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCFMNUMBER_FN_SHIFT)) & USBFSH_HCFMNUMBER_FN_MASK) | ||
15561 | /*! @} */ | ||
15562 | |||
15563 | /*! @name HCPERIODICSTART - Contains a programmable 14-bit value which determines the earliest time HC should start processing a periodic list */ | ||
15564 | /*! @{ */ | ||
15565 | #define USBFSH_HCPERIODICSTART_PS_MASK (0x3FFFU) | ||
15566 | #define USBFSH_HCPERIODICSTART_PS_SHIFT (0U) | ||
15567 | /*! PS - PeriodicStart After a hardware reset, this field is cleared and then set by HCD during the HC initialization. | ||
15568 | */ | ||
15569 | #define USBFSH_HCPERIODICSTART_PS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCPERIODICSTART_PS_SHIFT)) & USBFSH_HCPERIODICSTART_PS_MASK) | ||
15570 | /*! @} */ | ||
15571 | |||
15572 | /*! @name HCLSTHRESHOLD - Contains 11-bit value which is used by the HC to determine whether to commit to transfer a maximum of 8-byte LS packet before EOF */ | ||
15573 | /*! @{ */ | ||
15574 | #define USBFSH_HCLSTHRESHOLD_LST_MASK (0xFFFU) | ||
15575 | #define USBFSH_HCLSTHRESHOLD_LST_SHIFT (0U) | ||
15576 | /*! LST - LSThreshold This field contains a value which is compared to the FrameRemaining field | ||
15577 | * prior to initiating a Low Speed transaction. | ||
15578 | */ | ||
15579 | #define USBFSH_HCLSTHRESHOLD_LST(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCLSTHRESHOLD_LST_SHIFT)) & USBFSH_HCLSTHRESHOLD_LST_MASK) | ||
15580 | /*! @} */ | ||
15581 | |||
15582 | /*! @name HCRHDESCRIPTORA - First of the two registers which describes the characteristics of the root hub */ | ||
15583 | /*! @{ */ | ||
15584 | #define USBFSH_HCRHDESCRIPTORA_NDP_MASK (0xFFU) | ||
15585 | #define USBFSH_HCRHDESCRIPTORA_NDP_SHIFT (0U) | ||
15586 | /*! NDP - NumberDownstreamPorts These bits specify the number of downstream ports supported by the root hub. | ||
15587 | */ | ||
15588 | #define USBFSH_HCRHDESCRIPTORA_NDP(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORA_NDP_SHIFT)) & USBFSH_HCRHDESCRIPTORA_NDP_MASK) | ||
15589 | #define USBFSH_HCRHDESCRIPTORA_PSM_MASK (0x100U) | ||
15590 | #define USBFSH_HCRHDESCRIPTORA_PSM_SHIFT (8U) | ||
15591 | /*! PSM - PowerSwitchingMode This bit is used to specify how the power switching of the root hub ports is controlled. | ||
15592 | */ | ||
15593 | #define USBFSH_HCRHDESCRIPTORA_PSM(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORA_PSM_SHIFT)) & USBFSH_HCRHDESCRIPTORA_PSM_MASK) | ||
15594 | #define USBFSH_HCRHDESCRIPTORA_NPS_MASK (0x200U) | ||
15595 | #define USBFSH_HCRHDESCRIPTORA_NPS_SHIFT (9U) | ||
15596 | /*! NPS - NoPowerSwitching These bits are used to specify whether power switching is supported or port are always powered. | ||
15597 | */ | ||
15598 | #define USBFSH_HCRHDESCRIPTORA_NPS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORA_NPS_SHIFT)) & USBFSH_HCRHDESCRIPTORA_NPS_MASK) | ||
15599 | #define USBFSH_HCRHDESCRIPTORA_DT_MASK (0x400U) | ||
15600 | #define USBFSH_HCRHDESCRIPTORA_DT_SHIFT (10U) | ||
15601 | /*! DT - DeviceType This bit specifies that the root hub is not a compound device. | ||
15602 | */ | ||
15603 | #define USBFSH_HCRHDESCRIPTORA_DT(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORA_DT_SHIFT)) & USBFSH_HCRHDESCRIPTORA_DT_MASK) | ||
15604 | #define USBFSH_HCRHDESCRIPTORA_OCPM_MASK (0x800U) | ||
15605 | #define USBFSH_HCRHDESCRIPTORA_OCPM_SHIFT (11U) | ||
15606 | /*! OCPM - OverCurrentProtectionMode This bit describes how the overcurrent status for the root hub ports are reported. | ||
15607 | */ | ||
15608 | #define USBFSH_HCRHDESCRIPTORA_OCPM(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORA_OCPM_SHIFT)) & USBFSH_HCRHDESCRIPTORA_OCPM_MASK) | ||
15609 | #define USBFSH_HCRHDESCRIPTORA_NOCP_MASK (0x1000U) | ||
15610 | #define USBFSH_HCRHDESCRIPTORA_NOCP_SHIFT (12U) | ||
15611 | /*! NOCP - NoOverCurrentProtection This bit describes how the overcurrent status for the root hub ports are reported. | ||
15612 | */ | ||
15613 | #define USBFSH_HCRHDESCRIPTORA_NOCP(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORA_NOCP_SHIFT)) & USBFSH_HCRHDESCRIPTORA_NOCP_MASK) | ||
15614 | #define USBFSH_HCRHDESCRIPTORA_POTPGT_MASK (0xFF000000U) | ||
15615 | #define USBFSH_HCRHDESCRIPTORA_POTPGT_SHIFT (24U) | ||
15616 | /*! POTPGT - PowerOnToPowerGoodTime This byte specifies the duration the HCD has to wait before | ||
15617 | * accessing a powered-on port of the root hub. | ||
15618 | */ | ||
15619 | #define USBFSH_HCRHDESCRIPTORA_POTPGT(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORA_POTPGT_SHIFT)) & USBFSH_HCRHDESCRIPTORA_POTPGT_MASK) | ||
15620 | /*! @} */ | ||
15621 | |||
15622 | /*! @name HCRHDESCRIPTORB - Second of the two registers which describes the characteristics of the Root Hub */ | ||
15623 | /*! @{ */ | ||
15624 | #define USBFSH_HCRHDESCRIPTORB_DR_MASK (0xFFFFU) | ||
15625 | #define USBFSH_HCRHDESCRIPTORB_DR_SHIFT (0U) | ||
15626 | /*! DR - DeviceRemovable Each bit is dedicated to a port of the Root Hub. | ||
15627 | */ | ||
15628 | #define USBFSH_HCRHDESCRIPTORB_DR(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORB_DR_SHIFT)) & USBFSH_HCRHDESCRIPTORB_DR_MASK) | ||
15629 | #define USBFSH_HCRHDESCRIPTORB_PPCM_MASK (0xFFFF0000U) | ||
15630 | #define USBFSH_HCRHDESCRIPTORB_PPCM_SHIFT (16U) | ||
15631 | /*! PPCM - PortPowerControlMask Each bit indicates if a port is affected by a global power control | ||
15632 | * command when PowerSwitchingMode is set. | ||
15633 | */ | ||
15634 | #define USBFSH_HCRHDESCRIPTORB_PPCM(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHDESCRIPTORB_PPCM_SHIFT)) & USBFSH_HCRHDESCRIPTORB_PPCM_MASK) | ||
15635 | /*! @} */ | ||
15636 | |||
15637 | /*! @name HCRHSTATUS - This register is divided into two parts */ | ||
15638 | /*! @{ */ | ||
15639 | #define USBFSH_HCRHSTATUS_LPS_MASK (0x1U) | ||
15640 | #define USBFSH_HCRHSTATUS_LPS_SHIFT (0U) | ||
15641 | /*! LPS - (read) LocalPowerStatus The Root Hub does not support the local power status feature; | ||
15642 | * thus, this bit is always read as 0. | ||
15643 | */ | ||
15644 | #define USBFSH_HCRHSTATUS_LPS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHSTATUS_LPS_SHIFT)) & USBFSH_HCRHSTATUS_LPS_MASK) | ||
15645 | #define USBFSH_HCRHSTATUS_OCI_MASK (0x2U) | ||
15646 | #define USBFSH_HCRHSTATUS_OCI_SHIFT (1U) | ||
15647 | /*! OCI - OverCurrentIndicator This bit reports overcurrent conditions when the global reporting is implemented. | ||
15648 | */ | ||
15649 | #define USBFSH_HCRHSTATUS_OCI(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHSTATUS_OCI_SHIFT)) & USBFSH_HCRHSTATUS_OCI_MASK) | ||
15650 | #define USBFSH_HCRHSTATUS_DRWE_MASK (0x8000U) | ||
15651 | #define USBFSH_HCRHSTATUS_DRWE_SHIFT (15U) | ||
15652 | /*! DRWE - (read) DeviceRemoteWakeupEnable This bit enables a ConnectStatusChange bit as a resume | ||
15653 | * event, causing a USBSUSPEND to USBRESUME state transition and setting the ResumeDetected | ||
15654 | * interrupt. | ||
15655 | */ | ||
15656 | #define USBFSH_HCRHSTATUS_DRWE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHSTATUS_DRWE_SHIFT)) & USBFSH_HCRHSTATUS_DRWE_MASK) | ||
15657 | #define USBFSH_HCRHSTATUS_LPSC_MASK (0x10000U) | ||
15658 | #define USBFSH_HCRHSTATUS_LPSC_SHIFT (16U) | ||
15659 | /*! LPSC - (read) LocalPowerStatusChange The root hub does not support the local power status feature. | ||
15660 | */ | ||
15661 | #define USBFSH_HCRHSTATUS_LPSC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHSTATUS_LPSC_SHIFT)) & USBFSH_HCRHSTATUS_LPSC_MASK) | ||
15662 | #define USBFSH_HCRHSTATUS_OCIC_MASK (0x20000U) | ||
15663 | #define USBFSH_HCRHSTATUS_OCIC_SHIFT (17U) | ||
15664 | /*! OCIC - OverCurrentIndicatorChange This bit is set by hardware when a change has occurred to the OCI field of this register. | ||
15665 | */ | ||
15666 | #define USBFSH_HCRHSTATUS_OCIC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHSTATUS_OCIC_SHIFT)) & USBFSH_HCRHSTATUS_OCIC_MASK) | ||
15667 | #define USBFSH_HCRHSTATUS_CRWE_MASK (0x80000000U) | ||
15668 | #define USBFSH_HCRHSTATUS_CRWE_SHIFT (31U) | ||
15669 | /*! CRWE - (write) ClearRemoteWakeupEnable Writing a 1 clears DeviceRemoveWakeupEnable. | ||
15670 | */ | ||
15671 | #define USBFSH_HCRHSTATUS_CRWE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHSTATUS_CRWE_SHIFT)) & USBFSH_HCRHSTATUS_CRWE_MASK) | ||
15672 | /*! @} */ | ||
15673 | |||
15674 | /*! @name HCRHPORTSTATUS - Controls and reports the port events on a per-port basis */ | ||
15675 | /*! @{ */ | ||
15676 | #define USBFSH_HCRHPORTSTATUS_CCS_MASK (0x1U) | ||
15677 | #define USBFSH_HCRHPORTSTATUS_CCS_SHIFT (0U) | ||
15678 | /*! CCS - (read) CurrentConnectStatus This bit reflects the current state of the downstream port. | ||
15679 | */ | ||
15680 | #define USBFSH_HCRHPORTSTATUS_CCS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_CCS_SHIFT)) & USBFSH_HCRHPORTSTATUS_CCS_MASK) | ||
15681 | #define USBFSH_HCRHPORTSTATUS_PES_MASK (0x2U) | ||
15682 | #define USBFSH_HCRHPORTSTATUS_PES_SHIFT (1U) | ||
15683 | /*! PES - (read) PortEnableStatus This bit indicates whether the port is enabled or disabled. | ||
15684 | */ | ||
15685 | #define USBFSH_HCRHPORTSTATUS_PES(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_PES_SHIFT)) & USBFSH_HCRHPORTSTATUS_PES_MASK) | ||
15686 | #define USBFSH_HCRHPORTSTATUS_PSS_MASK (0x4U) | ||
15687 | #define USBFSH_HCRHPORTSTATUS_PSS_SHIFT (2U) | ||
15688 | /*! PSS - (read) PortSuspendStatus This bit indicates the port is suspended or in the resume sequence. | ||
15689 | */ | ||
15690 | #define USBFSH_HCRHPORTSTATUS_PSS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_PSS_SHIFT)) & USBFSH_HCRHPORTSTATUS_PSS_MASK) | ||
15691 | #define USBFSH_HCRHPORTSTATUS_POCI_MASK (0x8U) | ||
15692 | #define USBFSH_HCRHPORTSTATUS_POCI_SHIFT (3U) | ||
15693 | /*! POCI - (read) PortOverCurrentIndicator This bit is only valid when the Root Hub is configured in | ||
15694 | * such a way that overcurrent conditions are reported on a per-port basis. | ||
15695 | */ | ||
15696 | #define USBFSH_HCRHPORTSTATUS_POCI(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_POCI_SHIFT)) & USBFSH_HCRHPORTSTATUS_POCI_MASK) | ||
15697 | #define USBFSH_HCRHPORTSTATUS_PRS_MASK (0x10U) | ||
15698 | #define USBFSH_HCRHPORTSTATUS_PRS_SHIFT (4U) | ||
15699 | /*! PRS - (read) PortResetStatus When this bit is set by a write to SetPortReset, port reset signaling is asserted. | ||
15700 | */ | ||
15701 | #define USBFSH_HCRHPORTSTATUS_PRS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_PRS_SHIFT)) & USBFSH_HCRHPORTSTATUS_PRS_MASK) | ||
15702 | #define USBFSH_HCRHPORTSTATUS_PPS_MASK (0x100U) | ||
15703 | #define USBFSH_HCRHPORTSTATUS_PPS_SHIFT (8U) | ||
15704 | /*! PPS - (read) PortPowerStatus This bit reflects the porta's power status, regardless of the type | ||
15705 | * of power switching implemented. | ||
15706 | */ | ||
15707 | #define USBFSH_HCRHPORTSTATUS_PPS(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_PPS_SHIFT)) & USBFSH_HCRHPORTSTATUS_PPS_MASK) | ||
15708 | #define USBFSH_HCRHPORTSTATUS_LSDA_MASK (0x200U) | ||
15709 | #define USBFSH_HCRHPORTSTATUS_LSDA_SHIFT (9U) | ||
15710 | /*! LSDA - (read) LowSpeedDeviceAttached This bit indicates the speed of the device attached to this port. | ||
15711 | */ | ||
15712 | #define USBFSH_HCRHPORTSTATUS_LSDA(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_LSDA_SHIFT)) & USBFSH_HCRHPORTSTATUS_LSDA_MASK) | ||
15713 | #define USBFSH_HCRHPORTSTATUS_CSC_MASK (0x10000U) | ||
15714 | #define USBFSH_HCRHPORTSTATUS_CSC_SHIFT (16U) | ||
15715 | /*! CSC - ConnectStatusChange This bit is set whenever a connect or disconnect event occurs. | ||
15716 | */ | ||
15717 | #define USBFSH_HCRHPORTSTATUS_CSC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_CSC_SHIFT)) & USBFSH_HCRHPORTSTATUS_CSC_MASK) | ||
15718 | #define USBFSH_HCRHPORTSTATUS_PESC_MASK (0x20000U) | ||
15719 | #define USBFSH_HCRHPORTSTATUS_PESC_SHIFT (17U) | ||
15720 | /*! PESC - PortEnableStatusChange This bit is set when hardware events cause the PortEnableStatus bit to be cleared. | ||
15721 | */ | ||
15722 | #define USBFSH_HCRHPORTSTATUS_PESC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_PESC_SHIFT)) & USBFSH_HCRHPORTSTATUS_PESC_MASK) | ||
15723 | #define USBFSH_HCRHPORTSTATUS_PSSC_MASK (0x40000U) | ||
15724 | #define USBFSH_HCRHPORTSTATUS_PSSC_SHIFT (18U) | ||
15725 | /*! PSSC - PortSuspendStatusChange This bit is set when the full resume sequence is completed. | ||
15726 | */ | ||
15727 | #define USBFSH_HCRHPORTSTATUS_PSSC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_PSSC_SHIFT)) & USBFSH_HCRHPORTSTATUS_PSSC_MASK) | ||
15728 | #define USBFSH_HCRHPORTSTATUS_OCIC_MASK (0x80000U) | ||
15729 | #define USBFSH_HCRHPORTSTATUS_OCIC_SHIFT (19U) | ||
15730 | /*! OCIC - PortOverCurrentIndicatorChange This bit is valid only if overcurrent conditions are reported on a per-port basis. | ||
15731 | */ | ||
15732 | #define USBFSH_HCRHPORTSTATUS_OCIC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_OCIC_SHIFT)) & USBFSH_HCRHPORTSTATUS_OCIC_MASK) | ||
15733 | #define USBFSH_HCRHPORTSTATUS_PRSC_MASK (0x100000U) | ||
15734 | #define USBFSH_HCRHPORTSTATUS_PRSC_SHIFT (20U) | ||
15735 | /*! PRSC - PortResetStatusChange This bit is set at the end of the 10 ms port reset signal. | ||
15736 | */ | ||
15737 | #define USBFSH_HCRHPORTSTATUS_PRSC(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_HCRHPORTSTATUS_PRSC_SHIFT)) & USBFSH_HCRHPORTSTATUS_PRSC_MASK) | ||
15738 | /*! @} */ | ||
15739 | |||
15740 | /*! @name PORTMODE - Controls the port if it is attached to the host block or the device block */ | ||
15741 | /*! @{ */ | ||
15742 | #define USBFSH_PORTMODE_ID_MASK (0x1U) | ||
15743 | #define USBFSH_PORTMODE_ID_SHIFT (0U) | ||
15744 | /*! ID - Port ID pin value. | ||
15745 | */ | ||
15746 | #define USBFSH_PORTMODE_ID(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_PORTMODE_ID_SHIFT)) & USBFSH_PORTMODE_ID_MASK) | ||
15747 | #define USBFSH_PORTMODE_ID_EN_MASK (0x100U) | ||
15748 | #define USBFSH_PORTMODE_ID_EN_SHIFT (8U) | ||
15749 | /*! ID_EN - Port ID pin pull-up enable. | ||
15750 | */ | ||
15751 | #define USBFSH_PORTMODE_ID_EN(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_PORTMODE_ID_EN_SHIFT)) & USBFSH_PORTMODE_ID_EN_MASK) | ||
15752 | #define USBFSH_PORTMODE_DEV_ENABLE_MASK (0x10000U) | ||
15753 | #define USBFSH_PORTMODE_DEV_ENABLE_SHIFT (16U) | ||
15754 | /*! DEV_ENABLE - 1: device 0: host. | ||
15755 | */ | ||
15756 | #define USBFSH_PORTMODE_DEV_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << USBFSH_PORTMODE_DEV_ENABLE_SHIFT)) & USBFSH_PORTMODE_DEV_ENABLE_MASK) | ||
15757 | /*! @} */ | ||
15758 | |||
15759 | |||
15760 | /*! | ||
15761 | * @} | ||
15762 | */ /* end of group USBFSH_Register_Masks */ | ||
15763 | |||
15764 | |||
15765 | /* USBFSH - Peripheral instance base addresses */ | ||
15766 | /** Peripheral USBFSH base address */ | ||
15767 | #define USBFSH_BASE (0x400A2000u) | ||
15768 | /** Peripheral USBFSH base pointer */ | ||
15769 | #define USBFSH ((USBFSH_Type *)USBFSH_BASE) | ||
15770 | /** Array initializer of USBFSH peripheral base addresses */ | ||
15771 | #define USBFSH_BASE_ADDRS { USBFSH_BASE } | ||
15772 | /** Array initializer of USBFSH peripheral base pointers */ | ||
15773 | #define USBFSH_BASE_PTRS { USBFSH } | ||
15774 | /** Interrupt vectors for the USBFSH peripheral type */ | ||
15775 | #define USBFSH_IRQS { USB0_IRQn } | ||
15776 | #define USBFSH_NEEDCLK_IRQS { USB0_NEEDCLK_IRQn } | ||
15777 | |||
15778 | /*! | ||
15779 | * @} | ||
15780 | */ /* end of group USBFSH_Peripheral_Access_Layer */ | ||
15781 | |||
15782 | |||
15783 | /* ---------------------------------------------------------------------------- | ||
15784 | -- USBHSD Peripheral Access Layer | ||
15785 | ---------------------------------------------------------------------------- */ | ||
15786 | |||
15787 | /*! | ||
15788 | * @addtogroup USBHSD_Peripheral_Access_Layer USBHSD Peripheral Access Layer | ||
15789 | * @{ | ||
15790 | */ | ||
15791 | |||
15792 | /** USBHSD - Register Layout Typedef */ | ||
15793 | typedef struct { | ||
15794 | __IO uint32_t DEVCMDSTAT; /**< USB Device Command/Status register, offset: 0x0 */ | ||
15795 | __I uint32_t INFO; /**< USB Info register, offset: 0x4 */ | ||
15796 | __IO uint32_t EPLISTSTART; /**< USB EP Command/Status List start address, offset: 0x8 */ | ||
15797 | __IO uint32_t DATABUFSTART; /**< USB Data buffer start address, offset: 0xC */ | ||
15798 | __IO uint32_t LPM; /**< USB Link Power Management register, offset: 0x10 */ | ||
15799 | __IO uint32_t EPSKIP; /**< USB Endpoint skip, offset: 0x14 */ | ||
15800 | __IO uint32_t EPINUSE; /**< USB Endpoint Buffer in use, offset: 0x18 */ | ||
15801 | __IO uint32_t EPBUFCFG; /**< USB Endpoint Buffer Configuration register, offset: 0x1C */ | ||
15802 | __IO uint32_t INTSTAT; /**< USB interrupt status register, offset: 0x20 */ | ||
15803 | __IO uint32_t INTEN; /**< USB interrupt enable register, offset: 0x24 */ | ||
15804 | __IO uint32_t INTSETSTAT; /**< USB set interrupt status register, offset: 0x28 */ | ||
15805 | uint8_t RESERVED_0[8]; | ||
15806 | __I uint32_t EPTOGGLE; /**< USB Endpoint toggle register, offset: 0x34 */ | ||
15807 | } USBHSD_Type; | ||
15808 | |||
15809 | /* ---------------------------------------------------------------------------- | ||
15810 | -- USBHSD Register Masks | ||
15811 | ---------------------------------------------------------------------------- */ | ||
15812 | |||
15813 | /*! | ||
15814 | * @addtogroup USBHSD_Register_Masks USBHSD Register Masks | ||
15815 | * @{ | ||
15816 | */ | ||
15817 | |||
15818 | /*! @name DEVCMDSTAT - USB Device Command/Status register */ | ||
15819 | /*! @{ */ | ||
15820 | #define USBHSD_DEVCMDSTAT_DEV_ADDR_MASK (0x7FU) | ||
15821 | #define USBHSD_DEVCMDSTAT_DEV_ADDR_SHIFT (0U) | ||
15822 | /*! DEV_ADDR - USB device address. | ||
15823 | */ | ||
15824 | #define USBHSD_DEVCMDSTAT_DEV_ADDR(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_DEV_ADDR_SHIFT)) & USBHSD_DEVCMDSTAT_DEV_ADDR_MASK) | ||
15825 | #define USBHSD_DEVCMDSTAT_DEV_EN_MASK (0x80U) | ||
15826 | #define USBHSD_DEVCMDSTAT_DEV_EN_SHIFT (7U) | ||
15827 | /*! DEV_EN - USB device enable. | ||
15828 | */ | ||
15829 | #define USBHSD_DEVCMDSTAT_DEV_EN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_DEV_EN_SHIFT)) & USBHSD_DEVCMDSTAT_DEV_EN_MASK) | ||
15830 | #define USBHSD_DEVCMDSTAT_SETUP_MASK (0x100U) | ||
15831 | #define USBHSD_DEVCMDSTAT_SETUP_SHIFT (8U) | ||
15832 | /*! SETUP - SETUP token received. | ||
15833 | */ | ||
15834 | #define USBHSD_DEVCMDSTAT_SETUP(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_SETUP_SHIFT)) & USBHSD_DEVCMDSTAT_SETUP_MASK) | ||
15835 | #define USBHSD_DEVCMDSTAT_FORCE_NEEDCLK_MASK (0x200U) | ||
15836 | #define USBHSD_DEVCMDSTAT_FORCE_NEEDCLK_SHIFT (9U) | ||
15837 | /*! FORCE_NEEDCLK - Forces the NEEDCLK output to always be on:. | ||
15838 | */ | ||
15839 | #define USBHSD_DEVCMDSTAT_FORCE_NEEDCLK(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_FORCE_NEEDCLK_SHIFT)) & USBHSD_DEVCMDSTAT_FORCE_NEEDCLK_MASK) | ||
15840 | #define USBHSD_DEVCMDSTAT_FORCE_VBUS_MASK (0x400U) | ||
15841 | #define USBHSD_DEVCMDSTAT_FORCE_VBUS_SHIFT (10U) | ||
15842 | /*! FORCE_VBUS - If this bit is set to 1, the VBUS voltage indicators from the PHY are overruled. | ||
15843 | */ | ||
15844 | #define USBHSD_DEVCMDSTAT_FORCE_VBUS(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_FORCE_VBUS_SHIFT)) & USBHSD_DEVCMDSTAT_FORCE_VBUS_MASK) | ||
15845 | #define USBHSD_DEVCMDSTAT_LPM_SUP_MASK (0x800U) | ||
15846 | #define USBHSD_DEVCMDSTAT_LPM_SUP_SHIFT (11U) | ||
15847 | /*! LPM_SUP - LPM Supported:. | ||
15848 | */ | ||
15849 | #define USBHSD_DEVCMDSTAT_LPM_SUP(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_LPM_SUP_SHIFT)) & USBHSD_DEVCMDSTAT_LPM_SUP_MASK) | ||
15850 | #define USBHSD_DEVCMDSTAT_INTONNAK_AO_MASK (0x1000U) | ||
15851 | #define USBHSD_DEVCMDSTAT_INTONNAK_AO_SHIFT (12U) | ||
15852 | /*! INTONNAK_AO - Interrupt on NAK for interrupt and bulk OUT EP:. | ||
15853 | */ | ||
15854 | #define USBHSD_DEVCMDSTAT_INTONNAK_AO(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_INTONNAK_AO_SHIFT)) & USBHSD_DEVCMDSTAT_INTONNAK_AO_MASK) | ||
15855 | #define USBHSD_DEVCMDSTAT_INTONNAK_AI_MASK (0x2000U) | ||
15856 | #define USBHSD_DEVCMDSTAT_INTONNAK_AI_SHIFT (13U) | ||
15857 | /*! INTONNAK_AI - Interrupt on NAK for interrupt and bulk IN EP:. | ||
15858 | */ | ||
15859 | #define USBHSD_DEVCMDSTAT_INTONNAK_AI(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_INTONNAK_AI_SHIFT)) & USBHSD_DEVCMDSTAT_INTONNAK_AI_MASK) | ||
15860 | #define USBHSD_DEVCMDSTAT_INTONNAK_CO_MASK (0x4000U) | ||
15861 | #define USBHSD_DEVCMDSTAT_INTONNAK_CO_SHIFT (14U) | ||
15862 | /*! INTONNAK_CO - Interrupt on NAK for control OUT EP:. | ||
15863 | */ | ||
15864 | #define USBHSD_DEVCMDSTAT_INTONNAK_CO(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_INTONNAK_CO_SHIFT)) & USBHSD_DEVCMDSTAT_INTONNAK_CO_MASK) | ||
15865 | #define USBHSD_DEVCMDSTAT_INTONNAK_CI_MASK (0x8000U) | ||
15866 | #define USBHSD_DEVCMDSTAT_INTONNAK_CI_SHIFT (15U) | ||
15867 | /*! INTONNAK_CI - Interrupt on NAK for control IN EP:. | ||
15868 | */ | ||
15869 | #define USBHSD_DEVCMDSTAT_INTONNAK_CI(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_INTONNAK_CI_SHIFT)) & USBHSD_DEVCMDSTAT_INTONNAK_CI_MASK) | ||
15870 | #define USBHSD_DEVCMDSTAT_DCON_MASK (0x10000U) | ||
15871 | #define USBHSD_DEVCMDSTAT_DCON_SHIFT (16U) | ||
15872 | /*! DCON - Device status - connect. | ||
15873 | */ | ||
15874 | #define USBHSD_DEVCMDSTAT_DCON(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_DCON_SHIFT)) & USBHSD_DEVCMDSTAT_DCON_MASK) | ||
15875 | #define USBHSD_DEVCMDSTAT_DSUS_MASK (0x20000U) | ||
15876 | #define USBHSD_DEVCMDSTAT_DSUS_SHIFT (17U) | ||
15877 | /*! DSUS - Device status - suspend. | ||
15878 | */ | ||
15879 | #define USBHSD_DEVCMDSTAT_DSUS(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_DSUS_SHIFT)) & USBHSD_DEVCMDSTAT_DSUS_MASK) | ||
15880 | #define USBHSD_DEVCMDSTAT_LPM_SUS_MASK (0x80000U) | ||
15881 | #define USBHSD_DEVCMDSTAT_LPM_SUS_SHIFT (19U) | ||
15882 | /*! LPM_SUS - Device status - LPM Suspend. | ||
15883 | */ | ||
15884 | #define USBHSD_DEVCMDSTAT_LPM_SUS(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_LPM_SUS_SHIFT)) & USBHSD_DEVCMDSTAT_LPM_SUS_MASK) | ||
15885 | #define USBHSD_DEVCMDSTAT_LPM_REWP_MASK (0x100000U) | ||
15886 | #define USBHSD_DEVCMDSTAT_LPM_REWP_SHIFT (20U) | ||
15887 | /*! LPM_REWP - LPM Remote Wake-up Enabled by USB host. | ||
15888 | */ | ||
15889 | #define USBHSD_DEVCMDSTAT_LPM_REWP(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_LPM_REWP_SHIFT)) & USBHSD_DEVCMDSTAT_LPM_REWP_MASK) | ||
15890 | #define USBHSD_DEVCMDSTAT_Speed_MASK (0xC00000U) | ||
15891 | #define USBHSD_DEVCMDSTAT_Speed_SHIFT (22U) | ||
15892 | /*! Speed - This field indicates the speed at which the device operates: 00b: reserved 01b: | ||
15893 | * full-speed 10b: high-speed 11b: super-speed (reserved for future use). | ||
15894 | */ | ||
15895 | #define USBHSD_DEVCMDSTAT_Speed(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_Speed_SHIFT)) & USBHSD_DEVCMDSTAT_Speed_MASK) | ||
15896 | #define USBHSD_DEVCMDSTAT_DCON_C_MASK (0x1000000U) | ||
15897 | #define USBHSD_DEVCMDSTAT_DCON_C_SHIFT (24U) | ||
15898 | /*! DCON_C - Device status - connect change. | ||
15899 | */ | ||
15900 | #define USBHSD_DEVCMDSTAT_DCON_C(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_DCON_C_SHIFT)) & USBHSD_DEVCMDSTAT_DCON_C_MASK) | ||
15901 | #define USBHSD_DEVCMDSTAT_DSUS_C_MASK (0x2000000U) | ||
15902 | #define USBHSD_DEVCMDSTAT_DSUS_C_SHIFT (25U) | ||
15903 | /*! DSUS_C - Device status - suspend change. | ||
15904 | */ | ||
15905 | #define USBHSD_DEVCMDSTAT_DSUS_C(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_DSUS_C_SHIFT)) & USBHSD_DEVCMDSTAT_DSUS_C_MASK) | ||
15906 | #define USBHSD_DEVCMDSTAT_DRES_C_MASK (0x4000000U) | ||
15907 | #define USBHSD_DEVCMDSTAT_DRES_C_SHIFT (26U) | ||
15908 | /*! DRES_C - Device status - reset change. | ||
15909 | */ | ||
15910 | #define USBHSD_DEVCMDSTAT_DRES_C(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_DRES_C_SHIFT)) & USBHSD_DEVCMDSTAT_DRES_C_MASK) | ||
15911 | #define USBHSD_DEVCMDSTAT_VBUS_DEBOUNCED_MASK (0x10000000U) | ||
15912 | #define USBHSD_DEVCMDSTAT_VBUS_DEBOUNCED_SHIFT (28U) | ||
15913 | /*! VBUS_DEBOUNCED - This bit indicates if VBUS is detected or not. | ||
15914 | */ | ||
15915 | #define USBHSD_DEVCMDSTAT_VBUS_DEBOUNCED(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_VBUS_DEBOUNCED_SHIFT)) & USBHSD_DEVCMDSTAT_VBUS_DEBOUNCED_MASK) | ||
15916 | #define USBHSD_DEVCMDSTAT_PHY_TEST_MODE_MASK (0xE0000000U) | ||
15917 | #define USBHSD_DEVCMDSTAT_PHY_TEST_MODE_SHIFT (29U) | ||
15918 | /*! PHY_TEST_MODE - This field is written by firmware to put the PHY into a test mode as defined by the USB2. | ||
15919 | */ | ||
15920 | #define USBHSD_DEVCMDSTAT_PHY_TEST_MODE(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DEVCMDSTAT_PHY_TEST_MODE_SHIFT)) & USBHSD_DEVCMDSTAT_PHY_TEST_MODE_MASK) | ||
15921 | /*! @} */ | ||
15922 | |||
15923 | /*! @name INFO - USB Info register */ | ||
15924 | /*! @{ */ | ||
15925 | #define USBHSD_INFO_FRAME_NR_MASK (0x7FFU) | ||
15926 | #define USBHSD_INFO_FRAME_NR_SHIFT (0U) | ||
15927 | /*! FRAME_NR - Frame number. | ||
15928 | */ | ||
15929 | #define USBHSD_INFO_FRAME_NR(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INFO_FRAME_NR_SHIFT)) & USBHSD_INFO_FRAME_NR_MASK) | ||
15930 | #define USBHSD_INFO_ERR_CODE_MASK (0x7800U) | ||
15931 | #define USBHSD_INFO_ERR_CODE_SHIFT (11U) | ||
15932 | /*! ERR_CODE - The error code which last occurred:. | ||
15933 | */ | ||
15934 | #define USBHSD_INFO_ERR_CODE(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INFO_ERR_CODE_SHIFT)) & USBHSD_INFO_ERR_CODE_MASK) | ||
15935 | #define USBHSD_INFO_Minrev_MASK (0xFF0000U) | ||
15936 | #define USBHSD_INFO_Minrev_SHIFT (16U) | ||
15937 | /*! Minrev - Minor revision. | ||
15938 | */ | ||
15939 | #define USBHSD_INFO_Minrev(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INFO_Minrev_SHIFT)) & USBHSD_INFO_Minrev_MASK) | ||
15940 | #define USBHSD_INFO_Majrev_MASK (0xFF000000U) | ||
15941 | #define USBHSD_INFO_Majrev_SHIFT (24U) | ||
15942 | /*! Majrev - Major revision. | ||
15943 | */ | ||
15944 | #define USBHSD_INFO_Majrev(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INFO_Majrev_SHIFT)) & USBHSD_INFO_Majrev_MASK) | ||
15945 | /*! @} */ | ||
15946 | |||
15947 | /*! @name EPLISTSTART - USB EP Command/Status List start address */ | ||
15948 | /*! @{ */ | ||
15949 | #define USBHSD_EPLISTSTART_EP_LIST_PRG_MASK (0xFFF00U) | ||
15950 | #define USBHSD_EPLISTSTART_EP_LIST_PRG_SHIFT (8U) | ||
15951 | /*! EP_LIST_PRG - Programmable portion of the USB EP Command/Status List address. | ||
15952 | */ | ||
15953 | #define USBHSD_EPLISTSTART_EP_LIST_PRG(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_EPLISTSTART_EP_LIST_PRG_SHIFT)) & USBHSD_EPLISTSTART_EP_LIST_PRG_MASK) | ||
15954 | #define USBHSD_EPLISTSTART_EP_LIST_FIXED_MASK (0xFFF00000U) | ||
15955 | #define USBHSD_EPLISTSTART_EP_LIST_FIXED_SHIFT (20U) | ||
15956 | /*! EP_LIST_FIXED - Fixed portion of USB EP Command/Status List address. | ||
15957 | */ | ||
15958 | #define USBHSD_EPLISTSTART_EP_LIST_FIXED(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_EPLISTSTART_EP_LIST_FIXED_SHIFT)) & USBHSD_EPLISTSTART_EP_LIST_FIXED_MASK) | ||
15959 | /*! @} */ | ||
15960 | |||
15961 | /*! @name DATABUFSTART - USB Data buffer start address */ | ||
15962 | /*! @{ */ | ||
15963 | #define USBHSD_DATABUFSTART_DA_BUF_MASK (0xFFFC0000U) | ||
15964 | #define USBHSD_DATABUFSTART_DA_BUF_SHIFT (18U) | ||
15965 | /*! DA_BUF - Start address of the memory page where all endpoint data buffers are located. | ||
15966 | */ | ||
15967 | #define USBHSD_DATABUFSTART_DA_BUF(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_DATABUFSTART_DA_BUF_SHIFT)) & USBHSD_DATABUFSTART_DA_BUF_MASK) | ||
15968 | /*! @} */ | ||
15969 | |||
15970 | /*! @name LPM - USB Link Power Management register */ | ||
15971 | /*! @{ */ | ||
15972 | #define USBHSD_LPM_HIRD_HW_MASK (0xFU) | ||
15973 | #define USBHSD_LPM_HIRD_HW_SHIFT (0U) | ||
15974 | /*! HIRD_HW - Host Initiated Resume Duration - HW. | ||
15975 | */ | ||
15976 | #define USBHSD_LPM_HIRD_HW(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_LPM_HIRD_HW_SHIFT)) & USBHSD_LPM_HIRD_HW_MASK) | ||
15977 | #define USBHSD_LPM_HIRD_SW_MASK (0xF0U) | ||
15978 | #define USBHSD_LPM_HIRD_SW_SHIFT (4U) | ||
15979 | /*! HIRD_SW - Host Initiated Resume Duration - SW. | ||
15980 | */ | ||
15981 | #define USBHSD_LPM_HIRD_SW(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_LPM_HIRD_SW_SHIFT)) & USBHSD_LPM_HIRD_SW_MASK) | ||
15982 | #define USBHSD_LPM_DATA_PENDING_MASK (0x100U) | ||
15983 | #define USBHSD_LPM_DATA_PENDING_SHIFT (8U) | ||
15984 | /*! DATA_PENDING - As long as this bit is set to one and LPM supported bit is set to one, HW will | ||
15985 | * return a NYET handshake on every LPM token it receives. | ||
15986 | */ | ||
15987 | #define USBHSD_LPM_DATA_PENDING(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_LPM_DATA_PENDING_SHIFT)) & USBHSD_LPM_DATA_PENDING_MASK) | ||
15988 | /*! @} */ | ||
15989 | |||
15990 | /*! @name EPSKIP - USB Endpoint skip */ | ||
15991 | /*! @{ */ | ||
15992 | #define USBHSD_EPSKIP_SKIP_MASK (0xFFFU) | ||
15993 | #define USBHSD_EPSKIP_SKIP_SHIFT (0U) | ||
15994 | /*! SKIP - Endpoint skip: Writing 1 to one of these bits, will indicate to HW that it must | ||
15995 | * deactivate the buffer assigned to this endpoint and return control back to software. | ||
15996 | */ | ||
15997 | #define USBHSD_EPSKIP_SKIP(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_EPSKIP_SKIP_SHIFT)) & USBHSD_EPSKIP_SKIP_MASK) | ||
15998 | /*! @} */ | ||
15999 | |||
16000 | /*! @name EPINUSE - USB Endpoint Buffer in use */ | ||
16001 | /*! @{ */ | ||
16002 | #define USBHSD_EPINUSE_BUF_MASK (0xFFCU) | ||
16003 | #define USBHSD_EPINUSE_BUF_SHIFT (2U) | ||
16004 | /*! BUF - Buffer in use: This register has one bit per physical endpoint. | ||
16005 | */ | ||
16006 | #define USBHSD_EPINUSE_BUF(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_EPINUSE_BUF_SHIFT)) & USBHSD_EPINUSE_BUF_MASK) | ||
16007 | /*! @} */ | ||
16008 | |||
16009 | /*! @name EPBUFCFG - USB Endpoint Buffer Configuration register */ | ||
16010 | /*! @{ */ | ||
16011 | #define USBHSD_EPBUFCFG_BUF_SB_MASK (0xFFCU) | ||
16012 | #define USBHSD_EPBUFCFG_BUF_SB_SHIFT (2U) | ||
16013 | /*! BUF_SB - Buffer usage: This register has one bit per physical endpoint. | ||
16014 | */ | ||
16015 | #define USBHSD_EPBUFCFG_BUF_SB(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_EPBUFCFG_BUF_SB_SHIFT)) & USBHSD_EPBUFCFG_BUF_SB_MASK) | ||
16016 | /*! @} */ | ||
16017 | |||
16018 | /*! @name INTSTAT - USB interrupt status register */ | ||
16019 | /*! @{ */ | ||
16020 | #define USBHSD_INTSTAT_EP0OUT_MASK (0x1U) | ||
16021 | #define USBHSD_INTSTAT_EP0OUT_SHIFT (0U) | ||
16022 | /*! EP0OUT - Interrupt status register bit for the Control EP0 OUT direction. | ||
16023 | */ | ||
16024 | #define USBHSD_INTSTAT_EP0OUT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP0OUT_SHIFT)) & USBHSD_INTSTAT_EP0OUT_MASK) | ||
16025 | #define USBHSD_INTSTAT_EP0IN_MASK (0x2U) | ||
16026 | #define USBHSD_INTSTAT_EP0IN_SHIFT (1U) | ||
16027 | /*! EP0IN - Interrupt status register bit for the Control EP0 IN direction. | ||
16028 | */ | ||
16029 | #define USBHSD_INTSTAT_EP0IN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP0IN_SHIFT)) & USBHSD_INTSTAT_EP0IN_MASK) | ||
16030 | #define USBHSD_INTSTAT_EP1OUT_MASK (0x4U) | ||
16031 | #define USBHSD_INTSTAT_EP1OUT_SHIFT (2U) | ||
16032 | /*! EP1OUT - Interrupt status register bit for the EP1 OUT direction. | ||
16033 | */ | ||
16034 | #define USBHSD_INTSTAT_EP1OUT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP1OUT_SHIFT)) & USBHSD_INTSTAT_EP1OUT_MASK) | ||
16035 | #define USBHSD_INTSTAT_EP1IN_MASK (0x8U) | ||
16036 | #define USBHSD_INTSTAT_EP1IN_SHIFT (3U) | ||
16037 | /*! EP1IN - Interrupt status register bit for the EP1 IN direction. | ||
16038 | */ | ||
16039 | #define USBHSD_INTSTAT_EP1IN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP1IN_SHIFT)) & USBHSD_INTSTAT_EP1IN_MASK) | ||
16040 | #define USBHSD_INTSTAT_EP2OUT_MASK (0x10U) | ||
16041 | #define USBHSD_INTSTAT_EP2OUT_SHIFT (4U) | ||
16042 | /*! EP2OUT - Interrupt status register bit for the EP2 OUT direction. | ||
16043 | */ | ||
16044 | #define USBHSD_INTSTAT_EP2OUT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP2OUT_SHIFT)) & USBHSD_INTSTAT_EP2OUT_MASK) | ||
16045 | #define USBHSD_INTSTAT_EP2IN_MASK (0x20U) | ||
16046 | #define USBHSD_INTSTAT_EP2IN_SHIFT (5U) | ||
16047 | /*! EP2IN - Interrupt status register bit for the EP2 IN direction. | ||
16048 | */ | ||
16049 | #define USBHSD_INTSTAT_EP2IN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP2IN_SHIFT)) & USBHSD_INTSTAT_EP2IN_MASK) | ||
16050 | #define USBHSD_INTSTAT_EP3OUT_MASK (0x40U) | ||
16051 | #define USBHSD_INTSTAT_EP3OUT_SHIFT (6U) | ||
16052 | /*! EP3OUT - Interrupt status register bit for the EP3 OUT direction. | ||
16053 | */ | ||
16054 | #define USBHSD_INTSTAT_EP3OUT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP3OUT_SHIFT)) & USBHSD_INTSTAT_EP3OUT_MASK) | ||
16055 | #define USBHSD_INTSTAT_EP3IN_MASK (0x80U) | ||
16056 | #define USBHSD_INTSTAT_EP3IN_SHIFT (7U) | ||
16057 | /*! EP3IN - Interrupt status register bit for the EP3 IN direction. | ||
16058 | */ | ||
16059 | #define USBHSD_INTSTAT_EP3IN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP3IN_SHIFT)) & USBHSD_INTSTAT_EP3IN_MASK) | ||
16060 | #define USBHSD_INTSTAT_EP4OUT_MASK (0x100U) | ||
16061 | #define USBHSD_INTSTAT_EP4OUT_SHIFT (8U) | ||
16062 | /*! EP4OUT - Interrupt status register bit for the EP4 OUT direction. | ||
16063 | */ | ||
16064 | #define USBHSD_INTSTAT_EP4OUT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP4OUT_SHIFT)) & USBHSD_INTSTAT_EP4OUT_MASK) | ||
16065 | #define USBHSD_INTSTAT_EP4IN_MASK (0x200U) | ||
16066 | #define USBHSD_INTSTAT_EP4IN_SHIFT (9U) | ||
16067 | /*! EP4IN - Interrupt status register bit for the EP4 IN direction. | ||
16068 | */ | ||
16069 | #define USBHSD_INTSTAT_EP4IN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP4IN_SHIFT)) & USBHSD_INTSTAT_EP4IN_MASK) | ||
16070 | #define USBHSD_INTSTAT_EP5OUT_MASK (0x400U) | ||
16071 | #define USBHSD_INTSTAT_EP5OUT_SHIFT (10U) | ||
16072 | /*! EP5OUT - Interrupt status register bit for the EP5 OUT direction. | ||
16073 | */ | ||
16074 | #define USBHSD_INTSTAT_EP5OUT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP5OUT_SHIFT)) & USBHSD_INTSTAT_EP5OUT_MASK) | ||
16075 | #define USBHSD_INTSTAT_EP5IN_MASK (0x800U) | ||
16076 | #define USBHSD_INTSTAT_EP5IN_SHIFT (11U) | ||
16077 | /*! EP5IN - Interrupt status register bit for the EP5 IN direction. | ||
16078 | */ | ||
16079 | #define USBHSD_INTSTAT_EP5IN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_EP5IN_SHIFT)) & USBHSD_INTSTAT_EP5IN_MASK) | ||
16080 | #define USBHSD_INTSTAT_FRAME_INT_MASK (0x40000000U) | ||
16081 | #define USBHSD_INTSTAT_FRAME_INT_SHIFT (30U) | ||
16082 | /*! FRAME_INT - Frame interrupt. | ||
16083 | */ | ||
16084 | #define USBHSD_INTSTAT_FRAME_INT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_FRAME_INT_SHIFT)) & USBHSD_INTSTAT_FRAME_INT_MASK) | ||
16085 | #define USBHSD_INTSTAT_DEV_INT_MASK (0x80000000U) | ||
16086 | #define USBHSD_INTSTAT_DEV_INT_SHIFT (31U) | ||
16087 | /*! DEV_INT - Device status interrupt. | ||
16088 | */ | ||
16089 | #define USBHSD_INTSTAT_DEV_INT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSTAT_DEV_INT_SHIFT)) & USBHSD_INTSTAT_DEV_INT_MASK) | ||
16090 | /*! @} */ | ||
16091 | |||
16092 | /*! @name INTEN - USB interrupt enable register */ | ||
16093 | /*! @{ */ | ||
16094 | #define USBHSD_INTEN_EP_INT_EN_MASK (0xFFFU) | ||
16095 | #define USBHSD_INTEN_EP_INT_EN_SHIFT (0U) | ||
16096 | /*! EP_INT_EN - If this bit is set and the corresponding USB interrupt status bit is set, a HW | ||
16097 | * interrupt is generated on the interrupt line. | ||
16098 | */ | ||
16099 | #define USBHSD_INTEN_EP_INT_EN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTEN_EP_INT_EN_SHIFT)) & USBHSD_INTEN_EP_INT_EN_MASK) | ||
16100 | #define USBHSD_INTEN_FRAME_INT_EN_MASK (0x40000000U) | ||
16101 | #define USBHSD_INTEN_FRAME_INT_EN_SHIFT (30U) | ||
16102 | /*! FRAME_INT_EN - If this bit is set and the corresponding USB interrupt status bit is set, a HW | ||
16103 | * interrupt is generated on the interrupt line. | ||
16104 | */ | ||
16105 | #define USBHSD_INTEN_FRAME_INT_EN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTEN_FRAME_INT_EN_SHIFT)) & USBHSD_INTEN_FRAME_INT_EN_MASK) | ||
16106 | #define USBHSD_INTEN_DEV_INT_EN_MASK (0x80000000U) | ||
16107 | #define USBHSD_INTEN_DEV_INT_EN_SHIFT (31U) | ||
16108 | /*! DEV_INT_EN - If this bit is set and the corresponding USB interrupt status bit is set, a HW | ||
16109 | * interrupt is generated on the interrupt line. | ||
16110 | */ | ||
16111 | #define USBHSD_INTEN_DEV_INT_EN(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTEN_DEV_INT_EN_SHIFT)) & USBHSD_INTEN_DEV_INT_EN_MASK) | ||
16112 | /*! @} */ | ||
16113 | |||
16114 | /*! @name INTSETSTAT - USB set interrupt status register */ | ||
16115 | /*! @{ */ | ||
16116 | #define USBHSD_INTSETSTAT_EP_SET_INT_MASK (0xFFFU) | ||
16117 | #define USBHSD_INTSETSTAT_EP_SET_INT_SHIFT (0U) | ||
16118 | /*! EP_SET_INT - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. | ||
16119 | */ | ||
16120 | #define USBHSD_INTSETSTAT_EP_SET_INT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSETSTAT_EP_SET_INT_SHIFT)) & USBHSD_INTSETSTAT_EP_SET_INT_MASK) | ||
16121 | #define USBHSD_INTSETSTAT_FRAME_SET_INT_MASK (0x40000000U) | ||
16122 | #define USBHSD_INTSETSTAT_FRAME_SET_INT_SHIFT (30U) | ||
16123 | /*! FRAME_SET_INT - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. | ||
16124 | */ | ||
16125 | #define USBHSD_INTSETSTAT_FRAME_SET_INT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSETSTAT_FRAME_SET_INT_SHIFT)) & USBHSD_INTSETSTAT_FRAME_SET_INT_MASK) | ||
16126 | #define USBHSD_INTSETSTAT_DEV_SET_INT_MASK (0x80000000U) | ||
16127 | #define USBHSD_INTSETSTAT_DEV_SET_INT_SHIFT (31U) | ||
16128 | /*! DEV_SET_INT - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. | ||
16129 | */ | ||
16130 | #define USBHSD_INTSETSTAT_DEV_SET_INT(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_INTSETSTAT_DEV_SET_INT_SHIFT)) & USBHSD_INTSETSTAT_DEV_SET_INT_MASK) | ||
16131 | /*! @} */ | ||
16132 | |||
16133 | /*! @name EPTOGGLE - USB Endpoint toggle register */ | ||
16134 | /*! @{ */ | ||
16135 | #define USBHSD_EPTOGGLE_TOGGLE_MASK (0x3FFFFFFFU) | ||
16136 | #define USBHSD_EPTOGGLE_TOGGLE_SHIFT (0U) | ||
16137 | /*! TOGGLE - Endpoint data toggle: This field indicates the current value of the data toggle for the corresponding endpoint. | ||
16138 | */ | ||
16139 | #define USBHSD_EPTOGGLE_TOGGLE(x) (((uint32_t)(((uint32_t)(x)) << USBHSD_EPTOGGLE_TOGGLE_SHIFT)) & USBHSD_EPTOGGLE_TOGGLE_MASK) | ||
16140 | /*! @} */ | ||
16141 | |||
16142 | |||
16143 | /*! | ||
16144 | * @} | ||
16145 | */ /* end of group USBHSD_Register_Masks */ | ||
16146 | |||
16147 | |||
16148 | /* USBHSD - Peripheral instance base addresses */ | ||
16149 | /** Peripheral USBHSD base address */ | ||
16150 | #define USBHSD_BASE (0x40094000u) | ||
16151 | /** Peripheral USBHSD base pointer */ | ||
16152 | #define USBHSD ((USBHSD_Type *)USBHSD_BASE) | ||
16153 | /** Array initializer of USBHSD peripheral base addresses */ | ||
16154 | #define USBHSD_BASE_ADDRS { USBHSD_BASE } | ||
16155 | /** Array initializer of USBHSD peripheral base pointers */ | ||
16156 | #define USBHSD_BASE_PTRS { USBHSD } | ||
16157 | /** Interrupt vectors for the USBHSD peripheral type */ | ||
16158 | #define USBHSD_IRQS { USB1_IRQn } | ||
16159 | #define USBHSD_NEEDCLK_IRQS { USB1_NEEDCLK_IRQn } | ||
16160 | |||
16161 | /*! | ||
16162 | * @} | ||
16163 | */ /* end of group USBHSD_Peripheral_Access_Layer */ | ||
16164 | |||
16165 | |||
16166 | /* ---------------------------------------------------------------------------- | ||
16167 | -- USBHSH Peripheral Access Layer | ||
16168 | ---------------------------------------------------------------------------- */ | ||
16169 | |||
16170 | /*! | ||
16171 | * @addtogroup USBHSH_Peripheral_Access_Layer USBHSH Peripheral Access Layer | ||
16172 | * @{ | ||
16173 | */ | ||
16174 | |||
16175 | /** USBHSH - Register Layout Typedef */ | ||
16176 | typedef struct { | ||
16177 | __I uint32_t CAPLENGTH_CHIPID; /**< This register contains the offset value towards the start of the operational register space and the version number of the IP block, offset: 0x0 */ | ||
16178 | __I uint32_t HCSPARAMS; /**< Host Controller Structural Parameters, offset: 0x4 */ | ||
16179 | __I uint32_t HCCPARAMS; /**< Host Controller Capability Parameters, offset: 0x8 */ | ||
16180 | __IO uint32_t FLADJ_FRINDEX; /**< Frame Length Adjustment, offset: 0xC */ | ||
16181 | __IO uint32_t ATL_PTD_BASE_ADDR; /**< Memory base address where ATL PTD0 is stored, offset: 0x10 */ | ||
16182 | __IO uint32_t ISO_PTD_BASE_ADDR; /**< Memory base address where ISO PTD0 is stored, offset: 0x14 */ | ||
16183 | __IO uint32_t INT_PTD_BASE_ADDR; /**< Memory base address where INT PTD0 is stored, offset: 0x18 */ | ||
16184 | __IO uint32_t DATA_PAYLOAD_BASE_ADDR; /**< Memory base address that indicates the start of the data payload buffers, offset: 0x1C */ | ||
16185 | __IO uint32_t USBCMD; /**< USB Command register, offset: 0x20 */ | ||
16186 | __IO uint32_t USBSTS; /**< USB Interrupt Status register, offset: 0x24 */ | ||
16187 | __IO uint32_t USBINTR; /**< USB Interrupt Enable register, offset: 0x28 */ | ||
16188 | __IO uint32_t PORTSC1; /**< Port Status and Control register, offset: 0x2C */ | ||
16189 | __IO uint32_t ATL_PTD_DONE_MAP; /**< Done map for each ATL PTD, offset: 0x30 */ | ||
16190 | __IO uint32_t ATL_PTD_SKIP_MAP; /**< Skip map for each ATL PTD, offset: 0x34 */ | ||
16191 | __IO uint32_t ISO_PTD_DONE_MAP; /**< Done map for each ISO PTD, offset: 0x38 */ | ||
16192 | __IO uint32_t ISO_PTD_SKIP_MAP; /**< Skip map for each ISO PTD, offset: 0x3C */ | ||
16193 | __IO uint32_t INT_PTD_DONE_MAP; /**< Done map for each INT PTD, offset: 0x40 */ | ||
16194 | __IO uint32_t INT_PTD_SKIP_MAP; /**< Skip map for each INT PTD, offset: 0x44 */ | ||
16195 | __IO uint32_t LASTPTD; /**< Marks the last PTD in the list for ISO, INT and ATL, offset: 0x48 */ | ||
16196 | uint8_t RESERVED_0[4]; | ||
16197 | __IO uint32_t PORTMODE; /**< Controls the port if it is attached to the host block or the device block, offset: 0x50 */ | ||
16198 | } USBHSH_Type; | ||
16199 | |||
16200 | /* ---------------------------------------------------------------------------- | ||
16201 | -- USBHSH Register Masks | ||
16202 | ---------------------------------------------------------------------------- */ | ||
16203 | |||
16204 | /*! | ||
16205 | * @addtogroup USBHSH_Register_Masks USBHSH Register Masks | ||
16206 | * @{ | ||
16207 | */ | ||
16208 | |||
16209 | /*! @name CAPLENGTH_CHIPID - This register contains the offset value towards the start of the operational register space and the version number of the IP block */ | ||
16210 | /*! @{ */ | ||
16211 | #define USBHSH_CAPLENGTH_CHIPID_CAPLENGTH_MASK (0xFFU) | ||
16212 | #define USBHSH_CAPLENGTH_CHIPID_CAPLENGTH_SHIFT (0U) | ||
16213 | /*! CAPLENGTH - Capability Length: This is used as an offset. | ||
16214 | */ | ||
16215 | #define USBHSH_CAPLENGTH_CHIPID_CAPLENGTH(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_CAPLENGTH_CHIPID_CAPLENGTH_SHIFT)) & USBHSH_CAPLENGTH_CHIPID_CAPLENGTH_MASK) | ||
16216 | #define USBHSH_CAPLENGTH_CHIPID_CHIPID_MASK (0xFFFF0000U) | ||
16217 | #define USBHSH_CAPLENGTH_CHIPID_CHIPID_SHIFT (16U) | ||
16218 | /*! CHIPID - Chip identification: indicates major and minor revision of the IP: [31:24] = Major | ||
16219 | * revision [23:16] = Minor revision Major revisions used: 0x01: USB2. | ||
16220 | */ | ||
16221 | #define USBHSH_CAPLENGTH_CHIPID_CHIPID(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_CAPLENGTH_CHIPID_CHIPID_SHIFT)) & USBHSH_CAPLENGTH_CHIPID_CHIPID_MASK) | ||
16222 | /*! @} */ | ||
16223 | |||
16224 | /*! @name HCSPARAMS - Host Controller Structural Parameters */ | ||
16225 | /*! @{ */ | ||
16226 | #define USBHSH_HCSPARAMS_N_PORTS_MASK (0xFU) | ||
16227 | #define USBHSH_HCSPARAMS_N_PORTS_SHIFT (0U) | ||
16228 | /*! N_PORTS - This register specifies the number of physical downstream ports implemented on this host controller. | ||
16229 | */ | ||
16230 | #define USBHSH_HCSPARAMS_N_PORTS(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_HCSPARAMS_N_PORTS_SHIFT)) & USBHSH_HCSPARAMS_N_PORTS_MASK) | ||
16231 | #define USBHSH_HCSPARAMS_PPC_MASK (0x10U) | ||
16232 | #define USBHSH_HCSPARAMS_PPC_SHIFT (4U) | ||
16233 | /*! PPC - This field indicates whether the host controller implementation includes port power control. | ||
16234 | */ | ||
16235 | #define USBHSH_HCSPARAMS_PPC(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_HCSPARAMS_PPC_SHIFT)) & USBHSH_HCSPARAMS_PPC_MASK) | ||
16236 | #define USBHSH_HCSPARAMS_P_INDICATOR_MASK (0x10000U) | ||
16237 | #define USBHSH_HCSPARAMS_P_INDICATOR_SHIFT (16U) | ||
16238 | /*! P_INDICATOR - This bit indicates whether the ports support port indicator control. | ||
16239 | */ | ||
16240 | #define USBHSH_HCSPARAMS_P_INDICATOR(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_HCSPARAMS_P_INDICATOR_SHIFT)) & USBHSH_HCSPARAMS_P_INDICATOR_MASK) | ||
16241 | /*! @} */ | ||
16242 | |||
16243 | /*! @name HCCPARAMS - Host Controller Capability Parameters */ | ||
16244 | /*! @{ */ | ||
16245 | #define USBHSH_HCCPARAMS_LPMC_MASK (0x20000U) | ||
16246 | #define USBHSH_HCCPARAMS_LPMC_SHIFT (17U) | ||
16247 | /*! LPMC - Link Power Management Capability. | ||
16248 | */ | ||
16249 | #define USBHSH_HCCPARAMS_LPMC(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_HCCPARAMS_LPMC_SHIFT)) & USBHSH_HCCPARAMS_LPMC_MASK) | ||
16250 | /*! @} */ | ||
16251 | |||
16252 | /*! @name FLADJ_FRINDEX - Frame Length Adjustment */ | ||
16253 | /*! @{ */ | ||
16254 | #define USBHSH_FLADJ_FRINDEX_FLADJ_MASK (0x3FU) | ||
16255 | #define USBHSH_FLADJ_FRINDEX_FLADJ_SHIFT (0U) | ||
16256 | /*! FLADJ - Frame Length Timing Value. | ||
16257 | */ | ||
16258 | #define USBHSH_FLADJ_FRINDEX_FLADJ(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_FLADJ_FRINDEX_FLADJ_SHIFT)) & USBHSH_FLADJ_FRINDEX_FLADJ_MASK) | ||
16259 | #define USBHSH_FLADJ_FRINDEX_FRINDEX_MASK (0x3FFF0000U) | ||
16260 | #define USBHSH_FLADJ_FRINDEX_FRINDEX_SHIFT (16U) | ||
16261 | /*! FRINDEX - Frame Index: Bits 29 to16 in this register are used for the frame number field in the SOF packet. | ||
16262 | */ | ||
16263 | #define USBHSH_FLADJ_FRINDEX_FRINDEX(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_FLADJ_FRINDEX_FRINDEX_SHIFT)) & USBHSH_FLADJ_FRINDEX_FRINDEX_MASK) | ||
16264 | /*! @} */ | ||
16265 | |||
16266 | /*! @name ATL_PTD_BASE_ADDR - Memory base address where ATL PTD0 is stored */ | ||
16267 | /*! @{ */ | ||
16268 | #define USBHSH_ATL_PTD_BASE_ADDR_ATL_CUR_MASK (0x1F0U) | ||
16269 | #define USBHSH_ATL_PTD_BASE_ADDR_ATL_CUR_SHIFT (4U) | ||
16270 | /*! ATL_CUR - This indicates the current PTD that is used by the hardware when it is processing the ATL list. | ||
16271 | */ | ||
16272 | #define USBHSH_ATL_PTD_BASE_ADDR_ATL_CUR(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_ATL_PTD_BASE_ADDR_ATL_CUR_SHIFT)) & USBHSH_ATL_PTD_BASE_ADDR_ATL_CUR_MASK) | ||
16273 | #define USBHSH_ATL_PTD_BASE_ADDR_ATL_BASE_MASK (0xFFFFFE00U) | ||
16274 | #define USBHSH_ATL_PTD_BASE_ADDR_ATL_BASE_SHIFT (9U) | ||
16275 | /*! ATL_BASE - Base address to be used by the hardware to find the start of the ATL list. | ||
16276 | */ | ||
16277 | #define USBHSH_ATL_PTD_BASE_ADDR_ATL_BASE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_ATL_PTD_BASE_ADDR_ATL_BASE_SHIFT)) & USBHSH_ATL_PTD_BASE_ADDR_ATL_BASE_MASK) | ||
16278 | /*! @} */ | ||
16279 | |||
16280 | /*! @name ISO_PTD_BASE_ADDR - Memory base address where ISO PTD0 is stored */ | ||
16281 | /*! @{ */ | ||
16282 | #define USBHSH_ISO_PTD_BASE_ADDR_ISO_FIRST_MASK (0x3E0U) | ||
16283 | #define USBHSH_ISO_PTD_BASE_ADDR_ISO_FIRST_SHIFT (5U) | ||
16284 | /*! ISO_FIRST - This indicates the first PTD that is used by the hardware when it is processing the ISO list. | ||
16285 | */ | ||
16286 | #define USBHSH_ISO_PTD_BASE_ADDR_ISO_FIRST(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_ISO_PTD_BASE_ADDR_ISO_FIRST_SHIFT)) & USBHSH_ISO_PTD_BASE_ADDR_ISO_FIRST_MASK) | ||
16287 | #define USBHSH_ISO_PTD_BASE_ADDR_ISO_BASE_MASK (0xFFFFFC00U) | ||
16288 | #define USBHSH_ISO_PTD_BASE_ADDR_ISO_BASE_SHIFT (10U) | ||
16289 | /*! ISO_BASE - Base address to be used by the hardware to find the start of the ISO list. | ||
16290 | */ | ||
16291 | #define USBHSH_ISO_PTD_BASE_ADDR_ISO_BASE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_ISO_PTD_BASE_ADDR_ISO_BASE_SHIFT)) & USBHSH_ISO_PTD_BASE_ADDR_ISO_BASE_MASK) | ||
16292 | /*! @} */ | ||
16293 | |||
16294 | /*! @name INT_PTD_BASE_ADDR - Memory base address where INT PTD0 is stored */ | ||
16295 | /*! @{ */ | ||
16296 | #define USBHSH_INT_PTD_BASE_ADDR_INT_FIRST_MASK (0x3E0U) | ||
16297 | #define USBHSH_INT_PTD_BASE_ADDR_INT_FIRST_SHIFT (5U) | ||
16298 | /*! INT_FIRST - This indicates the first PTD that is used by the hardware when it is processing the INT list. | ||
16299 | */ | ||
16300 | #define USBHSH_INT_PTD_BASE_ADDR_INT_FIRST(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_INT_PTD_BASE_ADDR_INT_FIRST_SHIFT)) & USBHSH_INT_PTD_BASE_ADDR_INT_FIRST_MASK) | ||
16301 | #define USBHSH_INT_PTD_BASE_ADDR_INT_BASE_MASK (0xFFFFFC00U) | ||
16302 | #define USBHSH_INT_PTD_BASE_ADDR_INT_BASE_SHIFT (10U) | ||
16303 | /*! INT_BASE - Base address to be used by the hardware to find the start of the INT list. | ||
16304 | */ | ||
16305 | #define USBHSH_INT_PTD_BASE_ADDR_INT_BASE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_INT_PTD_BASE_ADDR_INT_BASE_SHIFT)) & USBHSH_INT_PTD_BASE_ADDR_INT_BASE_MASK) | ||
16306 | /*! @} */ | ||
16307 | |||
16308 | /*! @name DATA_PAYLOAD_BASE_ADDR - Memory base address that indicates the start of the data payload buffers */ | ||
16309 | /*! @{ */ | ||
16310 | #define USBHSH_DATA_PAYLOAD_BASE_ADDR_DAT_BASE_MASK (0xFFFF0000U) | ||
16311 | #define USBHSH_DATA_PAYLOAD_BASE_ADDR_DAT_BASE_SHIFT (16U) | ||
16312 | /*! DAT_BASE - Base address to be used by the hardware to find the start of the data payload section. | ||
16313 | */ | ||
16314 | #define USBHSH_DATA_PAYLOAD_BASE_ADDR_DAT_BASE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_DATA_PAYLOAD_BASE_ADDR_DAT_BASE_SHIFT)) & USBHSH_DATA_PAYLOAD_BASE_ADDR_DAT_BASE_MASK) | ||
16315 | /*! @} */ | ||
16316 | |||
16317 | /*! @name USBCMD - USB Command register */ | ||
16318 | /*! @{ */ | ||
16319 | #define USBHSH_USBCMD_RS_MASK (0x1U) | ||
16320 | #define USBHSH_USBCMD_RS_SHIFT (0U) | ||
16321 | /*! RS - Run/Stop: 1b = Run. | ||
16322 | */ | ||
16323 | #define USBHSH_USBCMD_RS(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBCMD_RS_SHIFT)) & USBHSH_USBCMD_RS_MASK) | ||
16324 | #define USBHSH_USBCMD_HCRESET_MASK (0x2U) | ||
16325 | #define USBHSH_USBCMD_HCRESET_SHIFT (1U) | ||
16326 | /*! HCRESET - Host Controller Reset: This control bit is used by the software to reset the host controller. | ||
16327 | */ | ||
16328 | #define USBHSH_USBCMD_HCRESET(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBCMD_HCRESET_SHIFT)) & USBHSH_USBCMD_HCRESET_MASK) | ||
16329 | #define USBHSH_USBCMD_FLS_MASK (0xCU) | ||
16330 | #define USBHSH_USBCMD_FLS_SHIFT (2U) | ||
16331 | /*! FLS - Frame List Size: This field specifies the size of the frame list. | ||
16332 | */ | ||
16333 | #define USBHSH_USBCMD_FLS(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBCMD_FLS_SHIFT)) & USBHSH_USBCMD_FLS_MASK) | ||
16334 | #define USBHSH_USBCMD_LHCR_MASK (0x80U) | ||
16335 | #define USBHSH_USBCMD_LHCR_SHIFT (7U) | ||
16336 | /*! LHCR - Light Host Controller Reset: This bit allows the driver software to reset the host | ||
16337 | * controller without affecting the state of the ports. | ||
16338 | */ | ||
16339 | #define USBHSH_USBCMD_LHCR(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBCMD_LHCR_SHIFT)) & USBHSH_USBCMD_LHCR_MASK) | ||
16340 | #define USBHSH_USBCMD_ATL_EN_MASK (0x100U) | ||
16341 | #define USBHSH_USBCMD_ATL_EN_SHIFT (8U) | ||
16342 | /*! ATL_EN - ATL List enabled. | ||
16343 | */ | ||
16344 | #define USBHSH_USBCMD_ATL_EN(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBCMD_ATL_EN_SHIFT)) & USBHSH_USBCMD_ATL_EN_MASK) | ||
16345 | #define USBHSH_USBCMD_ISO_EN_MASK (0x200U) | ||
16346 | #define USBHSH_USBCMD_ISO_EN_SHIFT (9U) | ||
16347 | /*! ISO_EN - ISO List enabled. | ||
16348 | */ | ||
16349 | #define USBHSH_USBCMD_ISO_EN(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBCMD_ISO_EN_SHIFT)) & USBHSH_USBCMD_ISO_EN_MASK) | ||
16350 | #define USBHSH_USBCMD_INT_EN_MASK (0x400U) | ||
16351 | #define USBHSH_USBCMD_INT_EN_SHIFT (10U) | ||
16352 | /*! INT_EN - INT List enabled. | ||
16353 | */ | ||
16354 | #define USBHSH_USBCMD_INT_EN(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBCMD_INT_EN_SHIFT)) & USBHSH_USBCMD_INT_EN_MASK) | ||
16355 | #define USBHSH_USBCMD_HIRD_MASK (0xF000000U) | ||
16356 | #define USBHSH_USBCMD_HIRD_SHIFT (24U) | ||
16357 | /*! HIRD - Host-Initiated Resume Duration. | ||
16358 | */ | ||
16359 | #define USBHSH_USBCMD_HIRD(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBCMD_HIRD_SHIFT)) & USBHSH_USBCMD_HIRD_MASK) | ||
16360 | /*! @} */ | ||
16361 | |||
16362 | /*! @name USBSTS - USB Interrupt Status register */ | ||
16363 | /*! @{ */ | ||
16364 | #define USBHSH_USBSTS_PCD_MASK (0x4U) | ||
16365 | #define USBHSH_USBSTS_PCD_SHIFT (2U) | ||
16366 | /*! PCD - Port Change Detect: The host controller sets this bit to logic 1 when any port has a | ||
16367 | * change bit transition from a 0 to a one or a Force Port Resume bit transition from a 0 to a 1 as a | ||
16368 | * result of a J-K transition detected on a suspended port. | ||
16369 | */ | ||
16370 | #define USBHSH_USBSTS_PCD(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBSTS_PCD_SHIFT)) & USBHSH_USBSTS_PCD_MASK) | ||
16371 | #define USBHSH_USBSTS_FLR_MASK (0x8U) | ||
16372 | #define USBHSH_USBSTS_FLR_SHIFT (3U) | ||
16373 | /*! FLR - Frame List Rollover: The host controller sets this bit to logic 1 when the frame list | ||
16374 | * index rolls over its maximum value to 0. | ||
16375 | */ | ||
16376 | #define USBHSH_USBSTS_FLR(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBSTS_FLR_SHIFT)) & USBHSH_USBSTS_FLR_MASK) | ||
16377 | #define USBHSH_USBSTS_ATL_IRQ_MASK (0x10000U) | ||
16378 | #define USBHSH_USBSTS_ATL_IRQ_SHIFT (16U) | ||
16379 | /*! ATL_IRQ - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed. | ||
16380 | */ | ||
16381 | #define USBHSH_USBSTS_ATL_IRQ(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBSTS_ATL_IRQ_SHIFT)) & USBHSH_USBSTS_ATL_IRQ_MASK) | ||
16382 | #define USBHSH_USBSTS_ISO_IRQ_MASK (0x20000U) | ||
16383 | #define USBHSH_USBSTS_ISO_IRQ_SHIFT (17U) | ||
16384 | /*! ISO_IRQ - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed. | ||
16385 | */ | ||
16386 | #define USBHSH_USBSTS_ISO_IRQ(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBSTS_ISO_IRQ_SHIFT)) & USBHSH_USBSTS_ISO_IRQ_MASK) | ||
16387 | #define USBHSH_USBSTS_INT_IRQ_MASK (0x40000U) | ||
16388 | #define USBHSH_USBSTS_INT_IRQ_SHIFT (18U) | ||
16389 | /*! INT_IRQ - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed. | ||
16390 | */ | ||
16391 | #define USBHSH_USBSTS_INT_IRQ(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBSTS_INT_IRQ_SHIFT)) & USBHSH_USBSTS_INT_IRQ_MASK) | ||
16392 | #define USBHSH_USBSTS_SOF_IRQ_MASK (0x80000U) | ||
16393 | #define USBHSH_USBSTS_SOF_IRQ_SHIFT (19U) | ||
16394 | /*! SOF_IRQ - SOF interrupt: Every time when the host sends a Start of Frame token on the USB bus, this bit is set. | ||
16395 | */ | ||
16396 | #define USBHSH_USBSTS_SOF_IRQ(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBSTS_SOF_IRQ_SHIFT)) & USBHSH_USBSTS_SOF_IRQ_MASK) | ||
16397 | /*! @} */ | ||
16398 | |||
16399 | /*! @name USBINTR - USB Interrupt Enable register */ | ||
16400 | /*! @{ */ | ||
16401 | #define USBHSH_USBINTR_PCDE_MASK (0x4U) | ||
16402 | #define USBHSH_USBINTR_PCDE_SHIFT (2U) | ||
16403 | /*! PCDE - Port Change Detect Interrupt Enable: 1: enable 0: disable. | ||
16404 | */ | ||
16405 | #define USBHSH_USBINTR_PCDE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBINTR_PCDE_SHIFT)) & USBHSH_USBINTR_PCDE_MASK) | ||
16406 | #define USBHSH_USBINTR_FLRE_MASK (0x8U) | ||
16407 | #define USBHSH_USBINTR_FLRE_SHIFT (3U) | ||
16408 | /*! FLRE - Frame List Rollover Interrupt Enable: 1: enable 0: disable. | ||
16409 | */ | ||
16410 | #define USBHSH_USBINTR_FLRE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBINTR_FLRE_SHIFT)) & USBHSH_USBINTR_FLRE_MASK) | ||
16411 | #define USBHSH_USBINTR_ATL_IRQ_E_MASK (0x10000U) | ||
16412 | #define USBHSH_USBINTR_ATL_IRQ_E_SHIFT (16U) | ||
16413 | /*! ATL_IRQ_E - ATL IRQ Enable bit: 1: enable 0: disable. | ||
16414 | */ | ||
16415 | #define USBHSH_USBINTR_ATL_IRQ_E(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBINTR_ATL_IRQ_E_SHIFT)) & USBHSH_USBINTR_ATL_IRQ_E_MASK) | ||
16416 | #define USBHSH_USBINTR_ISO_IRQ_E_MASK (0x20000U) | ||
16417 | #define USBHSH_USBINTR_ISO_IRQ_E_SHIFT (17U) | ||
16418 | /*! ISO_IRQ_E - ISO IRQ Enable bit: 1: enable 0: disable. | ||
16419 | */ | ||
16420 | #define USBHSH_USBINTR_ISO_IRQ_E(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBINTR_ISO_IRQ_E_SHIFT)) & USBHSH_USBINTR_ISO_IRQ_E_MASK) | ||
16421 | #define USBHSH_USBINTR_INT_IRQ_E_MASK (0x40000U) | ||
16422 | #define USBHSH_USBINTR_INT_IRQ_E_SHIFT (18U) | ||
16423 | /*! INT_IRQ_E - INT IRQ Enable bit: 1: enable 0: disable. | ||
16424 | */ | ||
16425 | #define USBHSH_USBINTR_INT_IRQ_E(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBINTR_INT_IRQ_E_SHIFT)) & USBHSH_USBINTR_INT_IRQ_E_MASK) | ||
16426 | #define USBHSH_USBINTR_SOF_E_MASK (0x80000U) | ||
16427 | #define USBHSH_USBINTR_SOF_E_SHIFT (19U) | ||
16428 | /*! SOF_E - SOF Interrupt Enable bit: 1: enable 0: disable. | ||
16429 | */ | ||
16430 | #define USBHSH_USBINTR_SOF_E(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_USBINTR_SOF_E_SHIFT)) & USBHSH_USBINTR_SOF_E_MASK) | ||
16431 | /*! @} */ | ||
16432 | |||
16433 | /*! @name PORTSC1 - Port Status and Control register */ | ||
16434 | /*! @{ */ | ||
16435 | #define USBHSH_PORTSC1_CCS_MASK (0x1U) | ||
16436 | #define USBHSH_PORTSC1_CCS_SHIFT (0U) | ||
16437 | /*! CCS - Current Connect Status: Logic 1 indicates a device is present on the port. | ||
16438 | */ | ||
16439 | #define USBHSH_PORTSC1_CCS(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_CCS_SHIFT)) & USBHSH_PORTSC1_CCS_MASK) | ||
16440 | #define USBHSH_PORTSC1_CSC_MASK (0x2U) | ||
16441 | #define USBHSH_PORTSC1_CSC_SHIFT (1U) | ||
16442 | /*! CSC - Connect Status Change: Logic 1 means that the value of CCS has changed. | ||
16443 | */ | ||
16444 | #define USBHSH_PORTSC1_CSC(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_CSC_SHIFT)) & USBHSH_PORTSC1_CSC_MASK) | ||
16445 | #define USBHSH_PORTSC1_PED_MASK (0x4U) | ||
16446 | #define USBHSH_PORTSC1_PED_SHIFT (2U) | ||
16447 | /*! PED - Port Enabled/Disabled. | ||
16448 | */ | ||
16449 | #define USBHSH_PORTSC1_PED(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_PED_SHIFT)) & USBHSH_PORTSC1_PED_MASK) | ||
16450 | #define USBHSH_PORTSC1_PEDC_MASK (0x8U) | ||
16451 | #define USBHSH_PORTSC1_PEDC_SHIFT (3U) | ||
16452 | /*! PEDC - Port Enabled/Disabled Change: Logic 1 means that the value of PED has changed. | ||
16453 | */ | ||
16454 | #define USBHSH_PORTSC1_PEDC(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_PEDC_SHIFT)) & USBHSH_PORTSC1_PEDC_MASK) | ||
16455 | #define USBHSH_PORTSC1_OCA_MASK (0x10U) | ||
16456 | #define USBHSH_PORTSC1_OCA_SHIFT (4U) | ||
16457 | /*! OCA - Over-current active: Logic 1 means that this port has an over-current condition. | ||
16458 | */ | ||
16459 | #define USBHSH_PORTSC1_OCA(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_OCA_SHIFT)) & USBHSH_PORTSC1_OCA_MASK) | ||
16460 | #define USBHSH_PORTSC1_OCC_MASK (0x20U) | ||
16461 | #define USBHSH_PORTSC1_OCC_SHIFT (5U) | ||
16462 | /*! OCC - Over-current change: Logic 1 means that the value of OCA has changed. | ||
16463 | */ | ||
16464 | #define USBHSH_PORTSC1_OCC(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_OCC_SHIFT)) & USBHSH_PORTSC1_OCC_MASK) | ||
16465 | #define USBHSH_PORTSC1_FPR_MASK (0x40U) | ||
16466 | #define USBHSH_PORTSC1_FPR_SHIFT (6U) | ||
16467 | /*! FPR - Force Port Resume: Logic 1 means resume (K-state) detected or driven on the port. | ||
16468 | */ | ||
16469 | #define USBHSH_PORTSC1_FPR(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_FPR_SHIFT)) & USBHSH_PORTSC1_FPR_MASK) | ||
16470 | #define USBHSH_PORTSC1_SUSP_MASK (0x80U) | ||
16471 | #define USBHSH_PORTSC1_SUSP_SHIFT (7U) | ||
16472 | /*! SUSP - Suspend: Logic 1 means port is in the suspend state. | ||
16473 | */ | ||
16474 | #define USBHSH_PORTSC1_SUSP(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_SUSP_SHIFT)) & USBHSH_PORTSC1_SUSP_MASK) | ||
16475 | #define USBHSH_PORTSC1_PR_MASK (0x100U) | ||
16476 | #define USBHSH_PORTSC1_PR_SHIFT (8U) | ||
16477 | /*! PR - Port Reset: Logic 1 means the port is in the reset state. | ||
16478 | */ | ||
16479 | #define USBHSH_PORTSC1_PR(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_PR_SHIFT)) & USBHSH_PORTSC1_PR_MASK) | ||
16480 | #define USBHSH_PORTSC1_SUS_L1_MASK (0x200U) | ||
16481 | #define USBHSH_PORTSC1_SUS_L1_SHIFT (9U) | ||
16482 | /*! SUS_L1 - Suspend using L1 0b = Suspend using L2 1b = Suspend using L1 When this bit is set to a | ||
16483 | * 1 and a non-zero value is specified in the Device Address field, the host controller will | ||
16484 | * generate an LPM Token to enter the L1 state whenever software writes a one to the Suspend bit, as | ||
16485 | * well as L1 exit timing during any device or host-initiated resume. | ||
16486 | */ | ||
16487 | #define USBHSH_PORTSC1_SUS_L1(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_SUS_L1_SHIFT)) & USBHSH_PORTSC1_SUS_L1_MASK) | ||
16488 | #define USBHSH_PORTSC1_LS_MASK (0xC00U) | ||
16489 | #define USBHSH_PORTSC1_LS_SHIFT (10U) | ||
16490 | /*! LS - Line Status: This field reflects the current logical levels of the DP (bit 11) and DM (bit 10) signal lines. | ||
16491 | */ | ||
16492 | #define USBHSH_PORTSC1_LS(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_LS_SHIFT)) & USBHSH_PORTSC1_LS_MASK) | ||
16493 | #define USBHSH_PORTSC1_PP_MASK (0x1000U) | ||
16494 | #define USBHSH_PORTSC1_PP_SHIFT (12U) | ||
16495 | /*! PP - Port Power: The function of this bit depends on the value of the Port Power Control (PPC) bit in the HCSPARAMS register. | ||
16496 | */ | ||
16497 | #define USBHSH_PORTSC1_PP(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_PP_SHIFT)) & USBHSH_PORTSC1_PP_MASK) | ||
16498 | #define USBHSH_PORTSC1_PIC_MASK (0xC000U) | ||
16499 | #define USBHSH_PORTSC1_PIC_SHIFT (14U) | ||
16500 | /*! PIC - Port Indicator Control : Writing to this field has no effect if the P_INDICATOR bit in the | ||
16501 | * HCSPARAMS register is logic 0. | ||
16502 | */ | ||
16503 | #define USBHSH_PORTSC1_PIC(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_PIC_SHIFT)) & USBHSH_PORTSC1_PIC_MASK) | ||
16504 | #define USBHSH_PORTSC1_PTC_MASK (0xF0000U) | ||
16505 | #define USBHSH_PORTSC1_PTC_SHIFT (16U) | ||
16506 | /*! PTC - Port Test Control: A non-zero value indicates that the port is operating in the test mode as indicated by the value. | ||
16507 | */ | ||
16508 | #define USBHSH_PORTSC1_PTC(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_PTC_SHIFT)) & USBHSH_PORTSC1_PTC_MASK) | ||
16509 | #define USBHSH_PORTSC1_PSPD_MASK (0x300000U) | ||
16510 | #define USBHSH_PORTSC1_PSPD_SHIFT (20U) | ||
16511 | /*! PSPD - Port Speed: 00b: Low-speed 01b: Full-speed 10b: High-speed 11b: Reserved. | ||
16512 | */ | ||
16513 | #define USBHSH_PORTSC1_PSPD(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_PSPD_SHIFT)) & USBHSH_PORTSC1_PSPD_MASK) | ||
16514 | #define USBHSH_PORTSC1_WOO_MASK (0x400000U) | ||
16515 | #define USBHSH_PORTSC1_WOO_SHIFT (22U) | ||
16516 | /*! WOO - Wake on overcurrent enable: Writing this bit to a one enables the port to be sensitive to | ||
16517 | * overcurrent conditions as wake-up events. | ||
16518 | */ | ||
16519 | #define USBHSH_PORTSC1_WOO(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_WOO_SHIFT)) & USBHSH_PORTSC1_WOO_MASK) | ||
16520 | #define USBHSH_PORTSC1_SUS_STAT_MASK (0x1800000U) | ||
16521 | #define USBHSH_PORTSC1_SUS_STAT_SHIFT (23U) | ||
16522 | /*! SUS_STAT - These two bits are used by software to determine whether the most recent L1 suspend | ||
16523 | * request was successful: 00b: Success-state transition was successful (ACK) 01b: Not Yet - | ||
16524 | * Device was unable to enter the L1 state at this time (NYET) 10b: Not supported - Device does not | ||
16525 | * support the L1 state (STALL) 11b: Timeout/Error - Device failed to respond or an error occurred. | ||
16526 | */ | ||
16527 | #define USBHSH_PORTSC1_SUS_STAT(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_SUS_STAT_SHIFT)) & USBHSH_PORTSC1_SUS_STAT_MASK) | ||
16528 | #define USBHSH_PORTSC1_DEV_ADD_MASK (0xFE000000U) | ||
16529 | #define USBHSH_PORTSC1_DEV_ADD_SHIFT (25U) | ||
16530 | /*! DEV_ADD - Device Address for LPM tokens. | ||
16531 | */ | ||
16532 | #define USBHSH_PORTSC1_DEV_ADD(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTSC1_DEV_ADD_SHIFT)) & USBHSH_PORTSC1_DEV_ADD_MASK) | ||
16533 | /*! @} */ | ||
16534 | |||
16535 | /*! @name ATL_PTD_DONE_MAP - Done map for each ATL PTD */ | ||
16536 | /*! @{ */ | ||
16537 | #define USBHSH_ATL_PTD_DONE_MAP_ATL_DONE_MASK (0xFFFFFFFFU) | ||
16538 | #define USBHSH_ATL_PTD_DONE_MAP_ATL_DONE_SHIFT (0U) | ||
16539 | /*! ATL_DONE - The bit corresponding to a certain PTD will be set to logic 1 as soon as that PTD execution is completed. | ||
16540 | */ | ||
16541 | #define USBHSH_ATL_PTD_DONE_MAP_ATL_DONE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_ATL_PTD_DONE_MAP_ATL_DONE_SHIFT)) & USBHSH_ATL_PTD_DONE_MAP_ATL_DONE_MASK) | ||
16542 | /*! @} */ | ||
16543 | |||
16544 | /*! @name ATL_PTD_SKIP_MAP - Skip map for each ATL PTD */ | ||
16545 | /*! @{ */ | ||
16546 | #define USBHSH_ATL_PTD_SKIP_MAP_ATL_SKIP_MASK (0xFFFFFFFFU) | ||
16547 | #define USBHSH_ATL_PTD_SKIP_MAP_ATL_SKIP_SHIFT (0U) | ||
16548 | /*! ATL_SKIP - When a bit in the PTD Skip Map is set to logic 1, the corresponding PTD will be | ||
16549 | * skipped, independent of the V bit setting. | ||
16550 | */ | ||
16551 | #define USBHSH_ATL_PTD_SKIP_MAP_ATL_SKIP(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_ATL_PTD_SKIP_MAP_ATL_SKIP_SHIFT)) & USBHSH_ATL_PTD_SKIP_MAP_ATL_SKIP_MASK) | ||
16552 | /*! @} */ | ||
16553 | |||
16554 | /*! @name ISO_PTD_DONE_MAP - Done map for each ISO PTD */ | ||
16555 | /*! @{ */ | ||
16556 | #define USBHSH_ISO_PTD_DONE_MAP_ISO_DONE_MASK (0xFFFFFFFFU) | ||
16557 | #define USBHSH_ISO_PTD_DONE_MAP_ISO_DONE_SHIFT (0U) | ||
16558 | /*! ISO_DONE - The bit corresponding to a certain PTD will be set to logic 1 as soon as that PTD execution is completed. | ||
16559 | */ | ||
16560 | #define USBHSH_ISO_PTD_DONE_MAP_ISO_DONE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_ISO_PTD_DONE_MAP_ISO_DONE_SHIFT)) & USBHSH_ISO_PTD_DONE_MAP_ISO_DONE_MASK) | ||
16561 | /*! @} */ | ||
16562 | |||
16563 | /*! @name ISO_PTD_SKIP_MAP - Skip map for each ISO PTD */ | ||
16564 | /*! @{ */ | ||
16565 | #define USBHSH_ISO_PTD_SKIP_MAP_ISO_SKIP_MASK (0xFFFFFFFFU) | ||
16566 | #define USBHSH_ISO_PTD_SKIP_MAP_ISO_SKIP_SHIFT (0U) | ||
16567 | /*! ISO_SKIP - The bit corresponding to a certain PTD will be set to logic 1 as soon as that PTD execution is completed. | ||
16568 | */ | ||
16569 | #define USBHSH_ISO_PTD_SKIP_MAP_ISO_SKIP(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_ISO_PTD_SKIP_MAP_ISO_SKIP_SHIFT)) & USBHSH_ISO_PTD_SKIP_MAP_ISO_SKIP_MASK) | ||
16570 | /*! @} */ | ||
16571 | |||
16572 | /*! @name INT_PTD_DONE_MAP - Done map for each INT PTD */ | ||
16573 | /*! @{ */ | ||
16574 | #define USBHSH_INT_PTD_DONE_MAP_INT_DONE_MASK (0xFFFFFFFFU) | ||
16575 | #define USBHSH_INT_PTD_DONE_MAP_INT_DONE_SHIFT (0U) | ||
16576 | /*! INT_DONE - The bit corresponding to a certain PTD will be set to logic 1 as soon as that PTD execution is completed. | ||
16577 | */ | ||
16578 | #define USBHSH_INT_PTD_DONE_MAP_INT_DONE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_INT_PTD_DONE_MAP_INT_DONE_SHIFT)) & USBHSH_INT_PTD_DONE_MAP_INT_DONE_MASK) | ||
16579 | /*! @} */ | ||
16580 | |||
16581 | /*! @name INT_PTD_SKIP_MAP - Skip map for each INT PTD */ | ||
16582 | /*! @{ */ | ||
16583 | #define USBHSH_INT_PTD_SKIP_MAP_INT_SKIP_MASK (0xFFFFFFFFU) | ||
16584 | #define USBHSH_INT_PTD_SKIP_MAP_INT_SKIP_SHIFT (0U) | ||
16585 | /*! INT_SKIP - When a bit in the PTD Skip Map is set to logic 1, the corresponding PTD will be | ||
16586 | * skipped, independent of the V bit setting. | ||
16587 | */ | ||
16588 | #define USBHSH_INT_PTD_SKIP_MAP_INT_SKIP(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_INT_PTD_SKIP_MAP_INT_SKIP_SHIFT)) & USBHSH_INT_PTD_SKIP_MAP_INT_SKIP_MASK) | ||
16589 | /*! @} */ | ||
16590 | |||
16591 | /*! @name LASTPTD - Marks the last PTD in the list for ISO, INT and ATL */ | ||
16592 | /*! @{ */ | ||
16593 | #define USBHSH_LASTPTD_ATL_LAST_MASK (0x1FU) | ||
16594 | #define USBHSH_LASTPTD_ATL_LAST_SHIFT (0U) | ||
16595 | /*! ATL_LAST - If hardware has reached this PTD and the J bit is not set, it will go to PTD0 as the next PTD to be processed. | ||
16596 | */ | ||
16597 | #define USBHSH_LASTPTD_ATL_LAST(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_LASTPTD_ATL_LAST_SHIFT)) & USBHSH_LASTPTD_ATL_LAST_MASK) | ||
16598 | #define USBHSH_LASTPTD_ISO_LAST_MASK (0x1F00U) | ||
16599 | #define USBHSH_LASTPTD_ISO_LAST_SHIFT (8U) | ||
16600 | /*! ISO_LAST - This indicates the last PTD in the ISO list. | ||
16601 | */ | ||
16602 | #define USBHSH_LASTPTD_ISO_LAST(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_LASTPTD_ISO_LAST_SHIFT)) & USBHSH_LASTPTD_ISO_LAST_MASK) | ||
16603 | #define USBHSH_LASTPTD_INT_LAST_MASK (0x1F0000U) | ||
16604 | #define USBHSH_LASTPTD_INT_LAST_SHIFT (16U) | ||
16605 | /*! INT_LAST - This indicates the last PTD in the INT list. | ||
16606 | */ | ||
16607 | #define USBHSH_LASTPTD_INT_LAST(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_LASTPTD_INT_LAST_SHIFT)) & USBHSH_LASTPTD_INT_LAST_MASK) | ||
16608 | /*! @} */ | ||
16609 | |||
16610 | /*! @name PORTMODE - Controls the port if it is attached to the host block or the device block */ | ||
16611 | /*! @{ */ | ||
16612 | #define USBHSH_PORTMODE_ID0_MASK (0x1U) | ||
16613 | #define USBHSH_PORTMODE_ID0_SHIFT (0U) | ||
16614 | /*! ID0 - Port 0 ID pin value. | ||
16615 | */ | ||
16616 | #define USBHSH_PORTMODE_ID0(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTMODE_ID0_SHIFT)) & USBHSH_PORTMODE_ID0_MASK) | ||
16617 | #define USBHSH_PORTMODE_ID0_EN_MASK (0x100U) | ||
16618 | #define USBHSH_PORTMODE_ID0_EN_SHIFT (8U) | ||
16619 | /*! ID0_EN - Port 0 ID pin pull-up enable. | ||
16620 | */ | ||
16621 | #define USBHSH_PORTMODE_ID0_EN(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTMODE_ID0_EN_SHIFT)) & USBHSH_PORTMODE_ID0_EN_MASK) | ||
16622 | #define USBHSH_PORTMODE_DEV_ENABLE_MASK (0x10000U) | ||
16623 | #define USBHSH_PORTMODE_DEV_ENABLE_SHIFT (16U) | ||
16624 | /*! DEV_ENABLE - If this bit is set to one, one of the ports will behave as a USB device. | ||
16625 | */ | ||
16626 | #define USBHSH_PORTMODE_DEV_ENABLE(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTMODE_DEV_ENABLE_SHIFT)) & USBHSH_PORTMODE_DEV_ENABLE_MASK) | ||
16627 | #define USBHSH_PORTMODE_SW_CTRL_PDCOM_MASK (0x40000U) | ||
16628 | #define USBHSH_PORTMODE_SW_CTRL_PDCOM_SHIFT (18U) | ||
16629 | /*! SW_CTRL_PDCOM - This bit indicates if the PHY power-down input is controlled by software or by hardware. | ||
16630 | */ | ||
16631 | #define USBHSH_PORTMODE_SW_CTRL_PDCOM(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTMODE_SW_CTRL_PDCOM_SHIFT)) & USBHSH_PORTMODE_SW_CTRL_PDCOM_MASK) | ||
16632 | #define USBHSH_PORTMODE_SW_PDCOM_MASK (0x80000U) | ||
16633 | #define USBHSH_PORTMODE_SW_PDCOM_SHIFT (19U) | ||
16634 | /*! SW_PDCOM - This bit is only used when SW_CTRL_PDCOM is set to 1b. | ||
16635 | */ | ||
16636 | #define USBHSH_PORTMODE_SW_PDCOM(x) (((uint32_t)(((uint32_t)(x)) << USBHSH_PORTMODE_SW_PDCOM_SHIFT)) & USBHSH_PORTMODE_SW_PDCOM_MASK) | ||
16637 | /*! @} */ | ||
16638 | |||
16639 | |||
16640 | /*! | ||
16641 | * @} | ||
16642 | */ /* end of group USBHSH_Register_Masks */ | ||
16643 | |||
16644 | |||
16645 | /* USBHSH - Peripheral instance base addresses */ | ||
16646 | /** Peripheral USBHSH base address */ | ||
16647 | #define USBHSH_BASE (0x400A3000u) | ||
16648 | /** Peripheral USBHSH base pointer */ | ||
16649 | #define USBHSH ((USBHSH_Type *)USBHSH_BASE) | ||
16650 | /** Array initializer of USBHSH peripheral base addresses */ | ||
16651 | #define USBHSH_BASE_ADDRS { USBHSH_BASE } | ||
16652 | /** Array initializer of USBHSH peripheral base pointers */ | ||
16653 | #define USBHSH_BASE_PTRS { USBHSH } | ||
16654 | /** Interrupt vectors for the USBHSH peripheral type */ | ||
16655 | #define USBHSH_IRQS { USB1_IRQn } | ||
16656 | #define USBHSH_NEEDCLK_IRQS { USB1_NEEDCLK_IRQn } | ||
16657 | |||
16658 | /*! | ||
16659 | * @} | ||
16660 | */ /* end of group USBHSH_Peripheral_Access_Layer */ | ||
16661 | |||
16662 | |||
16663 | /* ---------------------------------------------------------------------------- | ||
16664 | -- UTICK Peripheral Access Layer | ||
16665 | ---------------------------------------------------------------------------- */ | ||
16666 | |||
16667 | /*! | ||
16668 | * @addtogroup UTICK_Peripheral_Access_Layer UTICK Peripheral Access Layer | ||
16669 | * @{ | ||
16670 | */ | ||
16671 | |||
16672 | /** UTICK - Register Layout Typedef */ | ||
16673 | typedef struct { | ||
16674 | __IO uint32_t CTRL; /**< Control register., offset: 0x0 */ | ||
16675 | __IO uint32_t STAT; /**< Status register., offset: 0x4 */ | ||
16676 | __IO uint32_t CFG; /**< Capture configuration register., offset: 0x8 */ | ||
16677 | __O uint32_t CAPCLR; /**< Capture clear register., offset: 0xC */ | ||
16678 | __I uint32_t CAP[4]; /**< Capture register ., array offset: 0x10, array step: 0x4 */ | ||
16679 | } UTICK_Type; | ||
16680 | |||
16681 | /* ---------------------------------------------------------------------------- | ||
16682 | -- UTICK Register Masks | ||
16683 | ---------------------------------------------------------------------------- */ | ||
16684 | |||
16685 | /*! | ||
16686 | * @addtogroup UTICK_Register_Masks UTICK Register Masks | ||
16687 | * @{ | ||
16688 | */ | ||
16689 | |||
16690 | /*! @name CTRL - Control register. */ | ||
16691 | /*! @{ */ | ||
16692 | #define UTICK_CTRL_DELAYVAL_MASK (0x7FFFFFFFU) | ||
16693 | #define UTICK_CTRL_DELAYVAL_SHIFT (0U) | ||
16694 | /*! DELAYVAL - Tick interval value. The delay will be equal to DELAYVAL + 1 periods of the timer | ||
16695 | * clock. The minimum usable value is 1, for a delay of 2 timer clocks. A value of 0 stops the timer. | ||
16696 | */ | ||
16697 | #define UTICK_CTRL_DELAYVAL(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CTRL_DELAYVAL_SHIFT)) & UTICK_CTRL_DELAYVAL_MASK) | ||
16698 | #define UTICK_CTRL_REPEAT_MASK (0x80000000U) | ||
16699 | #define UTICK_CTRL_REPEAT_SHIFT (31U) | ||
16700 | /*! REPEAT - Repeat delay. 0 = One-time delay. 1 = Delay repeats continuously. | ||
16701 | */ | ||
16702 | #define UTICK_CTRL_REPEAT(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CTRL_REPEAT_SHIFT)) & UTICK_CTRL_REPEAT_MASK) | ||
16703 | /*! @} */ | ||
16704 | |||
16705 | /*! @name STAT - Status register. */ | ||
16706 | /*! @{ */ | ||
16707 | #define UTICK_STAT_INTR_MASK (0x1U) | ||
16708 | #define UTICK_STAT_INTR_SHIFT (0U) | ||
16709 | /*! INTR - Interrupt flag. 0 = No interrupt is pending. 1 = An interrupt is pending. A write of any | ||
16710 | * value to this register clears this flag. | ||
16711 | */ | ||
16712 | #define UTICK_STAT_INTR(x) (((uint32_t)(((uint32_t)(x)) << UTICK_STAT_INTR_SHIFT)) & UTICK_STAT_INTR_MASK) | ||
16713 | #define UTICK_STAT_ACTIVE_MASK (0x2U) | ||
16714 | #define UTICK_STAT_ACTIVE_SHIFT (1U) | ||
16715 | /*! ACTIVE - Active flag. 0 = The Micro-Tick Timer is stopped. 1 = The Micro-Tick Timer is currently active. | ||
16716 | */ | ||
16717 | #define UTICK_STAT_ACTIVE(x) (((uint32_t)(((uint32_t)(x)) << UTICK_STAT_ACTIVE_SHIFT)) & UTICK_STAT_ACTIVE_MASK) | ||
16718 | /*! @} */ | ||
16719 | |||
16720 | /*! @name CFG - Capture configuration register. */ | ||
16721 | /*! @{ */ | ||
16722 | #define UTICK_CFG_CAPEN0_MASK (0x1U) | ||
16723 | #define UTICK_CFG_CAPEN0_SHIFT (0U) | ||
16724 | /*! CAPEN0 - Enable Capture 0. 1 = Enabled, 0 = Disabled. | ||
16725 | */ | ||
16726 | #define UTICK_CFG_CAPEN0(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CFG_CAPEN0_SHIFT)) & UTICK_CFG_CAPEN0_MASK) | ||
16727 | #define UTICK_CFG_CAPEN1_MASK (0x2U) | ||
16728 | #define UTICK_CFG_CAPEN1_SHIFT (1U) | ||
16729 | /*! CAPEN1 - Enable Capture 1. 1 = Enabled, 0 = Disabled. | ||
16730 | */ | ||
16731 | #define UTICK_CFG_CAPEN1(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CFG_CAPEN1_SHIFT)) & UTICK_CFG_CAPEN1_MASK) | ||
16732 | #define UTICK_CFG_CAPEN2_MASK (0x4U) | ||
16733 | #define UTICK_CFG_CAPEN2_SHIFT (2U) | ||
16734 | /*! CAPEN2 - Enable Capture 2. 1 = Enabled, 0 = Disabled. | ||
16735 | */ | ||
16736 | #define UTICK_CFG_CAPEN2(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CFG_CAPEN2_SHIFT)) & UTICK_CFG_CAPEN2_MASK) | ||
16737 | #define UTICK_CFG_CAPEN3_MASK (0x8U) | ||
16738 | #define UTICK_CFG_CAPEN3_SHIFT (3U) | ||
16739 | /*! CAPEN3 - Enable Capture 3. 1 = Enabled, 0 = Disabled. | ||
16740 | */ | ||
16741 | #define UTICK_CFG_CAPEN3(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CFG_CAPEN3_SHIFT)) & UTICK_CFG_CAPEN3_MASK) | ||
16742 | #define UTICK_CFG_CAPPOL0_MASK (0x100U) | ||
16743 | #define UTICK_CFG_CAPPOL0_SHIFT (8U) | ||
16744 | /*! CAPPOL0 - Capture Polarity 0. 0 = Positive edge capture, 1 = Negative edge capture. | ||
16745 | */ | ||
16746 | #define UTICK_CFG_CAPPOL0(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CFG_CAPPOL0_SHIFT)) & UTICK_CFG_CAPPOL0_MASK) | ||
16747 | #define UTICK_CFG_CAPPOL1_MASK (0x200U) | ||
16748 | #define UTICK_CFG_CAPPOL1_SHIFT (9U) | ||
16749 | /*! CAPPOL1 - Capture Polarity 1. 0 = Positive edge capture, 1 = Negative edge capture. | ||
16750 | */ | ||
16751 | #define UTICK_CFG_CAPPOL1(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CFG_CAPPOL1_SHIFT)) & UTICK_CFG_CAPPOL1_MASK) | ||
16752 | #define UTICK_CFG_CAPPOL2_MASK (0x400U) | ||
16753 | #define UTICK_CFG_CAPPOL2_SHIFT (10U) | ||
16754 | /*! CAPPOL2 - Capture Polarity 2. 0 = Positive edge capture, 1 = Negative edge capture. | ||
16755 | */ | ||
16756 | #define UTICK_CFG_CAPPOL2(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CFG_CAPPOL2_SHIFT)) & UTICK_CFG_CAPPOL2_MASK) | ||
16757 | #define UTICK_CFG_CAPPOL3_MASK (0x800U) | ||
16758 | #define UTICK_CFG_CAPPOL3_SHIFT (11U) | ||
16759 | /*! CAPPOL3 - Capture Polarity 3. 0 = Positive edge capture, 1 = Negative edge capture. | ||
16760 | */ | ||
16761 | #define UTICK_CFG_CAPPOL3(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CFG_CAPPOL3_SHIFT)) & UTICK_CFG_CAPPOL3_MASK) | ||
16762 | /*! @} */ | ||
16763 | |||
16764 | /*! @name CAPCLR - Capture clear register. */ | ||
16765 | /*! @{ */ | ||
16766 | #define UTICK_CAPCLR_CAPCLR0_MASK (0x1U) | ||
16767 | #define UTICK_CAPCLR_CAPCLR0_SHIFT (0U) | ||
16768 | /*! CAPCLR0 - Clear capture 0. Writing 1 to this bit clears the CAP0 register value. | ||
16769 | */ | ||
16770 | #define UTICK_CAPCLR_CAPCLR0(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CAPCLR_CAPCLR0_SHIFT)) & UTICK_CAPCLR_CAPCLR0_MASK) | ||
16771 | #define UTICK_CAPCLR_CAPCLR1_MASK (0x2U) | ||
16772 | #define UTICK_CAPCLR_CAPCLR1_SHIFT (1U) | ||
16773 | /*! CAPCLR1 - Clear capture 1. Writing 1 to this bit clears the CAP1 register value. | ||
16774 | */ | ||
16775 | #define UTICK_CAPCLR_CAPCLR1(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CAPCLR_CAPCLR1_SHIFT)) & UTICK_CAPCLR_CAPCLR1_MASK) | ||
16776 | #define UTICK_CAPCLR_CAPCLR2_MASK (0x4U) | ||
16777 | #define UTICK_CAPCLR_CAPCLR2_SHIFT (2U) | ||
16778 | /*! CAPCLR2 - Clear capture 2. Writing 1 to this bit clears the CAP2 register value. | ||
16779 | */ | ||
16780 | #define UTICK_CAPCLR_CAPCLR2(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CAPCLR_CAPCLR2_SHIFT)) & UTICK_CAPCLR_CAPCLR2_MASK) | ||
16781 | #define UTICK_CAPCLR_CAPCLR3_MASK (0x8U) | ||
16782 | #define UTICK_CAPCLR_CAPCLR3_SHIFT (3U) | ||
16783 | /*! CAPCLR3 - Clear capture 3. Writing 1 to this bit clears the CAP3 register value. | ||
16784 | */ | ||
16785 | #define UTICK_CAPCLR_CAPCLR3(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CAPCLR_CAPCLR3_SHIFT)) & UTICK_CAPCLR_CAPCLR3_MASK) | ||
16786 | /*! @} */ | ||
16787 | |||
16788 | /*! @name CAP - Capture register . */ | ||
16789 | /*! @{ */ | ||
16790 | #define UTICK_CAP_CAP_VALUE_MASK (0x7FFFFFFFU) | ||
16791 | #define UTICK_CAP_CAP_VALUE_SHIFT (0U) | ||
16792 | /*! CAP_VALUE - Capture value for the related capture event (UTICK_CAPn. Note: the value is 1 lower | ||
16793 | * than the actual value of the Micro-tick Timer at the moment of the capture event. | ||
16794 | */ | ||
16795 | #define UTICK_CAP_CAP_VALUE(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CAP_CAP_VALUE_SHIFT)) & UTICK_CAP_CAP_VALUE_MASK) | ||
16796 | #define UTICK_CAP_VALID_MASK (0x80000000U) | ||
16797 | #define UTICK_CAP_VALID_SHIFT (31U) | ||
16798 | /*! VALID - Capture Valid. When 1, a value has been captured based on a transition of the related | ||
16799 | * UTICK_CAPn pin. Cleared by writing to the related bit in the CAPCLR register. | ||
16800 | */ | ||
16801 | #define UTICK_CAP_VALID(x) (((uint32_t)(((uint32_t)(x)) << UTICK_CAP_VALID_SHIFT)) & UTICK_CAP_VALID_MASK) | ||
16802 | /*! @} */ | ||
16803 | |||
16804 | /* The count of UTICK_CAP */ | ||
16805 | #define UTICK_CAP_COUNT (4U) | ||
16806 | |||
16807 | |||
16808 | /*! | ||
16809 | * @} | ||
16810 | */ /* end of group UTICK_Register_Masks */ | ||
16811 | |||
16812 | |||
16813 | /* UTICK - Peripheral instance base addresses */ | ||
16814 | /** Peripheral UTICK0 base address */ | ||
16815 | #define UTICK0_BASE (0x4000E000u) | ||
16816 | /** Peripheral UTICK0 base pointer */ | ||
16817 | #define UTICK0 ((UTICK_Type *)UTICK0_BASE) | ||
16818 | /** Array initializer of UTICK peripheral base addresses */ | ||
16819 | #define UTICK_BASE_ADDRS { UTICK0_BASE } | ||
16820 | /** Array initializer of UTICK peripheral base pointers */ | ||
16821 | #define UTICK_BASE_PTRS { UTICK0 } | ||
16822 | /** Interrupt vectors for the UTICK peripheral type */ | ||
16823 | #define UTICK_IRQS { UTICK0_IRQn } | ||
16824 | |||
16825 | /*! | ||
16826 | * @} | ||
16827 | */ /* end of group UTICK_Peripheral_Access_Layer */ | ||
16828 | |||
16829 | |||
16830 | /* ---------------------------------------------------------------------------- | ||
16831 | -- WWDT Peripheral Access Layer | ||
16832 | ---------------------------------------------------------------------------- */ | ||
16833 | |||
16834 | /*! | ||
16835 | * @addtogroup WWDT_Peripheral_Access_Layer WWDT Peripheral Access Layer | ||
16836 | * @{ | ||
16837 | */ | ||
16838 | |||
16839 | /** WWDT - Register Layout Typedef */ | ||
16840 | typedef struct { | ||
16841 | __IO uint32_t MOD; /**< Watchdog mode register. This register contains the basic mode and status of the Watchdog Timer., offset: 0x0 */ | ||
16842 | __IO uint32_t TC; /**< Watchdog timer constant register. This 24-bit register determines the time-out value., offset: 0x4 */ | ||
16843 | __O uint32_t FEED; /**< Watchdog feed sequence register. Writing 0xAA followed by 0x55 to this register reloads the Watchdog timer with the value contained in TC., offset: 0x8 */ | ||
16844 | __I uint32_t TV; /**< Watchdog timer value register. This 24-bit register reads out the current value of the Watchdog timer., offset: 0xC */ | ||
16845 | uint8_t RESERVED_0[4]; | ||
16846 | __IO uint32_t WARNINT; /**< Watchdog Warning Interrupt compare value., offset: 0x14 */ | ||
16847 | __IO uint32_t WINDOW; /**< Watchdog Window compare value., offset: 0x18 */ | ||
16848 | } WWDT_Type; | ||
16849 | |||
16850 | /* ---------------------------------------------------------------------------- | ||
16851 | -- WWDT Register Masks | ||
16852 | ---------------------------------------------------------------------------- */ | ||
16853 | |||
16854 | /*! | ||
16855 | * @addtogroup WWDT_Register_Masks WWDT Register Masks | ||
16856 | * @{ | ||
16857 | */ | ||
16858 | |||
16859 | /*! @name MOD - Watchdog mode register. This register contains the basic mode and status of the Watchdog Timer. */ | ||
16860 | /*! @{ */ | ||
16861 | #define WWDT_MOD_WDEN_MASK (0x1U) | ||
16862 | #define WWDT_MOD_WDEN_SHIFT (0U) | ||
16863 | /*! WDEN - Watchdog enable bit. Once this bit is set to one and a watchdog feed is performed, the | ||
16864 | * watchdog timer will run permanently. | ||
16865 | * 0b0..Stop. The watchdog timer is stopped. | ||
16866 | * 0b1..Run. The watchdog timer is running. | ||
16867 | */ | ||
16868 | #define WWDT_MOD_WDEN(x) (((uint32_t)(((uint32_t)(x)) << WWDT_MOD_WDEN_SHIFT)) & WWDT_MOD_WDEN_MASK) | ||
16869 | #define WWDT_MOD_WDRESET_MASK (0x2U) | ||
16870 | #define WWDT_MOD_WDRESET_SHIFT (1U) | ||
16871 | /*! WDRESET - Watchdog reset enable bit. Once this bit has been written with a 1 it cannot be re-written with a 0. | ||
16872 | * 0b0..Interrupt. A watchdog time-out will not cause a chip reset. | ||
16873 | * 0b1..Reset. A watchdog time-out will cause a chip reset. | ||
16874 | */ | ||
16875 | #define WWDT_MOD_WDRESET(x) (((uint32_t)(((uint32_t)(x)) << WWDT_MOD_WDRESET_SHIFT)) & WWDT_MOD_WDRESET_MASK) | ||
16876 | #define WWDT_MOD_WDTOF_MASK (0x4U) | ||
16877 | #define WWDT_MOD_WDTOF_SHIFT (2U) | ||
16878 | /*! WDTOF - Watchdog time-out flag. Set when the watchdog timer times out, by a feed error, or by | ||
16879 | * events associated with WDPROTECT. Cleared by software writing a 0 to this bit position. Causes a | ||
16880 | * chip reset if WDRESET = 1. | ||
16881 | */ | ||
16882 | #define WWDT_MOD_WDTOF(x) (((uint32_t)(((uint32_t)(x)) << WWDT_MOD_WDTOF_SHIFT)) & WWDT_MOD_WDTOF_MASK) | ||
16883 | #define WWDT_MOD_WDINT_MASK (0x8U) | ||
16884 | #define WWDT_MOD_WDINT_SHIFT (3U) | ||
16885 | /*! WDINT - Warning interrupt flag. Set when the timer is at or below the value in WDWARNINT. | ||
16886 | * Cleared by software writing a 1 to this bit position. Note that this bit cannot be cleared while the | ||
16887 | * WARNINT value is equal to the value of the TV register. This can occur if the value of | ||
16888 | * WARNINT is 0 and the WDRESET bit is 0 when TV decrements to 0. | ||
16889 | */ | ||
16890 | #define WWDT_MOD_WDINT(x) (((uint32_t)(((uint32_t)(x)) << WWDT_MOD_WDINT_SHIFT)) & WWDT_MOD_WDINT_MASK) | ||
16891 | #define WWDT_MOD_WDPROTECT_MASK (0x10U) | ||
16892 | #define WWDT_MOD_WDPROTECT_SHIFT (4U) | ||
16893 | /*! WDPROTECT - Watchdog update mode. This bit can be set once by software and is only cleared by a reset. | ||
16894 | * 0b0..Flexible. The watchdog time-out value (TC) can be changed at any time. | ||
16895 | * 0b1..Threshold. The watchdog time-out value (TC) can be changed only after the counter is below the value of WDWARNINT and WDWINDOW. | ||
16896 | */ | ||
16897 | #define WWDT_MOD_WDPROTECT(x) (((uint32_t)(((uint32_t)(x)) << WWDT_MOD_WDPROTECT_SHIFT)) & WWDT_MOD_WDPROTECT_MASK) | ||
16898 | #define WWDT_MOD_LOCK_MASK (0x20U) | ||
16899 | #define WWDT_MOD_LOCK_SHIFT (5U) | ||
16900 | /*! LOCK - Once this bit is set to one and a watchdog feed is performed, disabling or powering down | ||
16901 | * the watchdog oscillator is prevented by hardware. This bit can be set once by software and is | ||
16902 | * only cleared by any reset. | ||
16903 | */ | ||
16904 | #define WWDT_MOD_LOCK(x) (((uint32_t)(((uint32_t)(x)) << WWDT_MOD_LOCK_SHIFT)) & WWDT_MOD_LOCK_MASK) | ||
16905 | /*! @} */ | ||
16906 | |||
16907 | /*! @name TC - Watchdog timer constant register. This 24-bit register determines the time-out value. */ | ||
16908 | /*! @{ */ | ||
16909 | #define WWDT_TC_COUNT_MASK (0xFFFFFFU) | ||
16910 | #define WWDT_TC_COUNT_SHIFT (0U) | ||
16911 | /*! COUNT - Watchdog time-out value. | ||
16912 | */ | ||
16913 | #define WWDT_TC_COUNT(x) (((uint32_t)(((uint32_t)(x)) << WWDT_TC_COUNT_SHIFT)) & WWDT_TC_COUNT_MASK) | ||
16914 | /*! @} */ | ||
16915 | |||
16916 | /*! @name FEED - Watchdog feed sequence register. Writing 0xAA followed by 0x55 to this register reloads the Watchdog timer with the value contained in TC. */ | ||
16917 | /*! @{ */ | ||
16918 | #define WWDT_FEED_FEED_MASK (0xFFU) | ||
16919 | #define WWDT_FEED_FEED_SHIFT (0U) | ||
16920 | /*! FEED - Feed value should be 0xAA followed by 0x55. | ||
16921 | */ | ||
16922 | #define WWDT_FEED_FEED(x) (((uint32_t)(((uint32_t)(x)) << WWDT_FEED_FEED_SHIFT)) & WWDT_FEED_FEED_MASK) | ||
16923 | /*! @} */ | ||
16924 | |||
16925 | /*! @name TV - Watchdog timer value register. This 24-bit register reads out the current value of the Watchdog timer. */ | ||
16926 | /*! @{ */ | ||
16927 | #define WWDT_TV_COUNT_MASK (0xFFFFFFU) | ||
16928 | #define WWDT_TV_COUNT_SHIFT (0U) | ||
16929 | /*! COUNT - Counter timer value. | ||
16930 | */ | ||
16931 | #define WWDT_TV_COUNT(x) (((uint32_t)(((uint32_t)(x)) << WWDT_TV_COUNT_SHIFT)) & WWDT_TV_COUNT_MASK) | ||
16932 | /*! @} */ | ||
16933 | |||
16934 | /*! @name WARNINT - Watchdog Warning Interrupt compare value. */ | ||
16935 | /*! @{ */ | ||
16936 | #define WWDT_WARNINT_WARNINT_MASK (0x3FFU) | ||
16937 | #define WWDT_WARNINT_WARNINT_SHIFT (0U) | ||
16938 | /*! WARNINT - Watchdog warning interrupt compare value. | ||
16939 | */ | ||
16940 | #define WWDT_WARNINT_WARNINT(x) (((uint32_t)(((uint32_t)(x)) << WWDT_WARNINT_WARNINT_SHIFT)) & WWDT_WARNINT_WARNINT_MASK) | ||
16941 | /*! @} */ | ||
16942 | |||
16943 | /*! @name WINDOW - Watchdog Window compare value. */ | ||
16944 | /*! @{ */ | ||
16945 | #define WWDT_WINDOW_WINDOW_MASK (0xFFFFFFU) | ||
16946 | #define WWDT_WINDOW_WINDOW_SHIFT (0U) | ||
16947 | /*! WINDOW - Watchdog window value. | ||
16948 | */ | ||
16949 | #define WWDT_WINDOW_WINDOW(x) (((uint32_t)(((uint32_t)(x)) << WWDT_WINDOW_WINDOW_SHIFT)) & WWDT_WINDOW_WINDOW_MASK) | ||
16950 | /*! @} */ | ||
16951 | |||
16952 | |||
16953 | /*! | ||
16954 | * @} | ||
16955 | */ /* end of group WWDT_Register_Masks */ | ||
16956 | |||
16957 | |||
16958 | /* WWDT - Peripheral instance base addresses */ | ||
16959 | /** Peripheral WWDT base address */ | ||
16960 | #define WWDT_BASE (0x4000C000u) | ||
16961 | /** Peripheral WWDT base pointer */ | ||
16962 | #define WWDT ((WWDT_Type *)WWDT_BASE) | ||
16963 | /** Array initializer of WWDT peripheral base addresses */ | ||
16964 | #define WWDT_BASE_ADDRS { WWDT_BASE } | ||
16965 | /** Array initializer of WWDT peripheral base pointers */ | ||
16966 | #define WWDT_BASE_PTRS { WWDT } | ||
16967 | /** Interrupt vectors for the WWDT peripheral type */ | ||
16968 | #define WWDT_IRQS { WDT_BOD_IRQn } | ||
16969 | |||
16970 | /*! | ||
16971 | * @} | ||
16972 | */ /* end of group WWDT_Peripheral_Access_Layer */ | ||
16973 | |||
16974 | |||
16975 | /* | ||
16976 | ** End of section using anonymous unions | ||
16977 | */ | ||
16978 | |||
16979 | #if defined(__ARMCC_VERSION) | ||
16980 | #if (__ARMCC_VERSION >= 6010050) | ||
16981 | #pragma clang diagnostic pop | ||
16982 | #else | ||
16983 | #pragma pop | ||
16984 | #endif | ||
16985 | #elif defined(__GNUC__) | ||
16986 | /* leave anonymous unions enabled */ | ||
16987 | #elif defined(__IAR_SYSTEMS_ICC__) | ||
16988 | #pragma language=default | ||
16989 | #else | ||
16990 | #error Not supported compiler type | ||
16991 | #endif | ||
16992 | |||
16993 | /*! | ||
16994 | * @} | ||
16995 | */ /* end of group Peripheral_access_layer */ | ||
16996 | |||
16997 | |||
16998 | /* ---------------------------------------------------------------------------- | ||
16999 | -- Macros for use with bit field definitions (xxx_SHIFT, xxx_MASK). | ||
17000 | ---------------------------------------------------------------------------- */ | ||
17001 | |||
17002 | /*! | ||
17003 | * @addtogroup Bit_Field_Generic_Macros Macros for use with bit field definitions (xxx_SHIFT, xxx_MASK). | ||
17004 | * @{ | ||
17005 | */ | ||
17006 | |||
17007 | #if defined(__ARMCC_VERSION) | ||
17008 | #if (__ARMCC_VERSION >= 6010050) | ||
17009 | #pragma clang system_header | ||
17010 | #endif | ||
17011 | #elif defined(__IAR_SYSTEMS_ICC__) | ||
17012 | #pragma system_include | ||
17013 | #endif | ||
17014 | |||
17015 | /** | ||
17016 | * @brief Mask and left-shift a bit field value for use in a register bit range. | ||
17017 | * @param field Name of the register bit field. | ||
17018 | * @param value Value of the bit field. | ||
17019 | * @return Masked and shifted value. | ||
17020 | */ | ||
17021 | #define NXP_VAL2FLD(field, value) (((value) << (field ## _SHIFT)) & (field ## _MASK)) | ||
17022 | /** | ||
17023 | * @brief Mask and right-shift a register value to extract a bit field value. | ||
17024 | * @param field Name of the register bit field. | ||
17025 | * @param value Value of the register. | ||
17026 | * @return Masked and shifted bit field value. | ||
17027 | */ | ||
17028 | #define NXP_FLD2VAL(field, value) (((value) & (field ## _MASK)) >> (field ## _SHIFT)) | ||
17029 | |||
17030 | /*! | ||
17031 | * @} | ||
17032 | */ /* end of group Bit_Field_Generic_Macros */ | ||
17033 | |||
17034 | |||
17035 | /* ---------------------------------------------------------------------------- | ||
17036 | -- SDK Compatibility | ||
17037 | ---------------------------------------------------------------------------- */ | ||
17038 | |||
17039 | /*! | ||
17040 | * @addtogroup SDK_Compatibility_Symbols SDK Compatibility | ||
17041 | * @{ | ||
17042 | */ | ||
17043 | |||
17044 | /** EMC CS base address */ | ||
17045 | #define EMC_CS0_BASE (0x80000000u) | ||
17046 | #define EMC_CS1_BASE (0x88000000u) | ||
17047 | #define EMC_CS2_BASE (0x90000000u) | ||
17048 | #define EMC_CS3_BASE (0x98000000u) | ||
17049 | #define EMC_DYCS0_BASE (0xA0000000u) | ||
17050 | #define EMC_DYCS1_BASE (0xA8000000u) | ||
17051 | #define EMC_DYCS2_BASE (0xB0000000u) | ||
17052 | #define EMC_DYCS3_BASE (0xB8000000u) | ||
17053 | #define EMC_CS_ADDRESS {EMC_CS0_BASE, EMC_CS1_BASE, EMC_CS2_BASE, EMC_CS3_BASE} | ||
17054 | #define EMC_DYCS_ADDRESS {EMC_DYCS0_BASE, EMC_DYCS1_BASE, EMC_DYCS2_BASE, EMC_DYCS3_BASE} | ||
17055 | |||
17056 | /** OTP API */ | ||
17057 | typedef struct { | ||
17058 | uint32_t (*otpInit)(void); /** Initializes OTP controller */ | ||
17059 | uint32_t (*otpEnableBankWriteMask)(uint32_t bankMask); /** Unlock one or more OTP banks for write access */ | ||
17060 | uint32_t (*otpDisableBankWriteMask)(uint32_t bankMask); /** Lock one or more OTP banks for write access */ | ||
17061 | uint32_t (*otpEnableBankWriteLock)(uint32_t bankIndex, uint32_t regEnableMask, uint32_t regDisableMask, | ||
17062 | uint32_t lockWrite); /** Locks or unlocks write access to a register of an OTP bank and the write lock */ | ||
17063 | uint32_t (*otpEnableBankReadLock)(uint32_t bankIndex, uint32_t regEnableMask, uint32_t regDisableMask, | ||
17064 | uint32_t lockWrite); /** Locks or unlocks read access to a register of an OTP bank and the write lock */ | ||
17065 | uint32_t (*otpProgramReg)(uint32_t bankIndex, uint32_t regIndex, uint32_t value); /** Program a single register in an OTP bank */ | ||
17066 | uint32_t RESERVED_0[5]; | ||
17067 | uint32_t (*rngRead)(void); /** Returns 32-bit number from hardware random number generator */ | ||
17068 | uint32_t (*otpGetDriverVersion)(void); /** Returns the version of the OTP driver in ROM */ | ||
17069 | } OTP_API_Type; | ||
17070 | |||
17071 | /** SRAMX and SRAM0 base address */ | ||
17072 | #define SRAMX_BASE (0x00000000u) | ||
17073 | #define SRAMX_SIZE (0x00030000u) | ||
17074 | #define SRAM0_BASE (0x20000000u) | ||
17075 | #define SRAM0_SIZE (0x00010000u) | ||
17076 | |||
17077 | /** ROM API */ | ||
17078 | typedef struct { | ||
17079 | __I uint32_t usbdApiBase; /** USB API Base */ | ||
17080 | uint32_t RESERVED_0[13]; | ||
17081 | __I OTP_API_Type *otpApiBase; /** OTP API Base */ | ||
17082 | __I uint32_t aesApiBase; /** AES API Base */ | ||
17083 | __I uint32_t secureApiBase; /** Secure API Base */ | ||
17084 | } ROM_API_Type; | ||
17085 | |||
17086 | /** ROM API base address */ | ||
17087 | #define ROM_API_BASE (0x03000200u) | ||
17088 | /** ROM API base pointer */ | ||
17089 | #define ROM_API (*(ROM_API_Type**) ROM_API_BASE) | ||
17090 | /** OTP API base pointer */ | ||
17091 | #define OTP_API (ROM_API->otpApiBase) | ||
17092 | |||
17093 | /** Used for selecting the address of FROHF setting API in ROM */ | ||
17094 | #define FSL_FROHF_SETTING_API_ADDRESS_DETERMINE_BY_ROM_VERSION 1U | ||
17095 | #define FSL_ROM_VERSION_0A 0U | ||
17096 | #define FSL_ROM_VERSION_1B 1U | ||
17097 | #define FSL_ROM_VERSION_0A_FRO_SETTING_ADDR 0x03007933U | ||
17098 | #define FSL_ROM_VERSION_1B_FRO_SETTING_ADDR 0x03008D9BU | ||
17099 | |||
17100 | /*! | ||
17101 | * @brief Get the chip value. | ||
17102 | * | ||
17103 | * @return chip version, 0x0: 0A version chip, 0x1: 1B version chip, 0xFF: invalid version. | ||
17104 | */ | ||
17105 | static inline uint32_t Chip_GetVersion(void) | ||
17106 | { | ||
17107 | uint8_t romVersion = 0U; | ||
17108 | uint32_t command[5] = {0U}, result[4] = {0U}; | ||
17109 | uint32_t syscon_iap_entry_location = 0x03000205; | ||
17110 | |||
17111 | command[0] = 55U; | ||
17112 | result[0] = 0; | ||
17113 | result[1] = 0; | ||
17114 | ((void (*)(uint32_t cmd[5], uint32_t stat[4]))syscon_iap_entry_location)(command, result); | ||
17115 | |||
17116 | romVersion = (uint8_t)(result[1]); | ||
17117 | |||
17118 | if (0U == result[0]) | ||
17119 | { | ||
17120 | if (romVersion == FSL_ROM_VERSION_1B) | ||
17121 | { | ||
17122 | return FSL_ROM_VERSION_1B; | ||
17123 | } | ||
17124 | else if (romVersion == FSL_ROM_VERSION_0A) | ||
17125 | { | ||
17126 | return FSL_ROM_VERSION_0A; | ||
17127 | } | ||
17128 | else | ||
17129 | { | ||
17130 | return 0xFF; | ||
17131 | } | ||
17132 | } | ||
17133 | else | ||
17134 | { | ||
17135 | return 0xFF; | ||
17136 | } | ||
17137 | } | ||
17138 | |||
17139 | /*! | ||
17140 | * @} | ||
17141 | */ /* end of group SDK_Compatibility_Symbols */ | ||
17142 | |||
17143 | |||
17144 | #endif /* _LPC54005_H_ */ | ||
17145 | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/LPC54005_features.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/LPC54005_features.h new file mode 100644 index 000000000..95a15204b --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/LPC54005_features.h | |||
@@ -0,0 +1,342 @@ | |||
1 | /* | ||
2 | ** ################################################################### | ||
3 | ** Version: rev. 1.2, 2017-06-08 | ||
4 | ** Build: b191206 | ||
5 | ** | ||
6 | ** Abstract: | ||
7 | ** Chip specific module features. | ||
8 | ** | ||
9 | ** Copyright 2016 Freescale Semiconductor, Inc. | ||
10 | ** Copyright 2016-2019 NXP | ||
11 | ** All rights reserved. | ||
12 | ** | ||
13 | ** SPDX-License-Identifier: BSD-3-Clause | ||
14 | ** | ||
15 | ** http: www.nxp.com | ||
16 | ** mail: [email protected] | ||
17 | ** | ||
18 | ** Revisions: | ||
19 | ** - rev. 1.0 (2016-08-12) | ||
20 | ** Initial version. | ||
21 | ** - rev. 1.1 (2016-11-25) | ||
22 | ** Update CANFD and Classic CAN register. | ||
23 | ** Add MAC TIMERSTAMP registers. | ||
24 | ** - rev. 1.2 (2017-06-08) | ||
25 | ** Remove RTC_CTRL_RTC_OSC_BYPASS. | ||
26 | ** SYSCON_ARMTRCLKDIV rename to SYSCON_ARMTRACECLKDIV. | ||
27 | ** Remove RESET and HALT from SYSCON_AHBCLKDIV. | ||
28 | ** | ||
29 | ** ################################################################### | ||
30 | */ | ||
31 | |||
32 | #ifndef _LPC54005_FEATURES_H_ | ||
33 | #define _LPC54005_FEATURES_H_ | ||
34 | |||
35 | /* SOC module features */ | ||
36 | |||
37 | /* @brief ADC availability on the SoC. */ | ||
38 | #define FSL_FEATURE_SOC_ADC_COUNT (1) | ||
39 | /* @brief ASYNC_SYSCON availability on the SoC. */ | ||
40 | #define FSL_FEATURE_SOC_ASYNC_SYSCON_COUNT (1) | ||
41 | /* @brief CRC availability on the SoC. */ | ||
42 | #define FSL_FEATURE_SOC_CRC_COUNT (1) | ||
43 | /* @brief CTIMER availability on the SoC. */ | ||
44 | #define FSL_FEATURE_SOC_CTIMER_COUNT (5) | ||
45 | /* @brief DMA availability on the SoC. */ | ||
46 | #define FSL_FEATURE_SOC_DMA_COUNT (1) | ||
47 | /* @brief DMIC availability on the SoC. */ | ||
48 | #define FSL_FEATURE_SOC_DMIC_COUNT (1) | ||
49 | /* @brief EMC availability on the SoC. */ | ||
50 | #define FSL_FEATURE_SOC_EMC_COUNT (1) | ||
51 | /* @brief FLEXCOMM availability on the SoC. */ | ||
52 | #define FSL_FEATURE_SOC_FLEXCOMM_COUNT (11) | ||
53 | /* @brief GINT availability on the SoC. */ | ||
54 | #define FSL_FEATURE_SOC_GINT_COUNT (2) | ||
55 | /* @brief GPIO availability on the SoC. */ | ||
56 | #define FSL_FEATURE_SOC_GPIO_COUNT (1) | ||
57 | /* @brief I2C availability on the SoC. */ | ||
58 | #define FSL_FEATURE_SOC_I2C_COUNT (10) | ||
59 | /* @brief I2S availability on the SoC. */ | ||
60 | #define FSL_FEATURE_SOC_I2S_COUNT (2) | ||
61 | /* @brief INPUTMUX availability on the SoC. */ | ||
62 | #define FSL_FEATURE_SOC_INPUTMUX_COUNT (1) | ||
63 | /* @brief IOCON availability on the SoC. */ | ||
64 | #define FSL_FEATURE_SOC_IOCON_COUNT (1) | ||
65 | /* @brief MRT availability on the SoC. */ | ||
66 | #define FSL_FEATURE_SOC_MRT_COUNT (1) | ||
67 | /* @brief PINT availability on the SoC. */ | ||
68 | #define FSL_FEATURE_SOC_PINT_COUNT (1) | ||
69 | /* @brief RIT availability on the SoC. */ | ||
70 | #define FSL_FEATURE_SOC_RIT_COUNT (1) | ||
71 | /* @brief LPC_RNG availability on the SoC. */ | ||
72 | #define FSL_FEATURE_SOC_LPC_RNG_COUNT (1) | ||
73 | /* @brief RTC availability on the SoC. */ | ||
74 | #define FSL_FEATURE_SOC_RTC_COUNT (1) | ||
75 | /* @brief SCT availability on the SoC. */ | ||
76 | #define FSL_FEATURE_SOC_SCT_COUNT (1) | ||
77 | /* @brief SDIF availability on the SoC. */ | ||
78 | #define FSL_FEATURE_SOC_SDIF_COUNT (1) | ||
79 | /* @brief SHA availability on the SoC. */ | ||
80 | #define FSL_FEATURE_SOC_SHA_COUNT (1) | ||
81 | /* @brief SMARTCARD availability on the SoC. */ | ||
82 | #define FSL_FEATURE_SOC_SMARTCARD_COUNT (2) | ||
83 | /* @brief SPI availability on the SoC. */ | ||
84 | #define FSL_FEATURE_SOC_SPI_COUNT (11) | ||
85 | /* @brief SPIFI availability on the SoC. */ | ||
86 | #define FSL_FEATURE_SOC_SPIFI_COUNT (1) | ||
87 | /* @brief SYSCON availability on the SoC. */ | ||
88 | #define FSL_FEATURE_SOC_SYSCON_COUNT (1) | ||
89 | /* @brief USART availability on the SoC. */ | ||
90 | #define FSL_FEATURE_SOC_USART_COUNT (10) | ||
91 | /* @brief USB availability on the SoC. */ | ||
92 | #define FSL_FEATURE_SOC_USB_COUNT (1) | ||
93 | /* @brief USBFSH availability on the SoC. */ | ||
94 | #define FSL_FEATURE_SOC_USBFSH_COUNT (1) | ||
95 | /* @brief USBHSD availability on the SoC. */ | ||
96 | #define FSL_FEATURE_SOC_USBHSD_COUNT (1) | ||
97 | /* @brief USBHSH availability on the SoC. */ | ||
98 | #define FSL_FEATURE_SOC_USBHSH_COUNT (1) | ||
99 | /* @brief UTICK availability on the SoC. */ | ||
100 | #define FSL_FEATURE_SOC_UTICK_COUNT (1) | ||
101 | /* @brief WWDT availability on the SoC. */ | ||
102 | #define FSL_FEATURE_SOC_WWDT_COUNT (1) | ||
103 | |||
104 | /* ADC module features */ | ||
105 | |||
106 | /* @brief Do not has input select (register INSEL). */ | ||
107 | #define FSL_FEATURE_ADC_HAS_NO_INSEL (0) | ||
108 | /* @brief Has ASYNMODE bitfile in CTRL reigster. */ | ||
109 | #define FSL_FEATURE_ADC_HAS_CTRL_ASYNMODE (1) | ||
110 | /* @brief Has ASYNMODE bitfile in CTRL reigster. */ | ||
111 | #define FSL_FEATURE_ADC_HAS_CTRL_RESOL (1) | ||
112 | /* @brief Has ASYNMODE bitfile in CTRL reigster. */ | ||
113 | #define FSL_FEATURE_ADC_HAS_CTRL_BYPASSCAL (1) | ||
114 | /* @brief Has ASYNMODE bitfile in CTRL reigster. */ | ||
115 | #define FSL_FEATURE_ADC_HAS_CTRL_TSAMP (1) | ||
116 | /* @brief Has ASYNMODE bitfile in CTRL reigster. */ | ||
117 | #define FSL_FEATURE_ADC_HAS_CTRL_LPWRMODE (0) | ||
118 | /* @brief Has ASYNMODE bitfile in CTRL reigster. */ | ||
119 | #define FSL_FEATURE_ADC_HAS_CTRL_CALMODE (0) | ||
120 | /* @brief Has startup register. */ | ||
121 | #define FSL_FEATURE_ADC_HAS_STARTUP_REG (1) | ||
122 | /* @brief Has ADTrim register */ | ||
123 | #define FSL_FEATURE_ADC_HAS_TRIM_REG (0) | ||
124 | /* @brief Has Calibration register. */ | ||
125 | #define FSL_FEATURE_ADC_HAS_CALIB_REG (1) | ||
126 | |||
127 | /* DMA module features */ | ||
128 | |||
129 | /* @brief Number of channels */ | ||
130 | #define FSL_FEATURE_DMA_NUMBER_OF_CHANNELS (30) | ||
131 | /* @brief Align size of DMA descriptor */ | ||
132 | #define FSL_FEATURE_DMA_DESCRIPTOR_ALIGN_SIZE (512) | ||
133 | /* @brief DMA head link descriptor table align size */ | ||
134 | #define FSL_FEATURE_DMA_LINK_DESCRIPTOR_ALIGN_SIZE (16U) | ||
135 | |||
136 | /* FLEXCOMM module features */ | ||
137 | |||
138 | /* @brief FLEXCOMM0 USART INDEX 0 */ | ||
139 | #define FSL_FEATURE_FLEXCOMM0_USART_INDEX (0) | ||
140 | /* @brief FLEXCOMM0 SPI INDEX 0 */ | ||
141 | #define FSL_FEATURE_FLEXCOMM0_SPI_INDEX (0) | ||
142 | /* @brief FLEXCOMM0 I2C INDEX 0 */ | ||
143 | #define FSL_FEATURE_FLEXCOMM0_I2C_INDEX (0) | ||
144 | /* @brief FLEXCOMM1 USART INDEX 1 */ | ||
145 | #define FSL_FEATURE_FLEXCOMM1_USART_INDEX (1) | ||
146 | /* @brief FLEXCOMM1 SPI INDEX 1 */ | ||
147 | #define FSL_FEATURE_FLEXCOMM1_SPI_INDEX (1) | ||
148 | /* @brief FLEXCOMM1 I2C INDEX 1 */ | ||
149 | #define FSL_FEATURE_FLEXCOMM1_I2C_INDEX (1) | ||
150 | /* @brief FLEXCOMM2 USART INDEX 2 */ | ||
151 | #define FSL_FEATURE_FLEXCOMM2_USART_INDEX (2) | ||
152 | /* @brief FLEXCOMM2 SPI INDEX 2 */ | ||
153 | #define FSL_FEATURE_FLEXCOMM2_SPI_INDEX (2) | ||
154 | /* @brief FLEXCOMM2 I2C INDEX 2 */ | ||
155 | #define FSL_FEATURE_FLEXCOMM2_I2C_INDEX (2) | ||
156 | /* @brief FLEXCOMM3 USART INDEX 3 */ | ||
157 | #define FSL_FEATURE_FLEXCOMM3_USART_INDEX (3) | ||
158 | /* @brief FLEXCOMM3 SPI INDEX 3 */ | ||
159 | #define FSL_FEATURE_FLEXCOMM3_SPI_INDEX (3) | ||
160 | /* @brief FLEXCOMM3 I2C INDEX 3 */ | ||
161 | #define FSL_FEATURE_FLEXCOMM3_I2C_INDEX (3) | ||
162 | /* @brief FLEXCOMM4 USART INDEX 4 */ | ||
163 | #define FSL_FEATURE_FLEXCOMM4_USART_INDEX (4) | ||
164 | /* @brief FLEXCOMM4 SPI INDEX 4 */ | ||
165 | #define FSL_FEATURE_FLEXCOMM4_SPI_INDEX (4) | ||
166 | /* @brief FLEXCOMM4 I2C INDEX 4 */ | ||
167 | #define FSL_FEATURE_FLEXCOMM4_I2C_INDEX (4) | ||
168 | /* @brief FLEXCOMM5 USART INDEX 5 */ | ||
169 | #define FSL_FEATURE_FLEXCOMM5_USART_INDEX (5) | ||
170 | /* @brief FLEXCOMM5 SPI INDEX 5 */ | ||
171 | #define FSL_FEATURE_FLEXCOMM5_SPI_INDEX (5) | ||
172 | /* @brief FLEXCOMM5 I2C INDEX 5 */ | ||
173 | #define FSL_FEATURE_FLEXCOMM5_I2C_INDEX (5) | ||
174 | /* @brief FLEXCOMM6 USART INDEX 6 */ | ||
175 | #define FSL_FEATURE_FLEXCOMM6_USART_INDEX (6) | ||
176 | /* @brief FLEXCOMM6 SPI INDEX 6 */ | ||
177 | #define FSL_FEATURE_FLEXCOMM6_SPI_INDEX (6) | ||
178 | /* @brief FLEXCOMM6 I2C INDEX 6 */ | ||
179 | #define FSL_FEATURE_FLEXCOMM6_I2C_INDEX (6) | ||
180 | /* @brief FLEXCOMM7 I2S INDEX 0 */ | ||
181 | #define FSL_FEATURE_FLEXCOMM6_I2S_INDEX (0) | ||
182 | /* @brief FLEXCOMM7 USART INDEX 7 */ | ||
183 | #define FSL_FEATURE_FLEXCOMM7_USART_INDEX (7) | ||
184 | /* @brief FLEXCOMM7 SPI INDEX 7 */ | ||
185 | #define FSL_FEATURE_FLEXCOMM7_SPI_INDEX (7) | ||
186 | /* @brief FLEXCOMM7 I2C INDEX 7 */ | ||
187 | #define FSL_FEATURE_FLEXCOMM7_I2C_INDEX (7) | ||
188 | /* @brief FLEXCOMM7 I2S INDEX 1 */ | ||
189 | #define FSL_FEATURE_FLEXCOMM7_I2S_INDEX (1) | ||
190 | /* @brief FLEXCOMM4 USART INDEX 8 */ | ||
191 | #define FSL_FEATURE_FLEXCOMM8_USART_INDEX (8) | ||
192 | /* @brief FLEXCOMM4 SPI INDEX 8 */ | ||
193 | #define FSL_FEATURE_FLEXCOMM8_SPI_INDEX (8) | ||
194 | /* @brief FLEXCOMM4 I2C INDEX 8 */ | ||
195 | #define FSL_FEATURE_FLEXCOMM8_I2C_INDEX (8) | ||
196 | /* @brief FLEXCOMM5 USART INDEX 9 */ | ||
197 | #define FSL_FEATURE_FLEXCOMM9_USART_INDEX (9) | ||
198 | /* @brief FLEXCOMM5 SPI INDEX 9 */ | ||
199 | #define FSL_FEATURE_FLEXCOMM9_SPI_INDEX (9) | ||
200 | /* @brief FLEXCOMM5 I2C INDEX 9 */ | ||
201 | #define FSL_FEATURE_FLEXCOMM9_I2C_INDEX (9) | ||
202 | /* @brief I2S has DMIC interconnection */ | ||
203 | #define FSL_FEATURE_FLEXCOMM_INSTANCE_I2S_HAS_DMIC_INTERCONNECTIONn(x) \ | ||
204 | (((x) == FLEXCOMM0) ? (0) : \ | ||
205 | (((x) == FLEXCOMM1) ? (0) : \ | ||
206 | (((x) == FLEXCOMM2) ? (0) : \ | ||
207 | (((x) == FLEXCOMM3) ? (0) : \ | ||
208 | (((x) == FLEXCOMM4) ? (0) : \ | ||
209 | (((x) == FLEXCOMM5) ? (0) : \ | ||
210 | (((x) == FLEXCOMM6) ? (0) : \ | ||
211 | (((x) == FLEXCOMM7) ? (1) : \ | ||
212 | (((x) == FLEXCOMM8) ? (0) : \ | ||
213 | (((x) == FLEXCOMM9) ? (0) : \ | ||
214 | (((x) == FLEXCOMM10) ? (0) : (-1)))))))))))) | ||
215 | |||
216 | /* I2S module features */ | ||
217 | |||
218 | /* @brief I2S support dual channel transfer */ | ||
219 | #define FSL_FEATURE_I2S_SUPPORT_SECONDARY_CHANNEL (1) | ||
220 | /* @brief I2S has DMIC interconnection */ | ||
221 | #define FSL_FEATURE_FLEXCOMM_I2S_HAS_DMIC_INTERCONNECTION (1) | ||
222 | |||
223 | /* IOCON module features */ | ||
224 | |||
225 | /* @brief Func bit field width */ | ||
226 | #define FSL_FEATURE_IOCON_FUNC_FIELD_WIDTH (4) | ||
227 | |||
228 | /* MRT module features */ | ||
229 | |||
230 | /* @brief number of channels. */ | ||
231 | #define FSL_FEATURE_MRT_NUMBER_OF_CHANNELS (4) | ||
232 | |||
233 | /* interrupt module features */ | ||
234 | |||
235 | /* @brief Lowest interrupt request number. */ | ||
236 | #define FSL_FEATURE_INTERRUPT_IRQ_MIN (-14) | ||
237 | /* @brief Highest interrupt request number. */ | ||
238 | #define FSL_FEATURE_INTERRUPT_IRQ_MAX (105) | ||
239 | |||
240 | /* PINT module features */ | ||
241 | |||
242 | /* @brief Number of connected outputs */ | ||
243 | #define FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS (8) | ||
244 | |||
245 | /* RIT module features */ | ||
246 | |||
247 | /* @brief RIT has no reset control */ | ||
248 | #define FSL_FEATURE_RIT_HAS_NO_RESET (1) | ||
249 | |||
250 | /* RTC module features */ | ||
251 | |||
252 | /* @brief RTC has no reset control */ | ||
253 | #define FSL_FEATURE_RTC_HAS_NO_RESET (1) | ||
254 | |||
255 | /* SCT module features */ | ||
256 | |||
257 | /* @brief Number of events */ | ||
258 | #define FSL_FEATURE_SCT_NUMBER_OF_EVENTS (16) | ||
259 | /* @brief Number of states */ | ||
260 | #define FSL_FEATURE_SCT_NUMBER_OF_STATES (16) | ||
261 | /* @brief Number of match capture */ | ||
262 | #define FSL_FEATURE_SCT_NUMBER_OF_MATCH_CAPTURE (16) | ||
263 | /* @brief Number of outputs */ | ||
264 | #define FSL_FEATURE_SCT_NUMBER_OF_OUTPUTS (10) | ||
265 | |||
266 | /* SDIF module features */ | ||
267 | |||
268 | /* @brief FIFO depth, every location is a WORD */ | ||
269 | #define FSL_FEATURE_SDIF_FIFO_DEPTH_64_32BITS (64) | ||
270 | /* @brief Max DMA buffer size */ | ||
271 | #define FSL_FEATURE_SDIF_INTERNAL_DMA_MAX_BUFFER_SIZE (4096) | ||
272 | /* @brief Max source clock in HZ */ | ||
273 | #define FSL_FEATURE_SDIF_MAX_SOURCE_CLOCK (52000000) | ||
274 | |||
275 | /* SHA module features */ | ||
276 | |||
277 | /* @brief Has dedicated DMA controller. */ | ||
278 | #define FSL_FEATURE_SHA_HAS_MEMADDR_DMA (1) | ||
279 | |||
280 | /* SPIFI module features */ | ||
281 | |||
282 | /* @brief SPIFI start address */ | ||
283 | #define FSL_FEATURE_SPIFI_START_ADDR (0x10000000) | ||
284 | /* @brief SPIFI end address */ | ||
285 | #define FSL_FEATURE_SPIFI_END_ADDR (0x17FFFFFF) | ||
286 | |||
287 | /* SYSCON module features */ | ||
288 | |||
289 | /* @brief Pointer to ROM IAP entry functions */ | ||
290 | #define FSL_FEATURE_SYSCON_IAP_ENTRY_LOCATION (0x03000205) | ||
291 | |||
292 | /* SysTick module features */ | ||
293 | |||
294 | /* @brief Systick has external reference clock. */ | ||
295 | #define FSL_FEATURE_SYSTICK_HAS_EXT_REF (0) | ||
296 | /* @brief Systick external reference clock is core clock divided by this value. */ | ||
297 | #define FSL_FEATURE_SYSTICK_EXT_REF_CORE_DIV (0) | ||
298 | |||
299 | /* USB module features */ | ||
300 | |||
301 | /* @brief Size of the USB dedicated RAM */ | ||
302 | #define FSL_FEATURE_USB_USB_RAM (0x00002000) | ||
303 | /* @brief Base address of the USB dedicated RAM */ | ||
304 | #define FSL_FEATURE_USB_USB_RAM_BASE_ADDRESS (0x40100000) | ||
305 | /* @brief USB version */ | ||
306 | #define FSL_FEATURE_USB_VERSION (200) | ||
307 | /* @brief Number of the endpoint in USB FS */ | ||
308 | #define FSL_FEATURE_USB_EP_NUM (5) | ||
309 | |||
310 | /* USBFSH module features */ | ||
311 | |||
312 | /* @brief Size of the USB dedicated RAM */ | ||
313 | #define FSL_FEATURE_USBFSH_USB_RAM (0x00002000) | ||
314 | /* @brief Base address of the USB dedicated RAM */ | ||
315 | #define FSL_FEATURE_USBFSH_USB_RAM_BASE_ADDRESS (0x40100000) | ||
316 | /* @brief USBFSH version */ | ||
317 | #define FSL_FEATURE_USBFSH_VERSION (200) | ||
318 | |||
319 | /* USBHSD module features */ | ||
320 | |||
321 | /* @brief Size of the USB dedicated RAM */ | ||
322 | #define FSL_FEATURE_USBHSD_USB_RAM (0x00002000) | ||
323 | /* @brief Base address of the USB dedicated RAM */ | ||
324 | #define FSL_FEATURE_USBHSD_USB_RAM_BASE_ADDRESS (0x40100000) | ||
325 | /* @brief USBHSD version */ | ||
326 | #define FSL_FEATURE_USBHSD_VERSION (300) | ||
327 | /* @brief Number of the endpoint in USB HS */ | ||
328 | #define FSL_FEATURE_USBHSD_EP_NUM (6) | ||
329 | /* @brief Resetting interrupt endpoint resets DATAx sequence to DATA.1 */ | ||
330 | #define FSL_FEATURE_USBHSD_INTERRUPT_DATAX_ISSUE_VERSION_CHECK (1) | ||
331 | |||
332 | /* USBHSH module features */ | ||
333 | |||
334 | /* @brief Size of the USB dedicated RAM */ | ||
335 | #define FSL_FEATURE_USBHSH_USB_RAM (0x00002000) | ||
336 | /* @brief Base address of the USB dedicated RAM */ | ||
337 | #define FSL_FEATURE_USBHSH_USB_RAM_BASE_ADDRESS (0x40100000) | ||
338 | /* @brief USBHSH version */ | ||
339 | #define FSL_FEATURE_USBHSH_VERSION (300) | ||
340 | |||
341 | #endif /* _LPC54005_FEATURES_H_ */ | ||
342 | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_MT25QL128.FLM b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_MT25QL128.FLM new file mode 100644 index 000000000..491f1a3a6 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_MT25QL128.FLM | |||
Binary files differ | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_MX25L12835FM2I.FLM b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_MX25L12835FM2I.FLM new file mode 100644 index 000000000..a09805964 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_MX25L12835FM2I.FLM | |||
Binary files differ | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_W25Q128JVFM.FLM b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_W25Q128JVFM.FLM new file mode 100644 index 000000000..b11cdfabe --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/arm/LPC540xx_W25Q128JVFM.FLM | |||
Binary files differ | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/driver_reset.cmake b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/driver_reset.cmake new file mode 100644 index 000000000..989530f6f --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/driver_reset.cmake | |||
@@ -0,0 +1,14 @@ | |||
1 | if(NOT DRIVER_RESET_INCLUDED) | ||
2 | |||
3 | set(DRIVER_RESET_INCLUDED true CACHE BOOL "driver_reset component is included.") | ||
4 | |||
5 | target_sources(${MCUX_SDK_PROJECT_NAME} PRIVATE | ||
6 | ) | ||
7 | |||
8 | target_include_directories(${MCUX_SDK_PROJECT_NAME} PRIVATE | ||
9 | ${CMAKE_CURRENT_LIST_DIR}/. | ||
10 | ) | ||
11 | |||
12 | |||
13 | |||
14 | endif() \ No newline at end of file | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_clock.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_clock.c new file mode 100644 index 000000000..1f4d3c062 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_clock.c | |||
@@ -0,0 +1,2817 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016 - 2019 , NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * | ||
7 | * SPDX-License-Identifier: BSD-3-Clause | ||
8 | */ | ||
9 | |||
10 | #include "fsl_clock.h" | ||
11 | #include "fsl_power.h" | ||
12 | /******************************************************************************* | ||
13 | * Definitions | ||
14 | ******************************************************************************/ | ||
15 | /* Component ID definition, used by tools. */ | ||
16 | #ifndef FSL_COMPONENT_ID | ||
17 | #define FSL_COMPONENT_ID "platform.drivers.clock" | ||
18 | #endif | ||
19 | #define NVALMAX (0x100U) | ||
20 | #define PVALMAX (0x20U) | ||
21 | #define MVALMAX (0x8000U) | ||
22 | |||
23 | #define USB_NVALMAX (0x4U) | ||
24 | #define USB_PVALMAX (0x8U) | ||
25 | #define USB_MVALMAX (0x100U) | ||
26 | |||
27 | #define PLL_MAX_N_DIV 0x100U | ||
28 | #define USB_PLL_MAX_N_DIV 0x100U | ||
29 | |||
30 | #define PLL_MDEC_VAL_P (0U) /*!< MDEC is in bits 16 downto 0 */ | ||
31 | #define PLL_MDEC_VAL_M (0x1FFFFUL << PLL_MDEC_VAL_P) /*!< NDEC is in bits 9 downto 0 */ | ||
32 | #define PLL_NDEC_VAL_P (0U) /*!< NDEC is in bits 9:0 */ | ||
33 | #define PLL_NDEC_VAL_M (0x3FFUL << PLL_NDEC_VAL_P) | ||
34 | #define PLL_PDEC_VAL_P (0U) /*!< PDEC is in bits 6:0 */ | ||
35 | #define PLL_PDEC_VAL_M (0x7FUL << PLL_PDEC_VAL_P) | ||
36 | |||
37 | #define PLL_MIN_CCO_FREQ_MHZ (275000000U) | ||
38 | #define PLL_MAX_CCO_FREQ_MHZ (550000000U) | ||
39 | #define PLL_LOWER_IN_LIMIT (4000U) /*!< Minimum PLL input rate */ | ||
40 | #define PLL_MIN_IN_SSMODE (2000000U) | ||
41 | #define PLL_MAX_IN_SSMODE (4000000U) | ||
42 | |||
43 | /*!< Middle of the range values for spread-spectrum */ | ||
44 | #define PLL_SSCG_MF_FREQ_VALUE 4U | ||
45 | #define PLL_SSCG_MC_COMP_VALUE 2U | ||
46 | #define PLL_SSCG_MR_DEPTH_VALUE 4U | ||
47 | #define PLL_SSCG_DITHER_VALUE 0U | ||
48 | |||
49 | /*!< USB PLL CCO MAX AND MIN FREQ */ | ||
50 | #define USB_PLL_MIN_CCO_FREQ_MHZ (156000000U) | ||
51 | #define USB_PLL_MAX_CCO_FREQ_MHZ (320000000U) | ||
52 | #define USB_PLL_LOWER_IN_LIMIT (1000000U) /*!< Minimum PLL input rate */ | ||
53 | |||
54 | #define USB_PLL_MSEL_VAL_P (0U) /*!< MSEL is in bits 7 downto 0 */ | ||
55 | #define USB_PLL_MSEL_VAL_M (0xFFU) | ||
56 | #define USB_PLL_PSEL_VAL_P (8U) /*!< PDEC is in bits 9:8 */ | ||
57 | #define USB_PLL_PSEL_VAL_M (0x3U) | ||
58 | #define USB_PLL_NSEL_VAL_P (10U) /*!< NDEC is in bits 11:10 */ | ||
59 | #define USB_PLL_NSEL_VAL_M (0x3U) | ||
60 | |||
61 | /*!< SWITCH USB POSTDIVIDER FOR REGITSER WRITING */ | ||
62 | #define SWITCH_USB_PSEL(x) \ | ||
63 | (((x) == 0x0U) ? 0x1U : ((x) == 0x1U) ? 0x02U : ((x) == 0x2U) ? 0x4U : ((x) == 3U) ? 0x8U : 0U) | ||
64 | |||
65 | /*!< SYS PLL NDEC reg */ | ||
66 | #define PLL_NDEC_VAL_SET(value) (((unsigned long)(value) << PLL_NDEC_VAL_P) & PLL_NDEC_VAL_M) | ||
67 | /*!< SYS PLL PDEC reg */ | ||
68 | #define PLL_PDEC_VAL_SET(value) (((unsigned long)(value) << PLL_PDEC_VAL_P) & PLL_PDEC_VAL_M) | ||
69 | /*!< SYS PLL MDEC reg */ | ||
70 | #define PLL_MDEC_VAL_SET(value) (((unsigned long)(value) << PLL_MDEC_VAL_P) & PLL_MDEC_VAL_M) | ||
71 | |||
72 | /*!< SYS PLL NSEL reg */ | ||
73 | #define USB_PLL_NSEL_VAL_SET(value) (((unsigned long)(value)&USB_PLL_NSEL_VAL_M) << USB_PLL_NSEL_VAL_P) | ||
74 | /*!< SYS PLL PSEL reg */ | ||
75 | #define USB_PLL_PSEL_VAL_SET(value) (((unsigned long)(value)&USB_PLL_PSEL_VAL_M) << USB_PLL_PSEL_VAL_P) | ||
76 | /*!< SYS PLL MSEL reg */ | ||
77 | #define USB_PLL_MSEL_VAL_SET(value) (((unsigned long)(value)&USB_PLL_MSEL_VAL_M) << USB_PLL_MSEL_VAL_P) | ||
78 | |||
79 | /*!< FRAC control */ | ||
80 | #define AUDIO_PLL_FRACT_MD_P (0U) | ||
81 | #define AUDIO_PLL_FRACT_MD_INT_P (15U) | ||
82 | #define AUDIO_PLL_FRACT_MD_M (0x7FFFUL << AUDIO_PLL_FRACT_MD_P) | ||
83 | #define AUDIO_PLL_FRACT_MD_INT_M (0x7FUL << AUDIO_PLL_FRACT_MD_INT_P) | ||
84 | |||
85 | #define AUDIO_PLL_MD_FRACT_SET(value) (((unsigned long)(value) << AUDIO_PLL_FRACT_MD_P) & PLL_FRAC_MD_FRACT_M) | ||
86 | #define AUDIO_PLL_MD_INT_SET(value) (((unsigned long)(value) << AUDIO_PLL_FRACT_MD_INT_P) & AUDIO_PLL_FRACT_MD_INT_M) | ||
87 | |||
88 | /* Saved value of PLL output rate, computed whenever needed to save run-time | ||
89 | computation on each call to retrive the PLL rate. */ | ||
90 | static uint32_t s_Pll_Freq; | ||
91 | static uint32_t s_Usb_Pll_Freq; | ||
92 | static uint32_t s_Audio_Pll_Freq; | ||
93 | |||
94 | /** External clock rate on the CLKIN pin in Hz. If not used, | ||
95 | set this to 0. Otherwise, set it to the exact rate in Hz this pin is | ||
96 | being driven at. */ | ||
97 | static const uint32_t g_I2S_Mclk_Freq = 0U; | ||
98 | static const uint32_t g_Ext_Clk_Freq = 12000000U; | ||
99 | static const uint32_t g_Lcd_Clk_In_Freq = 0U; | ||
100 | |||
101 | /******************************************************************************* | ||
102 | * Variables | ||
103 | ******************************************************************************/ | ||
104 | |||
105 | /******************************************************************************* | ||
106 | * Prototypes | ||
107 | ******************************************************************************/ | ||
108 | /* Find encoded NDEC value for raw N value, max N = NVALMAX */ | ||
109 | static uint32_t pllEncodeN(uint32_t N); | ||
110 | /* Find decoded N value for raw NDEC value */ | ||
111 | static uint32_t pllDecodeN(uint32_t NDEC); | ||
112 | /* Find encoded PDEC value for raw P value, max P = PVALMAX */ | ||
113 | static uint32_t pllEncodeP(uint32_t P); | ||
114 | /* Find decoded P value for raw PDEC value */ | ||
115 | static uint32_t pllDecodeP(uint32_t PDEC); | ||
116 | /* Find encoded MDEC value for raw M value, max M = MVALMAX */ | ||
117 | static uint32_t pllEncodeM(uint32_t M); | ||
118 | /* Find decoded M value for raw MDEC value */ | ||
119 | static uint32_t pllDecodeM(uint32_t MDEC); | ||
120 | /* Find SELP, SELI, and SELR values for raw M value, max M = MVALMAX */ | ||
121 | static void pllFindSel(uint32_t M, uint32_t *pSelP, uint32_t *pSelI, uint32_t *pSelR); | ||
122 | /* Get predivider (N) from PLL NDEC setting */ | ||
123 | static uint32_t findPllPreDiv(uint32_t ctrlReg, uint32_t nDecReg); | ||
124 | /* Get postdivider (P) from PLL PDEC setting */ | ||
125 | static uint32_t findPllPostDiv(uint32_t ctrlReg, uint32_t pDecReg); | ||
126 | /* Get multiplier (M) from PLL MDEC and BYPASS_FBDIV2 settings */ | ||
127 | static uint32_t findPllMMult(uint32_t ctrlReg, uint32_t mDecReg); | ||
128 | /* Convert the binary to fractional part */ | ||
129 | static double Binary2Fractional(uint32_t binaryPart); | ||
130 | /* Calculate the powerTimes' power of 2 */ | ||
131 | static uint32_t power2Cal(uint32_t powerTimes); | ||
132 | /* Get the greatest common divisor */ | ||
133 | static uint32_t FindGreatestCommonDivisor(uint32_t m, uint32_t n); | ||
134 | /* Set PLL output based on desired output rate */ | ||
135 | static pll_error_t CLOCK_GetPllConfig(uint32_t finHz, uint32_t foutHz, pll_setup_t *pSetup); | ||
136 | |||
137 | /* Update local PLL rate variable */ | ||
138 | static void CLOCK_GetSystemPLLOutFromSetupUpdate(pll_setup_t *pSetup); | ||
139 | static void CLOCK_GetAudioPLLOutFromSetupUpdate(pll_setup_t *pSetup); | ||
140 | /*! | ||
141 | * @brief Set fro clock frequency. | ||
142 | * Due to LPC540xx 0A silicon and LPC540xx 1B silicon have different ROM addresses for set fro | ||
143 | * frequency api, so add this api to get rom version. | ||
144 | * @param base romVersion pointer to recieve rom version. | ||
145 | */ | ||
146 | #if defined(FSL_FROHF_SETTING_API_ADDRESS_DETERMINE_BY_ROM_VERSION) && \ | ||
147 | (FSL_FROHF_SETTING_API_ADDRESS_DETERMINE_BY_ROM_VERSION) | ||
148 | static uint32_t CLOCK_GetRomVersion(uint8_t *romVersion); | ||
149 | #endif | ||
150 | static const uint8_t wdtFreqLookup[32] = {0, 8, 12, 15, 18, 20, 24, 26, 28, 30, 32, 34, 36, 38, 40, 41, | ||
151 | 42, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56, 57, 58, 59, 60, 61}; | ||
152 | /******************************************************************************* | ||
153 | * Code | ||
154 | ******************************************************************************/ | ||
155 | #if defined(FSL_FROHF_SETTING_API_ADDRESS_DETERMINE_BY_ROM_VERSION) && \ | ||
156 | (FSL_FROHF_SETTING_API_ADDRESS_DETERMINE_BY_ROM_VERSION) | ||
157 | static uint32_t CLOCK_GetRomVersion(uint8_t *romVersion) | ||
158 | { | ||
159 | uint32_t command[5] = {0U}, result[4] = {0U}; | ||
160 | |||
161 | command[0] = 55U; | ||
162 | result[0] = 0; | ||
163 | result[1] = 0; | ||
164 | ((void (*)(uint32_t cmd[5], uint32_t stat[4]))FSL_FEATURE_SYSCON_IAP_ENTRY_LOCATION)(command, result); | ||
165 | |||
166 | *romVersion = (uint8_t)(result[1]); | ||
167 | |||
168 | return result[0]; | ||
169 | } | ||
170 | #endif | ||
171 | |||
172 | /** | ||
173 | * brief | ||
174 | * Initialize the Core clock to given frequency (12, 48 or 96 MHz), this API is implememnt in ROM code. | ||
175 | * Turns on FRO and uses default CCO, if freq is 12000000, then high speed output is off, else high speed | ||
176 | * output is enabled. | ||
177 | * Usage: CLOCK_SetupFROClocking(frequency), (frequency must be one of 12, 48 or 96 MHz) | ||
178 | * Note: Need to make sure ROM and OTP has power(PDRUNCFG0[17,29]= 0U) before calling this API since this API is | ||
179 | * implemented in ROM code and the FROHF TRIM value is stored in OTP | ||
180 | * | ||
181 | * param froFreq target fro frequency. | ||
182 | * return Nothing | ||
183 | */ | ||
184 | |||
185 | void CLOCK_SetupFROClocking(uint32_t froFreq) | ||
186 | { | ||
187 | uint32_t froRomAddr = 0U; | ||
188 | #if defined(FSL_FROHF_SETTING_API_ADDRESS_DETERMINE_BY_ROM_VERSION) && \ | ||
189 | (FSL_FROHF_SETTING_API_ADDRESS_DETERMINE_BY_ROM_VERSION) | ||
190 | uint8_t romVersion = 0U; | ||
191 | |||
192 | if (CLOCK_GetRomVersion(&romVersion) == (uint32_t)kStatus_Success) | ||
193 | { | ||
194 | if (romVersion == FSL_ROM_VERSION_1B) | ||
195 | { | ||
196 | froRomAddr = FSL_ROM_VERSION_1B_FRO_SETTING_ADDR; | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | froRomAddr = FSL_ROM_VERSION_0A_FRO_SETTING_ADDR; | ||
201 | } | ||
202 | |||
203 | (*((void (*)(uint32_t funcname))(froRomAddr)))(froFreq); | ||
204 | } | ||
205 | #else | ||
206 | froRomAddr = FSL_ROM_VERSION_0A_FRO_SETTING_ADDR; | ||
207 | |||
208 | (*((void (*)(uint32_t))(froRomAddr)))(froFreq); | ||
209 | #endif | ||
210 | } | ||
211 | |||
212 | /* Clock Selection for IP */ | ||
213 | /** | ||
214 | * brief Configure the clock selection muxes. | ||
215 | * param connection : Clock to be configured. | ||
216 | * return Nothing | ||
217 | */ | ||
218 | void CLOCK_AttachClk(clock_attach_id_t connection) | ||
219 | { | ||
220 | uint8_t mux; | ||
221 | uint8_t sel; | ||
222 | uint16_t item; | ||
223 | uint32_t tmp32 = (uint32_t)connection; | ||
224 | uint32_t i; | ||
225 | volatile uint32_t *pClkSel; | ||
226 | |||
227 | pClkSel = &(SYSCON->STICKCLKSEL); | ||
228 | |||
229 | if (kNONE_to_NONE != connection) | ||
230 | { | ||
231 | for (i = 0U; i < 2U; i++) | ||
232 | { | ||
233 | if (tmp32 == 0U) | ||
234 | { | ||
235 | break; | ||
236 | } | ||
237 | item = (uint16_t)GET_ID_ITEM(tmp32); | ||
238 | if (item != 0UL) | ||
239 | { | ||
240 | mux = GET_ID_ITEM_MUX(item); | ||
241 | sel = GET_ID_ITEM_SEL(item); | ||
242 | if (mux == CM_ASYNCAPB) | ||
243 | { | ||
244 | SYSCON->ASYNCAPBCTRL = SYSCON_ASYNCAPBCTRL_ENABLE(1); | ||
245 | ASYNC_SYSCON->ASYNCAPBCLKSELA = sel; | ||
246 | } | ||
247 | else | ||
248 | { | ||
249 | ((volatile uint32_t *)pClkSel)[mux] = sel; | ||
250 | } | ||
251 | } | ||
252 | tmp32 = GET_ID_NEXT_ITEM(tmp32); /* pick up next descriptor */ | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | |||
257 | /* Return the actual clock attach id */ | ||
258 | /** | ||
259 | * brief Get the actual clock attach id. | ||
260 | * This fuction uses the offset in input attach id, then it reads the actual source value in | ||
261 | * the register and combine the offset to obtain an actual attach id. | ||
262 | * param attachId : Clock attach id to get. | ||
263 | * return Clock source value. | ||
264 | */ | ||
265 | clock_attach_id_t CLOCK_GetClockAttachId(clock_attach_id_t attachId) | ||
266 | { | ||
267 | uint8_t mux; | ||
268 | uint8_t actualSel; | ||
269 | uint32_t tmp32 = (uint32_t)attachId; | ||
270 | uint32_t i; | ||
271 | uint32_t actualAttachId = 0U; | ||
272 | uint32_t selector = GET_ID_SELECTOR(tmp32); | ||
273 | volatile uint32_t *pClkSel; | ||
274 | |||
275 | pClkSel = &(SYSCON->STICKCLKSEL); | ||
276 | |||
277 | if (kNONE_to_NONE == attachId) | ||
278 | { | ||
279 | return kNONE_to_NONE; | ||
280 | } | ||
281 | |||
282 | for (i = 0U; i < 2U; i++) | ||
283 | { | ||
284 | mux = GET_ID_ITEM_MUX(tmp32); | ||
285 | if (tmp32 != 0UL) | ||
286 | { | ||
287 | if (mux == CM_ASYNCAPB) | ||
288 | { | ||
289 | actualSel = (uint8_t)(ASYNC_SYSCON->ASYNCAPBCLKSELA); | ||
290 | } | ||
291 | else | ||
292 | { | ||
293 | actualSel = (uint8_t)(((volatile uint32_t *)pClkSel)[mux]); | ||
294 | } | ||
295 | |||
296 | /* Consider the combination of two registers */ | ||
297 | actualAttachId |= CLK_ATTACH_ID(mux, actualSel, i); | ||
298 | } | ||
299 | tmp32 = GET_ID_NEXT_ITEM(tmp32); /*!< pick up next descriptor */ | ||
300 | } | ||
301 | |||
302 | actualAttachId |= selector; | ||
303 | |||
304 | return (clock_attach_id_t)actualAttachId; | ||
305 | } | ||
306 | |||
307 | /* Set IP Clock Divider */ | ||
308 | /** | ||
309 | * brief Setup peripheral clock dividers. | ||
310 | * param div_name : Clock divider name | ||
311 | * param divided_by_value: Value to be divided | ||
312 | * param reset : Whether to reset the divider counter. | ||
313 | * return Nothing | ||
314 | */ | ||
315 | void CLOCK_SetClkDiv(clock_div_name_t div_name, uint32_t divided_by_value, bool reset) | ||
316 | { | ||
317 | volatile uint32_t *pClkDiv; | ||
318 | |||
319 | pClkDiv = &(SYSCON->SYSTICKCLKDIV); | ||
320 | if (reset) | ||
321 | { | ||
322 | ((volatile uint32_t *)pClkDiv)[(uint8_t)div_name] = 1UL << 29U; | ||
323 | } | ||
324 | if (divided_by_value == 0U) /*!< halt */ | ||
325 | { | ||
326 | ((volatile uint32_t *)pClkDiv)[(uint8_t)div_name] = 1UL << 30U; | ||
327 | } | ||
328 | else | ||
329 | { | ||
330 | ((volatile uint32_t *)pClkDiv)[(uint8_t)div_name] = (divided_by_value - 1U); | ||
331 | } | ||
332 | } | ||
333 | |||
334 | /* Get CLOCK OUT Clk */ | ||
335 | /*! brief Return Frequency of ClockOut | ||
336 | * return Frequency of ClockOut | ||
337 | */ | ||
338 | uint32_t CLOCK_GetClockOutClkFreq(void) | ||
339 | { | ||
340 | uint32_t freq = 0U; | ||
341 | |||
342 | switch (SYSCON->CLKOUTSELA) | ||
343 | { | ||
344 | case 0U: | ||
345 | freq = CLOCK_GetCoreSysClkFreq(); | ||
346 | break; | ||
347 | |||
348 | case 1U: | ||
349 | freq = CLOCK_GetExtClkFreq(); | ||
350 | break; | ||
351 | |||
352 | case 2U: | ||
353 | freq = CLOCK_GetWdtOscFreq(); | ||
354 | break; | ||
355 | |||
356 | case 3U: | ||
357 | freq = CLOCK_GetFroHfFreq(); | ||
358 | break; | ||
359 | |||
360 | case 4U: | ||
361 | freq = CLOCK_GetPllOutFreq(); | ||
362 | break; | ||
363 | |||
364 | case 5U: | ||
365 | freq = CLOCK_GetUsbPllOutFreq(); | ||
366 | break; | ||
367 | |||
368 | case 6U: | ||
369 | freq = CLOCK_GetAudioPllOutFreq(); | ||
370 | break; | ||
371 | |||
372 | case 7U: | ||
373 | freq = CLOCK_GetOsc32KFreq(); | ||
374 | break; | ||
375 | |||
376 | default: | ||
377 | freq = 0U; | ||
378 | break; | ||
379 | } | ||
380 | return freq / ((SYSCON->CLKOUTDIV & 0xffU) + 1U); | ||
381 | } | ||
382 | |||
383 | /* Get SPIFI Clk */ | ||
384 | /*! brief Return Frequency of Spifi Clock | ||
385 | * return Frequency of Spifi. | ||
386 | */ | ||
387 | uint32_t CLOCK_GetSpifiClkFreq(void) | ||
388 | { | ||
389 | uint32_t freq = 0U; | ||
390 | |||
391 | switch (SYSCON->SPIFICLKSEL) | ||
392 | { | ||
393 | case 0U: | ||
394 | freq = CLOCK_GetCoreSysClkFreq(); | ||
395 | break; | ||
396 | case 1U: | ||
397 | freq = CLOCK_GetPllOutFreq(); | ||
398 | break; | ||
399 | case 2U: | ||
400 | freq = CLOCK_GetUsbPllOutFreq(); | ||
401 | break; | ||
402 | case 3U: | ||
403 | freq = CLOCK_GetFroHfFreq(); | ||
404 | break; | ||
405 | case 4U: | ||
406 | freq = CLOCK_GetAudioPllOutFreq(); | ||
407 | break; | ||
408 | case 7U: | ||
409 | freq = 0U; | ||
410 | break; | ||
411 | default: | ||
412 | freq = 0U; | ||
413 | break; | ||
414 | } | ||
415 | |||
416 | return freq / ((SYSCON->SPIFICLKDIV & 0xffU) + 1U); | ||
417 | } | ||
418 | |||
419 | /* Get ADC Clk */ | ||
420 | /*! brief Return Frequency of Adc Clock | ||
421 | * return Frequency of Adc Clock. | ||
422 | */ | ||
423 | uint32_t CLOCK_GetAdcClkFreq(void) | ||
424 | { | ||
425 | uint32_t freq = 0U; | ||
426 | |||
427 | switch (SYSCON->ADCCLKSEL) | ||
428 | { | ||
429 | case 0U: | ||
430 | freq = CLOCK_GetFroHfFreq(); | ||
431 | break; | ||
432 | case 1U: | ||
433 | freq = CLOCK_GetPllOutFreq(); | ||
434 | break; | ||
435 | case 2U: | ||
436 | freq = CLOCK_GetUsbPllOutFreq(); | ||
437 | break; | ||
438 | case 3U: | ||
439 | freq = CLOCK_GetAudioPllOutFreq(); | ||
440 | break; | ||
441 | case 7U: | ||
442 | freq = 0U; | ||
443 | break; | ||
444 | default: | ||
445 | freq = 0U; | ||
446 | break; | ||
447 | } | ||
448 | |||
449 | return freq / ((SYSCON->ADCCLKDIV & 0xffU) + 1U); | ||
450 | } | ||
451 | |||
452 | /* Get USB0 Clk */ | ||
453 | /*! brief Return Frequency of Usb0 Clock | ||
454 | * return Frequency of Usb0 Clock. | ||
455 | */ | ||
456 | uint32_t CLOCK_GetUsb0ClkFreq(void) | ||
457 | { | ||
458 | uint32_t freq = 0U; | ||
459 | |||
460 | switch (SYSCON->USB0CLKSEL) | ||
461 | { | ||
462 | case 0U: | ||
463 | freq = CLOCK_GetFroHfFreq(); | ||
464 | break; | ||
465 | case 1U: | ||
466 | freq = CLOCK_GetPllOutFreq(); | ||
467 | break; | ||
468 | case 2U: | ||
469 | freq = CLOCK_GetUsbPllOutFreq(); | ||
470 | break; | ||
471 | case 7U: | ||
472 | freq = 0U; | ||
473 | break; | ||
474 | |||
475 | default: | ||
476 | freq = 0U; | ||
477 | break; | ||
478 | } | ||
479 | |||
480 | return freq / ((SYSCON->USB0CLKDIV & 0xffU) + 1U); | ||
481 | } | ||
482 | |||
483 | /* Get USB1 Clk */ | ||
484 | /*! brief Return Frequency of Usb1 Clock | ||
485 | * return Frequency of Usb1 Clock. | ||
486 | */ | ||
487 | uint32_t CLOCK_GetUsb1ClkFreq(void) | ||
488 | { | ||
489 | uint32_t freq = 0U; | ||
490 | |||
491 | switch (SYSCON->USB1CLKSEL) | ||
492 | { | ||
493 | case 0U: | ||
494 | freq = CLOCK_GetCoreSysClkFreq(); | ||
495 | break; | ||
496 | case 1U: | ||
497 | freq = CLOCK_GetPllOutFreq(); | ||
498 | break; | ||
499 | case 2U: | ||
500 | freq = CLOCK_GetUsbPllOutFreq(); | ||
501 | break; | ||
502 | case 7U: | ||
503 | freq = 0U; | ||
504 | break; | ||
505 | |||
506 | default: | ||
507 | freq = 0U; | ||
508 | break; | ||
509 | } | ||
510 | |||
511 | return freq / ((SYSCON->USB1CLKDIV & 0xffU) + 1U); | ||
512 | } | ||
513 | |||
514 | /* Get MCLK Clk */ | ||
515 | /*! brief Return Frequency of MClk Clock | ||
516 | * return Frequency of MClk Clock. | ||
517 | */ | ||
518 | uint32_t CLOCK_GetMclkClkFreq(void) | ||
519 | { | ||
520 | uint32_t freq = 0U; | ||
521 | |||
522 | switch (SYSCON->MCLKCLKSEL) | ||
523 | { | ||
524 | case 0U: | ||
525 | freq = CLOCK_GetFroHfFreq() / ((SYSCON->FROHFDIV & 0xffu) + 1U); | ||
526 | break; | ||
527 | case 1U: | ||
528 | freq = CLOCK_GetAudioPllOutFreq(); | ||
529 | break; | ||
530 | case 7U: | ||
531 | freq = 0U; | ||
532 | break; | ||
533 | |||
534 | default: | ||
535 | freq = 0U; | ||
536 | break; | ||
537 | } | ||
538 | |||
539 | return freq / ((SYSCON->MCLKDIV & 0xffU) + 1U); | ||
540 | } | ||
541 | |||
542 | /* Get SCTIMER Clk */ | ||
543 | /*! brief Return Frequency of SCTimer Clock | ||
544 | * return Frequency of SCTimer Clock. | ||
545 | */ | ||
546 | uint32_t CLOCK_GetSctClkFreq(void) | ||
547 | { | ||
548 | uint32_t freq = 0U; | ||
549 | |||
550 | switch (SYSCON->SCTCLKSEL) | ||
551 | { | ||
552 | case 0U: | ||
553 | freq = CLOCK_GetCoreSysClkFreq(); | ||
554 | break; | ||
555 | case 1U: | ||
556 | freq = CLOCK_GetPllOutFreq(); | ||
557 | break; | ||
558 | case 2U: | ||
559 | freq = CLOCK_GetFroHfFreq(); | ||
560 | break; | ||
561 | case 3U: | ||
562 | freq = CLOCK_GetAudioPllOutFreq(); | ||
563 | break; | ||
564 | case 7U: | ||
565 | freq = 0U; | ||
566 | break; | ||
567 | |||
568 | default: | ||
569 | freq = 0U; | ||
570 | break; | ||
571 | } | ||
572 | |||
573 | return freq / ((SYSCON->SCTCLKDIV & 0xffU) + 1U); | ||
574 | } | ||
575 | |||
576 | /* Get SDIO Clk */ | ||
577 | /*! brief Return Frequency of SDIO Clock | ||
578 | * return Frequency of SDIO Clock. | ||
579 | */ | ||
580 | uint32_t CLOCK_GetSdioClkFreq(void) | ||
581 | { | ||
582 | uint32_t freq = 0U; | ||
583 | |||
584 | switch (SYSCON->SDIOCLKSEL) | ||
585 | { | ||
586 | case 0U: | ||
587 | freq = CLOCK_GetCoreSysClkFreq(); | ||
588 | break; | ||
589 | case 1U: | ||
590 | freq = CLOCK_GetPllOutFreq(); | ||
591 | break; | ||
592 | case 2U: | ||
593 | freq = CLOCK_GetUsbPllOutFreq(); | ||
594 | break; | ||
595 | case 3U: | ||
596 | freq = CLOCK_GetFroHfFreq(); | ||
597 | break; | ||
598 | case 4U: | ||
599 | freq = CLOCK_GetAudioPllOutFreq(); | ||
600 | break; | ||
601 | case 7U: | ||
602 | freq = 0U; | ||
603 | break; | ||
604 | default: | ||
605 | freq = 0U; | ||
606 | break; | ||
607 | } | ||
608 | |||
609 | return freq / ((SYSCON->SDIOCLKDIV & 0xffU) + 1U); | ||
610 | } | ||
611 | |||
612 | /* Get LCD Clk */ | ||
613 | /*! brief Return Frequency of LCD Clock | ||
614 | * return Frequency of LCD Clock. | ||
615 | */ | ||
616 | uint32_t CLOCK_GetLcdClkFreq(void) | ||
617 | { | ||
618 | uint32_t freq = 0U; | ||
619 | |||
620 | switch (SYSCON->LCDCLKSEL) | ||
621 | { | ||
622 | case 0U: | ||
623 | freq = CLOCK_GetCoreSysClkFreq(); | ||
624 | break; | ||
625 | case 1U: | ||
626 | freq = CLOCK_GetLcdClkIn(); | ||
627 | break; | ||
628 | case 2U: | ||
629 | freq = CLOCK_GetFroHfFreq(); | ||
630 | break; | ||
631 | case 3U: | ||
632 | freq = 0U; | ||
633 | break; | ||
634 | |||
635 | default: | ||
636 | freq = 0U; | ||
637 | break; | ||
638 | } | ||
639 | |||
640 | return freq / ((SYSCON->LCDCLKDIV & 0xffU) + 1U); | ||
641 | } | ||
642 | |||
643 | /* Get LCD CLK IN Clk */ | ||
644 | /*! brief Return Frequency of LCD CLKIN Clock | ||
645 | * return Frequency of LCD CLKIN Clock. | ||
646 | */ | ||
647 | uint32_t CLOCK_GetLcdClkIn(void) | ||
648 | { | ||
649 | return g_Lcd_Clk_In_Freq; | ||
650 | } | ||
651 | |||
652 | /* Get FRO 12M Clk */ | ||
653 | /*! brief Return Frequency of FRO 12MHz | ||
654 | * return Frequency of FRO 12MHz | ||
655 | */ | ||
656 | uint32_t CLOCK_GetFro12MFreq(void) | ||
657 | { | ||
658 | return ((SYSCON->PDRUNCFG[0] & SYSCON_PDRUNCFG_PDEN_FRO_MASK) != 0UL) ? 0U : 12000000U; | ||
659 | } | ||
660 | |||
661 | /* Get EXT OSC Clk */ | ||
662 | /*! brief Return Frequency of External Clock | ||
663 | * return Frequency of External Clock. If no external clock is used returns 0. | ||
664 | */ | ||
665 | uint32_t CLOCK_GetExtClkFreq(void) | ||
666 | { | ||
667 | return g_Ext_Clk_Freq; | ||
668 | } | ||
669 | |||
670 | /* Get WATCH DOG Clk */ | ||
671 | /*! brief Return Frequency of Watchdog Oscillator | ||
672 | * return Frequency of Watchdog Oscillator | ||
673 | */ | ||
674 | uint32_t CLOCK_GetWdtOscFreq(void) | ||
675 | { | ||
676 | uint8_t freq_sel, div_sel; | ||
677 | if ((SYSCON->PDRUNCFG[0] & SYSCON_PDRUNCFG_PDEN_WDT_OSC_MASK) != 0UL) | ||
678 | { | ||
679 | return 0U; | ||
680 | } | ||
681 | else | ||
682 | { | ||
683 | div_sel = (uint8_t)(((SYSCON->WDTOSCCTRL & 0x1fU) + 1U) << 1U); | ||
684 | freq_sel = | ||
685 | wdtFreqLookup[((SYSCON->WDTOSCCTRL & SYSCON_WDTOSCCTRL_FREQSEL_MASK) >> SYSCON_WDTOSCCTRL_FREQSEL_SHIFT)]; | ||
686 | return ((uint32_t)freq_sel * 50000U) / ((uint32_t)div_sel); | ||
687 | } | ||
688 | } | ||
689 | |||
690 | /* Get HF FRO Clk */ | ||
691 | /*! brief Return Frequency of High-Freq output of FRO | ||
692 | * return Frequency of High-Freq output of FRO | ||
693 | */ | ||
694 | uint32_t CLOCK_GetFroHfFreq(void) | ||
695 | { | ||
696 | if (((SYSCON->PDRUNCFG[0] & SYSCON_PDRUNCFG_PDEN_FRO_MASK) != 0UL) || | ||
697 | (0UL == (SYSCON->FROCTRL & SYSCON_FROCTRL_HSPDCLK_MASK))) | ||
698 | { | ||
699 | return 0U; | ||
700 | } | ||
701 | |||
702 | if ((SYSCON->FROCTRL & SYSCON_FROCTRL_SEL_MASK) != 0UL) | ||
703 | { | ||
704 | return 96000000U; | ||
705 | } | ||
706 | else | ||
707 | { | ||
708 | return 48000000U; | ||
709 | } | ||
710 | } | ||
711 | |||
712 | /* Get SYSTEM PLL Clk */ | ||
713 | /*! brief Return Frequency of PLL | ||
714 | * return Frequency of PLL | ||
715 | */ | ||
716 | uint32_t CLOCK_GetPllOutFreq(void) | ||
717 | { | ||
718 | return s_Pll_Freq; | ||
719 | } | ||
720 | |||
721 | /* Get AUDIO PLL Clk */ | ||
722 | /*! brief Return Frequency of AUDIO PLL | ||
723 | * return Frequency of PLL | ||
724 | */ | ||
725 | uint32_t CLOCK_GetAudioPllOutFreq(void) | ||
726 | { | ||
727 | return s_Audio_Pll_Freq; | ||
728 | } | ||
729 | |||
730 | /* Get USB PLL Clk */ | ||
731 | /*! brief Return Frequency of USB PLL | ||
732 | * return Frequency of PLL | ||
733 | */ | ||
734 | uint32_t CLOCK_GetUsbPllOutFreq(void) | ||
735 | { | ||
736 | return s_Usb_Pll_Freq; | ||
737 | } | ||
738 | |||
739 | /* Get RTC OSC Clk */ | ||
740 | /*! brief Return Frequency of 32kHz osc | ||
741 | * return Frequency of 32kHz osc | ||
742 | */ | ||
743 | uint32_t CLOCK_GetOsc32KFreq(void) | ||
744 | { | ||
745 | return CLK_RTC_32K_CLK; /* Needs to be corrected to check that RTC Clock is enabled */ | ||
746 | } | ||
747 | |||
748 | /* Get MAIN Clk */ | ||
749 | /*! brief Return Frequency of Core System | ||
750 | * return Frequency of Core System | ||
751 | */ | ||
752 | uint32_t CLOCK_GetCoreSysClkFreq(void) | ||
753 | { | ||
754 | uint32_t freq = 0U; | ||
755 | |||
756 | switch (SYSCON->MAINCLKSELB) | ||
757 | { | ||
758 | case 0U: | ||
759 | if (SYSCON->MAINCLKSELA == 0U) | ||
760 | { | ||
761 | freq = CLOCK_GetFro12MFreq(); | ||
762 | } | ||
763 | else if (SYSCON->MAINCLKSELA == 1U) | ||
764 | { | ||
765 | freq = CLOCK_GetExtClkFreq(); | ||
766 | } | ||
767 | else if (SYSCON->MAINCLKSELA == 2U) | ||
768 | { | ||
769 | freq = CLOCK_GetWdtOscFreq(); | ||
770 | } | ||
771 | else if (SYSCON->MAINCLKSELA == 3U) | ||
772 | { | ||
773 | freq = CLOCK_GetFroHfFreq(); | ||
774 | } | ||
775 | else | ||
776 | { | ||
777 | /* Add comment to prevent the case of rule 15.7. */ | ||
778 | } | ||
779 | break; | ||
780 | case 2U: | ||
781 | freq = CLOCK_GetPllOutFreq(); | ||
782 | break; | ||
783 | |||
784 | case 3U: | ||
785 | freq = CLOCK_GetOsc32KFreq(); | ||
786 | break; | ||
787 | |||
788 | default: | ||
789 | freq = 0U; | ||
790 | break; | ||
791 | } | ||
792 | |||
793 | return freq; | ||
794 | } | ||
795 | |||
796 | /* Get I2S MCLK Clk */ | ||
797 | /*! brief Return Frequency of I2S MCLK Clock | ||
798 | * return Frequency of I2S MCLK Clock | ||
799 | */ | ||
800 | uint32_t CLOCK_GetI2SMClkFreq(void) | ||
801 | { | ||
802 | return g_I2S_Mclk_Freq; | ||
803 | } | ||
804 | |||
805 | /* Get ASYNC APB Clk */ | ||
806 | /*! brief Return Frequency of Asynchronous APB Clock | ||
807 | * return Frequency of Asynchronous APB Clock Clock | ||
808 | */ | ||
809 | uint32_t CLOCK_GetAsyncApbClkFreq(void) | ||
810 | { | ||
811 | async_clock_src_t clkSrc; | ||
812 | uint32_t clkRate; | ||
813 | |||
814 | clkSrc = CLOCK_GetAsyncApbClkSrc(); | ||
815 | |||
816 | switch (clkSrc) | ||
817 | { | ||
818 | case kCLOCK_AsyncMainClk: | ||
819 | clkRate = CLOCK_GetCoreSysClkFreq(); | ||
820 | break; | ||
821 | case kCLOCK_AsyncFro12Mhz: | ||
822 | clkRate = CLK_FRO_12MHZ; | ||
823 | break; | ||
824 | default: | ||
825 | clkRate = 0U; | ||
826 | break; | ||
827 | } | ||
828 | |||
829 | return clkRate; | ||
830 | } | ||
831 | |||
832 | /* Get MCAN Clk */ | ||
833 | /*! brief Return Frequency of MCAN Clock | ||
834 | * param MCanSel : 0U: MCAN0; 1U: MCAN1 | ||
835 | * return Frequency of MCAN Clock | ||
836 | */ | ||
837 | uint32_t CLOCK_GetMCanClkFreq(uint32_t MCanSel) | ||
838 | { | ||
839 | uint32_t freq = 0U; | ||
840 | switch (MCanSel) | ||
841 | { | ||
842 | case 0U: | ||
843 | freq = CLOCK_GetCoreSysClkFreq() / ((SYSCON->CAN0CLKDIV & 0xffU) + 1U); | ||
844 | break; | ||
845 | case 1U: | ||
846 | freq = CLOCK_GetCoreSysClkFreq() / ((SYSCON->CAN1CLKDIV & 0xffU) + 1U); | ||
847 | break; | ||
848 | |||
849 | default: | ||
850 | freq = 0U; | ||
851 | break; | ||
852 | } | ||
853 | |||
854 | return freq; | ||
855 | } | ||
856 | |||
857 | /* Get FLEXCOMM Clk */ | ||
858 | /*! brief Return Frequency of Flexcomm functional Clock | ||
859 | * return Frequency of Flexcomm functional Clock | ||
860 | */ | ||
861 | uint32_t CLOCK_GetFlexCommClkFreq(uint32_t id) | ||
862 | { | ||
863 | uint32_t freq = 0U; | ||
864 | |||
865 | if (id != 10U) | ||
866 | { | ||
867 | switch (SYSCON->FCLKSEL[id]) | ||
868 | { | ||
869 | case 0U: | ||
870 | freq = CLOCK_GetFro12MFreq(); | ||
871 | break; | ||
872 | case 1U: | ||
873 | freq = CLOCK_GetFroHfFreq() / ((SYSCON->FROHFDIV & 0xffu) + 1U); | ||
874 | break; | ||
875 | case 2U: | ||
876 | freq = CLOCK_GetAudioPllOutFreq(); | ||
877 | break; | ||
878 | case 3U: | ||
879 | freq = CLOCK_GetI2SMClkFreq(); | ||
880 | break; | ||
881 | case 4U: | ||
882 | freq = CLOCK_GetFrgClkFreq(); | ||
883 | break; | ||
884 | |||
885 | default: | ||
886 | freq = 0U; | ||
887 | break; | ||
888 | } | ||
889 | } | ||
890 | else | ||
891 | { | ||
892 | switch (SYSCON->FCLKSEL10) | ||
893 | { | ||
894 | case 0U: | ||
895 | freq = CLOCK_GetCoreSysClkFreq(); | ||
896 | break; | ||
897 | case 1U: | ||
898 | freq = CLOCK_GetPllOutFreq(); | ||
899 | break; | ||
900 | case 2U: | ||
901 | freq = CLOCK_GetUsbPllOutFreq(); | ||
902 | break; | ||
903 | case 3U: | ||
904 | freq = CLOCK_GetFroHfFreq(); | ||
905 | break; | ||
906 | case 4U: | ||
907 | freq = CLOCK_GetAudioPllOutFreq(); | ||
908 | break; | ||
909 | default: | ||
910 | freq = 0U; | ||
911 | break; | ||
912 | } | ||
913 | } | ||
914 | |||
915 | return freq; | ||
916 | } | ||
917 | |||
918 | /* Get FRG Clk */ | ||
919 | uint32_t CLOCK_GetFRGInputClock(void) | ||
920 | { | ||
921 | uint32_t freq = 0U; | ||
922 | |||
923 | switch (SYSCON->FRGCLKSEL) | ||
924 | { | ||
925 | case 0U: | ||
926 | freq = CLOCK_GetCoreSysClkFreq(); | ||
927 | break; | ||
928 | case 1U: | ||
929 | freq = CLOCK_GetPllOutFreq(); | ||
930 | break; | ||
931 | case 2U: | ||
932 | freq = CLOCK_GetFro12MFreq(); | ||
933 | break; | ||
934 | case 3U: | ||
935 | freq = CLOCK_GetFroHfFreq(); | ||
936 | break; | ||
937 | |||
938 | default: | ||
939 | freq = 0U; | ||
940 | break; | ||
941 | } | ||
942 | |||
943 | return freq; | ||
944 | } | ||
945 | |||
946 | /* Get FRG Clk */ | ||
947 | /*! brief Return Frequency of frg | ||
948 | * return Frequency of FRG | ||
949 | */ | ||
950 | uint32_t CLOCK_GetFrgClkFreq(void) | ||
951 | { | ||
952 | uint32_t freq = 0U; | ||
953 | |||
954 | if ((SYSCON->FRGCTRL & SYSCON_FRGCTRL_DIV_MASK) == SYSCON_FRGCTRL_DIV_MASK) | ||
955 | { | ||
956 | freq = (uint32_t)(((uint64_t)CLOCK_GetFRGInputClock() * (SYSCON_FRGCTRL_DIV_MASK + 1U)) / | ||
957 | ((SYSCON_FRGCTRL_DIV_MASK + 1U) + | ||
958 | ((SYSCON->FRGCTRL & SYSCON_FRGCTRL_MULT_MASK) >> SYSCON_FRGCTRL_MULT_SHIFT))); | ||
959 | } | ||
960 | else | ||
961 | { | ||
962 | freq = 0U; | ||
963 | } | ||
964 | |||
965 | return freq; | ||
966 | } | ||
967 | |||
968 | /* Get FRG Clk */ | ||
969 | /*! brief Return Frequency of dmic | ||
970 | * return Frequency of DMIC | ||
971 | */ | ||
972 | uint32_t CLOCK_GetDmicClkFreq(void) | ||
973 | { | ||
974 | uint32_t freq = 0U; | ||
975 | |||
976 | switch (SYSCON->DMICCLKSEL) | ||
977 | { | ||
978 | case 0U: | ||
979 | freq = CLOCK_GetFro12MFreq(); | ||
980 | break; | ||
981 | case 1U: | ||
982 | freq = CLOCK_GetFroHfFreq(); | ||
983 | break; | ||
984 | case 2U: | ||
985 | freq = CLOCK_GetPllOutFreq(); | ||
986 | break; | ||
987 | case 3U: | ||
988 | freq = CLOCK_GetI2SMClkFreq(); | ||
989 | break; | ||
990 | case 4U: | ||
991 | freq = CLOCK_GetCoreSysClkFreq(); | ||
992 | break; | ||
993 | case 5U: | ||
994 | freq = CLOCK_GetWdtOscFreq(); | ||
995 | break; | ||
996 | default: | ||
997 | freq = 0U; | ||
998 | break; | ||
999 | } | ||
1000 | |||
1001 | return freq / ((SYSCON->DMICCLKDIV & 0xffU) + 1U); | ||
1002 | ; | ||
1003 | } | ||
1004 | |||
1005 | /* Set FRG Clk */ | ||
1006 | uint32_t CLOCK_SetFRGClock(uint32_t freq) | ||
1007 | { | ||
1008 | uint32_t input = CLOCK_GetFRGInputClock(); | ||
1009 | uint32_t mul; | ||
1010 | |||
1011 | if ((freq > 48000000U) || (freq > input) || (input / freq >= 2U)) | ||
1012 | { | ||
1013 | /* FRG output frequency should be less than equal to 48MHz */ | ||
1014 | return 0U; | ||
1015 | } | ||
1016 | else | ||
1017 | { | ||
1018 | mul = (uint32_t)((((uint64_t)input - freq) * 256U) / ((uint64_t)freq)); | ||
1019 | SYSCON->FRGCTRL = (mul << SYSCON_FRGCTRL_MULT_SHIFT) | SYSCON_FRGCTRL_DIV_MASK; | ||
1020 | return 1U; | ||
1021 | } | ||
1022 | } | ||
1023 | |||
1024 | /* Set IP Clk */ | ||
1025 | /*! brief Return Frequency of selected clock | ||
1026 | * return Frequency of selected clock | ||
1027 | */ | ||
1028 | uint32_t CLOCK_GetFreq(clock_name_t clockName) | ||
1029 | { | ||
1030 | uint32_t freq; | ||
1031 | switch (clockName) | ||
1032 | { | ||
1033 | case kCLOCK_CoreSysClk: | ||
1034 | freq = CLOCK_GetCoreSysClkFreq(); | ||
1035 | break; | ||
1036 | case kCLOCK_BusClk: | ||
1037 | freq = CLOCK_GetCoreSysClkFreq() / ((SYSCON->AHBCLKDIV & 0xffU) + 1U); | ||
1038 | break; | ||
1039 | case kCLOCK_ClockOut: | ||
1040 | freq = CLOCK_GetClockOutClkFreq(); | ||
1041 | break; | ||
1042 | case kCLOCK_Mclk: | ||
1043 | freq = CLOCK_GetMclkClkFreq(); | ||
1044 | break; | ||
1045 | case kCLOCK_FroHf: | ||
1046 | freq = CLOCK_GetFroHfFreq(); | ||
1047 | break; | ||
1048 | case kCLOCK_Fro12M: | ||
1049 | freq = CLOCK_GetFro12MFreq(); | ||
1050 | break; | ||
1051 | case kCLOCK_ExtClk: | ||
1052 | freq = CLOCK_GetExtClkFreq(); | ||
1053 | break; | ||
1054 | case kCLOCK_PllOut: | ||
1055 | freq = CLOCK_GetPllOutFreq(); | ||
1056 | break; | ||
1057 | case kCLOCK_WdtOsc: | ||
1058 | freq = CLOCK_GetWdtOscFreq(); | ||
1059 | break; | ||
1060 | case kCLOCK_Frg: | ||
1061 | freq = CLOCK_GetFrgClkFreq(); | ||
1062 | break; | ||
1063 | |||
1064 | case kCLOCK_AsyncApbClk: | ||
1065 | freq = CLOCK_GetAsyncApbClkFreq(); | ||
1066 | break; | ||
1067 | default: | ||
1068 | freq = 0U; | ||
1069 | break; | ||
1070 | } | ||
1071 | |||
1072 | return freq; | ||
1073 | } | ||
1074 | |||
1075 | /* Find encoded NDEC value for raw N value, max N = NVALMAX */ | ||
1076 | static uint32_t pllEncodeN(uint32_t N) | ||
1077 | { | ||
1078 | uint32_t x, i; | ||
1079 | |||
1080 | /* Find NDec */ | ||
1081 | switch (N) | ||
1082 | { | ||
1083 | case 0U: | ||
1084 | x = 0x3FFU; | ||
1085 | break; | ||
1086 | |||
1087 | case 1U: | ||
1088 | x = 0x302U; | ||
1089 | break; | ||
1090 | |||
1091 | case 2U: | ||
1092 | x = 0x202U; | ||
1093 | break; | ||
1094 | |||
1095 | default: | ||
1096 | x = 0x080U; | ||
1097 | for (i = N; i <= NVALMAX; i++) | ||
1098 | { | ||
1099 | x = (((x ^ (x >> 2U) ^ (x >> 3U) ^ (x >> 4U)) & 1U) << 7U) | ((x >> 1U) & 0x7FU); | ||
1100 | } | ||
1101 | break; | ||
1102 | } | ||
1103 | |||
1104 | return x & (PLL_NDEC_VAL_M >> PLL_NDEC_VAL_P); | ||
1105 | } | ||
1106 | |||
1107 | /* Find decoded N value for raw NDEC value */ | ||
1108 | static uint32_t pllDecodeN(uint32_t NDEC) | ||
1109 | { | ||
1110 | uint32_t n, x, i; | ||
1111 | |||
1112 | /* Find NDec */ | ||
1113 | switch (NDEC) | ||
1114 | { | ||
1115 | case 0x3FFU: | ||
1116 | n = 0U; | ||
1117 | break; | ||
1118 | |||
1119 | case 0x302U: | ||
1120 | n = 1U; | ||
1121 | break; | ||
1122 | |||
1123 | case 0x202U: | ||
1124 | n = 2U; | ||
1125 | break; | ||
1126 | |||
1127 | default: | ||
1128 | x = 0x080U; | ||
1129 | n = 0xFFFFFFFFU; | ||
1130 | for (i = NVALMAX; i >= 3U; i--) | ||
1131 | { | ||
1132 | x = (((x ^ (x >> 2U) ^ (x >> 3U) ^ (x >> 4U)) & 1U) << 7U) | ((x >> 1U) & 0x7FU); | ||
1133 | if ((x & (PLL_NDEC_VAL_M >> PLL_NDEC_VAL_P)) == NDEC) | ||
1134 | { | ||
1135 | /* Decoded value of NDEC */ | ||
1136 | n = i; | ||
1137 | break; | ||
1138 | } | ||
1139 | } | ||
1140 | break; | ||
1141 | } | ||
1142 | |||
1143 | return n; | ||
1144 | } | ||
1145 | |||
1146 | /* Find encoded PDEC value for raw P value, max P = PVALMAX */ | ||
1147 | static uint32_t pllEncodeP(uint32_t P) | ||
1148 | { | ||
1149 | uint32_t x, i; | ||
1150 | |||
1151 | /* Find PDec */ | ||
1152 | switch (P) | ||
1153 | { | ||
1154 | case 0U: | ||
1155 | x = 0x7FU; | ||
1156 | break; | ||
1157 | |||
1158 | case 1U: | ||
1159 | x = 0x62U; | ||
1160 | break; | ||
1161 | |||
1162 | case 2U: | ||
1163 | x = 0x42U; | ||
1164 | break; | ||
1165 | |||
1166 | default: | ||
1167 | x = 0x10U; | ||
1168 | for (i = P; i <= PVALMAX; i++) | ||
1169 | { | ||
1170 | x = (((x ^ (x >> 2U)) & 1U) << 4U) | ((x >> 1U) & 0xFU); | ||
1171 | } | ||
1172 | break; | ||
1173 | } | ||
1174 | |||
1175 | return x & (PLL_PDEC_VAL_M >> PLL_PDEC_VAL_P); | ||
1176 | } | ||
1177 | |||
1178 | /* Find decoded P value for raw PDEC value */ | ||
1179 | static uint32_t pllDecodeP(uint32_t PDEC) | ||
1180 | { | ||
1181 | uint32_t p, x, i; | ||
1182 | |||
1183 | /* Find PDec */ | ||
1184 | switch (PDEC) | ||
1185 | { | ||
1186 | case 0x7FU: | ||
1187 | p = 0U; | ||
1188 | break; | ||
1189 | |||
1190 | case 0x62U: | ||
1191 | p = 1U; | ||
1192 | break; | ||
1193 | |||
1194 | case 0x42U: | ||
1195 | p = 2U; | ||
1196 | break; | ||
1197 | |||
1198 | default: | ||
1199 | x = 0x10U; | ||
1200 | p = 0xFFFFFFFFU; | ||
1201 | for (i = PVALMAX; i >= 3U; i--) | ||
1202 | { | ||
1203 | x = (((x ^ (x >> 2U)) & 1U) << 4U) | ((x >> 1U) & 0xFU); | ||
1204 | if ((x & (PLL_PDEC_VAL_M >> PLL_PDEC_VAL_P)) == PDEC) | ||
1205 | { | ||
1206 | /* Decoded value of PDEC */ | ||
1207 | p = i; | ||
1208 | break; | ||
1209 | } | ||
1210 | } | ||
1211 | break; | ||
1212 | } | ||
1213 | |||
1214 | return p; | ||
1215 | } | ||
1216 | |||
1217 | /* Find encoded MDEC value for raw M value, max M = MVALMAX */ | ||
1218 | static uint32_t pllEncodeM(uint32_t M) | ||
1219 | { | ||
1220 | uint32_t i, x; | ||
1221 | |||
1222 | /* Find MDec */ | ||
1223 | switch (M) | ||
1224 | { | ||
1225 | case 0U: | ||
1226 | x = 0x1FFFFU; | ||
1227 | break; | ||
1228 | |||
1229 | case 1U: | ||
1230 | x = 0x18003U; | ||
1231 | break; | ||
1232 | |||
1233 | case 2U: | ||
1234 | x = 0x10003U; | ||
1235 | break; | ||
1236 | |||
1237 | default: | ||
1238 | x = 0x04000U; | ||
1239 | for (i = M; i <= MVALMAX; i++) | ||
1240 | { | ||
1241 | x = (((x ^ (x >> 1U)) & 1U) << 14U) | ((x >> 1U) & 0x3FFFU); | ||
1242 | } | ||
1243 | break; | ||
1244 | } | ||
1245 | |||
1246 | return x & (PLL_MDEC_VAL_M >> PLL_MDEC_VAL_P); | ||
1247 | } | ||
1248 | |||
1249 | /* Find decoded M value for raw MDEC value */ | ||
1250 | static uint32_t pllDecodeM(uint32_t MDEC) | ||
1251 | { | ||
1252 | uint32_t m, i, x; | ||
1253 | |||
1254 | /* Find MDec */ | ||
1255 | switch (MDEC) | ||
1256 | { | ||
1257 | case 0x1FFFFU: | ||
1258 | m = 0U; | ||
1259 | break; | ||
1260 | |||
1261 | case 0x18003U: | ||
1262 | m = 1U; | ||
1263 | break; | ||
1264 | |||
1265 | case 0x10003U: | ||
1266 | m = 2U; | ||
1267 | break; | ||
1268 | |||
1269 | default: | ||
1270 | x = 0x04000U; | ||
1271 | m = 0xFFFFFFFFU; | ||
1272 | for (i = MVALMAX; i >= 3U; i--) | ||
1273 | { | ||
1274 | x = (((x ^ (x >> 1U)) & 1U) << 14U) | ((x >> 1U) & 0x3FFFU); | ||
1275 | if ((x & (PLL_MDEC_VAL_M >> PLL_MDEC_VAL_P)) == MDEC) | ||
1276 | { | ||
1277 | /* Decoded value of MDEC */ | ||
1278 | m = i; | ||
1279 | break; | ||
1280 | } | ||
1281 | } | ||
1282 | break; | ||
1283 | } | ||
1284 | |||
1285 | return m; | ||
1286 | } | ||
1287 | |||
1288 | /* Find SELP, SELI, and SELR values for raw M value, max M = MVALMAX */ | ||
1289 | static void pllFindSel(uint32_t M, uint32_t *pSelP, uint32_t *pSelI, uint32_t *pSelR) | ||
1290 | { | ||
1291 | /* bandwidth: compute selP from Multiplier */ | ||
1292 | if (M < 60U) | ||
1293 | { | ||
1294 | *pSelP = (M >> 1U) + 1U; | ||
1295 | } | ||
1296 | else | ||
1297 | { | ||
1298 | *pSelP = PVALMAX - 1U; | ||
1299 | } | ||
1300 | |||
1301 | /* bandwidth: compute selI from Multiplier */ | ||
1302 | if (M > 16384U) | ||
1303 | { | ||
1304 | *pSelI = 1U; | ||
1305 | } | ||
1306 | else if (M > 8192U) | ||
1307 | { | ||
1308 | *pSelI = 2U; | ||
1309 | } | ||
1310 | else if (M > 2048U) | ||
1311 | { | ||
1312 | *pSelI = 4U; | ||
1313 | } | ||
1314 | else if (M >= 501U) | ||
1315 | { | ||
1316 | *pSelI = 8U; | ||
1317 | } | ||
1318 | else if (M >= 60U) | ||
1319 | { | ||
1320 | *pSelI = 4U * (1024U / (M + 9U)); | ||
1321 | } | ||
1322 | else | ||
1323 | { | ||
1324 | *pSelI = (M & 0x3CU) + 4U; | ||
1325 | } | ||
1326 | |||
1327 | if (*pSelI > ((0x3FUL << SYSCON_SYSPLLCTRL_SELI_SHIFT) >> SYSCON_SYSPLLCTRL_SELI_SHIFT)) | ||
1328 | { | ||
1329 | *pSelI = ((0x3FUL << SYSCON_SYSPLLCTRL_SELI_SHIFT) >> SYSCON_SYSPLLCTRL_SELI_SHIFT); | ||
1330 | } | ||
1331 | |||
1332 | *pSelR = 0U; | ||
1333 | } | ||
1334 | |||
1335 | /* Get predivider (N) from PLL NDEC setting */ | ||
1336 | static uint32_t findPllPreDiv(uint32_t ctrlReg, uint32_t nDecReg) | ||
1337 | { | ||
1338 | uint32_t preDiv = 1; | ||
1339 | |||
1340 | /* Direct input is not used? */ | ||
1341 | if ((ctrlReg & (1UL << SYSCON_SYSPLLCTRL_DIRECTI_SHIFT)) == 0U) | ||
1342 | { | ||
1343 | /* Decode NDEC value to get (N) pre divider */ | ||
1344 | preDiv = pllDecodeN(nDecReg & 0x3FFU); | ||
1345 | if (preDiv == 0U) | ||
1346 | { | ||
1347 | preDiv = 1U; | ||
1348 | } | ||
1349 | } | ||
1350 | |||
1351 | /* Adjusted by 1, directi is used to bypass */ | ||
1352 | return preDiv; | ||
1353 | } | ||
1354 | |||
1355 | /* Get postdivider (P) from PLL PDEC setting */ | ||
1356 | static uint32_t findPllPostDiv(uint32_t ctrlReg, uint32_t pDecReg) | ||
1357 | { | ||
1358 | uint32_t postDiv = 1U; | ||
1359 | |||
1360 | /* Direct input is not used? */ | ||
1361 | if ((ctrlReg & SYSCON_SYSPLLCTRL_DIRECTO_MASK) == 0U) | ||
1362 | { | ||
1363 | /* Decode PDEC value to get (P) post divider */ | ||
1364 | postDiv = 2U * pllDecodeP(pDecReg & 0x7FU); | ||
1365 | if (postDiv == 0U) | ||
1366 | { | ||
1367 | postDiv = 2U; | ||
1368 | } | ||
1369 | } | ||
1370 | |||
1371 | /* Adjusted by 1, directo is used to bypass */ | ||
1372 | return postDiv; | ||
1373 | } | ||
1374 | |||
1375 | /* Get multiplier (M) from PLL MDEC and BYPASS_FBDIV2 settings */ | ||
1376 | static uint32_t findPllMMult(uint32_t ctrlReg, uint32_t mDecReg) | ||
1377 | { | ||
1378 | uint32_t mMult = 1U; | ||
1379 | |||
1380 | /* Decode MDEC value to get (M) multiplier */ | ||
1381 | mMult = pllDecodeM(mDecReg & 0x1FFFFU); | ||
1382 | |||
1383 | if (mMult == 0U) | ||
1384 | { | ||
1385 | mMult = 1U; | ||
1386 | } | ||
1387 | |||
1388 | return mMult; | ||
1389 | } | ||
1390 | |||
1391 | /* Calculate the powerTimes' power of 2 */ | ||
1392 | static uint32_t power2Cal(uint32_t powerTimes) | ||
1393 | { | ||
1394 | uint32_t ret = 1U; | ||
1395 | uint32_t i; | ||
1396 | for (i = 0; i < powerTimes; i++) | ||
1397 | { | ||
1398 | ret *= 2U; | ||
1399 | } | ||
1400 | |||
1401 | return ret; | ||
1402 | } | ||
1403 | |||
1404 | /* Convert the binary to fractional part */ | ||
1405 | static double Binary2Fractional(uint32_t binaryPart) | ||
1406 | { | ||
1407 | double fractional = 0.0; | ||
1408 | for (uint32_t i = 0U; i <= 14U; i++) | ||
1409 | { | ||
1410 | fractional += (double)(uint32_t)((binaryPart >> i) & 0x1U) / (double)(uint32_t)power2Cal(15U - i); | ||
1411 | } | ||
1412 | return fractional; | ||
1413 | } | ||
1414 | |||
1415 | /* Find greatest common divisor between m and n */ | ||
1416 | static uint32_t FindGreatestCommonDivisor(uint32_t m, uint32_t n) | ||
1417 | { | ||
1418 | uint32_t tmp; | ||
1419 | |||
1420 | while (n != 0U) | ||
1421 | { | ||
1422 | tmp = n; | ||
1423 | n = m % n; | ||
1424 | m = tmp; | ||
1425 | } | ||
1426 | |||
1427 | return m; | ||
1428 | } | ||
1429 | |||
1430 | /* | ||
1431 | * Set PLL output based on desired output rate. | ||
1432 | * In this function, the it calculates the PLL setting for output frequency from input clock | ||
1433 | * frequency. The calculation would cost a few time. So it is not recommaned to use it frequently. | ||
1434 | * the "pllctrl", "pllndec", "pllpdec", "pllmdec" would updated in this function. | ||
1435 | */ | ||
1436 | static pll_error_t CLOCK_GetPllConfigInternal(uint32_t finHz, uint32_t foutHz, pll_setup_t *pSetup) | ||
1437 | { | ||
1438 | uint32_t nDivOutHz, fccoHz, multFccoDiv; | ||
1439 | uint32_t pllPreDivider, pllMultiplier, pllPostDivider; | ||
1440 | uint32_t pllDirectInput, pllDirectOutput; | ||
1441 | uint32_t pllSelP, pllSelI, pllSelR, uplimoff; | ||
1442 | |||
1443 | /* Baseline parameters (no input or output dividers) */ | ||
1444 | pllPreDivider = 1U; /* 1 implies pre-divider will be disabled */ | ||
1445 | pllPostDivider = 0U; /* 0 implies post-divider will be disabled */ | ||
1446 | pllDirectOutput = 1U; | ||
1447 | multFccoDiv = 2U; | ||
1448 | |||
1449 | /* Verify output rate parameter */ | ||
1450 | if (foutHz > PLL_MAX_CCO_FREQ_MHZ) | ||
1451 | { | ||
1452 | /* Maximum PLL output with post divider=1 cannot go above this frequency */ | ||
1453 | return kStatus_PLL_OutputTooHigh; | ||
1454 | } | ||
1455 | if (foutHz < (PLL_MIN_CCO_FREQ_MHZ / (PVALMAX << 1U))) | ||
1456 | { | ||
1457 | /* Minmum PLL output with maximum post divider cannot go below this frequency */ | ||
1458 | return kStatus_PLL_OutputTooLow; | ||
1459 | } | ||
1460 | |||
1461 | /* Verify input rate parameter */ | ||
1462 | if (finHz < PLL_LOWER_IN_LIMIT) | ||
1463 | { | ||
1464 | /* Input clock into the PLL cannot be lower than this */ | ||
1465 | return kStatus_PLL_InputTooLow; | ||
1466 | } | ||
1467 | |||
1468 | /* Find the optimal CCO frequency for the output and input that | ||
1469 | will keep it inside the PLL CCO range. This may require | ||
1470 | tweaking the post-divider for the PLL. */ | ||
1471 | fccoHz = foutHz; | ||
1472 | while (fccoHz < PLL_MIN_CCO_FREQ_MHZ) | ||
1473 | { | ||
1474 | /* CCO output is less than minimum CCO range, so the CCO output | ||
1475 | needs to be bumped up and the post-divider is used to bring | ||
1476 | the PLL output back down. */ | ||
1477 | pllPostDivider++; | ||
1478 | if (pllPostDivider > PVALMAX) | ||
1479 | { | ||
1480 | return kStatus_PLL_OutsideIntLimit; | ||
1481 | } | ||
1482 | |||
1483 | /* Target CCO goes up, PLL output goes down */ | ||
1484 | fccoHz = foutHz * (pllPostDivider * 2U); | ||
1485 | pllDirectOutput = 0U; | ||
1486 | } | ||
1487 | |||
1488 | /* Determine if a pre-divider is needed to get the best frequency */ | ||
1489 | if ((finHz > PLL_LOWER_IN_LIMIT) && (fccoHz >= finHz)) | ||
1490 | { | ||
1491 | uint32_t a = FindGreatestCommonDivisor(fccoHz, (multFccoDiv * finHz)); | ||
1492 | |||
1493 | if (a > 20000U) | ||
1494 | { | ||
1495 | a = (multFccoDiv * finHz) / a; | ||
1496 | if ((a != 0U) && (a < PLL_MAX_N_DIV)) | ||
1497 | { | ||
1498 | pllPreDivider = a; | ||
1499 | } | ||
1500 | } | ||
1501 | } | ||
1502 | |||
1503 | /* Bypass pre-divider hardware if pre-divider is 1 */ | ||
1504 | if (pllPreDivider > 1U) | ||
1505 | { | ||
1506 | pllDirectInput = 0U; | ||
1507 | } | ||
1508 | else | ||
1509 | { | ||
1510 | pllDirectInput = 1U; | ||
1511 | } | ||
1512 | |||
1513 | /* Determine PLL multipler */ | ||
1514 | nDivOutHz = (finHz / pllPreDivider); | ||
1515 | pllMultiplier = (fccoHz / nDivOutHz) / multFccoDiv; | ||
1516 | |||
1517 | /* Find optimal values for filter */ | ||
1518 | /* Will bumping up M by 1 get us closer to the desired CCO frequency? */ | ||
1519 | if ((nDivOutHz * ((multFccoDiv * pllMultiplier * 2U) + 1U)) < (fccoHz * 2U)) | ||
1520 | { | ||
1521 | pllMultiplier++; | ||
1522 | } | ||
1523 | |||
1524 | /* Setup filtering */ | ||
1525 | pllFindSel(pllMultiplier, &pllSelP, &pllSelI, &pllSelR); | ||
1526 | uplimoff = 0U; | ||
1527 | |||
1528 | /* Get encoded value for M (mult) and use manual filter, disable SS mode */ | ||
1529 | pSetup->pllmdec = PLL_MDEC_VAL_SET(pllEncodeM(pllMultiplier)); | ||
1530 | |||
1531 | /* Get encoded values for N (prediv) and P (postdiv) */ | ||
1532 | pSetup->pllndec = PLL_NDEC_VAL_SET(pllEncodeN(pllPreDivider)); | ||
1533 | pSetup->pllpdec = PLL_PDEC_VAL_SET(pllEncodeP(pllPostDivider)); | ||
1534 | |||
1535 | /* PLL control */ | ||
1536 | pSetup->pllctrl = (pllSelR << SYSCON_SYSPLLCTRL_SELR_SHIFT) | /* Filter coefficient */ | ||
1537 | (pllSelI << SYSCON_SYSPLLCTRL_SELI_SHIFT) | /* Filter coefficient */ | ||
1538 | (pllSelP << SYSCON_SYSPLLCTRL_SELP_SHIFT) | /* Filter coefficient */ | ||
1539 | (0UL << SYSCON_SYSPLLCTRL_BYPASS_SHIFT) | /* PLL bypass mode disabled */ | ||
1540 | (uplimoff << SYSCON_SYSPLLCTRL_UPLIMOFF_SHIFT) | /* SS/fractional mode disabled */ | ||
1541 | (pllDirectInput << SYSCON_SYSPLLCTRL_DIRECTI_SHIFT) | /* Bypass pre-divider? */ | ||
1542 | (pllDirectOutput << SYSCON_SYSPLLCTRL_DIRECTO_SHIFT); /* Bypass post-divider? */ | ||
1543 | |||
1544 | return kStatus_PLL_Success; | ||
1545 | } | ||
1546 | |||
1547 | #if (defined(CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT) && CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT) | ||
1548 | /* Alloct the static buffer for cache. */ | ||
1549 | static pll_setup_t gPllSetupCacheStruct[CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT]; | ||
1550 | static uint32_t gFinHzCache[CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT] = {0}; | ||
1551 | static uint32_t gFoutHzCache[CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT] = {0}; | ||
1552 | static uint32_t gPllSetupCacheIdx = 0U; | ||
1553 | #endif /* CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT */ | ||
1554 | |||
1555 | /* | ||
1556 | * Calculate the PLL setting values from input clock freq to output freq. | ||
1557 | */ | ||
1558 | static pll_error_t CLOCK_GetPllConfig(uint32_t finHz, uint32_t foutHz, pll_setup_t *pSetup) | ||
1559 | { | ||
1560 | pll_error_t retErr; | ||
1561 | #if (defined(CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT) && CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT) | ||
1562 | uint32_t i; | ||
1563 | |||
1564 | for (i = 0U; i < CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT; i++) | ||
1565 | { | ||
1566 | if ((finHz == gFinHzCache[i]) && (foutHz == gFoutHzCache[i])) | ||
1567 | { | ||
1568 | /* Hit the target in cache buffer. */ | ||
1569 | pSetup->pllctrl = gPllSetupCacheStruct[i].pllctrl; | ||
1570 | pSetup->pllndec = gPllSetupCacheStruct[i].pllndec; | ||
1571 | pSetup->pllpdec = gPllSetupCacheStruct[i].pllpdec; | ||
1572 | pSetup->pllmdec = gPllSetupCacheStruct[i].pllmdec; | ||
1573 | retErr = kStatus_PLL_Success; | ||
1574 | break; | ||
1575 | } | ||
1576 | } | ||
1577 | |||
1578 | if (i < CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT) | ||
1579 | { | ||
1580 | return retErr; | ||
1581 | } | ||
1582 | #endif /* CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT */ | ||
1583 | |||
1584 | /* No cache or did not hit the cache. */ | ||
1585 | retErr = CLOCK_GetPllConfigInternal(finHz, foutHz, pSetup); | ||
1586 | |||
1587 | #if (defined(CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT) && CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT) | ||
1588 | if (kStatus_PLL_Success == retErr) | ||
1589 | { | ||
1590 | /* Cache the most recent calulation result into buffer. */ | ||
1591 | gFinHzCache[gPllSetupCacheIdx] = finHz; | ||
1592 | gFoutHzCache[gPllSetupCacheIdx] = foutHz; | ||
1593 | |||
1594 | gPllSetupCacheStruct[gPllSetupCacheIdx].pllctrl = pSetup->pllctrl; | ||
1595 | gPllSetupCacheStruct[gPllSetupCacheIdx].pllndec = pSetup->pllndec; | ||
1596 | gPllSetupCacheStruct[gPllSetupCacheIdx].pllpdec = pSetup->pllpdec; | ||
1597 | gPllSetupCacheStruct[gPllSetupCacheIdx].pllmdec = pSetup->pllmdec; | ||
1598 | /* Update the index for next available buffer. */ | ||
1599 | gPllSetupCacheIdx = (gPllSetupCacheIdx + 1U) % CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT; | ||
1600 | } | ||
1601 | #endif /* CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT */ | ||
1602 | |||
1603 | return retErr; | ||
1604 | } | ||
1605 | |||
1606 | /* Update SYSTEM PLL rate variable */ | ||
1607 | static void CLOCK_GetSystemPLLOutFromSetupUpdate(pll_setup_t *pSetup) | ||
1608 | { | ||
1609 | s_Pll_Freq = CLOCK_GetSystemPLLOutFromSetup(pSetup); | ||
1610 | } | ||
1611 | |||
1612 | /* Update AUDIO PLL rate variable */ | ||
1613 | static void CLOCK_GetAudioPLLOutFromSetupUpdate(pll_setup_t *pSetup) | ||
1614 | { | ||
1615 | s_Audio_Pll_Freq = CLOCK_GetAudioPLLOutFromSetup(pSetup); | ||
1616 | } | ||
1617 | |||
1618 | /* Update AUDIO Fractional PLL rate variable */ | ||
1619 | static void CLOCK_GetAudioPLLOutFromAudioFracSetupUpdate(pll_setup_t *pSetup) | ||
1620 | { | ||
1621 | s_Audio_Pll_Freq = CLOCK_GetAudioPLLOutFromFractSetup(pSetup); | ||
1622 | } | ||
1623 | |||
1624 | /* Update USB PLL rate variable */ | ||
1625 | static void CLOCK_GetUsbPLLOutFromSetupUpdate(const usb_pll_setup_t *pSetup) | ||
1626 | { | ||
1627 | s_Usb_Pll_Freq = CLOCK_GetUsbPLLOutFromSetup(pSetup); | ||
1628 | } | ||
1629 | |||
1630 | /* Return System PLL input clock rate */ | ||
1631 | /*! brief Return System PLL input clock rate | ||
1632 | * return System PLL input clock rate | ||
1633 | */ | ||
1634 | uint32_t CLOCK_GetSystemPLLInClockRate(void) | ||
1635 | { | ||
1636 | uint32_t clkRate = 0U; | ||
1637 | |||
1638 | switch ((SYSCON->SYSPLLCLKSEL & SYSCON_SYSPLLCLKSEL_SEL_MASK)) | ||
1639 | { | ||
1640 | case 0x00U: | ||
1641 | clkRate = CLK_FRO_12MHZ; | ||
1642 | break; | ||
1643 | |||
1644 | case 0x01U: | ||
1645 | clkRate = CLOCK_GetExtClkFreq(); | ||
1646 | break; | ||
1647 | |||
1648 | case 0x02U: | ||
1649 | clkRate = CLOCK_GetWdtOscFreq(); | ||
1650 | break; | ||
1651 | |||
1652 | case 0x03U: | ||
1653 | clkRate = CLOCK_GetOsc32KFreq(); | ||
1654 | break; | ||
1655 | |||
1656 | default: | ||
1657 | clkRate = 0U; | ||
1658 | break; | ||
1659 | } | ||
1660 | |||
1661 | return clkRate; | ||
1662 | } | ||
1663 | |||
1664 | /* Return Audio PLL input clock rate */ | ||
1665 | /*! brief Return Audio PLL input clock rate | ||
1666 | * return Audio PLL input clock rate | ||
1667 | */ | ||
1668 | uint32_t CLOCK_GetAudioPLLInClockRate(void) | ||
1669 | { | ||
1670 | uint32_t clkRate = 0U; | ||
1671 | |||
1672 | switch ((SYSCON->AUDPLLCLKSEL & SYSCON_AUDPLLCLKSEL_SEL_MASK)) | ||
1673 | { | ||
1674 | case 0x00U: | ||
1675 | clkRate = CLK_FRO_12MHZ; | ||
1676 | break; | ||
1677 | |||
1678 | case 0x01U: | ||
1679 | clkRate = CLOCK_GetExtClkFreq(); | ||
1680 | break; | ||
1681 | |||
1682 | default: | ||
1683 | clkRate = 0U; | ||
1684 | break; | ||
1685 | } | ||
1686 | |||
1687 | return clkRate; | ||
1688 | } | ||
1689 | |||
1690 | /* Return System PLL output clock rate from setup structure */ | ||
1691 | /*! brief Return System PLL output clock rate from setup structure | ||
1692 | * param pSetup : Pointer to a PLL setup structure | ||
1693 | * return System PLL output clock rate the setup structure will generate | ||
1694 | */ | ||
1695 | uint32_t CLOCK_GetSystemPLLOutFromSetup(pll_setup_t *pSetup) | ||
1696 | { | ||
1697 | uint32_t prediv, postdiv, mMult, inPllRate; | ||
1698 | uint64_t workRate; | ||
1699 | |||
1700 | inPllRate = CLOCK_GetSystemPLLInClockRate(); | ||
1701 | /* If the PLL is bypassed, PLL would not be used and the output of PLL module would just be the input clock*/ | ||
1702 | if ((pSetup->pllctrl & (SYSCON_SYSPLLCTRL_BYPASS_MASK)) == 0U) | ||
1703 | { | ||
1704 | /* PLL is not in bypass mode, get pre-divider, and M divider, post-divider. */ | ||
1705 | /* | ||
1706 | * 1. Pre-divider | ||
1707 | * Pre-divider is only available when the DIRECTI is disabled. | ||
1708 | */ | ||
1709 | if (0U == (pSetup->pllctrl & SYSCON_SYSPLLCTRL_DIRECTI_MASK)) | ||
1710 | { | ||
1711 | prediv = findPllPreDiv(pSetup->pllctrl, pSetup->pllndec); | ||
1712 | } | ||
1713 | else | ||
1714 | { | ||
1715 | prediv = 1U; /* The pre-divider is bypassed. */ | ||
1716 | } | ||
1717 | /* | ||
1718 | * 2. Post-divider | ||
1719 | * Post-divider is only available when the DIRECTO is disabled. | ||
1720 | */ | ||
1721 | if (0U == (pSetup->pllctrl & SYSCON_SYSPLLCTRL_DIRECTO_MASK)) | ||
1722 | { | ||
1723 | postdiv = findPllPostDiv(pSetup->pllctrl, pSetup->pllpdec); | ||
1724 | } | ||
1725 | else | ||
1726 | { | ||
1727 | postdiv = 1U; /* The post-divider is bypassed. */ | ||
1728 | } | ||
1729 | /* Adjust input clock */ | ||
1730 | inPllRate = inPllRate / prediv; | ||
1731 | |||
1732 | /* MDEC used for rate */ | ||
1733 | mMult = findPllMMult(pSetup->pllctrl, pSetup->pllmdec); | ||
1734 | workRate = (uint64_t)inPllRate * (uint64_t)mMult; | ||
1735 | |||
1736 | workRate = workRate / ((uint64_t)postdiv); | ||
1737 | workRate = workRate * 2U; /* SYS PLL hardware cco is divide by 2 before to M-DIVIDER*/ | ||
1738 | } | ||
1739 | else | ||
1740 | { | ||
1741 | /* In bypass mode */ | ||
1742 | workRate = (uint64_t)inPllRate; | ||
1743 | } | ||
1744 | |||
1745 | return (uint32_t)workRate; | ||
1746 | } | ||
1747 | |||
1748 | /* Return Usb PLL output clock rate from setup structure */ | ||
1749 | /*! brief Return System USB PLL output clock rate from setup structure | ||
1750 | * param pSetup : Pointer to a PLL setup structure | ||
1751 | * return System PLL output clock rate the setup structure will generate | ||
1752 | */ | ||
1753 | uint32_t CLOCK_GetUsbPLLOutFromSetup(const usb_pll_setup_t *pSetup) | ||
1754 | { | ||
1755 | uint32_t nsel, psel, msel, inPllRate; | ||
1756 | uint64_t workRate; | ||
1757 | inPllRate = CLOCK_GetExtClkFreq(); | ||
1758 | msel = pSetup->msel; | ||
1759 | psel = pSetup->psel; | ||
1760 | nsel = pSetup->nsel; | ||
1761 | |||
1762 | if (pSetup->fbsel) | ||
1763 | { | ||
1764 | /*integer_mode: Fout = M*(Fin/N), Fcco = 2*P*M*(Fin/N) */ | ||
1765 | workRate = ((uint64_t)inPllRate) * ((uint64_t)msel + 1U) / ((uint64_t)nsel + 1U); | ||
1766 | } | ||
1767 | else | ||
1768 | { | ||
1769 | /* non integer_mode: Fout = M*(Fin/N)/(2*P), Fcco = M * (Fin/N) */ | ||
1770 | workRate = ((uint64_t)inPllRate / ((uint64_t)nsel + 1U)) * (msel + 1U) / (2U * SWITCH_USB_PSEL(psel)); | ||
1771 | } | ||
1772 | |||
1773 | return (uint32_t)workRate; | ||
1774 | } | ||
1775 | |||
1776 | /* Return Audio PLL output clock rate from setup structure */ | ||
1777 | /*! brief Return System AUDIO PLL output clock rate from setup structure | ||
1778 | * param pSetup : Pointer to a PLL setup structure | ||
1779 | * return System PLL output clock rate the setup structure will generate | ||
1780 | */ | ||
1781 | uint32_t CLOCK_GetAudioPLLOutFromSetup(pll_setup_t *pSetup) | ||
1782 | { | ||
1783 | uint32_t prediv, postdiv, mMult, inPllRate; | ||
1784 | uint64_t workRate; | ||
1785 | |||
1786 | inPllRate = CLOCK_GetAudioPLLInClockRate(); | ||
1787 | if ((pSetup->pllctrl & (1UL << SYSCON_SYSPLLCTRL_BYPASS_SHIFT)) == 0U) | ||
1788 | { | ||
1789 | /* PLL is not in bypass mode, get pre-divider, and M divider, post-divider. */ | ||
1790 | /* | ||
1791 | * 1. Pre-divider | ||
1792 | * Pre-divider is only available when the DIRECTI is disabled. | ||
1793 | */ | ||
1794 | if (0U == (pSetup->pllctrl & SYSCON_AUDPLLCTRL_DIRECTI_MASK)) | ||
1795 | { | ||
1796 | prediv = findPllPreDiv(pSetup->pllctrl, pSetup->pllndec); | ||
1797 | } | ||
1798 | else | ||
1799 | { | ||
1800 | prediv = 1U; /* The pre-divider is bypassed. */ | ||
1801 | } | ||
1802 | /* | ||
1803 | * 2. Post-divider | ||
1804 | * Post-divider is only available when the DIRECTO is disabled. | ||
1805 | */ | ||
1806 | if (0U == (pSetup->pllctrl & SYSCON_AUDPLLCTRL_DIRECTO_MASK)) | ||
1807 | { | ||
1808 | postdiv = findPllPostDiv(pSetup->pllctrl, pSetup->pllpdec); | ||
1809 | } | ||
1810 | else | ||
1811 | { | ||
1812 | postdiv = 1U; /* The post-divider is bypassed. */ | ||
1813 | } | ||
1814 | /* Adjust input clock */ | ||
1815 | inPllRate = inPllRate / prediv; | ||
1816 | |||
1817 | /* MDEC used for rate */ | ||
1818 | mMult = findPllMMult(pSetup->pllctrl, pSetup->pllmdec); | ||
1819 | workRate = (uint64_t)inPllRate * (uint64_t)mMult; | ||
1820 | |||
1821 | workRate = workRate / ((uint64_t)postdiv); | ||
1822 | workRate = workRate * 2U; /* SYS PLL hardware cco is divide by 2 before to M-DIVIDER*/ | ||
1823 | } | ||
1824 | else | ||
1825 | { | ||
1826 | /* In bypass mode */ | ||
1827 | workRate = (uint64_t)inPllRate; | ||
1828 | } | ||
1829 | |||
1830 | return (uint32_t)workRate; | ||
1831 | } | ||
1832 | |||
1833 | /* Return Audio PLL output clock rate from audio fractioanl setup structure */ | ||
1834 | /*! brief Return System AUDIO PLL output clock rate from audio fractioanl setup structure | ||
1835 | * param pSetup : Pointer to a PLL setup structure | ||
1836 | * return System PLL output clock rate the setup structure will generate | ||
1837 | */ | ||
1838 | uint32_t CLOCK_GetAudioPLLOutFromFractSetup(pll_setup_t *pSetup) | ||
1839 | { | ||
1840 | uint32_t prediv, postdiv, inPllRate; | ||
1841 | double workRate, mMultFactional; | ||
1842 | |||
1843 | inPllRate = CLOCK_GetAudioPLLInClockRate(); | ||
1844 | if ((pSetup->pllctrl & (1UL << SYSCON_SYSPLLCTRL_BYPASS_SHIFT)) == 0U) | ||
1845 | { | ||
1846 | /* PLL is not in bypass mode, get pre-divider, and M divider, post-divider. */ | ||
1847 | /* | ||
1848 | * 1. Pre-divider | ||
1849 | * Pre-divider is only available when the DIRECTI is disabled. | ||
1850 | */ | ||
1851 | if (0U == (pSetup->pllctrl & SYSCON_AUDPLLCTRL_DIRECTI_MASK)) | ||
1852 | { | ||
1853 | prediv = findPllPreDiv(pSetup->pllctrl, pSetup->pllndec); | ||
1854 | } | ||
1855 | else | ||
1856 | { | ||
1857 | prediv = 1U; /* The pre-divider is bypassed. */ | ||
1858 | } | ||
1859 | /* | ||
1860 | * 2. Post-divider | ||
1861 | * Post-divider is only available when the DIRECTO is disabled. | ||
1862 | */ | ||
1863 | if (0U == (pSetup->pllctrl & SYSCON_AUDPLLCTRL_DIRECTO_MASK)) | ||
1864 | { | ||
1865 | postdiv = findPllPostDiv(pSetup->pllctrl, pSetup->pllpdec); | ||
1866 | } | ||
1867 | else | ||
1868 | { | ||
1869 | postdiv = 1U; /* The post-divider is bypassed. */ | ||
1870 | } | ||
1871 | /* Adjust input clock */ | ||
1872 | inPllRate = inPllRate / prediv; | ||
1873 | |||
1874 | mMultFactional = (double)(uint32_t)(pSetup->audpllfrac >> 15) + | ||
1875 | (double)(uint32_t)Binary2Fractional(pSetup->audpllfrac & 0x7FFFU); | ||
1876 | workRate = (double)inPllRate * (double)mMultFactional; | ||
1877 | |||
1878 | workRate = workRate / ((double)postdiv); | ||
1879 | workRate = workRate * 2.0; /* SYS PLL hardware cco is divide by 2 before to M-DIVIDER*/ | ||
1880 | } | ||
1881 | else | ||
1882 | { | ||
1883 | /* In bypass mode */ | ||
1884 | workRate = (double)(uint64_t)inPllRate; | ||
1885 | } | ||
1886 | |||
1887 | return (uint32_t)workRate; | ||
1888 | } | ||
1889 | |||
1890 | /* Set the current PLL Rate */ | ||
1891 | /*! brief Store the current PLL rate | ||
1892 | * param rate: Current rate of the PLL | ||
1893 | * return Nothing | ||
1894 | **/ | ||
1895 | void CLOCK_SetStoredPLLClockRate(uint32_t rate) | ||
1896 | { | ||
1897 | s_Pll_Freq = rate; | ||
1898 | } | ||
1899 | |||
1900 | /* Set the current Audio PLL Rate */ | ||
1901 | /*! brief Store the current AUDIO PLL rate | ||
1902 | * param rate: Current rate of the PLL | ||
1903 | * return Nothing | ||
1904 | **/ | ||
1905 | void CLOCK_SetStoredAudioPLLClockRate(uint32_t rate) | ||
1906 | { | ||
1907 | s_Audio_Pll_Freq = rate; | ||
1908 | } | ||
1909 | |||
1910 | /* Set the current Usb PLL Rate */ | ||
1911 | void CLOCK_SetStoredUsbPLLClockRate(uint32_t rate) | ||
1912 | { | ||
1913 | s_Usb_Pll_Freq = rate; | ||
1914 | } | ||
1915 | |||
1916 | /* Return System PLL output clock rate */ | ||
1917 | /*! brief Return System PLL output clock rate | ||
1918 | * param recompute : Forces a PLL rate recomputation if true | ||
1919 | * return System PLL output clock rate | ||
1920 | * note The PLL rate is cached in the driver in a variable as | ||
1921 | * the rate computation function can take some time to perform. It | ||
1922 | * is recommended to use 'false' with the 'recompute' parameter. | ||
1923 | */ | ||
1924 | uint32_t CLOCK_GetSystemPLLOutClockRate(bool recompute) | ||
1925 | { | ||
1926 | pll_setup_t Setup; | ||
1927 | uint32_t rate; | ||
1928 | |||
1929 | if ((recompute) || (s_Pll_Freq == 0U)) | ||
1930 | { | ||
1931 | Setup.pllctrl = SYSCON->SYSPLLCTRL; | ||
1932 | Setup.pllndec = SYSCON->SYSPLLNDEC; | ||
1933 | Setup.pllpdec = SYSCON->SYSPLLPDEC; | ||
1934 | Setup.pllmdec = SYSCON->SYSPLLMDEC; | ||
1935 | |||
1936 | CLOCK_GetSystemPLLOutFromSetupUpdate(&Setup); | ||
1937 | } | ||
1938 | |||
1939 | rate = s_Pll_Freq; | ||
1940 | |||
1941 | return rate; | ||
1942 | } | ||
1943 | |||
1944 | /* Return AUDIO PLL output clock rate */ | ||
1945 | /*! brief Return System AUDIO PLL output clock rate | ||
1946 | * param recompute : Forces a AUDIO PLL rate recomputation if true | ||
1947 | * return System AUDIO PLL output clock rate | ||
1948 | * note The AUDIO PLL rate is cached in the driver in a variable as | ||
1949 | * the rate computation function can take some time to perform. It | ||
1950 | * is recommended to use 'false' with the 'recompute' parameter. | ||
1951 | */ | ||
1952 | uint32_t CLOCK_GetAudioPLLOutClockRate(bool recompute) | ||
1953 | { | ||
1954 | pll_setup_t Setup; | ||
1955 | uint32_t rate; | ||
1956 | |||
1957 | if ((recompute) || (s_Audio_Pll_Freq == 0U)) | ||
1958 | { | ||
1959 | Setup.pllctrl = SYSCON->AUDPLLCTRL; | ||
1960 | Setup.pllndec = SYSCON->AUDPLLNDEC; | ||
1961 | Setup.pllpdec = SYSCON->AUDPLLPDEC; | ||
1962 | Setup.pllmdec = SYSCON->AUDPLLMDEC; | ||
1963 | |||
1964 | CLOCK_GetAudioPLLOutFromSetupUpdate(&Setup); | ||
1965 | } | ||
1966 | |||
1967 | rate = s_Audio_Pll_Freq; | ||
1968 | return rate; | ||
1969 | } | ||
1970 | |||
1971 | /* Return USB PLL output clock rate */ | ||
1972 | uint32_t CLOCK_GetUsbPLLOutClockRate(bool recompute) | ||
1973 | { | ||
1974 | usb_pll_setup_t Setup; | ||
1975 | uint32_t rate; | ||
1976 | |||
1977 | if ((recompute) || (s_Usb_Pll_Freq == 0U)) | ||
1978 | { | ||
1979 | Setup.msel = (uint8_t)((SYSCON->USBPLLCTRL >> SYSCON_USBPLLCTRL_MSEL_SHIFT) & SYSCON_USBPLLCTRL_MSEL_MASK); | ||
1980 | Setup.psel = (uint8_t)((SYSCON->USBPLLCTRL >> SYSCON_USBPLLCTRL_PSEL_SHIFT) & SYSCON_USBPLLCTRL_PSEL_MASK); | ||
1981 | Setup.nsel = (uint8_t)((SYSCON->USBPLLCTRL >> SYSCON_USBPLLCTRL_NSEL_SHIFT) & SYSCON_USBPLLCTRL_NSEL_MASK); | ||
1982 | Setup.fbsel = (((SYSCON->USBPLLCTRL >> SYSCON_USBPLLCTRL_FBSEL_SHIFT) & SYSCON_USBPLLCTRL_FBSEL_MASK) != 0UL); | ||
1983 | Setup.bypass = | ||
1984 | (((SYSCON->USBPLLCTRL >> SYSCON_USBPLLCTRL_BYPASS_SHIFT) & SYSCON_USBPLLCTRL_BYPASS_MASK) != 0UL); | ||
1985 | Setup.direct = | ||
1986 | (((SYSCON->USBPLLCTRL >> SYSCON_USBPLLCTRL_DIRECT_SHIFT) & SYSCON_USBPLLCTRL_DIRECT_MASK) != 0UL); | ||
1987 | CLOCK_GetUsbPLLOutFromSetupUpdate(&Setup); | ||
1988 | } | ||
1989 | |||
1990 | rate = s_Usb_Pll_Freq; | ||
1991 | return rate; | ||
1992 | } | ||
1993 | |||
1994 | /* Set PLL output based on the passed PLL setup data */ | ||
1995 | /*! brief Set PLL output based on the passed PLL setup data | ||
1996 | * param pControl : Pointer to populated PLL control structure to generate setup with | ||
1997 | * param pSetup : Pointer to PLL setup structure to be filled | ||
1998 | * return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
1999 | * note Actual frequency for setup may vary from the desired frequency based on the | ||
2000 | * accuracy of input clocks, rounding, non-fractional PLL mode, etc. | ||
2001 | */ | ||
2002 | pll_error_t CLOCK_SetupPLLData(pll_config_t *pControl, pll_setup_t *pSetup) | ||
2003 | { | ||
2004 | uint32_t inRate; | ||
2005 | pll_error_t pllError; | ||
2006 | |||
2007 | /* Determine input rate for the PLL */ | ||
2008 | if ((pControl->flags & PLL_CONFIGFLAG_USEINRATE) != 0U) | ||
2009 | { | ||
2010 | inRate = pControl->inputRate; | ||
2011 | } | ||
2012 | else | ||
2013 | { | ||
2014 | inRate = CLOCK_GetSystemPLLInClockRate(); | ||
2015 | } | ||
2016 | |||
2017 | /* PLL flag options */ | ||
2018 | pllError = CLOCK_GetPllConfig(inRate, pControl->desiredRate, pSetup); | ||
2019 | pSetup->pllRate = pControl->desiredRate; | ||
2020 | return pllError; | ||
2021 | } | ||
2022 | |||
2023 | /* Set PLL output from PLL setup structure */ | ||
2024 | /*! brief Set PLL output from PLL setup structure (precise frequency) | ||
2025 | * param pSetup : Pointer to populated PLL setup structure | ||
2026 | * param flagcfg : Flag configuration for PLL config structure | ||
2027 | * return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
2028 | * note This function will power off the PLL, setup the PLL with the | ||
2029 | * new setup data, and then optionally powerup the PLL, wait for PLL lock, | ||
2030 | * and adjust system voltages to the new PLL rate. The function will not | ||
2031 | * alter any source clocks (ie, main systen clock) that may use the PLL, | ||
2032 | * so these should be setup prior to and after exiting the function. | ||
2033 | */ | ||
2034 | pll_error_t CLOCK_SetupSystemPLLPrec(pll_setup_t *pSetup, uint32_t flagcfg) | ||
2035 | { | ||
2036 | if ((SYSCON->SYSPLLCLKSEL & SYSCON_SYSPLLCLKSEL_SEL_MASK) == 0x01U) | ||
2037 | { | ||
2038 | /* Turn on the ext clock if system pll input select clk_in */ | ||
2039 | CLOCK_Enable_SysOsc(true); | ||
2040 | } | ||
2041 | /* Enable power for PLLs */ | ||
2042 | POWER_SetPLL(); | ||
2043 | /* Power off PLL during setup changes */ | ||
2044 | POWER_EnablePD(kPDRUNCFG_PD_SYS_PLL0); | ||
2045 | |||
2046 | pSetup->flags = flagcfg; | ||
2047 | |||
2048 | /* Write PLL setup data */ | ||
2049 | SYSCON->SYSPLLCTRL = pSetup->pllctrl; | ||
2050 | SYSCON->SYSPLLNDEC = pSetup->pllndec; | ||
2051 | SYSCON->SYSPLLNDEC = pSetup->pllndec | (1UL << SYSCON_SYSPLLNDEC_NREQ_SHIFT); /* latch */ | ||
2052 | SYSCON->SYSPLLPDEC = pSetup->pllpdec; | ||
2053 | SYSCON->SYSPLLPDEC = pSetup->pllpdec | (1UL << SYSCON_SYSPLLPDEC_PREQ_SHIFT); /* latch */ | ||
2054 | SYSCON->SYSPLLMDEC = pSetup->pllmdec; | ||
2055 | SYSCON->SYSPLLMDEC = pSetup->pllmdec | (1UL << SYSCON_SYSPLLMDEC_MREQ_SHIFT); /* latch */ | ||
2056 | |||
2057 | /* Flags for lock or power on */ | ||
2058 | if ((pSetup->flags & (PLL_SETUPFLAG_POWERUP | PLL_SETUPFLAG_WAITLOCK)) != 0U) | ||
2059 | { | ||
2060 | /* If turning the PLL back on, perform the following sequence to accelerate PLL lock */ | ||
2061 | uint32_t maxCCO = (1UL << 18U) | 0x5dd2U; /* CCO = 1.6Ghz + MDEC enabled*/ | ||
2062 | uint32_t curSSCTRL = SYSCON->SYSPLLMDEC & ~(1UL << 17U); | ||
2063 | |||
2064 | /* Initialize and power up PLL */ | ||
2065 | SYSCON->SYSPLLMDEC = maxCCO; | ||
2066 | POWER_DisablePD(kPDRUNCFG_PD_SYS_PLL0); | ||
2067 | |||
2068 | /* Set mreq to activate */ | ||
2069 | SYSCON->SYSPLLMDEC = maxCCO | (1UL << 17U); | ||
2070 | |||
2071 | /* Delay for 72 uSec @ 12Mhz */ | ||
2072 | SDK_DelayAtLeastUs(72U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2073 | |||
2074 | /* clear mreq to prepare for restoring mreq */ | ||
2075 | SYSCON->SYSPLLMDEC = curSSCTRL; | ||
2076 | |||
2077 | /* set original value back and activate */ | ||
2078 | SYSCON->SYSPLLMDEC = curSSCTRL | (1UL << 17U); | ||
2079 | |||
2080 | /* Enable peripheral states by setting low */ | ||
2081 | POWER_DisablePD(kPDRUNCFG_PD_SYS_PLL0); | ||
2082 | } | ||
2083 | if ((pSetup->flags & PLL_SETUPFLAG_WAITLOCK) != 0U) | ||
2084 | { | ||
2085 | while (CLOCK_IsSystemPLLLocked() == false) | ||
2086 | { | ||
2087 | } | ||
2088 | } | ||
2089 | |||
2090 | /* Update current programmed PLL rate var */ | ||
2091 | CLOCK_GetSystemPLLOutFromSetupUpdate(pSetup); | ||
2092 | |||
2093 | /* System voltage adjustment, occurs prior to setting main system clock */ | ||
2094 | if ((pSetup->flags & PLL_SETUPFLAG_ADGVOLT) != 0U) | ||
2095 | { | ||
2096 | POWER_SetVoltageForFreq(s_Pll_Freq); | ||
2097 | } | ||
2098 | |||
2099 | return kStatus_PLL_Success; | ||
2100 | } | ||
2101 | |||
2102 | /* Set AUDIO PLL output from AUDIO PLL setup structure */ | ||
2103 | /*! brief Set AUDIO PLL output from AUDIOPLL setup structure (precise frequency) | ||
2104 | * param pSetup : Pointer to populated PLL setup structure | ||
2105 | * param flagcfg : Flag configuration for PLL config structure | ||
2106 | * return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
2107 | * note This function will power off the PLL, setup the PLL with the | ||
2108 | * new setup data, and then optionally powerup the AUDIO PLL, wait for PLL lock, | ||
2109 | * and adjust system voltages to the new AUDIOPLL rate. The function will not | ||
2110 | * alter any source clocks (ie, main systen clock) that may use the AUDIO PLL, | ||
2111 | * so these should be setup prior to and after exiting the function. | ||
2112 | */ | ||
2113 | pll_error_t CLOCK_SetupAudioPLLPrec(pll_setup_t *pSetup, uint32_t flagcfg) | ||
2114 | { | ||
2115 | if ((SYSCON->AUDPLLCLKSEL & SYSCON_AUDPLLCLKSEL_SEL_MASK) == 0x01U) | ||
2116 | { | ||
2117 | /* Turn on the ext clock if system pll input select clk_in */ | ||
2118 | CLOCK_Enable_SysOsc(true); | ||
2119 | } | ||
2120 | /* Enable power VD3 for PLLs */ | ||
2121 | POWER_SetPLL(); | ||
2122 | /* Power off PLL during setup changes */ | ||
2123 | POWER_EnablePD(kPDRUNCFG_PD_AUDIO_PLL); | ||
2124 | |||
2125 | pSetup->flags = flagcfg; | ||
2126 | |||
2127 | /* Write PLL setup data */ | ||
2128 | SYSCON->AUDPLLCTRL = pSetup->pllctrl; | ||
2129 | SYSCON->AUDPLLNDEC = pSetup->pllndec; | ||
2130 | SYSCON->AUDPLLNDEC = pSetup->pllndec | (1UL << SYSCON_SYSPLLNDEC_NREQ_SHIFT); /* latch */ | ||
2131 | SYSCON->AUDPLLPDEC = pSetup->pllpdec; | ||
2132 | SYSCON->AUDPLLPDEC = pSetup->pllpdec | (1UL << SYSCON_SYSPLLPDEC_PREQ_SHIFT); /* latch */ | ||
2133 | SYSCON->AUDPLLMDEC = pSetup->pllmdec; | ||
2134 | SYSCON->AUDPLLMDEC = pSetup->pllmdec | (1UL << SYSCON_SYSPLLMDEC_MREQ_SHIFT); /* latch */ | ||
2135 | SYSCON->AUDPLLFRAC = SYSCON_AUDPLLFRAC_SEL_EXT(1); /* disable fractional function */ | ||
2136 | |||
2137 | /* Flags for lock or power on */ | ||
2138 | if ((pSetup->flags & (PLL_SETUPFLAG_POWERUP | PLL_SETUPFLAG_WAITLOCK)) != 0U) | ||
2139 | { | ||
2140 | /* If turning the PLL back on, perform the following sequence to accelerate PLL lock */ | ||
2141 | uint32_t maxCCO = (1UL << 18U) | 0x5dd2U; /* CCO = 1.6Ghz + MDEC enabled*/ | ||
2142 | uint32_t curSSCTRL = SYSCON->AUDPLLMDEC & ~(1UL << 17U); | ||
2143 | |||
2144 | /* Initialize and power up PLL */ | ||
2145 | SYSCON->AUDPLLMDEC = maxCCO; | ||
2146 | POWER_DisablePD(kPDRUNCFG_PD_AUDIO_PLL); | ||
2147 | |||
2148 | /* Set mreq to activate */ | ||
2149 | SYSCON->AUDPLLMDEC = maxCCO | (1UL << 17U); | ||
2150 | |||
2151 | /* Delay for 72 uSec @ 12Mhz */ | ||
2152 | SDK_DelayAtLeastUs(72U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2153 | |||
2154 | /* clear mreq to prepare for restoring mreq */ | ||
2155 | SYSCON->AUDPLLMDEC = curSSCTRL; | ||
2156 | |||
2157 | /* set original value back and activate */ | ||
2158 | SYSCON->AUDPLLMDEC = curSSCTRL | (1UL << 17U); | ||
2159 | |||
2160 | /* Enable peripheral states by setting low */ | ||
2161 | POWER_DisablePD(kPDRUNCFG_PD_AUDIO_PLL); | ||
2162 | } | ||
2163 | if ((pSetup->flags & PLL_SETUPFLAG_WAITLOCK) != 0U) | ||
2164 | { | ||
2165 | while (CLOCK_IsAudioPLLLocked() == false) | ||
2166 | { | ||
2167 | } | ||
2168 | } | ||
2169 | |||
2170 | /* Update current programmed PLL rate var */ | ||
2171 | CLOCK_GetAudioPLLOutFromSetupUpdate(pSetup); | ||
2172 | |||
2173 | return kStatus_PLL_Success; | ||
2174 | } | ||
2175 | |||
2176 | /* Set AUDIO PLL output from AUDIO PLL fractional setup structure */ | ||
2177 | /*! brief Set AUDIO PLL output from AUDIOPLL setup structure using the Audio Fractional divider register(precise | ||
2178 | * frequency) | ||
2179 | * param pSetup : Pointer to populated PLL setup structure | ||
2180 | * param flagcfg : Flag configuration for PLL config structure | ||
2181 | * return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
2182 | * note This function will power off the PLL, setup the PLL with the | ||
2183 | * new setup data, and then optionally powerup the AUDIO PLL, wait for PLL lock, | ||
2184 | * and adjust system voltages to the new AUDIOPLL rate. The function will not | ||
2185 | * alter any source clocks (ie, main systen clock) that may use the AUDIO PLL, | ||
2186 | * so these should be setup prior to and after exiting the function. | ||
2187 | */ | ||
2188 | pll_error_t CLOCK_SetupAudioPLLPrecFract(pll_setup_t *pSetup, uint32_t flagcfg) | ||
2189 | { | ||
2190 | if ((SYSCON->AUDPLLCLKSEL & SYSCON_AUDPLLCLKSEL_SEL_MASK) == 0x01U) | ||
2191 | { | ||
2192 | /* Turn on the ext clock if system pll input select clk_in */ | ||
2193 | CLOCK_Enable_SysOsc(true); | ||
2194 | } | ||
2195 | /* Enable power VD3 for PLLs */ | ||
2196 | POWER_SetPLL(); | ||
2197 | /* Power off PLL during setup changes */ | ||
2198 | POWER_EnablePD(kPDRUNCFG_PD_AUDIO_PLL); | ||
2199 | |||
2200 | pSetup->flags = flagcfg; | ||
2201 | |||
2202 | /* Write PLL setup data */ | ||
2203 | SYSCON->AUDPLLCTRL = pSetup->pllctrl; | ||
2204 | SYSCON->AUDPLLNDEC = pSetup->pllndec; | ||
2205 | SYSCON->AUDPLLNDEC = pSetup->pllndec | (1UL << SYSCON_SYSPLLNDEC_NREQ_SHIFT); /* latch */ | ||
2206 | SYSCON->AUDPLLPDEC = pSetup->pllpdec; | ||
2207 | SYSCON->AUDPLLPDEC = pSetup->pllpdec | (1UL << SYSCON_SYSPLLPDEC_PREQ_SHIFT); /* latch */ | ||
2208 | SYSCON->AUDPLLMDEC = pSetup->pllmdec; | ||
2209 | SYSCON->AUDPLLFRAC = SYSCON_AUDPLLFRAC_SEL_EXT(0); /* enable fractional function */ | ||
2210 | SYSCON->AUDPLLFRAC = pSetup->audpllfrac; | ||
2211 | SYSCON->AUDPLLFRAC = pSetup->audpllfrac | (1UL << SYSCON_AUDPLLFRAC_REQ_SHIFT); | ||
2212 | |||
2213 | /* Enable peripheral states by setting low */ | ||
2214 | POWER_DisablePD(kPDRUNCFG_PD_AUDIO_PLL); | ||
2215 | |||
2216 | if ((pSetup->flags & PLL_SETUPFLAG_WAITLOCK) != 0U) | ||
2217 | { | ||
2218 | while (CLOCK_IsAudioPLLLocked() == false) | ||
2219 | { | ||
2220 | } | ||
2221 | } | ||
2222 | |||
2223 | /* Update current programmed PLL rate var */ | ||
2224 | CLOCK_GetAudioPLLOutFromAudioFracSetupUpdate(pSetup); | ||
2225 | |||
2226 | return kStatus_PLL_Success; | ||
2227 | } | ||
2228 | |||
2229 | /* Set Audio PLL output based on the passed Audio PLL setup data */ | ||
2230 | /*! brief Set AUDIO PLL output based on the passed AUDIO PLL setup data | ||
2231 | * param pControl : Pointer to populated PLL control structure to generate setup with | ||
2232 | * param pSetup : Pointer to PLL setup structure to be filled | ||
2233 | * return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
2234 | * note Actual frequency for setup may vary from the desired frequency based on the | ||
2235 | * accuracy of input clocks, rounding, non-fractional PLL mode, etc. | ||
2236 | */ | ||
2237 | pll_error_t CLOCK_SetupAudioPLLData(pll_config_t *pControl, pll_setup_t *pSetup) | ||
2238 | { | ||
2239 | uint32_t inRate; | ||
2240 | pll_error_t pllError; | ||
2241 | |||
2242 | /* Determine input rate for the PLL */ | ||
2243 | if ((pControl->flags & PLL_CONFIGFLAG_USEINRATE) != 0U) | ||
2244 | { | ||
2245 | inRate = pControl->inputRate; | ||
2246 | } | ||
2247 | else | ||
2248 | { | ||
2249 | inRate = CLOCK_GetAudioPLLInClockRate(); | ||
2250 | } | ||
2251 | |||
2252 | /* PLL flag options */ | ||
2253 | pllError = CLOCK_GetPllConfig(inRate, pControl->desiredRate, pSetup); | ||
2254 | pSetup->pllRate = pControl->desiredRate; | ||
2255 | return pllError; | ||
2256 | } | ||
2257 | |||
2258 | /* Setup PLL Frequency from pre-calculated value */ | ||
2259 | /** | ||
2260 | * brief Set PLL output from PLL setup structure (precise frequency) | ||
2261 | * param pSetup : Pointer to populated PLL setup structure | ||
2262 | * return kStatus_PLL_Success on success, or PLL setup error code | ||
2263 | * note This function will power off the PLL, setup the PLL with the | ||
2264 | * new setup data, and then optionally powerup the PLL, wait for PLL lock, | ||
2265 | * and adjust system voltages to the new PLL rate. The function will not | ||
2266 | * alter any source clocks (ie, main systen clock) that may use the PLL, | ||
2267 | * so these should be setup prior to and after exiting the function. | ||
2268 | */ | ||
2269 | pll_error_t CLOCK_SetPLLFreq(const pll_setup_t *pSetup) | ||
2270 | { | ||
2271 | if ((SYSCON->SYSPLLCLKSEL & SYSCON_SYSPLLCLKSEL_SEL_MASK) == 0x01U) | ||
2272 | { | ||
2273 | /* Turn on the ext clock if system pll input select clk_in */ | ||
2274 | CLOCK_Enable_SysOsc(true); | ||
2275 | } | ||
2276 | /* Enable power VD3 for PLLs */ | ||
2277 | POWER_SetPLL(); | ||
2278 | /* Power off PLL during setup changes */ | ||
2279 | POWER_EnablePD(kPDRUNCFG_PD_SYS_PLL0); | ||
2280 | |||
2281 | /* Write PLL setup data */ | ||
2282 | SYSCON->SYSPLLCTRL = pSetup->pllctrl; | ||
2283 | SYSCON->SYSPLLNDEC = pSetup->pllndec; | ||
2284 | SYSCON->SYSPLLNDEC = pSetup->pllndec | (1UL << SYSCON_SYSPLLNDEC_NREQ_SHIFT); /* latch */ | ||
2285 | SYSCON->SYSPLLPDEC = pSetup->pllpdec; | ||
2286 | SYSCON->SYSPLLPDEC = pSetup->pllpdec | (1UL << SYSCON_SYSPLLPDEC_PREQ_SHIFT); /* latch */ | ||
2287 | SYSCON->SYSPLLMDEC = pSetup->pllmdec; | ||
2288 | SYSCON->SYSPLLMDEC = pSetup->pllmdec | (1UL << SYSCON_SYSPLLMDEC_MREQ_SHIFT); /* latch */ | ||
2289 | |||
2290 | /* Flags for lock or power on */ | ||
2291 | if ((pSetup->flags & (PLL_SETUPFLAG_POWERUP | PLL_SETUPFLAG_WAITLOCK)) != 0U) | ||
2292 | { | ||
2293 | /* If turning the PLL back on, perform the following sequence to accelerate PLL lock */ | ||
2294 | uint32_t maxCCO = (1UL << 18U) | 0x5dd2U; /* CCO = 1.6Ghz + MDEC enabled*/ | ||
2295 | uint32_t curSSCTRL = SYSCON->SYSPLLMDEC & ~(1UL << 17U); | ||
2296 | |||
2297 | /* Initialize and power up PLL */ | ||
2298 | SYSCON->SYSPLLMDEC = maxCCO; | ||
2299 | POWER_DisablePD(kPDRUNCFG_PD_SYS_PLL0); | ||
2300 | |||
2301 | /* Set mreq to activate */ | ||
2302 | SYSCON->SYSPLLMDEC = maxCCO | (1UL << 17U); | ||
2303 | |||
2304 | /* Delay for 72 uSec @ 12Mhz */ | ||
2305 | SDK_DelayAtLeastUs(72U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2306 | |||
2307 | /* clear mreq to prepare for restoring mreq */ | ||
2308 | SYSCON->SYSPLLMDEC = curSSCTRL; | ||
2309 | |||
2310 | /* set original value back and activate */ | ||
2311 | SYSCON->SYSPLLMDEC = curSSCTRL | (1UL << 17U); | ||
2312 | |||
2313 | /* Enable peripheral states by setting low */ | ||
2314 | POWER_DisablePD(kPDRUNCFG_PD_SYS_PLL0); | ||
2315 | } | ||
2316 | if ((pSetup->flags & PLL_SETUPFLAG_WAITLOCK) != 0U) | ||
2317 | { | ||
2318 | while (CLOCK_IsSystemPLLLocked() == false) | ||
2319 | { | ||
2320 | } | ||
2321 | } | ||
2322 | |||
2323 | /* Update current programmed PLL rate var */ | ||
2324 | s_Pll_Freq = pSetup->pllRate; | ||
2325 | |||
2326 | return kStatus_PLL_Success; | ||
2327 | } | ||
2328 | |||
2329 | /* Setup Audio PLL Frequency from pre-calculated value */ | ||
2330 | /** | ||
2331 | * brief Set Audio PLL output from Audio PLL setup structure (precise frequency) | ||
2332 | * param pSetup : Pointer to populated PLL setup structure | ||
2333 | * return kStatus_PLL_Success on success, or Audio PLL setup error code | ||
2334 | * note This function will power off the PLL, setup the Audio PLL with the | ||
2335 | * new setup data, and then optionally powerup the PLL, wait for Audio PLL lock, | ||
2336 | * and adjust system voltages to the new PLL rate. The function will not | ||
2337 | * alter any source clocks (ie, main systen clock) that may use the Audio PLL, | ||
2338 | * so these should be setup prior to and after exiting the function. | ||
2339 | */ | ||
2340 | pll_error_t CLOCK_SetAudioPLLFreq(const pll_setup_t *pSetup) | ||
2341 | { | ||
2342 | if ((SYSCON->AUDPLLCLKSEL & SYSCON_AUDPLLCLKSEL_SEL_MASK) == 0x01U) | ||
2343 | { | ||
2344 | /* Turn on the ext clock if system pll input select clk_in */ | ||
2345 | CLOCK_Enable_SysOsc(true); | ||
2346 | } | ||
2347 | /* Enable power VD3 for PLLs */ | ||
2348 | POWER_SetPLL(); | ||
2349 | /* Power off Audio PLL during setup changes */ | ||
2350 | POWER_EnablePD(kPDRUNCFG_PD_AUDIO_PLL); | ||
2351 | |||
2352 | /* Write Audio PLL setup data */ | ||
2353 | SYSCON->AUDPLLCTRL = pSetup->pllctrl; | ||
2354 | SYSCON->AUDPLLFRAC = pSetup->audpllfrac; | ||
2355 | SYSCON->AUDPLLFRAC = pSetup->audpllfrac | (1UL << SYSCON_AUDPLLFRAC_REQ_SHIFT); /* latch */ | ||
2356 | SYSCON->AUDPLLNDEC = pSetup->pllndec; | ||
2357 | SYSCON->AUDPLLNDEC = pSetup->pllndec | (1UL << SYSCON_AUDPLLNDEC_NREQ_SHIFT); /* latch */ | ||
2358 | SYSCON->AUDPLLPDEC = pSetup->pllpdec; | ||
2359 | SYSCON->AUDPLLPDEC = pSetup->pllpdec | (1UL << SYSCON_AUDPLLPDEC_PREQ_SHIFT); /* latch */ | ||
2360 | SYSCON->AUDPLLMDEC = pSetup->pllmdec; | ||
2361 | SYSCON->AUDPLLMDEC = pSetup->pllmdec | (1UL << SYSCON_AUDPLLMDEC_MREQ_SHIFT); /* latch */ | ||
2362 | SYSCON->AUDPLLFRAC = SYSCON_AUDPLLFRAC_SEL_EXT(1); /* disable fractional function */ | ||
2363 | |||
2364 | /* Flags for lock or power on */ | ||
2365 | if ((pSetup->flags & (PLL_SETUPFLAG_POWERUP | PLL_SETUPFLAG_WAITLOCK)) != 0U) | ||
2366 | { | ||
2367 | /* If turning the PLL back on, perform the following sequence to accelerate PLL lock */ | ||
2368 | uint32_t maxCCO = (1UL << 18U) | 0x5dd2U; /* CCO = 1.6Ghz + MDEC enabled*/ | ||
2369 | uint32_t curSSCTRL = SYSCON->SYSPLLMDEC & ~(1UL << 17U); | ||
2370 | |||
2371 | /* Initialize and power up PLL */ | ||
2372 | SYSCON->SYSPLLMDEC = maxCCO; | ||
2373 | POWER_DisablePD(kPDRUNCFG_PD_AUDIO_PLL); | ||
2374 | |||
2375 | /* Set mreq to activate */ | ||
2376 | SYSCON->SYSPLLMDEC = maxCCO | (1UL << 17U); | ||
2377 | |||
2378 | /* Delay for 72 uSec @ 12Mhz */ | ||
2379 | SDK_DelayAtLeastUs(72U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2380 | |||
2381 | /* clear mreq to prepare for restoring mreq */ | ||
2382 | SYSCON->SYSPLLMDEC = curSSCTRL; | ||
2383 | |||
2384 | /* set original value back and activate */ | ||
2385 | SYSCON->SYSPLLMDEC = curSSCTRL | (1UL << 17U); | ||
2386 | |||
2387 | /* Enable peripheral states by setting low */ | ||
2388 | POWER_DisablePD(kPDRUNCFG_PD_AUDIO_PLL); | ||
2389 | } | ||
2390 | if ((pSetup->flags & PLL_SETUPFLAG_WAITLOCK) != 0U) | ||
2391 | { | ||
2392 | while (CLOCK_IsAudioPLLLocked() == false) | ||
2393 | { | ||
2394 | } | ||
2395 | } | ||
2396 | |||
2397 | /* Update current programmed PLL rate var */ | ||
2398 | s_Audio_Pll_Freq = pSetup->pllRate; | ||
2399 | |||
2400 | return kStatus_PLL_Success; | ||
2401 | } | ||
2402 | |||
2403 | /* Setup USB PLL Frequency from pre-calculated value */ | ||
2404 | /** | ||
2405 | * brief Set USB PLL output from USB PLL setup structure (precise frequency) | ||
2406 | * param pSetup : Pointer to populated USB PLL setup structure | ||
2407 | * return kStatus_PLL_Success on success, or USB PLL setup error code | ||
2408 | * note This function will power off the USB PLL, setup the PLL with the | ||
2409 | * new setup data, and then optionally powerup the USB PLL, wait for USB PLL lock, | ||
2410 | * and adjust system voltages to the new USB PLL rate. The function will not | ||
2411 | * alter any source clocks (ie, usb pll clock) that may use the USB PLL, | ||
2412 | * so these should be setup prior to and after exiting the function. | ||
2413 | */ | ||
2414 | pll_error_t CLOCK_SetUsbPLLFreq(const usb_pll_setup_t *pSetup) | ||
2415 | { | ||
2416 | uint32_t usbpllctrl, fccoHz; | ||
2417 | uint8_t msel, psel, nsel; | ||
2418 | bool pllDirectInput, pllDirectOutput, pllfbsel; | ||
2419 | |||
2420 | msel = pSetup->msel; | ||
2421 | psel = pSetup->psel; | ||
2422 | nsel = pSetup->nsel; | ||
2423 | pllDirectOutput = pSetup->direct; | ||
2424 | pllDirectInput = pSetup->bypass; | ||
2425 | pllfbsel = pSetup->fbsel; | ||
2426 | |||
2427 | /* Input clock into the PLL cannot be lower than this */ | ||
2428 | if (pSetup->inputRate < USB_PLL_LOWER_IN_LIMIT) | ||
2429 | { | ||
2430 | return kStatus_PLL_InputTooLow; | ||
2431 | } | ||
2432 | |||
2433 | if (pllfbsel) | ||
2434 | { | ||
2435 | /*integer_mode: Fout = M*(Fin/N), Fcco = 2*P*M*(Fin/N) */ | ||
2436 | fccoHz = (pSetup->inputRate / ((uint32_t)nsel + 1U)) * 2U * (msel + 1U) * SWITCH_USB_PSEL(psel); | ||
2437 | |||
2438 | /* USB PLL CCO out rate cannot be lower than this */ | ||
2439 | if (fccoHz < USB_PLL_MIN_CCO_FREQ_MHZ) | ||
2440 | { | ||
2441 | return kStatus_PLL_CCOTooLow; | ||
2442 | } | ||
2443 | /* USB PLL CCO out rate cannot be Higher than this */ | ||
2444 | if (fccoHz > USB_PLL_MAX_CCO_FREQ_MHZ) | ||
2445 | { | ||
2446 | return kStatus_PLL_CCOTooHigh; | ||
2447 | } | ||
2448 | } | ||
2449 | else | ||
2450 | { | ||
2451 | /* non integer_mode: Fout = M*(Fin/N)/(2*P), Fcco = M * (Fin/N) */ | ||
2452 | fccoHz = pSetup->inputRate / ((uint32_t)nsel + 1U) * (msel + 1U); | ||
2453 | |||
2454 | /* USB PLL CCO out rate cannot be lower than this */ | ||
2455 | if (fccoHz < USB_PLL_MIN_CCO_FREQ_MHZ) | ||
2456 | { | ||
2457 | return kStatus_PLL_CCOTooLow; | ||
2458 | } | ||
2459 | /* USB PLL CCO out rate cannot be Higher than this */ | ||
2460 | if (fccoHz > USB_PLL_MAX_CCO_FREQ_MHZ) | ||
2461 | { | ||
2462 | return kStatus_PLL_CCOTooHigh; | ||
2463 | } | ||
2464 | } | ||
2465 | |||
2466 | /* If configure the USB HOST clock, VD5 power for USB PHY should be enable | ||
2467 | before the PLL is working */ | ||
2468 | /* Turn on the ext clock for usb pll input */ | ||
2469 | CLOCK_Enable_SysOsc(true); | ||
2470 | |||
2471 | /* Enable power VD3 for PLLs */ | ||
2472 | POWER_SetPLL(); | ||
2473 | |||
2474 | /* Power on the VD5 for USB PHY */ | ||
2475 | POWER_SetUsbPhy(); | ||
2476 | |||
2477 | /* Power off USB PLL during setup changes */ | ||
2478 | POWER_EnablePD(kPDRUNCFG_PD_USB_PLL); | ||
2479 | |||
2480 | /* Write USB PLL setup data */ | ||
2481 | usbpllctrl = USB_PLL_NSEL_VAL_SET(nsel) | /* NSEL VALUE */ | ||
2482 | USB_PLL_PSEL_VAL_SET(psel) | /* PSEL VALUE */ | ||
2483 | USB_PLL_MSEL_VAL_SET(msel) | /* MSEL VALUE */ | ||
2484 | (uint32_t)pllDirectInput << SYSCON_USBPLLCTRL_BYPASS_SHIFT | /* BYPASS DISABLE */ | ||
2485 | (uint32_t)pllDirectOutput << SYSCON_USBPLLCTRL_DIRECT_SHIFT | /* DIRECTO DISABLE */ | ||
2486 | (uint32_t)pllfbsel << SYSCON_USBPLLCTRL_FBSEL_SHIFT; /* FBSEL SELECT */ | ||
2487 | |||
2488 | SYSCON->USBPLLCTRL = usbpllctrl; | ||
2489 | |||
2490 | POWER_DisablePD(kPDRUNCFG_PD_USB_PLL); | ||
2491 | |||
2492 | /* Delay for 72 uSec @ 12Mhz for the usb pll to lock */ | ||
2493 | SDK_DelayAtLeastUs(72U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2494 | if (false == pllDirectInput) | ||
2495 | { | ||
2496 | while (CLOCK_IsUsbPLLLocked() == false) | ||
2497 | { | ||
2498 | } | ||
2499 | } | ||
2500 | CLOCK_GetUsbPLLOutFromSetupUpdate(pSetup); | ||
2501 | return kStatus_PLL_Success; | ||
2502 | } | ||
2503 | |||
2504 | /* Set System PLL clock based on the input frequency and multiplier */ | ||
2505 | /*! brief Set PLL output based on the multiplier and input frequency | ||
2506 | * param multiply_by : multiplier | ||
2507 | * param input_freq : Clock input frequency of the PLL | ||
2508 | * return Nothing | ||
2509 | * note Unlike the Chip_Clock_SetupSystemPLLPrec() function, this | ||
2510 | * function does not disable or enable PLL power, wait for PLL lock, | ||
2511 | * or adjust system voltages. These must be done in the application. | ||
2512 | * The function will not alter any source clocks (ie, main systen clock) | ||
2513 | * that may use the PLL, so these should be setup prior to and after | ||
2514 | * exiting the function. | ||
2515 | */ | ||
2516 | void CLOCK_SetupSystemPLLMult(uint32_t multiply_by, uint32_t input_freq) | ||
2517 | { | ||
2518 | uint32_t cco_freq = input_freq * multiply_by; | ||
2519 | uint32_t pdec = 1U; | ||
2520 | uint32_t selr; | ||
2521 | uint32_t seli; | ||
2522 | uint32_t selp; | ||
2523 | uint32_t mdec, ndec; | ||
2524 | |||
2525 | uint32_t directo = SYSCON_SYSPLLCTRL_DIRECTO(1); | ||
2526 | |||
2527 | while (cco_freq < 275000000U) | ||
2528 | { | ||
2529 | multiply_by <<= 1U; /* double value in each iteration */ | ||
2530 | pdec <<= 1U; /* correspondingly double pdec to cancel effect of double msel */ | ||
2531 | cco_freq = input_freq * multiply_by; | ||
2532 | } | ||
2533 | selr = 0U; | ||
2534 | if (multiply_by < 60U) | ||
2535 | { | ||
2536 | seli = (multiply_by & 0x3cU) + 4U; | ||
2537 | selp = (multiply_by >> 1U) + 1U; | ||
2538 | } | ||
2539 | else | ||
2540 | { | ||
2541 | selp = 31U; | ||
2542 | if (multiply_by > 16384U) | ||
2543 | { | ||
2544 | seli = 1U; | ||
2545 | } | ||
2546 | else if (multiply_by > 8192U) | ||
2547 | { | ||
2548 | seli = 2U; | ||
2549 | } | ||
2550 | else if (multiply_by > 2048U) | ||
2551 | { | ||
2552 | seli = 4U; | ||
2553 | } | ||
2554 | else if (multiply_by >= 501U) | ||
2555 | { | ||
2556 | seli = 8U; | ||
2557 | } | ||
2558 | else | ||
2559 | { | ||
2560 | seli = 4U * (1024U / (multiply_by + 9U)); | ||
2561 | } | ||
2562 | } | ||
2563 | |||
2564 | if (pdec > 1U) | ||
2565 | { | ||
2566 | directo = 0U; /* use post divider */ | ||
2567 | pdec = pdec / 2U; /* Account for minus 1 encoding */ | ||
2568 | /* Translate P value */ | ||
2569 | switch (pdec) | ||
2570 | { | ||
2571 | case 1U: | ||
2572 | pdec = 0x62U; /* 1 * 2 */ | ||
2573 | break; | ||
2574 | case 2U: | ||
2575 | pdec = 0x42U; /* 2 * 2 */ | ||
2576 | break; | ||
2577 | case 4U: | ||
2578 | pdec = 0x02U; /* 4 * 2 */ | ||
2579 | break; | ||
2580 | case 8U: | ||
2581 | pdec = 0x0bU; /* 8 * 2 */ | ||
2582 | break; | ||
2583 | case 16U: | ||
2584 | pdec = 0x11U; /* 16 * 2 */ | ||
2585 | break; | ||
2586 | case 32U: | ||
2587 | pdec = 0x08U; /* 32 * 2 */ | ||
2588 | break; | ||
2589 | default: | ||
2590 | pdec = 0x08U; | ||
2591 | break; | ||
2592 | } | ||
2593 | } | ||
2594 | |||
2595 | mdec = PLL_MDEC_VAL_SET(pllEncodeM(multiply_by)); | ||
2596 | ndec = 0x302U; /* pre divide by 1 (hardcoded) */ | ||
2597 | |||
2598 | SYSCON->SYSPLLCTRL = directo | (selr << SYSCON_SYSPLLCTRL_SELR_SHIFT) | (seli << SYSCON_SYSPLLCTRL_SELI_SHIFT) | | ||
2599 | (selp << SYSCON_SYSPLLCTRL_SELP_SHIFT); | ||
2600 | SYSCON->SYSPLLPDEC = pdec | (1U << 7U); /* set Pdec value and assert preq */ | ||
2601 | SYSCON->SYSPLLNDEC = ndec | (1UL << 10U); /* set Pdec value and assert preq */ | ||
2602 | SYSCON->SYSPLLMDEC = (1UL << 17U) | mdec; /* select non sscg MDEC value, assert mreq and select mdec value */ | ||
2603 | } | ||
2604 | |||
2605 | /* Enable USB DEVICE FULL SPEED clock */ | ||
2606 | /*! brief Enable USB Device FS clock. | ||
2607 | * param src : clock source | ||
2608 | * param freq: clock frequency | ||
2609 | * Enable USB Device Full Speed clock. | ||
2610 | */ | ||
2611 | bool CLOCK_EnableUsbfs0DeviceClock(clock_usb_src_t src, uint32_t freq) | ||
2612 | { | ||
2613 | bool ret = true; | ||
2614 | |||
2615 | CLOCK_DisableClock(kCLOCK_Usbd0); | ||
2616 | |||
2617 | if (kCLOCK_UsbSrcFro == src) | ||
2618 | { | ||
2619 | switch (freq) | ||
2620 | { | ||
2621 | case 96000000U: | ||
2622 | CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 2U, false); /*!< Div by 2 to get 48MHz, no divider reset */ | ||
2623 | break; | ||
2624 | |||
2625 | case 48000000U: | ||
2626 | CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 1U, false); /*!< Div by 1 to get 48MHz, no divider reset */ | ||
2627 | break; | ||
2628 | |||
2629 | default: | ||
2630 | ret = false; | ||
2631 | break; | ||
2632 | } | ||
2633 | /* Turn ON FRO HF and let it adjust TRIM value based on USB SOF */ | ||
2634 | SYSCON->FROCTRL = (SYSCON->FROCTRL & ~((0x01UL << 15U) | (0xFUL << 26U))) | SYSCON_FROCTRL_HSPDCLK_MASK | | ||
2635 | SYSCON_FROCTRL_USBCLKADJ_MASK; | ||
2636 | /* Select FRO 96 or 48 MHz */ | ||
2637 | CLOCK_AttachClk(kFRO_HF_to_USB0_CLK); | ||
2638 | } | ||
2639 | else | ||
2640 | { | ||
2641 | /*Set the USB PLL as the Usb0 CLK*/ | ||
2642 | POWER_DisablePD(kPDRUNCFG_PD_USB_PLL); | ||
2643 | |||
2644 | usb_pll_setup_t pll_setup = {0x3FU, 0x01U, 0x03U, false, false, false, 12000000U}; | ||
2645 | |||
2646 | (void)CLOCK_SetUsbPLLFreq(&pll_setup); | ||
2647 | CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 1U, false); | ||
2648 | CLOCK_AttachClk(kUSB_PLL_to_USB0_CLK); | ||
2649 | SDK_DelayAtLeastUs(50U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2650 | } | ||
2651 | CLOCK_EnableClock(kCLOCK_Usbd0); | ||
2652 | CLOCK_EnableClock(kCLOCK_UsbRam1); | ||
2653 | |||
2654 | return ret; | ||
2655 | } | ||
2656 | |||
2657 | /* Enable USB HOST FULL SPEED clock */ | ||
2658 | /*! brief Enable USB HOST FS clock. | ||
2659 | * param src : clock source | ||
2660 | * param freq: clock frequency | ||
2661 | * Enable USB HOST Full Speed clock. | ||
2662 | */ | ||
2663 | bool CLOCK_EnableUsbfs0HostClock(clock_usb_src_t src, uint32_t freq) | ||
2664 | { | ||
2665 | bool ret = true; | ||
2666 | |||
2667 | CLOCK_DisableClock(kCLOCK_Usbhmr0); | ||
2668 | CLOCK_DisableClock(kCLOCK_Usbhsl0); | ||
2669 | |||
2670 | if (kCLOCK_UsbSrcFro == src) | ||
2671 | { | ||
2672 | switch (freq) | ||
2673 | { | ||
2674 | case 96000000U: | ||
2675 | CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 2U, false); /*!< Div by 2 to get 48MHz, no divider reset */ | ||
2676 | break; | ||
2677 | |||
2678 | case 48000000U: | ||
2679 | CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 1U, false); /*!< Div by 1 to get 48MHz, no divider reset */ | ||
2680 | break; | ||
2681 | |||
2682 | default: | ||
2683 | ret = false; | ||
2684 | break; | ||
2685 | } | ||
2686 | /* Turn ON FRO HF and let it adjust TRIM value based on USB SOF */ | ||
2687 | SYSCON->FROCTRL = (SYSCON->FROCTRL & ~((0x01UL << 15U) | (0xFUL << 26U))) | SYSCON_FROCTRL_HSPDCLK_MASK | | ||
2688 | SYSCON_FROCTRL_USBCLKADJ_MASK; | ||
2689 | /* Select FRO 96 or 48 MHz */ | ||
2690 | CLOCK_AttachClk(kFRO_HF_to_USB0_CLK); | ||
2691 | } | ||
2692 | else | ||
2693 | { | ||
2694 | /*Set the USB PLL as the Usb0 CLK*/ | ||
2695 | POWER_DisablePD(kPDRUNCFG_PD_USB_PLL); | ||
2696 | |||
2697 | usb_pll_setup_t pll_setup = {0x3FU, 0x01U, 0x03U, false, false, false, 12000000U}; | ||
2698 | |||
2699 | (void)CLOCK_SetUsbPLLFreq(&pll_setup); | ||
2700 | CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 1U, false); | ||
2701 | CLOCK_AttachClk(kUSB_PLL_to_USB0_CLK); | ||
2702 | SDK_DelayAtLeastUs(50U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2703 | } | ||
2704 | CLOCK_EnableClock(kCLOCK_Usbhmr0); | ||
2705 | CLOCK_EnableClock(kCLOCK_Usbhsl0); | ||
2706 | CLOCK_EnableClock(kCLOCK_UsbRam1); | ||
2707 | |||
2708 | return ret; | ||
2709 | } | ||
2710 | |||
2711 | /* Enable USB DEVICE HIGH SPEED clock */ | ||
2712 | /*! brief Enable USB Device HS clock. | ||
2713 | * param src : clock source | ||
2714 | * param freq: clock frequency | ||
2715 | * Enable USB Device High Speed clock. | ||
2716 | */ | ||
2717 | bool CLOCK_EnableUsbhs0DeviceClock(clock_usb_src_t src, uint32_t freq) | ||
2718 | { | ||
2719 | bool ret = true; | ||
2720 | CLOCK_DisableClock(kCLOCK_Usbd1); | ||
2721 | /* Power on the VD5 for USB PHY */ | ||
2722 | POWER_SetUsbPhy(); | ||
2723 | if (kCLOCK_UsbSrcFro == src) | ||
2724 | { | ||
2725 | switch (freq) | ||
2726 | { | ||
2727 | case 96000000U: | ||
2728 | CLOCK_SetClkDiv(kCLOCK_DivUsb1Clk, 2U, false); /*!< Div by 2 to get 48MHz, no divider reset */ | ||
2729 | break; | ||
2730 | |||
2731 | case 48000000U: | ||
2732 | CLOCK_SetClkDiv(kCLOCK_DivUsb1Clk, 1U, false); /*!< Div by 1 to get 48MHz, no divider reset */ | ||
2733 | break; | ||
2734 | |||
2735 | default: | ||
2736 | ret = false; | ||
2737 | break; | ||
2738 | } | ||
2739 | /* Turn ON FRO HF and let it adjust TRIM value based on USB SOF */ | ||
2740 | SYSCON->FROCTRL = (SYSCON->FROCTRL & ~((0x01UL << 15U) | (0xFUL << 26U))) | SYSCON_FROCTRL_HSPDCLK_MASK | | ||
2741 | SYSCON_FROCTRL_USBCLKADJ_MASK; | ||
2742 | /* Select FRO 96 or 48 MHz */ | ||
2743 | CLOCK_AttachClk(kFRO_HF_to_USB1_CLK); | ||
2744 | } | ||
2745 | else | ||
2746 | { | ||
2747 | SDK_DelayAtLeastUs(50, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2748 | usb_pll_setup_t pll_setup = {0x3FU, 0x01U, 0x03U, false, false, false, 12000000U}; | ||
2749 | |||
2750 | (void)CLOCK_SetUsbPLLFreq(&pll_setup); | ||
2751 | |||
2752 | /* Select USB PLL output as USB clock src */ | ||
2753 | CLOCK_SetClkDiv(kCLOCK_DivUsb1Clk, 1U, false); | ||
2754 | CLOCK_AttachClk(kUSB_PLL_to_USB1_CLK); | ||
2755 | } | ||
2756 | |||
2757 | SDK_DelayAtLeastUs(50, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2758 | /* Enable USB1D and USB1RAM */ | ||
2759 | CLOCK_EnableClock(kCLOCK_Usbd1); | ||
2760 | CLOCK_EnableClock(kCLOCK_UsbRam1); | ||
2761 | POWER_DisablePD(kPDRUNCFG_PD_USB1_PHY); /* Turn on power for USB PHY */ | ||
2762 | return ret; | ||
2763 | } | ||
2764 | |||
2765 | /* Enable USB HOST HIGH SPEED clock */ | ||
2766 | /*! brief Enable USB HOST HS clock. | ||
2767 | * param src : clock source | ||
2768 | * param freq: clock frequency | ||
2769 | * Enable USB HOST High Speed clock. | ||
2770 | */ | ||
2771 | bool CLOCK_EnableUsbhs0HostClock(clock_usb_src_t src, uint32_t freq) | ||
2772 | { | ||
2773 | bool ret = true; | ||
2774 | CLOCK_DisableClock(kCLOCK_Usbh1); | ||
2775 | /* Power on the VD5 for USB PHY */ | ||
2776 | POWER_SetUsbPhy(); | ||
2777 | if (kCLOCK_UsbSrcFro == src) | ||
2778 | { | ||
2779 | switch (freq) | ||
2780 | { | ||
2781 | case 96000000U: | ||
2782 | CLOCK_SetClkDiv(kCLOCK_DivUsb1Clk, 2U, false); /*!< Div by 2 to get 48MHz, no divider reset */ | ||
2783 | break; | ||
2784 | |||
2785 | case 48000000U: | ||
2786 | CLOCK_SetClkDiv(kCLOCK_DivUsb1Clk, 1U, false); /*!< Div by 1 to get 48MHz, no divider reset */ | ||
2787 | break; | ||
2788 | |||
2789 | default: | ||
2790 | ret = false; | ||
2791 | break; | ||
2792 | } | ||
2793 | /* Turn ON FRO HF and let it adjust TRIM value based on USB SOF */ | ||
2794 | SYSCON->FROCTRL = (SYSCON->FROCTRL & ~((0x01UL << 15U) | (0xFUL << 26U))) | SYSCON_FROCTRL_HSPDCLK_MASK | | ||
2795 | SYSCON_FROCTRL_USBCLKADJ_MASK; | ||
2796 | /* Select FRO 96 or 48 MHz */ | ||
2797 | CLOCK_AttachClk(kFRO_HF_to_USB1_CLK); | ||
2798 | } | ||
2799 | else | ||
2800 | { | ||
2801 | SDK_DelayAtLeastUs(50U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2802 | usb_pll_setup_t pll_setup = {0x3FU, 0x01U, 0x03U, false, false, false, 12000000U}; | ||
2803 | |||
2804 | (void)CLOCK_SetUsbPLLFreq(&pll_setup); | ||
2805 | |||
2806 | /* Select USB PLL output as USB clock src */ | ||
2807 | CLOCK_SetClkDiv(kCLOCK_DivUsb1Clk, 1U, false); | ||
2808 | CLOCK_AttachClk(kUSB_PLL_to_USB1_CLK); | ||
2809 | } | ||
2810 | |||
2811 | SDK_DelayAtLeastUs(50, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); | ||
2812 | /* Enable USBh1 and USB1RAM */ | ||
2813 | CLOCK_EnableClock(kCLOCK_Usbh1); | ||
2814 | CLOCK_EnableClock(kCLOCK_UsbRam1); | ||
2815 | POWER_DisablePD(kPDRUNCFG_PD_USB1_PHY); /* Turn on power for USB PHY */ | ||
2816 | return ret; | ||
2817 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_clock.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_clock.h new file mode 100644 index 000000000..381562c22 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_clock.h | |||
@@ -0,0 +1,1293 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016 - 2019 , NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * | ||
7 | * SPDX-License-Identifier: BSD-3-Clause | ||
8 | */ | ||
9 | |||
10 | #ifndef _FSL_CLOCK_H_ | ||
11 | #define _FSL_CLOCK_H_ | ||
12 | |||
13 | #include "fsl_common.h" | ||
14 | |||
15 | /*! @addtogroup clock */ | ||
16 | /*! @{ */ | ||
17 | |||
18 | /*! @file */ | ||
19 | |||
20 | /******************************************************************************* | ||
21 | * Definitions | ||
22 | *****************************************************************************/ | ||
23 | |||
24 | /*! @name Driver version */ | ||
25 | /*@{*/ | ||
26 | /*! @brief CLOCK driver version 2.3.1. */ | ||
27 | #define FSL_CLOCK_DRIVER_VERSION (MAKE_VERSION(2, 3, 1)) | ||
28 | /*@}*/ | ||
29 | |||
30 | /*! @brief Configure whether driver controls clock | ||
31 | * | ||
32 | * When set to 0, peripheral drivers will enable clock in initialize function | ||
33 | * and disable clock in de-initialize function. When set to 1, peripheral | ||
34 | * driver will not control the clock, application could control the clock out of | ||
35 | * the driver. | ||
36 | * | ||
37 | * @note All drivers share this feature switcher. If it is set to 1, application | ||
38 | * should handle clock enable and disable for all drivers. | ||
39 | */ | ||
40 | #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)) | ||
41 | #define FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL 0 | ||
42 | #endif | ||
43 | |||
44 | /*! | ||
45 | * @brief User-defined the size of cache for CLOCK_PllGetConfig() function. | ||
46 | * | ||
47 | * Once define this MACRO to be non-zero value, CLOCK_PllGetConfig() function | ||
48 | * would cache the recent calulation and accelerate the execution to get the | ||
49 | * right settings. | ||
50 | */ | ||
51 | #ifndef CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT | ||
52 | #define CLOCK_USR_CFG_PLL_CONFIG_CACHE_COUNT 2U | ||
53 | #endif | ||
54 | |||
55 | /* Definition for delay API in clock driver, users can redefine it to the real application. */ | ||
56 | #ifndef SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY | ||
57 | #define SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY (180000000UL) | ||
58 | #endif | ||
59 | |||
60 | /*! @brief Clock ip name array for ADC. */ | ||
61 | #define ADC_CLOCKS \ | ||
62 | { \ | ||
63 | kCLOCK_Adc0 \ | ||
64 | } | ||
65 | /*! @brief Clock ip name array for ROM. */ | ||
66 | #define ROM_CLOCKS \ | ||
67 | { \ | ||
68 | kCLOCK_Rom \ | ||
69 | } | ||
70 | /*! @brief Clock ip name array for SRAM. */ | ||
71 | #define SRAM_CLOCKS \ | ||
72 | { \ | ||
73 | kCLOCK_Sram1, kCLOCK_Sram2, kCLOCK_Sram3 \ | ||
74 | } | ||
75 | /*! @brief Clock ip name array for FLASH. */ | ||
76 | #define FLASH_CLOCKS \ | ||
77 | { \ | ||
78 | kCLOCK_Flash \ | ||
79 | } | ||
80 | /*! @brief Clock ip name array for FMC. */ | ||
81 | #define FMC_CLOCKS \ | ||
82 | { \ | ||
83 | kCLOCK_Fmc \ | ||
84 | } | ||
85 | /*! @brief Clock ip name array for EEPROM. */ | ||
86 | #define EEPROM_CLOCKS \ | ||
87 | { \ | ||
88 | kCLOCK_Eeprom \ | ||
89 | } | ||
90 | /*! @brief Clock ip name array for SPIFI. */ | ||
91 | #define SPIFI_CLOCKS \ | ||
92 | { \ | ||
93 | kCLOCK_Spifi \ | ||
94 | } | ||
95 | /*! @brief Clock ip name array for INPUTMUX. */ | ||
96 | #define INPUTMUX_CLOCKS \ | ||
97 | { \ | ||
98 | kCLOCK_InputMux \ | ||
99 | } | ||
100 | /*! @brief Clock ip name array for IOCON. */ | ||
101 | #define IOCON_CLOCKS \ | ||
102 | { \ | ||
103 | kCLOCK_Iocon \ | ||
104 | } | ||
105 | /*! @brief Clock ip name array for GPIO. */ | ||
106 | #define GPIO_CLOCKS \ | ||
107 | { \ | ||
108 | kCLOCK_Gpio0, kCLOCK_Gpio1, kCLOCK_Gpio2, kCLOCK_Gpio3, kCLOCK_Gpio4, kCLOCK_Gpio5 \ | ||
109 | } | ||
110 | /*! @brief Clock ip name array for PINT. */ | ||
111 | #define PINT_CLOCKS \ | ||
112 | { \ | ||
113 | kCLOCK_Pint \ | ||
114 | } | ||
115 | /*! @brief Clock ip name array for GINT. */ | ||
116 | #define GINT_CLOCKS \ | ||
117 | { \ | ||
118 | kCLOCK_Gint, kCLOCK_Gint \ | ||
119 | } | ||
120 | /*! @brief Clock ip name array for DMA. */ | ||
121 | #define DMA_CLOCKS \ | ||
122 | { \ | ||
123 | kCLOCK_Dma \ | ||
124 | } | ||
125 | /*! @brief Clock ip name array for CRC. */ | ||
126 | #define CRC_CLOCKS \ | ||
127 | { \ | ||
128 | kCLOCK_Crc \ | ||
129 | } | ||
130 | /*! @brief Clock ip name array for WWDT. */ | ||
131 | #define WWDT_CLOCKS \ | ||
132 | { \ | ||
133 | kCLOCK_Wwdt \ | ||
134 | } | ||
135 | /*! @brief Clock ip name array for RTC. */ | ||
136 | #define RTC_CLOCKS \ | ||
137 | { \ | ||
138 | kCLOCK_Rtc \ | ||
139 | } | ||
140 | /*! @brief Clock ip name array for ADC0. */ | ||
141 | #define ADC0_CLOCKS \ | ||
142 | { \ | ||
143 | kCLOCK_Adc0 \ | ||
144 | } | ||
145 | /*! @brief Clock ip name array for MRT. */ | ||
146 | #define MRT_CLOCKS \ | ||
147 | { \ | ||
148 | kCLOCK_Mrt \ | ||
149 | } | ||
150 | /*! @brief Clock ip name array for RIT. */ | ||
151 | #define RIT_CLOCKS \ | ||
152 | { \ | ||
153 | kCLOCK_Rit \ | ||
154 | } | ||
155 | /*! @brief Clock ip name array for SCT0. */ | ||
156 | #define SCT_CLOCKS \ | ||
157 | { \ | ||
158 | kCLOCK_Sct0 \ | ||
159 | } | ||
160 | /*! @brief Clock ip name array for MCAN. */ | ||
161 | #define MCAN_CLOCKS \ | ||
162 | { \ | ||
163 | kCLOCK_Mcan0, kCLOCK_Mcan1 \ | ||
164 | } | ||
165 | /*! @brief Clock ip name array for UTICK. */ | ||
166 | #define UTICK_CLOCKS \ | ||
167 | { \ | ||
168 | kCLOCK_Utick \ | ||
169 | } | ||
170 | /*! @brief Clock ip name array for FLEXCOMM. */ | ||
171 | #define FLEXCOMM_CLOCKS \ | ||
172 | { \ | ||
173 | kCLOCK_FlexComm0, kCLOCK_FlexComm1, kCLOCK_FlexComm2, kCLOCK_FlexComm3, kCLOCK_FlexComm4, kCLOCK_FlexComm5, \ | ||
174 | kCLOCK_FlexComm6, kCLOCK_FlexComm7, kCLOCK_FlexComm8, kCLOCK_FlexComm9, kCLOCK_FlexComm10 \ | ||
175 | } | ||
176 | /*! @brief Clock ip name array for LPUART. */ | ||
177 | #define LPUART_CLOCKS \ | ||
178 | { \ | ||
179 | kCLOCK_MinUart0, kCLOCK_MinUart1, kCLOCK_MinUart2, kCLOCK_MinUart3, kCLOCK_MinUart4, kCLOCK_MinUart5, \ | ||
180 | kCLOCK_MinUart6, kCLOCK_MinUart7, kCLOCK_MinUart8, kCLOCK_MinUart9 \ | ||
181 | } | ||
182 | |||
183 | /*! @brief Clock ip name array for BI2C. */ | ||
184 | #define BI2C_CLOCKS \ | ||
185 | { \ | ||
186 | kCLOCK_BI2c0, kCLOCK_BI2c1, kCLOCK_BI2c2, kCLOCK_BI2c3, kCLOCK_BI2c4, kCLOCK_BI2c5, kCLOCK_BI2c6, \ | ||
187 | kCLOCK_BI2c7, kCLOCK_BI2c8, kCLOCK_BI2c9 \ | ||
188 | } | ||
189 | /*! @brief Clock ip name array for LSPI. */ | ||
190 | #define LPSI_CLOCKS \ | ||
191 | { \ | ||
192 | kCLOCK_LSpi0, kCLOCK_LSpi1, kCLOCK_LSpi2, kCLOCK_LSpi3, kCLOCK_LSpi4, kCLOCK_LSpi5, kCLOCK_LSpi6, \ | ||
193 | kCLOCK_LSpi7, kCLOCK_LSpi8, kCLOCK_LSpi9 \ | ||
194 | } | ||
195 | /*! @brief Clock ip name array for FLEXI2S. */ | ||
196 | #define FLEXI2S_CLOCKS \ | ||
197 | { \ | ||
198 | kCLOCK_FlexI2s0, kCLOCK_FlexI2s1, kCLOCK_FlexI2s2, kCLOCK_FlexI2s3, kCLOCK_FlexI2s4, kCLOCK_FlexI2s5, \ | ||
199 | kCLOCK_FlexI2s6, kCLOCK_FlexI2s7, kCLOCK_FlexI2s8, kCLOCK_FlexI2s9 \ | ||
200 | } | ||
201 | /*! @brief Clock ip name array for DMIC. */ | ||
202 | #define DMIC_CLOCKS \ | ||
203 | { \ | ||
204 | kCLOCK_DMic \ | ||
205 | } | ||
206 | /*! @brief Clock ip name array for CT32B. */ | ||
207 | #define CTIMER_CLOCKS \ | ||
208 | { \ | ||
209 | kCLOCK_Ct32b0, kCLOCK_Ct32b1, kCLOCK_Ct32b2, kCLOCK_Ct32b3, kCLOCK_Ct32b4 \ | ||
210 | } | ||
211 | /*! @brief Clock ip name array for LCD. */ | ||
212 | #define LCD_CLOCKS \ | ||
213 | { \ | ||
214 | kCLOCK_Lcd \ | ||
215 | } | ||
216 | /*! @brief Clock ip name array for SDIO. */ | ||
217 | #define SDIO_CLOCKS \ | ||
218 | { \ | ||
219 | kCLOCK_Sdio \ | ||
220 | } | ||
221 | /*! @brief Clock ip name array for USBRAM. */ | ||
222 | #define USBRAM_CLOCKS \ | ||
223 | { \ | ||
224 | kCLOCK_UsbRam1 \ | ||
225 | } | ||
226 | /*! @brief Clock ip name array for EMC. */ | ||
227 | #define EMC_CLOCKS \ | ||
228 | { \ | ||
229 | kCLOCK_Emc \ | ||
230 | } | ||
231 | /*! @brief Clock ip name array for ETH. */ | ||
232 | #define ETH_CLOCKS \ | ||
233 | { \ | ||
234 | kCLOCK_Eth \ | ||
235 | } | ||
236 | /*! @brief Clock ip name array for AES. */ | ||
237 | #define AES_CLOCKS \ | ||
238 | { \ | ||
239 | kCLOCK_Aes \ | ||
240 | } | ||
241 | /*! @brief Clock ip name array for OTP. */ | ||
242 | #define OTP_CLOCKS \ | ||
243 | { \ | ||
244 | kCLOCK_Otp \ | ||
245 | } | ||
246 | /*! @brief Clock ip name array for RNG. */ | ||
247 | #define RNG_CLOCKS \ | ||
248 | { \ | ||
249 | kCLOCK_Rng \ | ||
250 | } | ||
251 | /*! @brief Clock ip name array for USBHMR0. */ | ||
252 | #define USBHMR0_CLOCKS \ | ||
253 | { \ | ||
254 | kCLOCK_Usbhmr0 \ | ||
255 | } | ||
256 | /*! @brief Clock ip name array for USBHSL0. */ | ||
257 | #define USBHSL0_CLOCKS \ | ||
258 | { \ | ||
259 | kCLOCK_Usbhsl0 \ | ||
260 | } | ||
261 | /*! @brief Clock ip name array for SHA0. */ | ||
262 | #define SHA0_CLOCKS \ | ||
263 | { \ | ||
264 | kCLOCK_Sha0 \ | ||
265 | } | ||
266 | /*! @brief Clock ip name array for SMARTCARD. */ | ||
267 | #define SMARTCARD_CLOCKS \ | ||
268 | { \ | ||
269 | kCLOCK_SmartCard0, kCLOCK_SmartCard1 \ | ||
270 | } | ||
271 | /*! @brief Clock ip name array for USBD. */ | ||
272 | #define USBD_CLOCKS \ | ||
273 | { \ | ||
274 | kCLOCK_Usbd0, kCLOCK_Usbh1, kCLOCK_Usbd1 \ | ||
275 | } | ||
276 | /*! @brief Clock ip name array for USBH. */ | ||
277 | #define USBH_CLOCKS \ | ||
278 | { \ | ||
279 | kCLOCK_Usbh1 \ | ||
280 | } | ||
281 | /*! @brief Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock. */ | ||
282 | /*------------------------------------------------------------------------------ | ||
283 | clock_ip_name_t definition: | ||
284 | ------------------------------------------------------------------------------*/ | ||
285 | |||
286 | #define CLK_GATE_REG_OFFSET_SHIFT 8U | ||
287 | #define CLK_GATE_REG_OFFSET_MASK 0xFFFFFF00U | ||
288 | #define CLK_GATE_BIT_SHIFT_SHIFT 0U | ||
289 | #define CLK_GATE_BIT_SHIFT_MASK 0x000000FFU | ||
290 | |||
291 | #define CLK_GATE_DEFINE(reg_offset, bit_shift) \ | ||
292 | ((((reg_offset) << CLK_GATE_REG_OFFSET_SHIFT) & CLK_GATE_REG_OFFSET_MASK) | \ | ||
293 | (((bit_shift) << CLK_GATE_BIT_SHIFT_SHIFT) & CLK_GATE_BIT_SHIFT_MASK)) | ||
294 | |||
295 | #define CLK_GATE_ABSTRACT_REG_OFFSET(x) (((uint32_t)(x)&CLK_GATE_REG_OFFSET_MASK) >> CLK_GATE_REG_OFFSET_SHIFT) | ||
296 | #define CLK_GATE_ABSTRACT_BITS_SHIFT(x) (((uint32_t)(x)&CLK_GATE_BIT_SHIFT_MASK) >> CLK_GATE_BIT_SHIFT_SHIFT) | ||
297 | |||
298 | #define AHB_CLK_CTRL0 0 | ||
299 | #define AHB_CLK_CTRL1 1 | ||
300 | #define AHB_CLK_CTRL2 2 | ||
301 | #define ASYNC_CLK_CTRL0 3 | ||
302 | |||
303 | /*! @brief Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock. */ | ||
304 | typedef enum _clock_ip_name | ||
305 | { | ||
306 | kCLOCK_IpInvalid = 0U, | ||
307 | kCLOCK_Rom = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 1), | ||
308 | kCLOCK_Sram1 = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 3), | ||
309 | kCLOCK_Sram2 = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 4), | ||
310 | kCLOCK_Sram3 = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 5), | ||
311 | kCLOCK_Spifi = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 10), | ||
312 | kCLOCK_InputMux = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 11), | ||
313 | kCLOCK_Iocon = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 13), | ||
314 | kCLOCK_Gpio0 = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 14), | ||
315 | kCLOCK_Gpio1 = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 15), | ||
316 | kCLOCK_Gpio2 = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 16), | ||
317 | kCLOCK_Gpio3 = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 17), | ||
318 | kCLOCK_Pint = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 18), | ||
319 | kCLOCK_Gint = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 19), | ||
320 | kCLOCK_Dma = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 20), | ||
321 | kCLOCK_Crc = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 21), | ||
322 | kCLOCK_Wwdt = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 22), | ||
323 | kCLOCK_Rtc = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 23), | ||
324 | kCLOCK_Adc0 = CLK_GATE_DEFINE(AHB_CLK_CTRL0, 27), | ||
325 | kCLOCK_Mrt = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 0), | ||
326 | kCLOCK_Rit = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 1), | ||
327 | kCLOCK_Sct0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 2), | ||
328 | kCLOCK_Mcan0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 7), | ||
329 | kCLOCK_Mcan1 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 8), | ||
330 | kCLOCK_Utick = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 10), | ||
331 | kCLOCK_FlexComm0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 11), | ||
332 | kCLOCK_FlexComm1 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 12), | ||
333 | kCLOCK_FlexComm2 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 13), | ||
334 | kCLOCK_FlexComm3 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 14), | ||
335 | kCLOCK_FlexComm4 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 15), | ||
336 | kCLOCK_FlexComm5 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 16), | ||
337 | kCLOCK_FlexComm6 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 17), | ||
338 | kCLOCK_FlexComm7 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 18), | ||
339 | kCLOCK_MinUart0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 11), | ||
340 | kCLOCK_MinUart1 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 12), | ||
341 | kCLOCK_MinUart2 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 13), | ||
342 | kCLOCK_MinUart3 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 14), | ||
343 | kCLOCK_MinUart4 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 15), | ||
344 | kCLOCK_MinUart5 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 16), | ||
345 | kCLOCK_MinUart6 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 17), | ||
346 | kCLOCK_MinUart7 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 18), | ||
347 | kCLOCK_LSpi0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 11), | ||
348 | kCLOCK_LSpi1 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 12), | ||
349 | kCLOCK_LSpi2 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 13), | ||
350 | kCLOCK_LSpi3 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 14), | ||
351 | kCLOCK_LSpi4 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 15), | ||
352 | kCLOCK_LSpi5 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 16), | ||
353 | kCLOCK_LSpi6 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 17), | ||
354 | kCLOCK_LSpi7 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 18), | ||
355 | kCLOCK_BI2c0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 11), | ||
356 | kCLOCK_BI2c1 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 12), | ||
357 | kCLOCK_BI2c2 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 13), | ||
358 | kCLOCK_BI2c3 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 14), | ||
359 | kCLOCK_BI2c4 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 15), | ||
360 | kCLOCK_BI2c5 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 16), | ||
361 | kCLOCK_BI2c6 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 17), | ||
362 | kCLOCK_BI2c7 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 18), | ||
363 | kCLOCK_FlexI2s0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 11), | ||
364 | kCLOCK_FlexI2s1 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 12), | ||
365 | kCLOCK_FlexI2s2 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 13), | ||
366 | kCLOCK_FlexI2s3 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 14), | ||
367 | kCLOCK_FlexI2s4 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 15), | ||
368 | kCLOCK_FlexI2s5 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 16), | ||
369 | kCLOCK_FlexI2s6 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 17), | ||
370 | kCLOCK_FlexI2s7 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 18), | ||
371 | kCLOCK_DMic = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 19), | ||
372 | kCLOCK_Ct32b2 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 22), | ||
373 | kCLOCK_Usbd0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 25), | ||
374 | kCLOCK_Ct32b0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 26), | ||
375 | kCLOCK_Ct32b1 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 27), | ||
376 | kCLOCK_BodyBias0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 29), | ||
377 | kCLOCK_EzhArchB0 = CLK_GATE_DEFINE(AHB_CLK_CTRL1, 31), | ||
378 | kCLOCK_Lcd = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 2), | ||
379 | kCLOCK_Sdio = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 3), | ||
380 | kCLOCK_Usbh1 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 4), | ||
381 | kCLOCK_Usbd1 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 5), | ||
382 | kCLOCK_UsbRam1 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 6), | ||
383 | kCLOCK_Emc = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 7), | ||
384 | kCLOCK_Eth = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 8), | ||
385 | kCLOCK_Gpio4 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 9), | ||
386 | kCLOCK_Gpio5 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 10), | ||
387 | kCLOCK_Aes = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 11), | ||
388 | kCLOCK_Otp = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 12), | ||
389 | kCLOCK_Rng = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 13), | ||
390 | kCLOCK_FlexComm8 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 14), | ||
391 | kCLOCK_FlexComm9 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 15), | ||
392 | kCLOCK_MinUart8 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 14), | ||
393 | kCLOCK_MinUart9 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 15), | ||
394 | kCLOCK_LSpi8 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 14), | ||
395 | kCLOCK_LSpi9 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 15), | ||
396 | kCLOCK_BI2c8 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 14), | ||
397 | kCLOCK_BI2c9 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 15), | ||
398 | kCLOCK_FlexI2s8 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 14), | ||
399 | kCLOCK_FlexI2s9 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 15), | ||
400 | kCLOCK_Usbhmr0 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 16), | ||
401 | kCLOCK_Usbhsl0 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 17), | ||
402 | kCLOCK_Sha0 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 18), | ||
403 | kCLOCK_SmartCard0 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 19), | ||
404 | kCLOCK_SmartCard1 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 20), | ||
405 | kCLOCK_FlexComm10 = CLK_GATE_DEFINE(AHB_CLK_CTRL2, 21), | ||
406 | |||
407 | kCLOCK_Ct32b3 = CLK_GATE_DEFINE(ASYNC_CLK_CTRL0, 13), | ||
408 | kCLOCK_Ct32b4 = CLK_GATE_DEFINE(ASYNC_CLK_CTRL0, 14) | ||
409 | } clock_ip_name_t; | ||
410 | |||
411 | /*! @brief Clock name used to get clock frequency. */ | ||
412 | typedef enum _clock_name | ||
413 | { | ||
414 | kCLOCK_CoreSysClk, /*!< Core/system clock (aka MAIN_CLK) */ | ||
415 | kCLOCK_BusClk, /*!< Bus clock (AHB clock) */ | ||
416 | kCLOCK_ClockOut, /*!< CLOCKOUT */ | ||
417 | kCLOCK_FroHf, /*!< FRO48/96 */ | ||
418 | kCLOCK_UsbPll, /*!< USB1 PLL */ | ||
419 | kCLOCK_Mclk, /*!< MCLK */ | ||
420 | kCLOCK_Fro12M, /*!< FRO12M */ | ||
421 | kCLOCK_ExtClk, /*!< External Clock */ | ||
422 | kCLOCK_PllOut, /*!< PLL Output */ | ||
423 | kCLOCK_UsbClk, /*!< USB input */ | ||
424 | kCLOCK_WdtOsc, /*!< Watchdog Oscillator */ | ||
425 | kCLOCK_Frg, /*!< Frg Clock */ | ||
426 | kCLOCK_AsyncApbClk, /*!< Async APB clock */ | ||
427 | } clock_name_t; | ||
428 | |||
429 | /** | ||
430 | * Clock source selections for the asynchronous APB clock | ||
431 | */ | ||
432 | typedef enum _async_clock_src | ||
433 | { | ||
434 | kCLOCK_AsyncMainClk = 0, /*!< Main System clock */ | ||
435 | kCLOCK_AsyncFro12Mhz, /*!< 12MHz FRO */ | ||
436 | kCLOCK_AsyncAudioPllClk, | ||
437 | kCLOCK_AsyncI2cClkFc6, | ||
438 | |||
439 | } async_clock_src_t; | ||
440 | |||
441 | /*! @brief Clock Mux Switches | ||
442 | * The encoding is as follows each connection identified is 32bits wide while 24bits are valuable | ||
443 | * starting from LSB upwards | ||
444 | * | ||
445 | * [4 bits for choice, 0 means invalid choice] [8 bits mux ID]* | ||
446 | * | ||
447 | */ | ||
448 | |||
449 | #define CLK_ATTACH_ID(mux, sel, pos) ((((uint32_t)(mux) << 0U) | (((uint32_t)(sel) + 1U) & 0xFU) << 8U) << ((pos)*12U)) | ||
450 | #define MUX_A(mux, sel) CLK_ATTACH_ID((mux), (sel), 0U) | ||
451 | #define MUX_B(mux, sel, selector) (CLK_ATTACH_ID((mux), (sel), 1U) | ((selector) << 24U)) | ||
452 | |||
453 | #define GET_ID_ITEM(connection) ((connection)&0xFFFU) | ||
454 | #define GET_ID_NEXT_ITEM(connection) ((connection) >> 12U) | ||
455 | #define GET_ID_ITEM_MUX(connection) ((uint8_t)((connection)&0xFFU)) | ||
456 | #define GET_ID_ITEM_SEL(connection) ((uint8_t)((((connection)&0xF00U) >> 8U) - 1U)) | ||
457 | #define GET_ID_SELECTOR(connection) ((connection)&0xF000000U) | ||
458 | |||
459 | #define CM_STICKCLKSEL 0 | ||
460 | #define CM_MAINCLKSELA 1 | ||
461 | #define CM_MAINCLKSELB 2 | ||
462 | #define CM_CLKOUTCLKSELA 3 | ||
463 | #define CM_SYSPLLCLKSEL 5 | ||
464 | #define CM_AUDPLLCLKSEL 7 | ||
465 | #define CM_SPIFICLKSEL 9 | ||
466 | #define CM_ADCASYNCCLKSEL 10 | ||
467 | #define CM_USB0CLKSEL 11 | ||
468 | #define CM_USB1CLKSEL 12 | ||
469 | #define CM_FXCOMCLKSEL0 13 | ||
470 | #define CM_FXCOMCLKSEL1 14 | ||
471 | #define CM_FXCOMCLKSEL2 15 | ||
472 | #define CM_FXCOMCLKSEL3 16 | ||
473 | #define CM_FXCOMCLKSEL4 17 | ||
474 | #define CM_FXCOMCLKSEL5 18 | ||
475 | #define CM_FXCOMCLKSEL6 19 | ||
476 | #define CM_FXCOMCLKSEL7 20 | ||
477 | #define CM_FXCOMCLKSEL8 21 | ||
478 | #define CM_FXCOMCLKSEL9 22 | ||
479 | #define CM_FXCOMCLKSEL10 23 | ||
480 | #define CM_MCLKCLKSEL 25 | ||
481 | #define CM_FRGCLKSEL 27 | ||
482 | #define CM_DMICCLKSEL 28 | ||
483 | #define CM_SCTCLKSEL 29 | ||
484 | #define CM_LCDCLKSEL 30 | ||
485 | #define CM_SDIOCLKSEL 31 | ||
486 | |||
487 | #define CM_ASYNCAPB 32U | ||
488 | |||
489 | typedef enum _clock_attach_id | ||
490 | { | ||
491 | |||
492 | kSYSTICK_DIV_CLK_to_SYSTICKCLK = MUX_A(CM_STICKCLKSEL, 0), | ||
493 | kWDT_OSC_to_SYSTICKCLK = MUX_A(CM_STICKCLKSEL, 1), | ||
494 | kOSC32K_to_SYSTICKCLK = MUX_A(CM_STICKCLKSEL, 2), | ||
495 | kFRO12M_to_SYSTICKCLK = MUX_A(CM_STICKCLKSEL, 3), | ||
496 | kNONE_to_SYSTICKCLK = MUX_A(CM_STICKCLKSEL, 7), | ||
497 | |||
498 | kFRO12M_to_MAIN_CLK = MUX_A(CM_MAINCLKSELA, 0) | MUX_B(CM_MAINCLKSELB, 0, 0), | ||
499 | kEXT_CLK_to_MAIN_CLK = MUX_A(CM_MAINCLKSELA, 1) | MUX_B(CM_MAINCLKSELB, 0, 0), | ||
500 | kWDT_OSC_to_MAIN_CLK = MUX_A(CM_MAINCLKSELA, 2) | MUX_B(CM_MAINCLKSELB, 0, 0), | ||
501 | kFRO_HF_to_MAIN_CLK = MUX_A(CM_MAINCLKSELA, 3) | MUX_B(CM_MAINCLKSELB, 0, 0), | ||
502 | kSYS_PLL_to_MAIN_CLK = MUX_A(CM_MAINCLKSELA, 0) | MUX_B(CM_MAINCLKSELB, 2, 0), | ||
503 | kOSC32K_to_MAIN_CLK = MUX_A(CM_MAINCLKSELA, 0) | MUX_B(CM_MAINCLKSELB, 3, 0), | ||
504 | |||
505 | kMAIN_CLK_to_CLKOUT = MUX_A(CM_CLKOUTCLKSELA, 0), | ||
506 | kEXT_CLK_to_CLKOUT = MUX_A(CM_CLKOUTCLKSELA, 1), | ||
507 | kWDT_OSC_to_CLKOUT = MUX_A(CM_CLKOUTCLKSELA, 2), | ||
508 | kFRO_HF_to_CLKOUT = MUX_A(CM_CLKOUTCLKSELA, 3), | ||
509 | kSYS_PLL_to_CLKOUT = MUX_A(CM_CLKOUTCLKSELA, 4), | ||
510 | kUSB_PLL_to_CLKOUT = MUX_A(CM_CLKOUTCLKSELA, 5), | ||
511 | kAUDIO_PLL_to_CLKOUT = MUX_A(CM_CLKOUTCLKSELA, 6), | ||
512 | kOSC32K_OSC_to_CLKOUT = MUX_A(CM_CLKOUTCLKSELA, 7), | ||
513 | |||
514 | kFRO12M_to_SYS_PLL = MUX_A(CM_SYSPLLCLKSEL, 0), | ||
515 | kEXT_CLK_to_SYS_PLL = MUX_A(CM_SYSPLLCLKSEL, 1), | ||
516 | kWDT_OSC_to_SYS_PLL = MUX_A(CM_SYSPLLCLKSEL, 2), | ||
517 | kOSC32K_to_SYS_PLL = MUX_A(CM_SYSPLLCLKSEL, 3), | ||
518 | kNONE_to_SYS_PLL = MUX_A(CM_SYSPLLCLKSEL, 7), | ||
519 | |||
520 | kFRO12M_to_AUDIO_PLL = MUX_A(CM_AUDPLLCLKSEL, 0), | ||
521 | kEXT_CLK_to_AUDIO_PLL = MUX_A(CM_AUDPLLCLKSEL, 1), | ||
522 | kNONE_to_AUDIO_PLL = MUX_A(CM_AUDPLLCLKSEL, 7), | ||
523 | |||
524 | kMAIN_CLK_to_SPIFI_CLK = MUX_A(CM_SPIFICLKSEL, 0), | ||
525 | kSYS_PLL_to_SPIFI_CLK = MUX_A(CM_SPIFICLKSEL, 1), | ||
526 | kUSB_PLL_to_SPIFI_CLK = MUX_A(CM_SPIFICLKSEL, 2), | ||
527 | kFRO_HF_to_SPIFI_CLK = MUX_A(CM_SPIFICLKSEL, 3), | ||
528 | kAUDIO_PLL_to_SPIFI_CLK = MUX_A(CM_SPIFICLKSEL, 4), | ||
529 | kNONE_to_SPIFI_CLK = MUX_A(CM_SPIFICLKSEL, 7), | ||
530 | |||
531 | kFRO_HF_to_ADC_CLK = MUX_A(CM_ADCASYNCCLKSEL, 0), | ||
532 | kSYS_PLL_to_ADC_CLK = MUX_A(CM_ADCASYNCCLKSEL, 1), | ||
533 | kUSB_PLL_to_ADC_CLK = MUX_A(CM_ADCASYNCCLKSEL, 2), | ||
534 | kAUDIO_PLL_to_ADC_CLK = MUX_A(CM_ADCASYNCCLKSEL, 3), | ||
535 | kNONE_to_ADC_CLK = MUX_A(CM_ADCASYNCCLKSEL, 7), | ||
536 | |||
537 | kFRO_HF_to_USB0_CLK = MUX_A(CM_USB0CLKSEL, 0), | ||
538 | kSYS_PLL_to_USB0_CLK = MUX_A(CM_USB0CLKSEL, 1), | ||
539 | kUSB_PLL_to_USB0_CLK = MUX_A(CM_USB0CLKSEL, 2), | ||
540 | kNONE_to_USB0_CLK = MUX_A(CM_USB0CLKSEL, 7), | ||
541 | |||
542 | kFRO_HF_to_USB1_CLK = MUX_A(CM_USB1CLKSEL, 0), | ||
543 | kSYS_PLL_to_USB1_CLK = MUX_A(CM_USB1CLKSEL, 1), | ||
544 | kUSB_PLL_to_USB1_CLK = MUX_A(CM_USB1CLKSEL, 2), | ||
545 | kNONE_to_USB1_CLK = MUX_A(CM_USB1CLKSEL, 7), | ||
546 | |||
547 | kFRO12M_to_FLEXCOMM0 = MUX_A(CM_FXCOMCLKSEL0, 0), | ||
548 | kFRO_HF_to_FLEXCOMM0 = MUX_A(CM_FXCOMCLKSEL0, 1), | ||
549 | kAUDIO_PLL_to_FLEXCOMM0 = MUX_A(CM_FXCOMCLKSEL0, 2), | ||
550 | kMCLK_to_FLEXCOMM0 = MUX_A(CM_FXCOMCLKSEL0, 3), | ||
551 | kFRG_to_FLEXCOMM0 = MUX_A(CM_FXCOMCLKSEL0, 4), | ||
552 | kNONE_to_FLEXCOMM0 = MUX_A(CM_FXCOMCLKSEL0, 7), | ||
553 | |||
554 | kFRO12M_to_FLEXCOMM1 = MUX_A(CM_FXCOMCLKSEL1, 0), | ||
555 | kFRO_HF_to_FLEXCOMM1 = MUX_A(CM_FXCOMCLKSEL1, 1), | ||
556 | kAUDIO_PLL_to_FLEXCOMM1 = MUX_A(CM_FXCOMCLKSEL1, 2), | ||
557 | kMCLK_to_FLEXCOMM1 = MUX_A(CM_FXCOMCLKSEL1, 3), | ||
558 | kFRG_to_FLEXCOMM1 = MUX_A(CM_FXCOMCLKSEL1, 4), | ||
559 | kNONE_to_FLEXCOMM1 = MUX_A(CM_FXCOMCLKSEL1, 7), | ||
560 | |||
561 | kFRO12M_to_FLEXCOMM2 = MUX_A(CM_FXCOMCLKSEL2, 0), | ||
562 | kFRO_HF_to_FLEXCOMM2 = MUX_A(CM_FXCOMCLKSEL2, 1), | ||
563 | kAUDIO_PLL_to_FLEXCOMM2 = MUX_A(CM_FXCOMCLKSEL2, 2), | ||
564 | kMCLK_to_FLEXCOMM2 = MUX_A(CM_FXCOMCLKSEL2, 3), | ||
565 | kFRG_to_FLEXCOMM2 = MUX_A(CM_FXCOMCLKSEL2, 4), | ||
566 | kNONE_to_FLEXCOMM2 = MUX_A(CM_FXCOMCLKSEL2, 7), | ||
567 | |||
568 | kFRO12M_to_FLEXCOMM3 = MUX_A(CM_FXCOMCLKSEL3, 0), | ||
569 | kFRO_HF_to_FLEXCOMM3 = MUX_A(CM_FXCOMCLKSEL3, 1), | ||
570 | kAUDIO_PLL_to_FLEXCOMM3 = MUX_A(CM_FXCOMCLKSEL3, 2), | ||
571 | kMCLK_to_FLEXCOMM3 = MUX_A(CM_FXCOMCLKSEL3, 3), | ||
572 | kFRG_to_FLEXCOMM3 = MUX_A(CM_FXCOMCLKSEL3, 4), | ||
573 | kNONE_to_FLEXCOMM3 = MUX_A(CM_FXCOMCLKSEL3, 7), | ||
574 | |||
575 | kFRO12M_to_FLEXCOMM4 = MUX_A(CM_FXCOMCLKSEL4, 0), | ||
576 | kFRO_HF_to_FLEXCOMM4 = MUX_A(CM_FXCOMCLKSEL4, 1), | ||
577 | kAUDIO_PLL_to_FLEXCOMM4 = MUX_A(CM_FXCOMCLKSEL4, 2), | ||
578 | kMCLK_to_FLEXCOMM4 = MUX_A(CM_FXCOMCLKSEL4, 3), | ||
579 | kFRG_to_FLEXCOMM4 = MUX_A(CM_FXCOMCLKSEL4, 4), | ||
580 | kNONE_to_FLEXCOMM4 = MUX_A(CM_FXCOMCLKSEL4, 7), | ||
581 | |||
582 | kFRO12M_to_FLEXCOMM5 = MUX_A(CM_FXCOMCLKSEL5, 0), | ||
583 | kFRO_HF_to_FLEXCOMM5 = MUX_A(CM_FXCOMCLKSEL5, 1), | ||
584 | kAUDIO_PLL_to_FLEXCOMM5 = MUX_A(CM_FXCOMCLKSEL5, 2), | ||
585 | kMCLK_to_FLEXCOMM5 = MUX_A(CM_FXCOMCLKSEL5, 3), | ||
586 | kFRG_to_FLEXCOMM5 = MUX_A(CM_FXCOMCLKSEL5, 4), | ||
587 | kNONE_to_FLEXCOMM5 = MUX_A(CM_FXCOMCLKSEL5, 7), | ||
588 | |||
589 | kFRO12M_to_FLEXCOMM6 = MUX_A(CM_FXCOMCLKSEL6, 0), | ||
590 | kFRO_HF_to_FLEXCOMM6 = MUX_A(CM_FXCOMCLKSEL6, 1), | ||
591 | kAUDIO_PLL_to_FLEXCOMM6 = MUX_A(CM_FXCOMCLKSEL6, 2), | ||
592 | kMCLK_to_FLEXCOMM6 = MUX_A(CM_FXCOMCLKSEL6, 3), | ||
593 | kFRG_to_FLEXCOMM6 = MUX_A(CM_FXCOMCLKSEL6, 4), | ||
594 | kNONE_to_FLEXCOMM6 = MUX_A(CM_FXCOMCLKSEL6, 7), | ||
595 | |||
596 | kFRO12M_to_FLEXCOMM7 = MUX_A(CM_FXCOMCLKSEL7, 0), | ||
597 | kFRO_HF_to_FLEXCOMM7 = MUX_A(CM_FXCOMCLKSEL7, 1), | ||
598 | kAUDIO_PLL_to_FLEXCOMM7 = MUX_A(CM_FXCOMCLKSEL7, 2), | ||
599 | kMCLK_to_FLEXCOMM7 = MUX_A(CM_FXCOMCLKSEL7, 3), | ||
600 | kFRG_to_FLEXCOMM7 = MUX_A(CM_FXCOMCLKSEL7, 4), | ||
601 | kNONE_to_FLEXCOMM7 = MUX_A(CM_FXCOMCLKSEL7, 7), | ||
602 | |||
603 | kFRO12M_to_FLEXCOMM8 = MUX_A(CM_FXCOMCLKSEL8, 0), | ||
604 | kFRO_HF_to_FLEXCOMM8 = MUX_A(CM_FXCOMCLKSEL8, 1), | ||
605 | kAUDIO_PLL_to_FLEXCOMM8 = MUX_A(CM_FXCOMCLKSEL8, 2), | ||
606 | kMCLK_to_FLEXCOMM8 = MUX_A(CM_FXCOMCLKSEL8, 3), | ||
607 | kFRG_to_FLEXCOMM8 = MUX_A(CM_FXCOMCLKSEL8, 4), | ||
608 | kNONE_to_FLEXCOMM8 = MUX_A(CM_FXCOMCLKSEL8, 7), | ||
609 | |||
610 | kFRO12M_to_FLEXCOMM9 = MUX_A(CM_FXCOMCLKSEL9, 0), | ||
611 | kFRO_HF_to_FLEXCOMM9 = MUX_A(CM_FXCOMCLKSEL9, 1), | ||
612 | kAUDIO_PLL_to_FLEXCOMM9 = MUX_A(CM_FXCOMCLKSEL9, 2), | ||
613 | kMCLK_to_FLEXCOMM9 = MUX_A(CM_FXCOMCLKSEL9, 3), | ||
614 | kFRG_to_FLEXCOMM9 = MUX_A(CM_FXCOMCLKSEL9, 4), | ||
615 | kNONE_to_FLEXCOMM9 = MUX_A(CM_FXCOMCLKSEL9, 7), | ||
616 | |||
617 | kMAIN_CLK_to_FLEXCOMM10 = MUX_A(CM_FXCOMCLKSEL10, 0), | ||
618 | kSYS_PLL_to_FLEXCOMM10 = MUX_A(CM_FXCOMCLKSEL10, 1), | ||
619 | kUSB_PLL_to_FLEXCOMM10 = MUX_A(CM_FXCOMCLKSEL10, 2), | ||
620 | kFRO_HF_to_FLEXCOMM10 = MUX_A(CM_FXCOMCLKSEL10, 3), | ||
621 | kAUDIO_PLL_to_FLEXCOMM10 = MUX_A(CM_FXCOMCLKSEL10, 4), | ||
622 | kNONE_to_FLEXCOMM10 = MUX_A(CM_FXCOMCLKSEL10, 7), | ||
623 | |||
624 | kFRO_HF_to_MCLK = MUX_A(CM_MCLKCLKSEL, 0), | ||
625 | kAUDIO_PLL_to_MCLK = MUX_A(CM_MCLKCLKSEL, 1), | ||
626 | kNONE_to_MCLK = MUX_A(CM_MCLKCLKSEL, 7), | ||
627 | |||
628 | kMAIN_CLK_to_FRG = MUX_A(CM_FRGCLKSEL, 0), | ||
629 | kSYS_PLL_to_FRG = MUX_A(CM_FRGCLKSEL, 1), | ||
630 | kFRO12M_to_FRG = MUX_A(CM_FRGCLKSEL, 2), | ||
631 | kFRO_HF_to_FRG = MUX_A(CM_FRGCLKSEL, 3), | ||
632 | kNONE_to_FRG = MUX_A(CM_FRGCLKSEL, 7), | ||
633 | |||
634 | kFRO12M_to_DMIC = MUX_A(CM_DMICCLKSEL, 0), | ||
635 | kFRO_HF_DIV_to_DMIC = MUX_A(CM_DMICCLKSEL, 1), | ||
636 | kAUDIO_PLL_to_DMIC = MUX_A(CM_DMICCLKSEL, 2), | ||
637 | kMCLK_to_DMIC = MUX_A(CM_DMICCLKSEL, 3), | ||
638 | kMAIN_CLK_to_DMIC = MUX_A(CM_DMICCLKSEL, 4), | ||
639 | kWDT_OSC_to_DMIC = MUX_A(CM_DMICCLKSEL, 5), | ||
640 | kNONE_to_DMIC = MUX_A(CM_DMICCLKSEL, 7), | ||
641 | |||
642 | kMAIN_CLK_to_SCT_CLK = MUX_A(CM_SCTCLKSEL, 0), | ||
643 | kSYS_PLL_to_SCT_CLK = MUX_A(CM_SCTCLKSEL, 1), | ||
644 | kFRO_HF_to_SCT_CLK = MUX_A(CM_SCTCLKSEL, 2), | ||
645 | kAUDIO_PLL_to_SCT_CLK = MUX_A(CM_SCTCLKSEL, 3), | ||
646 | kNONE_to_SCT_CLK = MUX_A(CM_SCTCLKSEL, 7), | ||
647 | |||
648 | kMAIN_CLK_to_LCD_CLK = MUX_A(CM_LCDCLKSEL, 0), | ||
649 | kLCDCLKIN_to_LCD_CLK = MUX_A(CM_LCDCLKSEL, 1), | ||
650 | kFRO_HF_to_LCD_CLK = MUX_A(CM_LCDCLKSEL, 2), | ||
651 | kNONE_to_LCD_CLK = MUX_A(CM_LCDCLKSEL, 3), | ||
652 | |||
653 | kMAIN_CLK_to_SDIO_CLK = MUX_A(CM_SDIOCLKSEL, 0), | ||
654 | kSYS_PLL_to_SDIO_CLK = MUX_A(CM_SDIOCLKSEL, 1), | ||
655 | kUSB_PLL_to_SDIO_CLK = MUX_A(CM_SDIOCLKSEL, 2), | ||
656 | kFRO_HF_to_SDIO_CLK = MUX_A(CM_SDIOCLKSEL, 3), | ||
657 | kAUDIO_PLL_to_SDIO_CLK = MUX_A(CM_SDIOCLKSEL, 4), | ||
658 | kNONE_to_SDIO_CLK = MUX_A(CM_SDIOCLKSEL, 7), | ||
659 | |||
660 | kMAIN_CLK_to_ASYNC_APB = MUX_A(CM_ASYNCAPB, 0), | ||
661 | kFRO12M_to_ASYNC_APB = MUX_A(CM_ASYNCAPB, 1), | ||
662 | kAUDIO_PLL_to_ASYNC_APB = MUX_A(CM_ASYNCAPB, 2), | ||
663 | kI2C_CLK_FC6_to_ASYNC_APB = MUX_A(CM_ASYNCAPB, 3), | ||
664 | kNONE_to_NONE = (int)0x80000000U, | ||
665 | } clock_attach_id_t; | ||
666 | |||
667 | /* Clock dividers */ | ||
668 | typedef enum _clock_div_name | ||
669 | { | ||
670 | kCLOCK_DivSystickClk = 0, | ||
671 | kCLOCK_DivArmTrClkDiv = 1, | ||
672 | kCLOCK_DivCan0Clk = 2, | ||
673 | kCLOCK_DivCan1Clk = 3, | ||
674 | kCLOCK_DivSmartCard0Clk = 4, | ||
675 | kCLOCK_DivSmartCard1Clk = 5, | ||
676 | kCLOCK_DivAhbClk = 32, | ||
677 | kCLOCK_DivClkOut = 33, | ||
678 | kCLOCK_DivFrohfClk = 34, | ||
679 | kCLOCK_DivSpifiClk = 36, | ||
680 | kCLOCK_DivAdcAsyncClk = 37, | ||
681 | kCLOCK_DivUsb0Clk = 38, | ||
682 | kCLOCK_DivUsb1Clk = 39, | ||
683 | kCLOCK_DivFrg = 40, | ||
684 | kCLOCK_DivDmicClk = 42, | ||
685 | kCLOCK_DivMClk = 43, | ||
686 | kCLOCK_DivLcdClk = 44, | ||
687 | kCLOCK_DivSctClk = 45, | ||
688 | kCLOCK_DivEmcClk = 46, | ||
689 | kCLOCK_DivSdioClk = 47 | ||
690 | } clock_div_name_t; | ||
691 | |||
692 | /******************************************************************************* | ||
693 | * API | ||
694 | ******************************************************************************/ | ||
695 | |||
696 | #if defined(__cplusplus) | ||
697 | extern "C" { | ||
698 | #endif /* __cplusplus */ | ||
699 | |||
700 | static inline void CLOCK_EnableClock(clock_ip_name_t clk) | ||
701 | { | ||
702 | uint32_t index = CLK_GATE_ABSTRACT_REG_OFFSET(clk); | ||
703 | if (index < 3UL) | ||
704 | { | ||
705 | SYSCON->AHBCLKCTRLSET[index] = (1UL << CLK_GATE_ABSTRACT_BITS_SHIFT(clk)); | ||
706 | } | ||
707 | else | ||
708 | { | ||
709 | SYSCON->ASYNCAPBCTRL = SYSCON_ASYNCAPBCTRL_ENABLE(1); | ||
710 | ASYNC_SYSCON->ASYNCAPBCLKCTRLSET = (1UL << CLK_GATE_ABSTRACT_BITS_SHIFT(clk)); | ||
711 | } | ||
712 | } | ||
713 | |||
714 | static inline void CLOCK_DisableClock(clock_ip_name_t clk) | ||
715 | { | ||
716 | uint32_t index = CLK_GATE_ABSTRACT_REG_OFFSET(clk); | ||
717 | if (index < 3UL) | ||
718 | { | ||
719 | SYSCON->AHBCLKCTRLCLR[index] = (1UL << CLK_GATE_ABSTRACT_BITS_SHIFT(clk)); | ||
720 | } | ||
721 | else | ||
722 | { | ||
723 | ASYNC_SYSCON->ASYNCAPBCLKCTRLCLR = (1UL << CLK_GATE_ABSTRACT_BITS_SHIFT(clk)); | ||
724 | SYSCON->ASYNCAPBCTRL = SYSCON_ASYNCAPBCTRL_ENABLE(0); | ||
725 | } | ||
726 | } | ||
727 | |||
728 | /** | ||
729 | * @brief | ||
730 | * Initialize the Core clock to given frequency (12, 48 or 96 MHz), this API is implememnt in ROM code. | ||
731 | * Turns on FRO and uses default CCO, if freq is 12000000, then high speed output is off, else high speed | ||
732 | * output is enabled. | ||
733 | * Usage: CLOCK_SetupFROClocking(frequency), (frequency must be one of 12, 48 or 96 MHz) | ||
734 | * Note: Need to make sure ROM and OTP has power(PDRUNCFG0[17,29]= 0U) before calling this API since this API is | ||
735 | * implemented in ROM code and the FROHF TRIM value is stored in OTP | ||
736 | * | ||
737 | * @param froFreq target fro frequency. | ||
738 | * @return Nothing | ||
739 | */ | ||
740 | |||
741 | void CLOCK_SetupFROClocking(uint32_t froFreq); | ||
742 | |||
743 | /** | ||
744 | * @brief Configure the clock selection muxes. | ||
745 | * @param connection : Clock to be configured. | ||
746 | * @return Nothing | ||
747 | */ | ||
748 | void CLOCK_AttachClk(clock_attach_id_t connection); | ||
749 | /** | ||
750 | * @brief Get the actual clock attach id. | ||
751 | * This fuction uses the offset in input attach id, then it reads the actual source value in | ||
752 | * the register and combine the offset to obtain an actual attach id. | ||
753 | * @param attachId : Clock attach id to get. | ||
754 | * @return Clock source value. | ||
755 | */ | ||
756 | clock_attach_id_t CLOCK_GetClockAttachId(clock_attach_id_t attachId); | ||
757 | /** | ||
758 | * @brief Setup peripheral clock dividers. | ||
759 | * @param div_name : Clock divider name | ||
760 | * @param divided_by_value: Value to be divided | ||
761 | * @param reset : Whether to reset the divider counter. | ||
762 | * @return Nothing | ||
763 | */ | ||
764 | void CLOCK_SetClkDiv(clock_div_name_t div_name, uint32_t divided_by_value, bool reset); | ||
765 | |||
766 | /*! @brief Return Frequency of selected clock | ||
767 | * @return Frequency of selected clock | ||
768 | */ | ||
769 | uint32_t CLOCK_GetFreq(clock_name_t clockName); | ||
770 | /*! @brief Return Frequency of FRO 12MHz | ||
771 | * @return Frequency of FRO 12MHz | ||
772 | */ | ||
773 | uint32_t CLOCK_GetFro12MFreq(void); | ||
774 | /*! @brief Return Frequency of ClockOut | ||
775 | * @return Frequency of ClockOut | ||
776 | */ | ||
777 | uint32_t CLOCK_GetClockOutClkFreq(void); | ||
778 | /*! @brief Return Frequency of Spifi Clock | ||
779 | * @return Frequency of Spifi. | ||
780 | */ | ||
781 | uint32_t CLOCK_GetSpifiClkFreq(void); | ||
782 | /*! @brief Return Frequency of Adc Clock | ||
783 | * @return Frequency of Adc Clock. | ||
784 | */ | ||
785 | uint32_t CLOCK_GetAdcClkFreq(void); | ||
786 | /*! brief Return Frequency of MCAN Clock | ||
787 | * param MCanSel : 0U: MCAN0; 1U: MCAN1 | ||
788 | * return Frequency of MCAN Clock | ||
789 | */ | ||
790 | uint32_t CLOCK_GetMCanClkFreq(uint32_t MCanSel); | ||
791 | /*! @brief Return Frequency of Usb0 Clock | ||
792 | * @return Frequency of Usb0 Clock. | ||
793 | */ | ||
794 | uint32_t CLOCK_GetUsb0ClkFreq(void); | ||
795 | /*! @brief Return Frequency of Usb1 Clock | ||
796 | * @return Frequency of Usb1 Clock. | ||
797 | */ | ||
798 | uint32_t CLOCK_GetUsb1ClkFreq(void); | ||
799 | /*! @brief Return Frequency of MClk Clock | ||
800 | * @return Frequency of MClk Clock. | ||
801 | */ | ||
802 | uint32_t CLOCK_GetMclkClkFreq(void); | ||
803 | /*! @brief Return Frequency of SCTimer Clock | ||
804 | * @return Frequency of SCTimer Clock. | ||
805 | */ | ||
806 | uint32_t CLOCK_GetSctClkFreq(void); | ||
807 | /*! @brief Return Frequency of SDIO Clock | ||
808 | * @return Frequency of SDIO Clock. | ||
809 | */ | ||
810 | uint32_t CLOCK_GetSdioClkFreq(void); | ||
811 | /*! @brief Return Frequency of LCD Clock | ||
812 | * @return Frequency of LCD Clock. | ||
813 | */ | ||
814 | uint32_t CLOCK_GetLcdClkFreq(void); | ||
815 | /*! @brief Return Frequency of LCD CLKIN Clock | ||
816 | * @return Frequency of LCD CLKIN Clock. | ||
817 | */ | ||
818 | uint32_t CLOCK_GetLcdClkIn(void); | ||
819 | /*! @brief Return Frequency of External Clock | ||
820 | * @return Frequency of External Clock. If no external clock is used returns 0. | ||
821 | */ | ||
822 | uint32_t CLOCK_GetExtClkFreq(void); | ||
823 | /*! @brief Return Frequency of Watchdog Oscillator | ||
824 | * @return Frequency of Watchdog Oscillator | ||
825 | */ | ||
826 | uint32_t CLOCK_GetWdtOscFreq(void); | ||
827 | /*! @brief Return Frequency of High-Freq output of FRO | ||
828 | * @return Frequency of High-Freq output of FRO | ||
829 | */ | ||
830 | uint32_t CLOCK_GetFroHfFreq(void); | ||
831 | /*! @brief Return Frequency of frg | ||
832 | * @return Frequency of FRG | ||
833 | */ | ||
834 | uint32_t CLOCK_GetFrgClkFreq(void); | ||
835 | /*! @brief Return Frequency of dmic | ||
836 | * @return Frequency of DMIC | ||
837 | */ | ||
838 | uint32_t CLOCK_GetDmicClkFreq(void); | ||
839 | |||
840 | /*! | ||
841 | * @brief Set FRG Clk | ||
842 | * @return | ||
843 | * 1: if set FRG CLK successfully. | ||
844 | * 0: if set FRG CLK fail. | ||
845 | */ | ||
846 | uint32_t CLOCK_SetFRGClock(uint32_t freq); | ||
847 | |||
848 | /*! @brief Return Frequency of PLL | ||
849 | * @return Frequency of PLL | ||
850 | */ | ||
851 | uint32_t CLOCK_GetPllOutFreq(void); | ||
852 | /*! @brief Return Frequency of USB PLL | ||
853 | * @return Frequency of PLL | ||
854 | */ | ||
855 | uint32_t CLOCK_GetUsbPllOutFreq(void); | ||
856 | /*! @brief Return Frequency of AUDIO PLL | ||
857 | * @return Frequency of PLL | ||
858 | */ | ||
859 | uint32_t CLOCK_GetAudioPllOutFreq(void); | ||
860 | /*! @brief Return Frequency of 32kHz osc | ||
861 | * @return Frequency of 32kHz osc | ||
862 | */ | ||
863 | uint32_t CLOCK_GetOsc32KFreq(void); | ||
864 | /*! @brief Return Frequency of Core System | ||
865 | * @return Frequency of Core System | ||
866 | */ | ||
867 | uint32_t CLOCK_GetCoreSysClkFreq(void); | ||
868 | /*! @brief Return Frequency of I2S MCLK Clock | ||
869 | * @return Frequency of I2S MCLK Clock | ||
870 | */ | ||
871 | uint32_t CLOCK_GetI2SMClkFreq(void); | ||
872 | /*! @brief Return Frequency of Flexcomm functional Clock | ||
873 | * @return Frequency of Flexcomm functional Clock | ||
874 | */ | ||
875 | uint32_t CLOCK_GetFlexCommClkFreq(uint32_t id); | ||
876 | |||
877 | /*! @brief return FRG Clk | ||
878 | * @return Frequency of FRG CLK. | ||
879 | */ | ||
880 | uint32_t CLOCK_GetFRGInputClock(void); | ||
881 | /*! @brief Return Asynchronous APB Clock source | ||
882 | * @return Asynchronous APB CLock source | ||
883 | */ | ||
884 | __STATIC_INLINE async_clock_src_t CLOCK_GetAsyncApbClkSrc(void) | ||
885 | { | ||
886 | return (async_clock_src_t)(uint32_t)(ASYNC_SYSCON->ASYNCAPBCLKSELA & 0x3U); | ||
887 | } | ||
888 | /*! @brief Return Frequency of Asynchronous APB Clock | ||
889 | * @return Frequency of Asynchronous APB Clock Clock | ||
890 | */ | ||
891 | uint32_t CLOCK_GetAsyncApbClkFreq(void); | ||
892 | /*! @brief Return EMC source | ||
893 | * @return EMC source | ||
894 | */ | ||
895 | __STATIC_INLINE uint32_t CLOCK_GetEmcClkFreq(void) | ||
896 | { | ||
897 | uint32_t freqtmp; | ||
898 | |||
899 | freqtmp = CLOCK_GetCoreSysClkFreq() / ((SYSCON->AHBCLKDIV & 0xffU) + 1U); | ||
900 | return freqtmp / ((SYSCON->EMCCLKDIV & 0xffU) + 1U); | ||
901 | } | ||
902 | /*! @brief Return Audio PLL input clock rate | ||
903 | * @return Audio PLL input clock rate | ||
904 | */ | ||
905 | uint32_t CLOCK_GetAudioPLLInClockRate(void); | ||
906 | /*! @brief Return System PLL input clock rate | ||
907 | * @return System PLL input clock rate | ||
908 | */ | ||
909 | uint32_t CLOCK_GetSystemPLLInClockRate(void); | ||
910 | |||
911 | /*! @brief Return System PLL output clock rate | ||
912 | * @param recompute : Forces a PLL rate recomputation if true | ||
913 | * @return System PLL output clock rate | ||
914 | * @note The PLL rate is cached in the driver in a variable as | ||
915 | * the rate computation function can take some time to perform. It | ||
916 | * is recommended to use 'false' with the 'recompute' parameter. | ||
917 | */ | ||
918 | uint32_t CLOCK_GetSystemPLLOutClockRate(bool recompute); | ||
919 | |||
920 | /*! @brief Return System AUDIO PLL output clock rate | ||
921 | * @param recompute : Forces a AUDIO PLL rate recomputation if true | ||
922 | * @return System AUDIO PLL output clock rate | ||
923 | * @note The AUDIO PLL rate is cached in the driver in a variable as | ||
924 | * the rate computation function can take some time to perform. It | ||
925 | * is recommended to use 'false' with the 'recompute' parameter. | ||
926 | */ | ||
927 | uint32_t CLOCK_GetAudioPLLOutClockRate(bool recompute); | ||
928 | |||
929 | /*! @brief Return System USB PLL output clock rate | ||
930 | * @param recompute : Forces a USB PLL rate recomputation if true | ||
931 | * @return System USB PLL output clock rate | ||
932 | * @note The USB PLL rate is cached in the driver in a variable as | ||
933 | * the rate computation function can take some time to perform. It | ||
934 | * is recommended to use 'false' with the 'recompute' parameter. | ||
935 | */ | ||
936 | uint32_t CLOCK_GetUsbPLLOutClockRate(bool recompute); | ||
937 | |||
938 | /*! @brief Enables and disables PLL bypass mode | ||
939 | * @brief bypass : true to bypass PLL (PLL output = PLL input, false to disable bypass | ||
940 | * @return System PLL output clock rate | ||
941 | */ | ||
942 | __STATIC_INLINE void CLOCK_SetBypassPLL(bool bypass) | ||
943 | { | ||
944 | if (bypass) | ||
945 | { | ||
946 | SYSCON->SYSPLLCTRL |= (1UL << SYSCON_SYSPLLCTRL_BYPASS_SHIFT); | ||
947 | } | ||
948 | else | ||
949 | { | ||
950 | SYSCON->SYSPLLCTRL &= ~(1UL << SYSCON_SYSPLLCTRL_BYPASS_SHIFT); | ||
951 | } | ||
952 | } | ||
953 | |||
954 | /*! @brief Check if PLL is locked or not | ||
955 | * @return true if the PLL is locked, false if not locked | ||
956 | */ | ||
957 | __STATIC_INLINE bool CLOCK_IsSystemPLLLocked(void) | ||
958 | { | ||
959 | return (bool)((SYSCON->SYSPLLSTAT & SYSCON_SYSPLLSTAT_LOCK_MASK) != 0U); | ||
960 | } | ||
961 | |||
962 | /*! @brief Check if USB PLL is locked or not | ||
963 | * @return true if the USB PLL is locked, false if not locked | ||
964 | */ | ||
965 | __STATIC_INLINE bool CLOCK_IsUsbPLLLocked(void) | ||
966 | { | ||
967 | return (bool)((SYSCON->USBPLLSTAT & SYSCON_USBPLLSTAT_LOCK_MASK) != 0U); | ||
968 | } | ||
969 | |||
970 | /*! @brief Check if AUDIO PLL is locked or not | ||
971 | * @return true if the AUDIO PLL is locked, false if not locked | ||
972 | */ | ||
973 | __STATIC_INLINE bool CLOCK_IsAudioPLLLocked(void) | ||
974 | { | ||
975 | return (bool)((SYSCON->AUDPLLSTAT & SYSCON_AUDPLLSTAT_LOCK_MASK) != 0U); | ||
976 | } | ||
977 | |||
978 | /*! @brief Enables and disables SYS OSC | ||
979 | * @brief enable : true to enable SYS OSC, false to disable SYS OSC | ||
980 | */ | ||
981 | __STATIC_INLINE void CLOCK_Enable_SysOsc(bool enable) | ||
982 | { | ||
983 | if (enable) | ||
984 | { | ||
985 | SYSCON->PDRUNCFGCLR[0] |= SYSCON_PDRUNCFG_PDEN_VD2_ANA_MASK; | ||
986 | SYSCON->PDRUNCFGCLR[1] |= SYSCON_PDRUNCFG_PDEN_SYSOSC_MASK; | ||
987 | } | ||
988 | |||
989 | else | ||
990 | { | ||
991 | SYSCON->PDRUNCFGSET[0] = SYSCON_PDRUNCFG_PDEN_VD2_ANA_MASK; | ||
992 | SYSCON->PDRUNCFGSET[1] = SYSCON_PDRUNCFG_PDEN_SYSOSC_MASK; | ||
993 | } | ||
994 | } | ||
995 | |||
996 | /*! @brief Store the current PLL rate | ||
997 | * @param rate: Current rate of the PLL | ||
998 | * @return Nothing | ||
999 | **/ | ||
1000 | void CLOCK_SetStoredPLLClockRate(uint32_t rate); | ||
1001 | |||
1002 | /*! @brief Store the current AUDIO PLL rate | ||
1003 | * @param rate: Current rate of the PLL | ||
1004 | * @return Nothing | ||
1005 | **/ | ||
1006 | void CLOCK_SetStoredAudioPLLClockRate(uint32_t rate); | ||
1007 | |||
1008 | /*! @brief PLL configuration structure flags for 'flags' field | ||
1009 | * These flags control how the PLL configuration function sets up the PLL setup structure.<br> | ||
1010 | * | ||
1011 | * When the PLL_CONFIGFLAG_USEINRATE flag is selected, the 'InputRate' field in the | ||
1012 | * configuration structure must be assigned with the expected PLL frequency. If the | ||
1013 | * PLL_CONFIGFLAG_USEINRATE is not used, 'InputRate' is ignored in the configuration | ||
1014 | * function and the driver will determine the PLL rate from the currently selected | ||
1015 | * PLL source. This flag might be used to configure the PLL input clock more accurately | ||
1016 | * when using the WDT oscillator or a more dyanmic CLKIN source.<br> | ||
1017 | * | ||
1018 | * When the PLL_CONFIGFLAG_FORCENOFRACT flag is selected, the PLL hardware for the | ||
1019 | * automatic bandwidth selection, Spread Spectrum (SS) support, and fractional M-divider | ||
1020 | * are not used.<br> | ||
1021 | */ | ||
1022 | #define PLL_CONFIGFLAG_USEINRATE (1U << 0U) /*!< Flag to use InputRate in PLL configuration structure for setup */ | ||
1023 | #define PLL_CONFIGFLAG_FORCENOFRACT \ | ||
1024 | (1U << 2U) /*!< Force non-fractional output mode, PLL output will not use the fractional, automatic bandwidth, or \ | ||
1025 | SS hardware */ | ||
1026 | |||
1027 | /*! @brief PLL configuration structure | ||
1028 | * | ||
1029 | * This structure can be used to configure the settings for a PLL | ||
1030 | * setup structure. Fill in the desired configuration for the PLL | ||
1031 | * and call the PLL setup function to fill in a PLL setup structure. | ||
1032 | */ | ||
1033 | typedef struct _pll_config | ||
1034 | { | ||
1035 | uint32_t desiredRate; /*!< Desired PLL rate in Hz */ | ||
1036 | uint32_t inputRate; /*!< PLL input clock in Hz, only used if PLL_CONFIGFLAG_USEINRATE flag is set */ | ||
1037 | uint32_t flags; /*!< PLL configuration flags, Or'ed value of PLL_CONFIGFLAG_* definitions */ | ||
1038 | } pll_config_t; | ||
1039 | |||
1040 | /*! @brief PLL setup structure flags for 'flags' field | ||
1041 | * These flags control how the PLL setup function sets up the PLL | ||
1042 | */ | ||
1043 | #define PLL_SETUPFLAG_POWERUP (1U << 0U) /*!< Setup will power on the PLL after setup */ | ||
1044 | #define PLL_SETUPFLAG_WAITLOCK (1U << 1U) /*!< Setup will wait for PLL lock, implies the PLL will be pwoered on */ | ||
1045 | #define PLL_SETUPFLAG_ADGVOLT (1U << 2U) /*!< Optimize system voltage for the new PLL rate */ | ||
1046 | |||
1047 | /*! @brief PLL setup structure | ||
1048 | * This structure can be used to pre-build a PLL setup configuration | ||
1049 | * at run-time and quickly set the PLL to the configuration. It can be | ||
1050 | * populated with the PLL setup function. If powering up or waiting | ||
1051 | * for PLL lock, the PLL input clock source should be configured prior | ||
1052 | * to PLL setup. | ||
1053 | */ | ||
1054 | typedef struct _pll_setup | ||
1055 | { | ||
1056 | uint32_t pllctrl; /*!< PLL control register SYSPLLCTRL */ | ||
1057 | uint32_t pllndec; /*!< PLL NDEC register SYSPLLNDEC */ | ||
1058 | uint32_t pllpdec; /*!< PLL PDEC register SYSPLLPDEC */ | ||
1059 | uint32_t pllmdec; /*!< PLL MDEC registers SYSPLLPDEC */ | ||
1060 | uint32_t pllRate; /*!< Acutal PLL rate */ | ||
1061 | uint32_t audpllfrac; /*!< only aduio PLL has this function*/ | ||
1062 | uint32_t flags; /*!< PLL setup flags, Or'ed value of PLL_SETUPFLAG_* definitions */ | ||
1063 | } pll_setup_t; | ||
1064 | |||
1065 | /*! @brief PLL status definitions | ||
1066 | */ | ||
1067 | typedef enum _pll_error | ||
1068 | { | ||
1069 | kStatus_PLL_Success = MAKE_STATUS(kStatusGroup_Generic, 0), /*!< PLL operation was successful */ | ||
1070 | kStatus_PLL_OutputTooLow = MAKE_STATUS(kStatusGroup_Generic, 1), /*!< PLL output rate request was too low */ | ||
1071 | kStatus_PLL_OutputTooHigh = MAKE_STATUS(kStatusGroup_Generic, 2), /*!< PLL output rate request was too high */ | ||
1072 | kStatus_PLL_InputTooLow = MAKE_STATUS(kStatusGroup_Generic, 3), /*!< PLL input rate is too low */ | ||
1073 | kStatus_PLL_InputTooHigh = MAKE_STATUS(kStatusGroup_Generic, 4), /*!< PLL input rate is too high */ | ||
1074 | kStatus_PLL_OutsideIntLimit = MAKE_STATUS(kStatusGroup_Generic, 5), /*!< Requested output rate isn't possible */ | ||
1075 | kStatus_PLL_CCOTooLow = MAKE_STATUS(kStatusGroup_Generic, 6), /*!< Requested CCO rate isn't possible */ | ||
1076 | kStatus_PLL_CCOTooHigh = MAKE_STATUS(kStatusGroup_Generic, 7) /*!< Requested CCO rate isn't possible */ | ||
1077 | } pll_error_t; | ||
1078 | |||
1079 | /*! @brief USB clock source definition. */ | ||
1080 | typedef enum _clock_usb_src | ||
1081 | { | ||
1082 | kCLOCK_UsbSrcFro = (uint32_t)kCLOCK_FroHf, /*!< Use FRO 96 or 48 MHz. */ | ||
1083 | kCLOCK_UsbSrcSystemPll = (uint32_t)kCLOCK_PllOut, /*!< Use System PLL output. */ | ||
1084 | kCLOCK_UsbSrcMainClock = (uint32_t)kCLOCK_CoreSysClk, /*!< Use Main clock. */ | ||
1085 | kCLOCK_UsbSrcUsbPll = (uint32_t)kCLOCK_UsbPll, /*!< Use USB PLL clock. */ | ||
1086 | |||
1087 | kCLOCK_UsbSrcNone = SYSCON_USB0CLKSEL_SEL( | ||
1088 | 7U) /*!< Use None, this may be selected in order to reduce power when no output is needed.. */ | ||
1089 | } clock_usb_src_t; | ||
1090 | |||
1091 | /*! @brief USB PDEL Divider. */ | ||
1092 | typedef enum _usb_pll_psel | ||
1093 | { | ||
1094 | pSel_Divide_1 = 0U, | ||
1095 | pSel_Divide_2, | ||
1096 | pSel_Divide_4, | ||
1097 | pSel_Divide_8 | ||
1098 | } usb_pll_psel; | ||
1099 | |||
1100 | /*! @brief PLL setup structure | ||
1101 | * This structure can be used to pre-build a USB PLL setup configuration | ||
1102 | * at run-time and quickly set the usb PLL to the configuration. It can be | ||
1103 | * populated with the USB PLL setup function. If powering up or waiting | ||
1104 | * for USB PLL lock, the PLL input clock source should be configured prior | ||
1105 | * to USB PLL setup. | ||
1106 | */ | ||
1107 | typedef struct _usb_pll_setup | ||
1108 | { | ||
1109 | uint8_t msel; /*!< USB PLL control register msel:1U-256U */ | ||
1110 | uint8_t psel; /*!< USB PLL control register psel:only support inter 1U 2U 4U 8U */ | ||
1111 | uint8_t nsel; /*!< USB PLL control register nsel:only suppoet inter 1U 2U 3U 4U */ | ||
1112 | bool direct; /*!< USB PLL CCO output control */ | ||
1113 | bool bypass; /*!< USB PLL inout clock bypass control */ | ||
1114 | bool fbsel; /*!< USB PLL ineter mode and non-integer mode control*/ | ||
1115 | uint32_t inputRate; /*!< USB PLL input rate */ | ||
1116 | } usb_pll_setup_t; | ||
1117 | |||
1118 | /*! @brief Return System PLL output clock rate from setup structure | ||
1119 | * @param pSetup : Pointer to a PLL setup structure | ||
1120 | * @return System PLL output clock rate the setup structure will generate | ||
1121 | */ | ||
1122 | uint32_t CLOCK_GetSystemPLLOutFromSetup(pll_setup_t *pSetup); | ||
1123 | |||
1124 | /*! @brief Return System AUDIO PLL output clock rate from setup structure | ||
1125 | * @param pSetup : Pointer to a PLL setup structure | ||
1126 | * @return System PLL output clock rate the setup structure will generate | ||
1127 | */ | ||
1128 | uint32_t CLOCK_GetAudioPLLOutFromSetup(pll_setup_t *pSetup); | ||
1129 | |||
1130 | /*! @brief Return System AUDIO PLL output clock rate from audio fractioanl setup structure | ||
1131 | * @param pSetup : Pointer to a PLL setup structure | ||
1132 | * @return System PLL output clock rate the setup structure will generate | ||
1133 | */ | ||
1134 | uint32_t CLOCK_GetAudioPLLOutFromFractSetup(pll_setup_t *pSetup); | ||
1135 | |||
1136 | /*! @brief Return System USB PLL output clock rate from setup structure | ||
1137 | * @param pSetup : Pointer to a PLL setup structure | ||
1138 | * @return System PLL output clock rate the setup structure will generate | ||
1139 | */ | ||
1140 | uint32_t CLOCK_GetUsbPLLOutFromSetup(const usb_pll_setup_t *pSetup); | ||
1141 | |||
1142 | /*! @brief Set PLL output based on the passed PLL setup data | ||
1143 | * @param pControl : Pointer to populated PLL control structure to generate setup with | ||
1144 | * @param pSetup : Pointer to PLL setup structure to be filled | ||
1145 | * @return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
1146 | * @note Actual frequency for setup may vary from the desired frequency based on the | ||
1147 | * accuracy of input clocks, rounding, non-fractional PLL mode, etc. | ||
1148 | */ | ||
1149 | pll_error_t CLOCK_SetupPLLData(pll_config_t *pControl, pll_setup_t *pSetup); | ||
1150 | |||
1151 | /*! @brief Set AUDIO PLL output based on the passed AUDIO PLL setup data | ||
1152 | * @param pControl : Pointer to populated PLL control structure to generate setup with | ||
1153 | * @param pSetup : Pointer to PLL setup structure to be filled | ||
1154 | * @return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
1155 | * @note Actual frequency for setup may vary from the desired frequency based on the | ||
1156 | * accuracy of input clocks, rounding, non-fractional PLL mode, etc. | ||
1157 | */ | ||
1158 | pll_error_t CLOCK_SetupAudioPLLData(pll_config_t *pControl, pll_setup_t *pSetup); | ||
1159 | |||
1160 | /*! @brief Set PLL output from PLL setup structure (precise frequency) | ||
1161 | * @param pSetup : Pointer to populated PLL setup structure | ||
1162 | * @param flagcfg : Flag configuration for PLL config structure | ||
1163 | * @return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
1164 | * @note This function will power off the PLL, setup the PLL with the | ||
1165 | * new setup data, and then optionally powerup the PLL, wait for PLL lock, | ||
1166 | * and adjust system voltages to the new PLL rate. The function will not | ||
1167 | * alter any source clocks (ie, main systen clock) that may use the PLL, | ||
1168 | * so these should be setup prior to and after exiting the function. | ||
1169 | */ | ||
1170 | pll_error_t CLOCK_SetupSystemPLLPrec(pll_setup_t *pSetup, uint32_t flagcfg); | ||
1171 | |||
1172 | /*! @brief Set AUDIO PLL output from AUDIOPLL setup structure (precise frequency) | ||
1173 | * @param pSetup : Pointer to populated PLL setup structure | ||
1174 | * @param flagcfg : Flag configuration for PLL config structure | ||
1175 | * @return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
1176 | * @note This function will power off the PLL, setup the PLL with the | ||
1177 | * new setup data, and then optionally powerup the AUDIO PLL, wait for PLL lock, | ||
1178 | * and adjust system voltages to the new AUDIOPLL rate. The function will not | ||
1179 | * alter any source clocks (ie, main systen clock) that may use the AUDIO PLL, | ||
1180 | * so these should be setup prior to and after exiting the function. | ||
1181 | */ | ||
1182 | pll_error_t CLOCK_SetupAudioPLLPrec(pll_setup_t *pSetup, uint32_t flagcfg); | ||
1183 | |||
1184 | /*! @brief Set AUDIO PLL output from AUDIOPLL setup structure using the Audio Fractional divider register(precise | ||
1185 | * frequency) | ||
1186 | * @param pSetup : Pointer to populated PLL setup structure | ||
1187 | * @param flagcfg : Flag configuration for PLL config structure | ||
1188 | * @return PLL_ERROR_SUCCESS on success, or PLL setup error code | ||
1189 | * @note This function will power off the PLL, setup the PLL with the | ||
1190 | * new setup data, and then optionally powerup the AUDIO PLL, wait for PLL lock, | ||
1191 | * and adjust system voltages to the new AUDIOPLL rate. The function will not | ||
1192 | * alter any source clocks (ie, main systen clock) that may use the AUDIO PLL, | ||
1193 | * so these should be setup prior to and after exiting the function. | ||
1194 | */ | ||
1195 | pll_error_t CLOCK_SetupAudioPLLPrecFract(pll_setup_t *pSetup, uint32_t flagcfg); | ||
1196 | |||
1197 | /** | ||
1198 | * @brief Set PLL output from PLL setup structure (precise frequency) | ||
1199 | * @param pSetup : Pointer to populated PLL setup structure | ||
1200 | * @return kStatus_PLL_Success on success, or PLL setup error code | ||
1201 | * @note This function will power off the PLL, setup the PLL with the | ||
1202 | * new setup data, and then optionally powerup the PLL, wait for PLL lock, | ||
1203 | * and adjust system voltages to the new PLL rate. The function will not | ||
1204 | * alter any source clocks (ie, main systen clock) that may use the PLL, | ||
1205 | * so these should be setup prior to and after exiting the function. | ||
1206 | */ | ||
1207 | pll_error_t CLOCK_SetPLLFreq(const pll_setup_t *pSetup); | ||
1208 | |||
1209 | /** | ||
1210 | * @brief Set Audio PLL output from Audio PLL setup structure (precise frequency) | ||
1211 | * @param pSetup : Pointer to populated PLL setup structure | ||
1212 | * @return kStatus_PLL_Success on success, or Audio PLL setup error code | ||
1213 | * @note This function will power off the PLL, setup the Audio PLL with the | ||
1214 | * new setup data, and then optionally powerup the PLL, wait for Audio PLL lock, | ||
1215 | * and adjust system voltages to the new PLL rate. The function will not | ||
1216 | * alter any source clocks (ie, main systen clock) that may use the Audio PLL, | ||
1217 | * so these should be setup prior to and after exiting the function. | ||
1218 | */ | ||
1219 | pll_error_t CLOCK_SetAudioPLLFreq(const pll_setup_t *pSetup); | ||
1220 | |||
1221 | /** | ||
1222 | * @brief Set USB PLL output from USB PLL setup structure (precise frequency) | ||
1223 | * @param pSetup : Pointer to populated USB PLL setup structure | ||
1224 | * @return kStatus_PLL_Success on success, or USB PLL setup error code | ||
1225 | * @note This function will power off the USB PLL, setup the PLL with the | ||
1226 | * new setup data, and then optionally powerup the USB PLL, wait for USB PLL lock, | ||
1227 | * and adjust system voltages to the new USB PLL rate. The function will not | ||
1228 | * alter any source clocks (ie, usb pll clock) that may use the USB PLL, | ||
1229 | * so these should be setup prior to and after exiting the function. | ||
1230 | */ | ||
1231 | pll_error_t CLOCK_SetUsbPLLFreq(const usb_pll_setup_t *pSetup); | ||
1232 | |||
1233 | /*! @brief Set PLL output based on the multiplier and input frequency | ||
1234 | * @param multiply_by : multiplier | ||
1235 | * @param input_freq : Clock input frequency of the PLL | ||
1236 | * @return Nothing | ||
1237 | * @note Unlike the Chip_Clock_SetupSystemPLLPrec() function, this | ||
1238 | * function does not disable or enable PLL power, wait for PLL lock, | ||
1239 | * or adjust system voltages. These must be done in the application. | ||
1240 | * The function will not alter any source clocks (ie, main systen clock) | ||
1241 | * that may use the PLL, so these should be setup prior to and after | ||
1242 | * exiting the function. | ||
1243 | */ | ||
1244 | void CLOCK_SetupSystemPLLMult(uint32_t multiply_by, uint32_t input_freq); | ||
1245 | |||
1246 | /*! @brief Disable USB clock. | ||
1247 | * | ||
1248 | * Disable USB clock. | ||
1249 | */ | ||
1250 | static inline void CLOCK_DisableUsbDevicefs0Clock(clock_ip_name_t clk) | ||
1251 | { | ||
1252 | CLOCK_DisableClock(clk); | ||
1253 | } | ||
1254 | |||
1255 | /*! @brief Enable USB Device FS clock. | ||
1256 | * @param src : clock source | ||
1257 | * @param freq: clock frequency | ||
1258 | * Enable USB Device Full Speed clock. | ||
1259 | */ | ||
1260 | bool CLOCK_EnableUsbfs0DeviceClock(clock_usb_src_t src, uint32_t freq); | ||
1261 | |||
1262 | /*! @brief Enable USB HOST FS clock. | ||
1263 | * @param src : clock source | ||
1264 | * @param freq: clock frequency | ||
1265 | * Enable USB HOST Full Speed clock. | ||
1266 | */ | ||
1267 | bool CLOCK_EnableUsbfs0HostClock(clock_usb_src_t src, uint32_t freq); | ||
1268 | |||
1269 | /*! @brief Set the current Usb PLL Rate | ||
1270 | */ | ||
1271 | void CLOCK_SetStoredUsbPLLClockRate(uint32_t rate); | ||
1272 | |||
1273 | /*! @brief Enable USB Device HS clock. | ||
1274 | * @param src : clock source | ||
1275 | * @param freq: clock frequency | ||
1276 | * Enable USB Device High Speed clock. | ||
1277 | */ | ||
1278 | bool CLOCK_EnableUsbhs0DeviceClock(clock_usb_src_t src, uint32_t freq); | ||
1279 | |||
1280 | /*! @brief Enable USB HOST HS clock. | ||
1281 | * @param src : clock source | ||
1282 | * @param freq: clock frequency | ||
1283 | * Enable USB HOST High Speed clock. | ||
1284 | */ | ||
1285 | bool CLOCK_EnableUsbhs0HostClock(clock_usb_src_t src, uint32_t freq); | ||
1286 | |||
1287 | #if defined(__cplusplus) | ||
1288 | } | ||
1289 | #endif /* __cplusplus */ | ||
1290 | |||
1291 | /*! @} */ | ||
1292 | |||
1293 | #endif /* _FSL_CLOCK_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_inputmux_connections.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_inputmux_connections.h new file mode 100644 index 000000000..d7c604b15 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_inputmux_connections.h | |||
@@ -0,0 +1,203 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2017, NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * | ||
7 | * SPDX-License-Identifier: BSD-3-Clause | ||
8 | */ | ||
9 | |||
10 | #ifndef _FSL_INPUTMUX_CONNECTIONS_ | ||
11 | #define _FSL_INPUTMUX_CONNECTIONS_ | ||
12 | |||
13 | /******************************************************************************* | ||
14 | * Definitions | ||
15 | ******************************************************************************/ | ||
16 | /* Component ID definition, used by tools. */ | ||
17 | #ifndef FSL_COMPONENT_ID | ||
18 | #define FSL_COMPONENT_ID "platform.drivers.inputmux_connections" | ||
19 | #endif | ||
20 | |||
21 | /*! | ||
22 | * @addtogroup inputmux_driver | ||
23 | * @{ | ||
24 | */ | ||
25 | |||
26 | /*! | ||
27 | * @name Input multiplexing connections | ||
28 | * @{ | ||
29 | */ | ||
30 | |||
31 | /*! @brief Periphinmux IDs */ | ||
32 | #define SCT0_PMUX_ID 0x00U | ||
33 | #define PINTSEL_PMUX_ID 0xC0U | ||
34 | #define DMA_TRIG0_PMUX_ID 0xE0U | ||
35 | #define DMA_OTRIG_PMUX_ID 0x160U | ||
36 | #define FREQMEAS_PMUX_ID 0x180U | ||
37 | #define PMUX_SHIFT 20U | ||
38 | |||
39 | /*! @brief INPUTMUX connections type */ | ||
40 | typedef enum _inputmux_connection_t | ||
41 | { | ||
42 | /*!< SCT INMUX. */ | ||
43 | kINPUTMUX_SctGpi0ToSct0 = 0U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
44 | kINPUTMUX_SctGpi1ToSct0 = 1U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
45 | kINPUTMUX_SctGpi2ToSct0 = 2U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
46 | kINPUTMUX_SctGpi3ToSct0 = 3U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
47 | kINPUTMUX_SctGpi4ToSct0 = 4U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
48 | kINPUTMUX_SctGpi5ToSct0 = 5U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
49 | kINPUTMUX_SctGpi6ToSct0 = 6U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
50 | kINPUTMUX_SctGpi7ToSct0 = 7U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
51 | kINPUTMUX_T0Out0ToSct0 = 8U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
52 | kINPUTMUX_T1Out0ToSct0 = 9U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
53 | kINPUTMUX_T2Out0ToSct0 = 10U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
54 | kINPUTMUX_T3Out0ToSct0 = 11U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
55 | kINPUTMUX_T4Out0ToSct0 = 12U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
56 | kINPUTMUX_AdcThcmpIrqToSct0 = 13U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
57 | kINPUTMUX_GpioIntBmatchToSct0 = 14U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
58 | kINPUTMUX_Usb0FrameToggleToSct0 = 15U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
59 | kINPUTMUX_Usb1FrameToggleToSct0 = 16U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
60 | kINPUTMUX_ArmTxevToSct0 = 17U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
61 | kINPUTMUX_DebugHaltedToSct0 = 18U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
62 | kINPUTMUX_SmartCard0TxActivreToSct0 = 19U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
63 | kINPUTMUX_SmartCard0RxActivreToSct0 = 20U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
64 | kINPUTMUX_SmartCard1TxActivreToSct0 = 21U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
65 | kINPUTMUX_SmartCard1RxActivreToSct0 = 22U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
66 | kINPUTMUX_I2s6SclkToSct0 = 23U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
67 | kINPUTMUX_I2sS7clkToSct0 = 24U + (SCT0_PMUX_ID << PMUX_SHIFT), | ||
68 | |||
69 | /*!< Frequency measure. */ | ||
70 | kINPUTMUX_MainOscToFreqmeas = 0U + (FREQMEAS_PMUX_ID << PMUX_SHIFT), | ||
71 | kINPUTMUX_Fro12MhzToFreqmeas = 1U + (FREQMEAS_PMUX_ID << PMUX_SHIFT), | ||
72 | kINPUTMUX_Fro96MhzToFreqmeas = 2U + (FREQMEAS_PMUX_ID << PMUX_SHIFT), | ||
73 | kINPUTMUX_WdtOscToFreqmeas = 3U + (FREQMEAS_PMUX_ID << PMUX_SHIFT), | ||
74 | kINPUTMUX_32KhzOscToFreqmeas = 4U + (FREQMEAS_PMUX_ID << PMUX_SHIFT), | ||
75 | kINPUTMUX_MainClkToFreqmeas = 5U + (FREQMEAS_PMUX_ID << PMUX_SHIFT), | ||
76 | kINPUTMUX_FreqmeGpioClk_a = 6U + (FREQMEAS_PMUX_ID << PMUX_SHIFT), | ||
77 | kINPUTMUX_FreqmeGpioClk_b = 7U + (FREQMEAS_PMUX_ID << PMUX_SHIFT), | ||
78 | |||
79 | /*!< Pin Interrupt. */ | ||
80 | kINPUTMUX_GpioPort0Pin0ToPintsel = 0U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
81 | kINPUTMUX_GpioPort0Pin1ToPintsel = 1U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
82 | kINPUTMUX_GpioPort0Pin2ToPintsel = 2U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
83 | kINPUTMUX_GpioPort0Pin3ToPintsel = 3U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
84 | kINPUTMUX_GpioPort0Pin4ToPintsel = 4U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
85 | kINPUTMUX_GpioPort0Pin5ToPintsel = 5U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
86 | kINPUTMUX_GpioPort0Pin6ToPintsel = 6U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
87 | kINPUTMUX_GpioPort0Pin7ToPintsel = 7U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
88 | kINPUTMUX_GpioPort0Pin8ToPintsel = 8U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
89 | kINPUTMUX_GpioPort0Pin9ToPintsel = 9U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
90 | kINPUTMUX_GpioPort0Pin10ToPintsel = 10U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
91 | kINPUTMUX_GpioPort0Pin11ToPintsel = 11U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
92 | kINPUTMUX_GpioPort0Pin12ToPintsel = 12U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
93 | kINPUTMUX_GpioPort0Pin13ToPintsel = 13U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
94 | kINPUTMUX_GpioPort0Pin14ToPintsel = 14U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
95 | kINPUTMUX_GpioPort0Pin15ToPintsel = 15U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
96 | kINPUTMUX_GpioPort0Pin16ToPintsel = 16U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
97 | kINPUTMUX_GpioPort0Pin17ToPintsel = 17U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
98 | kINPUTMUX_GpioPort0Pin18ToPintsel = 18U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
99 | kINPUTMUX_GpioPort0Pin19ToPintsel = 19U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
100 | kINPUTMUX_GpioPort0Pin20ToPintsel = 20U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
101 | kINPUTMUX_GpioPort0Pin21ToPintsel = 21U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
102 | kINPUTMUX_GpioPort0Pin22ToPintsel = 22U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
103 | kINPUTMUX_GpioPort0Pin23ToPintsel = 23U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
104 | kINPUTMUX_GpioPort0Pin24ToPintsel = 24U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
105 | kINPUTMUX_GpioPort0Pin25ToPintsel = 25U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
106 | kINPUTMUX_GpioPort0Pin26ToPintsel = 26U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
107 | kINPUTMUX_GpioPort0Pin27ToPintsel = 27U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
108 | kINPUTMUX_GpioPort0Pin28ToPintsel = 28U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
109 | kINPUTMUX_GpioPort0Pin29ToPintsel = 29U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
110 | kINPUTMUX_GpioPort0Pin30ToPintsel = 30U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
111 | kINPUTMUX_GpioPort0Pin31ToPintsel = 31U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
112 | kINPUTMUX_GpioPort1Pin0ToPintsel = 32U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
113 | kINPUTMUX_GpioPort1Pin1ToPintsel = 33U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
114 | kINPUTMUX_GpioPort1Pin2ToPintsel = 34U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
115 | kINPUTMUX_GpioPort1Pin3ToPintsel = 35U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
116 | kINPUTMUX_GpioPort1Pin4ToPintsel = 36U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
117 | kINPUTMUX_GpioPort1Pin5ToPintsel = 37U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
118 | kINPUTMUX_GpioPort1Pin6ToPintsel = 38U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
119 | kINPUTMUX_GpioPort1Pin7ToPintsel = 39U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
120 | kINPUTMUX_GpioPort1Pin8ToPintsel = 40U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
121 | kINPUTMUX_GpioPort1Pin9ToPintsel = 41U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
122 | kINPUTMUX_GpioPort1Pin10ToPintsel = 42U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
123 | kINPUTMUX_GpioPort1Pin11ToPintsel = 43U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
124 | kINPUTMUX_GpioPort1Pin12ToPintsel = 44U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
125 | kINPUTMUX_GpioPort1Pin13ToPintsel = 45U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
126 | kINPUTMUX_GpioPort1Pin14ToPintsel = 46U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
127 | kINPUTMUX_GpioPort1Pin15ToPintsel = 47U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
128 | kINPUTMUX_GpioPort1Pin16ToPintsel = 48U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
129 | kINPUTMUX_GpioPort1Pin17ToPintsel = 49U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
130 | kINPUTMUX_GpioPort1Pin18ToPintsel = 50U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
131 | kINPUTMUX_GpioPort1Pin19ToPintsel = 51U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
132 | kINPUTMUX_GpioPort1Pin20ToPintsel = 52U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
133 | kINPUTMUX_GpioPort1Pin21ToPintsel = 53U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
134 | kINPUTMUX_GpioPort1Pin22ToPintsel = 54U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
135 | kINPUTMUX_GpioPort1Pin23ToPintsel = 55U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
136 | kINPUTMUX_GpioPort1Pin24ToPintsel = 56U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
137 | kINPUTMUX_GpioPort1Pin25ToPintsel = 57U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
138 | kINPUTMUX_GpioPort1Pin26ToPintsel = 58U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
139 | kINPUTMUX_GpioPort1Pin27ToPintsel = 59U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
140 | kINPUTMUX_GpioPort1Pin28ToPintsel = 60U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
141 | kINPUTMUX_GpioPort1Pin29ToPintsel = 61U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
142 | kINPUTMUX_GpioPort1Pin30ToPintsel = 62U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
143 | kINPUTMUX_GpioPort1Pin31ToPintsel = 63U + (PINTSEL_PMUX_ID << PMUX_SHIFT), | ||
144 | /*!< DMA ITRIG. */ | ||
145 | kINPUTMUX_Adc0SeqaIrqToDma = 0U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
146 | kINPUTMUX_Adc0SeqbIrqToDma = 1U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
147 | kINPUTMUX_Sct0DmaReq0ToDma = 2U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
148 | kINPUTMUX_Sct0DmaReq1ToDma = 3U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
149 | kINPUTMUX_PinInt0ToDma = 4U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
150 | kINPUTMUX_PinInt1ToDma = 5U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
151 | kINPUTMUX_PinInt2ToDma = 6U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
152 | kINPUTMUX_PinInt3ToDma = 7U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
153 | kINPUTMUX_Ctimer0M0ToDma = 8U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
154 | kINPUTMUX_Ctimer0M1ToDma = 9U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
155 | kINPUTMUX_Ctimer1M0ToDma = 10U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
156 | kINPUTMUX_Ctimer1M1ToDma = 11U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
157 | kINPUTMUX_Ctimer2M0ToDma = 12U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
158 | kINPUTMUX_Ctimer2M1ToDma = 13U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
159 | kINPUTMUX_Ctimer3M0ToDma = 14U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
160 | kINPUTMUX_Ctimer3M1ToDma = 15U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
161 | kINPUTMUX_Ctimer4M0ToDma = 16U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
162 | kINPUTMUX_Ctimer4M1ToDma = 17U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
163 | kINPUTMUX_Otrig0ToDma = 18U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
164 | kINPUTMUX_Otrig1ToDma = 19U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
165 | kINPUTMUX_Otrig2ToDma = 20U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
166 | kINPUTMUX_Otrig3ToDma = 21U + (DMA_TRIG0_PMUX_ID << PMUX_SHIFT), | ||
167 | /*!< DMA OTRIG. */ | ||
168 | kINPUTMUX_DmaFlexcomm0RxTrigoutToTriginChannels = 0U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
169 | kINPUTMUX_DmaFlexcomm0TxTrigoutToTriginChannels = 1U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
170 | kINPUTMUX_DmaFlexcomm1RxTrigoutToTriginChannels = 2U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
171 | kINPUTMUX_DmaFlexcomm1TxTrigoutToTriginChannels = 3U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
172 | kINPUTMUX_DmaFlexcomm2RxTrigoutToTriginChannels = 4U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
173 | kINPUTMUX_DmaFlexcomm2TxTrigoutToTriginChannels = 5U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
174 | kINPUTMUX_DmaFlexcomm3RxTrigoutToTriginChannels = 6U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
175 | kINPUTMUX_DmaFlexcomm3TxTrigoutToTriginChannels = 7U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
176 | kINPUTMUX_DmaFlexcomm4RxTrigoutToTriginChannels = 8U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
177 | kINPUTMUX_DmaFlexcomm4TxTrigoutToTriginChannels = 9U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
178 | kINPUTMUX_DmaFlexcomm5RxTrigoutToTriginChannels = 10U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
179 | kINPUTMUX_DmaFlexcomm5TxTrigoutToTriginChannels = 11U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
180 | kINPUTMUX_DmaFlexcomm6RxTrigoutToTriginChannels = 12U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
181 | kINPUTMUX_DmaFlexcomm6TxTrigoutToTriginChannels = 13U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
182 | kINPUTMUX_DmaFlexcomm7RxTrigoutToTriginChannels = 14U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
183 | kINPUTMUX_DmaFlexcomm7TxTrigoutToTriginChannels = 15U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
184 | kINPUTMUX_DmaDmic0Ch0TrigoutToTriginChannels = 16U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
185 | kINPUTMUX_Dmamic0Ch1TrigoutToTriginChannels = 17U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
186 | kINPUTMUX_DmaSpifi0TrigoutToTriginChannels = 18U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
187 | kINPUTMUX_DmaSha_TrigoutToTriginChannels = 19U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
188 | kINPUTMUX_DmaFlexcomm8RxTrigoutToTriginChannels = 20U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
189 | kINPUTMUX_DmaFlexcomm8TxTrigoutToTriginChannels = 21U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
190 | kINPUTMUX_DmaFlexcomm9RxTrigoutToTriginChannels = 22U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
191 | kINPUTMUX_DmaFlexcomm9TxTrigoutToTriginChannels = 23U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
192 | kINPUTMUX_DmaSmartcard0RxTrigoutToTriginChannels = 24U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
193 | kINPUTMUX_DmaSmartcard0TxTrigoutToTriginChannels = 25U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
194 | kINPUTMUX_DmaSmartcard1RxTrigoutToTriginChannels = 26U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
195 | kINPUTMUX_DmaSmartcard1TxTrigoutToTriginChannels = 27U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
196 | kINPUTMUX_DmaFlexcomm10RxTrigoutToTriginChannels = 28U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
197 | kINPUTMUX_DmaFlexcomm10TxTrigoutToTriginChannels = 29U + (DMA_OTRIG_PMUX_ID << PMUX_SHIFT), | ||
198 | |||
199 | } inputmux_connection_t; | ||
200 | |||
201 | /*@}*/ | ||
202 | |||
203 | #endif /* _FSL_INPUTMUX_CONNECTIONS_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_power.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_power.c new file mode 100644 index 000000000..4d350239c --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_power.c | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016, NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * | ||
7 | * SPDX-License-Identifier: BSD-3-Clause | ||
8 | */ | ||
9 | #include "fsl_common.h" | ||
10 | #include "fsl_power.h" | ||
11 | /* Component ID definition, used by tools. */ | ||
12 | #ifndef FSL_COMPONENT_ID | ||
13 | #define FSL_COMPONENT_ID "platform.drivers.power" | ||
14 | #endif | ||
15 | |||
16 | /******************************************************************************* | ||
17 | * Code | ||
18 | ******************************************************************************/ | ||
19 | |||
20 | /* Empty file since implementation is in header file and power library */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_power.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_power.h new file mode 100644 index 000000000..da73ee56b --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_power.h | |||
@@ -0,0 +1,225 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016, NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * | ||
7 | * SPDX-License-Identifier: BSD-3-Clause | ||
8 | */ | ||
9 | #ifndef _FSL_POWER_H_ | ||
10 | #define _FSL_POWER_H_ | ||
11 | |||
12 | #include "fsl_common.h" | ||
13 | |||
14 | /*! @addtogroup power */ | ||
15 | /*! @{ */ | ||
16 | |||
17 | /*! @file */ | ||
18 | |||
19 | /******************************************************************************* | ||
20 | * Definitions | ||
21 | ******************************************************************************/ | ||
22 | |||
23 | /*! @name Driver version */ | ||
24 | /*@{*/ | ||
25 | /*! @brief power driver version 2.0.0. */ | ||
26 | #define FSL_POWER_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) | ||
27 | /*@}*/ | ||
28 | |||
29 | #define MAKE_PD_BITS(reg, slot) (((reg) << 8) | (slot)) | ||
30 | #define PDRCFG0 0x0U | ||
31 | #define PDRCFG1 0x1U | ||
32 | |||
33 | typedef enum pd_bits | ||
34 | { | ||
35 | kPDRUNCFG_LP_REG = MAKE_PD_BITS(PDRCFG0, 2U), | ||
36 | kPDRUNCFG_PD_FRO_EN = MAKE_PD_BITS(PDRCFG0, 4U), | ||
37 | kPDRUNCFG_PD_TS = MAKE_PD_BITS(PDRCFG0, 6U), | ||
38 | kPDRUNCFG_PD_BOD_RESET = MAKE_PD_BITS(PDRCFG0, 7U), | ||
39 | kPDRUNCFG_PD_BOD_INTR = MAKE_PD_BITS(PDRCFG0, 8U), | ||
40 | kPDRUNCFG_PD_VD2_ANA = MAKE_PD_BITS(PDRCFG0, 9U), | ||
41 | kPDRUNCFG_PD_ADC0 = MAKE_PD_BITS(PDRCFG0, 10U), | ||
42 | kPDRUNCFG_PD_RAM0 = MAKE_PD_BITS(PDRCFG0, 13U), | ||
43 | kPDRUNCFG_PD_RAM1 = MAKE_PD_BITS(PDRCFG0, 14U), | ||
44 | kPDRUNCFG_PD_RAM2 = MAKE_PD_BITS(PDRCFG0, 15U), | ||
45 | kPDRUNCFG_PD_RAM3 = MAKE_PD_BITS(PDRCFG0, 16U), | ||
46 | kPDRUNCFG_PD_ROM = MAKE_PD_BITS(PDRCFG0, 17U), | ||
47 | kPDRUNCFG_PD_VDDA = MAKE_PD_BITS(PDRCFG0, 19U), | ||
48 | kPDRUNCFG_PD_WDT_OSC = MAKE_PD_BITS(PDRCFG0, 20U), | ||
49 | kPDRUNCFG_PD_USB0_PHY = MAKE_PD_BITS(PDRCFG0, 21U), | ||
50 | kPDRUNCFG_PD_SYS_PLL0 = MAKE_PD_BITS(PDRCFG0, 22U), | ||
51 | kPDRUNCFG_PD_VREFP = MAKE_PD_BITS(PDRCFG0, 23U), | ||
52 | kPDRUNCFG_PD_FLASH_BG = MAKE_PD_BITS(PDRCFG0, 25U), | ||
53 | kPDRUNCFG_PD_VD3 = MAKE_PD_BITS(PDRCFG0, 26U), | ||
54 | kPDRUNCFG_PD_VD4 = MAKE_PD_BITS(PDRCFG0, 27U), | ||
55 | kPDRUNCFG_PD_VD5 = MAKE_PD_BITS(PDRCFG0, 28U), | ||
56 | kPDRUNCFG_PD_VD6 = MAKE_PD_BITS(PDRCFG0, 29U), | ||
57 | kPDRUNCFG_REQ_DELAY = MAKE_PD_BITS(PDRCFG0, 30U), | ||
58 | kPDRUNCFG_FORCE_RBB = MAKE_PD_BITS(PDRCFG0, 31U), | ||
59 | |||
60 | kPDRUNCFG_PD_USB1_PHY = MAKE_PD_BITS(PDRCFG1, 0U), | ||
61 | kPDRUNCFG_PD_USB_PLL = MAKE_PD_BITS(PDRCFG1, 1U), | ||
62 | kPDRUNCFG_PD_AUDIO_PLL = MAKE_PD_BITS(PDRCFG1, 2U), | ||
63 | kPDRUNCFG_PD_SYS_OSC = MAKE_PD_BITS(PDRCFG1, 3U), | ||
64 | kPDRUNCFG_PD_EEPROM = MAKE_PD_BITS(PDRCFG1, 5U), | ||
65 | kPDRUNCFG_PD_rng = MAKE_PD_BITS(PDRCFG1, 6U), | ||
66 | |||
67 | /* | ||
68 | This enum member has no practical meaning,it is used to avoid MISRA issue, | ||
69 | user should not trying to use it. | ||
70 | */ | ||
71 | kPDRUNCFG_ForceUnsigned = 0x80000000U, | ||
72 | } pd_bit_t; | ||
73 | |||
74 | /* Power mode configuration API parameter */ | ||
75 | typedef enum _power_mode_config | ||
76 | { | ||
77 | kPmu_Sleep = 0U, | ||
78 | kPmu_Deep_Sleep = 1U, | ||
79 | kPmu_Deep_PowerDown = 2U, | ||
80 | } power_mode_cfg_t; | ||
81 | |||
82 | /******************************************************************************* | ||
83 | * API | ||
84 | ******************************************************************************/ | ||
85 | |||
86 | #ifdef __cplusplus | ||
87 | extern "C" { | ||
88 | #endif | ||
89 | |||
90 | /*! | ||
91 | * @name Power Configuration | ||
92 | * @{ | ||
93 | */ | ||
94 | |||
95 | /*! | ||
96 | * @brief API to enable PDRUNCFG bit in the Syscon. Note that enabling the bit powers down the peripheral | ||
97 | * | ||
98 | * @param en peripheral for which to enable the PDRUNCFG bit | ||
99 | * @return none | ||
100 | */ | ||
101 | static inline void POWER_EnablePD(pd_bit_t en) | ||
102 | { | ||
103 | /* PDRUNCFGSET */ | ||
104 | SYSCON->PDRUNCFGSET[((uint32_t)en >> 8UL)] = (1UL << ((uint32_t)en & 0xffU)); | ||
105 | } | ||
106 | |||
107 | /*! | ||
108 | * @brief API to disable PDRUNCFG bit in the Syscon. Note that disabling the bit powers up the peripheral | ||
109 | * | ||
110 | * @param en peripheral for which to disable the PDRUNCFG bit | ||
111 | * @return none | ||
112 | */ | ||
113 | static inline void POWER_DisablePD(pd_bit_t en) | ||
114 | { | ||
115 | /* PDRUNCFGCLR */ | ||
116 | SYSCON->PDRUNCFGCLR[((uint32_t)en >> 8UL)] = (1UL << ((uint32_t)en & 0xffU)); | ||
117 | } | ||
118 | |||
119 | /*! | ||
120 | * @brief API to enable deep sleep bit in the ARM Core. | ||
121 | * | ||
122 | * @param none | ||
123 | * @return none | ||
124 | */ | ||
125 | static inline void POWER_EnableDeepSleep(void) | ||
126 | { | ||
127 | SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; | ||
128 | } | ||
129 | |||
130 | /*! | ||
131 | * @brief API to disable deep sleep bit in the ARM Core. | ||
132 | * | ||
133 | * @param none | ||
134 | * @return none | ||
135 | */ | ||
136 | static inline void POWER_DisableDeepSleep(void) | ||
137 | { | ||
138 | SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; | ||
139 | } | ||
140 | |||
141 | /*! | ||
142 | * @brief Power Library API to reload OTP. | ||
143 | * This API must be called if VD6 is power down | ||
144 | * and power back again since FROHF TRIM value | ||
145 | * is store in OTP. If not, when calling FROHF settng | ||
146 | * API in clock driver then the FROHF clock out put | ||
147 | * will be inaccurate. | ||
148 | * @return none | ||
149 | */ | ||
150 | void POWER_OtpReload(void); | ||
151 | |||
152 | /*! | ||
153 | * @brief Power Library API to power the PLLs. | ||
154 | * | ||
155 | * @param none | ||
156 | * @return none | ||
157 | */ | ||
158 | void POWER_SetPLL(void); | ||
159 | |||
160 | /*! | ||
161 | * @brief Power Library API to power the USB PHY. | ||
162 | * | ||
163 | * @param none | ||
164 | * @return none | ||
165 | */ | ||
166 | void POWER_SetUsbPhy(void); | ||
167 | |||
168 | /*! | ||
169 | * @brief Power Library API to enter different power mode. | ||
170 | * | ||
171 | * @param exclude_from_pd Bit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) that needs to be powered on | ||
172 | * during power mode selected. | ||
173 | * @return none | ||
174 | */ | ||
175 | void POWER_EnterPowerMode(power_mode_cfg_t mode, uint64_t exclude_from_pd); | ||
176 | |||
177 | /*! | ||
178 | * @brief Power Library API to enter sleep mode. | ||
179 | * | ||
180 | * @return none | ||
181 | */ | ||
182 | void POWER_EnterSleep(void); | ||
183 | |||
184 | /*! | ||
185 | * @brief Power Library API to enter deep sleep mode. | ||
186 | * | ||
187 | * @param exclude_from_pd Bit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) bits that needs to be | ||
188 | * powered on during deep sleep | ||
189 | * @return none | ||
190 | */ | ||
191 | void POWER_EnterDeepSleep(uint64_t exclude_from_pd); | ||
192 | |||
193 | /*! | ||
194 | * @brief Power Library API to enter deep power down mode. | ||
195 | * | ||
196 | * @param exclude_from_pd Bit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) that needs to be powered on | ||
197 | during deep power | ||
198 | * down mode, but this is has no effect as the voltages are cut off. | ||
199 | |||
200 | * @return none | ||
201 | */ | ||
202 | void POWER_EnterDeepPowerDown(uint64_t exclude_from_pd); | ||
203 | |||
204 | /*! | ||
205 | * @brief Power Library API to choose normal regulation and set the voltage for the desired operating frequency. | ||
206 | * | ||
207 | * @param freq - The desired frequency at which the part would like to operate, | ||
208 | * note that the voltage and flash wait states should be set before changing frequency | ||
209 | * @return none | ||
210 | */ | ||
211 | void POWER_SetVoltageForFreq(uint32_t freq); | ||
212 | |||
213 | /*! | ||
214 | * @brief Power Library API to return the library version. | ||
215 | * | ||
216 | * @param none | ||
217 | * @return version number of the power library | ||
218 | */ | ||
219 | uint32_t POWER_GetLibVersion(void); | ||
220 | |||
221 | #ifdef __cplusplus | ||
222 | } | ||
223 | #endif | ||
224 | |||
225 | #endif /* _FSL_POWER_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_reset.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_reset.c new file mode 100644 index 000000000..5f886b293 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_reset.c | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016, NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * | ||
7 | * SPDX-License-Identifier: BSD-3-Clause | ||
8 | */ | ||
9 | |||
10 | #include "fsl_common.h" | ||
11 | #include "fsl_reset.h" | ||
12 | |||
13 | /******************************************************************************* | ||
14 | * Definitions | ||
15 | ******************************************************************************/ | ||
16 | /* Component ID definition, used by tools. */ | ||
17 | #ifndef FSL_COMPONENT_ID | ||
18 | #define FSL_COMPONENT_ID "platform.drivers.reset" | ||
19 | #endif | ||
20 | |||
21 | /******************************************************************************* | ||
22 | * Variables | ||
23 | ******************************************************************************/ | ||
24 | |||
25 | /******************************************************************************* | ||
26 | * Prototypes | ||
27 | ******************************************************************************/ | ||
28 | |||
29 | /******************************************************************************* | ||
30 | * Code | ||
31 | ******************************************************************************/ | ||
32 | |||
33 | #if ((defined(FSL_FEATURE_SOC_SYSCON_COUNT) && (FSL_FEATURE_SOC_SYSCON_COUNT > 0)) || \ | ||
34 | (defined(FSL_FEATURE_SOC_ASYNC_SYSCON_COUNT) && (FSL_FEATURE_SOC_ASYNC_SYSCON_COUNT > 0))) | ||
35 | |||
36 | /*! | ||
37 | * brief Assert reset to peripheral. | ||
38 | * | ||
39 | * Asserts reset signal to specified peripheral module. | ||
40 | * | ||
41 | * param peripheral Assert reset to this peripheral. The enum argument contains encoding of reset register | ||
42 | * and reset bit position in the reset register. | ||
43 | */ | ||
44 | void RESET_SetPeripheralReset(reset_ip_name_t peripheral) | ||
45 | { | ||
46 | const uint32_t regIndex = ((uint32_t)peripheral & 0xFFFF0000u) >> 16; | ||
47 | const uint32_t bitPos = ((uint32_t)peripheral & 0x0000FFFFu); | ||
48 | const uint32_t bitMask = 1UL << bitPos; | ||
49 | |||
50 | assert(bitPos < 32UL); | ||
51 | |||
52 | /* ASYNC_SYSCON registers have offset 1024 */ | ||
53 | if (regIndex >= SYSCON_PRESETCTRL_COUNT) | ||
54 | { | ||
55 | /* reset register is in ASYNC_SYSCON */ | ||
56 | |||
57 | /* set bit */ | ||
58 | ASYNC_SYSCON->ASYNCPRESETCTRLSET = bitMask; | ||
59 | /* wait until it reads 0b1 */ | ||
60 | while (0u == (ASYNC_SYSCON->ASYNCPRESETCTRL & bitMask)) | ||
61 | { | ||
62 | } | ||
63 | } | ||
64 | else | ||
65 | { | ||
66 | /* reset register is in SYSCON */ | ||
67 | |||
68 | /* set bit */ | ||
69 | SYSCON->PRESETCTRLSET[regIndex] = bitMask; | ||
70 | /* wait until it reads 0b1 */ | ||
71 | while (0u == (SYSCON->PRESETCTRL[regIndex] & bitMask)) | ||
72 | { | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | |||
77 | /*! | ||
78 | * brief Clear reset to peripheral. | ||
79 | * | ||
80 | * Clears reset signal to specified peripheral module, allows it to operate. | ||
81 | * | ||
82 | * param peripheral Clear reset to this peripheral. The enum argument contains encoding of reset register | ||
83 | * and reset bit position in the reset register. | ||
84 | */ | ||
85 | void RESET_ClearPeripheralReset(reset_ip_name_t peripheral) | ||
86 | { | ||
87 | const uint32_t regIndex = ((uint32_t)peripheral & 0xFFFF0000u) >> 16; | ||
88 | const uint32_t bitPos = ((uint32_t)peripheral & 0x0000FFFFu); | ||
89 | const uint32_t bitMask = 1UL << bitPos; | ||
90 | |||
91 | assert(bitPos < 32UL); | ||
92 | |||
93 | /* ASYNC_SYSCON registers have offset 1024 */ | ||
94 | if (regIndex >= SYSCON_PRESETCTRL_COUNT) | ||
95 | { | ||
96 | /* reset register is in ASYNC_SYSCON */ | ||
97 | |||
98 | /* clear bit */ | ||
99 | ASYNC_SYSCON->ASYNCPRESETCTRLCLR = bitMask; | ||
100 | /* wait until it reads 0b0 */ | ||
101 | while (bitMask == (ASYNC_SYSCON->ASYNCPRESETCTRL & bitMask)) | ||
102 | { | ||
103 | } | ||
104 | } | ||
105 | else | ||
106 | { | ||
107 | /* reset register is in SYSCON */ | ||
108 | |||
109 | /* clear bit */ | ||
110 | SYSCON->PRESETCTRLCLR[regIndex] = bitMask; | ||
111 | /* wait until it reads 0b0 */ | ||
112 | while (bitMask == (SYSCON->PRESETCTRL[regIndex] & bitMask)) | ||
113 | { | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /*! | ||
119 | * brief Reset peripheral module. | ||
120 | * | ||
121 | * Reset peripheral module. | ||
122 | * | ||
123 | * param peripheral Peripheral to reset. The enum argument contains encoding of reset register | ||
124 | * and reset bit position in the reset register. | ||
125 | */ | ||
126 | void RESET_PeripheralReset(reset_ip_name_t peripheral) | ||
127 | { | ||
128 | RESET_SetPeripheralReset(peripheral); | ||
129 | RESET_ClearPeripheralReset(peripheral); | ||
130 | } | ||
131 | |||
132 | #endif /* FSL_FEATURE_SOC_SYSCON_COUNT || FSL_FEATURE_SOC_ASYNC_SYSCON_COUNT */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_reset.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_reset.h new file mode 100644 index 000000000..9c4a77f85 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/drivers/fsl_reset.h | |||
@@ -0,0 +1,277 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016, NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * | ||
7 | * SPDX-License-Identifier: BSD-3-Clause | ||
8 | */ | ||
9 | |||
10 | #ifndef _FSL_RESET_H_ | ||
11 | #define _FSL_RESET_H_ | ||
12 | |||
13 | #include <assert.h> | ||
14 | #include <stdbool.h> | ||
15 | #include <stdint.h> | ||
16 | #include <string.h> | ||
17 | #include "fsl_device_registers.h" | ||
18 | |||
19 | /*! @addtogroup reset */ | ||
20 | /*! @{ */ | ||
21 | |||
22 | /*! @file */ | ||
23 | |||
24 | /******************************************************************************* | ||
25 | * Definitions | ||
26 | ******************************************************************************/ | ||
27 | |||
28 | /*! @name Driver version */ | ||
29 | /*@{*/ | ||
30 | /*! @brief reset driver version 2.0.1. */ | ||
31 | #define FSL_RESET_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) | ||
32 | /*@}*/ | ||
33 | |||
34 | /*! | ||
35 | * @brief Enumeration for peripheral reset control bits | ||
36 | * | ||
37 | * Defines the enumeration for peripheral reset control bits in PRESETCTRL/ASYNCPRESETCTRL registers | ||
38 | */ | ||
39 | typedef enum _SYSCON_RSTn | ||
40 | { | ||
41 | kSPIFI_RST_SHIFT_RSTn = 0 | 10U, /**< SPIFI reset control */ | ||
42 | kMUX_RST_SHIFT_RSTn = 0 | 11U, /**< Input mux reset control */ | ||
43 | kIOCON_RST_SHIFT_RSTn = 0 | 13U, /**< IOCON reset control */ | ||
44 | kGPIO0_RST_SHIFT_RSTn = 0 | 14U, /**< GPIO0 reset control */ | ||
45 | kGPIO1_RST_SHIFT_RSTn = 0 | 15U, /**< GPIO1 reset control */ | ||
46 | kGPIO2_RST_SHIFT_RSTn = 0 | 16U, /**< GPIO2 reset control */ | ||
47 | kGPIO3_RST_SHIFT_RSTn = 0 | 17U, /**< GPIO3 reset control */ | ||
48 | kPINT_RST_SHIFT_RSTn = 0 | 18U, /**< Pin interrupt (PINT) reset control */ | ||
49 | kGINT_RST_SHIFT_RSTn = 0 | 19U, /**< Grouped interrupt (PINT) reset control. */ | ||
50 | kDMA_RST_SHIFT_RSTn = 0 | 20U, /**< DMA reset control */ | ||
51 | kCRC_RST_SHIFT_RSTn = 0 | 21U, /**< CRC reset control */ | ||
52 | kWWDT_RST_SHIFT_RSTn = 0 | 22U, /**< Watchdog timer reset control */ | ||
53 | kADC0_RST_SHIFT_RSTn = 0 | 27U, /**< ADC0 reset control */ | ||
54 | |||
55 | kMRT_RST_SHIFT_RSTn = 65536 | 0U, /**< Multi-rate timer (MRT) reset control */ | ||
56 | kSCT0_RST_SHIFT_RSTn = 65536 | 2U, /**< SCTimer/PWM 0 (SCT0) reset control */ | ||
57 | kMCAN0_RST_SHIFT_RSTn = 65536 | 7U, /**< MCAN0 reset control */ | ||
58 | kMCAN1_RST_SHIFT_RSTn = 65536 | 8U, /**< MCAN1 reset control */ | ||
59 | kUTICK_RST_SHIFT_RSTn = 65536 | 10U, /**< Micro-tick timer reset control */ | ||
60 | kFC0_RST_SHIFT_RSTn = 65536 | 11U, /**< Flexcomm Interface 0 reset control */ | ||
61 | kFC1_RST_SHIFT_RSTn = 65536 | 12U, /**< Flexcomm Interface 1 reset control */ | ||
62 | kFC2_RST_SHIFT_RSTn = 65536 | 13U, /**< Flexcomm Interface 2 reset control */ | ||
63 | kFC3_RST_SHIFT_RSTn = 65536 | 14U, /**< Flexcomm Interface 3 reset control */ | ||
64 | kFC4_RST_SHIFT_RSTn = 65536 | 15U, /**< Flexcomm Interface 4 reset control */ | ||
65 | kFC5_RST_SHIFT_RSTn = 65536 | 16U, /**< Flexcomm Interface 5 reset control */ | ||
66 | kFC6_RST_SHIFT_RSTn = 65536 | 17U, /**< Flexcomm Interface 6 reset control */ | ||
67 | kFC7_RST_SHIFT_RSTn = 65536 | 18U, /**< Flexcomm Interface 7 reset control */ | ||
68 | kDMIC_RST_SHIFT_RSTn = 65536 | 19U, /**< Digital microphone interface reset control */ | ||
69 | kCT32B2_RST_SHIFT_RSTn = 65536 | 22U, /**< CT32B2 reset control */ | ||
70 | kUSB0D_RST_SHIFT_RSTn = 65536 | 25U, /**< USB0D reset control */ | ||
71 | kCT32B0_RST_SHIFT_RSTn = 65536 | 26U, /**< CT32B0 reset control */ | ||
72 | kCT32B1_RST_SHIFT_RSTn = 65536 | 27U, /**< CT32B1 reset control */ | ||
73 | |||
74 | kLCD_RST_SHIFT_RSTn = 131072 | 2U, /**< LCD reset control */ | ||
75 | kSDIO_RST_SHIFT_RSTn = 131072 | 3U, /**< SDIO reset control */ | ||
76 | kUSB1H_RST_SHIFT_RSTn = 131072 | 4U, /**< USB1H reset control */ | ||
77 | kUSB1D_RST_SHIFT_RSTn = 131072 | 5U, /**< USB1D reset control */ | ||
78 | kUSB1RAM_RST_SHIFT_RSTn = 131072 | 6U, /**< USB1RAM reset control */ | ||
79 | kEMC_RST_SHIFT_RSTn = 131072 | 7U, /**< EMC reset control */ | ||
80 | kETH_RST_SHIFT_RSTn = 131072 | 8U, /**< ETH reset control */ | ||
81 | kGPIO4_RST_SHIFT_RSTn = 131072 | 9U, /**< GPIO4 reset control */ | ||
82 | kGPIO5_RST_SHIFT_RSTn = 131072 | 10U, /**< GPIO5 reset control */ | ||
83 | kAES_RST_SHIFT_RSTn = 131072 | 11U, /**< AES reset control */ | ||
84 | kOTP_RST_SHIFT_RSTn = 131072 | 12U, /**< OTP reset control */ | ||
85 | kRNG_RST_SHIFT_RSTn = 131072 | 13U, /**< RNG reset control */ | ||
86 | kFC8_RST_SHIFT_RSTn = 131072 | 14U, /**< Flexcomm Interface 8 reset control */ | ||
87 | kFC9_RST_SHIFT_RSTn = 131072 | 15U, /**< Flexcomm Interface 9 reset control */ | ||
88 | kUSB0HMR_RST_SHIFT_RSTn = 131072 | 16U, /**< USB0HMR reset control */ | ||
89 | kUSB0HSL_RST_SHIFT_RSTn = 131072 | 17U, /**< USB0HSL reset control */ | ||
90 | kSHA_RST_SHIFT_RSTn = 131072 | 18U, /**< SHA reset control */ | ||
91 | kSC0_RST_SHIFT_RSTn = 131072 | 19U, /**< SC0 reset control */ | ||
92 | kSC1_RST_SHIFT_RSTn = 131072 | 20U, /**< SC1 reset control */ | ||
93 | kFC10_RST_SHIFT_RSTn = 131072 | 21U, /**< Flexcomm Interface 10 reset control */ | ||
94 | |||
95 | kCT32B3_RST_SHIFT_RSTn = 67108864 | 13U, /**< CT32B3 reset control */ | ||
96 | kCT32B4_RST_SHIFT_RSTn = 67108864 | 14U, /**< CT32B4 reset control */ | ||
97 | } SYSCON_RSTn_t; | ||
98 | |||
99 | /** Array initializers with peripheral reset bits **/ | ||
100 | #define ADC_RSTS \ | ||
101 | { \ | ||
102 | kADC0_RST_SHIFT_RSTn \ | ||
103 | } /* Reset bits for ADC peripheral */ | ||
104 | #define AES_RSTS \ | ||
105 | { \ | ||
106 | kAES_RST_SHIFT_RSTn \ | ||
107 | } /* Reset bits for AES peripheral */ | ||
108 | #define CRC_RSTS \ | ||
109 | { \ | ||
110 | kCRC_RST_SHIFT_RSTn \ | ||
111 | } /* Reset bits for CRC peripheral */ | ||
112 | #define CTIMER_RSTS \ | ||
113 | { \ | ||
114 | kCT32B0_RST_SHIFT_RSTn, kCT32B1_RST_SHIFT_RSTn, kCT32B2_RST_SHIFT_RSTn, kCT32B3_RST_SHIFT_RSTn, \ | ||
115 | kCT32B4_RST_SHIFT_RSTn \ | ||
116 | } /* Reset bits for CTIMER peripheral */ | ||
117 | #define DMA_RSTS_N \ | ||
118 | { \ | ||
119 | kDMA_RST_SHIFT_RSTn \ | ||
120 | } /* Reset bits for DMA peripheral */ | ||
121 | #define DMIC_RSTS \ | ||
122 | { \ | ||
123 | kDMIC_RST_SHIFT_RSTn \ | ||
124 | } /* Reset bits for DMIC peripheral */ | ||
125 | #define EMC_RSTS \ | ||
126 | { \ | ||
127 | kEMC_RST_SHIFT_RSTn \ | ||
128 | } /* Reset bits for EMC peripheral */ | ||
129 | #define ETH_RST \ | ||
130 | { \ | ||
131 | kETH_RST_SHIFT_RSTn \ | ||
132 | } /* Reset bits for EMC peripheral */ | ||
133 | #define FLEXCOMM_RSTS \ | ||
134 | { \ | ||
135 | kFC0_RST_SHIFT_RSTn, kFC1_RST_SHIFT_RSTn, kFC2_RST_SHIFT_RSTn, kFC3_RST_SHIFT_RSTn, kFC4_RST_SHIFT_RSTn, \ | ||
136 | kFC5_RST_SHIFT_RSTn, kFC6_RST_SHIFT_RSTn, kFC7_RST_SHIFT_RSTn, kFC8_RST_SHIFT_RSTn, kFC9_RST_SHIFT_RSTn, kFC9_RST_SHIFT_RSTn \ | ||
137 | } /* Reset bits for FLEXCOMM peripheral */ | ||
138 | #define GINT_RSTS \ | ||
139 | { \ | ||
140 | kGINT_RST_SHIFT_RSTn, kGINT_RST_SHIFT_RSTn \ | ||
141 | } /* Reset bits for GINT peripheral. GINT0 & GINT1 share same slot */ | ||
142 | #define GPIO_RSTS_N \ | ||
143 | { \ | ||
144 | kGPIO0_RST_SHIFT_RSTn, kGPIO1_RST_SHIFT_RSTn, kGPIO2_RST_SHIFT_RSTn, kGPIO3_RST_SHIFT_RSTn, \ | ||
145 | kGPIO4_RST_SHIFT_RSTn, kGPIO5_RST_SHIFT_RSTn \ | ||
146 | } /* Reset bits for GPIO peripheral */ | ||
147 | #define INPUTMUX_RSTS \ | ||
148 | { \ | ||
149 | kMUX_RST_SHIFT_RSTn \ | ||
150 | } /* Reset bits for INPUTMUX peripheral */ | ||
151 | #define IOCON_RSTS \ | ||
152 | { \ | ||
153 | kIOCON_RST_SHIFT_RSTn \ | ||
154 | } /* Reset bits for IOCON peripheral */ | ||
155 | #define FLASH_RSTS \ | ||
156 | { \ | ||
157 | kFLASH_RST_SHIFT_RSTn, kFMC_RST_SHIFT_RSTn \ | ||
158 | } /* Reset bits for Flash peripheral */ | ||
159 | #define LCD_RSTS \ | ||
160 | { \ | ||
161 | kLCD_RST_SHIFT_RSTn \ | ||
162 | } /* Reset bits for LCD peripheral */ | ||
163 | #define MRT_RSTS \ | ||
164 | { \ | ||
165 | kMRT_RST_SHIFT_RSTn \ | ||
166 | } /* Reset bits for MRT peripheral */ | ||
167 | #define MCAN_RSTS \ | ||
168 | { \ | ||
169 | kMCAN0_RST_SHIFT_RSTn,kMCAN1_RST_SHIFT_RSTn \ | ||
170 | } /* Reset bits for MCAN0&MACN1 peripheral */ | ||
171 | #define OTP_RSTS \ | ||
172 | { \ | ||
173 | kOTP_RST_SHIFT_RSTn \ | ||
174 | } /* Reset bits for OTP peripheral */ | ||
175 | #define PINT_RSTS \ | ||
176 | { \ | ||
177 | kPINT_RST_SHIFT_RSTn \ | ||
178 | } /* Reset bits for PINT peripheral */ | ||
179 | #define RNG_RSTS \ | ||
180 | { \ | ||
181 | kRNG_RST_SHIFT_RSTn \ | ||
182 | } /* Reset bits for RNG peripheral */ | ||
183 | #define SDIO_RST \ | ||
184 | { \ | ||
185 | kSDIO_RST_SHIFT_RSTn \ | ||
186 | } /* Reset bits for SDIO peripheral */ | ||
187 | #define SCT_RSTS \ | ||
188 | { \ | ||
189 | kSCT0_RST_SHIFT_RSTn \ | ||
190 | } /* Reset bits for SCT peripheral */ | ||
191 | #define SHA_RST \ | ||
192 | { \ | ||
193 | kSHA_RST_SHIFT_RSTn \ | ||
194 | } /* Reset bits for SHA peripheral */ | ||
195 | #define SPIFI_RSTS \ | ||
196 | { \ | ||
197 | kSPIFI_RST_SHIFT_RSTn \ | ||
198 | } /* Reset bits for SPIFI peripheral */ | ||
199 | #define USB0D_RST \ | ||
200 | { \ | ||
201 | kUSB0D_RST_SHIFT_RSTn \ | ||
202 | } /* Reset bits for USB0D peripheral */ | ||
203 | #define USB0HMR_RST \ | ||
204 | { \ | ||
205 | kUSB0HMR_RST_SHIFT_RSTn \ | ||
206 | } /* Reset bits for USB0HMR peripheral */ | ||
207 | #define USB0HSL_RST \ | ||
208 | { \ | ||
209 | kUSB0HSL_RST_SHIFT_RSTn \ | ||
210 | } /* Reset bits for USB0HSL peripheral */ | ||
211 | #define USB1H_RST \ | ||
212 | { \ | ||
213 | kUSB1H_RST_SHIFT_RSTn \ | ||
214 | } /* Reset bits for USB1H peripheral */ | ||
215 | #define USB1D_RST \ | ||
216 | { \ | ||
217 | kUSB1D_RST_SHIFT_RSTn \ | ||
218 | } /* Reset bits for USB1D peripheral */ | ||
219 | #define USB1RAM_RST \ | ||
220 | { \ | ||
221 | kUSB1RAM_RST_SHIFT_RSTn \ | ||
222 | } /* Reset bits for USB1RAM peripheral */ | ||
223 | #define UTICK_RSTS \ | ||
224 | { \ | ||
225 | kUTICK_RST_SHIFT_RSTn \ | ||
226 | } /* Reset bits for UTICK peripheral */ | ||
227 | #define WWDT_RSTS \ | ||
228 | { \ | ||
229 | kWWDT_RST_SHIFT_RSTn \ | ||
230 | } /* Reset bits for WWDT peripheral */ | ||
231 | |||
232 | typedef SYSCON_RSTn_t reset_ip_name_t; | ||
233 | |||
234 | /******************************************************************************* | ||
235 | * API | ||
236 | ******************************************************************************/ | ||
237 | #if defined(__cplusplus) | ||
238 | extern "C" { | ||
239 | #endif | ||
240 | |||
241 | /*! | ||
242 | * @brief Assert reset to peripheral. | ||
243 | * | ||
244 | * Asserts reset signal to specified peripheral module. | ||
245 | * | ||
246 | * @param peripheral Assert reset to this peripheral. The enum argument contains encoding of reset register | ||
247 | * and reset bit position in the reset register. | ||
248 | */ | ||
249 | void RESET_SetPeripheralReset(reset_ip_name_t peripheral); | ||
250 | |||
251 | /*! | ||
252 | * @brief Clear reset to peripheral. | ||
253 | * | ||
254 | * Clears reset signal to specified peripheral module, allows it to operate. | ||
255 | * | ||
256 | * @param peripheral Clear reset to this peripheral. The enum argument contains encoding of reset register | ||
257 | * and reset bit position in the reset register. | ||
258 | */ | ||
259 | void RESET_ClearPeripheralReset(reset_ip_name_t peripheral); | ||
260 | |||
261 | /*! | ||
262 | * @brief Reset peripheral module. | ||
263 | * | ||
264 | * Reset peripheral module. | ||
265 | * | ||
266 | * @param peripheral Peripheral to reset. The enum argument contains encoding of reset register | ||
267 | * and reset bit position in the reset register. | ||
268 | */ | ||
269 | void RESET_PeripheralReset(reset_ip_name_t peripheral); | ||
270 | |||
271 | #if defined(__cplusplus) | ||
272 | } | ||
273 | #endif | ||
274 | |||
275 | /*! @} */ | ||
276 | |||
277 | #endif /* _FSL_RESET_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/fsl_device_registers.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/fsl_device_registers.h new file mode 100644 index 000000000..9108255d7 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/fsl_device_registers.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright 2014-2016 Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2018 NXP | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef __FSL_DEVICE_REGISTERS_H__ | ||
10 | #define __FSL_DEVICE_REGISTERS_H__ | ||
11 | |||
12 | /* | ||
13 | * Include the cpu specific register header files. | ||
14 | * | ||
15 | * The CPU macro should be declared in the project or makefile. | ||
16 | */ | ||
17 | #if (defined(CPU_LPC54005JBD100) || defined(CPU_LPC54005JET100)) | ||
18 | |||
19 | #define LPC54005_SERIES | ||
20 | |||
21 | /* CMSIS-style register definitions */ | ||
22 | #include "LPC54005.h" | ||
23 | /* CPU specific feature definitions */ | ||
24 | #include "LPC54005_features.h" | ||
25 | |||
26 | #else | ||
27 | #error "No valid CPU defined!" | ||
28 | #endif | ||
29 | |||
30 | #endif /* __FSL_DEVICE_REGISTERS_H__ */ | ||
31 | |||
32 | /******************************************************************************* | ||
33 | * EOF | ||
34 | ******************************************************************************/ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/LPC54005_ram.ld b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/LPC54005_ram.ld new file mode 100644 index 000000000..76c7911f9 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/LPC54005_ram.ld | |||
@@ -0,0 +1,215 @@ | |||
1 | /* | ||
2 | ** ################################################################### | ||
3 | ** Processors: LPC54005JBD100 | ||
4 | ** LPC54005JET100 | ||
5 | ** | ||
6 | ** Compiler: GNU C Compiler | ||
7 | ** Reference manual: LPC540xx/LPC54S0xx User manual Rev.0.8 5 June 2018 | ||
8 | ** Version: rev. 1.2, 2017-06-08 | ||
9 | ** Build: b190925 | ||
10 | ** | ||
11 | ** Abstract: | ||
12 | ** Linker file for the GNU C Compiler | ||
13 | ** | ||
14 | ** Copyright 2016 Freescale Semiconductor, Inc. | ||
15 | ** Copyright 2016-2019 NXP | ||
16 | ** All rights reserved. | ||
17 | ** | ||
18 | ** SPDX-License-Identifier: BSD-3-Clause | ||
19 | ** | ||
20 | ** http: www.nxp.com | ||
21 | ** mail: [email protected] | ||
22 | ** | ||
23 | ** ################################################################### | ||
24 | */ | ||
25 | |||
26 | |||
27 | |||
28 | /* Entry Point */ | ||
29 | ENTRY(Reset_Handler) | ||
30 | |||
31 | HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; | ||
32 | STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800; | ||
33 | |||
34 | /* Specify the memory areas */ | ||
35 | MEMORY | ||
36 | { | ||
37 | m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000200 | ||
38 | m_text (RX) : ORIGIN = 0x00000200, LENGTH = 0x0002FE00 | ||
39 | m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00028000 | ||
40 | m_usb_sram (RW) : ORIGIN = 0x40100000, LENGTH = 0x00002000 | ||
41 | } | ||
42 | |||
43 | /* Define output sections */ | ||
44 | SECTIONS | ||
45 | { | ||
46 | /* The startup code goes first into internal flash */ | ||
47 | .interrupts : | ||
48 | { | ||
49 | . = ALIGN(4); | ||
50 | KEEP(*(.isr_vector)) /* Startup code */ | ||
51 | . = ALIGN(4); | ||
52 | } > m_interrupts | ||
53 | |||
54 | /* The program code and other data goes into internal flash */ | ||
55 | .text : | ||
56 | { | ||
57 | . = ALIGN(4); | ||
58 | *(.text) /* .text sections (code) */ | ||
59 | *(.text*) /* .text* sections (code) */ | ||
60 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ | ||
61 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ | ||
62 | *(.glue_7) /* glue arm to thumb code */ | ||
63 | *(.glue_7t) /* glue thumb to arm code */ | ||
64 | *(.eh_frame) | ||
65 | KEEP (*(.init)) | ||
66 | KEEP (*(.fini)) | ||
67 | . = ALIGN(4); | ||
68 | } > m_text | ||
69 | |||
70 | .ARM.extab : | ||
71 | { | ||
72 | *(.ARM.extab* .gnu.linkonce.armextab.*) | ||
73 | } > m_text | ||
74 | |||
75 | .ARM : | ||
76 | { | ||
77 | __exidx_start = .; | ||
78 | *(.ARM.exidx*) | ||
79 | __exidx_end = .; | ||
80 | } > m_text | ||
81 | |||
82 | .ctors : | ||
83 | { | ||
84 | __CTOR_LIST__ = .; | ||
85 | /* gcc uses crtbegin.o to find the start of | ||
86 | the constructors, so we make sure it is | ||
87 | first. Because this is a wildcard, it | ||
88 | doesn't matter if the user does not | ||
89 | actually link against crtbegin.o; the | ||
90 | linker won't look for a file to match a | ||
91 | wildcard. The wildcard also means that it | ||
92 | doesn't matter which directory crtbegin.o | ||
93 | is in. */ | ||
94 | KEEP (*crtbegin.o(.ctors)) | ||
95 | KEEP (*crtbegin?.o(.ctors)) | ||
96 | /* We don't want to include the .ctor section from | ||
97 | from the crtend.o file until after the sorted ctors. | ||
98 | The .ctor section from the crtend file contains the | ||
99 | end of ctors marker and it must be last */ | ||
100 | KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)) | ||
101 | KEEP (*(SORT(.ctors.*))) | ||
102 | KEEP (*(.ctors)) | ||
103 | __CTOR_END__ = .; | ||
104 | } > m_text | ||
105 | |||
106 | .dtors : | ||
107 | { | ||
108 | __DTOR_LIST__ = .; | ||
109 | KEEP (*crtbegin.o(.dtors)) | ||
110 | KEEP (*crtbegin?.o(.dtors)) | ||
111 | KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)) | ||
112 | KEEP (*(SORT(.dtors.*))) | ||
113 | KEEP (*(.dtors)) | ||
114 | __DTOR_END__ = .; | ||
115 | } > m_text | ||
116 | |||
117 | .preinit_array : | ||
118 | { | ||
119 | PROVIDE_HIDDEN (__preinit_array_start = .); | ||
120 | KEEP (*(.preinit_array*)) | ||
121 | PROVIDE_HIDDEN (__preinit_array_end = .); | ||
122 | } > m_text | ||
123 | |||
124 | .init_array : | ||
125 | { | ||
126 | PROVIDE_HIDDEN (__init_array_start = .); | ||
127 | KEEP (*(SORT(.init_array.*))) | ||
128 | KEEP (*(.init_array*)) | ||
129 | PROVIDE_HIDDEN (__init_array_end = .); | ||
130 | } > m_text | ||
131 | |||
132 | .fini_array : | ||
133 | { | ||
134 | PROVIDE_HIDDEN (__fini_array_start = .); | ||
135 | KEEP (*(SORT(.fini_array.*))) | ||
136 | KEEP (*(.fini_array*)) | ||
137 | PROVIDE_HIDDEN (__fini_array_end = .); | ||
138 | } > m_text | ||
139 | |||
140 | __etext = .; /* define a global symbol at end of code */ | ||
141 | __DATA_ROM = .; /* Symbol is used by startup for data initialization */ | ||
142 | |||
143 | .data : AT(__DATA_ROM) | ||
144 | { | ||
145 | . = ALIGN(4); | ||
146 | __DATA_RAM = .; | ||
147 | __data_start__ = .; /* create a global symbol at data start */ | ||
148 | *(.ramfunc*) /* for functions in ram */ | ||
149 | *(.data) /* .data sections */ | ||
150 | *(.data*) /* .data* sections */ | ||
151 | KEEP(*(.jcr*)) | ||
152 | . = ALIGN(4); | ||
153 | __data_end__ = .; /* define a global symbol at data end */ | ||
154 | } > m_data | ||
155 | |||
156 | __DATA_END = __DATA_ROM + (__data_end__ - __data_start__); | ||
157 | __IMAGE_START = LOADADDR(.interrupts); | ||
158 | __IMAGE_END = LOADADDR(.data) + SIZEOF(.data); | ||
159 | __IMAGE_SIZE = __IMAGE_END - __IMAGE_START; | ||
160 | text_end = ORIGIN(m_text) + LENGTH(m_text); | ||
161 | ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") | ||
162 | |||
163 | /* Uninitialized data section */ | ||
164 | .bss : | ||
165 | { | ||
166 | /* This is used by the startup in order to initialize the .bss section */ | ||
167 | . = ALIGN(4); | ||
168 | __START_BSS = .; | ||
169 | __bss_start__ = .; | ||
170 | *(.bss) | ||
171 | *(.bss*) | ||
172 | *(COMMON) | ||
173 | . = ALIGN(4); | ||
174 | __bss_end__ = .; | ||
175 | __END_BSS = .; | ||
176 | } > m_data | ||
177 | |||
178 | .heap : | ||
179 | { | ||
180 | . = ALIGN(8); | ||
181 | __end__ = .; | ||
182 | PROVIDE(end = .); | ||
183 | __HeapBase = .; | ||
184 | . += HEAP_SIZE; | ||
185 | __HeapLimit = .; | ||
186 | __heap_limit = .; /* Add for _sbrk */ | ||
187 | } > m_data | ||
188 | |||
189 | .stack : | ||
190 | { | ||
191 | . = ALIGN(8); | ||
192 | . += STACK_SIZE; | ||
193 | } > m_data | ||
194 | |||
195 | m_usb_bdt (NOLOAD) : | ||
196 | { | ||
197 | . = ALIGN(512); | ||
198 | *(m_usb_bdt) | ||
199 | } > m_usb_sram | ||
200 | |||
201 | m_usb_global (NOLOAD) : | ||
202 | { | ||
203 | *(m_usb_global) | ||
204 | } > m_usb_sram | ||
205 | |||
206 | /* Initializes stack on the end of block */ | ||
207 | __StackTop = ORIGIN(m_data) + LENGTH(m_data); | ||
208 | __StackLimit = __StackTop - STACK_SIZE; | ||
209 | PROVIDE(__stack = __StackTop); | ||
210 | |||
211 | .ARM.attributes 0 : { *(.ARM.attributes) } | ||
212 | |||
213 | ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap") | ||
214 | } | ||
215 | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/libpower_hardabi.a b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/libpower_hardabi.a new file mode 100644 index 000000000..0e5c92f49 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/libpower_hardabi.a | |||
Binary files differ | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/libpower_softabi.a b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/libpower_softabi.a new file mode 100644 index 000000000..78e7c633e --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/libpower_softabi.a | |||
Binary files differ | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/startup_LPC54005.S b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/startup_LPC54005.S new file mode 100644 index 000000000..66d8d46fc --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/gcc/startup_LPC54005.S | |||
@@ -0,0 +1,908 @@ | |||
1 | /* --------------------------------------------------------------------------*/ | ||
2 | /* @file: startup_LPC54005.S */ | ||
3 | /* @purpose: CMSIS Cortex-M4 Core Device Startup File */ | ||
4 | /* LPC54005 */ | ||
5 | /* @version: 1.2 */ | ||
6 | /* @date: 2017-6-8 */ | ||
7 | /* --------------------------------------------------------------------------*/ | ||
8 | /* */ | ||
9 | /* Copyright 1997-2016 Freescale Semiconductor, Inc. */ | ||
10 | /* Copyright 2016-2019 NXP */ | ||
11 | /* All rights reserved. */ | ||
12 | /* */ | ||
13 | /* SPDX-License-Identifier: BSD-3-Clause */ | ||
14 | /*****************************************************************************/ | ||
15 | /* Version: GCC for ARM Embedded Processors */ | ||
16 | /*****************************************************************************/ | ||
17 | |||
18 | |||
19 | .syntax unified | ||
20 | .arch armv7-m | ||
21 | |||
22 | .section .isr_vector, "a" | ||
23 | .align 2 | ||
24 | .globl __Vectors | ||
25 | __Vectors: | ||
26 | .long __StackTop /* Top of Stack */ | ||
27 | .long Reset_Handler /* Reset Handler */ | ||
28 | .long NMI_Handler /* NMI Handler*/ | ||
29 | .long HardFault_Handler /* Hard Fault Handler*/ | ||
30 | .long MemManage_Handler /* MPU Fault Handler*/ | ||
31 | .long BusFault_Handler /* Bus Fault Handler*/ | ||
32 | .long UsageFault_Handler /* Usage Fault Handler*/ | ||
33 | .long 0 /* Reserved*/ | ||
34 | .long 0 /* Reserved*/ | ||
35 | .long 0xEDDC94BD /* Enhanced image marker, set to 0x0 for legacy boot */ | ||
36 | .long 0x160 /* Pointer to enhanced boot block, set to 0x0 for legacy boot */ | ||
37 | .long SVC_Handler /* SVCall Handler*/ | ||
38 | .long DebugMon_Handler /* Debug Monitor Handler*/ | ||
39 | .long 0 /* Reserved*/ | ||
40 | .long PendSV_Handler /* PendSV Handler*/ | ||
41 | .long SysTick_Handler /* SysTick Handler*/ | ||
42 | |||
43 | /* External Interrupts */ | ||
44 | .long WDT_BOD_IRQHandler /* Windowed watchdog timer, Brownout detect */ | ||
45 | .long DMA0_IRQHandler /* DMA controller */ | ||
46 | .long GINT0_IRQHandler /* GPIO group 0 */ | ||
47 | .long GINT1_IRQHandler /* GPIO group 1 */ | ||
48 | .long PIN_INT0_IRQHandler /* Pin interrupt 0 or pattern match engine slice 0 */ | ||
49 | .long PIN_INT1_IRQHandler /* Pin interrupt 1or pattern match engine slice 1 */ | ||
50 | .long PIN_INT2_IRQHandler /* Pin interrupt 2 or pattern match engine slice 2 */ | ||
51 | .long PIN_INT3_IRQHandler /* Pin interrupt 3 or pattern match engine slice 3 */ | ||
52 | .long UTICK0_IRQHandler /* Micro-tick Timer */ | ||
53 | .long MRT0_IRQHandler /* Multi-rate timer */ | ||
54 | .long CTIMER0_IRQHandler /* Standard counter/timer CTIMER0 */ | ||
55 | .long CTIMER1_IRQHandler /* Standard counter/timer CTIMER1 */ | ||
56 | .long SCT0_IRQHandler /* SCTimer/PWM */ | ||
57 | .long CTIMER3_IRQHandler /* Standard counter/timer CTIMER3 */ | ||
58 | .long FLEXCOMM0_IRQHandler /* Flexcomm Interface 0 (USART, SPI, I2C, FLEXCOMM) */ | ||
59 | .long FLEXCOMM1_IRQHandler /* Flexcomm Interface 1 (USART, SPI, I2C, FLEXCOMM) */ | ||
60 | .long FLEXCOMM2_IRQHandler /* Flexcomm Interface 2 (USART, SPI, I2C, FLEXCOMM) */ | ||
61 | .long FLEXCOMM3_IRQHandler /* Flexcomm Interface 3 (USART, SPI, I2C, FLEXCOMM) */ | ||
62 | .long FLEXCOMM4_IRQHandler /* Flexcomm Interface 4 (USART, SPI, I2C, FLEXCOMM) */ | ||
63 | .long FLEXCOMM5_IRQHandler /* Flexcomm Interface 5 (USART, SPI, I2C,, FLEXCOMM) */ | ||
64 | .long FLEXCOMM6_IRQHandler /* Flexcomm Interface 6 (USART, SPI, I2C, I2S,, FLEXCOMM) */ | ||
65 | .long FLEXCOMM7_IRQHandler /* Flexcomm Interface 7 (USART, SPI, I2C, I2S,, FLEXCOMM) */ | ||
66 | .long ADC0_SEQA_IRQHandler /* ADC0 sequence A completion. */ | ||
67 | .long ADC0_SEQB_IRQHandler /* ADC0 sequence B completion. */ | ||
68 | .long ADC0_THCMP_IRQHandler /* ADC0 threshold compare and error. */ | ||
69 | .long DMIC0_IRQHandler /* Digital microphone and DMIC subsystem */ | ||
70 | .long HWVAD0_IRQHandler /* Hardware Voice Activity Detector */ | ||
71 | .long USB0_NEEDCLK_IRQHandler /* USB Activity Wake-up Interrupt */ | ||
72 | .long USB0_IRQHandler /* USB device */ | ||
73 | .long RTC_IRQHandler /* RTC alarm and wake-up interrupts */ | ||
74 | .long FLEXCOMM10_IRQHandler /* Flexcomm Interface 10 (SPI, FLEXCOMM) */ | ||
75 | .long Reserved47_IRQHandler /* Reserved interrupt */ | ||
76 | .long PIN_INT4_IRQHandler /* Pin interrupt 4 or pattern match engine slice 4 int */ | ||
77 | .long PIN_INT5_IRQHandler /* Pin interrupt 5 or pattern match engine slice 5 int */ | ||
78 | .long PIN_INT6_IRQHandler /* Pin interrupt 6 or pattern match engine slice 6 int */ | ||
79 | .long PIN_INT7_IRQHandler /* Pin interrupt 7 or pattern match engine slice 7 int */ | ||
80 | .long CTIMER2_IRQHandler /* Standard counter/timer CTIMER2 */ | ||
81 | .long CTIMER4_IRQHandler /* Standard counter/timer CTIMER4 */ | ||
82 | .long RIT_IRQHandler /* Repetitive Interrupt Timer */ | ||
83 | .long SPIFI0_IRQHandler /* SPI flash interface */ | ||
84 | .long FLEXCOMM8_IRQHandler /* Flexcomm Interface 8 (USART, SPI, I2C, FLEXCOMM) */ | ||
85 | .long FLEXCOMM9_IRQHandler /* Flexcomm Interface 9 (USART, SPI, I2C, FLEXCOMM) */ | ||
86 | .long SDIO_IRQHandler /* SD/MMC */ | ||
87 | .long CAN0_IRQ0_IRQHandler /* CAN0 interrupt0 */ | ||
88 | .long CAN0_IRQ1_IRQHandler /* CAN0 interrupt1 */ | ||
89 | .long CAN1_IRQ0_IRQHandler /* CAN1 interrupt0 */ | ||
90 | .long CAN1_IRQ1_IRQHandler /* CAN1 interrupt1 */ | ||
91 | .long USB1_IRQHandler /* USB1 interrupt */ | ||
92 | .long USB1_NEEDCLK_IRQHandler /* USB1 activity */ | ||
93 | .long ETHERNET_IRQHandler /* Ethernet */ | ||
94 | .long ETHERNET_PMT_IRQHandler /* Ethernet power management interrupt */ | ||
95 | .long ETHERNET_MACLP_IRQHandler /* Ethernet MAC interrupt */ | ||
96 | .long Reserved68_IRQHandler /* Reserved interrupt */ | ||
97 | .long LCD_IRQHandler /* LCD interrupt */ | ||
98 | .long SHA_IRQHandler /* SHA interrupt */ | ||
99 | .long SMARTCARD0_IRQHandler /* Smart card 0 interrupt */ | ||
100 | .long SMARTCARD1_IRQHandler /* Smart card 1 interrupt */ | ||
101 | |||
102 | .size __Vectors, . - __Vectors | ||
103 | |||
104 | .long 0 /* Reserved */ | ||
105 | .long 0 /* Reserved */ | ||
106 | .long 0 /* Reserved */ | ||
107 | .long 0 /* Reserved */ | ||
108 | .long 0 /* Reserved */ | ||
109 | .long 0 /* Reserved */ | ||
110 | .long 0 /* Reserved */ | ||
111 | .long 0 /* Reserved */ | ||
112 | .long 0 /* Reserved */ | ||
113 | .long 0 /* Reserved */ | ||
114 | .long 0 /* Reserved */ | ||
115 | .long 0 /* Reserved */ | ||
116 | .long 0 /* Reserved */ | ||
117 | .long 0 /* Reserved */ | ||
118 | .long 0 /* Reserved */ | ||
119 | |||
120 | #ifndef IMG_BAUDRATE | ||
121 | #define IMG_BAUDRATE 0 | ||
122 | #endif | ||
123 | |||
124 | __image_header: | ||
125 | .long 0xFEEDA5A5 /* (0x00, 0x160) Header Marker */ | ||
126 | #ifdef XIP_IMAGE | ||
127 | #ifdef ADD_CRC | ||
128 | .long 0x2 /* (0x04) Image Type */ | ||
129 | #else | ||
130 | .long 0x3 /* (0x04) Image Type */ | ||
131 | #endif | ||
132 | #else | ||
133 | #ifdef ADD_CRC | ||
134 | .long 0x0 /* (0x04) Image Type */ | ||
135 | #else | ||
136 | .long 0x1 /* (0x04) Image Type */ | ||
137 | #endif | ||
138 | #endif | ||
139 | |||
140 | #ifdef XIP_IMAGE | ||
141 | .long 0x10000000 /* (0x08) Load_address */ | ||
142 | #else | ||
143 | .long 0x00000000 /* (0x08) Load_address */ | ||
144 | #endif | ||
145 | .long __IMAGE_SIZE - 4 /* (0x0C) load_length, exclude 4 bytes CRC field */ | ||
146 | .long 0 /* (0x10) CRC value (only applicable to NON Non-secure images) */ | ||
147 | .long 0 /* (0x14) Version (only applicable to DUAL_ENH image type */ | ||
148 | .long 0 /* (0x18) EMC static memory configuration settings, required for EMC boot */ | ||
149 | .long IMG_BAUDRATE /* image baudrate */ | ||
150 | .long 0 /* Reserved */ | ||
151 | .long 0xEDDC94BD /* (0x24) Image_marker */ | ||
152 | .long 0 /* (0x28) SBZ */ | ||
153 | .long 0 /* (0x2C) reserved */ | ||
154 | #ifdef W25Q128JVFM | ||
155 | /* SPI Descriptor - W25Q128JVFM */ | ||
156 | .long 0x00000000 /* 0xFFFFFFFF to default 1-bit SPI mode ;DevStrAdr */ | ||
157 | .long 0x001870EF /* mfgId + extCount */ | ||
158 | .long 0x00000000 /* extid 0-3 */ | ||
159 | .long 0x00000000 /* extid 4-7 */ | ||
160 | .long 0x0001001D /* caps */ | ||
161 | .long 0x00000100 /* Blks + RESV1 */ | ||
162 | .long 0x00010000 /* blkSize */ | ||
163 | .long 0x00000000 /* subBlks + subBlkSize */ | ||
164 | .long 0x00000100 /* pageSize + RESV2 */ | ||
165 | .long 0x00003F00 /* maxReadSize */ | ||
166 | .long 0x68506850 /* maxClkRate,maxReadRate,maxHSReadRate,maxProgramRate */ | ||
167 | .long 0x04030050 /* maxHSProgramRate,initDeInitFxId,clearStatusFxId,getStatusFxId, */ | ||
168 | .long 0x14110D09 /* setStatusFxId,setOptionsFxId,getReadCmdFxId,getWriteCmdFxId */ | ||
169 | #endif | ||
170 | |||
171 | #ifdef MXL12835F | ||
172 | /* SPI Descriptor - MXL12835F */ | ||
173 | .long 0x00000000 /* 0xFFFFFFFF to default 1-bit SPI mode ;DevStrAdr */ | ||
174 | .long 0x001820C2 /* mfgId + extCount */ | ||
175 | .long 0x00000000 /* extid 0-3 */ | ||
176 | .long 0x00000000 /* extid 4-7 */ | ||
177 | .long 0x0001001D /* caps */ | ||
178 | .long 0x00000100 /* Blks + RESV1 */ | ||
179 | .long 0x00010000 /* blkSize */ | ||
180 | .long 0x00000000 /* subBlks + subBlkSize */ | ||
181 | .long 0x00000100 /* pageSize + RESV2 */ | ||
182 | .long 0x00003F00 /* maxReadSize */ | ||
183 | .long 0x68506850 /* maxClkRate,maxReadRate,maxHSReadRate,maxProgramRate */ | ||
184 | .long 0x06030050 /* maxHSProgramRate,initDeInitFxId,clearStatusFxId,getStatusFxId */ | ||
185 | .long 0x14110F0B /* setStatusFxId,setOptionsFxId,getReadCmdFxId,getWriteCmdFxId */ | ||
186 | #endif | ||
187 | .text | ||
188 | .thumb | ||
189 | |||
190 | /* Reset Handler */ | ||
191 | .thumb_func | ||
192 | .align 2 | ||
193 | .globl Reset_Handler | ||
194 | .weak Reset_Handler | ||
195 | .type Reset_Handler, %function | ||
196 | Reset_Handler: | ||
197 | |||
198 | #ifndef __NO_SYSTEM_INIT | ||
199 | movs r0,#56 | ||
200 | ldr r1, =0x40000220 | ||
201 | str r0, [r1] /* Enable SRAM clock used by Stack */ | ||
202 | ldr r0,=SystemInit | ||
203 | blx r0 | ||
204 | #endif | ||
205 | /* Loop to copy data from read only memory to RAM. The ranges | ||
206 | * of copy from/to are specified by following symbols evaluated in | ||
207 | * linker script. | ||
208 | * __etext: End of code section, i.e., begin of data sections to copy from. | ||
209 | * __data_start__/__data_end__: RAM address range that data should be | ||
210 | * copied to. Both must be aligned to 4 bytes boundary. */ | ||
211 | |||
212 | ldr r1, =__etext | ||
213 | ldr r2, =__data_start__ | ||
214 | ldr r3, =__data_end__ | ||
215 | |||
216 | #if 1 | ||
217 | /* Here are two copies of loop implemenations. First one favors code size | ||
218 | * and the second one favors performance. Default uses the first one. | ||
219 | * Change to "#if 0" to use the second one */ | ||
220 | .LC0: | ||
221 | cmp r2, r3 | ||
222 | ittt lt | ||
223 | ldrlt r0, [r1], #4 | ||
224 | strlt r0, [r2], #4 | ||
225 | blt .LC0 | ||
226 | #else | ||
227 | subs r3, r2 | ||
228 | ble .LC1 | ||
229 | .LC0: | ||
230 | subs r3, #4 | ||
231 | ldr r0, [r1, r3] | ||
232 | str r0, [r2, r3] | ||
233 | bgt .LC0 | ||
234 | .LC1: | ||
235 | #endif | ||
236 | |||
237 | #ifdef __STARTUP_CLEAR_BSS | ||
238 | /* This part of work usually is done in C library startup code. Otherwise, | ||
239 | * define this macro to enable it in this startup. | ||
240 | * | ||
241 | * Loop to zero out BSS section, which uses following symbols | ||
242 | * in linker script: | ||
243 | * __bss_start__: start of BSS section. Must align to 4 | ||
244 | * __bss_end__: end of BSS section. Must align to 4 | ||
245 | */ | ||
246 | ldr r1, =__bss_start__ | ||
247 | ldr r2, =__bss_end__ | ||
248 | |||
249 | movs r0, 0 | ||
250 | .LC2: | ||
251 | cmp r1, r2 | ||
252 | itt lt | ||
253 | strlt r0, [r1], #4 | ||
254 | blt .LC2 | ||
255 | #endif /* __STARTUP_CLEAR_BSS */ | ||
256 | |||
257 | #ifndef __START | ||
258 | #define __START _start | ||
259 | #endif | ||
260 | #ifndef __ATOLLIC__ | ||
261 | ldr r0,=__START | ||
262 | blx r0 | ||
263 | #else | ||
264 | ldr r0,=__libc_init_array | ||
265 | blx r0 | ||
266 | ldr r0,=main | ||
267 | bx r0 | ||
268 | #endif | ||
269 | .pool | ||
270 | .size Reset_Handler, . - Reset_Handler | ||
271 | |||
272 | .align 1 | ||
273 | .thumb_func | ||
274 | .weak DefaultISR | ||
275 | .type DefaultISR, %function | ||
276 | DefaultISR: | ||
277 | b DefaultISR | ||
278 | .size DefaultISR, . - DefaultISR | ||
279 | |||
280 | .align 1 | ||
281 | .thumb_func | ||
282 | .weak NMI_Handler | ||
283 | .type NMI_Handler, %function | ||
284 | NMI_Handler: | ||
285 | ldr r0,=NMI_Handler | ||
286 | bx r0 | ||
287 | .size NMI_Handler, . - NMI_Handler | ||
288 | |||
289 | .align 1 | ||
290 | .thumb_func | ||
291 | .weak HardFault_Handler | ||
292 | .type HardFault_Handler, %function | ||
293 | HardFault_Handler: | ||
294 | ldr r0,=HardFault_Handler | ||
295 | bx r0 | ||
296 | .size HardFault_Handler, . - HardFault_Handler | ||
297 | |||
298 | .align 1 | ||
299 | .thumb_func | ||
300 | .weak SVC_Handler | ||
301 | .type SVC_Handler, %function | ||
302 | SVC_Handler: | ||
303 | ldr r0,=SVC_Handler | ||
304 | bx r0 | ||
305 | .size SVC_Handler, . - SVC_Handler | ||
306 | |||
307 | .align 1 | ||
308 | .thumb_func | ||
309 | .weak PendSV_Handler | ||
310 | .type PendSV_Handler, %function | ||
311 | PendSV_Handler: | ||
312 | ldr r0,=PendSV_Handler | ||
313 | bx r0 | ||
314 | .size PendSV_Handler, . - PendSV_Handler | ||
315 | |||
316 | .align 1 | ||
317 | .thumb_func | ||
318 | .weak SysTick_Handler | ||
319 | .type SysTick_Handler, %function | ||
320 | SysTick_Handler: | ||
321 | ldr r0,=SysTick_Handler | ||
322 | bx r0 | ||
323 | .size SysTick_Handler, . - SysTick_Handler | ||
324 | |||
325 | .align 1 | ||
326 | .thumb_func | ||
327 | .weak WDT_BOD_IRQHandler | ||
328 | .type WDT_BOD_IRQHandler, %function | ||
329 | WDT_BOD_IRQHandler: | ||
330 | ldr r0,=WDT_BOD_DriverIRQHandler | ||
331 | bx r0 | ||
332 | .size WDT_BOD_IRQHandler, . - WDT_BOD_IRQHandler | ||
333 | |||
334 | .align 1 | ||
335 | .thumb_func | ||
336 | .weak DMA0_IRQHandler | ||
337 | .type DMA0_IRQHandler, %function | ||
338 | DMA0_IRQHandler: | ||
339 | ldr r0,=DMA0_DriverIRQHandler | ||
340 | bx r0 | ||
341 | .size DMA0_IRQHandler, . - DMA0_IRQHandler | ||
342 | |||
343 | .align 1 | ||
344 | .thumb_func | ||
345 | .weak GINT0_IRQHandler | ||
346 | .type GINT0_IRQHandler, %function | ||
347 | GINT0_IRQHandler: | ||
348 | ldr r0,=GINT0_DriverIRQHandler | ||
349 | bx r0 | ||
350 | .size GINT0_IRQHandler, . - GINT0_IRQHandler | ||
351 | |||
352 | .align 1 | ||
353 | .thumb_func | ||
354 | .weak GINT1_IRQHandler | ||
355 | .type GINT1_IRQHandler, %function | ||
356 | GINT1_IRQHandler: | ||
357 | ldr r0,=GINT1_DriverIRQHandler | ||
358 | bx r0 | ||
359 | .size GINT1_IRQHandler, . - GINT1_IRQHandler | ||
360 | |||
361 | .align 1 | ||
362 | .thumb_func | ||
363 | .weak PIN_INT0_IRQHandler | ||
364 | .type PIN_INT0_IRQHandler, %function | ||
365 | PIN_INT0_IRQHandler: | ||
366 | ldr r0,=PIN_INT0_DriverIRQHandler | ||
367 | bx r0 | ||
368 | .size PIN_INT0_IRQHandler, . - PIN_INT0_IRQHandler | ||
369 | |||
370 | .align 1 | ||
371 | .thumb_func | ||
372 | .weak PIN_INT1_IRQHandler | ||
373 | .type PIN_INT1_IRQHandler, %function | ||
374 | PIN_INT1_IRQHandler: | ||
375 | ldr r0,=PIN_INT1_DriverIRQHandler | ||
376 | bx r0 | ||
377 | .size PIN_INT1_IRQHandler, . - PIN_INT1_IRQHandler | ||
378 | |||
379 | .align 1 | ||
380 | .thumb_func | ||
381 | .weak PIN_INT2_IRQHandler | ||
382 | .type PIN_INT2_IRQHandler, %function | ||
383 | PIN_INT2_IRQHandler: | ||
384 | ldr r0,=PIN_INT2_DriverIRQHandler | ||
385 | bx r0 | ||
386 | .size PIN_INT2_IRQHandler, . - PIN_INT2_IRQHandler | ||
387 | |||
388 | .align 1 | ||
389 | .thumb_func | ||
390 | .weak PIN_INT3_IRQHandler | ||
391 | .type PIN_INT3_IRQHandler, %function | ||
392 | PIN_INT3_IRQHandler: | ||
393 | ldr r0,=PIN_INT3_DriverIRQHandler | ||
394 | bx r0 | ||
395 | .size PIN_INT3_IRQHandler, . - PIN_INT3_IRQHandler | ||
396 | |||
397 | .align 1 | ||
398 | .thumb_func | ||
399 | .weak UTICK0_IRQHandler | ||
400 | .type UTICK0_IRQHandler, %function | ||
401 | UTICK0_IRQHandler: | ||
402 | ldr r0,=UTICK0_DriverIRQHandler | ||
403 | bx r0 | ||
404 | .size UTICK0_IRQHandler, . - UTICK0_IRQHandler | ||
405 | |||
406 | .align 1 | ||
407 | .thumb_func | ||
408 | .weak MRT0_IRQHandler | ||
409 | .type MRT0_IRQHandler, %function | ||
410 | MRT0_IRQHandler: | ||
411 | ldr r0,=MRT0_DriverIRQHandler | ||
412 | bx r0 | ||
413 | .size MRT0_IRQHandler, . - MRT0_IRQHandler | ||
414 | |||
415 | .align 1 | ||
416 | .thumb_func | ||
417 | .weak CTIMER0_IRQHandler | ||
418 | .type CTIMER0_IRQHandler, %function | ||
419 | CTIMER0_IRQHandler: | ||
420 | ldr r0,=CTIMER0_DriverIRQHandler | ||
421 | bx r0 | ||
422 | .size CTIMER0_IRQHandler, . - CTIMER0_IRQHandler | ||
423 | |||
424 | .align 1 | ||
425 | .thumb_func | ||
426 | .weak CTIMER1_IRQHandler | ||
427 | .type CTIMER1_IRQHandler, %function | ||
428 | CTIMER1_IRQHandler: | ||
429 | ldr r0,=CTIMER1_DriverIRQHandler | ||
430 | bx r0 | ||
431 | .size CTIMER1_IRQHandler, . - CTIMER1_IRQHandler | ||
432 | |||
433 | .align 1 | ||
434 | .thumb_func | ||
435 | .weak SCT0_IRQHandler | ||
436 | .type SCT0_IRQHandler, %function | ||
437 | SCT0_IRQHandler: | ||
438 | ldr r0,=SCT0_DriverIRQHandler | ||
439 | bx r0 | ||
440 | .size SCT0_IRQHandler, . - SCT0_IRQHandler | ||
441 | |||
442 | .align 1 | ||
443 | .thumb_func | ||
444 | .weak CTIMER3_IRQHandler | ||
445 | .type CTIMER3_IRQHandler, %function | ||
446 | CTIMER3_IRQHandler: | ||
447 | ldr r0,=CTIMER3_DriverIRQHandler | ||
448 | bx r0 | ||
449 | .size CTIMER3_IRQHandler, . - CTIMER3_IRQHandler | ||
450 | |||
451 | .align 1 | ||
452 | .thumb_func | ||
453 | .weak FLEXCOMM0_IRQHandler | ||
454 | .type FLEXCOMM0_IRQHandler, %function | ||
455 | FLEXCOMM0_IRQHandler: | ||
456 | ldr r0,=FLEXCOMM0_DriverIRQHandler | ||
457 | bx r0 | ||
458 | .size FLEXCOMM0_IRQHandler, . - FLEXCOMM0_IRQHandler | ||
459 | |||
460 | .align 1 | ||
461 | .thumb_func | ||
462 | .weak FLEXCOMM1_IRQHandler | ||
463 | .type FLEXCOMM1_IRQHandler, %function | ||
464 | FLEXCOMM1_IRQHandler: | ||
465 | ldr r0,=FLEXCOMM1_DriverIRQHandler | ||
466 | bx r0 | ||
467 | .size FLEXCOMM1_IRQHandler, . - FLEXCOMM1_IRQHandler | ||
468 | |||
469 | .align 1 | ||
470 | .thumb_func | ||
471 | .weak FLEXCOMM2_IRQHandler | ||
472 | .type FLEXCOMM2_IRQHandler, %function | ||
473 | FLEXCOMM2_IRQHandler: | ||
474 | ldr r0,=FLEXCOMM2_DriverIRQHandler | ||
475 | bx r0 | ||
476 | .size FLEXCOMM2_IRQHandler, . - FLEXCOMM2_IRQHandler | ||
477 | |||
478 | .align 1 | ||
479 | .thumb_func | ||
480 | .weak FLEXCOMM3_IRQHandler | ||
481 | .type FLEXCOMM3_IRQHandler, %function | ||
482 | FLEXCOMM3_IRQHandler: | ||
483 | ldr r0,=FLEXCOMM3_DriverIRQHandler | ||
484 | bx r0 | ||
485 | .size FLEXCOMM3_IRQHandler, . - FLEXCOMM3_IRQHandler | ||
486 | |||
487 | .align 1 | ||
488 | .thumb_func | ||
489 | .weak FLEXCOMM4_IRQHandler | ||
490 | .type FLEXCOMM4_IRQHandler, %function | ||
491 | FLEXCOMM4_IRQHandler: | ||
492 | ldr r0,=FLEXCOMM4_DriverIRQHandler | ||
493 | bx r0 | ||
494 | .size FLEXCOMM4_IRQHandler, . - FLEXCOMM4_IRQHandler | ||
495 | |||
496 | .align 1 | ||
497 | .thumb_func | ||
498 | .weak FLEXCOMM5_IRQHandler | ||
499 | .type FLEXCOMM5_IRQHandler, %function | ||
500 | FLEXCOMM5_IRQHandler: | ||
501 | ldr r0,=FLEXCOMM5_DriverIRQHandler | ||
502 | bx r0 | ||
503 | .size FLEXCOMM5_IRQHandler, . - FLEXCOMM5_IRQHandler | ||
504 | |||
505 | .align 1 | ||
506 | .thumb_func | ||
507 | .weak FLEXCOMM6_IRQHandler | ||
508 | .type FLEXCOMM6_IRQHandler, %function | ||
509 | FLEXCOMM6_IRQHandler: | ||
510 | ldr r0,=FLEXCOMM6_DriverIRQHandler | ||
511 | bx r0 | ||
512 | .size FLEXCOMM6_IRQHandler, . - FLEXCOMM6_IRQHandler | ||
513 | |||
514 | .align 1 | ||
515 | .thumb_func | ||
516 | .weak FLEXCOMM7_IRQHandler | ||
517 | .type FLEXCOMM7_IRQHandler, %function | ||
518 | FLEXCOMM7_IRQHandler: | ||
519 | ldr r0,=FLEXCOMM7_DriverIRQHandler | ||
520 | bx r0 | ||
521 | .size FLEXCOMM7_IRQHandler, . - FLEXCOMM7_IRQHandler | ||
522 | |||
523 | .align 1 | ||
524 | .thumb_func | ||
525 | .weak ADC0_SEQA_IRQHandler | ||
526 | .type ADC0_SEQA_IRQHandler, %function | ||
527 | ADC0_SEQA_IRQHandler: | ||
528 | ldr r0,=ADC0_SEQA_DriverIRQHandler | ||
529 | bx r0 | ||
530 | .size ADC0_SEQA_IRQHandler, . - ADC0_SEQA_IRQHandler | ||
531 | |||
532 | .align 1 | ||
533 | .thumb_func | ||
534 | .weak ADC0_SEQB_IRQHandler | ||
535 | .type ADC0_SEQB_IRQHandler, %function | ||
536 | ADC0_SEQB_IRQHandler: | ||
537 | ldr r0,=ADC0_SEQB_DriverIRQHandler | ||
538 | bx r0 | ||
539 | .size ADC0_SEQB_IRQHandler, . - ADC0_SEQB_IRQHandler | ||
540 | |||
541 | .align 1 | ||
542 | .thumb_func | ||
543 | .weak ADC0_THCMP_IRQHandler | ||
544 | .type ADC0_THCMP_IRQHandler, %function | ||
545 | ADC0_THCMP_IRQHandler: | ||
546 | ldr r0,=ADC0_THCMP_DriverIRQHandler | ||
547 | bx r0 | ||
548 | .size ADC0_THCMP_IRQHandler, . - ADC0_THCMP_IRQHandler | ||
549 | |||
550 | .align 1 | ||
551 | .thumb_func | ||
552 | .weak DMIC0_IRQHandler | ||
553 | .type DMIC0_IRQHandler, %function | ||
554 | DMIC0_IRQHandler: | ||
555 | ldr r0,=DMIC0_DriverIRQHandler | ||
556 | bx r0 | ||
557 | .size DMIC0_IRQHandler, . - DMIC0_IRQHandler | ||
558 | |||
559 | .align 1 | ||
560 | .thumb_func | ||
561 | .weak HWVAD0_IRQHandler | ||
562 | .type HWVAD0_IRQHandler, %function | ||
563 | HWVAD0_IRQHandler: | ||
564 | ldr r0,=HWVAD0_DriverIRQHandler | ||
565 | bx r0 | ||
566 | .size HWVAD0_IRQHandler, . - HWVAD0_IRQHandler | ||
567 | |||
568 | .align 1 | ||
569 | .thumb_func | ||
570 | .weak USB0_NEEDCLK_IRQHandler | ||
571 | .type USB0_NEEDCLK_IRQHandler, %function | ||
572 | USB0_NEEDCLK_IRQHandler: | ||
573 | ldr r0,=USB0_NEEDCLK_DriverIRQHandler | ||
574 | bx r0 | ||
575 | .size USB0_NEEDCLK_IRQHandler, . - USB0_NEEDCLK_IRQHandler | ||
576 | |||
577 | .align 1 | ||
578 | .thumb_func | ||
579 | .weak USB0_IRQHandler | ||
580 | .type USB0_IRQHandler, %function | ||
581 | USB0_IRQHandler: | ||
582 | ldr r0,=USB0_DriverIRQHandler | ||
583 | bx r0 | ||
584 | .size USB0_IRQHandler, . - USB0_IRQHandler | ||
585 | |||
586 | .align 1 | ||
587 | .thumb_func | ||
588 | .weak RTC_IRQHandler | ||
589 | .type RTC_IRQHandler, %function | ||
590 | RTC_IRQHandler: | ||
591 | ldr r0,=RTC_DriverIRQHandler | ||
592 | bx r0 | ||
593 | .size RTC_IRQHandler, . - RTC_IRQHandler | ||
594 | |||
595 | .align 1 | ||
596 | .thumb_func | ||
597 | .weak FLEXCOMM10_IRQHandler | ||
598 | .type FLEXCOMM10_IRQHandler, %function | ||
599 | FLEXCOMM10_IRQHandler: | ||
600 | ldr r0,=FLEXCOMM10_DriverIRQHandler | ||
601 | bx r0 | ||
602 | .size FLEXCOMM10_IRQHandler, . - FLEXCOMM10_IRQHandler | ||
603 | |||
604 | .align 1 | ||
605 | .thumb_func | ||
606 | .weak Reserved47_IRQHandler | ||
607 | .type Reserved47_IRQHandler, %function | ||
608 | Reserved47_IRQHandler: | ||
609 | ldr r0,=Reserved47_DriverIRQHandler | ||
610 | bx r0 | ||
611 | .size Reserved47_IRQHandler, . - Reserved47_IRQHandler | ||
612 | |||
613 | .align 1 | ||
614 | .thumb_func | ||
615 | .weak PIN_INT4_IRQHandler | ||
616 | .type PIN_INT4_IRQHandler, %function | ||
617 | PIN_INT4_IRQHandler: | ||
618 | ldr r0,=PIN_INT4_DriverIRQHandler | ||
619 | bx r0 | ||
620 | .size PIN_INT4_IRQHandler, . - PIN_INT4_IRQHandler | ||
621 | |||
622 | .align 1 | ||
623 | .thumb_func | ||
624 | .weak PIN_INT5_IRQHandler | ||
625 | .type PIN_INT5_IRQHandler, %function | ||
626 | PIN_INT5_IRQHandler: | ||
627 | ldr r0,=PIN_INT5_DriverIRQHandler | ||
628 | bx r0 | ||
629 | .size PIN_INT5_IRQHandler, . - PIN_INT5_IRQHandler | ||
630 | |||
631 | .align 1 | ||
632 | .thumb_func | ||
633 | .weak PIN_INT6_IRQHandler | ||
634 | .type PIN_INT6_IRQHandler, %function | ||
635 | PIN_INT6_IRQHandler: | ||
636 | ldr r0,=PIN_INT6_DriverIRQHandler | ||
637 | bx r0 | ||
638 | .size PIN_INT6_IRQHandler, . - PIN_INT6_IRQHandler | ||
639 | |||
640 | .align 1 | ||
641 | .thumb_func | ||
642 | .weak PIN_INT7_IRQHandler | ||
643 | .type PIN_INT7_IRQHandler, %function | ||
644 | PIN_INT7_IRQHandler: | ||
645 | ldr r0,=PIN_INT7_DriverIRQHandler | ||
646 | bx r0 | ||
647 | .size PIN_INT7_IRQHandler, . - PIN_INT7_IRQHandler | ||
648 | |||
649 | .align 1 | ||
650 | .thumb_func | ||
651 | .weak CTIMER2_IRQHandler | ||
652 | .type CTIMER2_IRQHandler, %function | ||
653 | CTIMER2_IRQHandler: | ||
654 | ldr r0,=CTIMER2_DriverIRQHandler | ||
655 | bx r0 | ||
656 | .size CTIMER2_IRQHandler, . - CTIMER2_IRQHandler | ||
657 | |||
658 | .align 1 | ||
659 | .thumb_func | ||
660 | .weak CTIMER4_IRQHandler | ||
661 | .type CTIMER4_IRQHandler, %function | ||
662 | CTIMER4_IRQHandler: | ||
663 | ldr r0,=CTIMER4_DriverIRQHandler | ||
664 | bx r0 | ||
665 | .size CTIMER4_IRQHandler, . - CTIMER4_IRQHandler | ||
666 | |||
667 | .align 1 | ||
668 | .thumb_func | ||
669 | .weak RIT_IRQHandler | ||
670 | .type RIT_IRQHandler, %function | ||
671 | RIT_IRQHandler: | ||
672 | ldr r0,=RIT_DriverIRQHandler | ||
673 | bx r0 | ||
674 | .size RIT_IRQHandler, . - RIT_IRQHandler | ||
675 | |||
676 | .align 1 | ||
677 | .thumb_func | ||
678 | .weak SPIFI0_IRQHandler | ||
679 | .type SPIFI0_IRQHandler, %function | ||
680 | SPIFI0_IRQHandler: | ||
681 | ldr r0,=SPIFI0_DriverIRQHandler | ||
682 | bx r0 | ||
683 | .size SPIFI0_IRQHandler, . - SPIFI0_IRQHandler | ||
684 | |||
685 | .align 1 | ||
686 | .thumb_func | ||
687 | .weak FLEXCOMM8_IRQHandler | ||
688 | .type FLEXCOMM8_IRQHandler, %function | ||
689 | FLEXCOMM8_IRQHandler: | ||
690 | ldr r0,=FLEXCOMM8_DriverIRQHandler | ||
691 | bx r0 | ||
692 | .size FLEXCOMM8_IRQHandler, . - FLEXCOMM8_IRQHandler | ||
693 | |||
694 | .align 1 | ||
695 | .thumb_func | ||
696 | .weak FLEXCOMM9_IRQHandler | ||
697 | .type FLEXCOMM9_IRQHandler, %function | ||
698 | FLEXCOMM9_IRQHandler: | ||
699 | ldr r0,=FLEXCOMM9_DriverIRQHandler | ||
700 | bx r0 | ||
701 | .size FLEXCOMM9_IRQHandler, . - FLEXCOMM9_IRQHandler | ||
702 | |||
703 | .align 1 | ||
704 | .thumb_func | ||
705 | .weak SDIO_IRQHandler | ||
706 | .type SDIO_IRQHandler, %function | ||
707 | SDIO_IRQHandler: | ||
708 | ldr r0,=SDIO_DriverIRQHandler | ||
709 | bx r0 | ||
710 | .size SDIO_IRQHandler, . - SDIO_IRQHandler | ||
711 | |||
712 | .align 1 | ||
713 | .thumb_func | ||
714 | .weak CAN0_IRQ0_IRQHandler | ||
715 | .type CAN0_IRQ0_IRQHandler, %function | ||
716 | CAN0_IRQ0_IRQHandler: | ||
717 | ldr r0,=CAN0_IRQ0_DriverIRQHandler | ||
718 | bx r0 | ||
719 | .size CAN0_IRQ0_IRQHandler, . - CAN0_IRQ0_IRQHandler | ||
720 | |||
721 | .align 1 | ||
722 | .thumb_func | ||
723 | .weak CAN0_IRQ1_IRQHandler | ||
724 | .type CAN0_IRQ1_IRQHandler, %function | ||
725 | CAN0_IRQ1_IRQHandler: | ||
726 | ldr r0,=CAN0_IRQ1_DriverIRQHandler | ||
727 | bx r0 | ||
728 | .size CAN0_IRQ1_IRQHandler, . - CAN0_IRQ1_IRQHandler | ||
729 | |||
730 | .align 1 | ||
731 | .thumb_func | ||
732 | .weak CAN1_IRQ0_IRQHandler | ||
733 | .type CAN1_IRQ0_IRQHandler, %function | ||
734 | CAN1_IRQ0_IRQHandler: | ||
735 | ldr r0,=CAN1_IRQ0_DriverIRQHandler | ||
736 | bx r0 | ||
737 | .size CAN1_IRQ0_IRQHandler, . - CAN1_IRQ0_IRQHandler | ||
738 | |||
739 | .align 1 | ||
740 | .thumb_func | ||
741 | .weak CAN1_IRQ1_IRQHandler | ||
742 | .type CAN1_IRQ1_IRQHandler, %function | ||
743 | CAN1_IRQ1_IRQHandler: | ||
744 | ldr r0,=CAN1_IRQ1_DriverIRQHandler | ||
745 | bx r0 | ||
746 | .size CAN1_IRQ1_IRQHandler, . - CAN1_IRQ1_IRQHandler | ||
747 | |||
748 | .align 1 | ||
749 | .thumb_func | ||
750 | .weak USB1_IRQHandler | ||
751 | .type USB1_IRQHandler, %function | ||
752 | USB1_IRQHandler: | ||
753 | ldr r0,=USB1_DriverIRQHandler | ||
754 | bx r0 | ||
755 | .size USB1_IRQHandler, . - USB1_IRQHandler | ||
756 | |||
757 | .align 1 | ||
758 | .thumb_func | ||
759 | .weak USB1_NEEDCLK_IRQHandler | ||
760 | .type USB1_NEEDCLK_IRQHandler, %function | ||
761 | USB1_NEEDCLK_IRQHandler: | ||
762 | ldr r0,=USB1_NEEDCLK_DriverIRQHandler | ||
763 | bx r0 | ||
764 | .size USB1_NEEDCLK_IRQHandler, . - USB1_NEEDCLK_IRQHandler | ||
765 | |||
766 | .align 1 | ||
767 | .thumb_func | ||
768 | .weak ETHERNET_IRQHandler | ||
769 | .type ETHERNET_IRQHandler, %function | ||
770 | ETHERNET_IRQHandler: | ||
771 | ldr r0,=ETHERNET_DriverIRQHandler | ||
772 | bx r0 | ||
773 | .size ETHERNET_IRQHandler, . - ETHERNET_IRQHandler | ||
774 | |||
775 | .align 1 | ||
776 | .thumb_func | ||
777 | .weak ETHERNET_PMT_IRQHandler | ||
778 | .type ETHERNET_PMT_IRQHandler, %function | ||
779 | ETHERNET_PMT_IRQHandler: | ||
780 | ldr r0,=ETHERNET_PMT_DriverIRQHandler | ||
781 | bx r0 | ||
782 | .size ETHERNET_PMT_IRQHandler, . - ETHERNET_PMT_IRQHandler | ||
783 | |||
784 | .align 1 | ||
785 | .thumb_func | ||
786 | .weak ETHERNET_MACLP_IRQHandler | ||
787 | .type ETHERNET_MACLP_IRQHandler, %function | ||
788 | ETHERNET_MACLP_IRQHandler: | ||
789 | ldr r0,=ETHERNET_MACLP_DriverIRQHandler | ||
790 | bx r0 | ||
791 | .size ETHERNET_MACLP_IRQHandler, . - ETHERNET_MACLP_IRQHandler | ||
792 | |||
793 | .align 1 | ||
794 | .thumb_func | ||
795 | .weak Reserved68_IRQHandler | ||
796 | .type Reserved68_IRQHandler, %function | ||
797 | Reserved68_IRQHandler: | ||
798 | ldr r0,=Reserved68_DriverIRQHandler | ||
799 | bx r0 | ||
800 | .size Reserved68_IRQHandler, . - Reserved68_IRQHandler | ||
801 | |||
802 | .align 1 | ||
803 | .thumb_func | ||
804 | .weak LCD_IRQHandler | ||
805 | .type LCD_IRQHandler, %function | ||
806 | LCD_IRQHandler: | ||
807 | ldr r0,=LCD_DriverIRQHandler | ||
808 | bx r0 | ||
809 | .size LCD_IRQHandler, . - LCD_IRQHandler | ||
810 | |||
811 | .align 1 | ||
812 | .thumb_func | ||
813 | .weak SHA_IRQHandler | ||
814 | .type SHA_IRQHandler, %function | ||
815 | SHA_IRQHandler: | ||
816 | ldr r0,=SHA_DriverIRQHandler | ||
817 | bx r0 | ||
818 | .size SHA_IRQHandler, . - SHA_IRQHandler | ||
819 | |||
820 | .align 1 | ||
821 | .thumb_func | ||
822 | .weak SMARTCARD0_IRQHandler | ||
823 | .type SMARTCARD0_IRQHandler, %function | ||
824 | SMARTCARD0_IRQHandler: | ||
825 | ldr r0,=SMARTCARD0_DriverIRQHandler | ||
826 | bx r0 | ||
827 | .size SMARTCARD0_IRQHandler, . - SMARTCARD0_IRQHandler | ||
828 | |||
829 | .align 1 | ||
830 | .thumb_func | ||
831 | .weak SMARTCARD1_IRQHandler | ||
832 | .type SMARTCARD1_IRQHandler, %function | ||
833 | SMARTCARD1_IRQHandler: | ||
834 | ldr r0,=SMARTCARD1_DriverIRQHandler | ||
835 | bx r0 | ||
836 | .size SMARTCARD1_IRQHandler, . - SMARTCARD1_IRQHandler | ||
837 | |||
838 | /* Macro to define default handlers. Default handler | ||
839 | * will be weak symbol and just dead loops. They can be | ||
840 | * overwritten by other handlers */ | ||
841 | .macro def_irq_handler handler_name | ||
842 | .weak \handler_name | ||
843 | .set \handler_name, DefaultISR | ||
844 | .endm | ||
845 | /* Exception Handlers */ | ||
846 | def_irq_handler MemManage_Handler | ||
847 | def_irq_handler BusFault_Handler | ||
848 | def_irq_handler UsageFault_Handler | ||
849 | def_irq_handler DebugMon_Handler | ||
850 | def_irq_handler WDT_BOD_DriverIRQHandler | ||
851 | def_irq_handler DMA0_DriverIRQHandler | ||
852 | def_irq_handler GINT0_DriverIRQHandler | ||
853 | def_irq_handler GINT1_DriverIRQHandler | ||
854 | def_irq_handler PIN_INT0_DriverIRQHandler | ||
855 | def_irq_handler PIN_INT1_DriverIRQHandler | ||
856 | def_irq_handler PIN_INT2_DriverIRQHandler | ||
857 | def_irq_handler PIN_INT3_DriverIRQHandler | ||
858 | def_irq_handler UTICK0_DriverIRQHandler | ||
859 | def_irq_handler MRT0_DriverIRQHandler | ||
860 | def_irq_handler CTIMER0_DriverIRQHandler | ||
861 | def_irq_handler CTIMER1_DriverIRQHandler | ||
862 | def_irq_handler SCT0_DriverIRQHandler | ||
863 | def_irq_handler CTIMER3_DriverIRQHandler | ||
864 | def_irq_handler FLEXCOMM0_DriverIRQHandler | ||
865 | def_irq_handler FLEXCOMM1_DriverIRQHandler | ||
866 | def_irq_handler FLEXCOMM2_DriverIRQHandler | ||
867 | def_irq_handler FLEXCOMM3_DriverIRQHandler | ||
868 | def_irq_handler FLEXCOMM4_DriverIRQHandler | ||
869 | def_irq_handler FLEXCOMM5_DriverIRQHandler | ||
870 | def_irq_handler FLEXCOMM6_DriverIRQHandler | ||
871 | def_irq_handler FLEXCOMM7_DriverIRQHandler | ||
872 | def_irq_handler ADC0_SEQA_DriverIRQHandler | ||
873 | def_irq_handler ADC0_SEQB_DriverIRQHandler | ||
874 | def_irq_handler ADC0_THCMP_DriverIRQHandler | ||
875 | def_irq_handler DMIC0_DriverIRQHandler | ||
876 | def_irq_handler HWVAD0_DriverIRQHandler | ||
877 | def_irq_handler USB0_NEEDCLK_DriverIRQHandler | ||
878 | def_irq_handler USB0_DriverIRQHandler | ||
879 | def_irq_handler RTC_DriverIRQHandler | ||
880 | def_irq_handler FLEXCOMM10_DriverIRQHandler | ||
881 | def_irq_handler Reserved47_DriverIRQHandler | ||
882 | def_irq_handler PIN_INT4_DriverIRQHandler | ||
883 | def_irq_handler PIN_INT5_DriverIRQHandler | ||
884 | def_irq_handler PIN_INT6_DriverIRQHandler | ||
885 | def_irq_handler PIN_INT7_DriverIRQHandler | ||
886 | def_irq_handler CTIMER2_DriverIRQHandler | ||
887 | def_irq_handler CTIMER4_DriverIRQHandler | ||
888 | def_irq_handler RIT_DriverIRQHandler | ||
889 | def_irq_handler SPIFI0_DriverIRQHandler | ||
890 | def_irq_handler FLEXCOMM8_DriverIRQHandler | ||
891 | def_irq_handler FLEXCOMM9_DriverIRQHandler | ||
892 | def_irq_handler SDIO_DriverIRQHandler | ||
893 | def_irq_handler CAN0_IRQ0_DriverIRQHandler | ||
894 | def_irq_handler CAN0_IRQ1_DriverIRQHandler | ||
895 | def_irq_handler CAN1_IRQ0_DriverIRQHandler | ||
896 | def_irq_handler CAN1_IRQ1_DriverIRQHandler | ||
897 | def_irq_handler USB1_DriverIRQHandler | ||
898 | def_irq_handler USB1_NEEDCLK_DriverIRQHandler | ||
899 | def_irq_handler ETHERNET_DriverIRQHandler | ||
900 | def_irq_handler ETHERNET_PMT_DriverIRQHandler | ||
901 | def_irq_handler ETHERNET_MACLP_DriverIRQHandler | ||
902 | def_irq_handler Reserved68_DriverIRQHandler | ||
903 | def_irq_handler LCD_DriverIRQHandler | ||
904 | def_irq_handler SHA_DriverIRQHandler | ||
905 | def_irq_handler SMARTCARD0_DriverIRQHandler | ||
906 | def_irq_handler SMARTCARD1_DriverIRQHandler | ||
907 | |||
908 | .end | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/libpower_hardabi.a b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/libpower_hardabi.a new file mode 100644 index 000000000..0e5c92f49 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/libpower_hardabi.a | |||
Binary files differ | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/libpower_softabi.a b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/libpower_softabi.a new file mode 100644 index 000000000..78e7c633e --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/libpower_softabi.a | |||
Binary files differ | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/startup_lpc54005.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/startup_lpc54005.c new file mode 100644 index 000000000..39943aa41 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/startup_lpc54005.c | |||
@@ -0,0 +1,824 @@ | |||
1 | //***************************************************************************** | ||
2 | // LPC54005 startup code for use with MCUXpresso IDE | ||
3 | // | ||
4 | // Version : 160420 | ||
5 | //***************************************************************************** | ||
6 | // | ||
7 | // Copyright 2016-2020 NXP | ||
8 | // All rights reserved. | ||
9 | // | ||
10 | // SPDX-License-Identifier: BSD-3-Clause | ||
11 | //***************************************************************************** | ||
12 | |||
13 | #if defined (DEBUG) | ||
14 | #pragma GCC push_options | ||
15 | #pragma GCC optimize ("Og") | ||
16 | #endif // (DEBUG) | ||
17 | |||
18 | #if defined (__cplusplus) | ||
19 | #ifdef __REDLIB__ | ||
20 | #error Redlib does not support C++ | ||
21 | #else | ||
22 | //***************************************************************************** | ||
23 | // | ||
24 | // The entry point for the C++ library startup | ||
25 | // | ||
26 | //***************************************************************************** | ||
27 | extern "C" { | ||
28 | extern void __libc_init_array(void); | ||
29 | } | ||
30 | #endif | ||
31 | #endif | ||
32 | |||
33 | #define WEAK __attribute__ ((weak)) | ||
34 | #define WEAK_AV __attribute__ ((weak, section(".after_vectors"))) | ||
35 | #define ALIAS(f) __attribute__ ((weak, alias (#f))) | ||
36 | |||
37 | //***************************************************************************** | ||
38 | #if defined (__cplusplus) | ||
39 | extern "C" { | ||
40 | #endif | ||
41 | |||
42 | //***************************************************************************** | ||
43 | // Variable to store CRP value in. Will be placed automatically | ||
44 | // by the linker when "Enable Code Read Protect" selected. | ||
45 | // See crp.h header for more information | ||
46 | //***************************************************************************** | ||
47 | #include <NXP/crp.h> | ||
48 | __CRP const unsigned int CRP_WORD = CRP_NO_CRP ; | ||
49 | |||
50 | //***************************************************************************** | ||
51 | // Declaration of external SystemInit function | ||
52 | //***************************************************************************** | ||
53 | #if defined (__USE_CMSIS) | ||
54 | extern void SystemInit(void); | ||
55 | #endif // (__USE_CMSIS) | ||
56 | |||
57 | //***************************************************************************** | ||
58 | // Forward declaration of the core exception handlers. | ||
59 | // When the application defines a handler (with the same name), this will | ||
60 | // automatically take precedence over these weak definitions. | ||
61 | // If your application is a C++ one, then any interrupt handlers defined | ||
62 | // in C++ files within in your main application will need to have C linkage | ||
63 | // rather than C++ linkage. To do this, make sure that you are using extern "C" | ||
64 | // { .... } around the interrupt handler within your main application code. | ||
65 | //***************************************************************************** | ||
66 | void ResetISR(void); | ||
67 | WEAK void NMI_Handler(void); | ||
68 | WEAK void HardFault_Handler(void); | ||
69 | WEAK void MemManage_Handler(void); | ||
70 | WEAK void BusFault_Handler(void); | ||
71 | WEAK void UsageFault_Handler(void); | ||
72 | WEAK void SVC_Handler(void); | ||
73 | WEAK void DebugMon_Handler(void); | ||
74 | WEAK void PendSV_Handler(void); | ||
75 | WEAK void SysTick_Handler(void); | ||
76 | WEAK void IntDefaultHandler(void); | ||
77 | |||
78 | //***************************************************************************** | ||
79 | // Forward declaration of the application IRQ handlers. When the application | ||
80 | // defines a handler (with the same name), this will automatically take | ||
81 | // precedence over weak definitions below | ||
82 | //***************************************************************************** | ||
83 | WEAK void WDT_BOD_IRQHandler(void); | ||
84 | WEAK void DMA0_IRQHandler(void); | ||
85 | WEAK void GINT0_IRQHandler(void); | ||
86 | WEAK void GINT1_IRQHandler(void); | ||
87 | WEAK void PIN_INT0_IRQHandler(void); | ||
88 | WEAK void PIN_INT1_IRQHandler(void); | ||
89 | WEAK void PIN_INT2_IRQHandler(void); | ||
90 | WEAK void PIN_INT3_IRQHandler(void); | ||
91 | WEAK void UTICK0_IRQHandler(void); | ||
92 | WEAK void MRT0_IRQHandler(void); | ||
93 | WEAK void CTIMER0_IRQHandler(void); | ||
94 | WEAK void CTIMER1_IRQHandler(void); | ||
95 | WEAK void SCT0_IRQHandler(void); | ||
96 | WEAK void CTIMER3_IRQHandler(void); | ||
97 | WEAK void FLEXCOMM0_IRQHandler(void); | ||
98 | WEAK void FLEXCOMM1_IRQHandler(void); | ||
99 | WEAK void FLEXCOMM2_IRQHandler(void); | ||
100 | WEAK void FLEXCOMM3_IRQHandler(void); | ||
101 | WEAK void FLEXCOMM4_IRQHandler(void); | ||
102 | WEAK void FLEXCOMM5_IRQHandler(void); | ||
103 | WEAK void FLEXCOMM6_IRQHandler(void); | ||
104 | WEAK void FLEXCOMM7_IRQHandler(void); | ||
105 | WEAK void ADC0_SEQA_IRQHandler(void); | ||
106 | WEAK void ADC0_SEQB_IRQHandler(void); | ||
107 | WEAK void ADC0_THCMP_IRQHandler(void); | ||
108 | WEAK void DMIC0_IRQHandler(void); | ||
109 | WEAK void HWVAD0_IRQHandler(void); | ||
110 | WEAK void USB0_NEEDCLK_IRQHandler(void); | ||
111 | WEAK void USB0_IRQHandler(void); | ||
112 | WEAK void RTC_IRQHandler(void); | ||
113 | WEAK void FLEXCOMM10_IRQHandler(void); | ||
114 | WEAK void Reserved47_IRQHandler(void); | ||
115 | WEAK void PIN_INT4_IRQHandler(void); | ||
116 | WEAK void PIN_INT5_IRQHandler(void); | ||
117 | WEAK void PIN_INT6_IRQHandler(void); | ||
118 | WEAK void PIN_INT7_IRQHandler(void); | ||
119 | WEAK void CTIMER2_IRQHandler(void); | ||
120 | WEAK void CTIMER4_IRQHandler(void); | ||
121 | WEAK void RIT_IRQHandler(void); | ||
122 | WEAK void SPIFI0_IRQHandler(void); | ||
123 | WEAK void FLEXCOMM8_IRQHandler(void); | ||
124 | WEAK void FLEXCOMM9_IRQHandler(void); | ||
125 | WEAK void SDIO_IRQHandler(void); | ||
126 | WEAK void CAN0_IRQ0_IRQHandler(void); | ||
127 | WEAK void CAN0_IRQ1_IRQHandler(void); | ||
128 | WEAK void CAN1_IRQ0_IRQHandler(void); | ||
129 | WEAK void CAN1_IRQ1_IRQHandler(void); | ||
130 | WEAK void USB1_IRQHandler(void); | ||
131 | WEAK void USB1_NEEDCLK_IRQHandler(void); | ||
132 | WEAK void ETHERNET_IRQHandler(void); | ||
133 | WEAK void ETHERNET_PMT_IRQHandler(void); | ||
134 | WEAK void ETHERNET_MACLP_IRQHandler(void); | ||
135 | WEAK void Reserved68_IRQHandler(void); | ||
136 | WEAK void LCD_IRQHandler(void); | ||
137 | WEAK void SHA_IRQHandler(void); | ||
138 | WEAK void SMARTCARD0_IRQHandler(void); | ||
139 | WEAK void SMARTCARD1_IRQHandler(void); | ||
140 | |||
141 | //***************************************************************************** | ||
142 | // Forward declaration of the driver IRQ handlers. These are aliased | ||
143 | // to the IntDefaultHandler, which is a 'forever' loop. When the driver | ||
144 | // defines a handler (with the same name), this will automatically take | ||
145 | // precedence over these weak definitions | ||
146 | //***************************************************************************** | ||
147 | void WDT_BOD_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
148 | void DMA0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
149 | void GINT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
150 | void GINT1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
151 | void PIN_INT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
152 | void PIN_INT1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
153 | void PIN_INT2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
154 | void PIN_INT3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
155 | void UTICK0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
156 | void MRT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
157 | void CTIMER0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
158 | void CTIMER1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
159 | void SCT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
160 | void CTIMER3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
161 | void FLEXCOMM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
162 | void FLEXCOMM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
163 | void FLEXCOMM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
164 | void FLEXCOMM3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
165 | void FLEXCOMM4_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
166 | void FLEXCOMM5_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
167 | void FLEXCOMM6_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
168 | void FLEXCOMM7_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
169 | void ADC0_SEQA_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
170 | void ADC0_SEQB_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
171 | void ADC0_THCMP_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
172 | void DMIC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
173 | void HWVAD0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
174 | void USB0_NEEDCLK_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
175 | void USB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
176 | void RTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
177 | void FLEXCOMM10_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
178 | void Reserved47_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
179 | void PIN_INT4_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
180 | void PIN_INT5_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
181 | void PIN_INT6_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
182 | void PIN_INT7_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
183 | void CTIMER2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
184 | void CTIMER4_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
185 | void RIT_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
186 | void SPIFI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
187 | void FLEXCOMM8_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
188 | void FLEXCOMM9_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
189 | void SDIO_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
190 | void CAN0_IRQ0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
191 | void CAN0_IRQ1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
192 | void CAN1_IRQ0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
193 | void CAN1_IRQ1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
194 | void USB1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
195 | void USB1_NEEDCLK_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
196 | void ETHERNET_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
197 | void ETHERNET_PMT_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
198 | void ETHERNET_MACLP_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
199 | void Reserved68_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
200 | void LCD_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
201 | void SHA_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
202 | void SMARTCARD0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
203 | void SMARTCARD1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
204 | |||
205 | //***************************************************************************** | ||
206 | // The entry point for the application. | ||
207 | // __main() is the entry point for Redlib based applications | ||
208 | // main() is the entry point for Newlib based applications | ||
209 | //***************************************************************************** | ||
210 | #if defined (__REDLIB__) | ||
211 | extern void __main(void); | ||
212 | #endif | ||
213 | extern int main(void); | ||
214 | |||
215 | //***************************************************************************** | ||
216 | // External declaration for the pointer to the stack top from the Linker Script | ||
217 | //***************************************************************************** | ||
218 | extern void _vStackTop(void); | ||
219 | extern void _image_size(void); | ||
220 | //***************************************************************************** | ||
221 | // External declaration for LPC MCU vector table checksum from Linker Script | ||
222 | //***************************************************************************** | ||
223 | WEAK extern void __valid_user_code_checksum(); | ||
224 | |||
225 | //***************************************************************************** | ||
226 | // External declaration for image type and load address from Linker Script | ||
227 | //***************************************************************************** | ||
228 | WEAK extern void __imghdr_loadaddress(); | ||
229 | WEAK extern void __imghdr_imagetype(); | ||
230 | |||
231 | //***************************************************************************** | ||
232 | #if defined (__cplusplus) | ||
233 | } // extern "C" | ||
234 | #endif | ||
235 | #ifndef IMG_BAUDRATE | ||
236 | #define IMG_BAUDRATE 0 | ||
237 | #endif | ||
238 | //***************************************************************************** | ||
239 | // The vector table. | ||
240 | // This relies on the linker script to place at correct location in memory. | ||
241 | //***************************************************************************** | ||
242 | |||
243 | |||
244 | |||
245 | extern void (* const g_pfnVectors[])(void); | ||
246 | extern void * __Vectors __attribute__ ((alias ("g_pfnVectors"))); | ||
247 | |||
248 | __attribute__ ((used, section(".isr_vector"))) | ||
249 | void (* const g_pfnVectors[])(void) = { | ||
250 | // Core Level - CM4 | ||
251 | &_vStackTop, // The initial stack pointer | ||
252 | ResetISR, // The reset handler | ||
253 | NMI_Handler, // The NMI handler | ||
254 | HardFault_Handler, // The hard fault handler | ||
255 | MemManage_Handler, // The MPU fault handler | ||
256 | BusFault_Handler, // The bus fault handler | ||
257 | UsageFault_Handler, // The usage fault handler | ||
258 | __valid_user_code_checksum, // LPC MCU checksum | ||
259 | 0, // ECRP | ||
260 | (void (*)(void))0xEDDC94BD, // Reserved | ||
261 | (void (*)(void))0x160, // Reserved | ||
262 | SVC_Handler, // SVCall handler | ||
263 | DebugMon_Handler, // Debug monitor handler | ||
264 | 0, // Reserved | ||
265 | PendSV_Handler, // The PendSV handler | ||
266 | SysTick_Handler, // The SysTick handler | ||
267 | |||
268 | // Chip Level - LPC54005 | ||
269 | WDT_BOD_IRQHandler, // 16: Windowed watchdog timer, Brownout detect | ||
270 | DMA0_IRQHandler, // 17: DMA controller | ||
271 | GINT0_IRQHandler, // 18: GPIO group 0 | ||
272 | GINT1_IRQHandler, // 19: GPIO group 1 | ||
273 | PIN_INT0_IRQHandler, // 20: Pin interrupt 0 or pattern match engine slice 0 | ||
274 | PIN_INT1_IRQHandler, // 21: Pin interrupt 1or pattern match engine slice 1 | ||
275 | PIN_INT2_IRQHandler, // 22: Pin interrupt 2 or pattern match engine slice 2 | ||
276 | PIN_INT3_IRQHandler, // 23: Pin interrupt 3 or pattern match engine slice 3 | ||
277 | UTICK0_IRQHandler, // 24: Micro-tick Timer | ||
278 | MRT0_IRQHandler, // 25: Multi-rate timer | ||
279 | CTIMER0_IRQHandler, // 26: Standard counter/timer CTIMER0 | ||
280 | CTIMER1_IRQHandler, // 27: Standard counter/timer CTIMER1 | ||
281 | SCT0_IRQHandler, // 28: SCTimer/PWM | ||
282 | CTIMER3_IRQHandler, // 29: Standard counter/timer CTIMER3 | ||
283 | FLEXCOMM0_IRQHandler, // 30: Flexcomm Interface 0 (USART, SPI, I2C, FLEXCOMM) | ||
284 | FLEXCOMM1_IRQHandler, // 31: Flexcomm Interface 1 (USART, SPI, I2C, FLEXCOMM) | ||
285 | FLEXCOMM2_IRQHandler, // 32: Flexcomm Interface 2 (USART, SPI, I2C, FLEXCOMM) | ||
286 | FLEXCOMM3_IRQHandler, // 33: Flexcomm Interface 3 (USART, SPI, I2C, FLEXCOMM) | ||
287 | FLEXCOMM4_IRQHandler, // 34: Flexcomm Interface 4 (USART, SPI, I2C, FLEXCOMM) | ||
288 | FLEXCOMM5_IRQHandler, // 35: Flexcomm Interface 5 (USART, SPI, I2C,, FLEXCOMM) | ||
289 | FLEXCOMM6_IRQHandler, // 36: Flexcomm Interface 6 (USART, SPI, I2C, I2S,, FLEXCOMM) | ||
290 | FLEXCOMM7_IRQHandler, // 37: Flexcomm Interface 7 (USART, SPI, I2C, I2S,, FLEXCOMM) | ||
291 | ADC0_SEQA_IRQHandler, // 38: ADC0 sequence A completion. | ||
292 | ADC0_SEQB_IRQHandler, // 39: ADC0 sequence B completion. | ||
293 | ADC0_THCMP_IRQHandler, // 40: ADC0 threshold compare and error. | ||
294 | DMIC0_IRQHandler, // 41: Digital microphone and DMIC subsystem | ||
295 | HWVAD0_IRQHandler, // 42: Hardware Voice Activity Detector | ||
296 | USB0_NEEDCLK_IRQHandler, // 43: USB Activity Wake-up Interrupt | ||
297 | USB0_IRQHandler, // 44: USB device | ||
298 | RTC_IRQHandler, // 45: RTC alarm and wake-up interrupts | ||
299 | FLEXCOMM10_IRQHandler, // 46: Flexcomm Interface 10 (SPI, FLEXCOMM) | ||
300 | Reserved47_IRQHandler, // 47: Reserved interrupt | ||
301 | PIN_INT4_IRQHandler, // 48: Pin interrupt 4 or pattern match engine slice 4 int | ||
302 | PIN_INT5_IRQHandler, // 49: Pin interrupt 5 or pattern match engine slice 5 int | ||
303 | PIN_INT6_IRQHandler, // 50: Pin interrupt 6 or pattern match engine slice 6 int | ||
304 | PIN_INT7_IRQHandler, // 51: Pin interrupt 7 or pattern match engine slice 7 int | ||
305 | CTIMER2_IRQHandler, // 52: Standard counter/timer CTIMER2 | ||
306 | CTIMER4_IRQHandler, // 53: Standard counter/timer CTIMER4 | ||
307 | RIT_IRQHandler, // 54: Repetitive Interrupt Timer | ||
308 | SPIFI0_IRQHandler, // 55: SPI flash interface | ||
309 | FLEXCOMM8_IRQHandler, // 56: Flexcomm Interface 8 (USART, SPI, I2C, FLEXCOMM) | ||
310 | FLEXCOMM9_IRQHandler, // 57: Flexcomm Interface 9 (USART, SPI, I2C, FLEXCOMM) | ||
311 | SDIO_IRQHandler, // 58: SD/MMC | ||
312 | CAN0_IRQ0_IRQHandler, // 59: CAN0 interrupt0 | ||
313 | CAN0_IRQ1_IRQHandler, // 60: CAN0 interrupt1 | ||
314 | CAN1_IRQ0_IRQHandler, // 61: CAN1 interrupt0 | ||
315 | CAN1_IRQ1_IRQHandler, // 62: CAN1 interrupt1 | ||
316 | USB1_IRQHandler, // 63: USB1 interrupt | ||
317 | USB1_NEEDCLK_IRQHandler, // 64: USB1 activity | ||
318 | ETHERNET_IRQHandler, // 65: Ethernet | ||
319 | ETHERNET_PMT_IRQHandler, // 66: Ethernet power management interrupt | ||
320 | ETHERNET_MACLP_IRQHandler, // 67: Ethernet MAC interrupt | ||
321 | Reserved68_IRQHandler, // 68: Reserved interrupt | ||
322 | LCD_IRQHandler, // 69: LCD interrupt | ||
323 | SHA_IRQHandler, // 70: SHA interrupt | ||
324 | SMARTCARD0_IRQHandler, // 71: Smart card 0 interrupt | ||
325 | SMARTCARD1_IRQHandler, // 72: Smart card 1 interrupt | ||
326 | |||
327 | 0, // Reserved | ||
328 | 0, // Reserved | ||
329 | 0, // Reserved | ||
330 | 0, // Reserved | ||
331 | 0, // Reserved | ||
332 | 0, // Reserved | ||
333 | 0, // Reserved | ||
334 | 0, // Reserved | ||
335 | 0, // Reserved | ||
336 | 0, // Reserved | ||
337 | 0, // Reserved | ||
338 | 0, // Reserved | ||
339 | 0, // Reserved | ||
340 | 0, // Reserved | ||
341 | 0, // Reserved | ||
342 | (void (*)(void))0xFEEDA5A5, // Header Marker | ||
343 | |||
344 | #if defined (ADD_CRC) | ||
345 | (__imghdr_imagetype - 1), // (0x04) Image Type | ||
346 | __imghdr_loadaddress, // (0x08) Load_address | ||
347 | #else | ||
348 | __imghdr_imagetype, // (0x04) Image Type | ||
349 | __imghdr_loadaddress, // (0x08) Load_address | ||
350 | #endif | ||
351 | (void (*)(void))(((unsigned)_image_size) - 4), // (0x0C) load_length, exclude 4 bytes CRC field. | ||
352 | 0, // (0x10) CRC value (only applicable to NON Non-secure images). | ||
353 | 0, // (0x14) Version (only applicable to DUAL_ENH image type. | ||
354 | 0, // (0x18) EMC static memory configuration settings, required for EMC boot | ||
355 | (void (*)(void))IMG_BAUDRATE, // (0x1C) image baudrate | ||
356 | 0, // (0x20) reserved | ||
357 | (void (*)(void))0xEDDC94BD, // (0x24) Image_marker | ||
358 | 0, // (0x28) SBZ | ||
359 | 0, // (0x2C) reserved | ||
360 | #ifdef W25Q128JVFM | ||
361 | /* SPIFI Descriptor - W25Q128JVFM */ | ||
362 | (void (*)(void))0x00000000, // 0xFFFFFFFF to default 1-bit SPI mode ï¼›DevStrAdr | ||
363 | (void (*)(void))0x001870EF, // mfgId + extCount | ||
364 | (void (*)(void))0x00000000, // extid 0-3 | ||
365 | (void (*)(void))0x00000000, // extid 4-7 | ||
366 | (void (*)(void))0x0001001D, // caps | ||
367 | (void (*)(void))0x00000100, // Blks + RESV1 | ||
368 | (void (*)(void))0x00010000, // blkSize | ||
369 | (void (*)(void))0x00000000, // subBlks + subBlkSize | ||
370 | (void (*)(void))0x00000100, // pageSize + RESV2 | ||
371 | (void (*)(void))0x00003F00, // maxReadSize | ||
372 | (void (*)(void))0x68506850, // maxClkRate,maxReadRate,maxHSReadRate,maxProgramRate | ||
373 | (void (*)(void))0x04030050, // maxHSProgramRate,initDeInitFxId,clearStatusFxId,getStatusFxId, | ||
374 | (void (*)(void))0x14110D09, // setStatusFxId,setOptionsFxId,getReadCmdFxId,getWriteCmdFxId | ||
375 | #endif | ||
376 | |||
377 | #ifdef MXL12835F | ||
378 | /* SPI Descriptor - MXL12835F */ | ||
379 | (void (*)(void))0x00000000, // 0xFFFFFFFF to default 1-bit SPI mode ;DevStrAdr | ||
380 | (void (*)(void))0x001820C2, // mfgId + extCount | ||
381 | (void (*)(void))0x00000000, // extid 0-3 | ||
382 | (void (*)(void))0x00000000, // extid 4-7 | ||
383 | (void (*)(void))0x0001001D, // caps | ||
384 | (void (*)(void))0x00000100, // Blks + RESV1 | ||
385 | (void (*)(void))0x00010000, // blkSize | ||
386 | (void (*)(void))0x00000000, // subBlks + subBlkSize | ||
387 | (void (*)(void))0x00000100, // pageSize + RESV2 | ||
388 | (void (*)(void))0x00003F00, // maxReadSize | ||
389 | (void (*)(void))0x68506850, // maxClkRate,maxReadRate,maxHSReadRate,maxProgramRate | ||
390 | (void (*)(void))0x06030050, // maxHSProgramRate,initDeInitFxId,clearStatusFxId,getStatusFxId | ||
391 | (void (*)(void))0x14110F0B, // setStatusFxId,setOptionsFxId,getReadCmdFxId,getWriteCmdFxId | ||
392 | #endif | ||
393 | |||
394 | |||
395 | }; /* End of g_pfnVectors */ | ||
396 | |||
397 | //***************************************************************************** | ||
398 | // Functions to carry out the initialization of RW and BSS data sections. These | ||
399 | // are written as separate functions rather than being inlined within the | ||
400 | // ResetISR() function in order to cope with MCUs with multiple banks of | ||
401 | // memory. | ||
402 | //***************************************************************************** | ||
403 | __attribute__ ((section(".after_vectors.init_data"))) | ||
404 | void data_init(unsigned int romstart, unsigned int start, unsigned int len) { | ||
405 | unsigned int *pulDest = (unsigned int*) start; | ||
406 | unsigned int *pulSrc = (unsigned int*) romstart; | ||
407 | unsigned int loop; | ||
408 | for (loop = 0; loop < len; loop = loop + 4) | ||
409 | *pulDest++ = *pulSrc++; | ||
410 | } | ||
411 | |||
412 | __attribute__ ((section(".after_vectors.init_bss"))) | ||
413 | void bss_init(unsigned int start, unsigned int len) { | ||
414 | unsigned int *pulDest = (unsigned int*) start; | ||
415 | unsigned int loop; | ||
416 | for (loop = 0; loop < len; loop = loop + 4) | ||
417 | *pulDest++ = 0; | ||
418 | } | ||
419 | |||
420 | //***************************************************************************** | ||
421 | // The following symbols are constructs generated by the linker, indicating | ||
422 | // the location of various points in the "Global Section Table". This table is | ||
423 | // created by the linker via the Code Red managed linker script mechanism. It | ||
424 | // contains the load address, execution address and length of each RW data | ||
425 | // section and the execution and length of each BSS (zero initialized) section. | ||
426 | //***************************************************************************** | ||
427 | extern unsigned int __data_section_table; | ||
428 | extern unsigned int __data_section_table_end; | ||
429 | extern unsigned int __bss_section_table; | ||
430 | extern unsigned int __bss_section_table_end; | ||
431 | |||
432 | //***************************************************************************** | ||
433 | // Reset entry point for your code. | ||
434 | // Sets up a simple runtime environment and initializes the C/C++ | ||
435 | // library. | ||
436 | //***************************************************************************** | ||
437 | __attribute__ ((section(".after_vectors.reset"))) | ||
438 | void ResetISR(void) { | ||
439 | |||
440 | // Disable interrupts | ||
441 | __asm volatile ("cpsid i"); | ||
442 | |||
443 | |||
444 | // Enable SRAM clock used by Stack | ||
445 | __asm volatile ("LDR R0, =0x40000220\n\t" | ||
446 | "MOV R1, #56\n\t" | ||
447 | "STR R1, [R0]"); | ||
448 | |||
449 | #if defined (__USE_CMSIS) | ||
450 | // If __USE_CMSIS defined, then call CMSIS SystemInit code | ||
451 | SystemInit(); | ||
452 | |||
453 | #endif // (__USE_CMSIS) | ||
454 | |||
455 | // | ||
456 | // Copy the data sections from flash to SRAM. | ||
457 | // | ||
458 | unsigned int LoadAddr, ExeAddr, SectionLen; | ||
459 | unsigned int *SectionTableAddr; | ||
460 | |||
461 | // Load base address of Global Section Table | ||
462 | SectionTableAddr = &__data_section_table; | ||
463 | |||
464 | // Copy the data sections from flash to SRAM. | ||
465 | while (SectionTableAddr < &__data_section_table_end) { | ||
466 | LoadAddr = *SectionTableAddr++; | ||
467 | ExeAddr = *SectionTableAddr++; | ||
468 | SectionLen = *SectionTableAddr++; | ||
469 | data_init(LoadAddr, ExeAddr, SectionLen); | ||
470 | } | ||
471 | |||
472 | // At this point, SectionTableAddr = &__bss_section_table; | ||
473 | // Zero fill the bss segment | ||
474 | while (SectionTableAddr < &__bss_section_table_end) { | ||
475 | ExeAddr = *SectionTableAddr++; | ||
476 | SectionLen = *SectionTableAddr++; | ||
477 | bss_init(ExeAddr, SectionLen); | ||
478 | } | ||
479 | |||
480 | #if !defined (__USE_CMSIS) | ||
481 | // Assume that if __USE_CMSIS defined, then CMSIS SystemInit code | ||
482 | // will enable the FPU | ||
483 | #if defined (__VFP_FP__) && !defined (__SOFTFP__) | ||
484 | // | ||
485 | // Code to enable the Cortex-M4 FPU only included | ||
486 | // if appropriate build options have been selected. | ||
487 | // Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C) | ||
488 | // | ||
489 | // Read CPACR (located at address 0xE000ED88) | ||
490 | // Set bits 20-23 to enable CP10 and CP11 coprocessors | ||
491 | // Write back the modified value to the CPACR | ||
492 | asm volatile ("LDR.W R0, =0xE000ED88\n\t" | ||
493 | "LDR R1, [R0]\n\t" | ||
494 | "ORR R1, R1, #(0xF << 20)\n\t" | ||
495 | "STR R1, [R0]"); | ||
496 | #endif // (__VFP_FP__) && !(__SOFTFP__) | ||
497 | #endif // (__USE_CMSIS) | ||
498 | |||
499 | |||
500 | #if !defined (__USE_CMSIS) | ||
501 | // Assume that if __USE_CMSIS defined, then CMSIS SystemInit code | ||
502 | // will setup the VTOR register | ||
503 | |||
504 | // Check to see if we are running the code from a non-zero | ||
505 | // address (eg RAM, external flash), in which case we need | ||
506 | // to modify the VTOR register to tell the CPU that the | ||
507 | // vector table is located at a non-0x0 address. | ||
508 | unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08; | ||
509 | if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) { | ||
510 | *pSCB_VTOR = (unsigned int)g_pfnVectors; | ||
511 | } | ||
512 | #endif // (__USE_CMSIS) | ||
513 | #if defined (__cplusplus) | ||
514 | // | ||
515 | // Call C++ library initialisation | ||
516 | // | ||
517 | __libc_init_array(); | ||
518 | #endif | ||
519 | |||
520 | // Reenable interrupts | ||
521 | __asm volatile ("cpsie i"); | ||
522 | |||
523 | #if defined (__REDLIB__) | ||
524 | // Call the Redlib library, which in turn calls main() | ||
525 | __main(); | ||
526 | #else | ||
527 | main(); | ||
528 | #endif | ||
529 | |||
530 | // | ||
531 | // main() shouldn't return, but if it does, we'll just enter an infinite loop | ||
532 | // | ||
533 | while (1) { | ||
534 | ; | ||
535 | } | ||
536 | } | ||
537 | |||
538 | //***************************************************************************** | ||
539 | // Default core exception handlers. Override the ones here by defining your own | ||
540 | // handler routines in your application code. | ||
541 | //***************************************************************************** | ||
542 | WEAK_AV void NMI_Handler(void) | ||
543 | { while(1) {} | ||
544 | } | ||
545 | |||
546 | WEAK_AV void HardFault_Handler(void) | ||
547 | { while(1) {} | ||
548 | } | ||
549 | |||
550 | WEAK_AV void MemManage_Handler(void) | ||
551 | { while(1) {} | ||
552 | } | ||
553 | |||
554 | WEAK_AV void BusFault_Handler(void) | ||
555 | { while(1) {} | ||
556 | } | ||
557 | |||
558 | WEAK_AV void UsageFault_Handler(void) | ||
559 | { while(1) {} | ||
560 | } | ||
561 | |||
562 | WEAK_AV void SVC_Handler(void) | ||
563 | { while(1) {} | ||
564 | } | ||
565 | |||
566 | WEAK_AV void DebugMon_Handler(void) | ||
567 | { while(1) {} | ||
568 | } | ||
569 | |||
570 | WEAK_AV void PendSV_Handler(void) | ||
571 | { while(1) {} | ||
572 | } | ||
573 | |||
574 | WEAK_AV void SysTick_Handler(void) | ||
575 | { while(1) {} | ||
576 | } | ||
577 | |||
578 | //***************************************************************************** | ||
579 | // Processor ends up here if an unexpected interrupt occurs or a specific | ||
580 | // handler is not present in the application code. | ||
581 | //***************************************************************************** | ||
582 | WEAK_AV void IntDefaultHandler(void) | ||
583 | { while(1) {} | ||
584 | } | ||
585 | |||
586 | //***************************************************************************** | ||
587 | // Default application exception handlers. Override the ones here by defining | ||
588 | // your own handler routines in your application code. These routines call | ||
589 | // driver exception handlers or IntDefaultHandler() if no driver exception | ||
590 | // handler is included. | ||
591 | //***************************************************************************** | ||
592 | WEAK void WDT_BOD_IRQHandler(void) | ||
593 | { WDT_BOD_DriverIRQHandler(); | ||
594 | } | ||
595 | |||
596 | WEAK void DMA0_IRQHandler(void) | ||
597 | { DMA0_DriverIRQHandler(); | ||
598 | } | ||
599 | |||
600 | WEAK void GINT0_IRQHandler(void) | ||
601 | { GINT0_DriverIRQHandler(); | ||
602 | } | ||
603 | |||
604 | WEAK void GINT1_IRQHandler(void) | ||
605 | { GINT1_DriverIRQHandler(); | ||
606 | } | ||
607 | |||
608 | WEAK void PIN_INT0_IRQHandler(void) | ||
609 | { PIN_INT0_DriverIRQHandler(); | ||
610 | } | ||
611 | |||
612 | WEAK void PIN_INT1_IRQHandler(void) | ||
613 | { PIN_INT1_DriverIRQHandler(); | ||
614 | } | ||
615 | |||
616 | WEAK void PIN_INT2_IRQHandler(void) | ||
617 | { PIN_INT2_DriverIRQHandler(); | ||
618 | } | ||
619 | |||
620 | WEAK void PIN_INT3_IRQHandler(void) | ||
621 | { PIN_INT3_DriverIRQHandler(); | ||
622 | } | ||
623 | |||
624 | WEAK void UTICK0_IRQHandler(void) | ||
625 | { UTICK0_DriverIRQHandler(); | ||
626 | } | ||
627 | |||
628 | WEAK void MRT0_IRQHandler(void) | ||
629 | { MRT0_DriverIRQHandler(); | ||
630 | } | ||
631 | |||
632 | WEAK void CTIMER0_IRQHandler(void) | ||
633 | { CTIMER0_DriverIRQHandler(); | ||
634 | } | ||
635 | |||
636 | WEAK void CTIMER1_IRQHandler(void) | ||
637 | { CTIMER1_DriverIRQHandler(); | ||
638 | } | ||
639 | |||
640 | WEAK void SCT0_IRQHandler(void) | ||
641 | { SCT0_DriverIRQHandler(); | ||
642 | } | ||
643 | |||
644 | WEAK void CTIMER3_IRQHandler(void) | ||
645 | { CTIMER3_DriverIRQHandler(); | ||
646 | } | ||
647 | |||
648 | WEAK void FLEXCOMM0_IRQHandler(void) | ||
649 | { FLEXCOMM0_DriverIRQHandler(); | ||
650 | } | ||
651 | |||
652 | WEAK void FLEXCOMM1_IRQHandler(void) | ||
653 | { FLEXCOMM1_DriverIRQHandler(); | ||
654 | } | ||
655 | |||
656 | WEAK void FLEXCOMM2_IRQHandler(void) | ||
657 | { FLEXCOMM2_DriverIRQHandler(); | ||
658 | } | ||
659 | |||
660 | WEAK void FLEXCOMM3_IRQHandler(void) | ||
661 | { FLEXCOMM3_DriverIRQHandler(); | ||
662 | } | ||
663 | |||
664 | WEAK void FLEXCOMM4_IRQHandler(void) | ||
665 | { FLEXCOMM4_DriverIRQHandler(); | ||
666 | } | ||
667 | |||
668 | WEAK void FLEXCOMM5_IRQHandler(void) | ||
669 | { FLEXCOMM5_DriverIRQHandler(); | ||
670 | } | ||
671 | |||
672 | WEAK void FLEXCOMM6_IRQHandler(void) | ||
673 | { FLEXCOMM6_DriverIRQHandler(); | ||
674 | } | ||
675 | |||
676 | WEAK void FLEXCOMM7_IRQHandler(void) | ||
677 | { FLEXCOMM7_DriverIRQHandler(); | ||
678 | } | ||
679 | |||
680 | WEAK void ADC0_SEQA_IRQHandler(void) | ||
681 | { ADC0_SEQA_DriverIRQHandler(); | ||
682 | } | ||
683 | |||
684 | WEAK void ADC0_SEQB_IRQHandler(void) | ||
685 | { ADC0_SEQB_DriverIRQHandler(); | ||
686 | } | ||
687 | |||
688 | WEAK void ADC0_THCMP_IRQHandler(void) | ||
689 | { ADC0_THCMP_DriverIRQHandler(); | ||
690 | } | ||
691 | |||
692 | WEAK void DMIC0_IRQHandler(void) | ||
693 | { DMIC0_DriverIRQHandler(); | ||
694 | } | ||
695 | |||
696 | WEAK void HWVAD0_IRQHandler(void) | ||
697 | { HWVAD0_DriverIRQHandler(); | ||
698 | } | ||
699 | |||
700 | WEAK void USB0_NEEDCLK_IRQHandler(void) | ||
701 | { USB0_NEEDCLK_DriverIRQHandler(); | ||
702 | } | ||
703 | |||
704 | WEAK void USB0_IRQHandler(void) | ||
705 | { USB0_DriverIRQHandler(); | ||
706 | } | ||
707 | |||
708 | WEAK void RTC_IRQHandler(void) | ||
709 | { RTC_DriverIRQHandler(); | ||
710 | } | ||
711 | |||
712 | WEAK void FLEXCOMM10_IRQHandler(void) | ||
713 | { FLEXCOMM10_DriverIRQHandler(); | ||
714 | } | ||
715 | |||
716 | WEAK void Reserved47_IRQHandler(void) | ||
717 | { Reserved47_DriverIRQHandler(); | ||
718 | } | ||
719 | |||
720 | WEAK void PIN_INT4_IRQHandler(void) | ||
721 | { PIN_INT4_DriverIRQHandler(); | ||
722 | } | ||
723 | |||
724 | WEAK void PIN_INT5_IRQHandler(void) | ||
725 | { PIN_INT5_DriverIRQHandler(); | ||
726 | } | ||
727 | |||
728 | WEAK void PIN_INT6_IRQHandler(void) | ||
729 | { PIN_INT6_DriverIRQHandler(); | ||
730 | } | ||
731 | |||
732 | WEAK void PIN_INT7_IRQHandler(void) | ||
733 | { PIN_INT7_DriverIRQHandler(); | ||
734 | } | ||
735 | |||
736 | WEAK void CTIMER2_IRQHandler(void) | ||
737 | { CTIMER2_DriverIRQHandler(); | ||
738 | } | ||
739 | |||
740 | WEAK void CTIMER4_IRQHandler(void) | ||
741 | { CTIMER4_DriverIRQHandler(); | ||
742 | } | ||
743 | |||
744 | WEAK void RIT_IRQHandler(void) | ||
745 | { RIT_DriverIRQHandler(); | ||
746 | } | ||
747 | |||
748 | WEAK void SPIFI0_IRQHandler(void) | ||
749 | { SPIFI0_DriverIRQHandler(); | ||
750 | } | ||
751 | |||
752 | WEAK void FLEXCOMM8_IRQHandler(void) | ||
753 | { FLEXCOMM8_DriverIRQHandler(); | ||
754 | } | ||
755 | |||
756 | WEAK void FLEXCOMM9_IRQHandler(void) | ||
757 | { FLEXCOMM9_DriverIRQHandler(); | ||
758 | } | ||
759 | |||
760 | WEAK void SDIO_IRQHandler(void) | ||
761 | { SDIO_DriverIRQHandler(); | ||
762 | } | ||
763 | |||
764 | WEAK void CAN0_IRQ0_IRQHandler(void) | ||
765 | { CAN0_IRQ0_DriverIRQHandler(); | ||
766 | } | ||
767 | |||
768 | WEAK void CAN0_IRQ1_IRQHandler(void) | ||
769 | { CAN0_IRQ1_DriverIRQHandler(); | ||
770 | } | ||
771 | |||
772 | WEAK void CAN1_IRQ0_IRQHandler(void) | ||
773 | { CAN1_IRQ0_DriverIRQHandler(); | ||
774 | } | ||
775 | |||
776 | WEAK void CAN1_IRQ1_IRQHandler(void) | ||
777 | { CAN1_IRQ1_DriverIRQHandler(); | ||
778 | } | ||
779 | |||
780 | WEAK void USB1_IRQHandler(void) | ||
781 | { USB1_DriverIRQHandler(); | ||
782 | } | ||
783 | |||
784 | WEAK void USB1_NEEDCLK_IRQHandler(void) | ||
785 | { USB1_NEEDCLK_DriverIRQHandler(); | ||
786 | } | ||
787 | |||
788 | WEAK void ETHERNET_IRQHandler(void) | ||
789 | { ETHERNET_DriverIRQHandler(); | ||
790 | } | ||
791 | |||
792 | WEAK void ETHERNET_PMT_IRQHandler(void) | ||
793 | { ETHERNET_PMT_DriverIRQHandler(); | ||
794 | } | ||
795 | |||
796 | WEAK void ETHERNET_MACLP_IRQHandler(void) | ||
797 | { ETHERNET_MACLP_DriverIRQHandler(); | ||
798 | } | ||
799 | |||
800 | WEAK void Reserved68_IRQHandler(void) | ||
801 | { Reserved68_DriverIRQHandler(); | ||
802 | } | ||
803 | |||
804 | WEAK void LCD_IRQHandler(void) | ||
805 | { LCD_DriverIRQHandler(); | ||
806 | } | ||
807 | |||
808 | WEAK void SHA_IRQHandler(void) | ||
809 | { SHA_DriverIRQHandler(); | ||
810 | } | ||
811 | |||
812 | WEAK void SMARTCARD0_IRQHandler(void) | ||
813 | { SMARTCARD0_DriverIRQHandler(); | ||
814 | } | ||
815 | |||
816 | WEAK void SMARTCARD1_IRQHandler(void) | ||
817 | { SMARTCARD1_DriverIRQHandler(); | ||
818 | } | ||
819 | |||
820 | //***************************************************************************** | ||
821 | |||
822 | #if defined (DEBUG) | ||
823 | #pragma GCC pop_options | ||
824 | #endif // (DEBUG) | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/startup_lpc54005.cpp b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/startup_lpc54005.cpp new file mode 100644 index 000000000..39943aa41 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/mcuxpresso/startup_lpc54005.cpp | |||
@@ -0,0 +1,824 @@ | |||
1 | //***************************************************************************** | ||
2 | // LPC54005 startup code for use with MCUXpresso IDE | ||
3 | // | ||
4 | // Version : 160420 | ||
5 | //***************************************************************************** | ||
6 | // | ||
7 | // Copyright 2016-2020 NXP | ||
8 | // All rights reserved. | ||
9 | // | ||
10 | // SPDX-License-Identifier: BSD-3-Clause | ||
11 | //***************************************************************************** | ||
12 | |||
13 | #if defined (DEBUG) | ||
14 | #pragma GCC push_options | ||
15 | #pragma GCC optimize ("Og") | ||
16 | #endif // (DEBUG) | ||
17 | |||
18 | #if defined (__cplusplus) | ||
19 | #ifdef __REDLIB__ | ||
20 | #error Redlib does not support C++ | ||
21 | #else | ||
22 | //***************************************************************************** | ||
23 | // | ||
24 | // The entry point for the C++ library startup | ||
25 | // | ||
26 | //***************************************************************************** | ||
27 | extern "C" { | ||
28 | extern void __libc_init_array(void); | ||
29 | } | ||
30 | #endif | ||
31 | #endif | ||
32 | |||
33 | #define WEAK __attribute__ ((weak)) | ||
34 | #define WEAK_AV __attribute__ ((weak, section(".after_vectors"))) | ||
35 | #define ALIAS(f) __attribute__ ((weak, alias (#f))) | ||
36 | |||
37 | //***************************************************************************** | ||
38 | #if defined (__cplusplus) | ||
39 | extern "C" { | ||
40 | #endif | ||
41 | |||
42 | //***************************************************************************** | ||
43 | // Variable to store CRP value in. Will be placed automatically | ||
44 | // by the linker when "Enable Code Read Protect" selected. | ||
45 | // See crp.h header for more information | ||
46 | //***************************************************************************** | ||
47 | #include <NXP/crp.h> | ||
48 | __CRP const unsigned int CRP_WORD = CRP_NO_CRP ; | ||
49 | |||
50 | //***************************************************************************** | ||
51 | // Declaration of external SystemInit function | ||
52 | //***************************************************************************** | ||
53 | #if defined (__USE_CMSIS) | ||
54 | extern void SystemInit(void); | ||
55 | #endif // (__USE_CMSIS) | ||
56 | |||
57 | //***************************************************************************** | ||
58 | // Forward declaration of the core exception handlers. | ||
59 | // When the application defines a handler (with the same name), this will | ||
60 | // automatically take precedence over these weak definitions. | ||
61 | // If your application is a C++ one, then any interrupt handlers defined | ||
62 | // in C++ files within in your main application will need to have C linkage | ||
63 | // rather than C++ linkage. To do this, make sure that you are using extern "C" | ||
64 | // { .... } around the interrupt handler within your main application code. | ||
65 | //***************************************************************************** | ||
66 | void ResetISR(void); | ||
67 | WEAK void NMI_Handler(void); | ||
68 | WEAK void HardFault_Handler(void); | ||
69 | WEAK void MemManage_Handler(void); | ||
70 | WEAK void BusFault_Handler(void); | ||
71 | WEAK void UsageFault_Handler(void); | ||
72 | WEAK void SVC_Handler(void); | ||
73 | WEAK void DebugMon_Handler(void); | ||
74 | WEAK void PendSV_Handler(void); | ||
75 | WEAK void SysTick_Handler(void); | ||
76 | WEAK void IntDefaultHandler(void); | ||
77 | |||
78 | //***************************************************************************** | ||
79 | // Forward declaration of the application IRQ handlers. When the application | ||
80 | // defines a handler (with the same name), this will automatically take | ||
81 | // precedence over weak definitions below | ||
82 | //***************************************************************************** | ||
83 | WEAK void WDT_BOD_IRQHandler(void); | ||
84 | WEAK void DMA0_IRQHandler(void); | ||
85 | WEAK void GINT0_IRQHandler(void); | ||
86 | WEAK void GINT1_IRQHandler(void); | ||
87 | WEAK void PIN_INT0_IRQHandler(void); | ||
88 | WEAK void PIN_INT1_IRQHandler(void); | ||
89 | WEAK void PIN_INT2_IRQHandler(void); | ||
90 | WEAK void PIN_INT3_IRQHandler(void); | ||
91 | WEAK void UTICK0_IRQHandler(void); | ||
92 | WEAK void MRT0_IRQHandler(void); | ||
93 | WEAK void CTIMER0_IRQHandler(void); | ||
94 | WEAK void CTIMER1_IRQHandler(void); | ||
95 | WEAK void SCT0_IRQHandler(void); | ||
96 | WEAK void CTIMER3_IRQHandler(void); | ||
97 | WEAK void FLEXCOMM0_IRQHandler(void); | ||
98 | WEAK void FLEXCOMM1_IRQHandler(void); | ||
99 | WEAK void FLEXCOMM2_IRQHandler(void); | ||
100 | WEAK void FLEXCOMM3_IRQHandler(void); | ||
101 | WEAK void FLEXCOMM4_IRQHandler(void); | ||
102 | WEAK void FLEXCOMM5_IRQHandler(void); | ||
103 | WEAK void FLEXCOMM6_IRQHandler(void); | ||
104 | WEAK void FLEXCOMM7_IRQHandler(void); | ||
105 | WEAK void ADC0_SEQA_IRQHandler(void); | ||
106 | WEAK void ADC0_SEQB_IRQHandler(void); | ||
107 | WEAK void ADC0_THCMP_IRQHandler(void); | ||
108 | WEAK void DMIC0_IRQHandler(void); | ||
109 | WEAK void HWVAD0_IRQHandler(void); | ||
110 | WEAK void USB0_NEEDCLK_IRQHandler(void); | ||
111 | WEAK void USB0_IRQHandler(void); | ||
112 | WEAK void RTC_IRQHandler(void); | ||
113 | WEAK void FLEXCOMM10_IRQHandler(void); | ||
114 | WEAK void Reserved47_IRQHandler(void); | ||
115 | WEAK void PIN_INT4_IRQHandler(void); | ||
116 | WEAK void PIN_INT5_IRQHandler(void); | ||
117 | WEAK void PIN_INT6_IRQHandler(void); | ||
118 | WEAK void PIN_INT7_IRQHandler(void); | ||
119 | WEAK void CTIMER2_IRQHandler(void); | ||
120 | WEAK void CTIMER4_IRQHandler(void); | ||
121 | WEAK void RIT_IRQHandler(void); | ||
122 | WEAK void SPIFI0_IRQHandler(void); | ||
123 | WEAK void FLEXCOMM8_IRQHandler(void); | ||
124 | WEAK void FLEXCOMM9_IRQHandler(void); | ||
125 | WEAK void SDIO_IRQHandler(void); | ||
126 | WEAK void CAN0_IRQ0_IRQHandler(void); | ||
127 | WEAK void CAN0_IRQ1_IRQHandler(void); | ||
128 | WEAK void CAN1_IRQ0_IRQHandler(void); | ||
129 | WEAK void CAN1_IRQ1_IRQHandler(void); | ||
130 | WEAK void USB1_IRQHandler(void); | ||
131 | WEAK void USB1_NEEDCLK_IRQHandler(void); | ||
132 | WEAK void ETHERNET_IRQHandler(void); | ||
133 | WEAK void ETHERNET_PMT_IRQHandler(void); | ||
134 | WEAK void ETHERNET_MACLP_IRQHandler(void); | ||
135 | WEAK void Reserved68_IRQHandler(void); | ||
136 | WEAK void LCD_IRQHandler(void); | ||
137 | WEAK void SHA_IRQHandler(void); | ||
138 | WEAK void SMARTCARD0_IRQHandler(void); | ||
139 | WEAK void SMARTCARD1_IRQHandler(void); | ||
140 | |||
141 | //***************************************************************************** | ||
142 | // Forward declaration of the driver IRQ handlers. These are aliased | ||
143 | // to the IntDefaultHandler, which is a 'forever' loop. When the driver | ||
144 | // defines a handler (with the same name), this will automatically take | ||
145 | // precedence over these weak definitions | ||
146 | //***************************************************************************** | ||
147 | void WDT_BOD_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
148 | void DMA0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
149 | void GINT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
150 | void GINT1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
151 | void PIN_INT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
152 | void PIN_INT1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
153 | void PIN_INT2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
154 | void PIN_INT3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
155 | void UTICK0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
156 | void MRT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
157 | void CTIMER0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
158 | void CTIMER1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
159 | void SCT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
160 | void CTIMER3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
161 | void FLEXCOMM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
162 | void FLEXCOMM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
163 | void FLEXCOMM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
164 | void FLEXCOMM3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
165 | void FLEXCOMM4_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
166 | void FLEXCOMM5_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
167 | void FLEXCOMM6_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
168 | void FLEXCOMM7_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
169 | void ADC0_SEQA_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
170 | void ADC0_SEQB_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
171 | void ADC0_THCMP_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
172 | void DMIC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
173 | void HWVAD0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
174 | void USB0_NEEDCLK_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
175 | void USB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
176 | void RTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
177 | void FLEXCOMM10_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
178 | void Reserved47_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
179 | void PIN_INT4_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
180 | void PIN_INT5_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
181 | void PIN_INT6_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
182 | void PIN_INT7_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
183 | void CTIMER2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
184 | void CTIMER4_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
185 | void RIT_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
186 | void SPIFI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
187 | void FLEXCOMM8_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
188 | void FLEXCOMM9_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
189 | void SDIO_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
190 | void CAN0_IRQ0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
191 | void CAN0_IRQ1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
192 | void CAN1_IRQ0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
193 | void CAN1_IRQ1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
194 | void USB1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
195 | void USB1_NEEDCLK_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
196 | void ETHERNET_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
197 | void ETHERNET_PMT_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
198 | void ETHERNET_MACLP_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
199 | void Reserved68_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
200 | void LCD_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
201 | void SHA_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
202 | void SMARTCARD0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
203 | void SMARTCARD1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
204 | |||
205 | //***************************************************************************** | ||
206 | // The entry point for the application. | ||
207 | // __main() is the entry point for Redlib based applications | ||
208 | // main() is the entry point for Newlib based applications | ||
209 | //***************************************************************************** | ||
210 | #if defined (__REDLIB__) | ||
211 | extern void __main(void); | ||
212 | #endif | ||
213 | extern int main(void); | ||
214 | |||
215 | //***************************************************************************** | ||
216 | // External declaration for the pointer to the stack top from the Linker Script | ||
217 | //***************************************************************************** | ||
218 | extern void _vStackTop(void); | ||
219 | extern void _image_size(void); | ||
220 | //***************************************************************************** | ||
221 | // External declaration for LPC MCU vector table checksum from Linker Script | ||
222 | //***************************************************************************** | ||
223 | WEAK extern void __valid_user_code_checksum(); | ||
224 | |||
225 | //***************************************************************************** | ||
226 | // External declaration for image type and load address from Linker Script | ||
227 | //***************************************************************************** | ||
228 | WEAK extern void __imghdr_loadaddress(); | ||
229 | WEAK extern void __imghdr_imagetype(); | ||
230 | |||
231 | //***************************************************************************** | ||
232 | #if defined (__cplusplus) | ||
233 | } // extern "C" | ||
234 | #endif | ||
235 | #ifndef IMG_BAUDRATE | ||
236 | #define IMG_BAUDRATE 0 | ||
237 | #endif | ||
238 | //***************************************************************************** | ||
239 | // The vector table. | ||
240 | // This relies on the linker script to place at correct location in memory. | ||
241 | //***************************************************************************** | ||
242 | |||
243 | |||
244 | |||
245 | extern void (* const g_pfnVectors[])(void); | ||
246 | extern void * __Vectors __attribute__ ((alias ("g_pfnVectors"))); | ||
247 | |||
248 | __attribute__ ((used, section(".isr_vector"))) | ||
249 | void (* const g_pfnVectors[])(void) = { | ||
250 | // Core Level - CM4 | ||
251 | &_vStackTop, // The initial stack pointer | ||
252 | ResetISR, // The reset handler | ||
253 | NMI_Handler, // The NMI handler | ||
254 | HardFault_Handler, // The hard fault handler | ||
255 | MemManage_Handler, // The MPU fault handler | ||
256 | BusFault_Handler, // The bus fault handler | ||
257 | UsageFault_Handler, // The usage fault handler | ||
258 | __valid_user_code_checksum, // LPC MCU checksum | ||
259 | 0, // ECRP | ||
260 | (void (*)(void))0xEDDC94BD, // Reserved | ||
261 | (void (*)(void))0x160, // Reserved | ||
262 | SVC_Handler, // SVCall handler | ||
263 | DebugMon_Handler, // Debug monitor handler | ||
264 | 0, // Reserved | ||
265 | PendSV_Handler, // The PendSV handler | ||
266 | SysTick_Handler, // The SysTick handler | ||
267 | |||
268 | // Chip Level - LPC54005 | ||
269 | WDT_BOD_IRQHandler, // 16: Windowed watchdog timer, Brownout detect | ||
270 | DMA0_IRQHandler, // 17: DMA controller | ||
271 | GINT0_IRQHandler, // 18: GPIO group 0 | ||
272 | GINT1_IRQHandler, // 19: GPIO group 1 | ||
273 | PIN_INT0_IRQHandler, // 20: Pin interrupt 0 or pattern match engine slice 0 | ||
274 | PIN_INT1_IRQHandler, // 21: Pin interrupt 1or pattern match engine slice 1 | ||
275 | PIN_INT2_IRQHandler, // 22: Pin interrupt 2 or pattern match engine slice 2 | ||
276 | PIN_INT3_IRQHandler, // 23: Pin interrupt 3 or pattern match engine slice 3 | ||
277 | UTICK0_IRQHandler, // 24: Micro-tick Timer | ||
278 | MRT0_IRQHandler, // 25: Multi-rate timer | ||
279 | CTIMER0_IRQHandler, // 26: Standard counter/timer CTIMER0 | ||
280 | CTIMER1_IRQHandler, // 27: Standard counter/timer CTIMER1 | ||
281 | SCT0_IRQHandler, // 28: SCTimer/PWM | ||
282 | CTIMER3_IRQHandler, // 29: Standard counter/timer CTIMER3 | ||
283 | FLEXCOMM0_IRQHandler, // 30: Flexcomm Interface 0 (USART, SPI, I2C, FLEXCOMM) | ||
284 | FLEXCOMM1_IRQHandler, // 31: Flexcomm Interface 1 (USART, SPI, I2C, FLEXCOMM) | ||
285 | FLEXCOMM2_IRQHandler, // 32: Flexcomm Interface 2 (USART, SPI, I2C, FLEXCOMM) | ||
286 | FLEXCOMM3_IRQHandler, // 33: Flexcomm Interface 3 (USART, SPI, I2C, FLEXCOMM) | ||
287 | FLEXCOMM4_IRQHandler, // 34: Flexcomm Interface 4 (USART, SPI, I2C, FLEXCOMM) | ||
288 | FLEXCOMM5_IRQHandler, // 35: Flexcomm Interface 5 (USART, SPI, I2C,, FLEXCOMM) | ||
289 | FLEXCOMM6_IRQHandler, // 36: Flexcomm Interface 6 (USART, SPI, I2C, I2S,, FLEXCOMM) | ||
290 | FLEXCOMM7_IRQHandler, // 37: Flexcomm Interface 7 (USART, SPI, I2C, I2S,, FLEXCOMM) | ||
291 | ADC0_SEQA_IRQHandler, // 38: ADC0 sequence A completion. | ||
292 | ADC0_SEQB_IRQHandler, // 39: ADC0 sequence B completion. | ||
293 | ADC0_THCMP_IRQHandler, // 40: ADC0 threshold compare and error. | ||
294 | DMIC0_IRQHandler, // 41: Digital microphone and DMIC subsystem | ||
295 | HWVAD0_IRQHandler, // 42: Hardware Voice Activity Detector | ||
296 | USB0_NEEDCLK_IRQHandler, // 43: USB Activity Wake-up Interrupt | ||
297 | USB0_IRQHandler, // 44: USB device | ||
298 | RTC_IRQHandler, // 45: RTC alarm and wake-up interrupts | ||
299 | FLEXCOMM10_IRQHandler, // 46: Flexcomm Interface 10 (SPI, FLEXCOMM) | ||
300 | Reserved47_IRQHandler, // 47: Reserved interrupt | ||
301 | PIN_INT4_IRQHandler, // 48: Pin interrupt 4 or pattern match engine slice 4 int | ||
302 | PIN_INT5_IRQHandler, // 49: Pin interrupt 5 or pattern match engine slice 5 int | ||
303 | PIN_INT6_IRQHandler, // 50: Pin interrupt 6 or pattern match engine slice 6 int | ||
304 | PIN_INT7_IRQHandler, // 51: Pin interrupt 7 or pattern match engine slice 7 int | ||
305 | CTIMER2_IRQHandler, // 52: Standard counter/timer CTIMER2 | ||
306 | CTIMER4_IRQHandler, // 53: Standard counter/timer CTIMER4 | ||
307 | RIT_IRQHandler, // 54: Repetitive Interrupt Timer | ||
308 | SPIFI0_IRQHandler, // 55: SPI flash interface | ||
309 | FLEXCOMM8_IRQHandler, // 56: Flexcomm Interface 8 (USART, SPI, I2C, FLEXCOMM) | ||
310 | FLEXCOMM9_IRQHandler, // 57: Flexcomm Interface 9 (USART, SPI, I2C, FLEXCOMM) | ||
311 | SDIO_IRQHandler, // 58: SD/MMC | ||
312 | CAN0_IRQ0_IRQHandler, // 59: CAN0 interrupt0 | ||
313 | CAN0_IRQ1_IRQHandler, // 60: CAN0 interrupt1 | ||
314 | CAN1_IRQ0_IRQHandler, // 61: CAN1 interrupt0 | ||
315 | CAN1_IRQ1_IRQHandler, // 62: CAN1 interrupt1 | ||
316 | USB1_IRQHandler, // 63: USB1 interrupt | ||
317 | USB1_NEEDCLK_IRQHandler, // 64: USB1 activity | ||
318 | ETHERNET_IRQHandler, // 65: Ethernet | ||
319 | ETHERNET_PMT_IRQHandler, // 66: Ethernet power management interrupt | ||
320 | ETHERNET_MACLP_IRQHandler, // 67: Ethernet MAC interrupt | ||
321 | Reserved68_IRQHandler, // 68: Reserved interrupt | ||
322 | LCD_IRQHandler, // 69: LCD interrupt | ||
323 | SHA_IRQHandler, // 70: SHA interrupt | ||
324 | SMARTCARD0_IRQHandler, // 71: Smart card 0 interrupt | ||
325 | SMARTCARD1_IRQHandler, // 72: Smart card 1 interrupt | ||
326 | |||
327 | 0, // Reserved | ||
328 | 0, // Reserved | ||
329 | 0, // Reserved | ||
330 | 0, // Reserved | ||
331 | 0, // Reserved | ||
332 | 0, // Reserved | ||
333 | 0, // Reserved | ||
334 | 0, // Reserved | ||
335 | 0, // Reserved | ||
336 | 0, // Reserved | ||
337 | 0, // Reserved | ||
338 | 0, // Reserved | ||
339 | 0, // Reserved | ||
340 | 0, // Reserved | ||
341 | 0, // Reserved | ||
342 | (void (*)(void))0xFEEDA5A5, // Header Marker | ||
343 | |||
344 | #if defined (ADD_CRC) | ||
345 | (__imghdr_imagetype - 1), // (0x04) Image Type | ||
346 | __imghdr_loadaddress, // (0x08) Load_address | ||
347 | #else | ||
348 | __imghdr_imagetype, // (0x04) Image Type | ||
349 | __imghdr_loadaddress, // (0x08) Load_address | ||
350 | #endif | ||
351 | (void (*)(void))(((unsigned)_image_size) - 4), // (0x0C) load_length, exclude 4 bytes CRC field. | ||
352 | 0, // (0x10) CRC value (only applicable to NON Non-secure images). | ||
353 | 0, // (0x14) Version (only applicable to DUAL_ENH image type. | ||
354 | 0, // (0x18) EMC static memory configuration settings, required for EMC boot | ||
355 | (void (*)(void))IMG_BAUDRATE, // (0x1C) image baudrate | ||
356 | 0, // (0x20) reserved | ||
357 | (void (*)(void))0xEDDC94BD, // (0x24) Image_marker | ||
358 | 0, // (0x28) SBZ | ||
359 | 0, // (0x2C) reserved | ||
360 | #ifdef W25Q128JVFM | ||
361 | /* SPIFI Descriptor - W25Q128JVFM */ | ||
362 | (void (*)(void))0x00000000, // 0xFFFFFFFF to default 1-bit SPI mode ï¼›DevStrAdr | ||
363 | (void (*)(void))0x001870EF, // mfgId + extCount | ||
364 | (void (*)(void))0x00000000, // extid 0-3 | ||
365 | (void (*)(void))0x00000000, // extid 4-7 | ||
366 | (void (*)(void))0x0001001D, // caps | ||
367 | (void (*)(void))0x00000100, // Blks + RESV1 | ||
368 | (void (*)(void))0x00010000, // blkSize | ||
369 | (void (*)(void))0x00000000, // subBlks + subBlkSize | ||
370 | (void (*)(void))0x00000100, // pageSize + RESV2 | ||
371 | (void (*)(void))0x00003F00, // maxReadSize | ||
372 | (void (*)(void))0x68506850, // maxClkRate,maxReadRate,maxHSReadRate,maxProgramRate | ||
373 | (void (*)(void))0x04030050, // maxHSProgramRate,initDeInitFxId,clearStatusFxId,getStatusFxId, | ||
374 | (void (*)(void))0x14110D09, // setStatusFxId,setOptionsFxId,getReadCmdFxId,getWriteCmdFxId | ||
375 | #endif | ||
376 | |||
377 | #ifdef MXL12835F | ||
378 | /* SPI Descriptor - MXL12835F */ | ||
379 | (void (*)(void))0x00000000, // 0xFFFFFFFF to default 1-bit SPI mode ;DevStrAdr | ||
380 | (void (*)(void))0x001820C2, // mfgId + extCount | ||
381 | (void (*)(void))0x00000000, // extid 0-3 | ||
382 | (void (*)(void))0x00000000, // extid 4-7 | ||
383 | (void (*)(void))0x0001001D, // caps | ||
384 | (void (*)(void))0x00000100, // Blks + RESV1 | ||
385 | (void (*)(void))0x00010000, // blkSize | ||
386 | (void (*)(void))0x00000000, // subBlks + subBlkSize | ||
387 | (void (*)(void))0x00000100, // pageSize + RESV2 | ||
388 | (void (*)(void))0x00003F00, // maxReadSize | ||
389 | (void (*)(void))0x68506850, // maxClkRate,maxReadRate,maxHSReadRate,maxProgramRate | ||
390 | (void (*)(void))0x06030050, // maxHSProgramRate,initDeInitFxId,clearStatusFxId,getStatusFxId | ||
391 | (void (*)(void))0x14110F0B, // setStatusFxId,setOptionsFxId,getReadCmdFxId,getWriteCmdFxId | ||
392 | #endif | ||
393 | |||
394 | |||
395 | }; /* End of g_pfnVectors */ | ||
396 | |||
397 | //***************************************************************************** | ||
398 | // Functions to carry out the initialization of RW and BSS data sections. These | ||
399 | // are written as separate functions rather than being inlined within the | ||
400 | // ResetISR() function in order to cope with MCUs with multiple banks of | ||
401 | // memory. | ||
402 | //***************************************************************************** | ||
403 | __attribute__ ((section(".after_vectors.init_data"))) | ||
404 | void data_init(unsigned int romstart, unsigned int start, unsigned int len) { | ||
405 | unsigned int *pulDest = (unsigned int*) start; | ||
406 | unsigned int *pulSrc = (unsigned int*) romstart; | ||
407 | unsigned int loop; | ||
408 | for (loop = 0; loop < len; loop = loop + 4) | ||
409 | *pulDest++ = *pulSrc++; | ||
410 | } | ||
411 | |||
412 | __attribute__ ((section(".after_vectors.init_bss"))) | ||
413 | void bss_init(unsigned int start, unsigned int len) { | ||
414 | unsigned int *pulDest = (unsigned int*) start; | ||
415 | unsigned int loop; | ||
416 | for (loop = 0; loop < len; loop = loop + 4) | ||
417 | *pulDest++ = 0; | ||
418 | } | ||
419 | |||
420 | //***************************************************************************** | ||
421 | // The following symbols are constructs generated by the linker, indicating | ||
422 | // the location of various points in the "Global Section Table". This table is | ||
423 | // created by the linker via the Code Red managed linker script mechanism. It | ||
424 | // contains the load address, execution address and length of each RW data | ||
425 | // section and the execution and length of each BSS (zero initialized) section. | ||
426 | //***************************************************************************** | ||
427 | extern unsigned int __data_section_table; | ||
428 | extern unsigned int __data_section_table_end; | ||
429 | extern unsigned int __bss_section_table; | ||
430 | extern unsigned int __bss_section_table_end; | ||
431 | |||
432 | //***************************************************************************** | ||
433 | // Reset entry point for your code. | ||
434 | // Sets up a simple runtime environment and initializes the C/C++ | ||
435 | // library. | ||
436 | //***************************************************************************** | ||
437 | __attribute__ ((section(".after_vectors.reset"))) | ||
438 | void ResetISR(void) { | ||
439 | |||
440 | // Disable interrupts | ||
441 | __asm volatile ("cpsid i"); | ||
442 | |||
443 | |||
444 | // Enable SRAM clock used by Stack | ||
445 | __asm volatile ("LDR R0, =0x40000220\n\t" | ||
446 | "MOV R1, #56\n\t" | ||
447 | "STR R1, [R0]"); | ||
448 | |||
449 | #if defined (__USE_CMSIS) | ||
450 | // If __USE_CMSIS defined, then call CMSIS SystemInit code | ||
451 | SystemInit(); | ||
452 | |||
453 | #endif // (__USE_CMSIS) | ||
454 | |||
455 | // | ||
456 | // Copy the data sections from flash to SRAM. | ||
457 | // | ||
458 | unsigned int LoadAddr, ExeAddr, SectionLen; | ||
459 | unsigned int *SectionTableAddr; | ||
460 | |||
461 | // Load base address of Global Section Table | ||
462 | SectionTableAddr = &__data_section_table; | ||
463 | |||
464 | // Copy the data sections from flash to SRAM. | ||
465 | while (SectionTableAddr < &__data_section_table_end) { | ||
466 | LoadAddr = *SectionTableAddr++; | ||
467 | ExeAddr = *SectionTableAddr++; | ||
468 | SectionLen = *SectionTableAddr++; | ||
469 | data_init(LoadAddr, ExeAddr, SectionLen); | ||
470 | } | ||
471 | |||
472 | // At this point, SectionTableAddr = &__bss_section_table; | ||
473 | // Zero fill the bss segment | ||
474 | while (SectionTableAddr < &__bss_section_table_end) { | ||
475 | ExeAddr = *SectionTableAddr++; | ||
476 | SectionLen = *SectionTableAddr++; | ||
477 | bss_init(ExeAddr, SectionLen); | ||
478 | } | ||
479 | |||
480 | #if !defined (__USE_CMSIS) | ||
481 | // Assume that if __USE_CMSIS defined, then CMSIS SystemInit code | ||
482 | // will enable the FPU | ||
483 | #if defined (__VFP_FP__) && !defined (__SOFTFP__) | ||
484 | // | ||
485 | // Code to enable the Cortex-M4 FPU only included | ||
486 | // if appropriate build options have been selected. | ||
487 | // Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C) | ||
488 | // | ||
489 | // Read CPACR (located at address 0xE000ED88) | ||
490 | // Set bits 20-23 to enable CP10 and CP11 coprocessors | ||
491 | // Write back the modified value to the CPACR | ||
492 | asm volatile ("LDR.W R0, =0xE000ED88\n\t" | ||
493 | "LDR R1, [R0]\n\t" | ||
494 | "ORR R1, R1, #(0xF << 20)\n\t" | ||
495 | "STR R1, [R0]"); | ||
496 | #endif // (__VFP_FP__) && !(__SOFTFP__) | ||
497 | #endif // (__USE_CMSIS) | ||
498 | |||
499 | |||
500 | #if !defined (__USE_CMSIS) | ||
501 | // Assume that if __USE_CMSIS defined, then CMSIS SystemInit code | ||
502 | // will setup the VTOR register | ||
503 | |||
504 | // Check to see if we are running the code from a non-zero | ||
505 | // address (eg RAM, external flash), in which case we need | ||
506 | // to modify the VTOR register to tell the CPU that the | ||
507 | // vector table is located at a non-0x0 address. | ||
508 | unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08; | ||
509 | if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) { | ||
510 | *pSCB_VTOR = (unsigned int)g_pfnVectors; | ||
511 | } | ||
512 | #endif // (__USE_CMSIS) | ||
513 | #if defined (__cplusplus) | ||
514 | // | ||
515 | // Call C++ library initialisation | ||
516 | // | ||
517 | __libc_init_array(); | ||
518 | #endif | ||
519 | |||
520 | // Reenable interrupts | ||
521 | __asm volatile ("cpsie i"); | ||
522 | |||
523 | #if defined (__REDLIB__) | ||
524 | // Call the Redlib library, which in turn calls main() | ||
525 | __main(); | ||
526 | #else | ||
527 | main(); | ||
528 | #endif | ||
529 | |||
530 | // | ||
531 | // main() shouldn't return, but if it does, we'll just enter an infinite loop | ||
532 | // | ||
533 | while (1) { | ||
534 | ; | ||
535 | } | ||
536 | } | ||
537 | |||
538 | //***************************************************************************** | ||
539 | // Default core exception handlers. Override the ones here by defining your own | ||
540 | // handler routines in your application code. | ||
541 | //***************************************************************************** | ||
542 | WEAK_AV void NMI_Handler(void) | ||
543 | { while(1) {} | ||
544 | } | ||
545 | |||
546 | WEAK_AV void HardFault_Handler(void) | ||
547 | { while(1) {} | ||
548 | } | ||
549 | |||
550 | WEAK_AV void MemManage_Handler(void) | ||
551 | { while(1) {} | ||
552 | } | ||
553 | |||
554 | WEAK_AV void BusFault_Handler(void) | ||
555 | { while(1) {} | ||
556 | } | ||
557 | |||
558 | WEAK_AV void UsageFault_Handler(void) | ||
559 | { while(1) {} | ||
560 | } | ||
561 | |||
562 | WEAK_AV void SVC_Handler(void) | ||
563 | { while(1) {} | ||
564 | } | ||
565 | |||
566 | WEAK_AV void DebugMon_Handler(void) | ||
567 | { while(1) {} | ||
568 | } | ||
569 | |||
570 | WEAK_AV void PendSV_Handler(void) | ||
571 | { while(1) {} | ||
572 | } | ||
573 | |||
574 | WEAK_AV void SysTick_Handler(void) | ||
575 | { while(1) {} | ||
576 | } | ||
577 | |||
578 | //***************************************************************************** | ||
579 | // Processor ends up here if an unexpected interrupt occurs or a specific | ||
580 | // handler is not present in the application code. | ||
581 | //***************************************************************************** | ||
582 | WEAK_AV void IntDefaultHandler(void) | ||
583 | { while(1) {} | ||
584 | } | ||
585 | |||
586 | //***************************************************************************** | ||
587 | // Default application exception handlers. Override the ones here by defining | ||
588 | // your own handler routines in your application code. These routines call | ||
589 | // driver exception handlers or IntDefaultHandler() if no driver exception | ||
590 | // handler is included. | ||
591 | //***************************************************************************** | ||
592 | WEAK void WDT_BOD_IRQHandler(void) | ||
593 | { WDT_BOD_DriverIRQHandler(); | ||
594 | } | ||
595 | |||
596 | WEAK void DMA0_IRQHandler(void) | ||
597 | { DMA0_DriverIRQHandler(); | ||
598 | } | ||
599 | |||
600 | WEAK void GINT0_IRQHandler(void) | ||
601 | { GINT0_DriverIRQHandler(); | ||
602 | } | ||
603 | |||
604 | WEAK void GINT1_IRQHandler(void) | ||
605 | { GINT1_DriverIRQHandler(); | ||
606 | } | ||
607 | |||
608 | WEAK void PIN_INT0_IRQHandler(void) | ||
609 | { PIN_INT0_DriverIRQHandler(); | ||
610 | } | ||
611 | |||
612 | WEAK void PIN_INT1_IRQHandler(void) | ||
613 | { PIN_INT1_DriverIRQHandler(); | ||
614 | } | ||
615 | |||
616 | WEAK void PIN_INT2_IRQHandler(void) | ||
617 | { PIN_INT2_DriverIRQHandler(); | ||
618 | } | ||
619 | |||
620 | WEAK void PIN_INT3_IRQHandler(void) | ||
621 | { PIN_INT3_DriverIRQHandler(); | ||
622 | } | ||
623 | |||
624 | WEAK void UTICK0_IRQHandler(void) | ||
625 | { UTICK0_DriverIRQHandler(); | ||
626 | } | ||
627 | |||
628 | WEAK void MRT0_IRQHandler(void) | ||
629 | { MRT0_DriverIRQHandler(); | ||
630 | } | ||
631 | |||
632 | WEAK void CTIMER0_IRQHandler(void) | ||
633 | { CTIMER0_DriverIRQHandler(); | ||
634 | } | ||
635 | |||
636 | WEAK void CTIMER1_IRQHandler(void) | ||
637 | { CTIMER1_DriverIRQHandler(); | ||
638 | } | ||
639 | |||
640 | WEAK void SCT0_IRQHandler(void) | ||
641 | { SCT0_DriverIRQHandler(); | ||
642 | } | ||
643 | |||
644 | WEAK void CTIMER3_IRQHandler(void) | ||
645 | { CTIMER3_DriverIRQHandler(); | ||
646 | } | ||
647 | |||
648 | WEAK void FLEXCOMM0_IRQHandler(void) | ||
649 | { FLEXCOMM0_DriverIRQHandler(); | ||
650 | } | ||
651 | |||
652 | WEAK void FLEXCOMM1_IRQHandler(void) | ||
653 | { FLEXCOMM1_DriverIRQHandler(); | ||
654 | } | ||
655 | |||
656 | WEAK void FLEXCOMM2_IRQHandler(void) | ||
657 | { FLEXCOMM2_DriverIRQHandler(); | ||
658 | } | ||
659 | |||
660 | WEAK void FLEXCOMM3_IRQHandler(void) | ||
661 | { FLEXCOMM3_DriverIRQHandler(); | ||
662 | } | ||
663 | |||
664 | WEAK void FLEXCOMM4_IRQHandler(void) | ||
665 | { FLEXCOMM4_DriverIRQHandler(); | ||
666 | } | ||
667 | |||
668 | WEAK void FLEXCOMM5_IRQHandler(void) | ||
669 | { FLEXCOMM5_DriverIRQHandler(); | ||
670 | } | ||
671 | |||
672 | WEAK void FLEXCOMM6_IRQHandler(void) | ||
673 | { FLEXCOMM6_DriverIRQHandler(); | ||
674 | } | ||
675 | |||
676 | WEAK void FLEXCOMM7_IRQHandler(void) | ||
677 | { FLEXCOMM7_DriverIRQHandler(); | ||
678 | } | ||
679 | |||
680 | WEAK void ADC0_SEQA_IRQHandler(void) | ||
681 | { ADC0_SEQA_DriverIRQHandler(); | ||
682 | } | ||
683 | |||
684 | WEAK void ADC0_SEQB_IRQHandler(void) | ||
685 | { ADC0_SEQB_DriverIRQHandler(); | ||
686 | } | ||
687 | |||
688 | WEAK void ADC0_THCMP_IRQHandler(void) | ||
689 | { ADC0_THCMP_DriverIRQHandler(); | ||
690 | } | ||
691 | |||
692 | WEAK void DMIC0_IRQHandler(void) | ||
693 | { DMIC0_DriverIRQHandler(); | ||
694 | } | ||
695 | |||
696 | WEAK void HWVAD0_IRQHandler(void) | ||
697 | { HWVAD0_DriverIRQHandler(); | ||
698 | } | ||
699 | |||
700 | WEAK void USB0_NEEDCLK_IRQHandler(void) | ||
701 | { USB0_NEEDCLK_DriverIRQHandler(); | ||
702 | } | ||
703 | |||
704 | WEAK void USB0_IRQHandler(void) | ||
705 | { USB0_DriverIRQHandler(); | ||
706 | } | ||
707 | |||
708 | WEAK void RTC_IRQHandler(void) | ||
709 | { RTC_DriverIRQHandler(); | ||
710 | } | ||
711 | |||
712 | WEAK void FLEXCOMM10_IRQHandler(void) | ||
713 | { FLEXCOMM10_DriverIRQHandler(); | ||
714 | } | ||
715 | |||
716 | WEAK void Reserved47_IRQHandler(void) | ||
717 | { Reserved47_DriverIRQHandler(); | ||
718 | } | ||
719 | |||
720 | WEAK void PIN_INT4_IRQHandler(void) | ||
721 | { PIN_INT4_DriverIRQHandler(); | ||
722 | } | ||
723 | |||
724 | WEAK void PIN_INT5_IRQHandler(void) | ||
725 | { PIN_INT5_DriverIRQHandler(); | ||
726 | } | ||
727 | |||
728 | WEAK void PIN_INT6_IRQHandler(void) | ||
729 | { PIN_INT6_DriverIRQHandler(); | ||
730 | } | ||
731 | |||
732 | WEAK void PIN_INT7_IRQHandler(void) | ||
733 | { PIN_INT7_DriverIRQHandler(); | ||
734 | } | ||
735 | |||
736 | WEAK void CTIMER2_IRQHandler(void) | ||
737 | { CTIMER2_DriverIRQHandler(); | ||
738 | } | ||
739 | |||
740 | WEAK void CTIMER4_IRQHandler(void) | ||
741 | { CTIMER4_DriverIRQHandler(); | ||
742 | } | ||
743 | |||
744 | WEAK void RIT_IRQHandler(void) | ||
745 | { RIT_DriverIRQHandler(); | ||
746 | } | ||
747 | |||
748 | WEAK void SPIFI0_IRQHandler(void) | ||
749 | { SPIFI0_DriverIRQHandler(); | ||
750 | } | ||
751 | |||
752 | WEAK void FLEXCOMM8_IRQHandler(void) | ||
753 | { FLEXCOMM8_DriverIRQHandler(); | ||
754 | } | ||
755 | |||
756 | WEAK void FLEXCOMM9_IRQHandler(void) | ||
757 | { FLEXCOMM9_DriverIRQHandler(); | ||
758 | } | ||
759 | |||
760 | WEAK void SDIO_IRQHandler(void) | ||
761 | { SDIO_DriverIRQHandler(); | ||
762 | } | ||
763 | |||
764 | WEAK void CAN0_IRQ0_IRQHandler(void) | ||
765 | { CAN0_IRQ0_DriverIRQHandler(); | ||
766 | } | ||
767 | |||
768 | WEAK void CAN0_IRQ1_IRQHandler(void) | ||
769 | { CAN0_IRQ1_DriverIRQHandler(); | ||
770 | } | ||
771 | |||
772 | WEAK void CAN1_IRQ0_IRQHandler(void) | ||
773 | { CAN1_IRQ0_DriverIRQHandler(); | ||
774 | } | ||
775 | |||
776 | WEAK void CAN1_IRQ1_IRQHandler(void) | ||
777 | { CAN1_IRQ1_DriverIRQHandler(); | ||
778 | } | ||
779 | |||
780 | WEAK void USB1_IRQHandler(void) | ||
781 | { USB1_DriverIRQHandler(); | ||
782 | } | ||
783 | |||
784 | WEAK void USB1_NEEDCLK_IRQHandler(void) | ||
785 | { USB1_NEEDCLK_DriverIRQHandler(); | ||
786 | } | ||
787 | |||
788 | WEAK void ETHERNET_IRQHandler(void) | ||
789 | { ETHERNET_DriverIRQHandler(); | ||
790 | } | ||
791 | |||
792 | WEAK void ETHERNET_PMT_IRQHandler(void) | ||
793 | { ETHERNET_PMT_DriverIRQHandler(); | ||
794 | } | ||
795 | |||
796 | WEAK void ETHERNET_MACLP_IRQHandler(void) | ||
797 | { ETHERNET_MACLP_DriverIRQHandler(); | ||
798 | } | ||
799 | |||
800 | WEAK void Reserved68_IRQHandler(void) | ||
801 | { Reserved68_DriverIRQHandler(); | ||
802 | } | ||
803 | |||
804 | WEAK void LCD_IRQHandler(void) | ||
805 | { LCD_DriverIRQHandler(); | ||
806 | } | ||
807 | |||
808 | WEAK void SHA_IRQHandler(void) | ||
809 | { SHA_DriverIRQHandler(); | ||
810 | } | ||
811 | |||
812 | WEAK void SMARTCARD0_IRQHandler(void) | ||
813 | { SMARTCARD0_DriverIRQHandler(); | ||
814 | } | ||
815 | |||
816 | WEAK void SMARTCARD1_IRQHandler(void) | ||
817 | { SMARTCARD1_DriverIRQHandler(); | ||
818 | } | ||
819 | |||
820 | //***************************************************************************** | ||
821 | |||
822 | #if defined (DEBUG) | ||
823 | #pragma GCC pop_options | ||
824 | #endif // (DEBUG) | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/board.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/board.c new file mode 100644 index 000000000..64fddff63 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/board.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2017 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #include <stdint.h> | ||
10 | #include "fsl_common.h" | ||
11 | #include "clock_config.h" | ||
12 | #include "board.h" | ||
13 | #include "fsl_debug_console.h" | ||
14 | |||
15 | /******************************************************************************* | ||
16 | * Variables | ||
17 | ******************************************************************************/ | ||
18 | |||
19 | /* Clock rate on the CLKIN pin */ | ||
20 | const uint32_t ExtClockIn = BOARD_EXTCLKINRATE; | ||
21 | |||
22 | /******************************************************************************* | ||
23 | * Code | ||
24 | ******************************************************************************/ | ||
25 | /* Initialize debug console. */ | ||
26 | status_t BOARD_InitDebugConsole(void) | ||
27 | { | ||
28 | #if ((SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_SDK) || defined(SDK_DEBUGCONSOLE_UART)) | ||
29 | status_t result; | ||
30 | /* attach 12 MHz clock to FLEXCOMM0 (debug console) */ | ||
31 | CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0); | ||
32 | RESET_PeripheralReset(BOARD_DEBUG_UART_RST); | ||
33 | result = DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM, | ||
34 | BOARD_DEBUG_UART_CLK_FREQ); | ||
35 | assert(kStatus_Success == result); | ||
36 | return result; | ||
37 | #else | ||
38 | return kStatus_Success; | ||
39 | #endif | ||
40 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/board.h new file mode 100644 index 000000000..0cd139f97 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/board.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2017 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _BOARD_H_ | ||
10 | #define _BOARD_H_ | ||
11 | |||
12 | #include "clock_config.h" | ||
13 | #include "fsl_common.h" | ||
14 | #include "fsl_gpio.h" | ||
15 | |||
16 | /******************************************************************************* | ||
17 | * Definitions | ||
18 | ******************************************************************************/ | ||
19 | /*! @brief The board name */ | ||
20 | #define BOARD_NAME "LPCXPRESSO54608" | ||
21 | |||
22 | #define BOARD_EXTCLKINRATE (0) | ||
23 | |||
24 | /*! @brief The UART to use for debug messages. */ | ||
25 | /* TODO: rename UART to USART */ | ||
26 | #define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM | ||
27 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) USART0 | ||
28 | #define BOARD_DEBUG_UART_INSTANCE 0U | ||
29 | #define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetFreq(kCLOCK_Flexcomm0) | ||
30 | #define BOARD_DEBUG_UART_CLK_ATTACH kFRO12M_to_FLEXCOMM0 | ||
31 | #define BOARD_DEBUG_UART_RST kFC0_RST_SHIFT_RSTn | ||
32 | #define BOARD_DEBUG_UART_CLKSRC kCLOCK_Flexcomm0 | ||
33 | #define BOARD_UART_IRQ_HANDLER FLEXCOMM0_IRQHandler | ||
34 | #define BOARD_UART_IRQ FLEXCOMM0_IRQn | ||
35 | /* TODO: obsolete */ | ||
36 | #define BOARD_DEBUG_SPI_CLK_FREQ 12000000 | ||
37 | |||
38 | #ifndef BOARD_DEBUG_UART_BAUDRATE | ||
39 | #define BOARD_DEBUG_UART_BAUDRATE 115200 | ||
40 | #endif /* BOARD_DEBUG_UART_BAUDRATE */ | ||
41 | |||
42 | #ifndef BOARD_LED_RED_GPIO | ||
43 | #define BOARD_LED_RED_GPIO GPIO | ||
44 | #endif | ||
45 | #define BOARD_LED_RED_GPIO_PORT 3U | ||
46 | #ifndef BOARD_LED_RED_GPIO_PIN | ||
47 | #define BOARD_LED_RED_GPIO_PIN 14U | ||
48 | #endif | ||
49 | #ifndef BOARD_LED_GREEN_GPIO | ||
50 | #define BOARD_LED_GREEN_GPIO GPIO | ||
51 | #endif | ||
52 | #define BOARD_LED_GREEN_GPIO_PORT 2U | ||
53 | #ifndef BOARD_LED_GREEN_GPIO_PIN | ||
54 | #define BOARD_LED_GREEN_GPIO_PIN 2U | ||
55 | #endif | ||
56 | #ifndef BOARD_LED_BLUE_GPIO | ||
57 | #define BOARD_LED_BLUE_GPIO GPIO | ||
58 | #endif | ||
59 | #define BOARD_LED_BLUE_GPIO_PORT 3U | ||
60 | #ifndef BOARD_LED_BLUE_GPIO_PIN | ||
61 | #define BOARD_LED_BLUE_GPIO_PIN 3U | ||
62 | #endif | ||
63 | |||
64 | /* Board led color mapping */ | ||
65 | #define LOGIC_LED_ON 0U | ||
66 | #define LOGIC_LED_OFF 1U | ||
67 | |||
68 | #define LED_RED_INIT(output) \ | ||
69 | GPIO_PinInit(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, BOARD_LED_RED_GPIO_PIN, \ | ||
70 | &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_RED */ | ||
71 | #define LED_RED_ON() \ | ||
72 | GPIO_PortClear(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \ | ||
73 | 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */ | ||
74 | #define LED_RED_OFF() \ | ||
75 | GPIO_PortSet(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \ | ||
76 | 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */ | ||
77 | #define LED_RED_TOGGLE() \ | ||
78 | GPIO_PortToggle(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \ | ||
79 | 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */ | ||
80 | |||
81 | #define LED_GREEN_INIT(output) \ | ||
82 | GPIO_PinInit(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, BOARD_LED_GREEN_GPIO_PIN, \ | ||
83 | &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_GREEN */ | ||
84 | #define LED_GREEN_ON() \ | ||
85 | GPIO_PortClear(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \ | ||
86 | 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */ | ||
87 | #define LED_GREEN_OFF() \ | ||
88 | GPIO_PortSet(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \ | ||
89 | 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */ | ||
90 | #define LED_GREEN_TOGGLE() \ | ||
91 | GPIO_PortToggle(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \ | ||
92 | 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */ | ||
93 | |||
94 | #define LED_BLUE_INIT(output) \ | ||
95 | GPIO_PinInit(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, BOARD_LED_BLUE_GPIO_PIN, \ | ||
96 | &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_BLUE */ | ||
97 | #define LED_BLUE_ON() \ | ||
98 | GPIO_PortClear(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \ | ||
99 | 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */ | ||
100 | #define LED_BLUE_OFF() \ | ||
101 | GPIO_PortSet(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \ | ||
102 | 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */ | ||
103 | #define LED_BLUE_TOGGLE() \ | ||
104 | GPIO_PortToggle(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \ | ||
105 | 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */ | ||
106 | |||
107 | #if defined(__cplusplus) | ||
108 | extern "C" { | ||
109 | #endif /* __cplusplus */ | ||
110 | |||
111 | /******************************************************************************* | ||
112 | * API | ||
113 | ******************************************************************************/ | ||
114 | |||
115 | status_t BOARD_InitDebugConsole(void); | ||
116 | |||
117 | #if defined(__cplusplus) | ||
118 | } | ||
119 | #endif /* __cplusplus */ | ||
120 | |||
121 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/clock_config.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/clock_config.c new file mode 100644 index 000000000..605114391 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/clock_config.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * Copyright 2018 NXP. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * How to set up clock using clock driver functions: | ||
10 | * | ||
11 | * 1. Setup clock sources. | ||
12 | * | ||
13 | * 2. Setup voltage for the fastest of the clock outputs | ||
14 | * | ||
15 | * 3. Set up wait states of the flash. | ||
16 | * | ||
17 | * 4. Set up all dividers. | ||
18 | * | ||
19 | * 5. Set up all selectors to provide selected clocks. | ||
20 | */ | ||
21 | |||
22 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
23 | !!GlobalInfo | ||
24 | product: Clocks v5.0 | ||
25 | processor: LPC54005 | ||
26 | mcu_data: ksdk2_0 | ||
27 | processor_version: 0.0.8 | ||
28 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
29 | |||
30 | #include "fsl_power.h" | ||
31 | #include "fsl_clock.h" | ||
32 | #include "clock_config.h" | ||
33 | |||
34 | /******************************************************************************* | ||
35 | * Definitions | ||
36 | ******************************************************************************/ | ||
37 | |||
38 | /******************************************************************************* | ||
39 | * Variables | ||
40 | ******************************************************************************/ | ||
41 | /* System clock frequency. */ | ||
42 | extern uint32_t SystemCoreClock; | ||
43 | |||
44 | /******************************************************************************* | ||
45 | ************************ BOARD_InitBootClocks function ************************ | ||
46 | ******************************************************************************/ | ||
47 | void BOARD_InitBootClocks(void) | ||
48 | { | ||
49 | BOARD_BootClockRUN(); | ||
50 | } | ||
51 | |||
52 | /******************************************************************************* | ||
53 | ********************** Configuration BOARD_BootClockRUN *********************** | ||
54 | ******************************************************************************/ | ||
55 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
56 | !!Configuration | ||
57 | name: BOARD_BootClockRUN | ||
58 | called_from_default_init: true | ||
59 | outputs: | ||
60 | - {id: FRO12M_clock.outFreq, value: 12 MHz} | ||
61 | - {id: FROHF_clock.outFreq, value: 48 MHz} | ||
62 | - {id: MAIN_clock.outFreq, value: 12 MHz} | ||
63 | - {id: System_clock.outFreq, value: 12 MHz} | ||
64 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
65 | |||
66 | /******************************************************************************* | ||
67 | * Variables for BOARD_BootClockRUN configuration | ||
68 | ******************************************************************************/ | ||
69 | /******************************************************************************* | ||
70 | * Code for BOARD_BootClockRUN configuration | ||
71 | ******************************************************************************/ | ||
72 | void BOARD_BootClockRUN(void) | ||
73 | { | ||
74 | /*!< Set up the clock sources */ | ||
75 | /*!< Set up FRO */ | ||
76 | POWER_DisablePD(kPDRUNCFG_PD_FRO_EN); /*!< Ensure FRO is on */ | ||
77 | CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change voltage without accidentally | ||
78 | being below the voltage for current speed */ | ||
79 | POWER_SetVoltageForFreq(12000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */ | ||
80 | |||
81 | /*!< Set up dividers */ | ||
82 | CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Reset divider counter and set divider to value 1 */ | ||
83 | |||
84 | /*!< Set up clock selectors - Attach clocks to the peripheries */ | ||
85 | CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch MAIN_CLK to FRO12M */ | ||
86 | /* Set SystemCoreClock variable. */ | ||
87 | SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; | ||
88 | } | ||
89 | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/clock_config.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/clock_config.h new file mode 100644 index 000000000..363742ab0 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/clock_config.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright 2018 NXP. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | /*********************************************************************************************************************** | ||
9 | * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file | ||
10 | * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. | ||
11 | **********************************************************************************************************************/ | ||
12 | |||
13 | #ifndef _CLOCK_CONFIG_H_ | ||
14 | #define _CLOCK_CONFIG_H_ | ||
15 | |||
16 | #include "fsl_common.h" | ||
17 | |||
18 | /******************************************************************************* | ||
19 | * Definitions | ||
20 | ******************************************************************************/ | ||
21 | #define BOARD_XTAL0_CLK_HZ 12000000U /*!< Board xtal0 frequency in Hz */ | ||
22 | #define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32K frequency in Hz */ | ||
23 | |||
24 | /******************************************************************************* | ||
25 | ************************ BOARD_InitBootClocks function ************************ | ||
26 | ******************************************************************************/ | ||
27 | |||
28 | #if defined(__cplusplus) | ||
29 | extern "C" { | ||
30 | #endif /* __cplusplus*/ | ||
31 | |||
32 | /*! | ||
33 | * @brief This function executes default configuration of clocks. | ||
34 | * | ||
35 | */ | ||
36 | void BOARD_InitBootClocks(void); | ||
37 | |||
38 | #if defined(__cplusplus) | ||
39 | } | ||
40 | #endif /* __cplusplus*/ | ||
41 | |||
42 | /******************************************************************************* | ||
43 | ********************** Configuration BOARD_BootClockRUN *********************** | ||
44 | ******************************************************************************/ | ||
45 | /******************************************************************************* | ||
46 | * Definitions for BOARD_BootClockRUN configuration | ||
47 | ******************************************************************************/ | ||
48 | #define BOARD_BOOTCLOCKRUN_CORE_CLOCK 12000000U /*!< Core clock frequency:12000000Hz */ | ||
49 | |||
50 | /******************************************************************************* | ||
51 | * API for BOARD_BootClockRUN configuration | ||
52 | ******************************************************************************/ | ||
53 | #if defined(__cplusplus) | ||
54 | extern "C" { | ||
55 | #endif /* __cplusplus*/ | ||
56 | |||
57 | /*! | ||
58 | * @brief This function executes configuration of clocks. | ||
59 | * | ||
60 | */ | ||
61 | void BOARD_BootClockRUN(void); | ||
62 | |||
63 | #if defined(__cplusplus) | ||
64 | } | ||
65 | #endif /* __cplusplus*/ | ||
66 | |||
67 | #endif /* _CLOCK_CONFIG_H_ */ | ||
68 | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/peripherals.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/peripherals.c new file mode 100644 index 000000000..11ab6863a --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/peripherals.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright 2019 NXP. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | /*********************************************************************************************************************** | ||
9 | * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file | ||
10 | * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. | ||
11 | **********************************************************************************************************************/ | ||
12 | |||
13 | /* clang-format off */ | ||
14 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
15 | !!GlobalInfo | ||
16 | product: Peripherals v6.0 | ||
17 | processor: LPC54005 | ||
18 | mcu_data: ksdk2_0 | ||
19 | processor_version: 0.0.15 | ||
20 | functionalGroups: | ||
21 | - name: BOARD_InitPeripherals | ||
22 | called_from_default_init: true | ||
23 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
24 | |||
25 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
26 | component: | ||
27 | - type: 'system' | ||
28 | - type_id: 'system_54b53072540eeeb8f8e9343e71f28176' | ||
29 | - global_system_definitions: [] | ||
30 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
31 | /* clang-format on */ | ||
32 | |||
33 | /*********************************************************************************************************************** | ||
34 | * Included files | ||
35 | **********************************************************************************************************************/ | ||
36 | #include "peripherals.h" | ||
37 | |||
38 | /*********************************************************************************************************************** | ||
39 | * Initialization functions | ||
40 | **********************************************************************************************************************/ | ||
41 | void BOARD_InitPeripherals(void) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | /*********************************************************************************************************************** | ||
46 | * BOARD_InitBootPeripherals function | ||
47 | **********************************************************************************************************************/ | ||
48 | void BOARD_InitBootPeripherals(void) | ||
49 | { | ||
50 | BOARD_InitPeripherals(); | ||
51 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/peripherals.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/peripherals.h new file mode 100644 index 000000000..150360637 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/peripherals.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright 2019 NXP. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | /*********************************************************************************************************************** | ||
9 | * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file | ||
10 | * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. | ||
11 | **********************************************************************************************************************/ | ||
12 | |||
13 | #ifndef _PERIPHERALS_H_ | ||
14 | #define _PERIPHERALS_H_ | ||
15 | |||
16 | #if defined(__cplusplus) | ||
17 | extern "C" { | ||
18 | #endif /* __cplusplus */ | ||
19 | |||
20 | /*********************************************************************************************************************** | ||
21 | * Initialization functions | ||
22 | **********************************************************************************************************************/ | ||
23 | void BOARD_InitPeripherals(void); | ||
24 | |||
25 | /*********************************************************************************************************************** | ||
26 | * BOARD_InitBootPeripherals function | ||
27 | **********************************************************************************************************************/ | ||
28 | void BOARD_InitBootPeripherals(void); | ||
29 | |||
30 | #if defined(__cplusplus) | ||
31 | } | ||
32 | #endif | ||
33 | |||
34 | #endif /* _PERIPHERALS_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/pin_mux.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/pin_mux.c new file mode 100644 index 000000000..0dc94c6ee --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/pin_mux.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright 2019 NXP. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | /*********************************************************************************************************************** | ||
9 | * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file | ||
10 | * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. | ||
11 | **********************************************************************************************************************/ | ||
12 | |||
13 | /* clang-format off */ | ||
14 | /* | ||
15 | * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
16 | !!GlobalInfo | ||
17 | product: Pins v6.0 | ||
18 | processor: LPC54005 | ||
19 | mcu_data: ksdk2_0 | ||
20 | processor_version: 0.0.15 | ||
21 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** | ||
22 | */ | ||
23 | /* clang-format on */ | ||
24 | |||
25 | #include "fsl_common.h" | ||
26 | #include "pin_mux.h" | ||
27 | |||
28 | /* FUNCTION ************************************************************************************************************ | ||
29 | * | ||
30 | * Function Name : BOARD_InitBootPins | ||
31 | * Description : Calls initialization functions. | ||
32 | * | ||
33 | * END ****************************************************************************************************************/ | ||
34 | void BOARD_InitBootPins(void) | ||
35 | { | ||
36 | BOARD_InitPins(); | ||
37 | } | ||
38 | |||
39 | /* clang-format off */ | ||
40 | /* | ||
41 | * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
42 | BOARD_InitPins: | ||
43 | - options: {callFromInitBoot: 'true', enableClock: 'true'} | ||
44 | - pin_list: [] | ||
45 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** | ||
46 | */ | ||
47 | /* clang-format on */ | ||
48 | |||
49 | /* FUNCTION ************************************************************************************************************ | ||
50 | * | ||
51 | * Function Name : BOARD_InitPins | ||
52 | * Description : Configures pin routing and optionally pin electrical features. | ||
53 | * | ||
54 | * END ****************************************************************************************************************/ | ||
55 | /* Function assigned for the Cortex-M4F */ | ||
56 | void BOARD_InitPins(void) | ||
57 | { | ||
58 | } | ||
59 | /*********************************************************************************************************************** | ||
60 | * EOF | ||
61 | **********************************************************************************************************************/ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/pin_mux.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/pin_mux.h new file mode 100644 index 000000000..9b6492aad --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/project_template/pin_mux.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright 2019 NXP. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | /*********************************************************************************************************************** | ||
9 | * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file | ||
10 | * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. | ||
11 | **********************************************************************************************************************/ | ||
12 | |||
13 | #ifndef _PIN_MUX_H_ | ||
14 | #define _PIN_MUX_H_ | ||
15 | |||
16 | /*! | ||
17 | * @addtogroup pin_mux | ||
18 | * @{ | ||
19 | */ | ||
20 | |||
21 | /*********************************************************************************************************************** | ||
22 | * API | ||
23 | **********************************************************************************************************************/ | ||
24 | |||
25 | #if defined(__cplusplus) | ||
26 | extern "C" { | ||
27 | #endif | ||
28 | |||
29 | /*! | ||
30 | * @brief Calls initialization functions. | ||
31 | * | ||
32 | */ | ||
33 | void BOARD_InitBootPins(void); | ||
34 | |||
35 | /*! | ||
36 | * @brief Configures pin routing and optionally pin electrical features. | ||
37 | * | ||
38 | */ | ||
39 | void BOARD_InitPins(void); /* Function assigned for the Cortex-M4F */ | ||
40 | |||
41 | #if defined(__cplusplus) | ||
42 | } | ||
43 | #endif | ||
44 | |||
45 | /*! | ||
46 | * @} | ||
47 | */ | ||
48 | #endif /* _PIN_MUX_H_ */ | ||
49 | |||
50 | /*********************************************************************************************************************** | ||
51 | * EOF | ||
52 | **********************************************************************************************************************/ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/system_LPC54005.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/system_LPC54005.c new file mode 100644 index 000000000..1ac1431a6 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/system_LPC54005.c | |||
@@ -0,0 +1,371 @@ | |||
1 | /* | ||
2 | ** ################################################################### | ||
3 | ** Processors: LPC54005JBD100 | ||
4 | ** LPC54005JET100 | ||
5 | ** | ||
6 | ** Compilers: GNU C Compiler | ||
7 | ** IAR ANSI C/C++ Compiler for ARM | ||
8 | ** Keil ARM C/C++ Compiler | ||
9 | ** MCUXpresso Compiler | ||
10 | ** | ||
11 | ** Reference manual: LPC540xx/LPC54S0xx User manual Rev.0.8 5 June 2018 | ||
12 | ** Version: rev. 1.2, 2017-06-08 | ||
13 | ** Build: b201015 | ||
14 | ** | ||
15 | ** Abstract: | ||
16 | ** Provides a system configuration function and a global variable that | ||
17 | ** contains the system frequency. It configures the device and initializes | ||
18 | ** the oscillator (PLL) that is part of the microcontroller device. | ||
19 | ** | ||
20 | ** Copyright 2016 Freescale Semiconductor, Inc. | ||
21 | ** Copyright 2016-2020 NXP | ||
22 | ** All rights reserved. | ||
23 | ** | ||
24 | ** SPDX-License-Identifier: BSD-3-Clause | ||
25 | ** | ||
26 | ** http: www.nxp.com | ||
27 | ** mail: [email protected] | ||
28 | ** | ||
29 | ** Revisions: | ||
30 | ** - rev. 1.0 (2016-08-12) | ||
31 | ** Initial version. | ||
32 | ** - rev. 1.1 (2016-11-25) | ||
33 | ** Update CANFD and Classic CAN register. | ||
34 | ** Add MAC TIMERSTAMP registers. | ||
35 | ** - rev. 1.2 (2017-06-08) | ||
36 | ** Remove RTC_CTRL_RTC_OSC_BYPASS. | ||
37 | ** SYSCON_ARMTRCLKDIV rename to SYSCON_ARMTRACECLKDIV. | ||
38 | ** Remove RESET and HALT from SYSCON_AHBCLKDIV. | ||
39 | ** | ||
40 | ** ################################################################### | ||
41 | */ | ||
42 | |||
43 | /*! | ||
44 | * @file LPC54005 | ||
45 | * @version 1.2 | ||
46 | * @date 2017-06-08 | ||
47 | * @brief Device specific configuration file for LPC54005 (implementation file) | ||
48 | * | ||
49 | * Provides a system configuration function and a global variable that contains | ||
50 | * the system frequency. It configures the device and initializes the oscillator | ||
51 | * (PLL) that is part of the microcontroller device. | ||
52 | */ | ||
53 | |||
54 | #include <stdint.h> | ||
55 | #include "fsl_device_registers.h" | ||
56 | |||
57 | #define NVALMAX (0x100) | ||
58 | #define PVALMAX (0x20) | ||
59 | #define MVALMAX (0x8000) | ||
60 | #define PLL_MDEC_VAL_P (0) /* MDEC is in bits 16:0 */ | ||
61 | #define PLL_MDEC_VAL_M (0x1FFFFUL << PLL_MDEC_VAL_P) | ||
62 | #define PLL_NDEC_VAL_P (0) /* NDEC is in bits 9:0 */ | ||
63 | #define PLL_NDEC_VAL_M (0x3FFUL << PLL_NDEC_VAL_P) | ||
64 | #define PLL_PDEC_VAL_P (0) /* PDEC is in bits 6:0 */ | ||
65 | #define PLL_PDEC_VAL_M (0x7FUL << PLL_PDEC_VAL_P) | ||
66 | |||
67 | static const uint8_t wdtFreqLookup[32] = {0, 8, 12, 15, 18, 20, 24, 26, 28, 30, 32, 34, 36, 38, 40, 41, | ||
68 | 42, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56, 57, 58, 59, 60, 61}; | ||
69 | /* Get WATCH DOG Clk */ | ||
70 | static uint32_t getWdtOscFreq(void) | ||
71 | { | ||
72 | uint8_t freq_sel, div_sel; | ||
73 | if ((SYSCON->PDRUNCFG[0] & SYSCON_PDRUNCFG_PDEN_WDT_OSC_MASK) != 0UL) | ||
74 | { | ||
75 | return 0U; | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | div_sel = (uint8_t)((SYSCON->WDTOSCCTRL & SYSCON_WDTOSCCTRL_DIVSEL_MASK) + 1UL) << 1UL; | ||
80 | freq_sel = | ||
81 | wdtFreqLookup[((SYSCON->WDTOSCCTRL & SYSCON_WDTOSCCTRL_FREQSEL_MASK) >> SYSCON_WDTOSCCTRL_FREQSEL_SHIFT)]; | ||
82 | return ((uint32_t)freq_sel * 50000U) / ((uint32_t)div_sel); | ||
83 | } | ||
84 | } | ||
85 | /* Find decoded N value for raw NDEC value */ | ||
86 | static uint32_t pllDecodeN(uint32_t NDEC) | ||
87 | { | ||
88 | uint32_t n, x, i; | ||
89 | |||
90 | /* Find NDec */ | ||
91 | switch (NDEC) | ||
92 | { | ||
93 | case 0x3FF: | ||
94 | n = 0UL; | ||
95 | break; | ||
96 | case 0x302: | ||
97 | n = 1UL; | ||
98 | break; | ||
99 | case 0x202: | ||
100 | n = 2UL; | ||
101 | break; | ||
102 | default: | ||
103 | x = 0x080UL; | ||
104 | n = 0xFFFFFFFFUL; | ||
105 | for (i = NVALMAX; i >= 3UL; i--) | ||
106 | { | ||
107 | x = (((x ^ (x >> 2UL) ^ (x >> 3UL) ^ (x >> 4UL)) & 1UL) << 7UL) | ((x >> 1UL) & 0x7FUL); | ||
108 | if ((x & (PLL_NDEC_VAL_M >> PLL_NDEC_VAL_P)) == NDEC) | ||
109 | { | ||
110 | /* Decoded value of NDEC */ | ||
111 | n = i; | ||
112 | } | ||
113 | if (n != 0xFFFFFFFFUL) | ||
114 | { | ||
115 | break; | ||
116 | } | ||
117 | } | ||
118 | break; | ||
119 | } | ||
120 | return n; | ||
121 | } | ||
122 | |||
123 | /* Find decoded P value for raw PDEC value */ | ||
124 | static uint32_t pllDecodeP(uint32_t PDEC) | ||
125 | { | ||
126 | uint32_t p, x, i; | ||
127 | /* Find PDec */ | ||
128 | switch (PDEC) | ||
129 | { | ||
130 | case 0x7F: | ||
131 | p = 0UL; | ||
132 | break; | ||
133 | case 0x62: | ||
134 | p = 1UL; | ||
135 | break; | ||
136 | case 0x42: | ||
137 | p = 2UL; | ||
138 | break; | ||
139 | default: | ||
140 | x = 0x10UL; | ||
141 | p = 0xFFFFFFFFUL; | ||
142 | for (i = PVALMAX; i >= 3UL; i--) | ||
143 | { | ||
144 | x = (((x ^ (x >> 2UL)) & 1UL) << 4UL) | ((x >> 1UL) & 0xFUL); | ||
145 | if ((x & (PLL_PDEC_VAL_M >> PLL_PDEC_VAL_P)) == PDEC) | ||
146 | { | ||
147 | /* Decoded value of PDEC */ | ||
148 | p = i; | ||
149 | } | ||
150 | if (p != 0xFFFFFFFFUL) | ||
151 | { | ||
152 | break; | ||
153 | } | ||
154 | } | ||
155 | break; | ||
156 | } | ||
157 | return p; | ||
158 | } | ||
159 | |||
160 | /* Find decoded M value for raw MDEC value */ | ||
161 | static uint32_t pllDecodeM(uint32_t MDEC) | ||
162 | { | ||
163 | uint32_t m, i, x; | ||
164 | |||
165 | /* Find MDec */ | ||
166 | switch (MDEC) | ||
167 | { | ||
168 | case 0x1FFFF: | ||
169 | m = 0UL; | ||
170 | break; | ||
171 | case 0x18003: | ||
172 | m = 1UL; | ||
173 | break; | ||
174 | case 0x10003: | ||
175 | m = 2UL; | ||
176 | break; | ||
177 | default: | ||
178 | x = 0x04000UL; | ||
179 | m = 0xFFFFFFFFUL; | ||
180 | for (i = MVALMAX; i >= 3UL; i--) | ||
181 | { | ||
182 | x = (((x ^ (x >> 1UL)) & 1UL) << 14UL) | ((x >> 1UL) & 0x3FFFUL); | ||
183 | if ((x & (PLL_MDEC_VAL_M >> PLL_MDEC_VAL_P)) == MDEC) | ||
184 | { | ||
185 | /* Decoded value of MDEC */ | ||
186 | m = i; | ||
187 | } | ||
188 | if (m != 0xFFFFFFFFUL) | ||
189 | { | ||
190 | break; | ||
191 | } | ||
192 | } | ||
193 | break; | ||
194 | } | ||
195 | return m; | ||
196 | } | ||
197 | |||
198 | /* Get predivider (N) from PLL NDEC setting */ | ||
199 | static uint32_t findPllPreDiv(uint32_t ctrlReg, uint32_t nDecReg) | ||
200 | { | ||
201 | uint32_t preDiv = 1; | ||
202 | |||
203 | /* Direct input is not used? */ | ||
204 | if ((ctrlReg & SYSCON_SYSPLLCTRL_DIRECTI_MASK) == 0UL) | ||
205 | { | ||
206 | /* Decode NDEC value to get (N) pre divider */ | ||
207 | preDiv = pllDecodeN(nDecReg & 0x3FFUL); | ||
208 | if (preDiv == 0UL) | ||
209 | { | ||
210 | preDiv = 1; | ||
211 | } | ||
212 | } | ||
213 | /* Adjusted by 1, directi is used to bypass */ | ||
214 | return preDiv; | ||
215 | } | ||
216 | |||
217 | /* Get postdivider (P) from PLL PDEC setting */ | ||
218 | static uint32_t findPllPostDiv(uint32_t ctrlReg, uint32_t pDecReg) | ||
219 | { | ||
220 | uint32_t postDiv = 1; | ||
221 | |||
222 | /* Direct input is not used? */ | ||
223 | if ((ctrlReg & SYSCON_SYSPLLCTRL_DIRECTO_MASK) == 0UL) | ||
224 | { | ||
225 | /* Decode PDEC value to get (P) post divider */ | ||
226 | postDiv = 2UL * pllDecodeP(pDecReg & 0x7FUL); | ||
227 | if (postDiv == 0UL) | ||
228 | { | ||
229 | postDiv = 2; | ||
230 | } | ||
231 | } | ||
232 | /* Adjusted by 1, directo is used to bypass */ | ||
233 | return postDiv; | ||
234 | } | ||
235 | |||
236 | /* Get multiplier (M) from PLL MDEC and BYPASS_FBDIV2 settings */ | ||
237 | static uint32_t findPllMMult(uint32_t ctrlReg, uint32_t mDecReg) | ||
238 | { | ||
239 | uint32_t mMult = 1; | ||
240 | |||
241 | /* Decode MDEC value to get (M) multiplier */ | ||
242 | mMult = pllDecodeM(mDecReg & 0x1FFFFUL); | ||
243 | if (mMult == 0UL) | ||
244 | { | ||
245 | mMult = 1; | ||
246 | } | ||
247 | return mMult; | ||
248 | } | ||
249 | |||
250 | /* ---------------------------------------------------------------------------- | ||
251 | -- Core clock | ||
252 | ---------------------------------------------------------------------------- */ | ||
253 | |||
254 | uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK; | ||
255 | |||
256 | /* ---------------------------------------------------------------------------- | ||
257 | -- SystemInit() | ||
258 | ---------------------------------------------------------------------------- */ | ||
259 | |||
260 | void SystemInit(void) | ||
261 | { | ||
262 | #if ((__FPU_PRESENT == 1) && (__FPU_USED == 1)) | ||
263 | SCB->CPACR |= ((3UL << 10 * 2) | (3UL << 11 * 2)); /* set CP10, CP11 Full Access */ | ||
264 | #endif /* ((__FPU_PRESENT == 1) && (__FPU_USED == 1)) */ | ||
265 | |||
266 | #if defined(__MCUXPRESSO) | ||
267 | extern void (*const g_pfnVectors[])(void); | ||
268 | SCB->VTOR = (uint32_t)&g_pfnVectors; | ||
269 | #else | ||
270 | extern void *__Vectors; | ||
271 | SCB->VTOR = (uint32_t)&__Vectors; | ||
272 | #endif | ||
273 | SYSCON->ARMTRACECLKDIV = 0; | ||
274 | /* Optionally enable RAM banks that may be off by default at reset */ | ||
275 | #if !defined(DONT_ENABLE_DISABLED_RAMBANKS) | ||
276 | SYSCON->AHBCLKCTRLSET[0] = | ||
277 | SYSCON_AHBCLKCTRL_SRAM1_MASK | SYSCON_AHBCLKCTRL_SRAM2_MASK | SYSCON_AHBCLKCTRL_SRAM3_MASK; | ||
278 | |||
279 | #endif | ||
280 | SYSCON->MAINCLKSELA = 0U; | ||
281 | SYSCON->MAINCLKSELB = 0U; | ||
282 | SystemInitHook(); | ||
283 | } | ||
284 | |||
285 | /* ---------------------------------------------------------------------------- | ||
286 | -- SystemCoreClockUpdate() | ||
287 | ---------------------------------------------------------------------------- */ | ||
288 | |||
289 | void SystemCoreClockUpdate(void) | ||
290 | { | ||
291 | uint32_t clkRate = 0; | ||
292 | uint32_t prediv, postdiv; | ||
293 | uint64_t workRate; | ||
294 | |||
295 | switch (SYSCON->MAINCLKSELB & SYSCON_MAINCLKSELB_SEL_MASK) | ||
296 | { | ||
297 | case 0x00: /* MAINCLKSELA clock (main_clk_a)*/ | ||
298 | switch (SYSCON->MAINCLKSELA & SYSCON_MAINCLKSELA_SEL_MASK) | ||
299 | { | ||
300 | case 0x00: /* FRO 12 MHz (fro_12m) */ | ||
301 | clkRate = CLK_FRO_12MHZ; | ||
302 | break; | ||
303 | case 0x01: /* CLKIN Source (clk_in) */ | ||
304 | clkRate = CLK_CLK_IN; | ||
305 | break; | ||
306 | case 0x02: /* Watchdog oscillator (wdt_clk) */ | ||
307 | clkRate = getWdtOscFreq(); | ||
308 | break; | ||
309 | default: /* = 0x03 = FRO 96 or 48 MHz (fro_hf) */ | ||
310 | if ((SYSCON->FROCTRL & SYSCON_FROCTRL_SEL_MASK) == SYSCON_FROCTRL_SEL_MASK) | ||
311 | { | ||
312 | clkRate = CLK_FRO_96MHZ; | ||
313 | } | ||
314 | else | ||
315 | { | ||
316 | clkRate = CLK_FRO_48MHZ; | ||
317 | } | ||
318 | break; | ||
319 | } | ||
320 | break; | ||
321 | case 0x02: /* System PLL clock (pll_clk)*/ | ||
322 | switch (SYSCON->SYSPLLCLKSEL & SYSCON_SYSPLLCLKSEL_SEL_MASK) | ||
323 | { | ||
324 | case 0x00: /* FRO 12 MHz (fro_12m) */ | ||
325 | clkRate = CLK_FRO_12MHZ; | ||
326 | break; | ||
327 | case 0x01: /* CLKIN Source (clk_in) */ | ||
328 | clkRate = CLK_CLK_IN; | ||
329 | break; | ||
330 | case 0x02: /* Watchdog oscillator (wdt_clk) */ | ||
331 | clkRate = getWdtOscFreq(); | ||
332 | break; | ||
333 | case 0x03: /* RTC oscillator 32 kHz output (32k_clk) */ | ||
334 | clkRate = CLK_RTC_32K_CLK; | ||
335 | break; | ||
336 | default: | ||
337 | clkRate = 0UL; | ||
338 | break; | ||
339 | } | ||
340 | if ((SYSCON->SYSPLLCTRL & SYSCON_SYSPLLCTRL_BYPASS_MASK) == 0UL) | ||
341 | { | ||
342 | /* PLL is not in bypass mode, get pre-divider, post-divider, and M divider */ | ||
343 | prediv = findPllPreDiv(SYSCON->SYSPLLCTRL, SYSCON->SYSPLLNDEC); | ||
344 | postdiv = findPllPostDiv(SYSCON->SYSPLLCTRL, SYSCON->SYSPLLPDEC); | ||
345 | /* Adjust input clock */ | ||
346 | clkRate = clkRate / prediv; | ||
347 | |||
348 | /* MDEC used for rate */ | ||
349 | workRate = (uint64_t)(clkRate) * (uint64_t)findPllMMult(SYSCON->SYSPLLCTRL, SYSCON->SYSPLLMDEC); | ||
350 | clkRate = (uint32_t)(workRate / ((uint64_t)postdiv)); | ||
351 | clkRate = clkRate * 2UL; /* PLL CCO output is divided by 2 before to M-Divider */ | ||
352 | } | ||
353 | break; | ||
354 | case 0x03: /* RTC oscillator 32 kHz output (32k_clk) */ | ||
355 | clkRate = CLK_RTC_32K_CLK; | ||
356 | break; | ||
357 | default: | ||
358 | clkRate = 0UL; | ||
359 | break; | ||
360 | } | ||
361 | SystemCoreClock = clkRate / ((SYSCON->AHBCLKDIV & 0xFFUL) + 1UL); | ||
362 | } | ||
363 | |||
364 | /* ---------------------------------------------------------------------------- | ||
365 | -- SystemInitHook() | ||
366 | ---------------------------------------------------------------------------- */ | ||
367 | |||
368 | __attribute__((weak)) void SystemInitHook(void) | ||
369 | { | ||
370 | /* Void implementation of the weak function. */ | ||
371 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/system_LPC54005.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/system_LPC54005.h new file mode 100644 index 000000000..67a840cdb --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/system_LPC54005.h | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | ** ################################################################### | ||
3 | ** Processors: LPC54005JBD100 | ||
4 | ** LPC54005JET100 | ||
5 | ** | ||
6 | ** Compilers: GNU C Compiler | ||
7 | ** IAR ANSI C/C++ Compiler for ARM | ||
8 | ** Keil ARM C/C++ Compiler | ||
9 | ** MCUXpresso Compiler | ||
10 | ** | ||
11 | ** Reference manual: LPC540xx/LPC54S0xx User manual Rev.0.8 5 June 2018 | ||
12 | ** Version: rev. 1.2, 2017-06-08 | ||
13 | ** Build: b201015 | ||
14 | ** | ||
15 | ** Abstract: | ||
16 | ** Provides a system configuration function and a global variable that | ||
17 | ** contains the system frequency. It configures the device and initializes | ||
18 | ** the oscillator (PLL) that is part of the microcontroller device. | ||
19 | ** | ||
20 | ** Copyright 2016 Freescale Semiconductor, Inc. | ||
21 | ** Copyright 2016-2020 NXP | ||
22 | ** All rights reserved. | ||
23 | ** | ||
24 | ** SPDX-License-Identifier: BSD-3-Clause | ||
25 | ** | ||
26 | ** http: www.nxp.com | ||
27 | ** mail: [email protected] | ||
28 | ** | ||
29 | ** Revisions: | ||
30 | ** - rev. 1.0 (2016-08-12) | ||
31 | ** Initial version. | ||
32 | ** - rev. 1.1 (2016-11-25) | ||
33 | ** Update CANFD and Classic CAN register. | ||
34 | ** Add MAC TIMERSTAMP registers. | ||
35 | ** - rev. 1.2 (2017-06-08) | ||
36 | ** Remove RTC_CTRL_RTC_OSC_BYPASS. | ||
37 | ** SYSCON_ARMTRCLKDIV rename to SYSCON_ARMTRACECLKDIV. | ||
38 | ** Remove RESET and HALT from SYSCON_AHBCLKDIV. | ||
39 | ** | ||
40 | ** ################################################################### | ||
41 | */ | ||
42 | |||
43 | /*! | ||
44 | * @file LPC54005 | ||
45 | * @version 1.2 | ||
46 | * @date 2017-06-08 | ||
47 | * @brief Device specific configuration file for LPC54005 (header file) | ||
48 | * | ||
49 | * Provides a system configuration function and a global variable that contains | ||
50 | * the system frequency. It configures the device and initializes the oscillator | ||
51 | * (PLL) that is part of the microcontroller device. | ||
52 | */ | ||
53 | |||
54 | #ifndef _SYSTEM_LPC54005_H_ | ||
55 | #define _SYSTEM_LPC54005_H_ /**< Symbol preventing repeated inclusion */ | ||
56 | |||
57 | #ifdef __cplusplus | ||
58 | extern "C" { | ||
59 | #endif | ||
60 | |||
61 | #include <stdint.h> | ||
62 | |||
63 | #define DEFAULT_SYSTEM_CLOCK 12000000u /* Default System clock value */ | ||
64 | #define CLK_RTC_32K_CLK 32768u /* RTC oscillator 32 kHz output (32k_clk */ | ||
65 | #define CLK_FRO_12MHZ 12000000u /* FRO 12 MHz (fro_12m) */ | ||
66 | #define CLK_FRO_48MHZ 48000000u /* FRO 48 MHz (fro_48m) */ | ||
67 | #define CLK_FRO_96MHZ 96000000u /* FRO 96 MHz (fro_96m) */ | ||
68 | #define CLK_CLK_IN 0u /* Default CLK_IN pin clock */ | ||
69 | |||
70 | /** | ||
71 | * @brief System clock frequency (core clock) | ||
72 | * | ||
73 | * The system clock frequency supplied to the SysTick timer and the processor | ||
74 | * core clock. This variable can be used by the user application to setup the | ||
75 | * SysTick timer or configure other parameters. It may also be used by debugger to | ||
76 | * query the frequency of the debug timer or configure the trace clock speed | ||
77 | * SystemCoreClock is initialized with a correct predefined value. | ||
78 | */ | ||
79 | extern uint32_t SystemCoreClock; | ||
80 | |||
81 | /** | ||
82 | * @brief Setup the microcontroller system. | ||
83 | * | ||
84 | * Typically this function configures the oscillator (PLL) that is part of the | ||
85 | * microcontroller device. For systems with variable clock speed it also updates | ||
86 | * the variable SystemCoreClock. SystemInit is called from startup_device file. | ||
87 | */ | ||
88 | void SystemInit(void); | ||
89 | |||
90 | /** | ||
91 | * @brief Updates the SystemCoreClock variable. | ||
92 | * | ||
93 | * It must be called whenever the core clock is changed during program | ||
94 | * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates | ||
95 | * the current core clock. | ||
96 | */ | ||
97 | void SystemCoreClockUpdate(void); | ||
98 | |||
99 | /** | ||
100 | * @brief SystemInit function hook. | ||
101 | * | ||
102 | * This weak function allows to call specific initialization code during the | ||
103 | * SystemInit() execution.This can be used when an application specific code needs | ||
104 | * to be called as close to the reset entry as possible (for example the Multicore | ||
105 | * Manager MCMGR_EarlyInit() function call). | ||
106 | * NOTE: No global r/w variables can be used in this hook function because the | ||
107 | * initialization of these variables happens after this function. | ||
108 | */ | ||
109 | void SystemInitHook(void); | ||
110 | |||
111 | #ifdef __cplusplus | ||
112 | } | ||
113 | #endif | ||
114 | |||
115 | #endif /* _SYSTEM_LPC54005_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/template/RTE_Device.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/template/RTE_Device.h new file mode 100644 index 000000000..acec606cc --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/template/RTE_Device.h | |||
@@ -0,0 +1,281 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2020 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _RTE_DEVICE_H | ||
10 | #define _RTE_DEVICE_H | ||
11 | |||
12 | #include "pin_mux.h" | ||
13 | |||
14 | /* UART Select, UART0-UART9. */ | ||
15 | /* User needs to provide the implementation of USARTX_GetFreq/USARTX_InitPins/USARTX_DeinitPins for the enabled USART | ||
16 | * instance. */ | ||
17 | #define RTE_USART0 0 | ||
18 | #define RTE_USART0_DMA_EN 0 | ||
19 | #define RTE_USART1 0 | ||
20 | #define RTE_USART1_DMA_EN 0 | ||
21 | #define RTE_USART2 0 | ||
22 | #define RTE_USART2_DMA_EN 0 | ||
23 | #define RTE_USART3 0 | ||
24 | #define RTE_USART3_DMA_EN 0 | ||
25 | #define RTE_USART4 0 | ||
26 | #define RTE_USART4_DMA_EN 0 | ||
27 | #define RTE_USART5 0 | ||
28 | #define RTE_USART5_DMA_EN 0 | ||
29 | #define RTE_USART6 0 | ||
30 | #define RTE_USART6_DMA_EN 0 | ||
31 | #define RTE_USART7 0 | ||
32 | #define RTE_USART7_DMA_EN 0 | ||
33 | #define RTE_USART8 0 | ||
34 | #define RTE_USART8_DMA_EN 0 | ||
35 | #define RTE_USART9 0 | ||
36 | #define RTE_USART9_DMA_EN 0 | ||
37 | |||
38 | /* USART configuration. */ | ||
39 | #define USART_RX_BUFFER_LEN 64 | ||
40 | #define USART0_RX_BUFFER_ENABLE 0 | ||
41 | #define USART1_RX_BUFFER_ENABLE 0 | ||
42 | #define USART2_RX_BUFFER_ENABLE 0 | ||
43 | #define USART3_RX_BUFFER_ENABLE 0 | ||
44 | #define USART4_RX_BUFFER_ENABLE 0 | ||
45 | #define USART5_RX_BUFFER_ENABLE 0 | ||
46 | #define USART6_RX_BUFFER_ENABLE 0 | ||
47 | #define USART7_RX_BUFFER_ENABLE 0 | ||
48 | #define USART8_RX_BUFFER_ENABLE 0 | ||
49 | #define USART9_RX_BUFFER_ENABLE 0 | ||
50 | |||
51 | #define RTE_USART0_PIN_INIT USART0_InitPins | ||
52 | #define RTE_USART0_PIN_DEINIT USART0_DeinitPins | ||
53 | #define RTE_USART0_DMA_TX_CH 1 | ||
54 | #define RTE_USART0_DMA_TX_DMA_BASE DMA0 | ||
55 | #define RTE_USART0_DMA_RX_CH 0 | ||
56 | #define RTE_USART0_DMA_RX_DMA_BASE DMA0 | ||
57 | |||
58 | #define RTE_USART1_PIN_INIT USART1_InitPins | ||
59 | #define RTE_USART1_PIN_DEINIT USART1_DeinitPins | ||
60 | #define RTE_USART1_DMA_TX_CH 3 | ||
61 | #define RTE_USART1_DMA_TX_DMA_BASE DMA0 | ||
62 | #define RTE_USART1_DMA_RX_CH 2 | ||
63 | #define RTE_USART1_DMA_RX_DMA_BASE DMA0 | ||
64 | |||
65 | #define RTE_USART2_PIN_INIT USART2_InitPins | ||
66 | #define RTE_USART2_PIN_DEINIT USART2_DeinitPins | ||
67 | #define RTE_USART2_DMA_TX_CH 5 | ||
68 | #define RTE_USART2_DMA_TX_DMA_BASE DMA0 | ||
69 | #define RTE_USART2_DMA_RX_CH 4 | ||
70 | #define RTE_USART2_DMA_RX_DMA_BASE DMA0 | ||
71 | |||
72 | #define RTE_USART3_PIN_INIT USART3_InitPins | ||
73 | #define RTE_USART3_PIN_DEINIT USART3_DeinitPins | ||
74 | #define RTE_USART3_DMA_TX_CH 7 | ||
75 | #define RTE_USART3_DMA_TX_DMA_BASE DMA0 | ||
76 | #define RTE_USART3_DMA_RX_CH 6 | ||
77 | #define RTE_USART3_DMA_RX_DMA_BASE DMA0 | ||
78 | |||
79 | #define RTE_USART4_PIN_INIT USART4_InitPins | ||
80 | #define RTE_USART4_PIN_DEINIT USART4_DeinitPins | ||
81 | #define RTE_USART4_DMA_TX_CH 9 | ||
82 | #define RTE_USART4_DMA_TX_DMA_BASE DMA0 | ||
83 | #define RTE_USART4_DMA_RX_CH 8 | ||
84 | #define RTE_USART4_DMA_RX_DMA_BASE DMA0 | ||
85 | |||
86 | #define RTE_USART5_PIN_INIT USART5_InitPins | ||
87 | #define RTE_USART5_PIN_DEINIT USART5_DeinitPins | ||
88 | #define RTE_USART5_DMA_TX_CH 11 | ||
89 | #define RTE_USART5_DMA_TX_DMA_BASE DMA0 | ||
90 | #define RTE_USART5_DMA_RX_CH 10 | ||
91 | #define RTE_USART5_DMA_RX_DMA_BASE DMA0 | ||
92 | |||
93 | #define RTE_USART6_PIN_INIT USART6_InitPins | ||
94 | #define RTE_USART6_PIN_DEINIT USART6_DeinitPins | ||
95 | #define RTE_USART6_DMA_TX_CH 13 | ||
96 | #define RTE_USART6_DMA_TX_DMA_BASE DMA0 | ||
97 | #define RTE_USART6_DMA_RX_CH 12 | ||
98 | #define RTE_USART6_DMA_RX_DMA_BASE DMA0 | ||
99 | |||
100 | #define RTE_USART7_PIN_INIT USART7_InitPins | ||
101 | #define RTE_USART7_PIN_DEINIT USART7_DeinitPins | ||
102 | #define RTE_USART7_DMA_TX_CH 15 | ||
103 | #define RTE_USART7_DMA_TX_DMA_BASE DMA0 | ||
104 | #define RTE_USART7_DMA_RX_CH 14 | ||
105 | #define RTE_USART7_DMA_RX_DMA_BASE DMA0 | ||
106 | |||
107 | #define RTE_USART8_PIN_INIT USART8_InitPins | ||
108 | #define RTE_USART8_PIN_DEINIT USART8_DeinitPins | ||
109 | #define RTE_USART8_DMA_TX_CH 17 | ||
110 | #define RTE_USART8_DMA_TX_DMA_BASE DMA0 | ||
111 | #define RTE_USART8_DMA_RX_CH 16 | ||
112 | #define RTE_USART8_DMA_RX_DMA_BASE DMA0 | ||
113 | |||
114 | #define RTE_USART9_PIN_INIT USART9_InitPins | ||
115 | #define RTE_USART9_PIN_DEINIT USART9_DeinitPins | ||
116 | #define RTE_USART9_DMA_TX_CH 19 | ||
117 | #define RTE_USART9_DMA_TX_DMA_BASE DMA0 | ||
118 | #define RTE_USART9_DMA_RX_CH 18 | ||
119 | #define RTE_USART9_DMA_RX_DMA_BASE DMA0 | ||
120 | |||
121 | /* I2C Select, I2C0 -I2C9*/ | ||
122 | /* User needs to provide the implementation of I2CX_GetFreq/I2CX_InitPins/I2CX_DeinitPins for the enabled I2C instance. | ||
123 | */ | ||
124 | #define RTE_I2C0 0 | ||
125 | #define RTE_I2C0_DMA_EN 0 | ||
126 | #define RTE_I2C1 0 | ||
127 | #define RTE_I2C1_DMA_EN 0 | ||
128 | #define RTE_I2C2 0 | ||
129 | #define RTE_I2C2_DMA_EN 0 | ||
130 | #define RTE_I2C3 0 | ||
131 | #define RTE_I2C3_DMA_EN 0 | ||
132 | #define RTE_I2C4 0 | ||
133 | #define RTE_I2C4_DMA_EN 0 | ||
134 | #define RTE_I2C5 0 | ||
135 | #define RTE_I2C5_DMA_EN 0 | ||
136 | #define RTE_I2C6 0 | ||
137 | #define RTE_I2C6_DMA_EN 0 | ||
138 | #define RTE_I2C7 0 | ||
139 | #define RTE_I2C7_DMA_EN 0 | ||
140 | #define RTE_I2C8 0 | ||
141 | #define RTE_I2C8_DMA_EN 0 | ||
142 | #define RTE_I2C9 0 | ||
143 | #define RTE_I2C9_DMA_EN 0 | ||
144 | |||
145 | /*I2C configuration*/ | ||
146 | #define RTE_I2C0_Master_DMA_BASE DMA0 | ||
147 | #define RTE_I2C0_Master_DMA_CH 1 | ||
148 | |||
149 | #define RTE_I2C1_Master_DMA_BASE DMA0 | ||
150 | #define RTE_I2C1_Master_DMA_CH 3 | ||
151 | |||
152 | #define RTE_I2C2_Master_DMA_BASE DMA0 | ||
153 | #define RTE_I2C2_Master_DMA_CH 5 | ||
154 | |||
155 | #define RTE_I2C3_Master_DMA_BASE DMA0 | ||
156 | #define RTE_I2C3_Master_DMA_CH 7 | ||
157 | |||
158 | #define RTE_I2C4_Master_DMA_BASE DMA0 | ||
159 | #define RTE_I2C4_Master_DMA_CH 9 | ||
160 | |||
161 | #define RTE_I2C5_Master_DMA_BASE DMA0 | ||
162 | #define RTE_I2C5_Master_DMA_CH 11 | ||
163 | |||
164 | #define RTE_I2C6_Master_DMA_BASE DMA0 | ||
165 | #define RTE_I2C6_Master_DMA_CH 13 | ||
166 | |||
167 | #define RTE_I2C7_Master_DMA_BASE DMA0 | ||
168 | #define RTE_I2C7_Master_DMA_CH 15 | ||
169 | |||
170 | #define RTE_I2C8_Master_DMA_BASE DMA0 | ||
171 | #define RTE_I2C8_Master_DMA_CH 17 | ||
172 | |||
173 | #define RTE_I2C9_Master_DMA_BASE DMA0 | ||
174 | #define RTE_I2C9_Master_DMA_CH 19 | ||
175 | |||
176 | /* SPI select, SPI0 - SPI9.*/ | ||
177 | /* User needs to provide the implementation of SPIX_GetFreq/SPIX_InitPins/SPIX_DeinitPins for the enabled SPI instance. | ||
178 | */ | ||
179 | #define RTE_SPI0 0 | ||
180 | #define RTE_SPI0_DMA_EN 0 | ||
181 | #define RTE_SPI1 0 | ||
182 | #define RTE_SPI1_DMA_EN 0 | ||
183 | #define RTE_SPI2 0 | ||
184 | #define RTE_SPI2_DMA_EN 0 | ||
185 | #define RTE_SPI3 0 | ||
186 | #define RTE_SPI3_DMA_EN 0 | ||
187 | #define RTE_SPI4 0 | ||
188 | #define RTE_SPI4_DMA_EN 0 | ||
189 | #define RTE_SPI5 0 | ||
190 | #define RTE_SPI5_DMA_EN 0 | ||
191 | #define RTE_SPI6 0 | ||
192 | #define RTE_SPI6_DMA_EN 0 | ||
193 | #define RTE_SPI7 0 | ||
194 | #define RTE_SPI7_DMA_EN 0 | ||
195 | #define RTE_SPI8 0 | ||
196 | #define RTE_SPI8_DMA_EN 0 | ||
197 | #define RTE_SPI9 0 | ||
198 | #define RTE_SPI9_DMA_EN 0 | ||
199 | |||
200 | /* SPI configuration. */ | ||
201 | #define RTE_SPI0_SSEL_NUM kSPI_Ssel0 | ||
202 | #define RTE_SPI0_PIN_INIT SPI0_InitPins | ||
203 | #define RTE_SPI0_PIN_DEINIT SPI0_DeinitPins | ||
204 | #define RTE_SPI0_DMA_TX_CH 1 | ||
205 | #define RTE_SPI0_DMA_TX_DMA_BASE DMA0 | ||
206 | #define RTE_SPI0_DMA_RX_CH 0 | ||
207 | #define RTE_SPI0_DMA_RX_DMA_BASE DMA0 | ||
208 | |||
209 | #define RTE_SPI1_SSEL_NUM kSPI_Ssel0 | ||
210 | #define RTE_SPI1_PIN_INIT SPI1_InitPins | ||
211 | #define RTE_SPI1_PIN_DEINIT SPI1_DeinitPins | ||
212 | #define RTE_SPI1_DMA_TX_CH 3 | ||
213 | #define RTE_SPI1_DMA_TX_DMA_BASE DMA0 | ||
214 | #define RTE_SPI1_DMA_RX_CH 2 | ||
215 | #define RTE_SPI1_DMA_RX_DMA_BASE DMA0 | ||
216 | |||
217 | #define RTE_SPI2_SSEL_NUM kSPI_Ssel0 | ||
218 | #define RTE_SPI2_PIN_INIT SPI2_InitPins | ||
219 | #define RTE_SPI2_PIN_DEINIT SPI2_DeinitPins | ||
220 | #define RTE_SPI2_DMA_TX_CH 5 | ||
221 | #define RTE_SPI2_DMA_TX_DMA_BASE DMA0 | ||
222 | #define RTE_SPI2_DMA_RX_CH 4 | ||
223 | #define RTE_SPI2_DMA_RX_DMA_BASE DMA0 | ||
224 | |||
225 | #define RTE_SPI3_SSEL_NUM kSPI_Ssel0 | ||
226 | #define RTE_SPI3_PIN_INIT SPI3_InitPins | ||
227 | #define RTE_SPI3_PIN_DEINIT SPI3_DeinitPins | ||
228 | #define RTE_SPI3_DMA_TX_CH 7 | ||
229 | #define RTE_SPI3_DMA_TX_DMA_BASE DMA0 | ||
230 | #define RTE_SPI3_DMA_RX_CH 6 | ||
231 | #define RTE_SPI3_DMA_RX_DMA_BASE DMA0 | ||
232 | |||
233 | #define RTE_SPI4_SSEL_NUM kSPI_Ssel0 | ||
234 | #define RTE_SPI4_PIN_INIT SPI4_InitPins | ||
235 | #define RTE_SPI4_PIN_DEINIT SPI4_DeinitPins | ||
236 | #define RTE_SPI4_DMA_TX_CH 9 | ||
237 | #define RTE_SPI4_DMA_TX_DMA_BASE DMA0 | ||
238 | #define RTE_SPI4_DMA_RX_CH 8 | ||
239 | #define RTE_SPI4_DMA_RX_DMA_BASE DMA0 | ||
240 | |||
241 | #define RTE_SPI5_SSEL_NUM kSPI_Ssel0 | ||
242 | #define RTE_SPI5_PIN_INIT SPI5_InitPins | ||
243 | #define RTE_SPI5_PIN_DEINIT SPI5_DeinitPins | ||
244 | #define RTE_SPI5_DMA_TX_CH 11 | ||
245 | #define RTE_SPI5_DMA_TX_DMA_BASE DMA0 | ||
246 | #define RTE_SPI5_DMA_RX_CH 10 | ||
247 | #define RTE_SPI5_DMA_RX_DMA_BASE DMA0 | ||
248 | |||
249 | #define RTE_SPI6_SSEL_NUM kSPI_Ssel0 | ||
250 | #define RTE_SPI6_PIN_INIT SPI6_InitPins | ||
251 | #define RTE_SPI6_PIN_DEINIT SPI6_DeinitPins | ||
252 | #define RTE_SPI6_DMA_TX_CH 13 | ||
253 | #define RTE_SPI6_DMA_TX_DMA_BASE DMA0 | ||
254 | #define RTE_SPI6_DMA_RX_CH 12 | ||
255 | #define RTE_SPI6_DMA_RX_DMA_BASE DMA0 | ||
256 | |||
257 | #define RTE_SPI7_SSEL_NUM kSPI_Ssel0 | ||
258 | #define RTE_SPI7_PIN_INIT SPI7_InitPins | ||
259 | #define RTE_SPI7_PIN_DEINIT SPI7_DeinitPins | ||
260 | #define RTE_SPI7_DMA_TX_CH 15 | ||
261 | #define RTE_SPI7_DMA_TX_DMA_BASE DMA0 | ||
262 | #define RTE_SPI7_DMA_RX_CH 14 | ||
263 | #define RTE_SPI7_DMA_RX_DMA_BASE DMA0 | ||
264 | |||
265 | #define RTE_SPI8_SSEL_NUM kSPI_Ssel0 | ||
266 | #define RTE_SPI8_PIN_INIT SPI8_InitPins | ||
267 | #define RTE_SPI8_PIN_DEINIT SPI8_DeinitPins | ||
268 | #define RTE_SPI8_DMA_TX_CH 17 | ||
269 | #define RTE_SPI8_DMA_TX_DMA_BASE DMA0 | ||
270 | #define RTE_SPI8_DMA_RX_CH 16 | ||
271 | #define RTE_SPI8_DMA_RX_DMA_BASE DMA0 | ||
272 | |||
273 | #define RTE_SPI9_SSEL_NUM kSPI_Ssel0 | ||
274 | #define RTE_SPI9_PIN_INIT SPI9_InitPins | ||
275 | #define RTE_SPI9_PIN_DEINIT SPI9_DeinitPins | ||
276 | #define RTE_SPI9_DMA_TX_CH 23 | ||
277 | #define RTE_SPI9_DMA_TX_DMA_BASE DMA0 | ||
278 | #define RTE_SPI9_DMA_RX_CH 22 | ||
279 | #define RTE_SPI9_DMA_RX_DMA_BASE DMA0 | ||
280 | |||
281 | #endif /* _RTE_DEVICE_H */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_notifier.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_notifier.c new file mode 100644 index 000000000..7b7c02dc3 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_notifier.c | |||
@@ -0,0 +1,209 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2017 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #include "fsl_notifier.h" | ||
10 | |||
11 | /******************************************************************************* | ||
12 | * Definitions | ||
13 | ******************************************************************************/ | ||
14 | |||
15 | /******************************************************************************* | ||
16 | * Prototypes | ||
17 | ******************************************************************************/ | ||
18 | |||
19 | /******************************************************************************* | ||
20 | * Variables | ||
21 | ******************************************************************************/ | ||
22 | |||
23 | /******************************************************************************* | ||
24 | * Code | ||
25 | ******************************************************************************/ | ||
26 | |||
27 | /*! | ||
28 | * brief Creates a Notifier handle. | ||
29 | * | ||
30 | * param notifierHandle A pointer to the notifier handle. | ||
31 | * param configs A pointer to an array with references to all configurations which is handled by the Notifier. | ||
32 | * param configsNumber Number of configurations. Size of the configuration array. | ||
33 | * param callbacks A pointer to an array of callback configurations. | ||
34 | * If there are no callbacks to register during Notifier initialization, use NULL value. | ||
35 | * param callbacksNumber Number of registered callbacks. Size of the callbacks array. | ||
36 | * param userFunction User function. | ||
37 | * param userData User data passed to user function. | ||
38 | * return An error Code or kStatus_Success. | ||
39 | */ | ||
40 | status_t NOTIFIER_CreateHandle(notifier_handle_t *notifierHandle, | ||
41 | notifier_user_config_t **configs, | ||
42 | uint8_t configsNumber, | ||
43 | notifier_callback_config_t *callbacks, | ||
44 | uint8_t callbacksNumber, | ||
45 | notifier_user_function_t userFunction, | ||
46 | void *userData) | ||
47 | { | ||
48 | /* Check input parameter - at least one configuration is required and userFunction must exist */ | ||
49 | if ((configs == NULL) || (configsNumber == 0U) || (userFunction == NULL)) | ||
50 | { | ||
51 | return kStatus_Fail; | ||
52 | } | ||
53 | /* Initialize handle structure */ | ||
54 | (void)memset(notifierHandle, 0, sizeof(notifier_handle_t)); | ||
55 | /* Store references to user-defined configurations */ | ||
56 | notifierHandle->configsTable = configs; | ||
57 | notifierHandle->configsNumber = configsNumber; | ||
58 | /* Store references to user-defined callback configurations */ | ||
59 | if (callbacks != NULL) | ||
60 | { | ||
61 | notifierHandle->callbacksTable = callbacks; | ||
62 | notifierHandle->callbacksNumber = callbacksNumber; | ||
63 | /* If all callbacks return success, then the errorCallbackIndex is callbacksNumber */ | ||
64 | notifierHandle->errorCallbackIndex = callbacksNumber; | ||
65 | } | ||
66 | notifierHandle->userFunction = userFunction; | ||
67 | notifierHandle->userData = userData; | ||
68 | |||
69 | return kStatus_Success; | ||
70 | } | ||
71 | |||
72 | /*! | ||
73 | * brief Switches the configuration according to a pre-defined structure. | ||
74 | * | ||
75 | * This function sets the system to the target configuration. Before transition, | ||
76 | * the Notifier sends notifications to all callbacks registered to the callback table. | ||
77 | * Callbacks are invoked in the following order: All registered callbacks are notified | ||
78 | * ordered by index in the callbacks array. The same order is used for before and after switch notifications. | ||
79 | * The notifications before the configuration switch can be used to obtain confirmation about | ||
80 | * the change from registered callbacks. If any registered callback denies the | ||
81 | * configuration change, further execution of this function depends on the notifier policy: the | ||
82 | * configuration change is either forced (kNOTIFIER_PolicyForcible) or exited (kNOTIFIER_PolicyAgreement). | ||
83 | * When configuration change is forced, the result of the before switch notifications are ignored. If an | ||
84 | * agreement is required, if any callback returns an error code, further notifications | ||
85 | * before switch notifications are cancelled and all already notified callbacks are re-invoked. | ||
86 | * The index of the callback which returned error code during pre-switch notifications is stored | ||
87 | * (any error codes during callbacks re-invocation are ignored) and NOTIFIER_GetErrorCallback() can be used to get it. | ||
88 | * Regardless of the policies, if any callback returns an error code, an error code indicating in which phase | ||
89 | * the error occurred is returned when NOTIFIER_SwitchConfig() exits. | ||
90 | * param notifierHandle pointer to notifier handle | ||
91 | * param configIndex Index of the target configuration. | ||
92 | * param policy Transaction policy, kNOTIFIER_PolicyAgreement or kNOTIFIER_PolicyForcible. | ||
93 | * | ||
94 | * return An error code or kStatus_Success. | ||
95 | * | ||
96 | */ | ||
97 | status_t NOTIFIER_SwitchConfig(notifier_handle_t *notifierHandle, uint8_t configIndex, notifier_policy_t policy) | ||
98 | { | ||
99 | uint8_t currentStaticCallback = 0U; /* Index to array of statically registered call-backs */ | ||
100 | status_t returnCode = kStatus_Success; /* Function return */ | ||
101 | |||
102 | notifier_notification_block_t notifyBlock; /* Callback notification block */ | ||
103 | notifier_callback_config_t *callbackConfig; /* Pointer to callback configuration */ | ||
104 | |||
105 | /* Set errorcallbackindex as callbacksNumber, which means no callback error now */ | ||
106 | notifierHandle->errorCallbackIndex = notifierHandle->callbacksNumber; | ||
107 | |||
108 | /* Requested configuration availability check */ | ||
109 | if (configIndex >= notifierHandle->configsNumber) | ||
110 | { | ||
111 | return kStatus_OutOfRange; | ||
112 | } | ||
113 | |||
114 | /* Initialization of local variables from the Notifier handle structure */ | ||
115 | |||
116 | notifyBlock.policy = policy; | ||
117 | notifyBlock.targetConfig = notifierHandle->configsTable[configIndex]; | ||
118 | notifyBlock.notifyType = kNOTIFIER_NotifyBefore; | ||
119 | |||
120 | /* From all statically registered call-backs... */ | ||
121 | for (currentStaticCallback = 0U; currentStaticCallback < notifierHandle->callbacksNumber; currentStaticCallback++) | ||
122 | { | ||
123 | callbackConfig = &(notifierHandle->callbacksTable[currentStaticCallback]); | ||
124 | /* ...notify only those which asked to be called before the configuration switch */ | ||
125 | if (((uint32_t)callbackConfig->callbackType & (uint32_t)kNOTIFIER_CallbackBefore) != 0U) | ||
126 | { | ||
127 | /* In case that call-back returned error code mark it, store the call-back handle and eventually cancel | ||
128 | * the configuration switch */ | ||
129 | if (callbackConfig->callback(¬ifyBlock, callbackConfig->callbackData) != kStatus_Success) | ||
130 | { | ||
131 | returnCode = (status_t)kStatus_NOTIFIER_ErrorNotificationBefore; | ||
132 | notifierHandle->errorCallbackIndex = currentStaticCallback; | ||
133 | /* If not forcing configuration switch, call all already notified call-backs to revert their state | ||
134 | * as the switch is canceled */ | ||
135 | if (policy != kNOTIFIER_PolicyForcible) | ||
136 | { | ||
137 | break; | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | } | ||
142 | |||
143 | /* Set configuration */ | ||
144 | |||
145 | /* In case that any call-back returned error code and policy doesn't force the configuration set, go to after | ||
146 | * switch call-backs */ | ||
147 | if ((policy == kNOTIFIER_PolicyForcible) || (returnCode == kStatus_Success)) | ||
148 | { | ||
149 | returnCode = notifierHandle->userFunction(notifierHandle->configsTable[configIndex], notifierHandle->userData); | ||
150 | if (returnCode != kStatus_Success) | ||
151 | { | ||
152 | return returnCode; | ||
153 | } | ||
154 | /* Update current configuration index */ | ||
155 | notifierHandle->currentConfigIndex = configIndex; | ||
156 | notifyBlock.notifyType = kNOTIFIER_NotifyAfter; | ||
157 | /* From all statically registered call-backs... */ | ||
158 | for (currentStaticCallback = 0U; currentStaticCallback < notifierHandle->callbacksNumber; | ||
159 | currentStaticCallback++) | ||
160 | { | ||
161 | callbackConfig = &(notifierHandle->callbacksTable[currentStaticCallback]); | ||
162 | /* ...notify only those which asked to be called after the configuration switch */ | ||
163 | if (((uint32_t)callbackConfig->callbackType & (uint32_t)kNOTIFIER_CallbackAfter) != 0U) | ||
164 | { | ||
165 | /* In case that call-back returned error code mark it and store the call-back handle */ | ||
166 | if (callbackConfig->callback(¬ifyBlock, callbackConfig->callbackData) != kStatus_Success) | ||
167 | { | ||
168 | returnCode = (status_t)kStatus_NOTIFIER_ErrorNotificationAfter; | ||
169 | notifierHandle->errorCallbackIndex = currentStaticCallback; | ||
170 | if (policy != kNOTIFIER_PolicyForcible) | ||
171 | { | ||
172 | break; | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | else | ||
179 | { | ||
180 | /* End of unsuccessful switch */ | ||
181 | notifyBlock.notifyType = kNOTIFIER_NotifyRecover; | ||
182 | while (currentStaticCallback-- > 0U) | ||
183 | { | ||
184 | callbackConfig = &(notifierHandle->callbacksTable[currentStaticCallback]); | ||
185 | if (((uint32_t)callbackConfig->callbackType & (uint32_t)kNOTIFIER_CallbackBefore) != 0U) | ||
186 | { | ||
187 | (void)callbackConfig->callback(¬ifyBlock, callbackConfig->callbackData); | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | |||
192 | return returnCode; | ||
193 | } | ||
194 | |||
195 | /*! | ||
196 | * brief This function returns the last failed notification callback. | ||
197 | * | ||
198 | * This function returns an index of the last callback that failed during the configuration switch while | ||
199 | * the last NOTIFIER_SwitchConfig() was called. If the last NOTIFIER_SwitchConfig() call ended successfully | ||
200 | * value equal to callbacks number is returned. The returned value represents an index in the array of | ||
201 | * static call-backs. | ||
202 | * | ||
203 | * param notifierHandle Pointer to the notifier handle | ||
204 | * return Callback Index of the last failed callback or value equal to callbacks count. | ||
205 | */ | ||
206 | uint8_t NOTIFIER_GetErrorCallbackIndex(notifier_handle_t *notifierHandle) | ||
207 | { | ||
208 | return notifierHandle->errorCallbackIndex; | ||
209 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_notifier.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_notifier.h new file mode 100644 index 000000000..d93578c13 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_notifier.h | |||
@@ -0,0 +1,237 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2017 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _FSL_NOTIFIER_H_ | ||
10 | #define _FSL_NOTIFIER_H_ | ||
11 | |||
12 | #include "fsl_common.h" | ||
13 | /*! | ||
14 | * @addtogroup notifier | ||
15 | * @{ | ||
16 | */ | ||
17 | |||
18 | /******************************************************************************* | ||
19 | * Definitions | ||
20 | ******************************************************************************/ | ||
21 | |||
22 | /*! | ||
23 | * @brief Notifier error codes. | ||
24 | * | ||
25 | * Used as return value of Notifier functions. | ||
26 | */ | ||
27 | enum _notifier_status | ||
28 | { | ||
29 | kStatus_NOTIFIER_ErrorNotificationBefore = | ||
30 | MAKE_STATUS(kStatusGroup_NOTIFIER, 0), /*!< An error occurs during send "BEFORE" notification. */ | ||
31 | kStatus_NOTIFIER_ErrorNotificationAfter = | ||
32 | MAKE_STATUS(kStatusGroup_NOTIFIER, 1), /*!< An error occurs during send "AFTER" notification. */ | ||
33 | }; | ||
34 | |||
35 | /*! | ||
36 | * @brief Notifier policies. | ||
37 | * | ||
38 | * Defines whether the user function execution is forced or not. | ||
39 | * For kNOTIFIER_PolicyForcible, the user function is executed regardless of the callback results, | ||
40 | * while kNOTIFIER_PolicyAgreement policy is used to exit NOTIFIER_SwitchConfig() | ||
41 | * when any of the callbacks returns error code. | ||
42 | * See also NOTIFIER_SwitchConfig() description. | ||
43 | */ | ||
44 | typedef enum _notifier_policy | ||
45 | { | ||
46 | kNOTIFIER_PolicyAgreement, /*!< NOTIFIER_SwitchConfig() method is exited when any of the callbacks returns error | ||
47 | code. */ | ||
48 | kNOTIFIER_PolicyForcible, /*!< The user function is executed regardless of the results. */ | ||
49 | } notifier_policy_t; | ||
50 | |||
51 | /*! @brief Notification type. Used to notify registered callbacks */ | ||
52 | typedef enum _notifier_notification_type | ||
53 | { | ||
54 | kNOTIFIER_NotifyRecover = 0x00U, /*!< Notify IP to recover to previous work state. */ | ||
55 | kNOTIFIER_NotifyBefore = 0x01U, /*!< Notify IP that configuration setting is going to change. */ | ||
56 | kNOTIFIER_NotifyAfter = 0x02U, /*!< Notify IP that configuration setting has been changed. */ | ||
57 | } notifier_notification_type_t; | ||
58 | |||
59 | /*! | ||
60 | * @brief The callback type, which indicates kinds of notification the callback handles. | ||
61 | * | ||
62 | * Used in the callback configuration structure (notifier_callback_config_t) | ||
63 | * to specify when the registered callback is called during configuration switch initiated by the | ||
64 | * NOTIFIER_SwitchConfig(). | ||
65 | * Callback can be invoked in following situations. | ||
66 | * - Before the configuration switch (Callback return value can affect NOTIFIER_SwitchConfig() | ||
67 | * execution. See the NOTIFIER_SwitchConfig() and notifier_policy_t documentation). | ||
68 | * - After an unsuccessful attempt to switch configuration | ||
69 | * - After a successful configuration switch | ||
70 | */ | ||
71 | typedef enum _notifier_callback_type | ||
72 | { | ||
73 | kNOTIFIER_CallbackBefore = 0x01U, /*!< Callback handles BEFORE notification. */ | ||
74 | kNOTIFIER_CallbackAfter = 0x02U, /*!< Callback handles AFTER notification. */ | ||
75 | kNOTIFIER_CallbackBeforeAfter = 0x03U, /*!< Callback handles BEFORE and AFTER notification. */ | ||
76 | } notifier_callback_type_t; | ||
77 | |||
78 | /*! @brief Notifier user configuration type. | ||
79 | * | ||
80 | * Reference of the user defined configuration is stored in an array; the notifier switches between these configurations | ||
81 | * based on this array. | ||
82 | */ | ||
83 | typedef void notifier_user_config_t; | ||
84 | |||
85 | /*! @brief Notifier user function prototype | ||
86 | * Use this function to execute specific operations in configuration switch. | ||
87 | * Before and after this function execution, different notification is sent to registered callbacks. | ||
88 | * If this function returns any error code, NOTIFIER_SwitchConfig() exits. | ||
89 | * | ||
90 | * @param targetConfig target Configuration. | ||
91 | * @param userData Refers to other specific data passed to user function. | ||
92 | * @return An error code or kStatus_Success. | ||
93 | */ | ||
94 | typedef status_t (*notifier_user_function_t)(notifier_user_config_t *targetConfig, void *userData); | ||
95 | |||
96 | /*! @brief notification block passed to the registered callback function. */ | ||
97 | typedef struct _notifier_notification_block | ||
98 | { | ||
99 | notifier_user_config_t *targetConfig; /*!< Pointer to target configuration. */ | ||
100 | notifier_policy_t policy; /*!< Configure transition policy. */ | ||
101 | notifier_notification_type_t notifyType; /*!< Configure notification type. */ | ||
102 | } notifier_notification_block_t; | ||
103 | |||
104 | /*! | ||
105 | * @brief Callback prototype. | ||
106 | * | ||
107 | * Declaration of a callback. It is common for registered callbacks. | ||
108 | * Reference to function of this type is part of the notifier_callback_config_t callback configuration structure. | ||
109 | * Depending on callback type, function of this prototype is called (see NOTIFIER_SwitchConfig()) | ||
110 | * before configuration switch, after it or in both use cases to notify about | ||
111 | * the switch progress (see notifier_callback_type_t). When called, the type of the notification | ||
112 | * is passed as a parameter along with the reference to the target configuration structure (see | ||
113 | * notifier_notification_block_t) and any data passed during the callback registration. When notified before the | ||
114 | * configuration switch, depending on the configuration switch policy (see notifier_policy_t), the callback may deny the | ||
115 | * execution of the user function by returning an error code different than kStatus_Success (see | ||
116 | * NOTIFIER_SwitchConfig()). | ||
117 | * | ||
118 | * @param notify Notification block. | ||
119 | * @param data Callback data. Refers to the data passed during callback registration. Intended to | ||
120 | * pass any driver or application data such as internal state information. | ||
121 | * @return An error code or kStatus_Success. | ||
122 | */ | ||
123 | typedef status_t (*notifier_callback_t)(notifier_notification_block_t *notify, void *data); | ||
124 | |||
125 | /*! | ||
126 | * @brief Callback configuration structure. | ||
127 | * | ||
128 | * This structure holds the configuration of callbacks. | ||
129 | * Callbacks of this type are expected to be statically allocated. | ||
130 | * This structure contains the following application-defined data. | ||
131 | * callback - pointer to the callback function | ||
132 | * callbackType - specifies when the callback is called | ||
133 | * callbackData - pointer to the data passed to the callback. | ||
134 | */ | ||
135 | typedef struct _notifier_callback_config | ||
136 | { | ||
137 | notifier_callback_t callback; /*!< Pointer to the callback function. */ | ||
138 | notifier_callback_type_t callbackType; /*!< Callback type. */ | ||
139 | void *callbackData; /*!< Pointer to the data passed to the callback. */ | ||
140 | } notifier_callback_config_t; | ||
141 | |||
142 | /*! | ||
143 | * @brief Notifier handle structure. | ||
144 | * | ||
145 | * Notifier handle structure. Contains data necessary for the Notifier proper function. | ||
146 | * Stores references to registered configurations, callbacks, information about their numbers, | ||
147 | * user function, user data, and other internal data. | ||
148 | * NOTIFIER_CreateHandle() must be called to initialize this handle. | ||
149 | */ | ||
150 | typedef struct _notifier_handle | ||
151 | { | ||
152 | notifier_user_config_t **configsTable; /*!< Pointer to configure table. */ | ||
153 | uint8_t configsNumber; /*!< Number of configurations. */ | ||
154 | notifier_callback_config_t *callbacksTable; /*!< Pointer to callback table. */ | ||
155 | uint8_t callbacksNumber; /*!< Maximum number of callback configurations. */ | ||
156 | uint8_t errorCallbackIndex; /*!< Index of callback returns error. */ | ||
157 | uint8_t currentConfigIndex; /*!< Index of current configuration. */ | ||
158 | notifier_user_function_t userFunction; /*!< User function. */ | ||
159 | void *userData; /*!< User data passed to user function. */ | ||
160 | } notifier_handle_t; | ||
161 | |||
162 | /******************************************************************************* | ||
163 | * API | ||
164 | ******************************************************************************/ | ||
165 | |||
166 | #if defined(__cplusplus) | ||
167 | extern "C" { | ||
168 | #endif | ||
169 | |||
170 | /*! | ||
171 | * @brief Creates a Notifier handle. | ||
172 | * | ||
173 | * @param notifierHandle A pointer to the notifier handle. | ||
174 | * @param configs A pointer to an array with references to all configurations which is handled by the Notifier. | ||
175 | * @param configsNumber Number of configurations. Size of the configuration array. | ||
176 | * @param callbacks A pointer to an array of callback configurations. | ||
177 | * If there are no callbacks to register during Notifier initialization, use NULL value. | ||
178 | * @param callbacksNumber Number of registered callbacks. Size of the callbacks array. | ||
179 | * @param userFunction User function. | ||
180 | * @param userData User data passed to user function. | ||
181 | * @return An error Code or kStatus_Success. | ||
182 | */ | ||
183 | status_t NOTIFIER_CreateHandle(notifier_handle_t *notifierHandle, | ||
184 | notifier_user_config_t **configs, | ||
185 | uint8_t configsNumber, | ||
186 | notifier_callback_config_t *callbacks, | ||
187 | uint8_t callbacksNumber, | ||
188 | notifier_user_function_t userFunction, | ||
189 | void *userData); | ||
190 | |||
191 | /*! | ||
192 | * @brief Switches the configuration according to a pre-defined structure. | ||
193 | * | ||
194 | * This function sets the system to the target configuration. Before transition, | ||
195 | * the Notifier sends notifications to all callbacks registered to the callback table. | ||
196 | * Callbacks are invoked in the following order: All registered callbacks are notified | ||
197 | * ordered by index in the callbacks array. The same order is used for before and after switch notifications. | ||
198 | * The notifications before the configuration switch can be used to obtain confirmation about | ||
199 | * the change from registered callbacks. If any registered callback denies the | ||
200 | * configuration change, further execution of this function depends on the notifier policy: the | ||
201 | * configuration change is either forced (kNOTIFIER_PolicyForcible) or exited (kNOTIFIER_PolicyAgreement). | ||
202 | * When configuration change is forced, the result of the before switch notifications are ignored. If an | ||
203 | * agreement is required, if any callback returns an error code, further notifications | ||
204 | * before switch notifications are cancelled and all already notified callbacks are re-invoked. | ||
205 | * The index of the callback which returned error code during pre-switch notifications is stored | ||
206 | * (any error codes during callbacks re-invocation are ignored) and NOTIFIER_GetErrorCallback() can be used to get it. | ||
207 | * Regardless of the policies, if any callback returns an error code, an error code indicating in which phase | ||
208 | * the error occurred is returned when NOTIFIER_SwitchConfig() exits. | ||
209 | * @param notifierHandle pointer to notifier handle | ||
210 | * @param configIndex Index of the target configuration. | ||
211 | * @param policy Transaction policy, kNOTIFIER_PolicyAgreement or kNOTIFIER_PolicyForcible. | ||
212 | * | ||
213 | * @return An error code or kStatus_Success. | ||
214 | * | ||
215 | */ | ||
216 | status_t NOTIFIER_SwitchConfig(notifier_handle_t *notifierHandle, uint8_t configIndex, notifier_policy_t policy); | ||
217 | |||
218 | /*! | ||
219 | * @brief This function returns the last failed notification callback. | ||
220 | * | ||
221 | * This function returns an index of the last callback that failed during the configuration switch while | ||
222 | * the last NOTIFIER_SwitchConfig() was called. If the last NOTIFIER_SwitchConfig() call ended successfully | ||
223 | * value equal to callbacks number is returned. The returned value represents an index in the array of | ||
224 | * static call-backs. | ||
225 | * | ||
226 | * @param notifierHandle Pointer to the notifier handle | ||
227 | * @return Callback Index of the last failed callback or value equal to callbacks count. | ||
228 | */ | ||
229 | uint8_t NOTIFIER_GetErrorCallbackIndex(notifier_handle_t *notifierHandle); | ||
230 | |||
231 | #if defined(__cplusplus) | ||
232 | } | ||
233 | #endif /* __cplusplus */ | ||
234 | |||
235 | /*! @}*/ | ||
236 | |||
237 | #endif /* _FSL_NOTIFIER_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_shell.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_shell.c new file mode 100644 index 000000000..2cc75f02e --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_shell.c | |||
@@ -0,0 +1,1085 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2020 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | * | ||
8 | * POSIX getopt for Windows | ||
9 | * Code given out at the 1985 UNIFORUM conference in Dallas. | ||
10 | * | ||
11 | * From [email protected] (Moderator, John Quarterman) Sun Nov 3 14:34:15 1985 | ||
12 | * Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gatech.CSNET | ||
13 | * Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP | ||
14 | * Path: gatech!akgua!mhuxv!mhuxt!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!ut-sally!std-unix | ||
15 | * From: [email protected] (Moderator, John Quarterman) | ||
16 | * Newsgroups: mod.std.unix | ||
17 | * Subject: public domain AT&T getopt source | ||
18 | * Message-ID: <[email protected]> | ||
19 | * Date: 3 Nov 85 19:34:15 GMT | ||
20 | * Date-Received: 4 Nov 85 12:25:09 GMT | ||
21 | * Organization: IEEE/P1003 Portable Operating System Environment Committee | ||
22 | * Lines: 91 | ||
23 | * Approved: [email protected] | ||
24 | * Here's something you've all been waiting for: the AT&T public domain | ||
25 | * source for getopt(3). It is the code which was given out at the 1985 | ||
26 | * UNIFORUM conference in Dallas. I obtained it by electronic mail | ||
27 | * directly from AT&T. The people there assure me that it is indeed | ||
28 | * in the public domain | ||
29 | * There is no manual page. That is because the one they gave out at | ||
30 | * UNIFORUM was slightly different from the current System V Release 2 | ||
31 | * manual page. The difference apparently involved a note about the | ||
32 | * famous rules 5 and 6, recommending using white space between an option | ||
33 | * and its first argument, and not grouping options that have arguments. | ||
34 | * Getopt itself is currently lenient about both of these things White | ||
35 | * space is allowed, but not mandatory, and the last option in a group can | ||
36 | * have an argument. That particular version of the man page evidently | ||
37 | * has no official existence, and my source at AT&T did not send a copy. | ||
38 | * The current SVR2 man page reflects the actual behavor of this getopt. | ||
39 | * However, I am not about to post a copy of anything licensed by AT&T. | ||
40 | */ | ||
41 | |||
42 | #include <assert.h> | ||
43 | #include <stdarg.h> | ||
44 | #include <stdlib.h> | ||
45 | #include <stdio.h> | ||
46 | |||
47 | #include "fsl_common.h" | ||
48 | #include "fsl_str.h" | ||
49 | |||
50 | #include "fsl_component_generic_list.h" | ||
51 | #include "fsl_component_serial_manager.h" | ||
52 | |||
53 | #include "fsl_shell.h" | ||
54 | |||
55 | /* | ||
56 | * The OSA_USED macro can only be defined when the OSA component is used. | ||
57 | * If the source code of the OSA component does not exist, the OSA_USED cannot be defined. | ||
58 | * OR, If OSA component is not added into project event the OSA source code exists, the OSA_USED | ||
59 | * also cannot be defined. | ||
60 | * The source code path of the OSA component is <MCUXpresso_SDK>/components/osa. | ||
61 | * | ||
62 | */ | ||
63 | #if defined(OSA_USED) | ||
64 | |||
65 | #if (defined(SHELL_USE_COMMON_TASK) && (SHELL_USE_COMMON_TASK > 0U)) | ||
66 | #include "fsl_component_common_task.h" | ||
67 | #else | ||
68 | #include "fsl_os_abstraction.h" | ||
69 | #endif | ||
70 | |||
71 | #endif | ||
72 | |||
73 | /******************************************************************************* | ||
74 | * Definitions | ||
75 | ******************************************************************************/ | ||
76 | #define KEY_ESC (0x1BU) | ||
77 | #define KET_DEL (0x7FU) | ||
78 | |||
79 | #define SHELL_EVENT_DATA_ARRIVED (1U << 0) | ||
80 | #define SHELL_EVENT_DATA_SENT (1U << 1) | ||
81 | |||
82 | #define SHELL_SPRINTF_BUFFER_SIZE (64U) | ||
83 | |||
84 | /*! @brief A type for the handle special key. */ | ||
85 | typedef enum _fun_key_status | ||
86 | { | ||
87 | kSHELL_Normal = 0U, /*!< Normal key */ | ||
88 | kSHELL_Special = 1U, /*!< Special key */ | ||
89 | kSHELL_Function = 2U, /*!< Function key */ | ||
90 | } fun_key_status_t; | ||
91 | |||
92 | /*! @brief Data structure for Shell environment. */ | ||
93 | typedef struct _shell_context_handle | ||
94 | { | ||
95 | list_label_t commandContextListHead; /*!< Command shellContextHandle list queue head */ | ||
96 | serial_handle_t serialHandle; /*!< Serial manager handle */ | ||
97 | uint8_t | ||
98 | serialWriteHandleBuffer[SERIAL_MANAGER_WRITE_HANDLE_SIZE]; /*!< The buffer for serial manager write handle */ | ||
99 | serial_write_handle_t serialWriteHandle; /*!< The serial manager write handle */ | ||
100 | uint8_t serialReadHandleBuffer[SERIAL_MANAGER_READ_HANDLE_SIZE]; /*!< The buffer for serial manager read handle */ | ||
101 | serial_read_handle_t serialReadHandle; /*!< The serial manager read handle */ | ||
102 | char *prompt; /*!< Prompt string */ | ||
103 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
104 | |||
105 | #if defined(OSA_USED) | ||
106 | |||
107 | #if (defined(SHELL_USE_COMMON_TASK) && (SHELL_USE_COMMON_TASK > 0U)) | ||
108 | common_task_message_t commontaskMsg; /*!< Message for common task */ | ||
109 | #else | ||
110 | uint8_t event[OSA_EVENT_HANDLE_SIZE]; /*!< Event instance */ | ||
111 | uint8_t taskId[OSA_TASK_HANDLE_SIZE]; /*!< Task handle */ | ||
112 | #endif | ||
113 | |||
114 | #endif | ||
115 | |||
116 | #endif | ||
117 | char line[SHELL_BUFFER_SIZE]; /*!< Consult buffer */ | ||
118 | char hist_buf[SHELL_HISTORY_COUNT][SHELL_BUFFER_SIZE]; /*!< History buffer*/ | ||
119 | char printBuffer[SHELL_SPRINTF_BUFFER_SIZE]; /*!< Buffer for print */ | ||
120 | uint32_t printLength; /*!< All length has been printed */ | ||
121 | uint16_t hist_current; /*!< Current history command in hist buff*/ | ||
122 | uint16_t hist_count; /*!< Total history command in hist buff*/ | ||
123 | enum _fun_key_status stat; /*!< Special key status */ | ||
124 | uint8_t cmd_num; /*!< Number of user commands */ | ||
125 | uint8_t l_pos; /*!< Total line position */ | ||
126 | uint8_t c_pos; /*!< Current line position */ | ||
127 | volatile uint8_t notificationPost; /*!< The serial manager notification is post */ | ||
128 | uint8_t exit; /*!< Exit Flag*/ | ||
129 | uint8_t printBusy; /*!< Print is busy */ | ||
130 | } shell_context_handle_t; | ||
131 | |||
132 | #if 0 | ||
133 | #define SHELL_STRUCT_OFFSET(type, field) ((size_t) & (((type *)0)->field)) | ||
134 | #define SHEEL_COMMAND_POINTER(node) \ | ||
135 | ((shell_command_t *)(((uint32_t)(node)) - SHELL_STRUCT_OFFSET(shell_command_t, link))) | ||
136 | #else | ||
137 | #define SHEEL_COMMAND_POINTER(node) \ | ||
138 | ((shell_command_t *)(((uint32_t)(node)) - (sizeof(shell_command_t) - sizeof(list_element_t)))) | ||
139 | #endif | ||
140 | /******************************************************************************* | ||
141 | * Prototypes | ||
142 | ******************************************************************************/ | ||
143 | static shell_status_t SHELL_HelpCommand(shell_handle_t shellHandle, int32_t argc, char **argv); /*!< help command */ | ||
144 | |||
145 | static shell_status_t SHELL_ExitCommand(shell_handle_t shellHandle, int32_t argc, char **argv); /*!< exit command */ | ||
146 | |||
147 | static int32_t SHELL_ParseLine(const char *cmd, uint32_t len, char *argv[]); /*!< parse line command */ | ||
148 | |||
149 | static int32_t SHELL_StringCompare(const char *str1, const char *str2, int32_t count); /*!< compare string command */ | ||
150 | |||
151 | static void SHELL_ProcessCommand(shell_context_handle_t *shellContextHandle, const char *cmd); /*!< process a command */ | ||
152 | |||
153 | static void SHELL_GetHistoryCommand(shell_context_handle_t *shellContextHandle, | ||
154 | uint8_t hist_pos); /*!< get commands history */ | ||
155 | |||
156 | static void SHELL_AutoComplete(shell_context_handle_t *shellContextHandle); /*!< auto complete command */ | ||
157 | |||
158 | static shell_status_t SHELL_GetChar(shell_context_handle_t *shellContextHandle, | ||
159 | uint8_t *ch); /*!< get a char from communication interface */ | ||
160 | |||
161 | static void SHELL_WriteWithCopy(shell_handle_t shellHandle, const char *buffer, uint32_t length); | ||
162 | |||
163 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
164 | static void SHELL_Task(void *param); /*!< Shell task*/ | ||
165 | #endif | ||
166 | |||
167 | /******************************************************************************* | ||
168 | * Variables | ||
169 | ******************************************************************************/ | ||
170 | |||
171 | static SHELL_COMMAND_DEFINE(help, "\r\n\"help\": List all the registered commands\r\n", SHELL_HelpCommand, 0); | ||
172 | static SHELL_COMMAND_DEFINE(exit, "\r\n\"exit\": Exit program\r\n", SHELL_ExitCommand, 0); | ||
173 | |||
174 | static char s_paramBuffer[SHELL_BUFFER_SIZE]; | ||
175 | |||
176 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
177 | #if defined(OSA_USED) | ||
178 | #if (defined(SHELL_USE_COMMON_TASK) && (SHELL_USE_COMMON_TASK > 0U)) | ||
179 | #else | ||
180 | /* | ||
181 | * \brief Defines the serial manager task's stack | ||
182 | */ | ||
183 | static OSA_TASK_DEFINE(SHELL_Task, SHELL_TASK_PRIORITY, 1, SHELL_TASK_STACK_SIZE, false); | ||
184 | #endif | ||
185 | #endif /* OSA_USED */ | ||
186 | #endif /* SHELL_NON_BLOCKING_MODE */ | ||
187 | /******************************************************************************* | ||
188 | * Code | ||
189 | ******************************************************************************/ | ||
190 | |||
191 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
192 | static void SHELL_SerialManagerRxCallback(void *callbackParam, | ||
193 | serial_manager_callback_message_t *message, | ||
194 | serial_manager_status_t status) | ||
195 | { | ||
196 | shell_context_handle_t *shellHandle; | ||
197 | |||
198 | assert(callbackParam); | ||
199 | assert(message); | ||
200 | |||
201 | shellHandle = (shell_context_handle_t *)callbackParam; | ||
202 | |||
203 | if (0U == shellHandle->notificationPost) | ||
204 | { | ||
205 | shellHandle->notificationPost = 1U; | ||
206 | #if defined(OSA_USED) | ||
207 | |||
208 | #if (defined(SHELL_USE_COMMON_TASK) && (SHELL_USE_COMMON_TASK > 0U)) | ||
209 | shellHandle->commontaskMsg.callback = SHELL_Task; | ||
210 | shellHandle->commontaskMsg.callbackParam = shellHandle; | ||
211 | (void)COMMON_TASK_post_message(&shellHandle->commontaskMsg); | ||
212 | #else | ||
213 | (void)OSA_EventSet((osa_event_handle_t)shellHandle->event, SHELL_EVENT_DATA_ARRIVED); | ||
214 | #endif | ||
215 | |||
216 | #else | ||
217 | SHELL_Task(shellHandle); | ||
218 | #endif | ||
219 | } | ||
220 | } | ||
221 | #endif | ||
222 | |||
223 | static void SHELL_WriteBuffer(char *buffer, int32_t *indicator, char val, int len) | ||
224 | { | ||
225 | shell_context_handle_t *shellContextHandle; | ||
226 | int i = 0; | ||
227 | shellContextHandle = (shell_context_handle_t *)(void *)buffer; | ||
228 | |||
229 | for (i = 0; i < len; i++) | ||
230 | { | ||
231 | if ((*indicator + 1) >= (int32_t)SHELL_SPRINTF_BUFFER_SIZE) | ||
232 | { | ||
233 | #if (!defined(SDK_DEBUGCONSOLE_UART) && (defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE != 1))) | ||
234 | if (NULL == shellContextHandle->serialHandle) | ||
235 | { | ||
236 | for (uint32_t index = 0; index < ((uint32_t)*indicator); index++) | ||
237 | { | ||
238 | (void)putchar(shellContextHandle->printBuffer[index]); | ||
239 | } | ||
240 | } | ||
241 | else | ||
242 | #endif | ||
243 | { | ||
244 | (void)SerialManager_WriteBlocking(shellContextHandle->serialWriteHandle, | ||
245 | (uint8_t *)shellContextHandle->printBuffer, (uint32_t)*indicator); | ||
246 | } | ||
247 | |||
248 | shellContextHandle->printLength += (uint32_t)*indicator; | ||
249 | *indicator = 0; | ||
250 | } | ||
251 | |||
252 | shellContextHandle->printBuffer[*indicator] = val; | ||
253 | (*indicator)++; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | static int SHELL_Sprintf(void *buffer, const char *formatString, va_list ap) | ||
258 | { | ||
259 | shell_context_handle_t *shellContextHandle; | ||
260 | uint32_t length; | ||
261 | shellContextHandle = (shell_context_handle_t *)buffer; | ||
262 | |||
263 | length = (uint32_t)StrFormatPrintf(formatString, ap, (char *)buffer, SHELL_WriteBuffer); | ||
264 | shellContextHandle->printLength += length; | ||
265 | return (int32_t)length; | ||
266 | } | ||
267 | |||
268 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
269 | static void SHELL_Task(void *param) | ||
270 | #else | ||
271 | void SHELL_Task(shell_handle_t shellHandle) | ||
272 | #endif | ||
273 | { | ||
274 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
275 | shell_context_handle_t *shellContextHandle = (shell_context_handle_t *)param; | ||
276 | #else | ||
277 | shell_context_handle_t *shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
278 | #endif | ||
279 | uint8_t ch; | ||
280 | |||
281 | if (NULL != shellContextHandle) | ||
282 | { | ||
283 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
284 | |||
285 | #if defined(OSA_USED) | ||
286 | |||
287 | #if (defined(SHELL_USE_COMMON_TASK) && (SHELL_USE_COMMON_TASK > 0U)) | ||
288 | #else | ||
289 | osa_event_flags_t ev = 0; | ||
290 | |||
291 | do | ||
292 | { | ||
293 | if (KOSA_StatusSuccess == OSA_EventWait((osa_event_handle_t)shellContextHandle->event, osaEventFlagsAll_c, | ||
294 | 0U, osaWaitForever_c, &ev)) | ||
295 | { | ||
296 | if (0U != (ev & SHELL_EVENT_DATA_ARRIVED)) | ||
297 | #endif | ||
298 | |||
299 | #endif | ||
300 | |||
301 | #endif | ||
302 | { | ||
303 | shellContextHandle->notificationPost = 0; | ||
304 | do | ||
305 | { | ||
306 | if ((bool)shellContextHandle->exit) | ||
307 | { | ||
308 | if (shellContextHandle->serialReadHandle != NULL) | ||
309 | { | ||
310 | (void)SerialManager_CloseReadHandle(shellContextHandle->serialReadHandle); | ||
311 | shellContextHandle->serialReadHandle = NULL; | ||
312 | } | ||
313 | if (shellContextHandle->serialWriteHandle != NULL) | ||
314 | { | ||
315 | (void)SerialManager_CloseWriteHandle(shellContextHandle->serialWriteHandle); | ||
316 | shellContextHandle->serialWriteHandle = NULL; | ||
317 | } | ||
318 | break; | ||
319 | } | ||
320 | if (kStatus_SHELL_Success != (shell_status_t)SHELL_GetChar(shellContextHandle, &ch)) | ||
321 | { | ||
322 | /* If error occurred when getting a char, exit the task and waiting the new data arriving. */ | ||
323 | break; | ||
324 | } | ||
325 | |||
326 | /* Special key */ | ||
327 | if (ch == KEY_ESC) | ||
328 | { | ||
329 | shellContextHandle->stat = kSHELL_Special; | ||
330 | continue; | ||
331 | } | ||
332 | else if (shellContextHandle->stat == kSHELL_Special) | ||
333 | { | ||
334 | /* Function key */ | ||
335 | if ((char)ch == '[') | ||
336 | { | ||
337 | shellContextHandle->stat = kSHELL_Function; | ||
338 | continue; | ||
339 | } | ||
340 | shellContextHandle->stat = kSHELL_Normal; | ||
341 | } | ||
342 | else if (shellContextHandle->stat == kSHELL_Function) | ||
343 | { | ||
344 | shellContextHandle->stat = kSHELL_Normal; | ||
345 | |||
346 | switch ((char)ch) | ||
347 | { | ||
348 | /* History operation here */ | ||
349 | case 'A': /* Up key */ | ||
350 | SHELL_GetHistoryCommand(shellContextHandle, (uint8_t)shellContextHandle->hist_current); | ||
351 | if (shellContextHandle->hist_current < (shellContextHandle->hist_count - 1U)) | ||
352 | { | ||
353 | shellContextHandle->hist_current++; | ||
354 | } | ||
355 | break; | ||
356 | case 'B': /* Down key */ | ||
357 | SHELL_GetHistoryCommand(shellContextHandle, (uint8_t)shellContextHandle->hist_current); | ||
358 | if (shellContextHandle->hist_current > 0U) | ||
359 | { | ||
360 | shellContextHandle->hist_current--; | ||
361 | } | ||
362 | break; | ||
363 | case 'D': /* Left key */ | ||
364 | if ((bool)shellContextHandle->c_pos) | ||
365 | { | ||
366 | SHELL_WriteWithCopy(shellContextHandle, "\b", 1); | ||
367 | shellContextHandle->c_pos--; | ||
368 | } | ||
369 | break; | ||
370 | case 'C': /* Right key */ | ||
371 | if (shellContextHandle->c_pos < shellContextHandle->l_pos) | ||
372 | { | ||
373 | (void)SHELL_Write(shellContextHandle, | ||
374 | &shellContextHandle->line[shellContextHandle->c_pos], 1); | ||
375 | shellContextHandle->c_pos++; | ||
376 | } | ||
377 | break; | ||
378 | default: | ||
379 | /* MISRA C-2012 Rule 16.4 */ | ||
380 | break; | ||
381 | } | ||
382 | continue; | ||
383 | } | ||
384 | /* Handle tab key */ | ||
385 | else if ((char)ch == '\t') | ||
386 | { | ||
387 | #if SHELL_AUTO_COMPLETE | ||
388 | /* Move the cursor to the beginning of line */ | ||
389 | uint32_t i; | ||
390 | for (i = 0; i < (uint32_t)shellContextHandle->c_pos; i++) | ||
391 | { | ||
392 | SHELL_WriteWithCopy(shellContextHandle, "\b", 1); | ||
393 | } | ||
394 | /* Do auto complete */ | ||
395 | SHELL_AutoComplete(shellContextHandle); | ||
396 | /* Move position to end */ | ||
397 | shellContextHandle->l_pos = (uint8_t)strlen(shellContextHandle->line); | ||
398 | shellContextHandle->c_pos = shellContextHandle->l_pos; | ||
399 | #endif | ||
400 | continue; | ||
401 | } | ||
402 | /* Handle backspace key */ | ||
403 | else if ((ch == KET_DEL) || ((char)ch == '\b')) | ||
404 | { | ||
405 | /* There must be at last one char */ | ||
406 | if (shellContextHandle->c_pos == 0U) | ||
407 | { | ||
408 | continue; | ||
409 | } | ||
410 | |||
411 | shellContextHandle->l_pos--; | ||
412 | shellContextHandle->c_pos--; | ||
413 | |||
414 | if (shellContextHandle->l_pos > shellContextHandle->c_pos) | ||
415 | { | ||
416 | (void)memmove(&shellContextHandle->line[shellContextHandle->c_pos], | ||
417 | &shellContextHandle->line[shellContextHandle->c_pos + 1U], | ||
418 | (uint32_t)shellContextHandle->l_pos - (uint32_t)shellContextHandle->c_pos); | ||
419 | shellContextHandle->line[shellContextHandle->l_pos] = '\0'; | ||
420 | SHELL_WriteWithCopy(shellContextHandle, "\b", 1); | ||
421 | (void)SHELL_Write(shellContextHandle, &shellContextHandle->line[shellContextHandle->c_pos], | ||
422 | strlen(&shellContextHandle->line[shellContextHandle->c_pos])); | ||
423 | SHELL_WriteWithCopy(shellContextHandle, " \b", 3); | ||
424 | |||
425 | /* Reset position */ | ||
426 | uint32_t i; | ||
427 | for (i = (uint32_t)shellContextHandle->c_pos; i <= (uint32_t)shellContextHandle->l_pos; i++) | ||
428 | { | ||
429 | SHELL_WriteWithCopy(shellContextHandle, "\b", 1); | ||
430 | } | ||
431 | } | ||
432 | else /* Normal backspace operation */ | ||
433 | { | ||
434 | SHELL_WriteWithCopy(shellContextHandle, "\b \b", 3); | ||
435 | shellContextHandle->line[shellContextHandle->l_pos] = '\0'; | ||
436 | } | ||
437 | continue; | ||
438 | } | ||
439 | else | ||
440 | { | ||
441 | /* MISRA C-2012 Rule 15.7 */ | ||
442 | } | ||
443 | |||
444 | /* Input too long */ | ||
445 | if (shellContextHandle->l_pos >= (SHELL_BUFFER_SIZE - 1U)) | ||
446 | { | ||
447 | shellContextHandle->l_pos = 0U; | ||
448 | } | ||
449 | |||
450 | /* Handle end of line, break */ | ||
451 | if (((char)ch == '\r') || ((char)ch == '\n')) | ||
452 | { | ||
453 | static char endoflinechar = '\0'; | ||
454 | |||
455 | if (((uint8_t)endoflinechar != 0U) && ((uint8_t)endoflinechar != ch)) | ||
456 | { | ||
457 | continue; | ||
458 | } | ||
459 | else | ||
460 | { | ||
461 | endoflinechar = (char)ch; | ||
462 | /* Print new line. */ | ||
463 | SHELL_WriteWithCopy(shellContextHandle, "\r\n", 2U); /* MISRA C-2012 Rule 7.4 */ | ||
464 | /* If command line is not NULL, will start process it. */ | ||
465 | if (0U != strlen(shellContextHandle->line)) | ||
466 | { | ||
467 | SHELL_ProcessCommand(shellContextHandle, shellContextHandle->line); | ||
468 | } | ||
469 | /* Print prompt. */ | ||
470 | (void)SHELL_Write(shellContextHandle, shellContextHandle->prompt, | ||
471 | strlen(shellContextHandle->prompt)); | ||
472 | /* Reset all params */ | ||
473 | shellContextHandle->c_pos = shellContextHandle->l_pos = 0; | ||
474 | shellContextHandle->hist_current = 0; | ||
475 | (void)memset(shellContextHandle->line, 0, sizeof(shellContextHandle->line)); | ||
476 | continue; | ||
477 | } | ||
478 | } | ||
479 | |||
480 | /* Normal character */ | ||
481 | if (shellContextHandle->c_pos < shellContextHandle->l_pos) | ||
482 | { | ||
483 | (void)memmove(&shellContextHandle->line[shellContextHandle->c_pos + 1U], | ||
484 | &shellContextHandle->line[shellContextHandle->c_pos], | ||
485 | (uint32_t)shellContextHandle->l_pos - (uint32_t)shellContextHandle->c_pos); | ||
486 | shellContextHandle->line[shellContextHandle->c_pos] = (char)ch; | ||
487 | (void)SHELL_Write(shellContextHandle, &shellContextHandle->line[shellContextHandle->c_pos], | ||
488 | strlen(&shellContextHandle->line[shellContextHandle->c_pos])); | ||
489 | /* Move the cursor to new position */ | ||
490 | uint32_t i; | ||
491 | for (i = (uint32_t)shellContextHandle->c_pos; i < (uint32_t)shellContextHandle->l_pos; i++) | ||
492 | { | ||
493 | SHELL_WriteWithCopy(shellContextHandle, "\b", 1); | ||
494 | } | ||
495 | } | ||
496 | else | ||
497 | { | ||
498 | shellContextHandle->line[shellContextHandle->l_pos] = (char)ch; | ||
499 | (void)SHELL_Write(shellContextHandle, &shellContextHandle->line[shellContextHandle->l_pos], 1); | ||
500 | } | ||
501 | |||
502 | ch = 0; | ||
503 | shellContextHandle->l_pos++; | ||
504 | shellContextHandle->c_pos++; | ||
505 | } while (0U == shellContextHandle->exit); | ||
506 | } | ||
507 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
508 | |||
509 | #if defined(OSA_USED) | ||
510 | |||
511 | #if (defined(SHELL_USE_COMMON_TASK) && (SHELL_USE_COMMON_TASK > 0U)) | ||
512 | #else | ||
513 | } | ||
514 | } while (1U == gUseRtos_c); /* USE_RTOS = 0 for BareMetal and 1 for OS */ | ||
515 | #endif | ||
516 | |||
517 | #endif | ||
518 | |||
519 | #endif | ||
520 | } | ||
521 | } | ||
522 | |||
523 | static shell_status_t SHELL_HelpCommand(shell_handle_t shellHandle, int32_t argc, char **argv) | ||
524 | { | ||
525 | shell_context_handle_t *shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
526 | shell_command_t *shellCommandContextHandle; | ||
527 | list_element_handle_t p = LIST_GetHead(&shellContextHandle->commandContextListHead); | ||
528 | |||
529 | while (p != NULL) | ||
530 | { | ||
531 | shellCommandContextHandle = SHEEL_COMMAND_POINTER(p); | ||
532 | if ((shellCommandContextHandle->pcHelpString != NULL) && (bool)strlen(shellCommandContextHandle->pcHelpString)) | ||
533 | { | ||
534 | (void)SHELL_Write(shellContextHandle, shellCommandContextHandle->pcHelpString, | ||
535 | strlen(shellCommandContextHandle->pcHelpString)); | ||
536 | } | ||
537 | |||
538 | p = LIST_GetNext(p); | ||
539 | } | ||
540 | return kStatus_SHELL_Success; | ||
541 | } | ||
542 | |||
543 | static shell_status_t SHELL_ExitCommand(shell_handle_t shellHandle, int32_t argc, char **argv) | ||
544 | { | ||
545 | shell_context_handle_t *shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
546 | /* Skip warning */ | ||
547 | SHELL_WriteWithCopy(shellContextHandle, "\r\nSHELL exited\r\n", strlen("\r\nSHELL exited\r\n")); | ||
548 | shellContextHandle->exit = (uint8_t) true; | ||
549 | return kStatus_SHELL_Success; | ||
550 | } | ||
551 | |||
552 | static void SHELL_ProcessCommand(shell_context_handle_t *shellContextHandle, const char *cmd) | ||
553 | { | ||
554 | shell_command_t *tmpCommand = NULL; | ||
555 | const char *tmpCommandString; | ||
556 | int32_t argc; | ||
557 | char *argv[SHELL_BUFFER_SIZE] = {0}; | ||
558 | list_element_handle_t p; | ||
559 | uint8_t flag = 1; | ||
560 | uint8_t tmpCommandLen; | ||
561 | uint8_t tmpLen; | ||
562 | uint8_t i = 0; | ||
563 | |||
564 | tmpLen = (uint8_t)strlen(cmd); | ||
565 | argc = SHELL_ParseLine(cmd, tmpLen, argv); | ||
566 | |||
567 | if ((argc > 0)) | ||
568 | { | ||
569 | p = LIST_GetHead(&shellContextHandle->commandContextListHead); | ||
570 | while (p != NULL) | ||
571 | { | ||
572 | tmpCommand = SHEEL_COMMAND_POINTER(p); | ||
573 | tmpCommandString = tmpCommand->pcCommand; | ||
574 | tmpCommandLen = (uint8_t)strlen(tmpCommandString); | ||
575 | /* Compare with space or end of string */ | ||
576 | if ((cmd[tmpCommandLen] == ' ') || (cmd[tmpCommandLen] == (char)0x00)) | ||
577 | { | ||
578 | if (SHELL_StringCompare(tmpCommandString, argv[0], (int32_t)tmpCommandLen) == 0) | ||
579 | { | ||
580 | /* support commands with optional number of parameters */ | ||
581 | if (tmpCommand->cExpectedNumberOfParameters == (uint8_t)SHELL_IGNORE_PARAMETER_COUNT) | ||
582 | { | ||
583 | flag = 0; | ||
584 | } | ||
585 | else if ((tmpCommand->cExpectedNumberOfParameters == 0U) && (argc == 1)) | ||
586 | { | ||
587 | flag = 0; | ||
588 | } | ||
589 | else if (tmpCommand->cExpectedNumberOfParameters > 0U) | ||
590 | { | ||
591 | if ((argc - 1) == (int32_t)tmpCommand->cExpectedNumberOfParameters) | ||
592 | { | ||
593 | flag = 0; | ||
594 | } | ||
595 | } | ||
596 | else | ||
597 | { | ||
598 | flag = 1; | ||
599 | } | ||
600 | break; | ||
601 | } | ||
602 | } | ||
603 | p = LIST_GetNext(p); | ||
604 | } | ||
605 | if (NULL == p) | ||
606 | { | ||
607 | tmpCommand = NULL; | ||
608 | } | ||
609 | } | ||
610 | |||
611 | if ((tmpCommand != NULL) && (flag == 1U)) | ||
612 | { | ||
613 | SHELL_WriteWithCopy( | ||
614 | shellContextHandle, | ||
615 | "\r\nIncorrect command parameter(s). Enter \"help\" to view a list of available commands.\r\n\r\n", | ||
616 | strlen( | ||
617 | "\r\nIncorrect command parameter(s). Enter \"help\" to view a list of available commands.\r\n\r\n")); | ||
618 | } | ||
619 | else if (tmpCommand != NULL) | ||
620 | { | ||
621 | tmpLen = (uint8_t)strlen(cmd); | ||
622 | /* Compare with last command. Push back to history buffer if different */ | ||
623 | if (tmpLen != (uint8_t)SHELL_StringCompare(cmd, shellContextHandle->hist_buf[0], (int32_t)strlen(cmd))) | ||
624 | { | ||
625 | for (i = SHELL_HISTORY_COUNT - 1U; i > 0U; i--) | ||
626 | { | ||
627 | (void)memset(shellContextHandle->hist_buf[i], (int)'\0', SHELL_BUFFER_SIZE); | ||
628 | tmpLen = (uint8_t)strlen(shellContextHandle->hist_buf[i - 1U]); | ||
629 | (void)memcpy(shellContextHandle->hist_buf[i], shellContextHandle->hist_buf[i - 1U], tmpLen); | ||
630 | } | ||
631 | (void)memset(shellContextHandle->hist_buf[0], (int)'\0', SHELL_BUFFER_SIZE); | ||
632 | tmpLen = (uint8_t)strlen(cmd); | ||
633 | (void)memcpy(shellContextHandle->hist_buf[0], cmd, tmpLen); | ||
634 | if (shellContextHandle->hist_count < SHELL_HISTORY_COUNT) | ||
635 | { | ||
636 | shellContextHandle->hist_count++; | ||
637 | } | ||
638 | } | ||
639 | (void)tmpCommand->pFuncCallBack(shellContextHandle, argc, argv); | ||
640 | } | ||
641 | else | ||
642 | { | ||
643 | SHELL_WriteWithCopy( | ||
644 | shellContextHandle, | ||
645 | "\r\nCommand not recognized. Enter 'help' to view a list of available commands.\r\n\r\n", | ||
646 | strlen("\r\nCommand not recognized. Enter 'help' to view a list of available commands.\r\n\r\n")); | ||
647 | } | ||
648 | } | ||
649 | |||
650 | static void SHELL_GetHistoryCommand(shell_context_handle_t *shellContextHandle, uint8_t hist_pos) | ||
651 | { | ||
652 | uint32_t i; | ||
653 | uint32_t tmp; | ||
654 | |||
655 | if (shellContextHandle->hist_buf[0][0] == '\0') | ||
656 | { | ||
657 | shellContextHandle->hist_current = 0; | ||
658 | return; | ||
659 | } | ||
660 | |||
661 | #if 0 /*hist_pos is passed from hist_current. And hist_current is only changed in case 'A'/'B',as hist_count is 3 \ | ||
662 | most, it can't be more than 3 */ | ||
663 | if (hist_pos >= SHELL_HISTORY_COUNT) | ||
664 | { | ||
665 | hist_pos = SHELL_HISTORY_COUNT - 1U; | ||
666 | } | ||
667 | #endif | ||
668 | |||
669 | tmp = strlen(shellContextHandle->line); | ||
670 | /* Clear current if have */ | ||
671 | if (tmp > 0U) | ||
672 | { | ||
673 | (void)memset(shellContextHandle->line, (int)'\0', tmp); | ||
674 | for (i = 0U; i < tmp; i++) | ||
675 | { | ||
676 | SHELL_WriteWithCopy(shellContextHandle, "\b \b", 3); | ||
677 | } | ||
678 | } | ||
679 | |||
680 | shellContextHandle->l_pos = (uint8_t)strlen(shellContextHandle->hist_buf[hist_pos]); | ||
681 | shellContextHandle->c_pos = shellContextHandle->l_pos; | ||
682 | (void)memcpy(shellContextHandle->line, shellContextHandle->hist_buf[hist_pos], shellContextHandle->l_pos); | ||
683 | (void)SHELL_Write(shellContextHandle, shellContextHandle->hist_buf[hist_pos], | ||
684 | strlen(shellContextHandle->hist_buf[hist_pos])); | ||
685 | } | ||
686 | |||
687 | static void SHELL_AutoComplete(shell_context_handle_t *shellContextHandle) | ||
688 | { | ||
689 | int32_t minLen; | ||
690 | list_element_handle_t p; | ||
691 | shell_command_t *tmpCommand = NULL; | ||
692 | const char *namePtr; | ||
693 | const char *cmdName; | ||
694 | |||
695 | minLen = (int32_t)SHELL_BUFFER_SIZE; | ||
696 | namePtr = NULL; | ||
697 | |||
698 | /* Empty tab, list all commands */ | ||
699 | if (shellContextHandle->line[0] == '\0') | ||
700 | { | ||
701 | (void)SHELL_HelpCommand(shellContextHandle, 0, NULL); | ||
702 | return; | ||
703 | } | ||
704 | |||
705 | SHELL_WriteWithCopy(shellContextHandle, "\r\n", 2); | ||
706 | |||
707 | /* Do auto complete */ | ||
708 | p = LIST_GetHead(&shellContextHandle->commandContextListHead); | ||
709 | while (p != NULL) | ||
710 | { | ||
711 | tmpCommand = SHEEL_COMMAND_POINTER(p); | ||
712 | cmdName = tmpCommand->pcCommand; | ||
713 | if (SHELL_StringCompare(shellContextHandle->line, cmdName, (int32_t)strlen(shellContextHandle->line)) == 0) | ||
714 | { | ||
715 | /* Show possible matches */ | ||
716 | (void)SHELL_Printf(shellContextHandle, "%s ", cmdName); | ||
717 | if (minLen > ((int32_t)strlen(cmdName))) | ||
718 | { | ||
719 | namePtr = cmdName; | ||
720 | minLen = (int32_t)strlen(namePtr); | ||
721 | } | ||
722 | } | ||
723 | p = LIST_GetNext(p); | ||
724 | } | ||
725 | /* Auto complete string */ | ||
726 | if (namePtr != NULL) | ||
727 | { | ||
728 | (void)memcpy(shellContextHandle->line, namePtr, (uint32_t)minLen); | ||
729 | } | ||
730 | SHELL_PrintPrompt(shellContextHandle); | ||
731 | (void)SHELL_Write(shellContextHandle, shellContextHandle->line, strlen(shellContextHandle->line)); | ||
732 | return; | ||
733 | } | ||
734 | |||
735 | static int32_t SHELL_StringCompare(const char *str1, const char *str2, int32_t count) | ||
736 | { | ||
737 | while ((bool)(count--)) | ||
738 | { | ||
739 | if (*str1++ != *str2++) | ||
740 | { | ||
741 | return (int32_t)(*(str1 - 1) - *(str2 - 1)); | ||
742 | } | ||
743 | } | ||
744 | return 0; | ||
745 | } | ||
746 | |||
747 | static int32_t SHELL_ParseLine(const char *cmd, uint32_t len, char *argv[]) | ||
748 | { | ||
749 | uint32_t argc; | ||
750 | char *p; | ||
751 | uint32_t position; | ||
752 | |||
753 | /* Init params */ | ||
754 | (void)memset(s_paramBuffer, (int)'\0', len + 1U); | ||
755 | (void)memcpy(s_paramBuffer, cmd, len); | ||
756 | |||
757 | p = s_paramBuffer; | ||
758 | position = 0; | ||
759 | argc = 0; | ||
760 | |||
761 | while (position < len) | ||
762 | { | ||
763 | /* Skip all blanks */ | ||
764 | while ((position < len) && ((char)(*p) == ' ')) | ||
765 | { | ||
766 | *p = '\0'; | ||
767 | p++; | ||
768 | position++; | ||
769 | } | ||
770 | |||
771 | if (position >= len) | ||
772 | { | ||
773 | break; | ||
774 | } | ||
775 | |||
776 | /* Process begin of a string */ | ||
777 | if (*p == '"') | ||
778 | { | ||
779 | p++; | ||
780 | position++; | ||
781 | argv[argc] = p; | ||
782 | argc++; | ||
783 | /* Skip this string */ | ||
784 | while ((*p != '"') && (position < len)) | ||
785 | { | ||
786 | p++; | ||
787 | position++; | ||
788 | } | ||
789 | /* Skip '"' */ | ||
790 | *p = '\0'; | ||
791 | p++; | ||
792 | position++; | ||
793 | } | ||
794 | else /* Normal char */ | ||
795 | { | ||
796 | argv[argc] = p; | ||
797 | argc++; | ||
798 | while (((char)*p != ' ') && (position < len)) | ||
799 | { | ||
800 | p++; | ||
801 | position++; | ||
802 | } | ||
803 | } | ||
804 | } | ||
805 | return (int32_t)argc; | ||
806 | } | ||
807 | |||
808 | static shell_status_t SHELL_GetChar(shell_context_handle_t *shellContextHandle, uint8_t *ch) | ||
809 | { | ||
810 | shell_status_t status; | ||
811 | |||
812 | #if (!defined(SDK_DEBUGCONSOLE_UART) && (defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE != 1))) | ||
813 | if (NULL == shellContextHandle->serialHandle) | ||
814 | { | ||
815 | int ret; | ||
816 | ret = getchar(); | ||
817 | if (ret > 0) | ||
818 | { | ||
819 | *ch = (uint8_t)ret; | ||
820 | status = kStatus_SHELL_Success; | ||
821 | } | ||
822 | else | ||
823 | { | ||
824 | status = kStatus_SHELL_Error; | ||
825 | } | ||
826 | } | ||
827 | else | ||
828 | #endif | ||
829 | { | ||
830 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
831 | uint32_t length = 0; | ||
832 | |||
833 | (void)SerialManager_TryRead(shellContextHandle->serialReadHandle, ch, 1, &length); | ||
834 | |||
835 | if (length > 0U) | ||
836 | { | ||
837 | status = kStatus_SHELL_Success; | ||
838 | } | ||
839 | else | ||
840 | { | ||
841 | status = kStatus_SHELL_Error; | ||
842 | } | ||
843 | #else | ||
844 | status = (shell_status_t)SerialManager_ReadBlocking(shellContextHandle->serialReadHandle, ch, 1); | ||
845 | #endif | ||
846 | } | ||
847 | |||
848 | return status; | ||
849 | } | ||
850 | |||
851 | shell_status_t SHELL_Init(shell_handle_t shellHandle, serial_handle_t serialHandle, char *prompt) | ||
852 | { | ||
853 | shell_context_handle_t *shellContextHandle; | ||
854 | serial_manager_status_t status = kStatus_SerialManager_Error; | ||
855 | (void)status; | ||
856 | |||
857 | assert(shellHandle); | ||
858 | #if !(!defined(SDK_DEBUGCONSOLE_UART) && (defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE != 1))) | ||
859 | assert(serialHandle); | ||
860 | #endif | ||
861 | assert(prompt); | ||
862 | assert(SHELL_HANDLE_SIZE >= sizeof(shell_context_handle_t)); | ||
863 | |||
864 | shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
865 | |||
866 | /* memory set for shellHandle */ | ||
867 | (void)memset(shellHandle, 0, SHELL_HANDLE_SIZE); | ||
868 | |||
869 | #if (!defined(SDK_DEBUGCONSOLE_UART) && (defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE != 1))) | ||
870 | if (NULL == serialHandle) | ||
871 | { | ||
872 | } | ||
873 | else | ||
874 | #endif | ||
875 | { | ||
876 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
877 | |||
878 | #if defined(OSA_USED) | ||
879 | |||
880 | #if (defined(SHELL_USE_COMMON_TASK) && (SHELL_USE_COMMON_TASK > 0U)) | ||
881 | (void)COMMON_TASK_init(); | ||
882 | #else | ||
883 | if (KOSA_StatusSuccess != OSA_EventCreate((osa_event_handle_t)shellContextHandle->event, 1U)) | ||
884 | { | ||
885 | return kStatus_SHELL_Error; | ||
886 | } | ||
887 | |||
888 | if (KOSA_StatusSuccess != | ||
889 | OSA_TaskCreate((osa_task_handle_t)shellContextHandle->taskId, OSA_TASK(SHELL_Task), shellContextHandle)) | ||
890 | { | ||
891 | return kStatus_SHELL_Error; | ||
892 | } | ||
893 | #endif | ||
894 | |||
895 | #endif | ||
896 | |||
897 | #endif | ||
898 | } | ||
899 | |||
900 | shellContextHandle->prompt = prompt; | ||
901 | shellContextHandle->serialHandle = serialHandle; | ||
902 | |||
903 | #if (!defined(SDK_DEBUGCONSOLE_UART) && (defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE != 1))) | ||
904 | if (NULL == serialHandle) | ||
905 | { | ||
906 | } | ||
907 | else | ||
908 | #endif | ||
909 | { | ||
910 | shellContextHandle->serialWriteHandle = (serial_write_handle_t)&shellContextHandle->serialWriteHandleBuffer[0]; | ||
911 | status = SerialManager_OpenWriteHandle(shellContextHandle->serialHandle, shellContextHandle->serialWriteHandle); | ||
912 | assert(kStatus_SerialManager_Success == status); | ||
913 | |||
914 | shellContextHandle->serialReadHandle = (serial_read_handle_t)&shellContextHandle->serialReadHandleBuffer[0]; | ||
915 | status = SerialManager_OpenReadHandle(shellContextHandle->serialHandle, shellContextHandle->serialReadHandle); | ||
916 | assert(kStatus_SerialManager_Success == status); | ||
917 | |||
918 | #if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
919 | status = SerialManager_InstallRxCallback(shellContextHandle->serialReadHandle, SHELL_SerialManagerRxCallback, | ||
920 | shellContextHandle); | ||
921 | assert(kStatus_SerialManager_Success == status); | ||
922 | #endif | ||
923 | (void)status; | ||
924 | } | ||
925 | |||
926 | (void)SHELL_RegisterCommand(shellContextHandle, SHELL_COMMAND(help)); | ||
927 | (void)SHELL_RegisterCommand(shellContextHandle, SHELL_COMMAND(exit)); | ||
928 | |||
929 | SHELL_WriteWithCopy(shellContextHandle, "\r\nSHELL build: ", strlen("\r\nSHELL build: ")); | ||
930 | SHELL_WriteWithCopy(shellContextHandle, __DATE__, strlen(__DATE__)); | ||
931 | SHELL_WriteWithCopy(shellContextHandle, "\r\nCopyright 2020 NXP\r\n", strlen("\r\nCopyright 2020 NXP\r\n")); | ||
932 | SHELL_PrintPrompt(shellContextHandle); | ||
933 | |||
934 | return kStatus_SHELL_Success; | ||
935 | } | ||
936 | |||
937 | shell_status_t SHELL_RegisterCommand(shell_handle_t shellHandle, shell_command_t *shellCommand) | ||
938 | { | ||
939 | shell_context_handle_t *shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
940 | assert(shellHandle); | ||
941 | assert(shellCommand); | ||
942 | |||
943 | /* memory set for shellHandle */ | ||
944 | (void)memset(&shellCommand->link, 0, sizeof(shellCommand->link)); | ||
945 | |||
946 | (void)LIST_AddTail(&shellContextHandle->commandContextListHead, &shellCommand->link); | ||
947 | |||
948 | return kStatus_SHELL_Success; | ||
949 | } | ||
950 | |||
951 | shell_status_t SHELL_UnregisterCommand(shell_command_t *shellCommand) | ||
952 | { | ||
953 | assert(shellCommand); | ||
954 | |||
955 | (void)LIST_RemoveElement(&shellCommand->link); | ||
956 | |||
957 | /* memory set for shellHandle */ | ||
958 | (void)memset(&shellCommand->link, 0, sizeof(shellCommand->link)); | ||
959 | |||
960 | return kStatus_SHELL_Success; | ||
961 | } | ||
962 | |||
963 | shell_status_t SHELL_Write(shell_handle_t shellHandle, char *buffer, uint32_t length) | ||
964 | { | ||
965 | shell_context_handle_t *shellContextHandle; | ||
966 | uint32_t primask; | ||
967 | shell_status_t status; | ||
968 | |||
969 | assert(shellHandle); | ||
970 | assert(buffer); | ||
971 | |||
972 | if (!(bool)length) | ||
973 | { | ||
974 | return kStatus_SHELL_Success; | ||
975 | } | ||
976 | |||
977 | shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
978 | |||
979 | primask = DisableGlobalIRQ(); | ||
980 | if ((bool)shellContextHandle->printBusy) | ||
981 | { | ||
982 | EnableGlobalIRQ(primask); | ||
983 | return kStatus_SHELL_Error; | ||
984 | } | ||
985 | shellContextHandle->printBusy = 1U; | ||
986 | EnableGlobalIRQ(primask); | ||
987 | #if (!defined(SDK_DEBUGCONSOLE_UART) && (defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE != 1))) | ||
988 | if (NULL == shellContextHandle->serialHandle) | ||
989 | { | ||
990 | status = kStatus_SHELL_Success; | ||
991 | for (uint32_t index = 0; index < length; index++) | ||
992 | { | ||
993 | (void)putchar(buffer[index]); | ||
994 | } | ||
995 | } | ||
996 | else | ||
997 | #endif | ||
998 | { | ||
999 | status = (shell_status_t)SerialManager_WriteBlocking(shellContextHandle->serialWriteHandle, (uint8_t *)buffer, | ||
1000 | length); | ||
1001 | } | ||
1002 | |||
1003 | shellContextHandle->printBusy = 0U; | ||
1004 | |||
1005 | return status; | ||
1006 | } | ||
1007 | |||
1008 | /* For MISRA to fix const */ | ||
1009 | static void SHELL_WriteWithCopy(shell_handle_t shellHandle, const char *buffer, uint32_t length) | ||
1010 | { | ||
1011 | char s_shellWriteCopyBuffer[128]; | ||
1012 | |||
1013 | assert(length <= 128UL); | ||
1014 | |||
1015 | (void)memcpy(s_shellWriteCopyBuffer, buffer, length); | ||
1016 | (void)SHELL_Write(shellHandle, s_shellWriteCopyBuffer, length); | ||
1017 | } | ||
1018 | |||
1019 | int SHELL_Printf(shell_handle_t shellHandle, const char *formatString, ...) | ||
1020 | { | ||
1021 | shell_context_handle_t *shellContextHandle; | ||
1022 | uint32_t length; | ||
1023 | uint32_t primask; | ||
1024 | va_list ap; | ||
1025 | |||
1026 | assert(shellHandle); | ||
1027 | assert(formatString); | ||
1028 | |||
1029 | shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
1030 | |||
1031 | primask = DisableGlobalIRQ(); | ||
1032 | if ((bool)shellContextHandle->printBusy) | ||
1033 | { | ||
1034 | EnableGlobalIRQ(primask); | ||
1035 | return -1; | ||
1036 | } | ||
1037 | shellContextHandle->printBusy = 1U; | ||
1038 | EnableGlobalIRQ(primask); | ||
1039 | |||
1040 | va_start(ap, formatString); | ||
1041 | |||
1042 | shellContextHandle->printLength = 0U; | ||
1043 | length = (uint32_t)SHELL_Sprintf(shellHandle, formatString, ap); | ||
1044 | #if (!defined(SDK_DEBUGCONSOLE_UART) && (defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE != 1))) | ||
1045 | if (NULL == shellContextHandle->serialHandle) | ||
1046 | { | ||
1047 | for (uint32_t index = 0; index < length; index++) | ||
1048 | { | ||
1049 | (void)putchar(shellContextHandle->printBuffer[index]); | ||
1050 | } | ||
1051 | } | ||
1052 | else | ||
1053 | #endif | ||
1054 | { | ||
1055 | (void)SerialManager_WriteBlocking(shellContextHandle->serialWriteHandle, | ||
1056 | (uint8_t *)shellContextHandle->printBuffer, length); | ||
1057 | } | ||
1058 | va_end(ap); | ||
1059 | |||
1060 | shellContextHandle->printBusy = 0U; | ||
1061 | return (int32_t)shellContextHandle->printLength; | ||
1062 | } | ||
1063 | |||
1064 | void SHELL_ChangePrompt(shell_handle_t shellHandle, char *prompt) | ||
1065 | { | ||
1066 | shell_context_handle_t *shellContextHandle; | ||
1067 | assert(shellHandle); | ||
1068 | assert(prompt); | ||
1069 | |||
1070 | shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
1071 | |||
1072 | shellContextHandle->prompt = prompt; | ||
1073 | SHELL_PrintPrompt(shellContextHandle); | ||
1074 | } | ||
1075 | |||
1076 | void SHELL_PrintPrompt(shell_handle_t shellHandle) | ||
1077 | { | ||
1078 | shell_context_handle_t *shellContextHandle; | ||
1079 | assert(shellHandle); | ||
1080 | |||
1081 | shellContextHandle = (shell_context_handle_t *)shellHandle; | ||
1082 | |||
1083 | SHELL_WriteWithCopy(shellContextHandle, "\r\n", 2U); /* MISRA C-2012 Rule 7.4 */ | ||
1084 | (void)SHELL_Write(shellContextHandle, shellContextHandle->prompt, strlen(shellContextHandle->prompt)); | ||
1085 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_shell.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_shell.h new file mode 100644 index 000000000..28eace717 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54005/utilities/fsl_shell.h | |||
@@ -0,0 +1,292 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2020 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef __FSL_SHELL_H__ | ||
10 | #define __FSL_SHELL_H__ | ||
11 | |||
12 | /*! | ||
13 | * @addtogroup SHELL | ||
14 | * @{ | ||
15 | */ | ||
16 | |||
17 | #include "fsl_common.h" | ||
18 | #include "fsl_component_serial_manager.h" | ||
19 | #include "fsl_component_generic_list.h" | ||
20 | |||
21 | /******************************************************************************* | ||
22 | * Definitions | ||
23 | ******************************************************************************/ | ||
24 | |||
25 | /*! @brief Whether use non-blocking mode. */ | ||
26 | #ifndef SHELL_NON_BLOCKING_MODE | ||
27 | #define SHELL_NON_BLOCKING_MODE SERIAL_MANAGER_NON_BLOCKING_MODE | ||
28 | #endif | ||
29 | |||
30 | /*! @brief Macro to set on/off auto-complete feature. */ | ||
31 | #define SHELL_AUTO_COMPLETE (1U) | ||
32 | |||
33 | /*! @brief Macro to set console buffer size. */ | ||
34 | #ifndef SHELL_BUFFER_SIZE | ||
35 | #define SHELL_BUFFER_SIZE (64U) | ||
36 | #endif | ||
37 | |||
38 | /*! @brief Macro to set maximum arguments in command. */ | ||
39 | #define SHELL_MAX_ARGS (8U) | ||
40 | |||
41 | /*! @brief Macro to set maximum count of history commands. */ | ||
42 | #ifndef SHELL_HISTORY_COUNT | ||
43 | #define SHELL_HISTORY_COUNT (3U) | ||
44 | #endif | ||
45 | |||
46 | /*! @brief Macro to bypass arguments check */ | ||
47 | #define SHELL_IGNORE_PARAMETER_COUNT (0xFF) | ||
48 | |||
49 | /*! @brief The handle size of the shell module. It is the sum of the SHELL_HISTORY_COUNT * SHELL_BUFFER_SIZE + | ||
50 | * SHELL_BUFFER_SIZE + SERIAL_MANAGER_READ_HANDLE_SIZE + SERIAL_MANAGER_WRITE_HANDLE_SIZE*/ | ||
51 | #define SHELL_HANDLE_SIZE \ | ||
52 | (160U + SHELL_HISTORY_COUNT * SHELL_BUFFER_SIZE + SHELL_BUFFER_SIZE + SERIAL_MANAGER_READ_HANDLE_SIZE + \ | ||
53 | SERIAL_MANAGER_WRITE_HANDLE_SIZE) | ||
54 | |||
55 | /*! @brief Macro to determine whether use common task. */ | ||
56 | #ifndef SHELL_USE_COMMON_TASK | ||
57 | #define SHELL_USE_COMMON_TASK (0U) | ||
58 | #endif | ||
59 | |||
60 | /*! @brief Macro to set shell task priority. */ | ||
61 | #ifndef SHELL_TASK_PRIORITY | ||
62 | #define SHELL_TASK_PRIORITY (2U) | ||
63 | #endif | ||
64 | |||
65 | /*! @brief Macro to set shell task stack size. */ | ||
66 | #ifndef SHELL_TASK_STACK_SIZE | ||
67 | #define SHELL_TASK_STACK_SIZE (1000U) | ||
68 | #endif | ||
69 | |||
70 | /*! @brief Shell status */ | ||
71 | typedef enum _shell_status | ||
72 | { | ||
73 | kStatus_SHELL_Success = kStatus_Success, /*!< Success */ | ||
74 | kStatus_SHELL_Error = MAKE_STATUS(kStatusGroup_SHELL, 1), /*!< Failed */ | ||
75 | kStatus_SHELL_OpenWriteHandleFailed = MAKE_STATUS(kStatusGroup_SHELL, 2), /*!< Open write handle failed */ | ||
76 | kStatus_SHELL_OpenReadHandleFailed = MAKE_STATUS(kStatusGroup_SHELL, 3), /*!< Open read handle failed */ | ||
77 | } shell_status_t; | ||
78 | |||
79 | /*! @brief The handle of the shell module */ | ||
80 | typedef void *shell_handle_t; | ||
81 | |||
82 | /*! @brief User command function prototype. */ | ||
83 | typedef shell_status_t (*cmd_function_t)(shell_handle_t shellHandle, int32_t argc, char **argv); | ||
84 | |||
85 | /*! @brief User command data configuration structure. */ | ||
86 | typedef struct _shell_command | ||
87 | { | ||
88 | const char *pcCommand; /*!< The command that is executed. For example "help". It must be all lower case. */ | ||
89 | char *pcHelpString; /*!< String that describes how to use the command. It should start with the command itself, | ||
90 | and end with "\r\n". For example "help: Returns a list of all the commands\r\n". */ | ||
91 | const cmd_function_t | ||
92 | pFuncCallBack; /*!< A pointer to the callback function that returns the output generated by the command. */ | ||
93 | uint8_t cExpectedNumberOfParameters; /*!< Commands expect a fixed number of parameters, which may be zero. */ | ||
94 | list_element_t link; /*!< link of the element */ | ||
95 | } shell_command_t; | ||
96 | |||
97 | /*! | ||
98 | * @brief Defines the shell handle | ||
99 | * | ||
100 | * This macro is used to define a 4 byte aligned shell handle. | ||
101 | * Then use "(shell_handle_t)name" to get the shell handle. | ||
102 | * | ||
103 | * The macro should be global and could be optional. You could also define shell handle by yourself. | ||
104 | * | ||
105 | * This is an example, | ||
106 | * @code | ||
107 | * SHELL_HANDLE_DEFINE(shellHandle); | ||
108 | * @endcode | ||
109 | * | ||
110 | * @param name The name string of the shell handle. | ||
111 | */ | ||
112 | #define SHELL_HANDLE_DEFINE(name) uint32_t name[((SHELL_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))] | ||
113 | |||
114 | #if defined(__ICCARM__) | ||
115 | /* disable misra 19.13 */ | ||
116 | _Pragma("diag_suppress=Pm120") | ||
117 | #endif | ||
118 | /*! | ||
119 | * @brief Defines the shell command structure | ||
120 | * | ||
121 | * This macro is used to define the shell command structure #shell_command_t. | ||
122 | * And then uses the macro SHELL_COMMAND to get the command structure pointer. | ||
123 | * The macro should not be used in any function. | ||
124 | * | ||
125 | * This is a example, | ||
126 | * @code | ||
127 | * SHELL_COMMAND_DEFINE(exit, "\r\n\"exit\": Exit program\r\n", SHELL_ExitCommand, 0); | ||
128 | * SHELL_RegisterCommand(s_shellHandle, SHELL_COMMAND(exit)); | ||
129 | * @endcode | ||
130 | * | ||
131 | * @param command The command string of the command. The double quotes do not need. Such as exit for "exit", | ||
132 | * help for "Help", read for "read". | ||
133 | * @param descriptor The description of the command is used for showing the command usage when "help" is typing. | ||
134 | * @param callback The callback of the command is used to handle the command line when the input command is matched. | ||
135 | * @param paramCount The max parameter count of the current command. | ||
136 | */ | ||
137 | #define SHELL_COMMAND_DEFINE(command, descriptor, callback, paramCount) \ | ||
138 | \ | ||
139 | shell_command_t g_shellCommand##command = { \ | ||
140 | (#command), (descriptor), (callback), (paramCount), {0}, \ | ||
141 | } | ||
142 | |||
143 | /*! | ||
144 | * @brief Gets the shell command pointer | ||
145 | * | ||
146 | * This macro is used to get the shell command pointer. The macro should not be used before the macro | ||
147 | * SHELL_COMMAND_DEFINE is used. | ||
148 | * | ||
149 | * @param command The command string of the command. The double quotes do not need. Such as exit for "exit", | ||
150 | * help for "Help", read for "read". | ||
151 | */ | ||
152 | #define SHELL_COMMAND(command) &g_shellCommand##command | ||
153 | |||
154 | #if defined(__ICCARM__) | ||
155 | _Pragma("diag_default=Pm120") | ||
156 | #endif | ||
157 | |||
158 | /******************************************************************************* | ||
159 | * API | ||
160 | ******************************************************************************/ | ||
161 | |||
162 | #if defined(__cplusplus) | ||
163 | extern "C" | ||
164 | { | ||
165 | #endif /* _cplusplus */ | ||
166 | |||
167 | /*! | ||
168 | * @name Shell functional operation | ||
169 | * @{ | ||
170 | */ | ||
171 | |||
172 | /*! | ||
173 | * @brief Initializes the shell module | ||
174 | * | ||
175 | * This function must be called before calling all other Shell functions. | ||
176 | * Call operation the Shell commands with user-defined settings. | ||
177 | * The example below shows how to set up the Shell and | ||
178 | * how to call the SHELL_Init function by passing in these parameters. | ||
179 | * This is an example. | ||
180 | * @code | ||
181 | * static SHELL_HANDLE_DEFINE(s_shellHandle); | ||
182 | * SHELL_Init((shell_handle_t)s_shellHandle, (serial_handle_t)s_serialHandle, "Test@SHELL>"); | ||
183 | * @endcode | ||
184 | * @param shellHandle Pointer to point to a memory space of size #SHELL_HANDLE_SIZE allocated by the caller. | ||
185 | * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. | ||
186 | * You can define the handle in the following two ways: | ||
187 | * #SHELL_HANDLE_DEFINE(shellHandle); | ||
188 | * or | ||
189 | * uint32_t shellHandle[((SHELL_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; | ||
190 | * @param serialHandle The serial manager module handle pointer. | ||
191 | * @param prompt The string prompt pointer of Shell. Only the global variable can be passed. | ||
192 | * @retval kStatus_SHELL_Success The shell initialization succeed. | ||
193 | * @retval kStatus_SHELL_Error An error occurred when the shell is initialized. | ||
194 | * @retval kStatus_SHELL_OpenWriteHandleFailed Open the write handle failed. | ||
195 | * @retval kStatus_SHELL_OpenReadHandleFailed Open the read handle failed. | ||
196 | */ | ||
197 | shell_status_t SHELL_Init(shell_handle_t shellHandle, serial_handle_t serialHandle, char *prompt); | ||
198 | |||
199 | /*! | ||
200 | * @brief Registers the shell command | ||
201 | * | ||
202 | * This function is used to register the shell command by using the command configuration shell_command_config_t. | ||
203 | * This is a example, | ||
204 | * @code | ||
205 | * SHELL_COMMAND_DEFINE(exit, "\r\n\"exit\": Exit program\r\n", SHELL_ExitCommand, 0); | ||
206 | * SHELL_RegisterCommand(s_shellHandle, SHELL_COMMAND(exit)); | ||
207 | * @endcode | ||
208 | * @param shellHandle The shell module handle pointer. | ||
209 | * @param shellCommand The command element. | ||
210 | * @retval kStatus_SHELL_Success Successfully register the command. | ||
211 | * @retval kStatus_SHELL_Error An error occurred. | ||
212 | */ | ||
213 | shell_status_t SHELL_RegisterCommand(shell_handle_t shellHandle, shell_command_t * shellCommand); | ||
214 | |||
215 | /*! | ||
216 | * @brief Unregisters the shell command | ||
217 | * | ||
218 | * This function is used to unregister the shell command. | ||
219 | * | ||
220 | * @param shellCommand The command element. | ||
221 | * @retval kStatus_SHELL_Success Successfully unregister the command. | ||
222 | */ | ||
223 | shell_status_t SHELL_UnregisterCommand(shell_command_t * shellCommand); | ||
224 | |||
225 | /*! | ||
226 | * @brief Sends data to the shell output stream. | ||
227 | * | ||
228 | * This function is used to send data to the shell output stream. | ||
229 | * | ||
230 | * @param shellHandle The shell module handle pointer. | ||
231 | * @param buffer Start address of the data to write. | ||
232 | * @param length Length of the data to write. | ||
233 | * @retval kStatus_SHELL_Success Successfully send data. | ||
234 | * @retval kStatus_SHELL_Error An error occurred. | ||
235 | */ | ||
236 | shell_status_t SHELL_Write(shell_handle_t shellHandle, char *buffer, uint32_t length); | ||
237 | |||
238 | /*! | ||
239 | * @brief Writes formatted output to the shell output stream. | ||
240 | * | ||
241 | * Call this function to write a formatted output to the shell output stream. | ||
242 | * | ||
243 | * @param shellHandle The shell module handle pointer. | ||
244 | * | ||
245 | * @param formatString Format string. | ||
246 | * @return Returns the number of characters printed or a negative value if an error occurs. | ||
247 | */ | ||
248 | int SHELL_Printf(shell_handle_t shellHandle, const char *formatString, ...); | ||
249 | |||
250 | /*! | ||
251 | * @brief Change shell prompt. | ||
252 | * | ||
253 | * Call this function to change shell prompt. | ||
254 | * | ||
255 | * @param shellHandle The shell module handle pointer. | ||
256 | * | ||
257 | * @param prompt The string which will be used for command prompt | ||
258 | * @return NULL. | ||
259 | */ | ||
260 | void SHELL_ChangePrompt(shell_handle_t shellHandle, char *prompt); | ||
261 | |||
262 | /*! | ||
263 | * @brief Print shell prompt. | ||
264 | * | ||
265 | * Call this function to print shell prompt. | ||
266 | * | ||
267 | * @param shellHandle The shell module handle pointer. | ||
268 | * | ||
269 | * @return NULL. | ||
270 | */ | ||
271 | void SHELL_PrintPrompt(shell_handle_t shellHandle); | ||
272 | |||
273 | /*! | ||
274 | * @brief The task function for Shell. | ||
275 | * The task function for Shell; The function should be polled by upper layer. | ||
276 | * This function does not return until Shell command exit was called. | ||
277 | * | ||
278 | * @param shellHandle The shell module handle pointer. | ||
279 | */ | ||
280 | #if !(defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U)) | ||
281 | void SHELL_Task(shell_handle_t shellHandle); | ||
282 | #endif | ||
283 | |||
284 | /* @} */ | ||
285 | |||
286 | #if defined(__cplusplus) | ||
287 | } | ||
288 | #endif | ||
289 | |||
290 | /*! @}*/ | ||
291 | |||
292 | #endif /* __FSL_SHELL_H__ */ | ||