Contiki 3.x
MKL25Z4_extension.h
1 /*
2 ** ###################################################################
3 ** Compilers: Keil ARM C/C++ Compiler
4 ** Freescale C/C++ for Embedded ARM
5 ** GNU C Compiler
6 ** GNU C Compiler - CodeSourcery Sourcery G++
7 ** IAR ANSI C/C++ Compiler for ARM
8 **
9 ** Reference manual: KL25P80M48SF0RM, Rev.3, Sep 2012
10 ** Version: rev. 2.5, 2015-02-19
11 ** Build: b150612
12 **
13 ** Abstract:
14 ** Extension to the CMSIS register access layer header.
15 **
16 ** Copyright (c) 2015 Freescale Semiconductor, Inc.
17 ** All rights reserved.
18 **
19 ** Redistribution and use in source and binary forms, with or without modification,
20 ** are permitted provided that the following conditions are met:
21 **
22 ** o Redistributions of source code must retain the above copyright notice, this list
23 ** of conditions and the following disclaimer.
24 **
25 ** o Redistributions in binary form must reproduce the above copyright notice, this
26 ** list of conditions and the following disclaimer in the documentation and/or
27 ** other materials provided with the distribution.
28 **
29 ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
30 ** contributors may be used to endorse or promote products derived from this
31 ** software without specific prior written permission.
32 **
33 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
37 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
40 ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 **
44 ** http: www.freescale.com
45 ** mail: support@freescale.com
46 **
47 ** Revisions:
48 ** - rev. 1.0 (2012-06-13)
49 ** Initial version.
50 ** - rev. 1.1 (2012-06-21)
51 ** Update according to reference manual rev. 1.
52 ** - rev. 1.2 (2012-08-01)
53 ** Device type UARTLP changed to UART0.
54 ** - rev. 1.3 (2012-10-04)
55 ** Update according to reference manual rev. 3.
56 ** - rev. 1.4 (2012-11-22)
57 ** MCG module - bit LOLS in MCG_S register renamed to LOLS0.
58 ** NV registers - bit EZPORT_DIS in NV_FOPT register removed.
59 ** - rev. 2.0 (2013-10-29)
60 ** Register accessor macros added to the memory map.
61 ** Symbols for Processor Expert memory map compatibility added to the memory map.
62 ** Startup file for gcc has been updated according to CMSIS 3.2.
63 ** System initialization updated.
64 ** - rev. 2.1 (2014-07-16)
65 ** Module access macro module_BASES replaced by module_BASE_PTRS.
66 ** System initialization and startup updated.
67 ** - rev. 2.2 (2014-08-22)
68 ** System initialization updated - default clock config changed.
69 ** - rev. 2.3 (2014-08-28)
70 ** Update of startup files - possibility to override DefaultISR added.
71 ** - rev. 2.4 (2014-10-14)
72 ** Interrupt INT_LPTimer renamed to INT_LPTMR0.
73 ** - rev. 2.5 (2015-02-19)
74 ** Renamed interrupt vector LLW to LLWU.
75 **
76 ** ###################################################################
77 */
78 
79 /*
80  * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
81  *
82  * This file was generated automatically and any changes may be lost.
83  */
84 #ifndef __MKL25Z4_EXTENSION_H__
85 #define __MKL25Z4_EXTENSION_H__
86 
87 #include "MKL25Z4.h"
88 #include "fsl_bitaccess.h"
89 
90 #if defined(__IAR_SYSTEMS_ICC__)
91  /*
92  * Suppress "Error[Pm008]: sections of code should not be 'commented out' (MISRA C 2004 rule 2.4)"
93  * as some register descriptions contain code examples
94  */
95  #pragma diag_suppress=pm008
96 #endif
97 
98 /*
99  * MKL25Z4 ADC
100  *
101  * Analog-to-Digital Converter
102  *
103  * Registers defined in this header file:
104  * - ADC_SC1 - ADC Status and Control Registers 1
105  * - ADC_CFG1 - ADC Configuration Register 1
106  * - ADC_CFG2 - ADC Configuration Register 2
107  * - ADC_R - ADC Data Result Register
108  * - ADC_CV1 - Compare Value Registers
109  * - ADC_CV2 - Compare Value Registers
110  * - ADC_SC2 - Status and Control Register 2
111  * - ADC_SC3 - Status and Control Register 3
112  * - ADC_OFS - ADC Offset Correction Register
113  * - ADC_PG - ADC Plus-Side Gain Register
114  * - ADC_MG - ADC Minus-Side Gain Register
115  * - ADC_CLPD - ADC Plus-Side General Calibration Value Register
116  * - ADC_CLPS - ADC Plus-Side General Calibration Value Register
117  * - ADC_CLP4 - ADC Plus-Side General Calibration Value Register
118  * - ADC_CLP3 - ADC Plus-Side General Calibration Value Register
119  * - ADC_CLP2 - ADC Plus-Side General Calibration Value Register
120  * - ADC_CLP1 - ADC Plus-Side General Calibration Value Register
121  * - ADC_CLP0 - ADC Plus-Side General Calibration Value Register
122  * - ADC_CLMD - ADC Minus-Side General Calibration Value Register
123  * - ADC_CLMS - ADC Minus-Side General Calibration Value Register
124  * - ADC_CLM4 - ADC Minus-Side General Calibration Value Register
125  * - ADC_CLM3 - ADC Minus-Side General Calibration Value Register
126  * - ADC_CLM2 - ADC Minus-Side General Calibration Value Register
127  * - ADC_CLM1 - ADC Minus-Side General Calibration Value Register
128  * - ADC_CLM0 - ADC Minus-Side General Calibration Value Register
129  */
130 
131 #define ADC_INSTANCE_COUNT (1U) /*!< Number of instances of the ADC module. */
132 #define ADC0_IDX (0U) /*!< Instance number for ADC0. */
133 
134 /*******************************************************************************
135  * ADC_SC1 - ADC Status and Control Registers 1
136  ******************************************************************************/
137 
138 /*!
139  * @brief ADC_SC1 - ADC Status and Control Registers 1 (RW)
140  *
141  * Reset value: 0x0000001FU
142  *
143  * SC1A is used for both software and hardware trigger modes of operation. To
144  * allow sequential conversions of the ADC to be triggered by internal peripherals,
145  * the ADC can have more then one status and control register: one for each
146  * conversion. The SC1B-SC1n registers indicate potentially multiple SC1 registers
147  * for use only in hardware trigger mode. See the chip configuration information
148  * about the number of SC1n registers specific to this device. The SC1n registers
149  * have identical fields, and are used in a "ping-pong" approach to control ADC
150  * operation. At any one point in time, only one of the SC1n registers is actively
151  * controlling ADC conversions. Updating SC1A while SC1n is actively controlling
152  * a conversion is allowed, and vice-versa for any of the SC1n registers specific
153  * to this MCU. Writing SC1A while SC1A is actively controlling a conversion
154  * aborts the current conversion. In Software Trigger mode, when SC2[ADTRG]=0,
155  * writes to SC1A subsequently initiate a new conversion, if SC1[ADCH] contains a
156  * value other than all 1s. Writing any of the SC1n registers while that specific
157  * SC1n register is actively controlling a conversion aborts the current conversion.
158  * None of the SC1B-SC1n registers are used for software trigger operation and
159  * therefore writes to the SC1B-SC1n registers do not initiate a new conversion.
160  */
161 /*!
162  * @name Constants and macros for entire ADC_SC1 register
163  */
164 /*@{*/
165 #define ADC_RD_SC1(base, index) (ADC_SC1_REG(base, index))
166 #define ADC_WR_SC1(base, index, value) (ADC_SC1_REG(base, index) = (value))
167 #define ADC_RMW_SC1(base, index, mask, value) (ADC_WR_SC1(base, index, (ADC_RD_SC1(base, index) & ~(mask)) | (value)))
168 #define ADC_SET_SC1(base, index, value) (BME_OR32(&ADC_SC1_REG(base, index), (uint32_t)(value)))
169 #define ADC_CLR_SC1(base, index, value) (BME_AND32(&ADC_SC1_REG(base, index), (uint32_t)(~(value))))
170 #define ADC_TOG_SC1(base, index, value) (BME_XOR32(&ADC_SC1_REG(base, index), (uint32_t)(value)))
171 /*@}*/
172 
173 /*
174  * Constants & macros for individual ADC_SC1 bitfields
175  */
176 
177 /*!
178  * @name Register ADC_SC1, field ADCH[4:0] (RW)
179  *
180  * Selects one of the input channels. The input channel decode depends on the
181  * value of DIFF. DAD0-DAD3 are associated with the input pin pairs DADPx and
182  * DADMx. Some of the input channel options in the bitfield-setting descriptions might
183  * not be available for your device. For the actual ADC channel assignments for
184  * your device, see the Chip Configuration details. The successive approximation
185  * converter subsystem is turned off when the channel select bits are all set,
186  * that is, ADCH = 11111. This feature allows explicit disabling of the ADC and
187  * isolation of the input channel from all sources. Terminating continuous
188  * conversions this way prevents an additional single conversion from being performed. It
189  * is not necessary to set ADCH to all 1s to place the ADC in a low-power state
190  * when continuous conversions are not enabled because the module automatically
191  * enters a low-power state when a conversion completes.
192  *
193  * Values:
194  * - 0b00000 - When DIFF=0, DADP0 is selected as input; when DIFF=1, DAD0 is
195  * selected as input.
196  * - 0b00001 - When DIFF=0, DADP1 is selected as input; when DIFF=1, DAD1 is
197  * selected as input.
198  * - 0b00010 - When DIFF=0, DADP2 is selected as input; when DIFF=1, DAD2 is
199  * selected as input.
200  * - 0b00011 - When DIFF=0, DADP3 is selected as input; when DIFF=1, DAD3 is
201  * selected as input.
202  * - 0b00100 - When DIFF=0, AD4 is selected as input; when DIFF=1, it is
203  * reserved.
204  * - 0b00101 - When DIFF=0, AD5 is selected as input; when DIFF=1, it is
205  * reserved.
206  * - 0b00110 - When DIFF=0, AD6 is selected as input; when DIFF=1, it is
207  * reserved.
208  * - 0b00111 - When DIFF=0, AD7 is selected as input; when DIFF=1, it is
209  * reserved.
210  * - 0b01000 - When DIFF=0, AD8 is selected as input; when DIFF=1, it is
211  * reserved.
212  * - 0b01001 - When DIFF=0, AD9 is selected as input; when DIFF=1, it is
213  * reserved.
214  * - 0b01010 - When DIFF=0, AD10 is selected as input; when DIFF=1, it is
215  * reserved.
216  * - 0b01011 - When DIFF=0, AD11 is selected as input; when DIFF=1, it is
217  * reserved.
218  * - 0b01100 - When DIFF=0, AD12 is selected as input; when DIFF=1, it is
219  * reserved.
220  * - 0b01101 - When DIFF=0, AD13 is selected as input; when DIFF=1, it is
221  * reserved.
222  * - 0b01110 - When DIFF=0, AD14 is selected as input; when DIFF=1, it is
223  * reserved.
224  * - 0b01111 - When DIFF=0, AD15 is selected as input; when DIFF=1, it is
225  * reserved.
226  * - 0b10000 - When DIFF=0, AD16 is selected as input; when DIFF=1, it is
227  * reserved.
228  * - 0b10001 - When DIFF=0, AD17 is selected as input; when DIFF=1, it is
229  * reserved.
230  * - 0b10010 - When DIFF=0, AD18 is selected as input; when DIFF=1, it is
231  * reserved.
232  * - 0b10011 - When DIFF=0, AD19 is selected as input; when DIFF=1, it is
233  * reserved.
234  * - 0b10100 - When DIFF=0, AD20 is selected as input; when DIFF=1, it is
235  * reserved.
236  * - 0b10101 - When DIFF=0, AD21 is selected as input; when DIFF=1, it is
237  * reserved.
238  * - 0b10110 - When DIFF=0, AD22 is selected as input; when DIFF=1, it is
239  * reserved.
240  * - 0b10111 - When DIFF=0, AD23 is selected as input; when DIFF=1, it is
241  * reserved.
242  * - 0b11000 - Reserved.
243  * - 0b11001 - Reserved.
244  * - 0b11010 - When DIFF=0, Temp Sensor (single-ended) is selected as input;
245  * when DIFF=1, Temp Sensor (differential) is selected as input.
246  * - 0b11011 - When DIFF=0, Bandgap (single-ended) is selected as input; when
247  * DIFF=1, Bandgap (differential) is selected as input.
248  * - 0b11100 - Reserved.
249  * - 0b11101 - When DIFF=0,VREFSH is selected as input; when DIFF=1, -VREFSH
250  * (differential) is selected as input. Voltage reference selected is determined
251  * by SC2[REFSEL].
252  * - 0b11110 - When DIFF=0,VREFSL is selected as input; when DIFF=1, it is
253  * reserved. Voltage reference selected is determined by SC2[REFSEL].
254  * - 0b11111 - Module is disabled.
255  */
256 /*@{*/
257 /*! @brief Read current value of the ADC_SC1_ADCH field. */
258 #define ADC_RD_SC1_ADCH(base, index) ((ADC_SC1_REG(base, index) & ADC_SC1_ADCH_MASK) >> ADC_SC1_ADCH_SHIFT)
259 #define ADC_BRD_SC1_ADCH(base, index) (BME_UBFX32(&ADC_SC1_REG(base, index), ADC_SC1_ADCH_SHIFT, ADC_SC1_ADCH_WIDTH))
260 
261 /*! @brief Set the ADCH field to a new value. */
262 #define ADC_WR_SC1_ADCH(base, index, value) (ADC_RMW_SC1(base, index, ADC_SC1_ADCH_MASK, ADC_SC1_ADCH(value)))
263 #define ADC_BWR_SC1_ADCH(base, index, value) (BME_BFI32(&ADC_SC1_REG(base, index), ((uint32_t)(value) << ADC_SC1_ADCH_SHIFT), ADC_SC1_ADCH_SHIFT, ADC_SC1_ADCH_WIDTH))
264 /*@}*/
265 
266 /*!
267  * @name Register ADC_SC1, field DIFF[5] (RW)
268  *
269  * Configures the ADC to operate in differential mode. When enabled, this mode
270  * automatically selects from the differential channels, and changes the
271  * conversion algorithm and the number of cycles to complete a conversion.
272  *
273  * Values:
274  * - 0b0 - Single-ended conversions and input channels are selected.
275  * - 0b1 - Differential conversions and input channels are selected.
276  */
277 /*@{*/
278 /*! @brief Read current value of the ADC_SC1_DIFF field. */
279 #define ADC_RD_SC1_DIFF(base, index) ((ADC_SC1_REG(base, index) & ADC_SC1_DIFF_MASK) >> ADC_SC1_DIFF_SHIFT)
280 #define ADC_BRD_SC1_DIFF(base, index) (BME_UBFX32(&ADC_SC1_REG(base, index), ADC_SC1_DIFF_SHIFT, ADC_SC1_DIFF_WIDTH))
281 
282 /*! @brief Set the DIFF field to a new value. */
283 #define ADC_WR_SC1_DIFF(base, index, value) (ADC_RMW_SC1(base, index, ADC_SC1_DIFF_MASK, ADC_SC1_DIFF(value)))
284 #define ADC_BWR_SC1_DIFF(base, index, value) (BME_BFI32(&ADC_SC1_REG(base, index), ((uint32_t)(value) << ADC_SC1_DIFF_SHIFT), ADC_SC1_DIFF_SHIFT, ADC_SC1_DIFF_WIDTH))
285 /*@}*/
286 
287 /*!
288  * @name Register ADC_SC1, field AIEN[6] (RW)
289  *
290  * Enables conversion complete interrupts. When COCO becomes set while the
291  * respective AIEN is high, an interrupt is asserted.
292  *
293  * Values:
294  * - 0b0 - Conversion complete interrupt is disabled.
295  * - 0b1 - Conversion complete interrupt is enabled.
296  */
297 /*@{*/
298 /*! @brief Read current value of the ADC_SC1_AIEN field. */
299 #define ADC_RD_SC1_AIEN(base, index) ((ADC_SC1_REG(base, index) & ADC_SC1_AIEN_MASK) >> ADC_SC1_AIEN_SHIFT)
300 #define ADC_BRD_SC1_AIEN(base, index) (BME_UBFX32(&ADC_SC1_REG(base, index), ADC_SC1_AIEN_SHIFT, ADC_SC1_AIEN_WIDTH))
301 
302 /*! @brief Set the AIEN field to a new value. */
303 #define ADC_WR_SC1_AIEN(base, index, value) (ADC_RMW_SC1(base, index, ADC_SC1_AIEN_MASK, ADC_SC1_AIEN(value)))
304 #define ADC_BWR_SC1_AIEN(base, index, value) (BME_BFI32(&ADC_SC1_REG(base, index), ((uint32_t)(value) << ADC_SC1_AIEN_SHIFT), ADC_SC1_AIEN_SHIFT, ADC_SC1_AIEN_WIDTH))
305 /*@}*/
306 
307 /*!
308  * @name Register ADC_SC1, field COCO[7] (RO)
309  *
310  * This is a read-only field that is set each time a conversion is completed
311  * when the compare function is disabled, or SC2[ACFE]=0 and the hardware average
312  * function is disabled, or SC3[AVGE]=0. When the compare function is enabled, or
313  * SC2[ACFE]=1, COCO is set upon completion of a conversion only if the compare
314  * result is true. When the hardware average function is enabled, or SC3[AVGE]=1,
315  * COCO is set upon completion of the selected number of conversions (determined
316  * by AVGS). COCO in SC1A is also set at the completion of a calibration sequence.
317  * COCO is cleared when the respective SC1n register is written or when the
318  * respective Rn register is read.
319  *
320  * Values:
321  * - 0b0 - Conversion is not completed.
322  * - 0b1 - Conversion is completed.
323  */
324 /*@{*/
325 /*! @brief Read current value of the ADC_SC1_COCO field. */
326 #define ADC_RD_SC1_COCO(base, index) ((ADC_SC1_REG(base, index) & ADC_SC1_COCO_MASK) >> ADC_SC1_COCO_SHIFT)
327 #define ADC_BRD_SC1_COCO(base, index) (BME_UBFX32(&ADC_SC1_REG(base, index), ADC_SC1_COCO_SHIFT, ADC_SC1_COCO_WIDTH))
328 /*@}*/
329 
330 /*******************************************************************************
331  * ADC_CFG1 - ADC Configuration Register 1
332  ******************************************************************************/
333 
334 /*!
335  * @brief ADC_CFG1 - ADC Configuration Register 1 (RW)
336  *
337  * Reset value: 0x00000000U
338  *
339  * The configuration Register 1 (CFG1) selects the mode of operation, clock
340  * source, clock divide, and configuration for low power or long sample time.
341  */
342 /*!
343  * @name Constants and macros for entire ADC_CFG1 register
344  */
345 /*@{*/
346 #define ADC_RD_CFG1(base) (ADC_CFG1_REG(base))
347 #define ADC_WR_CFG1(base, value) (ADC_CFG1_REG(base) = (value))
348 #define ADC_RMW_CFG1(base, mask, value) (ADC_WR_CFG1(base, (ADC_RD_CFG1(base) & ~(mask)) | (value)))
349 #define ADC_SET_CFG1(base, value) (BME_OR32(&ADC_CFG1_REG(base), (uint32_t)(value)))
350 #define ADC_CLR_CFG1(base, value) (BME_AND32(&ADC_CFG1_REG(base), (uint32_t)(~(value))))
351 #define ADC_TOG_CFG1(base, value) (BME_XOR32(&ADC_CFG1_REG(base), (uint32_t)(value)))
352 /*@}*/
353 
354 /*
355  * Constants & macros for individual ADC_CFG1 bitfields
356  */
357 
358 /*!
359  * @name Register ADC_CFG1, field ADICLK[1:0] (RW)
360  *
361  * Selects the input clock source to generate the internal clock, ADCK. Note
362  * that when the ADACK clock source is selected, it is not required to be active
363  * prior to conversion start. When it is selected and it is not active prior to a
364  * conversion start, when CFG2[ADACKEN]=0, the asynchronous clock is activated at
365  * the start of a conversion and deactivated when conversions are terminated. In
366  * this case, there is an associated clock startup delay each time the clock
367  * source is re-activated.
368  *
369  * Values:
370  * - 0b00 - Bus clock
371  * - 0b01 - (Bus clock)/2
372  * - 0b10 - Alternate clock (ALTCLK)
373  * - 0b11 - Asynchronous clock (ADACK)
374  */
375 /*@{*/
376 /*! @brief Read current value of the ADC_CFG1_ADICLK field. */
377 #define ADC_RD_CFG1_ADICLK(base) ((ADC_CFG1_REG(base) & ADC_CFG1_ADICLK_MASK) >> ADC_CFG1_ADICLK_SHIFT)
378 #define ADC_BRD_CFG1_ADICLK(base) (BME_UBFX32(&ADC_CFG1_REG(base), ADC_CFG1_ADICLK_SHIFT, ADC_CFG1_ADICLK_WIDTH))
379 
380 /*! @brief Set the ADICLK field to a new value. */
381 #define ADC_WR_CFG1_ADICLK(base, value) (ADC_RMW_CFG1(base, ADC_CFG1_ADICLK_MASK, ADC_CFG1_ADICLK(value)))
382 #define ADC_BWR_CFG1_ADICLK(base, value) (BME_BFI32(&ADC_CFG1_REG(base), ((uint32_t)(value) << ADC_CFG1_ADICLK_SHIFT), ADC_CFG1_ADICLK_SHIFT, ADC_CFG1_ADICLK_WIDTH))
383 /*@}*/
384 
385 /*!
386  * @name Register ADC_CFG1, field MODE[3:2] (RW)
387  *
388  * Selects the ADC resolution mode.
389  *
390  * Values:
391  * - 0b00 - When DIFF=0:It is single-ended 8-bit conversion; when DIFF=1, it is
392  * differential 9-bit conversion with 2's complement output.
393  * - 0b01 - When DIFF=0:It is single-ended 12-bit conversion ; when DIFF=1, it
394  * is differential 13-bit conversion with 2's complement output.
395  * - 0b10 - When DIFF=0:It is single-ended 10-bit conversion ; when DIFF=1, it
396  * is differential 11-bit conversion with 2's complement output.
397  * - 0b11 - When DIFF=0:It is single-ended 16-bit conversion; when DIFF=1, it is
398  * differential 16-bit conversion with 2's complement output.
399  */
400 /*@{*/
401 /*! @brief Read current value of the ADC_CFG1_MODE field. */
402 #define ADC_RD_CFG1_MODE(base) ((ADC_CFG1_REG(base) & ADC_CFG1_MODE_MASK) >> ADC_CFG1_MODE_SHIFT)
403 #define ADC_BRD_CFG1_MODE(base) (BME_UBFX32(&ADC_CFG1_REG(base), ADC_CFG1_MODE_SHIFT, ADC_CFG1_MODE_WIDTH))
404 
405 /*! @brief Set the MODE field to a new value. */
406 #define ADC_WR_CFG1_MODE(base, value) (ADC_RMW_CFG1(base, ADC_CFG1_MODE_MASK, ADC_CFG1_MODE(value)))
407 #define ADC_BWR_CFG1_MODE(base, value) (BME_BFI32(&ADC_CFG1_REG(base), ((uint32_t)(value) << ADC_CFG1_MODE_SHIFT), ADC_CFG1_MODE_SHIFT, ADC_CFG1_MODE_WIDTH))
408 /*@}*/
409 
410 /*!
411  * @name Register ADC_CFG1, field ADLSMP[4] (RW)
412  *
413  * ADLSMP selects between different sample times based on the conversion mode
414  * selected. This bit adjusts the sample period to allow higher impedance inputs to
415  * be accurately sampled or to maximize conversion speed for lower impedance
416  * inputs. Longer sample times can also be used to lower overall power consumption
417  * if continuous conversions are enabled and high conversion rates are not
418  * required. When ADLSMP=1, the long sample time select bits, (ADLSTS[1:0]), can select
419  * the extent of the long sample time.
420  *
421  * Values:
422  * - 0b0 - Short sample time.
423  * - 0b1 - Long sample time.
424  */
425 /*@{*/
426 /*! @brief Read current value of the ADC_CFG1_ADLSMP field. */
427 #define ADC_RD_CFG1_ADLSMP(base) ((ADC_CFG1_REG(base) & ADC_CFG1_ADLSMP_MASK) >> ADC_CFG1_ADLSMP_SHIFT)
428 #define ADC_BRD_CFG1_ADLSMP(base) (BME_UBFX32(&ADC_CFG1_REG(base), ADC_CFG1_ADLSMP_SHIFT, ADC_CFG1_ADLSMP_WIDTH))
429 
430 /*! @brief Set the ADLSMP field to a new value. */
431 #define ADC_WR_CFG1_ADLSMP(base, value) (ADC_RMW_CFG1(base, ADC_CFG1_ADLSMP_MASK, ADC_CFG1_ADLSMP(value)))
432 #define ADC_BWR_CFG1_ADLSMP(base, value) (BME_BFI32(&ADC_CFG1_REG(base), ((uint32_t)(value) << ADC_CFG1_ADLSMP_SHIFT), ADC_CFG1_ADLSMP_SHIFT, ADC_CFG1_ADLSMP_WIDTH))
433 /*@}*/
434 
435 /*!
436  * @name Register ADC_CFG1, field ADIV[6:5] (RW)
437  *
438  * ADIV selects the divide ratio used by the ADC to generate the internal clock
439  * ADCK.
440  *
441  * Values:
442  * - 0b00 - The divide ratio is 1 and the clock rate is input clock.
443  * - 0b01 - The divide ratio is 2 and the clock rate is (input clock)/2.
444  * - 0b10 - The divide ratio is 4 and the clock rate is (input clock)/4.
445  * - 0b11 - The divide ratio is 8 and the clock rate is (input clock)/8.
446  */
447 /*@{*/
448 /*! @brief Read current value of the ADC_CFG1_ADIV field. */
449 #define ADC_RD_CFG1_ADIV(base) ((ADC_CFG1_REG(base) & ADC_CFG1_ADIV_MASK) >> ADC_CFG1_ADIV_SHIFT)
450 #define ADC_BRD_CFG1_ADIV(base) (BME_UBFX32(&ADC_CFG1_REG(base), ADC_CFG1_ADIV_SHIFT, ADC_CFG1_ADIV_WIDTH))
451 
452 /*! @brief Set the ADIV field to a new value. */
453 #define ADC_WR_CFG1_ADIV(base, value) (ADC_RMW_CFG1(base, ADC_CFG1_ADIV_MASK, ADC_CFG1_ADIV(value)))
454 #define ADC_BWR_CFG1_ADIV(base, value) (BME_BFI32(&ADC_CFG1_REG(base), ((uint32_t)(value) << ADC_CFG1_ADIV_SHIFT), ADC_CFG1_ADIV_SHIFT, ADC_CFG1_ADIV_WIDTH))
455 /*@}*/
456 
457 /*!
458  * @name Register ADC_CFG1, field ADLPC[7] (RW)
459  *
460  * Controls the power configuration of the successive approximation converter.
461  * This optimizes power consumption when higher sample rates are not required.
462  *
463  * Values:
464  * - 0b0 - Normal power configuration.
465  * - 0b1 - Low-power configuration. The power is reduced at the expense of
466  * maximum clock speed.
467  */
468 /*@{*/
469 /*! @brief Read current value of the ADC_CFG1_ADLPC field. */
470 #define ADC_RD_CFG1_ADLPC(base) ((ADC_CFG1_REG(base) & ADC_CFG1_ADLPC_MASK) >> ADC_CFG1_ADLPC_SHIFT)
471 #define ADC_BRD_CFG1_ADLPC(base) (BME_UBFX32(&ADC_CFG1_REG(base), ADC_CFG1_ADLPC_SHIFT, ADC_CFG1_ADLPC_WIDTH))
472 
473 /*! @brief Set the ADLPC field to a new value. */
474 #define ADC_WR_CFG1_ADLPC(base, value) (ADC_RMW_CFG1(base, ADC_CFG1_ADLPC_MASK, ADC_CFG1_ADLPC(value)))
475 #define ADC_BWR_CFG1_ADLPC(base, value) (BME_BFI32(&ADC_CFG1_REG(base), ((uint32_t)(value) << ADC_CFG1_ADLPC_SHIFT), ADC_CFG1_ADLPC_SHIFT, ADC_CFG1_ADLPC_WIDTH))
476 /*@}*/
477 
478 /*******************************************************************************
479  * ADC_CFG2 - ADC Configuration Register 2
480  ******************************************************************************/
481 
482 /*!
483  * @brief ADC_CFG2 - ADC Configuration Register 2 (RW)
484  *
485  * Reset value: 0x00000000U
486  *
487  * Configuration Register 2 (CFG2) selects the special high-speed configuration
488  * for very high speed conversions and selects the long sample time duration
489  * during long sample mode.
490  */
491 /*!
492  * @name Constants and macros for entire ADC_CFG2 register
493  */
494 /*@{*/
495 #define ADC_RD_CFG2(base) (ADC_CFG2_REG(base))
496 #define ADC_WR_CFG2(base, value) (ADC_CFG2_REG(base) = (value))
497 #define ADC_RMW_CFG2(base, mask, value) (ADC_WR_CFG2(base, (ADC_RD_CFG2(base) & ~(mask)) | (value)))
498 #define ADC_SET_CFG2(base, value) (BME_OR32(&ADC_CFG2_REG(base), (uint32_t)(value)))
499 #define ADC_CLR_CFG2(base, value) (BME_AND32(&ADC_CFG2_REG(base), (uint32_t)(~(value))))
500 #define ADC_TOG_CFG2(base, value) (BME_XOR32(&ADC_CFG2_REG(base), (uint32_t)(value)))
501 /*@}*/
502 
503 /*
504  * Constants & macros for individual ADC_CFG2 bitfields
505  */
506 
507 /*!
508  * @name Register ADC_CFG2, field ADLSTS[1:0] (RW)
509  *
510  * Selects between the extended sample times when long sample time is selected,
511  * that is, when CFG1[ADLSMP]=1. This allows higher impedance inputs to be
512  * accurately sampled or to maximize conversion speed for lower impedance inputs.
513  * Longer sample times can also be used to lower overall power consumption when
514  * continuous conversions are enabled if high conversion rates are not required.
515  *
516  * Values:
517  * - 0b00 - Default longest sample time; 20 extra ADCK cycles; 24 ADCK cycles
518  * total.
519  * - 0b01 - 12 extra ADCK cycles; 16 ADCK cycles total sample time.
520  * - 0b10 - 6 extra ADCK cycles; 10 ADCK cycles total sample time.
521  * - 0b11 - 2 extra ADCK cycles; 6 ADCK cycles total sample time.
522  */
523 /*@{*/
524 /*! @brief Read current value of the ADC_CFG2_ADLSTS field. */
525 #define ADC_RD_CFG2_ADLSTS(base) ((ADC_CFG2_REG(base) & ADC_CFG2_ADLSTS_MASK) >> ADC_CFG2_ADLSTS_SHIFT)
526 #define ADC_BRD_CFG2_ADLSTS(base) (BME_UBFX32(&ADC_CFG2_REG(base), ADC_CFG2_ADLSTS_SHIFT, ADC_CFG2_ADLSTS_WIDTH))
527 
528 /*! @brief Set the ADLSTS field to a new value. */
529 #define ADC_WR_CFG2_ADLSTS(base, value) (ADC_RMW_CFG2(base, ADC_CFG2_ADLSTS_MASK, ADC_CFG2_ADLSTS(value)))
530 #define ADC_BWR_CFG2_ADLSTS(base, value) (BME_BFI32(&ADC_CFG2_REG(base), ((uint32_t)(value) << ADC_CFG2_ADLSTS_SHIFT), ADC_CFG2_ADLSTS_SHIFT, ADC_CFG2_ADLSTS_WIDTH))
531 /*@}*/
532 
533 /*!
534  * @name Register ADC_CFG2, field ADHSC[2] (RW)
535  *
536  * Configures the ADC for very high-speed operation. The conversion sequence is
537  * altered with 2 ADCK cycles added to the conversion time to allow higher speed
538  * conversion clocks.
539  *
540  * Values:
541  * - 0b0 - Normal conversion sequence selected.
542  * - 0b1 - High-speed conversion sequence selected with 2 additional ADCK cycles
543  * to total conversion time.
544  */
545 /*@{*/
546 /*! @brief Read current value of the ADC_CFG2_ADHSC field. */
547 #define ADC_RD_CFG2_ADHSC(base) ((ADC_CFG2_REG(base) & ADC_CFG2_ADHSC_MASK) >> ADC_CFG2_ADHSC_SHIFT)
548 #define ADC_BRD_CFG2_ADHSC(base) (BME_UBFX32(&ADC_CFG2_REG(base), ADC_CFG2_ADHSC_SHIFT, ADC_CFG2_ADHSC_WIDTH))
549 
550 /*! @brief Set the ADHSC field to a new value. */
551 #define ADC_WR_CFG2_ADHSC(base, value) (ADC_RMW_CFG2(base, ADC_CFG2_ADHSC_MASK, ADC_CFG2_ADHSC(value)))
552 #define ADC_BWR_CFG2_ADHSC(base, value) (BME_BFI32(&ADC_CFG2_REG(base), ((uint32_t)(value) << ADC_CFG2_ADHSC_SHIFT), ADC_CFG2_ADHSC_SHIFT, ADC_CFG2_ADHSC_WIDTH))
553 /*@}*/
554 
555 /*!
556  * @name Register ADC_CFG2, field ADACKEN[3] (RW)
557  *
558  * Enables the asynchronous clock source and the clock source output regardless
559  * of the conversion and status of CFG1[ADICLK]. Based on MCU configuration, the
560  * asynchronous clock may be used by other modules. See chip configuration
561  * information. Setting this field allows the clock to be used even while the ADC is
562  * idle or operating from a different clock source. Also, latency of initiating a
563  * single or first-continuous conversion with the asynchronous clock selected is
564  * reduced because the ADACK clock is already operational.
565  *
566  * Values:
567  * - 0b0 - Asynchronous clock output disabled; Asynchronous clock is enabled
568  * only if selected by ADICLK and a conversion is active.
569  * - 0b1 - Asynchronous clock and clock output is enabled regardless of the
570  * state of the ADC.
571  */
572 /*@{*/
573 /*! @brief Read current value of the ADC_CFG2_ADACKEN field. */
574 #define ADC_RD_CFG2_ADACKEN(base) ((ADC_CFG2_REG(base) & ADC_CFG2_ADACKEN_MASK) >> ADC_CFG2_ADACKEN_SHIFT)
575 #define ADC_BRD_CFG2_ADACKEN(base) (BME_UBFX32(&ADC_CFG2_REG(base), ADC_CFG2_ADACKEN_SHIFT, ADC_CFG2_ADACKEN_WIDTH))
576 
577 /*! @brief Set the ADACKEN field to a new value. */
578 #define ADC_WR_CFG2_ADACKEN(base, value) (ADC_RMW_CFG2(base, ADC_CFG2_ADACKEN_MASK, ADC_CFG2_ADACKEN(value)))
579 #define ADC_BWR_CFG2_ADACKEN(base, value) (BME_BFI32(&ADC_CFG2_REG(base), ((uint32_t)(value) << ADC_CFG2_ADACKEN_SHIFT), ADC_CFG2_ADACKEN_SHIFT, ADC_CFG2_ADACKEN_WIDTH))
580 /*@}*/
581 
582 /*!
583  * @name Register ADC_CFG2, field MUXSEL[4] (RW)
584  *
585  * Changes the ADC mux setting to select between alternate sets of ADC channels.
586  *
587  * Values:
588  * - 0b0 - ADxxa channels are selected.
589  * - 0b1 - ADxxb channels are selected.
590  */
591 /*@{*/
592 /*! @brief Read current value of the ADC_CFG2_MUXSEL field. */
593 #define ADC_RD_CFG2_MUXSEL(base) ((ADC_CFG2_REG(base) & ADC_CFG2_MUXSEL_MASK) >> ADC_CFG2_MUXSEL_SHIFT)
594 #define ADC_BRD_CFG2_MUXSEL(base) (BME_UBFX32(&ADC_CFG2_REG(base), ADC_CFG2_MUXSEL_SHIFT, ADC_CFG2_MUXSEL_WIDTH))
595 
596 /*! @brief Set the MUXSEL field to a new value. */
597 #define ADC_WR_CFG2_MUXSEL(base, value) (ADC_RMW_CFG2(base, ADC_CFG2_MUXSEL_MASK, ADC_CFG2_MUXSEL(value)))
598 #define ADC_BWR_CFG2_MUXSEL(base, value) (BME_BFI32(&ADC_CFG2_REG(base), ((uint32_t)(value) << ADC_CFG2_MUXSEL_SHIFT), ADC_CFG2_MUXSEL_SHIFT, ADC_CFG2_MUXSEL_WIDTH))
599 /*@}*/
600 
601 /*******************************************************************************
602  * ADC_R - ADC Data Result Register
603  ******************************************************************************/
604 
605 /*!
606  * @brief ADC_R - ADC Data Result Register (RO)
607  *
608  * Reset value: 0x00000000U
609  *
610  * The data result registers (Rn) contain the result of an ADC conversion of the
611  * channel selected by the corresponding status and channel control register
612  * (SC1A:SC1n). For every status and channel control register, there is a
613  * corresponding data result register. Unused bits in R n are cleared in unsigned
614  * right-justified modes and carry the sign bit (MSB) in sign-extended 2's complement
615  * modes. For example, when configured for 10-bit single-ended mode, D[15:10] are
616  * cleared. When configured for 11-bit differential mode, D[15:10] carry the sign
617  * bit, that is, bit 10 extended through bit 15. The following table describes the
618  * behavior of the data result registers in the different modes of operation.
619  * Data result register description Conversion mode D15 D14 D13 D12 D11 D10 D9 D8 D7
620  * D6 D5 D4 D3 D2 D1 D0 Format 16-bit differential S D D D D D D D D D D D D D D
621  * D Signed 2's complement 16-bit single-ended D D D D D D D D D D D D D D D D
622  * Unsigned right justified 13-bit differential S S S S D D D D D D D D D D D D
623  * Sign-extended 2's complement 12-bit single-ended 0 0 0 0 D D D D D D D D D D D D
624  * Unsigned right-justified 11-bit differential S S S S S S D D D D D D D D D D
625  * Sign-extended 2's complement 10-bit single-ended 0 0 0 0 0 0 D D D D D D D D D
626  * D Unsigned right-justified 9-bit differential S S S S S S S S D D D D D D D D
627  * Sign-extended 2's complement 8-bit single-ended 0 0 0 0 0 0 0 0 D D D D D D D
628  * D Unsigned right-justified S: Sign bit or sign bit extension; D: Data, which
629  * is 2's complement data if indicated
630  */
631 /*!
632  * @name Constants and macros for entire ADC_R register
633  */
634 /*@{*/
635 #define ADC_RD_R(base, index) (ADC_R_REG(base, index))
636 /*@}*/
637 
638 /*
639  * Constants & macros for individual ADC_R bitfields
640  */
641 
642 /*!
643  * @name Register ADC_R, field D[15:0] (RO)
644  */
645 /*@{*/
646 /*! @brief Read current value of the ADC_R_D field. */
647 #define ADC_RD_R_D(base, index) ((ADC_R_REG(base, index) & ADC_R_D_MASK) >> ADC_R_D_SHIFT)
648 #define ADC_BRD_R_D(base, index) (BME_UBFX32(&ADC_R_REG(base, index), ADC_R_D_SHIFT, ADC_R_D_WIDTH))
649 /*@}*/
650 
651 /*******************************************************************************
652  * ADC_CV1 - Compare Value Registers
653  ******************************************************************************/
654 
655 /*!
656  * @brief ADC_CV1 - Compare Value Registers (RW)
657  *
658  * Reset value: 0x00000000U
659  *
660  * The compare value registers (CV1 and CV2) contain a compare value used to
661  * compare the conversion result when the compare function is enabled, that is,
662  * SC2[ACFE]=1. This register is formatted in the same way as the Rn registers in
663  * different modes of operation for both bit position definition and value format
664  * using unsigned or sign-extended 2's complement. Therefore, the compare function
665  * uses only the CVn fields that are related to the ADC mode of operation. The
666  * compare value 2 register (CV2) is used only when the compare range function is
667  * enabled, that is, SC2[ACREN]=1.
668  */
669 /*!
670  * @name Constants and macros for entire ADC_CV1 register
671  */
672 /*@{*/
673 #define ADC_RD_CV1(base) (ADC_CV1_REG(base))
674 #define ADC_WR_CV1(base, value) (ADC_CV1_REG(base) = (value))
675 #define ADC_RMW_CV1(base, mask, value) (ADC_WR_CV1(base, (ADC_RD_CV1(base) & ~(mask)) | (value)))
676 #define ADC_SET_CV1(base, value) (BME_OR32(&ADC_CV1_REG(base), (uint32_t)(value)))
677 #define ADC_CLR_CV1(base, value) (BME_AND32(&ADC_CV1_REG(base), (uint32_t)(~(value))))
678 #define ADC_TOG_CV1(base, value) (BME_XOR32(&ADC_CV1_REG(base), (uint32_t)(value)))
679 /*@}*/
680 
681 /*
682  * Constants & macros for individual ADC_CV1 bitfields
683  */
684 
685 /*!
686  * @name Register ADC_CV1, field CV[15:0] (RW)
687  */
688 /*@{*/
689 /*! @brief Read current value of the ADC_CV1_CV field. */
690 #define ADC_RD_CV1_CV(base) ((ADC_CV1_REG(base) & ADC_CV1_CV_MASK) >> ADC_CV1_CV_SHIFT)
691 #define ADC_BRD_CV1_CV(base) (BME_UBFX32(&ADC_CV1_REG(base), ADC_CV1_CV_SHIFT, ADC_CV1_CV_WIDTH))
692 
693 /*! @brief Set the CV field to a new value. */
694 #define ADC_WR_CV1_CV(base, value) (ADC_RMW_CV1(base, ADC_CV1_CV_MASK, ADC_CV1_CV(value)))
695 #define ADC_BWR_CV1_CV(base, value) (BME_BFI32(&ADC_CV1_REG(base), ((uint32_t)(value) << ADC_CV1_CV_SHIFT), ADC_CV1_CV_SHIFT, ADC_CV1_CV_WIDTH))
696 /*@}*/
697 
698 /*******************************************************************************
699  * ADC_CV2 - Compare Value Registers
700  ******************************************************************************/
701 
702 /*!
703  * @brief ADC_CV2 - Compare Value Registers (RW)
704  *
705  * Reset value: 0x00000000U
706  *
707  * The compare value registers (CV1 and CV2) contain a compare value used to
708  * compare the conversion result when the compare function is enabled, that is,
709  * SC2[ACFE]=1. This register is formatted in the same way as the Rn registers in
710  * different modes of operation for both bit position definition and value format
711  * using unsigned or sign-extended 2's complement. Therefore, the compare function
712  * uses only the CVn fields that are related to the ADC mode of operation. The
713  * compare value 2 register (CV2) is used only when the compare range function is
714  * enabled, that is, SC2[ACREN]=1.
715  */
716 /*!
717  * @name Constants and macros for entire ADC_CV2 register
718  */
719 /*@{*/
720 #define ADC_RD_CV2(base) (ADC_CV2_REG(base))
721 #define ADC_WR_CV2(base, value) (ADC_CV2_REG(base) = (value))
722 #define ADC_RMW_CV2(base, mask, value) (ADC_WR_CV2(base, (ADC_RD_CV2(base) & ~(mask)) | (value)))
723 #define ADC_SET_CV2(base, value) (BME_OR32(&ADC_CV2_REG(base), (uint32_t)(value)))
724 #define ADC_CLR_CV2(base, value) (BME_AND32(&ADC_CV2_REG(base), (uint32_t)(~(value))))
725 #define ADC_TOG_CV2(base, value) (BME_XOR32(&ADC_CV2_REG(base), (uint32_t)(value)))
726 /*@}*/
727 
728 /*
729  * Constants & macros for individual ADC_CV2 bitfields
730  */
731 
732 /*!
733  * @name Register ADC_CV2, field CV[15:0] (RW)
734  */
735 /*@{*/
736 /*! @brief Read current value of the ADC_CV2_CV field. */
737 #define ADC_RD_CV2_CV(base) ((ADC_CV2_REG(base) & ADC_CV2_CV_MASK) >> ADC_CV2_CV_SHIFT)
738 #define ADC_BRD_CV2_CV(base) (BME_UBFX32(&ADC_CV2_REG(base), ADC_CV2_CV_SHIFT, ADC_CV2_CV_WIDTH))
739 
740 /*! @brief Set the CV field to a new value. */
741 #define ADC_WR_CV2_CV(base, value) (ADC_RMW_CV2(base, ADC_CV2_CV_MASK, ADC_CV2_CV(value)))
742 #define ADC_BWR_CV2_CV(base, value) (BME_BFI32(&ADC_CV2_REG(base), ((uint32_t)(value) << ADC_CV2_CV_SHIFT), ADC_CV2_CV_SHIFT, ADC_CV2_CV_WIDTH))
743 /*@}*/
744 
745 /*******************************************************************************
746  * ADC_SC2 - Status and Control Register 2
747  ******************************************************************************/
748 
749 /*!
750  * @brief ADC_SC2 - Status and Control Register 2 (RW)
751  *
752  * Reset value: 0x00000000U
753  *
754  * The status and control register 2 (SC2) contains the conversion active,
755  * hardware/software trigger select, compare function, and voltage reference select of
756  * the ADC module.
757  */
758 /*!
759  * @name Constants and macros for entire ADC_SC2 register
760  */
761 /*@{*/
762 #define ADC_RD_SC2(base) (ADC_SC2_REG(base))
763 #define ADC_WR_SC2(base, value) (ADC_SC2_REG(base) = (value))
764 #define ADC_RMW_SC2(base, mask, value) (ADC_WR_SC2(base, (ADC_RD_SC2(base) & ~(mask)) | (value)))
765 #define ADC_SET_SC2(base, value) (BME_OR32(&ADC_SC2_REG(base), (uint32_t)(value)))
766 #define ADC_CLR_SC2(base, value) (BME_AND32(&ADC_SC2_REG(base), (uint32_t)(~(value))))
767 #define ADC_TOG_SC2(base, value) (BME_XOR32(&ADC_SC2_REG(base), (uint32_t)(value)))
768 /*@}*/
769 
770 /*
771  * Constants & macros for individual ADC_SC2 bitfields
772  */
773 
774 /*!
775  * @name Register ADC_SC2, field REFSEL[1:0] (RW)
776  *
777  * Selects the voltage reference source used for conversions.
778  *
779  * Values:
780  * - 0b00 - Default voltage reference pin pair, that is, external pins VREFH and
781  * VREFL
782  * - 0b01 - Alternate reference pair, that is, VALTH and VALTL . This pair may
783  * be additional external pins or internal sources depending on the MCU
784  * configuration. See the chip configuration information for details specific to
785  * this MCU
786  * - 0b10 - Reserved
787  * - 0b11 - Reserved
788  */
789 /*@{*/
790 /*! @brief Read current value of the ADC_SC2_REFSEL field. */
791 #define ADC_RD_SC2_REFSEL(base) ((ADC_SC2_REG(base) & ADC_SC2_REFSEL_MASK) >> ADC_SC2_REFSEL_SHIFT)
792 #define ADC_BRD_SC2_REFSEL(base) (BME_UBFX32(&ADC_SC2_REG(base), ADC_SC2_REFSEL_SHIFT, ADC_SC2_REFSEL_WIDTH))
793 
794 /*! @brief Set the REFSEL field to a new value. */
795 #define ADC_WR_SC2_REFSEL(base, value) (ADC_RMW_SC2(base, ADC_SC2_REFSEL_MASK, ADC_SC2_REFSEL(value)))
796 #define ADC_BWR_SC2_REFSEL(base, value) (BME_BFI32(&ADC_SC2_REG(base), ((uint32_t)(value) << ADC_SC2_REFSEL_SHIFT), ADC_SC2_REFSEL_SHIFT, ADC_SC2_REFSEL_WIDTH))
797 /*@}*/
798 
799 /*!
800  * @name Register ADC_SC2, field DMAEN[2] (RW)
801  *
802  * Values:
803  * - 0b0 - DMA is disabled.
804  * - 0b1 - DMA is enabled and will assert the ADC DMA request during an ADC
805  * conversion complete event noted when any of the SC1n[COCO] flags is asserted.
806  */
807 /*@{*/
808 /*! @brief Read current value of the ADC_SC2_DMAEN field. */
809 #define ADC_RD_SC2_DMAEN(base) ((ADC_SC2_REG(base) & ADC_SC2_DMAEN_MASK) >> ADC_SC2_DMAEN_SHIFT)
810 #define ADC_BRD_SC2_DMAEN(base) (BME_UBFX32(&ADC_SC2_REG(base), ADC_SC2_DMAEN_SHIFT, ADC_SC2_DMAEN_WIDTH))
811 
812 /*! @brief Set the DMAEN field to a new value. */
813 #define ADC_WR_SC2_DMAEN(base, value) (ADC_RMW_SC2(base, ADC_SC2_DMAEN_MASK, ADC_SC2_DMAEN(value)))
814 #define ADC_BWR_SC2_DMAEN(base, value) (BME_BFI32(&ADC_SC2_REG(base), ((uint32_t)(value) << ADC_SC2_DMAEN_SHIFT), ADC_SC2_DMAEN_SHIFT, ADC_SC2_DMAEN_WIDTH))
815 /*@}*/
816 
817 /*!
818  * @name Register ADC_SC2, field ACREN[3] (RW)
819  *
820  * Configures the compare function to check if the conversion result of the
821  * input being monitored is either between or outside the range formed by CV1 and CV2
822  * determined by the value of ACFGT. ACFE must be set for ACFGT to have any
823  * effect.
824  *
825  * Values:
826  * - 0b0 - Range function disabled. Only CV1 is compared.
827  * - 0b1 - Range function enabled. Both CV1 and CV2 are compared.
828  */
829 /*@{*/
830 /*! @brief Read current value of the ADC_SC2_ACREN field. */
831 #define ADC_RD_SC2_ACREN(base) ((ADC_SC2_REG(base) & ADC_SC2_ACREN_MASK) >> ADC_SC2_ACREN_SHIFT)
832 #define ADC_BRD_SC2_ACREN(base) (BME_UBFX32(&ADC_SC2_REG(base), ADC_SC2_ACREN_SHIFT, ADC_SC2_ACREN_WIDTH))
833 
834 /*! @brief Set the ACREN field to a new value. */
835 #define ADC_WR_SC2_ACREN(base, value) (ADC_RMW_SC2(base, ADC_SC2_ACREN_MASK, ADC_SC2_ACREN(value)))
836 #define ADC_BWR_SC2_ACREN(base, value) (BME_BFI32(&ADC_SC2_REG(base), ((uint32_t)(value) << ADC_SC2_ACREN_SHIFT), ADC_SC2_ACREN_SHIFT, ADC_SC2_ACREN_WIDTH))
837 /*@}*/
838 
839 /*!
840  * @name Register ADC_SC2, field ACFGT[4] (RW)
841  *
842  * Configures the compare function to check the conversion result relative to
843  * the CV1 and CV2 based upon the value of ACREN. ACFE must be set for ACFGT to
844  * have any effect.
845  *
846  * Values:
847  * - 0b0 - Configures less than threshold, outside range not inclusive and
848  * inside range not inclusive; functionality based on the values placed in CV1 and
849  * CV2.
850  * - 0b1 - Configures greater than or equal to threshold, outside and inside
851  * ranges inclusive; functionality based on the values placed in CV1 and CV2.
852  */
853 /*@{*/
854 /*! @brief Read current value of the ADC_SC2_ACFGT field. */
855 #define ADC_RD_SC2_ACFGT(base) ((ADC_SC2_REG(base) & ADC_SC2_ACFGT_MASK) >> ADC_SC2_ACFGT_SHIFT)
856 #define ADC_BRD_SC2_ACFGT(base) (BME_UBFX32(&ADC_SC2_REG(base), ADC_SC2_ACFGT_SHIFT, ADC_SC2_ACFGT_WIDTH))
857 
858 /*! @brief Set the ACFGT field to a new value. */
859 #define ADC_WR_SC2_ACFGT(base, value) (ADC_RMW_SC2(base, ADC_SC2_ACFGT_MASK, ADC_SC2_ACFGT(value)))
860 #define ADC_BWR_SC2_ACFGT(base, value) (BME_BFI32(&ADC_SC2_REG(base), ((uint32_t)(value) << ADC_SC2_ACFGT_SHIFT), ADC_SC2_ACFGT_SHIFT, ADC_SC2_ACFGT_WIDTH))
861 /*@}*/
862 
863 /*!
864  * @name Register ADC_SC2, field ACFE[5] (RW)
865  *
866  * Enables the compare function.
867  *
868  * Values:
869  * - 0b0 - Compare function disabled.
870  * - 0b1 - Compare function enabled.
871  */
872 /*@{*/
873 /*! @brief Read current value of the ADC_SC2_ACFE field. */
874 #define ADC_RD_SC2_ACFE(base) ((ADC_SC2_REG(base) & ADC_SC2_ACFE_MASK) >> ADC_SC2_ACFE_SHIFT)
875 #define ADC_BRD_SC2_ACFE(base) (BME_UBFX32(&ADC_SC2_REG(base), ADC_SC2_ACFE_SHIFT, ADC_SC2_ACFE_WIDTH))
876 
877 /*! @brief Set the ACFE field to a new value. */
878 #define ADC_WR_SC2_ACFE(base, value) (ADC_RMW_SC2(base, ADC_SC2_ACFE_MASK, ADC_SC2_ACFE(value)))
879 #define ADC_BWR_SC2_ACFE(base, value) (BME_BFI32(&ADC_SC2_REG(base), ((uint32_t)(value) << ADC_SC2_ACFE_SHIFT), ADC_SC2_ACFE_SHIFT, ADC_SC2_ACFE_WIDTH))
880 /*@}*/
881 
882 /*!
883  * @name Register ADC_SC2, field ADTRG[6] (RW)
884  *
885  * Selects the type of trigger used for initiating a conversion. Two types of
886  * trigger are selectable: Software trigger: When software trigger is selected, a
887  * conversion is initiated following a write to SC1A. Hardware trigger: When
888  * hardware trigger is selected, a conversion is initiated following the assertion of
889  * the ADHWT input after a pulse of the ADHWTSn input.
890  *
891  * Values:
892  * - 0b0 - Software trigger selected.
893  * - 0b1 - Hardware trigger selected.
894  */
895 /*@{*/
896 /*! @brief Read current value of the ADC_SC2_ADTRG field. */
897 #define ADC_RD_SC2_ADTRG(base) ((ADC_SC2_REG(base) & ADC_SC2_ADTRG_MASK) >> ADC_SC2_ADTRG_SHIFT)
898 #define ADC_BRD_SC2_ADTRG(base) (BME_UBFX32(&ADC_SC2_REG(base), ADC_SC2_ADTRG_SHIFT, ADC_SC2_ADTRG_WIDTH))
899 
900 /*! @brief Set the ADTRG field to a new value. */
901 #define ADC_WR_SC2_ADTRG(base, value) (ADC_RMW_SC2(base, ADC_SC2_ADTRG_MASK, ADC_SC2_ADTRG(value)))
902 #define ADC_BWR_SC2_ADTRG(base, value) (BME_BFI32(&ADC_SC2_REG(base), ((uint32_t)(value) << ADC_SC2_ADTRG_SHIFT), ADC_SC2_ADTRG_SHIFT, ADC_SC2_ADTRG_WIDTH))
903 /*@}*/
904 
905 /*!
906  * @name Register ADC_SC2, field ADACT[7] (RO)
907  *
908  * Indicates that a conversion or hardware averaging is in progress. ADACT is
909  * set when a conversion is initiated and cleared when a conversion is completed or
910  * aborted.
911  *
912  * Values:
913  * - 0b0 - Conversion not in progress.
914  * - 0b1 - Conversion in progress.
915  */
916 /*@{*/
917 /*! @brief Read current value of the ADC_SC2_ADACT field. */
918 #define ADC_RD_SC2_ADACT(base) ((ADC_SC2_REG(base) & ADC_SC2_ADACT_MASK) >> ADC_SC2_ADACT_SHIFT)
919 #define ADC_BRD_SC2_ADACT(base) (BME_UBFX32(&ADC_SC2_REG(base), ADC_SC2_ADACT_SHIFT, ADC_SC2_ADACT_WIDTH))
920 /*@}*/
921 
922 /*******************************************************************************
923  * ADC_SC3 - Status and Control Register 3
924  ******************************************************************************/
925 
926 /*!
927  * @brief ADC_SC3 - Status and Control Register 3 (RW)
928  *
929  * Reset value: 0x00000000U
930  *
931  * The Status and Control Register 3 (SC3) controls the calibration, continuous
932  * convert, and hardware averaging functions of the ADC module.
933  */
934 /*!
935  * @name Constants and macros for entire ADC_SC3 register
936  */
937 /*@{*/
938 #define ADC_RD_SC3(base) (ADC_SC3_REG(base))
939 #define ADC_WR_SC3(base, value) (ADC_SC3_REG(base) = (value))
940 #define ADC_RMW_SC3(base, mask, value) (ADC_WR_SC3(base, (ADC_RD_SC3(base) & ~(mask)) | (value)))
941 #define ADC_SET_SC3(base, value) (BME_OR32(&ADC_SC3_REG(base), (uint32_t)(value)))
942 #define ADC_CLR_SC3(base, value) (BME_AND32(&ADC_SC3_REG(base), (uint32_t)(~(value))))
943 #define ADC_TOG_SC3(base, value) (BME_XOR32(&ADC_SC3_REG(base), (uint32_t)(value)))
944 /*@}*/
945 
946 /*
947  * Constants & macros for individual ADC_SC3 bitfields
948  */
949 
950 /*!
951  * @name Register ADC_SC3, field AVGS[1:0] (RW)
952  *
953  * Determines how many ADC conversions will be averaged to create the ADC
954  * average result.
955  *
956  * Values:
957  * - 0b00 - 4 samples averaged.
958  * - 0b01 - 8 samples averaged.
959  * - 0b10 - 16 samples averaged.
960  * - 0b11 - 32 samples averaged.
961  */
962 /*@{*/
963 /*! @brief Read current value of the ADC_SC3_AVGS field. */
964 #define ADC_RD_SC3_AVGS(base) ((ADC_SC3_REG(base) & ADC_SC3_AVGS_MASK) >> ADC_SC3_AVGS_SHIFT)
965 #define ADC_BRD_SC3_AVGS(base) (BME_UBFX32(&ADC_SC3_REG(base), ADC_SC3_AVGS_SHIFT, ADC_SC3_AVGS_WIDTH))
966 
967 /*! @brief Set the AVGS field to a new value. */
968 #define ADC_WR_SC3_AVGS(base, value) (ADC_RMW_SC3(base, (ADC_SC3_AVGS_MASK | ADC_SC3_CALF_MASK), ADC_SC3_AVGS(value)))
969 #define ADC_BWR_SC3_AVGS(base, value) (BME_BFI32(&ADC_SC3_REG(base), ((uint32_t)(value) << ADC_SC3_AVGS_SHIFT), ADC_SC3_AVGS_SHIFT, ADC_SC3_AVGS_WIDTH))
970 /*@}*/
971 
972 /*!
973  * @name Register ADC_SC3, field AVGE[2] (RW)
974  *
975  * Enables the hardware average function of the ADC.
976  *
977  * Values:
978  * - 0b0 - Hardware average function disabled.
979  * - 0b1 - Hardware average function enabled.
980  */
981 /*@{*/
982 /*! @brief Read current value of the ADC_SC3_AVGE field. */
983 #define ADC_RD_SC3_AVGE(base) ((ADC_SC3_REG(base) & ADC_SC3_AVGE_MASK) >> ADC_SC3_AVGE_SHIFT)
984 #define ADC_BRD_SC3_AVGE(base) (BME_UBFX32(&ADC_SC3_REG(base), ADC_SC3_AVGE_SHIFT, ADC_SC3_AVGE_WIDTH))
985 
986 /*! @brief Set the AVGE field to a new value. */
987 #define ADC_WR_SC3_AVGE(base, value) (ADC_RMW_SC3(base, (ADC_SC3_AVGE_MASK | ADC_SC3_CALF_MASK), ADC_SC3_AVGE(value)))
988 #define ADC_BWR_SC3_AVGE(base, value) (BME_BFI32(&ADC_SC3_REG(base), ((uint32_t)(value) << ADC_SC3_AVGE_SHIFT), ADC_SC3_AVGE_SHIFT, ADC_SC3_AVGE_WIDTH))
989 /*@}*/
990 
991 /*!
992  * @name Register ADC_SC3, field ADCO[3] (RW)
993  *
994  * Enables continuous conversions.
995  *
996  * Values:
997  * - 0b0 - One conversion or one set of conversions if the hardware average
998  * function is enabled, that is, AVGE=1, after initiating a conversion.
999  * - 0b1 - Continuous conversions or sets of conversions if the hardware average
1000  * function is enabled, that is, AVGE=1, after initiating a conversion.
1001  */
1002 /*@{*/
1003 /*! @brief Read current value of the ADC_SC3_ADCO field. */
1004 #define ADC_RD_SC3_ADCO(base) ((ADC_SC3_REG(base) & ADC_SC3_ADCO_MASK) >> ADC_SC3_ADCO_SHIFT)
1005 #define ADC_BRD_SC3_ADCO(base) (BME_UBFX32(&ADC_SC3_REG(base), ADC_SC3_ADCO_SHIFT, ADC_SC3_ADCO_WIDTH))
1006 
1007 /*! @brief Set the ADCO field to a new value. */
1008 #define ADC_WR_SC3_ADCO(base, value) (ADC_RMW_SC3(base, (ADC_SC3_ADCO_MASK | ADC_SC3_CALF_MASK), ADC_SC3_ADCO(value)))
1009 #define ADC_BWR_SC3_ADCO(base, value) (BME_BFI32(&ADC_SC3_REG(base), ((uint32_t)(value) << ADC_SC3_ADCO_SHIFT), ADC_SC3_ADCO_SHIFT, ADC_SC3_ADCO_WIDTH))
1010 /*@}*/
1011 
1012 /*!
1013  * @name Register ADC_SC3, field CALF[6] (W1C)
1014  *
1015  * Displays the result of the calibration sequence. The calibration sequence
1016  * will fail if SC2[ADTRG] = 1, any ADC register is written, or any stop mode is
1017  * entered before the calibration sequence completes. Writing 1 to CALF clears it.
1018  *
1019  * Values:
1020  * - 0b0 - Calibration completed normally.
1021  * - 0b1 - Calibration failed. ADC accuracy specifications are not guaranteed.
1022  */
1023 /*@{*/
1024 /*! @brief Read current value of the ADC_SC3_CALF field. */
1025 #define ADC_RD_SC3_CALF(base) ((ADC_SC3_REG(base) & ADC_SC3_CALF_MASK) >> ADC_SC3_CALF_SHIFT)
1026 #define ADC_BRD_SC3_CALF(base) (BME_UBFX32(&ADC_SC3_REG(base), ADC_SC3_CALF_SHIFT, ADC_SC3_CALF_WIDTH))
1027 
1028 /*! @brief Set the CALF field to a new value. */
1029 #define ADC_WR_SC3_CALF(base, value) (ADC_RMW_SC3(base, ADC_SC3_CALF_MASK, ADC_SC3_CALF(value)))
1030 #define ADC_BWR_SC3_CALF(base, value) (BME_BFI32(&ADC_SC3_REG(base), ((uint32_t)(value) << ADC_SC3_CALF_SHIFT), ADC_SC3_CALF_SHIFT, ADC_SC3_CALF_WIDTH))
1031 /*@}*/
1032 
1033 /*!
1034  * @name Register ADC_SC3, field CAL[7] (RW)
1035  *
1036  * Begins the calibration sequence when set. This field stays set while the
1037  * calibration is in progress and is cleared when the calibration sequence is
1038  * completed. CALF must be checked to determine the result of the calibration sequence.
1039  * Once started, the calibration routine cannot be interrupted by writes to the
1040  * ADC registers or the results will be invalid and CALF will set. Setting CAL
1041  * will abort any current conversion.
1042  */
1043 /*@{*/
1044 /*! @brief Read current value of the ADC_SC3_CAL field. */
1045 #define ADC_RD_SC3_CAL(base) ((ADC_SC3_REG(base) & ADC_SC3_CAL_MASK) >> ADC_SC3_CAL_SHIFT)
1046 #define ADC_BRD_SC3_CAL(base) (BME_UBFX32(&ADC_SC3_REG(base), ADC_SC3_CAL_SHIFT, ADC_SC3_CAL_WIDTH))
1047 
1048 /*! @brief Set the CAL field to a new value. */
1049 #define ADC_WR_SC3_CAL(base, value) (ADC_RMW_SC3(base, (ADC_SC3_CAL_MASK | ADC_SC3_CALF_MASK), ADC_SC3_CAL(value)))
1050 #define ADC_BWR_SC3_CAL(base, value) (BME_BFI32(&ADC_SC3_REG(base), ((uint32_t)(value) << ADC_SC3_CAL_SHIFT), ADC_SC3_CAL_SHIFT, ADC_SC3_CAL_WIDTH))
1051 /*@}*/
1052 
1053 /*******************************************************************************
1054  * ADC_OFS - ADC Offset Correction Register
1055  ******************************************************************************/
1056 
1057 /*!
1058  * @brief ADC_OFS - ADC Offset Correction Register (RW)
1059  *
1060  * Reset value: 0x00000004U
1061  *
1062  * The ADC Offset Correction Register (OFS) contains the user-selected or
1063  * calibration-generated offset error correction value. This register is a 2's
1064  * complement, left-justified, 16-bit value . The value in OFS is subtracted from the
1065  * conversion and the result is transferred into the result registers, Rn. If the
1066  * result is greater than the maximum or less than the minimum result value, it is
1067  * forced to the appropriate limit for the current mode of operation.
1068  */
1069 /*!
1070  * @name Constants and macros for entire ADC_OFS register
1071  */
1072 /*@{*/
1073 #define ADC_RD_OFS(base) (ADC_OFS_REG(base))
1074 #define ADC_WR_OFS(base, value) (ADC_OFS_REG(base) = (value))
1075 #define ADC_RMW_OFS(base, mask, value) (ADC_WR_OFS(base, (ADC_RD_OFS(base) & ~(mask)) | (value)))
1076 #define ADC_SET_OFS(base, value) (BME_OR32(&ADC_OFS_REG(base), (uint32_t)(value)))
1077 #define ADC_CLR_OFS(base, value) (BME_AND32(&ADC_OFS_REG(base), (uint32_t)(~(value))))
1078 #define ADC_TOG_OFS(base, value) (BME_XOR32(&ADC_OFS_REG(base), (uint32_t)(value)))
1079 /*@}*/
1080 
1081 /*
1082  * Constants & macros for individual ADC_OFS bitfields
1083  */
1084 
1085 /*!
1086  * @name Register ADC_OFS, field OFS[15:0] (RW)
1087  */
1088 /*@{*/
1089 /*! @brief Read current value of the ADC_OFS_OFS field. */
1090 #define ADC_RD_OFS_OFS(base) ((ADC_OFS_REG(base) & ADC_OFS_OFS_MASK) >> ADC_OFS_OFS_SHIFT)
1091 #define ADC_BRD_OFS_OFS(base) (BME_UBFX32(&ADC_OFS_REG(base), ADC_OFS_OFS_SHIFT, ADC_OFS_OFS_WIDTH))
1092 
1093 /*! @brief Set the OFS field to a new value. */
1094 #define ADC_WR_OFS_OFS(base, value) (ADC_RMW_OFS(base, ADC_OFS_OFS_MASK, ADC_OFS_OFS(value)))
1095 #define ADC_BWR_OFS_OFS(base, value) (BME_BFI32(&ADC_OFS_REG(base), ((uint32_t)(value) << ADC_OFS_OFS_SHIFT), ADC_OFS_OFS_SHIFT, ADC_OFS_OFS_WIDTH))
1096 /*@}*/
1097 
1098 /*******************************************************************************
1099  * ADC_PG - ADC Plus-Side Gain Register
1100  ******************************************************************************/
1101 
1102 /*!
1103  * @brief ADC_PG - ADC Plus-Side Gain Register (RW)
1104  *
1105  * Reset value: 0x00008200U
1106  *
1107  * The Plus-Side Gain Register (PG) contains the gain error correction for the
1108  * plus-side input in differential mode or the overall conversion in single-ended
1109  * mode. PG, a 16-bit real number in binary format, is the gain adjustment
1110  * factor, with the radix point fixed between ADPG15 and ADPG14. This register must be
1111  * written by the user with the value described in the calibration procedure.
1112  * Otherwise, the gain error specifications may not be met.
1113  */
1114 /*!
1115  * @name Constants and macros for entire ADC_PG register
1116  */
1117 /*@{*/
1118 #define ADC_RD_PG(base) (ADC_PG_REG(base))
1119 #define ADC_WR_PG(base, value) (ADC_PG_REG(base) = (value))
1120 #define ADC_RMW_PG(base, mask, value) (ADC_WR_PG(base, (ADC_RD_PG(base) & ~(mask)) | (value)))
1121 #define ADC_SET_PG(base, value) (BME_OR32(&ADC_PG_REG(base), (uint32_t)(value)))
1122 #define ADC_CLR_PG(base, value) (BME_AND32(&ADC_PG_REG(base), (uint32_t)(~(value))))
1123 #define ADC_TOG_PG(base, value) (BME_XOR32(&ADC_PG_REG(base), (uint32_t)(value)))
1124 /*@}*/
1125 
1126 /*
1127  * Constants & macros for individual ADC_PG bitfields
1128  */
1129 
1130 /*!
1131  * @name Register ADC_PG, field PG[15:0] (RW)
1132  */
1133 /*@{*/
1134 /*! @brief Read current value of the ADC_PG_PG field. */
1135 #define ADC_RD_PG_PG(base) ((ADC_PG_REG(base) & ADC_PG_PG_MASK) >> ADC_PG_PG_SHIFT)
1136 #define ADC_BRD_PG_PG(base) (BME_UBFX32(&ADC_PG_REG(base), ADC_PG_PG_SHIFT, ADC_PG_PG_WIDTH))
1137 
1138 /*! @brief Set the PG field to a new value. */
1139 #define ADC_WR_PG_PG(base, value) (ADC_RMW_PG(base, ADC_PG_PG_MASK, ADC_PG_PG(value)))
1140 #define ADC_BWR_PG_PG(base, value) (BME_BFI32(&ADC_PG_REG(base), ((uint32_t)(value) << ADC_PG_PG_SHIFT), ADC_PG_PG_SHIFT, ADC_PG_PG_WIDTH))
1141 /*@}*/
1142 
1143 /*******************************************************************************
1144  * ADC_MG - ADC Minus-Side Gain Register
1145  ******************************************************************************/
1146 
1147 /*!
1148  * @brief ADC_MG - ADC Minus-Side Gain Register (RW)
1149  *
1150  * Reset value: 0x00008200U
1151  *
1152  * The Minus-Side Gain Register (MG) contains the gain error correction for the
1153  * minus-side input in differential mode. This register is ignored in
1154  * single-ended mode. MG, a 16-bit real number in binary format, is the gain adjustment
1155  * factor, with the radix point fixed between ADMG15 and ADMG14. This register must
1156  * be written by the user with the value described in the calibration procedure.
1157  * Otherwise, the gain error specifications may not be met.
1158  */
1159 /*!
1160  * @name Constants and macros for entire ADC_MG register
1161  */
1162 /*@{*/
1163 #define ADC_RD_MG(base) (ADC_MG_REG(base))
1164 #define ADC_WR_MG(base, value) (ADC_MG_REG(base) = (value))
1165 #define ADC_RMW_MG(base, mask, value) (ADC_WR_MG(base, (ADC_RD_MG(base) & ~(mask)) | (value)))
1166 #define ADC_SET_MG(base, value) (BME_OR32(&ADC_MG_REG(base), (uint32_t)(value)))
1167 #define ADC_CLR_MG(base, value) (BME_AND32(&ADC_MG_REG(base), (uint32_t)(~(value))))
1168 #define ADC_TOG_MG(base, value) (BME_XOR32(&ADC_MG_REG(base), (uint32_t)(value)))
1169 /*@}*/
1170 
1171 /*
1172  * Constants & macros for individual ADC_MG bitfields
1173  */
1174 
1175 /*!
1176  * @name Register ADC_MG, field MG[15:0] (RW)
1177  */
1178 /*@{*/
1179 /*! @brief Read current value of the ADC_MG_MG field. */
1180 #define ADC_RD_MG_MG(base) ((ADC_MG_REG(base) & ADC_MG_MG_MASK) >> ADC_MG_MG_SHIFT)
1181 #define ADC_BRD_MG_MG(base) (BME_UBFX32(&ADC_MG_REG(base), ADC_MG_MG_SHIFT, ADC_MG_MG_WIDTH))
1182 
1183 /*! @brief Set the MG field to a new value. */
1184 #define ADC_WR_MG_MG(base, value) (ADC_RMW_MG(base, ADC_MG_MG_MASK, ADC_MG_MG(value)))
1185 #define ADC_BWR_MG_MG(base, value) (BME_BFI32(&ADC_MG_REG(base), ((uint32_t)(value) << ADC_MG_MG_SHIFT), ADC_MG_MG_SHIFT, ADC_MG_MG_WIDTH))
1186 /*@}*/
1187 
1188 /*******************************************************************************
1189  * ADC_CLPD - ADC Plus-Side General Calibration Value Register
1190  ******************************************************************************/
1191 
1192 /*!
1193  * @brief ADC_CLPD - ADC Plus-Side General Calibration Value Register (RW)
1194  *
1195  * Reset value: 0x0000000AU
1196  *
1197  * The Plus-Side General Calibration Value Registers (CLPx) contain calibration
1198  * information that is generated by the calibration function. These registers
1199  * contain seven calibration values of varying widths: CLP0[5:0], CLP1[6:0],
1200  * CLP2[7:0], CLP3[8:0], CLP4[9:0], CLPS[5:0], and CLPD[5:0]. CLPx are automatically set
1201  * when the self-calibration sequence is done, that is, CAL is cleared. If these
1202  * registers are written by the user after calibration, the linearity error
1203  * specifications may not be met.
1204  */
1205 /*!
1206  * @name Constants and macros for entire ADC_CLPD register
1207  */
1208 /*@{*/
1209 #define ADC_RD_CLPD(base) (ADC_CLPD_REG(base))
1210 #define ADC_WR_CLPD(base, value) (ADC_CLPD_REG(base) = (value))
1211 #define ADC_RMW_CLPD(base, mask, value) (ADC_WR_CLPD(base, (ADC_RD_CLPD(base) & ~(mask)) | (value)))
1212 #define ADC_SET_CLPD(base, value) (BME_OR32(&ADC_CLPD_REG(base), (uint32_t)(value)))
1213 #define ADC_CLR_CLPD(base, value) (BME_AND32(&ADC_CLPD_REG(base), (uint32_t)(~(value))))
1214 #define ADC_TOG_CLPD(base, value) (BME_XOR32(&ADC_CLPD_REG(base), (uint32_t)(value)))
1215 /*@}*/
1216 
1217 /*
1218  * Constants & macros for individual ADC_CLPD bitfields
1219  */
1220 
1221 /*!
1222  * @name Register ADC_CLPD, field CLPD[5:0] (RW)
1223  *
1224  * Calibration Value
1225  */
1226 /*@{*/
1227 /*! @brief Read current value of the ADC_CLPD_CLPD field. */
1228 #define ADC_RD_CLPD_CLPD(base) ((ADC_CLPD_REG(base) & ADC_CLPD_CLPD_MASK) >> ADC_CLPD_CLPD_SHIFT)
1229 #define ADC_BRD_CLPD_CLPD(base) (BME_UBFX32(&ADC_CLPD_REG(base), ADC_CLPD_CLPD_SHIFT, ADC_CLPD_CLPD_WIDTH))
1230 
1231 /*! @brief Set the CLPD field to a new value. */
1232 #define ADC_WR_CLPD_CLPD(base, value) (ADC_RMW_CLPD(base, ADC_CLPD_CLPD_MASK, ADC_CLPD_CLPD(value)))
1233 #define ADC_BWR_CLPD_CLPD(base, value) (BME_BFI32(&ADC_CLPD_REG(base), ((uint32_t)(value) << ADC_CLPD_CLPD_SHIFT), ADC_CLPD_CLPD_SHIFT, ADC_CLPD_CLPD_WIDTH))
1234 /*@}*/
1235 
1236 /*******************************************************************************
1237  * ADC_CLPS - ADC Plus-Side General Calibration Value Register
1238  ******************************************************************************/
1239 
1240 /*!
1241  * @brief ADC_CLPS - ADC Plus-Side General Calibration Value Register (RW)
1242  *
1243  * Reset value: 0x00000020U
1244  *
1245  * For more information, see CLPD register description.
1246  */
1247 /*!
1248  * @name Constants and macros for entire ADC_CLPS register
1249  */
1250 /*@{*/
1251 #define ADC_RD_CLPS(base) (ADC_CLPS_REG(base))
1252 #define ADC_WR_CLPS(base, value) (ADC_CLPS_REG(base) = (value))
1253 #define ADC_RMW_CLPS(base, mask, value) (ADC_WR_CLPS(base, (ADC_RD_CLPS(base) & ~(mask)) | (value)))
1254 #define ADC_SET_CLPS(base, value) (BME_OR32(&ADC_CLPS_REG(base), (uint32_t)(value)))
1255 #define ADC_CLR_CLPS(base, value) (BME_AND32(&ADC_CLPS_REG(base), (uint32_t)(~(value))))
1256 #define ADC_TOG_CLPS(base, value) (BME_XOR32(&ADC_CLPS_REG(base), (uint32_t)(value)))
1257 /*@}*/
1258 
1259 /*
1260  * Constants & macros for individual ADC_CLPS bitfields
1261  */
1262 
1263 /*!
1264  * @name Register ADC_CLPS, field CLPS[5:0] (RW)
1265  *
1266  * Calibration Value
1267  */
1268 /*@{*/
1269 /*! @brief Read current value of the ADC_CLPS_CLPS field. */
1270 #define ADC_RD_CLPS_CLPS(base) ((ADC_CLPS_REG(base) & ADC_CLPS_CLPS_MASK) >> ADC_CLPS_CLPS_SHIFT)
1271 #define ADC_BRD_CLPS_CLPS(base) (BME_UBFX32(&ADC_CLPS_REG(base), ADC_CLPS_CLPS_SHIFT, ADC_CLPS_CLPS_WIDTH))
1272 
1273 /*! @brief Set the CLPS field to a new value. */
1274 #define ADC_WR_CLPS_CLPS(base, value) (ADC_RMW_CLPS(base, ADC_CLPS_CLPS_MASK, ADC_CLPS_CLPS(value)))
1275 #define ADC_BWR_CLPS_CLPS(base, value) (BME_BFI32(&ADC_CLPS_REG(base), ((uint32_t)(value) << ADC_CLPS_CLPS_SHIFT), ADC_CLPS_CLPS_SHIFT, ADC_CLPS_CLPS_WIDTH))
1276 /*@}*/
1277 
1278 /*******************************************************************************
1279  * ADC_CLP4 - ADC Plus-Side General Calibration Value Register
1280  ******************************************************************************/
1281 
1282 /*!
1283  * @brief ADC_CLP4 - ADC Plus-Side General Calibration Value Register (RW)
1284  *
1285  * Reset value: 0x00000200U
1286  *
1287  * For more information, see CLPD register description.
1288  */
1289 /*!
1290  * @name Constants and macros for entire ADC_CLP4 register
1291  */
1292 /*@{*/
1293 #define ADC_RD_CLP4(base) (ADC_CLP4_REG(base))
1294 #define ADC_WR_CLP4(base, value) (ADC_CLP4_REG(base) = (value))
1295 #define ADC_RMW_CLP4(base, mask, value) (ADC_WR_CLP4(base, (ADC_RD_CLP4(base) & ~(mask)) | (value)))
1296 #define ADC_SET_CLP4(base, value) (BME_OR32(&ADC_CLP4_REG(base), (uint32_t)(value)))
1297 #define ADC_CLR_CLP4(base, value) (BME_AND32(&ADC_CLP4_REG(base), (uint32_t)(~(value))))
1298 #define ADC_TOG_CLP4(base, value) (BME_XOR32(&ADC_CLP4_REG(base), (uint32_t)(value)))
1299 /*@}*/
1300 
1301 /*
1302  * Constants & macros for individual ADC_CLP4 bitfields
1303  */
1304 
1305 /*!
1306  * @name Register ADC_CLP4, field CLP4[9:0] (RW)
1307  *
1308  * Calibration Value
1309  */
1310 /*@{*/
1311 /*! @brief Read current value of the ADC_CLP4_CLP4 field. */
1312 #define ADC_RD_CLP4_CLP4(base) ((ADC_CLP4_REG(base) & ADC_CLP4_CLP4_MASK) >> ADC_CLP4_CLP4_SHIFT)
1313 #define ADC_BRD_CLP4_CLP4(base) (BME_UBFX32(&ADC_CLP4_REG(base), ADC_CLP4_CLP4_SHIFT, ADC_CLP4_CLP4_WIDTH))
1314 
1315 /*! @brief Set the CLP4 field to a new value. */
1316 #define ADC_WR_CLP4_CLP4(base, value) (ADC_RMW_CLP4(base, ADC_CLP4_CLP4_MASK, ADC_CLP4_CLP4(value)))
1317 #define ADC_BWR_CLP4_CLP4(base, value) (BME_BFI32(&ADC_CLP4_REG(base), ((uint32_t)(value) << ADC_CLP4_CLP4_SHIFT), ADC_CLP4_CLP4_SHIFT, ADC_CLP4_CLP4_WIDTH))
1318 /*@}*/
1319 
1320 /*******************************************************************************
1321  * ADC_CLP3 - ADC Plus-Side General Calibration Value Register
1322  ******************************************************************************/
1323 
1324 /*!
1325  * @brief ADC_CLP3 - ADC Plus-Side General Calibration Value Register (RW)
1326  *
1327  * Reset value: 0x00000100U
1328  *
1329  * For more information, see CLPD register description.
1330  */
1331 /*!
1332  * @name Constants and macros for entire ADC_CLP3 register
1333  */
1334 /*@{*/
1335 #define ADC_RD_CLP3(base) (ADC_CLP3_REG(base))
1336 #define ADC_WR_CLP3(base, value) (ADC_CLP3_REG(base) = (value))
1337 #define ADC_RMW_CLP3(base, mask, value) (ADC_WR_CLP3(base, (ADC_RD_CLP3(base) & ~(mask)) | (value)))
1338 #define ADC_SET_CLP3(base, value) (BME_OR32(&ADC_CLP3_REG(base), (uint32_t)(value)))
1339 #define ADC_CLR_CLP3(base, value) (BME_AND32(&ADC_CLP3_REG(base), (uint32_t)(~(value))))
1340 #define ADC_TOG_CLP3(base, value) (BME_XOR32(&ADC_CLP3_REG(base), (uint32_t)(value)))
1341 /*@}*/
1342 
1343 /*
1344  * Constants & macros for individual ADC_CLP3 bitfields
1345  */
1346 
1347 /*!
1348  * @name Register ADC_CLP3, field CLP3[8:0] (RW)
1349  *
1350  * Calibration Value
1351  */
1352 /*@{*/
1353 /*! @brief Read current value of the ADC_CLP3_CLP3 field. */
1354 #define ADC_RD_CLP3_CLP3(base) ((ADC_CLP3_REG(base) & ADC_CLP3_CLP3_MASK) >> ADC_CLP3_CLP3_SHIFT)
1355 #define ADC_BRD_CLP3_CLP3(base) (BME_UBFX32(&ADC_CLP3_REG(base), ADC_CLP3_CLP3_SHIFT, ADC_CLP3_CLP3_WIDTH))
1356 
1357 /*! @brief Set the CLP3 field to a new value. */
1358 #define ADC_WR_CLP3_CLP3(base, value) (ADC_RMW_CLP3(base, ADC_CLP3_CLP3_MASK, ADC_CLP3_CLP3(value)))
1359 #define ADC_BWR_CLP3_CLP3(base, value) (BME_BFI32(&ADC_CLP3_REG(base), ((uint32_t)(value) << ADC_CLP3_CLP3_SHIFT), ADC_CLP3_CLP3_SHIFT, ADC_CLP3_CLP3_WIDTH))
1360 /*@}*/
1361 
1362 /*******************************************************************************
1363  * ADC_CLP2 - ADC Plus-Side General Calibration Value Register
1364  ******************************************************************************/
1365 
1366 /*!
1367  * @brief ADC_CLP2 - ADC Plus-Side General Calibration Value Register (RW)
1368  *
1369  * Reset value: 0x00000080U
1370  *
1371  * For more information, see CLPD register description.
1372  */
1373 /*!
1374  * @name Constants and macros for entire ADC_CLP2 register
1375  */
1376 /*@{*/
1377 #define ADC_RD_CLP2(base) (ADC_CLP2_REG(base))
1378 #define ADC_WR_CLP2(base, value) (ADC_CLP2_REG(base) = (value))
1379 #define ADC_RMW_CLP2(base, mask, value) (ADC_WR_CLP2(base, (ADC_RD_CLP2(base) & ~(mask)) | (value)))
1380 #define ADC_SET_CLP2(base, value) (BME_OR32(&ADC_CLP2_REG(base), (uint32_t)(value)))
1381 #define ADC_CLR_CLP2(base, value) (BME_AND32(&ADC_CLP2_REG(base), (uint32_t)(~(value))))
1382 #define ADC_TOG_CLP2(base, value) (BME_XOR32(&ADC_CLP2_REG(base), (uint32_t)(value)))
1383 /*@}*/
1384 
1385 /*
1386  * Constants & macros for individual ADC_CLP2 bitfields
1387  */
1388 
1389 /*!
1390  * @name Register ADC_CLP2, field CLP2[7:0] (RW)
1391  *
1392  * Calibration Value
1393  */
1394 /*@{*/
1395 /*! @brief Read current value of the ADC_CLP2_CLP2 field. */
1396 #define ADC_RD_CLP2_CLP2(base) ((ADC_CLP2_REG(base) & ADC_CLP2_CLP2_MASK) >> ADC_CLP2_CLP2_SHIFT)
1397 #define ADC_BRD_CLP2_CLP2(base) (BME_UBFX32(&ADC_CLP2_REG(base), ADC_CLP2_CLP2_SHIFT, ADC_CLP2_CLP2_WIDTH))
1398 
1399 /*! @brief Set the CLP2 field to a new value. */
1400 #define ADC_WR_CLP2_CLP2(base, value) (ADC_RMW_CLP2(base, ADC_CLP2_CLP2_MASK, ADC_CLP2_CLP2(value)))
1401 #define ADC_BWR_CLP2_CLP2(base, value) (BME_BFI32(&ADC_CLP2_REG(base), ((uint32_t)(value) << ADC_CLP2_CLP2_SHIFT), ADC_CLP2_CLP2_SHIFT, ADC_CLP2_CLP2_WIDTH))
1402 /*@}*/
1403 
1404 /*******************************************************************************
1405  * ADC_CLP1 - ADC Plus-Side General Calibration Value Register
1406  ******************************************************************************/
1407 
1408 /*!
1409  * @brief ADC_CLP1 - ADC Plus-Side General Calibration Value Register (RW)
1410  *
1411  * Reset value: 0x00000040U
1412  *
1413  * For more information, see CLPD register description.
1414  */
1415 /*!
1416  * @name Constants and macros for entire ADC_CLP1 register
1417  */
1418 /*@{*/
1419 #define ADC_RD_CLP1(base) (ADC_CLP1_REG(base))
1420 #define ADC_WR_CLP1(base, value) (ADC_CLP1_REG(base) = (value))
1421 #define ADC_RMW_CLP1(base, mask, value) (ADC_WR_CLP1(base, (ADC_RD_CLP1(base) & ~(mask)) | (value)))
1422 #define ADC_SET_CLP1(base, value) (BME_OR32(&ADC_CLP1_REG(base), (uint32_t)(value)))
1423 #define ADC_CLR_CLP1(base, value) (BME_AND32(&ADC_CLP1_REG(base), (uint32_t)(~(value))))
1424 #define ADC_TOG_CLP1(base, value) (BME_XOR32(&ADC_CLP1_REG(base), (uint32_t)(value)))
1425 /*@}*/
1426 
1427 /*
1428  * Constants & macros for individual ADC_CLP1 bitfields
1429  */
1430 
1431 /*!
1432  * @name Register ADC_CLP1, field CLP1[6:0] (RW)
1433  *
1434  * Calibration Value
1435  */
1436 /*@{*/
1437 /*! @brief Read current value of the ADC_CLP1_CLP1 field. */
1438 #define ADC_RD_CLP1_CLP1(base) ((ADC_CLP1_REG(base) & ADC_CLP1_CLP1_MASK) >> ADC_CLP1_CLP1_SHIFT)
1439 #define ADC_BRD_CLP1_CLP1(base) (BME_UBFX32(&ADC_CLP1_REG(base), ADC_CLP1_CLP1_SHIFT, ADC_CLP1_CLP1_WIDTH))
1440 
1441 /*! @brief Set the CLP1 field to a new value. */
1442 #define ADC_WR_CLP1_CLP1(base, value) (ADC_RMW_CLP1(base, ADC_CLP1_CLP1_MASK, ADC_CLP1_CLP1(value)))
1443 #define ADC_BWR_CLP1_CLP1(base, value) (BME_BFI32(&ADC_CLP1_REG(base), ((uint32_t)(value) << ADC_CLP1_CLP1_SHIFT), ADC_CLP1_CLP1_SHIFT, ADC_CLP1_CLP1_WIDTH))
1444 /*@}*/
1445 
1446 /*******************************************************************************
1447  * ADC_CLP0 - ADC Plus-Side General Calibration Value Register
1448  ******************************************************************************/
1449 
1450 /*!
1451  * @brief ADC_CLP0 - ADC Plus-Side General Calibration Value Register (RW)
1452  *
1453  * Reset value: 0x00000020U
1454  *
1455  * For more information, see CLPD register description.
1456  */
1457 /*!
1458  * @name Constants and macros for entire ADC_CLP0 register
1459  */
1460 /*@{*/
1461 #define ADC_RD_CLP0(base) (ADC_CLP0_REG(base))
1462 #define ADC_WR_CLP0(base, value) (ADC_CLP0_REG(base) = (value))
1463 #define ADC_RMW_CLP0(base, mask, value) (ADC_WR_CLP0(base, (ADC_RD_CLP0(base) & ~(mask)) | (value)))
1464 #define ADC_SET_CLP0(base, value) (BME_OR32(&ADC_CLP0_REG(base), (uint32_t)(value)))
1465 #define ADC_CLR_CLP0(base, value) (BME_AND32(&ADC_CLP0_REG(base), (uint32_t)(~(value))))
1466 #define ADC_TOG_CLP0(base, value) (BME_XOR32(&ADC_CLP0_REG(base), (uint32_t)(value)))
1467 /*@}*/
1468 
1469 /*
1470  * Constants & macros for individual ADC_CLP0 bitfields
1471  */
1472 
1473 /*!
1474  * @name Register ADC_CLP0, field CLP0[5:0] (RW)
1475  *
1476  * Calibration Value
1477  */
1478 /*@{*/
1479 /*! @brief Read current value of the ADC_CLP0_CLP0 field. */
1480 #define ADC_RD_CLP0_CLP0(base) ((ADC_CLP0_REG(base) & ADC_CLP0_CLP0_MASK) >> ADC_CLP0_CLP0_SHIFT)
1481 #define ADC_BRD_CLP0_CLP0(base) (BME_UBFX32(&ADC_CLP0_REG(base), ADC_CLP0_CLP0_SHIFT, ADC_CLP0_CLP0_WIDTH))
1482 
1483 /*! @brief Set the CLP0 field to a new value. */
1484 #define ADC_WR_CLP0_CLP0(base, value) (ADC_RMW_CLP0(base, ADC_CLP0_CLP0_MASK, ADC_CLP0_CLP0(value)))
1485 #define ADC_BWR_CLP0_CLP0(base, value) (BME_BFI32(&ADC_CLP0_REG(base), ((uint32_t)(value) << ADC_CLP0_CLP0_SHIFT), ADC_CLP0_CLP0_SHIFT, ADC_CLP0_CLP0_WIDTH))
1486 /*@}*/
1487 
1488 /*******************************************************************************
1489  * ADC_CLMD - ADC Minus-Side General Calibration Value Register
1490  ******************************************************************************/
1491 
1492 /*!
1493  * @brief ADC_CLMD - ADC Minus-Side General Calibration Value Register (RW)
1494  *
1495  * Reset value: 0x0000000AU
1496  *
1497  * The Minus-Side General Calibration Value (CLMx) registers contain calibration
1498  * information that is generated by the calibration function. These registers
1499  * contain seven calibration values of varying widths: CLM0[5:0], CLM1[6:0],
1500  * CLM2[7:0], CLM3[8:0], CLM4[9:0], CLMS[5:0], and CLMD[5:0]. CLMx are automatically
1501  * set when the self-calibration sequence is done, that is, CAL is cleared. If
1502  * these registers are written by the user after calibration, the linearity error
1503  * specifications may not be met.
1504  */
1505 /*!
1506  * @name Constants and macros for entire ADC_CLMD register
1507  */
1508 /*@{*/
1509 #define ADC_RD_CLMD(base) (ADC_CLMD_REG(base))
1510 #define ADC_WR_CLMD(base, value) (ADC_CLMD_REG(base) = (value))
1511 #define ADC_RMW_CLMD(base, mask, value) (ADC_WR_CLMD(base, (ADC_RD_CLMD(base) & ~(mask)) | (value)))
1512 #define ADC_SET_CLMD(base, value) (BME_OR32(&ADC_CLMD_REG(base), (uint32_t)(value)))
1513 #define ADC_CLR_CLMD(base, value) (BME_AND32(&ADC_CLMD_REG(base), (uint32_t)(~(value))))
1514 #define ADC_TOG_CLMD(base, value) (BME_XOR32(&ADC_CLMD_REG(base), (uint32_t)(value)))
1515 /*@}*/
1516 
1517 /*
1518  * Constants & macros for individual ADC_CLMD bitfields
1519  */
1520 
1521 /*!
1522  * @name Register ADC_CLMD, field CLMD[5:0] (RW)
1523  *
1524  * Calibration Value
1525  */
1526 /*@{*/
1527 /*! @brief Read current value of the ADC_CLMD_CLMD field. */
1528 #define ADC_RD_CLMD_CLMD(base) ((ADC_CLMD_REG(base) & ADC_CLMD_CLMD_MASK) >> ADC_CLMD_CLMD_SHIFT)
1529 #define ADC_BRD_CLMD_CLMD(base) (BME_UBFX32(&ADC_CLMD_REG(base), ADC_CLMD_CLMD_SHIFT, ADC_CLMD_CLMD_WIDTH))
1530 
1531 /*! @brief Set the CLMD field to a new value. */
1532 #define ADC_WR_CLMD_CLMD(base, value) (ADC_RMW_CLMD(base, ADC_CLMD_CLMD_MASK, ADC_CLMD_CLMD(value)))
1533 #define ADC_BWR_CLMD_CLMD(base, value) (BME_BFI32(&ADC_CLMD_REG(base), ((uint32_t)(value) << ADC_CLMD_CLMD_SHIFT), ADC_CLMD_CLMD_SHIFT, ADC_CLMD_CLMD_WIDTH))
1534 /*@}*/
1535 
1536 /*******************************************************************************
1537  * ADC_CLMS - ADC Minus-Side General Calibration Value Register
1538  ******************************************************************************/
1539 
1540 /*!
1541  * @brief ADC_CLMS - ADC Minus-Side General Calibration Value Register (RW)
1542  *
1543  * Reset value: 0x00000020U
1544  *
1545  * For more information, see CLMD register description.
1546  */
1547 /*!
1548  * @name Constants and macros for entire ADC_CLMS register
1549  */
1550 /*@{*/
1551 #define ADC_RD_CLMS(base) (ADC_CLMS_REG(base))
1552 #define ADC_WR_CLMS(base, value) (ADC_CLMS_REG(base) = (value))
1553 #define ADC_RMW_CLMS(base, mask, value) (ADC_WR_CLMS(base, (ADC_RD_CLMS(base) & ~(mask)) | (value)))
1554 #define ADC_SET_CLMS(base, value) (BME_OR32(&ADC_CLMS_REG(base), (uint32_t)(value)))
1555 #define ADC_CLR_CLMS(base, value) (BME_AND32(&ADC_CLMS_REG(base), (uint32_t)(~(value))))
1556 #define ADC_TOG_CLMS(base, value) (BME_XOR32(&ADC_CLMS_REG(base), (uint32_t)(value)))
1557 /*@}*/
1558 
1559 /*
1560  * Constants & macros for individual ADC_CLMS bitfields
1561  */
1562 
1563 /*!
1564  * @name Register ADC_CLMS, field CLMS[5:0] (RW)
1565  *
1566  * Calibration Value
1567  */
1568 /*@{*/
1569 /*! @brief Read current value of the ADC_CLMS_CLMS field. */
1570 #define ADC_RD_CLMS_CLMS(base) ((ADC_CLMS_REG(base) & ADC_CLMS_CLMS_MASK) >> ADC_CLMS_CLMS_SHIFT)
1571 #define ADC_BRD_CLMS_CLMS(base) (BME_UBFX32(&ADC_CLMS_REG(base), ADC_CLMS_CLMS_SHIFT, ADC_CLMS_CLMS_WIDTH))
1572 
1573 /*! @brief Set the CLMS field to a new value. */
1574 #define ADC_WR_CLMS_CLMS(base, value) (ADC_RMW_CLMS(base, ADC_CLMS_CLMS_MASK, ADC_CLMS_CLMS(value)))
1575 #define ADC_BWR_CLMS_CLMS(base, value) (BME_BFI32(&ADC_CLMS_REG(base), ((uint32_t)(value) << ADC_CLMS_CLMS_SHIFT), ADC_CLMS_CLMS_SHIFT, ADC_CLMS_CLMS_WIDTH))
1576 /*@}*/
1577 
1578 /*******************************************************************************
1579  * ADC_CLM4 - ADC Minus-Side General Calibration Value Register
1580  ******************************************************************************/
1581 
1582 /*!
1583  * @brief ADC_CLM4 - ADC Minus-Side General Calibration Value Register (RW)
1584  *
1585  * Reset value: 0x00000200U
1586  *
1587  * For more information, see CLMD register description.
1588  */
1589 /*!
1590  * @name Constants and macros for entire ADC_CLM4 register
1591  */
1592 /*@{*/
1593 #define ADC_RD_CLM4(base) (ADC_CLM4_REG(base))
1594 #define ADC_WR_CLM4(base, value) (ADC_CLM4_REG(base) = (value))
1595 #define ADC_RMW_CLM4(base, mask, value) (ADC_WR_CLM4(base, (ADC_RD_CLM4(base) & ~(mask)) | (value)))
1596 #define ADC_SET_CLM4(base, value) (BME_OR32(&ADC_CLM4_REG(base), (uint32_t)(value)))
1597 #define ADC_CLR_CLM4(base, value) (BME_AND32(&ADC_CLM4_REG(base), (uint32_t)(~(value))))
1598 #define ADC_TOG_CLM4(base, value) (BME_XOR32(&ADC_CLM4_REG(base), (uint32_t)(value)))
1599 /*@}*/
1600 
1601 /*
1602  * Constants & macros for individual ADC_CLM4 bitfields
1603  */
1604 
1605 /*!
1606  * @name Register ADC_CLM4, field CLM4[9:0] (RW)
1607  *
1608  * Calibration Value
1609  */
1610 /*@{*/
1611 /*! @brief Read current value of the ADC_CLM4_CLM4 field. */
1612 #define ADC_RD_CLM4_CLM4(base) ((ADC_CLM4_REG(base) & ADC_CLM4_CLM4_MASK) >> ADC_CLM4_CLM4_SHIFT)
1613 #define ADC_BRD_CLM4_CLM4(base) (BME_UBFX32(&ADC_CLM4_REG(base), ADC_CLM4_CLM4_SHIFT, ADC_CLM4_CLM4_WIDTH))
1614 
1615 /*! @brief Set the CLM4 field to a new value. */
1616 #define ADC_WR_CLM4_CLM4(base, value) (ADC_RMW_CLM4(base, ADC_CLM4_CLM4_MASK, ADC_CLM4_CLM4(value)))
1617 #define ADC_BWR_CLM4_CLM4(base, value) (BME_BFI32(&ADC_CLM4_REG(base), ((uint32_t)(value) << ADC_CLM4_CLM4_SHIFT), ADC_CLM4_CLM4_SHIFT, ADC_CLM4_CLM4_WIDTH))
1618 /*@}*/
1619 
1620 /*******************************************************************************
1621  * ADC_CLM3 - ADC Minus-Side General Calibration Value Register
1622  ******************************************************************************/
1623 
1624 /*!
1625  * @brief ADC_CLM3 - ADC Minus-Side General Calibration Value Register (RW)
1626  *
1627  * Reset value: 0x00000100U
1628  *
1629  * For more information, see CLMD register description.
1630  */
1631 /*!
1632  * @name Constants and macros for entire ADC_CLM3 register
1633  */
1634 /*@{*/
1635 #define ADC_RD_CLM3(base) (ADC_CLM3_REG(base))
1636 #define ADC_WR_CLM3(base, value) (ADC_CLM3_REG(base) = (value))
1637 #define ADC_RMW_CLM3(base, mask, value) (ADC_WR_CLM3(base, (ADC_RD_CLM3(base) & ~(mask)) | (value)))
1638 #define ADC_SET_CLM3(base, value) (BME_OR32(&ADC_CLM3_REG(base), (uint32_t)(value)))
1639 #define ADC_CLR_CLM3(base, value) (BME_AND32(&ADC_CLM3_REG(base), (uint32_t)(~(value))))
1640 #define ADC_TOG_CLM3(base, value) (BME_XOR32(&ADC_CLM3_REG(base), (uint32_t)(value)))
1641 /*@}*/
1642 
1643 /*
1644  * Constants & macros for individual ADC_CLM3 bitfields
1645  */
1646 
1647 /*!
1648  * @name Register ADC_CLM3, field CLM3[8:0] (RW)
1649  *
1650  * Calibration Value
1651  */
1652 /*@{*/
1653 /*! @brief Read current value of the ADC_CLM3_CLM3 field. */
1654 #define ADC_RD_CLM3_CLM3(base) ((ADC_CLM3_REG(base) & ADC_CLM3_CLM3_MASK) >> ADC_CLM3_CLM3_SHIFT)
1655 #define ADC_BRD_CLM3_CLM3(base) (BME_UBFX32(&ADC_CLM3_REG(base), ADC_CLM3_CLM3_SHIFT, ADC_CLM3_CLM3_WIDTH))
1656 
1657 /*! @brief Set the CLM3 field to a new value. */
1658 #define ADC_WR_CLM3_CLM3(base, value) (ADC_RMW_CLM3(base, ADC_CLM3_CLM3_MASK, ADC_CLM3_CLM3(value)))
1659 #define ADC_BWR_CLM3_CLM3(base, value) (BME_BFI32(&ADC_CLM3_REG(base), ((uint32_t)(value) << ADC_CLM3_CLM3_SHIFT), ADC_CLM3_CLM3_SHIFT, ADC_CLM3_CLM3_WIDTH))
1660 /*@}*/
1661 
1662 /*******************************************************************************
1663  * ADC_CLM2 - ADC Minus-Side General Calibration Value Register
1664  ******************************************************************************/
1665 
1666 /*!
1667  * @brief ADC_CLM2 - ADC Minus-Side General Calibration Value Register (RW)
1668  *
1669  * Reset value: 0x00000080U
1670  *
1671  * For more information, see CLMD register description.
1672  */
1673 /*!
1674  * @name Constants and macros for entire ADC_CLM2 register
1675  */
1676 /*@{*/
1677 #define ADC_RD_CLM2(base) (ADC_CLM2_REG(base))
1678 #define ADC_WR_CLM2(base, value) (ADC_CLM2_REG(base) = (value))
1679 #define ADC_RMW_CLM2(base, mask, value) (ADC_WR_CLM2(base, (ADC_RD_CLM2(base) & ~(mask)) | (value)))
1680 #define ADC_SET_CLM2(base, value) (BME_OR32(&ADC_CLM2_REG(base), (uint32_t)(value)))
1681 #define ADC_CLR_CLM2(base, value) (BME_AND32(&ADC_CLM2_REG(base), (uint32_t)(~(value))))
1682 #define ADC_TOG_CLM2(base, value) (BME_XOR32(&ADC_CLM2_REG(base), (uint32_t)(value)))
1683 /*@}*/
1684 
1685 /*
1686  * Constants & macros for individual ADC_CLM2 bitfields
1687  */
1688 
1689 /*!
1690  * @name Register ADC_CLM2, field CLM2[7:0] (RW)
1691  *
1692  * Calibration Value
1693  */
1694 /*@{*/
1695 /*! @brief Read current value of the ADC_CLM2_CLM2 field. */
1696 #define ADC_RD_CLM2_CLM2(base) ((ADC_CLM2_REG(base) & ADC_CLM2_CLM2_MASK) >> ADC_CLM2_CLM2_SHIFT)
1697 #define ADC_BRD_CLM2_CLM2(base) (BME_UBFX32(&ADC_CLM2_REG(base), ADC_CLM2_CLM2_SHIFT, ADC_CLM2_CLM2_WIDTH))
1698 
1699 /*! @brief Set the CLM2 field to a new value. */
1700 #define ADC_WR_CLM2_CLM2(base, value) (ADC_RMW_CLM2(base, ADC_CLM2_CLM2_MASK, ADC_CLM2_CLM2(value)))
1701 #define ADC_BWR_CLM2_CLM2(base, value) (BME_BFI32(&ADC_CLM2_REG(base), ((uint32_t)(value) << ADC_CLM2_CLM2_SHIFT), ADC_CLM2_CLM2_SHIFT, ADC_CLM2_CLM2_WIDTH))
1702 /*@}*/
1703 
1704 /*******************************************************************************
1705  * ADC_CLM1 - ADC Minus-Side General Calibration Value Register
1706  ******************************************************************************/
1707 
1708 /*!
1709  * @brief ADC_CLM1 - ADC Minus-Side General Calibration Value Register (RW)
1710  *
1711  * Reset value: 0x00000040U
1712  *
1713  * For more information, see CLMD register description.
1714  */
1715 /*!
1716  * @name Constants and macros for entire ADC_CLM1 register
1717  */
1718 /*@{*/
1719 #define ADC_RD_CLM1(base) (ADC_CLM1_REG(base))
1720 #define ADC_WR_CLM1(base, value) (ADC_CLM1_REG(base) = (value))
1721 #define ADC_RMW_CLM1(base, mask, value) (ADC_WR_CLM1(base, (ADC_RD_CLM1(base) & ~(mask)) | (value)))
1722 #define ADC_SET_CLM1(base, value) (BME_OR32(&ADC_CLM1_REG(base), (uint32_t)(value)))
1723 #define ADC_CLR_CLM1(base, value) (BME_AND32(&ADC_CLM1_REG(base), (uint32_t)(~(value))))
1724 #define ADC_TOG_CLM1(base, value) (BME_XOR32(&ADC_CLM1_REG(base), (uint32_t)(value)))
1725 /*@}*/
1726 
1727 /*
1728  * Constants & macros for individual ADC_CLM1 bitfields
1729  */
1730 
1731 /*!
1732  * @name Register ADC_CLM1, field CLM1[6:0] (RW)
1733  *
1734  * Calibration Value
1735  */
1736 /*@{*/
1737 /*! @brief Read current value of the ADC_CLM1_CLM1 field. */
1738 #define ADC_RD_CLM1_CLM1(base) ((ADC_CLM1_REG(base) & ADC_CLM1_CLM1_MASK) >> ADC_CLM1_CLM1_SHIFT)
1739 #define ADC_BRD_CLM1_CLM1(base) (BME_UBFX32(&ADC_CLM1_REG(base), ADC_CLM1_CLM1_SHIFT, ADC_CLM1_CLM1_WIDTH))
1740 
1741 /*! @brief Set the CLM1 field to a new value. */
1742 #define ADC_WR_CLM1_CLM1(base, value) (ADC_RMW_CLM1(base, ADC_CLM1_CLM1_MASK, ADC_CLM1_CLM1(value)))
1743 #define ADC_BWR_CLM1_CLM1(base, value) (BME_BFI32(&ADC_CLM1_REG(base), ((uint32_t)(value) << ADC_CLM1_CLM1_SHIFT), ADC_CLM1_CLM1_SHIFT, ADC_CLM1_CLM1_WIDTH))
1744 /*@}*/
1745 
1746 /*******************************************************************************
1747  * ADC_CLM0 - ADC Minus-Side General Calibration Value Register
1748  ******************************************************************************/
1749 
1750 /*!
1751  * @brief ADC_CLM0 - ADC Minus-Side General Calibration Value Register (RW)
1752  *
1753  * Reset value: 0x00000020U
1754  *
1755  * For more information, see CLMD register description.
1756  */
1757 /*!
1758  * @name Constants and macros for entire ADC_CLM0 register
1759  */
1760 /*@{*/
1761 #define ADC_RD_CLM0(base) (ADC_CLM0_REG(base))
1762 #define ADC_WR_CLM0(base, value) (ADC_CLM0_REG(base) = (value))
1763 #define ADC_RMW_CLM0(base, mask, value) (ADC_WR_CLM0(base, (ADC_RD_CLM0(base) & ~(mask)) | (value)))
1764 #define ADC_SET_CLM0(base, value) (BME_OR32(&ADC_CLM0_REG(base), (uint32_t)(value)))
1765 #define ADC_CLR_CLM0(base, value) (BME_AND32(&ADC_CLM0_REG(base), (uint32_t)(~(value))))
1766 #define ADC_TOG_CLM0(base, value) (BME_XOR32(&ADC_CLM0_REG(base), (uint32_t)(value)))
1767 /*@}*/
1768 
1769 /*
1770  * Constants & macros for individual ADC_CLM0 bitfields
1771  */
1772 
1773 /*!
1774  * @name Register ADC_CLM0, field CLM0[5:0] (RW)
1775  *
1776  * Calibration Value
1777  */
1778 /*@{*/
1779 /*! @brief Read current value of the ADC_CLM0_CLM0 field. */
1780 #define ADC_RD_CLM0_CLM0(base) ((ADC_CLM0_REG(base) & ADC_CLM0_CLM0_MASK) >> ADC_CLM0_CLM0_SHIFT)
1781 #define ADC_BRD_CLM0_CLM0(base) (BME_UBFX32(&ADC_CLM0_REG(base), ADC_CLM0_CLM0_SHIFT, ADC_CLM0_CLM0_WIDTH))
1782 
1783 /*! @brief Set the CLM0 field to a new value. */
1784 #define ADC_WR_CLM0_CLM0(base, value) (ADC_RMW_CLM0(base, ADC_CLM0_CLM0_MASK, ADC_CLM0_CLM0(value)))
1785 #define ADC_BWR_CLM0_CLM0(base, value) (BME_BFI32(&ADC_CLM0_REG(base), ((uint32_t)(value) << ADC_CLM0_CLM0_SHIFT), ADC_CLM0_CLM0_SHIFT, ADC_CLM0_CLM0_WIDTH))
1786 /*@}*/
1787 
1788 /*
1789  * MKL25Z4 CMP
1790  *
1791  * High-Speed Comparator (CMP), Voltage Reference (VREF) Digital-to-Analog Converter (DAC), and Analog Mux (ANMUX)
1792  *
1793  * Registers defined in this header file:
1794  * - CMP_CR0 - CMP Control Register 0
1795  * - CMP_CR1 - CMP Control Register 1
1796  * - CMP_FPR - CMP Filter Period Register
1797  * - CMP_SCR - CMP Status and Control Register
1798  * - CMP_DACCR - DAC Control Register
1799  * - CMP_MUXCR - MUX Control Register
1800  */
1801 
1802 #define CMP_INSTANCE_COUNT (1U) /*!< Number of instances of the CMP module. */
1803 #define CMP0_IDX (0U) /*!< Instance number for CMP0. */
1804 
1805 /*******************************************************************************
1806  * CMP_CR0 - CMP Control Register 0
1807  ******************************************************************************/
1808 
1809 /*!
1810  * @brief CMP_CR0 - CMP Control Register 0 (RW)
1811  *
1812  * Reset value: 0x00U
1813  */
1814 /*!
1815  * @name Constants and macros for entire CMP_CR0 register
1816  */
1817 /*@{*/
1818 #define CMP_RD_CR0(base) (CMP_CR0_REG(base))
1819 #define CMP_WR_CR0(base, value) (CMP_CR0_REG(base) = (value))
1820 #define CMP_RMW_CR0(base, mask, value) (CMP_WR_CR0(base, (CMP_RD_CR0(base) & ~(mask)) | (value)))
1821 #define CMP_SET_CR0(base, value) (BME_OR8(&CMP_CR0_REG(base), (uint8_t)(value)))
1822 #define CMP_CLR_CR0(base, value) (BME_AND8(&CMP_CR0_REG(base), (uint8_t)(~(value))))
1823 #define CMP_TOG_CR0(base, value) (BME_XOR8(&CMP_CR0_REG(base), (uint8_t)(value)))
1824 /*@}*/
1825 
1826 /*
1827  * Constants & macros for individual CMP_CR0 bitfields
1828  */
1829 
1830 /*!
1831  * @name Register CMP_CR0, field HYSTCTR[1:0] (RW)
1832  *
1833  * Defines the programmable hysteresis level. The hysteresis values associated
1834  * with each level are device-specific. See the Data Sheet of the device for the
1835  * exact values.
1836  *
1837  * Values:
1838  * - 0b00 - Level 0
1839  * - 0b01 - Level 1
1840  * - 0b10 - Level 2
1841  * - 0b11 - Level 3
1842  */
1843 /*@{*/
1844 /*! @brief Read current value of the CMP_CR0_HYSTCTR field. */
1845 #define CMP_RD_CR0_HYSTCTR(base) ((CMP_CR0_REG(base) & CMP_CR0_HYSTCTR_MASK) >> CMP_CR0_HYSTCTR_SHIFT)
1846 #define CMP_BRD_CR0_HYSTCTR(base) (BME_UBFX8(&CMP_CR0_REG(base), CMP_CR0_HYSTCTR_SHIFT, CMP_CR0_HYSTCTR_WIDTH))
1847 
1848 /*! @brief Set the HYSTCTR field to a new value. */
1849 #define CMP_WR_CR0_HYSTCTR(base, value) (CMP_RMW_CR0(base, CMP_CR0_HYSTCTR_MASK, CMP_CR0_HYSTCTR(value)))
1850 #define CMP_BWR_CR0_HYSTCTR(base, value) (BME_BFI8(&CMP_CR0_REG(base), ((uint8_t)(value) << CMP_CR0_HYSTCTR_SHIFT), CMP_CR0_HYSTCTR_SHIFT, CMP_CR0_HYSTCTR_WIDTH))
1851 /*@}*/
1852 
1853 /*!
1854  * @name Register CMP_CR0, field FILTER_CNT[6:4] (RW)
1855  *
1856  * Represents the number of consecutive samples that must agree prior to the
1857  * comparator ouput filter accepting a new output state. For information regarding
1858  * filter programming and latency, see the Functional description.
1859  *
1860  * Values:
1861  * - 0b000 - Filter is disabled. If SE = 1, then COUT is a logic 0. This is not
1862  * a legal state, and is not recommended. If SE = 0, COUT = COUTA.
1863  * - 0b001 - One sample must agree. The comparator output is simply sampled.
1864  * - 0b010 - 2 consecutive samples must agree.
1865  * - 0b011 - 3 consecutive samples must agree.
1866  * - 0b100 - 4 consecutive samples must agree.
1867  * - 0b101 - 5 consecutive samples must agree.
1868  * - 0b110 - 6 consecutive samples must agree.
1869  * - 0b111 - 7 consecutive samples must agree.
1870  */
1871 /*@{*/
1872 /*! @brief Read current value of the CMP_CR0_FILTER_CNT field. */
1873 #define CMP_RD_CR0_FILTER_CNT(base) ((CMP_CR0_REG(base) & CMP_CR0_FILTER_CNT_MASK) >> CMP_CR0_FILTER_CNT_SHIFT)
1874 #define CMP_BRD_CR0_FILTER_CNT(base) (BME_UBFX8(&CMP_CR0_REG(base), CMP_CR0_FILTER_CNT_SHIFT, CMP_CR0_FILTER_CNT_WIDTH))
1875 
1876 /*! @brief Set the FILTER_CNT field to a new value. */
1877 #define CMP_WR_CR0_FILTER_CNT(base, value) (CMP_RMW_CR0(base, CMP_CR0_FILTER_CNT_MASK, CMP_CR0_FILTER_CNT(value)))
1878 #define CMP_BWR_CR0_FILTER_CNT(base, value) (BME_BFI8(&CMP_CR0_REG(base), ((uint8_t)(value) << CMP_CR0_FILTER_CNT_SHIFT), CMP_CR0_FILTER_CNT_SHIFT, CMP_CR0_FILTER_CNT_WIDTH))
1879 /*@}*/
1880 
1881 /*******************************************************************************
1882  * CMP_CR1 - CMP Control Register 1
1883  ******************************************************************************/
1884 
1885 /*!
1886  * @brief CMP_CR1 - CMP Control Register 1 (RW)
1887  *
1888  * Reset value: 0x00U
1889  */
1890 /*!
1891  * @name Constants and macros for entire CMP_CR1 register
1892  */
1893 /*@{*/
1894 #define CMP_RD_CR1(base) (CMP_CR1_REG(base))
1895 #define CMP_WR_CR1(base, value) (CMP_CR1_REG(base) = (value))
1896 #define CMP_RMW_CR1(base, mask, value) (CMP_WR_CR1(base, (CMP_RD_CR1(base) & ~(mask)) | (value)))
1897 #define CMP_SET_CR1(base, value) (BME_OR8(&CMP_CR1_REG(base), (uint8_t)(value)))
1898 #define CMP_CLR_CR1(base, value) (BME_AND8(&CMP_CR1_REG(base), (uint8_t)(~(value))))
1899 #define CMP_TOG_CR1(base, value) (BME_XOR8(&CMP_CR1_REG(base), (uint8_t)(value)))
1900 /*@}*/
1901 
1902 /*
1903  * Constants & macros for individual CMP_CR1 bitfields
1904  */
1905 
1906 /*!
1907  * @name Register CMP_CR1, field EN[0] (RW)
1908  *
1909  * Enables the Analog Comparator module. When the module is not enabled, it
1910  * remains in the off state, and consumes no power. When the user selects the same
1911  * input from analog mux to the positive and negative port, the comparator is
1912  * disabled automatically.
1913  *
1914  * Values:
1915  * - 0b0 - Analog Comparator is disabled.
1916  * - 0b1 - Analog Comparator is enabled.
1917  */
1918 /*@{*/
1919 /*! @brief Read current value of the CMP_CR1_EN field. */
1920 #define CMP_RD_CR1_EN(base) ((CMP_CR1_REG(base) & CMP_CR1_EN_MASK) >> CMP_CR1_EN_SHIFT)
1921 #define CMP_BRD_CR1_EN(base) (BME_UBFX8(&CMP_CR1_REG(base), CMP_CR1_EN_SHIFT, CMP_CR1_EN_WIDTH))
1922 
1923 /*! @brief Set the EN field to a new value. */
1924 #define CMP_WR_CR1_EN(base, value) (CMP_RMW_CR1(base, CMP_CR1_EN_MASK, CMP_CR1_EN(value)))
1925 #define CMP_BWR_CR1_EN(base, value) (BME_BFI8(&CMP_CR1_REG(base), ((uint8_t)(value) << CMP_CR1_EN_SHIFT), CMP_CR1_EN_SHIFT, CMP_CR1_EN_WIDTH))
1926 /*@}*/
1927 
1928 /*!
1929  * @name Register CMP_CR1, field OPE[1] (RW)
1930  *
1931  * Values:
1932  * - 0b0 - CMPO is not available on the associated CMPO output pin. If the
1933  * comparator does not own the pin, this field has no effect.
1934  * - 0b1 - CMPO is available on the associated CMPO output pin. The comparator
1935  * output (CMPO) is driven out on the associated CMPO output pin if the
1936  * comparator owns the pin. If the comparator does not own the field, this bit has
1937  * no effect.
1938  */
1939 /*@{*/
1940 /*! @brief Read current value of the CMP_CR1_OPE field. */
1941 #define CMP_RD_CR1_OPE(base) ((CMP_CR1_REG(base) & CMP_CR1_OPE_MASK) >> CMP_CR1_OPE_SHIFT)
1942 #define CMP_BRD_CR1_OPE(base) (BME_UBFX8(&CMP_CR1_REG(base), CMP_CR1_OPE_SHIFT, CMP_CR1_OPE_WIDTH))
1943 
1944 /*! @brief Set the OPE field to a new value. */
1945 #define CMP_WR_CR1_OPE(base, value) (CMP_RMW_CR1(base, CMP_CR1_OPE_MASK, CMP_CR1_OPE(value)))
1946 #define CMP_BWR_CR1_OPE(base, value) (BME_BFI8(&CMP_CR1_REG(base), ((uint8_t)(value) << CMP_CR1_OPE_SHIFT), CMP_CR1_OPE_SHIFT, CMP_CR1_OPE_WIDTH))
1947 /*@}*/
1948 
1949 /*!
1950  * @name Register CMP_CR1, field COS[2] (RW)
1951  *
1952  * Values:
1953  * - 0b0 - Set the filtered comparator output (CMPO) to equal COUT.
1954  * - 0b1 - Set the unfiltered comparator output (CMPO) to equal COUTA.
1955  */
1956 /*@{*/
1957 /*! @brief Read current value of the CMP_CR1_COS field. */
1958 #define CMP_RD_CR1_COS(base) ((CMP_CR1_REG(base) & CMP_CR1_COS_MASK) >> CMP_CR1_COS_SHIFT)
1959 #define CMP_BRD_CR1_COS(base) (BME_UBFX8(&CMP_CR1_REG(base), CMP_CR1_COS_SHIFT, CMP_CR1_COS_WIDTH))
1960 
1961 /*! @brief Set the COS field to a new value. */
1962 #define CMP_WR_CR1_COS(base, value) (CMP_RMW_CR1(base, CMP_CR1_COS_MASK, CMP_CR1_COS(value)))
1963 #define CMP_BWR_CR1_COS(base, value) (BME_BFI8(&CMP_CR1_REG(base), ((uint8_t)(value) << CMP_CR1_COS_SHIFT), CMP_CR1_COS_SHIFT, CMP_CR1_COS_WIDTH))
1964 /*@}*/
1965 
1966 /*!
1967  * @name Register CMP_CR1, field INV[3] (RW)
1968  *
1969  * Allows selection of the polarity of the analog comparator function. It is
1970  * also driven to the COUT output, on both the device pin and as SCR[COUT], when
1971  * OPE=0.
1972  *
1973  * Values:
1974  * - 0b0 - Does not invert the comparator output.
1975  * - 0b1 - Inverts the comparator output.
1976  */
1977 /*@{*/
1978 /*! @brief Read current value of the CMP_CR1_INV field. */
1979 #define CMP_RD_CR1_INV(base) ((CMP_CR1_REG(base) & CMP_CR1_INV_MASK) >> CMP_CR1_INV_SHIFT)
1980 #define CMP_BRD_CR1_INV(base) (BME_UBFX8(&CMP_CR1_REG(base), CMP_CR1_INV_SHIFT, CMP_CR1_INV_WIDTH))
1981 
1982 /*! @brief Set the INV field to a new value. */
1983 #define CMP_WR_CR1_INV(base, value) (CMP_RMW_CR1(base, CMP_CR1_INV_MASK, CMP_CR1_INV(value)))
1984 #define CMP_BWR_CR1_INV(base, value) (BME_BFI8(&CMP_CR1_REG(base), ((uint8_t)(value) << CMP_CR1_INV_SHIFT), CMP_CR1_INV_SHIFT, CMP_CR1_INV_WIDTH))
1985 /*@}*/
1986 
1987 /*!
1988  * @name Register CMP_CR1, field PMODE[4] (RW)
1989  *
1990  * See the electrical specifications table in the device Data Sheet for details.
1991  *
1992  * Values:
1993  * - 0b0 - Low-Speed (LS) Comparison mode selected. In this mode, CMP has slower
1994  * output propagation delay and lower current consumption.
1995  * - 0b1 - High-Speed (HS) Comparison mode selected. In this mode, CMP has
1996  * faster output propagation delay and higher current consumption.
1997  */
1998 /*@{*/
1999 /*! @brief Read current value of the CMP_CR1_PMODE field. */
2000 #define CMP_RD_CR1_PMODE(base) ((CMP_CR1_REG(base) & CMP_CR1_PMODE_MASK) >> CMP_CR1_PMODE_SHIFT)
2001 #define CMP_BRD_CR1_PMODE(base) (BME_UBFX8(&CMP_CR1_REG(base), CMP_CR1_PMODE_SHIFT, CMP_CR1_PMODE_WIDTH))
2002 
2003 /*! @brief Set the PMODE field to a new value. */
2004 #define CMP_WR_CR1_PMODE(base, value) (CMP_RMW_CR1(base, CMP_CR1_PMODE_MASK, CMP_CR1_PMODE(value)))
2005 #define CMP_BWR_CR1_PMODE(base, value) (BME_BFI8(&CMP_CR1_REG(base), ((uint8_t)(value) << CMP_CR1_PMODE_SHIFT), CMP_CR1_PMODE_SHIFT, CMP_CR1_PMODE_WIDTH))
2006 /*@}*/
2007 
2008 /*!
2009  * @name Register CMP_CR1, field TRIGM[5] (RW)
2010  *
2011  * CMP and DAC are configured to CMP Trigger mode when CMP_CR1[TRIGM] is set to
2012  * 1. In addition, the CMP should be enabled. If the DAC is to be used as a
2013  * reference to the CMP, it should also be enabled. CMP Trigger mode depends on an
2014  * external timer resource to periodically enable the CMP and 6-bit DAC in order to
2015  * generate a triggered compare. Upon setting TRIGM, the CMP and DAC are placed
2016  * in a standby state until an external timer resource trigger is received. See
2017  * the chip configuration chapter for details about the external timer resource.
2018  *
2019  * Values:
2020  * - 0b0 - Trigger mode is disabled.
2021  * - 0b1 - Trigger mode is enabled.
2022  */
2023 /*@{*/
2024 /*! @brief Read current value of the CMP_CR1_TRIGM field. */
2025 #define CMP_RD_CR1_TRIGM(base) ((CMP_CR1_REG(base) & CMP_CR1_TRIGM_MASK) >> CMP_CR1_TRIGM_SHIFT)
2026 #define CMP_BRD_CR1_TRIGM(base) (BME_UBFX8(&CMP_CR1_REG(base), CMP_CR1_TRIGM_SHIFT, CMP_CR1_TRIGM_WIDTH))
2027 
2028 /*! @brief Set the TRIGM field to a new value. */
2029 #define CMP_WR_CR1_TRIGM(base, value) (CMP_RMW_CR1(base, CMP_CR1_TRIGM_MASK, CMP_CR1_TRIGM(value)))
2030 #define CMP_BWR_CR1_TRIGM(base, value) (BME_BFI8(&CMP_CR1_REG(base), ((uint8_t)(value) << CMP_CR1_TRIGM_SHIFT), CMP_CR1_TRIGM_SHIFT, CMP_CR1_TRIGM_WIDTH))
2031 /*@}*/
2032 
2033 /*!
2034  * @name Register CMP_CR1, field WE[6] (RW)
2035  *
2036  * At any given time, either SE or WE can be set. It is mandatory request to not
2037  * set SE and WE both at a given time.
2038  *
2039  * Values:
2040  * - 0b0 - Windowing mode is not selected.
2041  * - 0b1 - Windowing mode is selected.
2042  */
2043 /*@{*/
2044 /*! @brief Read current value of the CMP_CR1_WE field. */
2045 #define CMP_RD_CR1_WE(base) ((CMP_CR1_REG(base) & CMP_CR1_WE_MASK) >> CMP_CR1_WE_SHIFT)
2046 #define CMP_BRD_CR1_WE(base) (BME_UBFX8(&CMP_CR1_REG(base), CMP_CR1_WE_SHIFT, CMP_CR1_WE_WIDTH))
2047 
2048 /*! @brief Set the WE field to a new value. */
2049 #define CMP_WR_CR1_WE(base, value) (CMP_RMW_CR1(base, CMP_CR1_WE_MASK, CMP_CR1_WE(value)))
2050 #define CMP_BWR_CR1_WE(base, value) (BME_BFI8(&CMP_CR1_REG(base), ((uint8_t)(value) << CMP_CR1_WE_SHIFT), CMP_CR1_WE_SHIFT, CMP_CR1_WE_WIDTH))
2051 /*@}*/
2052 
2053 /*!
2054  * @name Register CMP_CR1, field SE[7] (RW)
2055  *
2056  * At any given time, either SE or WE can be set. It is mandatory request to not
2057  * set SE and WE both at a given time.
2058  *
2059  * Values:
2060  * - 0b0 - Sampling mode is not selected.
2061  * - 0b1 - Sampling mode is selected.
2062  */
2063 /*@{*/
2064 /*! @brief Read current value of the CMP_CR1_SE field. */
2065 #define CMP_RD_CR1_SE(base) ((CMP_CR1_REG(base) & CMP_CR1_SE_MASK) >> CMP_CR1_SE_SHIFT)
2066 #define CMP_BRD_CR1_SE(base) (BME_UBFX8(&CMP_CR1_REG(base), CMP_CR1_SE_SHIFT, CMP_CR1_SE_WIDTH))
2067 
2068 /*! @brief Set the SE field to a new value. */
2069 #define CMP_WR_CR1_SE(base, value) (CMP_RMW_CR1(base, CMP_CR1_SE_MASK, CMP_CR1_SE(value)))
2070 #define CMP_BWR_CR1_SE(base, value) (BME_BFI8(&CMP_CR1_REG(base), ((uint8_t)(value) << CMP_CR1_SE_SHIFT), CMP_CR1_SE_SHIFT, CMP_CR1_SE_WIDTH))
2071 /*@}*/
2072 
2073 /*******************************************************************************
2074  * CMP_FPR - CMP Filter Period Register
2075  ******************************************************************************/
2076 
2077 /*!
2078  * @brief CMP_FPR - CMP Filter Period Register (RW)
2079  *
2080  * Reset value: 0x00U
2081  */
2082 /*!
2083  * @name Constants and macros for entire CMP_FPR register
2084  */
2085 /*@{*/
2086 #define CMP_RD_FPR(base) (CMP_FPR_REG(base))
2087 #define CMP_WR_FPR(base, value) (CMP_FPR_REG(base) = (value))
2088 #define CMP_RMW_FPR(base, mask, value) (CMP_WR_FPR(base, (CMP_RD_FPR(base) & ~(mask)) | (value)))
2089 #define CMP_SET_FPR(base, value) (BME_OR8(&CMP_FPR_REG(base), (uint8_t)(value)))
2090 #define CMP_CLR_FPR(base, value) (BME_AND8(&CMP_FPR_REG(base), (uint8_t)(~(value))))
2091 #define CMP_TOG_FPR(base, value) (BME_XOR8(&CMP_FPR_REG(base), (uint8_t)(value)))
2092 /*@}*/
2093 
2094 /*******************************************************************************
2095  * CMP_SCR - CMP Status and Control Register
2096  ******************************************************************************/
2097 
2098 /*!
2099  * @brief CMP_SCR - CMP Status and Control Register (RW)
2100  *
2101  * Reset value: 0x00U
2102  */
2103 /*!
2104  * @name Constants and macros for entire CMP_SCR register
2105  */
2106 /*@{*/
2107 #define CMP_RD_SCR(base) (CMP_SCR_REG(base))
2108 #define CMP_WR_SCR(base, value) (CMP_SCR_REG(base) = (value))
2109 #define CMP_RMW_SCR(base, mask, value) (CMP_WR_SCR(base, (CMP_RD_SCR(base) & ~(mask)) | (value)))
2110 #define CMP_SET_SCR(base, value) (BME_OR8(&CMP_SCR_REG(base), (uint8_t)(value)))
2111 #define CMP_CLR_SCR(base, value) (BME_AND8(&CMP_SCR_REG(base), (uint8_t)(~(value))))
2112 #define CMP_TOG_SCR(base, value) (BME_XOR8(&CMP_SCR_REG(base), (uint8_t)(value)))
2113 /*@}*/
2114 
2115 /*
2116  * Constants & macros for individual CMP_SCR bitfields
2117  */
2118 
2119 /*!
2120  * @name Register CMP_SCR, field COUT[0] (RO)
2121  *
2122  * Returns the current value of the Analog Comparator output, when read. The
2123  * field is reset to 0 and will read as CR1[INV] when the Analog Comparator module
2124  * is disabled, that is, when CR1[EN] = 0. Writes to this field are ignored.
2125  */
2126 /*@{*/
2127 /*! @brief Read current value of the CMP_SCR_COUT field. */
2128 #define CMP_RD_SCR_COUT(base) ((CMP_SCR_REG(base) & CMP_SCR_COUT_MASK) >> CMP_SCR_COUT_SHIFT)
2129 #define CMP_BRD_SCR_COUT(base) (BME_UBFX8(&CMP_SCR_REG(base), CMP_SCR_COUT_SHIFT, CMP_SCR_COUT_WIDTH))
2130 /*@}*/
2131 
2132 /*!
2133  * @name Register CMP_SCR, field CFF[1] (W1C)
2134  *
2135  * Detects a falling-edge on COUT, when set, during normal operation. CFF is
2136  * cleared by writing 1 to it. During Stop modes, CFF is level senstive .
2137  *
2138  * Values:
2139  * - 0b0 - Falling-edge on COUT has not been detected.
2140  * - 0b1 - Falling-edge on COUT has occurred.
2141  */
2142 /*@{*/
2143 /*! @brief Read current value of the CMP_SCR_CFF field. */
2144 #define CMP_RD_SCR_CFF(base) ((CMP_SCR_REG(base) & CMP_SCR_CFF_MASK) >> CMP_SCR_CFF_SHIFT)
2145 #define CMP_BRD_SCR_CFF(base) (BME_UBFX8(&CMP_SCR_REG(base), CMP_SCR_CFF_SHIFT, CMP_SCR_CFF_WIDTH))
2146 
2147 /*! @brief Set the CFF field to a new value. */
2148 #define CMP_WR_SCR_CFF(base, value) (CMP_RMW_SCR(base, (CMP_SCR_CFF_MASK | CMP_SCR_CFR_MASK), CMP_SCR_CFF(value)))
2149 #define CMP_BWR_SCR_CFF(base, value) (BME_BFI8(&CMP_SCR_REG(base), ((uint8_t)(value) << CMP_SCR_CFF_SHIFT), CMP_SCR_CFF_SHIFT, CMP_SCR_CFF_WIDTH))
2150 /*@}*/
2151 
2152 /*!
2153  * @name Register CMP_SCR, field CFR[2] (W1C)
2154  *
2155  * Detects a rising-edge on COUT, when set, during normal operation. CFR is
2156  * cleared by writing 1 to it. During Stop modes, CFR is level sensitive .
2157  *
2158  * Values:
2159  * - 0b0 - Rising-edge on COUT has not been detected.
2160  * - 0b1 - Rising-edge on COUT has occurred.
2161  */
2162 /*@{*/
2163 /*! @brief Read current value of the CMP_SCR_CFR field. */
2164 #define CMP_RD_SCR_CFR(base) ((CMP_SCR_REG(base) & CMP_SCR_CFR_MASK) >> CMP_SCR_CFR_SHIFT)
2165 #define CMP_BRD_SCR_CFR(base) (BME_UBFX8(&CMP_SCR_REG(base), CMP_SCR_CFR_SHIFT, CMP_SCR_CFR_WIDTH))
2166 
2167 /*! @brief Set the CFR field to a new value. */
2168 #define CMP_WR_SCR_CFR(base, value) (CMP_RMW_SCR(base, (CMP_SCR_CFR_MASK | CMP_SCR_CFF_MASK), CMP_SCR_CFR(value)))
2169 #define CMP_BWR_SCR_CFR(base, value) (BME_BFI8(&CMP_SCR_REG(base), ((uint8_t)(value) << CMP_SCR_CFR_SHIFT), CMP_SCR_CFR_SHIFT, CMP_SCR_CFR_WIDTH))
2170 /*@}*/
2171 
2172 /*!
2173  * @name Register CMP_SCR, field IEF[3] (RW)
2174  *
2175  * Enables the CFF interrupt from the CMP. When this field is set, an interrupt
2176  * will be asserted when CFF is set.
2177  *
2178  * Values:
2179  * - 0b0 - Interrupt is disabled.
2180  * - 0b1 - Interrupt is enabled.
2181  */
2182 /*@{*/
2183 /*! @brief Read current value of the CMP_SCR_IEF field. */
2184 #define CMP_RD_SCR_IEF(base) ((CMP_SCR_REG(base) & CMP_SCR_IEF_MASK) >> CMP_SCR_IEF_SHIFT)
2185 #define CMP_BRD_SCR_IEF(base) (BME_UBFX8(&CMP_SCR_REG(base), CMP_SCR_IEF_SHIFT, CMP_SCR_IEF_WIDTH))
2186 
2187 /*! @brief Set the IEF field to a new value. */
2188 #define CMP_WR_SCR_IEF(base, value) (CMP_RMW_SCR(base, (CMP_SCR_IEF_MASK | CMP_SCR_CFF_MASK | CMP_SCR_CFR_MASK), CMP_SCR_IEF(value)))
2189 #define CMP_BWR_SCR_IEF(base, value) (BME_BFI8(&CMP_SCR_REG(base), ((uint8_t)(value) << CMP_SCR_IEF_SHIFT), CMP_SCR_IEF_SHIFT, CMP_SCR_IEF_WIDTH))
2190 /*@}*/
2191 
2192 /*!
2193  * @name Register CMP_SCR, field IER[4] (RW)
2194  *
2195  * Enables the CFR interrupt from the CMP. When this field is set, an interrupt
2196  * will be asserted when CFR is set.
2197  *
2198  * Values:
2199  * - 0b0 - Interrupt is disabled.
2200  * - 0b1 - Interrupt is enabled.
2201  */
2202 /*@{*/
2203 /*! @brief Read current value of the CMP_SCR_IER field. */
2204 #define CMP_RD_SCR_IER(base) ((CMP_SCR_REG(base) & CMP_SCR_IER_MASK) >> CMP_SCR_IER_SHIFT)
2205 #define CMP_BRD_SCR_IER(base) (BME_UBFX8(&CMP_SCR_REG(base), CMP_SCR_IER_SHIFT, CMP_SCR_IER_WIDTH))
2206 
2207 /*! @brief Set the IER field to a new value. */
2208 #define CMP_WR_SCR_IER(base, value) (CMP_RMW_SCR(base, (CMP_SCR_IER_MASK | CMP_SCR_CFF_MASK | CMP_SCR_CFR_MASK), CMP_SCR_IER(value)))
2209 #define CMP_BWR_SCR_IER(base, value) (BME_BFI8(&CMP_SCR_REG(base), ((uint8_t)(value) << CMP_SCR_IER_SHIFT), CMP_SCR_IER_SHIFT, CMP_SCR_IER_WIDTH))
2210 /*@}*/
2211 
2212 /*!
2213  * @name Register CMP_SCR, field DMAEN[6] (RW)
2214  *
2215  * Enables the DMA transfer triggered from the CMP module. When this field is
2216  * set, a DMA request is asserted when CFR or CFF is set.
2217  *
2218  * Values:
2219  * - 0b0 - DMA is disabled.
2220  * - 0b1 - DMA is enabled.
2221  */
2222 /*@{*/
2223 /*! @brief Read current value of the CMP_SCR_DMAEN field. */
2224 #define CMP_RD_SCR_DMAEN(base) ((CMP_SCR_REG(base) & CMP_SCR_DMAEN_MASK) >> CMP_SCR_DMAEN_SHIFT)
2225 #define CMP_BRD_SCR_DMAEN(base) (BME_UBFX8(&CMP_SCR_REG(base), CMP_SCR_DMAEN_SHIFT, CMP_SCR_DMAEN_WIDTH))
2226 
2227 /*! @brief Set the DMAEN field to a new value. */
2228 #define CMP_WR_SCR_DMAEN(base, value) (CMP_RMW_SCR(base, (CMP_SCR_DMAEN_MASK | CMP_SCR_CFF_MASK | CMP_SCR_CFR_MASK), CMP_SCR_DMAEN(value)))
2229 #define CMP_BWR_SCR_DMAEN(base, value) (BME_BFI8(&CMP_SCR_REG(base), ((uint8_t)(value) << CMP_SCR_DMAEN_SHIFT), CMP_SCR_DMAEN_SHIFT, CMP_SCR_DMAEN_WIDTH))
2230 /*@}*/
2231 
2232 /*******************************************************************************
2233  * CMP_DACCR - DAC Control Register
2234  ******************************************************************************/
2235 
2236 /*!
2237  * @brief CMP_DACCR - DAC Control Register (RW)
2238  *
2239  * Reset value: 0x00U
2240  */
2241 /*!
2242  * @name Constants and macros for entire CMP_DACCR register
2243  */
2244 /*@{*/
2245 #define CMP_RD_DACCR(base) (CMP_DACCR_REG(base))
2246 #define CMP_WR_DACCR(base, value) (CMP_DACCR_REG(base) = (value))
2247 #define CMP_RMW_DACCR(base, mask, value) (CMP_WR_DACCR(base, (CMP_RD_DACCR(base) & ~(mask)) | (value)))
2248 #define CMP_SET_DACCR(base, value) (BME_OR8(&CMP_DACCR_REG(base), (uint8_t)(value)))
2249 #define CMP_CLR_DACCR(base, value) (BME_AND8(&CMP_DACCR_REG(base), (uint8_t)(~(value))))
2250 #define CMP_TOG_DACCR(base, value) (BME_XOR8(&CMP_DACCR_REG(base), (uint8_t)(value)))
2251 /*@}*/
2252 
2253 /*
2254  * Constants & macros for individual CMP_DACCR bitfields
2255  */
2256 
2257 /*!
2258  * @name Register CMP_DACCR, field VOSEL[5:0] (RW)
2259  *
2260  * Selects an output voltage from one of 64 distinct levels. DACO = (V in /64) *
2261  * (VOSEL[5:0] + 1) , so the DACO range is from V in /64 to V in .
2262  */
2263 /*@{*/
2264 /*! @brief Read current value of the CMP_DACCR_VOSEL field. */
2265 #define CMP_RD_DACCR_VOSEL(base) ((CMP_DACCR_REG(base) & CMP_DACCR_VOSEL_MASK) >> CMP_DACCR_VOSEL_SHIFT)
2266 #define CMP_BRD_DACCR_VOSEL(base) (BME_UBFX8(&CMP_DACCR_REG(base), CMP_DACCR_VOSEL_SHIFT, CMP_DACCR_VOSEL_WIDTH))
2267 
2268 /*! @brief Set the VOSEL field to a new value. */
2269 #define CMP_WR_DACCR_VOSEL(base, value) (CMP_RMW_DACCR(base, CMP_DACCR_VOSEL_MASK, CMP_DACCR_VOSEL(value)))
2270 #define CMP_BWR_DACCR_VOSEL(base, value) (BME_BFI8(&CMP_DACCR_REG(base), ((uint8_t)(value) << CMP_DACCR_VOSEL_SHIFT), CMP_DACCR_VOSEL_SHIFT, CMP_DACCR_VOSEL_WIDTH))
2271 /*@}*/
2272 
2273 /*!
2274  * @name Register CMP_DACCR, field VRSEL[6] (RW)
2275  *
2276  * Values:
2277  * - 0b0 - V is selected as resistor ladder network supply reference V. in1 in
2278  * - 0b1 - V is selected as resistor ladder network supply reference V. in2 in
2279  */
2280 /*@{*/
2281 /*! @brief Read current value of the CMP_DACCR_VRSEL field. */
2282 #define CMP_RD_DACCR_VRSEL(base) ((CMP_DACCR_REG(base) & CMP_DACCR_VRSEL_MASK) >> CMP_DACCR_VRSEL_SHIFT)
2283 #define CMP_BRD_DACCR_VRSEL(base) (BME_UBFX8(&CMP_DACCR_REG(base), CMP_DACCR_VRSEL_SHIFT, CMP_DACCR_VRSEL_WIDTH))
2284 
2285 /*! @brief Set the VRSEL field to a new value. */
2286 #define CMP_WR_DACCR_VRSEL(base, value) (CMP_RMW_DACCR(base, CMP_DACCR_VRSEL_MASK, CMP_DACCR_VRSEL(value)))
2287 #define CMP_BWR_DACCR_VRSEL(base, value) (BME_BFI8(&CMP_DACCR_REG(base), ((uint8_t)(value) << CMP_DACCR_VRSEL_SHIFT), CMP_DACCR_VRSEL_SHIFT, CMP_DACCR_VRSEL_WIDTH))
2288 /*@}*/
2289 
2290 /*!
2291  * @name Register CMP_DACCR, field DACEN[7] (RW)
2292  *
2293  * Enables the DAC. When the DAC is disabled, it is powered down to conserve
2294  * power.
2295  *
2296  * Values:
2297  * - 0b0 - DAC is disabled.
2298  * - 0b1 - DAC is enabled.
2299  */
2300 /*@{*/
2301 /*! @brief Read current value of the CMP_DACCR_DACEN field. */
2302 #define CMP_RD_DACCR_DACEN(base) ((CMP_DACCR_REG(base) & CMP_DACCR_DACEN_MASK) >> CMP_DACCR_DACEN_SHIFT)
2303 #define CMP_BRD_DACCR_DACEN(base) (BME_UBFX8(&CMP_DACCR_REG(base), CMP_DACCR_DACEN_SHIFT, CMP_DACCR_DACEN_WIDTH))
2304 
2305 /*! @brief Set the DACEN field to a new value. */
2306 #define CMP_WR_DACCR_DACEN(base, value) (CMP_RMW_DACCR(base, CMP_DACCR_DACEN_MASK, CMP_DACCR_DACEN(value)))
2307 #define CMP_BWR_DACCR_DACEN(base, value) (BME_BFI8(&CMP_DACCR_REG(base), ((uint8_t)(value) << CMP_DACCR_DACEN_SHIFT), CMP_DACCR_DACEN_SHIFT, CMP_DACCR_DACEN_WIDTH))
2308 /*@}*/
2309 
2310 /*******************************************************************************
2311  * CMP_MUXCR - MUX Control Register
2312  ******************************************************************************/
2313 
2314 /*!
2315  * @brief CMP_MUXCR - MUX Control Register (RW)
2316  *
2317  * Reset value: 0x00U
2318  */
2319 /*!
2320  * @name Constants and macros for entire CMP_MUXCR register
2321  */
2322 /*@{*/
2323 #define CMP_RD_MUXCR(base) (CMP_MUXCR_REG(base))
2324 #define CMP_WR_MUXCR(base, value) (CMP_MUXCR_REG(base) = (value))
2325 #define CMP_RMW_MUXCR(base, mask, value) (CMP_WR_MUXCR(base, (CMP_RD_MUXCR(base) & ~(mask)) | (value)))
2326 #define CMP_SET_MUXCR(base, value) (BME_OR8(&CMP_MUXCR_REG(base), (uint8_t)(value)))
2327 #define CMP_CLR_MUXCR(base, value) (BME_AND8(&CMP_MUXCR_REG(base), (uint8_t)(~(value))))
2328 #define CMP_TOG_MUXCR(base, value) (BME_XOR8(&CMP_MUXCR_REG(base), (uint8_t)(value)))
2329 /*@}*/
2330 
2331 /*
2332  * Constants & macros for individual CMP_MUXCR bitfields
2333  */
2334 
2335 /*!
2336  * @name Register CMP_MUXCR, field MSEL[2:0] (RW)
2337  *
2338  * Determines which input is selected for the minus input of the comparator. For
2339  * INx inputs, see CMP, DAC, and ANMUX block diagrams. When an inappropriate
2340  * operation selects the same input for both muxes, the comparator automatically
2341  * shuts down to prevent itself from becoming a noise generator.
2342  *
2343  * Values:
2344  * - 0b000 - IN0
2345  * - 0b001 - IN1
2346  * - 0b010 - IN2
2347  * - 0b011 - IN3
2348  * - 0b100 - IN4
2349  * - 0b101 - IN5
2350  * - 0b110 - IN6
2351  * - 0b111 - IN7
2352  */
2353 /*@{*/
2354 /*! @brief Read current value of the CMP_MUXCR_MSEL field. */
2355 #define CMP_RD_MUXCR_MSEL(base) ((CMP_MUXCR_REG(base) & CMP_MUXCR_MSEL_MASK) >> CMP_MUXCR_MSEL_SHIFT)
2356 #define CMP_BRD_MUXCR_MSEL(base) (BME_UBFX8(&CMP_MUXCR_REG(base), CMP_MUXCR_MSEL_SHIFT, CMP_MUXCR_MSEL_WIDTH))
2357 
2358 /*! @brief Set the MSEL field to a new value. */
2359 #define CMP_WR_MUXCR_MSEL(base, value) (CMP_RMW_MUXCR(base, CMP_MUXCR_MSEL_MASK, CMP_MUXCR_MSEL(value)))
2360 #define CMP_BWR_MUXCR_MSEL(base, value) (BME_BFI8(&CMP_MUXCR_REG(base), ((uint8_t)(value) << CMP_MUXCR_MSEL_SHIFT), CMP_MUXCR_MSEL_SHIFT, CMP_MUXCR_MSEL_WIDTH))
2361 /*@}*/
2362 
2363 /*!
2364  * @name Register CMP_MUXCR, field PSEL[5:3] (RW)
2365  *
2366  * Determines which input is selected for the plus input of the comparator. For
2367  * INx inputs, see CMP, DAC, and ANMUX block diagrams. When an inappropriate
2368  * operation selects the same input for both muxes, the comparator automatically
2369  * shuts down to prevent itself from becoming a noise generator.
2370  *
2371  * Values:
2372  * - 0b000 - IN0
2373  * - 0b001 - IN1
2374  * - 0b010 - IN2
2375  * - 0b011 - IN3
2376  * - 0b100 - IN4
2377  * - 0b101 - IN5
2378  * - 0b110 - IN6
2379  * - 0b111 - IN7
2380  */
2381 /*@{*/
2382 /*! @brief Read current value of the CMP_MUXCR_PSEL field. */
2383 #define CMP_RD_MUXCR_PSEL(base) ((CMP_MUXCR_REG(base) & CMP_MUXCR_PSEL_MASK) >> CMP_MUXCR_PSEL_SHIFT)
2384 #define CMP_BRD_MUXCR_PSEL(base) (BME_UBFX8(&CMP_MUXCR_REG(base), CMP_MUXCR_PSEL_SHIFT, CMP_MUXCR_PSEL_WIDTH))
2385 
2386 /*! @brief Set the PSEL field to a new value. */
2387 #define CMP_WR_MUXCR_PSEL(base, value) (CMP_RMW_MUXCR(base, CMP_MUXCR_PSEL_MASK, CMP_MUXCR_PSEL(value)))
2388 #define CMP_BWR_MUXCR_PSEL(base, value) (BME_BFI8(&CMP_MUXCR_REG(base), ((uint8_t)(value) << CMP_MUXCR_PSEL_SHIFT), CMP_MUXCR_PSEL_SHIFT, CMP_MUXCR_PSEL_WIDTH))
2389 /*@}*/
2390 
2391 /*!
2392  * @name Register CMP_MUXCR, field PSTM[7] (RW)
2393  *
2394  * This bit is used to enable to MUX pass through mode. Pass through mode is
2395  * always available but for some devices this feature must be always disabled due to
2396  * the lack of package pins.
2397  *
2398  * Values:
2399  * - 0b0 - Pass Through Mode is disabled.
2400  * - 0b1 - Pass Through Mode is enabled.
2401  */
2402 /*@{*/
2403 /*! @brief Read current value of the CMP_MUXCR_PSTM field. */
2404 #define CMP_RD_MUXCR_PSTM(base) ((CMP_MUXCR_REG(base) & CMP_MUXCR_PSTM_MASK) >> CMP_MUXCR_PSTM_SHIFT)
2405 #define CMP_BRD_MUXCR_PSTM(base) (BME_UBFX8(&CMP_MUXCR_REG(base), CMP_MUXCR_PSTM_SHIFT, CMP_MUXCR_PSTM_WIDTH))
2406 
2407 /*! @brief Set the PSTM field to a new value. */
2408 #define CMP_WR_MUXCR_PSTM(base, value) (CMP_RMW_MUXCR(base, CMP_MUXCR_PSTM_MASK, CMP_MUXCR_PSTM(value)))
2409 #define CMP_BWR_MUXCR_PSTM(base, value) (BME_BFI8(&CMP_MUXCR_REG(base), ((uint8_t)(value) << CMP_MUXCR_PSTM_SHIFT), CMP_MUXCR_PSTM_SHIFT, CMP_MUXCR_PSTM_WIDTH))
2410 /*@}*/
2411 
2412 /*
2413  * MKL25Z4 DAC
2414  *
2415  * 12-Bit Digital-to-Analog Converter
2416  *
2417  * Registers defined in this header file:
2418  * - DAC_DATL - DAC Data Low Register
2419  * - DAC_DATH - DAC Data High Register
2420  * - DAC_SR - DAC Status Register
2421  * - DAC_C0 - DAC Control Register
2422  * - DAC_C1 - DAC Control Register 1
2423  * - DAC_C2 - DAC Control Register 2
2424  */
2425 
2426 #define DAC_INSTANCE_COUNT (1U) /*!< Number of instances of the DAC module. */
2427 #define DAC0_IDX (0U) /*!< Instance number for DAC0. */
2428 
2429 /*******************************************************************************
2430  * DAC_DATL - DAC Data Low Register
2431  ******************************************************************************/
2432 
2433 /*!
2434  * @brief DAC_DATL - DAC Data Low Register (RW)
2435  *
2436  * Reset value: 0x00U
2437  */
2438 /*!
2439  * @name Constants and macros for entire DAC_DATL register
2440  */
2441 /*@{*/
2442 #define DAC_RD_DATL(base, index) (DAC_DATL_REG(base, index))
2443 #define DAC_WR_DATL(base, index, value) (DAC_DATL_REG(base, index) = (value))
2444 #define DAC_RMW_DATL(base, index, mask, value) (DAC_WR_DATL(base, index, (DAC_RD_DATL(base, index) & ~(mask)) | (value)))
2445 #define DAC_SET_DATL(base, index, value) (BME_OR8(&DAC_DATL_REG(base, index), (uint8_t)(value)))
2446 #define DAC_CLR_DATL(base, index, value) (BME_AND8(&DAC_DATL_REG(base, index), (uint8_t)(~(value))))
2447 #define DAC_TOG_DATL(base, index, value) (BME_XOR8(&DAC_DATL_REG(base, index), (uint8_t)(value)))
2448 /*@}*/
2449 
2450 /*******************************************************************************
2451  * DAC_DATH - DAC Data High Register
2452  ******************************************************************************/
2453 
2454 /*!
2455  * @brief DAC_DATH - DAC Data High Register (RW)
2456  *
2457  * Reset value: 0x00U
2458  */
2459 /*!
2460  * @name Constants and macros for entire DAC_DATH register
2461  */
2462 /*@{*/
2463 #define DAC_RD_DATH(base, index) (DAC_DATH_REG(base, index))
2464 #define DAC_WR_DATH(base, index, value) (DAC_DATH_REG(base, index) = (value))
2465 #define DAC_RMW_DATH(base, index, mask, value) (DAC_WR_DATH(base, index, (DAC_RD_DATH(base, index) & ~(mask)) | (value)))
2466 #define DAC_SET_DATH(base, index, value) (BME_OR8(&DAC_DATH_REG(base, index), (uint8_t)(value)))
2467 #define DAC_CLR_DATH(base, index, value) (BME_AND8(&DAC_DATH_REG(base, index), (uint8_t)(~(value))))
2468 #define DAC_TOG_DATH(base, index, value) (BME_XOR8(&DAC_DATH_REG(base, index), (uint8_t)(value)))
2469 /*@}*/
2470 
2471 /*
2472  * Constants & macros for individual DAC_DATH bitfields
2473  */
2474 
2475 /*!
2476  * @name Register DAC_DATH, field DATA1[3:0] (RW)
2477  *
2478  * When the DAC Buffer is not enabled, DATA[11:0] controls the output voltage
2479  * based on the following formula. V out = V in * (1 + DACDAT0[11:0])/4096 When the
2480  * DAC buffer is enabled, DATA[11:0] is mapped to the 16-word buffer.
2481  */
2482 /*@{*/
2483 /*! @brief Read current value of the DAC_DATH_DATA1 field. */
2484 #define DAC_RD_DATH_DATA1(base, index) ((DAC_DATH_REG(base, index) & DAC_DATH_DATA1_MASK) >> DAC_DATH_DATA1_SHIFT)
2485 #define DAC_BRD_DATH_DATA1(base, index) (BME_UBFX8(&DAC_DATH_REG(base, index), DAC_DATH_DATA1_SHIFT, DAC_DATH_DATA1_WIDTH))
2486 
2487 /*! @brief Set the DATA1 field to a new value. */
2488 #define DAC_WR_DATH_DATA1(base, index, value) (DAC_RMW_DATH(base, index, DAC_DATH_DATA1_MASK, DAC_DATH_DATA1(value)))
2489 #define DAC_BWR_DATH_DATA1(base, index, value) (BME_BFI8(&DAC_DATH_REG(base, index), ((uint8_t)(value) << DAC_DATH_DATA1_SHIFT), DAC_DATH_DATA1_SHIFT, DAC_DATH_DATA1_WIDTH))
2490 /*@}*/
2491 
2492 /*******************************************************************************
2493  * DAC_SR - DAC Status Register
2494  ******************************************************************************/
2495 
2496 /*!
2497  * @brief DAC_SR - DAC Status Register (RW)
2498  *
2499  * Reset value: 0x02U
2500  *
2501  * If DMA is enabled, the flags can be cleared automatically by DMA when the DMA
2502  * request is done. Writing 0 to a field clears it whereas writing 1 has no
2503  * effect. After reset, DACBFRPTF is set and can be cleared by software, if needed.
2504  * The flags are set only when the data buffer status is changed. Do not use
2505  * 32/16-bit accesses to this register.
2506  */
2507 /*!
2508  * @name Constants and macros for entire DAC_SR register
2509  */
2510 /*@{*/
2511 #define DAC_RD_SR(base) (DAC_SR_REG(base))
2512 #define DAC_WR_SR(base, value) (DAC_SR_REG(base) = (value))
2513 #define DAC_RMW_SR(base, mask, value) (DAC_WR_SR(base, (DAC_RD_SR(base) & ~(mask)) | (value)))
2514 #define DAC_SET_SR(base, value) (BME_OR8(&DAC_SR_REG(base), (uint8_t)(value)))
2515 #define DAC_CLR_SR(base, value) (BME_AND8(&DAC_SR_REG(base), (uint8_t)(~(value))))
2516 #define DAC_TOG_SR(base, value) (BME_XOR8(&DAC_SR_REG(base), (uint8_t)(value)))
2517 /*@}*/
2518 
2519 /*
2520  * Constants & macros for individual DAC_SR bitfields
2521  */
2522 
2523 /*!
2524  * @name Register DAC_SR, field DACBFRPBF[0] (RW)
2525  *
2526  * Values:
2527  * - 0b0 - The DAC buffer read pointer is not equal to C2[DACBFUP].
2528  * - 0b1 - The DAC buffer read pointer is equal to C2[DACBFUP].
2529  */
2530 /*@{*/
2531 /*! @brief Read current value of the DAC_SR_DACBFRPBF field. */
2532 #define DAC_RD_SR_DACBFRPBF(base) ((DAC_SR_REG(base) & DAC_SR_DACBFRPBF_MASK) >> DAC_SR_DACBFRPBF_SHIFT)
2533 #define DAC_BRD_SR_DACBFRPBF(base) (BME_UBFX8(&DAC_SR_REG(base), DAC_SR_DACBFRPBF_SHIFT, DAC_SR_DACBFRPBF_WIDTH))
2534 
2535 /*! @brief Set the DACBFRPBF field to a new value. */
2536 #define DAC_WR_SR_DACBFRPBF(base, value) (DAC_RMW_SR(base, DAC_SR_DACBFRPBF_MASK, DAC_SR_DACBFRPBF(value)))
2537 #define DAC_BWR_SR_DACBFRPBF(base, value) (BME_BFI8(&DAC_SR_REG(base), ((uint8_t)(value) << DAC_SR_DACBFRPBF_SHIFT), DAC_SR_DACBFRPBF_SHIFT, DAC_SR_DACBFRPBF_WIDTH))
2538 /*@}*/
2539 
2540 /*!
2541  * @name Register DAC_SR, field DACBFRPTF[1] (RW)
2542  *
2543  * Values:
2544  * - 0b0 - The DAC buffer read pointer is not zero.
2545  * - 0b1 - The DAC buffer read pointer is zero.
2546  */
2547 /*@{*/
2548 /*! @brief Read current value of the DAC_SR_DACBFRPTF field. */
2549 #define DAC_RD_SR_DACBFRPTF(base) ((DAC_SR_REG(base) & DAC_SR_DACBFRPTF_MASK) >> DAC_SR_DACBFRPTF_SHIFT)
2550 #define DAC_BRD_SR_DACBFRPTF(base) (BME_UBFX8(&DAC_SR_REG(base), DAC_SR_DACBFRPTF_SHIFT, DAC_SR_DACBFRPTF_WIDTH))
2551 
2552 /*! @brief Set the DACBFRPTF field to a new value. */
2553 #define DAC_WR_SR_DACBFRPTF(base, value) (DAC_RMW_SR(base, DAC_SR_DACBFRPTF_MASK, DAC_SR_DACBFRPTF(value)))
2554 #define DAC_BWR_SR_DACBFRPTF(base, value) (BME_BFI8(&DAC_SR_REG(base), ((uint8_t)(value) << DAC_SR_DACBFRPTF_SHIFT), DAC_SR_DACBFRPTF_SHIFT, DAC_SR_DACBFRPTF_WIDTH))
2555 /*@}*/
2556 
2557 /*******************************************************************************
2558  * DAC_C0 - DAC Control Register
2559  ******************************************************************************/
2560 
2561 /*!
2562  * @brief DAC_C0 - DAC Control Register (RW)
2563  *
2564  * Reset value: 0x00U
2565  *
2566  * Do not use 32- or 16-bit accesses to this register.
2567  */
2568 /*!
2569  * @name Constants and macros for entire DAC_C0 register
2570  */
2571 /*@{*/
2572 #define DAC_RD_C0(base) (DAC_C0_REG(base))
2573 #define DAC_WR_C0(base, value) (DAC_C0_REG(base) = (value))
2574 #define DAC_RMW_C0(base, mask, value) (DAC_WR_C0(base, (DAC_RD_C0(base) & ~(mask)) | (value)))
2575 #define DAC_SET_C0(base, value) (BME_OR8(&DAC_C0_REG(base), (uint8_t)(value)))
2576 #define DAC_CLR_C0(base, value) (BME_AND8(&DAC_C0_REG(base), (uint8_t)(~(value))))
2577 #define DAC_TOG_C0(base, value) (BME_XOR8(&DAC_C0_REG(base), (uint8_t)(value)))
2578 /*@}*/
2579 
2580 /*
2581  * Constants & macros for individual DAC_C0 bitfields
2582  */
2583 
2584 /*!
2585  * @name Register DAC_C0, field DACBBIEN[0] (RW)
2586  *
2587  * Values:
2588  * - 0b0 - The DAC buffer read pointer bottom flag interrupt is disabled.
2589  * - 0b1 - The DAC buffer read pointer bottom flag interrupt is enabled.
2590  */
2591 /*@{*/
2592 /*! @brief Read current value of the DAC_C0_DACBBIEN field. */
2593 #define DAC_RD_C0_DACBBIEN(base) ((DAC_C0_REG(base) & DAC_C0_DACBBIEN_MASK) >> DAC_C0_DACBBIEN_SHIFT)
2594 #define DAC_BRD_C0_DACBBIEN(base) (BME_UBFX8(&DAC_C0_REG(base), DAC_C0_DACBBIEN_SHIFT, DAC_C0_DACBBIEN_WIDTH))
2595 
2596 /*! @brief Set the DACBBIEN field to a new value. */
2597 #define DAC_WR_C0_DACBBIEN(base, value) (DAC_RMW_C0(base, DAC_C0_DACBBIEN_MASK, DAC_C0_DACBBIEN(value)))
2598 #define DAC_BWR_C0_DACBBIEN(base, value) (BME_BFI8(&DAC_C0_REG(base), ((uint8_t)(value) << DAC_C0_DACBBIEN_SHIFT), DAC_C0_DACBBIEN_SHIFT, DAC_C0_DACBBIEN_WIDTH))
2599 /*@}*/
2600 
2601 /*!
2602  * @name Register DAC_C0, field DACBTIEN[1] (RW)
2603  *
2604  * Values:
2605  * - 0b0 - The DAC buffer read pointer top flag interrupt is disabled.
2606  * - 0b1 - The DAC buffer read pointer top flag interrupt is enabled.
2607  */
2608 /*@{*/
2609 /*! @brief Read current value of the DAC_C0_DACBTIEN field. */
2610 #define DAC_RD_C0_DACBTIEN(base) ((DAC_C0_REG(base) & DAC_C0_DACBTIEN_MASK) >> DAC_C0_DACBTIEN_SHIFT)
2611 #define DAC_BRD_C0_DACBTIEN(base) (BME_UBFX8(&DAC_C0_REG(base), DAC_C0_DACBTIEN_SHIFT, DAC_C0_DACBTIEN_WIDTH))
2612 
2613 /*! @brief Set the DACBTIEN field to a new value. */
2614 #define DAC_WR_C0_DACBTIEN(base, value) (DAC_RMW_C0(base, DAC_C0_DACBTIEN_MASK, DAC_C0_DACBTIEN(value)))
2615 #define DAC_BWR_C0_DACBTIEN(base, value) (BME_BFI8(&DAC_C0_REG(base), ((uint8_t)(value) << DAC_C0_DACBTIEN_SHIFT), DAC_C0_DACBTIEN_SHIFT, DAC_C0_DACBTIEN_WIDTH))
2616 /*@}*/
2617 
2618 /*!
2619  * @name Register DAC_C0, field LPEN[3] (RW)
2620  *
2621  * See the 12-bit DAC electrical characteristics of the device data sheet for
2622  * details on the impact of the modes below.
2623  *
2624  * Values:
2625  * - 0b0 - High-Power mode
2626  * - 0b1 - Low-Power mode
2627  */
2628 /*@{*/
2629 /*! @brief Read current value of the DAC_C0_LPEN field. */
2630 #define DAC_RD_C0_LPEN(base) ((DAC_C0_REG(base) & DAC_C0_LPEN_MASK) >> DAC_C0_LPEN_SHIFT)
2631 #define DAC_BRD_C0_LPEN(base) (BME_UBFX8(&DAC_C0_REG(base), DAC_C0_LPEN_SHIFT, DAC_C0_LPEN_WIDTH))
2632 
2633 /*! @brief Set the LPEN field to a new value. */
2634 #define DAC_WR_C0_LPEN(base, value) (DAC_RMW_C0(base, DAC_C0_LPEN_MASK, DAC_C0_LPEN(value)))
2635 #define DAC_BWR_C0_LPEN(base, value) (BME_BFI8(&DAC_C0_REG(base), ((uint8_t)(value) << DAC_C0_LPEN_SHIFT), DAC_C0_LPEN_SHIFT, DAC_C0_LPEN_WIDTH))
2636 /*@}*/
2637 
2638 /*!
2639  * @name Register DAC_C0, field DACSWTRG[4] (WORZ)
2640  *
2641  * Active high. This is a write-only field, which always reads 0. If DAC
2642  * software trigger is selected and buffer is enabled, writing 1 to this field will
2643  * advance the buffer read pointer once.
2644  *
2645  * Values:
2646  * - 0b0 - The DAC soft trigger is not valid.
2647  * - 0b1 - The DAC soft trigger is valid.
2648  */
2649 /*@{*/
2650 /*! @brief Set the DACSWTRG field to a new value. */
2651 #define DAC_WR_C0_DACSWTRG(base, value) (DAC_RMW_C0(base, DAC_C0_DACSWTRG_MASK, DAC_C0_DACSWTRG(value)))
2652 #define DAC_BWR_C0_DACSWTRG(base, value) (BME_BFI8(&DAC_C0_REG(base), ((uint8_t)(value) << DAC_C0_DACSWTRG_SHIFT), DAC_C0_DACSWTRG_SHIFT, DAC_C0_DACSWTRG_WIDTH))
2653 /*@}*/
2654 
2655 /*!
2656  * @name Register DAC_C0, field DACTRGSEL[5] (RW)
2657  *
2658  * Values:
2659  * - 0b0 - The DAC hardware trigger is selected.
2660  * - 0b1 - The DAC software trigger is selected.
2661  */
2662 /*@{*/
2663 /*! @brief Read current value of the DAC_C0_DACTRGSEL field. */
2664 #define DAC_RD_C0_DACTRGSEL(base) ((DAC_C0_REG(base) & DAC_C0_DACTRGSEL_MASK) >> DAC_C0_DACTRGSEL_SHIFT)
2665 #define DAC_BRD_C0_DACTRGSEL(base) (BME_UBFX8(&DAC_C0_REG(base), DAC_C0_DACTRGSEL_SHIFT, DAC_C0_DACTRGSEL_WIDTH))
2666 
2667 /*! @brief Set the DACTRGSEL field to a new value. */
2668 #define DAC_WR_C0_DACTRGSEL(base, value) (DAC_RMW_C0(base, DAC_C0_DACTRGSEL_MASK, DAC_C0_DACTRGSEL(value)))
2669 #define DAC_BWR_C0_DACTRGSEL(base, value) (BME_BFI8(&DAC_C0_REG(base), ((uint8_t)(value) << DAC_C0_DACTRGSEL_SHIFT), DAC_C0_DACTRGSEL_SHIFT, DAC_C0_DACTRGSEL_WIDTH))
2670 /*@}*/
2671 
2672 /*!
2673  * @name Register DAC_C0, field DACRFS[6] (RW)
2674  *
2675  * Values:
2676  * - 0b0 - The DAC selects DACREF_1 as the reference voltage.
2677  * - 0b1 - The DAC selects DACREF_2 as the reference voltage.
2678  */
2679 /*@{*/
2680 /*! @brief Read current value of the DAC_C0_DACRFS field. */
2681 #define DAC_RD_C0_DACRFS(base) ((DAC_C0_REG(base) & DAC_C0_DACRFS_MASK) >> DAC_C0_DACRFS_SHIFT)
2682 #define DAC_BRD_C0_DACRFS(base) (BME_UBFX8(&DAC_C0_REG(base), DAC_C0_DACRFS_SHIFT, DAC_C0_DACRFS_WIDTH))
2683 
2684 /*! @brief Set the DACRFS field to a new value. */
2685 #define DAC_WR_C0_DACRFS(base, value) (DAC_RMW_C0(base, DAC_C0_DACRFS_MASK, DAC_C0_DACRFS(value)))
2686 #define DAC_BWR_C0_DACRFS(base, value) (BME_BFI8(&DAC_C0_REG(base), ((uint8_t)(value) << DAC_C0_DACRFS_SHIFT), DAC_C0_DACRFS_SHIFT, DAC_C0_DACRFS_WIDTH))
2687 /*@}*/
2688 
2689 /*!
2690  * @name Register DAC_C0, field DACEN[7] (RW)
2691  *
2692  * Starts the Programmable Reference Generator operation.
2693  *
2694  * Values:
2695  * - 0b0 - The DAC system is disabled.
2696  * - 0b1 - The DAC system is enabled.
2697  */
2698 /*@{*/
2699 /*! @brief Read current value of the DAC_C0_DACEN field. */
2700 #define DAC_RD_C0_DACEN(base) ((DAC_C0_REG(base) & DAC_C0_DACEN_MASK) >> DAC_C0_DACEN_SHIFT)
2701 #define DAC_BRD_C0_DACEN(base) (BME_UBFX8(&DAC_C0_REG(base), DAC_C0_DACEN_SHIFT, DAC_C0_DACEN_WIDTH))
2702 
2703 /*! @brief Set the DACEN field to a new value. */
2704 #define DAC_WR_C0_DACEN(base, value) (DAC_RMW_C0(base, DAC_C0_DACEN_MASK, DAC_C0_DACEN(value)))
2705 #define DAC_BWR_C0_DACEN(base, value) (BME_BFI8(&DAC_C0_REG(base), ((uint8_t)(value) << DAC_C0_DACEN_SHIFT), DAC_C0_DACEN_SHIFT, DAC_C0_DACEN_WIDTH))
2706 /*@}*/
2707 
2708 /*******************************************************************************
2709  * DAC_C1 - DAC Control Register 1
2710  ******************************************************************************/
2711 
2712 /*!
2713  * @brief DAC_C1 - DAC Control Register 1 (RW)
2714  *
2715  * Reset value: 0x00U
2716  *
2717  * Do not use 32- or 16-bit accesses to this register.
2718  */
2719 /*!
2720  * @name Constants and macros for entire DAC_C1 register
2721  */
2722 /*@{*/
2723 #define DAC_RD_C1(base) (DAC_C1_REG(base))
2724 #define DAC_WR_C1(base, value) (DAC_C1_REG(base) = (value))
2725 #define DAC_RMW_C1(base, mask, value) (DAC_WR_C1(base, (DAC_RD_C1(base) & ~(mask)) | (value)))
2726 #define DAC_SET_C1(base, value) (BME_OR8(&DAC_C1_REG(base), (uint8_t)(value)))
2727 #define DAC_CLR_C1(base, value) (BME_AND8(&DAC_C1_REG(base), (uint8_t)(~(value))))
2728 #define DAC_TOG_C1(base, value) (BME_XOR8(&DAC_C1_REG(base), (uint8_t)(value)))
2729 /*@}*/
2730 
2731 /*
2732  * Constants & macros for individual DAC_C1 bitfields
2733  */
2734 
2735 /*!
2736  * @name Register DAC_C1, field DACBFEN[0] (RW)
2737  *
2738  * Values:
2739  * - 0b0 - Buffer read pointer is disabled. The converted data is always the
2740  * first word of the buffer.
2741  * - 0b1 - Buffer read pointer is enabled. The converted data is the word that
2742  * the read pointer points to. It means converted data can be from any word of
2743  * the buffer.
2744  */
2745 /*@{*/
2746 /*! @brief Read current value of the DAC_C1_DACBFEN field. */
2747 #define DAC_RD_C1_DACBFEN(base) ((DAC_C1_REG(base) & DAC_C1_DACBFEN_MASK) >> DAC_C1_DACBFEN_SHIFT)
2748 #define DAC_BRD_C1_DACBFEN(base) (BME_UBFX8(&DAC_C1_REG(base), DAC_C1_DACBFEN_SHIFT, DAC_C1_DACBFEN_WIDTH))
2749 
2750 /*! @brief Set the DACBFEN field to a new value. */
2751 #define DAC_WR_C1_DACBFEN(base, value) (DAC_RMW_C1(base, DAC_C1_DACBFEN_MASK, DAC_C1_DACBFEN(value)))
2752 #define DAC_BWR_C1_DACBFEN(base, value) (BME_BFI8(&DAC_C1_REG(base), ((uint8_t)(value) << DAC_C1_DACBFEN_SHIFT), DAC_C1_DACBFEN_SHIFT, DAC_C1_DACBFEN_WIDTH))
2753 /*@}*/
2754 
2755 /*!
2756  * @name Register DAC_C1, field DACBFMD[2] (RW)
2757  *
2758  * Values:
2759  * - 0b0 - Normal mode
2760  * - 0b1 - One-Time Scan mode
2761  */
2762 /*@{*/
2763 /*! @brief Read current value of the DAC_C1_DACBFMD field. */
2764 #define DAC_RD_C1_DACBFMD(base) ((DAC_C1_REG(base) & DAC_C1_DACBFMD_MASK) >> DAC_C1_DACBFMD_SHIFT)
2765 #define DAC_BRD_C1_DACBFMD(base) (BME_UBFX8(&DAC_C1_REG(base), DAC_C1_DACBFMD_SHIFT, DAC_C1_DACBFMD_WIDTH))
2766 
2767 /*! @brief Set the DACBFMD field to a new value. */
2768 #define DAC_WR_C1_DACBFMD(base, value) (DAC_RMW_C1(base, DAC_C1_DACBFMD_MASK, DAC_C1_DACBFMD(value)))
2769 #define DAC_BWR_C1_DACBFMD(base, value) (BME_BFI8(&DAC_C1_REG(base), ((uint8_t)(value) << DAC_C1_DACBFMD_SHIFT), DAC_C1_DACBFMD_SHIFT, DAC_C1_DACBFMD_WIDTH))
2770 /*@}*/
2771 
2772 /*!
2773  * @name Register DAC_C1, field DMAEN[7] (RW)
2774  *
2775  * Values:
2776  * - 0b0 - DMA is disabled.
2777  * - 0b1 - DMA is enabled. When DMA is enabled, the DMA request will be
2778  * generated by original interrupts. The interrupts will not be presented on this
2779  * module at the same time.
2780  */
2781 /*@{*/
2782 /*! @brief Read current value of the DAC_C1_DMAEN field. */
2783 #define DAC_RD_C1_DMAEN(base) ((DAC_C1_REG(base) & DAC_C1_DMAEN_MASK) >> DAC_C1_DMAEN_SHIFT)
2784 #define DAC_BRD_C1_DMAEN(base) (BME_UBFX8(&DAC_C1_REG(base), DAC_C1_DMAEN_SHIFT, DAC_C1_DMAEN_WIDTH))
2785 
2786 /*! @brief Set the DMAEN field to a new value. */
2787 #define DAC_WR_C1_DMAEN(base, value) (DAC_RMW_C1(base, DAC_C1_DMAEN_MASK, DAC_C1_DMAEN(value)))
2788 #define DAC_BWR_C1_DMAEN(base, value) (BME_BFI8(&DAC_C1_REG(base), ((uint8_t)(value) << DAC_C1_DMAEN_SHIFT), DAC_C1_DMAEN_SHIFT, DAC_C1_DMAEN_WIDTH))
2789 /*@}*/
2790 
2791 /*******************************************************************************
2792  * DAC_C2 - DAC Control Register 2
2793  ******************************************************************************/
2794 
2795 /*!
2796  * @brief DAC_C2 - DAC Control Register 2 (RW)
2797  *
2798  * Reset value: 0x01U
2799  *
2800  * Do not use 32- or 16-bit accesses to this register.
2801  */
2802 /*!
2803  * @name Constants and macros for entire DAC_C2 register
2804  */
2805 /*@{*/
2806 #define DAC_RD_C2(base) (DAC_C2_REG(base))
2807 #define DAC_WR_C2(base, value) (DAC_C2_REG(base) = (value))
2808 #define DAC_RMW_C2(base, mask, value) (DAC_WR_C2(base, (DAC_RD_C2(base) & ~(mask)) | (value)))
2809 #define DAC_SET_C2(base, value) (BME_OR8(&DAC_C2_REG(base), (uint8_t)(value)))
2810 #define DAC_CLR_C2(base, value) (BME_AND8(&DAC_C2_REG(base), (uint8_t)(~(value))))
2811 #define DAC_TOG_C2(base, value) (BME_XOR8(&DAC_C2_REG(base), (uint8_t)(value)))
2812 /*@}*/
2813 
2814 /*
2815  * Constants & macros for individual DAC_C2 bitfields
2816  */
2817 
2818 /*!
2819  * @name Register DAC_C2, field DACBFUP[0] (RW)
2820  *
2821  * Selects the upper limit of the DAC buffer. The buffer read pointer cannot
2822  * exceed it.
2823  */
2824 /*@{*/
2825 /*! @brief Read current value of the DAC_C2_DACBFUP field. */
2826 #define DAC_RD_C2_DACBFUP(base) ((DAC_C2_REG(base) & DAC_C2_DACBFUP_MASK) >> DAC_C2_DACBFUP_SHIFT)
2827 #define DAC_BRD_C2_DACBFUP(base) (BME_UBFX8(&DAC_C2_REG(base), DAC_C2_DACBFUP_SHIFT, DAC_C2_DACBFUP_WIDTH))
2828 
2829 /*! @brief Set the DACBFUP field to a new value. */
2830 #define DAC_WR_C2_DACBFUP(base, value) (DAC_RMW_C2(base, DAC_C2_DACBFUP_MASK, DAC_C2_DACBFUP(value)))
2831 #define DAC_BWR_C2_DACBFUP(base, value) (BME_BFI8(&DAC_C2_REG(base), ((uint8_t)(value) << DAC_C2_DACBFUP_SHIFT), DAC_C2_DACBFUP_SHIFT, DAC_C2_DACBFUP_WIDTH))
2832 /*@}*/
2833 
2834 /*!
2835  * @name Register DAC_C2, field DACBFRP[4] (RW)
2836  *
2837  * Keeps the current value of the buffer read pointer.
2838  */
2839 /*@{*/
2840 /*! @brief Read current value of the DAC_C2_DACBFRP field. */
2841 #define DAC_RD_C2_DACBFRP(base) ((DAC_C2_REG(base) & DAC_C2_DACBFRP_MASK) >> DAC_C2_DACBFRP_SHIFT)
2842 #define DAC_BRD_C2_DACBFRP(base) (BME_UBFX8(&DAC_C2_REG(base), DAC_C2_DACBFRP_SHIFT, DAC_C2_DACBFRP_WIDTH))
2843 
2844 /*! @brief Set the DACBFRP field to a new value. */
2845 #define DAC_WR_C2_DACBFRP(base, value) (DAC_RMW_C2(base, DAC_C2_DACBFRP_MASK, DAC_C2_DACBFRP(value)))
2846 #define DAC_BWR_C2_DACBFRP(base, value) (BME_BFI8(&DAC_C2_REG(base), ((uint8_t)(value) << DAC_C2_DACBFRP_SHIFT), DAC_C2_DACBFRP_SHIFT, DAC_C2_DACBFRP_WIDTH))
2847 /*@}*/
2848 
2849 /*
2850  * MKL25Z4 DMA
2851  *
2852  * DMA Controller
2853  *
2854  * Registers defined in this header file:
2855  * - DMA_SAR - Source Address Register
2856  * - DMA_DAR - Destination Address Register
2857  * - DMA_DSR - DMA_DSR0 register.
2858  * - DMA_DSR_BCR - DMA Status Register / Byte Count Register
2859  * - DMA_DCR - DMA Control Register
2860  */
2861 
2862 #define DMA_INSTANCE_COUNT (1U) /*!< Number of instances of the DMA module. */
2863 #define DMA_IDX (0U) /*!< Instance number for DMA. */
2864 
2865 /*******************************************************************************
2866  * DMA_SAR - Source Address Register
2867  ******************************************************************************/
2868 
2869 /*!
2870  * @brief DMA_SAR - Source Address Register (RW)
2871  *
2872  * Reset value: 0x00000000U
2873  *
2874  * For this register: Only 32-bit writes are allowed. 16-bit and 8-bit writes
2875  * result in a bus error. Only four values are allowed to be written to bits 31-20
2876  * of this register. A write of any other value to these bits causes a
2877  * configuration error when the channel starts to execute. For more information about the
2878  * configuration error, see the description of the CEConfiguration error field of
2879  * DSR.
2880  */
2881 /*!
2882  * @name Constants and macros for entire DMA_SAR register
2883  */
2884 /*@{*/
2885 #define DMA_RD_SAR(base, index) (DMA_SAR_REG(base, index))
2886 #define DMA_WR_SAR(base, index, value) (DMA_SAR_REG(base, index) = (value))
2887 #define DMA_RMW_SAR(base, index, mask, value) (DMA_WR_SAR(base, index, (DMA_RD_SAR(base, index) & ~(mask)) | (value)))
2888 #define DMA_SET_SAR(base, index, value) (BME_OR32(&DMA_SAR_REG(base, index), (uint32_t)(value)))
2889 #define DMA_CLR_SAR(base, index, value) (BME_AND32(&DMA_SAR_REG(base, index), (uint32_t)(~(value))))
2890 #define DMA_TOG_SAR(base, index, value) (BME_XOR32(&DMA_SAR_REG(base, index), (uint32_t)(value)))
2891 /*@}*/
2892 
2893 /*******************************************************************************
2894  * DMA_DAR - Destination Address Register
2895  ******************************************************************************/
2896 
2897 /*!
2898  * @brief DMA_DAR - Destination Address Register (RW)
2899  *
2900  * Reset value: 0x00000000U
2901  *
2902  * For this register: Only 32-bit writes are allowed. 16-bit and 8-bit writes
2903  * result in a bus error. Only four values are allowed to be written to bits 31-20
2904  * of this register. A write of any other value to these bits causes a
2905  * configuration error when the channel starts to execute. For more information about the
2906  * configuration error, see the description of the CEConfiguration error field of
2907  * DSR.
2908  */
2909 /*!
2910  * @name Constants and macros for entire DMA_DAR register
2911  */
2912 /*@{*/
2913 #define DMA_RD_DAR(base, index) (DMA_DAR_REG(base, index))
2914 #define DMA_WR_DAR(base, index, value) (DMA_DAR_REG(base, index) = (value))
2915 #define DMA_RMW_DAR(base, index, mask, value) (DMA_WR_DAR(base, index, (DMA_RD_DAR(base, index) & ~(mask)) | (value)))
2916 #define DMA_SET_DAR(base, index, value) (BME_OR32(&DMA_DAR_REG(base, index), (uint32_t)(value)))
2917 #define DMA_CLR_DAR(base, index, value) (BME_AND32(&DMA_DAR_REG(base, index), (uint32_t)(~(value))))
2918 #define DMA_TOG_DAR(base, index, value) (BME_XOR32(&DMA_DAR_REG(base, index), (uint32_t)(value)))
2919 /*@}*/
2920 
2921 /*******************************************************************************
2922  * DMA_DSR_BCR - DMA Status Register / Byte Count Register
2923  ******************************************************************************/
2924 
2925 /*!
2926  * @brief DMA_DSR_BCR - DMA Status Register / Byte Count Register (RW)
2927  *
2928  * Reset value: 0x00000000U
2929  *
2930  * DSR and BCR are two logical registers that occupy one 32-bit address. DSRn
2931  * occupies bits 31-24, and BCRn occupies bits 23-0. DSRn contains flags indicating
2932  * the channel status, and BCRn contains the number of bytes yet to be
2933  * transferred for a given block. On the successful completion of the write transfer, BCRn
2934  * decrements by 1, 2, or 4 for 8-bit, 16-bit, or 32-bit accesses, respectively.
2935  * BCRn is cleared if a 1 is written to DSR[DONE]. In response to an event, the
2936  * DMA controller writes to the appropriate DSRn bit. Only a write to DSRn[DONE]
2937  * results in action. DSRn[DONE] is set when the block transfer is complete. When
2938  * a transfer sequence is initiated and BCRn[BCR] is not a multiple of 4 or 2
2939  * when the DMA is configured for 32-bit or 16-bit transfers, respectively,
2940  * DSRn[CE] is set and no transfer occurs.
2941  */
2942 /*!
2943  * @name Constants and macros for entire DMA_DSR_BCR register
2944  */
2945 /*@{*/
2946 #define DMA_RD_DSR_BCR(base, index) (DMA_DSR_BCR_REG(base, index))
2947 #define DMA_WR_DSR_BCR(base, index, value) (DMA_DSR_BCR_REG(base, index) = (value))
2948 #define DMA_RMW_DSR_BCR(base, index, mask, value) (DMA_WR_DSR_BCR(base, index, (DMA_RD_DSR_BCR(base, index) & ~(mask)) | (value)))
2949 #define DMA_SET_DSR_BCR(base, index, value) (BME_OR32(&DMA_DSR_BCR_REG(base, index), (uint32_t)(value)))
2950 #define DMA_CLR_DSR_BCR(base, index, value) (BME_AND32(&DMA_DSR_BCR_REG(base, index), (uint32_t)(~(value))))
2951 #define DMA_TOG_DSR_BCR(base, index, value) (BME_XOR32(&DMA_DSR_BCR_REG(base, index), (uint32_t)(value)))
2952 /*@}*/
2953 
2954 /*
2955  * Constants & macros for individual DMA_DSR_BCR bitfields
2956  */
2957 
2958 /*!
2959  * @name Register DMA_DSR_BCR, field BCR[23:0] (RW)
2960  *
2961  * This field contains the number of bytes yet to be transferred for a given
2962  * block. BCR must be written with a value equal to or less than 0F_FFFFh. After
2963  * being written with a value in this range, bits 23-20 of BCR read back as 1110b. A
2964  * write to BCR of a value greater than 0F_FFFFh causes a configuration error
2965  * when the channel starts to execute. After being written with a value in this
2966  * range, bits 23-20 of BCR read back as 1111b.
2967  */
2968 /*@{*/
2969 /*! @brief Read current value of the DMA_DSR_BCR_BCR field. */
2970 #define DMA_RD_DSR_BCR_BCR(base, index) ((DMA_DSR_BCR_REG(base, index) & DMA_DSR_BCR_BCR_MASK) >> DMA_DSR_BCR_BCR_SHIFT)
2971 #define DMA_BRD_DSR_BCR_BCR(base, index) (DMA_RD_DSR_BCR_BCR(base, index))
2972 
2973 /*! @brief Set the BCR field to a new value. */
2974 #define DMA_WR_DSR_BCR_BCR(base, index, value) (DMA_RMW_DSR_BCR(base, index, (DMA_DSR_BCR_BCR_MASK | DMA_DSR_BCR_DONE_MASK), DMA_DSR_BCR_BCR(value)))
2975 #define DMA_BWR_DSR_BCR_BCR(base, index, value) (DMA_WR_DSR_BCR_BCR(base, index, value))
2976 /*@}*/
2977 
2978 /*!
2979  * @name Register DMA_DSR_BCR, field DONE[24] (W1C)
2980  *
2981  * Set when all DMA controller transactions complete as determined by transfer
2982  * count, or based on error conditions. When BCR reaches zero, DONE is set when
2983  * the final transfer completes successfully. DONE can also be used to abort a
2984  * transfer by resetting the status bits. When a transfer completes, software must
2985  * clear DONE before reprogramming the DMA.
2986  *
2987  * Values:
2988  * - 0b0 - DMA transfer is not yet complete. Writing a 0 has no effect.
2989  * - 0b1 - DMA transfer completed. Writing a 1 to this bit clears all DMA status
2990  * bits and should be used in an interrupt service routine to clear the DMA
2991  * interrupt and error bits.
2992  */
2993 /*@{*/
2994 /*! @brief Read current value of the DMA_DSR_BCR_DONE field. */
2995 #define DMA_RD_DSR_BCR_DONE(base, index) ((DMA_DSR_BCR_REG(base, index) & DMA_DSR_BCR_DONE_MASK) >> DMA_DSR_BCR_DONE_SHIFT)
2996 #define DMA_BRD_DSR_BCR_DONE(base, index) (BME_UBFX32(&DMA_DSR_BCR_REG(base, index), DMA_DSR_BCR_DONE_SHIFT, DMA_DSR_BCR_DONE_WIDTH))
2997 
2998 /*! @brief Set the DONE field to a new value. */
2999 #define DMA_WR_DSR_BCR_DONE(base, index, value) (DMA_RMW_DSR_BCR(base, index, DMA_DSR_BCR_DONE_MASK, DMA_DSR_BCR_DONE(value)))
3000 #define DMA_BWR_DSR_BCR_DONE(base, index, value) (BME_BFI32(&DMA_DSR_BCR_REG(base, index), ((uint32_t)(value) << DMA_DSR_BCR_DONE_SHIFT), DMA_DSR_BCR_DONE_SHIFT, DMA_DSR_BCR_DONE_WIDTH))
3001 /*@}*/
3002 
3003 /*!
3004  * @name Register DMA_DSR_BCR, field BSY[25] (RO)
3005  *
3006  * Values:
3007  * - 0b0 - DMA channel is inactive. Cleared when the DMA has finished the last
3008  * transaction.
3009  * - 0b1 - BSY is set the first time the channel is enabled after a transfer is
3010  * initiated.
3011  */
3012 /*@{*/
3013 /*! @brief Read current value of the DMA_DSR_BCR_BSY field. */
3014 #define DMA_RD_DSR_BCR_BSY(base, index) ((DMA_DSR_BCR_REG(base, index) & DMA_DSR_BCR_BSY_MASK) >> DMA_DSR_BCR_BSY_SHIFT)
3015 #define DMA_BRD_DSR_BCR_BSY(base, index) (BME_UBFX32(&DMA_DSR_BCR_REG(base, index), DMA_DSR_BCR_BSY_SHIFT, DMA_DSR_BCR_BSY_WIDTH))
3016 /*@}*/
3017 
3018 /*!
3019  * @name Register DMA_DSR_BCR, field REQ[26] (RO)
3020  *
3021  * Values:
3022  * - 0b0 - No request is pending or the channel is currently active. Cleared
3023  * when the channel is selected.
3024  * - 0b1 - The DMA channel has a transfer remaining and the channel is not
3025  * selected.
3026  */
3027 /*@{*/
3028 /*! @brief Read current value of the DMA_DSR_BCR_REQ field. */
3029 #define DMA_RD_DSR_BCR_REQ(base, index) ((DMA_DSR_BCR_REG(base, index) & DMA_DSR_BCR_REQ_MASK) >> DMA_DSR_BCR_REQ_SHIFT)
3030 #define DMA_BRD_DSR_BCR_REQ(base, index) (BME_UBFX32(&DMA_DSR_BCR_REG(base, index), DMA_DSR_BCR_REQ_SHIFT, DMA_DSR_BCR_REQ_WIDTH))
3031 /*@}*/
3032 
3033 /*!
3034  * @name Register DMA_DSR_BCR, field BED[28] (RO)
3035  *
3036  * BED is cleared at hardware reset or by writing a 1 to the DONE bit.
3037  *
3038  * Values:
3039  * - 0b0 - No bus error occurred.
3040  * - 0b1 - The DMA channel terminated with a bus error during the write portion
3041  * of a transfer.
3042  */
3043 /*@{*/
3044 /*! @brief Read current value of the DMA_DSR_BCR_BED field. */
3045 #define DMA_RD_DSR_BCR_BED(base, index) ((DMA_DSR_BCR_REG(base, index) & DMA_DSR_BCR_BED_MASK) >> DMA_DSR_BCR_BED_SHIFT)
3046 #define DMA_BRD_DSR_BCR_BED(base, index) (BME_UBFX32(&DMA_DSR_BCR_REG(base, index), DMA_DSR_BCR_BED_SHIFT, DMA_DSR_BCR_BED_WIDTH))
3047 /*@}*/
3048 
3049 /*!
3050  * @name Register DMA_DSR_BCR, field BES[29] (RO)
3051  *
3052  * BES is cleared at hardware reset or by writing a 1 to the DONE bit.
3053  *
3054  * Values:
3055  * - 0b0 - No bus error occurred.
3056  * - 0b1 - The DMA channel terminated with a bus error during the read portion
3057  * of a transfer.
3058  */
3059 /*@{*/
3060 /*! @brief Read current value of the DMA_DSR_BCR_BES field. */
3061 #define DMA_RD_DSR_BCR_BES(base, index) ((DMA_DSR_BCR_REG(base, index) & DMA_DSR_BCR_BES_MASK) >> DMA_DSR_BCR_BES_SHIFT)
3062 #define DMA_BRD_DSR_BCR_BES(base, index) (BME_UBFX32(&DMA_DSR_BCR_REG(base, index), DMA_DSR_BCR_BES_SHIFT, DMA_DSR_BCR_BES_WIDTH))
3063 /*@}*/
3064 
3065 /*!
3066  * @name Register DMA_DSR_BCR, field CE[30] (RO)
3067  *
3068  * Any of the following conditions causes a configuration error: BCR, SAR, or
3069  * DAR does not match the requested transfer size. A value greater than 0F_FFFFh is
3070  * written to BCR. Bits 31-20 of SAR or DAR are written with a value other than
3071  * one of the allowed values. See SAR and DAR . SSIZE or DSIZE is set to an
3072  * unsupported value. BCR equals 0 when the DMA receives a start condition. CE is
3073  * cleared at hardware reset or by writing a 1 to the DONE bit.
3074  *
3075  * Values:
3076  * - 0b0 - No configuration error exists.
3077  * - 0b1 - A configuration error has occurred.
3078  */
3079 /*@{*/
3080 /*! @brief Read current value of the DMA_DSR_BCR_CE field. */
3081 #define DMA_RD_DSR_BCR_CE(base, index) ((DMA_DSR_BCR_REG(base, index) & DMA_DSR_BCR_CE_MASK) >> DMA_DSR_BCR_CE_SHIFT)
3082 #define DMA_BRD_DSR_BCR_CE(base, index) (BME_UBFX32(&DMA_DSR_BCR_REG(base, index), DMA_DSR_BCR_CE_SHIFT, DMA_DSR_BCR_CE_WIDTH))
3083 /*@}*/
3084 
3085 /*******************************************************************************
3086  * DMA_DSR - DMA_DSR0 register.
3087  ******************************************************************************/
3088 
3089 /*!
3090  * @brief DMA_DSR - DMA_DSR0 register. (RW)
3091  *
3092  * Reset value: 0x00U
3093  */
3094 /*!
3095  * @name Constants and macros for entire DMA_DSR register
3096  */
3097 /*@{*/
3098 #define DMA_RD_DSR(base, index) (DMA_DSR_REG(base, index))
3099 #define DMA_WR_DSR(base, index, value) (DMA_DSR_REG(base, index) = (value))
3100 #define DMA_RMW_DSR(base, index, mask, value) (DMA_WR_DSR(base, index, (DMA_RD_DSR(base, index) & ~(mask)) | (value)))
3101 #define DMA_SET_DSR(base, index, value) (BME_OR8(&DMA_DSR_REG(base, index), (uint8_t)(value)))
3102 #define DMA_CLR_DSR(base, index, value) (BME_AND8(&DMA_DSR_REG(base, index), (uint8_t)(~(value))))
3103 #define DMA_TOG_DSR(base, index, value) (BME_XOR8(&DMA_DSR_REG(base, index), (uint8_t)(value)))
3104 /*@}*/
3105 
3106 /*******************************************************************************
3107  * DMA_DCR - DMA Control Register
3108  ******************************************************************************/
3109 
3110 /*!
3111  * @brief DMA_DCR - DMA Control Register (RW)
3112  *
3113  * Reset value: 0x00000000U
3114  */
3115 /*!
3116  * @name Constants and macros for entire DMA_DCR register
3117  */
3118 /*@{*/
3119 #define DMA_RD_DCR(base, index) (DMA_DCR_REG(base, index))
3120 #define DMA_WR_DCR(base, index, value) (DMA_DCR_REG(base, index) = (value))
3121 #define DMA_RMW_DCR(base, index, mask, value) (DMA_WR_DCR(base, index, (DMA_RD_DCR(base, index) & ~(mask)) | (value)))
3122 #define DMA_SET_DCR(base, index, value) (BME_OR32(&DMA_DCR_REG(base, index), (uint32_t)(value)))
3123 #define DMA_CLR_DCR(base, index, value) (BME_AND32(&DMA_DCR_REG(base, index), (uint32_t)(~(value))))
3124 #define DMA_TOG_DCR(base, index, value) (BME_XOR32(&DMA_DCR_REG(base, index), (uint32_t)(value)))
3125 /*@}*/
3126 
3127 /*
3128  * Constants & macros for individual DMA_DCR bitfields
3129  */
3130 
3131 /*!
3132  * @name Register DMA_DCR, field LCH2[1:0] (RW)
3133  *
3134  * Indicates the DMA channel assigned as link channel 2. The link channel number
3135  * cannot be the same as the currently executing channel, and generates a
3136  * configuration error if this is attempted (DSRn[CE] is set).
3137  *
3138  * Values:
3139  * - 0b00 - DMA Channel 0
3140  * - 0b01 - DMA Channel 1
3141  * - 0b10 - DMA Channel 2
3142  * - 0b11 - DMA Channel 3
3143  */
3144 /*@{*/
3145 /*! @brief Read current value of the DMA_DCR_LCH2 field. */
3146 #define DMA_RD_DCR_LCH2(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_LCH2_MASK) >> DMA_DCR_LCH2_SHIFT)
3147 #define DMA_BRD_DCR_LCH2(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_LCH2_SHIFT, DMA_DCR_LCH2_WIDTH))
3148 
3149 /*! @brief Set the LCH2 field to a new value. */
3150 #define DMA_WR_DCR_LCH2(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_LCH2_MASK, DMA_DCR_LCH2(value)))
3151 #define DMA_BWR_DCR_LCH2(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_LCH2_SHIFT), DMA_DCR_LCH2_SHIFT, DMA_DCR_LCH2_WIDTH))
3152 /*@}*/
3153 
3154 /*!
3155  * @name Register DMA_DCR, field LCH1[3:2] (RW)
3156  *
3157  * Indicates the DMA channel assigned as link channel 1. The link channel number
3158  * cannot be the same as the currently executing channel, and generates a
3159  * configuration error if this is attempted (DSRn[CE] is set).
3160  *
3161  * Values:
3162  * - 0b00 - DMA Channel 0
3163  * - 0b01 - DMA Channel 1
3164  * - 0b10 - DMA Channel 2
3165  * - 0b11 - DMA Channel 3
3166  */
3167 /*@{*/
3168 /*! @brief Read current value of the DMA_DCR_LCH1 field. */
3169 #define DMA_RD_DCR_LCH1(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_LCH1_MASK) >> DMA_DCR_LCH1_SHIFT)
3170 #define DMA_BRD_DCR_LCH1(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_LCH1_SHIFT, DMA_DCR_LCH1_WIDTH))
3171 
3172 /*! @brief Set the LCH1 field to a new value. */
3173 #define DMA_WR_DCR_LCH1(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_LCH1_MASK, DMA_DCR_LCH1(value)))
3174 #define DMA_BWR_DCR_LCH1(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_LCH1_SHIFT), DMA_DCR_LCH1_SHIFT, DMA_DCR_LCH1_WIDTH))
3175 /*@}*/
3176 
3177 /*!
3178  * @name Register DMA_DCR, field LINKCC[5:4] (RW)
3179  *
3180  * Allows DMA channels to have their transfers linked. The current DMA channel
3181  * triggers a DMA request to the linked channels (LCH1 or LCH2) depending on the
3182  * condition described by the LINKCC bits. If not in cycle steal mode (DCRn[CS]=0)
3183  * and LINKCC equals 01 or 10, no link to LCH1 occurs. If LINKCC equals 01, a
3184  * link to LCH1 is created after each cycle-steal transfer performed by the current
3185  * DMA channel is completed. As the last cycle-steal is performed and the BCR
3186  * reaches zero, then the link to LCH1 is closed and a link to LCH2 is created.
3187  *
3188  * Values:
3189  * - 0b00 - No channel-to-channel linking
3190  * - 0b01 - Perform a link to channel LCH1 after each cycle-steal transfer
3191  * followed by a link to LCH2 after the BCR decrements to zero
3192  * - 0b10 - Perform a link to channel LCH1 after each cycle-steal transfer
3193  * - 0b11 - Perform a link to channel LCH1 after the BCR decrements to zero
3194  */
3195 /*@{*/
3196 /*! @brief Read current value of the DMA_DCR_LINKCC field. */
3197 #define DMA_RD_DCR_LINKCC(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_LINKCC_MASK) >> DMA_DCR_LINKCC_SHIFT)
3198 #define DMA_BRD_DCR_LINKCC(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_LINKCC_SHIFT, DMA_DCR_LINKCC_WIDTH))
3199 
3200 /*! @brief Set the LINKCC field to a new value. */
3201 #define DMA_WR_DCR_LINKCC(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_LINKCC_MASK, DMA_DCR_LINKCC(value)))
3202 #define DMA_BWR_DCR_LINKCC(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_LINKCC_SHIFT), DMA_DCR_LINKCC_SHIFT, DMA_DCR_LINKCC_WIDTH))
3203 /*@}*/
3204 
3205 /*!
3206  * @name Register DMA_DCR, field D_REQ[7] (RW)
3207  *
3208  * DMA hardware automatically clears the corresponding DCRn[ERQ] bit when the
3209  * byte count register reaches zero.
3210  *
3211  * Values:
3212  * - 0b0 - ERQ bit is not affected.
3213  * - 0b1 - ERQ bit is cleared when the BCR is exhausted.
3214  */
3215 /*@{*/
3216 /*! @brief Read current value of the DMA_DCR_D_REQ field. */
3217 #define DMA_RD_DCR_D_REQ(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_D_REQ_MASK) >> DMA_DCR_D_REQ_SHIFT)
3218 #define DMA_BRD_DCR_D_REQ(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_D_REQ_SHIFT, DMA_DCR_D_REQ_WIDTH))
3219 
3220 /*! @brief Set the D_REQ field to a new value. */
3221 #define DMA_WR_DCR_D_REQ(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_D_REQ_MASK, DMA_DCR_D_REQ(value)))
3222 #define DMA_BWR_DCR_D_REQ(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_D_REQ_SHIFT), DMA_DCR_D_REQ_SHIFT, DMA_DCR_D_REQ_WIDTH))
3223 /*@}*/
3224 
3225 /*!
3226  * @name Register DMA_DCR, field DMOD[11:8] (RW)
3227  *
3228  * Defines the size of the destination data circular buffer used by the DMA
3229  * Controller. If enabled (DMOD value is non-zero), the buffer base address is
3230  * located on a boundary of the buffer size. The value of this boundary depends on the
3231  * initial destination address (DAR). The base address should be aligned to a
3232  * 0-modulo-(circular buffer size) boundary. Misaligned buffers are not possible.
3233  * The boundary is forced to the value determined by the upper address bits in the
3234  * field selection.
3235  *
3236  * Values:
3237  * - 0b0000 - Buffer disabled
3238  * - 0b0001 - Circular buffer size is 16 bytes
3239  * - 0b0010 - Circular buffer size is 32 bytes
3240  * - 0b0011 - Circular buffer size is 64 bytes
3241  * - 0b0100 - Circular buffer size is 128 bytes
3242  * - 0b0101 - Circular buffer size is 256 bytes
3243  * - 0b0110 - Circular buffer size is 512 bytes
3244  * - 0b0111 - Circular buffer size is 1 KB
3245  * - 0b1000 - Circular buffer size is 2 KB
3246  * - 0b1001 - Circular buffer size is 4 KB
3247  * - 0b1010 - Circular buffer size is 8 KB
3248  * - 0b1011 - Circular buffer size is 16 KB
3249  * - 0b1100 - Circular buffer size is 32 KB
3250  * - 0b1101 - Circular buffer size is 64 KB
3251  * - 0b1110 - Circular buffer size is 128 KB
3252  * - 0b1111 - Circular buffer size is 256 KB
3253  */
3254 /*@{*/
3255 /*! @brief Read current value of the DMA_DCR_DMOD field. */
3256 #define DMA_RD_DCR_DMOD(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_DMOD_MASK) >> DMA_DCR_DMOD_SHIFT)
3257 #define DMA_BRD_DCR_DMOD(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_DMOD_SHIFT, DMA_DCR_DMOD_WIDTH))
3258 
3259 /*! @brief Set the DMOD field to a new value. */
3260 #define DMA_WR_DCR_DMOD(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_DMOD_MASK, DMA_DCR_DMOD(value)))
3261 #define DMA_BWR_DCR_DMOD(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_DMOD_SHIFT), DMA_DCR_DMOD_SHIFT, DMA_DCR_DMOD_WIDTH))
3262 /*@}*/
3263 
3264 /*!
3265  * @name Register DMA_DCR, field SMOD[15:12] (RW)
3266  *
3267  * Defines the size of the source data circular buffer used by the DMA
3268  * Controller. If enabled (SMOD is non-zero), the buffer base address is located on a
3269  * boundary of the buffer size. The value of this boundary is based upon the initial
3270  * source address (SAR). The base address should be aligned to a
3271  * 0-modulo-(circular buffer size) boundary. Misaligned buffers are not possible. The boundary is
3272  * forced to the value determined by the upper address bits in the field
3273  * selection.
3274  *
3275  * Values:
3276  * - 0b0000 - Buffer disabled
3277  * - 0b0001 - Circular buffer size is 16 bytes
3278  * - 0b0010 - Circular buffer size is 32 bytes
3279  * - 0b0011 - Circular buffer size is 64 bytes
3280  * - 0b0100 - Circular buffer size is 128 bytes
3281  * - 0b0101 - Circular buffer size is 256 bytes
3282  * - 0b0110 - Circular buffer size is 512 bytes
3283  * - 0b0111 - Circular buffer size is 1 KB
3284  * - 0b1000 - Circular buffer size is 2 KB
3285  * - 0b1001 - Circular buffer size is 4 KB
3286  * - 0b1010 - Circular buffer size is 8 KB
3287  * - 0b1011 - Circular buffer size is 16 KB
3288  * - 0b1100 - Circular buffer size is 32 KB
3289  * - 0b1101 - Circular buffer size is 64 KB
3290  * - 0b1110 - Circular buffer size is 128 KB
3291  * - 0b1111 - Circular buffer size is 256 KB
3292  */
3293 /*@{*/
3294 /*! @brief Read current value of the DMA_DCR_SMOD field. */
3295 #define DMA_RD_DCR_SMOD(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_SMOD_MASK) >> DMA_DCR_SMOD_SHIFT)
3296 #define DMA_BRD_DCR_SMOD(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_SMOD_SHIFT, DMA_DCR_SMOD_WIDTH))
3297 
3298 /*! @brief Set the SMOD field to a new value. */
3299 #define DMA_WR_DCR_SMOD(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_SMOD_MASK, DMA_DCR_SMOD(value)))
3300 #define DMA_BWR_DCR_SMOD(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_SMOD_SHIFT), DMA_DCR_SMOD_SHIFT, DMA_DCR_SMOD_WIDTH))
3301 /*@}*/
3302 
3303 /*!
3304  * @name Register DMA_DCR, field START[16] (WORZ)
3305  *
3306  * Values:
3307  * - 0b0 - DMA inactive
3308  * - 0b1 - The DMA begins the transfer in accordance to the values in the TCDn.
3309  * START is cleared automatically after one module clock and always reads as
3310  * logic 0.
3311  */
3312 /*@{*/
3313 /*! @brief Set the START field to a new value. */
3314 #define DMA_WR_DCR_START(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_START_MASK, DMA_DCR_START(value)))
3315 #define DMA_BWR_DCR_START(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_START_SHIFT), DMA_DCR_START_SHIFT, DMA_DCR_START_WIDTH))
3316 /*@}*/
3317 
3318 /*!
3319  * @name Register DMA_DCR, field DSIZE[18:17] (RW)
3320  *
3321  * Determines the data size of the destination bus cycle for the DMA controller.
3322  *
3323  * Values:
3324  * - 0b00 - 32-bit
3325  * - 0b01 - 8-bit
3326  * - 0b10 - 16-bit
3327  * - 0b11 - Reserved (generates a configuration error (DSRn[CE]) if incorrectly
3328  * specified at time of channel activation)
3329  */
3330 /*@{*/
3331 /*! @brief Read current value of the DMA_DCR_DSIZE field. */
3332 #define DMA_RD_DCR_DSIZE(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_DSIZE_MASK) >> DMA_DCR_DSIZE_SHIFT)
3333 #define DMA_BRD_DCR_DSIZE(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_DSIZE_SHIFT, DMA_DCR_DSIZE_WIDTH))
3334 
3335 /*! @brief Set the DSIZE field to a new value. */
3336 #define DMA_WR_DCR_DSIZE(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_DSIZE_MASK, DMA_DCR_DSIZE(value)))
3337 #define DMA_BWR_DCR_DSIZE(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_DSIZE_SHIFT), DMA_DCR_DSIZE_SHIFT, DMA_DCR_DSIZE_WIDTH))
3338 /*@}*/
3339 
3340 /*!
3341  * @name Register DMA_DCR, field DINC[19] (RW)
3342  *
3343  * Controls whether the destination address increments after each successful
3344  * transfer.
3345  *
3346  * Values:
3347  * - 0b0 - No change to the DAR after a successful transfer.
3348  * - 0b1 - The DAR increments by 1, 2, 4 depending upon the size of the transfer.
3349  */
3350 /*@{*/
3351 /*! @brief Read current value of the DMA_DCR_DINC field. */
3352 #define DMA_RD_DCR_DINC(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_DINC_MASK) >> DMA_DCR_DINC_SHIFT)
3353 #define DMA_BRD_DCR_DINC(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_DINC_SHIFT, DMA_DCR_DINC_WIDTH))
3354 
3355 /*! @brief Set the DINC field to a new value. */
3356 #define DMA_WR_DCR_DINC(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_DINC_MASK, DMA_DCR_DINC(value)))
3357 #define DMA_BWR_DCR_DINC(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_DINC_SHIFT), DMA_DCR_DINC_SHIFT, DMA_DCR_DINC_WIDTH))
3358 /*@}*/
3359 
3360 /*!
3361  * @name Register DMA_DCR, field SSIZE[21:20] (RW)
3362  *
3363  * Determines the data size of the source bus cycle for the DMA controller.
3364  *
3365  * Values:
3366  * - 0b00 - 32-bit
3367  * - 0b01 - 8-bit
3368  * - 0b10 - 16-bit
3369  * - 0b11 - Reserved (generates a configuration error (DSRn[CE]) if incorrectly
3370  * specified at time of channel activation)
3371  */
3372 /*@{*/
3373 /*! @brief Read current value of the DMA_DCR_SSIZE field. */
3374 #define DMA_RD_DCR_SSIZE(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_SSIZE_MASK) >> DMA_DCR_SSIZE_SHIFT)
3375 #define DMA_BRD_DCR_SSIZE(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_SSIZE_SHIFT, DMA_DCR_SSIZE_WIDTH))
3376 
3377 /*! @brief Set the SSIZE field to a new value. */
3378 #define DMA_WR_DCR_SSIZE(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_SSIZE_MASK, DMA_DCR_SSIZE(value)))
3379 #define DMA_BWR_DCR_SSIZE(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_SSIZE_SHIFT), DMA_DCR_SSIZE_SHIFT, DMA_DCR_SSIZE_WIDTH))
3380 /*@}*/
3381 
3382 /*!
3383  * @name Register DMA_DCR, field SINC[22] (RW)
3384  *
3385  * Controls whether the source address increments after each successful transfer.
3386  *
3387  * Values:
3388  * - 0b0 - No change to SAR after a successful transfer.
3389  * - 0b1 - The SAR increments by 1, 2, 4 as determined by the transfer size.
3390  */
3391 /*@{*/
3392 /*! @brief Read current value of the DMA_DCR_SINC field. */
3393 #define DMA_RD_DCR_SINC(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_SINC_MASK) >> DMA_DCR_SINC_SHIFT)
3394 #define DMA_BRD_DCR_SINC(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_SINC_SHIFT, DMA_DCR_SINC_WIDTH))
3395 
3396 /*! @brief Set the SINC field to a new value. */
3397 #define DMA_WR_DCR_SINC(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_SINC_MASK, DMA_DCR_SINC(value)))
3398 #define DMA_BWR_DCR_SINC(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_SINC_SHIFT), DMA_DCR_SINC_SHIFT, DMA_DCR_SINC_WIDTH))
3399 /*@}*/
3400 
3401 /*!
3402  * @name Register DMA_DCR, field EADREQ[23] (RW)
3403  *
3404  * Enables the channel to support asynchronous DREQs while the MCU is in Stop
3405  * mode.
3406  *
3407  * Values:
3408  * - 0b0 - Disabled
3409  * - 0b1 - Enabled
3410  */
3411 /*@{*/
3412 /*! @brief Read current value of the DMA_DCR_EADREQ field. */
3413 #define DMA_RD_DCR_EADREQ(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_EADREQ_MASK) >> DMA_DCR_EADREQ_SHIFT)
3414 #define DMA_BRD_DCR_EADREQ(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_EADREQ_SHIFT, DMA_DCR_EADREQ_WIDTH))
3415 
3416 /*! @brief Set the EADREQ field to a new value. */
3417 #define DMA_WR_DCR_EADREQ(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_EADREQ_MASK, DMA_DCR_EADREQ(value)))
3418 #define DMA_BWR_DCR_EADREQ(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_EADREQ_SHIFT), DMA_DCR_EADREQ_SHIFT, DMA_DCR_EADREQ_WIDTH))
3419 /*@}*/
3420 
3421 /*!
3422  * @name Register DMA_DCR, field AA[28] (RW)
3423  *
3424  * AA and SIZE bits determine whether the source or destination is auto-aligned;
3425  * that is, transfers are optimized based on the address and size.
3426  *
3427  * Values:
3428  * - 0b0 - Auto-align disabled
3429  * - 0b1 - If SSIZE indicates a transfer no smaller than DSIZE, source accesses
3430  * are auto-aligned; otherwise, destination accesses are auto-aligned. Source
3431  * alignment takes precedence over destination alignment. If auto-alignment
3432  * is enabled, the appropriate address register increments, regardless of
3433  * DINC or SINC.
3434  */
3435 /*@{*/
3436 /*! @brief Read current value of the DMA_DCR_AA field. */
3437 #define DMA_RD_DCR_AA(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_AA_MASK) >> DMA_DCR_AA_SHIFT)
3438 #define DMA_BRD_DCR_AA(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_AA_SHIFT, DMA_DCR_AA_WIDTH))
3439 
3440 /*! @brief Set the AA field to a new value. */
3441 #define DMA_WR_DCR_AA(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_AA_MASK, DMA_DCR_AA(value)))
3442 #define DMA_BWR_DCR_AA(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_AA_SHIFT), DMA_DCR_AA_SHIFT, DMA_DCR_AA_WIDTH))
3443 /*@}*/
3444 
3445 /*!
3446  * @name Register DMA_DCR, field CS[29] (RW)
3447  *
3448  * Values:
3449  * - 0b0 - DMA continuously makes read/write transfers until the BCR decrements
3450  * to 0.
3451  * - 0b1 - Forces a single read/write transfer per request.
3452  */
3453 /*@{*/
3454 /*! @brief Read current value of the DMA_DCR_CS field. */
3455 #define DMA_RD_DCR_CS(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_CS_MASK) >> DMA_DCR_CS_SHIFT)
3456 #define DMA_BRD_DCR_CS(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_CS_SHIFT, DMA_DCR_CS_WIDTH))
3457 
3458 /*! @brief Set the CS field to a new value. */
3459 #define DMA_WR_DCR_CS(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_CS_MASK, DMA_DCR_CS(value)))
3460 #define DMA_BWR_DCR_CS(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_CS_SHIFT), DMA_DCR_CS_SHIFT, DMA_DCR_CS_WIDTH))
3461 /*@}*/
3462 
3463 /*!
3464  * @name Register DMA_DCR, field ERQ[30] (RW)
3465  *
3466  * Be careful: a collision can occur between the START bit and D_REQ when the
3467  * ERQ bit is 1.
3468  *
3469  * Values:
3470  * - 0b0 - Peripheral request is ignored.
3471  * - 0b1 - Enables peripheral request to initiate transfer. A software-initiated
3472  * request (setting the START bit) is always enabled.
3473  */
3474 /*@{*/
3475 /*! @brief Read current value of the DMA_DCR_ERQ field. */
3476 #define DMA_RD_DCR_ERQ(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_ERQ_MASK) >> DMA_DCR_ERQ_SHIFT)
3477 #define DMA_BRD_DCR_ERQ(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_ERQ_SHIFT, DMA_DCR_ERQ_WIDTH))
3478 
3479 /*! @brief Set the ERQ field to a new value. */
3480 #define DMA_WR_DCR_ERQ(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_ERQ_MASK, DMA_DCR_ERQ(value)))
3481 #define DMA_BWR_DCR_ERQ(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_ERQ_SHIFT), DMA_DCR_ERQ_SHIFT, DMA_DCR_ERQ_WIDTH))
3482 /*@}*/
3483 
3484 /*!
3485  * @name Register DMA_DCR, field EINT[31] (RW)
3486  *
3487  * Determines whether an interrupt is generated by completing a transfer or by
3488  * the occurrence of an error condition.
3489  *
3490  * Values:
3491  * - 0b0 - No interrupt is generated.
3492  * - 0b1 - Interrupt signal is enabled.
3493  */
3494 /*@{*/
3495 /*! @brief Read current value of the DMA_DCR_EINT field. */
3496 #define DMA_RD_DCR_EINT(base, index) ((DMA_DCR_REG(base, index) & DMA_DCR_EINT_MASK) >> DMA_DCR_EINT_SHIFT)
3497 #define DMA_BRD_DCR_EINT(base, index) (BME_UBFX32(&DMA_DCR_REG(base, index), DMA_DCR_EINT_SHIFT, DMA_DCR_EINT_WIDTH))
3498 
3499 /*! @brief Set the EINT field to a new value. */
3500 #define DMA_WR_DCR_EINT(base, index, value) (DMA_RMW_DCR(base, index, DMA_DCR_EINT_MASK, DMA_DCR_EINT(value)))
3501 #define DMA_BWR_DCR_EINT(base, index, value) (BME_BFI32(&DMA_DCR_REG(base, index), ((uint32_t)(value) << DMA_DCR_EINT_SHIFT), DMA_DCR_EINT_SHIFT, DMA_DCR_EINT_WIDTH))
3502 /*@}*/
3503 
3504 /*
3505  * MKL25Z4 DMAMUX
3506  *
3507  * DMA channel multiplexor
3508  *
3509  * Registers defined in this header file:
3510  * - DMAMUX_CHCFG - Channel Configuration register
3511  */
3512 
3513 #define DMAMUX_INSTANCE_COUNT (1U) /*!< Number of instances of the DMAMUX module. */
3514 #define DMAMUX0_IDX (0U) /*!< Instance number for DMAMUX0. */
3515 
3516 /*******************************************************************************
3517  * DMAMUX_CHCFG - Channel Configuration register
3518  ******************************************************************************/
3519 
3520 /*!
3521  * @brief DMAMUX_CHCFG - Channel Configuration register (RW)
3522  *
3523  * Reset value: 0x00U
3524  *
3525  * Each of the DMA channels can be independently enabled/disabled and associated
3526  * with one of the DMA slots (peripheral slots or always-on slots) in the
3527  * system. Setting multiple CHCFG registers with the same Source value will result in
3528  * unpredictable behavior. Before changing the trigger or source settings a DMA
3529  * channel must be disabled via the CHCFGn[ENBL] bit.
3530  */
3531 /*!
3532  * @name Constants and macros for entire DMAMUX_CHCFG register
3533  */
3534 /*@{*/
3535 #define DMAMUX_RD_CHCFG(base, index) (DMAMUX_CHCFG_REG(base, index))
3536 #define DMAMUX_WR_CHCFG(base, index, value) (DMAMUX_CHCFG_REG(base, index) = (value))
3537 #define DMAMUX_RMW_CHCFG(base, index, mask, value) (DMAMUX_WR_CHCFG(base, index, (DMAMUX_RD_CHCFG(base, index) & ~(mask)) | (value)))
3538 #define DMAMUX_SET_CHCFG(base, index, value) (BME_OR8(&DMAMUX_CHCFG_REG(base, index), (uint8_t)(value)))
3539 #define DMAMUX_CLR_CHCFG(base, index, value) (BME_AND8(&DMAMUX_CHCFG_REG(base, index), (uint8_t)(~(value))))
3540 #define DMAMUX_TOG_CHCFG(base, index, value) (BME_XOR8(&DMAMUX_CHCFG_REG(base, index), (uint8_t)(value)))
3541 /*@}*/
3542 
3543 /*
3544  * Constants & macros for individual DMAMUX_CHCFG bitfields
3545  */
3546 
3547 /*!
3548  * @name Register DMAMUX_CHCFG, field SOURCE[5:0] (RW)
3549  *
3550  * Specifies which DMA source, if any, is routed to a particular DMA channel.
3551  * See your device's chip configuration details for further details about the
3552  * peripherals and their slot numbers.
3553  */
3554 /*@{*/
3555 /*! @brief Read current value of the DMAMUX_CHCFG_SOURCE field. */
3556 #define DMAMUX_RD_CHCFG_SOURCE(base, index) ((DMAMUX_CHCFG_REG(base, index) & DMAMUX_CHCFG_SOURCE_MASK) >> DMAMUX_CHCFG_SOURCE_SHIFT)
3557 #define DMAMUX_BRD_CHCFG_SOURCE(base, index) (BME_UBFX8(&DMAMUX_CHCFG_REG(base, index), DMAMUX_CHCFG_SOURCE_SHIFT, DMAMUX_CHCFG_SOURCE_WIDTH))
3558 
3559 /*! @brief Set the SOURCE field to a new value. */
3560 #define DMAMUX_WR_CHCFG_SOURCE(base, index, value) (DMAMUX_RMW_CHCFG(base, index, DMAMUX_CHCFG_SOURCE_MASK, DMAMUX_CHCFG_SOURCE(value)))
3561 #define DMAMUX_BWR_CHCFG_SOURCE(base, index, value) (BME_BFI8(&DMAMUX_CHCFG_REG(base, index), ((uint8_t)(value) << DMAMUX_CHCFG_SOURCE_SHIFT), DMAMUX_CHCFG_SOURCE_SHIFT, DMAMUX_CHCFG_SOURCE_WIDTH))
3562 /*@}*/
3563 
3564 /*!
3565  * @name Register DMAMUX_CHCFG, field TRIG[6] (RW)
3566  *
3567  * Enables the periodic trigger capability for the triggered DMA channel.
3568  *
3569  * Values:
3570  * - 0b0 - Triggering is disabled. If triggering is disabled, and the ENBL bit
3571  * is set, the DMA Channel will simply route the specified source to the DMA
3572  * channel. (Normal mode)
3573  * - 0b1 - Triggering is enabled. If triggering is enabled, and the ENBL bit is
3574  * set, the DMAMUX is in Periodic Trigger mode.
3575  */
3576 /*@{*/
3577 /*! @brief Read current value of the DMAMUX_CHCFG_TRIG field. */
3578 #define DMAMUX_RD_CHCFG_TRIG(base, index) ((DMAMUX_CHCFG_REG(base, index) & DMAMUX_CHCFG_TRIG_MASK) >> DMAMUX_CHCFG_TRIG_SHIFT)
3579 #define DMAMUX_BRD_CHCFG_TRIG(base, index) (BME_UBFX8(&DMAMUX_CHCFG_REG(base, index), DMAMUX_CHCFG_TRIG_SHIFT, DMAMUX_CHCFG_TRIG_WIDTH))
3580 
3581 /*! @brief Set the TRIG field to a new value. */
3582 #define DMAMUX_WR_CHCFG_TRIG(base, index, value) (DMAMUX_RMW_CHCFG(base, index, DMAMUX_CHCFG_TRIG_MASK, DMAMUX_CHCFG_TRIG(value)))
3583 #define DMAMUX_BWR_CHCFG_TRIG(base, index, value) (BME_BFI8(&DMAMUX_CHCFG_REG(base, index), ((uint8_t)(value) << DMAMUX_CHCFG_TRIG_SHIFT), DMAMUX_CHCFG_TRIG_SHIFT, DMAMUX_CHCFG_TRIG_WIDTH))
3584 /*@}*/
3585 
3586 /*!
3587  * @name Register DMAMUX_CHCFG, field ENBL[7] (RW)
3588  *
3589  * Enables the DMA channel.
3590  *
3591  * Values:
3592  * - 0b0 - DMA channel is disabled. This mode is primarily used during
3593  * configuration of the DMA Mux. The DMA has separate channel enables/disables, which
3594  * should be used to disable or re-configure a DMA channel.
3595  * - 0b1 - DMA channel is enabled
3596  */
3597 /*@{*/
3598 /*! @brief Read current value of the DMAMUX_CHCFG_ENBL field. */
3599 #define DMAMUX_RD_CHCFG_ENBL(base, index) ((DMAMUX_CHCFG_REG(base, index) & DMAMUX_CHCFG_ENBL_MASK) >> DMAMUX_CHCFG_ENBL_SHIFT)
3600 #define DMAMUX_BRD_CHCFG_ENBL(base, index) (BME_UBFX8(&DMAMUX_CHCFG_REG(base, index), DMAMUX_CHCFG_ENBL_SHIFT, DMAMUX_CHCFG_ENBL_WIDTH))
3601 
3602 /*! @brief Set the ENBL field to a new value. */
3603 #define DMAMUX_WR_CHCFG_ENBL(base, index, value) (DMAMUX_RMW_CHCFG(base, index, DMAMUX_CHCFG_ENBL_MASK, DMAMUX_CHCFG_ENBL(value)))
3604 #define DMAMUX_BWR_CHCFG_ENBL(base, index, value) (BME_BFI8(&DMAMUX_CHCFG_REG(base, index), ((uint8_t)(value) << DMAMUX_CHCFG_ENBL_SHIFT), DMAMUX_CHCFG_ENBL_SHIFT, DMAMUX_CHCFG_ENBL_WIDTH))
3605 /*@}*/
3606 
3607 /*
3608  * MKL25Z4 FGPIO
3609  *
3610  * General Purpose Input/Output
3611  *
3612  * Registers defined in this header file:
3613  * - FGPIO_PDOR - Port Data Output Register
3614  * - FGPIO_PSOR - Port Set Output Register
3615  * - FGPIO_PCOR - Port Clear Output Register
3616  * - FGPIO_PTOR - Port Toggle Output Register
3617  * - FGPIO_PDIR - Port Data Input Register
3618  * - FGPIO_PDDR - Port Data Direction Register
3619  */
3620 
3621 #define FGPIO_INSTANCE_COUNT (5U) /*!< Number of instances of the FGPIO module. */
3622 #define FGPIOA_IDX (0U) /*!< Instance number for FGPIOA. */
3623 #define FGPIOB_IDX (1U) /*!< Instance number for FGPIOB. */
3624 #define FGPIOC_IDX (2U) /*!< Instance number for FGPIOC. */
3625 #define FGPIOD_IDX (3U) /*!< Instance number for FGPIOD. */
3626 #define FGPIOE_IDX (4U) /*!< Instance number for FGPIOE. */
3627 
3628 /*******************************************************************************
3629  * FGPIO_PDOR - Port Data Output Register
3630  ******************************************************************************/
3631 
3632 /*!
3633  * @brief FGPIO_PDOR - Port Data Output Register (RW)
3634  *
3635  * Reset value: 0x00000000U
3636  *
3637  * This register configures the logic levels that are driven on each
3638  * general-purpose output pins.
3639  */
3640 /*!
3641  * @name Constants and macros for entire FGPIO_PDOR register
3642  */
3643 /*@{*/
3644 #define FGPIO_RD_PDOR(base) (FGPIO_PDOR_REG(base))
3645 #define FGPIO_WR_PDOR(base, value) (FGPIO_PDOR_REG(base) = (value))
3646 #define FGPIO_RMW_PDOR(base, mask, value) (FGPIO_WR_PDOR(base, (FGPIO_RD_PDOR(base) & ~(mask)) | (value)))
3647 #define FGPIO_SET_PDOR(base, value) (FGPIO_WR_PDOR(base, FGPIO_RD_PDOR(base) | (value)))
3648 #define FGPIO_CLR_PDOR(base, value) (FGPIO_WR_PDOR(base, FGPIO_RD_PDOR(base) & ~(value)))
3649 #define FGPIO_TOG_PDOR(base, value) (FGPIO_WR_PDOR(base, FGPIO_RD_PDOR(base) ^ (value)))
3650 /*@}*/
3651 
3652 /*******************************************************************************
3653  * FGPIO_PSOR - Port Set Output Register
3654  ******************************************************************************/
3655 
3656 /*!
3657  * @brief FGPIO_PSOR - Port Set Output Register (WORZ)
3658  *
3659  * Reset value: 0x00000000U
3660  *
3661  * This register configures whether to set the fields of the PDOR.
3662  */
3663 /*!
3664  * @name Constants and macros for entire FGPIO_PSOR register
3665  */
3666 /*@{*/
3667 #define FGPIO_RD_PSOR(base) (FGPIO_PSOR_REG(base))
3668 #define FGPIO_WR_PSOR(base, value) (FGPIO_PSOR_REG(base) = (value))
3669 #define FGPIO_RMW_PSOR(base, mask, value) (FGPIO_WR_PSOR(base, (FGPIO_RD_PSOR(base) & ~(mask)) | (value)))
3670 /*@}*/
3671 
3672 /*******************************************************************************
3673  * FGPIO_PCOR - Port Clear Output Register
3674  ******************************************************************************/
3675 
3676 /*!
3677  * @brief FGPIO_PCOR - Port Clear Output Register (WORZ)
3678  *
3679  * Reset value: 0x00000000U
3680  *
3681  * This register configures whether to clear the fields of PDOR.
3682  */
3683 /*!
3684  * @name Constants and macros for entire FGPIO_PCOR register
3685  */
3686 /*@{*/
3687 #define FGPIO_RD_PCOR(base) (FGPIO_PCOR_REG(base))
3688 #define FGPIO_WR_PCOR(base, value) (FGPIO_PCOR_REG(base) = (value))
3689 #define FGPIO_RMW_PCOR(base, mask, value) (FGPIO_WR_PCOR(base, (FGPIO_RD_PCOR(base) & ~(mask)) | (value)))
3690 /*@}*/
3691 
3692 /*******************************************************************************
3693  * FGPIO_PTOR - Port Toggle Output Register
3694  ******************************************************************************/
3695 
3696 /*!
3697  * @brief FGPIO_PTOR - Port Toggle Output Register (WORZ)
3698  *
3699  * Reset value: 0x00000000U
3700  */
3701 /*!
3702  * @name Constants and macros for entire FGPIO_PTOR register
3703  */
3704 /*@{*/
3705 #define FGPIO_RD_PTOR(base) (FGPIO_PTOR_REG(base))
3706 #define FGPIO_WR_PTOR(base, value) (FGPIO_PTOR_REG(base) = (value))
3707 #define FGPIO_RMW_PTOR(base, mask, value) (FGPIO_WR_PTOR(base, (FGPIO_RD_PTOR(base) & ~(mask)) | (value)))
3708 /*@}*/
3709 
3710 /*******************************************************************************
3711  * FGPIO_PDIR - Port Data Input Register
3712  ******************************************************************************/
3713 
3714 /*!
3715  * @brief FGPIO_PDIR - Port Data Input Register (RO)
3716  *
3717  * Reset value: 0x00000000U
3718  */
3719 /*!
3720  * @name Constants and macros for entire FGPIO_PDIR register
3721  */
3722 /*@{*/
3723 #define FGPIO_RD_PDIR(base) (FGPIO_PDIR_REG(base))
3724 /*@}*/
3725 
3726 /*******************************************************************************
3727  * FGPIO_PDDR - Port Data Direction Register
3728  ******************************************************************************/
3729 
3730 /*!
3731  * @brief FGPIO_PDDR - Port Data Direction Register (RW)
3732  *
3733  * Reset value: 0x00000000U
3734  *
3735  * The PDDR configures the individual port pins for input or output.
3736  */
3737 /*!
3738  * @name Constants and macros for entire FGPIO_PDDR register
3739  */
3740 /*@{*/
3741 #define FGPIO_RD_PDDR(base) (FGPIO_PDDR_REG(base))
3742 #define FGPIO_WR_PDDR(base, value) (FGPIO_PDDR_REG(base) = (value))
3743 #define FGPIO_RMW_PDDR(base, mask, value) (FGPIO_WR_PDDR(base, (FGPIO_RD_PDDR(base) & ~(mask)) | (value)))
3744 #define FGPIO_SET_PDDR(base, value) (FGPIO_WR_PDDR(base, FGPIO_RD_PDDR(base) | (value)))
3745 #define FGPIO_CLR_PDDR(base, value) (FGPIO_WR_PDDR(base, FGPIO_RD_PDDR(base) & ~(value)))
3746 #define FGPIO_TOG_PDDR(base, value) (FGPIO_WR_PDDR(base, FGPIO_RD_PDDR(base) ^ (value)))
3747 /*@}*/
3748 
3749 /*
3750  * MKL25Z4 FTFA
3751  *
3752  * Flash Memory Interface
3753  *
3754  * Registers defined in this header file:
3755  * - FTFA_FSTAT - Flash Status Register
3756  * - FTFA_FCNFG - Flash Configuration Register
3757  * - FTFA_FSEC - Flash Security Register
3758  * - FTFA_FOPT - Flash Option Register
3759  * - FTFA_FCCOB3 - Flash Common Command Object Registers
3760  * - FTFA_FCCOB2 - Flash Common Command Object Registers
3761  * - FTFA_FCCOB1 - Flash Common Command Object Registers
3762  * - FTFA_FCCOB0 - Flash Common Command Object Registers
3763  * - FTFA_FCCOB7 - Flash Common Command Object Registers
3764  * - FTFA_FCCOB6 - Flash Common Command Object Registers
3765  * - FTFA_FCCOB5 - Flash Common Command Object Registers
3766  * - FTFA_FCCOB4 - Flash Common Command Object Registers
3767  * - FTFA_FCCOBB - Flash Common Command Object Registers
3768  * - FTFA_FCCOBA - Flash Common Command Object Registers
3769  * - FTFA_FCCOB9 - Flash Common Command Object Registers
3770  * - FTFA_FCCOB8 - Flash Common Command Object Registers
3771  * - FTFA_FPROT3 - Program Flash Protection Registers
3772  * - FTFA_FPROT2 - Program Flash Protection Registers
3773  * - FTFA_FPROT1 - Program Flash Protection Registers
3774  * - FTFA_FPROT0 - Program Flash Protection Registers
3775  */
3776 
3777 #define FTFA_INSTANCE_COUNT (1U) /*!< Number of instances of the FTFA module. */
3778 #define FTFA_IDX (0U) /*!< Instance number for FTFA. */
3779 
3780 /*******************************************************************************
3781  * FTFA_FSTAT - Flash Status Register
3782  ******************************************************************************/
3783 
3784 /*!
3785  * @brief FTFA_FSTAT - Flash Status Register (RW)
3786  *
3787  * Reset value: 0x00U
3788  *
3789  * The FSTAT register reports the operational status of the flash memory module.
3790  * The CCIF, RDCOLERR, ACCERR, and FPVIOL bits are readable and writable. The
3791  * MGSTAT0 bit is read only. The unassigned bits read 0 and are not writable. When
3792  * set, the Access Error (ACCERR) and Flash Protection Violation (FPVIOL) bits in
3793  * this register prevent the launch of any more commands until the flag is
3794  * cleared (by writing a one to it).
3795  */
3796 /*!
3797  * @name Constants and macros for entire FTFA_FSTAT register
3798  */
3799 /*@{*/
3800 #define FTFA_RD_FSTAT(base) (FTFA_FSTAT_REG(base))
3801 #define FTFA_WR_FSTAT(base, value) (FTFA_FSTAT_REG(base) = (value))
3802 #define FTFA_RMW_FSTAT(base, mask, value) (FTFA_WR_FSTAT(base, (FTFA_RD_FSTAT(base) & ~(mask)) | (value)))
3803 #define FTFA_SET_FSTAT(base, value) (BME_OR8(&FTFA_FSTAT_REG(base), (uint8_t)(value)))
3804 #define FTFA_CLR_FSTAT(base, value) (BME_AND8(&FTFA_FSTAT_REG(base), (uint8_t)(~(value))))
3805 #define FTFA_TOG_FSTAT(base, value) (BME_XOR8(&FTFA_FSTAT_REG(base), (uint8_t)(value)))
3806 /*@}*/
3807 
3808 /*
3809  * Constants & macros for individual FTFA_FSTAT bitfields
3810  */
3811 
3812 /*!
3813  * @name Register FTFA_FSTAT, field MGSTAT0[0] (RO)
3814  *
3815  * The MGSTAT0 status flag is set if an error is detected during execution of a
3816  * flash command or during the flash reset sequence. As a status flag, this bit
3817  * cannot (and need not) be cleared by the user like the other error flags in this
3818  * register. The value of the MGSTAT0 bit for "command-N" is valid only at the
3819  * end of the "command-N" execution when CCIF=1 and before the next command has
3820  * been launched. At some point during the execution of "command-N+1," the previous
3821  * result is discarded and any previous error is cleared.
3822  */
3823 /*@{*/
3824 /*! @brief Read current value of the FTFA_FSTAT_MGSTAT0 field. */
3825 #define FTFA_RD_FSTAT_MGSTAT0(base) ((FTFA_FSTAT_REG(base) & FTFA_FSTAT_MGSTAT0_MASK) >> FTFA_FSTAT_MGSTAT0_SHIFT)
3826 #define FTFA_BRD_FSTAT_MGSTAT0(base) (BME_UBFX8(&FTFA_FSTAT_REG(base), FTFA_FSTAT_MGSTAT0_SHIFT, FTFA_FSTAT_MGSTAT0_WIDTH))
3827 /*@}*/
3828 
3829 /*!
3830  * @name Register FTFA_FSTAT, field FPVIOL[4] (W1C)
3831  *
3832  * The FPVIOL error bit indicates an attempt was made to program or erase an
3833  * address in a protected area of program flash memory during a command write
3834  * sequence . While FPVIOL is set, the CCIF flag cannot be cleared to launch a command.
3835  * The FPVIOL bit is cleared by writing a 1 to it. Writing a 0 to the FPVIOL bit
3836  * has no effect.
3837  *
3838  * Values:
3839  * - 0b0 - No protection violation detected
3840  * - 0b1 - Protection violation detected
3841  */
3842 /*@{*/
3843 /*! @brief Read current value of the FTFA_FSTAT_FPVIOL field. */
3844 #define FTFA_RD_FSTAT_FPVIOL(base) ((FTFA_FSTAT_REG(base) & FTFA_FSTAT_FPVIOL_MASK) >> FTFA_FSTAT_FPVIOL_SHIFT)
3845 #define FTFA_BRD_FSTAT_FPVIOL(base) (BME_UBFX8(&FTFA_FSTAT_REG(base), FTFA_FSTAT_FPVIOL_SHIFT, FTFA_FSTAT_FPVIOL_WIDTH))
3846 
3847 /*! @brief Set the FPVIOL field to a new value. */
3848 #define FTFA_WR_FSTAT_FPVIOL(base, value) (FTFA_RMW_FSTAT(base, (FTFA_FSTAT_FPVIOL_MASK | FTFA_FSTAT_ACCERR_MASK | FTFA_FSTAT_RDCOLERR_MASK | FTFA_FSTAT_CCIF_MASK), FTFA_FSTAT_FPVIOL(value)))
3849 #define FTFA_BWR_FSTAT_FPVIOL(base, value) (BME_BFI8(&FTFA_FSTAT_REG(base), ((uint8_t)(value) << FTFA_FSTAT_FPVIOL_SHIFT), FTFA_FSTAT_FPVIOL_SHIFT, FTFA_FSTAT_FPVIOL_WIDTH))
3850 /*@}*/
3851 
3852 /*!
3853  * @name Register FTFA_FSTAT, field ACCERR[5] (W1C)
3854  *
3855  * The ACCERR error bit indicates an illegal access has occurred to a flash
3856  * memory resource caused by a violation of the command write sequence or issuing an
3857  * illegal flash command. While ACCERR is set, the CCIF flag cannot be cleared to
3858  * launch a command. The ACCERR bit is cleared by writing a 1 to it. Writing a 0
3859  * to the ACCERR bit has no effect.
3860  *
3861  * Values:
3862  * - 0b0 - No access error detected
3863  * - 0b1 - Access error detected
3864  */
3865 /*@{*/
3866 /*! @brief Read current value of the FTFA_FSTAT_ACCERR field. */
3867 #define FTFA_RD_FSTAT_ACCERR(base) ((FTFA_FSTAT_REG(base) & FTFA_FSTAT_ACCERR_MASK) >> FTFA_FSTAT_ACCERR_SHIFT)
3868 #define FTFA_BRD_FSTAT_ACCERR(base) (BME_UBFX8(&FTFA_FSTAT_REG(base), FTFA_FSTAT_ACCERR_SHIFT, FTFA_FSTAT_ACCERR_WIDTH))
3869 
3870 /*! @brief Set the ACCERR field to a new value. */
3871 #define FTFA_WR_FSTAT_ACCERR(base, value) (FTFA_RMW_FSTAT(base, (FTFA_FSTAT_ACCERR_MASK | FTFA_FSTAT_FPVIOL_MASK | FTFA_FSTAT_RDCOLERR_MASK | FTFA_FSTAT_CCIF_MASK), FTFA_FSTAT_ACCERR(value)))
3872 #define FTFA_BWR_FSTAT_ACCERR(base, value) (BME_BFI8(&FTFA_FSTAT_REG(base), ((uint8_t)(value) << FTFA_FSTAT_ACCERR_SHIFT), FTFA_FSTAT_ACCERR_SHIFT, FTFA_FSTAT_ACCERR_WIDTH))
3873 /*@}*/
3874 
3875 /*!
3876  * @name Register FTFA_FSTAT, field RDCOLERR[6] (W1C)
3877  *
3878  * The RDCOLERR error bit indicates that the MCU attempted a read from a flash
3879  * memory resource that was being manipulated by a flash command (CCIF=0). Any
3880  * simultaneous access is detected as a collision error by the block arbitration
3881  * logic. The read data in this case cannot be guaranteed. The RDCOLERR bit is
3882  * cleared by writing a 1 to it. Writing a 0 to RDCOLERR has no effect.
3883  *
3884  * Values:
3885  * - 0b0 - No collision error detected
3886  * - 0b1 - Collision error detected
3887  */
3888 /*@{*/
3889 /*! @brief Read current value of the FTFA_FSTAT_RDCOLERR field. */
3890 #define FTFA_RD_FSTAT_RDCOLERR(base) ((FTFA_FSTAT_REG(base) & FTFA_FSTAT_RDCOLERR_MASK) >> FTFA_FSTAT_RDCOLERR_SHIFT)
3891 #define FTFA_BRD_FSTAT_RDCOLERR(base) (BME_UBFX8(&FTFA_FSTAT_REG(base), FTFA_FSTAT_RDCOLERR_SHIFT, FTFA_FSTAT_RDCOLERR_WIDTH))
3892 
3893 /*! @brief Set the RDCOLERR field to a new value. */
3894 #define FTFA_WR_FSTAT_RDCOLERR(base, value) (FTFA_RMW_FSTAT(base, (FTFA_FSTAT_RDCOLERR_MASK | FTFA_FSTAT_FPVIOL_MASK | FTFA_FSTAT_ACCERR_MASK | FTFA_FSTAT_CCIF_MASK), FTFA_FSTAT_RDCOLERR(value)))
3895 #define FTFA_BWR_FSTAT_RDCOLERR(base, value) (BME_BFI8(&FTFA_FSTAT_REG(base), ((uint8_t)(value) << FTFA_FSTAT_RDCOLERR_SHIFT), FTFA_FSTAT_RDCOLERR_SHIFT, FTFA_FSTAT_RDCOLERR_WIDTH))
3896 /*@}*/
3897 
3898 /*!
3899  * @name Register FTFA_FSTAT, field CCIF[7] (W1C)
3900  *
3901  * The CCIF flag indicates that a flash command has completed. The CCIF flag is
3902  * cleared by writing a 1 to CCIF to launch a command, and CCIF stays low until
3903  * command completion or command violation. The CCIF bit is reset to 0 but is set
3904  * to 1 by the memory controller at the end of the reset initialization sequence.
3905  * Depending on how quickly the read occurs after reset release, the user may or
3906  * may not see the 0 hardware reset value.
3907  *
3908  * Values:
3909  * - 0b0 - Flash command in progress
3910  * - 0b1 - Flash command has completed
3911  */
3912 /*@{*/
3913 /*! @brief Read current value of the FTFA_FSTAT_CCIF field. */
3914 #define FTFA_RD_FSTAT_CCIF(base) ((FTFA_FSTAT_REG(base) & FTFA_FSTAT_CCIF_MASK) >> FTFA_FSTAT_CCIF_SHIFT)
3915 #define FTFA_BRD_FSTAT_CCIF(base) (BME_UBFX8(&FTFA_FSTAT_REG(base), FTFA_FSTAT_CCIF_SHIFT, FTFA_FSTAT_CCIF_WIDTH))
3916 
3917 /*! @brief Set the CCIF field to a new value. */
3918 #define FTFA_WR_FSTAT_CCIF(base, value) (FTFA_RMW_FSTAT(base, (FTFA_FSTAT_CCIF_MASK | FTFA_FSTAT_FPVIOL_MASK | FTFA_FSTAT_ACCERR_MASK | FTFA_FSTAT_RDCOLERR_MASK), FTFA_FSTAT_CCIF(value)))
3919 #define FTFA_BWR_FSTAT_CCIF(base, value) (BME_BFI8(&FTFA_FSTAT_REG(base), ((uint8_t)(value) << FTFA_FSTAT_CCIF_SHIFT), FTFA_FSTAT_CCIF_SHIFT, FTFA_FSTAT_CCIF_WIDTH))
3920 /*@}*/
3921 
3922 /*******************************************************************************
3923  * FTFA_FCNFG - Flash Configuration Register
3924  ******************************************************************************/
3925 
3926 /*!
3927  * @brief FTFA_FCNFG - Flash Configuration Register (RW)
3928  *
3929  * Reset value: 0x00U
3930  *
3931  * This register provides information on the current functional state of the
3932  * flash memory module. The erase control bits (ERSAREQ and ERSSUSP) have write
3933  * restrictions. The unassigned bits read as noted and are not writable.
3934  */
3935 /*!
3936  * @name Constants and macros for entire FTFA_FCNFG register
3937  */
3938 /*@{*/
3939 #define FTFA_RD_FCNFG(base) (FTFA_FCNFG_REG(base))
3940 #define FTFA_WR_FCNFG(base, value) (FTFA_FCNFG_REG(base) = (value))
3941 #define FTFA_RMW_FCNFG(base, mask, value) (FTFA_WR_FCNFG(base, (FTFA_RD_FCNFG(base) & ~(mask)) | (value)))
3942 #define FTFA_SET_FCNFG(base, value) (BME_OR8(&FTFA_FCNFG_REG(base), (uint8_t)(value)))
3943 #define FTFA_CLR_FCNFG(base, value) (BME_AND8(&FTFA_FCNFG_REG(base), (uint8_t)(~(value))))
3944 #define FTFA_TOG_FCNFG(base, value) (BME_XOR8(&FTFA_FCNFG_REG(base), (uint8_t)(value)))
3945 /*@}*/
3946 
3947 /*
3948  * Constants & macros for individual FTFA_FCNFG bitfields
3949  */
3950 
3951 /*!
3952  * @name Register FTFA_FCNFG, field ERSSUSP[4] (RW)
3953  *
3954  * The ERSSUSP bit allows the user to suspend (interrupt) the Erase Flash Sector
3955  * command while it is executing.
3956  *
3957  * Values:
3958  * - 0b0 - No suspend requested
3959  * - 0b1 - Suspend the current Erase Flash Sector command execution.
3960  */
3961 /*@{*/
3962 /*! @brief Read current value of the FTFA_FCNFG_ERSSUSP field. */
3963 #define FTFA_RD_FCNFG_ERSSUSP(base) ((FTFA_FCNFG_REG(base) & FTFA_FCNFG_ERSSUSP_MASK) >> FTFA_FCNFG_ERSSUSP_SHIFT)
3964 #define FTFA_BRD_FCNFG_ERSSUSP(base) (BME_UBFX8(&FTFA_FCNFG_REG(base), FTFA_FCNFG_ERSSUSP_SHIFT, FTFA_FCNFG_ERSSUSP_WIDTH))
3965 
3966 /*! @brief Set the ERSSUSP field to a new value. */
3967 #define FTFA_WR_FCNFG_ERSSUSP(base, value) (FTFA_RMW_FCNFG(base, FTFA_FCNFG_ERSSUSP_MASK, FTFA_FCNFG_ERSSUSP(value)))
3968 #define FTFA_BWR_FCNFG_ERSSUSP(base, value) (BME_BFI8(&FTFA_FCNFG_REG(base), ((uint8_t)(value) << FTFA_FCNFG_ERSSUSP_SHIFT), FTFA_FCNFG_ERSSUSP_SHIFT, FTFA_FCNFG_ERSSUSP_WIDTH))
3969 /*@}*/
3970 
3971 /*!
3972  * @name Register FTFA_FCNFG, field ERSAREQ[5] (RO)
3973  *
3974  * This bit issues a request to the memory controller to execute the Erase All
3975  * Blocks command and release security. ERSAREQ is not directly writable but is
3976  * under indirect user control. Refer to the device's Chip Configuration details on
3977  * how to request this command. The ERSAREQ bit sets when an erase all request
3978  * is triggered external to the flash memory module and CCIF is set (no command is
3979  * currently being executed). ERSAREQ is cleared by the flash memory module when
3980  * the operation completes.
3981  *
3982  * Values:
3983  * - 0b0 - No request or request complete
3984  * - 0b1 - Request to: run the Erase All Blocks command, verify the erased
3985  * state, program the security byte in the Flash Configuration Field to the
3986  * unsecure state, and release MCU security by setting the FSEC[SEC] field to the
3987  * unsecure state.
3988  */
3989 /*@{*/
3990 /*! @brief Read current value of the FTFA_FCNFG_ERSAREQ field. */
3991 #define FTFA_RD_FCNFG_ERSAREQ(base) ((FTFA_FCNFG_REG(base) & FTFA_FCNFG_ERSAREQ_MASK) >> FTFA_FCNFG_ERSAREQ_SHIFT)
3992 #define FTFA_BRD_FCNFG_ERSAREQ(base) (BME_UBFX8(&FTFA_FCNFG_REG(base), FTFA_FCNFG_ERSAREQ_SHIFT, FTFA_FCNFG_ERSAREQ_WIDTH))
3993 /*@}*/
3994 
3995 /*!
3996  * @name Register FTFA_FCNFG, field RDCOLLIE[6] (RW)
3997  *
3998  * The RDCOLLIE bit controls interrupt generation when a flash memory read
3999  * collision error occurs.
4000  *
4001  * Values:
4002  * - 0b0 - Read collision error interrupt disabled
4003  * - 0b1 - Read collision error interrupt enabled. An interrupt request is
4004  * generated whenever a flash memory read collision error is detected (see the
4005  * description of FSTAT[RDCOLERR]).
4006  */
4007 /*@{*/
4008 /*! @brief Read current value of the FTFA_FCNFG_RDCOLLIE field. */
4009 #define FTFA_RD_FCNFG_RDCOLLIE(base) ((FTFA_FCNFG_REG(base) & FTFA_FCNFG_RDCOLLIE_MASK) >> FTFA_FCNFG_RDCOLLIE_SHIFT)
4010 #define FTFA_BRD_FCNFG_RDCOLLIE(base) (BME_UBFX8(&FTFA_FCNFG_REG(base), FTFA_FCNFG_RDCOLLIE_SHIFT, FTFA_FCNFG_RDCOLLIE_WIDTH))
4011 
4012 /*! @brief Set the RDCOLLIE field to a new value. */
4013 #define FTFA_WR_FCNFG_RDCOLLIE(base, value) (FTFA_RMW_FCNFG(base, FTFA_FCNFG_RDCOLLIE_MASK, FTFA_FCNFG_RDCOLLIE(value)))
4014 #define FTFA_BWR_FCNFG_RDCOLLIE(base, value) (BME_BFI8(&FTFA_FCNFG_REG(base), ((uint8_t)(value) << FTFA_FCNFG_RDCOLLIE_SHIFT), FTFA_FCNFG_RDCOLLIE_SHIFT, FTFA_FCNFG_RDCOLLIE_WIDTH))
4015 /*@}*/
4016 
4017 /*!
4018  * @name Register FTFA_FCNFG, field CCIE[7] (RW)
4019  *
4020  * The CCIE bit controls interrupt generation when a flash command completes.
4021  *
4022  * Values:
4023  * - 0b0 - Command complete interrupt disabled
4024  * - 0b1 - Command complete interrupt enabled. An interrupt request is generated
4025  * whenever the FSTAT[CCIF] flag is set.
4026  */
4027 /*@{*/
4028 /*! @brief Read current value of the FTFA_FCNFG_CCIE field. */
4029 #define FTFA_RD_FCNFG_CCIE(base) ((FTFA_FCNFG_REG(base) & FTFA_FCNFG_CCIE_MASK) >> FTFA_FCNFG_CCIE_SHIFT)
4030 #define FTFA_BRD_FCNFG_CCIE(base) (BME_UBFX8(&FTFA_FCNFG_REG(base), FTFA_FCNFG_CCIE_SHIFT, FTFA_FCNFG_CCIE_WIDTH))
4031 
4032 /*! @brief Set the CCIE field to a new value. */
4033 #define FTFA_WR_FCNFG_CCIE(base, value) (FTFA_RMW_FCNFG(base, FTFA_FCNFG_CCIE_MASK, FTFA_FCNFG_CCIE(value)))
4034 #define FTFA_BWR_FCNFG_CCIE(base, value) (BME_BFI8(&FTFA_FCNFG_REG(base), ((uint8_t)(value) << FTFA_FCNFG_CCIE_SHIFT), FTFA_FCNFG_CCIE_SHIFT, FTFA_FCNFG_CCIE_WIDTH))
4035 /*@}*/
4036 
4037 /*******************************************************************************
4038  * FTFA_FSEC - Flash Security Register
4039  ******************************************************************************/
4040 
4041 /*!
4042  * @brief FTFA_FSEC - Flash Security Register (RO)
4043  *
4044  * Reset value: 0x00U
4045  *
4046  * This read-only register holds all bits associated with the security of the
4047  * MCU and flash memory module. During the reset sequence, the register is loaded
4048  * with the contents of the flash security byte in the Flash Configuration Field
4049  * located in program flash memory. The flash basis for the values is signified by
4050  * X in the reset value.
4051  */
4052 /*!
4053  * @name Constants and macros for entire FTFA_FSEC register
4054  */
4055 /*@{*/
4056 #define FTFA_RD_FSEC(base) (FTFA_FSEC_REG(base))
4057 /*@}*/
4058 
4059 /*
4060  * Constants & macros for individual FTFA_FSEC bitfields
4061  */
4062 
4063 /*!
4064  * @name Register FTFA_FSEC, field SEC[1:0] (RO)
4065  *
4066  * These bits define the security state of the MCU. In the secure state, the MCU
4067  * limits access to flash memory module resources. The limitations are defined
4068  * per device and are detailed in the Chip Configuration details. If the flash
4069  * memory module is unsecured using backdoor key access, the SEC bits are forced to
4070  * 10b.
4071  *
4072  * Values:
4073  * - 0b00 - MCU security status is secure
4074  * - 0b01 - MCU security status is secure
4075  * - 0b10 - MCU security status is unsecure (The standard shipping condition of
4076  * the flash memory module is unsecure.)
4077  * - 0b11 - MCU security status is secure
4078  */
4079 /*@{*/
4080 /*! @brief Read current value of the FTFA_FSEC_SEC field. */
4081 #define FTFA_RD_FSEC_SEC(base) ((FTFA_FSEC_REG(base) & FTFA_FSEC_SEC_MASK) >> FTFA_FSEC_SEC_SHIFT)
4082 #define FTFA_BRD_FSEC_SEC(base) (BME_UBFX8(&FTFA_FSEC_REG(base), FTFA_FSEC_SEC_SHIFT, FTFA_FSEC_SEC_WIDTH))
4083 /*@}*/
4084 
4085 /*!
4086  * @name Register FTFA_FSEC, field FSLACC[3:2] (RO)
4087  *
4088  * These bits enable or disable access to the flash memory contents during
4089  * returned part failure analysis at Freescale. When SEC is secure and FSLACC is
4090  * denied, access to the program flash contents is denied and any failure analysis
4091  * performed by Freescale factory test must begin with a full erase to unsecure the
4092  * part. When access is granted (SEC is unsecure, or SEC is secure and FSLACC is
4093  * granted), Freescale factory testing has visibility of the current flash
4094  * contents. The state of the FSLACC bits is only relevant when the SEC bits are set to
4095  * secure. When the SEC field is set to unsecure, the FSLACC setting does not
4096  * matter.
4097  *
4098  * Values:
4099  * - 0b00 - Freescale factory access granted
4100  * - 0b01 - Freescale factory access denied
4101  * - 0b10 - Freescale factory access denied
4102  * - 0b11 - Freescale factory access granted
4103  */
4104 /*@{*/
4105 /*! @brief Read current value of the FTFA_FSEC_FSLACC field. */
4106 #define FTFA_RD_FSEC_FSLACC(base) ((FTFA_FSEC_REG(base) & FTFA_FSEC_FSLACC_MASK) >> FTFA_FSEC_FSLACC_SHIFT)
4107 #define FTFA_BRD_FSEC_FSLACC(base) (BME_UBFX8(&FTFA_FSEC_REG(base), FTFA_FSEC_FSLACC_SHIFT, FTFA_FSEC_FSLACC_WIDTH))
4108 /*@}*/
4109 
4110 /*!
4111  * @name Register FTFA_FSEC, field MEEN[5:4] (RO)
4112  *
4113  * Enables and disables mass erase capability of the flash memory module. The
4114  * state of the MEEN bits is only relevant when the SEC bits are set to secure
4115  * outside of NVM Normal Mode. When the SEC field is set to unsecure, the MEEN
4116  * setting does not matter.
4117  *
4118  * Values:
4119  * - 0b00 - Mass erase is enabled
4120  * - 0b01 - Mass erase is enabled
4121  * - 0b10 - Mass erase is disabled
4122  * - 0b11 - Mass erase is enabled
4123  */
4124 /*@{*/
4125 /*! @brief Read current value of the FTFA_FSEC_MEEN field. */
4126 #define FTFA_RD_FSEC_MEEN(base) ((FTFA_FSEC_REG(base) & FTFA_FSEC_MEEN_MASK) >> FTFA_FSEC_MEEN_SHIFT)
4127 #define FTFA_BRD_FSEC_MEEN(base) (BME_UBFX8(&FTFA_FSEC_REG(base), FTFA_FSEC_MEEN_SHIFT, FTFA_FSEC_MEEN_WIDTH))
4128 /*@}*/
4129 
4130 /*!
4131  * @name Register FTFA_FSEC, field KEYEN[7:6] (RO)
4132  *
4133  * These bits enable and disable backdoor key access to the flash memory module.
4134  *
4135  * Values:
4136  * - 0b00 - Backdoor key access disabled
4137  * - 0b01 - Backdoor key access disabled (preferred KEYEN state to disable
4138  * backdoor key access)
4139  * - 0b10 - Backdoor key access enabled
4140  * - 0b11 - Backdoor key access disabled
4141  */
4142 /*@{*/
4143 /*! @brief Read current value of the FTFA_FSEC_KEYEN field. */
4144 #define FTFA_RD_FSEC_KEYEN(base) ((FTFA_FSEC_REG(base) & FTFA_FSEC_KEYEN_MASK) >> FTFA_FSEC_KEYEN_SHIFT)
4145 #define FTFA_BRD_FSEC_KEYEN(base) (BME_UBFX8(&FTFA_FSEC_REG(base), FTFA_FSEC_KEYEN_SHIFT, FTFA_FSEC_KEYEN_WIDTH))
4146 /*@}*/
4147 
4148 /*******************************************************************************
4149  * FTFA_FOPT - Flash Option Register
4150  ******************************************************************************/
4151 
4152 /*!
4153  * @brief FTFA_FOPT - Flash Option Register (RO)
4154  *
4155  * Reset value: 0x00U
4156  *
4157  * The flash option register allows the MCU to customize its operations by
4158  * examining the state of these read-only bits, which are loaded from NVM at reset.
4159  * The function of the bits is defined in the device's Chip Configuration details.
4160  * All bits in the register are read-only . During the reset sequence, the
4161  * register is loaded from the flash nonvolatile option byte in the Flash Configuration
4162  * Field located in program flash memory. The flash basis for the values is
4163  * signified by X in the reset value.
4164  */
4165 /*!
4166  * @name Constants and macros for entire FTFA_FOPT register
4167  */
4168 /*@{*/
4169 #define FTFA_RD_FOPT(base) (FTFA_FOPT_REG(base))
4170 /*@}*/
4171 
4172 /*******************************************************************************
4173  * FTFA_FCCOB3 - Flash Common Command Object Registers
4174  ******************************************************************************/
4175 
4176 /*!
4177  * @brief FTFA_FCCOB3 - Flash Common Command Object Registers (RW)
4178  *
4179  * Reset value: 0x00U
4180  *
4181  * The FCCOB register group provides 12 bytes for command codes and parameters.
4182  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4183  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4184  */
4185 /*!
4186  * @name Constants and macros for entire FTFA_FCCOB3 register
4187  */
4188 /*@{*/
4189 #define FTFA_RD_FCCOB3(base) (FTFA_FCCOB3_REG(base))
4190 #define FTFA_WR_FCCOB3(base, value) (FTFA_FCCOB3_REG(base) = (value))
4191 #define FTFA_RMW_FCCOB3(base, mask, value) (FTFA_WR_FCCOB3(base, (FTFA_RD_FCCOB3(base) & ~(mask)) | (value)))
4192 #define FTFA_SET_FCCOB3(base, value) (BME_OR8(&FTFA_FCCOB3_REG(base), (uint8_t)(value)))
4193 #define FTFA_CLR_FCCOB3(base, value) (BME_AND8(&FTFA_FCCOB3_REG(base), (uint8_t)(~(value))))
4194 #define FTFA_TOG_FCCOB3(base, value) (BME_XOR8(&FTFA_FCCOB3_REG(base), (uint8_t)(value)))
4195 /*@}*/
4196 
4197 /*******************************************************************************
4198  * FTFA_FCCOB2 - Flash Common Command Object Registers
4199  ******************************************************************************/
4200 
4201 /*!
4202  * @brief FTFA_FCCOB2 - Flash Common Command Object Registers (RW)
4203  *
4204  * Reset value: 0x00U
4205  *
4206  * The FCCOB register group provides 12 bytes for command codes and parameters.
4207  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4208  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4209  */
4210 /*!
4211  * @name Constants and macros for entire FTFA_FCCOB2 register
4212  */
4213 /*@{*/
4214 #define FTFA_RD_FCCOB2(base) (FTFA_FCCOB2_REG(base))
4215 #define FTFA_WR_FCCOB2(base, value) (FTFA_FCCOB2_REG(base) = (value))
4216 #define FTFA_RMW_FCCOB2(base, mask, value) (FTFA_WR_FCCOB2(base, (FTFA_RD_FCCOB2(base) & ~(mask)) | (value)))
4217 #define FTFA_SET_FCCOB2(base, value) (BME_OR8(&FTFA_FCCOB2_REG(base), (uint8_t)(value)))
4218 #define FTFA_CLR_FCCOB2(base, value) (BME_AND8(&FTFA_FCCOB2_REG(base), (uint8_t)(~(value))))
4219 #define FTFA_TOG_FCCOB2(base, value) (BME_XOR8(&FTFA_FCCOB2_REG(base), (uint8_t)(value)))
4220 /*@}*/
4221 
4222 /*******************************************************************************
4223  * FTFA_FCCOB1 - Flash Common Command Object Registers
4224  ******************************************************************************/
4225 
4226 /*!
4227  * @brief FTFA_FCCOB1 - Flash Common Command Object Registers (RW)
4228  *
4229  * Reset value: 0x00U
4230  *
4231  * The FCCOB register group provides 12 bytes for command codes and parameters.
4232  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4233  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4234  */
4235 /*!
4236  * @name Constants and macros for entire FTFA_FCCOB1 register
4237  */
4238 /*@{*/
4239 #define FTFA_RD_FCCOB1(base) (FTFA_FCCOB1_REG(base))
4240 #define FTFA_WR_FCCOB1(base, value) (FTFA_FCCOB1_REG(base) = (value))
4241 #define FTFA_RMW_FCCOB1(base, mask, value) (FTFA_WR_FCCOB1(base, (FTFA_RD_FCCOB1(base) & ~(mask)) | (value)))
4242 #define FTFA_SET_FCCOB1(base, value) (BME_OR8(&FTFA_FCCOB1_REG(base), (uint8_t)(value)))
4243 #define FTFA_CLR_FCCOB1(base, value) (BME_AND8(&FTFA_FCCOB1_REG(base), (uint8_t)(~(value))))
4244 #define FTFA_TOG_FCCOB1(base, value) (BME_XOR8(&FTFA_FCCOB1_REG(base), (uint8_t)(value)))
4245 /*@}*/
4246 
4247 /*******************************************************************************
4248  * FTFA_FCCOB0 - Flash Common Command Object Registers
4249  ******************************************************************************/
4250 
4251 /*!
4252  * @brief FTFA_FCCOB0 - Flash Common Command Object Registers (RW)
4253  *
4254  * Reset value: 0x00U
4255  *
4256  * The FCCOB register group provides 12 bytes for command codes and parameters.
4257  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4258  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4259  */
4260 /*!
4261  * @name Constants and macros for entire FTFA_FCCOB0 register
4262  */
4263 /*@{*/
4264 #define FTFA_RD_FCCOB0(base) (FTFA_FCCOB0_REG(base))
4265 #define FTFA_WR_FCCOB0(base, value) (FTFA_FCCOB0_REG(base) = (value))
4266 #define FTFA_RMW_FCCOB0(base, mask, value) (FTFA_WR_FCCOB0(base, (FTFA_RD_FCCOB0(base) & ~(mask)) | (value)))
4267 #define FTFA_SET_FCCOB0(base, value) (BME_OR8(&FTFA_FCCOB0_REG(base), (uint8_t)(value)))
4268 #define FTFA_CLR_FCCOB0(base, value) (BME_AND8(&FTFA_FCCOB0_REG(base), (uint8_t)(~(value))))
4269 #define FTFA_TOG_FCCOB0(base, value) (BME_XOR8(&FTFA_FCCOB0_REG(base), (uint8_t)(value)))
4270 /*@}*/
4271 
4272 /*******************************************************************************
4273  * FTFA_FCCOB7 - Flash Common Command Object Registers
4274  ******************************************************************************/
4275 
4276 /*!
4277  * @brief FTFA_FCCOB7 - Flash Common Command Object Registers (RW)
4278  *
4279  * Reset value: 0x00U
4280  *
4281  * The FCCOB register group provides 12 bytes for command codes and parameters.
4282  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4283  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4284  */
4285 /*!
4286  * @name Constants and macros for entire FTFA_FCCOB7 register
4287  */
4288 /*@{*/
4289 #define FTFA_RD_FCCOB7(base) (FTFA_FCCOB7_REG(base))
4290 #define FTFA_WR_FCCOB7(base, value) (FTFA_FCCOB7_REG(base) = (value))
4291 #define FTFA_RMW_FCCOB7(base, mask, value) (FTFA_WR_FCCOB7(base, (FTFA_RD_FCCOB7(base) & ~(mask)) | (value)))
4292 #define FTFA_SET_FCCOB7(base, value) (BME_OR8(&FTFA_FCCOB7_REG(base), (uint8_t)(value)))
4293 #define FTFA_CLR_FCCOB7(base, value) (BME_AND8(&FTFA_FCCOB7_REG(base), (uint8_t)(~(value))))
4294 #define FTFA_TOG_FCCOB7(base, value) (BME_XOR8(&FTFA_FCCOB7_REG(base), (uint8_t)(value)))
4295 /*@}*/
4296 
4297 /*******************************************************************************
4298  * FTFA_FCCOB6 - Flash Common Command Object Registers
4299  ******************************************************************************/
4300 
4301 /*!
4302  * @brief FTFA_FCCOB6 - Flash Common Command Object Registers (RW)
4303  *
4304  * Reset value: 0x00U
4305  *
4306  * The FCCOB register group provides 12 bytes for command codes and parameters.
4307  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4308  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4309  */
4310 /*!
4311  * @name Constants and macros for entire FTFA_FCCOB6 register
4312  */
4313 /*@{*/
4314 #define FTFA_RD_FCCOB6(base) (FTFA_FCCOB6_REG(base))
4315 #define FTFA_WR_FCCOB6(base, value) (FTFA_FCCOB6_REG(base) = (value))
4316 #define FTFA_RMW_FCCOB6(base, mask, value) (FTFA_WR_FCCOB6(base, (FTFA_RD_FCCOB6(base) & ~(mask)) | (value)))
4317 #define FTFA_SET_FCCOB6(base, value) (BME_OR8(&FTFA_FCCOB6_REG(base), (uint8_t)(value)))
4318 #define FTFA_CLR_FCCOB6(base, value) (BME_AND8(&FTFA_FCCOB6_REG(base), (uint8_t)(~(value))))
4319 #define FTFA_TOG_FCCOB6(base, value) (BME_XOR8(&FTFA_FCCOB6_REG(base), (uint8_t)(value)))
4320 /*@}*/
4321 
4322 /*******************************************************************************
4323  * FTFA_FCCOB5 - Flash Common Command Object Registers
4324  ******************************************************************************/
4325 
4326 /*!
4327  * @brief FTFA_FCCOB5 - Flash Common Command Object Registers (RW)
4328  *
4329  * Reset value: 0x00U
4330  *
4331  * The FCCOB register group provides 12 bytes for command codes and parameters.
4332  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4333  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4334  */
4335 /*!
4336  * @name Constants and macros for entire FTFA_FCCOB5 register
4337  */
4338 /*@{*/
4339 #define FTFA_RD_FCCOB5(base) (FTFA_FCCOB5_REG(base))
4340 #define FTFA_WR_FCCOB5(base, value) (FTFA_FCCOB5_REG(base) = (value))
4341 #define FTFA_RMW_FCCOB5(base, mask, value) (FTFA_WR_FCCOB5(base, (FTFA_RD_FCCOB5(base) & ~(mask)) | (value)))
4342 #define FTFA_SET_FCCOB5(base, value) (BME_OR8(&FTFA_FCCOB5_REG(base), (uint8_t)(value)))
4343 #define FTFA_CLR_FCCOB5(base, value) (BME_AND8(&FTFA_FCCOB5_REG(base), (uint8_t)(~(value))))
4344 #define FTFA_TOG_FCCOB5(base, value) (BME_XOR8(&FTFA_FCCOB5_REG(base), (uint8_t)(value)))
4345 /*@}*/
4346 
4347 /*******************************************************************************
4348  * FTFA_FCCOB4 - Flash Common Command Object Registers
4349  ******************************************************************************/
4350 
4351 /*!
4352  * @brief FTFA_FCCOB4 - Flash Common Command Object Registers (RW)
4353  *
4354  * Reset value: 0x00U
4355  *
4356  * The FCCOB register group provides 12 bytes for command codes and parameters.
4357  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4358  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4359  */
4360 /*!
4361  * @name Constants and macros for entire FTFA_FCCOB4 register
4362  */
4363 /*@{*/
4364 #define FTFA_RD_FCCOB4(base) (FTFA_FCCOB4_REG(base))
4365 #define FTFA_WR_FCCOB4(base, value) (FTFA_FCCOB4_REG(base) = (value))
4366 #define FTFA_RMW_FCCOB4(base, mask, value) (FTFA_WR_FCCOB4(base, (FTFA_RD_FCCOB4(base) & ~(mask)) | (value)))
4367 #define FTFA_SET_FCCOB4(base, value) (BME_OR8(&FTFA_FCCOB4_REG(base), (uint8_t)(value)))
4368 #define FTFA_CLR_FCCOB4(base, value) (BME_AND8(&FTFA_FCCOB4_REG(base), (uint8_t)(~(value))))
4369 #define FTFA_TOG_FCCOB4(base, value) (BME_XOR8(&FTFA_FCCOB4_REG(base), (uint8_t)(value)))
4370 /*@}*/
4371 
4372 /*******************************************************************************
4373  * FTFA_FCCOBB - Flash Common Command Object Registers
4374  ******************************************************************************/
4375 
4376 /*!
4377  * @brief FTFA_FCCOBB - Flash Common Command Object Registers (RW)
4378  *
4379  * Reset value: 0x00U
4380  *
4381  * The FCCOB register group provides 12 bytes for command codes and parameters.
4382  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4383  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4384  */
4385 /*!
4386  * @name Constants and macros for entire FTFA_FCCOBB register
4387  */
4388 /*@{*/
4389 #define FTFA_RD_FCCOBB(base) (FTFA_FCCOBB_REG(base))
4390 #define FTFA_WR_FCCOBB(base, value) (FTFA_FCCOBB_REG(base) = (value))
4391 #define FTFA_RMW_FCCOBB(base, mask, value) (FTFA_WR_FCCOBB(base, (FTFA_RD_FCCOBB(base) & ~(mask)) | (value)))
4392 #define FTFA_SET_FCCOBB(base, value) (BME_OR8(&FTFA_FCCOBB_REG(base), (uint8_t)(value)))
4393 #define FTFA_CLR_FCCOBB(base, value) (BME_AND8(&FTFA_FCCOBB_REG(base), (uint8_t)(~(value))))
4394 #define FTFA_TOG_FCCOBB(base, value) (BME_XOR8(&FTFA_FCCOBB_REG(base), (uint8_t)(value)))
4395 /*@}*/
4396 
4397 /*******************************************************************************
4398  * FTFA_FCCOBA - Flash Common Command Object Registers
4399  ******************************************************************************/
4400 
4401 /*!
4402  * @brief FTFA_FCCOBA - Flash Common Command Object Registers (RW)
4403  *
4404  * Reset value: 0x00U
4405  *
4406  * The FCCOB register group provides 12 bytes for command codes and parameters.
4407  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4408  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4409  */
4410 /*!
4411  * @name Constants and macros for entire FTFA_FCCOBA register
4412  */
4413 /*@{*/
4414 #define FTFA_RD_FCCOBA(base) (FTFA_FCCOBA_REG(base))
4415 #define FTFA_WR_FCCOBA(base, value) (FTFA_FCCOBA_REG(base) = (value))
4416 #define FTFA_RMW_FCCOBA(base, mask, value) (FTFA_WR_FCCOBA(base, (FTFA_RD_FCCOBA(base) & ~(mask)) | (value)))
4417 #define FTFA_SET_FCCOBA(base, value) (BME_OR8(&FTFA_FCCOBA_REG(base), (uint8_t)(value)))
4418 #define FTFA_CLR_FCCOBA(base, value) (BME_AND8(&FTFA_FCCOBA_REG(base), (uint8_t)(~(value))))
4419 #define FTFA_TOG_FCCOBA(base, value) (BME_XOR8(&FTFA_FCCOBA_REG(base), (uint8_t)(value)))
4420 /*@}*/
4421 
4422 /*******************************************************************************
4423  * FTFA_FCCOB9 - Flash Common Command Object Registers
4424  ******************************************************************************/
4425 
4426 /*!
4427  * @brief FTFA_FCCOB9 - Flash Common Command Object Registers (RW)
4428  *
4429  * Reset value: 0x00U
4430  *
4431  * The FCCOB register group provides 12 bytes for command codes and parameters.
4432  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4433  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4434  */
4435 /*!
4436  * @name Constants and macros for entire FTFA_FCCOB9 register
4437  */
4438 /*@{*/
4439 #define FTFA_RD_FCCOB9(base) (FTFA_FCCOB9_REG(base))
4440 #define FTFA_WR_FCCOB9(base, value) (FTFA_FCCOB9_REG(base) = (value))
4441 #define FTFA_RMW_FCCOB9(base, mask, value) (FTFA_WR_FCCOB9(base, (FTFA_RD_FCCOB9(base) & ~(mask)) | (value)))
4442 #define FTFA_SET_FCCOB9(base, value) (BME_OR8(&FTFA_FCCOB9_REG(base), (uint8_t)(value)))
4443 #define FTFA_CLR_FCCOB9(base, value) (BME_AND8(&FTFA_FCCOB9_REG(base), (uint8_t)(~(value))))
4444 #define FTFA_TOG_FCCOB9(base, value) (BME_XOR8(&FTFA_FCCOB9_REG(base), (uint8_t)(value)))
4445 /*@}*/
4446 
4447 /*******************************************************************************
4448  * FTFA_FCCOB8 - Flash Common Command Object Registers
4449  ******************************************************************************/
4450 
4451 /*!
4452  * @brief FTFA_FCCOB8 - Flash Common Command Object Registers (RW)
4453  *
4454  * Reset value: 0x00U
4455  *
4456  * The FCCOB register group provides 12 bytes for command codes and parameters.
4457  * The individual bytes within the set append a 0-B hex identifier to the FCCOB
4458  * register name: FCCOB0, FCCOB1, ..., FCCOBB.
4459  */
4460 /*!
4461  * @name Constants and macros for entire FTFA_FCCOB8 register
4462  */
4463 /*@{*/
4464 #define FTFA_RD_FCCOB8(base) (FTFA_FCCOB8_REG(base))
4465 #define FTFA_WR_FCCOB8(base, value) (FTFA_FCCOB8_REG(base) = (value))
4466 #define FTFA_RMW_FCCOB8(base, mask, value) (FTFA_WR_FCCOB8(base, (FTFA_RD_FCCOB8(base) & ~(mask)) | (value)))
4467 #define FTFA_SET_FCCOB8(base, value) (BME_OR8(&FTFA_FCCOB8_REG(base), (uint8_t)(value)))
4468 #define FTFA_CLR_FCCOB8(base, value) (BME_AND8(&FTFA_FCCOB8_REG(base), (uint8_t)(~(value))))
4469 #define FTFA_TOG_FCCOB8(base, value) (BME_XOR8(&FTFA_FCCOB8_REG(base), (uint8_t)(value)))
4470 /*@}*/
4471 
4472 /*******************************************************************************
4473  * FTFA_FPROT3 - Program Flash Protection Registers
4474  ******************************************************************************/
4475 
4476 /*!
4477  * @brief FTFA_FPROT3 - Program Flash Protection Registers (RW)
4478  *
4479  * Reset value: 0x00U
4480  *
4481  * The FPROT registers define which logical program flash regions are protected
4482  * from program and erase operations. Protected flash regions cannot have their
4483  * content changed; that is, these regions cannot be programmed and cannot be
4484  * erased by any flash command. Unprotected regions can be changed by program and
4485  * erase operations. The four FPROT registers allow up to 32 protectable regions.
4486  * Each bit protects a 1/32 region of the program flash memory except for memory
4487  * configurations with less than 32 Kbytes of program flash where each assigned bit
4488  * protects 1 Kbyte . For configurations with 24 Kbytes of program flash memory
4489  * or less, FPROT0 is not used. For configurations with 16 Kbytes of program
4490  * flash memory or less, FPROT1 is not used. For configurations with 8 Kbytes of
4491  * program flash memory, FPROT2 is not used. The bitfields are defined in each
4492  * register as follows: Program flash protection register Program flash protection bits
4493  * FPROT0 PROT[31:24] FPROT1 PROT[23:16] FPROT2 PROT[15:8] FPROT3 PROT[7:0]
4494  * During the reset sequence, the FPROT registers are loaded with the contents of the
4495  * program flash protection bytes in the Flash Configuration Field as indicated
4496  * in the following table. Program flash protection register Flash Configuration
4497  * Field offset address FPROT0 0x000B FPROT1 0x000A FPROT2 0x0009 FPROT3 0x0008
4498  * To change the program flash protection that is loaded during the reset
4499  * sequence, unprotect the sector of program flash memory that contains the Flash
4500  * Configuration Field. Then, reprogram the program flash protection byte.
4501  */
4502 /*!
4503  * @name Constants and macros for entire FTFA_FPROT3 register
4504  */
4505 /*@{*/
4506 #define FTFA_RD_FPROT3(base) (FTFA_FPROT3_REG(base))
4507 #define FTFA_WR_FPROT3(base, value) (FTFA_FPROT3_REG(base) = (value))
4508 #define FTFA_RMW_FPROT3(base, mask, value) (FTFA_WR_FPROT3(base, (FTFA_RD_FPROT3(base) & ~(mask)) | (value)))
4509 #define FTFA_SET_FPROT3(base, value) (BME_OR8(&FTFA_FPROT3_REG(base), (uint8_t)(value)))
4510 #define FTFA_CLR_FPROT3(base, value) (BME_AND8(&FTFA_FPROT3_REG(base), (uint8_t)(~(value))))
4511 #define FTFA_TOG_FPROT3(base, value) (BME_XOR8(&FTFA_FPROT3_REG(base), (uint8_t)(value)))
4512 /*@}*/
4513 
4514 /*******************************************************************************
4515  * FTFA_FPROT2 - Program Flash Protection Registers
4516  ******************************************************************************/
4517 
4518 /*!
4519  * @brief FTFA_FPROT2 - Program Flash Protection Registers (RW)
4520  *
4521  * Reset value: 0x00U
4522  *
4523  * The FPROT registers define which logical program flash regions are protected
4524  * from program and erase operations. Protected flash regions cannot have their
4525  * content changed; that is, these regions cannot be programmed and cannot be
4526  * erased by any flash command. Unprotected regions can be changed by program and
4527  * erase operations. The four FPROT registers allow up to 32 protectable regions.
4528  * Each bit protects a 1/32 region of the program flash memory except for memory
4529  * configurations with less than 32 Kbytes of program flash where each assigned bit
4530  * protects 1 Kbyte . For configurations with 24 Kbytes of program flash memory
4531  * or less, FPROT0 is not used. For configurations with 16 Kbytes of program
4532  * flash memory or less, FPROT1 is not used. For configurations with 8 Kbytes of
4533  * program flash memory, FPROT2 is not used. The bitfields are defined in each
4534  * register as follows: Program flash protection register Program flash protection bits
4535  * FPROT0 PROT[31:24] FPROT1 PROT[23:16] FPROT2 PROT[15:8] FPROT3 PROT[7:0]
4536  * During the reset sequence, the FPROT registers are loaded with the contents of the
4537  * program flash protection bytes in the Flash Configuration Field as indicated
4538  * in the following table. Program flash protection register Flash Configuration
4539  * Field offset address FPROT0 0x000B FPROT1 0x000A FPROT2 0x0009 FPROT3 0x0008
4540  * To change the program flash protection that is loaded during the reset
4541  * sequence, unprotect the sector of program flash memory that contains the Flash
4542  * Configuration Field. Then, reprogram the program flash protection byte.
4543  */
4544 /*!
4545  * @name Constants and macros for entire FTFA_FPROT2 register
4546  */
4547 /*@{*/
4548 #define FTFA_RD_FPROT2(base) (FTFA_FPROT2_REG(base))
4549 #define FTFA_WR_FPROT2(base, value) (FTFA_FPROT2_REG(base) = (value))
4550 #define FTFA_RMW_FPROT2(base, mask, value) (FTFA_WR_FPROT2(base, (FTFA_RD_FPROT2(base) & ~(mask)) | (value)))
4551 #define FTFA_SET_FPROT2(base, value) (BME_OR8(&FTFA_FPROT2_REG(base), (uint8_t)(value)))
4552 #define FTFA_CLR_FPROT2(base, value) (BME_AND8(&FTFA_FPROT2_REG(base), (uint8_t)(~(value))))
4553 #define FTFA_TOG_FPROT2(base, value) (BME_XOR8(&FTFA_FPROT2_REG(base), (uint8_t)(value)))
4554 /*@}*/
4555 
4556 /*******************************************************************************
4557  * FTFA_FPROT1 - Program Flash Protection Registers
4558  ******************************************************************************/
4559 
4560 /*!
4561  * @brief FTFA_FPROT1 - Program Flash Protection Registers (RW)
4562  *
4563  * Reset value: 0x00U
4564  *
4565  * The FPROT registers define which logical program flash regions are protected
4566  * from program and erase operations. Protected flash regions cannot have their
4567  * content changed; that is, these regions cannot be programmed and cannot be
4568  * erased by any flash command. Unprotected regions can be changed by program and
4569  * erase operations. The four FPROT registers allow up to 32 protectable regions.
4570  * Each bit protects a 1/32 region of the program flash memory except for memory
4571  * configurations with less than 32 Kbytes of program flash where each assigned bit
4572  * protects 1 Kbyte . For configurations with 24 Kbytes of program flash memory
4573  * or less, FPROT0 is not used. For configurations with 16 Kbytes of program
4574  * flash memory or less, FPROT1 is not used. For configurations with 8 Kbytes of
4575  * program flash memory, FPROT2 is not used. The bitfields are defined in each
4576  * register as follows: Program flash protection register Program flash protection bits
4577  * FPROT0 PROT[31:24] FPROT1 PROT[23:16] FPROT2 PROT[15:8] FPROT3 PROT[7:0]
4578  * During the reset sequence, the FPROT registers are loaded with the contents of the
4579  * program flash protection bytes in the Flash Configuration Field as indicated
4580  * in the following table. Program flash protection register Flash Configuration
4581  * Field offset address FPROT0 0x000B FPROT1 0x000A FPROT2 0x0009 FPROT3 0x0008
4582  * To change the program flash protection that is loaded during the reset
4583  * sequence, unprotect the sector of program flash memory that contains the Flash
4584  * Configuration Field. Then, reprogram the program flash protection byte.
4585  */
4586 /*!
4587  * @name Constants and macros for entire FTFA_FPROT1 register
4588  */
4589 /*@{*/
4590 #define FTFA_RD_FPROT1(base) (FTFA_FPROT1_REG(base))
4591 #define FTFA_WR_FPROT1(base, value) (FTFA_FPROT1_REG(base) = (value))
4592 #define FTFA_RMW_FPROT1(base, mask, value) (FTFA_WR_FPROT1(base, (FTFA_RD_FPROT1(base) & ~(mask)) | (value)))
4593 #define FTFA_SET_FPROT1(base, value) (BME_OR8(&FTFA_FPROT1_REG(base), (uint8_t)(value)))
4594 #define FTFA_CLR_FPROT1(base, value) (BME_AND8(&FTFA_FPROT1_REG(base), (uint8_t)(~(value))))
4595 #define FTFA_TOG_FPROT1(base, value) (BME_XOR8(&FTFA_FPROT1_REG(base), (uint8_t)(value)))
4596 /*@}*/
4597 
4598 /*******************************************************************************
4599  * FTFA_FPROT0 - Program Flash Protection Registers
4600  ******************************************************************************/
4601 
4602 /*!
4603  * @brief FTFA_FPROT0 - Program Flash Protection Registers (RW)
4604  *
4605  * Reset value: 0x00U
4606  *
4607  * The FPROT registers define which logical program flash regions are protected
4608  * from program and erase operations. Protected flash regions cannot have their
4609  * content changed; that is, these regions cannot be programmed and cannot be
4610  * erased by any flash command. Unprotected regions can be changed by program and
4611  * erase operations. The four FPROT registers allow up to 32 protectable regions.
4612  * Each bit protects a 1/32 region of the program flash memory except for memory
4613  * configurations with less than 32 Kbytes of program flash where each assigned bit
4614  * protects 1 Kbyte . For configurations with 24 Kbytes of program flash memory
4615  * or less, FPROT0 is not used. For configurations with 16 Kbytes of program
4616  * flash memory or less, FPROT1 is not used. For configurations with 8 Kbytes of
4617  * program flash memory, FPROT2 is not used. The bitfields are defined in each
4618  * register as follows: Program flash protection register Program flash protection bits
4619  * FPROT0 PROT[31:24] FPROT1 PROT[23:16] FPROT2 PROT[15:8] FPROT3 PROT[7:0]
4620  * During the reset sequence, the FPROT registers are loaded with the contents of the
4621  * program flash protection bytes in the Flash Configuration Field as indicated
4622  * in the following table. Program flash protection register Flash Configuration
4623  * Field offset address FPROT0 0x000B FPROT1 0x000A FPROT2 0x0009 FPROT3 0x0008
4624  * To change the program flash protection that is loaded during the reset
4625  * sequence, unprotect the sector of program flash memory that contains the Flash
4626  * Configuration Field. Then, reprogram the program flash protection byte.
4627  */
4628 /*!
4629  * @name Constants and macros for entire FTFA_FPROT0 register
4630  */
4631 /*@{*/
4632 #define FTFA_RD_FPROT0(base) (FTFA_FPROT0_REG(base))
4633 #define FTFA_WR_FPROT0(base, value) (FTFA_FPROT0_REG(base) = (value))
4634 #define FTFA_RMW_FPROT0(base, mask, value) (FTFA_WR_FPROT0(base, (FTFA_RD_FPROT0(base) & ~(mask)) | (value)))
4635 #define FTFA_SET_FPROT0(base, value) (BME_OR8(&FTFA_FPROT0_REG(base), (uint8_t)(value)))
4636 #define FTFA_CLR_FPROT0(base, value) (BME_AND8(&FTFA_FPROT0_REG(base), (uint8_t)(~(value))))
4637 #define FTFA_TOG_FPROT0(base, value) (BME_XOR8(&FTFA_FPROT0_REG(base), (uint8_t)(value)))
4638 /*@}*/
4639 
4640 /*
4641  * MKL25Z4 GPIO
4642  *
4643  * General Purpose Input/Output
4644  *
4645  * Registers defined in this header file:
4646  * - GPIO_PDOR - Port Data Output Register
4647  * - GPIO_PSOR - Port Set Output Register
4648  * - GPIO_PCOR - Port Clear Output Register
4649  * - GPIO_PTOR - Port Toggle Output Register
4650  * - GPIO_PDIR - Port Data Input Register
4651  * - GPIO_PDDR - Port Data Direction Register
4652  */
4653 
4654 #define GPIO_INSTANCE_COUNT (5U) /*!< Number of instances of the GPIO module. */
4655 #define GPIOA_IDX (0U) /*!< Instance number for GPIOA. */
4656 #define GPIOB_IDX (1U) /*!< Instance number for GPIOB. */
4657 #define GPIOC_IDX (2U) /*!< Instance number for GPIOC. */
4658 #define GPIOD_IDX (3U) /*!< Instance number for GPIOD. */
4659 #define GPIOE_IDX (4U) /*!< Instance number for GPIOE. */
4660 
4661 /*******************************************************************************
4662  * GPIO_PDOR - Port Data Output Register
4663  ******************************************************************************/
4664 
4665 /*!
4666  * @brief GPIO_PDOR - Port Data Output Register (RW)
4667  *
4668  * Reset value: 0x00000000U
4669  *
4670  * This register configures the logic levels that are driven on each
4671  * general-purpose output pins. Do not modify pin configuration registers associated with
4672  * pins not available in your selected package. All un-bonded pins not available in
4673  * your package will default to DISABLE state for lowest power consumption.
4674  */
4675 /*!
4676  * @name Constants and macros for entire GPIO_PDOR register
4677  */
4678 /*@{*/
4679 #define GPIO_RD_PDOR(base) (GPIO_PDOR_REG(base))
4680 #define GPIO_WR_PDOR(base, value) (GPIO_PDOR_REG(base) = (value))
4681 #define GPIO_RMW_PDOR(base, mask, value) (GPIO_WR_PDOR(base, (GPIO_RD_PDOR(base) & ~(mask)) | (value)))
4682 #define GPIO_SET_PDOR(base, value) (BME_OR32(&GPIO_PDOR_REG(base), (uint32_t)(value)))
4683 #define GPIO_CLR_PDOR(base, value) (BME_AND32(&GPIO_PDOR_REG(base), (uint32_t)(~(value))))
4684 #define GPIO_TOG_PDOR(base, value) (BME_XOR32(&GPIO_PDOR_REG(base), (uint32_t)(value)))
4685 /*@}*/
4686 
4687 /*******************************************************************************
4688  * GPIO_PSOR - Port Set Output Register
4689  ******************************************************************************/
4690 
4691 /*!
4692  * @brief GPIO_PSOR - Port Set Output Register (WORZ)
4693  *
4694  * Reset value: 0x00000000U
4695  *
4696  * This register configures whether to set the fields of the PDOR.
4697  */
4698 /*!
4699  * @name Constants and macros for entire GPIO_PSOR register
4700  */
4701 /*@{*/
4702 #define GPIO_RD_PSOR(base) (GPIO_PSOR_REG(base))
4703 #define GPIO_WR_PSOR(base, value) (GPIO_PSOR_REG(base) = (value))
4704 #define GPIO_RMW_PSOR(base, mask, value) (GPIO_WR_PSOR(base, (GPIO_RD_PSOR(base) & ~(mask)) | (value)))
4705 /*@}*/
4706 
4707 /*******************************************************************************
4708  * GPIO_PCOR - Port Clear Output Register
4709  ******************************************************************************/
4710 
4711 /*!
4712  * @brief GPIO_PCOR - Port Clear Output Register (WORZ)
4713  *
4714  * Reset value: 0x00000000U
4715  *
4716  * This register configures whether to clear the fields of PDOR.
4717  */
4718 /*!
4719  * @name Constants and macros for entire GPIO_PCOR register
4720  */
4721 /*@{*/
4722 #define GPIO_RD_PCOR(base) (GPIO_PCOR_REG(base))
4723 #define GPIO_WR_PCOR(base, value) (GPIO_PCOR_REG(base) = (value))
4724 #define GPIO_RMW_PCOR(base, mask, value) (GPIO_WR_PCOR(base, (GPIO_RD_PCOR(base) & ~(mask)) | (value)))
4725 /*@}*/
4726 
4727 /*******************************************************************************
4728  * GPIO_PTOR - Port Toggle Output Register
4729  ******************************************************************************/
4730 
4731 /*!
4732  * @brief GPIO_PTOR - Port Toggle Output Register (WORZ)
4733  *
4734  * Reset value: 0x00000000U
4735  */
4736 /*!
4737  * @name Constants and macros for entire GPIO_PTOR register
4738  */
4739 /*@{*/
4740 #define GPIO_RD_PTOR(base) (GPIO_PTOR_REG(base))
4741 #define GPIO_WR_PTOR(base, value) (GPIO_PTOR_REG(base) = (value))
4742 #define GPIO_RMW_PTOR(base, mask, value) (GPIO_WR_PTOR(base, (GPIO_RD_PTOR(base) & ~(mask)) | (value)))
4743 /*@}*/
4744 
4745 /*******************************************************************************
4746  * GPIO_PDIR - Port Data Input Register
4747  ******************************************************************************/
4748 
4749 /*!
4750  * @brief GPIO_PDIR - Port Data Input Register (RO)
4751  *
4752  * Reset value: 0x00000000U
4753  *
4754  * Do not modify pin configuration registers associated with pins not available
4755  * in your selected package. All un-bonded pins not available in your package
4756  * will default to DISABLE state for lowest power consumption.
4757  */
4758 /*!
4759  * @name Constants and macros for entire GPIO_PDIR register
4760  */
4761 /*@{*/
4762 #define GPIO_RD_PDIR(base) (GPIO_PDIR_REG(base))
4763 /*@}*/
4764 
4765 /*******************************************************************************
4766  * GPIO_PDDR - Port Data Direction Register
4767  ******************************************************************************/
4768 
4769 /*!
4770  * @brief GPIO_PDDR - Port Data Direction Register (RW)
4771  *
4772  * Reset value: 0x00000000U
4773  *
4774  * The PDDR configures the individual port pins for input or output.
4775  */
4776 /*!
4777  * @name Constants and macros for entire GPIO_PDDR register
4778  */
4779 /*@{*/
4780 #define GPIO_RD_PDDR(base) (GPIO_PDDR_REG(base))
4781 #define GPIO_WR_PDDR(base, value) (GPIO_PDDR_REG(base) = (value))
4782 #define GPIO_RMW_PDDR(base, mask, value) (GPIO_WR_PDDR(base, (GPIO_RD_PDDR(base) & ~(mask)) | (value)))
4783 #define GPIO_SET_PDDR(base, value) (BME_OR32(&GPIO_PDDR_REG(base), (uint32_t)(value)))
4784 #define GPIO_CLR_PDDR(base, value) (BME_AND32(&GPIO_PDDR_REG(base), (uint32_t)(~(value))))
4785 #define GPIO_TOG_PDDR(base, value) (BME_XOR32(&GPIO_PDDR_REG(base), (uint32_t)(value)))
4786 /*@}*/
4787 
4788 /*
4789  * MKL25Z4 I2C
4790  *
4791  * Inter-Integrated Circuit
4792  *
4793  * Registers defined in this header file:
4794  * - I2C_A1 - I2C Address Register 1
4795  * - I2C_F - I2C Frequency Divider register
4796  * - I2C_C1 - I2C Control Register 1
4797  * - I2C_S - I2C Status register
4798  * - I2C_D - I2C Data I/O register
4799  * - I2C_C2 - I2C Control Register 2
4800  * - I2C_FLT - I2C Programmable Input Glitch Filter register
4801  * - I2C_RA - I2C Range Address register
4802  * - I2C_SMB - I2C SMBus Control and Status register
4803  * - I2C_A2 - I2C Address Register 2
4804  * - I2C_SLTH - I2C SCL Low Timeout Register High
4805  * - I2C_SLTL - I2C SCL Low Timeout Register Low
4806  */
4807 
4808 #define I2C_INSTANCE_COUNT (2U) /*!< Number of instances of the I2C module. */
4809 #define I2C0_IDX (0U) /*!< Instance number for I2C0. */
4810 #define I2C1_IDX (1U) /*!< Instance number for I2C1. */
4811 
4812 /*******************************************************************************
4813  * I2C_A1 - I2C Address Register 1
4814  ******************************************************************************/
4815 
4816 /*!
4817  * @brief I2C_A1 - I2C Address Register 1 (RW)
4818  *
4819  * Reset value: 0x00U
4820  *
4821  * This register contains the slave address to be used by the I2C module.
4822  */
4823 /*!
4824  * @name Constants and macros for entire I2C_A1 register
4825  */
4826 /*@{*/
4827 #define I2C_RD_A1(base) (I2C_A1_REG(base))
4828 #define I2C_WR_A1(base, value) (I2C_A1_REG(base) = (value))
4829 #define I2C_RMW_A1(base, mask, value) (I2C_WR_A1(base, (I2C_RD_A1(base) & ~(mask)) | (value)))
4830 #define I2C_SET_A1(base, value) (BME_OR8(&I2C_A1_REG(base), (uint8_t)(value)))
4831 #define I2C_CLR_A1(base, value) (BME_AND8(&I2C_A1_REG(base), (uint8_t)(~(value))))
4832 #define I2C_TOG_A1(base, value) (BME_XOR8(&I2C_A1_REG(base), (uint8_t)(value)))
4833 /*@}*/
4834 
4835 /*
4836  * Constants & macros for individual I2C_A1 bitfields
4837  */
4838 
4839 /*!
4840  * @name Register I2C_A1, field AD[7:1] (RW)
4841  *
4842  * Contains the primary slave address used by the I2C module when it is
4843  * addressed as a slave. This field is used in the 7-bit address scheme and the lower
4844  * seven bits in the 10-bit address scheme.
4845  */
4846 /*@{*/
4847 /*! @brief Read current value of the I2C_A1_AD field. */
4848 #define I2C_RD_A1_AD(base) ((I2C_A1_REG(base) & I2C_A1_AD_MASK) >> I2C_A1_AD_SHIFT)
4849 #define I2C_BRD_A1_AD(base) (BME_UBFX8(&I2C_A1_REG(base), I2C_A1_AD_SHIFT, I2C_A1_AD_WIDTH))
4850 
4851 /*! @brief Set the AD field to a new value. */
4852 #define I2C_WR_A1_AD(base, value) (I2C_RMW_A1(base, I2C_A1_AD_MASK, I2C_A1_AD(value)))
4853 #define I2C_BWR_A1_AD(base, value) (BME_BFI8(&I2C_A1_REG(base), ((uint8_t)(value) << I2C_A1_AD_SHIFT), I2C_A1_AD_SHIFT, I2C_A1_AD_WIDTH))
4854 /*@}*/
4855 
4856 /*******************************************************************************
4857  * I2C_F - I2C Frequency Divider register
4858  ******************************************************************************/
4859 
4860 /*!
4861  * @brief I2C_F - I2C Frequency Divider register (RW)
4862  *
4863  * Reset value: 0x00U
4864  */
4865 /*!
4866  * @name Constants and macros for entire I2C_F register
4867  */
4868 /*@{*/
4869 #define I2C_RD_F(base) (I2C_F_REG(base))
4870 #define I2C_WR_F(base, value) (I2C_F_REG(base) = (value))
4871 #define I2C_RMW_F(base, mask, value) (I2C_WR_F(base, (I2C_RD_F(base) & ~(mask)) | (value)))
4872 #define I2C_SET_F(base, value) (BME_OR8(&I2C_F_REG(base), (uint8_t)(value)))
4873 #define I2C_CLR_F(base, value) (BME_AND8(&I2C_F_REG(base), (uint8_t)(~(value))))
4874 #define I2C_TOG_F(base, value) (BME_XOR8(&I2C_F_REG(base), (uint8_t)(value)))
4875 /*@}*/
4876 
4877 /*
4878  * Constants & macros for individual I2C_F bitfields
4879  */
4880 
4881 /*!
4882  * @name Register I2C_F, field ICR[5:0] (RW)
4883  *
4884  * Prescales the bus clock for bit rate selection. This field and the MULT field
4885  * determine the I2C baud rate, the SDA hold time, the SCL start hold time, and
4886  * the SCL stop hold time. For a list of values corresponding to each ICR
4887  * setting, see I2C divider and hold values. The SCL divider multiplied by multiplier
4888  * factor (mul) determines the I2C baud rate. I2C baud rate = bus speed (Hz)/(mul *
4889  * SCL divider) The SDA hold time is the delay from the falling edge of SCL (I2C
4890  * clock) to the changing of SDA (I2C data). SDA hold time = bus period (s) *
4891  * mul * SDA hold value The SCL start hold time is the delay from the falling edge
4892  * of SDA (I2C data) while SCL is high (start condition) to the falling edge of
4893  * SCL (I2C clock). SCL start hold time = bus period (s) * mul * SCL start hold
4894  * value The SCL stop hold time is the delay from the rising edge of SCL (I2C
4895  * clock) to the rising edge of SDA (I2C data) while SCL is high (stop condition). SCL
4896  * stop hold time = bus period (s) * mul * SCL stop hold value For example, if
4897  * the bus speed is 8 MHz, the following table shows the possible hold time values
4898  * with different ICR and MULT selections to achieve an I2C baud rate of 100
4899  * kbps. MULT ICR Hold times (us) SDA SCL Start SCL Stop 2h 00h 3.500 3.000 5.500 1h
4900  * 07h 2.500 4.000 5.250 1h 0Bh 2.250 4.000 5.250 0h 14h 2.125 4.250 5.125 0h
4901  * 18h 1.125 4.750 5.125
4902  */
4903 /*@{*/
4904 /*! @brief Read current value of the I2C_F_ICR field. */
4905 #define I2C_RD_F_ICR(base) ((I2C_F_REG(base) & I2C_F_ICR_MASK) >> I2C_F_ICR_SHIFT)
4906 #define I2C_BRD_F_ICR(base) (BME_UBFX8(&I2C_F_REG(base), I2C_F_ICR_SHIFT, I2C_F_ICR_WIDTH))
4907 
4908 /*! @brief Set the ICR field to a new value. */
4909 #define I2C_WR_F_ICR(base, value) (I2C_RMW_F(base, I2C_F_ICR_MASK, I2C_F_ICR(value)))
4910 #define I2C_BWR_F_ICR(base, value) (BME_BFI8(&I2C_F_REG(base), ((uint8_t)(value) << I2C_F_ICR_SHIFT), I2C_F_ICR_SHIFT, I2C_F_ICR_WIDTH))
4911 /*@}*/
4912 
4913 /*!
4914  * @name Register I2C_F, field MULT[7:6] (RW)
4915  *
4916  * The MULT bits define the multiplier factor mul. This factor is used along
4917  * with the SCL divider to generate the I2C baud rate.
4918  *
4919  * Values:
4920  * - 0b00 - mul = 1
4921  * - 0b01 - mul = 2
4922  * - 0b10 - mul = 4
4923  * - 0b11 - Reserved
4924  */
4925 /*@{*/
4926 /*! @brief Read current value of the I2C_F_MULT field. */
4927 #define I2C_RD_F_MULT(base) ((I2C_F_REG(base) & I2C_F_MULT_MASK) >> I2C_F_MULT_SHIFT)
4928 #define I2C_BRD_F_MULT(base) (BME_UBFX8(&I2C_F_REG(base), I2C_F_MULT_SHIFT, I2C_F_MULT_WIDTH))
4929 
4930 /*! @brief Set the MULT field to a new value. */
4931 #define I2C_WR_F_MULT(base, value) (I2C_RMW_F(base, I2C_F_MULT_MASK, I2C_F_MULT(value)))
4932 #define I2C_BWR_F_MULT(base, value) (BME_BFI8(&I2C_F_REG(base), ((uint8_t)(value) << I2C_F_MULT_SHIFT), I2C_F_MULT_SHIFT, I2C_F_MULT_WIDTH))
4933 /*@}*/
4934 
4935 /*******************************************************************************
4936  * I2C_C1 - I2C Control Register 1
4937  ******************************************************************************/
4938 
4939 /*!
4940  * @brief I2C_C1 - I2C Control Register 1 (RW)
4941  *
4942  * Reset value: 0x00U
4943  */
4944 /*!
4945  * @name Constants and macros for entire I2C_C1 register
4946  */
4947 /*@{*/
4948 #define I2C_RD_C1(base) (I2C_C1_REG(base))
4949 #define I2C_WR_C1(base, value) (I2C_C1_REG(base) = (value))
4950 #define I2C_RMW_C1(base, mask, value) (I2C_WR_C1(base, (I2C_RD_C1(base) & ~(mask)) | (value)))
4951 #define I2C_SET_C1(base, value) (BME_OR8(&I2C_C1_REG(base), (uint8_t)(value)))
4952 #define I2C_CLR_C1(base, value) (BME_AND8(&I2C_C1_REG(base), (uint8_t)(~(value))))
4953 #define I2C_TOG_C1(base, value) (BME_XOR8(&I2C_C1_REG(base), (uint8_t)(value)))
4954 /*@}*/
4955 
4956 /*
4957  * Constants & macros for individual I2C_C1 bitfields
4958  */
4959 
4960 /*!
4961  * @name Register I2C_C1, field DMAEN[0] (RW)
4962  *
4963  * The DMAEN bit enables or disables the DMA function.
4964  *
4965  * Values:
4966  * - 0b0 - All DMA signalling disabled.
4967  * - 0b1 - DMA transfer is enabled and the following conditions trigger the DMA
4968  * request: While FACK = 0, a data byte is received, either address or data
4969  * is transmitted. (ACK/NACK automatic) While FACK = 0, the first byte
4970  * received matches the A1 register or is general call address. If any address
4971  * matching occurs, IAAS and TCF are set. If the direction of transfer is known
4972  * from master to slave, then it is not required to check the SRW. With this
4973  * assumption, DMA can also be used in this case. In other cases, if the master
4974  * reads data from the slave, then it is required to rewrite the C1 register
4975  * operation. With this assumption, DMA cannot be used. When FACK = 1, an
4976  * address or a data byte is transmitted.
4977  */
4978 /*@{*/
4979 /*! @brief Read current value of the I2C_C1_DMAEN field. */
4980 #define I2C_RD_C1_DMAEN(base) ((I2C_C1_REG(base) & I2C_C1_DMAEN_MASK) >> I2C_C1_DMAEN_SHIFT)
4981 #define I2C_BRD_C1_DMAEN(base) (BME_UBFX8(&I2C_C1_REG(base), I2C_C1_DMAEN_SHIFT, I2C_C1_DMAEN_WIDTH))
4982 
4983 /*! @brief Set the DMAEN field to a new value. */
4984 #define I2C_WR_C1_DMAEN(base, value) (I2C_RMW_C1(base, I2C_C1_DMAEN_MASK, I2C_C1_DMAEN(value)))
4985 #define I2C_BWR_C1_DMAEN(base, value) (BME_BFI8(&I2C_C1_REG(base), ((uint8_t)(value) << I2C_C1_DMAEN_SHIFT), I2C_C1_DMAEN_SHIFT, I2C_C1_DMAEN_WIDTH))
4986 /*@}*/
4987 
4988 /*!
4989  * @name Register I2C_C1, field WUEN[1] (RW)
4990  *
4991  * The I2C module can wake the MCU from low power mode with no peripheral bus
4992  * running when slave address matching occurs.
4993  *
4994  * Values:
4995  * - 0b0 - Normal operation. No interrupt generated when address matching in low
4996  * power mode.
4997  * - 0b1 - Enables the wakeup function in low power mode.
4998  */
4999 /*@{*/
5000 /*! @brief Read current value of the I2C_C1_WUEN field. */
5001 #define I2C_RD_C1_WUEN(base) ((I2C_C1_REG(base) & I2C_C1_WUEN_MASK) >> I2C_C1_WUEN_SHIFT)
5002 #define I2C_BRD_C1_WUEN(base) (BME_UBFX8(&I2C_C1_REG(base), I2C_C1_WUEN_SHIFT, I2C_C1_WUEN_WIDTH))
5003 
5004 /*! @brief Set the WUEN field to a new value. */
5005 #define I2C_WR_C1_WUEN(base, value) (I2C_RMW_C1(base, I2C_C1_WUEN_MASK, I2C_C1_WUEN(value)))
5006 #define I2C_BWR_C1_WUEN(base, value) (BME_BFI8(&I2C_C1_REG(base), ((uint8_t)(value) << I2C_C1_WUEN_SHIFT), I2C_C1_WUEN_SHIFT, I2C_C1_WUEN_WIDTH))
5007 /*@}*/
5008 
5009 /*!
5010  * @name Register I2C_C1, field RSTA[2] (WORZ)
5011  *
5012  * Writing a one to this bit generates a repeated START condition provided it is
5013  * the current master. This bit will always be read as zero. Attempting a repeat
5014  * at the wrong time results in loss of arbitration.
5015  */
5016 /*@{*/
5017 /*! @brief Set the RSTA field to a new value. */
5018 #define I2C_WR_C1_RSTA(base, value) (I2C_RMW_C1(base, I2C_C1_RSTA_MASK, I2C_C1_RSTA(value)))
5019 #define I2C_BWR_C1_RSTA(base, value) (BME_BFI8(&I2C_C1_REG(base), ((uint8_t)(value) << I2C_C1_RSTA_SHIFT), I2C_C1_RSTA_SHIFT, I2C_C1_RSTA_WIDTH))
5020 /*@}*/
5021 
5022 /*!
5023  * @name Register I2C_C1, field TXAK[3] (RW)
5024  *
5025  * Specifies the value driven onto the SDA during data acknowledge cycles for
5026  * both master and slave receivers. The value of the FACK bit affects NACK/ACK
5027  * generation. SCL is held low until TXAK is written.
5028  *
5029  * Values:
5030  * - 0b0 - An acknowledge signal is sent to the bus on the following receiving
5031  * byte (if FACK is cleared) or the current receiving byte (if FACK is set).
5032  * - 0b1 - No acknowledge signal is sent to the bus on the following receiving
5033  * data byte (if FACK is cleared) or the current receiving data byte (if FACK
5034  * is set).
5035  */
5036 /*@{*/
5037 /*! @brief Read current value of the I2C_C1_TXAK field. */
5038 #define I2C_RD_C1_TXAK(base) ((I2C_C1_REG(base) & I2C_C1_TXAK_MASK) >> I2C_C1_TXAK_SHIFT)
5039 #define I2C_BRD_C1_TXAK(base) (BME_UBFX8(&I2C_C1_REG(base), I2C_C1_TXAK_SHIFT, I2C_C1_TXAK_WIDTH))
5040 
5041 /*! @brief Set the TXAK field to a new value. */
5042 #define I2C_WR_C1_TXAK(base, value) (I2C_RMW_C1(base, I2C_C1_TXAK_MASK, I2C_C1_TXAK(value)))
5043 #define I2C_BWR_C1_TXAK(base, value) (BME_BFI8(&I2C_C1_REG(base), ((uint8_t)(value) << I2C_C1_TXAK_SHIFT), I2C_C1_TXAK_SHIFT, I2C_C1_TXAK_WIDTH))
5044 /*@}*/
5045 
5046 /*!
5047  * @name Register I2C_C1, field TX[4] (RW)
5048  *
5049  * Selects the direction of master and slave transfers. In master mode this bit
5050  * must be set according to the type of transfer required. Therefore, for address
5051  * cycles, this bit is always set. When addressed as a slave this bit must be
5052  * set by software according to the SRW bit in the status register.
5053  *
5054  * Values:
5055  * - 0b0 - Receive
5056  * - 0b1 - Transmit
5057  */
5058 /*@{*/
5059 /*! @brief Read current value of the I2C_C1_TX field. */
5060 #define I2C_RD_C1_TX(base) ((I2C_C1_REG(base) & I2C_C1_TX_MASK) >> I2C_C1_TX_SHIFT)
5061 #define I2C_BRD_C1_TX(base) (BME_UBFX8(&I2C_C1_REG(base), I2C_C1_TX_SHIFT, I2C_C1_TX_WIDTH))
5062 
5063 /*! @brief Set the TX field to a new value. */
5064 #define I2C_WR_C1_TX(base, value) (I2C_RMW_C1(base, I2C_C1_TX_MASK, I2C_C1_TX(value)))
5065 #define I2C_BWR_C1_TX(base, value) (BME_BFI8(&I2C_C1_REG(base), ((uint8_t)(value) << I2C_C1_TX_SHIFT), I2C_C1_TX_SHIFT, I2C_C1_TX_WIDTH))
5066 /*@}*/
5067 
5068 /*!
5069  * @name Register I2C_C1, field MST[5] (RW)
5070  *
5071  * When the MST bit is changed from a 0 to a 1, a START signal is generated on
5072  * the bus and master mode is selected. When this bit changes from a 1 to a 0, a
5073  * STOP signal is generated and the mode of operation changes from master to slave.
5074  *
5075  * Values:
5076  * - 0b0 - Slave mode
5077  * - 0b1 - Master mode
5078  */
5079 /*@{*/
5080 /*! @brief Read current value of the I2C_C1_MST field. */
5081 #define I2C_RD_C1_MST(base) ((I2C_C1_REG(base) & I2C_C1_MST_MASK) >> I2C_C1_MST_SHIFT)
5082 #define I2C_BRD_C1_MST(base) (BME_UBFX8(&I2C_C1_REG(base), I2C_C1_MST_SHIFT, I2C_C1_MST_WIDTH))
5083 
5084 /*! @brief Set the MST field to a new value. */
5085 #define I2C_WR_C1_MST(base, value) (I2C_RMW_C1(base, I2C_C1_MST_MASK, I2C_C1_MST(value)))
5086 #define I2C_BWR_C1_MST(base, value) (BME_BFI8(&I2C_C1_REG(base), ((uint8_t)(value) << I2C_C1_MST_SHIFT), I2C_C1_MST_SHIFT, I2C_C1_MST_WIDTH))
5087 /*@}*/
5088 
5089 /*!
5090  * @name Register I2C_C1, field IICIE[6] (RW)
5091  *
5092  * Enables I2C interrupt requests.
5093  *
5094  * Values:
5095  * - 0b0 - Disabled
5096  * - 0b1 - Enabled
5097  */
5098 /*@{*/
5099 /*! @brief Read current value of the I2C_C1_IICIE field. */
5100 #define I2C_RD_C1_IICIE(base) ((I2C_C1_REG(base) & I2C_C1_IICIE_MASK) >> I2C_C1_IICIE_SHIFT)
5101 #define I2C_BRD_C1_IICIE(base) (BME_UBFX8(&I2C_C1_REG(base), I2C_C1_IICIE_SHIFT, I2C_C1_IICIE_WIDTH))
5102 
5103 /*! @brief Set the IICIE field to a new value. */
5104 #define I2C_WR_C1_IICIE(base, value) (I2C_RMW_C1(base, I2C_C1_IICIE_MASK, I2C_C1_IICIE(value)))
5105 #define I2C_BWR_C1_IICIE(base, value) (BME_BFI8(&I2C_C1_REG(base), ((uint8_t)(value) << I2C_C1_IICIE_SHIFT), I2C_C1_IICIE_SHIFT, I2C_C1_IICIE_WIDTH))
5106 /*@}*/
5107 
5108 /*!
5109  * @name Register I2C_C1, field IICEN[7] (RW)
5110  *
5111  * Enables I2C module operation.
5112  *
5113  * Values:
5114  * - 0b0 - Disabled
5115  * - 0b1 - Enabled
5116  */
5117 /*@{*/
5118 /*! @brief Read current value of the I2C_C1_IICEN field. */
5119 #define I2C_RD_C1_IICEN(base) ((I2C_C1_REG(base) & I2C_C1_IICEN_MASK) >> I2C_C1_IICEN_SHIFT)
5120 #define I2C_BRD_C1_IICEN(base) (BME_UBFX8(&I2C_C1_REG(base), I2C_C1_IICEN_SHIFT, I2C_C1_IICEN_WIDTH))
5121 
5122 /*! @brief Set the IICEN field to a new value. */
5123 #define I2C_WR_C1_IICEN(base, value) (I2C_RMW_C1(base, I2C_C1_IICEN_MASK, I2C_C1_IICEN(value)))
5124 #define I2C_BWR_C1_IICEN(base, value) (BME_BFI8(&I2C_C1_REG(base), ((uint8_t)(value) << I2C_C1_IICEN_SHIFT), I2C_C1_IICEN_SHIFT, I2C_C1_IICEN_WIDTH))
5125 /*@}*/
5126 
5127 /*******************************************************************************
5128  * I2C_S - I2C Status register
5129  ******************************************************************************/
5130 
5131 /*!
5132  * @brief I2C_S - I2C Status register (RW)
5133  *
5134  * Reset value: 0x80U
5135  */
5136 /*!
5137  * @name Constants and macros for entire I2C_S register
5138  */
5139 /*@{*/
5140 #define I2C_RD_S(base) (I2C_S_REG(base))
5141 #define I2C_WR_S(base, value) (I2C_S_REG(base) = (value))
5142 #define I2C_RMW_S(base, mask, value) (I2C_WR_S(base, (I2C_RD_S(base) & ~(mask)) | (value)))
5143 #define I2C_SET_S(base, value) (BME_OR8(&I2C_S_REG(base), (uint8_t)(value)))
5144 #define I2C_CLR_S(base, value) (BME_AND8(&I2C_S_REG(base), (uint8_t)(~(value))))
5145 #define I2C_TOG_S(base, value) (BME_XOR8(&I2C_S_REG(base), (uint8_t)(value)))
5146 /*@}*/
5147 
5148 /*
5149  * Constants & macros for individual I2C_S bitfields
5150  */
5151 
5152 /*!
5153  * @name Register I2C_S, field RXAK[0] (RO)
5154  *
5155  * Values:
5156  * - 0b0 - Acknowledge signal was received after the completion of one byte of
5157  * data transmission on the bus
5158  * - 0b1 - No acknowledge signal detected
5159  */
5160 /*@{*/
5161 /*! @brief Read current value of the I2C_S_RXAK field. */
5162 #define I2C_RD_S_RXAK(base) ((I2C_S_REG(base) & I2C_S_RXAK_MASK) >> I2C_S_RXAK_SHIFT)
5163 #define I2C_BRD_S_RXAK(base) (BME_UBFX8(&I2C_S_REG(base), I2C_S_RXAK_SHIFT, I2C_S_RXAK_WIDTH))
5164 /*@}*/
5165 
5166 /*!
5167  * @name Register I2C_S, field IICIF[1] (W1C)
5168  *
5169  * This bit sets when an interrupt is pending. This bit must be cleared by
5170  * software by writing a 1 to it, such as in the interrupt routine. One of the
5171  * following events can set this bit: One byte transfer, including ACK/NACK bit,
5172  * completes if FACK is 0. An ACK or NACK is sent on the bus by writing 0 or 1 to TXAK
5173  * after this bit is set in receive mode. One byte transfer, excluding ACK/NACK
5174  * bit, completes if FACK is 1. Match of slave address to calling address including
5175  * primary slave address, range slave address , alert response address, second
5176  * slave address, or general call address. Arbitration lost In SMBus mode, any
5177  * timeouts except SCL and SDA high timeouts I2C bus stop detection if the STOPIE
5178  * bit in the Input Glitch Filter register is 1 To clear the I2C bus stop detection
5179  * interrupt: In the interrupt service routine, first clear the STOPF bit in the
5180  * Input Glitch Filter register by writing 1 to it, and then clear the IICIF
5181  * bit. If this sequence is reversed, the IICIF bit is asserted again.
5182  *
5183  * Values:
5184  * - 0b0 - No interrupt pending
5185  * - 0b1 - Interrupt pending
5186  */
5187 /*@{*/
5188 /*! @brief Read current value of the I2C_S_IICIF field. */
5189 #define I2C_RD_S_IICIF(base) ((I2C_S_REG(base) & I2C_S_IICIF_MASK) >> I2C_S_IICIF_SHIFT)
5190 #define I2C_BRD_S_IICIF(base) (BME_UBFX8(&I2C_S_REG(base), I2C_S_IICIF_SHIFT, I2C_S_IICIF_WIDTH))
5191 
5192 /*! @brief Set the IICIF field to a new value. */
5193 #define I2C_WR_S_IICIF(base, value) (I2C_RMW_S(base, (I2C_S_IICIF_MASK | I2C_S_ARBL_MASK), I2C_S_IICIF(value)))
5194 #define I2C_BWR_S_IICIF(base, value) (BME_BFI8(&I2C_S_REG(base), ((uint8_t)(value) << I2C_S_IICIF_SHIFT), I2C_S_IICIF_SHIFT, I2C_S_IICIF_WIDTH))
5195 /*@}*/
5196 
5197 /*!
5198  * @name Register I2C_S, field SRW[2] (RO)
5199  *
5200  * When addressed as a slave, SRW indicates the value of the R/W command bit of
5201  * the calling address sent to the master.
5202  *
5203  * Values:
5204  * - 0b0 - Slave receive, master writing to slave
5205  * - 0b1 - Slave transmit, master reading from slave
5206  */
5207 /*@{*/
5208 /*! @brief Read current value of the I2C_S_SRW field. */
5209 #define I2C_RD_S_SRW(base) ((I2C_S_REG(base) & I2C_S_SRW_MASK) >> I2C_S_SRW_SHIFT)
5210 #define I2C_BRD_S_SRW(base) (BME_UBFX8(&I2C_S_REG(base), I2C_S_SRW_SHIFT, I2C_S_SRW_WIDTH))
5211 /*@}*/
5212 
5213 /*!
5214  * @name Register I2C_S, field RAM[3] (RW)
5215  *
5216  * This bit is set to 1 by any of the following conditions: Any nonzero calling
5217  * address is received that matches the address in the RA register. The RMEN bit
5218  * is set and the calling address is within the range of values of the A1 and RA
5219  * registers. For the RAM bit to be set to 1 correctly, C1[IICIE] must be set to
5220  * 1. Writing the C1 register with any value clears this bit to 0.
5221  *
5222  * Values:
5223  * - 0b0 - Not addressed
5224  * - 0b1 - Addressed as a slave
5225  */
5226 /*@{*/
5227 /*! @brief Read current value of the I2C_S_RAM field. */
5228 #define I2C_RD_S_RAM(base) ((I2C_S_REG(base) & I2C_S_RAM_MASK) >> I2C_S_RAM_SHIFT)
5229 #define I2C_BRD_S_RAM(base) (BME_UBFX8(&I2C_S_REG(base), I2C_S_RAM_SHIFT, I2C_S_RAM_WIDTH))
5230 
5231 /*! @brief Set the RAM field to a new value. */
5232 #define I2C_WR_S_RAM(base, value) (I2C_RMW_S(base, (I2C_S_RAM_MASK | I2C_S_IICIF_MASK | I2C_S_ARBL_MASK), I2C_S_RAM(value)))
5233 #define I2C_BWR_S_RAM(base, value) (BME_BFI8(&I2C_S_REG(base), ((uint8_t)(value) << I2C_S_RAM_SHIFT), I2C_S_RAM_SHIFT, I2C_S_RAM_WIDTH))
5234 /*@}*/
5235 
5236 /*!
5237  * @name Register I2C_S, field ARBL[4] (W1C)
5238  *
5239  * This bit is set by hardware when the arbitration procedure is lost. The ARBL
5240  * bit must be cleared by software, by writing a one to it.
5241  *
5242  * Values:
5243  * - 0b0 - Standard bus operation.
5244  * - 0b1 - Loss of arbitration.
5245  */
5246 /*@{*/
5247 /*! @brief Read current value of the I2C_S_ARBL field. */
5248 #define I2C_RD_S_ARBL(base) ((I2C_S_REG(base) & I2C_S_ARBL_MASK) >> I2C_S_ARBL_SHIFT)
5249 #define I2C_BRD_S_ARBL(base) (BME_UBFX8(&I2C_S_REG(base), I2C_S_ARBL_SHIFT, I2C_S_ARBL_WIDTH))
5250 
5251 /*! @brief Set the ARBL field to a new value. */
5252 #define I2C_WR_S_ARBL(base, value) (I2C_RMW_S(base, (I2C_S_ARBL_MASK | I2C_S_IICIF_MASK), I2C_S_ARBL(value)))
5253 #define I2C_BWR_S_ARBL(base, value) (BME_BFI8(&I2C_S_REG(base), ((uint8_t)(value) << I2C_S_ARBL_SHIFT), I2C_S_ARBL_SHIFT, I2C_S_ARBL_WIDTH))
5254 /*@}*/
5255 
5256 /*!
5257  * @name Register I2C_S, field BUSY[5] (RO)
5258  *
5259  * Indicates the status of the bus regardless of slave or master mode. This bit
5260  * is set when a START signal is detected and cleared when a STOP signal is
5261  * detected.
5262  *
5263  * Values:
5264  * - 0b0 - Bus is idle
5265  * - 0b1 - Bus is busy
5266  */
5267 /*@{*/
5268 /*! @brief Read current value of the I2C_S_BUSY field. */
5269 #define I2C_RD_S_BUSY(base) ((I2C_S_REG(base) & I2C_S_BUSY_MASK) >> I2C_S_BUSY_SHIFT)
5270 #define I2C_BRD_S_BUSY(base) (BME_UBFX8(&I2C_S_REG(base), I2C_S_BUSY_SHIFT, I2C_S_BUSY_WIDTH))
5271 /*@}*/
5272 
5273 /*!
5274  * @name Register I2C_S, field IAAS[6] (RW)
5275  *
5276  * This bit is set by one of the following conditions: The calling address
5277  * matches the programmed slave primary address in the A1 register or range address in
5278  * the RA register (which must be set to a nonzero value). GCAEN is set and a
5279  * general call is received. SIICAEN is set and the calling address matches the
5280  * second programmed slave address. ALERTEN is set and an SMBus alert response
5281  * address is received RMEN is set and an address is received that is within the range
5282  * between the values of the A1 and RA registers. This bit sets before the ACK
5283  * bit. The CPU must check the SRW bit and set TX/RX accordingly. Writing the C1
5284  * register with any value clears this bit.
5285  *
5286  * Values:
5287  * - 0b0 - Not addressed
5288  * - 0b1 - Addressed as a slave
5289  */
5290 /*@{*/
5291 /*! @brief Read current value of the I2C_S_IAAS field. */
5292 #define I2C_RD_S_IAAS(base) ((I2C_S_REG(base) & I2C_S_IAAS_MASK) >> I2C_S_IAAS_SHIFT)
5293 #define I2C_BRD_S_IAAS(base) (BME_UBFX8(&I2C_S_REG(base), I2C_S_IAAS_SHIFT, I2C_S_IAAS_WIDTH))
5294 
5295 /*! @brief Set the IAAS field to a new value. */
5296 #define I2C_WR_S_IAAS(base, value) (I2C_RMW_S(base, (I2C_S_IAAS_MASK | I2C_S_IICIF_MASK | I2C_S_ARBL_MASK), I2C_S_IAAS(value)))
5297 #define I2C_BWR_S_IAAS(base, value) (BME_BFI8(&I2C_S_REG(base), ((uint8_t)(value) << I2C_S_IAAS_SHIFT), I2C_S_IAAS_SHIFT, I2C_S_IAAS_WIDTH))
5298 /*@}*/
5299 
5300 /*!
5301  * @name Register I2C_S, field TCF[7] (RO)
5302  *
5303  * This bit sets on the completion of a byte and acknowledge bit transfer. This
5304  * bit is valid only during or immediately following a transfer to or from the
5305  * I2C module. The TCF bit is cleared by reading the I2C data register in receive
5306  * mode or by writing to the I2C data register in transmit mode.
5307  *
5308  * Values:
5309  * - 0b0 - Transfer in progress
5310  * - 0b1 - Transfer complete
5311  */
5312 /*@{*/
5313 /*! @brief Read current value of the I2C_S_TCF field. */
5314 #define I2C_RD_S_TCF(base) ((I2C_S_REG(base) & I2C_S_TCF_MASK) >> I2C_S_TCF_SHIFT)
5315 #define I2C_BRD_S_TCF(base) (BME_UBFX8(&I2C_S_REG(base), I2C_S_TCF_SHIFT, I2C_S_TCF_WIDTH))
5316 /*@}*/
5317 
5318 /*******************************************************************************
5319  * I2C_D - I2C Data I/O register
5320  ******************************************************************************/
5321 
5322 /*!
5323  * @brief I2C_D - I2C Data I/O register (RW)
5324  *
5325  * Reset value: 0x00U
5326  */
5327 /*!
5328  * @name Constants and macros for entire I2C_D register
5329  */
5330 /*@{*/
5331 #define I2C_RD_D(base) (I2C_D_REG(base))
5332 #define I2C_WR_D(base, value) (I2C_D_REG(base) = (value))
5333 #define I2C_RMW_D(base, mask, value) (I2C_WR_D(base, (I2C_RD_D(base) & ~(mask)) | (value)))
5334 #define I2C_SET_D(base, value) (BME_OR8(&I2C_D_REG(base), (uint8_t)(value)))
5335 #define I2C_CLR_D(base, value) (BME_AND8(&I2C_D_REG(base), (uint8_t)(~(value))))
5336 #define I2C_TOG_D(base, value) (BME_XOR8(&I2C_D_REG(base), (uint8_t)(value)))
5337 /*@}*/
5338 
5339 /*******************************************************************************
5340  * I2C_C2 - I2C Control Register 2
5341  ******************************************************************************/
5342 
5343 /*!
5344  * @brief I2C_C2 - I2C Control Register 2 (RW)
5345  *
5346  * Reset value: 0x00U
5347  */
5348 /*!
5349  * @name Constants and macros for entire I2C_C2 register
5350  */
5351 /*@{*/
5352 #define I2C_RD_C2(base) (I2C_C2_REG(base))
5353 #define I2C_WR_C2(base, value) (I2C_C2_REG(base) = (value))
5354 #define I2C_RMW_C2(base, mask, value) (I2C_WR_C2(base, (I2C_RD_C2(base) & ~(mask)) | (value)))
5355 #define I2C_SET_C2(base, value) (BME_OR8(&I2C_C2_REG(base), (uint8_t)(value)))
5356 #define I2C_CLR_C2(base, value) (BME_AND8(&I2C_C2_REG(base), (uint8_t)(~(value))))
5357 #define I2C_TOG_C2(base, value) (BME_XOR8(&I2C_C2_REG(base), (uint8_t)(value)))
5358 /*@}*/
5359 
5360 /*
5361  * Constants & macros for individual I2C_C2 bitfields
5362  */
5363 
5364 /*!
5365  * @name Register I2C_C2, field AD[2:0] (RW)
5366  *
5367  * Contains the upper three bits of the slave address in the 10-bit address
5368  * scheme. This field is valid only while the ADEXT bit is set.
5369  */
5370 /*@{*/
5371 /*! @brief Read current value of the I2C_C2_AD field. */
5372 #define I2C_RD_C2_AD(base) ((I2C_C2_REG(base) & I2C_C2_AD_MASK) >> I2C_C2_AD_SHIFT)
5373 #define I2C_BRD_C2_AD(base) (BME_UBFX8(&I2C_C2_REG(base), I2C_C2_AD_SHIFT, I2C_C2_AD_WIDTH))
5374 
5375 /*! @brief Set the AD field to a new value. */
5376 #define I2C_WR_C2_AD(base, value) (I2C_RMW_C2(base, I2C_C2_AD_MASK, I2C_C2_AD(value)))
5377 #define I2C_BWR_C2_AD(base, value) (BME_BFI8(&I2C_C2_REG(base), ((uint8_t)(value) << I2C_C2_AD_SHIFT), I2C_C2_AD_SHIFT, I2C_C2_AD_WIDTH))
5378 /*@}*/
5379 
5380 /*!
5381  * @name Register I2C_C2, field RMEN[3] (RW)
5382  *
5383  * This bit controls slave address matching for addresses between the values of
5384  * the A1 and RA registers. When this bit is set, a slave address match occurs
5385  * for any address greater than the value of the A1 register and less than or equal
5386  * to the value of the RA register.
5387  *
5388  * Values:
5389  * - 0b0 - Range mode disabled. No address match occurs for an address within
5390  * the range of values of the A1 and RA registers.
5391  * - 0b1 - Range mode enabled. Address matching occurs when a slave receives an
5392  * address within the range of values of the A1 and RA registers.
5393  */
5394 /*@{*/
5395 /*! @brief Read current value of the I2C_C2_RMEN field. */
5396 #define I2C_RD_C2_RMEN(base) ((I2C_C2_REG(base) & I2C_C2_RMEN_MASK) >> I2C_C2_RMEN_SHIFT)
5397 #define I2C_BRD_C2_RMEN(base) (BME_UBFX8(&I2C_C2_REG(base), I2C_C2_RMEN_SHIFT, I2C_C2_RMEN_WIDTH))
5398 
5399 /*! @brief Set the RMEN field to a new value. */
5400 #define I2C_WR_C2_RMEN(base, value) (I2C_RMW_C2(base, I2C_C2_RMEN_MASK, I2C_C2_RMEN(value)))
5401 #define I2C_BWR_C2_RMEN(base, value) (BME_BFI8(&I2C_C2_REG(base), ((uint8_t)(value) << I2C_C2_RMEN_SHIFT), I2C_C2_RMEN_SHIFT, I2C_C2_RMEN_WIDTH))
5402 /*@}*/
5403 
5404 /*!
5405  * @name Register I2C_C2, field SBRC[4] (RW)
5406  *
5407  * Enables independent slave mode baud rate at maximum frequency, which forces
5408  * clock stretching on SCL in very fast I2C modes. To a slave, an example of a
5409  * "very fast" mode is when the master transfers at 40 kbps but the slave can
5410  * capture the master's data at only 10 kbps.
5411  *
5412  * Values:
5413  * - 0b0 - The slave baud rate follows the master baud rate and clock stretching
5414  * may occur
5415  * - 0b1 - Slave baud rate is independent of the master baud rate
5416  */
5417 /*@{*/
5418 /*! @brief Read current value of the I2C_C2_SBRC field. */
5419 #define I2C_RD_C2_SBRC(base) ((I2C_C2_REG(base) & I2C_C2_SBRC_MASK) >> I2C_C2_SBRC_SHIFT)
5420 #define I2C_BRD_C2_SBRC(base) (BME_UBFX8(&I2C_C2_REG(base), I2C_C2_SBRC_SHIFT, I2C_C2_SBRC_WIDTH))
5421 
5422 /*! @brief Set the SBRC field to a new value. */
5423 #define I2C_WR_C2_SBRC(base, value) (I2C_RMW_C2(base, I2C_C2_SBRC_MASK, I2C_C2_SBRC(value)))
5424 #define I2C_BWR_C2_SBRC(base, value) (BME_BFI8(&I2C_C2_REG(base), ((uint8_t)(value) << I2C_C2_SBRC_SHIFT), I2C_C2_SBRC_SHIFT, I2C_C2_SBRC_WIDTH))
5425 /*@}*/
5426 
5427 /*!
5428  * @name Register I2C_C2, field HDRS[5] (RW)
5429  *
5430  * Controls the drive capability of the I2C pads.
5431  *
5432  * Values:
5433  * - 0b0 - Normal drive mode
5434  * - 0b1 - High drive mode
5435  */
5436 /*@{*/
5437 /*! @brief Read current value of the I2C_C2_HDRS field. */
5438 #define I2C_RD_C2_HDRS(base) ((I2C_C2_REG(base) & I2C_C2_HDRS_MASK) >> I2C_C2_HDRS_SHIFT)
5439 #define I2C_BRD_C2_HDRS(base) (BME_UBFX8(&I2C_C2_REG(base), I2C_C2_HDRS_SHIFT, I2C_C2_HDRS_WIDTH))
5440 
5441 /*! @brief Set the HDRS field to a new value. */
5442 #define I2C_WR_C2_HDRS(base, value) (I2C_RMW_C2(base, I2C_C2_HDRS_MASK, I2C_C2_HDRS(value)))
5443 #define I2C_BWR_C2_HDRS(base, value) (BME_BFI8(&I2C_C2_REG(base), ((uint8_t)(value) << I2C_C2_HDRS_SHIFT), I2C_C2_HDRS_SHIFT, I2C_C2_HDRS_WIDTH))
5444 /*@}*/
5445 
5446 /*!
5447  * @name Register I2C_C2, field ADEXT[6] (RW)
5448  *
5449  * Controls the number of bits used for the slave address.
5450  *
5451  * Values:
5452  * - 0b0 - 7-bit address scheme
5453  * - 0b1 - 10-bit address scheme
5454  */
5455 /*@{*/
5456 /*! @brief Read current value of the I2C_C2_ADEXT field. */
5457 #define I2C_RD_C2_ADEXT(base) ((I2C_C2_REG(base) & I2C_C2_ADEXT_MASK) >> I2C_C2_ADEXT_SHIFT)
5458 #define I2C_BRD_C2_ADEXT(base) (BME_UBFX8(&I2C_C2_REG(base), I2C_C2_ADEXT_SHIFT, I2C_C2_ADEXT_WIDTH))
5459 
5460 /*! @brief Set the ADEXT field to a new value. */
5461 #define I2C_WR_C2_ADEXT(base, value) (I2C_RMW_C2(base, I2C_C2_ADEXT_MASK, I2C_C2_ADEXT(value)))
5462 #define I2C_BWR_C2_ADEXT(base, value) (BME_BFI8(&I2C_C2_REG(base), ((uint8_t)(value) << I2C_C2_ADEXT_SHIFT), I2C_C2_ADEXT_SHIFT, I2C_C2_ADEXT_WIDTH))
5463 /*@}*/
5464 
5465 /*!
5466  * @name Register I2C_C2, field GCAEN[7] (RW)
5467  *
5468  * Enables general call address.
5469  *
5470  * Values:
5471  * - 0b0 - Disabled
5472  * - 0b1 - Enabled
5473  */
5474 /*@{*/
5475 /*! @brief Read current value of the I2C_C2_GCAEN field. */
5476 #define I2C_RD_C2_GCAEN(base) ((I2C_C2_REG(base) & I2C_C2_GCAEN_MASK) >> I2C_C2_GCAEN_SHIFT)
5477 #define I2C_BRD_C2_GCAEN(base) (BME_UBFX8(&I2C_C2_REG(base), I2C_C2_GCAEN_SHIFT, I2C_C2_GCAEN_WIDTH))
5478 
5479 /*! @brief Set the GCAEN field to a new value. */
5480 #define I2C_WR_C2_GCAEN(base, value) (I2C_RMW_C2(base, I2C_C2_GCAEN_MASK, I2C_C2_GCAEN(value)))
5481 #define I2C_BWR_C2_GCAEN(base, value) (BME_BFI8(&I2C_C2_REG(base), ((uint8_t)(value) << I2C_C2_GCAEN_SHIFT), I2C_C2_GCAEN_SHIFT, I2C_C2_GCAEN_WIDTH))
5482 /*@}*/
5483 
5484 /*******************************************************************************
5485  * I2C_FLT - I2C Programmable Input Glitch Filter register
5486  ******************************************************************************/
5487 
5488 /*!
5489  * @brief I2C_FLT - I2C Programmable Input Glitch Filter register (RW)
5490  *
5491  * Reset value: 0x00U
5492  */
5493 /*!
5494  * @name Constants and macros for entire I2C_FLT register
5495  */
5496 /*@{*/
5497 #define I2C_RD_FLT(base) (I2C_FLT_REG(base))
5498 #define I2C_WR_FLT(base, value) (I2C_FLT_REG(base) = (value))
5499 #define I2C_RMW_FLT(base, mask, value) (I2C_WR_FLT(base, (I2C_RD_FLT(base) & ~(mask)) | (value)))
5500 #define I2C_SET_FLT(base, value) (BME_OR8(&I2C_FLT_REG(base), (uint8_t)(value)))
5501 #define I2C_CLR_FLT(base, value) (BME_AND8(&I2C_FLT_REG(base), (uint8_t)(~(value))))
5502 #define I2C_TOG_FLT(base, value) (BME_XOR8(&I2C_FLT_REG(base), (uint8_t)(value)))
5503 /*@}*/
5504 
5505 /*
5506  * Constants & macros for individual I2C_FLT bitfields
5507  */
5508 
5509 /*!
5510  * @name Register I2C_FLT, field FLT[4:0] (RW)
5511  *
5512  * Controls the width of the glitch, in terms of bus clock cycles, that the
5513  * filter must absorb. For any glitch whose size is less than or equal to this width
5514  * setting, the filter does not allow the glitch to pass.
5515  *
5516  * Values:
5517  * - 0b00000 - No filter/bypass
5518  */
5519 /*@{*/
5520 /*! @brief Read current value of the I2C_FLT_FLT field. */
5521 #define I2C_RD_FLT_FLT(base) ((I2C_FLT_REG(base) & I2C_FLT_FLT_MASK) >> I2C_FLT_FLT_SHIFT)
5522 #define I2C_BRD_FLT_FLT(base) (BME_UBFX8(&I2C_FLT_REG(base), I2C_FLT_FLT_SHIFT, I2C_FLT_FLT_WIDTH))
5523 
5524 /*! @brief Set the FLT field to a new value. */
5525 #define I2C_WR_FLT_FLT(base, value) (I2C_RMW_FLT(base, (I2C_FLT_FLT_MASK | I2C_FLT_STOPF_MASK), I2C_FLT_FLT(value)))
5526 #define I2C_BWR_FLT_FLT(base, value) (BME_BFI8(&I2C_FLT_REG(base), ((uint8_t)(value) << I2C_FLT_FLT_SHIFT), I2C_FLT_FLT_SHIFT, I2C_FLT_FLT_WIDTH))
5527 /*@}*/
5528 
5529 /*!
5530  * @name Register I2C_FLT, field STOPIE[5] (RW)
5531  *
5532  * This bit enables the interrupt for I2C bus stop detection. To clear the I2C
5533  * bus stop detection interrupt: In the interrupt service routine, first clear the
5534  * STOPF bit by writing 1 to it, and then clear the IICIF bit in the status
5535  * register. If this sequence is reversed, the IICIF bit is asserted again.
5536  *
5537  * Values:
5538  * - 0b0 - Stop detection interrupt is disabled
5539  * - 0b1 - Stop detection interrupt is enabled
5540  */
5541 /*@{*/
5542 /*! @brief Read current value of the I2C_FLT_STOPIE field. */
5543 #define I2C_RD_FLT_STOPIE(base) ((I2C_FLT_REG(base) & I2C_FLT_STOPIE_MASK) >> I2C_FLT_STOPIE_SHIFT)
5544 #define I2C_BRD_FLT_STOPIE(base) (BME_UBFX8(&I2C_FLT_REG(base), I2C_FLT_STOPIE_SHIFT, I2C_FLT_STOPIE_WIDTH))
5545 
5546 /*! @brief Set the STOPIE field to a new value. */
5547 #define I2C_WR_FLT_STOPIE(base, value) (I2C_RMW_FLT(base, (I2C_FLT_STOPIE_MASK | I2C_FLT_STOPF_MASK), I2C_FLT_STOPIE(value)))
5548 #define I2C_BWR_FLT_STOPIE(base, value) (BME_BFI8(&I2C_FLT_REG(base), ((uint8_t)(value) << I2C_FLT_STOPIE_SHIFT), I2C_FLT_STOPIE_SHIFT, I2C_FLT_STOPIE_WIDTH))
5549 /*@}*/
5550 
5551 /*!
5552  * @name Register I2C_FLT, field STOPF[6] (W1C)
5553  *
5554  * Hardware sets this bit when the I2C bus's stop status is detected. The STOPF
5555  * bit must be cleared by writing 1 to it.
5556  *
5557  * Values:
5558  * - 0b0 - No stop happens on I2C bus
5559  * - 0b1 - Stop detected on I2C bus
5560  */
5561 /*@{*/
5562 /*! @brief Read current value of the I2C_FLT_STOPF field. */
5563 #define I2C_RD_FLT_STOPF(base) ((I2C_FLT_REG(base) & I2C_FLT_STOPF_MASK) >> I2C_FLT_STOPF_SHIFT)
5564 #define I2C_BRD_FLT_STOPF(base) (BME_UBFX8(&I2C_FLT_REG(base), I2C_FLT_STOPF_SHIFT, I2C_FLT_STOPF_WIDTH))
5565 
5566 /*! @brief Set the STOPF field to a new value. */
5567 #define I2C_WR_FLT_STOPF(base, value) (I2C_RMW_FLT(base, I2C_FLT_STOPF_MASK, I2C_FLT_STOPF(value)))
5568 #define I2C_BWR_FLT_STOPF(base, value) (BME_BFI8(&I2C_FLT_REG(base), ((uint8_t)(value) << I2C_FLT_STOPF_SHIFT), I2C_FLT_STOPF_SHIFT, I2C_FLT_STOPF_WIDTH))
5569 /*@}*/
5570 
5571 /*!
5572  * @name Register I2C_FLT, field SHEN[7] (RW)
5573  *
5574  * Set this bit to hold off entry to stop mode when any data transmission or
5575  * reception is occurring. The following scenario explains the holdoff
5576  * functionality: The I2C module is configured for a basic transfer, and the SHEN bit is set
5577  * to 1. A transfer begins. The MCU signals the I2C module to enter stop mode. The
5578  * byte currently being transferred, including both address and data, completes
5579  * its transfer. The I2C slave or master acknowledges that the in-transfer byte
5580  * completed its transfer and acknowledges the request to enter stop mode. After
5581  * receiving the I2C module's acknowledgment of the request to enter stop mode,
5582  * the MCU determines whether to shut off the I2C module's clock. If the SHEN bit
5583  * is set to 1 and the I2C module is in an idle or disabled state when the MCU
5584  * signals to enter stop mode, the module immediately acknowledges the request to
5585  * enter stop mode. If SHEN is cleared to 0 and the overall data transmission or
5586  * reception that was suspended by stop mode entry was incomplete: To resume the
5587  * overall transmission or reception after the MCU exits stop mode, software must
5588  * reinitialize the transfer by resending the address of the slave. If the I2C
5589  * Control Register 1's IICIE bit was set to 1 before the MCU entered stop mode,
5590  * system software will receive the interrupt triggered by the I2C Status Register's
5591  * TCF bit after the MCU wakes from the stop mode.
5592  *
5593  * Values:
5594  * - 0b0 - Stop holdoff is disabled. The MCU's entry to stop mode is not gated.
5595  * - 0b1 - Stop holdoff is enabled.
5596  */
5597 /*@{*/
5598 /*! @brief Read current value of the I2C_FLT_SHEN field. */
5599 #define I2C_RD_FLT_SHEN(base) ((I2C_FLT_REG(base) & I2C_FLT_SHEN_MASK) >> I2C_FLT_SHEN_SHIFT)
5600 #define I2C_BRD_FLT_SHEN(base) (BME_UBFX8(&I2C_FLT_REG(base), I2C_FLT_SHEN_SHIFT, I2C_FLT_SHEN_WIDTH))
5601 
5602 /*! @brief Set the SHEN field to a new value. */
5603 #define I2C_WR_FLT_SHEN(base, value) (I2C_RMW_FLT(base, (I2C_FLT_SHEN_MASK | I2C_FLT_STOPF_MASK), I2C_FLT_SHEN(value)))
5604 #define I2C_BWR_FLT_SHEN(base, value) (BME_BFI8(&I2C_FLT_REG(base), ((uint8_t)(value) << I2C_FLT_SHEN_SHIFT), I2C_FLT_SHEN_SHIFT, I2C_FLT_SHEN_WIDTH))
5605 /*@}*/
5606 
5607 /*******************************************************************************
5608  * I2C_RA - I2C Range Address register
5609  ******************************************************************************/
5610 
5611 /*!
5612  * @brief I2C_RA - I2C Range Address register (RW)
5613  *
5614  * Reset value: 0x00U
5615  */
5616 /*!
5617  * @name Constants and macros for entire I2C_RA register
5618  */
5619 /*@{*/
5620 #define I2C_RD_RA(base) (I2C_RA_REG(base))
5621 #define I2C_WR_RA(base, value) (I2C_RA_REG(base) = (value))
5622 #define I2C_RMW_RA(base, mask, value) (I2C_WR_RA(base, (I2C_RD_RA(base) & ~(mask)) | (value)))
5623 #define I2C_SET_RA(base, value) (BME_OR8(&I2C_RA_REG(base), (uint8_t)(value)))
5624 #define I2C_CLR_RA(base, value) (BME_AND8(&I2C_RA_REG(base), (uint8_t)(~(value))))
5625 #define I2C_TOG_RA(base, value) (BME_XOR8(&I2C_RA_REG(base), (uint8_t)(value)))
5626 /*@}*/
5627 
5628 /*
5629  * Constants & macros for individual I2C_RA bitfields
5630  */
5631 
5632 /*!
5633  * @name Register I2C_RA, field RAD[7:1] (RW)
5634  *
5635  * This field contains the slave address to be used by the I2C module. The field
5636  * is used in the 7-bit address scheme. Any nonzero write enables this register.
5637  * This register's use is similar to that of the A1 register, but in addition
5638  * this register can be considered a maximum boundary in range matching mode.
5639  */
5640 /*@{*/
5641 /*! @brief Read current value of the I2C_RA_RAD field. */
5642 #define I2C_RD_RA_RAD(base) ((I2C_RA_REG(base) & I2C_RA_RAD_MASK) >> I2C_RA_RAD_SHIFT)
5643 #define I2C_BRD_RA_RAD(base) (BME_UBFX8(&I2C_RA_REG(base), I2C_RA_RAD_SHIFT, I2C_RA_RAD_WIDTH))
5644 
5645 /*! @brief Set the RAD field to a new value. */
5646 #define I2C_WR_RA_RAD(base, value) (I2C_RMW_RA(base, I2C_RA_RAD_MASK, I2C_RA_RAD(value)))
5647 #define I2C_BWR_RA_RAD(base, value) (BME_BFI8(&I2C_RA_REG(base), ((uint8_t)(value) << I2C_RA_RAD_SHIFT), I2C_RA_RAD_SHIFT, I2C_RA_RAD_WIDTH))
5648 /*@}*/
5649 
5650 /*******************************************************************************
5651  * I2C_SMB - I2C SMBus Control and Status register
5652  ******************************************************************************/
5653 
5654 /*!
5655  * @brief I2C_SMB - I2C SMBus Control and Status register (RW)
5656  *
5657  * Reset value: 0x00U
5658  *
5659  * When the SCL and SDA signals are held high for a length of time greater than
5660  * the high timeout period, the SHTF1 flag sets. Before reaching this threshold,
5661  * while the system is detecting how long these signals are being held high, a
5662  * master assumes that the bus is free. However, the SHTF1 bit rises in the bus
5663  * transmission process with the idle bus state. When the TCKSEL bit is set, there
5664  * is no need to monitor the SHTF1 bit because the bus speed is too high to match
5665  * the protocol of SMBus.
5666  */
5667 /*!
5668  * @name Constants and macros for entire I2C_SMB register
5669  */
5670 /*@{*/
5671 #define I2C_RD_SMB(base) (I2C_SMB_REG(base))
5672 #define I2C_WR_SMB(base, value) (I2C_SMB_REG(base) = (value))
5673 #define I2C_RMW_SMB(base, mask, value) (I2C_WR_SMB(base, (I2C_RD_SMB(base) & ~(mask)) | (value)))
5674 #define I2C_SET_SMB(base, value) (BME_OR8(&I2C_SMB_REG(base), (uint8_t)(value)))
5675 #define I2C_CLR_SMB(base, value) (BME_AND8(&I2C_SMB_REG(base), (uint8_t)(~(value))))
5676 #define I2C_TOG_SMB(base, value) (BME_XOR8(&I2C_SMB_REG(base), (uint8_t)(value)))
5677 /*@}*/
5678 
5679 /*
5680  * Constants & macros for individual I2C_SMB bitfields
5681  */
5682 
5683 /*!
5684  * @name Register I2C_SMB, field SHTF2IE[0] (RW)
5685  *
5686  * Enables SCL high and SDA low timeout interrupt.
5687  *
5688  * Values:
5689  * - 0b0 - SHTF2 interrupt is disabled
5690  * - 0b1 - SHTF2 interrupt is enabled
5691  */
5692 /*@{*/
5693 /*! @brief Read current value of the I2C_SMB_SHTF2IE field. */
5694 #define I2C_RD_SMB_SHTF2IE(base) ((I2C_SMB_REG(base) & I2C_SMB_SHTF2IE_MASK) >> I2C_SMB_SHTF2IE_SHIFT)
5695 #define I2C_BRD_SMB_SHTF2IE(base) (BME_UBFX8(&I2C_SMB_REG(base), I2C_SMB_SHTF2IE_SHIFT, I2C_SMB_SHTF2IE_WIDTH))
5696 
5697 /*! @brief Set the SHTF2IE field to a new value. */
5698 #define I2C_WR_SMB_SHTF2IE(base, value) (I2C_RMW_SMB(base, (I2C_SMB_SHTF2IE_MASK | I2C_SMB_SHTF2_MASK | I2C_SMB_SLTF_MASK), I2C_SMB_SHTF2IE(value)))
5699 #define I2C_BWR_SMB_SHTF2IE(base, value) (BME_BFI8(&I2C_SMB_REG(base), ((uint8_t)(value) << I2C_SMB_SHTF2IE_SHIFT), I2C_SMB_SHTF2IE_SHIFT, I2C_SMB_SHTF2IE_WIDTH))
5700 /*@}*/
5701 
5702 /*!
5703  * @name Register I2C_SMB, field SHTF2[1] (W1C)
5704  *
5705  * This bit sets when SCL is held high and SDA is held low more than clock *
5706  * LoValue/512. Software clears this bit by writing a 1 to it.
5707  *
5708  * Values:
5709  * - 0b0 - No SCL high and SDA low timeout occurs
5710  * - 0b1 - SCL high and SDA low timeout occurs
5711  */
5712 /*@{*/
5713 /*! @brief Read current value of the I2C_SMB_SHTF2 field. */
5714 #define I2C_RD_SMB_SHTF2(base) ((I2C_SMB_REG(base) & I2C_SMB_SHTF2_MASK) >> I2C_SMB_SHTF2_SHIFT)
5715 #define I2C_BRD_SMB_SHTF2(base) (BME_UBFX8(&I2C_SMB_REG(base), I2C_SMB_SHTF2_SHIFT, I2C_SMB_SHTF2_WIDTH))
5716 
5717 /*! @brief Set the SHTF2 field to a new value. */
5718 #define I2C_WR_SMB_SHTF2(base, value) (I2C_RMW_SMB(base, (I2C_SMB_SHTF2_MASK | I2C_SMB_SLTF_MASK), I2C_SMB_SHTF2(value)))
5719 #define I2C_BWR_SMB_SHTF2(base, value) (BME_BFI8(&I2C_SMB_REG(base), ((uint8_t)(value) << I2C_SMB_SHTF2_SHIFT), I2C_SMB_SHTF2_SHIFT, I2C_SMB_SHTF2_WIDTH))
5720 /*@}*/
5721 
5722 /*!
5723  * @name Register I2C_SMB, field SHTF1[2] (RO)
5724  *
5725  * This read-only bit sets when SCL and SDA are held high more than clock *
5726  * LoValue / 512, which indicates the bus is free. This bit is cleared automatically.
5727  *
5728  * Values:
5729  * - 0b0 - No SCL high and SDA high timeout occurs
5730  * - 0b1 - SCL high and SDA high timeout occurs
5731  */
5732 /*@{*/
5733 /*! @brief Read current value of the I2C_SMB_SHTF1 field. */
5734 #define I2C_RD_SMB_SHTF1(base) ((I2C_SMB_REG(base) & I2C_SMB_SHTF1_MASK) >> I2C_SMB_SHTF1_SHIFT)
5735 #define I2C_BRD_SMB_SHTF1(base) (BME_UBFX8(&I2C_SMB_REG(base), I2C_SMB_SHTF1_SHIFT, I2C_SMB_SHTF1_WIDTH))
5736 /*@}*/
5737 
5738 /*!
5739  * @name Register I2C_SMB, field SLTF[3] (W1C)
5740  *
5741  * This bit is set when the SLT register (consisting of the SLTH and SLTL
5742  * registers) is loaded with a non-zero value (LoValue) and an SCL low timeout occurs.
5743  * Software clears this bit by writing a logic 1 to it. The low timeout function
5744  * is disabled when the SLT register's value is zero.
5745  *
5746  * Values:
5747  * - 0b0 - No low timeout occurs
5748  * - 0b1 - Low timeout occurs
5749  */
5750 /*@{*/
5751 /*! @brief Read current value of the I2C_SMB_SLTF field. */
5752 #define I2C_RD_SMB_SLTF(base) ((I2C_SMB_REG(base) & I2C_SMB_SLTF_MASK) >> I2C_SMB_SLTF_SHIFT)
5753 #define I2C_BRD_SMB_SLTF(base) (BME_UBFX8(&I2C_SMB_REG(base), I2C_SMB_SLTF_SHIFT, I2C_SMB_SLTF_WIDTH))
5754 
5755 /*! @brief Set the SLTF field to a new value. */
5756 #define I2C_WR_SMB_SLTF(base, value) (I2C_RMW_SMB(base, (I2C_SMB_SLTF_MASK | I2C_SMB_SHTF2_MASK), I2C_SMB_SLTF(value)))
5757 #define I2C_BWR_SMB_SLTF(base, value) (BME_BFI8(&I2C_SMB_REG(base), ((uint8_t)(value) << I2C_SMB_SLTF_SHIFT), I2C_SMB_SLTF_SHIFT, I2C_SMB_SLTF_WIDTH))
5758 /*@}*/
5759 
5760 /*!
5761  * @name Register I2C_SMB, field TCKSEL[4] (RW)
5762  *
5763  * Selects the clock source of the timeout counter.
5764  *
5765  * Values:
5766  * - 0b0 - Timeout counter counts at the frequency of the bus clock / 64
5767  * - 0b1 - Timeout counter counts at the frequency of the bus clock
5768  */
5769 /*@{*/
5770 /*! @brief Read current value of the I2C_SMB_TCKSEL field. */
5771 #define I2C_RD_SMB_TCKSEL(base) ((I2C_SMB_REG(base) & I2C_SMB_TCKSEL_MASK) >> I2C_SMB_TCKSEL_SHIFT)
5772 #define I2C_BRD_SMB_TCKSEL(base) (BME_UBFX8(&I2C_SMB_REG(base), I2C_SMB_TCKSEL_SHIFT, I2C_SMB_TCKSEL_WIDTH))
5773 
5774 /*! @brief Set the TCKSEL field to a new value. */
5775 #define I2C_WR_SMB_TCKSEL(base, value) (I2C_RMW_SMB(base, (I2C_SMB_TCKSEL_MASK | I2C_SMB_SHTF2_MASK | I2C_SMB_SLTF_MASK), I2C_SMB_TCKSEL(value)))
5776 #define I2C_BWR_SMB_TCKSEL(base, value) (BME_BFI8(&I2C_SMB_REG(base), ((uint8_t)(value) << I2C_SMB_TCKSEL_SHIFT), I2C_SMB_TCKSEL_SHIFT, I2C_SMB_TCKSEL_WIDTH))
5777 /*@}*/
5778 
5779 /*!
5780  * @name Register I2C_SMB, field SIICAEN[5] (RW)
5781  *
5782  * Enables or disables SMBus device default address.
5783  *
5784  * Values:
5785  * - 0b0 - I2C address register 2 matching is disabled
5786  * - 0b1 - I2C address register 2 matching is enabled
5787  */
5788 /*@{*/
5789 /*! @brief Read current value of the I2C_SMB_SIICAEN field. */
5790 #define I2C_RD_SMB_SIICAEN(base) ((I2C_SMB_REG(base) & I2C_SMB_SIICAEN_MASK) >> I2C_SMB_SIICAEN_SHIFT)
5791 #define I2C_BRD_SMB_SIICAEN(base) (BME_UBFX8(&I2C_SMB_REG(base), I2C_SMB_SIICAEN_SHIFT, I2C_SMB_SIICAEN_WIDTH))
5792 
5793 /*! @brief Set the SIICAEN field to a new value. */
5794 #define I2C_WR_SMB_SIICAEN(base, value) (I2C_RMW_SMB(base, (I2C_SMB_SIICAEN_MASK | I2C_SMB_SHTF2_MASK | I2C_SMB_SLTF_MASK), I2C_SMB_SIICAEN(value)))
5795 #define I2C_BWR_SMB_SIICAEN(base, value) (BME_BFI8(&I2C_SMB_REG(base), ((uint8_t)(value) << I2C_SMB_SIICAEN_SHIFT), I2C_SMB_SIICAEN_SHIFT, I2C_SMB_SIICAEN_WIDTH))
5796 /*@}*/
5797 
5798 /*!
5799  * @name Register I2C_SMB, field ALERTEN[6] (RW)
5800  *
5801  * Enables or disables SMBus alert response address matching. After the host
5802  * responds to a device that used the alert response address, you must use software
5803  * to put the device's address on the bus. The alert protocol is described in the
5804  * SMBus specification.
5805  *
5806  * Values:
5807  * - 0b0 - SMBus alert response address matching is disabled
5808  * - 0b1 - SMBus alert response address matching is enabled
5809  */
5810 /*@{*/
5811 /*! @brief Read current value of the I2C_SMB_ALERTEN field. */
5812 #define I2C_RD_SMB_ALERTEN(base) ((I2C_SMB_REG(base) & I2C_SMB_ALERTEN_MASK) >> I2C_SMB_ALERTEN_SHIFT)
5813 #define I2C_BRD_SMB_ALERTEN(base) (BME_UBFX8(&I2C_SMB_REG(base), I2C_SMB_ALERTEN_SHIFT, I2C_SMB_ALERTEN_WIDTH))
5814 
5815 /*! @brief Set the ALERTEN field to a new value. */
5816 #define I2C_WR_SMB_ALERTEN(base, value) (I2C_RMW_SMB(base, (I2C_SMB_ALERTEN_MASK | I2C_SMB_SHTF2_MASK | I2C_SMB_SLTF_MASK), I2C_SMB_ALERTEN(value)))
5817 #define I2C_BWR_SMB_ALERTEN(base, value) (BME_BFI8(&I2C_SMB_REG(base), ((uint8_t)(value) << I2C_SMB_ALERTEN_SHIFT), I2C_SMB_ALERTEN_SHIFT, I2C_SMB_ALERTEN_WIDTH))
5818 /*@}*/
5819 
5820 /*!
5821  * @name Register I2C_SMB, field FACK[7] (RW)
5822  *
5823  * For SMBus packet error checking, the CPU must be able to issue an ACK or NACK
5824  * according to the result of receiving data byte.
5825  *
5826  * Values:
5827  * - 0b0 - An ACK or NACK is sent on the following receiving data byte
5828  * - 0b1 - Writing 0 to TXAK after receiving a data byte generates an ACK.
5829  * Writing 1 to TXAK after receiving a data byte generates a NACK.
5830  */
5831 /*@{*/
5832 /*! @brief Read current value of the I2C_SMB_FACK field. */
5833 #define I2C_RD_SMB_FACK(base) ((I2C_SMB_REG(base) & I2C_SMB_FACK_MASK) >> I2C_SMB_FACK_SHIFT)
5834 #define I2C_BRD_SMB_FACK(base) (BME_UBFX8(&I2C_SMB_REG(base), I2C_SMB_FACK_SHIFT, I2C_SMB_FACK_WIDTH))
5835 
5836 /*! @brief Set the FACK field to a new value. */
5837 #define I2C_WR_SMB_FACK(base, value) (I2C_RMW_SMB(base, (I2C_SMB_FACK_MASK | I2C_SMB_SHTF2_MASK | I2C_SMB_SLTF_MASK), I2C_SMB_FACK(value)))
5838 #define I2C_BWR_SMB_FACK(base, value) (BME_BFI8(&I2C_SMB_REG(base), ((uint8_t)(value) << I2C_SMB_FACK_SHIFT), I2C_SMB_FACK_SHIFT, I2C_SMB_FACK_WIDTH))
5839 /*@}*/
5840 
5841 /*******************************************************************************
5842  * I2C_A2 - I2C Address Register 2
5843  ******************************************************************************/
5844 
5845 /*!
5846  * @brief I2C_A2 - I2C Address Register 2 (RW)
5847  *
5848  * Reset value: 0xC2U
5849  */
5850 /*!
5851  * @name Constants and macros for entire I2C_A2 register
5852  */
5853 /*@{*/
5854 #define I2C_RD_A2(base) (I2C_A2_REG(base))
5855 #define I2C_WR_A2(base, value) (I2C_A2_REG(base) = (value))
5856 #define I2C_RMW_A2(base, mask, value) (I2C_WR_A2(base, (I2C_RD_A2(base) & ~(mask)) | (value)))
5857 #define I2C_SET_A2(base, value) (BME_OR8(&I2C_A2_REG(base), (uint8_t)(value)))
5858 #define I2C_CLR_A2(base, value) (BME_AND8(&I2C_A2_REG(base), (uint8_t)(~(value))))
5859 #define I2C_TOG_A2(base, value) (BME_XOR8(&I2C_A2_REG(base), (uint8_t)(value)))
5860 /*@}*/
5861 
5862 /*
5863  * Constants & macros for individual I2C_A2 bitfields
5864  */
5865 
5866 /*!
5867  * @name Register I2C_A2, field SAD[7:1] (RW)
5868  *
5869  * Contains the slave address used by the SMBus. This field is used on the
5870  * device default address or other related addresses.
5871  */
5872 /*@{*/
5873 /*! @brief Read current value of the I2C_A2_SAD field. */
5874 #define I2C_RD_A2_SAD(base) ((I2C_A2_REG(base) & I2C_A2_SAD_MASK) >> I2C_A2_SAD_SHIFT)
5875 #define I2C_BRD_A2_SAD(base) (BME_UBFX8(&I2C_A2_REG(base), I2C_A2_SAD_SHIFT, I2C_A2_SAD_WIDTH))
5876 
5877 /*! @brief Set the SAD field to a new value. */
5878 #define I2C_WR_A2_SAD(base, value) (I2C_RMW_A2(base, I2C_A2_SAD_MASK, I2C_A2_SAD(value)))
5879 #define I2C_BWR_A2_SAD(base, value) (BME_BFI8(&I2C_A2_REG(base), ((uint8_t)(value) << I2C_A2_SAD_SHIFT), I2C_A2_SAD_SHIFT, I2C_A2_SAD_WIDTH))
5880 /*@}*/
5881 
5882 /*******************************************************************************
5883  * I2C_SLTH - I2C SCL Low Timeout Register High
5884  ******************************************************************************/
5885 
5886 /*!
5887  * @brief I2C_SLTH - I2C SCL Low Timeout Register High (RW)
5888  *
5889  * Reset value: 0x00U
5890  */
5891 /*!
5892  * @name Constants and macros for entire I2C_SLTH register
5893  */
5894 /*@{*/
5895 #define I2C_RD_SLTH(base) (I2C_SLTH_REG(base))
5896 #define I2C_WR_SLTH(base, value) (I2C_SLTH_REG(base) = (value))
5897 #define I2C_RMW_SLTH(base, mask, value) (I2C_WR_SLTH(base, (I2C_RD_SLTH(base) & ~(mask)) | (value)))
5898 #define I2C_SET_SLTH(base, value) (BME_OR8(&I2C_SLTH_REG(base), (uint8_t)(value)))
5899 #define I2C_CLR_SLTH(base, value) (BME_AND8(&I2C_SLTH_REG(base), (uint8_t)(~(value))))
5900 #define I2C_TOG_SLTH(base, value) (BME_XOR8(&I2C_SLTH_REG(base), (uint8_t)(value)))
5901 /*@}*/
5902 
5903 /*******************************************************************************
5904  * I2C_SLTL - I2C SCL Low Timeout Register Low
5905  ******************************************************************************/
5906 
5907 /*!
5908  * @brief I2C_SLTL - I2C SCL Low Timeout Register Low (RW)
5909  *
5910  * Reset value: 0x00U
5911  */
5912 /*!
5913  * @name Constants and macros for entire I2C_SLTL register
5914  */
5915 /*@{*/
5916 #define I2C_RD_SLTL(base) (I2C_SLTL_REG(base))
5917 #define I2C_WR_SLTL(base, value) (I2C_SLTL_REG(base) = (value))
5918 #define I2C_RMW_SLTL(base, mask, value) (I2C_WR_SLTL(base, (I2C_RD_SLTL(base) & ~(mask)) | (value)))
5919 #define I2C_SET_SLTL(base, value) (BME_OR8(&I2C_SLTL_REG(base), (uint8_t)(value)))
5920 #define I2C_CLR_SLTL(base, value) (BME_AND8(&I2C_SLTL_REG(base), (uint8_t)(~(value))))
5921 #define I2C_TOG_SLTL(base, value) (BME_XOR8(&I2C_SLTL_REG(base), (uint8_t)(value)))
5922 /*@}*/
5923 
5924 /*
5925  * MKL25Z4 LLWU
5926  *
5927  * Low leakage wakeup unit
5928  *
5929  * Registers defined in this header file:
5930  * - LLWU_PE1 - LLWU Pin Enable 1 register
5931  * - LLWU_PE2 - LLWU Pin Enable 2 register
5932  * - LLWU_PE3 - LLWU Pin Enable 3 register
5933  * - LLWU_PE4 - LLWU Pin Enable 4 register
5934  * - LLWU_ME - LLWU Module Enable register
5935  * - LLWU_F1 - LLWU Flag 1 register
5936  * - LLWU_F2 - LLWU Flag 2 register
5937  * - LLWU_F3 - LLWU Flag 3 register
5938  * - LLWU_FILT1 - LLWU Pin Filter 1 register
5939  * - LLWU_FILT2 - LLWU Pin Filter 2 register
5940  */
5941 
5942 #define LLWU_INSTANCE_COUNT (1U) /*!< Number of instances of the LLWU module. */
5943 #define LLWU_IDX (0U) /*!< Instance number for LLWU. */
5944 
5945 /*******************************************************************************
5946  * LLWU_PE1 - LLWU Pin Enable 1 register
5947  ******************************************************************************/
5948 
5949 /*!
5950  * @brief LLWU_PE1 - LLWU Pin Enable 1 register (RW)
5951  *
5952  * Reset value: 0x00U
5953  *
5954  * LLWU_PE1 contains the field to enable and select the edge detect type for the
5955  * external wakeup input pins LLWU_P3-LLWU_P0. This register is reset on Chip
5956  * Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is
5957  * unaffected by reset types that do not trigger Chip Reset not VLLS. See the
5958  * Introduction details for more information.
5959  */
5960 /*!
5961  * @name Constants and macros for entire LLWU_PE1 register
5962  */
5963 /*@{*/
5964 #define LLWU_RD_PE1(base) (LLWU_PE1_REG(base))
5965 #define LLWU_WR_PE1(base, value) (LLWU_PE1_REG(base) = (value))
5966 #define LLWU_RMW_PE1(base, mask, value) (LLWU_WR_PE1(base, (LLWU_RD_PE1(base) & ~(mask)) | (value)))
5967 #define LLWU_SET_PE1(base, value) (BME_OR8(&LLWU_PE1_REG(base), (uint8_t)(value)))
5968 #define LLWU_CLR_PE1(base, value) (BME_AND8(&LLWU_PE1_REG(base), (uint8_t)(~(value))))
5969 #define LLWU_TOG_PE1(base, value) (BME_XOR8(&LLWU_PE1_REG(base), (uint8_t)(value)))
5970 /*@}*/
5971 
5972 /*
5973  * Constants & macros for individual LLWU_PE1 bitfields
5974  */
5975 
5976 /*!
5977  * @name Register LLWU_PE1, field WUPE0[1:0] (RW)
5978  *
5979  * Enables and configures the edge detection for the wakeup pin.
5980  *
5981  * Values:
5982  * - 0b00 - External input pin disabled as wakeup input
5983  * - 0b01 - External input pin enabled with rising edge detection
5984  * - 0b10 - External input pin enabled with falling edge detection
5985  * - 0b11 - External input pin enabled with any change detection
5986  */
5987 /*@{*/
5988 /*! @brief Read current value of the LLWU_PE1_WUPE0 field. */
5989 #define LLWU_RD_PE1_WUPE0(base) ((LLWU_PE1_REG(base) & LLWU_PE1_WUPE0_MASK) >> LLWU_PE1_WUPE0_SHIFT)
5990 #define LLWU_BRD_PE1_WUPE0(base) (BME_UBFX8(&LLWU_PE1_REG(base), LLWU_PE1_WUPE0_SHIFT, LLWU_PE1_WUPE0_WIDTH))
5991 
5992 /*! @brief Set the WUPE0 field to a new value. */
5993 #define LLWU_WR_PE1_WUPE0(base, value) (LLWU_RMW_PE1(base, LLWU_PE1_WUPE0_MASK, LLWU_PE1_WUPE0(value)))
5994 #define LLWU_BWR_PE1_WUPE0(base, value) (BME_BFI8(&LLWU_PE1_REG(base), ((uint8_t)(value) << LLWU_PE1_WUPE0_SHIFT), LLWU_PE1_WUPE0_SHIFT, LLWU_PE1_WUPE0_WIDTH))
5995 /*@}*/
5996 
5997 /*!
5998  * @name Register LLWU_PE1, field WUPE1[3:2] (RW)
5999  *
6000  * Enables and configures the edge detection for the wakeup pin.
6001  *
6002  * Values:
6003  * - 0b00 - External input pin disabled as wakeup input
6004  * - 0b01 - External input pin enabled with rising edge detection
6005  * - 0b10 - External input pin enabled with falling edge detection
6006  * - 0b11 - External input pin enabled with any change detection
6007  */
6008 /*@{*/
6009 /*! @brief Read current value of the LLWU_PE1_WUPE1 field. */
6010 #define LLWU_RD_PE1_WUPE1(base) ((LLWU_PE1_REG(base) & LLWU_PE1_WUPE1_MASK) >> LLWU_PE1_WUPE1_SHIFT)
6011 #define LLWU_BRD_PE1_WUPE1(base) (BME_UBFX8(&LLWU_PE1_REG(base), LLWU_PE1_WUPE1_SHIFT, LLWU_PE1_WUPE1_WIDTH))
6012 
6013 /*! @brief Set the WUPE1 field to a new value. */
6014 #define LLWU_WR_PE1_WUPE1(base, value) (LLWU_RMW_PE1(base, LLWU_PE1_WUPE1_MASK, LLWU_PE1_WUPE1(value)))
6015 #define LLWU_BWR_PE1_WUPE1(base, value) (BME_BFI8(&LLWU_PE1_REG(base), ((uint8_t)(value) << LLWU_PE1_WUPE1_SHIFT), LLWU_PE1_WUPE1_SHIFT, LLWU_PE1_WUPE1_WIDTH))
6016 /*@}*/
6017 
6018 /*!
6019  * @name Register LLWU_PE1, field WUPE2[5:4] (RW)
6020  *
6021  * Enables and configures the edge detection for the wakeup pin.
6022  *
6023  * Values:
6024  * - 0b00 - External input pin disabled as wakeup input
6025  * - 0b01 - External input pin enabled with rising edge detection
6026  * - 0b10 - External input pin enabled with falling edge detection
6027  * - 0b11 - External input pin enabled with any change detection
6028  */
6029 /*@{*/
6030 /*! @brief Read current value of the LLWU_PE1_WUPE2 field. */
6031 #define LLWU_RD_PE1_WUPE2(base) ((LLWU_PE1_REG(base) & LLWU_PE1_WUPE2_MASK) >> LLWU_PE1_WUPE2_SHIFT)
6032 #define LLWU_BRD_PE1_WUPE2(base) (BME_UBFX8(&LLWU_PE1_REG(base), LLWU_PE1_WUPE2_SHIFT, LLWU_PE1_WUPE2_WIDTH))
6033 
6034 /*! @brief Set the WUPE2 field to a new value. */
6035 #define LLWU_WR_PE1_WUPE2(base, value) (LLWU_RMW_PE1(base, LLWU_PE1_WUPE2_MASK, LLWU_PE1_WUPE2(value)))
6036 #define LLWU_BWR_PE1_WUPE2(base, value) (BME_BFI8(&LLWU_PE1_REG(base), ((uint8_t)(value) << LLWU_PE1_WUPE2_SHIFT), LLWU_PE1_WUPE2_SHIFT, LLWU_PE1_WUPE2_WIDTH))
6037 /*@}*/
6038 
6039 /*!
6040  * @name Register LLWU_PE1, field WUPE3[7:6] (RW)
6041  *
6042  * Enables and configures the edge detection for the wakeup pin.
6043  *
6044  * Values:
6045  * - 0b00 - External input pin disabled as wakeup input
6046  * - 0b01 - External input pin enabled with rising edge detection
6047  * - 0b10 - External input pin enabled with falling edge detection
6048  * - 0b11 - External input pin enabled with any change detection
6049  */
6050 /*@{*/
6051 /*! @brief Read current value of the LLWU_PE1_WUPE3 field. */
6052 #define LLWU_RD_PE1_WUPE3(base) ((LLWU_PE1_REG(base) & LLWU_PE1_WUPE3_MASK) >> LLWU_PE1_WUPE3_SHIFT)
6053 #define LLWU_BRD_PE1_WUPE3(base) (BME_UBFX8(&LLWU_PE1_REG(base), LLWU_PE1_WUPE3_SHIFT, LLWU_PE1_WUPE3_WIDTH))
6054 
6055 /*! @brief Set the WUPE3 field to a new value. */
6056 #define LLWU_WR_PE1_WUPE3(base, value) (LLWU_RMW_PE1(base, LLWU_PE1_WUPE3_MASK, LLWU_PE1_WUPE3(value)))
6057 #define LLWU_BWR_PE1_WUPE3(base, value) (BME_BFI8(&LLWU_PE1_REG(base), ((uint8_t)(value) << LLWU_PE1_WUPE3_SHIFT), LLWU_PE1_WUPE3_SHIFT, LLWU_PE1_WUPE3_WIDTH))
6058 /*@}*/
6059 
6060 /*******************************************************************************
6061  * LLWU_PE2 - LLWU Pin Enable 2 register
6062  ******************************************************************************/
6063 
6064 /*!
6065  * @brief LLWU_PE2 - LLWU Pin Enable 2 register (RW)
6066  *
6067  * Reset value: 0x00U
6068  *
6069  * LLWU_PE2 contains the field to enable and select the edge detect type for the
6070  * external wakeup input pins LLWU_P7-LLWU_P4. This register is reset on Chip
6071  * Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is
6072  * unaffected by reset types that do not trigger Chip Reset not VLLS. See the
6073  * Introduction details for more information.
6074  */
6075 /*!
6076  * @name Constants and macros for entire LLWU_PE2 register
6077  */
6078 /*@{*/
6079 #define LLWU_RD_PE2(base) (LLWU_PE2_REG(base))
6080 #define LLWU_WR_PE2(base, value) (LLWU_PE2_REG(base) = (value))
6081 #define LLWU_RMW_PE2(base, mask, value) (LLWU_WR_PE2(base, (LLWU_RD_PE2(base) & ~(mask)) | (value)))
6082 #define LLWU_SET_PE2(base, value) (BME_OR8(&LLWU_PE2_REG(base), (uint8_t)(value)))
6083 #define LLWU_CLR_PE2(base, value) (BME_AND8(&LLWU_PE2_REG(base), (uint8_t)(~(value))))
6084 #define LLWU_TOG_PE2(base, value) (BME_XOR8(&LLWU_PE2_REG(base), (uint8_t)(value)))
6085 /*@}*/
6086 
6087 /*
6088  * Constants & macros for individual LLWU_PE2 bitfields
6089  */
6090 
6091 /*!
6092  * @name Register LLWU_PE2, field WUPE4[1:0] (RW)
6093  *
6094  * Enables and configures the edge detection for the wakeup pin.
6095  *
6096  * Values:
6097  * - 0b00 - External input pin disabled as wakeup input
6098  * - 0b01 - External input pin enabled with rising edge detection
6099  * - 0b10 - External input pin enabled with falling edge detection
6100  * - 0b11 - External input pin enabled with any change detection
6101  */
6102 /*@{*/
6103 /*! @brief Read current value of the LLWU_PE2_WUPE4 field. */
6104 #define LLWU_RD_PE2_WUPE4(base) ((LLWU_PE2_REG(base) & LLWU_PE2_WUPE4_MASK) >> LLWU_PE2_WUPE4_SHIFT)
6105 #define LLWU_BRD_PE2_WUPE4(base) (BME_UBFX8(&LLWU_PE2_REG(base), LLWU_PE2_WUPE4_SHIFT, LLWU_PE2_WUPE4_WIDTH))
6106 
6107 /*! @brief Set the WUPE4 field to a new value. */
6108 #define LLWU_WR_PE2_WUPE4(base, value) (LLWU_RMW_PE2(base, LLWU_PE2_WUPE4_MASK, LLWU_PE2_WUPE4(value)))
6109 #define LLWU_BWR_PE2_WUPE4(base, value) (BME_BFI8(&LLWU_PE2_REG(base), ((uint8_t)(value) << LLWU_PE2_WUPE4_SHIFT), LLWU_PE2_WUPE4_SHIFT, LLWU_PE2_WUPE4_WIDTH))
6110 /*@}*/
6111 
6112 /*!
6113  * @name Register LLWU_PE2, field WUPE5[3:2] (RW)
6114  *
6115  * Enables and configures the edge detection for the wakeup pin.
6116  *
6117  * Values:
6118  * - 0b00 - External input pin disabled as wakeup input
6119  * - 0b01 - External input pin enabled with rising edge detection
6120  * - 0b10 - External input pin enabled with falling edge detection
6121  * - 0b11 - External input pin enabled with any change detection
6122  */
6123 /*@{*/
6124 /*! @brief Read current value of the LLWU_PE2_WUPE5 field. */
6125 #define LLWU_RD_PE2_WUPE5(base) ((LLWU_PE2_REG(base) & LLWU_PE2_WUPE5_MASK) >> LLWU_PE2_WUPE5_SHIFT)
6126 #define LLWU_BRD_PE2_WUPE5(base) (BME_UBFX8(&LLWU_PE2_REG(base), LLWU_PE2_WUPE5_SHIFT, LLWU_PE2_WUPE5_WIDTH))
6127 
6128 /*! @brief Set the WUPE5 field to a new value. */
6129 #define LLWU_WR_PE2_WUPE5(base, value) (LLWU_RMW_PE2(base, LLWU_PE2_WUPE5_MASK, LLWU_PE2_WUPE5(value)))
6130 #define LLWU_BWR_PE2_WUPE5(base, value) (BME_BFI8(&LLWU_PE2_REG(base), ((uint8_t)(value) << LLWU_PE2_WUPE5_SHIFT), LLWU_PE2_WUPE5_SHIFT, LLWU_PE2_WUPE5_WIDTH))
6131 /*@}*/
6132 
6133 /*!
6134  * @name Register LLWU_PE2, field WUPE6[5:4] (RW)
6135  *
6136  * Enables and configures the edge detection for the wakeup pin.
6137  *
6138  * Values:
6139  * - 0b00 - External input pin disabled as wakeup input
6140  * - 0b01 - External input pin enabled with rising edge detection
6141  * - 0b10 - External input pin enabled with falling edge detection
6142  * - 0b11 - External input pin enabled with any change detection
6143  */
6144 /*@{*/
6145 /*! @brief Read current value of the LLWU_PE2_WUPE6 field. */
6146 #define LLWU_RD_PE2_WUPE6(base) ((LLWU_PE2_REG(base) & LLWU_PE2_WUPE6_MASK) >> LLWU_PE2_WUPE6_SHIFT)
6147 #define LLWU_BRD_PE2_WUPE6(base) (BME_UBFX8(&LLWU_PE2_REG(base), LLWU_PE2_WUPE6_SHIFT, LLWU_PE2_WUPE6_WIDTH))
6148 
6149 /*! @brief Set the WUPE6 field to a new value. */
6150 #define LLWU_WR_PE2_WUPE6(base, value) (LLWU_RMW_PE2(base, LLWU_PE2_WUPE6_MASK, LLWU_PE2_WUPE6(value)))
6151 #define LLWU_BWR_PE2_WUPE6(base, value) (BME_BFI8(&LLWU_PE2_REG(base), ((uint8_t)(value) << LLWU_PE2_WUPE6_SHIFT), LLWU_PE2_WUPE6_SHIFT, LLWU_PE2_WUPE6_WIDTH))
6152 /*@}*/
6153 
6154 /*!
6155  * @name Register LLWU_PE2, field WUPE7[7:6] (RW)
6156  *
6157  * Enables and configures the edge detection for the wakeup pin.
6158  *
6159  * Values:
6160  * - 0b00 - External input pin disabled as wakeup input
6161  * - 0b01 - External input pin enabled with rising edge detection
6162  * - 0b10 - External input pin enabled with falling edge detection
6163  * - 0b11 - External input pin enabled with any change detection
6164  */
6165 /*@{*/
6166 /*! @brief Read current value of the LLWU_PE2_WUPE7 field. */
6167 #define LLWU_RD_PE2_WUPE7(base) ((LLWU_PE2_REG(base) & LLWU_PE2_WUPE7_MASK) >> LLWU_PE2_WUPE7_SHIFT)
6168 #define LLWU_BRD_PE2_WUPE7(base) (BME_UBFX8(&LLWU_PE2_REG(base), LLWU_PE2_WUPE7_SHIFT, LLWU_PE2_WUPE7_WIDTH))
6169 
6170 /*! @brief Set the WUPE7 field to a new value. */
6171 #define LLWU_WR_PE2_WUPE7(base, value) (LLWU_RMW_PE2(base, LLWU_PE2_WUPE7_MASK, LLWU_PE2_WUPE7(value)))
6172 #define LLWU_BWR_PE2_WUPE7(base, value) (BME_BFI8(&LLWU_PE2_REG(base), ((uint8_t)(value) << LLWU_PE2_WUPE7_SHIFT), LLWU_PE2_WUPE7_SHIFT, LLWU_PE2_WUPE7_WIDTH))
6173 /*@}*/
6174 
6175 /*******************************************************************************
6176  * LLWU_PE3 - LLWU Pin Enable 3 register
6177  ******************************************************************************/
6178 
6179 /*!
6180  * @brief LLWU_PE3 - LLWU Pin Enable 3 register (RW)
6181  *
6182  * Reset value: 0x00U
6183  *
6184  * LLWU_PE3 contains the field to enable and select the edge detect type for the
6185  * external wakeup input pins LLWU_P11-LLWU_P8. This register is reset on Chip
6186  * Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is
6187  * unaffected by reset types that do not trigger Chip Reset not VLLS. See the
6188  * Introduction details for more information.
6189  */
6190 /*!
6191  * @name Constants and macros for entire LLWU_PE3 register
6192  */
6193 /*@{*/
6194 #define LLWU_RD_PE3(base) (LLWU_PE3_REG(base))
6195 #define LLWU_WR_PE3(base, value) (LLWU_PE3_REG(base) = (value))
6196 #define LLWU_RMW_PE3(base, mask, value) (LLWU_WR_PE3(base, (LLWU_RD_PE3(base) & ~(mask)) | (value)))
6197 #define LLWU_SET_PE3(base, value) (BME_OR8(&LLWU_PE3_REG(base), (uint8_t)(value)))
6198 #define LLWU_CLR_PE3(base, value) (BME_AND8(&LLWU_PE3_REG(base), (uint8_t)(~(value))))
6199 #define LLWU_TOG_PE3(base, value) (BME_XOR8(&LLWU_PE3_REG(base), (uint8_t)(value)))
6200 /*@}*/
6201 
6202 /*
6203  * Constants & macros for individual LLWU_PE3 bitfields
6204  */
6205 
6206 /*!
6207  * @name Register LLWU_PE3, field WUPE8[1:0] (RW)
6208  *
6209  * Enables and configures the edge detection for the wakeup pin.
6210  *
6211  * Values:
6212  * - 0b00 - External input pin disabled as wakeup input
6213  * - 0b01 - External input pin enabled with rising edge detection
6214  * - 0b10 - External input pin enabled with falling edge detection
6215  * - 0b11 - External input pin enabled with any change detection
6216  */
6217 /*@{*/
6218 /*! @brief Read current value of the LLWU_PE3_WUPE8 field. */
6219 #define LLWU_RD_PE3_WUPE8(base) ((LLWU_PE3_REG(base) & LLWU_PE3_WUPE8_MASK) >> LLWU_PE3_WUPE8_SHIFT)
6220 #define LLWU_BRD_PE3_WUPE8(base) (BME_UBFX8(&LLWU_PE3_REG(base), LLWU_PE3_WUPE8_SHIFT, LLWU_PE3_WUPE8_WIDTH))
6221 
6222 /*! @brief Set the WUPE8 field to a new value. */
6223 #define LLWU_WR_PE3_WUPE8(base, value) (LLWU_RMW_PE3(base, LLWU_PE3_WUPE8_MASK, LLWU_PE3_WUPE8(value)))
6224 #define LLWU_BWR_PE3_WUPE8(base, value) (BME_BFI8(&LLWU_PE3_REG(base), ((uint8_t)(value) << LLWU_PE3_WUPE8_SHIFT), LLWU_PE3_WUPE8_SHIFT, LLWU_PE3_WUPE8_WIDTH))
6225 /*@}*/
6226 
6227 /*!
6228  * @name Register LLWU_PE3, field WUPE9[3:2] (RW)
6229  *
6230  * Enables and configures the edge detection for the wakeup pin.
6231  *
6232  * Values:
6233  * - 0b00 - External input pin disabled as wakeup input
6234  * - 0b01 - External input pin enabled with rising edge detection
6235  * - 0b10 - External input pin enabled with falling edge detection
6236  * - 0b11 - External input pin enabled with any change detection
6237  */
6238 /*@{*/
6239 /*! @brief Read current value of the LLWU_PE3_WUPE9 field. */
6240 #define LLWU_RD_PE3_WUPE9(base) ((LLWU_PE3_REG(base) & LLWU_PE3_WUPE9_MASK) >> LLWU_PE3_WUPE9_SHIFT)
6241 #define LLWU_BRD_PE3_WUPE9(base) (BME_UBFX8(&LLWU_PE3_REG(base), LLWU_PE3_WUPE9_SHIFT, LLWU_PE3_WUPE9_WIDTH))
6242 
6243 /*! @brief Set the WUPE9 field to a new value. */
6244 #define LLWU_WR_PE3_WUPE9(base, value) (LLWU_RMW_PE3(base, LLWU_PE3_WUPE9_MASK, LLWU_PE3_WUPE9(value)))
6245 #define LLWU_BWR_PE3_WUPE9(base, value) (BME_BFI8(&LLWU_PE3_REG(base), ((uint8_t)(value) << LLWU_PE3_WUPE9_SHIFT), LLWU_PE3_WUPE9_SHIFT, LLWU_PE3_WUPE9_WIDTH))
6246 /*@}*/
6247 
6248 /*!
6249  * @name Register LLWU_PE3, field WUPE10[5:4] (RW)
6250  *
6251  * Enables and configures the edge detection for the wakeup pin.
6252  *
6253  * Values:
6254  * - 0b00 - External input pin disabled as wakeup input
6255  * - 0b01 - External input pin enabled with rising edge detection
6256  * - 0b10 - External input pin enabled with falling edge detection
6257  * - 0b11 - External input pin enabled with any change detection
6258  */
6259 /*@{*/
6260 /*! @brief Read current value of the LLWU_PE3_WUPE10 field. */
6261 #define LLWU_RD_PE3_WUPE10(base) ((LLWU_PE3_REG(base) & LLWU_PE3_WUPE10_MASK) >> LLWU_PE3_WUPE10_SHIFT)
6262 #define LLWU_BRD_PE3_WUPE10(base) (BME_UBFX8(&LLWU_PE3_REG(base), LLWU_PE3_WUPE10_SHIFT, LLWU_PE3_WUPE10_WIDTH))
6263 
6264 /*! @brief Set the WUPE10 field to a new value. */
6265 #define LLWU_WR_PE3_WUPE10(base, value) (LLWU_RMW_PE3(base, LLWU_PE3_WUPE10_MASK, LLWU_PE3_WUPE10(value)))
6266 #define LLWU_BWR_PE3_WUPE10(base, value) (BME_BFI8(&LLWU_PE3_REG(base), ((uint8_t)(value) << LLWU_PE3_WUPE10_SHIFT), LLWU_PE3_WUPE10_SHIFT, LLWU_PE3_WUPE10_WIDTH))
6267 /*@}*/
6268 
6269 /*!
6270  * @name Register LLWU_PE3, field WUPE11[7:6] (RW)
6271  *
6272  * Enables and configures the edge detection for the wakeup pin.
6273  *
6274  * Values:
6275  * - 0b00 - External input pin disabled as wakeup input
6276  * - 0b01 - External input pin enabled with rising edge detection
6277  * - 0b10 - External input pin enabled with falling edge detection
6278  * - 0b11 - External input pin enabled with any change detection
6279  */
6280 /*@{*/
6281 /*! @brief Read current value of the LLWU_PE3_WUPE11 field. */
6282 #define LLWU_RD_PE3_WUPE11(base) ((LLWU_PE3_REG(base) & LLWU_PE3_WUPE11_MASK) >> LLWU_PE3_WUPE11_SHIFT)
6283 #define LLWU_BRD_PE3_WUPE11(base) (BME_UBFX8(&LLWU_PE3_REG(base), LLWU_PE3_WUPE11_SHIFT, LLWU_PE3_WUPE11_WIDTH))
6284 
6285 /*! @brief Set the WUPE11 field to a new value. */
6286 #define LLWU_WR_PE3_WUPE11(base, value) (LLWU_RMW_PE3(base, LLWU_PE3_WUPE11_MASK, LLWU_PE3_WUPE11(value)))
6287 #define LLWU_BWR_PE3_WUPE11(base, value) (BME_BFI8(&LLWU_PE3_REG(base), ((uint8_t)(value) << LLWU_PE3_WUPE11_SHIFT), LLWU_PE3_WUPE11_SHIFT, LLWU_PE3_WUPE11_WIDTH))
6288 /*@}*/
6289 
6290 /*******************************************************************************
6291  * LLWU_PE4 - LLWU Pin Enable 4 register
6292  ******************************************************************************/
6293 
6294 /*!
6295  * @brief LLWU_PE4 - LLWU Pin Enable 4 register (RW)
6296  *
6297  * Reset value: 0x00U
6298  *
6299  * LLWU_PE4 contains the field to enable and select the edge detect type for the
6300  * external wakeup input pins LLWU_P15-LLWU_P12. This register is reset on Chip
6301  * Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is
6302  * unaffected by reset types that do not trigger Chip Reset not VLLS. See the
6303  * Introduction details for more information.
6304  */
6305 /*!
6306  * @name Constants and macros for entire LLWU_PE4 register
6307  */
6308 /*@{*/
6309 #define LLWU_RD_PE4(base) (LLWU_PE4_REG(base))
6310 #define LLWU_WR_PE4(base, value) (LLWU_PE4_REG(base) = (value))
6311 #define LLWU_RMW_PE4(base, mask, value) (LLWU_WR_PE4(base, (LLWU_RD_PE4(base) & ~(mask)) | (value)))
6312 #define LLWU_SET_PE4(base, value) (BME_OR8(&LLWU_PE4_REG(base), (uint8_t)(value)))
6313 #define LLWU_CLR_PE4(base, value) (BME_AND8(&LLWU_PE4_REG(base), (uint8_t)(~(value))))
6314 #define LLWU_TOG_PE4(base, value) (BME_XOR8(&LLWU_PE4_REG(base), (uint8_t)(value)))
6315 /*@}*/
6316 
6317 /*
6318  * Constants & macros for individual LLWU_PE4 bitfields
6319  */
6320 
6321 /*!
6322  * @name Register LLWU_PE4, field WUPE12[1:0] (RW)
6323  *
6324  * Enables and configures the edge detection for the wakeup pin.
6325  *
6326  * Values:
6327  * - 0b00 - External input pin disabled as wakeup input
6328  * - 0b01 - External input pin enabled with rising edge detection
6329  * - 0b10 - External input pin enabled with falling edge detection
6330  * - 0b11 - External input pin enabled with any change detection
6331  */
6332 /*@{*/
6333 /*! @brief Read current value of the LLWU_PE4_WUPE12 field. */
6334 #define LLWU_RD_PE4_WUPE12(base) ((LLWU_PE4_REG(base) & LLWU_PE4_WUPE12_MASK) >> LLWU_PE4_WUPE12_SHIFT)
6335 #define LLWU_BRD_PE4_WUPE12(base) (BME_UBFX8(&LLWU_PE4_REG(base), LLWU_PE4_WUPE12_SHIFT, LLWU_PE4_WUPE12_WIDTH))
6336 
6337 /*! @brief Set the WUPE12 field to a new value. */
6338 #define LLWU_WR_PE4_WUPE12(base, value) (LLWU_RMW_PE4(base, LLWU_PE4_WUPE12_MASK, LLWU_PE4_WUPE12(value)))
6339 #define LLWU_BWR_PE4_WUPE12(base, value) (BME_BFI8(&LLWU_PE4_REG(base), ((uint8_t)(value) << LLWU_PE4_WUPE12_SHIFT), LLWU_PE4_WUPE12_SHIFT, LLWU_PE4_WUPE12_WIDTH))
6340 /*@}*/
6341 
6342 /*!
6343  * @name Register LLWU_PE4, field WUPE13[3:2] (RW)
6344  *
6345  * Enables and configures the edge detection for the wakeup pin.
6346  *
6347  * Values:
6348  * - 0b00 - External input pin disabled as wakeup input
6349  * - 0b01 - External input pin enabled with rising edge detection
6350  * - 0b10 - External input pin enabled with falling edge detection
6351  * - 0b11 - External input pin enabled with any change detection
6352  */
6353 /*@{*/
6354 /*! @brief Read current value of the LLWU_PE4_WUPE13 field. */
6355 #define LLWU_RD_PE4_WUPE13(base) ((LLWU_PE4_REG(base) & LLWU_PE4_WUPE13_MASK) >> LLWU_PE4_WUPE13_SHIFT)
6356 #define LLWU_BRD_PE4_WUPE13(base) (BME_UBFX8(&LLWU_PE4_REG(base), LLWU_PE4_WUPE13_SHIFT, LLWU_PE4_WUPE13_WIDTH))
6357 
6358 /*! @brief Set the WUPE13 field to a new value. */
6359 #define LLWU_WR_PE4_WUPE13(base, value) (LLWU_RMW_PE4(base, LLWU_PE4_WUPE13_MASK, LLWU_PE4_WUPE13(value)))
6360 #define LLWU_BWR_PE4_WUPE13(base, value) (BME_BFI8(&LLWU_PE4_REG(base), ((uint8_t)(value) << LLWU_PE4_WUPE13_SHIFT), LLWU_PE4_WUPE13_SHIFT, LLWU_PE4_WUPE13_WIDTH))
6361 /*@}*/
6362 
6363 /*!
6364  * @name Register LLWU_PE4, field WUPE14[5:4] (RW)
6365  *
6366  * Enables and configures the edge detection for the wakeup pin.
6367  *
6368  * Values:
6369  * - 0b00 - External input pin disabled as wakeup input
6370  * - 0b01 - External input pin enabled with rising edge detection
6371  * - 0b10 - External input pin enabled with falling edge detection
6372  * - 0b11 - External input pin enabled with any change detection
6373  */
6374 /*@{*/
6375 /*! @brief Read current value of the LLWU_PE4_WUPE14 field. */
6376 #define LLWU_RD_PE4_WUPE14(base) ((LLWU_PE4_REG(base) & LLWU_PE4_WUPE14_MASK) >> LLWU_PE4_WUPE14_SHIFT)
6377 #define LLWU_BRD_PE4_WUPE14(base) (BME_UBFX8(&LLWU_PE4_REG(base), LLWU_PE4_WUPE14_SHIFT, LLWU_PE4_WUPE14_WIDTH))
6378 
6379 /*! @brief Set the WUPE14 field to a new value. */
6380 #define LLWU_WR_PE4_WUPE14(base, value) (LLWU_RMW_PE4(base, LLWU_PE4_WUPE14_MASK, LLWU_PE4_WUPE14(value)))
6381 #define LLWU_BWR_PE4_WUPE14(base, value) (BME_BFI8(&LLWU_PE4_REG(base), ((uint8_t)(value) << LLWU_PE4_WUPE14_SHIFT), LLWU_PE4_WUPE14_SHIFT, LLWU_PE4_WUPE14_WIDTH))
6382 /*@}*/
6383 
6384 /*!
6385  * @name Register LLWU_PE4, field WUPE15[7:6] (RW)
6386  *
6387  * Enables and configures the edge detection for the wakeup pin.
6388  *
6389  * Values:
6390  * - 0b00 - External input pin disabled as wakeup input
6391  * - 0b01 - External input pin enabled with rising edge detection
6392  * - 0b10 - External input pin enabled with falling edge detection
6393  * - 0b11 - External input pin enabled with any change detection
6394  */
6395 /*@{*/
6396 /*! @brief Read current value of the LLWU_PE4_WUPE15 field. */
6397 #define LLWU_RD_PE4_WUPE15(base) ((LLWU_PE4_REG(base) & LLWU_PE4_WUPE15_MASK) >> LLWU_PE4_WUPE15_SHIFT)
6398 #define LLWU_BRD_PE4_WUPE15(base) (BME_UBFX8(&LLWU_PE4_REG(base), LLWU_PE4_WUPE15_SHIFT, LLWU_PE4_WUPE15_WIDTH))
6399 
6400 /*! @brief Set the WUPE15 field to a new value. */
6401 #define LLWU_WR_PE4_WUPE15(base, value) (LLWU_RMW_PE4(base, LLWU_PE4_WUPE15_MASK, LLWU_PE4_WUPE15(value)))
6402 #define LLWU_BWR_PE4_WUPE15(base, value) (BME_BFI8(&LLWU_PE4_REG(base), ((uint8_t)(value) << LLWU_PE4_WUPE15_SHIFT), LLWU_PE4_WUPE15_SHIFT, LLWU_PE4_WUPE15_WIDTH))
6403 /*@}*/
6404 
6405 /*******************************************************************************
6406  * LLWU_ME - LLWU Module Enable register
6407  ******************************************************************************/
6408 
6409 /*!
6410  * @brief LLWU_ME - LLWU Module Enable register (RW)
6411  *
6412  * Reset value: 0x00U
6413  *
6414  * LLWU_ME contains the bits to enable the internal module flag as a wakeup
6415  * input source for inputs MWUF7-MWUF0. This register is reset on Chip Reset not VLLS
6416  * and by reset types that trigger Chip Reset not VLLS. It is unaffected by
6417  * reset types that do not trigger Chip Reset not VLLS. See the Introduction details
6418  * for more information.
6419  */
6420 /*!
6421  * @name Constants and macros for entire LLWU_ME register
6422  */
6423 /*@{*/
6424 #define LLWU_RD_ME(base) (LLWU_ME_REG(base))
6425 #define LLWU_WR_ME(base, value) (LLWU_ME_REG(base) = (value))
6426 #define LLWU_RMW_ME(base, mask, value) (LLWU_WR_ME(base, (LLWU_RD_ME(base) & ~(mask)) | (value)))
6427 #define LLWU_SET_ME(base, value) (BME_OR8(&LLWU_ME_REG(base), (uint8_t)(value)))
6428 #define LLWU_CLR_ME(base, value) (BME_AND8(&LLWU_ME_REG(base), (uint8_t)(~(value))))
6429 #define LLWU_TOG_ME(base, value) (BME_XOR8(&LLWU_ME_REG(base), (uint8_t)(value)))
6430 /*@}*/
6431 
6432 /*
6433  * Constants & macros for individual LLWU_ME bitfields
6434  */
6435 
6436 /*!
6437  * @name Register LLWU_ME, field WUME0[0] (RW)
6438  *
6439  * Enables an internal module as a wakeup source input.
6440  *
6441  * Values:
6442  * - 0b0 - Internal module flag not used as wakeup source
6443  * - 0b1 - Internal module flag used as wakeup source
6444  */
6445 /*@{*/
6446 /*! @brief Read current value of the LLWU_ME_WUME0 field. */
6447 #define LLWU_RD_ME_WUME0(base) ((LLWU_ME_REG(base) & LLWU_ME_WUME0_MASK) >> LLWU_ME_WUME0_SHIFT)
6448 #define LLWU_BRD_ME_WUME0(base) (BME_UBFX8(&LLWU_ME_REG(base), LLWU_ME_WUME0_SHIFT, LLWU_ME_WUME0_WIDTH))
6449 
6450 /*! @brief Set the WUME0 field to a new value. */
6451 #define LLWU_WR_ME_WUME0(base, value) (LLWU_RMW_ME(base, LLWU_ME_WUME0_MASK, LLWU_ME_WUME0(value)))
6452 #define LLWU_BWR_ME_WUME0(base, value) (BME_BFI8(&LLWU_ME_REG(base), ((uint8_t)(value) << LLWU_ME_WUME0_SHIFT), LLWU_ME_WUME0_SHIFT, LLWU_ME_WUME0_WIDTH))
6453 /*@}*/
6454 
6455 /*!
6456  * @name Register LLWU_ME, field WUME1[1] (RW)
6457  *
6458  * Enables an internal module as a wakeup source input.
6459  *
6460  * Values:
6461  * - 0b0 - Internal module flag not used as wakeup source
6462  * - 0b1 - Internal module flag used as wakeup source
6463  */
6464 /*@{*/
6465 /*! @brief Read current value of the LLWU_ME_WUME1 field. */
6466 #define LLWU_RD_ME_WUME1(base) ((LLWU_ME_REG(base) & LLWU_ME_WUME1_MASK) >> LLWU_ME_WUME1_SHIFT)
6467 #define LLWU_BRD_ME_WUME1(base) (BME_UBFX8(&LLWU_ME_REG(base), LLWU_ME_WUME1_SHIFT, LLWU_ME_WUME1_WIDTH))
6468 
6469 /*! @brief Set the WUME1 field to a new value. */
6470 #define LLWU_WR_ME_WUME1(base, value) (LLWU_RMW_ME(base, LLWU_ME_WUME1_MASK, LLWU_ME_WUME1(value)))
6471 #define LLWU_BWR_ME_WUME1(base, value) (BME_BFI8(&LLWU_ME_REG(base), ((uint8_t)(value) << LLWU_ME_WUME1_SHIFT), LLWU_ME_WUME1_SHIFT, LLWU_ME_WUME1_WIDTH))
6472 /*@}*/
6473 
6474 /*!
6475  * @name Register LLWU_ME, field WUME2[2] (RW)
6476  *
6477  * Enables an internal module as a wakeup source input.
6478  *
6479  * Values:
6480  * - 0b0 - Internal module flag not used as wakeup source
6481  * - 0b1 - Internal module flag used as wakeup source
6482  */
6483 /*@{*/
6484 /*! @brief Read current value of the LLWU_ME_WUME2 field. */
6485 #define LLWU_RD_ME_WUME2(base) ((LLWU_ME_REG(base) & LLWU_ME_WUME2_MASK) >> LLWU_ME_WUME2_SHIFT)
6486 #define LLWU_BRD_ME_WUME2(base) (BME_UBFX8(&LLWU_ME_REG(base), LLWU_ME_WUME2_SHIFT, LLWU_ME_WUME2_WIDTH))
6487 
6488 /*! @brief Set the WUME2 field to a new value. */
6489 #define LLWU_WR_ME_WUME2(base, value) (LLWU_RMW_ME(base, LLWU_ME_WUME2_MASK, LLWU_ME_WUME2(value)))
6490 #define LLWU_BWR_ME_WUME2(base, value) (BME_BFI8(&LLWU_ME_REG(base), ((uint8_t)(value) << LLWU_ME_WUME2_SHIFT), LLWU_ME_WUME2_SHIFT, LLWU_ME_WUME2_WIDTH))
6491 /*@}*/
6492 
6493 /*!
6494  * @name Register LLWU_ME, field WUME3[3] (RW)
6495  *
6496  * Enables an internal module as a wakeup source input.
6497  *
6498  * Values:
6499  * - 0b0 - Internal module flag not used as wakeup source
6500  * - 0b1 - Internal module flag used as wakeup source
6501  */
6502 /*@{*/
6503 /*! @brief Read current value of the LLWU_ME_WUME3 field. */
6504 #define LLWU_RD_ME_WUME3(base) ((LLWU_ME_REG(base) & LLWU_ME_WUME3_MASK) >> LLWU_ME_WUME3_SHIFT)
6505 #define LLWU_BRD_ME_WUME3(base) (BME_UBFX8(&LLWU_ME_REG(base), LLWU_ME_WUME3_SHIFT, LLWU_ME_WUME3_WIDTH))
6506 
6507 /*! @brief Set the WUME3 field to a new value. */
6508 #define LLWU_WR_ME_WUME3(base, value) (LLWU_RMW_ME(base, LLWU_ME_WUME3_MASK, LLWU_ME_WUME3(value)))
6509 #define LLWU_BWR_ME_WUME3(base, value) (BME_BFI8(&LLWU_ME_REG(base), ((uint8_t)(value) << LLWU_ME_WUME3_SHIFT), LLWU_ME_WUME3_SHIFT, LLWU_ME_WUME3_WIDTH))
6510 /*@}*/
6511 
6512 /*!
6513  * @name Register LLWU_ME, field WUME4[4] (RW)
6514  *
6515  * Enables an internal module as a wakeup source input.
6516  *
6517  * Values:
6518  * - 0b0 - Internal module flag not used as wakeup source
6519  * - 0b1 - Internal module flag used as wakeup source
6520  */
6521 /*@{*/
6522 /*! @brief Read current value of the LLWU_ME_WUME4 field. */
6523 #define LLWU_RD_ME_WUME4(base) ((LLWU_ME_REG(base) & LLWU_ME_WUME4_MASK) >> LLWU_ME_WUME4_SHIFT)
6524 #define LLWU_BRD_ME_WUME4(base) (BME_UBFX8(&LLWU_ME_REG(base), LLWU_ME_WUME4_SHIFT, LLWU_ME_WUME4_WIDTH))
6525 
6526 /*! @brief Set the WUME4 field to a new value. */
6527 #define LLWU_WR_ME_WUME4(base, value) (LLWU_RMW_ME(base, LLWU_ME_WUME4_MASK, LLWU_ME_WUME4(value)))
6528 #define LLWU_BWR_ME_WUME4(base, value) (BME_BFI8(&LLWU_ME_REG(base), ((uint8_t)(value) << LLWU_ME_WUME4_SHIFT), LLWU_ME_WUME4_SHIFT, LLWU_ME_WUME4_WIDTH))
6529 /*@}*/
6530 
6531 /*!
6532  * @name Register LLWU_ME, field WUME5[5] (RW)
6533  *
6534  * Enables an internal module as a wakeup source input.
6535  *
6536  * Values:
6537  * - 0b0 - Internal module flag not used as wakeup source
6538  * - 0b1 - Internal module flag used as wakeup source
6539  */
6540 /*@{*/
6541 /*! @brief Read current value of the LLWU_ME_WUME5 field. */
6542 #define LLWU_RD_ME_WUME5(base) ((LLWU_ME_REG(base) & LLWU_ME_WUME5_MASK) >> LLWU_ME_WUME5_SHIFT)
6543 #define LLWU_BRD_ME_WUME5(base) (BME_UBFX8(&LLWU_ME_REG(base), LLWU_ME_WUME5_SHIFT, LLWU_ME_WUME5_WIDTH))
6544 
6545 /*! @brief Set the WUME5 field to a new value. */
6546 #define LLWU_WR_ME_WUME5(base, value) (LLWU_RMW_ME(base, LLWU_ME_WUME5_MASK, LLWU_ME_WUME5(value)))
6547 #define LLWU_BWR_ME_WUME5(base, value) (BME_BFI8(&LLWU_ME_REG(base), ((uint8_t)(value) << LLWU_ME_WUME5_SHIFT), LLWU_ME_WUME5_SHIFT, LLWU_ME_WUME5_WIDTH))
6548 /*@}*/
6549 
6550 /*!
6551  * @name Register LLWU_ME, field WUME6[6] (RW)
6552  *
6553  * Enables an internal module as a wakeup source input.
6554  *
6555  * Values:
6556  * - 0b0 - Internal module flag not used as wakeup source
6557  * - 0b1 - Internal module flag used as wakeup source
6558  */
6559 /*@{*/
6560 /*! @brief Read current value of the LLWU_ME_WUME6 field. */
6561 #define LLWU_RD_ME_WUME6(base) ((LLWU_ME_REG(base) & LLWU_ME_WUME6_MASK) >> LLWU_ME_WUME6_SHIFT)
6562 #define LLWU_BRD_ME_WUME6(base) (BME_UBFX8(&LLWU_ME_REG(base), LLWU_ME_WUME6_SHIFT, LLWU_ME_WUME6_WIDTH))
6563 
6564 /*! @brief Set the WUME6 field to a new value. */
6565 #define LLWU_WR_ME_WUME6(base, value) (LLWU_RMW_ME(base, LLWU_ME_WUME6_MASK, LLWU_ME_WUME6(value)))
6566 #define LLWU_BWR_ME_WUME6(base, value) (BME_BFI8(&LLWU_ME_REG(base), ((uint8_t)(value) << LLWU_ME_WUME6_SHIFT), LLWU_ME_WUME6_SHIFT, LLWU_ME_WUME6_WIDTH))
6567 /*@}*/
6568 
6569 /*!
6570  * @name Register LLWU_ME, field WUME7[7] (RW)
6571  *
6572  * Enables an internal module as a wakeup source input.
6573  *
6574  * Values:
6575  * - 0b0 - Internal module flag not used as wakeup source
6576  * - 0b1 - Internal module flag used as wakeup source
6577  */
6578 /*@{*/
6579 /*! @brief Read current value of the LLWU_ME_WUME7 field. */
6580 #define LLWU_RD_ME_WUME7(base) ((LLWU_ME_REG(base) & LLWU_ME_WUME7_MASK) >> LLWU_ME_WUME7_SHIFT)
6581 #define LLWU_BRD_ME_WUME7(base) (BME_UBFX8(&LLWU_ME_REG(base), LLWU_ME_WUME7_SHIFT, LLWU_ME_WUME7_WIDTH))
6582 
6583 /*! @brief Set the WUME7 field to a new value. */
6584 #define LLWU_WR_ME_WUME7(base, value) (LLWU_RMW_ME(base, LLWU_ME_WUME7_MASK, LLWU_ME_WUME7(value)))
6585 #define LLWU_BWR_ME_WUME7(base, value) (BME_BFI8(&LLWU_ME_REG(base), ((uint8_t)(value) << LLWU_ME_WUME7_SHIFT), LLWU_ME_WUME7_SHIFT, LLWU_ME_WUME7_WIDTH))
6586 /*@}*/
6587 
6588 /*******************************************************************************
6589  * LLWU_F1 - LLWU Flag 1 register
6590  ******************************************************************************/
6591 
6592 /*!
6593  * @brief LLWU_F1 - LLWU Flag 1 register (W1C)
6594  *
6595  * Reset value: 0x00U
6596  *
6597  * LLWU_F1 contains the wakeup flags indicating which wakeup source caused the
6598  * MCU to exit LLS or VLLS mode. For LLS, this is the source causing the CPU
6599  * interrupt flow. For VLLS, this is the source causing the MCU reset flow. The
6600  * external wakeup flags are read-only and clearing a flag is accomplished by a write
6601  * of a 1 to the corresponding WUFx bit. The wakeup flag (WUFx), if set, will
6602  * remain set if the associated WUPEx bit is cleared. This register is reset on Chip
6603  * Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is
6604  * unaffected by reset types that do not trigger Chip Reset not VLLS. See the
6605  * Introduction details for more information.
6606  */
6607 /*!
6608  * @name Constants and macros for entire LLWU_F1 register
6609  */
6610 /*@{*/
6611 #define LLWU_RD_F1(base) (LLWU_F1_REG(base))
6612 #define LLWU_WR_F1(base, value) (LLWU_F1_REG(base) = (value))
6613 #define LLWU_RMW_F1(base, mask, value) (LLWU_WR_F1(base, (LLWU_RD_F1(base) & ~(mask)) | (value)))
6614 #define LLWU_SET_F1(base, value) (BME_OR8(&LLWU_F1_REG(base), (uint8_t)(value)))
6615 #define LLWU_CLR_F1(base, value) (BME_AND8(&LLWU_F1_REG(base), (uint8_t)(~(value))))
6616 #define LLWU_TOG_F1(base, value) (BME_XOR8(&LLWU_F1_REG(base), (uint8_t)(value)))
6617 /*@}*/
6618 
6619 /*
6620  * Constants & macros for individual LLWU_F1 bitfields
6621  */
6622 
6623 /*!
6624  * @name Register LLWU_F1, field WUF0[0] (W1C)
6625  *
6626  * Indicates that an enabled external wakeup pin was a source of exiting a
6627  * low-leakage power mode. To clear the flag write a one to WUF0.
6628  *
6629  * Values:
6630  * - 0b0 - LLWU_P0 input was not a wakeup source
6631  * - 0b1 - LLWU_P0 input was a wakeup source
6632  */
6633 /*@{*/
6634 /*! @brief Read current value of the LLWU_F1_WUF0 field. */
6635 #define LLWU_RD_F1_WUF0(base) ((LLWU_F1_REG(base) & LLWU_F1_WUF0_MASK) >> LLWU_F1_WUF0_SHIFT)
6636 #define LLWU_BRD_F1_WUF0(base) (BME_UBFX8(&LLWU_F1_REG(base), LLWU_F1_WUF0_SHIFT, LLWU_F1_WUF0_WIDTH))
6637 
6638 /*! @brief Set the WUF0 field to a new value. */
6639 #define LLWU_WR_F1_WUF0(base, value) (LLWU_RMW_F1(base, (LLWU_F1_WUF0_MASK | LLWU_F1_WUF1_MASK | LLWU_F1_WUF2_MASK | LLWU_F1_WUF3_MASK | LLWU_F1_WUF4_MASK | LLWU_F1_WUF5_MASK | LLWU_F1_WUF6_MASK | LLWU_F1_WUF7_MASK), LLWU_F1_WUF0(value)))
6640 #define LLWU_BWR_F1_WUF0(base, value) (BME_BFI8(&LLWU_F1_REG(base), ((uint8_t)(value) << LLWU_F1_WUF0_SHIFT), LLWU_F1_WUF0_SHIFT, LLWU_F1_WUF0_WIDTH))
6641 /*@}*/
6642 
6643 /*!
6644  * @name Register LLWU_F1, field WUF1[1] (W1C)
6645  *
6646  * Indicates that an enabled external wakeup pin was a source of exiting a
6647  * low-leakage power mode. To clear the flag write a one to WUF1.
6648  *
6649  * Values:
6650  * - 0b0 - LLWU_P1 input was not a wakeup source
6651  * - 0b1 - LLWU_P1 input was a wakeup source
6652  */
6653 /*@{*/
6654 /*! @brief Read current value of the LLWU_F1_WUF1 field. */
6655 #define LLWU_RD_F1_WUF1(base) ((LLWU_F1_REG(base) & LLWU_F1_WUF1_MASK) >> LLWU_F1_WUF1_SHIFT)
6656 #define LLWU_BRD_F1_WUF1(base) (BME_UBFX8(&LLWU_F1_REG(base), LLWU_F1_WUF1_SHIFT, LLWU_F1_WUF1_WIDTH))
6657 
6658 /*! @brief Set the WUF1 field to a new value. */
6659 #define LLWU_WR_F1_WUF1(base, value) (LLWU_RMW_F1(base, (LLWU_F1_WUF1_MASK | LLWU_F1_WUF0_MASK | LLWU_F1_WUF2_MASK | LLWU_F1_WUF3_MASK | LLWU_F1_WUF4_MASK | LLWU_F1_WUF5_MASK | LLWU_F1_WUF6_MASK | LLWU_F1_WUF7_MASK), LLWU_F1_WUF1(value)))
6660 #define LLWU_BWR_F1_WUF1(base, value) (BME_BFI8(&LLWU_F1_REG(base), ((uint8_t)(value) << LLWU_F1_WUF1_SHIFT), LLWU_F1_WUF1_SHIFT, LLWU_F1_WUF1_WIDTH))
6661 /*@}*/
6662 
6663 /*!
6664  * @name Register LLWU_F1, field WUF2[2] (W1C)
6665  *
6666  * Indicates that an enabled external wakeup pin was a source of exiting a
6667  * low-leakage power mode. To clear the flag write a one to WUF2.
6668  *
6669  * Values:
6670  * - 0b0 - LLWU_P2 input was not a wakeup source
6671  * - 0b1 - LLWU_P2 input was a wakeup source
6672  */
6673 /*@{*/
6674 /*! @brief Read current value of the LLWU_F1_WUF2 field. */
6675 #define LLWU_RD_F1_WUF2(base) ((LLWU_F1_REG(base) & LLWU_F1_WUF2_MASK) >> LLWU_F1_WUF2_SHIFT)
6676 #define LLWU_BRD_F1_WUF2(base) (BME_UBFX8(&LLWU_F1_REG(base), LLWU_F1_WUF2_SHIFT, LLWU_F1_WUF2_WIDTH))
6677 
6678 /*! @brief Set the WUF2 field to a new value. */
6679 #define LLWU_WR_F1_WUF2(base, value) (LLWU_RMW_F1(base, (LLWU_F1_WUF2_MASK | LLWU_F1_WUF0_MASK | LLWU_F1_WUF1_MASK | LLWU_F1_WUF3_MASK | LLWU_F1_WUF4_MASK | LLWU_F1_WUF5_MASK | LLWU_F1_WUF6_MASK | LLWU_F1_WUF7_MASK), LLWU_F1_WUF2(value)))
6680 #define LLWU_BWR_F1_WUF2(base, value) (BME_BFI8(&LLWU_F1_REG(base), ((uint8_t)(value) << LLWU_F1_WUF2_SHIFT), LLWU_F1_WUF2_SHIFT, LLWU_F1_WUF2_WIDTH))
6681 /*@}*/
6682 
6683 /*!
6684  * @name Register LLWU_F1, field WUF3[3] (W1C)
6685  *
6686  * Indicates that an enabled external wakeup pin was a source of exiting a
6687  * low-leakage power mode. To clear the flag write a one to WUF3.
6688  *
6689  * Values:
6690  * - 0b0 - LLWU_P3 input was not a wakeup source
6691  * - 0b1 - LLWU_P3 input was a wakeup source
6692  */
6693 /*@{*/
6694 /*! @brief Read current value of the LLWU_F1_WUF3 field. */
6695 #define LLWU_RD_F1_WUF3(base) ((LLWU_F1_REG(base) & LLWU_F1_WUF3_MASK) >> LLWU_F1_WUF3_SHIFT)
6696 #define LLWU_BRD_F1_WUF3(base) (BME_UBFX8(&LLWU_F1_REG(base), LLWU_F1_WUF3_SHIFT, LLWU_F1_WUF3_WIDTH))
6697 
6698 /*! @brief Set the WUF3 field to a new value. */
6699 #define LLWU_WR_F1_WUF3(base, value) (LLWU_RMW_F1(base, (LLWU_F1_WUF3_MASK | LLWU_F1_WUF0_MASK | LLWU_F1_WUF1_MASK | LLWU_F1_WUF2_MASK | LLWU_F1_WUF4_MASK | LLWU_F1_WUF5_MASK | LLWU_F1_WUF6_MASK | LLWU_F1_WUF7_MASK), LLWU_F1_WUF3(value)))
6700 #define LLWU_BWR_F1_WUF3(base, value) (BME_BFI8(&LLWU_F1_REG(base), ((uint8_t)(value) << LLWU_F1_WUF3_SHIFT), LLWU_F1_WUF3_SHIFT, LLWU_F1_WUF3_WIDTH))
6701 /*@}*/
6702 
6703 /*!
6704  * @name Register LLWU_F1, field WUF4[4] (W1C)
6705  *
6706  * Indicates that an enabled external wakeup pin was a source of exiting a
6707  * low-leakage power mode. To clear the flag write a one to WUF4.
6708  *
6709  * Values:
6710  * - 0b0 - LLWU_P4 input was not a wakeup source
6711  * - 0b1 - LLWU_P4 input was a wakeup source
6712  */
6713 /*@{*/
6714 /*! @brief Read current value of the LLWU_F1_WUF4 field. */
6715 #define LLWU_RD_F1_WUF4(base) ((LLWU_F1_REG(base) & LLWU_F1_WUF4_MASK) >> LLWU_F1_WUF4_SHIFT)
6716 #define LLWU_BRD_F1_WUF4(base) (BME_UBFX8(&LLWU_F1_REG(base), LLWU_F1_WUF4_SHIFT, LLWU_F1_WUF4_WIDTH))
6717 
6718 /*! @brief Set the WUF4 field to a new value. */
6719 #define LLWU_WR_F1_WUF4(base, value) (LLWU_RMW_F1(base, (LLWU_F1_WUF4_MASK | LLWU_F1_WUF0_MASK | LLWU_F1_WUF1_MASK | LLWU_F1_WUF2_MASK | LLWU_F1_WUF3_MASK | LLWU_F1_WUF5_MASK | LLWU_F1_WUF6_MASK | LLWU_F1_WUF7_MASK), LLWU_F1_WUF4(value)))
6720 #define LLWU_BWR_F1_WUF4(base, value) (BME_BFI8(&LLWU_F1_REG(base), ((uint8_t)(value) << LLWU_F1_WUF4_SHIFT), LLWU_F1_WUF4_SHIFT, LLWU_F1_WUF4_WIDTH))
6721 /*@}*/
6722 
6723 /*!
6724  * @name Register LLWU_F1, field WUF5[5] (W1C)
6725  *
6726  * Indicates that an enabled external wakeup pin was a source of exiting a
6727  * low-leakage power mode. To clear the flag write a one to WUF5.
6728  *
6729  * Values:
6730  * - 0b0 - LLWU_P5 input was not a wakeup source
6731  * - 0b1 - LLWU_P5 input was a wakeup source
6732  */
6733 /*@{*/
6734 /*! @brief Read current value of the LLWU_F1_WUF5 field. */
6735 #define LLWU_RD_F1_WUF5(base) ((LLWU_F1_REG(base) & LLWU_F1_WUF5_MASK) >> LLWU_F1_WUF5_SHIFT)
6736 #define LLWU_BRD_F1_WUF5(base) (BME_UBFX8(&LLWU_F1_REG(base), LLWU_F1_WUF5_SHIFT, LLWU_F1_WUF5_WIDTH))
6737 
6738 /*! @brief Set the WUF5 field to a new value. */
6739 #define LLWU_WR_F1_WUF5(base, value) (LLWU_RMW_F1(base, (LLWU_F1_WUF5_MASK | LLWU_F1_WUF0_MASK | LLWU_F1_WUF1_MASK | LLWU_F1_WUF2_MASK | LLWU_F1_WUF3_MASK | LLWU_F1_WUF4_MASK | LLWU_F1_WUF6_MASK | LLWU_F1_WUF7_MASK), LLWU_F1_WUF5(value)))
6740 #define LLWU_BWR_F1_WUF5(base, value) (BME_BFI8(&LLWU_F1_REG(base), ((uint8_t)(value) << LLWU_F1_WUF5_SHIFT), LLWU_F1_WUF5_SHIFT, LLWU_F1_WUF5_WIDTH))
6741 /*@}*/
6742 
6743 /*!
6744  * @name Register LLWU_F1, field WUF6[6] (W1C)
6745  *
6746  * Indicates that an enabled external wakeup pin was a source of exiting a
6747  * low-leakage power mode. To clear the flag write a one to WUF6.
6748  *
6749  * Values:
6750  * - 0b0 - LLWU_P6 input was not a wakeup source
6751  * - 0b1 - LLWU_P6 input was a wakeup source
6752  */
6753 /*@{*/
6754 /*! @brief Read current value of the LLWU_F1_WUF6 field. */
6755 #define LLWU_RD_F1_WUF6(base) ((LLWU_F1_REG(base) & LLWU_F1_WUF6_MASK) >> LLWU_F1_WUF6_SHIFT)
6756 #define LLWU_BRD_F1_WUF6(base) (BME_UBFX8(&LLWU_F1_REG(base), LLWU_F1_WUF6_SHIFT, LLWU_F1_WUF6_WIDTH))
6757 
6758 /*! @brief Set the WUF6 field to a new value. */
6759 #define LLWU_WR_F1_WUF6(base, value) (LLWU_RMW_F1(base, (LLWU_F1_WUF6_MASK | LLWU_F1_WUF0_MASK | LLWU_F1_WUF1_MASK | LLWU_F1_WUF2_MASK | LLWU_F1_WUF3_MASK | LLWU_F1_WUF4_MASK | LLWU_F1_WUF5_MASK | LLWU_F1_WUF7_MASK), LLWU_F1_WUF6(value)))
6760 #define LLWU_BWR_F1_WUF6(base, value) (BME_BFI8(&LLWU_F1_REG(base), ((uint8_t)(value) << LLWU_F1_WUF6_SHIFT), LLWU_F1_WUF6_SHIFT, LLWU_F1_WUF6_WIDTH))
6761 /*@}*/
6762 
6763 /*!
6764  * @name Register LLWU_F1, field WUF7[7] (W1C)
6765  *
6766  * Indicates that an enabled external wakeup pin was a source of exiting a
6767  * low-leakage power mode. To clear the flag write a one to WUF7.
6768  *
6769  * Values:
6770  * - 0b0 - LLWU_P7 input was not a wakeup source
6771  * - 0b1 - LLWU_P7 input was a wakeup source
6772  */
6773 /*@{*/
6774 /*! @brief Read current value of the LLWU_F1_WUF7 field. */
6775 #define LLWU_RD_F1_WUF7(base) ((LLWU_F1_REG(base) & LLWU_F1_WUF7_MASK) >> LLWU_F1_WUF7_SHIFT)
6776 #define LLWU_BRD_F1_WUF7(base) (BME_UBFX8(&LLWU_F1_REG(base), LLWU_F1_WUF7_SHIFT, LLWU_F1_WUF7_WIDTH))
6777 
6778 /*! @brief Set the WUF7 field to a new value. */
6779 #define LLWU_WR_F1_WUF7(base, value) (LLWU_RMW_F1(base, (LLWU_F1_WUF7_MASK | LLWU_F1_WUF0_MASK | LLWU_F1_WUF1_MASK | LLWU_F1_WUF2_MASK | LLWU_F1_WUF3_MASK | LLWU_F1_WUF4_MASK | LLWU_F1_WUF5_MASK | LLWU_F1_WUF6_MASK), LLWU_F1_WUF7(value)))
6780 #define LLWU_BWR_F1_WUF7(base, value) (BME_BFI8(&LLWU_F1_REG(base), ((uint8_t)(value) << LLWU_F1_WUF7_SHIFT), LLWU_F1_WUF7_SHIFT, LLWU_F1_WUF7_WIDTH))
6781 /*@}*/
6782 
6783 /*******************************************************************************
6784  * LLWU_F2 - LLWU Flag 2 register
6785  ******************************************************************************/
6786 
6787 /*!
6788  * @brief LLWU_F2 - LLWU Flag 2 register (W1C)
6789  *
6790  * Reset value: 0x00U
6791  *
6792  * LLWU_F2 contains the wakeup flags indicating which wakeup source caused the
6793  * MCU to exit LLS or VLLS mode. For LLS, this is the source causing the CPU
6794  * interrupt flow. For VLLS, this is the source causing the MCU reset flow. The
6795  * external wakeup flags are read-only and clearing a flag is accomplished by a write
6796  * of a 1 to the corresponding WUFx bit. The wakeup flag (WUFx), if set, will
6797  * remain set if the associated WUPEx bit is cleared. This register is reset on Chip
6798  * Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is
6799  * unaffected by reset types that do not trigger Chip Reset not VLLS. See the
6800  * Introduction details for more information.
6801  */
6802 /*!
6803  * @name Constants and macros for entire LLWU_F2 register
6804  */
6805 /*@{*/
6806 #define LLWU_RD_F2(base) (LLWU_F2_REG(base))
6807 #define LLWU_WR_F2(base, value) (LLWU_F2_REG(base) = (value))
6808 #define LLWU_RMW_F2(base, mask, value) (LLWU_WR_F2(base, (LLWU_RD_F2(base) & ~(mask)) | (value)))
6809 #define LLWU_SET_F2(base, value) (BME_OR8(&LLWU_F2_REG(base), (uint8_t)(value)))
6810 #define LLWU_CLR_F2(base, value) (BME_AND8(&LLWU_F2_REG(base), (uint8_t)(~(value))))
6811 #define LLWU_TOG_F2(base, value) (BME_XOR8(&LLWU_F2_REG(base), (uint8_t)(value)))
6812 /*@}*/
6813 
6814 /*
6815  * Constants & macros for individual LLWU_F2 bitfields
6816  */
6817 
6818 /*!
6819  * @name Register LLWU_F2, field WUF8[0] (W1C)
6820  *
6821  * Indicates that an enabled external wakeup pin was a source of exiting a
6822  * low-leakage power mode. To clear the flag write a one to WUF8.
6823  *
6824  * Values:
6825  * - 0b0 - LLWU_P8 input was not a wakeup source
6826  * - 0b1 - LLWU_P8 input was a wakeup source
6827  */
6828 /*@{*/
6829 /*! @brief Read current value of the LLWU_F2_WUF8 field. */
6830 #define LLWU_RD_F2_WUF8(base) ((LLWU_F2_REG(base) & LLWU_F2_WUF8_MASK) >> LLWU_F2_WUF8_SHIFT)
6831 #define LLWU_BRD_F2_WUF8(base) (BME_UBFX8(&LLWU_F2_REG(base), LLWU_F2_WUF8_SHIFT, LLWU_F2_WUF8_WIDTH))
6832 
6833 /*! @brief Set the WUF8 field to a new value. */
6834 #define LLWU_WR_F2_WUF8(base, value) (LLWU_RMW_F2(base, (LLWU_F2_WUF8_MASK | LLWU_F2_WUF9_MASK | LLWU_F2_WUF10_MASK | LLWU_F2_WUF11_MASK | LLWU_F2_WUF12_MASK | LLWU_F2_WUF13_MASK | LLWU_F2_WUF14_MASK | LLWU_F2_WUF15_MASK), LLWU_F2_WUF8(value)))
6835 #define LLWU_BWR_F2_WUF8(base, value) (BME_BFI8(&LLWU_F2_REG(base), ((uint8_t)(value) << LLWU_F2_WUF8_SHIFT), LLWU_F2_WUF8_SHIFT, LLWU_F2_WUF8_WIDTH))
6836 /*@}*/
6837 
6838 /*!
6839  * @name Register LLWU_F2, field WUF9[1] (W1C)
6840  *
6841  * Indicates that an enabled external wakeup pin was a source of exiting a
6842  * low-leakage power mode. To clear the flag write a one to WUF9.
6843  *
6844  * Values:
6845  * - 0b0 - LLWU_P9 input was not a wakeup source
6846  * - 0b1 - LLWU_P9 input was a wakeup source
6847  */
6848 /*@{*/
6849 /*! @brief Read current value of the LLWU_F2_WUF9 field. */
6850 #define LLWU_RD_F2_WUF9(base) ((LLWU_F2_REG(base) & LLWU_F2_WUF9_MASK) >> LLWU_F2_WUF9_SHIFT)
6851 #define LLWU_BRD_F2_WUF9(base) (BME_UBFX8(&LLWU_F2_REG(base), LLWU_F2_WUF9_SHIFT, LLWU_F2_WUF9_WIDTH))
6852 
6853 /*! @brief Set the WUF9 field to a new value. */
6854 #define LLWU_WR_F2_WUF9(base, value) (LLWU_RMW_F2(base, (LLWU_F2_WUF9_MASK | LLWU_F2_WUF8_MASK | LLWU_F2_WUF10_MASK | LLWU_F2_WUF11_MASK | LLWU_F2_WUF12_MASK | LLWU_F2_WUF13_MASK | LLWU_F2_WUF14_MASK | LLWU_F2_WUF15_MASK), LLWU_F2_WUF9(value)))
6855 #define LLWU_BWR_F2_WUF9(base, value) (BME_BFI8(&LLWU_F2_REG(base), ((uint8_t)(value) << LLWU_F2_WUF9_SHIFT), LLWU_F2_WUF9_SHIFT, LLWU_F2_WUF9_WIDTH))
6856 /*@}*/
6857 
6858 /*!
6859  * @name Register LLWU_F2, field WUF10[2] (W1C)
6860  *
6861  * Indicates that an enabled external wakeup pin was a source of exiting a
6862  * low-leakage power mode. To clear the flag write a one to WUF10.
6863  *
6864  * Values:
6865  * - 0b0 - LLWU_P10 input was not a wakeup source
6866  * - 0b1 - LLWU_P10 input was a wakeup source
6867  */
6868 /*@{*/
6869 /*! @brief Read current value of the LLWU_F2_WUF10 field. */
6870 #define LLWU_RD_F2_WUF10(base) ((LLWU_F2_REG(base) & LLWU_F2_WUF10_MASK) >> LLWU_F2_WUF10_SHIFT)
6871 #define LLWU_BRD_F2_WUF10(base) (BME_UBFX8(&LLWU_F2_REG(base), LLWU_F2_WUF10_SHIFT, LLWU_F2_WUF10_WIDTH))
6872 
6873 /*! @brief Set the WUF10 field to a new value. */
6874 #define LLWU_WR_F2_WUF10(base, value) (LLWU_RMW_F2(base, (LLWU_F2_WUF10_MASK | LLWU_F2_WUF8_MASK | LLWU_F2_WUF9_MASK | LLWU_F2_WUF11_MASK | LLWU_F2_WUF12_MASK | LLWU_F2_WUF13_MASK | LLWU_F2_WUF14_MASK | LLWU_F2_WUF15_MASK), LLWU_F2_WUF10(value)))
6875 #define LLWU_BWR_F2_WUF10(base, value) (BME_BFI8(&LLWU_F2_REG(base), ((uint8_t)(value) << LLWU_F2_WUF10_SHIFT), LLWU_F2_WUF10_SHIFT, LLWU_F2_WUF10_WIDTH))
6876 /*@}*/
6877 
6878 /*!
6879  * @name Register LLWU_F2, field WUF11[3] (W1C)
6880  *
6881  * Indicates that an enabled external wakeup pin was a source of exiting a
6882  * low-leakage power mode. To clear the flag write a one to WUF11.
6883  *
6884  * Values:
6885  * - 0b0 - LLWU_P11 input was not a wakeup source
6886  * - 0b1 - LLWU_P11 input was a wakeup source
6887  */
6888 /*@{*/
6889 /*! @brief Read current value of the LLWU_F2_WUF11 field. */
6890 #define LLWU_RD_F2_WUF11(base) ((LLWU_F2_REG(base) & LLWU_F2_WUF11_MASK) >> LLWU_F2_WUF11_SHIFT)
6891 #define LLWU_BRD_F2_WUF11(base) (BME_UBFX8(&LLWU_F2_REG(base), LLWU_F2_WUF11_SHIFT, LLWU_F2_WUF11_WIDTH))
6892 
6893 /*! @brief Set the WUF11 field to a new value. */
6894 #define LLWU_WR_F2_WUF11(base, value) (LLWU_RMW_F2(base, (LLWU_F2_WUF11_MASK | LLWU_F2_WUF8_MASK | LLWU_F2_WUF9_MASK | LLWU_F2_WUF10_MASK | LLWU_F2_WUF12_MASK | LLWU_F2_WUF13_MASK | LLWU_F2_WUF14_MASK | LLWU_F2_WUF15_MASK), LLWU_F2_WUF11(value)))
6895 #define LLWU_BWR_F2_WUF11(base, value) (BME_BFI8(&LLWU_F2_REG(base), ((uint8_t)(value) << LLWU_F2_WUF11_SHIFT), LLWU_F2_WUF11_SHIFT, LLWU_F2_WUF11_WIDTH))
6896 /*@}*/
6897 
6898 /*!
6899  * @name Register LLWU_F2, field WUF12[4] (W1C)
6900  *
6901  * Indicates that an enabled external wakeup pin was a source of exiting a
6902  * low-leakage power mode. To clear the flag write a one to WUF12.
6903  *
6904  * Values:
6905  * - 0b0 - LLWU_P12 input was not a wakeup source
6906  * - 0b1 - LLWU_P12 input was a wakeup source
6907  */
6908 /*@{*/
6909 /*! @brief Read current value of the LLWU_F2_WUF12 field. */
6910 #define LLWU_RD_F2_WUF12(base) ((LLWU_F2_REG(base) & LLWU_F2_WUF12_MASK) >> LLWU_F2_WUF12_SHIFT)
6911 #define LLWU_BRD_F2_WUF12(base) (BME_UBFX8(&LLWU_F2_REG(base), LLWU_F2_WUF12_SHIFT, LLWU_F2_WUF12_WIDTH))
6912 
6913 /*! @brief Set the WUF12 field to a new value. */
6914 #define LLWU_WR_F2_WUF12(base, value) (LLWU_RMW_F2(base, (LLWU_F2_WUF12_MASK | LLWU_F2_WUF8_MASK | LLWU_F2_WUF9_MASK | LLWU_F2_WUF10_MASK | LLWU_F2_WUF11_MASK | LLWU_F2_WUF13_MASK | LLWU_F2_WUF14_MASK | LLWU_F2_WUF15_MASK), LLWU_F2_WUF12(value)))
6915 #define LLWU_BWR_F2_WUF12(base, value) (BME_BFI8(&LLWU_F2_REG(base), ((uint8_t)(value) << LLWU_F2_WUF12_SHIFT), LLWU_F2_WUF12_SHIFT, LLWU_F2_WUF12_WIDTH))
6916 /*@}*/
6917 
6918 /*!
6919  * @name Register LLWU_F2, field WUF13[5] (W1C)
6920  *
6921  * Indicates that an enabled external wakeup pin was a source of exiting a
6922  * low-leakage power mode. To clear the flag write a one to WUF13.
6923  *
6924  * Values:
6925  * - 0b0 - LLWU_P13 input was not a wakeup source
6926  * - 0b1 - LLWU_P13 input was a wakeup source
6927  */
6928 /*@{*/
6929 /*! @brief Read current value of the LLWU_F2_WUF13 field. */
6930 #define LLWU_RD_F2_WUF13(base) ((LLWU_F2_REG(base) & LLWU_F2_WUF13_MASK) >> LLWU_F2_WUF13_SHIFT)
6931 #define LLWU_BRD_F2_WUF13(base) (BME_UBFX8(&LLWU_F2_REG(base), LLWU_F2_WUF13_SHIFT, LLWU_F2_WUF13_WIDTH))
6932 
6933 /*! @brief Set the WUF13 field to a new value. */
6934 #define LLWU_WR_F2_WUF13(base, value) (LLWU_RMW_F2(base, (LLWU_F2_WUF13_MASK | LLWU_F2_WUF8_MASK | LLWU_F2_WUF9_MASK | LLWU_F2_WUF10_MASK | LLWU_F2_WUF11_MASK | LLWU_F2_WUF12_MASK | LLWU_F2_WUF14_MASK | LLWU_F2_WUF15_MASK), LLWU_F2_WUF13(value)))
6935 #define LLWU_BWR_F2_WUF13(base, value) (BME_BFI8(&LLWU_F2_REG(base), ((uint8_t)(value) << LLWU_F2_WUF13_SHIFT), LLWU_F2_WUF13_SHIFT, LLWU_F2_WUF13_WIDTH))
6936 /*@}*/
6937 
6938 /*!
6939  * @name Register LLWU_F2, field WUF14[6] (W1C)
6940  *
6941  * Indicates that an enabled external wakeup pin was a source of exiting a
6942  * low-leakage power mode. To clear the flag write a one to WUF14.
6943  *
6944  * Values:
6945  * - 0b0 - LLWU_P14 input was not a wakeup source
6946  * - 0b1 - LLWU_P14 input was a wakeup source
6947  */
6948 /*@{*/
6949 /*! @brief Read current value of the LLWU_F2_WUF14 field. */
6950 #define LLWU_RD_F2_WUF14(base) ((LLWU_F2_REG(base) & LLWU_F2_WUF14_MASK) >> LLWU_F2_WUF14_SHIFT)
6951 #define LLWU_BRD_F2_WUF14(base) (BME_UBFX8(&LLWU_F2_REG(base), LLWU_F2_WUF14_SHIFT, LLWU_F2_WUF14_WIDTH))
6952 
6953 /*! @brief Set the WUF14 field to a new value. */
6954 #define LLWU_WR_F2_WUF14(base, value) (LLWU_RMW_F2(base, (LLWU_F2_WUF14_MASK | LLWU_F2_WUF8_MASK | LLWU_F2_WUF9_MASK | LLWU_F2_WUF10_MASK | LLWU_F2_WUF11_MASK | LLWU_F2_WUF12_MASK | LLWU_F2_WUF13_MASK | LLWU_F2_WUF15_MASK), LLWU_F2_WUF14(value)))
6955 #define LLWU_BWR_F2_WUF14(base, value) (BME_BFI8(&LLWU_F2_REG(base), ((uint8_t)(value) << LLWU_F2_WUF14_SHIFT), LLWU_F2_WUF14_SHIFT, LLWU_F2_WUF14_WIDTH))
6956 /*@}*/
6957 
6958 /*!
6959  * @name Register LLWU_F2, field WUF15[7] (W1C)
6960  *
6961  * Indicates that an enabled external wakeup pin was a source of exiting a
6962  * low-leakage power mode. To clear the flag write a one to WUF15.
6963  *
6964  * Values:
6965  * - 0b0 - LLWU_P15 input was not a wakeup source
6966  * - 0b1 - LLWU_P15 input was a wakeup source
6967  */
6968 /*@{*/
6969 /*! @brief Read current value of the LLWU_F2_WUF15 field. */
6970 #define LLWU_RD_F2_WUF15(base) ((LLWU_F2_REG(base) & LLWU_F2_WUF15_MASK) >> LLWU_F2_WUF15_SHIFT)
6971 #define LLWU_BRD_F2_WUF15(base) (BME_UBFX8(&LLWU_F2_REG(base), LLWU_F2_WUF15_SHIFT, LLWU_F2_WUF15_WIDTH))
6972 
6973 /*! @brief Set the WUF15 field to a new value. */
6974 #define LLWU_WR_F2_WUF15(base, value) (LLWU_RMW_F2(base, (LLWU_F2_WUF15_MASK | LLWU_F2_WUF8_MASK | LLWU_F2_WUF9_MASK | LLWU_F2_WUF10_MASK | LLWU_F2_WUF11_MASK | LLWU_F2_WUF12_MASK | LLWU_F2_WUF13_MASK | LLWU_F2_WUF14_MASK), LLWU_F2_WUF15(value)))
6975 #define LLWU_BWR_F2_WUF15(base, value) (BME_BFI8(&LLWU_F2_REG(base), ((uint8_t)(value) << LLWU_F2_WUF15_SHIFT), LLWU_F2_WUF15_SHIFT, LLWU_F2_WUF15_WIDTH))
6976 /*@}*/
6977 
6978 /*******************************************************************************
6979  * LLWU_F3 - LLWU Flag 3 register
6980  ******************************************************************************/
6981 
6982 /*!
6983  * @brief LLWU_F3 - LLWU Flag 3 register (RO)
6984  *
6985  * Reset value: 0x00U
6986  *
6987  * LLWU_F3 contains the wakeup flags indicating which internal wakeup source
6988  * caused the MCU to exit LLS or VLLS mode. For LLS, this is the source causing the
6989  * CPU interrupt flow. For VLLS, this is the source causing the MCU reset flow.
6990  * For internal peripherals that are capable of running in a low-leakage power
6991  * mode, such as iRTC or CMP modules, the flag from the associated peripheral is
6992  * accessible as the MWUFx bit. The flag will need to be cleared in the peripheral
6993  * instead of writing a 1 to the MWUFx bit. This register is reset on Chip Reset
6994  * not VLLS and by reset types that trigger Chip Reset not VLLS. It is unaffected
6995  * by reset types that do not trigger Chip Reset not VLLS. See the Introduction
6996  * details for more information.
6997  */
6998 /*!
6999  * @name Constants and macros for entire LLWU_F3 register
7000  */
7001 /*@{*/
7002 #define LLWU_RD_F3(base) (LLWU_F3_REG(base))
7003 /*@}*/
7004 
7005 /*
7006  * Constants & macros for individual LLWU_F3 bitfields
7007  */
7008 
7009 /*!
7010  * @name Register LLWU_F3, field MWUF0[0] (RO)
7011  *
7012  * Indicates that an enabled internal peripheral was a source of exiting a
7013  * low-leakage power mode. To clear the flag, follow the internal peripheral flag
7014  * clearing mechanism.
7015  *
7016  * Values:
7017  * - 0b0 - Module 0 input was not a wakeup source
7018  * - 0b1 - Module 0 input was a wakeup source
7019  */
7020 /*@{*/
7021 /*! @brief Read current value of the LLWU_F3_MWUF0 field. */
7022 #define LLWU_RD_F3_MWUF0(base) ((LLWU_F3_REG(base) & LLWU_F3_MWUF0_MASK) >> LLWU_F3_MWUF0_SHIFT)
7023 #define LLWU_BRD_F3_MWUF0(base) (BME_UBFX8(&LLWU_F3_REG(base), LLWU_F3_MWUF0_SHIFT, LLWU_F3_MWUF0_WIDTH))
7024 /*@}*/
7025 
7026 /*!
7027  * @name Register LLWU_F3, field MWUF1[1] (RO)
7028  *
7029  * Indicates that an enabled internal peripheral was a source of exiting a
7030  * low-leakage power mode. To clear the flag, follow the internal peripheral flag
7031  * clearing mechanism.
7032  *
7033  * Values:
7034  * - 0b0 - Module 1 input was not a wakeup source
7035  * - 0b1 - Module 1 input was a wakeup source
7036  */
7037 /*@{*/
7038 /*! @brief Read current value of the LLWU_F3_MWUF1 field. */
7039 #define LLWU_RD_F3_MWUF1(base) ((LLWU_F3_REG(base) & LLWU_F3_MWUF1_MASK) >> LLWU_F3_MWUF1_SHIFT)
7040 #define LLWU_BRD_F3_MWUF1(base) (BME_UBFX8(&LLWU_F3_REG(base), LLWU_F3_MWUF1_SHIFT, LLWU_F3_MWUF1_WIDTH))
7041 /*@}*/
7042 
7043 /*!
7044  * @name Register LLWU_F3, field MWUF2[2] (RO)
7045  *
7046  * Indicates that an enabled internal peripheral was a source of exiting a
7047  * low-leakage power mode. To clear the flag, follow the internal peripheral flag
7048  * clearing mechanism.
7049  *
7050  * Values:
7051  * - 0b0 - Module 2 input was not a wakeup source
7052  * - 0b1 - Module 2 input was a wakeup source
7053  */
7054 /*@{*/
7055 /*! @brief Read current value of the LLWU_F3_MWUF2 field. */
7056 #define LLWU_RD_F3_MWUF2(base) ((LLWU_F3_REG(base) & LLWU_F3_MWUF2_MASK) >> LLWU_F3_MWUF2_SHIFT)
7057 #define LLWU_BRD_F3_MWUF2(base) (BME_UBFX8(&LLWU_F3_REG(base), LLWU_F3_MWUF2_SHIFT, LLWU_F3_MWUF2_WIDTH))
7058 /*@}*/
7059 
7060 /*!
7061  * @name Register LLWU_F3, field MWUF3[3] (RO)
7062  *
7063  * Indicates that an enabled internal peripheral was a source of exiting a
7064  * low-leakage power mode. To clear the flag, follow the internal peripheral flag
7065  * clearing mechanism.
7066  *
7067  * Values:
7068  * - 0b0 - Module 3 input was not a wakeup source
7069  * - 0b1 - Module 3 input was a wakeup source
7070  */
7071 /*@{*/
7072 /*! @brief Read current value of the LLWU_F3_MWUF3 field. */
7073 #define LLWU_RD_F3_MWUF3(base) ((LLWU_F3_REG(base) & LLWU_F3_MWUF3_MASK) >> LLWU_F3_MWUF3_SHIFT)
7074 #define LLWU_BRD_F3_MWUF3(base) (BME_UBFX8(&LLWU_F3_REG(base), LLWU_F3_MWUF3_SHIFT, LLWU_F3_MWUF3_WIDTH))
7075 /*@}*/
7076 
7077 /*!
7078  * @name Register LLWU_F3, field MWUF4[4] (RO)
7079  *
7080  * Indicates that an enabled internal peripheral was a source of exiting a
7081  * low-leakage power mode. To clear the flag, follow the internal peripheral flag
7082  * clearing mechanism.
7083  *
7084  * Values:
7085  * - 0b0 - Module 4 input was not a wakeup source
7086  * - 0b1 - Module 4 input was a wakeup source
7087  */
7088 /*@{*/
7089 /*! @brief Read current value of the LLWU_F3_MWUF4 field. */
7090 #define LLWU_RD_F3_MWUF4(base) ((LLWU_F3_REG(base) & LLWU_F3_MWUF4_MASK) >> LLWU_F3_MWUF4_SHIFT)
7091 #define LLWU_BRD_F3_MWUF4(base) (BME_UBFX8(&LLWU_F3_REG(base), LLWU_F3_MWUF4_SHIFT, LLWU_F3_MWUF4_WIDTH))
7092 /*@}*/
7093 
7094 /*!
7095  * @name Register LLWU_F3, field MWUF5[5] (RO)
7096  *
7097  * Indicates that an enabled internal peripheral was a source of exiting a
7098  * low-leakage power mode. To clear the flag, follow the internal peripheral flag
7099  * clearing mechanism.
7100  *
7101  * Values:
7102  * - 0b0 - Module 5 input was not a wakeup source
7103  * - 0b1 - Module 5 input was a wakeup source
7104  */
7105 /*@{*/
7106 /*! @brief Read current value of the LLWU_F3_MWUF5 field. */
7107 #define LLWU_RD_F3_MWUF5(base) ((LLWU_F3_REG(base) & LLWU_F3_MWUF5_MASK) >> LLWU_F3_MWUF5_SHIFT)
7108 #define LLWU_BRD_F3_MWUF5(base) (BME_UBFX8(&LLWU_F3_REG(base), LLWU_F3_MWUF5_SHIFT, LLWU_F3_MWUF5_WIDTH))
7109 /*@}*/
7110 
7111 /*!
7112  * @name Register LLWU_F3, field MWUF6[6] (RO)
7113  *
7114  * Indicates that an enabled internal peripheral was a source of exiting a
7115  * low-leakage power mode. To clear the flag, follow the internal peripheral flag
7116  * clearing mechanism.
7117  *
7118  * Values:
7119  * - 0b0 - Module 6 input was not a wakeup source
7120  * - 0b1 - Module 6 input was a wakeup source
7121  */
7122 /*@{*/
7123 /*! @brief Read current value of the LLWU_F3_MWUF6 field. */
7124 #define LLWU_RD_F3_MWUF6(base) ((LLWU_F3_REG(base) & LLWU_F3_MWUF6_MASK) >> LLWU_F3_MWUF6_SHIFT)
7125 #define LLWU_BRD_F3_MWUF6(base) (BME_UBFX8(&LLWU_F3_REG(base), LLWU_F3_MWUF6_SHIFT, LLWU_F3_MWUF6_WIDTH))
7126 /*@}*/
7127 
7128 /*!
7129  * @name Register LLWU_F3, field MWUF7[7] (RO)
7130  *
7131  * Indicates that an enabled internal peripheral was a source of exiting a
7132  * low-leakage power mode. To clear the flag, follow the internal peripheral flag
7133  * clearing mechanism.
7134  *
7135  * Values:
7136  * - 0b0 - Module 7 input was not a wakeup source
7137  * - 0b1 - Module 7 input was a wakeup source
7138  */
7139 /*@{*/
7140 /*! @brief Read current value of the LLWU_F3_MWUF7 field. */
7141 #define LLWU_RD_F3_MWUF7(base) ((LLWU_F3_REG(base) & LLWU_F3_MWUF7_MASK) >> LLWU_F3_MWUF7_SHIFT)
7142 #define LLWU_BRD_F3_MWUF7(base) (BME_UBFX8(&LLWU_F3_REG(base), LLWU_F3_MWUF7_SHIFT, LLWU_F3_MWUF7_WIDTH))
7143 /*@}*/
7144 
7145 /*******************************************************************************
7146  * LLWU_FILT1 - LLWU Pin Filter 1 register
7147  ******************************************************************************/
7148 
7149 /*!
7150  * @brief LLWU_FILT1 - LLWU Pin Filter 1 register (RW)
7151  *
7152  * Reset value: 0x00U
7153  *
7154  * LLWU_FILT1 is a control and status register that is used to enable/disable
7155  * the digital filter 1 features for an external pin. This register is reset on
7156  * Chip Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is
7157  * unaffected by reset types that do not trigger Chip Reset not VLLS. See the
7158  * Introduction details for more information.
7159  */
7160 /*!
7161  * @name Constants and macros for entire LLWU_FILT1 register
7162  */
7163 /*@{*/
7164 #define LLWU_RD_FILT1(base) (LLWU_FILT1_REG(base))
7165 #define LLWU_WR_FILT1(base, value) (LLWU_FILT1_REG(base) = (value))
7166 #define LLWU_RMW_FILT1(base, mask, value) (LLWU_WR_FILT1(base, (LLWU_RD_FILT1(base) & ~(mask)) | (value)))
7167 #define LLWU_SET_FILT1(base, value) (BME_OR8(&LLWU_FILT1_REG(base), (uint8_t)(value)))
7168 #define LLWU_CLR_FILT1(base, value) (BME_AND8(&LLWU_FILT1_REG(base), (uint8_t)(~(value))))
7169 #define LLWU_TOG_FILT1(base, value) (BME_XOR8(&LLWU_FILT1_REG(base), (uint8_t)(value)))
7170 /*@}*/
7171 
7172 /*
7173  * Constants & macros for individual LLWU_FILT1 bitfields
7174  */
7175 
7176 /*!
7177  * @name Register LLWU_FILT1, field FILTSEL[3:0] (RW)
7178  *
7179  * Selects 1 out of the 16 wakeup pins to be muxed into the filter.
7180  *
7181  * Values:
7182  * - 0b0000 - Select LLWU_P0 for filter
7183  * - 0b1111 - Select LLWU_P15 for filter
7184  */
7185 /*@{*/
7186 /*! @brief Read current value of the LLWU_FILT1_FILTSEL field. */
7187 #define LLWU_RD_FILT1_FILTSEL(base) ((LLWU_FILT1_REG(base) & LLWU_FILT1_FILTSEL_MASK) >> LLWU_FILT1_FILTSEL_SHIFT)
7188 #define LLWU_BRD_FILT1_FILTSEL(base) (BME_UBFX8(&LLWU_FILT1_REG(base), LLWU_FILT1_FILTSEL_SHIFT, LLWU_FILT1_FILTSEL_WIDTH))
7189 
7190 /*! @brief Set the FILTSEL field to a new value. */
7191 #define LLWU_WR_FILT1_FILTSEL(base, value) (LLWU_RMW_FILT1(base, (LLWU_FILT1_FILTSEL_MASK | LLWU_FILT1_FILTF_MASK), LLWU_FILT1_FILTSEL(value)))
7192 #define LLWU_BWR_FILT1_FILTSEL(base, value) (BME_BFI8(&LLWU_FILT1_REG(base), ((uint8_t)(value) << LLWU_FILT1_FILTSEL_SHIFT), LLWU_FILT1_FILTSEL_SHIFT, LLWU_FILT1_FILTSEL_WIDTH))
7193 /*@}*/
7194 
7195 /*!
7196  * @name Register LLWU_FILT1, field FILTE[6:5] (RW)
7197  *
7198  * Controls the digital filter options for the external pin detect.
7199  *
7200  * Values:
7201  * - 0b00 - Filter disabled
7202  * - 0b01 - Filter posedge detect enabled
7203  * - 0b10 - Filter negedge detect enabled
7204  * - 0b11 - Filter any edge detect enabled
7205  */
7206 /*@{*/
7207 /*! @brief Read current value of the LLWU_FILT1_FILTE field. */
7208 #define LLWU_RD_FILT1_FILTE(base) ((LLWU_FILT1_REG(base) & LLWU_FILT1_FILTE_MASK) >> LLWU_FILT1_FILTE_SHIFT)
7209 #define LLWU_BRD_FILT1_FILTE(base) (BME_UBFX8(&LLWU_FILT1_REG(base), LLWU_FILT1_FILTE_SHIFT, LLWU_FILT1_FILTE_WIDTH))
7210 
7211 /*! @brief Set the FILTE field to a new value. */
7212 #define LLWU_WR_FILT1_FILTE(base, value) (LLWU_RMW_FILT1(base, (LLWU_FILT1_FILTE_MASK | LLWU_FILT1_FILTF_MASK), LLWU_FILT1_FILTE(value)))
7213 #define LLWU_BWR_FILT1_FILTE(base, value) (BME_BFI8(&LLWU_FILT1_REG(base), ((uint8_t)(value) << LLWU_FILT1_FILTE_SHIFT), LLWU_FILT1_FILTE_SHIFT, LLWU_FILT1_FILTE_WIDTH))
7214 /*@}*/
7215 
7216 /*!
7217  * @name Register LLWU_FILT1, field FILTF[7] (W1C)
7218  *
7219  * Indicates that the filtered external wakeup pin, selected by FILTSEL, was a
7220  * source of exiting a low-leakage power mode. To clear the flag write a one to
7221  * FILTF.
7222  *
7223  * Values:
7224  * - 0b0 - Pin Filter 1 was not a wakeup source
7225  * - 0b1 - Pin Filter 1 was a wakeup source
7226  */
7227 /*@{*/
7228 /*! @brief Read current value of the LLWU_FILT1_FILTF field. */
7229 #define LLWU_RD_FILT1_FILTF(base) ((LLWU_FILT1_REG(base) & LLWU_FILT1_FILTF_MASK) >> LLWU_FILT1_FILTF_SHIFT)
7230 #define LLWU_BRD_FILT1_FILTF(base) (BME_UBFX8(&LLWU_FILT1_REG(base), LLWU_FILT1_FILTF_SHIFT, LLWU_FILT1_FILTF_WIDTH))
7231 
7232 /*! @brief Set the FILTF field to a new value. */
7233 #define LLWU_WR_FILT1_FILTF(base, value) (LLWU_RMW_FILT1(base, LLWU_FILT1_FILTF_MASK, LLWU_FILT1_FILTF(value)))
7234 #define LLWU_BWR_FILT1_FILTF(base, value) (BME_BFI8(&LLWU_FILT1_REG(base), ((uint8_t)(value) << LLWU_FILT1_FILTF_SHIFT), LLWU_FILT1_FILTF_SHIFT, LLWU_FILT1_FILTF_WIDTH))
7235 /*@}*/
7236 
7237 /*******************************************************************************
7238  * LLWU_FILT2 - LLWU Pin Filter 2 register
7239  ******************************************************************************/
7240 
7241 /*!
7242  * @brief LLWU_FILT2 - LLWU Pin Filter 2 register (RW)
7243  *
7244  * Reset value: 0x00U
7245  *
7246  * LLWU_FILT2 is a control and status register that is used to enable/disable
7247  * the digital filter 2 features for an external pin. This register is reset on
7248  * Chip Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is
7249  * unaffected by reset types that do not trigger Chip Reset not VLLS. See the
7250  * Introduction details for more information.
7251  */
7252 /*!
7253  * @name Constants and macros for entire LLWU_FILT2 register
7254  */
7255 /*@{*/
7256 #define LLWU_RD_FILT2(base) (LLWU_FILT2_REG(base))
7257 #define LLWU_WR_FILT2(base, value) (LLWU_FILT2_REG(base) = (value))
7258 #define LLWU_RMW_FILT2(base, mask, value) (LLWU_WR_FILT2(base, (LLWU_RD_FILT2(base) & ~(mask)) | (value)))
7259 #define LLWU_SET_FILT2(base, value) (BME_OR8(&LLWU_FILT2_REG(base), (uint8_t)(value)))
7260 #define LLWU_CLR_FILT2(base, value) (BME_AND8(&LLWU_FILT2_REG(base), (uint8_t)(~(value))))
7261 #define LLWU_TOG_FILT2(base, value) (BME_XOR8(&LLWU_FILT2_REG(base), (uint8_t)(value)))
7262 /*@}*/
7263 
7264 /*
7265  * Constants & macros for individual LLWU_FILT2 bitfields
7266  */
7267 
7268 /*!
7269  * @name Register LLWU_FILT2, field FILTSEL[3:0] (RW)
7270  *
7271  * Selects 1 out of the 16 wakeup pins to be muxed into the filter.
7272  *
7273  * Values:
7274  * - 0b0000 - Select LLWU_P0 for filter
7275  * - 0b1111 - Select LLWU_P15 for filter
7276  */
7277 /*@{*/
7278 /*! @brief Read current value of the LLWU_FILT2_FILTSEL field. */
7279 #define LLWU_RD_FILT2_FILTSEL(base) ((LLWU_FILT2_REG(base) & LLWU_FILT2_FILTSEL_MASK) >> LLWU_FILT2_FILTSEL_SHIFT)
7280 #define LLWU_BRD_FILT2_FILTSEL(base) (BME_UBFX8(&LLWU_FILT2_REG(base), LLWU_FILT2_FILTSEL_SHIFT, LLWU_FILT2_FILTSEL_WIDTH))
7281 
7282 /*! @brief Set the FILTSEL field to a new value. */
7283 #define LLWU_WR_FILT2_FILTSEL(base, value) (LLWU_RMW_FILT2(base, (LLWU_FILT2_FILTSEL_MASK | LLWU_FILT2_FILTF_MASK), LLWU_FILT2_FILTSEL(value)))
7284 #define LLWU_BWR_FILT2_FILTSEL(base, value) (BME_BFI8(&LLWU_FILT2_REG(base), ((uint8_t)(value) << LLWU_FILT2_FILTSEL_SHIFT), LLWU_FILT2_FILTSEL_SHIFT, LLWU_FILT2_FILTSEL_WIDTH))
7285 /*@}*/
7286 
7287 /*!
7288  * @name Register LLWU_FILT2, field FILTE[6:5] (RW)
7289  *
7290  * Controls the digital filter options for the external pin detect.
7291  *
7292  * Values:
7293  * - 0b00 - Filter disabled
7294  * - 0b01 - Filter posedge detect enabled
7295  * - 0b10 - Filter negedge detect enabled
7296  * - 0b11 - Filter any edge detect enabled
7297  */
7298 /*@{*/
7299 /*! @brief Read current value of the LLWU_FILT2_FILTE field. */
7300 #define LLWU_RD_FILT2_FILTE(base) ((LLWU_FILT2_REG(base) & LLWU_FILT2_FILTE_MASK) >> LLWU_FILT2_FILTE_SHIFT)
7301 #define LLWU_BRD_FILT2_FILTE(base) (BME_UBFX8(&LLWU_FILT2_REG(base), LLWU_FILT2_FILTE_SHIFT, LLWU_FILT2_FILTE_WIDTH))
7302 
7303 /*! @brief Set the FILTE field to a new value. */
7304 #define LLWU_WR_FILT2_FILTE(base, value) (LLWU_RMW_FILT2(base, (LLWU_FILT2_FILTE_MASK | LLWU_FILT2_FILTF_MASK), LLWU_FILT2_FILTE(value)))
7305 #define LLWU_BWR_FILT2_FILTE(base, value) (BME_BFI8(&LLWU_FILT2_REG(base), ((uint8_t)(value) << LLWU_FILT2_FILTE_SHIFT), LLWU_FILT2_FILTE_SHIFT, LLWU_FILT2_FILTE_WIDTH))
7306 /*@}*/
7307 
7308 /*!
7309  * @name Register LLWU_FILT2, field FILTF[7] (W1C)
7310  *
7311  * Indicates that the filtered external wakeup pin, selected by FILTSEL, was a
7312  * source of exiting a low-leakage power mode. To clear the flag write a one to
7313  * FILTF.
7314  *
7315  * Values:
7316  * - 0b0 - Pin Filter 2 was not a wakeup source
7317  * - 0b1 - Pin Filter 2 was a wakeup source
7318  */
7319 /*@{*/
7320 /*! @brief Read current value of the LLWU_FILT2_FILTF field. */
7321 #define LLWU_RD_FILT2_FILTF(base) ((LLWU_FILT2_REG(base) & LLWU_FILT2_FILTF_MASK) >> LLWU_FILT2_FILTF_SHIFT)
7322 #define LLWU_BRD_FILT2_FILTF(base) (BME_UBFX8(&LLWU_FILT2_REG(base), LLWU_FILT2_FILTF_SHIFT, LLWU_FILT2_FILTF_WIDTH))
7323 
7324 /*! @brief Set the FILTF field to a new value. */
7325 #define LLWU_WR_FILT2_FILTF(base, value) (LLWU_RMW_FILT2(base, LLWU_FILT2_FILTF_MASK, LLWU_FILT2_FILTF(value)))
7326 #define LLWU_BWR_FILT2_FILTF(base, value) (BME_BFI8(&LLWU_FILT2_REG(base), ((uint8_t)(value) << LLWU_FILT2_FILTF_SHIFT), LLWU_FILT2_FILTF_SHIFT, LLWU_FILT2_FILTF_WIDTH))
7327 /*@}*/
7328 
7329 /*
7330  * MKL25Z4 LPTMR
7331  *
7332  * Low Power Timer
7333  *
7334  * Registers defined in this header file:
7335  * - LPTMR_CSR - Low Power Timer Control Status Register
7336  * - LPTMR_PSR - Low Power Timer Prescale Register
7337  * - LPTMR_CMR - Low Power Timer Compare Register
7338  * - LPTMR_CNR - Low Power Timer Counter Register
7339  */
7340 
7341 #define LPTMR_INSTANCE_COUNT (1U) /*!< Number of instances of the LPTMR module. */
7342 #define LPTMR0_IDX (0U) /*!< Instance number for LPTMR0. */
7343 
7344 /*******************************************************************************
7345  * LPTMR_CSR - Low Power Timer Control Status Register
7346  ******************************************************************************/
7347 
7348 /*!
7349  * @brief LPTMR_CSR - Low Power Timer Control Status Register (RW)
7350  *
7351  * Reset value: 0x00000000U
7352  */
7353 /*!
7354  * @name Constants and macros for entire LPTMR_CSR register
7355  */
7356 /*@{*/
7357 #define LPTMR_RD_CSR(base) (LPTMR_CSR_REG(base))
7358 #define LPTMR_WR_CSR(base, value) (LPTMR_CSR_REG(base) = (value))
7359 #define LPTMR_RMW_CSR(base, mask, value) (LPTMR_WR_CSR(base, (LPTMR_RD_CSR(base) & ~(mask)) | (value)))
7360 #define LPTMR_SET_CSR(base, value) (BME_OR32(&LPTMR_CSR_REG(base), (uint32_t)(value)))
7361 #define LPTMR_CLR_CSR(base, value) (BME_AND32(&LPTMR_CSR_REG(base), (uint32_t)(~(value))))
7362 #define LPTMR_TOG_CSR(base, value) (BME_XOR32(&LPTMR_CSR_REG(base), (uint32_t)(value)))
7363 /*@}*/
7364 
7365 /*
7366  * Constants & macros for individual LPTMR_CSR bitfields
7367  */
7368 
7369 /*!
7370  * @name Register LPTMR_CSR, field TEN[0] (RW)
7371  *
7372  * When TEN is clear, it resets the LPTMR internal logic, including the CNR and
7373  * TCF. When TEN is set, the LPTMR is enabled. While writing 1 to this field,
7374  * CSR[5:1] must not be altered.
7375  *
7376  * Values:
7377  * - 0b0 - LPTMR is disabled and internal logic is reset.
7378  * - 0b1 - LPTMR is enabled.
7379  */
7380 /*@{*/
7381 /*! @brief Read current value of the LPTMR_CSR_TEN field. */
7382 #define LPTMR_RD_CSR_TEN(base) ((LPTMR_CSR_REG(base) & LPTMR_CSR_TEN_MASK) >> LPTMR_CSR_TEN_SHIFT)
7383 #define LPTMR_BRD_CSR_TEN(base) (BME_UBFX32(&LPTMR_CSR_REG(base), LPTMR_CSR_TEN_SHIFT, LPTMR_CSR_TEN_WIDTH))
7384 
7385 /*! @brief Set the TEN field to a new value. */
7386 #define LPTMR_WR_CSR_TEN(base, value) (LPTMR_RMW_CSR(base, (LPTMR_CSR_TEN_MASK | LPTMR_CSR_TCF_MASK), LPTMR_CSR_TEN(value)))
7387 #define LPTMR_BWR_CSR_TEN(base, value) (BME_BFI32(&LPTMR_CSR_REG(base), ((uint32_t)(value) << LPTMR_CSR_TEN_SHIFT), LPTMR_CSR_TEN_SHIFT, LPTMR_CSR_TEN_WIDTH))
7388 /*@}*/
7389 
7390 /*!
7391  * @name Register LPTMR_CSR, field TMS[1] (RW)
7392  *
7393  * Configures the mode of the LPTMR. TMS must be altered only when the LPTMR is
7394  * disabled.
7395  *
7396  * Values:
7397  * - 0b0 - Time Counter mode.
7398  * - 0b1 - Pulse Counter mode.
7399  */
7400 /*@{*/
7401 /*! @brief Read current value of the LPTMR_CSR_TMS field. */
7402 #define LPTMR_RD_CSR_TMS(base) ((LPTMR_CSR_REG(base) & LPTMR_CSR_TMS_MASK) >> LPTMR_CSR_TMS_SHIFT)
7403 #define LPTMR_BRD_CSR_TMS(base) (BME_UBFX32(&LPTMR_CSR_REG(base), LPTMR_CSR_TMS_SHIFT, LPTMR_CSR_TMS_WIDTH))
7404 
7405 /*! @brief Set the TMS field to a new value. */
7406 #define LPTMR_WR_CSR_TMS(base, value) (LPTMR_RMW_CSR(base, (LPTMR_CSR_TMS_MASK | LPTMR_CSR_TCF_MASK), LPTMR_CSR_TMS(value)))
7407 #define LPTMR_BWR_CSR_TMS(base, value) (BME_BFI32(&LPTMR_CSR_REG(base), ((uint32_t)(value) << LPTMR_CSR_TMS_SHIFT), LPTMR_CSR_TMS_SHIFT, LPTMR_CSR_TMS_WIDTH))
7408 /*@}*/
7409 
7410 /*!
7411  * @name Register LPTMR_CSR, field TFC[2] (RW)
7412  *
7413  * When clear, TFC configures the CNR to reset whenever TCF is set. When set,
7414  * TFC configures the CNR to reset on overflow. TFC must be altered only when the
7415  * LPTMR is disabled.
7416  *
7417  * Values:
7418  * - 0b0 - CNR is reset whenever TCF is set.
7419  * - 0b1 - CNR is reset on overflow.
7420  */
7421 /*@{*/
7422 /*! @brief Read current value of the LPTMR_CSR_TFC field. */
7423 #define LPTMR_RD_CSR_TFC(base) ((LPTMR_CSR_REG(base) & LPTMR_CSR_TFC_MASK) >> LPTMR_CSR_TFC_SHIFT)
7424 #define LPTMR_BRD_CSR_TFC(base) (BME_UBFX32(&LPTMR_CSR_REG(base), LPTMR_CSR_TFC_SHIFT, LPTMR_CSR_TFC_WIDTH))
7425 
7426 /*! @brief Set the TFC field to a new value. */
7427 #define LPTMR_WR_CSR_TFC(base, value) (LPTMR_RMW_CSR(base, (LPTMR_CSR_TFC_MASK | LPTMR_CSR_TCF_MASK), LPTMR_CSR_TFC(value)))
7428 #define LPTMR_BWR_CSR_TFC(base, value) (BME_BFI32(&LPTMR_CSR_REG(base), ((uint32_t)(value) << LPTMR_CSR_TFC_SHIFT), LPTMR_CSR_TFC_SHIFT, LPTMR_CSR_TFC_WIDTH))
7429 /*@}*/
7430 
7431 /*!
7432  * @name Register LPTMR_CSR, field TPP[3] (RW)
7433  *
7434  * Configures the polarity of the input source in Pulse Counter mode. TPP must
7435  * be changed only when the LPTMR is disabled.
7436  *
7437  * Values:
7438  * - 0b0 - Pulse Counter input source is active-high, and the CNR will increment
7439  * on the rising-edge.
7440  * - 0b1 - Pulse Counter input source is active-low, and the CNR will increment
7441  * on the falling-edge.
7442  */
7443 /*@{*/
7444 /*! @brief Read current value of the LPTMR_CSR_TPP field. */
7445 #define LPTMR_RD_CSR_TPP(base) ((LPTMR_CSR_REG(base) & LPTMR_CSR_TPP_MASK) >> LPTMR_CSR_TPP_SHIFT)
7446 #define LPTMR_BRD_CSR_TPP(base) (BME_UBFX32(&LPTMR_CSR_REG(base), LPTMR_CSR_TPP_SHIFT, LPTMR_CSR_TPP_WIDTH))
7447 
7448 /*! @brief Set the TPP field to a new value. */
7449 #define LPTMR_WR_CSR_TPP(base, value) (LPTMR_RMW_CSR(base, (LPTMR_CSR_TPP_MASK | LPTMR_CSR_TCF_MASK), LPTMR_CSR_TPP(value)))
7450 #define LPTMR_BWR_CSR_TPP(base, value) (BME_BFI32(&LPTMR_CSR_REG(base), ((uint32_t)(value) << LPTMR_CSR_TPP_SHIFT), LPTMR_CSR_TPP_SHIFT, LPTMR_CSR_TPP_WIDTH))
7451 /*@}*/
7452 
7453 /*!
7454  * @name Register LPTMR_CSR, field TPS[5:4] (RW)
7455  *
7456  * Configures the input source to be used in Pulse Counter mode. TPS must be
7457  * altered only when the LPTMR is disabled. The input connections vary by device.
7458  * See the chip configuration details for information on the connections to these
7459  * inputs.
7460  *
7461  * Values:
7462  * - 0b00 - Pulse counter input 0 is selected.
7463  * - 0b01 - Pulse counter input 1 is selected.
7464  * - 0b10 - Pulse counter input 2 is selected.
7465  * - 0b11 - Pulse counter input 3 is selected.
7466  */
7467 /*@{*/
7468 /*! @brief Read current value of the LPTMR_CSR_TPS field. */
7469 #define LPTMR_RD_CSR_TPS(base) ((LPTMR_CSR_REG(base) & LPTMR_CSR_TPS_MASK) >> LPTMR_CSR_TPS_SHIFT)
7470 #define LPTMR_BRD_CSR_TPS(base) (BME_UBFX32(&LPTMR_CSR_REG(base), LPTMR_CSR_TPS_SHIFT, LPTMR_CSR_TPS_WIDTH))
7471 
7472 /*! @brief Set the TPS field to a new value. */
7473 #define LPTMR_WR_CSR_TPS(base, value) (LPTMR_RMW_CSR(base, (LPTMR_CSR_TPS_MASK | LPTMR_CSR_TCF_MASK), LPTMR_CSR_TPS(value)))
7474 #define LPTMR_BWR_CSR_TPS(base, value) (BME_BFI32(&LPTMR_CSR_REG(base), ((uint32_t)(value) << LPTMR_CSR_TPS_SHIFT), LPTMR_CSR_TPS_SHIFT, LPTMR_CSR_TPS_WIDTH))
7475 /*@}*/
7476 
7477 /*!
7478  * @name Register LPTMR_CSR, field TIE[6] (RW)
7479  *
7480  * When TIE is set, the LPTMR Interrupt is generated whenever TCF is also set.
7481  *
7482  * Values:
7483  * - 0b0 - Timer interrupt disabled.
7484  * - 0b1 - Timer interrupt enabled.
7485  */
7486 /*@{*/
7487 /*! @brief Read current value of the LPTMR_CSR_TIE field. */
7488 #define LPTMR_RD_CSR_TIE(base) ((LPTMR_CSR_REG(base) & LPTMR_CSR_TIE_MASK) >> LPTMR_CSR_TIE_SHIFT)
7489 #define LPTMR_BRD_CSR_TIE(base) (BME_UBFX32(&LPTMR_CSR_REG(base), LPTMR_CSR_TIE_SHIFT, LPTMR_CSR_TIE_WIDTH))
7490 
7491 /*! @brief Set the TIE field to a new value. */
7492 #define LPTMR_WR_CSR_TIE(base, value) (LPTMR_RMW_CSR(base, (LPTMR_CSR_TIE_MASK | LPTMR_CSR_TCF_MASK), LPTMR_CSR_TIE(value)))
7493 #define LPTMR_BWR_CSR_TIE(base, value) (BME_BFI32(&LPTMR_CSR_REG(base), ((uint32_t)(value) << LPTMR_CSR_TIE_SHIFT), LPTMR_CSR_TIE_SHIFT, LPTMR_CSR_TIE_WIDTH))
7494 /*@}*/
7495 
7496 /*!
7497  * @name Register LPTMR_CSR, field TCF[7] (W1C)
7498  *
7499  * TCF is set when the LPTMR is enabled and the CNR equals the CMR and
7500  * increments. TCF is cleared when the LPTMR is disabled or a logic 1 is written to it.
7501  *
7502  * Values:
7503  * - 0b0 - The value of CNR is not equal to CMR and increments.
7504  * - 0b1 - The value of CNR is equal to CMR and increments.
7505  */
7506 /*@{*/
7507 /*! @brief Read current value of the LPTMR_CSR_TCF field. */
7508 #define LPTMR_RD_CSR_TCF(base) ((LPTMR_CSR_REG(base) & LPTMR_CSR_TCF_MASK) >> LPTMR_CSR_TCF_SHIFT)
7509 #define LPTMR_BRD_CSR_TCF(base) (BME_UBFX32(&LPTMR_CSR_REG(base), LPTMR_CSR_TCF_SHIFT, LPTMR_CSR_TCF_WIDTH))
7510 
7511 /*! @brief Set the TCF field to a new value. */
7512 #define LPTMR_WR_CSR_TCF(base, value) (LPTMR_RMW_CSR(base, LPTMR_CSR_TCF_MASK, LPTMR_CSR_TCF(value)))
7513 #define LPTMR_BWR_CSR_TCF(base, value) (BME_BFI32(&LPTMR_CSR_REG(base), ((uint32_t)(value) << LPTMR_CSR_TCF_SHIFT), LPTMR_CSR_TCF_SHIFT, LPTMR_CSR_TCF_WIDTH))
7514 /*@}*/
7515 
7516 /*******************************************************************************
7517  * LPTMR_PSR - Low Power Timer Prescale Register
7518  ******************************************************************************/
7519 
7520 /*!
7521  * @brief LPTMR_PSR - Low Power Timer Prescale Register (RW)
7522  *
7523  * Reset value: 0x00000000U
7524  */
7525 /*!
7526  * @name Constants and macros for entire LPTMR_PSR register
7527  */
7528 /*@{*/
7529 #define LPTMR_RD_PSR(base) (LPTMR_PSR_REG(base))
7530 #define LPTMR_WR_PSR(base, value) (LPTMR_PSR_REG(base) = (value))
7531 #define LPTMR_RMW_PSR(base, mask, value) (LPTMR_WR_PSR(base, (LPTMR_RD_PSR(base) & ~(mask)) | (value)))
7532 #define LPTMR_SET_PSR(base, value) (BME_OR32(&LPTMR_PSR_REG(base), (uint32_t)(value)))
7533 #define LPTMR_CLR_PSR(base, value) (BME_AND32(&LPTMR_PSR_REG(base), (uint32_t)(~(value))))
7534 #define LPTMR_TOG_PSR(base, value) (BME_XOR32(&LPTMR_PSR_REG(base), (uint32_t)(value)))
7535 /*@}*/
7536 
7537 /*
7538  * Constants & macros for individual LPTMR_PSR bitfields
7539  */
7540 
7541 /*!
7542  * @name Register LPTMR_PSR, field PCS[1:0] (RW)
7543  *
7544  * Selects the clock to be used by the LPTMR prescaler/glitch filter. PCS must
7545  * be altered only when the LPTMR is disabled. The clock connections vary by
7546  * device. See the chip configuration details for information on the connections to
7547  * these inputs.
7548  *
7549  * Values:
7550  * - 0b00 - Prescaler/glitch filter clock 0 selected.
7551  * - 0b01 - Prescaler/glitch filter clock 1 selected.
7552  * - 0b10 - Prescaler/glitch filter clock 2 selected.
7553  * - 0b11 - Prescaler/glitch filter clock 3 selected.
7554  */
7555 /*@{*/
7556 /*! @brief Read current value of the LPTMR_PSR_PCS field. */
7557 #define LPTMR_RD_PSR_PCS(base) ((LPTMR_PSR_REG(base) & LPTMR_PSR_PCS_MASK) >> LPTMR_PSR_PCS_SHIFT)
7558 #define LPTMR_BRD_PSR_PCS(base) (BME_UBFX32(&LPTMR_PSR_REG(base), LPTMR_PSR_PCS_SHIFT, LPTMR_PSR_PCS_WIDTH))
7559 
7560 /*! @brief Set the PCS field to a new value. */
7561 #define LPTMR_WR_PSR_PCS(base, value) (LPTMR_RMW_PSR(base, LPTMR_PSR_PCS_MASK, LPTMR_PSR_PCS(value)))
7562 #define LPTMR_BWR_PSR_PCS(base, value) (BME_BFI32(&LPTMR_PSR_REG(base), ((uint32_t)(value) << LPTMR_PSR_PCS_SHIFT), LPTMR_PSR_PCS_SHIFT, LPTMR_PSR_PCS_WIDTH))
7563 /*@}*/
7564 
7565 /*!
7566  * @name Register LPTMR_PSR, field PBYP[2] (RW)
7567  *
7568  * When PBYP is set, the selected prescaler clock in Time Counter mode or
7569  * selected input source in Pulse Counter mode directly clocks the CNR. When PBYP is
7570  * clear, the CNR is clocked by the output of the prescaler/glitch filter. PBYP
7571  * must be altered only when the LPTMR is disabled.
7572  *
7573  * Values:
7574  * - 0b0 - Prescaler/glitch filter is enabled.
7575  * - 0b1 - Prescaler/glitch filter is bypassed.
7576  */
7577 /*@{*/
7578 /*! @brief Read current value of the LPTMR_PSR_PBYP field. */
7579 #define LPTMR_RD_PSR_PBYP(base) ((LPTMR_PSR_REG(base) & LPTMR_PSR_PBYP_MASK) >> LPTMR_PSR_PBYP_SHIFT)
7580 #define LPTMR_BRD_PSR_PBYP(base) (BME_UBFX32(&LPTMR_PSR_REG(base), LPTMR_PSR_PBYP_SHIFT, LPTMR_PSR_PBYP_WIDTH))
7581 
7582 /*! @brief Set the PBYP field to a new value. */
7583 #define LPTMR_WR_PSR_PBYP(base, value) (LPTMR_RMW_PSR(base, LPTMR_PSR_PBYP_MASK, LPTMR_PSR_PBYP(value)))
7584 #define LPTMR_BWR_PSR_PBYP(base, value) (BME_BFI32(&LPTMR_PSR_REG(base), ((uint32_t)(value) << LPTMR_PSR_PBYP_SHIFT), LPTMR_PSR_PBYP_SHIFT, LPTMR_PSR_PBYP_WIDTH))
7585 /*@}*/
7586 
7587 /*!
7588  * @name Register LPTMR_PSR, field PRESCALE[6:3] (RW)
7589  *
7590  * Configures the size of the Prescaler in Time Counter mode or width of the
7591  * glitch filter in Pulse Counter mode. PRESCALE must be altered only when the LPTMR
7592  * is disabled.
7593  *
7594  * Values:
7595  * - 0b0000 - Prescaler divides the prescaler clock by 2; glitch filter does not
7596  * support this configuration.
7597  * - 0b0001 - Prescaler divides the prescaler clock by 4; glitch filter
7598  * recognizes change on input pin after 2 rising clock edges.
7599  * - 0b0010 - Prescaler divides the prescaler clock by 8; glitch filter
7600  * recognizes change on input pin after 4 rising clock edges.
7601  * - 0b0011 - Prescaler divides the prescaler clock by 16; glitch filter
7602  * recognizes change on input pin after 8 rising clock edges.
7603  * - 0b0100 - Prescaler divides the prescaler clock by 32; glitch filter
7604  * recognizes change on input pin after 16 rising clock edges.
7605  * - 0b0101 - Prescaler divides the prescaler clock by 64; glitch filter
7606  * recognizes change on input pin after 32 rising clock edges.
7607  * - 0b0110 - Prescaler divides the prescaler clock by 128; glitch filter
7608  * recognizes change on input pin after 64 rising clock edges.
7609  * - 0b0111 - Prescaler divides the prescaler clock by 256; glitch filter
7610  * recognizes change on input pin after 128 rising clock edges.
7611  * - 0b1000 - Prescaler divides the prescaler clock by 512; glitch filter
7612  * recognizes change on input pin after 256 rising clock edges.
7613  * - 0b1001 - Prescaler divides the prescaler clock by 1024; glitch filter
7614  * recognizes change on input pin after 512 rising clock edges.
7615  * - 0b1010 - Prescaler divides the prescaler clock by 2048; glitch filter
7616  * recognizes change on input pin after 1024 rising clock edges.
7617  * - 0b1011 - Prescaler divides the prescaler clock by 4096; glitch filter
7618  * recognizes change on input pin after 2048 rising clock edges.
7619  * - 0b1100 - Prescaler divides the prescaler clock by 8192; glitch filter
7620  * recognizes change on input pin after 4096 rising clock edges.
7621  * - 0b1101 - Prescaler divides the prescaler clock by 16,384; glitch filter
7622  * recognizes change on input pin after 8192 rising clock edges.
7623  * - 0b1110 - Prescaler divides the prescaler clock by 32,768; glitch filter
7624  * recognizes change on input pin after 16,384 rising clock edges.
7625  * - 0b1111 - Prescaler divides the prescaler clock by 65,536; glitch filter
7626  * recognizes change on input pin after 32,768 rising clock edges.
7627  */
7628 /*@{*/
7629 /*! @brief Read current value of the LPTMR_PSR_PRESCALE field. */
7630 #define LPTMR_RD_PSR_PRESCALE(base) ((LPTMR_PSR_REG(base) & LPTMR_PSR_PRESCALE_MASK) >> LPTMR_PSR_PRESCALE_SHIFT)
7631 #define LPTMR_BRD_PSR_PRESCALE(base) (BME_UBFX32(&LPTMR_PSR_REG(base), LPTMR_PSR_PRESCALE_SHIFT, LPTMR_PSR_PRESCALE_WIDTH))
7632 
7633 /*! @brief Set the PRESCALE field to a new value. */
7634 #define LPTMR_WR_PSR_PRESCALE(base, value) (LPTMR_RMW_PSR(base, LPTMR_PSR_PRESCALE_MASK, LPTMR_PSR_PRESCALE(value)))
7635 #define LPTMR_BWR_PSR_PRESCALE(base, value) (BME_BFI32(&LPTMR_PSR_REG(base), ((uint32_t)(value) << LPTMR_PSR_PRESCALE_SHIFT), LPTMR_PSR_PRESCALE_SHIFT, LPTMR_PSR_PRESCALE_WIDTH))
7636 /*@}*/
7637 
7638 /*******************************************************************************
7639  * LPTMR_CMR - Low Power Timer Compare Register
7640  ******************************************************************************/
7641 
7642 /*!
7643  * @brief LPTMR_CMR - Low Power Timer Compare Register (RW)
7644  *
7645  * Reset value: 0x00000000U
7646  */
7647 /*!
7648  * @name Constants and macros for entire LPTMR_CMR register
7649  */
7650 /*@{*/
7651 #define LPTMR_RD_CMR(base) (LPTMR_CMR_REG(base))
7652 #define LPTMR_WR_CMR(base, value) (LPTMR_CMR_REG(base) = (value))
7653 #define LPTMR_RMW_CMR(base, mask, value) (LPTMR_WR_CMR(base, (LPTMR_RD_CMR(base) & ~(mask)) | (value)))
7654 #define LPTMR_SET_CMR(base, value) (BME_OR32(&LPTMR_CMR_REG(base), (uint32_t)(value)))
7655 #define LPTMR_CLR_CMR(base, value) (BME_AND32(&LPTMR_CMR_REG(base), (uint32_t)(~(value))))
7656 #define LPTMR_TOG_CMR(base, value) (BME_XOR32(&LPTMR_CMR_REG(base), (uint32_t)(value)))
7657 /*@}*/
7658 
7659 /*
7660  * Constants & macros for individual LPTMR_CMR bitfields
7661  */
7662 
7663 /*!
7664  * @name Register LPTMR_CMR, field COMPARE[15:0] (RW)
7665  *
7666  * When the LPTMR is enabled and the CNR equals the value in the CMR and
7667  * increments, TCF is set and the hardware trigger asserts until the next time the CNR
7668  * increments. If the CMR is 0, the hardware trigger will remain asserted until
7669  * the LPTMR is disabled. If the LPTMR is enabled, the CMR must be altered only
7670  * when TCF is set.
7671  */
7672 /*@{*/
7673 /*! @brief Read current value of the LPTMR_CMR_COMPARE field. */
7674 #define LPTMR_RD_CMR_COMPARE(base) ((LPTMR_CMR_REG(base) & LPTMR_CMR_COMPARE_MASK) >> LPTMR_CMR_COMPARE_SHIFT)
7675 #define LPTMR_BRD_CMR_COMPARE(base) (BME_UBFX32(&LPTMR_CMR_REG(base), LPTMR_CMR_COMPARE_SHIFT, LPTMR_CMR_COMPARE_WIDTH))
7676 
7677 /*! @brief Set the COMPARE field to a new value. */
7678 #define LPTMR_WR_CMR_COMPARE(base, value) (LPTMR_RMW_CMR(base, LPTMR_CMR_COMPARE_MASK, LPTMR_CMR_COMPARE(value)))
7679 #define LPTMR_BWR_CMR_COMPARE(base, value) (BME_BFI32(&LPTMR_CMR_REG(base), ((uint32_t)(value) << LPTMR_CMR_COMPARE_SHIFT), LPTMR_CMR_COMPARE_SHIFT, LPTMR_CMR_COMPARE_WIDTH))
7680 /*@}*/
7681 
7682 /*******************************************************************************
7683  * LPTMR_CNR - Low Power Timer Counter Register
7684  ******************************************************************************/
7685 
7686 /*!
7687  * @brief LPTMR_CNR - Low Power Timer Counter Register (RW)
7688  *
7689  * Reset value: 0x00000000U
7690  */
7691 /*!
7692  * @name Constants and macros for entire LPTMR_CNR register
7693  */
7694 /*@{*/
7695 #define LPTMR_RD_CNR(base) (LPTMR_CNR_REG(base))
7696 #define LPTMR_WR_CNR(base, value) (LPTMR_CNR_REG(base) = (value))
7697 #define LPTMR_RMW_CNR(base, mask, value) (LPTMR_WR_CNR(base, (LPTMR_RD_CNR(base) & ~(mask)) | (value)))
7698 #define LPTMR_SET_CNR(base, value) (BME_OR32(&LPTMR_CNR_REG(base), (uint32_t)(value)))
7699 #define LPTMR_CLR_CNR(base, value) (BME_AND32(&LPTMR_CNR_REG(base), (uint32_t)(~(value))))
7700 #define LPTMR_TOG_CNR(base, value) (BME_XOR32(&LPTMR_CNR_REG(base), (uint32_t)(value)))
7701 /*@}*/
7702 
7703 /*
7704  * Constants & macros for individual LPTMR_CNR bitfields
7705  */
7706 
7707 /*!
7708  * @name Register LPTMR_CNR, field COUNTER[15:0] (RW)
7709  */
7710 /*@{*/
7711 /*! @brief Read current value of the LPTMR_CNR_COUNTER field. */
7712 #define LPTMR_RD_CNR_COUNTER(base) ((LPTMR_CNR_REG(base) & LPTMR_CNR_COUNTER_MASK) >> LPTMR_CNR_COUNTER_SHIFT)
7713 #define LPTMR_BRD_CNR_COUNTER(base) (BME_UBFX32(&LPTMR_CNR_REG(base), LPTMR_CNR_COUNTER_SHIFT, LPTMR_CNR_COUNTER_WIDTH))
7714 
7715 /*! @brief Set the COUNTER field to a new value. */
7716 #define LPTMR_WR_CNR_COUNTER(base, value) (LPTMR_RMW_CNR(base, LPTMR_CNR_COUNTER_MASK, LPTMR_CNR_COUNTER(value)))
7717 #define LPTMR_BWR_CNR_COUNTER(base, value) (BME_BFI32(&LPTMR_CNR_REG(base), ((uint32_t)(value) << LPTMR_CNR_COUNTER_SHIFT), LPTMR_CNR_COUNTER_SHIFT, LPTMR_CNR_COUNTER_WIDTH))
7718 /*@}*/
7719 
7720 /*
7721  * MKL25Z4 MCG
7722  *
7723  * Multipurpose Clock Generator module
7724  *
7725  * Registers defined in this header file:
7726  * - MCG_C1 - MCG Control 1 Register
7727  * - MCG_C2 - MCG Control 2 Register
7728  * - MCG_C3 - MCG Control 3 Register
7729  * - MCG_C4 - MCG Control 4 Register
7730  * - MCG_C5 - MCG Control 5 Register
7731  * - MCG_C6 - MCG Control 6 Register
7732  * - MCG_S - MCG Status Register
7733  * - MCG_SC - MCG Status and Control Register
7734  * - MCG_ATCVH - MCG Auto Trim Compare Value High Register
7735  * - MCG_ATCVL - MCG Auto Trim Compare Value Low Register
7736  * - MCG_C7 - MCG Control 7 Register
7737  * - MCG_C8 - MCG Control 8 Register
7738  * - MCG_C9 - MCG Control 9 Register
7739  * - MCG_C10 - MCG Control 10 Register
7740  */
7741 
7742 #define MCG_INSTANCE_COUNT (1U) /*!< Number of instances of the MCG module. */
7743 #define MCG_IDX (0U) /*!< Instance number for MCG. */
7744 
7745 /*******************************************************************************
7746  * MCG_C1 - MCG Control 1 Register
7747  ******************************************************************************/
7748 
7749 /*!
7750  * @brief MCG_C1 - MCG Control 1 Register (RW)
7751  *
7752  * Reset value: 0x04U
7753  */
7754 /*!
7755  * @name Constants and macros for entire MCG_C1 register
7756  */
7757 /*@{*/
7758 #define MCG_RD_C1(base) (MCG_C1_REG(base))
7759 #define MCG_WR_C1(base, value) (MCG_C1_REG(base) = (value))
7760 #define MCG_RMW_C1(base, mask, value) (MCG_WR_C1(base, (MCG_RD_C1(base) & ~(mask)) | (value)))
7761 #define MCG_SET_C1(base, value) (BME_OR8(&MCG_C1_REG(base), (uint8_t)(value)))
7762 #define MCG_CLR_C1(base, value) (BME_AND8(&MCG_C1_REG(base), (uint8_t)(~(value))))
7763 #define MCG_TOG_C1(base, value) (BME_XOR8(&MCG_C1_REG(base), (uint8_t)(value)))
7764 /*@}*/
7765 
7766 /*
7767  * Constants & macros for individual MCG_C1 bitfields
7768  */
7769 
7770 /*!
7771  * @name Register MCG_C1, field IREFSTEN[0] (RW)
7772  *
7773  * Controls whether or not the internal reference clock remains enabled when the
7774  * MCG enters Stop mode.
7775  *
7776  * Values:
7777  * - 0b0 - Internal reference clock is disabled in Stop mode.
7778  * - 0b1 - Internal reference clock is enabled in Stop mode if IRCLKEN is set or
7779  * if MCG is in FEI, FBI, or BLPI modes before entering Stop mode.
7780  */
7781 /*@{*/
7782 /*! @brief Read current value of the MCG_C1_IREFSTEN field. */
7783 #define MCG_RD_C1_IREFSTEN(base) ((MCG_C1_REG(base) & MCG_C1_IREFSTEN_MASK) >> MCG_C1_IREFSTEN_SHIFT)
7784 #define MCG_BRD_C1_IREFSTEN(base) (BME_UBFX8(&MCG_C1_REG(base), MCG_C1_IREFSTEN_SHIFT, MCG_C1_IREFSTEN_WIDTH))
7785 
7786 /*! @brief Set the IREFSTEN field to a new value. */
7787 #define MCG_WR_C1_IREFSTEN(base, value) (MCG_RMW_C1(base, MCG_C1_IREFSTEN_MASK, MCG_C1_IREFSTEN(value)))
7788 #define MCG_BWR_C1_IREFSTEN(base, value) (BME_BFI8(&MCG_C1_REG(base), ((uint8_t)(value) << MCG_C1_IREFSTEN_SHIFT), MCG_C1_IREFSTEN_SHIFT, MCG_C1_IREFSTEN_WIDTH))
7789 /*@}*/
7790 
7791 /*!
7792  * @name Register MCG_C1, field IRCLKEN[1] (RW)
7793  *
7794  * Enables the internal reference clock for use as MCGIRCLK.
7795  *
7796  * Values:
7797  * - 0b0 - MCGIRCLK inactive.
7798  * - 0b1 - MCGIRCLK active.
7799  */
7800 /*@{*/
7801 /*! @brief Read current value of the MCG_C1_IRCLKEN field. */
7802 #define MCG_RD_C1_IRCLKEN(base) ((MCG_C1_REG(base) & MCG_C1_IRCLKEN_MASK) >> MCG_C1_IRCLKEN_SHIFT)
7803 #define MCG_BRD_C1_IRCLKEN(base) (BME_UBFX8(&MCG_C1_REG(base), MCG_C1_IRCLKEN_SHIFT, MCG_C1_IRCLKEN_WIDTH))
7804 
7805 /*! @brief Set the IRCLKEN field to a new value. */
7806 #define MCG_WR_C1_IRCLKEN(base, value) (MCG_RMW_C1(base, MCG_C1_IRCLKEN_MASK, MCG_C1_IRCLKEN(value)))
7807 #define MCG_BWR_C1_IRCLKEN(base, value) (BME_BFI8(&MCG_C1_REG(base), ((uint8_t)(value) << MCG_C1_IRCLKEN_SHIFT), MCG_C1_IRCLKEN_SHIFT, MCG_C1_IRCLKEN_WIDTH))
7808 /*@}*/
7809 
7810 /*!
7811  * @name Register MCG_C1, field IREFS[2] (RW)
7812  *
7813  * Selects the reference clock source for the FLL.
7814  *
7815  * Values:
7816  * - 0b0 - External reference clock is selected.
7817  * - 0b1 - The slow internal reference clock is selected.
7818  */
7819 /*@{*/
7820 /*! @brief Read current value of the MCG_C1_IREFS field. */
7821 #define MCG_RD_C1_IREFS(base) ((MCG_C1_REG(base) & MCG_C1_IREFS_MASK) >> MCG_C1_IREFS_SHIFT)
7822 #define MCG_BRD_C1_IREFS(base) (BME_UBFX8(&MCG_C1_REG(base), MCG_C1_IREFS_SHIFT, MCG_C1_IREFS_WIDTH))
7823 
7824 /*! @brief Set the IREFS field to a new value. */
7825 #define MCG_WR_C1_IREFS(base, value) (MCG_RMW_C1(base, MCG_C1_IREFS_MASK, MCG_C1_IREFS(value)))
7826 #define MCG_BWR_C1_IREFS(base, value) (BME_BFI8(&MCG_C1_REG(base), ((uint8_t)(value) << MCG_C1_IREFS_SHIFT), MCG_C1_IREFS_SHIFT, MCG_C1_IREFS_WIDTH))
7827 /*@}*/
7828 
7829 /*!
7830  * @name Register MCG_C1, field FRDIV[5:3] (RW)
7831  *
7832  * Selects the amount to divide down the external reference clock for the FLL.
7833  * The resulting frequency must be in the range 31.25 kHz to 39.0625 kHz (This is
7834  * required when FLL/DCO is the clock source for MCGOUTCLK . In FBE mode, it is
7835  * not required to meet this range, but it is recommended in the cases when trying
7836  * to enter a FLL mode from FBE).
7837  *
7838  * Values:
7839  * - 0b000 - If RANGE 0 = 0 , Divide Factor is 1; for all other RANGE 0 values,
7840  * Divide Factor is 32.
7841  * - 0b001 - If RANGE 0 = 0 , Divide Factor is 2; for all other RANGE 0 values,
7842  * Divide Factor is 64.
7843  * - 0b010 - If RANGE 0 = 0 , Divide Factor is 4; for all other RANGE 0 values,
7844  * Divide Factor is 128.
7845  * - 0b011 - If RANGE 0 = 0 , Divide Factor is 8; for all other RANGE 0 values,
7846  * Divide Factor is 256.
7847  * - 0b100 - If RANGE 0 = 0 , Divide Factor is 16; for all other RANGE 0 values,
7848  * Divide Factor is 512.
7849  * - 0b101 - If RANGE 0 = 0 , Divide Factor is 32; for all other RANGE 0 values,
7850  * Divide Factor is 1024.
7851  * - 0b110 - If RANGE 0 = 0 , Divide Factor is 64; for all other RANGE 0 values,
7852  * Divide Factor is 1280 .
7853  * - 0b111 - If RANGE 0 = 0 , Divide Factor is 128; for all other RANGE 0
7854  * values, Divide Factor is 1536 .
7855  */
7856 /*@{*/
7857 /*! @brief Read current value of the MCG_C1_FRDIV field. */
7858 #define MCG_RD_C1_FRDIV(base) ((MCG_C1_REG(base) & MCG_C1_FRDIV_MASK) >> MCG_C1_FRDIV_SHIFT)
7859 #define MCG_BRD_C1_FRDIV(base) (BME_UBFX8(&MCG_C1_REG(base), MCG_C1_FRDIV_SHIFT, MCG_C1_FRDIV_WIDTH))
7860 
7861 /*! @brief Set the FRDIV field to a new value. */
7862 #define MCG_WR_C1_FRDIV(base, value) (MCG_RMW_C1(base, MCG_C1_FRDIV_MASK, MCG_C1_FRDIV(value)))
7863 #define MCG_BWR_C1_FRDIV(base, value) (BME_BFI8(&MCG_C1_REG(base), ((uint8_t)(value) << MCG_C1_FRDIV_SHIFT), MCG_C1_FRDIV_SHIFT, MCG_C1_FRDIV_WIDTH))
7864 /*@}*/
7865 
7866 /*!
7867  * @name Register MCG_C1, field CLKS[7:6] (RW)
7868  *
7869  * Selects the clock source for MCGOUTCLK .
7870  *
7871  * Values:
7872  * - 0b00 - Encoding 0 - Output of FLL or PLL is selected (depends on PLLS
7873  * control bit).
7874  * - 0b01 - Encoding 1 - Internal reference clock is selected.
7875  * - 0b10 - Encoding 2 - External reference clock is selected.
7876  * - 0b11 - Encoding 3 - Reserved.
7877  */
7878 /*@{*/
7879 /*! @brief Read current value of the MCG_C1_CLKS field. */
7880 #define MCG_RD_C1_CLKS(base) ((MCG_C1_REG(base) & MCG_C1_CLKS_MASK) >> MCG_C1_CLKS_SHIFT)
7881 #define MCG_BRD_C1_CLKS(base) (BME_UBFX8(&MCG_C1_REG(base), MCG_C1_CLKS_SHIFT, MCG_C1_CLKS_WIDTH))
7882 
7883 /*! @brief Set the CLKS field to a new value. */
7884 #define MCG_WR_C1_CLKS(base, value) (MCG_RMW_C1(base, MCG_C1_CLKS_MASK, MCG_C1_CLKS(value)))
7885 #define MCG_BWR_C1_CLKS(base, value) (BME_BFI8(&MCG_C1_REG(base), ((uint8_t)(value) << MCG_C1_CLKS_SHIFT), MCG_C1_CLKS_SHIFT, MCG_C1_CLKS_WIDTH))
7886 /*@}*/
7887 
7888 /*******************************************************************************
7889  * MCG_C2 - MCG Control 2 Register
7890  ******************************************************************************/
7891 
7892 /*!
7893  * @brief MCG_C2 - MCG Control 2 Register (RW)
7894  *
7895  * Reset value: 0x80U
7896  */
7897 /*!
7898  * @name Constants and macros for entire MCG_C2 register
7899  */
7900 /*@{*/
7901 #define MCG_RD_C2(base) (MCG_C2_REG(base))
7902 #define MCG_WR_C2(base, value) (MCG_C2_REG(base) = (value))
7903 #define MCG_RMW_C2(base, mask, value) (MCG_WR_C2(base, (MCG_RD_C2(base) & ~(mask)) | (value)))
7904 #define MCG_SET_C2(base, value) (BME_OR8(&MCG_C2_REG(base), (uint8_t)(value)))
7905 #define MCG_CLR_C2(base, value) (BME_AND8(&MCG_C2_REG(base), (uint8_t)(~(value))))
7906 #define MCG_TOG_C2(base, value) (BME_XOR8(&MCG_C2_REG(base), (uint8_t)(value)))
7907 /*@}*/
7908 
7909 /*
7910  * Constants & macros for individual MCG_C2 bitfields
7911  */
7912 
7913 /*!
7914  * @name Register MCG_C2, field IRCS[0] (RW)
7915  *
7916  * Selects between the fast or slow internal reference clock source.
7917  *
7918  * Values:
7919  * - 0b0 - Slow internal reference clock selected.
7920  * - 0b1 - Fast internal reference clock selected.
7921  */
7922 /*@{*/
7923 /*! @brief Read current value of the MCG_C2_IRCS field. */
7924 #define MCG_RD_C2_IRCS(base) ((MCG_C2_REG(base) & MCG_C2_IRCS_MASK) >> MCG_C2_IRCS_SHIFT)
7925 #define MCG_BRD_C2_IRCS(base) (BME_UBFX8(&MCG_C2_REG(base), MCG_C2_IRCS_SHIFT, MCG_C2_IRCS_WIDTH))
7926 
7927 /*! @brief Set the IRCS field to a new value. */
7928 #define MCG_WR_C2_IRCS(base, value) (MCG_RMW_C2(base, MCG_C2_IRCS_MASK, MCG_C2_IRCS(value)))
7929 #define MCG_BWR_C2_IRCS(base, value) (BME_BFI8(&MCG_C2_REG(base), ((uint8_t)(value) << MCG_C2_IRCS_SHIFT), MCG_C2_IRCS_SHIFT, MCG_C2_IRCS_WIDTH))
7930 /*@}*/
7931 
7932 /*!
7933  * @name Register MCG_C2, field LP[1] (RW)
7934  *
7935  * Controls whether the FLL or PLL is disabled in BLPI and BLPE modes. In FBE or
7936  * PBE modes, setting this bit to 1 will transition the MCG into BLPE mode; in
7937  * FBI mode, setting this bit to 1 will transition the MCG into BLPI mode. In any
7938  * other MCG mode, LP bit has no affect.
7939  *
7940  * Values:
7941  * - 0b0 - FLL or PLL is not disabled in bypass modes.
7942  * - 0b1 - FLL or PLL is disabled in bypass modes (lower power)
7943  */
7944 /*@{*/
7945 /*! @brief Read current value of the MCG_C2_LP field. */
7946 #define MCG_RD_C2_LP(base) ((MCG_C2_REG(base) & MCG_C2_LP_MASK) >> MCG_C2_LP_SHIFT)
7947 #define MCG_BRD_C2_LP(base) (BME_UBFX8(&MCG_C2_REG(base), MCG_C2_LP_SHIFT, MCG_C2_LP_WIDTH))
7948 
7949 /*! @brief Set the LP field to a new value. */
7950 #define MCG_WR_C2_LP(base, value) (MCG_RMW_C2(base, MCG_C2_LP_MASK, MCG_C2_LP(value)))
7951 #define MCG_BWR_C2_LP(base, value) (BME_BFI8(&MCG_C2_REG(base), ((uint8_t)(value) << MCG_C2_LP_SHIFT), MCG_C2_LP_SHIFT, MCG_C2_LP_WIDTH))
7952 /*@}*/
7953 
7954 /*!
7955  * @name Register MCG_C2, field EREFS0[2] (RW)
7956  *
7957  * Selects the source for the external reference clock. See the Oscillator (OSC)
7958  * chapter for more details.
7959  *
7960  * Values:
7961  * - 0b0 - External reference clock requested.
7962  * - 0b1 - Oscillator requested.
7963  */
7964 /*@{*/
7965 /*! @brief Read current value of the MCG_C2_EREFS0 field. */
7966 #define MCG_RD_C2_EREFS0(base) ((MCG_C2_REG(base) & MCG_C2_EREFS0_MASK) >> MCG_C2_EREFS0_SHIFT)
7967 #define MCG_BRD_C2_EREFS0(base) (BME_UBFX8(&MCG_C2_REG(base), MCG_C2_EREFS0_SHIFT, MCG_C2_EREFS0_WIDTH))
7968 
7969 /*! @brief Set the EREFS0 field to a new value. */
7970 #define MCG_WR_C2_EREFS0(base, value) (MCG_RMW_C2(base, MCG_C2_EREFS0_MASK, MCG_C2_EREFS0(value)))
7971 #define MCG_BWR_C2_EREFS0(base, value) (BME_BFI8(&MCG_C2_REG(base), ((uint8_t)(value) << MCG_C2_EREFS0_SHIFT), MCG_C2_EREFS0_SHIFT, MCG_C2_EREFS0_WIDTH))
7972 /*@}*/
7973 
7974 /*!
7975  * @name Register MCG_C2, field HGO0[3] (RW)
7976  *
7977  * Controls the crystal oscillator mode of operation. See the Oscillator (OSC)
7978  * chapter for more details.
7979  *
7980  * Values:
7981  * - 0b0 - Configure crystal oscillator for low-power operation.
7982  * - 0b1 - Configure crystal oscillator for high-gain operation.
7983  */
7984 /*@{*/
7985 /*! @brief Read current value of the MCG_C2_HGO0 field. */
7986 #define MCG_RD_C2_HGO0(base) ((MCG_C2_REG(base) & MCG_C2_HGO0_MASK) >> MCG_C2_HGO0_SHIFT)
7987 #define MCG_BRD_C2_HGO0(base) (BME_UBFX8(&MCG_C2_REG(base), MCG_C2_HGO0_SHIFT, MCG_C2_HGO0_WIDTH))
7988 
7989 /*! @brief Set the HGO0 field to a new value. */
7990 #define MCG_WR_C2_HGO0(base, value) (MCG_RMW_C2(base, MCG_C2_HGO0_MASK, MCG_C2_HGO0(value)))
7991 #define MCG_BWR_C2_HGO0(base, value) (BME_BFI8(&MCG_C2_REG(base), ((uint8_t)(value) << MCG_C2_HGO0_SHIFT), MCG_C2_HGO0_SHIFT, MCG_C2_HGO0_WIDTH))
7992 /*@}*/
7993 
7994 /*!
7995  * @name Register MCG_C2, field RANGE0[5:4] (RW)
7996  *
7997  * Selects the frequency range for the crystal oscillator or external clock
7998  * source. See the Oscillator (OSC) chapter for more details and the device data
7999  * sheet for the frequency ranges used.
8000  *
8001  * Values:
8002  * - 0b00 - Encoding 0 - Low frequency range selected for the crystal oscillator
8003  * .
8004  * - 0b01 - Encoding 1 - High frequency range selected for the crystal
8005  * oscillator .
8006  */
8007 /*@{*/
8008 /*! @brief Read current value of the MCG_C2_RANGE0 field. */
8009 #define MCG_RD_C2_RANGE0(base) ((MCG_C2_REG(base) & MCG_C2_RANGE0_MASK) >> MCG_C2_RANGE0_SHIFT)
8010 #define MCG_BRD_C2_RANGE0(base) (BME_UBFX8(&MCG_C2_REG(base), MCG_C2_RANGE0_SHIFT, MCG_C2_RANGE0_WIDTH))
8011 
8012 /*! @brief Set the RANGE0 field to a new value. */
8013 #define MCG_WR_C2_RANGE0(base, value) (MCG_RMW_C2(base, MCG_C2_RANGE0_MASK, MCG_C2_RANGE0(value)))
8014 #define MCG_BWR_C2_RANGE0(base, value) (BME_BFI8(&MCG_C2_REG(base), ((uint8_t)(value) << MCG_C2_RANGE0_SHIFT), MCG_C2_RANGE0_SHIFT, MCG_C2_RANGE0_WIDTH))
8015 /*@}*/
8016 
8017 /*!
8018  * @name Register MCG_C2, field LOCRE0[7] (RW)
8019  *
8020  * Determines whether an interrupt or a reset request is made following a loss
8021  * of OSC0 external reference clock. The LOCRE0 only has an affect when CME0 is
8022  * set.
8023  *
8024  * Values:
8025  * - 0b0 - Interrupt request is generated on a loss of OSC0 external reference
8026  * clock.
8027  * - 0b1 - Generate a reset request on a loss of OSC0 external reference clock.
8028  */
8029 /*@{*/
8030 /*! @brief Read current value of the MCG_C2_LOCRE0 field. */
8031 #define MCG_RD_C2_LOCRE0(base) ((MCG_C2_REG(base) & MCG_C2_LOCRE0_MASK) >> MCG_C2_LOCRE0_SHIFT)
8032 #define MCG_BRD_C2_LOCRE0(base) (BME_UBFX8(&MCG_C2_REG(base), MCG_C2_LOCRE0_SHIFT, MCG_C2_LOCRE0_WIDTH))
8033 
8034 /*! @brief Set the LOCRE0 field to a new value. */
8035 #define MCG_WR_C2_LOCRE0(base, value) (MCG_RMW_C2(base, MCG_C2_LOCRE0_MASK, MCG_C2_LOCRE0(value)))
8036 #define MCG_BWR_C2_LOCRE0(base, value) (BME_BFI8(&MCG_C2_REG(base), ((uint8_t)(value) << MCG_C2_LOCRE0_SHIFT), MCG_C2_LOCRE0_SHIFT, MCG_C2_LOCRE0_WIDTH))
8037 /*@}*/
8038 
8039 /*******************************************************************************
8040  * MCG_C3 - MCG Control 3 Register
8041  ******************************************************************************/
8042 
8043 /*!
8044  * @brief MCG_C3 - MCG Control 3 Register (RW)
8045  *
8046  * Reset value: 0x00U
8047  */
8048 /*!
8049  * @name Constants and macros for entire MCG_C3 register
8050  */
8051 /*@{*/
8052 #define MCG_RD_C3(base) (MCG_C3_REG(base))
8053 #define MCG_WR_C3(base, value) (MCG_C3_REG(base) = (value))
8054 #define MCG_RMW_C3(base, mask, value) (MCG_WR_C3(base, (MCG_RD_C3(base) & ~(mask)) | (value)))
8055 #define MCG_SET_C3(base, value) (BME_OR8(&MCG_C3_REG(base), (uint8_t)(value)))
8056 #define MCG_CLR_C3(base, value) (BME_AND8(&MCG_C3_REG(base), (uint8_t)(~(value))))
8057 #define MCG_TOG_C3(base, value) (BME_XOR8(&MCG_C3_REG(base), (uint8_t)(value)))
8058 /*@}*/
8059 
8060 /*******************************************************************************
8061  * MCG_C4 - MCG Control 4 Register
8062  ******************************************************************************/
8063 
8064 /*!
8065  * @brief MCG_C4 - MCG Control 4 Register (RW)
8066  *
8067  * Reset value: 0x00U
8068  *
8069  * Reset values for DRST and DMX32 bits are 0.
8070  */
8071 /*!
8072  * @name Constants and macros for entire MCG_C4 register
8073  */
8074 /*@{*/
8075 #define MCG_RD_C4(base) (MCG_C4_REG(base))
8076 #define MCG_WR_C4(base, value) (MCG_C4_REG(base) = (value))
8077 #define MCG_RMW_C4(base, mask, value) (MCG_WR_C4(base, (MCG_RD_C4(base) & ~(mask)) | (value)))
8078 #define MCG_SET_C4(base, value) (BME_OR8(&MCG_C4_REG(base), (uint8_t)(value)))
8079 #define MCG_CLR_C4(base, value) (BME_AND8(&MCG_C4_REG(base), (uint8_t)(~(value))))
8080 #define MCG_TOG_C4(base, value) (BME_XOR8(&MCG_C4_REG(base), (uint8_t)(value)))
8081 /*@}*/
8082 
8083 /*
8084  * Constants & macros for individual MCG_C4 bitfields
8085  */
8086 
8087 /*!
8088  * @name Register MCG_C4, field SCFTRIM[0] (RW)
8089  *
8090  * SCFTRIM A value for SCFTRIM is loaded during reset from a factory programmed
8091  * location . controls the smallest adjustment of the slow internal reference
8092  * clock frequency. Setting SCFTRIM increases the period and clearing SCFTRIM
8093  * decreases the period by the smallest amount possible. If an SCFTRIM value stored in
8094  * nonvolatile memory is to be used, it is your responsibility to copy that value
8095  * from the nonvolatile memory location to this bit.
8096  */
8097 /*@{*/
8098 /*! @brief Read current value of the MCG_C4_SCFTRIM field. */
8099 #define MCG_RD_C4_SCFTRIM(base) ((MCG_C4_REG(base) & MCG_C4_SCFTRIM_MASK) >> MCG_C4_SCFTRIM_SHIFT)
8100 #define MCG_BRD_C4_SCFTRIM(base) (BME_UBFX8(&MCG_C4_REG(base), MCG_C4_SCFTRIM_SHIFT, MCG_C4_SCFTRIM_WIDTH))
8101 
8102 /*! @brief Set the SCFTRIM field to a new value. */
8103 #define MCG_WR_C4_SCFTRIM(base, value) (MCG_RMW_C4(base, MCG_C4_SCFTRIM_MASK, MCG_C4_SCFTRIM(value)))
8104 #define MCG_BWR_C4_SCFTRIM(base, value) (BME_BFI8(&MCG_C4_REG(base), ((uint8_t)(value) << MCG_C4_SCFTRIM_SHIFT), MCG_C4_SCFTRIM_SHIFT, MCG_C4_SCFTRIM_WIDTH))
8105 /*@}*/
8106 
8107 /*!
8108  * @name Register MCG_C4, field FCTRIM[4:1] (RW)
8109  *
8110  * FCTRIM A value for FCTRIM is loaded during reset from a factory programmed
8111  * location . controls the fast internal reference clock frequency by controlling
8112  * the fast internal reference clock period. The FCTRIM bits are binary weighted,
8113  * that is, bit 1 adjusts twice as much as bit 0. Increasing the binary value
8114  * increases the period, and decreasing the value decreases the period. If an
8115  * FCTRIM[3:0] value stored in nonvolatile memory is to be used, it is your
8116  * responsibility to copy that value from the nonvolatile memory location to this register.
8117  */
8118 /*@{*/
8119 /*! @brief Read current value of the MCG_C4_FCTRIM field. */
8120 #define MCG_RD_C4_FCTRIM(base) ((MCG_C4_REG(base) & MCG_C4_FCTRIM_MASK) >> MCG_C4_FCTRIM_SHIFT)
8121 #define MCG_BRD_C4_FCTRIM(base) (BME_UBFX8(&MCG_C4_REG(base), MCG_C4_FCTRIM_SHIFT, MCG_C4_FCTRIM_WIDTH))
8122 
8123 /*! @brief Set the FCTRIM field to a new value. */
8124 #define MCG_WR_C4_FCTRIM(base, value) (MCG_RMW_C4(base, MCG_C4_FCTRIM_MASK, MCG_C4_FCTRIM(value)))
8125 #define MCG_BWR_C4_FCTRIM(base, value) (BME_BFI8(&MCG_C4_REG(base), ((uint8_t)(value) << MCG_C4_FCTRIM_SHIFT), MCG_C4_FCTRIM_SHIFT, MCG_C4_FCTRIM_WIDTH))
8126 /*@}*/
8127 
8128 /*!
8129  * @name Register MCG_C4, field DRST_DRS[6:5] (RW)
8130  *
8131  * The DRS bits select the frequency range for the FLL output, DCOOUT. When the
8132  * LP bit is set, writes to the DRS bits are ignored. The DRST read field
8133  * indicates the current frequency range for DCOOUT. The DRST field does not update
8134  * immediately after a write to the DRS field due to internal synchronization between
8135  * clock domains. See the DCO Frequency Range table for more details.
8136  *
8137  * Values:
8138  * - 0b00 - Encoding 0 - Low range (reset default).
8139  * - 0b01 - Encoding 1 - Mid range.
8140  * - 0b10 - Encoding 2 - Mid-high range.
8141  * - 0b11 - Encoding 3 - High range.
8142  */
8143 /*@{*/
8144 /*! @brief Read current value of the MCG_C4_DRST_DRS field. */
8145 #define MCG_RD_C4_DRST_DRS(base) ((MCG_C4_REG(base) & MCG_C4_DRST_DRS_MASK) >> MCG_C4_DRST_DRS_SHIFT)
8146 #define MCG_BRD_C4_DRST_DRS(base) (BME_UBFX8(&MCG_C4_REG(base), MCG_C4_DRST_DRS_SHIFT, MCG_C4_DRST_DRS_WIDTH))
8147 
8148 /*! @brief Set the DRST_DRS field to a new value. */
8149 #define MCG_WR_C4_DRST_DRS(base, value) (MCG_RMW_C4(base, MCG_C4_DRST_DRS_MASK, MCG_C4_DRST_DRS(value)))
8150 #define MCG_BWR_C4_DRST_DRS(base, value) (BME_BFI8(&MCG_C4_REG(base), ((uint8_t)(value) << MCG_C4_DRST_DRS_SHIFT), MCG_C4_DRST_DRS_SHIFT, MCG_C4_DRST_DRS_WIDTH))
8151 /*@}*/
8152 
8153 /*!
8154  * @name Register MCG_C4, field DMX32[7] (RW)
8155  *
8156  * The DMX32 bit controls whether the DCO frequency range is narrowed to its
8157  * maximum frequency with a 32.768 kHz reference. The following table identifies
8158  * settings for the DCO frequency range. The system clocks derived from this source
8159  * should not exceed their specified maximums. DRST_DRS DMX32 Reference Range FLL
8160  * Factor DCO Range 00 0 31.25-39.0625 kHz 640 20-25 MHz 1 32.768 kHz 732 24 MHz
8161  * 01 0 31.25-39.0625 kHz 1280 40-50 MHz 1 32.768 kHz 1464 48 MHz 10 0
8162  * 31.25-39.0625 kHz 1920 60-75 MHz 1 32.768 kHz 2197 72 MHz 11 0 31.25-39.0625 kHz 2560
8163  * 80-100 MHz 1 32.768 kHz 2929 96 MHz
8164  *
8165  * Values:
8166  * - 0b0 - DCO has a default range of 25%.
8167  * - 0b1 - DCO is fine-tuned for maximum frequency with 32.768 kHz reference.
8168  */
8169 /*@{*/
8170 /*! @brief Read current value of the MCG_C4_DMX32 field. */
8171 #define MCG_RD_C4_DMX32(base) ((MCG_C4_REG(base) & MCG_C4_DMX32_MASK) >> MCG_C4_DMX32_SHIFT)
8172 #define MCG_BRD_C4_DMX32(base) (BME_UBFX8(&MCG_C4_REG(base), MCG_C4_DMX32_SHIFT, MCG_C4_DMX32_WIDTH))
8173 
8174 /*! @brief Set the DMX32 field to a new value. */
8175 #define MCG_WR_C4_DMX32(base, value) (MCG_RMW_C4(base, MCG_C4_DMX32_MASK, MCG_C4_DMX32(value)))
8176 #define MCG_BWR_C4_DMX32(base, value) (BME_BFI8(&MCG_C4_REG(base), ((uint8_t)(value) << MCG_C4_DMX32_SHIFT), MCG_C4_DMX32_SHIFT, MCG_C4_DMX32_WIDTH))
8177 /*@}*/
8178 
8179 /*******************************************************************************
8180  * MCG_C5 - MCG Control 5 Register
8181  ******************************************************************************/
8182 
8183 /*!
8184  * @brief MCG_C5 - MCG Control 5 Register (RW)
8185  *
8186  * Reset value: 0x00U
8187  */
8188 /*!
8189  * @name Constants and macros for entire MCG_C5 register
8190  */
8191 /*@{*/
8192 #define MCG_RD_C5(base) (MCG_C5_REG(base))
8193 #define MCG_WR_C5(base, value) (MCG_C5_REG(base) = (value))
8194 #define MCG_RMW_C5(base, mask, value) (MCG_WR_C5(base, (MCG_RD_C5(base) & ~(mask)) | (value)))
8195 #define MCG_SET_C5(base, value) (BME_OR8(&MCG_C5_REG(base), (uint8_t)(value)))
8196 #define MCG_CLR_C5(base, value) (BME_AND8(&MCG_C5_REG(base), (uint8_t)(~(value))))
8197 #define MCG_TOG_C5(base, value) (BME_XOR8(&MCG_C5_REG(base), (uint8_t)(value)))
8198 /*@}*/
8199 
8200 /*
8201  * Constants & macros for individual MCG_C5 bitfields
8202  */
8203 
8204 /*!
8205  * @name Register MCG_C5, field PRDIV0[4:0] (RW)
8206  *
8207  * Selects the amount to divide down the external reference clock for the PLL.
8208  * The resulting frequency must be in the range of 2 MHz to 4 MHz. After the PLL
8209  * is enabled (by setting either PLLCLKEN 0 or PLLS), the PRDIV 0 value must not
8210  * be changed when LOCK0 is zero. PLL External Reference Divide Factor PRDIV 0
8211  * Divide Factor PRDIV 0 Divide Factor PRDIV 0 Divide Factor PRDIV 0 Divide Factor
8212  * 00000 1 01000 9 10000 17 11000 25 00001 2 01001 10 10001 18 11001 Reserved
8213  * 00010 3 01010 11 10010 19 11010 Reserved 00011 4 01011 12 10011 20 11011 Reserved
8214  * 00100 5 01100 13 10100 21 11100 Reserved 00101 6 01101 14 10101 22 11101
8215  * Reserved 00110 7 01110 15 10110 23 11110 Reserved 00111 8 01111 16 10111 24 11111
8216  * Reserved
8217  */
8218 /*@{*/
8219 /*! @brief Read current value of the MCG_C5_PRDIV0 field. */
8220 #define MCG_RD_C5_PRDIV0(base) ((MCG_C5_REG(base) & MCG_C5_PRDIV0_MASK) >> MCG_C5_PRDIV0_SHIFT)
8221 #define MCG_BRD_C5_PRDIV0(base) (BME_UBFX8(&MCG_C5_REG(base), MCG_C5_PRDIV0_SHIFT, MCG_C5_PRDIV0_WIDTH))
8222 
8223 /*! @brief Set the PRDIV0 field to a new value. */
8224 #define MCG_WR_C5_PRDIV0(base, value) (MCG_RMW_C5(base, MCG_C5_PRDIV0_MASK, MCG_C5_PRDIV0(value)))
8225 #define MCG_BWR_C5_PRDIV0(base, value) (BME_BFI8(&MCG_C5_REG(base), ((uint8_t)(value) << MCG_C5_PRDIV0_SHIFT), MCG_C5_PRDIV0_SHIFT, MCG_C5_PRDIV0_WIDTH))
8226 /*@}*/
8227 
8228 /*!
8229  * @name Register MCG_C5, field PLLSTEN0[5] (RW)
8230  *
8231  * Enables the PLL Clock during Normal Stop. In Low Power Stop mode, the PLL
8232  * clock gets disabled even if PLLSTEN 0 =1. All other power modes, PLLSTEN 0 bit
8233  * has no affect and does not enable the PLL Clock to run if it is written to 1.
8234  *
8235  * Values:
8236  * - 0b0 - MCGPLLCLK is disabled in any of the Stop modes.
8237  * - 0b1 - MCGPLLCLK is enabled if system is in Normal Stop mode.
8238  */
8239 /*@{*/
8240 /*! @brief Read current value of the MCG_C5_PLLSTEN0 field. */
8241 #define MCG_RD_C5_PLLSTEN0(base) ((MCG_C5_REG(base) & MCG_C5_PLLSTEN0_MASK) >> MCG_C5_PLLSTEN0_SHIFT)
8242 #define MCG_BRD_C5_PLLSTEN0(base) (BME_UBFX8(&MCG_C5_REG(base), MCG_C5_PLLSTEN0_SHIFT, MCG_C5_PLLSTEN0_WIDTH))
8243 
8244 /*! @brief Set the PLLSTEN0 field to a new value. */
8245 #define MCG_WR_C5_PLLSTEN0(base, value) (MCG_RMW_C5(base, MCG_C5_PLLSTEN0_MASK, MCG_C5_PLLSTEN0(value)))
8246 #define MCG_BWR_C5_PLLSTEN0(base, value) (BME_BFI8(&MCG_C5_REG(base), ((uint8_t)(value) << MCG_C5_PLLSTEN0_SHIFT), MCG_C5_PLLSTEN0_SHIFT, MCG_C5_PLLSTEN0_WIDTH))
8247 /*@}*/
8248 
8249 /*!
8250  * @name Register MCG_C5, field PLLCLKEN0[6] (RW)
8251  *
8252  * Enables the PLL independent of PLLS and enables the PLL clock for use as
8253  * MCGPLLCLK. (PRDIV 0 needs to be programmed to the correct divider to generate a
8254  * PLL reference clock in the range of 2 - 4 MHz range prior to setting the
8255  * PLLCLKEN 0 bit). Setting PLLCLKEN 0 will enable the external oscillator if not
8256  * already enabled. Whenever the PLL is being enabled by means of the PLLCLKEN 0 bit,
8257  * and the external oscillator is being used as the reference clock, the OSCINIT 0
8258  * bit should be checked to make sure it is set.
8259  *
8260  * Values:
8261  * - 0b0 - MCGPLLCLK is inactive.
8262  * - 0b1 - MCGPLLCLK is active.
8263  */
8264 /*@{*/
8265 /*! @brief Read current value of the MCG_C5_PLLCLKEN0 field. */
8266 #define MCG_RD_C5_PLLCLKEN0(base) ((MCG_C5_REG(base) & MCG_C5_PLLCLKEN0_MASK) >> MCG_C5_PLLCLKEN0_SHIFT)
8267 #define MCG_BRD_C5_PLLCLKEN0(base) (BME_UBFX8(&MCG_C5_REG(base), MCG_C5_PLLCLKEN0_SHIFT, MCG_C5_PLLCLKEN0_WIDTH))
8268 
8269 /*! @brief Set the PLLCLKEN0 field to a new value. */
8270 #define MCG_WR_C5_PLLCLKEN0(base, value) (MCG_RMW_C5(base, MCG_C5_PLLCLKEN0_MASK, MCG_C5_PLLCLKEN0(value)))
8271 #define MCG_BWR_C5_PLLCLKEN0(base, value) (BME_BFI8(&MCG_C5_REG(base), ((uint8_t)(value) << MCG_C5_PLLCLKEN0_SHIFT), MCG_C5_PLLCLKEN0_SHIFT, MCG_C5_PLLCLKEN0_WIDTH))
8272 /*@}*/
8273 
8274 /*******************************************************************************
8275  * MCG_C6 - MCG Control 6 Register
8276  ******************************************************************************/
8277 
8278 /*!
8279  * @brief MCG_C6 - MCG Control 6 Register (RW)
8280  *
8281  * Reset value: 0x00U
8282  */
8283 /*!
8284  * @name Constants and macros for entire MCG_C6 register
8285  */
8286 /*@{*/
8287 #define MCG_RD_C6(base) (MCG_C6_REG(base))
8288 #define MCG_WR_C6(base, value) (MCG_C6_REG(base) = (value))
8289 #define MCG_RMW_C6(base, mask, value) (MCG_WR_C6(base, (MCG_RD_C6(base) & ~(mask)) | (value)))
8290 #define MCG_SET_C6(base, value) (BME_OR8(&MCG_C6_REG(base), (uint8_t)(value)))
8291 #define MCG_CLR_C6(base, value) (BME_AND8(&MCG_C6_REG(base), (uint8_t)(~(value))))
8292 #define MCG_TOG_C6(base, value) (BME_XOR8(&MCG_C6_REG(base), (uint8_t)(value)))
8293 /*@}*/
8294 
8295 /*
8296  * Constants & macros for individual MCG_C6 bitfields
8297  */
8298 
8299 /*!
8300  * @name Register MCG_C6, field VDIV0[4:0] (RW)
8301  *
8302  * Selects the amount to divide the VCO output of the PLL. The VDIV 0 bits
8303  * establish the multiplication factor (M) applied to the reference clock frequency.
8304  * After the PLL is enabled (by setting either PLLCLKEN 0 or PLLS), the VDIV 0
8305  * value must not be changed when LOCK 0 is zero. PLL VCO Divide Factor VDIV 0
8306  * Multiply Factor VDIV 0 Multiply Factor VDIV 0 Multiply Factor VDIV 0 Multiply
8307  * Factor 00000 24 01000 32 10000 40 11000 48 00001 25 01001 33 10001 41 11001 49
8308  * 00010 26 01010 34 10010 42 11010 50 00011 27 01011 35 10011 43 11011 51 00100 28
8309  * 01100 36 10100 44 11100 52 00101 29 01101 37 10101 45 11101 53 00110 30 01110
8310  * 38 10110 46 11110 54 00111 31 01111 39 10111 47 11111 55
8311  */
8312 /*@{*/
8313 /*! @brief Read current value of the MCG_C6_VDIV0 field. */
8314 #define MCG_RD_C6_VDIV0(base) ((MCG_C6_REG(base) & MCG_C6_VDIV0_MASK) >> MCG_C6_VDIV0_SHIFT)
8315 #define MCG_BRD_C6_VDIV0(base) (BME_UBFX8(&MCG_C6_REG(base), MCG_C6_VDIV0_SHIFT, MCG_C6_VDIV0_WIDTH))
8316 
8317 /*! @brief Set the VDIV0 field to a new value. */
8318 #define MCG_WR_C6_VDIV0(base, value) (MCG_RMW_C6(base, MCG_C6_VDIV0_MASK, MCG_C6_VDIV0(value)))
8319 #define MCG_BWR_C6_VDIV0(base, value) (BME_BFI8(&MCG_C6_REG(base), ((uint8_t)(value) << MCG_C6_VDIV0_SHIFT), MCG_C6_VDIV0_SHIFT, MCG_C6_VDIV0_WIDTH))
8320 /*@}*/
8321 
8322 /*!
8323  * @name Register MCG_C6, field CME0[5] (RW)
8324  *
8325  * Enables the loss of clock monitoring circuit for the OSC0 external reference
8326  * mux select. The LOCRE0 bit will determine if a interrupt or a reset request is
8327  * generated following a loss of OSC0 indication. The CME0 bit should only be
8328  * set to a logic 1 when the MCG is in an operational mode that uses the external
8329  * clock (FEE, FBE, PEE, PBE, or BLPE) . Whenever the CME0 bit is set to a logic
8330  * 1, the value of the RANGE0 bits in the C2 register should not be changed. CME0
8331  * bit should be set to a logic 0 before the MCG enters any Stop mode. Otherwise,
8332  * a reset request may occur while in Stop mode. CME0 should also be set to a
8333  * logic 0 before entering VLPR or VLPW power modes if the MCG is in BLPE mode.
8334  *
8335  * Values:
8336  * - 0b0 - External clock monitor is disabled for OSC0.
8337  * - 0b1 - External clock monitor is enabled for OSC0.
8338  */
8339 /*@{*/
8340 /*! @brief Read current value of the MCG_C6_CME0 field. */
8341 #define MCG_RD_C6_CME0(base) ((MCG_C6_REG(base) & MCG_C6_CME0_MASK) >> MCG_C6_CME0_SHIFT)
8342 #define MCG_BRD_C6_CME0(base) (BME_UBFX8(&MCG_C6_REG(base), MCG_C6_CME0_SHIFT, MCG_C6_CME0_WIDTH))
8343 
8344 /*! @brief Set the CME0 field to a new value. */
8345 #define MCG_WR_C6_CME0(base, value) (MCG_RMW_C6(base, MCG_C6_CME0_MASK, MCG_C6_CME0(value)))
8346 #define MCG_BWR_C6_CME0(base, value) (BME_BFI8(&MCG_C6_REG(base), ((uint8_t)(value) << MCG_C6_CME0_SHIFT), MCG_C6_CME0_SHIFT, MCG_C6_CME0_WIDTH))
8347 /*@}*/
8348 
8349 /*!
8350  * @name Register MCG_C6, field PLLS[6] (RW)
8351  *
8352  * Controls whether the PLL or FLL output is selected as the MCG source when
8353  * CLKS[1:0]=00. If the PLLS bit is cleared and PLLCLKEN 0 is not set, the PLL is
8354  * disabled in all modes. If the PLLS is set, the FLL is disabled in all modes.
8355  *
8356  * Values:
8357  * - 0b0 - FLL is selected.
8358  * - 0b1 - PLL is selected (PRDIV 0 need to be programmed to the correct divider
8359  * to generate a PLL reference clock in the range of 2-4 MHz prior to
8360  * setting the PLLS bit).
8361  */
8362 /*@{*/
8363 /*! @brief Read current value of the MCG_C6_PLLS field. */
8364 #define MCG_RD_C6_PLLS(base) ((MCG_C6_REG(base) & MCG_C6_PLLS_MASK) >> MCG_C6_PLLS_SHIFT)
8365 #define MCG_BRD_C6_PLLS(base) (BME_UBFX8(&MCG_C6_REG(base), MCG_C6_PLLS_SHIFT, MCG_C6_PLLS_WIDTH))
8366 
8367 /*! @brief Set the PLLS field to a new value. */
8368 #define MCG_WR_C6_PLLS(base, value) (MCG_RMW_C6(base, MCG_C6_PLLS_MASK, MCG_C6_PLLS(value)))
8369 #define MCG_BWR_C6_PLLS(base, value) (BME_BFI8(&MCG_C6_REG(base), ((uint8_t)(value) << MCG_C6_PLLS_SHIFT), MCG_C6_PLLS_SHIFT, MCG_C6_PLLS_WIDTH))
8370 /*@}*/
8371 
8372 /*!
8373  * @name Register MCG_C6, field LOLIE0[7] (RW)
8374  *
8375  * Determines if an interrupt request is made following a loss of lock
8376  * indication. This bit only has an effect when LOLS 0 is set.
8377  *
8378  * Values:
8379  * - 0b0 - No interrupt request is generated on loss of lock.
8380  * - 0b1 - Generate an interrupt request on loss of lock.
8381  */
8382 /*@{*/
8383 /*! @brief Read current value of the MCG_C6_LOLIE0 field. */
8384 #define MCG_RD_C6_LOLIE0(base) ((MCG_C6_REG(base) & MCG_C6_LOLIE0_MASK) >> MCG_C6_LOLIE0_SHIFT)
8385 #define MCG_BRD_C6_LOLIE0(base) (BME_UBFX8(&MCG_C6_REG(base), MCG_C6_LOLIE0_SHIFT, MCG_C6_LOLIE0_WIDTH))
8386 
8387 /*! @brief Set the LOLIE0 field to a new value. */
8388 #define MCG_WR_C6_LOLIE0(base, value) (MCG_RMW_C6(base, MCG_C6_LOLIE0_MASK, MCG_C6_LOLIE0(value)))
8389 #define MCG_BWR_C6_LOLIE0(base, value) (BME_BFI8(&MCG_C6_REG(base), ((uint8_t)(value) << MCG_C6_LOLIE0_SHIFT), MCG_C6_LOLIE0_SHIFT, MCG_C6_LOLIE0_WIDTH))
8390 /*@}*/
8391 
8392 /*******************************************************************************
8393  * MCG_S - MCG Status Register
8394  ******************************************************************************/
8395 
8396 /*!
8397  * @brief MCG_S - MCG Status Register (RW)
8398  *
8399  * Reset value: 0x10U
8400  */
8401 /*!
8402  * @name Constants and macros for entire MCG_S register
8403  */
8404 /*@{*/
8405 #define MCG_RD_S(base) (MCG_S_REG(base))
8406 #define MCG_WR_S(base, value) (MCG_S_REG(base) = (value))
8407 #define MCG_RMW_S(base, mask, value) (MCG_WR_S(base, (MCG_RD_S(base) & ~(mask)) | (value)))
8408 #define MCG_SET_S(base, value) (BME_OR8(&MCG_S_REG(base), (uint8_t)(value)))
8409 #define MCG_CLR_S(base, value) (BME_AND8(&MCG_S_REG(base), (uint8_t)(~(value))))
8410 #define MCG_TOG_S(base, value) (BME_XOR8(&MCG_S_REG(base), (uint8_t)(value)))
8411 /*@}*/
8412 
8413 /*
8414  * Constants & macros for individual MCG_S bitfields
8415  */
8416 
8417 /*!
8418  * @name Register MCG_S, field IRCST[0] (RO)
8419  *
8420  * The IRCST bit indicates the current source for the internal reference clock
8421  * select clock (IRCSCLK). The IRCST bit does not update immediately after a write
8422  * to the IRCS bit due to internal synchronization between clock domains. The
8423  * IRCST bit will only be updated if the internal reference clock is enabled,
8424  * either by the MCG being in a mode that uses the IRC or by setting the C1[IRCLKEN]
8425  * bit .
8426  *
8427  * Values:
8428  * - 0b0 - Source of internal reference clock is the slow clock (32 kHz IRC).
8429  * - 0b1 - Source of internal reference clock is the fast clock (4 MHz IRC).
8430  */
8431 /*@{*/
8432 /*! @brief Read current value of the MCG_S_IRCST field. */
8433 #define MCG_RD_S_IRCST(base) ((MCG_S_REG(base) & MCG_S_IRCST_MASK) >> MCG_S_IRCST_SHIFT)
8434 #define MCG_BRD_S_IRCST(base) (BME_UBFX8(&MCG_S_REG(base), MCG_S_IRCST_SHIFT, MCG_S_IRCST_WIDTH))
8435 /*@}*/
8436 
8437 /*!
8438  * @name Register MCG_S, field OSCINIT0[1] (RO)
8439  *
8440  * This bit, which resets to 0, is set to 1 after the initialization cycles of
8441  * the crystal oscillator clock have completed. After being set, the bit is
8442  * cleared to 0 if the OSC is subsequently disabled. See the OSC module's detailed
8443  * description for more information.
8444  */
8445 /*@{*/
8446 /*! @brief Read current value of the MCG_S_OSCINIT0 field. */
8447 #define MCG_RD_S_OSCINIT0(base) ((MCG_S_REG(base) & MCG_S_OSCINIT0_MASK) >> MCG_S_OSCINIT0_SHIFT)
8448 #define MCG_BRD_S_OSCINIT0(base) (BME_UBFX8(&MCG_S_REG(base), MCG_S_OSCINIT0_SHIFT, MCG_S_OSCINIT0_WIDTH))
8449 /*@}*/
8450 
8451 /*!
8452  * @name Register MCG_S, field CLKST[3:2] (RO)
8453  *
8454  * These bits indicate the current clock mode. The CLKST bits do not update
8455  * immediately after a write to the CLKS bits due to internal synchronization between
8456  * clock domains.
8457  *
8458  * Values:
8459  * - 0b00 - Encoding 0 - Output of the FLL is selected (reset default).
8460  * - 0b01 - Encoding 1 - Internal reference clock is selected.
8461  * - 0b10 - Encoding 2 - External reference clock is selected.
8462  * - 0b11 - Encoding 3 - Output of the PLL is selected.
8463  */
8464 /*@{*/
8465 /*! @brief Read current value of the MCG_S_CLKST field. */
8466 #define MCG_RD_S_CLKST(base) ((MCG_S_REG(base) & MCG_S_CLKST_MASK) >> MCG_S_CLKST_SHIFT)
8467 #define MCG_BRD_S_CLKST(base) (BME_UBFX8(&MCG_S_REG(base), MCG_S_CLKST_SHIFT, MCG_S_CLKST_WIDTH))
8468 /*@}*/
8469 
8470 /*!
8471  * @name Register MCG_S, field IREFST[4] (RO)
8472  *
8473  * This bit indicates the current source for the FLL reference clock. The IREFST
8474  * bit does not update immediately after a write to the IREFS bit due to
8475  * internal synchronization between clock domains.
8476  *
8477  * Values:
8478  * - 0b0 - Source of FLL reference clock is the external reference clock.
8479  * - 0b1 - Source of FLL reference clock is the internal reference clock.
8480  */
8481 /*@{*/
8482 /*! @brief Read current value of the MCG_S_IREFST field. */
8483 #define MCG_RD_S_IREFST(base) ((MCG_S_REG(base) & MCG_S_IREFST_MASK) >> MCG_S_IREFST_SHIFT)
8484 #define MCG_BRD_S_IREFST(base) (BME_UBFX8(&MCG_S_REG(base), MCG_S_IREFST_SHIFT, MCG_S_IREFST_WIDTH))
8485 /*@}*/
8486 
8487 /*!
8488  * @name Register MCG_S, field PLLST[5] (RO)
8489  *
8490  * This bit indicates the clock source selected by PLLS . The PLLST bit does not
8491  * update immediately after a write to the PLLS bit due to internal
8492  * synchronization between clock domains.
8493  *
8494  * Values:
8495  * - 0b0 - Source of PLLS clock is FLL clock.
8496  * - 0b1 - Source of PLLS clock is PLL output clock.
8497  */
8498 /*@{*/
8499 /*! @brief Read current value of the MCG_S_PLLST field. */
8500 #define MCG_RD_S_PLLST(base) ((MCG_S_REG(base) & MCG_S_PLLST_MASK) >> MCG_S_PLLST_SHIFT)
8501 #define MCG_BRD_S_PLLST(base) (BME_UBFX8(&MCG_S_REG(base), MCG_S_PLLST_SHIFT, MCG_S_PLLST_WIDTH))
8502 /*@}*/
8503 
8504 /*!
8505  * @name Register MCG_S, field LOCK0[6] (RO)
8506  *
8507  * This bit indicates whether the PLL has acquired lock. Lock detection is only
8508  * enabled when the PLL is enabled (either through clock mode selection or
8509  * PLLCLKEN0=1 setting). While the PLL clock is locking to the desired frequency, the
8510  * MCG PLL clock (MCGPLLCLK) will be gated off until the LOCK bit gets asserted.
8511  * If the lock status bit is set, changing the value of the PRDIV0 [4:0] bits in
8512  * the C5 register or the VDIV0[4:0] bits in the C6 register causes the lock
8513  * status bit to clear and stay cleared until the PLL has reacquired lock. Loss of PLL
8514  * reference clock will also cause the LOCK0 bit to clear until the PLL has
8515  * reacquired lock. Entry into LLS, VLPS, or regular Stop with PLLSTEN=0 also causes
8516  * the lock status bit to clear and stay cleared until the Stop mode is exited
8517  * and the PLL has reacquired lock. Any time the PLL is enabled and the LOCK0 bit
8518  * is cleared, the MCGPLLCLK will be gated off until the LOCK0 bit is asserted
8519  * again.
8520  *
8521  * Values:
8522  * - 0b0 - PLL is currently unlocked.
8523  * - 0b1 - PLL is currently locked.
8524  */
8525 /*@{*/
8526 /*! @brief Read current value of the MCG_S_LOCK0 field. */
8527 #define MCG_RD_S_LOCK0(base) ((MCG_S_REG(base) & MCG_S_LOCK0_MASK) >> MCG_S_LOCK0_SHIFT)
8528 #define MCG_BRD_S_LOCK0(base) (BME_UBFX8(&MCG_S_REG(base), MCG_S_LOCK0_SHIFT, MCG_S_LOCK0_WIDTH))
8529 /*@}*/
8530 
8531 /*!
8532  * @name Register MCG_S, field LOLS0[7] (W1C)
8533  *
8534  * This bit is a sticky bit indicating the lock status for the PLL. LOLS is set
8535  * if after acquiring lock, the PLL output frequency has fallen outside the lock
8536  * exit frequency tolerance, D unl . LOLIE determines whether an interrupt
8537  * request is made when LOLS is set. LOLRE determines whether a reset request is made
8538  * when LOLS is set. This bit is cleared by reset or by writing a logic 1 to it
8539  * when set. Writing a logic 0 to this bit has no effect.
8540  *
8541  * Values:
8542  * - 0b0 - PLL has not lost lock since LOLS 0 was last cleared.
8543  * - 0b1 - PLL has lost lock since LOLS 0 was last cleared.
8544  */
8545 /*@{*/
8546 /*! @brief Read current value of the MCG_S_LOLS0 field. */
8547 #define MCG_RD_S_LOLS0(base) ((MCG_S_REG(base) & MCG_S_LOLS0_MASK) >> MCG_S_LOLS0_SHIFT)
8548 #define MCG_BRD_S_LOLS0(base) (BME_UBFX8(&MCG_S_REG(base), MCG_S_LOLS0_SHIFT, MCG_S_LOLS0_WIDTH))
8549 
8550 /*! @brief Set the LOLS0 field to a new value. */
8551 #define MCG_WR_S_LOLS0(base, value) (MCG_RMW_S(base, MCG_S_LOLS0_MASK, MCG_S_LOLS0(value)))
8552 #define MCG_BWR_S_LOLS0(base, value) (BME_BFI8(&MCG_S_REG(base), ((uint8_t)(value) << MCG_S_LOLS0_SHIFT), MCG_S_LOLS0_SHIFT, MCG_S_LOLS0_WIDTH))
8553 /*@}*/
8554 
8555 /*******************************************************************************
8556  * MCG_SC - MCG Status and Control Register
8557  ******************************************************************************/
8558 
8559 /*!
8560  * @brief MCG_SC - MCG Status and Control Register (RW)
8561  *
8562  * Reset value: 0x02U
8563  */
8564 /*!
8565  * @name Constants and macros for entire MCG_SC register
8566  */
8567 /*@{*/
8568 #define MCG_RD_SC(base) (MCG_SC_REG(base))
8569 #define MCG_WR_SC(base, value) (MCG_SC_REG(base) = (value))
8570 #define MCG_RMW_SC(base, mask, value) (MCG_WR_SC(base, (MCG_RD_SC(base) & ~(mask)) | (value)))
8571 #define MCG_SET_SC(base, value) (BME_OR8(&MCG_SC_REG(base), (uint8_t)(value)))
8572 #define MCG_CLR_SC(base, value) (BME_AND8(&MCG_SC_REG(base), (uint8_t)(~(value))))
8573 #define MCG_TOG_SC(base, value) (BME_XOR8(&MCG_SC_REG(base), (uint8_t)(value)))
8574 /*@}*/
8575 
8576 /*
8577  * Constants & macros for individual MCG_SC bitfields
8578  */
8579 
8580 /*!
8581  * @name Register MCG_SC, field LOCS0[0] (W1C)
8582  *
8583  * The LOCS0 indicates when a loss of OSC0 reference clock has occurred. The
8584  * LOCS0 bit only has an effect when CME0 is set. This bit is cleared by writing a
8585  * logic 1 to it when set.
8586  *
8587  * Values:
8588  * - 0b0 - Loss of OSC0 has not occurred.
8589  * - 0b1 - Loss of OSC0 has occurred.
8590  */
8591 /*@{*/
8592 /*! @brief Read current value of the MCG_SC_LOCS0 field. */
8593 #define MCG_RD_SC_LOCS0(base) ((MCG_SC_REG(base) & MCG_SC_LOCS0_MASK) >> MCG_SC_LOCS0_SHIFT)
8594 #define MCG_BRD_SC_LOCS0(base) (BME_UBFX8(&MCG_SC_REG(base), MCG_SC_LOCS0_SHIFT, MCG_SC_LOCS0_WIDTH))
8595 
8596 /*! @brief Set the LOCS0 field to a new value. */
8597 #define MCG_WR_SC_LOCS0(base, value) (MCG_RMW_SC(base, MCG_SC_LOCS0_MASK, MCG_SC_LOCS0(value)))
8598 #define MCG_BWR_SC_LOCS0(base, value) (BME_BFI8(&MCG_SC_REG(base), ((uint8_t)(value) << MCG_SC_LOCS0_SHIFT), MCG_SC_LOCS0_SHIFT, MCG_SC_LOCS0_WIDTH))
8599 /*@}*/
8600 
8601 /*!
8602  * @name Register MCG_SC, field FCRDIV[3:1] (RW)
8603  *
8604  * Selects the amount to divide down the fast internal reference clock. The
8605  * resulting frequency will be in the range 31.25 kHz to 4 MHz (Note: Changing the
8606  * divider when the Fast IRC is enabled is not supported).
8607  *
8608  * Values:
8609  * - 0b000 - Divide Factor is 1
8610  * - 0b001 - Divide Factor is 2.
8611  * - 0b010 - Divide Factor is 4.
8612  * - 0b011 - Divide Factor is 8.
8613  * - 0b100 - Divide Factor is 16
8614  * - 0b101 - Divide Factor is 32
8615  * - 0b110 - Divide Factor is 64
8616  * - 0b111 - Divide Factor is 128.
8617  */
8618 /*@{*/
8619 /*! @brief Read current value of the MCG_SC_FCRDIV field. */
8620 #define MCG_RD_SC_FCRDIV(base) ((MCG_SC_REG(base) & MCG_SC_FCRDIV_MASK) >> MCG_SC_FCRDIV_SHIFT)
8621 #define MCG_BRD_SC_FCRDIV(base) (BME_UBFX8(&MCG_SC_REG(base), MCG_SC_FCRDIV_SHIFT, MCG_SC_FCRDIV_WIDTH))
8622 
8623 /*! @brief Set the FCRDIV field to a new value. */
8624 #define MCG_WR_SC_FCRDIV(base, value) (MCG_RMW_SC(base, (MCG_SC_FCRDIV_MASK | MCG_SC_LOCS0_MASK), MCG_SC_FCRDIV(value)))
8625 #define MCG_BWR_SC_FCRDIV(base, value) (BME_BFI8(&MCG_SC_REG(base), ((uint8_t)(value) << MCG_SC_FCRDIV_SHIFT), MCG_SC_FCRDIV_SHIFT, MCG_SC_FCRDIV_WIDTH))
8626 /*@}*/
8627 
8628 /*!
8629  * @name Register MCG_SC, field FLTPRSRV[4] (RW)
8630  *
8631  * This bit will prevent the FLL filter values from resetting allowing the FLL
8632  * output frequency to remain the same during clock mode changes where the FLL/DCO
8633  * output is still valid. (Note: This requires that the FLL reference frequency
8634  * to remain the same as what it was prior to the new clock mode switch.
8635  * Otherwise FLL filter and frequency values will change.)
8636  *
8637  * Values:
8638  * - 0b0 - FLL filter and FLL frequency will reset on changes to currect clock
8639  * mode.
8640  * - 0b1 - Fll filter and FLL frequency retain their previous values during new
8641  * clock mode change.
8642  */
8643 /*@{*/
8644 /*! @brief Read current value of the MCG_SC_FLTPRSRV field. */
8645 #define MCG_RD_SC_FLTPRSRV(base) ((MCG_SC_REG(base) & MCG_SC_FLTPRSRV_MASK) >> MCG_SC_FLTPRSRV_SHIFT)
8646 #define MCG_BRD_SC_FLTPRSRV(base) (BME_UBFX8(&MCG_SC_REG(base), MCG_SC_FLTPRSRV_SHIFT, MCG_SC_FLTPRSRV_WIDTH))
8647 
8648 /*! @brief Set the FLTPRSRV field to a new value. */
8649 #define MCG_WR_SC_FLTPRSRV(base, value) (MCG_RMW_SC(base, (MCG_SC_FLTPRSRV_MASK | MCG_SC_LOCS0_MASK), MCG_SC_FLTPRSRV(value)))
8650 #define MCG_BWR_SC_FLTPRSRV(base, value) (BME_BFI8(&MCG_SC_REG(base), ((uint8_t)(value) << MCG_SC_FLTPRSRV_SHIFT), MCG_SC_FLTPRSRV_SHIFT, MCG_SC_FLTPRSRV_WIDTH))
8651 /*@}*/
8652 
8653 /*!
8654  * @name Register MCG_SC, field ATMF[5] (RW)
8655  *
8656  * Fail flag for the Automatic Trim Machine (ATM). This bit asserts when the
8657  * Automatic Trim Machine is enabled, ATME=1, and a write to the C1, C3, C4, and SC
8658  * registers is detected or the MCG enters into any Stop mode. A write to ATMF
8659  * clears the flag.
8660  *
8661  * Values:
8662  * - 0b0 - Automatic Trim Machine completed normally.
8663  * - 0b1 - Automatic Trim Machine failed.
8664  */
8665 /*@{*/
8666 /*! @brief Read current value of the MCG_SC_ATMF field. */
8667 #define MCG_RD_SC_ATMF(base) ((MCG_SC_REG(base) & MCG_SC_ATMF_MASK) >> MCG_SC_ATMF_SHIFT)
8668 #define MCG_BRD_SC_ATMF(base) (BME_UBFX8(&MCG_SC_REG(base), MCG_SC_ATMF_SHIFT, MCG_SC_ATMF_WIDTH))
8669 
8670 /*! @brief Set the ATMF field to a new value. */
8671 #define MCG_WR_SC_ATMF(base, value) (MCG_RMW_SC(base, (MCG_SC_ATMF_MASK | MCG_SC_LOCS0_MASK), MCG_SC_ATMF(value)))
8672 #define MCG_BWR_SC_ATMF(base, value) (BME_BFI8(&MCG_SC_REG(base), ((uint8_t)(value) << MCG_SC_ATMF_SHIFT), MCG_SC_ATMF_SHIFT, MCG_SC_ATMF_WIDTH))
8673 /*@}*/
8674 
8675 /*!
8676  * @name Register MCG_SC, field ATMS[6] (RW)
8677  *
8678  * Selects the IRCS clock for Auto Trim Test.
8679  *
8680  * Values:
8681  * - 0b0 - 32 kHz Internal Reference Clock selected.
8682  * - 0b1 - 4 MHz Internal Reference Clock selected.
8683  */
8684 /*@{*/
8685 /*! @brief Read current value of the MCG_SC_ATMS field. */
8686 #define MCG_RD_SC_ATMS(base) ((MCG_SC_REG(base) & MCG_SC_ATMS_MASK) >> MCG_SC_ATMS_SHIFT)
8687 #define MCG_BRD_SC_ATMS(base) (BME_UBFX8(&MCG_SC_REG(base), MCG_SC_ATMS_SHIFT, MCG_SC_ATMS_WIDTH))
8688 
8689 /*! @brief Set the ATMS field to a new value. */
8690 #define MCG_WR_SC_ATMS(base, value) (MCG_RMW_SC(base, (MCG_SC_ATMS_MASK | MCG_SC_LOCS0_MASK), MCG_SC_ATMS(value)))
8691 #define MCG_BWR_SC_ATMS(base, value) (BME_BFI8(&MCG_SC_REG(base), ((uint8_t)(value) << MCG_SC_ATMS_SHIFT), MCG_SC_ATMS_SHIFT, MCG_SC_ATMS_WIDTH))
8692 /*@}*/
8693 
8694 /*!
8695  * @name Register MCG_SC, field ATME[7] (RW)
8696  *
8697  * Enables the Auto Trim Machine to start automatically trimming the selected
8698  * Internal Reference Clock. ATME deasserts after the Auto Trim Machine has
8699  * completed trimming all trim bits of the IRCS clock selected by the ATMS bit. Writing
8700  * to C1, C3, C4, and SC registers or entering Stop mode aborts the auto trim
8701  * operation and clears this bit.
8702  *
8703  * Values:
8704  * - 0b0 - Auto Trim Machine disabled.
8705  * - 0b1 - Auto Trim Machine enabled.
8706  */
8707 /*@{*/
8708 /*! @brief Read current value of the MCG_SC_ATME field. */
8709 #define MCG_RD_SC_ATME(base) ((MCG_SC_REG(base) & MCG_SC_ATME_MASK) >> MCG_SC_ATME_SHIFT)
8710 #define MCG_BRD_SC_ATME(base) (BME_UBFX8(&MCG_SC_REG(base), MCG_SC_ATME_SHIFT, MCG_SC_ATME_WIDTH))
8711 
8712 /*! @brief Set the ATME field to a new value. */
8713 #define MCG_WR_SC_ATME(base, value) (MCG_RMW_SC(base, (MCG_SC_ATME_MASK | MCG_SC_LOCS0_MASK), MCG_SC_ATME(value)))
8714 #define MCG_BWR_SC_ATME(base, value) (BME_BFI8(&MCG_SC_REG(base), ((uint8_t)(value) << MCG_SC_ATME_SHIFT), MCG_SC_ATME_SHIFT, MCG_SC_ATME_WIDTH))
8715 /*@}*/
8716 
8717 /*******************************************************************************
8718  * MCG_ATCVH - MCG Auto Trim Compare Value High Register
8719  ******************************************************************************/
8720 
8721 /*!
8722  * @brief MCG_ATCVH - MCG Auto Trim Compare Value High Register (RW)
8723  *
8724  * Reset value: 0x00U
8725  */
8726 /*!
8727  * @name Constants and macros for entire MCG_ATCVH register
8728  */
8729 /*@{*/
8730 #define MCG_RD_ATCVH(base) (MCG_ATCVH_REG(base))
8731 #define MCG_WR_ATCVH(base, value) (MCG_ATCVH_REG(base) = (value))
8732 #define MCG_RMW_ATCVH(base, mask, value) (MCG_WR_ATCVH(base, (MCG_RD_ATCVH(base) & ~(mask)) | (value)))
8733 #define MCG_SET_ATCVH(base, value) (BME_OR8(&MCG_ATCVH_REG(base), (uint8_t)(value)))
8734 #define MCG_CLR_ATCVH(base, value) (BME_AND8(&MCG_ATCVH_REG(base), (uint8_t)(~(value))))
8735 #define MCG_TOG_ATCVH(base, value) (BME_XOR8(&MCG_ATCVH_REG(base), (uint8_t)(value)))
8736 /*@}*/
8737 
8738 /*******************************************************************************
8739  * MCG_ATCVL - MCG Auto Trim Compare Value Low Register
8740  ******************************************************************************/
8741 
8742 /*!
8743  * @brief MCG_ATCVL - MCG Auto Trim Compare Value Low Register (RW)
8744  *
8745  * Reset value: 0x00U
8746  */
8747 /*!
8748  * @name Constants and macros for entire MCG_ATCVL register
8749  */
8750 /*@{*/
8751 #define MCG_RD_ATCVL(base) (MCG_ATCVL_REG(base))
8752 #define MCG_WR_ATCVL(base, value) (MCG_ATCVL_REG(base) = (value))
8753 #define MCG_RMW_ATCVL(base, mask, value) (MCG_WR_ATCVL(base, (MCG_RD_ATCVL(base) & ~(mask)) | (value)))
8754 #define MCG_SET_ATCVL(base, value) (BME_OR8(&MCG_ATCVL_REG(base), (uint8_t)(value)))
8755 #define MCG_CLR_ATCVL(base, value) (BME_AND8(&MCG_ATCVL_REG(base), (uint8_t)(~(value))))
8756 #define MCG_TOG_ATCVL(base, value) (BME_XOR8(&MCG_ATCVL_REG(base), (uint8_t)(value)))
8757 /*@}*/
8758 
8759 /*******************************************************************************
8760  * MCG_C7 - MCG Control 7 Register
8761  ******************************************************************************/
8762 
8763 /*!
8764  * @brief MCG_C7 - MCG Control 7 Register (ROZ)
8765  *
8766  * Reset value: 0x00U
8767  */
8768 /*!
8769  * @name Constants and macros for entire MCG_C7 register
8770  */
8771 /*@{*/
8772 #define MCG_RD_C7(base) (MCG_C7_REG(base))
8773 /*@}*/
8774 
8775 /*******************************************************************************
8776  * MCG_C8 - MCG Control 8 Register
8777  ******************************************************************************/
8778 
8779 /*!
8780  * @brief MCG_C8 - MCG Control 8 Register (RW)
8781  *
8782  * Reset value: 0x80U
8783  */
8784 /*!
8785  * @name Constants and macros for entire MCG_C8 register
8786  */
8787 /*@{*/
8788 #define MCG_RD_C8(base) (MCG_C8_REG(base))
8789 #define MCG_WR_C8(base, value) (MCG_C8_REG(base) = (value))
8790 #define MCG_RMW_C8(base, mask, value) (MCG_WR_C8(base, (MCG_RD_C8(base) & ~(mask)) | (value)))
8791 #define MCG_SET_C8(base, value) (BME_OR8(&MCG_C8_REG(base), (uint8_t)(value)))
8792 #define MCG_CLR_C8(base, value) (BME_AND8(&MCG_C8_REG(base), (uint8_t)(~(value))))
8793 #define MCG_TOG_C8(base, value) (BME_XOR8(&MCG_C8_REG(base), (uint8_t)(value)))
8794 /*@}*/
8795 
8796 /*
8797  * Constants & macros for individual MCG_C8 bitfields
8798  */
8799 
8800 /*!
8801  * @name Register MCG_C8, field LOLRE[6] (RW)
8802  *
8803  * Determines if a interrupt or a reset request is made following a PLL loss of
8804  * lock.
8805  *
8806  * Values:
8807  * - 0b0 - Interrupt request is generated on a PLL loss of lock indication. The
8808  * PLL loss of lock interrupt enable bit must also be set to generate the
8809  * interrupt request.
8810  * - 0b1 - Generate a reset request on a PLL loss of lock indication.
8811  */
8812 /*@{*/
8813 /*! @brief Read current value of the MCG_C8_LOLRE field. */
8814 #define MCG_RD_C8_LOLRE(base) ((MCG_C8_REG(base) & MCG_C8_LOLRE_MASK) >> MCG_C8_LOLRE_SHIFT)
8815 #define MCG_BRD_C8_LOLRE(base) (BME_UBFX8(&MCG_C8_REG(base), MCG_C8_LOLRE_SHIFT, MCG_C8_LOLRE_WIDTH))
8816 
8817 /*! @brief Set the LOLRE field to a new value. */
8818 #define MCG_WR_C8_LOLRE(base, value) (MCG_RMW_C8(base, MCG_C8_LOLRE_MASK, MCG_C8_LOLRE(value)))
8819 #define MCG_BWR_C8_LOLRE(base, value) (BME_BFI8(&MCG_C8_REG(base), ((uint8_t)(value) << MCG_C8_LOLRE_SHIFT), MCG_C8_LOLRE_SHIFT, MCG_C8_LOLRE_WIDTH))
8820 /*@}*/
8821 
8822 /*******************************************************************************
8823  * MCG_C9 - MCG Control 9 Register
8824  ******************************************************************************/
8825 
8826 /*!
8827  * @brief MCG_C9 - MCG Control 9 Register (ROZ)
8828  *
8829  * Reset value: 0x00U
8830  */
8831 /*!
8832  * @name Constants and macros for entire MCG_C9 register
8833  */
8834 /*@{*/
8835 #define MCG_RD_C9(base) (MCG_C9_REG(base))
8836 /*@}*/
8837 
8838 /*******************************************************************************
8839  * MCG_C10 - MCG Control 10 Register
8840  ******************************************************************************/
8841 
8842 /*!
8843  * @brief MCG_C10 - MCG Control 10 Register (ROZ)
8844  *
8845  * Reset value: 0x00U
8846  */
8847 /*!
8848  * @name Constants and macros for entire MCG_C10 register
8849  */
8850 /*@{*/
8851 #define MCG_RD_C10(base) (MCG_C10_REG(base))
8852 /*@}*/
8853 
8854 /* MCG C2[EREFS] backward compatibility */
8855 #define MCG_RD_C2_EREFS(base) (MCG_RD_C2_EREFS0(base))
8856 #define MCG_BRD_C2_EREFS(base) (MCG_BRD_C2_EREFS0(base))
8857 #define MCG_WR_C2_EREFS(base, value) (MCG_WR_C2_EREFS0((base), (value)))
8858 #define MCG_BWR_C2_EREFS(base, value) (MCG_BWR_C2_EREFS0((base), (value)))
8859 /* MCG C2[HGO] backward compatibility */
8860 #define MCG_RD_C2_HGO(base) (MCG_RD_C2_HGO0(base))
8861 #define MCG_BRD_C2_HGO(base) (MCG_BRD_C2_HGO0(base))
8862 #define MCG_WR_C2_HGO(base, value) (MCG_WR_C2_HGO0((base), (value)))
8863 #define MCG_BWR_C2_HGO(base, value) (MCG_BWR_C2_HGO0((base), (value)))
8864 /* MCG C2[RANGE] backward compatibility */
8865 #define MCG_RD_C2_RANGE(base) (MCG_RD_C2_RANGE0(base))
8866 #define MCG_BRD_C2_RANGE(base) (MCG_BRD_C2_RANGE0(base))
8867 #define MCG_WR_C2_RANGE(base, value) (MCG_WR_C2_RANGE0((base), (value)))
8868 #define MCG_BWR_C2_RANGE(base, value) (MCG_BWR_C2_RANGE0((base), (value)))
8869 
8870 /*
8871  * MKL25Z4 MCM
8872  *
8873  * Core Platform Miscellaneous Control Module
8874  *
8875  * Registers defined in this header file:
8876  * - MCM_PLASC - Crossbar Switch (AXBS) Slave Configuration
8877  * - MCM_PLAMC - Crossbar Switch (AXBS) Master Configuration
8878  * - MCM_PLACR - Platform Control Register
8879  * - MCM_CPO - Compute Operation Control Register
8880  */
8881 
8882 #define MCM_INSTANCE_COUNT (1U) /*!< Number of instances of the MCM module. */
8883 #define MCM_IDX (0U) /*!< Instance number for MCM. */
8884 
8885 /*******************************************************************************
8886  * MCM_PLASC - Crossbar Switch (AXBS) Slave Configuration
8887  ******************************************************************************/
8888 
8889 /*!
8890  * @brief MCM_PLASC - Crossbar Switch (AXBS) Slave Configuration (RO)
8891  *
8892  * Reset value: 0x0007U
8893  *
8894  * PLASC is a 16-bit read-only register identifying the presence/absence of bus
8895  * slave connections to the device's crossbar switch.
8896  */
8897 /*!
8898  * @name Constants and macros for entire MCM_PLASC register
8899  */
8900 /*@{*/
8901 #define MCM_RD_PLASC(base) (MCM_PLASC_REG(base))
8902 /*@}*/
8903 
8904 /*
8905  * Constants & macros for individual MCM_PLASC bitfields
8906  */
8907 
8908 /*!
8909  * @name Register MCM_PLASC, field ASC[7:0] (RO)
8910  *
8911  * Values:
8912  * - 0b00000000 - A bus slave connection to AXBS input port n is absent
8913  * - 0b00000001 - A bus slave connection to AXBS input port n is present
8914  */
8915 /*@{*/
8916 /*! @brief Read current value of the MCM_PLASC_ASC field. */
8917 #define MCM_RD_PLASC_ASC(base) ((MCM_PLASC_REG(base) & MCM_PLASC_ASC_MASK) >> MCM_PLASC_ASC_SHIFT)
8918 #define MCM_BRD_PLASC_ASC(base) (MCM_RD_PLASC_ASC(base))
8919 /*@}*/
8920 
8921 /*******************************************************************************
8922  * MCM_PLAMC - Crossbar Switch (AXBS) Master Configuration
8923  ******************************************************************************/
8924 
8925 /*!
8926  * @brief MCM_PLAMC - Crossbar Switch (AXBS) Master Configuration (RO)
8927  *
8928  * Reset value: 0x000DU
8929  *
8930  * PLAMC is a 16-bit read-only register identifying the presence/absence of bus
8931  * master connections to the device's crossbar switch.
8932  */
8933 /*!
8934  * @name Constants and macros for entire MCM_PLAMC register
8935  */
8936 /*@{*/
8937 #define MCM_RD_PLAMC(base) (MCM_PLAMC_REG(base))
8938 /*@}*/
8939 
8940 /*
8941  * Constants & macros for individual MCM_PLAMC bitfields
8942  */
8943 
8944 /*!
8945  * @name Register MCM_PLAMC, field AMC[7:0] (RO)
8946  *
8947  * Values:
8948  * - 0b00000000 - A bus master connection to AXBS input port n is absent
8949  * - 0b00000001 - A bus master connection to AXBS input port n is present
8950  */
8951 /*@{*/
8952 /*! @brief Read current value of the MCM_PLAMC_AMC field. */
8953 #define MCM_RD_PLAMC_AMC(base) ((MCM_PLAMC_REG(base) & MCM_PLAMC_AMC_MASK) >> MCM_PLAMC_AMC_SHIFT)
8954 #define MCM_BRD_PLAMC_AMC(base) (MCM_RD_PLAMC_AMC(base))
8955 /*@}*/
8956 
8957 /*******************************************************************************
8958  * MCM_PLACR - Platform Control Register
8959  ******************************************************************************/
8960 
8961 /*!
8962  * @brief MCM_PLACR - Platform Control Register (RW)
8963  *
8964  * Reset value: 0x00000000U
8965  *
8966  * The PLACR register selects the arbitration policy for the crossbar masters
8967  * and configures the flash memory controller. The speculation buffer and cache in
8968  * the flash memory controller is configurable via MCM_PLACR[15:10]. The
8969  * speculation buffer is enabled only for instructions after reset. It is possible to
8970  * have these states for the speculation buffer: DFCS EFDS Description 0 0
8971  * Speculation buffer is on for instruction and off for data. 0 1 Speculation buffer is on
8972  * for instruction and on for data. 1 X Speculation buffer is off. The cache in
8973  * flash controller is enabled and caching both instruction and data type fetches
8974  * after reset. It is possible to have these states for the cache: DFCC DFCIC
8975  * DFCDA Description 0 0 0 Cache is on for both instruction and data. 0 0 1 Cache
8976  * is on for instruction and off for data. 0 1 0 Cache is off for instruction and
8977  * on for data. 0 1 1 Cache is off for both instruction and data. 1 X X Cache is
8978  * off.
8979  */
8980 /*!
8981  * @name Constants and macros for entire MCM_PLACR register
8982  */
8983 /*@{*/
8984 #define MCM_RD_PLACR(base) (MCM_PLACR_REG(base))
8985 #define MCM_WR_PLACR(base, value) (MCM_PLACR_REG(base) = (value))
8986 #define MCM_RMW_PLACR(base, mask, value) (MCM_WR_PLACR(base, (MCM_RD_PLACR(base) & ~(mask)) | (value)))
8987 #define MCM_SET_PLACR(base, value) (MCM_WR_PLACR(base, MCM_RD_PLACR(base) | (value)))
8988 #define MCM_CLR_PLACR(base, value) (MCM_WR_PLACR(base, MCM_RD_PLACR(base) & ~(value)))
8989 #define MCM_TOG_PLACR(base, value) (MCM_WR_PLACR(base, MCM_RD_PLACR(base) ^ (value)))
8990 /*@}*/
8991 
8992 /*
8993  * Constants & macros for individual MCM_PLACR bitfields
8994  */
8995 
8996 /*!
8997  * @name Register MCM_PLACR, field ARB[9] (RW)
8998  *
8999  * Values:
9000  * - 0b0 - Fixed-priority arbitration for the crossbar masters
9001  * - 0b1 - Round-robin arbitration for the crossbar masters
9002  */
9003 /*@{*/
9004 /*! @brief Read current value of the MCM_PLACR_ARB field. */
9005 #define MCM_RD_PLACR_ARB(base) ((MCM_PLACR_REG(base) & MCM_PLACR_ARB_MASK) >> MCM_PLACR_ARB_SHIFT)
9006 #define MCM_BRD_PLACR_ARB(base) (MCM_RD_PLACR_ARB(base))
9007 
9008 /*! @brief Set the ARB field to a new value. */
9009 #define MCM_WR_PLACR_ARB(base, value) (MCM_RMW_PLACR(base, MCM_PLACR_ARB_MASK, MCM_PLACR_ARB(value)))
9010 #define MCM_BWR_PLACR_ARB(base, value) (MCM_WR_PLACR_ARB(base, value))
9011 /*@}*/
9012 
9013 /*!
9014  * @name Register MCM_PLACR, field CFCC[10] (WORZ)
9015  *
9016  * Writing a 1 to this field clears the cache. Writing a 0 to this field is
9017  * ignored. This field always reads as 0.
9018  */
9019 /*@{*/
9020 /*! @brief Set the CFCC field to a new value. */
9021 #define MCM_WR_PLACR_CFCC(base, value) (MCM_RMW_PLACR(base, MCM_PLACR_CFCC_MASK, MCM_PLACR_CFCC(value)))
9022 #define MCM_BWR_PLACR_CFCC(base, value) (MCM_WR_PLACR_CFCC(base, value))
9023 /*@}*/
9024 
9025 /*!
9026  * @name Register MCM_PLACR, field DFCDA[11] (RW)
9027  *
9028  * This field is used to disable flash controller data caching.
9029  *
9030  * Values:
9031  * - 0b0 - Enable flash controller data caching
9032  * - 0b1 - Disable flash controller data caching.
9033  */
9034 /*@{*/
9035 /*! @brief Read current value of the MCM_PLACR_DFCDA field. */
9036 #define MCM_RD_PLACR_DFCDA(base) ((MCM_PLACR_REG(base) & MCM_PLACR_DFCDA_MASK) >> MCM_PLACR_DFCDA_SHIFT)
9037 #define MCM_BRD_PLACR_DFCDA(base) (MCM_RD_PLACR_DFCDA(base))
9038 
9039 /*! @brief Set the DFCDA field to a new value. */
9040 #define MCM_WR_PLACR_DFCDA(base, value) (MCM_RMW_PLACR(base, MCM_PLACR_DFCDA_MASK, MCM_PLACR_DFCDA(value)))
9041 #define MCM_BWR_PLACR_DFCDA(base, value) (MCM_WR_PLACR_DFCDA(base, value))
9042 /*@}*/
9043 
9044 /*!
9045  * @name Register MCM_PLACR, field DFCIC[12] (RW)
9046  *
9047  * This field is used to disable flash controller instruction caching.
9048  *
9049  * Values:
9050  * - 0b0 - Enable flash controller instruction caching.
9051  * - 0b1 - Disable flash controller instruction caching.
9052  */
9053 /*@{*/
9054 /*! @brief Read current value of the MCM_PLACR_DFCIC field. */
9055 #define MCM_RD_PLACR_DFCIC(base) ((MCM_PLACR_REG(base) & MCM_PLACR_DFCIC_MASK) >> MCM_PLACR_DFCIC_SHIFT)
9056 #define MCM_BRD_PLACR_DFCIC(base) (MCM_RD_PLACR_DFCIC(base))
9057 
9058 /*! @brief Set the DFCIC field to a new value. */
9059 #define MCM_WR_PLACR_DFCIC(base, value) (MCM_RMW_PLACR(base, MCM_PLACR_DFCIC_MASK, MCM_PLACR_DFCIC(value)))
9060 #define MCM_BWR_PLACR_DFCIC(base, value) (MCM_WR_PLACR_DFCIC(base, value))
9061 /*@}*/
9062 
9063 /*!
9064  * @name Register MCM_PLACR, field DFCC[13] (RW)
9065  *
9066  * This field is used to disable flash controller cache.
9067  *
9068  * Values:
9069  * - 0b0 - Enable flash controller cache.
9070  * - 0b1 - Disable flash controller cache.
9071  */
9072 /*@{*/
9073 /*! @brief Read current value of the MCM_PLACR_DFCC field. */
9074 #define MCM_RD_PLACR_DFCC(base) ((MCM_PLACR_REG(base) & MCM_PLACR_DFCC_MASK) >> MCM_PLACR_DFCC_SHIFT)
9075 #define MCM_BRD_PLACR_DFCC(base) (MCM_RD_PLACR_DFCC(base))
9076 
9077 /*! @brief Set the DFCC field to a new value. */
9078 #define MCM_WR_PLACR_DFCC(base, value) (MCM_RMW_PLACR(base, MCM_PLACR_DFCC_MASK, MCM_PLACR_DFCC(value)))
9079 #define MCM_BWR_PLACR_DFCC(base, value) (MCM_WR_PLACR_DFCC(base, value))
9080 /*@}*/
9081 
9082 /*!
9083  * @name Register MCM_PLACR, field EFDS[14] (RW)
9084  *
9085  * This field is used to enable flash data speculation.
9086  *
9087  * Values:
9088  * - 0b0 - Disable flash data speculation.
9089  * - 0b1 - Enable flash data speculation.
9090  */
9091 /*@{*/
9092 /*! @brief Read current value of the MCM_PLACR_EFDS field. */
9093 #define MCM_RD_PLACR_EFDS(base) ((MCM_PLACR_REG(base) & MCM_PLACR_EFDS_MASK) >> MCM_PLACR_EFDS_SHIFT)
9094 #define MCM_BRD_PLACR_EFDS(base) (MCM_RD_PLACR_EFDS(base))
9095 
9096 /*! @brief Set the EFDS field to a new value. */
9097 #define MCM_WR_PLACR_EFDS(base, value) (MCM_RMW_PLACR(base, MCM_PLACR_EFDS_MASK, MCM_PLACR_EFDS(value)))
9098 #define MCM_BWR_PLACR_EFDS(base, value) (MCM_WR_PLACR_EFDS(base, value))
9099 /*@}*/
9100 
9101 /*!
9102  * @name Register MCM_PLACR, field DFCS[15] (RW)
9103  *
9104  * This field is used to disable flash controller speculation.
9105  *
9106  * Values:
9107  * - 0b0 - Enable flash controller speculation.
9108  * - 0b1 - Disable flash controller speculation.
9109  */
9110 /*@{*/
9111 /*! @brief Read current value of the MCM_PLACR_DFCS field. */
9112 #define MCM_RD_PLACR_DFCS(base) ((MCM_PLACR_REG(base) & MCM_PLACR_DFCS_MASK) >> MCM_PLACR_DFCS_SHIFT)
9113 #define MCM_BRD_PLACR_DFCS(base) (MCM_RD_PLACR_DFCS(base))
9114 
9115 /*! @brief Set the DFCS field to a new value. */
9116 #define MCM_WR_PLACR_DFCS(base, value) (MCM_RMW_PLACR(base, MCM_PLACR_DFCS_MASK, MCM_PLACR_DFCS(value)))
9117 #define MCM_BWR_PLACR_DFCS(base, value) (MCM_WR_PLACR_DFCS(base, value))
9118 /*@}*/
9119 
9120 /*!
9121  * @name Register MCM_PLACR, field ESFC[16] (RW)
9122  *
9123  * This field is used to enable stalling flash controller when flash is busy.
9124  *
9125  * Values:
9126  * - 0b0 - Disable stalling flash controller when flash is busy.
9127  * - 0b1 - Enable stalling flash controller when flash is busy.
9128  */
9129 /*@{*/
9130 /*! @brief Read current value of the MCM_PLACR_ESFC field. */
9131 #define MCM_RD_PLACR_ESFC(base) ((MCM_PLACR_REG(base) & MCM_PLACR_ESFC_MASK) >> MCM_PLACR_ESFC_SHIFT)
9132 #define MCM_BRD_PLACR_ESFC(base) (MCM_RD_PLACR_ESFC(base))
9133 
9134 /*! @brief Set the ESFC field to a new value. */
9135 #define MCM_WR_PLACR_ESFC(base, value) (MCM_RMW_PLACR(base, MCM_PLACR_ESFC_MASK, MCM_PLACR_ESFC(value)))
9136 #define MCM_BWR_PLACR_ESFC(base, value) (MCM_WR_PLACR_ESFC(base, value))
9137 /*@}*/
9138 
9139 /*******************************************************************************
9140  * MCM_CPO - Compute Operation Control Register
9141  ******************************************************************************/
9142 
9143 /*!
9144  * @brief MCM_CPO - Compute Operation Control Register (RW)
9145  *
9146  * Reset value: 0x00000000U
9147  *
9148  * This register controls the Compute Operation.
9149  */
9150 /*!
9151  * @name Constants and macros for entire MCM_CPO register
9152  */
9153 /*@{*/
9154 #define MCM_RD_CPO(base) (MCM_CPO_REG(base))
9155 #define MCM_WR_CPO(base, value) (MCM_CPO_REG(base) = (value))
9156 #define MCM_RMW_CPO(base, mask, value) (MCM_WR_CPO(base, (MCM_RD_CPO(base) & ~(mask)) | (value)))
9157 #define MCM_SET_CPO(base, value) (MCM_WR_CPO(base, MCM_RD_CPO(base) | (value)))
9158 #define MCM_CLR_CPO(base, value) (MCM_WR_CPO(base, MCM_RD_CPO(base) & ~(value)))
9159 #define MCM_TOG_CPO(base, value) (MCM_WR_CPO(base, MCM_RD_CPO(base) ^ (value)))
9160 /*@}*/
9161 
9162 /*
9163  * Constants & macros for individual MCM_CPO bitfields
9164  */
9165 
9166 /*!
9167  * @name Register MCM_CPO, field CPOREQ[0] (RW)
9168  *
9169  * This bit is auto-cleared by vector fetching if CPOWOI = 1.
9170  *
9171  * Values:
9172  * - 0b0 - Request is cleared.
9173  * - 0b1 - Request Compute Operation.
9174  */
9175 /*@{*/
9176 /*! @brief Read current value of the MCM_CPO_CPOREQ field. */
9177 #define MCM_RD_CPO_CPOREQ(base) ((MCM_CPO_REG(base) & MCM_CPO_CPOREQ_MASK) >> MCM_CPO_CPOREQ_SHIFT)
9178 #define MCM_BRD_CPO_CPOREQ(base) (MCM_RD_CPO_CPOREQ(base))
9179 
9180 /*! @brief Set the CPOREQ field to a new value. */
9181 #define MCM_WR_CPO_CPOREQ(base, value) (MCM_RMW_CPO(base, MCM_CPO_CPOREQ_MASK, MCM_CPO_CPOREQ(value)))
9182 #define MCM_BWR_CPO_CPOREQ(base, value) (MCM_WR_CPO_CPOREQ(base, value))
9183 /*@}*/
9184 
9185 /*!
9186  * @name Register MCM_CPO, field CPOACK[1] (RO)
9187  *
9188  * Values:
9189  * - 0b0 - Compute operation entry has not completed or compute operation exit
9190  * has completed.
9191  * - 0b1 - Compute operation entry has completed or compute operation exit has
9192  * not completed.
9193  */
9194 /*@{*/
9195 /*! @brief Read current value of the MCM_CPO_CPOACK field. */
9196 #define MCM_RD_CPO_CPOACK(base) ((MCM_CPO_REG(base) & MCM_CPO_CPOACK_MASK) >> MCM_CPO_CPOACK_SHIFT)
9197 #define MCM_BRD_CPO_CPOACK(base) (MCM_RD_CPO_CPOACK(base))
9198 /*@}*/
9199 
9200 /*!
9201  * @name Register MCM_CPO, field CPOWOI[2] (RW)
9202  *
9203  * Values:
9204  * - 0b0 - No effect.
9205  * - 0b1 - When set, the CPOREQ is cleared on any interrupt or exception vector
9206  * fetch.
9207  */
9208 /*@{*/
9209 /*! @brief Read current value of the MCM_CPO_CPOWOI field. */
9210 #define MCM_RD_CPO_CPOWOI(base) ((MCM_CPO_REG(base) & MCM_CPO_CPOWOI_MASK) >> MCM_CPO_CPOWOI_SHIFT)
9211 #define MCM_BRD_CPO_CPOWOI(base) (MCM_RD_CPO_CPOWOI(base))
9212 
9213 /*! @brief Set the CPOWOI field to a new value. */
9214 #define MCM_WR_CPO_CPOWOI(base, value) (MCM_RMW_CPO(base, MCM_CPO_CPOWOI_MASK, MCM_CPO_CPOWOI(value)))
9215 #define MCM_BWR_CPO_CPOWOI(base, value) (MCM_WR_CPO_CPOWOI(base, value))
9216 /*@}*/
9217 
9218 /*
9219  * MKL25Z4 MTB
9220  *
9221  * Micro Trace Buffer
9222  *
9223  * Registers defined in this header file:
9224  * - MTB_POSITION - MTB Position Register
9225  * - MTB_MASTER - MTB Master Register
9226  * - MTB_FLOW - MTB Flow Register
9227  * - MTB_BASE - MTB Base Register
9228  * - MTB_MODECTRL - Integration Mode Control Register
9229  * - MTB_TAGSET - Claim TAG Set Register
9230  * - MTB_TAGCLEAR - Claim TAG Clear Register
9231  * - MTB_LOCKACCESS - Lock Access Register
9232  * - MTB_LOCKSTAT - Lock Status Register
9233  * - MTB_AUTHSTAT - Authentication Status Register
9234  * - MTB_DEVICEARCH - Device Architecture Register
9235  * - MTB_DEVICECFG - Device Configuration Register
9236  * - MTB_DEVICETYPID - Device Type Identifier Register
9237  * - MTB_PERIPHID - Peripheral ID Register
9238  * - MTB_COMPID - Component ID Register
9239  */
9240 
9241 #define MTB_INSTANCE_COUNT (1U) /*!< Number of instances of the MTB module. */
9242 #define MTB_IDX (0U) /*!< Instance number for MTB. */
9243 
9244 /*******************************************************************************
9245  * MTB_POSITION - MTB Position Register
9246  ******************************************************************************/
9247 
9248 /*!
9249  * @brief MTB_POSITION - MTB Position Register (RW)
9250  *
9251  * Reset value: 0x00000000U
9252  *
9253  * The MTB_POSITION register is the trace write address pointer and wrap bit.
9254  * This register can be modified by the explicit programming model writes. It is
9255  * also automatically updated by the MTB hardware when trace packets are being
9256  * recorded.
9257  */
9258 /*!
9259  * @name Constants and macros for entire MTB_POSITION register
9260  */
9261 /*@{*/
9262 #define MTB_RD_POSITION(base) (MTB_POSITION_REG(base))
9263 #define MTB_WR_POSITION(base, value) (MTB_POSITION_REG(base) = (value))
9264 #define MTB_RMW_POSITION(base, mask, value) (MTB_WR_POSITION(base, (MTB_RD_POSITION(base) & ~(mask)) | (value)))
9265 #define MTB_SET_POSITION(base, value) (MTB_WR_POSITION(base, MTB_RD_POSITION(base) | (value)))
9266 #define MTB_CLR_POSITION(base, value) (MTB_WR_POSITION(base, MTB_RD_POSITION(base) & ~(value)))
9267 #define MTB_TOG_POSITION(base, value) (MTB_WR_POSITION(base, MTB_RD_POSITION(base) ^ (value)))
9268 /*@}*/
9269 
9270 /*
9271  * Constants & macros for individual MTB_POSITION bitfields
9272  */
9273 
9274 /*!
9275  * @name Register MTB_POSITION, field WRAP[2] (RW)
9276  *
9277  * This bit is set to 1 automatically when the POINTER value wraps as determined
9278  * by the MTB_MASTER[MASK] bit in the MASTER Trace Control Register. A debug
9279  * agent can use the WRAP bit to determine whether the trace information above and
9280  * below the pointer address is valid.
9281  */
9282 /*@{*/
9283 /*! @brief Read current value of the MTB_POSITION_WRAP field. */
9284 #define MTB_RD_POSITION_WRAP(base) ((MTB_POSITION_REG(base) & MTB_POSITION_WRAP_MASK) >> MTB_POSITION_WRAP_SHIFT)
9285 #define MTB_BRD_POSITION_WRAP(base) (MTB_RD_POSITION_WRAP(base))
9286 
9287 /*! @brief Set the WRAP field to a new value. */
9288 #define MTB_WR_POSITION_WRAP(base, value) (MTB_RMW_POSITION(base, MTB_POSITION_WRAP_MASK, MTB_POSITION_WRAP(value)))
9289 #define MTB_BWR_POSITION_WRAP(base, value) (MTB_WR_POSITION_WRAP(base, value))
9290 /*@}*/
9291 
9292 /*!
9293  * @name Register MTB_POSITION, field POINTER[31:3] (RW)
9294  *
9295  * Trace packet address pointer. Because a packet consists of two words, the
9296  * POINTER field is the address of the first word of a packet. This field contains
9297  * bits[31:3] of the RAM address that points to the next unused memory location
9298  * for the trace data. This is an empty ascending location and is automatically
9299  * updated. A debug agent can add the value of POINTER to the value of MTB_BASE to
9300  * obtain the absolute pointer address as seen on the system AHB bus interface.
9301  * The size of the RAM is parameterized and the most significant bits of the
9302  * POINTER field are RAZ/WI. POSITION register bits greater than or equal to 15 are
9303  * RAZ/WI, therefore, the active POINTER field bits are [11:0].
9304  */
9305 /*@{*/
9306 /*! @brief Read current value of the MTB_POSITION_POINTER field. */
9307 #define MTB_RD_POSITION_POINTER(base) ((MTB_POSITION_REG(base) & MTB_POSITION_POINTER_MASK) >> MTB_POSITION_POINTER_SHIFT)
9308 #define MTB_BRD_POSITION_POINTER(base) (MTB_RD_POSITION_POINTER(base))
9309 
9310 /*! @brief Set the POINTER field to a new value. */
9311 #define MTB_WR_POSITION_POINTER(base, value) (MTB_RMW_POSITION(base, MTB_POSITION_POINTER_MASK, MTB_POSITION_POINTER(value)))
9312 #define MTB_BWR_POSITION_POINTER(base, value) (MTB_WR_POSITION_POINTER(base, value))
9313 /*@}*/
9314 
9315 /*******************************************************************************
9316  * MTB_MASTER - MTB Master Register
9317  ******************************************************************************/
9318 
9319 /*!
9320  * @brief MTB_MASTER - MTB Master Register (RW)
9321  *
9322  * Reset value: 0x00000080U
9323  *
9324  * The MTB_MASTER register contains the main program trace enable plus other
9325  * trace controls. This register can be modified by the explicit programming model
9326  * writes. MTB_MASTER[EN] and MTB_MASTER[HALTREQ] fields are also automatically
9327  * updated by the MTB hardware. Before the MTB_MASTER[EN] or MTB_MASTER[TSTARTEN]
9328  * bits are set to 1, software must initialize the MTB_POSITION and MTB_FLOW
9329  * registers. If the MTB_FLOW[WATERMARK] field is used to stop tracing or to halt the
9330  * processor, the MTB_MASTER[MASK] field must still be set to a value that
9331  * prevents the MTB_POSITION[POINTER] field from wrapping before it reaches the
9332  * MTB_FLOW[WATERMARK] value. The format of this mask field is different than the
9333  * MTBDWT_MASKn[MASK].
9334  */
9335 /*!
9336  * @name Constants and macros for entire MTB_MASTER register
9337  */
9338 /*@{*/
9339 #define MTB_RD_MASTER(base) (MTB_MASTER_REG(base))
9340 #define MTB_WR_MASTER(base, value) (MTB_MASTER_REG(base) = (value))
9341 #define MTB_RMW_MASTER(base, mask, value) (MTB_WR_MASTER(base, (MTB_RD_MASTER(base) & ~(mask)) | (value)))
9342 #define MTB_SET_MASTER(base, value) (MTB_WR_MASTER(base, MTB_RD_MASTER(base) | (value)))
9343 #define MTB_CLR_MASTER(base, value) (MTB_WR_MASTER(base, MTB_RD_MASTER(base) & ~(value)))
9344 #define MTB_TOG_MASTER(base, value) (MTB_WR_MASTER(base, MTB_RD_MASTER(base) ^ (value)))
9345 /*@}*/
9346 
9347 /*
9348  * Constants & macros for individual MTB_MASTER bitfields
9349  */
9350 
9351 /*!
9352  * @name Register MTB_MASTER, field MASK[4:0] (RW)
9353  *
9354  * This value determines the maximum size of the trace buffer in RAM. It
9355  * specifies the most-significant bit of the MTB_POSITION[POINTER] field that can be
9356  * updated by automatic increment. If the trace tries to advance past this power of
9357  * two, the MTB_POSITION[WRAP] bit is set to 1, the MTB_POSITION[POINTER[MASK:0]]
9358  * bits are set to zero, and the MTB_POSITION[POINTER[11:MASK+1]] bits remain
9359  * unchanged. This field causes the trace packet information to be stored in a
9360  * circular buffer of size 2^[MASK+4] bytes, that can be positioned in memory at
9361  * multiples of this size. Valid values of this field are zero to 11. Values greater
9362  * than the maximum have the same effect as the maximum.
9363  */
9364 /*@{*/
9365 /*! @brief Read current value of the MTB_MASTER_MASK field. */
9366 #define MTB_RD_MASTER_MASK(base) ((MTB_MASTER_REG(base) & MTB_MASTER_MASK_MASK) >> MTB_MASTER_MASK_SHIFT)
9367 #define MTB_BRD_MASTER_MASK(base) (MTB_RD_MASTER_MASK(base))
9368 
9369 /*! @brief Set the MASK field to a new value. */
9370 #define MTB_WR_MASTER_MASK(base, value) (MTB_RMW_MASTER(base, MTB_MASTER_MASK_MASK, MTB_MASTER_MASK(value)))
9371 #define MTB_BWR_MASTER_MASK(base, value) (MTB_WR_MASTER_MASK(base, value))
9372 /*@}*/
9373 
9374 /*!
9375  * @name Register MTB_MASTER, field TSTARTEN[5] (RW)
9376  *
9377  * If this bit is 1 and the TSTART signal is HIGH, then the EN bit is set to 1.
9378  * Tracing continues until a stop condition occurs.
9379  */
9380 /*@{*/
9381 /*! @brief Read current value of the MTB_MASTER_TSTARTEN field. */
9382 #define MTB_RD_MASTER_TSTARTEN(base) ((MTB_MASTER_REG(base) & MTB_MASTER_TSTARTEN_MASK) >> MTB_MASTER_TSTARTEN_SHIFT)
9383 #define MTB_BRD_MASTER_TSTARTEN(base) (MTB_RD_MASTER_TSTARTEN(base))
9384 
9385 /*! @brief Set the TSTARTEN field to a new value. */
9386 #define MTB_WR_MASTER_TSTARTEN(base, value) (MTB_RMW_MASTER(base, MTB_MASTER_TSTARTEN_MASK, MTB_MASTER_TSTARTEN(value)))
9387 #define MTB_BWR_MASTER_TSTARTEN(base, value) (MTB_WR_MASTER_TSTARTEN(base, value))
9388 /*@}*/
9389 
9390 /*!
9391  * @name Register MTB_MASTER, field TSTOPEN[6] (RW)
9392  *
9393  * If this bit is 1 and the TSTOP signal is HIGH, then the EN bit is set to 0.
9394  * If a trace packet is being written to memory, the write is completed before
9395  * tracing is stopped.
9396  */
9397 /*@{*/
9398 /*! @brief Read current value of the MTB_MASTER_TSTOPEN field. */
9399 #define MTB_RD_MASTER_TSTOPEN(base) ((MTB_MASTER_REG(base) & MTB_MASTER_TSTOPEN_MASK) >> MTB_MASTER_TSTOPEN_SHIFT)
9400 #define MTB_BRD_MASTER_TSTOPEN(base) (MTB_RD_MASTER_TSTOPEN(base))
9401 
9402 /*! @brief Set the TSTOPEN field to a new value. */
9403 #define MTB_WR_MASTER_TSTOPEN(base, value) (MTB_RMW_MASTER(base, MTB_MASTER_TSTOPEN_MASK, MTB_MASTER_TSTOPEN(value)))
9404 #define MTB_BWR_MASTER_TSTOPEN(base, value) (MTB_WR_MASTER_TSTOPEN(base, value))
9405 /*@}*/
9406 
9407 /*!
9408  * @name Register MTB_MASTER, field SFRWPRIV[7] (RW)
9409  *
9410  * If this bit is 0, then user or privileged AHB read and write accesses to the
9411  * MTB_RAM Special Function Registers (programming model) are permitted. If this
9412  * bit is 1, then only privileged write accesses are permitted; user write
9413  * accesses are ignored. The HPROT[1] signal determines if an access is user or
9414  * privileged. Note MTB_RAM SFR read access are not controlled by this bit and are
9415  * always permitted.
9416  */
9417 /*@{*/
9418 /*! @brief Read current value of the MTB_MASTER_SFRWPRIV field. */
9419 #define MTB_RD_MASTER_SFRWPRIV(base) ((MTB_MASTER_REG(base) & MTB_MASTER_SFRWPRIV_MASK) >> MTB_MASTER_SFRWPRIV_SHIFT)
9420 #define MTB_BRD_MASTER_SFRWPRIV(base) (MTB_RD_MASTER_SFRWPRIV(base))
9421 
9422 /*! @brief Set the SFRWPRIV field to a new value. */
9423 #define MTB_WR_MASTER_SFRWPRIV(base, value) (MTB_RMW_MASTER(base, MTB_MASTER_SFRWPRIV_MASK, MTB_MASTER_SFRWPRIV(value)))
9424 #define MTB_BWR_MASTER_SFRWPRIV(base, value) (MTB_WR_MASTER_SFRWPRIV(base, value))
9425 /*@}*/
9426 
9427 /*!
9428  * @name Register MTB_MASTER, field RAMPRIV[8] (RW)
9429  *
9430  * If this bit is 0, then user or privileged AHB read and write accesses to the
9431  * RAM are permitted. If this bit is 1, then only privileged AHB read and write
9432  * accesses to the RAM are permitted and user accesses are RAZ/WI. The HPROT[1]
9433  * signal determines if an access is a user or privileged mode reference.
9434  */
9435 /*@{*/
9436 /*! @brief Read current value of the MTB_MASTER_RAMPRIV field. */
9437 #define MTB_RD_MASTER_RAMPRIV(base) ((MTB_MASTER_REG(base) & MTB_MASTER_RAMPRIV_MASK) >> MTB_MASTER_RAMPRIV_SHIFT)
9438 #define MTB_BRD_MASTER_RAMPRIV(base) (MTB_RD_MASTER_RAMPRIV(base))
9439 
9440 /*! @brief Set the RAMPRIV field to a new value. */
9441 #define MTB_WR_MASTER_RAMPRIV(base, value) (MTB_RMW_MASTER(base, MTB_MASTER_RAMPRIV_MASK, MTB_MASTER_RAMPRIV(value)))
9442 #define MTB_BWR_MASTER_RAMPRIV(base, value) (MTB_WR_MASTER_RAMPRIV(base, value))
9443 /*@}*/
9444 
9445 /*!
9446  * @name Register MTB_MASTER, field HALTREQ[9] (RW)
9447  *
9448  * This bit is connected to the halt request signal of the trace logic, EDBGRQ.
9449  * When HALTREQ is set to 1, the EDBFGRQ is asserted if DBGEN (invasive debug
9450  * enable, one of the debug authentication interface signals) is also HIGH. The
9451  * HALTREQ bit can be automatically set to 1 using the MTB_FLOW[WATERMARK] field.
9452  */
9453 /*@{*/
9454 /*! @brief Read current value of the MTB_MASTER_HALTREQ field. */
9455 #define MTB_RD_MASTER_HALTREQ(base) ((MTB_MASTER_REG(base) & MTB_MASTER_HALTREQ_MASK) >> MTB_MASTER_HALTREQ_SHIFT)
9456 #define MTB_BRD_MASTER_HALTREQ(base) (MTB_RD_MASTER_HALTREQ(base))
9457 
9458 /*! @brief Set the HALTREQ field to a new value. */
9459 #define MTB_WR_MASTER_HALTREQ(base, value) (MTB_RMW_MASTER(base, MTB_MASTER_HALTREQ_MASK, MTB_MASTER_HALTREQ(value)))
9460 #define MTB_BWR_MASTER_HALTREQ(base, value) (MTB_WR_MASTER_HALTREQ(base, value))
9461 /*@}*/
9462 
9463 /*!
9464  * @name Register MTB_MASTER, field EN[31] (RW)
9465  *
9466  * When this bit is 1, trace data is written into the RAM memory location
9467  * addressed by MTB_POSITION[POINTER]. The MTB_POSITION[POINTER] value auto increments
9468  * after the trace data packet is written. The EN bit can be automatically set to
9469  * 0 using the MTB_FLOW[WATERMARK] field and the MTB_FLOW[AUTOSTOP] bit. The EN
9470  * bit is automatically set to 1 if the TSTARTEN bit is 1 and the TSTART signal
9471  * is HIGH. The EN bit is automatically set to 0 if TSTOPEN bit is 1 and the TSTOP
9472  * signal is HIGH. If the EN bit is set to 0 because the MTB_FLOW[WATERMARK]
9473  * field is set, then it is not automatically set to 1 if the TSTARTEN bit is 1 and
9474  * the TSTART input is HIGH. In this case, tracing can only be restarted if the
9475  * MTB_FLOW[WATERMARK] or MTB_POSITION[POINTER] value is changed by software.
9476  */
9477 /*@{*/
9478 /*! @brief Read current value of the MTB_MASTER_EN field. */
9479 #define MTB_RD_MASTER_EN(base) ((MTB_MASTER_REG(base) & MTB_MASTER_EN_MASK) >> MTB_MASTER_EN_SHIFT)
9480 #define MTB_BRD_MASTER_EN(base) (MTB_RD_MASTER_EN(base))
9481 
9482 /*! @brief Set the EN field to a new value. */
9483 #define MTB_WR_MASTER_EN(base, value) (MTB_RMW_MASTER(base, MTB_MASTER_EN_MASK, MTB_MASTER_EN(value)))
9484 #define MTB_BWR_MASTER_EN(base, value) (MTB_WR_MASTER_EN(base, value))
9485 /*@}*/
9486 
9487 /*******************************************************************************
9488  * MTB_FLOW - MTB Flow Register
9489  ******************************************************************************/
9490 
9491 /*!
9492  * @brief MTB_FLOW - MTB Flow Register (RW)
9493  *
9494  * Reset value: 0x00000000U
9495  *
9496  * The MTB_FLOW register contains the watermark address and the
9497  * autostop/autohalt control bits.
9498  */
9499 /*!
9500  * @name Constants and macros for entire MTB_FLOW register
9501  */
9502 /*@{*/
9503 #define MTB_RD_FLOW(base) (MTB_FLOW_REG(base))
9504 #define MTB_WR_FLOW(base, value) (MTB_FLOW_REG(base) = (value))
9505 #define MTB_RMW_FLOW(base, mask, value) (MTB_WR_FLOW(base, (MTB_RD_FLOW(base) & ~(mask)) | (value)))
9506 #define MTB_SET_FLOW(base, value) (MTB_WR_FLOW(base, MTB_RD_FLOW(base) | (value)))
9507 #define MTB_CLR_FLOW(base, value) (MTB_WR_FLOW(base, MTB_RD_FLOW(base) & ~(value)))
9508 #define MTB_TOG_FLOW(base, value) (MTB_WR_FLOW(base, MTB_RD_FLOW(base) ^ (value)))
9509 /*@}*/
9510 
9511 /*
9512  * Constants & macros for individual MTB_FLOW bitfields
9513  */
9514 
9515 /*!
9516  * @name Register MTB_FLOW, field AUTOSTOP[0] (RW)
9517  *
9518  * If this bit is 1 and WATERMARK is equal to MTB_POSITION[POINTER], then the
9519  * MTB_MASTER[EN] bit is automatically set to 0. This stops tracing.
9520  */
9521 /*@{*/
9522 /*! @brief Read current value of the MTB_FLOW_AUTOSTOP field. */
9523 #define MTB_RD_FLOW_AUTOSTOP(base) ((MTB_FLOW_REG(base) & MTB_FLOW_AUTOSTOP_MASK) >> MTB_FLOW_AUTOSTOP_SHIFT)
9524 #define MTB_BRD_FLOW_AUTOSTOP(base) (MTB_RD_FLOW_AUTOSTOP(base))
9525 
9526 /*! @brief Set the AUTOSTOP field to a new value. */
9527 #define MTB_WR_FLOW_AUTOSTOP(base, value) (MTB_RMW_FLOW(base, MTB_FLOW_AUTOSTOP_MASK, MTB_FLOW_AUTOSTOP(value)))
9528 #define MTB_BWR_FLOW_AUTOSTOP(base, value) (MTB_WR_FLOW_AUTOSTOP(base, value))
9529 /*@}*/
9530 
9531 /*!
9532  * @name Register MTB_FLOW, field AUTOHALT[1] (RW)
9533  *
9534  * If this bit is 1 and WATERMARK is equal to MTB_POSITION[POINTER], then the
9535  * MTB_MASTER[HALTREQ] bit is automatically set to 1. If the DBGEN signal is HIGH,
9536  * the MTB asserts this halt request to the Cortex-M0+ processor by asserting the
9537  * EDBGRQ signal.
9538  */
9539 /*@{*/
9540 /*! @brief Read current value of the MTB_FLOW_AUTOHALT field. */
9541 #define MTB_RD_FLOW_AUTOHALT(base) ((MTB_FLOW_REG(base) & MTB_FLOW_AUTOHALT_MASK) >> MTB_FLOW_AUTOHALT_SHIFT)
9542 #define MTB_BRD_FLOW_AUTOHALT(base) (MTB_RD_FLOW_AUTOHALT(base))
9543 
9544 /*! @brief Set the AUTOHALT field to a new value. */
9545 #define MTB_WR_FLOW_AUTOHALT(base, value) (MTB_RMW_FLOW(base, MTB_FLOW_AUTOHALT_MASK, MTB_FLOW_AUTOHALT(value)))
9546 #define MTB_BWR_FLOW_AUTOHALT(base, value) (MTB_WR_FLOW_AUTOHALT(base, value))
9547 /*@}*/
9548 
9549 /*!
9550  * @name Register MTB_FLOW, field WATERMARK[31:3] (RW)
9551  *
9552  * This field contains an address in the same format as the
9553  * MTB_POSITION[POINTER] field. When the MTB_POSITION[POINTER] matches the WATERMARK field value,
9554  * actions defined by the AUTOHALT and AUTOSTOP bits are performed.
9555  */
9556 /*@{*/
9557 /*! @brief Read current value of the MTB_FLOW_WATERMARK field. */
9558 #define MTB_RD_FLOW_WATERMARK(base) ((MTB_FLOW_REG(base) & MTB_FLOW_WATERMARK_MASK) >> MTB_FLOW_WATERMARK_SHIFT)
9559 #define MTB_BRD_FLOW_WATERMARK(base) (MTB_RD_FLOW_WATERMARK(base))
9560 
9561 /*! @brief Set the WATERMARK field to a new value. */
9562 #define MTB_WR_FLOW_WATERMARK(base, value) (MTB_RMW_FLOW(base, MTB_FLOW_WATERMARK_MASK, MTB_FLOW_WATERMARK(value)))
9563 #define MTB_BWR_FLOW_WATERMARK(base, value) (MTB_WR_FLOW_WATERMARK(base, value))
9564 /*@}*/
9565 
9566 /*******************************************************************************
9567  * MTB_BASE - MTB Base Register
9568  ******************************************************************************/
9569 
9570 /*!
9571  * @brief MTB_BASE - MTB Base Register (RO)
9572  *
9573  * Reset value: 0x00000000U
9574  *
9575  * The read-only MTB_BASE Register indicates where the RAM is located in the
9576  * processor memory map. This register is provided to enable auto discovery of the
9577  * MTB RAM location, by a debug agent and is defined by a hardware design
9578  * parameter. For these devices, the base address is defined by the expression:
9579  * MTB_BASE[BASEADDR] = 0x2000_0000 - (RAM_Size/4)
9580  */
9581 /*!
9582  * @name Constants and macros for entire MTB_BASE register
9583  */
9584 /*@{*/
9585 #define MTB_RD_BASE(base) (MTB_BASE_REG(base))
9586 /*@}*/
9587 
9588 /*******************************************************************************
9589  * MTB_MODECTRL - Integration Mode Control Register
9590  ******************************************************************************/
9591 
9592 /*!
9593  * @brief MTB_MODECTRL - Integration Mode Control Register (RO)
9594  *
9595  * Reset value: 0x00000000U
9596  *
9597  * This register enables the device to switch from a functional mode, or default
9598  * behavior, into integration mode. It is hardwired to specific values used
9599  * during the auto-discovery process by an external debug agent.
9600  */
9601 /*!
9602  * @name Constants and macros for entire MTB_MODECTRL register
9603  */
9604 /*@{*/
9605 #define MTB_RD_MODECTRL(base) (MTB_MODECTRL_REG(base))
9606 /*@}*/
9607 
9608 /*******************************************************************************
9609  * MTB_TAGSET - Claim TAG Set Register
9610  ******************************************************************************/
9611 
9612 /*!
9613  * @brief MTB_TAGSET - Claim TAG Set Register (RO)
9614  *
9615  * Reset value: 0x00000000U
9616  *
9617  * The Claim Tag Set Register returns the number of bits that can be set on a
9618  * read, and enables individual bits to be set on a write. It is hardwired to
9619  * specific values used during the auto-discovery process by an external debug agent.
9620  */
9621 /*!
9622  * @name Constants and macros for entire MTB_TAGSET register
9623  */
9624 /*@{*/
9625 #define MTB_RD_TAGSET(base) (MTB_TAGSET_REG(base))
9626 /*@}*/
9627 
9628 /*******************************************************************************
9629  * MTB_TAGCLEAR - Claim TAG Clear Register
9630  ******************************************************************************/
9631 
9632 /*!
9633  * @brief MTB_TAGCLEAR - Claim TAG Clear Register (RO)
9634  *
9635  * Reset value: 0x00000000U
9636  *
9637  * The read/write Claim Tag Clear Register is used to read the claim status on
9638  * debug resources. A read indicates the claim tag status. Writing 1 to a specific
9639  * bit clears the corresponding claim tag to 0. It is hardwired to specific
9640  * values used during the auto-discovery process by an external debug agent.
9641  */
9642 /*!
9643  * @name Constants and macros for entire MTB_TAGCLEAR register
9644  */
9645 /*@{*/
9646 #define MTB_RD_TAGCLEAR(base) (MTB_TAGCLEAR_REG(base))
9647 /*@}*/
9648 
9649 /*******************************************************************************
9650  * MTB_LOCKACCESS - Lock Access Register
9651  ******************************************************************************/
9652 
9653 /*!
9654  * @brief MTB_LOCKACCESS - Lock Access Register (RO)
9655  *
9656  * Reset value: 0x00000000U
9657  *
9658  * The Lock Access Register enables a write access to component registers. It is
9659  * hardwired to specific values used during the auto-discovery process by an
9660  * external debug agent.
9661  */
9662 /*!
9663  * @name Constants and macros for entire MTB_LOCKACCESS register
9664  */
9665 /*@{*/
9666 #define MTB_RD_LOCKACCESS(base) (MTB_LOCKACCESS_REG(base))
9667 /*@}*/
9668 
9669 /*******************************************************************************
9670  * MTB_LOCKSTAT - Lock Status Register
9671  ******************************************************************************/
9672 
9673 /*!
9674  * @brief MTB_LOCKSTAT - Lock Status Register (RO)
9675  *
9676  * Reset value: 0x00000000U
9677  *
9678  * The Lock Status Register indicates the status of the lock control mechanism.
9679  * This register is used in conjunction with the Lock Access Register. It is
9680  * hardwired to specific values used during the auto-discovery process by an external
9681  * debug agent.
9682  */
9683 /*!
9684  * @name Constants and macros for entire MTB_LOCKSTAT register
9685  */
9686 /*@{*/
9687 #define MTB_RD_LOCKSTAT(base) (MTB_LOCKSTAT_REG(base))
9688 /*@}*/
9689 
9690 /*******************************************************************************
9691  * MTB_AUTHSTAT - Authentication Status Register
9692  ******************************************************************************/
9693 
9694 /*!
9695  * @brief MTB_AUTHSTAT - Authentication Status Register (RO)
9696  *
9697  * Reset value: 0x00000000U
9698  *
9699  * The Authentication Status Register reports the required security level and
9700  * current status of the security enable bit pairs. Where functionality changes on
9701  * a given security level, this change must be reported in this register. It is
9702  * connected to specific signals used during the auto-discovery process by an
9703  * external debug agent. MTB_AUTHSTAT[3:2] indicates if nonsecure, noninvasive debug
9704  * is enabled or disabled, while MTB_AUTHSTAT[1:0] indicates the enabled/disabled
9705  * state of nonsecure, invasive debug. For both 2-bit fields, 0b10 indicates the
9706  * functionality is disabled and 0b11 indicates it is enabled.
9707  */
9708 /*!
9709  * @name Constants and macros for entire MTB_AUTHSTAT register
9710  */
9711 /*@{*/
9712 #define MTB_RD_AUTHSTAT(base) (MTB_AUTHSTAT_REG(base))
9713 /*@}*/
9714 
9715 /*
9716  * Constants & macros for individual MTB_AUTHSTAT bitfields
9717  */
9718 
9719 /*!
9720  * @name Register MTB_AUTHSTAT, field BIT0[0] (RO)
9721  *
9722  * Connected to DBGEN.
9723  */
9724 /*@{*/
9725 /*! @brief Read current value of the MTB_AUTHSTAT_BIT0 field. */
9726 #define MTB_RD_AUTHSTAT_BIT0(base) ((MTB_AUTHSTAT_REG(base) & MTB_AUTHSTAT_BIT0_MASK) >> MTB_AUTHSTAT_BIT0_SHIFT)
9727 #define MTB_BRD_AUTHSTAT_BIT0(base) (MTB_RD_AUTHSTAT_BIT0(base))
9728 /*@}*/
9729 
9730 /*!
9731  * @name Register MTB_AUTHSTAT, field BIT1[1] (ROO)
9732  *
9733  * Hardwired to 1.
9734  */
9735 /*@{*/
9736 /*! @brief Read current value of the MTB_AUTHSTAT_BIT1 field. */
9737 #define MTB_RD_AUTHSTAT_BIT1(base) ((MTB_AUTHSTAT_REG(base) & MTB_AUTHSTAT_BIT1_MASK) >> MTB_AUTHSTAT_BIT1_SHIFT)
9738 #define MTB_BRD_AUTHSTAT_BIT1(base) (MTB_RD_AUTHSTAT_BIT1(base))
9739 /*@}*/
9740 
9741 /*!
9742  * @name Register MTB_AUTHSTAT, field BIT2[2] (RO)
9743  *
9744  * Connected to NIDEN or DBGEN signal.
9745  */
9746 /*@{*/
9747 /*! @brief Read current value of the MTB_AUTHSTAT_BIT2 field. */
9748 #define MTB_RD_AUTHSTAT_BIT2(base) ((MTB_AUTHSTAT_REG(base) & MTB_AUTHSTAT_BIT2_MASK) >> MTB_AUTHSTAT_BIT2_SHIFT)
9749 #define MTB_BRD_AUTHSTAT_BIT2(base) (MTB_RD_AUTHSTAT_BIT2(base))
9750 /*@}*/
9751 
9752 /*!
9753  * @name Register MTB_AUTHSTAT, field BIT3[3] (ROO)
9754  *
9755  * Hardwired to 1.
9756  */
9757 /*@{*/
9758 /*! @brief Read current value of the MTB_AUTHSTAT_BIT3 field. */
9759 #define MTB_RD_AUTHSTAT_BIT3(base) ((MTB_AUTHSTAT_REG(base) & MTB_AUTHSTAT_BIT3_MASK) >> MTB_AUTHSTAT_BIT3_SHIFT)
9760 #define MTB_BRD_AUTHSTAT_BIT3(base) (MTB_RD_AUTHSTAT_BIT3(base))
9761 /*@}*/
9762 
9763 /*******************************************************************************
9764  * MTB_DEVICEARCH - Device Architecture Register
9765  ******************************************************************************/
9766 
9767 /*!
9768  * @brief MTB_DEVICEARCH - Device Architecture Register (RO)
9769  *
9770  * Reset value: 0x47700A31U
9771  *
9772  * This register indicates the device architecture. It is hardwired to specific
9773  * values used during the auto-discovery process by an external debug agent.
9774  */
9775 /*!
9776  * @name Constants and macros for entire MTB_DEVICEARCH register
9777  */
9778 /*@{*/
9779 #define MTB_RD_DEVICEARCH(base) (MTB_DEVICEARCH_REG(base))
9780 /*@}*/
9781 
9782 /*******************************************************************************
9783  * MTB_DEVICECFG - Device Configuration Register
9784  ******************************************************************************/
9785 
9786 /*!
9787  * @brief MTB_DEVICECFG - Device Configuration Register (RO)
9788  *
9789  * Reset value: 0x00000000U
9790  *
9791  * This register indicates the device configuration. It is hardwired to specific
9792  * values used during the auto-discovery process by an external debug agent.
9793  */
9794 /*!
9795  * @name Constants and macros for entire MTB_DEVICECFG register
9796  */
9797 /*@{*/
9798 #define MTB_RD_DEVICECFG(base) (MTB_DEVICECFG_REG(base))
9799 /*@}*/
9800 
9801 /*******************************************************************************
9802  * MTB_DEVICETYPID - Device Type Identifier Register
9803  ******************************************************************************/
9804 
9805 /*!
9806  * @brief MTB_DEVICETYPID - Device Type Identifier Register (RO)
9807  *
9808  * Reset value: 0x00000031U
9809  *
9810  * This register indicates the device type ID. It is hardwired to specific
9811  * values used during the auto-discovery process by an external debug agent.
9812  */
9813 /*!
9814  * @name Constants and macros for entire MTB_DEVICETYPID register
9815  */
9816 /*@{*/
9817 #define MTB_RD_DEVICETYPID(base) (MTB_DEVICETYPID_REG(base))
9818 /*@}*/
9819 
9820 /*******************************************************************************
9821  * MTB_PERIPHID - Peripheral ID Register
9822  ******************************************************************************/
9823 
9824 /*!
9825  * @brief MTB_PERIPHID - Peripheral ID Register (RO)
9826  *
9827  * Reset value: 0x00000000U
9828  *
9829  * These registers indicate the peripheral IDs. They are hardwired to specific
9830  * values used during the auto-discovery process by an external debug agent.
9831  */
9832 /*!
9833  * @name Constants and macros for entire MTB_PERIPHID register
9834  */
9835 /*@{*/
9836 #define MTB_RD_PERIPHID(base, index) (MTB_PERIPHID_REG(base, index))
9837 /*@}*/
9838 
9839 /*******************************************************************************
9840  * MTB_COMPID - Component ID Register
9841  ******************************************************************************/
9842 
9843 /*!
9844  * @brief MTB_COMPID - Component ID Register (RO)
9845  *
9846  * Reset value: 0x00000000U
9847  *
9848  * These registers indicate the component IDs. They are hardwired to specific
9849  * values used during the auto-discovery process by an external debug agent.
9850  */
9851 /*!
9852  * @name Constants and macros for entire MTB_COMPID register
9853  */
9854 /*@{*/
9855 #define MTB_RD_COMPID(base, index) (MTB_COMPID_REG(base, index))
9856 /*@}*/
9857 
9858 /*
9859  * MKL25Z4 MTBDWT
9860  *
9861  * MTB data watchpoint and trace
9862  *
9863  * Registers defined in this header file:
9864  * - MTBDWT_CTRL - MTB DWT Control Register
9865  * - MTBDWT_COMP - MTB_DWT Comparator Register
9866  * - MTBDWT_MASK - MTB_DWT Comparator Mask Register
9867  * - MTBDWT_FCT - MTB_DWT Comparator Function Register 0
9868  * - MTBDWT_TBCTRL - MTB_DWT Trace Buffer Control Register
9869  * - MTBDWT_DEVICECFG - Device Configuration Register
9870  * - MTBDWT_DEVICETYPID - Device Type Identifier Register
9871  * - MTBDWT_PERIPHID - Peripheral ID Register
9872  * - MTBDWT_COMPID - Component ID Register
9873  */
9874 
9875 #define MTBDWT_INSTANCE_COUNT (1U) /*!< Number of instances of the MTBDWT module. */
9876 #define MTBDWT_IDX (0U) /*!< Instance number for MTBDWT. */
9877 
9878 /*******************************************************************************
9879  * MTBDWT_CTRL - MTB DWT Control Register
9880  ******************************************************************************/
9881 
9882 /*!
9883  * @brief MTBDWT_CTRL - MTB DWT Control Register (RO)
9884  *
9885  * Reset value: 0x2F000000U
9886  *
9887  * The MTBDWT_CTRL register provides read-only information on the watchpoint
9888  * configuration for the MTB_DWT.
9889  */
9890 /*!
9891  * @name Constants and macros for entire MTBDWT_CTRL register
9892  */
9893 /*@{*/
9894 #define MTBDWT_RD_CTRL(base) (MTBDWT_CTRL_REG(base))
9895 /*@}*/
9896 
9897 /*
9898  * Constants & macros for individual MTBDWT_CTRL bitfields
9899  */
9900 
9901 /*!
9902  * @name Register MTBDWT_CTRL, field DWTCFGCTRL[27:0] (RO)
9903  *
9904  * This field is hardwired to 0xF00_0000, disabling all the remaining DWT
9905  * functionality. The specific fields and their state are: MTBDWT_CTRL[27] = NOTRCPKT =
9906  * 1, trace sample and exception trace is not supported MTBDWT_CTRL[26] =
9907  * NOEXTTRIG = 1, external match signals are not supported MTBDWT_CTRL[25] = NOCYCCNT =
9908  * 1, cycle counter is not supported MTBDWT_CTRL[24] = NOPRFCNT = 1, profiling
9909  * counters are not supported MTBDWT_CTRL[22] = CYCEBTENA = 0, no POSTCNT
9910  * underflow packets generated MTBDWT_CTRL[21] = FOLDEVTENA = 0, no folded instruction
9911  * counter overflow events MTBDWT_CTRL[20] = LSUEVTENA = 0, no LSU counter overflow
9912  * events MTBDWT_CTRL[19] = SLEEPEVTENA = 0, no sleep counter overflow events
9913  * MTBDWT_CTRL[18] = EXCEVTENA = 0, no exception overhead counter events
9914  * MTBDWT_CTRL[17] = CPIEVTENA = 0, no CPI counter overflow events MTBDWT_CTRL[16] =
9915  * EXCTRCENA = 0, generation of exception trace disabled MTBDWT_CTRL[12] = PCSAMPLENA =
9916  * 0, no periodic PC sample packets generated MTBDWT_CTRL[11:10] = SYNCTAP = 0,
9917  * no synchronization packets MTBDWT_CTRL[9] = CYCTAP = 0, cycle counter is not
9918  * supported MTBDWT_CTRL[8:5] = POSTINIT = 0, cycle counter is not supported
9919  * MTBDWT_CTRL[4:1] = POSTPRESET = 0, cycle counter is not supported MTBDWT_CTRL[0] =
9920  * CYCCNTENA = 0, cycle counter is not supported
9921  */
9922 /*@{*/
9923 /*! @brief Read current value of the MTBDWT_CTRL_DWTCFGCTRL field. */
9924 #define MTBDWT_RD_CTRL_DWTCFGCTRL(base) ((MTBDWT_CTRL_REG(base) & MTBDWT_CTRL_DWTCFGCTRL_MASK) >> MTBDWT_CTRL_DWTCFGCTRL_SHIFT)
9925 #define MTBDWT_BRD_CTRL_DWTCFGCTRL(base) (MTBDWT_RD_CTRL_DWTCFGCTRL(base))
9926 /*@}*/
9927 
9928 /*!
9929  * @name Register MTBDWT_CTRL, field NUMCMP[31:28] (RO)
9930  *
9931  * The MTB_DWT implements two comparators.
9932  */
9933 /*@{*/
9934 /*! @brief Read current value of the MTBDWT_CTRL_NUMCMP field. */
9935 #define MTBDWT_RD_CTRL_NUMCMP(base) ((MTBDWT_CTRL_REG(base) & MTBDWT_CTRL_NUMCMP_MASK) >> MTBDWT_CTRL_NUMCMP_SHIFT)
9936 #define MTBDWT_BRD_CTRL_NUMCMP(base) (MTBDWT_RD_CTRL_NUMCMP(base))
9937 /*@}*/
9938 
9939 /*******************************************************************************
9940  * MTBDWT_COMP - MTB_DWT Comparator Register
9941  ******************************************************************************/
9942 
9943 /*!
9944  * @brief MTBDWT_COMP - MTB_DWT Comparator Register (RW)
9945  *
9946  * Reset value: 0x00000000U
9947  *
9948  * The MTBDWT_COMPn registers provide the reference value for comparator n.
9949  */
9950 /*!
9951  * @name Constants and macros for entire MTBDWT_COMP register
9952  */
9953 /*@{*/
9954 #define MTBDWT_RD_COMP(base, index) (MTBDWT_COMP_REG(base, index))
9955 #define MTBDWT_WR_COMP(base, index, value) (MTBDWT_COMP_REG(base, index) = (value))
9956 #define MTBDWT_RMW_COMP(base, index, mask, value) (MTBDWT_WR_COMP(base, index, (MTBDWT_RD_COMP(base, index) & ~(mask)) | (value)))
9957 #define MTBDWT_SET_COMP(base, index, value) (MTBDWT_WR_COMP(base, index, MTBDWT_RD_COMP(base, index) | (value)))
9958 #define MTBDWT_CLR_COMP(base, index, value) (MTBDWT_WR_COMP(base, index, MTBDWT_RD_COMP(base, index) & ~(value)))
9959 #define MTBDWT_TOG_COMP(base, index, value) (MTBDWT_WR_COMP(base, index, MTBDWT_RD_COMP(base, index) ^ (value)))
9960 /*@}*/
9961 
9962 /*******************************************************************************
9963  * MTBDWT_MASK - MTB_DWT Comparator Mask Register
9964  ******************************************************************************/
9965 
9966 /*!
9967  * @brief MTBDWT_MASK - MTB_DWT Comparator Mask Register (RW)
9968  *
9969  * Reset value: 0x00000000U
9970  *
9971  * The MTBDWT_MASKn registers define the size of the ignore mask applied to the
9972  * reference address for address range matching by comparator n. Note the format
9973  * of this mask field is different than the MTB_MASTER[MASK].
9974  */
9975 /*!
9976  * @name Constants and macros for entire MTBDWT_MASK register
9977  */
9978 /*@{*/
9979 #define MTBDWT_RD_MASK(base, index) (MTBDWT_MASK_REG(base, index))
9980 #define MTBDWT_WR_MASK(base, index, value) (MTBDWT_MASK_REG(base, index) = (value))
9981 #define MTBDWT_RMW_MASK(base, index, mask, value) (MTBDWT_WR_MASK(base, index, (MTBDWT_RD_MASK(base, index) & ~(mask)) | (value)))
9982 #define MTBDWT_SET_MASK(base, index, value) (MTBDWT_WR_MASK(base, index, MTBDWT_RD_MASK(base, index) | (value)))
9983 #define MTBDWT_CLR_MASK(base, index, value) (MTBDWT_WR_MASK(base, index, MTBDWT_RD_MASK(base, index) & ~(value)))
9984 #define MTBDWT_TOG_MASK(base, index, value) (MTBDWT_WR_MASK(base, index, MTBDWT_RD_MASK(base, index) ^ (value)))
9985 /*@}*/
9986 
9987 /*
9988  * Constants & macros for individual MTBDWT_MASK bitfields
9989  */
9990 
9991 /*!
9992  * @name Register MTBDWT_MASK, field MASK[4:0] (RW)
9993  *
9994  * The value of the ignore mask, 0-31 bits, is applied to address range
9995  * matching. MASK = 0 is used to include all bits of the address in the comparison,
9996  * except if MASK = 0 and the comparator is configured to watch instruction fetch
9997  * addresses, address bit [0] is ignored by the hardware since all fetches must be at
9998  * least halfword aligned. For MASK != 0 and regardless of watch type, address
9999  * bits [x-1:0] are ignored in the address comparison. Using a mask means the
10000  * comparator matches on a range of addresses, defined by the unmasked most
10001  * significant bits of the address, bits [31:x]. The maximum MASK value is 24, producing a
10002  * 16 Mbyte mask. An attempted write of a MASK value > 24 is limited by the
10003  * MTBDWT hardware to 24. If MTBDWT_COMP0 is used as a data value comparator, then
10004  * MTBDWT_MASK0 should be programmed to zero.
10005  */
10006 /*@{*/
10007 /*! @brief Read current value of the MTBDWT_MASK_MASK field. */
10008 #define MTBDWT_RD_MASK_MASK(base, index) ((MTBDWT_MASK_REG(base, index) & MTBDWT_MASK_MASK_MASK) >> MTBDWT_MASK_MASK_SHIFT)
10009 #define MTBDWT_BRD_MASK_MASK(base, index) (MTBDWT_RD_MASK_MASK(base, index))
10010 
10011 /*! @brief Set the MASK field to a new value. */
10012 #define MTBDWT_WR_MASK_MASK(base, index, value) (MTBDWT_RMW_MASK(base, index, MTBDWT_MASK_MASK_MASK, MTBDWT_MASK_MASK(value)))
10013 #define MTBDWT_BWR_MASK_MASK(base, index, value) (MTBDWT_WR_MASK_MASK(base, index, value))
10014 /*@}*/
10015 
10016 /*******************************************************************************
10017  * MTBDWT_FCT - MTB_DWT Comparator Function Register 0
10018  ******************************************************************************/
10019 
10020 /*!
10021  * @brief MTBDWT_FCT - MTB_DWT Comparator Function Register 0 (RW)
10022  *
10023  * Reset value: 0x00000000U
10024  *
10025  * The MTBDWT_FCTn registers control the operation of comparator n.
10026  */
10027 /*!
10028  * @name Constants and macros for entire MTBDWT_FCT register
10029  */
10030 /*@{*/
10031 #define MTBDWT_RD_FCT(base, index) (MTBDWT_FCT_REG(base, index))
10032 #define MTBDWT_WR_FCT(base, index, value) (MTBDWT_FCT_REG(base, index) = (value))
10033 #define MTBDWT_RMW_FCT(base, index, mask, value) (MTBDWT_WR_FCT(base, index, (MTBDWT_RD_FCT(base, index) & ~(mask)) | (value)))
10034 #define MTBDWT_SET_FCT(base, index, value) (MTBDWT_WR_FCT(base, index, MTBDWT_RD_FCT(base, index) | (value)))
10035 #define MTBDWT_CLR_FCT(base, index, value) (MTBDWT_WR_FCT(base, index, MTBDWT_RD_FCT(base, index) & ~(value)))
10036 #define MTBDWT_TOG_FCT(base, index, value) (MTBDWT_WR_FCT(base, index, MTBDWT_RD_FCT(base, index) ^ (value)))
10037 /*@}*/
10038 
10039 /*
10040  * Constants & macros for individual MTBDWT_FCT bitfields
10041  */
10042 
10043 /*!
10044  * @name Register MTBDWT_FCT, field FUNCTION[3:0] (RW)
10045  *
10046  * Selects the action taken on a comparator match. If MTBDWT_COMP0 is used for a
10047  * data value and MTBDWT_COMP1 for an address value, then MTBDWT_FCT1[FUNCTION]
10048  * must be set to zero. For this configuration, MTBDWT_MASK1 can be set to a
10049  * non-zero value, so the combined comparators match on a range of addresses.
10050  *
10051  * Values:
10052  * - 0b0000 - Disabled.
10053  * - 0b0100 - Instruction fetch.
10054  * - 0b0101 - Data operand read.
10055  * - 0b0110 - Data operand write.
10056  * - 0b0111 - Data operand (read + write).
10057  */
10058 /*@{*/
10059 /*! @brief Read current value of the MTBDWT_FCT_FUNCTION field. */
10060 #define MTBDWT_RD_FCT_FUNCTION(base, index) ((MTBDWT_FCT_REG(base, index) & MTBDWT_FCT_FUNCTION_MASK) >> MTBDWT_FCT_FUNCTION_SHIFT)
10061 #define MTBDWT_BRD_FCT_FUNCTION(base, index) (MTBDWT_RD_FCT_FUNCTION(base, index))
10062 
10063 /*! @brief Set the FUNCTION field to a new value. */
10064 #define MTBDWT_WR_FCT_FUNCTION(base, index, value) (MTBDWT_RMW_FCT(base, index, MTBDWT_FCT_FUNCTION_MASK, MTBDWT_FCT_FUNCTION(value)))
10065 #define MTBDWT_BWR_FCT_FUNCTION(base, index, value) (MTBDWT_WR_FCT_FUNCTION(base, index, value))
10066 /*@}*/
10067 
10068 /*!
10069  * @name Register MTBDWT_FCT, field DATAVMATCH[8] (RW)
10070  *
10071  * The assertion of this bit enables data value comparison. For this
10072  * implementation, MTBDWT_COMP0 supports address or data value comparisons; MTBDWT_COMP1
10073  * only supports address comparisons.
10074  *
10075  * Values:
10076  * - 0b0 - Perform address comparison.
10077  * - 0b1 - Perform data value comparison.
10078  */
10079 /*@{*/
10080 /*! @brief Read current value of the MTBDWT_FCT_DATAVMATCH field. */
10081 #define MTBDWT_RD_FCT_DATAVMATCH(base, index) ((MTBDWT_FCT_REG(base, index) & MTBDWT_FCT_DATAVMATCH_MASK) >> MTBDWT_FCT_DATAVMATCH_SHIFT)
10082 #define MTBDWT_BRD_FCT_DATAVMATCH(base, index) (MTBDWT_RD_FCT_DATAVMATCH(base, index))
10083 
10084 /*! @brief Set the DATAVMATCH field to a new value. */
10085 #define MTBDWT_WR_FCT_DATAVMATCH(base, index, value) (MTBDWT_RMW_FCT(base, index, MTBDWT_FCT_DATAVMATCH_MASK, MTBDWT_FCT_DATAVMATCH(value)))
10086 #define MTBDWT_BWR_FCT_DATAVMATCH(base, index, value) (MTBDWT_WR_FCT_DATAVMATCH(base, index, value))
10087 /*@}*/
10088 
10089 /*!
10090  * @name Register MTBDWT_FCT, field DATAVSIZE[11:10] (RW)
10091  *
10092  * For data value matching, this field defines the size of the required data
10093  * comparison.
10094  *
10095  * Values:
10096  * - 0b00 - Byte.
10097  * - 0b01 - Halfword.
10098  * - 0b10 - Word.
10099  * - 0b11 - Reserved. Any attempts to use this value results in UNPREDICTABLE
10100  * behavior.
10101  */
10102 /*@{*/
10103 /*! @brief Read current value of the MTBDWT_FCT_DATAVSIZE field. */
10104 #define MTBDWT_RD_FCT_DATAVSIZE(base, index) ((MTBDWT_FCT_REG(base, index) & MTBDWT_FCT_DATAVSIZE_MASK) >> MTBDWT_FCT_DATAVSIZE_SHIFT)
10105 #define MTBDWT_BRD_FCT_DATAVSIZE(base, index) (MTBDWT_RD_FCT_DATAVSIZE(base, index))
10106 
10107 /*! @brief Set the DATAVSIZE field to a new value. */
10108 #define MTBDWT_WR_FCT_DATAVSIZE(base, index, value) (MTBDWT_RMW_FCT(base, index, MTBDWT_FCT_DATAVSIZE_MASK, MTBDWT_FCT_DATAVSIZE(value)))
10109 #define MTBDWT_BWR_FCT_DATAVSIZE(base, index, value) (MTBDWT_WR_FCT_DATAVSIZE(base, index, value))
10110 /*@}*/
10111 
10112 /*!
10113  * @name Register MTBDWT_FCT, field DATAVADDR0[15:12] (RW)
10114  *
10115  * Since the MTB_DWT implements two comparators, the DATAVADDR0 field is
10116  * restricted to values {0,1}. When the DATAVMATCH bit is asserted, this field defines
10117  * the comparator number to use for linked address comparison. If MTBDWT_COMP0 is
10118  * used as a data watchpoint and MTBDWT_COMP1 as an address watchpoint,
10119  * DATAVADDR0 must be set.
10120  */
10121 /*@{*/
10122 /*! @brief Read current value of the MTBDWT_FCT_DATAVADDR0 field. */
10123 #define MTBDWT_RD_FCT_DATAVADDR0(base, index) ((MTBDWT_FCT_REG(base, index) & MTBDWT_FCT_DATAVADDR0_MASK) >> MTBDWT_FCT_DATAVADDR0_SHIFT)
10124 #define MTBDWT_BRD_FCT_DATAVADDR0(base, index) (MTBDWT_RD_FCT_DATAVADDR0(base, index))
10125 
10126 /*! @brief Set the DATAVADDR0 field to a new value. */
10127 #define MTBDWT_WR_FCT_DATAVADDR0(base, index, value) (MTBDWT_RMW_FCT(base, index, MTBDWT_FCT_DATAVADDR0_MASK, MTBDWT_FCT_DATAVADDR0(value)))
10128 #define MTBDWT_BWR_FCT_DATAVADDR0(base, index, value) (MTBDWT_WR_FCT_DATAVADDR0(base, index, value))
10129 /*@}*/
10130 
10131 /*!
10132  * @name Register MTBDWT_FCT, field MATCHED[24] (RO)
10133  *
10134  * If this read-only flag is asserted, it indicates the operation defined by the
10135  * FUNCTION field occurred since the last read of the register. Reading the
10136  * register clears this bit.
10137  *
10138  * Values:
10139  * - 0b0 - No match.
10140  * - 0b1 - Match occurred.
10141  */
10142 /*@{*/
10143 /*! @brief Read current value of the MTBDWT_FCT_MATCHED field. */
10144 #define MTBDWT_RD_FCT_MATCHED(base, index) ((MTBDWT_FCT_REG(base, index) & MTBDWT_FCT_MATCHED_MASK) >> MTBDWT_FCT_MATCHED_SHIFT)
10145 #define MTBDWT_BRD_FCT_MATCHED(base, index) (MTBDWT_RD_FCT_MATCHED(base, index))
10146 /*@}*/
10147 
10148 /*******************************************************************************
10149  * MTBDWT_TBCTRL - MTB_DWT Trace Buffer Control Register
10150  ******************************************************************************/
10151 
10152 /*!
10153  * @brief MTBDWT_TBCTRL - MTB_DWT Trace Buffer Control Register (RW)
10154  *
10155  * Reset value: 0x20000000U
10156  *
10157  * The MTBDWT_TBCTRL register defines how the watchpoint comparisons control the
10158  * actual trace buffer operation. Recall the MTB supports starting and stopping
10159  * the program trace based on the watchpoint comparisons signaled via TSTART and
10160  * TSTOP. The watchpoint comparison signals are enabled in the MTB's control
10161  * logic by setting the appropriate enable bits, MTB_MASTER[TSTARTEN, TSTOPEN]. In
10162  * the event of simultaneous assertion of both TSTART and TSTOP, TSTART takes
10163  * priority.
10164  */
10165 /*!
10166  * @name Constants and macros for entire MTBDWT_TBCTRL register
10167  */
10168 /*@{*/
10169 #define MTBDWT_RD_TBCTRL(base) (MTBDWT_TBCTRL_REG(base))
10170 #define MTBDWT_WR_TBCTRL(base, value) (MTBDWT_TBCTRL_REG(base) = (value))
10171 #define MTBDWT_RMW_TBCTRL(base, mask, value) (MTBDWT_WR_TBCTRL(base, (MTBDWT_RD_TBCTRL(base) & ~(mask)) | (value)))
10172 #define MTBDWT_SET_TBCTRL(base, value) (MTBDWT_WR_TBCTRL(base, MTBDWT_RD_TBCTRL(base) | (value)))
10173 #define MTBDWT_CLR_TBCTRL(base, value) (MTBDWT_WR_TBCTRL(base, MTBDWT_RD_TBCTRL(base) & ~(value)))
10174 #define MTBDWT_TOG_TBCTRL(base, value) (MTBDWT_WR_TBCTRL(base, MTBDWT_RD_TBCTRL(base) ^ (value)))
10175 /*@}*/
10176 
10177 /*
10178  * Constants & macros for individual MTBDWT_TBCTRL bitfields
10179  */
10180 
10181 /*!
10182  * @name Register MTBDWT_TBCTRL, field ACOMP0[0] (RW)
10183  *
10184  * When the MTBDWT_FCT0[MATCHED] is set, it indicates MTBDWT_COMP0 address
10185  * compare has triggered and the trace buffer's recording state is changed. The
10186  * assertion of MTBDWT_FCT0[MATCHED] is caused by the following conditions: Address
10187  * match in MTBDWT_COMP0 when MTBDWT_FCT0[DATAVMATCH] = 0 Data match in MTBDWT_COMP0
10188  * when MTBDWT_FCT0[DATAVMATCH, DATAVADDR0] = {1,0} Data match in MTBDWT_COMP0
10189  * and address match in MTBDWT_COMP1 when MTBDWT_FCT0[DATAVMATCH, DATAVADDR0] =
10190  * {1,1}
10191  *
10192  * Values:
10193  * - 0b0 - Trigger TSTOP based on the assertion of MTBDWT_FCT0[MATCHED].
10194  * - 0b1 - Trigger TSTART based on the assertion of MTBDWT_FCT0[MATCHED].
10195  */
10196 /*@{*/
10197 /*! @brief Read current value of the MTBDWT_TBCTRL_ACOMP0 field. */
10198 #define MTBDWT_RD_TBCTRL_ACOMP0(base) ((MTBDWT_TBCTRL_REG(base) & MTBDWT_TBCTRL_ACOMP0_MASK) >> MTBDWT_TBCTRL_ACOMP0_SHIFT)
10199 #define MTBDWT_BRD_TBCTRL_ACOMP0(base) (MTBDWT_RD_TBCTRL_ACOMP0(base))
10200 
10201 /*! @brief Set the ACOMP0 field to a new value. */
10202 #define MTBDWT_WR_TBCTRL_ACOMP0(base, value) (MTBDWT_RMW_TBCTRL(base, MTBDWT_TBCTRL_ACOMP0_MASK, MTBDWT_TBCTRL_ACOMP0(value)))
10203 #define MTBDWT_BWR_TBCTRL_ACOMP0(base, value) (MTBDWT_WR_TBCTRL_ACOMP0(base, value))
10204 /*@}*/
10205 
10206 /*!
10207  * @name Register MTBDWT_TBCTRL, field ACOMP1[1] (RW)
10208  *
10209  * When the MTBDWT_FCT1[MATCHED] is set, it indicates MTBDWT_COMP1 address
10210  * compare has triggered and the trace buffer's recording state is changed.
10211  *
10212  * Values:
10213  * - 0b0 - Trigger TSTOP based on the assertion of MTBDWT_FCT1[MATCHED].
10214  * - 0b1 - Trigger TSTART based on the assertion of MTBDWT_FCT1[MATCHED].
10215  */
10216 /*@{*/
10217 /*! @brief Read current value of the MTBDWT_TBCTRL_ACOMP1 field. */
10218 #define MTBDWT_RD_TBCTRL_ACOMP1(base) ((MTBDWT_TBCTRL_REG(base) & MTBDWT_TBCTRL_ACOMP1_MASK) >> MTBDWT_TBCTRL_ACOMP1_SHIFT)
10219 #define MTBDWT_BRD_TBCTRL_ACOMP1(base) (MTBDWT_RD_TBCTRL_ACOMP1(base))
10220 
10221 /*! @brief Set the ACOMP1 field to a new value. */
10222 #define MTBDWT_WR_TBCTRL_ACOMP1(base, value) (MTBDWT_RMW_TBCTRL(base, MTBDWT_TBCTRL_ACOMP1_MASK, MTBDWT_TBCTRL_ACOMP1(value)))
10223 #define MTBDWT_BWR_TBCTRL_ACOMP1(base, value) (MTBDWT_WR_TBCTRL_ACOMP1(base, value))
10224 /*@}*/
10225 
10226 /*!
10227  * @name Register MTBDWT_TBCTRL, field NUMCOMP[31:28] (RO)
10228  *
10229  * This read-only field specifies the number of comparators in the MTB_DWT. This
10230  * implementation includes two registers.
10231  */
10232 /*@{*/
10233 /*! @brief Read current value of the MTBDWT_TBCTRL_NUMCOMP field. */
10234 #define MTBDWT_RD_TBCTRL_NUMCOMP(base) ((MTBDWT_TBCTRL_REG(base) & MTBDWT_TBCTRL_NUMCOMP_MASK) >> MTBDWT_TBCTRL_NUMCOMP_SHIFT)
10235 #define MTBDWT_BRD_TBCTRL_NUMCOMP(base) (MTBDWT_RD_TBCTRL_NUMCOMP(base))
10236 /*@}*/
10237 
10238 /*******************************************************************************
10239  * MTBDWT_DEVICECFG - Device Configuration Register
10240  ******************************************************************************/
10241 
10242 /*!
10243  * @brief MTBDWT_DEVICECFG - Device Configuration Register (RO)
10244  *
10245  * Reset value: 0x00000000U
10246  *
10247  * This register indicates the device configuration. It is hardwired to specific
10248  * values used during the auto-discovery process by an external debug agent.
10249  */
10250 /*!
10251  * @name Constants and macros for entire MTBDWT_DEVICECFG register
10252  */
10253 /*@{*/
10254 #define MTBDWT_RD_DEVICECFG(base) (MTBDWT_DEVICECFG_REG(base))
10255 /*@}*/
10256 
10257 /*******************************************************************************
10258  * MTBDWT_DEVICETYPID - Device Type Identifier Register
10259  ******************************************************************************/
10260 
10261 /*!
10262  * @brief MTBDWT_DEVICETYPID - Device Type Identifier Register (RO)
10263  *
10264  * Reset value: 0x00000004U
10265  *
10266  * This register indicates the device type ID. It is hardwired to specific
10267  * values used during the auto-discovery process by an external debug agent.
10268  */
10269 /*!
10270  * @name Constants and macros for entire MTBDWT_DEVICETYPID register
10271  */
10272 /*@{*/
10273 #define MTBDWT_RD_DEVICETYPID(base) (MTBDWT_DEVICETYPID_REG(base))
10274 /*@}*/
10275 
10276 /*******************************************************************************
10277  * MTBDWT_PERIPHID - Peripheral ID Register
10278  ******************************************************************************/
10279 
10280 /*!
10281  * @brief MTBDWT_PERIPHID - Peripheral ID Register (RO)
10282  *
10283  * Reset value: 0x00000000U
10284  *
10285  * These registers indicate the peripheral IDs. They are hardwired to specific
10286  * values used during the auto-discovery process by an external debug agent.
10287  */
10288 /*!
10289  * @name Constants and macros for entire MTBDWT_PERIPHID register
10290  */
10291 /*@{*/
10292 #define MTBDWT_RD_PERIPHID(base, index) (MTBDWT_PERIPHID_REG(base, index))
10293 /*@}*/
10294 
10295 /*******************************************************************************
10296  * MTBDWT_COMPID - Component ID Register
10297  ******************************************************************************/
10298 
10299 /*!
10300  * @brief MTBDWT_COMPID - Component ID Register (RO)
10301  *
10302  * Reset value: 0x00000000U
10303  *
10304  * These registers indicate the component IDs. They are hardwired to specific
10305  * values used during the auto-discovery process by an external debug agent.
10306  */
10307 /*!
10308  * @name Constants and macros for entire MTBDWT_COMPID register
10309  */
10310 /*@{*/
10311 #define MTBDWT_RD_COMPID(base, index) (MTBDWT_COMPID_REG(base, index))
10312 /*@}*/
10313 
10314 /*
10315  * MKL25Z4 NV
10316  *
10317  * Flash configuration field
10318  *
10319  * Registers defined in this header file:
10320  * - NV_BACKKEY3 - Backdoor Comparison Key 3.
10321  * - NV_BACKKEY2 - Backdoor Comparison Key 2.
10322  * - NV_BACKKEY1 - Backdoor Comparison Key 1.
10323  * - NV_BACKKEY0 - Backdoor Comparison Key 0.
10324  * - NV_BACKKEY7 - Backdoor Comparison Key 7.
10325  * - NV_BACKKEY6 - Backdoor Comparison Key 6.
10326  * - NV_BACKKEY5 - Backdoor Comparison Key 5.
10327  * - NV_BACKKEY4 - Backdoor Comparison Key 4.
10328  * - NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register
10329  * - NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register
10330  * - NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register
10331  * - NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register
10332  * - NV_FSEC - Non-volatile Flash Security Register
10333  * - NV_FOPT - Non-volatile Flash Option Register
10334  */
10335 
10336 #define NV_INSTANCE_COUNT (1U) /*!< Number of instances of the NV module. */
10337 #define FTFA_FlashConfig_IDX (0U) /*!< Instance number for FTFA_FlashConfig. */
10338 
10339 /*******************************************************************************
10340  * NV_BACKKEY3 - Backdoor Comparison Key 3.
10341  ******************************************************************************/
10342 
10343 /*!
10344  * @brief NV_BACKKEY3 - Backdoor Comparison Key 3. (RO)
10345  *
10346  * Reset value: 0xFFU
10347  */
10348 /*!
10349  * @name Constants and macros for entire NV_BACKKEY3 register
10350  */
10351 /*@{*/
10352 #define NV_RD_BACKKEY3(base) (NV_BACKKEY3_REG(base))
10353 /*@}*/
10354 
10355 /*******************************************************************************
10356  * NV_BACKKEY2 - Backdoor Comparison Key 2.
10357  ******************************************************************************/
10358 
10359 /*!
10360  * @brief NV_BACKKEY2 - Backdoor Comparison Key 2. (RO)
10361  *
10362  * Reset value: 0xFFU
10363  */
10364 /*!
10365  * @name Constants and macros for entire NV_BACKKEY2 register
10366  */
10367 /*@{*/
10368 #define NV_RD_BACKKEY2(base) (NV_BACKKEY2_REG(base))
10369 /*@}*/
10370 
10371 /*******************************************************************************
10372  * NV_BACKKEY1 - Backdoor Comparison Key 1.
10373  ******************************************************************************/
10374 
10375 /*!
10376  * @brief NV_BACKKEY1 - Backdoor Comparison Key 1. (RO)
10377  *
10378  * Reset value: 0xFFU
10379  */
10380 /*!
10381  * @name Constants and macros for entire NV_BACKKEY1 register
10382  */
10383 /*@{*/
10384 #define NV_RD_BACKKEY1(base) (NV_BACKKEY1_REG(base))
10385 /*@}*/
10386 
10387 /*******************************************************************************
10388  * NV_BACKKEY0 - Backdoor Comparison Key 0.
10389  ******************************************************************************/
10390 
10391 /*!
10392  * @brief NV_BACKKEY0 - Backdoor Comparison Key 0. (RO)
10393  *
10394  * Reset value: 0xFFU
10395  */
10396 /*!
10397  * @name Constants and macros for entire NV_BACKKEY0 register
10398  */
10399 /*@{*/
10400 #define NV_RD_BACKKEY0(base) (NV_BACKKEY0_REG(base))
10401 /*@}*/
10402 
10403 /*******************************************************************************
10404  * NV_BACKKEY7 - Backdoor Comparison Key 7.
10405  ******************************************************************************/
10406 
10407 /*!
10408  * @brief NV_BACKKEY7 - Backdoor Comparison Key 7. (RO)
10409  *
10410  * Reset value: 0xFFU
10411  */
10412 /*!
10413  * @name Constants and macros for entire NV_BACKKEY7 register
10414  */
10415 /*@{*/
10416 #define NV_RD_BACKKEY7(base) (NV_BACKKEY7_REG(base))
10417 /*@}*/
10418 
10419 /*******************************************************************************
10420  * NV_BACKKEY6 - Backdoor Comparison Key 6.
10421  ******************************************************************************/
10422 
10423 /*!
10424  * @brief NV_BACKKEY6 - Backdoor Comparison Key 6. (RO)
10425  *
10426  * Reset value: 0xFFU
10427  */
10428 /*!
10429  * @name Constants and macros for entire NV_BACKKEY6 register
10430  */
10431 /*@{*/
10432 #define NV_RD_BACKKEY6(base) (NV_BACKKEY6_REG(base))
10433 /*@}*/
10434 
10435 /*******************************************************************************
10436  * NV_BACKKEY5 - Backdoor Comparison Key 5.
10437  ******************************************************************************/
10438 
10439 /*!
10440  * @brief NV_BACKKEY5 - Backdoor Comparison Key 5. (RO)
10441  *
10442  * Reset value: 0xFFU
10443  */
10444 /*!
10445  * @name Constants and macros for entire NV_BACKKEY5 register
10446  */
10447 /*@{*/
10448 #define NV_RD_BACKKEY5(base) (NV_BACKKEY5_REG(base))
10449 /*@}*/
10450 
10451 /*******************************************************************************
10452  * NV_BACKKEY4 - Backdoor Comparison Key 4.
10453  ******************************************************************************/
10454 
10455 /*!
10456  * @brief NV_BACKKEY4 - Backdoor Comparison Key 4. (RO)
10457  *
10458  * Reset value: 0xFFU
10459  */
10460 /*!
10461  * @name Constants and macros for entire NV_BACKKEY4 register
10462  */
10463 /*@{*/
10464 #define NV_RD_BACKKEY4(base) (NV_BACKKEY4_REG(base))
10465 /*@}*/
10466 
10467 /*******************************************************************************
10468  * NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register
10469  ******************************************************************************/
10470 
10471 /*!
10472  * @brief NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register (RO)
10473  *
10474  * Reset value: 0xFFU
10475  */
10476 /*!
10477  * @name Constants and macros for entire NV_FPROT3 register
10478  */
10479 /*@{*/
10480 #define NV_RD_FPROT3(base) (NV_FPROT3_REG(base))
10481 /*@}*/
10482 
10483 /*******************************************************************************
10484  * NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register
10485  ******************************************************************************/
10486 
10487 /*!
10488  * @brief NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register (RO)
10489  *
10490  * Reset value: 0xFFU
10491  */
10492 /*!
10493  * @name Constants and macros for entire NV_FPROT2 register
10494  */
10495 /*@{*/
10496 #define NV_RD_FPROT2(base) (NV_FPROT2_REG(base))
10497 /*@}*/
10498 
10499 /*******************************************************************************
10500  * NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register
10501  ******************************************************************************/
10502 
10503 /*!
10504  * @brief NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register (RO)
10505  *
10506  * Reset value: 0xFFU
10507  */
10508 /*!
10509  * @name Constants and macros for entire NV_FPROT1 register
10510  */
10511 /*@{*/
10512 #define NV_RD_FPROT1(base) (NV_FPROT1_REG(base))
10513 /*@}*/
10514 
10515 /*******************************************************************************
10516  * NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register
10517  ******************************************************************************/
10518 
10519 /*!
10520  * @brief NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register (RO)
10521  *
10522  * Reset value: 0xFFU
10523  */
10524 /*!
10525  * @name Constants and macros for entire NV_FPROT0 register
10526  */
10527 /*@{*/
10528 #define NV_RD_FPROT0(base) (NV_FPROT0_REG(base))
10529 /*@}*/
10530 
10531 /*******************************************************************************
10532  * NV_FSEC - Non-volatile Flash Security Register
10533  ******************************************************************************/
10534 
10535 /*!
10536  * @brief NV_FSEC - Non-volatile Flash Security Register (RO)
10537  *
10538  * Reset value: 0xFFU
10539  *
10540  * Allows the user to customize the operation of the MCU at boot time
10541  */
10542 /*!
10543  * @name Constants and macros for entire NV_FSEC register
10544  */
10545 /*@{*/
10546 #define NV_RD_FSEC(base) (NV_FSEC_REG(base))
10547 /*@}*/
10548 
10549 /*
10550  * Constants & macros for individual NV_FSEC bitfields
10551  */
10552 
10553 /*!
10554  * @name Register NV_FSEC, field SEC[1:0] (RO)
10555  *
10556  * Values:
10557  * - 0b10 - MCU security status is unsecure
10558  * - 0b11 - MCU security status is secure
10559  */
10560 /*@{*/
10561 /*! @brief Read current value of the NV_FSEC_SEC field. */
10562 #define NV_RD_FSEC_SEC(base) ((NV_FSEC_REG(base) & NV_FSEC_SEC_MASK) >> NV_FSEC_SEC_SHIFT)
10563 #define NV_BRD_FSEC_SEC(base) (NV_RD_FSEC_SEC(base))
10564 /*@}*/
10565 
10566 /*!
10567  * @name Register NV_FSEC, field FSLACC[3:2] (RO)
10568  *
10569  * Values:
10570  * - 0b10 - Freescale factory access denied
10571  * - 0b11 - Freescale factory access granted
10572  */
10573 /*@{*/
10574 /*! @brief Read current value of the NV_FSEC_FSLACC field. */
10575 #define NV_RD_FSEC_FSLACC(base) ((NV_FSEC_REG(base) & NV_FSEC_FSLACC_MASK) >> NV_FSEC_FSLACC_SHIFT)
10576 #define NV_BRD_FSEC_FSLACC(base) (NV_RD_FSEC_FSLACC(base))
10577 /*@}*/
10578 
10579 /*!
10580  * @name Register NV_FSEC, field MEEN[5:4] (RO)
10581  *
10582  * Values:
10583  * - 0b10 - Mass erase is disabled
10584  * - 0b11 - Mass erase is enabled
10585  */
10586 /*@{*/
10587 /*! @brief Read current value of the NV_FSEC_MEEN field. */
10588 #define NV_RD_FSEC_MEEN(base) ((NV_FSEC_REG(base) & NV_FSEC_MEEN_MASK) >> NV_FSEC_MEEN_SHIFT)
10589 #define NV_BRD_FSEC_MEEN(base) (NV_RD_FSEC_MEEN(base))
10590 /*@}*/
10591 
10592 /*!
10593  * @name Register NV_FSEC, field KEYEN[7:6] (RO)
10594  *
10595  * Values:
10596  * - 0b10 - Backdoor key access enabled
10597  * - 0b11 - Backdoor key access disabled
10598  */
10599 /*@{*/
10600 /*! @brief Read current value of the NV_FSEC_KEYEN field. */
10601 #define NV_RD_FSEC_KEYEN(base) ((NV_FSEC_REG(base) & NV_FSEC_KEYEN_MASK) >> NV_FSEC_KEYEN_SHIFT)
10602 #define NV_BRD_FSEC_KEYEN(base) (NV_RD_FSEC_KEYEN(base))
10603 /*@}*/
10604 
10605 /*******************************************************************************
10606  * NV_FOPT - Non-volatile Flash Option Register
10607  ******************************************************************************/
10608 
10609 /*!
10610  * @brief NV_FOPT - Non-volatile Flash Option Register (RO)
10611  *
10612  * Reset value: 0xFFU
10613  */
10614 /*!
10615  * @name Constants and macros for entire NV_FOPT register
10616  */
10617 /*@{*/
10618 #define NV_RD_FOPT(base) (NV_FOPT_REG(base))
10619 /*@}*/
10620 
10621 /*
10622  * Constants & macros for individual NV_FOPT bitfields
10623  */
10624 
10625 /*!
10626  * @name Register NV_FOPT, field LPBOOT0[0] (RO)
10627  *
10628  * Values:
10629  * - 0b0 - Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) when
10630  * LPBOOT1=0 or 0x1 (divide by 2) when LPBOOT1=1.
10631  * - 0b1 - Core and system clock divider (OUTDIV1) is 0x3 (divide by 4) when
10632  * LPBOOT1=0 or 0x0 (divide by 1) when LPBOOT1=1.
10633  */
10634 /*@{*/
10635 /*! @brief Read current value of the NV_FOPT_LPBOOT0 field. */
10636 #define NV_RD_FOPT_LPBOOT0(base) ((NV_FOPT_REG(base) & NV_FOPT_LPBOOT0_MASK) >> NV_FOPT_LPBOOT0_SHIFT)
10637 #define NV_BRD_FOPT_LPBOOT0(base) (NV_RD_FOPT_LPBOOT0(base))
10638 /*@}*/
10639 
10640 /*!
10641  * @name Register NV_FOPT, field NMI_DIS[2] (RO)
10642  *
10643  * Values:
10644  * - 0b0 - NMI interrupts are always blocked
10645  * - 0b1 - NMI_b pin/interrupts reset default to enabled
10646  */
10647 /*@{*/
10648 /*! @brief Read current value of the NV_FOPT_NMI_DIS field. */
10649 #define NV_RD_FOPT_NMI_DIS(base) ((NV_FOPT_REG(base) & NV_FOPT_NMI_DIS_MASK) >> NV_FOPT_NMI_DIS_SHIFT)
10650 #define NV_BRD_FOPT_NMI_DIS(base) (NV_RD_FOPT_NMI_DIS(base))
10651 /*@}*/
10652 
10653 /*!
10654  * @name Register NV_FOPT, field RESET_PIN_CFG[3] (RO)
10655  *
10656  * Values:
10657  * - 0b0 - RESET pin is disabled following a POR and cannot be enabled as reset
10658  * function
10659  * - 0b1 - RESET_b pin is dedicated
10660  */
10661 /*@{*/
10662 /*! @brief Read current value of the NV_FOPT_RESET_PIN_CFG field. */
10663 #define NV_RD_FOPT_RESET_PIN_CFG(base) ((NV_FOPT_REG(base) & NV_FOPT_RESET_PIN_CFG_MASK) >> NV_FOPT_RESET_PIN_CFG_SHIFT)
10664 #define NV_BRD_FOPT_RESET_PIN_CFG(base) (NV_RD_FOPT_RESET_PIN_CFG(base))
10665 /*@}*/
10666 
10667 /*!
10668  * @name Register NV_FOPT, field LPBOOT1[4] (RO)
10669  *
10670  * Values:
10671  * - 0b0 - Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) when
10672  * LPBOOT0=0 or 0x3 (divide by 4) when LPBOOT0=1.
10673  * - 0b1 - Core and system clock divider (OUTDIV1) is 0x1 (divide by 2) when
10674  * LPBOOT0=0 or 0x0 (divide by 1) when LPBOOT0=1.
10675  */
10676 /*@{*/
10677 /*! @brief Read current value of the NV_FOPT_LPBOOT1 field. */
10678 #define NV_RD_FOPT_LPBOOT1(base) ((NV_FOPT_REG(base) & NV_FOPT_LPBOOT1_MASK) >> NV_FOPT_LPBOOT1_SHIFT)
10679 #define NV_BRD_FOPT_LPBOOT1(base) (NV_RD_FOPT_LPBOOT1(base))
10680 /*@}*/
10681 
10682 /*!
10683  * @name Register NV_FOPT, field FAST_INIT[5] (RO)
10684  *
10685  * Values:
10686  * - 0b0 - Slower initialization
10687  * - 0b1 - Fast Initialization
10688  */
10689 /*@{*/
10690 /*! @brief Read current value of the NV_FOPT_FAST_INIT field. */
10691 #define NV_RD_FOPT_FAST_INIT(base) ((NV_FOPT_REG(base) & NV_FOPT_FAST_INIT_MASK) >> NV_FOPT_FAST_INIT_SHIFT)
10692 #define NV_BRD_FOPT_FAST_INIT(base) (NV_RD_FOPT_FAST_INIT(base))
10693 /*@}*/
10694 
10695 /*
10696  * MKL25Z4 OSC
10697  *
10698  * Oscillator
10699  *
10700  * Registers defined in this header file:
10701  * - OSC_CR - OSC Control Register
10702  */
10703 
10704 #define OSC_INSTANCE_COUNT (1U) /*!< Number of instances of the OSC module. */
10705 #define OSC0_IDX (0U) /*!< Instance number for OSC0. */
10706 
10707 /*******************************************************************************
10708  * OSC_CR - OSC Control Register
10709  ******************************************************************************/
10710 
10711 /*!
10712  * @brief OSC_CR - OSC Control Register (RW)
10713  *
10714  * Reset value: 0x00U
10715  *
10716  * After OSC is enabled and starts generating the clocks, the configurations
10717  * such as low power and frequency range, must not be changed.
10718  */
10719 /*!
10720  * @name Constants and macros for entire OSC_CR register
10721  */
10722 /*@{*/
10723 #define OSC_RD_CR(base) (OSC_CR_REG(base))
10724 #define OSC_WR_CR(base, value) (OSC_CR_REG(base) = (value))
10725 #define OSC_RMW_CR(base, mask, value) (OSC_WR_CR(base, (OSC_RD_CR(base) & ~(mask)) | (value)))
10726 #define OSC_SET_CR(base, value) (BME_OR8(&OSC_CR_REG(base), (uint8_t)(value)))
10727 #define OSC_CLR_CR(base, value) (BME_AND8(&OSC_CR_REG(base), (uint8_t)(~(value))))
10728 #define OSC_TOG_CR(base, value) (BME_XOR8(&OSC_CR_REG(base), (uint8_t)(value)))
10729 /*@}*/
10730 
10731 /*
10732  * Constants & macros for individual OSC_CR bitfields
10733  */
10734 
10735 /*!
10736  * @name Register OSC_CR, field SC16P[0] (RW)
10737  *
10738  * Configures the oscillator load.
10739  *
10740  * Values:
10741  * - 0b0 - Disable the selection.
10742  * - 0b1 - Add 16 pF capacitor to the oscillator load.
10743  */
10744 /*@{*/
10745 /*! @brief Read current value of the OSC_CR_SC16P field. */
10746 #define OSC_RD_CR_SC16P(base) ((OSC_CR_REG(base) & OSC_CR_SC16P_MASK) >> OSC_CR_SC16P_SHIFT)
10747 #define OSC_BRD_CR_SC16P(base) (BME_UBFX8(&OSC_CR_REG(base), OSC_CR_SC16P_SHIFT, OSC_CR_SC16P_WIDTH))
10748 
10749 /*! @brief Set the SC16P field to a new value. */
10750 #define OSC_WR_CR_SC16P(base, value) (OSC_RMW_CR(base, OSC_CR_SC16P_MASK, OSC_CR_SC16P(value)))
10751 #define OSC_BWR_CR_SC16P(base, value) (BME_BFI8(&OSC_CR_REG(base), ((uint8_t)(value) << OSC_CR_SC16P_SHIFT), OSC_CR_SC16P_SHIFT, OSC_CR_SC16P_WIDTH))
10752 /*@}*/
10753 
10754 /*!
10755  * @name Register OSC_CR, field SC8P[1] (RW)
10756  *
10757  * Configures the oscillator load.
10758  *
10759  * Values:
10760  * - 0b0 - Disable the selection.
10761  * - 0b1 - Add 8 pF capacitor to the oscillator load.
10762  */
10763 /*@{*/
10764 /*! @brief Read current value of the OSC_CR_SC8P field. */
10765 #define OSC_RD_CR_SC8P(base) ((OSC_CR_REG(base) & OSC_CR_SC8P_MASK) >> OSC_CR_SC8P_SHIFT)
10766 #define OSC_BRD_CR_SC8P(base) (BME_UBFX8(&OSC_CR_REG(base), OSC_CR_SC8P_SHIFT, OSC_CR_SC8P_WIDTH))
10767 
10768 /*! @brief Set the SC8P field to a new value. */
10769 #define OSC_WR_CR_SC8P(base, value) (OSC_RMW_CR(base, OSC_CR_SC8P_MASK, OSC_CR_SC8P(value)))
10770 #define OSC_BWR_CR_SC8P(base, value) (BME_BFI8(&OSC_CR_REG(base), ((uint8_t)(value) << OSC_CR_SC8P_SHIFT), OSC_CR_SC8P_SHIFT, OSC_CR_SC8P_WIDTH))
10771 /*@}*/
10772 
10773 /*!
10774  * @name Register OSC_CR, field SC4P[2] (RW)
10775  *
10776  * Configures the oscillator load.
10777  *
10778  * Values:
10779  * - 0b0 - Disable the selection.
10780  * - 0b1 - Add 4 pF capacitor to the oscillator load.
10781  */
10782 /*@{*/
10783 /*! @brief Read current value of the OSC_CR_SC4P field. */
10784 #define OSC_RD_CR_SC4P(base) ((OSC_CR_REG(base) & OSC_CR_SC4P_MASK) >> OSC_CR_SC4P_SHIFT)
10785 #define OSC_BRD_CR_SC4P(base) (BME_UBFX8(&OSC_CR_REG(base), OSC_CR_SC4P_SHIFT, OSC_CR_SC4P_WIDTH))
10786 
10787 /*! @brief Set the SC4P field to a new value. */
10788 #define OSC_WR_CR_SC4P(base, value) (OSC_RMW_CR(base, OSC_CR_SC4P_MASK, OSC_CR_SC4P(value)))
10789 #define OSC_BWR_CR_SC4P(base, value) (BME_BFI8(&OSC_CR_REG(base), ((uint8_t)(value) << OSC_CR_SC4P_SHIFT), OSC_CR_SC4P_SHIFT, OSC_CR_SC4P_WIDTH))
10790 /*@}*/
10791 
10792 /*!
10793  * @name Register OSC_CR, field SC2P[3] (RW)
10794  *
10795  * Configures the oscillator load.
10796  *
10797  * Values:
10798  * - 0b0 - Disable the selection.
10799  * - 0b1 - Add 2 pF capacitor to the oscillator load.
10800  */
10801 /*@{*/
10802 /*! @brief Read current value of the OSC_CR_SC2P field. */
10803 #define OSC_RD_CR_SC2P(base) ((OSC_CR_REG(base) & OSC_CR_SC2P_MASK) >> OSC_CR_SC2P_SHIFT)
10804 #define OSC_BRD_CR_SC2P(base) (BME_UBFX8(&OSC_CR_REG(base), OSC_CR_SC2P_SHIFT, OSC_CR_SC2P_WIDTH))
10805 
10806 /*! @brief Set the SC2P field to a new value. */
10807 #define OSC_WR_CR_SC2P(base, value) (OSC_RMW_CR(base, OSC_CR_SC2P_MASK, OSC_CR_SC2P(value)))
10808 #define OSC_BWR_CR_SC2P(base, value) (BME_BFI8(&OSC_CR_REG(base), ((uint8_t)(value) << OSC_CR_SC2P_SHIFT), OSC_CR_SC2P_SHIFT, OSC_CR_SC2P_WIDTH))
10809 /*@}*/
10810 
10811 /*!
10812  * @name Register OSC_CR, field EREFSTEN[5] (RW)
10813  *
10814  * Controls whether or not the external reference clock (OSCERCLK) remains
10815  * enabled when MCU enters Stop mode.
10816  *
10817  * Values:
10818  * - 0b0 - External reference clock is disabled in Stop mode.
10819  * - 0b1 - External reference clock stays enabled in Stop mode if ERCLKEN is set
10820  * before entering Stop mode.
10821  */
10822 /*@{*/
10823 /*! @brief Read current value of the OSC_CR_EREFSTEN field. */
10824 #define OSC_RD_CR_EREFSTEN(base) ((OSC_CR_REG(base) & OSC_CR_EREFSTEN_MASK) >> OSC_CR_EREFSTEN_SHIFT)
10825 #define OSC_BRD_CR_EREFSTEN(base) (BME_UBFX8(&OSC_CR_REG(base), OSC_CR_EREFSTEN_SHIFT, OSC_CR_EREFSTEN_WIDTH))
10826 
10827 /*! @brief Set the EREFSTEN field to a new value. */
10828 #define OSC_WR_CR_EREFSTEN(base, value) (OSC_RMW_CR(base, OSC_CR_EREFSTEN_MASK, OSC_CR_EREFSTEN(value)))
10829 #define OSC_BWR_CR_EREFSTEN(base, value) (BME_BFI8(&OSC_CR_REG(base), ((uint8_t)(value) << OSC_CR_EREFSTEN_SHIFT), OSC_CR_EREFSTEN_SHIFT, OSC_CR_EREFSTEN_WIDTH))
10830 /*@}*/
10831 
10832 /*!
10833  * @name Register OSC_CR, field ERCLKEN[7] (RW)
10834  *
10835  * Enables external reference clock (OSCERCLK).
10836  *
10837  * Values:
10838  * - 0b0 - External reference clock is inactive.
10839  * - 0b1 - External reference clock is enabled.
10840  */
10841 /*@{*/
10842 /*! @brief Read current value of the OSC_CR_ERCLKEN field. */
10843 #define OSC_RD_CR_ERCLKEN(base) ((OSC_CR_REG(base) & OSC_CR_ERCLKEN_MASK) >> OSC_CR_ERCLKEN_SHIFT)
10844 #define OSC_BRD_CR_ERCLKEN(base) (BME_UBFX8(&OSC_CR_REG(base), OSC_CR_ERCLKEN_SHIFT, OSC_CR_ERCLKEN_WIDTH))
10845 
10846 /*! @brief Set the ERCLKEN field to a new value. */
10847 #define OSC_WR_CR_ERCLKEN(base, value) (OSC_RMW_CR(base, OSC_CR_ERCLKEN_MASK, OSC_CR_ERCLKEN(value)))
10848 #define OSC_BWR_CR_ERCLKEN(base, value) (BME_BFI8(&OSC_CR_REG(base), ((uint8_t)(value) << OSC_CR_ERCLKEN_SHIFT), OSC_CR_ERCLKEN_SHIFT, OSC_CR_ERCLKEN_WIDTH))
10849 /*@}*/
10850 
10851 /*
10852  * MKL25Z4 PIT
10853  *
10854  * Periodic Interrupt Timer
10855  *
10856  * Registers defined in this header file:
10857  * - PIT_MCR - PIT Module Control Register
10858  * - PIT_LTMR64H - PIT Upper Lifetime Timer Register
10859  * - PIT_LTMR64L - PIT Lower Lifetime Timer Register
10860  * - PIT_LDVAL - Timer Load Value Register
10861  * - PIT_CVAL - Current Timer Value Register
10862  * - PIT_TCTRL - Timer Control Register
10863  * - PIT_TFLG - Timer Flag Register
10864  */
10865 
10866 #define PIT_INSTANCE_COUNT (1U) /*!< Number of instances of the PIT module. */
10867 #define PIT_IDX (0U) /*!< Instance number for PIT. */
10868 
10869 /*******************************************************************************
10870  * PIT_MCR - PIT Module Control Register
10871  ******************************************************************************/
10872 
10873 /*!
10874  * @brief PIT_MCR - PIT Module Control Register (RW)
10875  *
10876  * Reset value: 0x00000002U
10877  *
10878  * This register enables or disables the PIT timer clocks and controls the
10879  * timers when the PIT enters the Debug mode.
10880  */
10881 /*!
10882  * @name Constants and macros for entire PIT_MCR register
10883  */
10884 /*@{*/
10885 #define PIT_RD_MCR(base) (PIT_MCR_REG(base))
10886 #define PIT_WR_MCR(base, value) (PIT_MCR_REG(base) = (value))
10887 #define PIT_RMW_MCR(base, mask, value) (PIT_WR_MCR(base, (PIT_RD_MCR(base) & ~(mask)) | (value)))
10888 #define PIT_SET_MCR(base, value) (BME_OR32(&PIT_MCR_REG(base), (uint32_t)(value)))
10889 #define PIT_CLR_MCR(base, value) (BME_AND32(&PIT_MCR_REG(base), (uint32_t)(~(value))))
10890 #define PIT_TOG_MCR(base, value) (BME_XOR32(&PIT_MCR_REG(base), (uint32_t)(value)))
10891 /*@}*/
10892 
10893 /*
10894  * Constants & macros for individual PIT_MCR bitfields
10895  */
10896 
10897 /*!
10898  * @name Register PIT_MCR, field FRZ[0] (RW)
10899  *
10900  * Allows the timers to be stopped when the device enters the Debug mode.
10901  *
10902  * Values:
10903  * - 0b0 - Timers continue to run in Debug mode.
10904  * - 0b1 - Timers are stopped in Debug mode.
10905  */
10906 /*@{*/
10907 /*! @brief Read current value of the PIT_MCR_FRZ field. */
10908 #define PIT_RD_MCR_FRZ(base) ((PIT_MCR_REG(base) & PIT_MCR_FRZ_MASK) >> PIT_MCR_FRZ_SHIFT)
10909 #define PIT_BRD_MCR_FRZ(base) (BME_UBFX32(&PIT_MCR_REG(base), PIT_MCR_FRZ_SHIFT, PIT_MCR_FRZ_WIDTH))
10910 
10911 /*! @brief Set the FRZ field to a new value. */
10912 #define PIT_WR_MCR_FRZ(base, value) (PIT_RMW_MCR(base, PIT_MCR_FRZ_MASK, PIT_MCR_FRZ(value)))
10913 #define PIT_BWR_MCR_FRZ(base, value) (BME_BFI32(&PIT_MCR_REG(base), ((uint32_t)(value) << PIT_MCR_FRZ_SHIFT), PIT_MCR_FRZ_SHIFT, PIT_MCR_FRZ_WIDTH))
10914 /*@}*/
10915 
10916 /*!
10917  * @name Register PIT_MCR, field MDIS[1] (RW)
10918  *
10919  * Disables the standard timers. The RTI timer is not affected by this field.
10920  * This field must be enabled before any other setup is done.
10921  *
10922  * Values:
10923  * - 0b0 - Clock for standard PIT timers is enabled.
10924  * - 0b1 - Clock for standard PIT timers is disabled.
10925  */
10926 /*@{*/
10927 /*! @brief Read current value of the PIT_MCR_MDIS field. */
10928 #define PIT_RD_MCR_MDIS(base) ((PIT_MCR_REG(base) & PIT_MCR_MDIS_MASK) >> PIT_MCR_MDIS_SHIFT)
10929 #define PIT_BRD_MCR_MDIS(base) (BME_UBFX32(&PIT_MCR_REG(base), PIT_MCR_MDIS_SHIFT, PIT_MCR_MDIS_WIDTH))
10930 
10931 /*! @brief Set the MDIS field to a new value. */
10932 #define PIT_WR_MCR_MDIS(base, value) (PIT_RMW_MCR(base, PIT_MCR_MDIS_MASK, PIT_MCR_MDIS(value)))
10933 #define PIT_BWR_MCR_MDIS(base, value) (BME_BFI32(&PIT_MCR_REG(base), ((uint32_t)(value) << PIT_MCR_MDIS_SHIFT), PIT_MCR_MDIS_SHIFT, PIT_MCR_MDIS_WIDTH))
10934 /*@}*/
10935 
10936 /*******************************************************************************
10937  * PIT_LTMR64H - PIT Upper Lifetime Timer Register
10938  ******************************************************************************/
10939 
10940 /*!
10941  * @brief PIT_LTMR64H - PIT Upper Lifetime Timer Register (RO)
10942  *
10943  * Reset value: 0x00000000U
10944  *
10945  * This register is intended for applications that chain timer 0 and timer 1 to
10946  * build a 64-bit lifetimer.
10947  */
10948 /*!
10949  * @name Constants and macros for entire PIT_LTMR64H register
10950  */
10951 /*@{*/
10952 #define PIT_RD_LTMR64H(base) (PIT_LTMR64H_REG(base))
10953 /*@}*/
10954 
10955 /*******************************************************************************
10956  * PIT_LTMR64L - PIT Lower Lifetime Timer Register
10957  ******************************************************************************/
10958 
10959 /*!
10960  * @brief PIT_LTMR64L - PIT Lower Lifetime Timer Register (RO)
10961  *
10962  * Reset value: 0x00000000U
10963  *
10964  * This register is intended for applications that chain timer 0 and timer 1 to
10965  * build a 64-bit lifetimer. To use LTMR64H and LTMR64L, timer 0 and timer 1 need
10966  * to be chained. To obtain the correct value, first read LTMR64H and then
10967  * LTMR64L. LTMR64H will have the value of CVAL1 at the time of the first access,
10968  * LTMR64L will have the value of CVAL0 at the time of the first access, therefore
10969  * the application does not need to worry about carry-over effects of the running
10970  * counter.
10971  */
10972 /*!
10973  * @name Constants and macros for entire PIT_LTMR64L register
10974  */
10975 /*@{*/
10976 #define PIT_RD_LTMR64L(base) (PIT_LTMR64L_REG(base))
10977 /*@}*/
10978 
10979 /*******************************************************************************
10980  * PIT_LDVAL - Timer Load Value Register
10981  ******************************************************************************/
10982 
10983 /*!
10984  * @brief PIT_LDVAL - Timer Load Value Register (RW)
10985  *
10986  * Reset value: 0x00000000U
10987  *
10988  * These registers select the timeout period for the timer interrupts.
10989  */
10990 /*!
10991  * @name Constants and macros for entire PIT_LDVAL register
10992  */
10993 /*@{*/
10994 #define PIT_RD_LDVAL(base, index) (PIT_LDVAL_REG(base, index))
10995 #define PIT_WR_LDVAL(base, index, value) (PIT_LDVAL_REG(base, index) = (value))
10996 #define PIT_RMW_LDVAL(base, index, mask, value) (PIT_WR_LDVAL(base, index, (PIT_RD_LDVAL(base, index) & ~(mask)) | (value)))
10997 #define PIT_SET_LDVAL(base, index, value) (BME_OR32(&PIT_LDVAL_REG(base, index), (uint32_t)(value)))
10998 #define PIT_CLR_LDVAL(base, index, value) (BME_AND32(&PIT_LDVAL_REG(base, index), (uint32_t)(~(value))))
10999 #define PIT_TOG_LDVAL(base, index, value) (BME_XOR32(&PIT_LDVAL_REG(base, index), (uint32_t)(value)))
11000 /*@}*/
11001 
11002 /*******************************************************************************
11003  * PIT_CVAL - Current Timer Value Register
11004  ******************************************************************************/
11005 
11006 /*!
11007  * @brief PIT_CVAL - Current Timer Value Register (RO)
11008  *
11009  * Reset value: 0x00000000U
11010  *
11011  * These registers indicate the current timer position.
11012  */
11013 /*!
11014  * @name Constants and macros for entire PIT_CVAL register
11015  */
11016 /*@{*/
11017 #define PIT_RD_CVAL(base, index) (PIT_CVAL_REG(base, index))
11018 /*@}*/
11019 
11020 /*******************************************************************************
11021  * PIT_TCTRL - Timer Control Register
11022  ******************************************************************************/
11023 
11024 /*!
11025  * @brief PIT_TCTRL - Timer Control Register (RW)
11026  *
11027  * Reset value: 0x00000000U
11028  *
11029  * These register contain the control bits for each timer.
11030  */
11031 /*!
11032  * @name Constants and macros for entire PIT_TCTRL register
11033  */
11034 /*@{*/
11035 #define PIT_RD_TCTRL(base, index) (PIT_TCTRL_REG(base, index))
11036 #define PIT_WR_TCTRL(base, index, value) (PIT_TCTRL_REG(base, index) = (value))
11037 #define PIT_RMW_TCTRL(base, index, mask, value) (PIT_WR_TCTRL(base, index, (PIT_RD_TCTRL(base, index) & ~(mask)) | (value)))
11038 #define PIT_SET_TCTRL(base, index, value) (BME_OR32(&PIT_TCTRL_REG(base, index), (uint32_t)(value)))
11039 #define PIT_CLR_TCTRL(base, index, value) (BME_AND32(&PIT_TCTRL_REG(base, index), (uint32_t)(~(value))))
11040 #define PIT_TOG_TCTRL(base, index, value) (BME_XOR32(&PIT_TCTRL_REG(base, index), (uint32_t)(value)))
11041 /*@}*/
11042 
11043 /*
11044  * Constants & macros for individual PIT_TCTRL bitfields
11045  */
11046 
11047 /*!
11048  * @name Register PIT_TCTRL, field TEN[0] (RW)
11049  *
11050  * Enables or disables the timer.
11051  *
11052  * Values:
11053  * - 0b0 - Timer n is disabled.
11054  * - 0b1 - Timer n is enabled.
11055  */
11056 /*@{*/
11057 /*! @brief Read current value of the PIT_TCTRL_TEN field. */
11058 #define PIT_RD_TCTRL_TEN(base, index) ((PIT_TCTRL_REG(base, index) & PIT_TCTRL_TEN_MASK) >> PIT_TCTRL_TEN_SHIFT)
11059 #define PIT_BRD_TCTRL_TEN(base, index) (BME_UBFX32(&PIT_TCTRL_REG(base, index), PIT_TCTRL_TEN_SHIFT, PIT_TCTRL_TEN_WIDTH))
11060 
11061 /*! @brief Set the TEN field to a new value. */
11062 #define PIT_WR_TCTRL_TEN(base, index, value) (PIT_RMW_TCTRL(base, index, PIT_TCTRL_TEN_MASK, PIT_TCTRL_TEN(value)))
11063 #define PIT_BWR_TCTRL_TEN(base, index, value) (BME_BFI32(&PIT_TCTRL_REG(base, index), ((uint32_t)(value) << PIT_TCTRL_TEN_SHIFT), PIT_TCTRL_TEN_SHIFT, PIT_TCTRL_TEN_WIDTH))
11064 /*@}*/
11065 
11066 /*!
11067  * @name Register PIT_TCTRL, field TIE[1] (RW)
11068  *
11069  * When an interrupt is pending, or, TFLGn[TIF] is set, enabling the interrupt
11070  * will immediately cause an interrupt event. To avoid this, the associated
11071  * TFLGn[TIF] must be cleared first.
11072  *
11073  * Values:
11074  * - 0b0 - Interrupt requests from Timer n are disabled.
11075  * - 0b1 - Interrupt will be requested whenever TIF is set.
11076  */
11077 /*@{*/
11078 /*! @brief Read current value of the PIT_TCTRL_TIE field. */
11079 #define PIT_RD_TCTRL_TIE(base, index) ((PIT_TCTRL_REG(base, index) & PIT_TCTRL_TIE_MASK) >> PIT_TCTRL_TIE_SHIFT)
11080 #define PIT_BRD_TCTRL_TIE(base, index) (BME_UBFX32(&PIT_TCTRL_REG(base, index), PIT_TCTRL_TIE_SHIFT, PIT_TCTRL_TIE_WIDTH))
11081 
11082 /*! @brief Set the TIE field to a new value. */
11083 #define PIT_WR_TCTRL_TIE(base, index, value) (PIT_RMW_TCTRL(base, index, PIT_TCTRL_TIE_MASK, PIT_TCTRL_TIE(value)))
11084 #define PIT_BWR_TCTRL_TIE(base, index, value) (BME_BFI32(&PIT_TCTRL_REG(base, index), ((uint32_t)(value) << PIT_TCTRL_TIE_SHIFT), PIT_TCTRL_TIE_SHIFT, PIT_TCTRL_TIE_WIDTH))
11085 /*@}*/
11086 
11087 /*!
11088  * @name Register PIT_TCTRL, field CHN[2] (RW)
11089  *
11090  * When activated, Timer n-1 needs to expire before timer n can decrement by 1.
11091  * Timer 0 can not be changed.
11092  *
11093  * Values:
11094  * - 0b0 - Timer is not chained.
11095  * - 0b1 - Timer is chained to previous timer. For example, for Channel 2, if
11096  * this field is set, Timer 2 is chained to Timer 1.
11097  */
11098 /*@{*/
11099 /*! @brief Read current value of the PIT_TCTRL_CHN field. */
11100 #define PIT_RD_TCTRL_CHN(base, index) ((PIT_TCTRL_REG(base, index) & PIT_TCTRL_CHN_MASK) >> PIT_TCTRL_CHN_SHIFT)
11101 #define PIT_BRD_TCTRL_CHN(base, index) (BME_UBFX32(&PIT_TCTRL_REG(base, index), PIT_TCTRL_CHN_SHIFT, PIT_TCTRL_CHN_WIDTH))
11102 
11103 /*! @brief Set the CHN field to a new value. */
11104 #define PIT_WR_TCTRL_CHN(base, index, value) (PIT_RMW_TCTRL(base, index, PIT_TCTRL_CHN_MASK, PIT_TCTRL_CHN(value)))
11105 #define PIT_BWR_TCTRL_CHN(base, index, value) (BME_BFI32(&PIT_TCTRL_REG(base, index), ((uint32_t)(value) << PIT_TCTRL_CHN_SHIFT), PIT_TCTRL_CHN_SHIFT, PIT_TCTRL_CHN_WIDTH))
11106 /*@}*/
11107 
11108 /*******************************************************************************
11109  * PIT_TFLG - Timer Flag Register
11110  ******************************************************************************/
11111 
11112 /*!
11113  * @brief PIT_TFLG - Timer Flag Register (RW)
11114  *
11115  * Reset value: 0x00000000U
11116  *
11117  * These registers hold the PIT interrupt flags.
11118  */
11119 /*!
11120  * @name Constants and macros for entire PIT_TFLG register
11121  */
11122 /*@{*/
11123 #define PIT_RD_TFLG(base, index) (PIT_TFLG_REG(base, index))
11124 #define PIT_WR_TFLG(base, index, value) (PIT_TFLG_REG(base, index) = (value))
11125 #define PIT_RMW_TFLG(base, index, mask, value) (PIT_WR_TFLG(base, index, (PIT_RD_TFLG(base, index) & ~(mask)) | (value)))
11126 #define PIT_SET_TFLG(base, index, value) (BME_OR32(&PIT_TFLG_REG(base, index), (uint32_t)(value)))
11127 #define PIT_CLR_TFLG(base, index, value) (BME_AND32(&PIT_TFLG_REG(base, index), (uint32_t)(~(value))))
11128 #define PIT_TOG_TFLG(base, index, value) (BME_XOR32(&PIT_TFLG_REG(base, index), (uint32_t)(value)))
11129 /*@}*/
11130 
11131 /*
11132  * Constants & macros for individual PIT_TFLG bitfields
11133  */
11134 
11135 /*!
11136  * @name Register PIT_TFLG, field TIF[0] (W1C)
11137  *
11138  * Sets to 1 at the end of the timer period. Writing 1 to this flag clears it.
11139  * Writing 0 has no effect. If enabled, or, when TCTRLn[TIE] = 1, TIF causes an
11140  * interrupt request.
11141  *
11142  * Values:
11143  * - 0b0 - Timeout has not yet occurred.
11144  * - 0b1 - Timeout has occurred.
11145  */
11146 /*@{*/
11147 /*! @brief Read current value of the PIT_TFLG_TIF field. */
11148 #define PIT_RD_TFLG_TIF(base, index) ((PIT_TFLG_REG(base, index) & PIT_TFLG_TIF_MASK) >> PIT_TFLG_TIF_SHIFT)
11149 #define PIT_BRD_TFLG_TIF(base, index) (BME_UBFX32(&PIT_TFLG_REG(base, index), PIT_TFLG_TIF_SHIFT, PIT_TFLG_TIF_WIDTH))
11150 
11151 /*! @brief Set the TIF field to a new value. */
11152 #define PIT_WR_TFLG_TIF(base, index, value) (PIT_RMW_TFLG(base, index, PIT_TFLG_TIF_MASK, PIT_TFLG_TIF(value)))
11153 #define PIT_BWR_TFLG_TIF(base, index, value) (BME_BFI32(&PIT_TFLG_REG(base, index), ((uint32_t)(value) << PIT_TFLG_TIF_SHIFT), PIT_TFLG_TIF_SHIFT, PIT_TFLG_TIF_WIDTH))
11154 /*@}*/
11155 
11156 /*
11157  * MKL25Z4 PMC
11158  *
11159  * Power Management Controller
11160  *
11161  * Registers defined in this header file:
11162  * - PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register
11163  * - PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register
11164  * - PMC_REGSC - Regulator Status And Control register
11165  */
11166 
11167 #define PMC_INSTANCE_COUNT (1U) /*!< Number of instances of the PMC module. */
11168 #define PMC_IDX (0U) /*!< Instance number for PMC. */
11169 
11170 /*******************************************************************************
11171  * PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register
11172  ******************************************************************************/
11173 
11174 /*!
11175  * @brief PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register (RW)
11176  *
11177  * Reset value: 0x10U
11178  *
11179  * This register contains status and control bits to support the low voltage
11180  * detect function. This register should be written during the reset initialization
11181  * program to set the desired controls even if the desired settings are the same
11182  * as the reset settings. While the device is in the very low power or low
11183  * leakage modes, the LVD system is disabled regardless of LVDSC1 settings. To protect
11184  * systems that must have LVD always on, configure the SMC's power mode
11185  * protection register (PMPROT) to disallow any very low power or low leakage modes from
11186  * being enabled. See the device's data sheet for the exact LVD trip voltages. The
11187  * LVDV bits are reset solely on a POR Only event. The register's other bits are
11188  * reset on Chip Reset Not VLLS. For more information about these reset types,
11189  * refer to the Reset section details.
11190  */
11191 /*!
11192  * @name Constants and macros for entire PMC_LVDSC1 register
11193  */
11194 /*@{*/
11195 #define PMC_RD_LVDSC1(base) (PMC_LVDSC1_REG(base))
11196 #define PMC_WR_LVDSC1(base, value) (PMC_LVDSC1_REG(base) = (value))
11197 #define PMC_RMW_LVDSC1(base, mask, value) (PMC_WR_LVDSC1(base, (PMC_RD_LVDSC1(base) & ~(mask)) | (value)))
11198 #define PMC_SET_LVDSC1(base, value) (BME_OR8(&PMC_LVDSC1_REG(base), (uint8_t)(value)))
11199 #define PMC_CLR_LVDSC1(base, value) (BME_AND8(&PMC_LVDSC1_REG(base), (uint8_t)(~(value))))
11200 #define PMC_TOG_LVDSC1(base, value) (BME_XOR8(&PMC_LVDSC1_REG(base), (uint8_t)(value)))
11201 /*@}*/
11202 
11203 /*
11204  * Constants & macros for individual PMC_LVDSC1 bitfields
11205  */
11206 
11207 /*!
11208  * @name Register PMC_LVDSC1, field LVDV[1:0] (RW)
11209  *
11210  * Selects the LVD trip point voltage (V LVD ).
11211  *
11212  * Values:
11213  * - 0b00 - Low trip point selected (V LVD = V LVDL )
11214  * - 0b01 - High trip point selected (V LVD = V LVDH )
11215  * - 0b10 - Reserved
11216  * - 0b11 - Reserved
11217  */
11218 /*@{*/
11219 /*! @brief Read current value of the PMC_LVDSC1_LVDV field. */
11220 #define PMC_RD_LVDSC1_LVDV(base) ((PMC_LVDSC1_REG(base) & PMC_LVDSC1_LVDV_MASK) >> PMC_LVDSC1_LVDV_SHIFT)
11221 #define PMC_BRD_LVDSC1_LVDV(base) (BME_UBFX8(&PMC_LVDSC1_REG(base), PMC_LVDSC1_LVDV_SHIFT, PMC_LVDSC1_LVDV_WIDTH))
11222 
11223 /*! @brief Set the LVDV field to a new value. */
11224 #define PMC_WR_LVDSC1_LVDV(base, value) (PMC_RMW_LVDSC1(base, PMC_LVDSC1_LVDV_MASK, PMC_LVDSC1_LVDV(value)))
11225 #define PMC_BWR_LVDSC1_LVDV(base, value) (BME_BFI8(&PMC_LVDSC1_REG(base), ((uint8_t)(value) << PMC_LVDSC1_LVDV_SHIFT), PMC_LVDSC1_LVDV_SHIFT, PMC_LVDSC1_LVDV_WIDTH))
11226 /*@}*/
11227 
11228 /*!
11229  * @name Register PMC_LVDSC1, field LVDRE[4] (RW)
11230  *
11231  * This write-once bit enables LVDF events to generate a hardware reset.
11232  * Additional writes are ignored.
11233  *
11234  * Values:
11235  * - 0b0 - LVDF does not generate hardware resets
11236  * - 0b1 - Force an MCU reset when LVDF = 1
11237  */
11238 /*@{*/
11239 /*! @brief Read current value of the PMC_LVDSC1_LVDRE field. */
11240 #define PMC_RD_LVDSC1_LVDRE(base) ((PMC_LVDSC1_REG(base) & PMC_LVDSC1_LVDRE_MASK) >> PMC_LVDSC1_LVDRE_SHIFT)
11241 #define PMC_BRD_LVDSC1_LVDRE(base) (BME_UBFX8(&PMC_LVDSC1_REG(base), PMC_LVDSC1_LVDRE_SHIFT, PMC_LVDSC1_LVDRE_WIDTH))
11242 
11243 /*! @brief Set the LVDRE field to a new value. */
11244 #define PMC_WR_LVDSC1_LVDRE(base, value) (PMC_RMW_LVDSC1(base, PMC_LVDSC1_LVDRE_MASK, PMC_LVDSC1_LVDRE(value)))
11245 #define PMC_BWR_LVDSC1_LVDRE(base, value) (BME_BFI8(&PMC_LVDSC1_REG(base), ((uint8_t)(value) << PMC_LVDSC1_LVDRE_SHIFT), PMC_LVDSC1_LVDRE_SHIFT, PMC_LVDSC1_LVDRE_WIDTH))
11246 /*@}*/
11247 
11248 /*!
11249  * @name Register PMC_LVDSC1, field LVDIE[5] (RW)
11250  *
11251  * Enables hardware interrupt requests for LVDF.
11252  *
11253  * Values:
11254  * - 0b0 - Hardware interrupt disabled (use polling)
11255  * - 0b1 - Request a hardware interrupt when LVDF = 1
11256  */
11257 /*@{*/
11258 /*! @brief Read current value of the PMC_LVDSC1_LVDIE field. */
11259 #define PMC_RD_LVDSC1_LVDIE(base) ((PMC_LVDSC1_REG(base) & PMC_LVDSC1_LVDIE_MASK) >> PMC_LVDSC1_LVDIE_SHIFT)
11260 #define PMC_BRD_LVDSC1_LVDIE(base) (BME_UBFX8(&PMC_LVDSC1_REG(base), PMC_LVDSC1_LVDIE_SHIFT, PMC_LVDSC1_LVDIE_WIDTH))
11261 
11262 /*! @brief Set the LVDIE field to a new value. */
11263 #define PMC_WR_LVDSC1_LVDIE(base, value) (PMC_RMW_LVDSC1(base, PMC_LVDSC1_LVDIE_MASK, PMC_LVDSC1_LVDIE(value)))
11264 #define PMC_BWR_LVDSC1_LVDIE(base, value) (BME_BFI8(&PMC_LVDSC1_REG(base), ((uint8_t)(value) << PMC_LVDSC1_LVDIE_SHIFT), PMC_LVDSC1_LVDIE_SHIFT, PMC_LVDSC1_LVDIE_WIDTH))
11265 /*@}*/
11266 
11267 /*!
11268  * @name Register PMC_LVDSC1, field LVDACK[6] (WORZ)
11269  *
11270  * This write-only bit is used to acknowledge low voltage detection errors.
11271  * Write 1 to clear LVDF. Reads always return 0.
11272  */
11273 /*@{*/
11274 /*! @brief Set the LVDACK field to a new value. */
11275 #define PMC_WR_LVDSC1_LVDACK(base, value) (PMC_RMW_LVDSC1(base, PMC_LVDSC1_LVDACK_MASK, PMC_LVDSC1_LVDACK(value)))
11276 #define PMC_BWR_LVDSC1_LVDACK(base, value) (BME_BFI8(&PMC_LVDSC1_REG(base), ((uint8_t)(value) << PMC_LVDSC1_LVDACK_SHIFT), PMC_LVDSC1_LVDACK_SHIFT, PMC_LVDSC1_LVDACK_WIDTH))
11277 /*@}*/
11278 
11279 /*!
11280  * @name Register PMC_LVDSC1, field LVDF[7] (RO)
11281  *
11282  * This read-only status bit indicates a low-voltage detect event.
11283  *
11284  * Values:
11285  * - 0b0 - Low-voltage event not detected
11286  * - 0b1 - Low-voltage event detected
11287  */
11288 /*@{*/
11289 /*! @brief Read current value of the PMC_LVDSC1_LVDF field. */
11290 #define PMC_RD_LVDSC1_LVDF(base) ((PMC_LVDSC1_REG(base) & PMC_LVDSC1_LVDF_MASK) >> PMC_LVDSC1_LVDF_SHIFT)
11291 #define PMC_BRD_LVDSC1_LVDF(base) (BME_UBFX8(&PMC_LVDSC1_REG(base), PMC_LVDSC1_LVDF_SHIFT, PMC_LVDSC1_LVDF_WIDTH))
11292 /*@}*/
11293 
11294 /*******************************************************************************
11295  * PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register
11296  ******************************************************************************/
11297 
11298 /*!
11299  * @brief PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register (RW)
11300  *
11301  * Reset value: 0x00U
11302  *
11303  * This register contains status and control bits to support the low voltage
11304  * warning function. While the device is in the very low power or low leakage modes,
11305  * the LVD system is disabled regardless of LVDSC2 settings. See the device's
11306  * data sheet for the exact LVD trip voltages. The LVW trip voltages depend on LVWV
11307  * and LVDV bits. The LVWV bits are reset solely on a POR Only event. The
11308  * register's other bits are reset on Chip Reset Not VLLS. For more information about
11309  * these reset types, refer to the Reset section details.
11310  */
11311 /*!
11312  * @name Constants and macros for entire PMC_LVDSC2 register
11313  */
11314 /*@{*/
11315 #define PMC_RD_LVDSC2(base) (PMC_LVDSC2_REG(base))
11316 #define PMC_WR_LVDSC2(base, value) (PMC_LVDSC2_REG(base) = (value))
11317 #define PMC_RMW_LVDSC2(base, mask, value) (PMC_WR_LVDSC2(base, (PMC_RD_LVDSC2(base) & ~(mask)) | (value)))
11318 #define PMC_SET_LVDSC2(base, value) (BME_OR8(&PMC_LVDSC2_REG(base), (uint8_t)(value)))
11319 #define PMC_CLR_LVDSC2(base, value) (BME_AND8(&PMC_LVDSC2_REG(base), (uint8_t)(~(value))))
11320 #define PMC_TOG_LVDSC2(base, value) (BME_XOR8(&PMC_LVDSC2_REG(base), (uint8_t)(value)))
11321 /*@}*/
11322 
11323 /*
11324  * Constants & macros for individual PMC_LVDSC2 bitfields
11325  */
11326 
11327 /*!
11328  * @name Register PMC_LVDSC2, field LVWV[1:0] (RW)
11329  *
11330  * Selects the LVW trip point voltage (VLVW). The actual voltage for the warning
11331  * depends on LVDSC1[LVDV].
11332  *
11333  * Values:
11334  * - 0b00 - Low trip point selected (VLVW = VLVW1)
11335  * - 0b01 - Mid 1 trip point selected (VLVW = VLVW2)
11336  * - 0b10 - Mid 2 trip point selected (VLVW = VLVW3)
11337  * - 0b11 - High trip point selected (VLVW = VLVW4)
11338  */
11339 /*@{*/
11340 /*! @brief Read current value of the PMC_LVDSC2_LVWV field. */
11341 #define PMC_RD_LVDSC2_LVWV(base) ((PMC_LVDSC2_REG(base) & PMC_LVDSC2_LVWV_MASK) >> PMC_LVDSC2_LVWV_SHIFT)
11342 #define PMC_BRD_LVDSC2_LVWV(base) (BME_UBFX8(&PMC_LVDSC2_REG(base), PMC_LVDSC2_LVWV_SHIFT, PMC_LVDSC2_LVWV_WIDTH))
11343 
11344 /*! @brief Set the LVWV field to a new value. */
11345 #define PMC_WR_LVDSC2_LVWV(base, value) (PMC_RMW_LVDSC2(base, PMC_LVDSC2_LVWV_MASK, PMC_LVDSC2_LVWV(value)))
11346 #define PMC_BWR_LVDSC2_LVWV(base, value) (BME_BFI8(&PMC_LVDSC2_REG(base), ((uint8_t)(value) << PMC_LVDSC2_LVWV_SHIFT), PMC_LVDSC2_LVWV_SHIFT, PMC_LVDSC2_LVWV_WIDTH))
11347 /*@}*/
11348 
11349 /*!
11350  * @name Register PMC_LVDSC2, field LVWIE[5] (RW)
11351  *
11352  * Enables hardware interrupt requests for LVWF.
11353  *
11354  * Values:
11355  * - 0b0 - Hardware interrupt disabled (use polling)
11356  * - 0b1 - Request a hardware interrupt when LVWF = 1
11357  */
11358 /*@{*/
11359 /*! @brief Read current value of the PMC_LVDSC2_LVWIE field. */
11360 #define PMC_RD_LVDSC2_LVWIE(base) ((PMC_LVDSC2_REG(base) & PMC_LVDSC2_LVWIE_MASK) >> PMC_LVDSC2_LVWIE_SHIFT)
11361 #define PMC_BRD_LVDSC2_LVWIE(base) (BME_UBFX8(&PMC_LVDSC2_REG(base), PMC_LVDSC2_LVWIE_SHIFT, PMC_LVDSC2_LVWIE_WIDTH))
11362 
11363 /*! @brief Set the LVWIE field to a new value. */
11364 #define PMC_WR_LVDSC2_LVWIE(base, value) (PMC_RMW_LVDSC2(base, PMC_LVDSC2_LVWIE_MASK, PMC_LVDSC2_LVWIE(value)))
11365 #define PMC_BWR_LVDSC2_LVWIE(base, value) (BME_BFI8(&PMC_LVDSC2_REG(base), ((uint8_t)(value) << PMC_LVDSC2_LVWIE_SHIFT), PMC_LVDSC2_LVWIE_SHIFT, PMC_LVDSC2_LVWIE_WIDTH))
11366 /*@}*/
11367 
11368 /*!
11369  * @name Register PMC_LVDSC2, field LVWACK[6] (WORZ)
11370  *
11371  * This write-only bit is used to acknowledge low voltage warning errors. Write
11372  * 1 to clear LVWF. Reads always return 0.
11373  */
11374 /*@{*/
11375 /*! @brief Set the LVWACK field to a new value. */
11376 #define PMC_WR_LVDSC2_LVWACK(base, value) (PMC_RMW_LVDSC2(base, PMC_LVDSC2_LVWACK_MASK, PMC_LVDSC2_LVWACK(value)))
11377 #define PMC_BWR_LVDSC2_LVWACK(base, value) (BME_BFI8(&PMC_LVDSC2_REG(base), ((uint8_t)(value) << PMC_LVDSC2_LVWACK_SHIFT), PMC_LVDSC2_LVWACK_SHIFT, PMC_LVDSC2_LVWACK_WIDTH))
11378 /*@}*/
11379 
11380 /*!
11381  * @name Register PMC_LVDSC2, field LVWF[7] (RO)
11382  *
11383  * This read-only status bit indicates a low-voltage warning event. LVWF is set
11384  * when VSupply transitions below the trip point, or after reset and VSupply is
11385  * already below VLVW. LVWF bit may be 1 after power on reset, therefore, to use
11386  * LVW interrupt function, before enabling LVWIE, LVWF must be cleared by writing
11387  * LVWACK first.
11388  *
11389  * Values:
11390  * - 0b0 - Low-voltage warning event not detected
11391  * - 0b1 - Low-voltage warning event detected
11392  */
11393 /*@{*/
11394 /*! @brief Read current value of the PMC_LVDSC2_LVWF field. */
11395 #define PMC_RD_LVDSC2_LVWF(base) ((PMC_LVDSC2_REG(base) & PMC_LVDSC2_LVWF_MASK) >> PMC_LVDSC2_LVWF_SHIFT)
11396 #define PMC_BRD_LVDSC2_LVWF(base) (BME_UBFX8(&PMC_LVDSC2_REG(base), PMC_LVDSC2_LVWF_SHIFT, PMC_LVDSC2_LVWF_WIDTH))
11397 /*@}*/
11398 
11399 /*******************************************************************************
11400  * PMC_REGSC - Regulator Status And Control register
11401  ******************************************************************************/
11402 
11403 /*!
11404  * @brief PMC_REGSC - Regulator Status And Control register (RW)
11405  *
11406  * Reset value: 0x04U
11407  *
11408  * The PMC contains an internal voltage regulator. The voltage regulator design
11409  * uses a bandgap reference that is also available through a buffer as input to
11410  * certain internal peripherals, such as the CMP and ADC. The internal regulator
11411  * provides a status bit (REGONS) indicating the regulator is in run regulation.
11412  * This register is reset on Chip Reset Not VLLS and by reset types that trigger
11413  * Chip Reset not VLLS. See the Reset section for more information.
11414  */
11415 /*!
11416  * @name Constants and macros for entire PMC_REGSC register
11417  */
11418 /*@{*/
11419 #define PMC_RD_REGSC(base) (PMC_REGSC_REG(base))
11420 #define PMC_WR_REGSC(base, value) (PMC_REGSC_REG(base) = (value))
11421 #define PMC_RMW_REGSC(base, mask, value) (PMC_WR_REGSC(base, (PMC_RD_REGSC(base) & ~(mask)) | (value)))
11422 #define PMC_SET_REGSC(base, value) (BME_OR8(&PMC_REGSC_REG(base), (uint8_t)(value)))
11423 #define PMC_CLR_REGSC(base, value) (BME_AND8(&PMC_REGSC_REG(base), (uint8_t)(~(value))))
11424 #define PMC_TOG_REGSC(base, value) (BME_XOR8(&PMC_REGSC_REG(base), (uint8_t)(value)))
11425 /*@}*/
11426 
11427 /*
11428  * Constants & macros for individual PMC_REGSC bitfields
11429  */
11430 
11431 /*!
11432  * @name Register PMC_REGSC, field BGBE[0] (RW)
11433  *
11434  * Enables the bandgap buffer.
11435  *
11436  * Values:
11437  * - 0b0 - Bandgap buffer not enabled
11438  * - 0b1 - Bandgap buffer enabled
11439  */
11440 /*@{*/
11441 /*! @brief Read current value of the PMC_REGSC_BGBE field. */
11442 #define PMC_RD_REGSC_BGBE(base) ((PMC_REGSC_REG(base) & PMC_REGSC_BGBE_MASK) >> PMC_REGSC_BGBE_SHIFT)
11443 #define PMC_BRD_REGSC_BGBE(base) (BME_UBFX8(&PMC_REGSC_REG(base), PMC_REGSC_BGBE_SHIFT, PMC_REGSC_BGBE_WIDTH))
11444 
11445 /*! @brief Set the BGBE field to a new value. */
11446 #define PMC_WR_REGSC_BGBE(base, value) (PMC_RMW_REGSC(base, (PMC_REGSC_BGBE_MASK | PMC_REGSC_ACKISO_MASK), PMC_REGSC_BGBE(value)))
11447 #define PMC_BWR_REGSC_BGBE(base, value) (BME_BFI8(&PMC_REGSC_REG(base), ((uint8_t)(value) << PMC_REGSC_BGBE_SHIFT), PMC_REGSC_BGBE_SHIFT, PMC_REGSC_BGBE_WIDTH))
11448 /*@}*/
11449 
11450 /*!
11451  * @name Register PMC_REGSC, field REGONS[2] (RO)
11452  *
11453  * This read-only bit provides the current status of the internal voltage
11454  * regulator.
11455  *
11456  * Values:
11457  * - 0b0 - Regulator is in stop regulation or in transition to/from it
11458  * - 0b1 - Regulator is in run regulation
11459  */
11460 /*@{*/
11461 /*! @brief Read current value of the PMC_REGSC_REGONS field. */
11462 #define PMC_RD_REGSC_REGONS(base) ((PMC_REGSC_REG(base) & PMC_REGSC_REGONS_MASK) >> PMC_REGSC_REGONS_SHIFT)
11463 #define PMC_BRD_REGSC_REGONS(base) (BME_UBFX8(&PMC_REGSC_REG(base), PMC_REGSC_REGONS_SHIFT, PMC_REGSC_REGONS_WIDTH))
11464 /*@}*/
11465 
11466 /*!
11467  * @name Register PMC_REGSC, field ACKISO[3] (W1C)
11468  *
11469  * Reading this bit indicates whether certain peripherals and the I/O pads are
11470  * in a latched state as a result of having been in a VLLS mode. Writing one to
11471  * this bit when it is set releases the I/O pads and certain peripherals to their
11472  * normal run mode state. After recovering from a VLLS mode, user should restore
11473  * chip configuration before clearing ACKISO. In particular, pin configuration for
11474  * enabled LLWU wakeup pins should be restored to avoid any LLWU flag from being
11475  * falsely set when ACKISO is cleared.
11476  *
11477  * Values:
11478  * - 0b0 - Peripherals and I/O pads are in normal run state
11479  * - 0b1 - Certain peripherals and I/O pads are in an isolated and latched state
11480  */
11481 /*@{*/
11482 /*! @brief Read current value of the PMC_REGSC_ACKISO field. */
11483 #define PMC_RD_REGSC_ACKISO(base) ((PMC_REGSC_REG(base) & PMC_REGSC_ACKISO_MASK) >> PMC_REGSC_ACKISO_SHIFT)
11484 #define PMC_BRD_REGSC_ACKISO(base) (BME_UBFX8(&PMC_REGSC_REG(base), PMC_REGSC_ACKISO_SHIFT, PMC_REGSC_ACKISO_WIDTH))
11485 
11486 /*! @brief Set the ACKISO field to a new value. */
11487 #define PMC_WR_REGSC_ACKISO(base, value) (PMC_RMW_REGSC(base, PMC_REGSC_ACKISO_MASK, PMC_REGSC_ACKISO(value)))
11488 #define PMC_BWR_REGSC_ACKISO(base, value) (BME_BFI8(&PMC_REGSC_REG(base), ((uint8_t)(value) << PMC_REGSC_ACKISO_SHIFT), PMC_REGSC_ACKISO_SHIFT, PMC_REGSC_ACKISO_WIDTH))
11489 /*@}*/
11490 
11491 /*!
11492  * @name Register PMC_REGSC, field BGEN[4] (RW)
11493  *
11494  * BGEN controls whether the bandgap is enabled in lower power modes of
11495  * operation (VLPx, LLS, and VLLSx). When on-chip peripherals require the bandgap voltage
11496  * reference in low power modes of operation, set BGEN to continue to enable the
11497  * bandgap operation. When the bandgap voltage reference is not needed in low
11498  * power modes, clear BGEN to avoid excess power consumption.
11499  *
11500  * Values:
11501  * - 0b0 - Bandgap voltage reference is disabled in VLPx , LLS , and VLLSx modes
11502  * - 0b1 - Bandgap voltage reference is enabled in VLPx , LLS , and VLLSx modes
11503  */
11504 /*@{*/
11505 /*! @brief Read current value of the PMC_REGSC_BGEN field. */
11506 #define PMC_RD_REGSC_BGEN(base) ((PMC_REGSC_REG(base) & PMC_REGSC_BGEN_MASK) >> PMC_REGSC_BGEN_SHIFT)
11507 #define PMC_BRD_REGSC_BGEN(base) (BME_UBFX8(&PMC_REGSC_REG(base), PMC_REGSC_BGEN_SHIFT, PMC_REGSC_BGEN_WIDTH))
11508 
11509 /*! @brief Set the BGEN field to a new value. */
11510 #define PMC_WR_REGSC_BGEN(base, value) (PMC_RMW_REGSC(base, (PMC_REGSC_BGEN_MASK | PMC_REGSC_ACKISO_MASK), PMC_REGSC_BGEN(value)))
11511 #define PMC_BWR_REGSC_BGEN(base, value) (BME_BFI8(&PMC_REGSC_REG(base), ((uint8_t)(value) << PMC_REGSC_BGEN_SHIFT), PMC_REGSC_BGEN_SHIFT, PMC_REGSC_BGEN_WIDTH))
11512 /*@}*/
11513 
11514 /*
11515  * MKL25Z4 PORT
11516  *
11517  * Pin Control and Interrupts
11518  *
11519  * Registers defined in this header file:
11520  * - PORT_PCR - Pin Control Register n
11521  * - PORT_GPCLR - Global Pin Control Low Register
11522  * - PORT_GPCHR - Global Pin Control High Register
11523  * - PORT_ISFR - Interrupt Status Flag Register
11524  */
11525 
11526 #define PORT_INSTANCE_COUNT (5U) /*!< Number of instances of the PORT module. */
11527 #define PORTA_IDX (0U) /*!< Instance number for PORTA. */
11528 #define PORTB_IDX (1U) /*!< Instance number for PORTB. */
11529 #define PORTC_IDX (2U) /*!< Instance number for PORTC. */
11530 #define PORTD_IDX (3U) /*!< Instance number for PORTD. */
11531 #define PORTE_IDX (4U) /*!< Instance number for PORTE. */
11532 
11533 /*******************************************************************************
11534  * PORT_PCR - Pin Control Register n
11535  ******************************************************************************/
11536 
11537 /*!
11538  * @brief PORT_PCR - Pin Control Register n (RW)
11539  *
11540  * Reset value: 0x00000706U
11541  *
11542  * Refer to the Signal Multiplexing and Signal Descriptions chapter for the
11543  * reset value of this device. See the GPIO Configuration section for details on the
11544  * available functions for each pin. Do not modify pin configuration registers
11545  * associated with pins not available in your selected package. All un-bonded pins
11546  * not available in your package will default to DISABLE state for lowest power
11547  * consumption.
11548  */
11549 /*!
11550  * @name Constants and macros for entire PORT_PCR register
11551  */
11552 /*@{*/
11553 #define PORT_RD_PCR(base, index) (PORT_PCR_REG(base, index))
11554 #define PORT_WR_PCR(base, index, value) (PORT_PCR_REG(base, index) = (value))
11555 #define PORT_RMW_PCR(base, index, mask, value) (PORT_WR_PCR(base, index, (PORT_RD_PCR(base, index) & ~(mask)) | (value)))
11556 #define PORT_SET_PCR(base, index, value) (BME_OR32(&PORT_PCR_REG(base, index), (uint32_t)(value)))
11557 #define PORT_CLR_PCR(base, index, value) (BME_AND32(&PORT_PCR_REG(base, index), (uint32_t)(~(value))))
11558 #define PORT_TOG_PCR(base, index, value) (BME_XOR32(&PORT_PCR_REG(base, index), (uint32_t)(value)))
11559 /*@}*/
11560 
11561 /*
11562  * Constants & macros for individual PORT_PCR bitfields
11563  */
11564 
11565 /*!
11566  * @name Register PORT_PCR, field PS[0] (RW)
11567  *
11568  * This bit is read only for pins that do not support a configurable pull
11569  * resistor direction. Pull configuration is valid in all digital pin muxing modes.
11570  *
11571  * Values:
11572  * - 0b0 - Internal pulldown resistor is enabled on the corresponding pin, if
11573  * the corresponding Port Pull Enable field is set.
11574  * - 0b1 - Internal pullup resistor is enabled on the corresponding pin, if the
11575  * corresponding Port Pull Enable field is set.
11576  */
11577 /*@{*/
11578 /*! @brief Read current value of the PORT_PCR_PS field. */
11579 #define PORT_RD_PCR_PS(base, index) ((PORT_PCR_REG(base, index) & PORT_PCR_PS_MASK) >> PORT_PCR_PS_SHIFT)
11580 #define PORT_BRD_PCR_PS(base, index) (BME_UBFX32(&PORT_PCR_REG(base, index), PORT_PCR_PS_SHIFT, PORT_PCR_PS_WIDTH))
11581 
11582 /*! @brief Set the PS field to a new value. */
11583 #define PORT_WR_PCR_PS(base, index, value) (PORT_RMW_PCR(base, index, (PORT_PCR_PS_MASK | PORT_PCR_ISF_MASK), PORT_PCR_PS(value)))
11584 #define PORT_BWR_PCR_PS(base, index, value) (BME_BFI32(&PORT_PCR_REG(base, index), ((uint32_t)(value) << PORT_PCR_PS_SHIFT), PORT_PCR_PS_SHIFT, PORT_PCR_PS_WIDTH))
11585 /*@}*/
11586 
11587 /*!
11588  * @name Register PORT_PCR, field PE[1] (RW)
11589  *
11590  * This bit is read only for pins that do not support a configurable pull
11591  * resistor. Refer to the Chapter of Signal Multiplexing and Signal Descriptions for
11592  * the pins that support a configurable pull resistor. Pull configuration is valid
11593  * in all digital pin muxing modes.
11594  *
11595  * Values:
11596  * - 0b0 - Internal pullup or pulldown resistor is not enabled on the
11597  * corresponding pin.
11598  * - 0b1 - Internal pullup or pulldown resistor is enabled on the corresponding
11599  * pin, if the pin is configured as a digital input.
11600  */
11601 /*@{*/
11602 /*! @brief Read current value of the PORT_PCR_PE field. */
11603 #define PORT_RD_PCR_PE(base, index) ((PORT_PCR_REG(base, index) & PORT_PCR_PE_MASK) >> PORT_PCR_PE_SHIFT)
11604 #define PORT_BRD_PCR_PE(base, index) (BME_UBFX32(&PORT_PCR_REG(base, index), PORT_PCR_PE_SHIFT, PORT_PCR_PE_WIDTH))
11605 
11606 /*! @brief Set the PE field to a new value. */
11607 #define PORT_WR_PCR_PE(base, index, value) (PORT_RMW_PCR(base, index, (PORT_PCR_PE_MASK | PORT_PCR_ISF_MASK), PORT_PCR_PE(value)))
11608 #define PORT_BWR_PCR_PE(base, index, value) (BME_BFI32(&PORT_PCR_REG(base, index), ((uint32_t)(value) << PORT_PCR_PE_SHIFT), PORT_PCR_PE_SHIFT, PORT_PCR_PE_WIDTH))
11609 /*@}*/
11610 
11611 /*!
11612  * @name Register PORT_PCR, field SRE[2] (RW)
11613  *
11614  * This bit is read only for pins that do not support a configurable slew rate.
11615  * Slew rate configuration is valid in all digital pin muxing modes.
11616  *
11617  * Values:
11618  * - 0b0 - Fast slew rate is configured on the corresponding pin, if the pin is
11619  * configured as a digital output.
11620  * - 0b1 - Slow slew rate is configured on the corresponding pin, if the pin is
11621  * configured as a digital output.
11622  */
11623 /*@{*/
11624 /*! @brief Read current value of the PORT_PCR_SRE field. */
11625 #define PORT_RD_PCR_SRE(base, index) ((PORT_PCR_REG(base, index) & PORT_PCR_SRE_MASK) >> PORT_PCR_SRE_SHIFT)
11626 #define PORT_BRD_PCR_SRE(base, index) (BME_UBFX32(&PORT_PCR_REG(base, index), PORT_PCR_SRE_SHIFT, PORT_PCR_SRE_WIDTH))
11627 
11628 /*! @brief Set the SRE field to a new value. */
11629 #define PORT_WR_PCR_SRE(base, index, value) (PORT_RMW_PCR(base, index, (PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK), PORT_PCR_SRE(value)))
11630 #define PORT_BWR_PCR_SRE(base, index, value) (BME_BFI32(&PORT_PCR_REG(base, index), ((uint32_t)(value) << PORT_PCR_SRE_SHIFT), PORT_PCR_SRE_SHIFT, PORT_PCR_SRE_WIDTH))
11631 /*@}*/
11632 
11633 /*!
11634  * @name Register PORT_PCR, field PFE[4] (RW)
11635  *
11636  * This bit is read only for pins that do not support a configurable passive
11637  * input filter. Passive filter configuration is valid in all digital pin muxing
11638  * modes.
11639  *
11640  * Values:
11641  * - 0b0 - Passive input filter is disabled on the corresponding pin.
11642  * - 0b1 - Passive input filter is enabled on the corresponding pin, if the pin
11643  * is configured as a digital input. Refer to the device data sheet for
11644  * filter characteristics.
11645  */
11646 /*@{*/
11647 /*! @brief Read current value of the PORT_PCR_PFE field. */
11648 #define PORT_RD_PCR_PFE(base, index) ((PORT_PCR_REG(base, index) & PORT_PCR_PFE_MASK) >> PORT_PCR_PFE_SHIFT)
11649 #define PORT_BRD_PCR_PFE(base, index) (BME_UBFX32(&PORT_PCR_REG(base, index), PORT_PCR_PFE_SHIFT, PORT_PCR_PFE_WIDTH))
11650 
11651 /*! @brief Set the PFE field to a new value. */
11652 #define PORT_WR_PCR_PFE(base, index, value) (PORT_RMW_PCR(base, index, (PORT_PCR_PFE_MASK | PORT_PCR_ISF_MASK), PORT_PCR_PFE(value)))
11653 #define PORT_BWR_PCR_PFE(base, index, value) (BME_BFI32(&PORT_PCR_REG(base, index), ((uint32_t)(value) << PORT_PCR_PFE_SHIFT), PORT_PCR_PFE_SHIFT, PORT_PCR_PFE_WIDTH))
11654 /*@}*/
11655 
11656 /*!
11657  * @name Register PORT_PCR, field DSE[6] (RW)
11658  *
11659  * This bit is read only for pins that do not support a configurable drive
11660  * strength. Drive strength configuration is valid in all digital pin muxing modes.
11661  *
11662  * Values:
11663  * - 0b0 - Low drive strength is configured on the corresponding pin, if pin is
11664  * configured as a digital output.
11665  * - 0b1 - High drive strength is configured on the corresponding pin, if pin is
11666  * configured as a digital output.
11667  */
11668 /*@{*/
11669 /*! @brief Read current value of the PORT_PCR_DSE field. */
11670 #define PORT_RD_PCR_DSE(base, index) ((PORT_PCR_REG(base, index) & PORT_PCR_DSE_MASK) >> PORT_PCR_DSE_SHIFT)
11671 #define PORT_BRD_PCR_DSE(base, index) (BME_UBFX32(&PORT_PCR_REG(base, index), PORT_PCR_DSE_SHIFT, PORT_PCR_DSE_WIDTH))
11672 
11673 /*! @brief Set the DSE field to a new value. */
11674 #define PORT_WR_PCR_DSE(base, index, value) (PORT_RMW_PCR(base, index, (PORT_PCR_DSE_MASK | PORT_PCR_ISF_MASK), PORT_PCR_DSE(value)))
11675 #define PORT_BWR_PCR_DSE(base, index, value) (BME_BFI32(&PORT_PCR_REG(base, index), ((uint32_t)(value) << PORT_PCR_DSE_SHIFT), PORT_PCR_DSE_SHIFT, PORT_PCR_DSE_WIDTH))
11676 /*@}*/
11677 
11678 /*!
11679  * @name Register PORT_PCR, field MUX[10:8] (RW)
11680  *
11681  * Not all pins support all pin muxing slots. Unimplemented pin muxing slots are
11682  * reserved and may result in configuring the pin for a different pin muxing
11683  * slot. The corresponding pin is configured in the following pin muxing slot as
11684  * follows:
11685  *
11686  * Values:
11687  * - 0b000 - Pin disabled (analog).
11688  * - 0b001 - Alternative 1 (GPIO).
11689  * - 0b010 - Alternative 2 (chip-specific).
11690  * - 0b011 - Alternative 3 (chip-specific).
11691  * - 0b100 - Alternative 4 (chip-specific).
11692  * - 0b101 - Alternative 5 (chip-specific).
11693  * - 0b110 - Alternative 6 (chip-specific).
11694  * - 0b111 - Alternative 7 (chip-specific).
11695  */
11696 /*@{*/
11697 /*! @brief Read current value of the PORT_PCR_MUX field. */
11698 #define PORT_RD_PCR_MUX(base, index) ((PORT_PCR_REG(base, index) & PORT_PCR_MUX_MASK) >> PORT_PCR_MUX_SHIFT)
11699 #define PORT_BRD_PCR_MUX(base, index) (BME_UBFX32(&PORT_PCR_REG(base, index), PORT_PCR_MUX_SHIFT, PORT_PCR_MUX_WIDTH))
11700 
11701 /*! @brief Set the MUX field to a new value. */
11702 #define PORT_WR_PCR_MUX(base, index, value) (PORT_RMW_PCR(base, index, (PORT_PCR_MUX_MASK | PORT_PCR_ISF_MASK), PORT_PCR_MUX(value)))
11703 #define PORT_BWR_PCR_MUX(base, index, value) (BME_BFI32(&PORT_PCR_REG(base, index), ((uint32_t)(value) << PORT_PCR_MUX_SHIFT), PORT_PCR_MUX_SHIFT, PORT_PCR_MUX_WIDTH))
11704 /*@}*/
11705 
11706 /*!
11707  * @name Register PORT_PCR, field IRQC[19:16] (RW)
11708  *
11709  * This field is read only for pins that do not support interrupt generation.
11710  * The pin interrupt configuration is valid in all digital pin muxing modes. The
11711  * corresponding pin is configured to generate interrupt/DMA request as follows:
11712  *
11713  * Values:
11714  * - 0b0000 - Interrupt/DMA request disabled.
11715  * - 0b0001 - DMA request on rising edge.
11716  * - 0b0010 - DMA request on falling edge.
11717  * - 0b0011 - DMA request on either edge.
11718  * - 0b1000 - Interrupt when logic zero.
11719  * - 0b1001 - Interrupt on rising edge.
11720  * - 0b1010 - Interrupt on falling edge.
11721  * - 0b1011 - Interrupt on either edge.
11722  * - 0b1100 - Interrupt when logic one.
11723  */
11724 /*@{*/
11725 /*! @brief Read current value of the PORT_PCR_IRQC field. */
11726 #define PORT_RD_PCR_IRQC(base, index) ((PORT_PCR_REG(base, index) & PORT_PCR_IRQC_MASK) >> PORT_PCR_IRQC_SHIFT)
11727 #define PORT_BRD_PCR_IRQC(base, index) (BME_UBFX32(&PORT_PCR_REG(base, index), PORT_PCR_IRQC_SHIFT, PORT_PCR_IRQC_WIDTH))
11728 
11729 /*! @brief Set the IRQC field to a new value. */
11730 #define PORT_WR_PCR_IRQC(base, index, value) (PORT_RMW_PCR(base, index, (PORT_PCR_IRQC_MASK | PORT_PCR_ISF_MASK), PORT_PCR_IRQC(value)))
11731 #define PORT_BWR_PCR_IRQC(base, index, value) (BME_BFI32(&PORT_PCR_REG(base, index), ((uint32_t)(value) << PORT_PCR_IRQC_SHIFT), PORT_PCR_IRQC_SHIFT, PORT_PCR_IRQC_WIDTH))
11732 /*@}*/
11733 
11734 /*!
11735  * @name Register PORT_PCR, field ISF[24] (W1C)
11736  *
11737  * This bit is read only for pins that do not support interrupt generation. The
11738  * pin interrupt configuration is valid in all digital pin muxing modes.
11739  *
11740  * Values:
11741  * - 0b0 - Configured interrupt is not detected.
11742  * - 0b1 - Configured interrupt is detected. If the pin is configured to
11743  * generate a DMA request, then the corresponding flag will be cleared automatically
11744  * at the completion of the requested DMA transfer. Otherwise, the flag
11745  * remains set until a logic one is written to the flag. If the pin is configured
11746  * for a level sensitive interrupt and the pin remains asserted, then the
11747  * flag is set again immediately after it is cleared.
11748  */
11749 /*@{*/
11750 /*! @brief Read current value of the PORT_PCR_ISF field. */
11751 #define PORT_RD_PCR_ISF(base, index) ((PORT_PCR_REG(base, index) & PORT_PCR_ISF_MASK) >> PORT_PCR_ISF_SHIFT)
11752 #define PORT_BRD_PCR_ISF(base, index) (BME_UBFX32(&PORT_PCR_REG(base, index), PORT_PCR_ISF_SHIFT, PORT_PCR_ISF_WIDTH))
11753 
11754 /*! @brief Set the ISF field to a new value. */
11755 #define PORT_WR_PCR_ISF(base, index, value) (PORT_RMW_PCR(base, index, PORT_PCR_ISF_MASK, PORT_PCR_ISF(value)))
11756 #define PORT_BWR_PCR_ISF(base, index, value) (BME_BFI32(&PORT_PCR_REG(base, index), ((uint32_t)(value) << PORT_PCR_ISF_SHIFT), PORT_PCR_ISF_SHIFT, PORT_PCR_ISF_WIDTH))
11757 /*@}*/
11758 
11759 /*******************************************************************************
11760  * PORT_GPCLR - Global Pin Control Low Register
11761  ******************************************************************************/
11762 
11763 /*!
11764  * @brief PORT_GPCLR - Global Pin Control Low Register (WORZ)
11765  *
11766  * Reset value: 0x00000000U
11767  *
11768  * Only 32-bit writes are supported to this register.
11769  */
11770 /*!
11771  * @name Constants and macros for entire PORT_GPCLR register
11772  */
11773 /*@{*/
11774 #define PORT_RD_GPCLR(base) (PORT_GPCLR_REG(base))
11775 #define PORT_WR_GPCLR(base, value) (PORT_GPCLR_REG(base) = (value))
11776 #define PORT_RMW_GPCLR(base, mask, value) (PORT_WR_GPCLR(base, (PORT_RD_GPCLR(base) & ~(mask)) | (value)))
11777 /*@}*/
11778 
11779 /*
11780  * Constants & macros for individual PORT_GPCLR bitfields
11781  */
11782 
11783 /*!
11784  * @name Register PORT_GPCLR, field GPWD[15:0] (WORZ)
11785  *
11786  * Write value that is written to all Pin Control Registers bits [15:0] that are
11787  * selected by GPWE.
11788  */
11789 /*@{*/
11790 /*! @brief Set the GPWD field to a new value. */
11791 #define PORT_WR_GPCLR_GPWD(base, value) (PORT_RMW_GPCLR(base, PORT_GPCLR_GPWD_MASK, PORT_GPCLR_GPWD(value)))
11792 #define PORT_BWR_GPCLR_GPWD(base, value) (BME_BFI32(&PORT_GPCLR_REG(base), ((uint32_t)(value) << PORT_GPCLR_GPWD_SHIFT), PORT_GPCLR_GPWD_SHIFT, PORT_GPCLR_GPWD_WIDTH))
11793 /*@}*/
11794 
11795 /*!
11796  * @name Register PORT_GPCLR, field GPWE[31:16] (WORZ)
11797  *
11798  * Selects which Pin Control Registers (15 through 0) bits [15:0] update with
11799  * the value in GPWD.
11800  *
11801  * Values:
11802  * - 0b0000000000000000 - Corresponding Pin Control Register is not updated with
11803  * the value in GPWD.
11804  * - 0b0000000000000001 - Corresponding Pin Control Register is updated with the
11805  * value in GPWD.
11806  */
11807 /*@{*/
11808 /*! @brief Set the GPWE field to a new value. */
11809 #define PORT_WR_GPCLR_GPWE(base, value) (PORT_RMW_GPCLR(base, PORT_GPCLR_GPWE_MASK, PORT_GPCLR_GPWE(value)))
11810 #define PORT_BWR_GPCLR_GPWE(base, value) (BME_BFI32(&PORT_GPCLR_REG(base), ((uint32_t)(value) << PORT_GPCLR_GPWE_SHIFT), PORT_GPCLR_GPWE_SHIFT, PORT_GPCLR_GPWE_WIDTH))
11811 /*@}*/
11812 
11813 /*******************************************************************************
11814  * PORT_GPCHR - Global Pin Control High Register
11815  ******************************************************************************/
11816 
11817 /*!
11818  * @brief PORT_GPCHR - Global Pin Control High Register (WORZ)
11819  *
11820  * Reset value: 0x00000000U
11821  *
11822  * Only 32-bit writes are supported to this register.
11823  */
11824 /*!
11825  * @name Constants and macros for entire PORT_GPCHR register
11826  */
11827 /*@{*/
11828 #define PORT_RD_GPCHR(base) (PORT_GPCHR_REG(base))
11829 #define PORT_WR_GPCHR(base, value) (PORT_GPCHR_REG(base) = (value))
11830 #define PORT_RMW_GPCHR(base, mask, value) (PORT_WR_GPCHR(base, (PORT_RD_GPCHR(base) & ~(mask)) | (value)))
11831 /*@}*/
11832 
11833 /*
11834  * Constants & macros for individual PORT_GPCHR bitfields
11835  */
11836 
11837 /*!
11838  * @name Register PORT_GPCHR, field GPWD[15:0] (WORZ)
11839  *
11840  * Write value that is written to all Pin Control Registers bits [15:0] that are
11841  * selected by GPWE.
11842  */
11843 /*@{*/
11844 /*! @brief Set the GPWD field to a new value. */
11845 #define PORT_WR_GPCHR_GPWD(base, value) (PORT_RMW_GPCHR(base, PORT_GPCHR_GPWD_MASK, PORT_GPCHR_GPWD(value)))
11846 #define PORT_BWR_GPCHR_GPWD(base, value) (BME_BFI32(&PORT_GPCHR_REG(base), ((uint32_t)(value) << PORT_GPCHR_GPWD_SHIFT), PORT_GPCHR_GPWD_SHIFT, PORT_GPCHR_GPWD_WIDTH))
11847 /*@}*/
11848 
11849 /*!
11850  * @name Register PORT_GPCHR, field GPWE[31:16] (WORZ)
11851  *
11852  * Selects which Pin Control Registers (31 through 16) bits [15:0] update with
11853  * the value in GPWD.
11854  *
11855  * Values:
11856  * - 0b0000000000000000 - Corresponding Pin Control Register is not updated with
11857  * the value in GPWD.
11858  * - 0b0000000000000001 - Corresponding Pin Control Register is updated with the
11859  * value in GPWD.
11860  */
11861 /*@{*/
11862 /*! @brief Set the GPWE field to a new value. */
11863 #define PORT_WR_GPCHR_GPWE(base, value) (PORT_RMW_GPCHR(base, PORT_GPCHR_GPWE_MASK, PORT_GPCHR_GPWE(value)))
11864 #define PORT_BWR_GPCHR_GPWE(base, value) (BME_BFI32(&PORT_GPCHR_REG(base), ((uint32_t)(value) << PORT_GPCHR_GPWE_SHIFT), PORT_GPCHR_GPWE_SHIFT, PORT_GPCHR_GPWE_WIDTH))
11865 /*@}*/
11866 
11867 /*******************************************************************************
11868  * PORT_ISFR - Interrupt Status Flag Register
11869  ******************************************************************************/
11870 
11871 /*!
11872  * @brief PORT_ISFR - Interrupt Status Flag Register (W1C)
11873  *
11874  * Reset value: 0x00000000U
11875  *
11876  * The corresponding bit is read only for pins that do not support interrupt
11877  * generation. The pin interrupt configuration is valid in all digital pin muxing
11878  * modes. The Interrupt Status Flag for each pin is also visible in the
11879  * corresponding Pin Control Register, and each flag can be cleared in either location.
11880  */
11881 /*!
11882  * @name Constants and macros for entire PORT_ISFR register
11883  */
11884 /*@{*/
11885 #define PORT_RD_ISFR(base) (PORT_ISFR_REG(base))
11886 #define PORT_WR_ISFR(base, value) (PORT_ISFR_REG(base) = (value))
11887 #define PORT_RMW_ISFR(base, mask, value) (PORT_WR_ISFR(base, (PORT_RD_ISFR(base) & ~(mask)) | (value)))
11888 #define PORT_SET_ISFR(base, value) (BME_OR32(&PORT_ISFR_REG(base), (uint32_t)(value)))
11889 #define PORT_CLR_ISFR(base, value) (BME_AND32(&PORT_ISFR_REG(base), (uint32_t)(~(value))))
11890 #define PORT_TOG_ISFR(base, value) (BME_XOR32(&PORT_ISFR_REG(base), (uint32_t)(value)))
11891 /*@}*/
11892 
11893 /*
11894  * MKL25Z4 RCM
11895  *
11896  * Reset Control Module
11897  *
11898  * Registers defined in this header file:
11899  * - RCM_SRS0 - System Reset Status Register 0
11900  * - RCM_SRS1 - System Reset Status Register 1
11901  * - RCM_RPFC - Reset Pin Filter Control register
11902  * - RCM_RPFW - Reset Pin Filter Width register
11903  */
11904 
11905 #define RCM_INSTANCE_COUNT (1U) /*!< Number of instances of the RCM module. */
11906 #define RCM_IDX (0U) /*!< Instance number for RCM. */
11907 
11908 /*******************************************************************************
11909  * RCM_SRS0 - System Reset Status Register 0
11910  ******************************************************************************/
11911 
11912 /*!
11913  * @brief RCM_SRS0 - System Reset Status Register 0 (RO)
11914  *
11915  * Reset value: 0x82U
11916  *
11917  * This register includes read-only status flags to indicate the source of the
11918  * most recent reset. The reset state of these bits depends on what caused the MCU
11919  * to reset. The reset value of this register depends on the reset source: POR
11920  * (including LVD) - 0x82 LVD (without POR) - 0x02 VLLS mode wakeup due to RESET
11921  * pin assertion - 0x41 VLLS mode wakeup due to other wakeup sources - 0x01 Other
11922  * reset - a bit is set if its corresponding reset source caused the reset
11923  */
11924 /*!
11925  * @name Constants and macros for entire RCM_SRS0 register
11926  */
11927 /*@{*/
11928 #define RCM_RD_SRS0(base) (RCM_SRS0_REG(base))
11929 /*@}*/
11930 
11931 /*
11932  * Constants & macros for individual RCM_SRS0 bitfields
11933  */
11934 
11935 /*!
11936  * @name Register RCM_SRS0, field WAKEUP[0] (RO)
11937  *
11938  * Indicates a reset has been caused by an enabled LLWU module wakeup source
11939  * while the chip was in a low leakage mode. In LLS mode, the RESET pin is the only
11940  * wakeup source that can cause this reset. Any enabled wakeup source in a VLLSx
11941  * mode causes a reset. This bit is cleared by any reset except WAKEUP.
11942  *
11943  * Values:
11944  * - 0b0 - Reset not caused by LLWU module wakeup source
11945  * - 0b1 - Reset caused by LLWU module wakeup source
11946  */
11947 /*@{*/
11948 /*! @brief Read current value of the RCM_SRS0_WAKEUP field. */
11949 #define RCM_RD_SRS0_WAKEUP(base) ((RCM_SRS0_REG(base) & RCM_SRS0_WAKEUP_MASK) >> RCM_SRS0_WAKEUP_SHIFT)
11950 #define RCM_BRD_SRS0_WAKEUP(base) (BME_UBFX8(&RCM_SRS0_REG(base), RCM_SRS0_WAKEUP_SHIFT, RCM_SRS0_WAKEUP_WIDTH))
11951 /*@}*/
11952 
11953 /*!
11954  * @name Register RCM_SRS0, field LVD[1] (RO)
11955  *
11956  * If the LVDRE bit is set and the supply drops below the LVD trip voltage, an
11957  * LVD reset occurs. This bit is also set by POR.
11958  *
11959  * Values:
11960  * - 0b0 - Reset not caused by LVD trip or POR
11961  * - 0b1 - Reset caused by LVD trip or POR
11962  */
11963 /*@{*/
11964 /*! @brief Read current value of the RCM_SRS0_LVD field. */
11965 #define RCM_RD_SRS0_LVD(base) ((RCM_SRS0_REG(base) & RCM_SRS0_LVD_MASK) >> RCM_SRS0_LVD_SHIFT)
11966 #define RCM_BRD_SRS0_LVD(base) (BME_UBFX8(&RCM_SRS0_REG(base), RCM_SRS0_LVD_SHIFT, RCM_SRS0_LVD_WIDTH))
11967 /*@}*/
11968 
11969 /*!
11970  * @name Register RCM_SRS0, field LOC[2] (RO)
11971  *
11972  * Indicates a reset has been caused by a loss of external clock. The MCG clock
11973  * monitor must be enabled for a loss of clock to be detected. Refer to the
11974  * detailed MCG description for information on enabling the clock monitor.
11975  *
11976  * Values:
11977  * - 0b0 - Reset not caused by a loss of external clock.
11978  * - 0b1 - Reset caused by a loss of external clock.
11979  */
11980 /*@{*/
11981 /*! @brief Read current value of the RCM_SRS0_LOC field. */
11982 #define RCM_RD_SRS0_LOC(base) ((RCM_SRS0_REG(base) & RCM_SRS0_LOC_MASK) >> RCM_SRS0_LOC_SHIFT)
11983 #define RCM_BRD_SRS0_LOC(base) (BME_UBFX8(&RCM_SRS0_REG(base), RCM_SRS0_LOC_SHIFT, RCM_SRS0_LOC_WIDTH))
11984 /*@}*/
11985 
11986 /*!
11987  * @name Register RCM_SRS0, field LOL[3] (RO)
11988  *
11989  * Indicates a reset has been caused by a loss of lock in the MCG PLL. See the
11990  * MCG description for information on the loss-of-clock event.
11991  *
11992  * Values:
11993  * - 0b0 - Reset not caused by a loss of lock in the PLL
11994  * - 0b1 - Reset caused by a loss of lock in the PLL
11995  */
11996 /*@{*/
11997 /*! @brief Read current value of the RCM_SRS0_LOL field. */
11998 #define RCM_RD_SRS0_LOL(base) ((RCM_SRS0_REG(base) & RCM_SRS0_LOL_MASK) >> RCM_SRS0_LOL_SHIFT)
11999 #define RCM_BRD_SRS0_LOL(base) (BME_UBFX8(&RCM_SRS0_REG(base), RCM_SRS0_LOL_SHIFT, RCM_SRS0_LOL_WIDTH))
12000 /*@}*/
12001 
12002 /*!
12003  * @name Register RCM_SRS0, field WDOG[5] (RO)
12004  *
12005  * Indicates a reset has been caused by the watchdog timer Computer Operating
12006  * Properly (COP) timing out. This reset source can be blocked by disabling the COP
12007  * watchdog: write 00 to the SIM's COPC[COPT] field.
12008  *
12009  * Values:
12010  * - 0b0 - Reset not caused by watchdog timeout
12011  * - 0b1 - Reset caused by watchdog timeout
12012  */
12013 /*@{*/
12014 /*! @brief Read current value of the RCM_SRS0_WDOG field. */
12015 #define RCM_RD_SRS0_WDOG(base) ((RCM_SRS0_REG(base) & RCM_SRS0_WDOG_MASK) >> RCM_SRS0_WDOG_SHIFT)
12016 #define RCM_BRD_SRS0_WDOG(base) (BME_UBFX8(&RCM_SRS0_REG(base), RCM_SRS0_WDOG_SHIFT, RCM_SRS0_WDOG_WIDTH))
12017 /*@}*/
12018 
12019 /*!
12020  * @name Register RCM_SRS0, field PIN[6] (RO)
12021  *
12022  * Indicates a reset has been caused by an active-low level on the external
12023  * RESET pin.
12024  *
12025  * Values:
12026  * - 0b0 - Reset not caused by external reset pin
12027  * - 0b1 - Reset caused by external reset pin
12028  */
12029 /*@{*/
12030 /*! @brief Read current value of the RCM_SRS0_PIN field. */
12031 #define RCM_RD_SRS0_PIN(base) ((RCM_SRS0_REG(base) & RCM_SRS0_PIN_MASK) >> RCM_SRS0_PIN_SHIFT)
12032 #define RCM_BRD_SRS0_PIN(base) (BME_UBFX8(&RCM_SRS0_REG(base), RCM_SRS0_PIN_SHIFT, RCM_SRS0_PIN_WIDTH))
12033 /*@}*/
12034 
12035 /*!
12036  * @name Register RCM_SRS0, field POR[7] (RO)
12037  *
12038  * Indicates a reset has been caused by the power-on detection logic. Because
12039  * the internal supply voltage was ramping up at the time, the low-voltage reset
12040  * (LVD) status bit is also set to indicate that the reset occurred while the
12041  * internal supply was below the LVD threshold.
12042  *
12043  * Values:
12044  * - 0b0 - Reset not caused by POR
12045  * - 0b1 - Reset caused by POR
12046  */
12047 /*@{*/
12048 /*! @brief Read current value of the RCM_SRS0_POR field. */
12049 #define RCM_RD_SRS0_POR(base) ((RCM_SRS0_REG(base) & RCM_SRS0_POR_MASK) >> RCM_SRS0_POR_SHIFT)
12050 #define RCM_BRD_SRS0_POR(base) (BME_UBFX8(&RCM_SRS0_REG(base), RCM_SRS0_POR_SHIFT, RCM_SRS0_POR_WIDTH))
12051 /*@}*/
12052 
12053 /*******************************************************************************
12054  * RCM_SRS1 - System Reset Status Register 1
12055  ******************************************************************************/
12056 
12057 /*!
12058  * @brief RCM_SRS1 - System Reset Status Register 1 (RO)
12059  *
12060  * Reset value: 0x00U
12061  *
12062  * This register includes read-only status flags to indicate the source of the
12063  * most recent reset. The reset state of these bits depends on what caused the MCU
12064  * to reset. The reset value of this register depends on the reset source: POR
12065  * (including LVD) - 0x00 LVD (without POR) - 0x00 VLLS mode wakeup - 0x00 Other
12066  * reset - a bit is set if its corresponding reset source caused the reset
12067  */
12068 /*!
12069  * @name Constants and macros for entire RCM_SRS1 register
12070  */
12071 /*@{*/
12072 #define RCM_RD_SRS1(base) (RCM_SRS1_REG(base))
12073 /*@}*/
12074 
12075 /*
12076  * Constants & macros for individual RCM_SRS1 bitfields
12077  */
12078 
12079 /*!
12080  * @name Register RCM_SRS1, field LOCKUP[1] (RO)
12081  *
12082  * Indicates a reset has been caused by the ARM core indication of a LOCKUP
12083  * event.
12084  *
12085  * Values:
12086  * - 0b0 - Reset not caused by core LOCKUP event
12087  * - 0b1 - Reset caused by core LOCKUP event
12088  */
12089 /*@{*/
12090 /*! @brief Read current value of the RCM_SRS1_LOCKUP field. */
12091 #define RCM_RD_SRS1_LOCKUP(base) ((RCM_SRS1_REG(base) & RCM_SRS1_LOCKUP_MASK) >> RCM_SRS1_LOCKUP_SHIFT)
12092 #define RCM_BRD_SRS1_LOCKUP(base) (BME_UBFX8(&RCM_SRS1_REG(base), RCM_SRS1_LOCKUP_SHIFT, RCM_SRS1_LOCKUP_WIDTH))
12093 /*@}*/
12094 
12095 /*!
12096  * @name Register RCM_SRS1, field SW[2] (RO)
12097  *
12098  * Indicates a reset has been caused by software setting of SYSRESETREQ bit in
12099  * Application Interrupt and Reset Control Register in the ARM core.
12100  *
12101  * Values:
12102  * - 0b0 - Reset not caused by software setting of SYSRESETREQ bit
12103  * - 0b1 - Reset caused by software setting of SYSRESETREQ bit
12104  */
12105 /*@{*/
12106 /*! @brief Read current value of the RCM_SRS1_SW field. */
12107 #define RCM_RD_SRS1_SW(base) ((RCM_SRS1_REG(base) & RCM_SRS1_SW_MASK) >> RCM_SRS1_SW_SHIFT)
12108 #define RCM_BRD_SRS1_SW(base) (BME_UBFX8(&RCM_SRS1_REG(base), RCM_SRS1_SW_SHIFT, RCM_SRS1_SW_WIDTH))
12109 /*@}*/
12110 
12111 /*!
12112  * @name Register RCM_SRS1, field MDM_AP[3] (RO)
12113  *
12114  * Indicates a reset has been caused by the host debugger system setting of the
12115  * System Reset Request bit in the MDM-AP Control Register.
12116  *
12117  * Values:
12118  * - 0b0 - Reset not caused by host debugger system setting of the System Reset
12119  * Request bit
12120  * - 0b1 - Reset caused by host debugger system setting of the System Reset
12121  * Request bit
12122  */
12123 /*@{*/
12124 /*! @brief Read current value of the RCM_SRS1_MDM_AP field. */
12125 #define RCM_RD_SRS1_MDM_AP(base) ((RCM_SRS1_REG(base) & RCM_SRS1_MDM_AP_MASK) >> RCM_SRS1_MDM_AP_SHIFT)
12126 #define RCM_BRD_SRS1_MDM_AP(base) (BME_UBFX8(&RCM_SRS1_REG(base), RCM_SRS1_MDM_AP_SHIFT, RCM_SRS1_MDM_AP_WIDTH))
12127 /*@}*/
12128 
12129 /*!
12130  * @name Register RCM_SRS1, field SACKERR[5] (RO)
12131  *
12132  * Indicates that after an attempt to enter Stop mode, a reset has been caused
12133  * by a failure of one or more peripherals to acknowledge within approximately one
12134  * second to enter stop mode.
12135  *
12136  * Values:
12137  * - 0b0 - Reset not caused by peripheral failure to acknowledge attempt to
12138  * enter stop mode
12139  * - 0b1 - Reset caused by peripheral failure to acknowledge attempt to enter
12140  * stop mode
12141  */
12142 /*@{*/
12143 /*! @brief Read current value of the RCM_SRS1_SACKERR field. */
12144 #define RCM_RD_SRS1_SACKERR(base) ((RCM_SRS1_REG(base) & RCM_SRS1_SACKERR_MASK) >> RCM_SRS1_SACKERR_SHIFT)
12145 #define RCM_BRD_SRS1_SACKERR(base) (BME_UBFX8(&RCM_SRS1_REG(base), RCM_SRS1_SACKERR_SHIFT, RCM_SRS1_SACKERR_WIDTH))
12146 /*@}*/
12147 
12148 /*******************************************************************************
12149  * RCM_RPFC - Reset Pin Filter Control register
12150  ******************************************************************************/
12151 
12152 /*!
12153  * @brief RCM_RPFC - Reset Pin Filter Control register (RW)
12154  *
12155  * Reset value: 0x00U
12156  *
12157  * The reset values of bits 2-0 are for Chip POR only. They are unaffected by
12158  * other reset types. The bus clock filter is reset when disabled or when entering
12159  * stop mode. The LPO filter is reset when disabled .
12160  */
12161 /*!
12162  * @name Constants and macros for entire RCM_RPFC register
12163  */
12164 /*@{*/
12165 #define RCM_RD_RPFC(base) (RCM_RPFC_REG(base))
12166 #define RCM_WR_RPFC(base, value) (RCM_RPFC_REG(base) = (value))
12167 #define RCM_RMW_RPFC(base, mask, value) (RCM_WR_RPFC(base, (RCM_RD_RPFC(base) & ~(mask)) | (value)))
12168 #define RCM_SET_RPFC(base, value) (BME_OR8(&RCM_RPFC_REG(base), (uint8_t)(value)))
12169 #define RCM_CLR_RPFC(base, value) (BME_AND8(&RCM_RPFC_REG(base), (uint8_t)(~(value))))
12170 #define RCM_TOG_RPFC(base, value) (BME_XOR8(&RCM_RPFC_REG(base), (uint8_t)(value)))
12171 /*@}*/
12172 
12173 /*
12174  * Constants & macros for individual RCM_RPFC bitfields
12175  */
12176 
12177 /*!
12178  * @name Register RCM_RPFC, field RSTFLTSRW[1:0] (RW)
12179  *
12180  * Selects how the reset pin filter is enabled in run and wait modes.
12181  *
12182  * Values:
12183  * - 0b00 - All filtering disabled
12184  * - 0b01 - Bus clock filter enabled for normal operation
12185  * - 0b10 - LPO clock filter enabled for normal operation
12186  * - 0b11 - Reserved
12187  */
12188 /*@{*/
12189 /*! @brief Read current value of the RCM_RPFC_RSTFLTSRW field. */
12190 #define RCM_RD_RPFC_RSTFLTSRW(base) ((RCM_RPFC_REG(base) & RCM_RPFC_RSTFLTSRW_MASK) >> RCM_RPFC_RSTFLTSRW_SHIFT)
12191 #define RCM_BRD_RPFC_RSTFLTSRW(base) (BME_UBFX8(&RCM_RPFC_REG(base), RCM_RPFC_RSTFLTSRW_SHIFT, RCM_RPFC_RSTFLTSRW_WIDTH))
12192 
12193 /*! @brief Set the RSTFLTSRW field to a new value. */
12194 #define RCM_WR_RPFC_RSTFLTSRW(base, value) (RCM_RMW_RPFC(base, RCM_RPFC_RSTFLTSRW_MASK, RCM_RPFC_RSTFLTSRW(value)))
12195 #define RCM_BWR_RPFC_RSTFLTSRW(base, value) (BME_BFI8(&RCM_RPFC_REG(base), ((uint8_t)(value) << RCM_RPFC_RSTFLTSRW_SHIFT), RCM_RPFC_RSTFLTSRW_SHIFT, RCM_RPFC_RSTFLTSRW_WIDTH))
12196 /*@}*/
12197 
12198 /*!
12199  * @name Register RCM_RPFC, field RSTFLTSS[2] (RW)
12200  *
12201  * Selects how the reset pin filter is enabled in Stop and VLPS modes , and also
12202  * during LLS and VLLS modes. On exit from VLLS mode, this bit should be
12203  * reconfigured before clearing ACKISO in the PMC.
12204  *
12205  * Values:
12206  * - 0b0 - All filtering disabled
12207  * - 0b1 - LPO clock filter enabled
12208  */
12209 /*@{*/
12210 /*! @brief Read current value of the RCM_RPFC_RSTFLTSS field. */
12211 #define RCM_RD_RPFC_RSTFLTSS(base) ((RCM_RPFC_REG(base) & RCM_RPFC_RSTFLTSS_MASK) >> RCM_RPFC_RSTFLTSS_SHIFT)
12212 #define RCM_BRD_RPFC_RSTFLTSS(base) (BME_UBFX8(&RCM_RPFC_REG(base), RCM_RPFC_RSTFLTSS_SHIFT, RCM_RPFC_RSTFLTSS_WIDTH))
12213 
12214 /*! @brief Set the RSTFLTSS field to a new value. */
12215 #define RCM_WR_RPFC_RSTFLTSS(base, value) (RCM_RMW_RPFC(base, RCM_RPFC_RSTFLTSS_MASK, RCM_RPFC_RSTFLTSS(value)))
12216 #define RCM_BWR_RPFC_RSTFLTSS(base, value) (BME_BFI8(&RCM_RPFC_REG(base), ((uint8_t)(value) << RCM_RPFC_RSTFLTSS_SHIFT), RCM_RPFC_RSTFLTSS_SHIFT, RCM_RPFC_RSTFLTSS_WIDTH))
12217 /*@}*/
12218 
12219 /*******************************************************************************
12220  * RCM_RPFW - Reset Pin Filter Width register
12221  ******************************************************************************/
12222 
12223 /*!
12224  * @brief RCM_RPFW - Reset Pin Filter Width register (RW)
12225  *
12226  * Reset value: 0x00U
12227  *
12228  * The reset values of the bits in the RSTFLTSEL field are for Chip POR only.
12229  * They are unaffected by other reset types.
12230  */
12231 /*!
12232  * @name Constants and macros for entire RCM_RPFW register
12233  */
12234 /*@{*/
12235 #define RCM_RD_RPFW(base) (RCM_RPFW_REG(base))
12236 #define RCM_WR_RPFW(base, value) (RCM_RPFW_REG(base) = (value))
12237 #define RCM_RMW_RPFW(base, mask, value) (RCM_WR_RPFW(base, (RCM_RD_RPFW(base) & ~(mask)) | (value)))
12238 #define RCM_SET_RPFW(base, value) (BME_OR8(&RCM_RPFW_REG(base), (uint8_t)(value)))
12239 #define RCM_CLR_RPFW(base, value) (BME_AND8(&RCM_RPFW_REG(base), (uint8_t)(~(value))))
12240 #define RCM_TOG_RPFW(base, value) (BME_XOR8(&RCM_RPFW_REG(base), (uint8_t)(value)))
12241 /*@}*/
12242 
12243 /*
12244  * Constants & macros for individual RCM_RPFW bitfields
12245  */
12246 
12247 /*!
12248  * @name Register RCM_RPFW, field RSTFLTSEL[4:0] (RW)
12249  *
12250  * Selects the reset pin bus clock filter width.
12251  *
12252  * Values:
12253  * - 0b00000 - Bus clock filter count is 1
12254  * - 0b00001 - Bus clock filter count is 2
12255  * - 0b00010 - Bus clock filter count is 3
12256  * - 0b00011 - Bus clock filter count is 4
12257  * - 0b00100 - Bus clock filter count is 5
12258  * - 0b00101 - Bus clock filter count is 6
12259  * - 0b00110 - Bus clock filter count is 7
12260  * - 0b00111 - Bus clock filter count is 8
12261  * - 0b01000 - Bus clock filter count is 9
12262  * - 0b01001 - Bus clock filter count is 10
12263  * - 0b01010 - Bus clock filter count is 11
12264  * - 0b01011 - Bus clock filter count is 12
12265  * - 0b01100 - Bus clock filter count is 13
12266  * - 0b01101 - Bus clock filter count is 14
12267  * - 0b01110 - Bus clock filter count is 15
12268  * - 0b01111 - Bus clock filter count is 16
12269  * - 0b10000 - Bus clock filter count is 17
12270  * - 0b10001 - Bus clock filter count is 18
12271  * - 0b10010 - Bus clock filter count is 19
12272  * - 0b10011 - Bus clock filter count is 20
12273  * - 0b10100 - Bus clock filter count is 21
12274  * - 0b10101 - Bus clock filter count is 22
12275  * - 0b10110 - Bus clock filter count is 23
12276  * - 0b10111 - Bus clock filter count is 24
12277  * - 0b11000 - Bus clock filter count is 25
12278  * - 0b11001 - Bus clock filter count is 26
12279  * - 0b11010 - Bus clock filter count is 27
12280  * - 0b11011 - Bus clock filter count is 28
12281  * - 0b11100 - Bus clock filter count is 29
12282  * - 0b11101 - Bus clock filter count is 30
12283  * - 0b11110 - Bus clock filter count is 31
12284  * - 0b11111 - Bus clock filter count is 32
12285  */
12286 /*@{*/
12287 /*! @brief Read current value of the RCM_RPFW_RSTFLTSEL field. */
12288 #define RCM_RD_RPFW_RSTFLTSEL(base) ((RCM_RPFW_REG(base) & RCM_RPFW_RSTFLTSEL_MASK) >> RCM_RPFW_RSTFLTSEL_SHIFT)
12289 #define RCM_BRD_RPFW_RSTFLTSEL(base) (BME_UBFX8(&RCM_RPFW_REG(base), RCM_RPFW_RSTFLTSEL_SHIFT, RCM_RPFW_RSTFLTSEL_WIDTH))
12290 
12291 /*! @brief Set the RSTFLTSEL field to a new value. */
12292 #define RCM_WR_RPFW_RSTFLTSEL(base, value) (RCM_RMW_RPFW(base, RCM_RPFW_RSTFLTSEL_MASK, RCM_RPFW_RSTFLTSEL(value)))
12293 #define RCM_BWR_RPFW_RSTFLTSEL(base, value) (BME_BFI8(&RCM_RPFW_REG(base), ((uint8_t)(value) << RCM_RPFW_RSTFLTSEL_SHIFT), RCM_RPFW_RSTFLTSEL_SHIFT, RCM_RPFW_RSTFLTSEL_WIDTH))
12294 /*@}*/
12295 
12296 /*
12297  * MKL25Z4 ROM
12298  *
12299  * System ROM
12300  *
12301  * Registers defined in this header file:
12302  * - ROM_ENTRY - Entry
12303  * - ROM_TABLEMARK - End of Table Marker Register
12304  * - ROM_SYSACCESS - System Access Register
12305  * - ROM_PERIPHID4 - Peripheral ID Register
12306  * - ROM_PERIPHID5 - Peripheral ID Register
12307  * - ROM_PERIPHID6 - Peripheral ID Register
12308  * - ROM_PERIPHID7 - Peripheral ID Register
12309  * - ROM_PERIPHID0 - Peripheral ID Register
12310  * - ROM_PERIPHID1 - Peripheral ID Register
12311  * - ROM_PERIPHID2 - Peripheral ID Register
12312  * - ROM_PERIPHID3 - Peripheral ID Register
12313  * - ROM_COMPID - Component ID Register
12314  */
12315 
12316 #define ROM_INSTANCE_COUNT (1U) /*!< Number of instances of the ROM module. */
12317 #define ROM_IDX (0U) /*!< Instance number for ROM. */
12318 
12319 /*******************************************************************************
12320  * ROM_ENTRY - Entry
12321  ******************************************************************************/
12322 
12323 /*!
12324  * @brief ROM_ENTRY - Entry (RO)
12325  *
12326  * Reset value: 0x00000000U
12327  *
12328  * The System ROM Table begins with "n" relative 32-bit addresses, one for each
12329  * debug component present in the device and terminating with an all-zero value
12330  * signaling the end of the table at the "n+1"-th value. See Chip Configuration
12331  * chapter for the debug components these registers point to. It is hardwired to
12332  * specific values used during the auto-discovery process by an external debug
12333  * agent.
12334  */
12335 /*!
12336  * @name Constants and macros for entire ROM_ENTRY register
12337  */
12338 /*@{*/
12339 #define ROM_RD_ENTRY(base, index) (ROM_ENTRY_REG(base, index))
12340 /*@}*/
12341 
12342 /*******************************************************************************
12343  * ROM_TABLEMARK - End of Table Marker Register
12344  ******************************************************************************/
12345 
12346 /*!
12347  * @brief ROM_TABLEMARK - End of Table Marker Register (RO)
12348  *
12349  * Reset value: 0x00000000U
12350  *
12351  * This register indicates end of table marker. It is hardwired to specific
12352  * values used during the auto-discovery process by an external debug agent.
12353  */
12354 /*!
12355  * @name Constants and macros for entire ROM_TABLEMARK register
12356  */
12357 /*@{*/
12358 #define ROM_RD_TABLEMARK(base) (ROM_TABLEMARK_REG(base))
12359 /*@}*/
12360 
12361 /*******************************************************************************
12362  * ROM_SYSACCESS - System Access Register
12363  ******************************************************************************/
12364 
12365 /*!
12366  * @brief ROM_SYSACCESS - System Access Register (RO)
12367  *
12368  * Reset value: 0x00000001U
12369  *
12370  * This register indicates system access. It is hardwired to specific values
12371  * used during the auto-discovery process by an external debug agent.
12372  */
12373 /*!
12374  * @name Constants and macros for entire ROM_SYSACCESS register
12375  */
12376 /*@{*/
12377 #define ROM_RD_SYSACCESS(base) (ROM_SYSACCESS_REG(base))
12378 /*@}*/
12379 
12380 /*******************************************************************************
12381  * ROM_PERIPHID4 - Peripheral ID Register
12382  ******************************************************************************/
12383 
12384 /*!
12385  * @brief ROM_PERIPHID4 - Peripheral ID Register (RO)
12386  *
12387  * Reset value: 0x00000000U
12388  *
12389  * These registers indicate the peripheral IDs. They are hardwired to specific
12390  * values used during the auto-discovery process by an external debug agent.
12391  */
12392 /*!
12393  * @name Constants and macros for entire ROM_PERIPHID4 register
12394  */
12395 /*@{*/
12396 #define ROM_RD_PERIPHID4(base) (ROM_PERIPHID4_REG(base))
12397 /*@}*/
12398 
12399 /*******************************************************************************
12400  * ROM_PERIPHID5 - Peripheral ID Register
12401  ******************************************************************************/
12402 
12403 /*!
12404  * @brief ROM_PERIPHID5 - Peripheral ID Register (RO)
12405  *
12406  * Reset value: 0x00000000U
12407  *
12408  * These registers indicate the peripheral IDs. They are hardwired to specific
12409  * values used during the auto-discovery process by an external debug agent.
12410  */
12411 /*!
12412  * @name Constants and macros for entire ROM_PERIPHID5 register
12413  */
12414 /*@{*/
12415 #define ROM_RD_PERIPHID5(base) (ROM_PERIPHID5_REG(base))
12416 /*@}*/
12417 
12418 /*******************************************************************************
12419  * ROM_PERIPHID6 - Peripheral ID Register
12420  ******************************************************************************/
12421 
12422 /*!
12423  * @brief ROM_PERIPHID6 - Peripheral ID Register (RO)
12424  *
12425  * Reset value: 0x00000000U
12426  *
12427  * These registers indicate the peripheral IDs. They are hardwired to specific
12428  * values used during the auto-discovery process by an external debug agent.
12429  */
12430 /*!
12431  * @name Constants and macros for entire ROM_PERIPHID6 register
12432  */
12433 /*@{*/
12434 #define ROM_RD_PERIPHID6(base) (ROM_PERIPHID6_REG(base))
12435 /*@}*/
12436 
12437 /*******************************************************************************
12438  * ROM_PERIPHID7 - Peripheral ID Register
12439  ******************************************************************************/
12440 
12441 /*!
12442  * @brief ROM_PERIPHID7 - Peripheral ID Register (RO)
12443  *
12444  * Reset value: 0x00000000U
12445  *
12446  * These registers indicate the peripheral IDs. They are hardwired to specific
12447  * values used during the auto-discovery process by an external debug agent.
12448  */
12449 /*!
12450  * @name Constants and macros for entire ROM_PERIPHID7 register
12451  */
12452 /*@{*/
12453 #define ROM_RD_PERIPHID7(base) (ROM_PERIPHID7_REG(base))
12454 /*@}*/
12455 
12456 /*******************************************************************************
12457  * ROM_PERIPHID0 - Peripheral ID Register
12458  ******************************************************************************/
12459 
12460 /*!
12461  * @brief ROM_PERIPHID0 - Peripheral ID Register (RO)
12462  *
12463  * Reset value: 0x00000000U
12464  *
12465  * These registers indicate the peripheral IDs. They are hardwired to specific
12466  * values used during the auto-discovery process by an external debug agent.
12467  */
12468 /*!
12469  * @name Constants and macros for entire ROM_PERIPHID0 register
12470  */
12471 /*@{*/
12472 #define ROM_RD_PERIPHID0(base) (ROM_PERIPHID0_REG(base))
12473 /*@}*/
12474 
12475 /*******************************************************************************
12476  * ROM_PERIPHID1 - Peripheral ID Register
12477  ******************************************************************************/
12478 
12479 /*!
12480  * @brief ROM_PERIPHID1 - Peripheral ID Register (RO)
12481  *
12482  * Reset value: 0x00000000U
12483  *
12484  * These registers indicate the peripheral IDs. They are hardwired to specific
12485  * values used during the auto-discovery process by an external debug agent.
12486  */
12487 /*!
12488  * @name Constants and macros for entire ROM_PERIPHID1 register
12489  */
12490 /*@{*/
12491 #define ROM_RD_PERIPHID1(base) (ROM_PERIPHID1_REG(base))
12492 /*@}*/
12493 
12494 /*******************************************************************************
12495  * ROM_PERIPHID2 - Peripheral ID Register
12496  ******************************************************************************/
12497 
12498 /*!
12499  * @brief ROM_PERIPHID2 - Peripheral ID Register (RO)
12500  *
12501  * Reset value: 0x00000000U
12502  *
12503  * These registers indicate the peripheral IDs. They are hardwired to specific
12504  * values used during the auto-discovery process by an external debug agent.
12505  */
12506 /*!
12507  * @name Constants and macros for entire ROM_PERIPHID2 register
12508  */
12509 /*@{*/
12510 #define ROM_RD_PERIPHID2(base) (ROM_PERIPHID2_REG(base))
12511 /*@}*/
12512 
12513 /*******************************************************************************
12514  * ROM_PERIPHID3 - Peripheral ID Register
12515  ******************************************************************************/
12516 
12517 /*!
12518  * @brief ROM_PERIPHID3 - Peripheral ID Register (RO)
12519  *
12520  * Reset value: 0x00000000U
12521  *
12522  * These registers indicate the peripheral IDs. They are hardwired to specific
12523  * values used during the auto-discovery process by an external debug agent.
12524  */
12525 /*!
12526  * @name Constants and macros for entire ROM_PERIPHID3 register
12527  */
12528 /*@{*/
12529 #define ROM_RD_PERIPHID3(base) (ROM_PERIPHID3_REG(base))
12530 /*@}*/
12531 
12532 /*******************************************************************************
12533  * ROM_COMPID - Component ID Register
12534  ******************************************************************************/
12535 
12536 /*!
12537  * @brief ROM_COMPID - Component ID Register (RO)
12538  *
12539  * Reset value: 0x00000000U
12540  *
12541  * These registers indicate the component IDs. They are hardwired to specific
12542  * values used during the auto-discovery process by an external debug agent.
12543  */
12544 /*!
12545  * @name Constants and macros for entire ROM_COMPID register
12546  */
12547 /*@{*/
12548 #define ROM_RD_COMPID(base, index) (ROM_COMPID_REG(base, index))
12549 /*@}*/
12550 
12551 /*
12552  * MKL25Z4 RTC
12553  *
12554  * Secure Real Time Clock
12555  *
12556  * Registers defined in this header file:
12557  * - RTC_TSR - RTC Time Seconds Register
12558  * - RTC_TPR - RTC Time Prescaler Register
12559  * - RTC_TAR - RTC Time Alarm Register
12560  * - RTC_TCR - RTC Time Compensation Register
12561  * - RTC_CR - RTC Control Register
12562  * - RTC_SR - RTC Status Register
12563  * - RTC_LR - RTC Lock Register
12564  * - RTC_IER - RTC Interrupt Enable Register
12565  */
12566 
12567 #define RTC_INSTANCE_COUNT (1U) /*!< Number of instances of the RTC module. */
12568 #define RTC_IDX (0U) /*!< Instance number for RTC. */
12569 
12570 /*******************************************************************************
12571  * RTC_TSR - RTC Time Seconds Register
12572  ******************************************************************************/
12573 
12574 /*!
12575  * @brief RTC_TSR - RTC Time Seconds Register (RW)
12576  *
12577  * Reset value: 0x00000000U
12578  */
12579 /*!
12580  * @name Constants and macros for entire RTC_TSR register
12581  */
12582 /*@{*/
12583 #define RTC_RD_TSR(base) (RTC_TSR_REG(base))
12584 #define RTC_WR_TSR(base, value) (RTC_TSR_REG(base) = (value))
12585 #define RTC_RMW_TSR(base, mask, value) (RTC_WR_TSR(base, (RTC_RD_TSR(base) & ~(mask)) | (value)))
12586 #define RTC_SET_TSR(base, value) (BME_OR32(&RTC_TSR_REG(base), (uint32_t)(value)))
12587 #define RTC_CLR_TSR(base, value) (BME_AND32(&RTC_TSR_REG(base), (uint32_t)(~(value))))
12588 #define RTC_TOG_TSR(base, value) (BME_XOR32(&RTC_TSR_REG(base), (uint32_t)(value)))
12589 /*@}*/
12590 
12591 /*******************************************************************************
12592  * RTC_TPR - RTC Time Prescaler Register
12593  ******************************************************************************/
12594 
12595 /*!
12596  * @brief RTC_TPR - RTC Time Prescaler Register (RW)
12597  *
12598  * Reset value: 0x00000000U
12599  */
12600 /*!
12601  * @name Constants and macros for entire RTC_TPR register
12602  */
12603 /*@{*/
12604 #define RTC_RD_TPR(base) (RTC_TPR_REG(base))
12605 #define RTC_WR_TPR(base, value) (RTC_TPR_REG(base) = (value))
12606 #define RTC_RMW_TPR(base, mask, value) (RTC_WR_TPR(base, (RTC_RD_TPR(base) & ~(mask)) | (value)))
12607 #define RTC_SET_TPR(base, value) (BME_OR32(&RTC_TPR_REG(base), (uint32_t)(value)))
12608 #define RTC_CLR_TPR(base, value) (BME_AND32(&RTC_TPR_REG(base), (uint32_t)(~(value))))
12609 #define RTC_TOG_TPR(base, value) (BME_XOR32(&RTC_TPR_REG(base), (uint32_t)(value)))
12610 /*@}*/
12611 
12612 /*
12613  * Constants & macros for individual RTC_TPR bitfields
12614  */
12615 
12616 /*!
12617  * @name Register RTC_TPR, field TPR[15:0] (RW)
12618  *
12619  * When the time counter is enabled, the TPR is read only and increments every
12620  * 32.768 kHz clock cycle. The time counter will read as zero when SR[TOF] or
12621  * SR[TIF] are set. When the time counter is disabled, the TPR can be read or
12622  * written. The TSR[TSR] increments when bit 14 of the TPR transitions from a logic one
12623  * to a logic zero.
12624  */
12625 /*@{*/
12626 /*! @brief Read current value of the RTC_TPR_TPR field. */
12627 #define RTC_RD_TPR_TPR(base) ((RTC_TPR_REG(base) & RTC_TPR_TPR_MASK) >> RTC_TPR_TPR_SHIFT)
12628 #define RTC_BRD_TPR_TPR(base) (BME_UBFX32(&RTC_TPR_REG(base), RTC_TPR_TPR_SHIFT, RTC_TPR_TPR_WIDTH))
12629 
12630 /*! @brief Set the TPR field to a new value. */
12631 #define RTC_WR_TPR_TPR(base, value) (RTC_RMW_TPR(base, RTC_TPR_TPR_MASK, RTC_TPR_TPR(value)))
12632 #define RTC_BWR_TPR_TPR(base, value) (BME_BFI32(&RTC_TPR_REG(base), ((uint32_t)(value) << RTC_TPR_TPR_SHIFT), RTC_TPR_TPR_SHIFT, RTC_TPR_TPR_WIDTH))
12633 /*@}*/
12634 
12635 /*******************************************************************************
12636  * RTC_TAR - RTC Time Alarm Register
12637  ******************************************************************************/
12638 
12639 /*!
12640  * @brief RTC_TAR - RTC Time Alarm Register (RW)
12641  *
12642  * Reset value: 0x00000000U
12643  */
12644 /*!
12645  * @name Constants and macros for entire RTC_TAR register
12646  */
12647 /*@{*/
12648 #define RTC_RD_TAR(base) (RTC_TAR_REG(base))
12649 #define RTC_WR_TAR(base, value) (RTC_TAR_REG(base) = (value))
12650 #define RTC_RMW_TAR(base, mask, value) (RTC_WR_TAR(base, (RTC_RD_TAR(base) & ~(mask)) | (value)))
12651 #define RTC_SET_TAR(base, value) (BME_OR32(&RTC_TAR_REG(base), (uint32_t)(value)))
12652 #define RTC_CLR_TAR(base, value) (BME_AND32(&RTC_TAR_REG(base), (uint32_t)(~(value))))
12653 #define RTC_TOG_TAR(base, value) (BME_XOR32(&RTC_TAR_REG(base), (uint32_t)(value)))
12654 /*@}*/
12655 
12656 /*******************************************************************************
12657  * RTC_TCR - RTC Time Compensation Register
12658  ******************************************************************************/
12659 
12660 /*!
12661  * @brief RTC_TCR - RTC Time Compensation Register (RW)
12662  *
12663  * Reset value: 0x00000000U
12664  */
12665 /*!
12666  * @name Constants and macros for entire RTC_TCR register
12667  */
12668 /*@{*/
12669 #define RTC_RD_TCR(base) (RTC_TCR_REG(base))
12670 #define RTC_WR_TCR(base, value) (RTC_TCR_REG(base) = (value))
12671 #define RTC_RMW_TCR(base, mask, value) (RTC_WR_TCR(base, (RTC_RD_TCR(base) & ~(mask)) | (value)))
12672 #define RTC_SET_TCR(base, value) (BME_OR32(&RTC_TCR_REG(base), (uint32_t)(value)))
12673 #define RTC_CLR_TCR(base, value) (BME_AND32(&RTC_TCR_REG(base), (uint32_t)(~(value))))
12674 #define RTC_TOG_TCR(base, value) (BME_XOR32(&RTC_TCR_REG(base), (uint32_t)(value)))
12675 /*@}*/
12676 
12677 /*
12678  * Constants & macros for individual RTC_TCR bitfields
12679  */
12680 
12681 /*!
12682  * @name Register RTC_TCR, field TCR[7:0] (RW)
12683  *
12684  * Configures the number of 32.768 kHz clock cycles in each second. This
12685  * register is double buffered and writes do not take affect until the end of the
12686  * current compensation interval.
12687  *
12688  * Values:
12689  * - 0b10000000 - Time Prescaler Register overflows every 32896 clock cycles.
12690  * - 0b11111111 - Time Prescaler Register overflows every 32769 clock cycles.
12691  * - 0b00000000 - Time Prescaler Register overflows every 32768 clock cycles.
12692  * - 0b00000001 - Time Prescaler Register overflows every 32767 clock cycles.
12693  * - 0b01111111 - Time Prescaler Register overflows every 32641 clock cycles.
12694  */
12695 /*@{*/
12696 /*! @brief Read current value of the RTC_TCR_TCR field. */
12697 #define RTC_RD_TCR_TCR(base) ((RTC_TCR_REG(base) & RTC_TCR_TCR_MASK) >> RTC_TCR_TCR_SHIFT)
12698 #define RTC_BRD_TCR_TCR(base) (BME_UBFX32(&RTC_TCR_REG(base), RTC_TCR_TCR_SHIFT, RTC_TCR_TCR_WIDTH))
12699 
12700 /*! @brief Set the TCR field to a new value. */
12701 #define RTC_WR_TCR_TCR(base, value) (RTC_RMW_TCR(base, RTC_TCR_TCR_MASK, RTC_TCR_TCR(value)))
12702 #define RTC_BWR_TCR_TCR(base, value) (BME_BFI32(&RTC_TCR_REG(base), ((uint32_t)(value) << RTC_TCR_TCR_SHIFT), RTC_TCR_TCR_SHIFT, RTC_TCR_TCR_WIDTH))
12703 /*@}*/
12704 
12705 /*!
12706  * @name Register RTC_TCR, field CIR[15:8] (RW)
12707  *
12708  * Configures the compensation interval in seconds from 1 to 256 to control how
12709  * frequently the TCR should adjust the number of 32.768 kHz cycles in each
12710  * second. The value written should be one less than the number of seconds. For
12711  * example, write zero to configure for a compensation interval of one second. This
12712  * register is double buffered and writes do not take affect until the end of the
12713  * current compensation interval.
12714  */
12715 /*@{*/
12716 /*! @brief Read current value of the RTC_TCR_CIR field. */
12717 #define RTC_RD_TCR_CIR(base) ((RTC_TCR_REG(base) & RTC_TCR_CIR_MASK) >> RTC_TCR_CIR_SHIFT)
12718 #define RTC_BRD_TCR_CIR(base) (BME_UBFX32(&RTC_TCR_REG(base), RTC_TCR_CIR_SHIFT, RTC_TCR_CIR_WIDTH))
12719 
12720 /*! @brief Set the CIR field to a new value. */
12721 #define RTC_WR_TCR_CIR(base, value) (RTC_RMW_TCR(base, RTC_TCR_CIR_MASK, RTC_TCR_CIR(value)))
12722 #define RTC_BWR_TCR_CIR(base, value) (BME_BFI32(&RTC_TCR_REG(base), ((uint32_t)(value) << RTC_TCR_CIR_SHIFT), RTC_TCR_CIR_SHIFT, RTC_TCR_CIR_WIDTH))
12723 /*@}*/
12724 
12725 /*!
12726  * @name Register RTC_TCR, field TCV[23:16] (RO)
12727  *
12728  * Current value used by the compensation logic for the present second interval.
12729  * Updated once a second if the CIC equals 0 with the contents of the TCR field.
12730  * If the CIC does not equal zero then it is loaded with zero (compensation is
12731  * not enabled for that second increment).
12732  */
12733 /*@{*/
12734 /*! @brief Read current value of the RTC_TCR_TCV field. */
12735 #define RTC_RD_TCR_TCV(base) ((RTC_TCR_REG(base) & RTC_TCR_TCV_MASK) >> RTC_TCR_TCV_SHIFT)
12736 #define RTC_BRD_TCR_TCV(base) (BME_UBFX32(&RTC_TCR_REG(base), RTC_TCR_TCV_SHIFT, RTC_TCR_TCV_WIDTH))
12737 /*@}*/
12738 
12739 /*!
12740  * @name Register RTC_TCR, field CIC[31:24] (RO)
12741  *
12742  * Current value of the compensation interval counter. If the compensation
12743  * interval counter equals zero then it is loaded with the contents of the CIR. If the
12744  * CIC does not equal zero then it is decremented once a second.
12745  */
12746 /*@{*/
12747 /*! @brief Read current value of the RTC_TCR_CIC field. */
12748 #define RTC_RD_TCR_CIC(base) ((RTC_TCR_REG(base) & RTC_TCR_CIC_MASK) >> RTC_TCR_CIC_SHIFT)
12749 #define RTC_BRD_TCR_CIC(base) (BME_UBFX32(&RTC_TCR_REG(base), RTC_TCR_CIC_SHIFT, RTC_TCR_CIC_WIDTH))
12750 /*@}*/
12751 
12752 /*******************************************************************************
12753  * RTC_CR - RTC Control Register
12754  ******************************************************************************/
12755 
12756 /*!
12757  * @brief RTC_CR - RTC Control Register (RW)
12758  *
12759  * Reset value: 0x00000000U
12760  */
12761 /*!
12762  * @name Constants and macros for entire RTC_CR register
12763  */
12764 /*@{*/
12765 #define RTC_RD_CR(base) (RTC_CR_REG(base))
12766 #define RTC_WR_CR(base, value) (RTC_CR_REG(base) = (value))
12767 #define RTC_RMW_CR(base, mask, value) (RTC_WR_CR(base, (RTC_RD_CR(base) & ~(mask)) | (value)))
12768 #define RTC_SET_CR(base, value) (BME_OR32(&RTC_CR_REG(base), (uint32_t)(value)))
12769 #define RTC_CLR_CR(base, value) (BME_AND32(&RTC_CR_REG(base), (uint32_t)(~(value))))
12770 #define RTC_TOG_CR(base, value) (BME_XOR32(&RTC_CR_REG(base), (uint32_t)(value)))
12771 /*@}*/
12772 
12773 /*
12774  * Constants & macros for individual RTC_CR bitfields
12775  */
12776 
12777 /*!
12778  * @name Register RTC_CR, field SWR[0] (RW)
12779  *
12780  * Values:
12781  * - 0b0 - No effect.
12782  * - 0b1 - Resets all RTC registers except for the SWR bit . The SWR bit is
12783  * cleared by POR and by software explicitly clearing it.
12784  */
12785 /*@{*/
12786 /*! @brief Read current value of the RTC_CR_SWR field. */
12787 #define RTC_RD_CR_SWR(base) ((RTC_CR_REG(base) & RTC_CR_SWR_MASK) >> RTC_CR_SWR_SHIFT)
12788 #define RTC_BRD_CR_SWR(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_SWR_SHIFT, RTC_CR_SWR_WIDTH))
12789 
12790 /*! @brief Set the SWR field to a new value. */
12791 #define RTC_WR_CR_SWR(base, value) (RTC_RMW_CR(base, RTC_CR_SWR_MASK, RTC_CR_SWR(value)))
12792 #define RTC_BWR_CR_SWR(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_SWR_SHIFT), RTC_CR_SWR_SHIFT, RTC_CR_SWR_WIDTH))
12793 /*@}*/
12794 
12795 /*!
12796  * @name Register RTC_CR, field WPE[1] (RW)
12797  *
12798  * The wakeup pin is optional and not available on all devices.
12799  *
12800  * Values:
12801  * - 0b0 - Wakeup pin is disabled.
12802  * - 0b1 - Wakeup pin is enabled and wakeup pin asserts if the RTC interrupt
12803  * asserts or the wakeup pin is turned on.
12804  */
12805 /*@{*/
12806 /*! @brief Read current value of the RTC_CR_WPE field. */
12807 #define RTC_RD_CR_WPE(base) ((RTC_CR_REG(base) & RTC_CR_WPE_MASK) >> RTC_CR_WPE_SHIFT)
12808 #define RTC_BRD_CR_WPE(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_WPE_SHIFT, RTC_CR_WPE_WIDTH))
12809 
12810 /*! @brief Set the WPE field to a new value. */
12811 #define RTC_WR_CR_WPE(base, value) (RTC_RMW_CR(base, RTC_CR_WPE_MASK, RTC_CR_WPE(value)))
12812 #define RTC_BWR_CR_WPE(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_WPE_SHIFT), RTC_CR_WPE_SHIFT, RTC_CR_WPE_WIDTH))
12813 /*@}*/
12814 
12815 /*!
12816  * @name Register RTC_CR, field SUP[2] (RW)
12817  *
12818  * Values:
12819  * - 0b0 - Non-supervisor mode write accesses are not supported and generate a
12820  * bus error.
12821  * - 0b1 - Non-supervisor mode write accesses are supported.
12822  */
12823 /*@{*/
12824 /*! @brief Read current value of the RTC_CR_SUP field. */
12825 #define RTC_RD_CR_SUP(base) ((RTC_CR_REG(base) & RTC_CR_SUP_MASK) >> RTC_CR_SUP_SHIFT)
12826 #define RTC_BRD_CR_SUP(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_SUP_SHIFT, RTC_CR_SUP_WIDTH))
12827 
12828 /*! @brief Set the SUP field to a new value. */
12829 #define RTC_WR_CR_SUP(base, value) (RTC_RMW_CR(base, RTC_CR_SUP_MASK, RTC_CR_SUP(value)))
12830 #define RTC_BWR_CR_SUP(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_SUP_SHIFT), RTC_CR_SUP_SHIFT, RTC_CR_SUP_WIDTH))
12831 /*@}*/
12832 
12833 /*!
12834  * @name Register RTC_CR, field UM[3] (RW)
12835  *
12836  * Allows SR[TCE] to be written even when the Status Register is locked. When
12837  * set, the SR[TCE] can always be written if the SR[TIF] or SR[TOF] are set or if
12838  * the SR[TCE] is clear.
12839  *
12840  * Values:
12841  * - 0b0 - Registers cannot be written when locked.
12842  * - 0b1 - Registers can be written when locked under limited conditions.
12843  */
12844 /*@{*/
12845 /*! @brief Read current value of the RTC_CR_UM field. */
12846 #define RTC_RD_CR_UM(base) ((RTC_CR_REG(base) & RTC_CR_UM_MASK) >> RTC_CR_UM_SHIFT)
12847 #define RTC_BRD_CR_UM(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_UM_SHIFT, RTC_CR_UM_WIDTH))
12848 
12849 /*! @brief Set the UM field to a new value. */
12850 #define RTC_WR_CR_UM(base, value) (RTC_RMW_CR(base, RTC_CR_UM_MASK, RTC_CR_UM(value)))
12851 #define RTC_BWR_CR_UM(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_UM_SHIFT), RTC_CR_UM_SHIFT, RTC_CR_UM_WIDTH))
12852 /*@}*/
12853 
12854 /*!
12855  * @name Register RTC_CR, field OSCE[8] (RW)
12856  *
12857  * Values:
12858  * - 0b0 - 32.768 kHz oscillator is disabled.
12859  * - 0b1 - 32.768 kHz oscillator is enabled. After setting this bit, wait the
12860  * oscillator startup time before enabling the time counter to allow the 32.768
12861  * kHz clock time to stabilize.
12862  */
12863 /*@{*/
12864 /*! @brief Read current value of the RTC_CR_OSCE field. */
12865 #define RTC_RD_CR_OSCE(base) ((RTC_CR_REG(base) & RTC_CR_OSCE_MASK) >> RTC_CR_OSCE_SHIFT)
12866 #define RTC_BRD_CR_OSCE(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_OSCE_SHIFT, RTC_CR_OSCE_WIDTH))
12867 
12868 /*! @brief Set the OSCE field to a new value. */
12869 #define RTC_WR_CR_OSCE(base, value) (RTC_RMW_CR(base, RTC_CR_OSCE_MASK, RTC_CR_OSCE(value)))
12870 #define RTC_BWR_CR_OSCE(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_OSCE_SHIFT), RTC_CR_OSCE_SHIFT, RTC_CR_OSCE_WIDTH))
12871 /*@}*/
12872 
12873 /*!
12874  * @name Register RTC_CR, field CLKO[9] (RW)
12875  *
12876  * Values:
12877  * - 0b0 - The 32 kHz clock is output to other peripherals.
12878  * - 0b1 - The 32 kHz clock is not output to other peripherals.
12879  */
12880 /*@{*/
12881 /*! @brief Read current value of the RTC_CR_CLKO field. */
12882 #define RTC_RD_CR_CLKO(base) ((RTC_CR_REG(base) & RTC_CR_CLKO_MASK) >> RTC_CR_CLKO_SHIFT)
12883 #define RTC_BRD_CR_CLKO(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_CLKO_SHIFT, RTC_CR_CLKO_WIDTH))
12884 
12885 /*! @brief Set the CLKO field to a new value. */
12886 #define RTC_WR_CR_CLKO(base, value) (RTC_RMW_CR(base, RTC_CR_CLKO_MASK, RTC_CR_CLKO(value)))
12887 #define RTC_BWR_CR_CLKO(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_CLKO_SHIFT), RTC_CR_CLKO_SHIFT, RTC_CR_CLKO_WIDTH))
12888 /*@}*/
12889 
12890 /*!
12891  * @name Register RTC_CR, field SC16P[10] (RW)
12892  *
12893  * Values:
12894  * - 0b0 - Disable the load.
12895  * - 0b1 - Enable the additional load.
12896  */
12897 /*@{*/
12898 /*! @brief Read current value of the RTC_CR_SC16P field. */
12899 #define RTC_RD_CR_SC16P(base) ((RTC_CR_REG(base) & RTC_CR_SC16P_MASK) >> RTC_CR_SC16P_SHIFT)
12900 #define RTC_BRD_CR_SC16P(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_SC16P_SHIFT, RTC_CR_SC16P_WIDTH))
12901 
12902 /*! @brief Set the SC16P field to a new value. */
12903 #define RTC_WR_CR_SC16P(base, value) (RTC_RMW_CR(base, RTC_CR_SC16P_MASK, RTC_CR_SC16P(value)))
12904 #define RTC_BWR_CR_SC16P(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_SC16P_SHIFT), RTC_CR_SC16P_SHIFT, RTC_CR_SC16P_WIDTH))
12905 /*@}*/
12906 
12907 /*!
12908  * @name Register RTC_CR, field SC8P[11] (RW)
12909  *
12910  * Values:
12911  * - 0b0 - Disable the load.
12912  * - 0b1 - Enable the additional load.
12913  */
12914 /*@{*/
12915 /*! @brief Read current value of the RTC_CR_SC8P field. */
12916 #define RTC_RD_CR_SC8P(base) ((RTC_CR_REG(base) & RTC_CR_SC8P_MASK) >> RTC_CR_SC8P_SHIFT)
12917 #define RTC_BRD_CR_SC8P(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_SC8P_SHIFT, RTC_CR_SC8P_WIDTH))
12918 
12919 /*! @brief Set the SC8P field to a new value. */
12920 #define RTC_WR_CR_SC8P(base, value) (RTC_RMW_CR(base, RTC_CR_SC8P_MASK, RTC_CR_SC8P(value)))
12921 #define RTC_BWR_CR_SC8P(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_SC8P_SHIFT), RTC_CR_SC8P_SHIFT, RTC_CR_SC8P_WIDTH))
12922 /*@}*/
12923 
12924 /*!
12925  * @name Register RTC_CR, field SC4P[12] (RW)
12926  *
12927  * Values:
12928  * - 0b0 - Disable the load.
12929  * - 0b1 - Enable the additional load.
12930  */
12931 /*@{*/
12932 /*! @brief Read current value of the RTC_CR_SC4P field. */
12933 #define RTC_RD_CR_SC4P(base) ((RTC_CR_REG(base) & RTC_CR_SC4P_MASK) >> RTC_CR_SC4P_SHIFT)
12934 #define RTC_BRD_CR_SC4P(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_SC4P_SHIFT, RTC_CR_SC4P_WIDTH))
12935 
12936 /*! @brief Set the SC4P field to a new value. */
12937 #define RTC_WR_CR_SC4P(base, value) (RTC_RMW_CR(base, RTC_CR_SC4P_MASK, RTC_CR_SC4P(value)))
12938 #define RTC_BWR_CR_SC4P(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_SC4P_SHIFT), RTC_CR_SC4P_SHIFT, RTC_CR_SC4P_WIDTH))
12939 /*@}*/
12940 
12941 /*!
12942  * @name Register RTC_CR, field SC2P[13] (RW)
12943  *
12944  * Values:
12945  * - 0b0 - Disable the load.
12946  * - 0b1 - Enable the additional load.
12947  */
12948 /*@{*/
12949 /*! @brief Read current value of the RTC_CR_SC2P field. */
12950 #define RTC_RD_CR_SC2P(base) ((RTC_CR_REG(base) & RTC_CR_SC2P_MASK) >> RTC_CR_SC2P_SHIFT)
12951 #define RTC_BRD_CR_SC2P(base) (BME_UBFX32(&RTC_CR_REG(base), RTC_CR_SC2P_SHIFT, RTC_CR_SC2P_WIDTH))
12952 
12953 /*! @brief Set the SC2P field to a new value. */
12954 #define RTC_WR_CR_SC2P(base, value) (RTC_RMW_CR(base, RTC_CR_SC2P_MASK, RTC_CR_SC2P(value)))
12955 #define RTC_BWR_CR_SC2P(base, value) (BME_BFI32(&RTC_CR_REG(base), ((uint32_t)(value) << RTC_CR_SC2P_SHIFT), RTC_CR_SC2P_SHIFT, RTC_CR_SC2P_WIDTH))
12956 /*@}*/
12957 
12958 /*******************************************************************************
12959  * RTC_SR - RTC Status Register
12960  ******************************************************************************/
12961 
12962 /*!
12963  * @brief RTC_SR - RTC Status Register (RW)
12964  *
12965  * Reset value: 0x00000001U
12966  */
12967 /*!
12968  * @name Constants and macros for entire RTC_SR register
12969  */
12970 /*@{*/
12971 #define RTC_RD_SR(base) (RTC_SR_REG(base))
12972 #define RTC_WR_SR(base, value) (RTC_SR_REG(base) = (value))
12973 #define RTC_RMW_SR(base, mask, value) (RTC_WR_SR(base, (RTC_RD_SR(base) & ~(mask)) | (value)))
12974 #define RTC_SET_SR(base, value) (BME_OR32(&RTC_SR_REG(base), (uint32_t)(value)))
12975 #define RTC_CLR_SR(base, value) (BME_AND32(&RTC_SR_REG(base), (uint32_t)(~(value))))
12976 #define RTC_TOG_SR(base, value) (BME_XOR32(&RTC_SR_REG(base), (uint32_t)(value)))
12977 /*@}*/
12978 
12979 /*
12980  * Constants & macros for individual RTC_SR bitfields
12981  */
12982 
12983 /*!
12984  * @name Register RTC_SR, field TIF[0] (RO)
12985  *
12986  * The time invalid flag is set on POR or software reset. The TSR and TPR do not
12987  * increment and read as zero when this bit is set. This bit is cleared by
12988  * writing the TSR register when the time counter is disabled.
12989  *
12990  * Values:
12991  * - 0b0 - Time is valid.
12992  * - 0b1 - Time is invalid and time counter is read as zero.
12993  */
12994 /*@{*/
12995 /*! @brief Read current value of the RTC_SR_TIF field. */
12996 #define RTC_RD_SR_TIF(base) ((RTC_SR_REG(base) & RTC_SR_TIF_MASK) >> RTC_SR_TIF_SHIFT)
12997 #define RTC_BRD_SR_TIF(base) (BME_UBFX32(&RTC_SR_REG(base), RTC_SR_TIF_SHIFT, RTC_SR_TIF_WIDTH))
12998 /*@}*/
12999 
13000 /*!
13001  * @name Register RTC_SR, field TOF[1] (RO)
13002  *
13003  * Time overflow flag is set when the time counter is enabled and overflows. The
13004  * TSR and TPR do not increment and read as zero when this bit is set. This bit
13005  * is cleared by writing the TSR register when the time counter is disabled.
13006  *
13007  * Values:
13008  * - 0b0 - Time overflow has not occurred.
13009  * - 0b1 - Time overflow has occurred and time counter is read as zero.
13010  */
13011 /*@{*/
13012 /*! @brief Read current value of the RTC_SR_TOF field. */
13013 #define RTC_RD_SR_TOF(base) ((RTC_SR_REG(base) & RTC_SR_TOF_MASK) >> RTC_SR_TOF_SHIFT)
13014 #define RTC_BRD_SR_TOF(base) (BME_UBFX32(&RTC_SR_REG(base), RTC_SR_TOF_SHIFT, RTC_SR_TOF_WIDTH))
13015 /*@}*/
13016 
13017 /*!
13018  * @name Register RTC_SR, field TAF[2] (RO)
13019  *
13020  * Time alarm flag is set when the TAR[TAR] equals the TSR[TSR] and the TSR[TSR]
13021  * increments. This bit is cleared by writing the TAR register.
13022  *
13023  * Values:
13024  * - 0b0 - Time alarm has not occurred.
13025  * - 0b1 - Time alarm has occurred.
13026  */
13027 /*@{*/
13028 /*! @brief Read current value of the RTC_SR_TAF field. */
13029 #define RTC_RD_SR_TAF(base) ((RTC_SR_REG(base) & RTC_SR_TAF_MASK) >> RTC_SR_TAF_SHIFT)
13030 #define RTC_BRD_SR_TAF(base) (BME_UBFX32(&RTC_SR_REG(base), RTC_SR_TAF_SHIFT, RTC_SR_TAF_WIDTH))
13031 /*@}*/
13032 
13033 /*!
13034  * @name Register RTC_SR, field TCE[4] (RW)
13035  *
13036  * When time counter is disabled the TSR register and TPR register are
13037  * writeable, but do not increment. When time counter is enabled the TSR register and TPR
13038  * register are not writeable, but increment.
13039  *
13040  * Values:
13041  * - 0b0 - Time counter is disabled.
13042  * - 0b1 - Time counter is enabled.
13043  */
13044 /*@{*/
13045 /*! @brief Read current value of the RTC_SR_TCE field. */
13046 #define RTC_RD_SR_TCE(base) ((RTC_SR_REG(base) & RTC_SR_TCE_MASK) >> RTC_SR_TCE_SHIFT)
13047 #define RTC_BRD_SR_TCE(base) (BME_UBFX32(&RTC_SR_REG(base), RTC_SR_TCE_SHIFT, RTC_SR_TCE_WIDTH))
13048 
13049 /*! @brief Set the TCE field to a new value. */
13050 #define RTC_WR_SR_TCE(base, value) (RTC_RMW_SR(base, RTC_SR_TCE_MASK, RTC_SR_TCE(value)))
13051 #define RTC_BWR_SR_TCE(base, value) (BME_BFI32(&RTC_SR_REG(base), ((uint32_t)(value) << RTC_SR_TCE_SHIFT), RTC_SR_TCE_SHIFT, RTC_SR_TCE_WIDTH))
13052 /*@}*/
13053 
13054 /*******************************************************************************
13055  * RTC_LR - RTC Lock Register
13056  ******************************************************************************/
13057 
13058 /*!
13059  * @brief RTC_LR - RTC Lock Register (RW)
13060  *
13061  * Reset value: 0x000000FFU
13062  */
13063 /*!
13064  * @name Constants and macros for entire RTC_LR register
13065  */
13066 /*@{*/
13067 #define RTC_RD_LR(base) (RTC_LR_REG(base))
13068 #define RTC_WR_LR(base, value) (RTC_LR_REG(base) = (value))
13069 #define RTC_RMW_LR(base, mask, value) (RTC_WR_LR(base, (RTC_RD_LR(base) & ~(mask)) | (value)))
13070 #define RTC_SET_LR(base, value) (BME_OR32(&RTC_LR_REG(base), (uint32_t)(value)))
13071 #define RTC_CLR_LR(base, value) (BME_AND32(&RTC_LR_REG(base), (uint32_t)(~(value))))
13072 #define RTC_TOG_LR(base, value) (BME_XOR32(&RTC_LR_REG(base), (uint32_t)(value)))
13073 /*@}*/
13074 
13075 /*
13076  * Constants & macros for individual RTC_LR bitfields
13077  */
13078 
13079 /*!
13080  * @name Register RTC_LR, field TCL[3] (RW)
13081  *
13082  * After being cleared, this bit can be set only by POR or software reset.
13083  *
13084  * Values:
13085  * - 0b0 - Time Compensation Register is locked and writes are ignored.
13086  * - 0b1 - Time Compensation Register is not locked and writes complete as
13087  * normal.
13088  */
13089 /*@{*/
13090 /*! @brief Read current value of the RTC_LR_TCL field. */
13091 #define RTC_RD_LR_TCL(base) ((RTC_LR_REG(base) & RTC_LR_TCL_MASK) >> RTC_LR_TCL_SHIFT)
13092 #define RTC_BRD_LR_TCL(base) (BME_UBFX32(&RTC_LR_REG(base), RTC_LR_TCL_SHIFT, RTC_LR_TCL_WIDTH))
13093 
13094 /*! @brief Set the TCL field to a new value. */
13095 #define RTC_WR_LR_TCL(base, value) (RTC_RMW_LR(base, RTC_LR_TCL_MASK, RTC_LR_TCL(value)))
13096 #define RTC_BWR_LR_TCL(base, value) (BME_BFI32(&RTC_LR_REG(base), ((uint32_t)(value) << RTC_LR_TCL_SHIFT), RTC_LR_TCL_SHIFT, RTC_LR_TCL_WIDTH))
13097 /*@}*/
13098 
13099 /*!
13100  * @name Register RTC_LR, field CRL[4] (RW)
13101  *
13102  * After being cleared, this bit can only be set by POR.
13103  *
13104  * Values:
13105  * - 0b0 - Control Register is locked and writes are ignored.
13106  * - 0b1 - Control Register is not locked and writes complete as normal.
13107  */
13108 /*@{*/
13109 /*! @brief Read current value of the RTC_LR_CRL field. */
13110 #define RTC_RD_LR_CRL(base) ((RTC_LR_REG(base) & RTC_LR_CRL_MASK) >> RTC_LR_CRL_SHIFT)
13111 #define RTC_BRD_LR_CRL(base) (BME_UBFX32(&RTC_LR_REG(base), RTC_LR_CRL_SHIFT, RTC_LR_CRL_WIDTH))
13112 
13113 /*! @brief Set the CRL field to a new value. */
13114 #define RTC_WR_LR_CRL(base, value) (RTC_RMW_LR(base, RTC_LR_CRL_MASK, RTC_LR_CRL(value)))
13115 #define RTC_BWR_LR_CRL(base, value) (BME_BFI32(&RTC_LR_REG(base), ((uint32_t)(value) << RTC_LR_CRL_SHIFT), RTC_LR_CRL_SHIFT, RTC_LR_CRL_WIDTH))
13116 /*@}*/
13117 
13118 /*!
13119  * @name Register RTC_LR, field SRL[5] (RW)
13120  *
13121  * After being cleared, this bit can be set only by POR or software reset.
13122  *
13123  * Values:
13124  * - 0b0 - Status Register is locked and writes are ignored.
13125  * - 0b1 - Status Register is not locked and writes complete as normal.
13126  */
13127 /*@{*/
13128 /*! @brief Read current value of the RTC_LR_SRL field. */
13129 #define RTC_RD_LR_SRL(base) ((RTC_LR_REG(base) & RTC_LR_SRL_MASK) >> RTC_LR_SRL_SHIFT)
13130 #define RTC_BRD_LR_SRL(base) (BME_UBFX32(&RTC_LR_REG(base), RTC_LR_SRL_SHIFT, RTC_LR_SRL_WIDTH))
13131 
13132 /*! @brief Set the SRL field to a new value. */
13133 #define RTC_WR_LR_SRL(base, value) (RTC_RMW_LR(base, RTC_LR_SRL_MASK, RTC_LR_SRL(value)))
13134 #define RTC_BWR_LR_SRL(base, value) (BME_BFI32(&RTC_LR_REG(base), ((uint32_t)(value) << RTC_LR_SRL_SHIFT), RTC_LR_SRL_SHIFT, RTC_LR_SRL_WIDTH))
13135 /*@}*/
13136 
13137 /*!
13138  * @name Register RTC_LR, field LRL[6] (RW)
13139  *
13140  * After being cleared, this bit can be set only by POR or software reset.
13141  *
13142  * Values:
13143  * - 0b0 - Lock Register is locked and writes are ignored.
13144  * - 0b1 - Lock Register is not locked and writes complete as normal.
13145  */
13146 /*@{*/
13147 /*! @brief Read current value of the RTC_LR_LRL field. */
13148 #define RTC_RD_LR_LRL(base) ((RTC_LR_REG(base) & RTC_LR_LRL_MASK) >> RTC_LR_LRL_SHIFT)
13149 #define RTC_BRD_LR_LRL(base) (BME_UBFX32(&RTC_LR_REG(base), RTC_LR_LRL_SHIFT, RTC_LR_LRL_WIDTH))
13150 
13151 /*! @brief Set the LRL field to a new value. */
13152 #define RTC_WR_LR_LRL(base, value) (RTC_RMW_LR(base, RTC_LR_LRL_MASK, RTC_LR_LRL(value)))
13153 #define RTC_BWR_LR_LRL(base, value) (BME_BFI32(&RTC_LR_REG(base), ((uint32_t)(value) << RTC_LR_LRL_SHIFT), RTC_LR_LRL_SHIFT, RTC_LR_LRL_WIDTH))
13154 /*@}*/
13155 
13156 /*******************************************************************************
13157  * RTC_IER - RTC Interrupt Enable Register
13158  ******************************************************************************/
13159 
13160 /*!
13161  * @brief RTC_IER - RTC Interrupt Enable Register (RW)
13162  *
13163  * Reset value: 0x00000007U
13164  */
13165 /*!
13166  * @name Constants and macros for entire RTC_IER register
13167  */
13168 /*@{*/
13169 #define RTC_RD_IER(base) (RTC_IER_REG(base))
13170 #define RTC_WR_IER(base, value) (RTC_IER_REG(base) = (value))
13171 #define RTC_RMW_IER(base, mask, value) (RTC_WR_IER(base, (RTC_RD_IER(base) & ~(mask)) | (value)))
13172 #define RTC_SET_IER(base, value) (BME_OR32(&RTC_IER_REG(base), (uint32_t)(value)))
13173 #define RTC_CLR_IER(base, value) (BME_AND32(&RTC_IER_REG(base), (uint32_t)(~(value))))
13174 #define RTC_TOG_IER(base, value) (BME_XOR32(&RTC_IER_REG(base), (uint32_t)(value)))
13175 /*@}*/
13176 
13177 /*
13178  * Constants & macros for individual RTC_IER bitfields
13179  */
13180 
13181 /*!
13182  * @name Register RTC_IER, field TIIE[0] (RW)
13183  *
13184  * Values:
13185  * - 0b0 - Time invalid flag does not generate an interrupt.
13186  * - 0b1 - Time invalid flag does generate an interrupt.
13187  */
13188 /*@{*/
13189 /*! @brief Read current value of the RTC_IER_TIIE field. */
13190 #define RTC_RD_IER_TIIE(base) ((RTC_IER_REG(base) & RTC_IER_TIIE_MASK) >> RTC_IER_TIIE_SHIFT)
13191 #define RTC_BRD_IER_TIIE(base) (BME_UBFX32(&RTC_IER_REG(base), RTC_IER_TIIE_SHIFT, RTC_IER_TIIE_WIDTH))
13192 
13193 /*! @brief Set the TIIE field to a new value. */
13194 #define RTC_WR_IER_TIIE(base, value) (RTC_RMW_IER(base, RTC_IER_TIIE_MASK, RTC_IER_TIIE(value)))
13195 #define RTC_BWR_IER_TIIE(base, value) (BME_BFI32(&RTC_IER_REG(base), ((uint32_t)(value) << RTC_IER_TIIE_SHIFT), RTC_IER_TIIE_SHIFT, RTC_IER_TIIE_WIDTH))
13196 /*@}*/
13197 
13198 /*!
13199  * @name Register RTC_IER, field TOIE[1] (RW)
13200  *
13201  * Values:
13202  * - 0b0 - Time overflow flag does not generate an interrupt.
13203  * - 0b1 - Time overflow flag does generate an interrupt.
13204  */
13205 /*@{*/
13206 /*! @brief Read current value of the RTC_IER_TOIE field. */
13207 #define RTC_RD_IER_TOIE(base) ((RTC_IER_REG(base) & RTC_IER_TOIE_MASK) >> RTC_IER_TOIE_SHIFT)
13208 #define RTC_BRD_IER_TOIE(base) (BME_UBFX32(&RTC_IER_REG(base), RTC_IER_TOIE_SHIFT, RTC_IER_TOIE_WIDTH))
13209 
13210 /*! @brief Set the TOIE field to a new value. */
13211 #define RTC_WR_IER_TOIE(base, value) (RTC_RMW_IER(base, RTC_IER_TOIE_MASK, RTC_IER_TOIE(value)))
13212 #define RTC_BWR_IER_TOIE(base, value) (BME_BFI32(&RTC_IER_REG(base), ((uint32_t)(value) << RTC_IER_TOIE_SHIFT), RTC_IER_TOIE_SHIFT, RTC_IER_TOIE_WIDTH))
13213 /*@}*/
13214 
13215 /*!
13216  * @name Register RTC_IER, field TAIE[2] (RW)
13217  *
13218  * Values:
13219  * - 0b0 - Time alarm flag does not generate an interrupt.
13220  * - 0b1 - Time alarm flag does generate an interrupt.
13221  */
13222 /*@{*/
13223 /*! @brief Read current value of the RTC_IER_TAIE field. */
13224 #define RTC_RD_IER_TAIE(base) ((RTC_IER_REG(base) & RTC_IER_TAIE_MASK) >> RTC_IER_TAIE_SHIFT)
13225 #define RTC_BRD_IER_TAIE(base) (BME_UBFX32(&RTC_IER_REG(base), RTC_IER_TAIE_SHIFT, RTC_IER_TAIE_WIDTH))
13226 
13227 /*! @brief Set the TAIE field to a new value. */
13228 #define RTC_WR_IER_TAIE(base, value) (RTC_RMW_IER(base, RTC_IER_TAIE_MASK, RTC_IER_TAIE(value)))
13229 #define RTC_BWR_IER_TAIE(base, value) (BME_BFI32(&RTC_IER_REG(base), ((uint32_t)(value) << RTC_IER_TAIE_SHIFT), RTC_IER_TAIE_SHIFT, RTC_IER_TAIE_WIDTH))
13230 /*@}*/
13231 
13232 /*!
13233  * @name Register RTC_IER, field TSIE[4] (RW)
13234  *
13235  * The seconds interrupt is an edge-sensitive interrupt with a dedicated
13236  * interrupt vector. It is generated once a second and requires no software overhead
13237  * (there is no corresponding status flag to clear).
13238  *
13239  * Values:
13240  * - 0b0 - Seconds interrupt is disabled.
13241  * - 0b1 - Seconds interrupt is enabled.
13242  */
13243 /*@{*/
13244 /*! @brief Read current value of the RTC_IER_TSIE field. */
13245 #define RTC_RD_IER_TSIE(base) ((RTC_IER_REG(base) & RTC_IER_TSIE_MASK) >> RTC_IER_TSIE_SHIFT)
13246 #define RTC_BRD_IER_TSIE(base) (BME_UBFX32(&RTC_IER_REG(base), RTC_IER_TSIE_SHIFT, RTC_IER_TSIE_WIDTH))
13247 
13248 /*! @brief Set the TSIE field to a new value. */
13249 #define RTC_WR_IER_TSIE(base, value) (RTC_RMW_IER(base, RTC_IER_TSIE_MASK, RTC_IER_TSIE(value)))
13250 #define RTC_BWR_IER_TSIE(base, value) (BME_BFI32(&RTC_IER_REG(base), ((uint32_t)(value) << RTC_IER_TSIE_SHIFT), RTC_IER_TSIE_SHIFT, RTC_IER_TSIE_WIDTH))
13251 /*@}*/
13252 
13253 /*!
13254  * @name Register RTC_IER, field WPON[7] (RW)
13255  *
13256  * The wakeup pin is optional and not available on all devices. Whenever the
13257  * wakeup pin is enabled and this bit is set, the wakeup pin will assert.
13258  *
13259  * Values:
13260  * - 0b0 - No effect.
13261  * - 0b1 - If the wakeup pin is enabled, then the wakeup pin will assert.
13262  */
13263 /*@{*/
13264 /*! @brief Read current value of the RTC_IER_WPON field. */
13265 #define RTC_RD_IER_WPON(base) ((RTC_IER_REG(base) & RTC_IER_WPON_MASK) >> RTC_IER_WPON_SHIFT)
13266 #define RTC_BRD_IER_WPON(base) (BME_UBFX32(&RTC_IER_REG(base), RTC_IER_WPON_SHIFT, RTC_IER_WPON_WIDTH))
13267 
13268 /*! @brief Set the WPON field to a new value. */
13269 #define RTC_WR_IER_WPON(base, value) (RTC_RMW_IER(base, RTC_IER_WPON_MASK, RTC_IER_WPON(value)))
13270 #define RTC_BWR_IER_WPON(base, value) (BME_BFI32(&RTC_IER_REG(base), ((uint32_t)(value) << RTC_IER_WPON_SHIFT), RTC_IER_WPON_SHIFT, RTC_IER_WPON_WIDTH))
13271 /*@}*/
13272 
13273 /*
13274  * MKL25Z4 SIM
13275  *
13276  * System Integration Module
13277  *
13278  * Registers defined in this header file:
13279  * - SIM_SOPT1 - System Options Register 1
13280  * - SIM_SOPT1CFG - SOPT1 Configuration Register
13281  * - SIM_SOPT2 - System Options Register 2
13282  * - SIM_SOPT4 - System Options Register 4
13283  * - SIM_SOPT5 - System Options Register 5
13284  * - SIM_SOPT7 - System Options Register 7
13285  * - SIM_SDID - System Device Identification Register
13286  * - SIM_SCGC4 - System Clock Gating Control Register 4
13287  * - SIM_SCGC5 - System Clock Gating Control Register 5
13288  * - SIM_SCGC6 - System Clock Gating Control Register 6
13289  * - SIM_SCGC7 - System Clock Gating Control Register 7
13290  * - SIM_CLKDIV1 - System Clock Divider Register 1
13291  * - SIM_FCFG1 - Flash Configuration Register 1
13292  * - SIM_FCFG2 - Flash Configuration Register 2
13293  * - SIM_UIDMH - Unique Identification Register Mid-High
13294  * - SIM_UIDML - Unique Identification Register Mid Low
13295  * - SIM_UIDL - Unique Identification Register Low
13296  * - SIM_COPC - COP Control Register
13297  * - SIM_SRVCOP - Service COP Register
13298  */
13299 
13300 #define SIM_INSTANCE_COUNT (1U) /*!< Number of instances of the SIM module. */
13301 #define SIM_IDX (0U) /*!< Instance number for SIM. */
13302 
13303 /*******************************************************************************
13304  * SIM_SOPT1 - System Options Register 1
13305  ******************************************************************************/
13306 
13307 /*!
13308  * @brief SIM_SOPT1 - System Options Register 1 (RW)
13309  *
13310  * Reset value: 0x80000000U
13311  *
13312  * The SOPT1 register is only reset on POR or LVD.
13313  */
13314 /*!
13315  * @name Constants and macros for entire SIM_SOPT1 register
13316  */
13317 /*@{*/
13318 #define SIM_RD_SOPT1(base) (SIM_SOPT1_REG(base))
13319 #define SIM_WR_SOPT1(base, value) (SIM_SOPT1_REG(base) = (value))
13320 #define SIM_RMW_SOPT1(base, mask, value) (SIM_WR_SOPT1(base, (SIM_RD_SOPT1(base) & ~(mask)) | (value)))
13321 #define SIM_SET_SOPT1(base, value) (BME_OR32(&SIM_SOPT1_REG(base), (uint32_t)(value)))
13322 #define SIM_CLR_SOPT1(base, value) (BME_AND32(&SIM_SOPT1_REG(base), (uint32_t)(~(value))))
13323 #define SIM_TOG_SOPT1(base, value) (BME_XOR32(&SIM_SOPT1_REG(base), (uint32_t)(value)))
13324 /*@}*/
13325 
13326 /*
13327  * Constants & macros for individual SIM_SOPT1 bitfields
13328  */
13329 
13330 /*!
13331  * @name Register SIM_SOPT1, field OSC32KSEL[19:18] (RW)
13332  *
13333  * Selects the 32 kHz clock source (ERCLK32K) for RTC and LPTMR. This bit is
13334  * reset only on POR/LVD.
13335  *
13336  * Values:
13337  * - 0b00 - System oscillator (OSC32KCLK)
13338  * - 0b01 - Reserved
13339  * - 0b10 - RTC_CLKIN
13340  * - 0b11 - LPO 1kHz
13341  */
13342 /*@{*/
13343 /*! @brief Read current value of the SIM_SOPT1_OSC32KSEL field. */
13344 #define SIM_RD_SOPT1_OSC32KSEL(base) ((SIM_SOPT1_REG(base) & SIM_SOPT1_OSC32KSEL_MASK) >> SIM_SOPT1_OSC32KSEL_SHIFT)
13345 #define SIM_BRD_SOPT1_OSC32KSEL(base) (BME_UBFX32(&SIM_SOPT1_REG(base), SIM_SOPT1_OSC32KSEL_SHIFT, SIM_SOPT1_OSC32KSEL_WIDTH))
13346 
13347 /*! @brief Set the OSC32KSEL field to a new value. */
13348 #define SIM_WR_SOPT1_OSC32KSEL(base, value) (SIM_RMW_SOPT1(base, SIM_SOPT1_OSC32KSEL_MASK, SIM_SOPT1_OSC32KSEL(value)))
13349 #define SIM_BWR_SOPT1_OSC32KSEL(base, value) (BME_BFI32(&SIM_SOPT1_REG(base), ((uint32_t)(value) << SIM_SOPT1_OSC32KSEL_SHIFT), SIM_SOPT1_OSC32KSEL_SHIFT, SIM_SOPT1_OSC32KSEL_WIDTH))
13350 /*@}*/
13351 
13352 /*!
13353  * @name Register SIM_SOPT1, field USBVSTBY[29] (RW)
13354  *
13355  * Controls whether the USB voltage regulator is placed in standby mode during
13356  * VLPR and VLPW modes.
13357  *
13358  * Values:
13359  * - 0b0 - USB voltage regulator not in standby during VLPR and VLPW modes.
13360  * - 0b1 - USB voltage regulator in standby during VLPR and VLPW modes.
13361  */
13362 /*@{*/
13363 /*! @brief Read current value of the SIM_SOPT1_USBVSTBY field. */
13364 #define SIM_RD_SOPT1_USBVSTBY(base) ((SIM_SOPT1_REG(base) & SIM_SOPT1_USBVSTBY_MASK) >> SIM_SOPT1_USBVSTBY_SHIFT)
13365 #define SIM_BRD_SOPT1_USBVSTBY(base) (BME_UBFX32(&SIM_SOPT1_REG(base), SIM_SOPT1_USBVSTBY_SHIFT, SIM_SOPT1_USBVSTBY_WIDTH))
13366 
13367 /*! @brief Set the USBVSTBY field to a new value. */
13368 #define SIM_WR_SOPT1_USBVSTBY(base, value) (SIM_RMW_SOPT1(base, SIM_SOPT1_USBVSTBY_MASK, SIM_SOPT1_USBVSTBY(value)))
13369 #define SIM_BWR_SOPT1_USBVSTBY(base, value) (BME_BFI32(&SIM_SOPT1_REG(base), ((uint32_t)(value) << SIM_SOPT1_USBVSTBY_SHIFT), SIM_SOPT1_USBVSTBY_SHIFT, SIM_SOPT1_USBVSTBY_WIDTH))
13370 /*@}*/
13371 
13372 /*!
13373  * @name Register SIM_SOPT1, field USBSSTBY[30] (RW)
13374  *
13375  * Controls whether the USB voltage regulator is placed in standby mode during
13376  * Stop, VLPS, LLS and VLLS modes.
13377  *
13378  * Values:
13379  * - 0b0 - USB voltage regulator not in standby during Stop, VLPS, LLS and VLLS
13380  * modes.
13381  * - 0b1 - USB voltage regulator in standby during Stop, VLPS, LLS and VLLS
13382  * modes.
13383  */
13384 /*@{*/
13385 /*! @brief Read current value of the SIM_SOPT1_USBSSTBY field. */
13386 #define SIM_RD_SOPT1_USBSSTBY(base) ((SIM_SOPT1_REG(base) & SIM_SOPT1_USBSSTBY_MASK) >> SIM_SOPT1_USBSSTBY_SHIFT)
13387 #define SIM_BRD_SOPT1_USBSSTBY(base) (BME_UBFX32(&SIM_SOPT1_REG(base), SIM_SOPT1_USBSSTBY_SHIFT, SIM_SOPT1_USBSSTBY_WIDTH))
13388 
13389 /*! @brief Set the USBSSTBY field to a new value. */
13390 #define SIM_WR_SOPT1_USBSSTBY(base, value) (SIM_RMW_SOPT1(base, SIM_SOPT1_USBSSTBY_MASK, SIM_SOPT1_USBSSTBY(value)))
13391 #define SIM_BWR_SOPT1_USBSSTBY(base, value) (BME_BFI32(&SIM_SOPT1_REG(base), ((uint32_t)(value) << SIM_SOPT1_USBSSTBY_SHIFT), SIM_SOPT1_USBSSTBY_SHIFT, SIM_SOPT1_USBSSTBY_WIDTH))
13392 /*@}*/
13393 
13394 /*!
13395  * @name Register SIM_SOPT1, field USBREGEN[31] (RW)
13396  *
13397  * Controls whether the USB voltage regulator is enabled.
13398  *
13399  * Values:
13400  * - 0b0 - USB voltage regulator is disabled.
13401  * - 0b1 - USB voltage regulator is enabled.
13402  */
13403 /*@{*/
13404 /*! @brief Read current value of the SIM_SOPT1_USBREGEN field. */
13405 #define SIM_RD_SOPT1_USBREGEN(base) ((SIM_SOPT1_REG(base) & SIM_SOPT1_USBREGEN_MASK) >> SIM_SOPT1_USBREGEN_SHIFT)
13406 #define SIM_BRD_SOPT1_USBREGEN(base) (BME_UBFX32(&SIM_SOPT1_REG(base), SIM_SOPT1_USBREGEN_SHIFT, SIM_SOPT1_USBREGEN_WIDTH))
13407 
13408 /*! @brief Set the USBREGEN field to a new value. */
13409 #define SIM_WR_SOPT1_USBREGEN(base, value) (SIM_RMW_SOPT1(base, SIM_SOPT1_USBREGEN_MASK, SIM_SOPT1_USBREGEN(value)))
13410 #define SIM_BWR_SOPT1_USBREGEN(base, value) (BME_BFI32(&SIM_SOPT1_REG(base), ((uint32_t)(value) << SIM_SOPT1_USBREGEN_SHIFT), SIM_SOPT1_USBREGEN_SHIFT, SIM_SOPT1_USBREGEN_WIDTH))
13411 /*@}*/
13412 
13413 /*******************************************************************************
13414  * SIM_SOPT1CFG - SOPT1 Configuration Register
13415  ******************************************************************************/
13416 
13417 /*!
13418  * @brief SIM_SOPT1CFG - SOPT1 Configuration Register (RW)
13419  *
13420  * Reset value: 0x00000000U
13421  *
13422  * The SOPT1CFG register is reset on System Reset not VLLS.
13423  */
13424 /*!
13425  * @name Constants and macros for entire SIM_SOPT1CFG register
13426  */
13427 /*@{*/
13428 #define SIM_RD_SOPT1CFG(base) (SIM_SOPT1CFG_REG(base))
13429 #define SIM_WR_SOPT1CFG(base, value) (SIM_SOPT1CFG_REG(base) = (value))
13430 #define SIM_RMW_SOPT1CFG(base, mask, value) (SIM_WR_SOPT1CFG(base, (SIM_RD_SOPT1CFG(base) & ~(mask)) | (value)))
13431 #define SIM_SET_SOPT1CFG(base, value) (BME_OR32(&SIM_SOPT1CFG_REG(base), (uint32_t)(value)))
13432 #define SIM_CLR_SOPT1CFG(base, value) (BME_AND32(&SIM_SOPT1CFG_REG(base), (uint32_t)(~(value))))
13433 #define SIM_TOG_SOPT1CFG(base, value) (BME_XOR32(&SIM_SOPT1CFG_REG(base), (uint32_t)(value)))
13434 /*@}*/
13435 
13436 /*
13437  * Constants & macros for individual SIM_SOPT1CFG bitfields
13438  */
13439 
13440 /*!
13441  * @name Register SIM_SOPT1CFG, field URWE[24] (RW)
13442  *
13443  * Writing one to the URWE bit allows the SOPT1 USBREGEN bit to be written. This
13444  * register bit clears after a write to USBREGEN.
13445  *
13446  * Values:
13447  * - 0b0 - SOPT1 USBREGEN cannot be written.
13448  * - 0b1 - SOPT1 USBREGEN can be written.
13449  */
13450 /*@{*/
13451 /*! @brief Read current value of the SIM_SOPT1CFG_URWE field. */
13452 #define SIM_RD_SOPT1CFG_URWE(base) ((SIM_SOPT1CFG_REG(base) & SIM_SOPT1CFG_URWE_MASK) >> SIM_SOPT1CFG_URWE_SHIFT)
13453 #define SIM_BRD_SOPT1CFG_URWE(base) (BME_UBFX32(&SIM_SOPT1CFG_REG(base), SIM_SOPT1CFG_URWE_SHIFT, SIM_SOPT1CFG_URWE_WIDTH))
13454 
13455 /*! @brief Set the URWE field to a new value. */
13456 #define SIM_WR_SOPT1CFG_URWE(base, value) (SIM_RMW_SOPT1CFG(base, SIM_SOPT1CFG_URWE_MASK, SIM_SOPT1CFG_URWE(value)))
13457 #define SIM_BWR_SOPT1CFG_URWE(base, value) (BME_BFI32(&SIM_SOPT1CFG_REG(base), ((uint32_t)(value) << SIM_SOPT1CFG_URWE_SHIFT), SIM_SOPT1CFG_URWE_SHIFT, SIM_SOPT1CFG_URWE_WIDTH))
13458 /*@}*/
13459 
13460 /*!
13461  * @name Register SIM_SOPT1CFG, field UVSWE[25] (RW)
13462  *
13463  * Writing one to the UVSWE bit allows the SOPT1 USBVSTBY bit to be written.
13464  * This register bit clears after a write to USBVSTBY.
13465  *
13466  * Values:
13467  * - 0b0 - SOPT1 USBVSTB cannot be written.
13468  * - 0b1 - SOPT1 USBVSTB can be written.
13469  */
13470 /*@{*/
13471 /*! @brief Read current value of the SIM_SOPT1CFG_UVSWE field. */
13472 #define SIM_RD_SOPT1CFG_UVSWE(base) ((SIM_SOPT1CFG_REG(base) & SIM_SOPT1CFG_UVSWE_MASK) >> SIM_SOPT1CFG_UVSWE_SHIFT)
13473 #define SIM_BRD_SOPT1CFG_UVSWE(base) (BME_UBFX32(&SIM_SOPT1CFG_REG(base), SIM_SOPT1CFG_UVSWE_SHIFT, SIM_SOPT1CFG_UVSWE_WIDTH))
13474 
13475 /*! @brief Set the UVSWE field to a new value. */
13476 #define SIM_WR_SOPT1CFG_UVSWE(base, value) (SIM_RMW_SOPT1CFG(base, SIM_SOPT1CFG_UVSWE_MASK, SIM_SOPT1CFG_UVSWE(value)))
13477 #define SIM_BWR_SOPT1CFG_UVSWE(base, value) (BME_BFI32(&SIM_SOPT1CFG_REG(base), ((uint32_t)(value) << SIM_SOPT1CFG_UVSWE_SHIFT), SIM_SOPT1CFG_UVSWE_SHIFT, SIM_SOPT1CFG_UVSWE_WIDTH))
13478 /*@}*/
13479 
13480 /*!
13481  * @name Register SIM_SOPT1CFG, field USSWE[26] (RW)
13482  *
13483  * Writing one to the USSWE bit allows the SOPT1 USBSSTBY bit to be written.
13484  * This register bit clears after a write to USBSSTBY.
13485  *
13486  * Values:
13487  * - 0b0 - SOPT1 USBSSTB cannot be written.
13488  * - 0b1 - SOPT1 USBSSTB can be written.
13489  */
13490 /*@{*/
13491 /*! @brief Read current value of the SIM_SOPT1CFG_USSWE field. */
13492 #define SIM_RD_SOPT1CFG_USSWE(base) ((SIM_SOPT1CFG_REG(base) & SIM_SOPT1CFG_USSWE_MASK) >> SIM_SOPT1CFG_USSWE_SHIFT)
13493 #define SIM_BRD_SOPT1CFG_USSWE(base) (BME_UBFX32(&SIM_SOPT1CFG_REG(base), SIM_SOPT1CFG_USSWE_SHIFT, SIM_SOPT1CFG_USSWE_WIDTH))
13494 
13495 /*! @brief Set the USSWE field to a new value. */
13496 #define SIM_WR_SOPT1CFG_USSWE(base, value) (SIM_RMW_SOPT1CFG(base, SIM_SOPT1CFG_USSWE_MASK, SIM_SOPT1CFG_USSWE(value)))
13497 #define SIM_BWR_SOPT1CFG_USSWE(base, value) (BME_BFI32(&SIM_SOPT1CFG_REG(base), ((uint32_t)(value) << SIM_SOPT1CFG_USSWE_SHIFT), SIM_SOPT1CFG_USSWE_SHIFT, SIM_SOPT1CFG_USSWE_WIDTH))
13498 /*@}*/
13499 
13500 /*******************************************************************************
13501  * SIM_SOPT2 - System Options Register 2
13502  ******************************************************************************/
13503 
13504 /*!
13505  * @brief SIM_SOPT2 - System Options Register 2 (RW)
13506  *
13507  * Reset value: 0x00000000U
13508  *
13509  * SOPT2 contains the controls for selecting many of the module clock source
13510  * options on this device. See the Clock Distribution chapter for more information
13511  * including clocking diagrams and definitions of device clocks.
13512  */
13513 /*!
13514  * @name Constants and macros for entire SIM_SOPT2 register
13515  */
13516 /*@{*/
13517 #define SIM_RD_SOPT2(base) (SIM_SOPT2_REG(base))
13518 #define SIM_WR_SOPT2(base, value) (SIM_SOPT2_REG(base) = (value))
13519 #define SIM_RMW_SOPT2(base, mask, value) (SIM_WR_SOPT2(base, (SIM_RD_SOPT2(base) & ~(mask)) | (value)))
13520 #define SIM_SET_SOPT2(base, value) (BME_OR32(&SIM_SOPT2_REG(base), (uint32_t)(value)))
13521 #define SIM_CLR_SOPT2(base, value) (BME_AND32(&SIM_SOPT2_REG(base), (uint32_t)(~(value))))
13522 #define SIM_TOG_SOPT2(base, value) (BME_XOR32(&SIM_SOPT2_REG(base), (uint32_t)(value)))
13523 /*@}*/
13524 
13525 /*
13526  * Constants & macros for individual SIM_SOPT2 bitfields
13527  */
13528 
13529 /*!
13530  * @name Register SIM_SOPT2, field RTCCLKOUTSEL[4] (RW)
13531  *
13532  * Selects either the RTC 1 Hz clock or the OSC clock to be output on the
13533  * RTC_CLKOUT pin.
13534  *
13535  * Values:
13536  * - 0b0 - RTC 1 Hz clock is output on the RTC_CLKOUT pin.
13537  * - 0b1 - OSCERCLK clock is output on the RTC_CLKOUT pin.
13538  */
13539 /*@{*/
13540 /*! @brief Read current value of the SIM_SOPT2_RTCCLKOUTSEL field. */
13541 #define SIM_RD_SOPT2_RTCCLKOUTSEL(base) ((SIM_SOPT2_REG(base) & SIM_SOPT2_RTCCLKOUTSEL_MASK) >> SIM_SOPT2_RTCCLKOUTSEL_SHIFT)
13542 #define SIM_BRD_SOPT2_RTCCLKOUTSEL(base) (BME_UBFX32(&SIM_SOPT2_REG(base), SIM_SOPT2_RTCCLKOUTSEL_SHIFT, SIM_SOPT2_RTCCLKOUTSEL_WIDTH))
13543 
13544 /*! @brief Set the RTCCLKOUTSEL field to a new value. */
13545 #define SIM_WR_SOPT2_RTCCLKOUTSEL(base, value) (SIM_RMW_SOPT2(base, SIM_SOPT2_RTCCLKOUTSEL_MASK, SIM_SOPT2_RTCCLKOUTSEL(value)))
13546 #define SIM_BWR_SOPT2_RTCCLKOUTSEL(base, value) (BME_BFI32(&SIM_SOPT2_REG(base), ((uint32_t)(value) << SIM_SOPT2_RTCCLKOUTSEL_SHIFT), SIM_SOPT2_RTCCLKOUTSEL_SHIFT, SIM_SOPT2_RTCCLKOUTSEL_WIDTH))
13547 /*@}*/
13548 
13549 /*!
13550  * @name Register SIM_SOPT2, field CLKOUTSEL[7:5] (RW)
13551  *
13552  * Selects the clock to output on the CLKOUT pin.
13553  *
13554  * Values:
13555  * - 0b000 - Reserved
13556  * - 0b001 - Reserved
13557  * - 0b010 - Bus clock
13558  * - 0b011 - LPO clock (1 kHz)
13559  * - 0b100 - MCGIRCLK
13560  * - 0b101 - Reserved
13561  * - 0b110 - OSCERCLK
13562  * - 0b111 - Reserved
13563  */
13564 /*@{*/
13565 /*! @brief Read current value of the SIM_SOPT2_CLKOUTSEL field. */
13566 #define SIM_RD_SOPT2_CLKOUTSEL(base) ((SIM_SOPT2_REG(base) & SIM_SOPT2_CLKOUTSEL_MASK) >> SIM_SOPT2_CLKOUTSEL_SHIFT)
13567 #define SIM_BRD_SOPT2_CLKOUTSEL(base) (BME_UBFX32(&SIM_SOPT2_REG(base), SIM_SOPT2_CLKOUTSEL_SHIFT, SIM_SOPT2_CLKOUTSEL_WIDTH))
13568 
13569 /*! @brief Set the CLKOUTSEL field to a new value. */
13570 #define SIM_WR_SOPT2_CLKOUTSEL(base, value) (SIM_RMW_SOPT2(base, SIM_SOPT2_CLKOUTSEL_MASK, SIM_SOPT2_CLKOUTSEL(value)))
13571 #define SIM_BWR_SOPT2_CLKOUTSEL(base, value) (BME_BFI32(&SIM_SOPT2_REG(base), ((uint32_t)(value) << SIM_SOPT2_CLKOUTSEL_SHIFT), SIM_SOPT2_CLKOUTSEL_SHIFT, SIM_SOPT2_CLKOUTSEL_WIDTH))
13572 /*@}*/
13573 
13574 /*!
13575  * @name Register SIM_SOPT2, field PLLFLLSEL[16] (RW)
13576  *
13577  * Selects the MCGPLLCLK or MCGFLLCLK clock for various peripheral clocking
13578  * options.
13579  *
13580  * Values:
13581  * - 0b0 - MCGFLLCLK clock
13582  * - 0b1 - MCGPLLCLK clock with fixed divide by two
13583  */
13584 /*@{*/
13585 /*! @brief Read current value of the SIM_SOPT2_PLLFLLSEL field. */
13586 #define SIM_RD_SOPT2_PLLFLLSEL(base) ((SIM_SOPT2_REG(base) & SIM_SOPT2_PLLFLLSEL_MASK) >> SIM_SOPT2_PLLFLLSEL_SHIFT)
13587 #define SIM_BRD_SOPT2_PLLFLLSEL(base) (BME_UBFX32(&SIM_SOPT2_REG(base), SIM_SOPT2_PLLFLLSEL_SHIFT, SIM_SOPT2_PLLFLLSEL_WIDTH))
13588 
13589 /*! @brief Set the PLLFLLSEL field to a new value. */
13590 #define SIM_WR_SOPT2_PLLFLLSEL(base, value) (SIM_RMW_SOPT2(base, SIM_SOPT2_PLLFLLSEL_MASK, SIM_SOPT2_PLLFLLSEL(value)))
13591 #define SIM_BWR_SOPT2_PLLFLLSEL(base, value) (BME_BFI32(&SIM_SOPT2_REG(base), ((uint32_t)(value) << SIM_SOPT2_PLLFLLSEL_SHIFT), SIM_SOPT2_PLLFLLSEL_SHIFT, SIM_SOPT2_PLLFLLSEL_WIDTH))
13592 /*@}*/
13593 
13594 /*!
13595  * @name Register SIM_SOPT2, field USBSRC[18] (RW)
13596  *
13597  * Selects the clock source for the USB 48 MHz clock.
13598  *
13599  * Values:
13600  * - 0b0 - External bypass clock (USB_CLKIN).
13601  * - 0b1 - MCGPLLCLK/2 or MCGFLLCLK clock
13602  */
13603 /*@{*/
13604 /*! @brief Read current value of the SIM_SOPT2_USBSRC field. */
13605 #define SIM_RD_SOPT2_USBSRC(base) ((SIM_SOPT2_REG(base) & SIM_SOPT2_USBSRC_MASK) >> SIM_SOPT2_USBSRC_SHIFT)
13606 #define SIM_BRD_SOPT2_USBSRC(base) (BME_UBFX32(&SIM_SOPT2_REG(base), SIM_SOPT2_USBSRC_SHIFT, SIM_SOPT2_USBSRC_WIDTH))
13607 
13608 /*! @brief Set the USBSRC field to a new value. */
13609 #define SIM_WR_SOPT2_USBSRC(base, value) (SIM_RMW_SOPT2(base, SIM_SOPT2_USBSRC_MASK, SIM_SOPT2_USBSRC(value)))
13610 #define SIM_BWR_SOPT2_USBSRC(base, value) (BME_BFI32(&SIM_SOPT2_REG(base), ((uint32_t)(value) << SIM_SOPT2_USBSRC_SHIFT), SIM_SOPT2_USBSRC_SHIFT, SIM_SOPT2_USBSRC_WIDTH))
13611 /*@}*/
13612 
13613 /*!
13614  * @name Register SIM_SOPT2, field TPMSRC[25:24] (RW)
13615  *
13616  * Selects the clock source for the TPM counter clock
13617  *
13618  * Values:
13619  * - 0b00 - Clock disabled
13620  * - 0b01 - MCGFLLCLK clock or MCGPLLCLK/2
13621  * - 0b10 - OSCERCLK clock
13622  * - 0b11 - MCGIRCLK clock
13623  */
13624 /*@{*/
13625 /*! @brief Read current value of the SIM_SOPT2_TPMSRC field. */
13626 #define SIM_RD_SOPT2_TPMSRC(base) ((SIM_SOPT2_REG(base) & SIM_SOPT2_TPMSRC_MASK) >> SIM_SOPT2_TPMSRC_SHIFT)
13627 #define SIM_BRD_SOPT2_TPMSRC(base) (BME_UBFX32(&SIM_SOPT2_REG(base), SIM_SOPT2_TPMSRC_SHIFT, SIM_SOPT2_TPMSRC_WIDTH))
13628 
13629 /*! @brief Set the TPMSRC field to a new value. */
13630 #define SIM_WR_SOPT2_TPMSRC(base, value) (SIM_RMW_SOPT2(base, SIM_SOPT2_TPMSRC_MASK, SIM_SOPT2_TPMSRC(value)))
13631 #define SIM_BWR_SOPT2_TPMSRC(base, value) (BME_BFI32(&SIM_SOPT2_REG(base), ((uint32_t)(value) << SIM_SOPT2_TPMSRC_SHIFT), SIM_SOPT2_TPMSRC_SHIFT, SIM_SOPT2_TPMSRC_WIDTH))
13632 /*@}*/
13633 
13634 /*!
13635  * @name Register SIM_SOPT2, field UART0SRC[27:26] (RW)
13636  *
13637  * Selects the clock source for the UART0 transmit and receive clock.
13638  *
13639  * Values:
13640  * - 0b00 - Clock disabled
13641  * - 0b01 - MCGFLLCLK clock or MCGPLLCLK/2 clock
13642  * - 0b10 - OSCERCLK clock
13643  * - 0b11 - MCGIRCLK clock
13644  */
13645 /*@{*/
13646 /*! @brief Read current value of the SIM_SOPT2_UART0SRC field. */
13647 #define SIM_RD_SOPT2_UART0SRC(base) ((SIM_SOPT2_REG(base) & SIM_SOPT2_UART0SRC_MASK) >> SIM_SOPT2_UART0SRC_SHIFT)
13648 #define SIM_BRD_SOPT2_UART0SRC(base) (BME_UBFX32(&SIM_SOPT2_REG(base), SIM_SOPT2_UART0SRC_SHIFT, SIM_SOPT2_UART0SRC_WIDTH))
13649 
13650 /*! @brief Set the UART0SRC field to a new value. */
13651 #define SIM_WR_SOPT2_UART0SRC(base, value) (SIM_RMW_SOPT2(base, SIM_SOPT2_UART0SRC_MASK, SIM_SOPT2_UART0SRC(value)))
13652 #define SIM_BWR_SOPT2_UART0SRC(base, value) (BME_BFI32(&SIM_SOPT2_REG(base), ((uint32_t)(value) << SIM_SOPT2_UART0SRC_SHIFT), SIM_SOPT2_UART0SRC_SHIFT, SIM_SOPT2_UART0SRC_WIDTH))
13653 /*@}*/
13654 
13655 /*******************************************************************************
13656  * SIM_SOPT4 - System Options Register 4
13657  ******************************************************************************/
13658 
13659 /*!
13660  * @brief SIM_SOPT4 - System Options Register 4 (RW)
13661  *
13662  * Reset value: 0x00000000U
13663  */
13664 /*!
13665  * @name Constants and macros for entire SIM_SOPT4 register
13666  */
13667 /*@{*/
13668 #define SIM_RD_SOPT4(base) (SIM_SOPT4_REG(base))
13669 #define SIM_WR_SOPT4(base, value) (SIM_SOPT4_REG(base) = (value))
13670 #define SIM_RMW_SOPT4(base, mask, value) (SIM_WR_SOPT4(base, (SIM_RD_SOPT4(base) & ~(mask)) | (value)))
13671 #define SIM_SET_SOPT4(base, value) (BME_OR32(&SIM_SOPT4_REG(base), (uint32_t)(value)))
13672 #define SIM_CLR_SOPT4(base, value) (BME_AND32(&SIM_SOPT4_REG(base), (uint32_t)(~(value))))
13673 #define SIM_TOG_SOPT4(base, value) (BME_XOR32(&SIM_SOPT4_REG(base), (uint32_t)(value)))
13674 /*@}*/
13675 
13676 /*
13677  * Constants & macros for individual SIM_SOPT4 bitfields
13678  */
13679 
13680 /*!
13681  * @name Register SIM_SOPT4, field TPM1CH0SRC[18] (RW)
13682  *
13683  * Selects the source for TPM1 channel 0 input capture. When TPM1 is not in
13684  * input capture mode, clear this field.
13685  *
13686  * Values:
13687  * - 0b0 - TPM1_CH0 signal
13688  * - 0b1 - CMP0 output
13689  */
13690 /*@{*/
13691 /*! @brief Read current value of the SIM_SOPT4_TPM1CH0SRC field. */
13692 #define SIM_RD_SOPT4_TPM1CH0SRC(base) ((SIM_SOPT4_REG(base) & SIM_SOPT4_TPM1CH0SRC_MASK) >> SIM_SOPT4_TPM1CH0SRC_SHIFT)
13693 #define SIM_BRD_SOPT4_TPM1CH0SRC(base) (BME_UBFX32(&SIM_SOPT4_REG(base), SIM_SOPT4_TPM1CH0SRC_SHIFT, SIM_SOPT4_TPM1CH0SRC_WIDTH))
13694 
13695 /*! @brief Set the TPM1CH0SRC field to a new value. */
13696 #define SIM_WR_SOPT4_TPM1CH0SRC(base, value) (SIM_RMW_SOPT4(base, SIM_SOPT4_TPM1CH0SRC_MASK, SIM_SOPT4_TPM1CH0SRC(value)))
13697 #define SIM_BWR_SOPT4_TPM1CH0SRC(base, value) (BME_BFI32(&SIM_SOPT4_REG(base), ((uint32_t)(value) << SIM_SOPT4_TPM1CH0SRC_SHIFT), SIM_SOPT4_TPM1CH0SRC_SHIFT, SIM_SOPT4_TPM1CH0SRC_WIDTH))
13698 /*@}*/
13699 
13700 /*!
13701  * @name Register SIM_SOPT4, field TPM2CH0SRC[20] (RW)
13702  *
13703  * Selects the source for TPM2 channel 0 input capture. When TPM2 is not in
13704  * input capture mode, clear this field.
13705  *
13706  * Values:
13707  * - 0b0 - TPM2_CH0 signal
13708  * - 0b1 - CMP0 output
13709  */
13710 /*@{*/
13711 /*! @brief Read current value of the SIM_SOPT4_TPM2CH0SRC field. */
13712 #define SIM_RD_SOPT4_TPM2CH0SRC(base) ((SIM_SOPT4_REG(base) & SIM_SOPT4_TPM2CH0SRC_MASK) >> SIM_SOPT4_TPM2CH0SRC_SHIFT)
13713 #define SIM_BRD_SOPT4_TPM2CH0SRC(base) (BME_UBFX32(&SIM_SOPT4_REG(base), SIM_SOPT4_TPM2CH0SRC_SHIFT, SIM_SOPT4_TPM2CH0SRC_WIDTH))
13714 
13715 /*! @brief Set the TPM2CH0SRC field to a new value. */
13716 #define SIM_WR_SOPT4_TPM2CH0SRC(base, value) (SIM_RMW_SOPT4(base, SIM_SOPT4_TPM2CH0SRC_MASK, SIM_SOPT4_TPM2CH0SRC(value)))
13717 #define SIM_BWR_SOPT4_TPM2CH0SRC(base, value) (BME_BFI32(&SIM_SOPT4_REG(base), ((uint32_t)(value) << SIM_SOPT4_TPM2CH0SRC_SHIFT), SIM_SOPT4_TPM2CH0SRC_SHIFT, SIM_SOPT4_TPM2CH0SRC_WIDTH))
13718 /*@}*/
13719 
13720 /*!
13721  * @name Register SIM_SOPT4, field TPM0CLKSEL[24] (RW)
13722  *
13723  * Selects the external pin used to drive the clock to the TPM0 module. The
13724  * selected pin must also be configured for the TPM external clock function through
13725  * the appropriate pin control register in the port control module.
13726  *
13727  * Values:
13728  * - 0b0 - TPM0 external clock driven by TPM_CLKIN0 pin.
13729  * - 0b1 - TPM0 external clock driven by TPM_CLKIN1 pin.
13730  */
13731 /*@{*/
13732 /*! @brief Read current value of the SIM_SOPT4_TPM0CLKSEL field. */
13733 #define SIM_RD_SOPT4_TPM0CLKSEL(base) ((SIM_SOPT4_REG(base) & SIM_SOPT4_TPM0CLKSEL_MASK) >> SIM_SOPT4_TPM0CLKSEL_SHIFT)
13734 #define SIM_BRD_SOPT4_TPM0CLKSEL(base) (BME_UBFX32(&SIM_SOPT4_REG(base), SIM_SOPT4_TPM0CLKSEL_SHIFT, SIM_SOPT4_TPM0CLKSEL_WIDTH))
13735 
13736 /*! @brief Set the TPM0CLKSEL field to a new value. */
13737 #define SIM_WR_SOPT4_TPM0CLKSEL(base, value) (SIM_RMW_SOPT4(base, SIM_SOPT4_TPM0CLKSEL_MASK, SIM_SOPT4_TPM0CLKSEL(value)))
13738 #define SIM_BWR_SOPT4_TPM0CLKSEL(base, value) (BME_BFI32(&SIM_SOPT4_REG(base), ((uint32_t)(value) << SIM_SOPT4_TPM0CLKSEL_SHIFT), SIM_SOPT4_TPM0CLKSEL_SHIFT, SIM_SOPT4_TPM0CLKSEL_WIDTH))
13739 /*@}*/
13740 
13741 /*!
13742  * @name Register SIM_SOPT4, field TPM1CLKSEL[25] (RW)
13743  *
13744  * Selects the external pin used to drive the clock to the TPM1 module. The
13745  * selected pin must also be configured for the TPM external clock function through
13746  * the appropriate pin control register in the port control module.
13747  *
13748  * Values:
13749  * - 0b0 - TPM1 external clock driven by TPM_CLKIN0 pin.
13750  * - 0b1 - TPM1 external clock driven by TPM_CLKIN1 pin.
13751  */
13752 /*@{*/
13753 /*! @brief Read current value of the SIM_SOPT4_TPM1CLKSEL field. */
13754 #define SIM_RD_SOPT4_TPM1CLKSEL(base) ((SIM_SOPT4_REG(base) & SIM_SOPT4_TPM1CLKSEL_MASK) >> SIM_SOPT4_TPM1CLKSEL_SHIFT)
13755 #define SIM_BRD_SOPT4_TPM1CLKSEL(base) (BME_UBFX32(&SIM_SOPT4_REG(base), SIM_SOPT4_TPM1CLKSEL_SHIFT, SIM_SOPT4_TPM1CLKSEL_WIDTH))
13756 
13757 /*! @brief Set the TPM1CLKSEL field to a new value. */
13758 #define SIM_WR_SOPT4_TPM1CLKSEL(base, value) (SIM_RMW_SOPT4(base, SIM_SOPT4_TPM1CLKSEL_MASK, SIM_SOPT4_TPM1CLKSEL(value)))
13759 #define SIM_BWR_SOPT4_TPM1CLKSEL(base, value) (BME_BFI32(&SIM_SOPT4_REG(base), ((uint32_t)(value) << SIM_SOPT4_TPM1CLKSEL_SHIFT), SIM_SOPT4_TPM1CLKSEL_SHIFT, SIM_SOPT4_TPM1CLKSEL_WIDTH))
13760 /*@}*/
13761 
13762 /*!
13763  * @name Register SIM_SOPT4, field TPM2CLKSEL[26] (RW)
13764  *
13765  * Selects the external pin used to drive the clock to the TPM2 module. The
13766  * selected pin must also be configured for the TPM external clock function through
13767  * the appropriate pin control register in the port control module.
13768  *
13769  * Values:
13770  * - 0b0 - TPM2 external clock driven by TPM_CLKIN0 pin.
13771  * - 0b1 - TPM2 external clock driven by TPM_CLKIN1 pin.
13772  */
13773 /*@{*/
13774 /*! @brief Read current value of the SIM_SOPT4_TPM2CLKSEL field. */
13775 #define SIM_RD_SOPT4_TPM2CLKSEL(base) ((SIM_SOPT4_REG(base) & SIM_SOPT4_TPM2CLKSEL_MASK) >> SIM_SOPT4_TPM2CLKSEL_SHIFT)
13776 #define SIM_BRD_SOPT4_TPM2CLKSEL(base) (BME_UBFX32(&SIM_SOPT4_REG(base), SIM_SOPT4_TPM2CLKSEL_SHIFT, SIM_SOPT4_TPM2CLKSEL_WIDTH))
13777 
13778 /*! @brief Set the TPM2CLKSEL field to a new value. */
13779 #define SIM_WR_SOPT4_TPM2CLKSEL(base, value) (SIM_RMW_SOPT4(base, SIM_SOPT4_TPM2CLKSEL_MASK, SIM_SOPT4_TPM2CLKSEL(value)))
13780 #define SIM_BWR_SOPT4_TPM2CLKSEL(base, value) (BME_BFI32(&SIM_SOPT4_REG(base), ((uint32_t)(value) << SIM_SOPT4_TPM2CLKSEL_SHIFT), SIM_SOPT4_TPM2CLKSEL_SHIFT, SIM_SOPT4_TPM2CLKSEL_WIDTH))
13781 /*@}*/
13782 
13783 /*******************************************************************************
13784  * SIM_SOPT5 - System Options Register 5
13785  ******************************************************************************/
13786 
13787 /*!
13788  * @brief SIM_SOPT5 - System Options Register 5 (RW)
13789  *
13790  * Reset value: 0x00000000U
13791  */
13792 /*!
13793  * @name Constants and macros for entire SIM_SOPT5 register
13794  */
13795 /*@{*/
13796 #define SIM_RD_SOPT5(base) (SIM_SOPT5_REG(base))
13797 #define SIM_WR_SOPT5(base, value) (SIM_SOPT5_REG(base) = (value))
13798 #define SIM_RMW_SOPT5(base, mask, value) (SIM_WR_SOPT5(base, (SIM_RD_SOPT5(base) & ~(mask)) | (value)))
13799 #define SIM_SET_SOPT5(base, value) (BME_OR32(&SIM_SOPT5_REG(base), (uint32_t)(value)))
13800 #define SIM_CLR_SOPT5(base, value) (BME_AND32(&SIM_SOPT5_REG(base), (uint32_t)(~(value))))
13801 #define SIM_TOG_SOPT5(base, value) (BME_XOR32(&SIM_SOPT5_REG(base), (uint32_t)(value)))
13802 /*@}*/
13803 
13804 /*
13805  * Constants & macros for individual SIM_SOPT5 bitfields
13806  */
13807 
13808 /*!
13809  * @name Register SIM_SOPT5, field UART0TXSRC[1:0] (RW)
13810  *
13811  * Selects the source for the UART0 transmit data.
13812  *
13813  * Values:
13814  * - 0b00 - UART0_TX pin
13815  * - 0b01 - UART0_TX pin modulated with TPM1 channel 0 output
13816  * - 0b10 - UART0_TX pin modulated with TPM2 channel 0 output
13817  * - 0b11 - Reserved
13818  */
13819 /*@{*/
13820 /*! @brief Read current value of the SIM_SOPT5_UART0TXSRC field. */
13821 #define SIM_RD_SOPT5_UART0TXSRC(base) ((SIM_SOPT5_REG(base) & SIM_SOPT5_UART0TXSRC_MASK) >> SIM_SOPT5_UART0TXSRC_SHIFT)
13822 #define SIM_BRD_SOPT5_UART0TXSRC(base) (BME_UBFX32(&SIM_SOPT5_REG(base), SIM_SOPT5_UART0TXSRC_SHIFT, SIM_SOPT5_UART0TXSRC_WIDTH))
13823 
13824 /*! @brief Set the UART0TXSRC field to a new value. */
13825 #define SIM_WR_SOPT5_UART0TXSRC(base, value) (SIM_RMW_SOPT5(base, SIM_SOPT5_UART0TXSRC_MASK, SIM_SOPT5_UART0TXSRC(value)))
13826 #define SIM_BWR_SOPT5_UART0TXSRC(base, value) (BME_BFI32(&SIM_SOPT5_REG(base), ((uint32_t)(value) << SIM_SOPT5_UART0TXSRC_SHIFT), SIM_SOPT5_UART0TXSRC_SHIFT, SIM_SOPT5_UART0TXSRC_WIDTH))
13827 /*@}*/
13828 
13829 /*!
13830  * @name Register SIM_SOPT5, field UART0RXSRC[2] (RW)
13831  *
13832  * Selects the source for the UART0 receive data.
13833  *
13834  * Values:
13835  * - 0b0 - UART0_RX pin
13836  * - 0b1 - CMP0 output
13837  */
13838 /*@{*/
13839 /*! @brief Read current value of the SIM_SOPT5_UART0RXSRC field. */
13840 #define SIM_RD_SOPT5_UART0RXSRC(base) ((SIM_SOPT5_REG(base) & SIM_SOPT5_UART0RXSRC_MASK) >> SIM_SOPT5_UART0RXSRC_SHIFT)
13841 #define SIM_BRD_SOPT5_UART0RXSRC(base) (BME_UBFX32(&SIM_SOPT5_REG(base), SIM_SOPT5_UART0RXSRC_SHIFT, SIM_SOPT5_UART0RXSRC_WIDTH))
13842 
13843 /*! @brief Set the UART0RXSRC field to a new value. */
13844 #define SIM_WR_SOPT5_UART0RXSRC(base, value) (SIM_RMW_SOPT5(base, SIM_SOPT5_UART0RXSRC_MASK, SIM_SOPT5_UART0RXSRC(value)))
13845 #define SIM_BWR_SOPT5_UART0RXSRC(base, value) (BME_BFI32(&SIM_SOPT5_REG(base), ((uint32_t)(value) << SIM_SOPT5_UART0RXSRC_SHIFT), SIM_SOPT5_UART0RXSRC_SHIFT, SIM_SOPT5_UART0RXSRC_WIDTH))
13846 /*@}*/
13847 
13848 /*!
13849  * @name Register SIM_SOPT5, field UART1TXSRC[5:4] (RW)
13850  *
13851  * Selects the source for the UART1 transmit data.
13852  *
13853  * Values:
13854  * - 0b00 - UART1_TX pin
13855  * - 0b01 - UART1_TX pin modulated with TPM1 channel 0 output
13856  * - 0b10 - UART1_TX pin modulated with TPM2 channel 0 output
13857  * - 0b11 - Reserved
13858  */
13859 /*@{*/
13860 /*! @brief Read current value of the SIM_SOPT5_UART1TXSRC field. */
13861 #define SIM_RD_SOPT5_UART1TXSRC(base) ((SIM_SOPT5_REG(base) & SIM_SOPT5_UART1TXSRC_MASK) >> SIM_SOPT5_UART1TXSRC_SHIFT)
13862 #define SIM_BRD_SOPT5_UART1TXSRC(base) (BME_UBFX32(&SIM_SOPT5_REG(base), SIM_SOPT5_UART1TXSRC_SHIFT, SIM_SOPT5_UART1TXSRC_WIDTH))
13863 
13864 /*! @brief Set the UART1TXSRC field to a new value. */
13865 #define SIM_WR_SOPT5_UART1TXSRC(base, value) (SIM_RMW_SOPT5(base, SIM_SOPT5_UART1TXSRC_MASK, SIM_SOPT5_UART1TXSRC(value)))
13866 #define SIM_BWR_SOPT5_UART1TXSRC(base, value) (BME_BFI32(&SIM_SOPT5_REG(base), ((uint32_t)(value) << SIM_SOPT5_UART1TXSRC_SHIFT), SIM_SOPT5_UART1TXSRC_SHIFT, SIM_SOPT5_UART1TXSRC_WIDTH))
13867 /*@}*/
13868 
13869 /*!
13870  * @name Register SIM_SOPT5, field UART1RXSRC[6] (RW)
13871  *
13872  * Selects the source for the UART1 receive data.
13873  *
13874  * Values:
13875  * - 0b0 - UART1_RX pin
13876  * - 0b1 - CMP0 output
13877  */
13878 /*@{*/
13879 /*! @brief Read current value of the SIM_SOPT5_UART1RXSRC field. */
13880 #define SIM_RD_SOPT5_UART1RXSRC(base) ((SIM_SOPT5_REG(base) & SIM_SOPT5_UART1RXSRC_MASK) >> SIM_SOPT5_UART1RXSRC_SHIFT)
13881 #define SIM_BRD_SOPT5_UART1RXSRC(base) (BME_UBFX32(&SIM_SOPT5_REG(base), SIM_SOPT5_UART1RXSRC_SHIFT, SIM_SOPT5_UART1RXSRC_WIDTH))
13882 
13883 /*! @brief Set the UART1RXSRC field to a new value. */
13884 #define SIM_WR_SOPT5_UART1RXSRC(base, value) (SIM_RMW_SOPT5(base, SIM_SOPT5_UART1RXSRC_MASK, SIM_SOPT5_UART1RXSRC(value)))
13885 #define SIM_BWR_SOPT5_UART1RXSRC(base, value) (BME_BFI32(&SIM_SOPT5_REG(base), ((uint32_t)(value) << SIM_SOPT5_UART1RXSRC_SHIFT), SIM_SOPT5_UART1RXSRC_SHIFT, SIM_SOPT5_UART1RXSRC_WIDTH))
13886 /*@}*/
13887 
13888 /*!
13889  * @name Register SIM_SOPT5, field UART0ODE[16] (RW)
13890  *
13891  * Values:
13892  * - 0b0 - Open drain is disabled on UART0
13893  * - 0b1 - Open drain is enabled on UART0
13894  */
13895 /*@{*/
13896 /*! @brief Read current value of the SIM_SOPT5_UART0ODE field. */
13897 #define SIM_RD_SOPT5_UART0ODE(base) ((SIM_SOPT5_REG(base) & SIM_SOPT5_UART0ODE_MASK) >> SIM_SOPT5_UART0ODE_SHIFT)
13898 #define SIM_BRD_SOPT5_UART0ODE(base) (BME_UBFX32(&SIM_SOPT5_REG(base), SIM_SOPT5_UART0ODE_SHIFT, SIM_SOPT5_UART0ODE_WIDTH))
13899 
13900 /*! @brief Set the UART0ODE field to a new value. */
13901 #define SIM_WR_SOPT5_UART0ODE(base, value) (SIM_RMW_SOPT5(base, SIM_SOPT5_UART0ODE_MASK, SIM_SOPT5_UART0ODE(value)))
13902 #define SIM_BWR_SOPT5_UART0ODE(base, value) (BME_BFI32(&SIM_SOPT5_REG(base), ((uint32_t)(value) << SIM_SOPT5_UART0ODE_SHIFT), SIM_SOPT5_UART0ODE_SHIFT, SIM_SOPT5_UART0ODE_WIDTH))
13903 /*@}*/
13904 
13905 /*!
13906  * @name Register SIM_SOPT5, field UART1ODE[17] (RW)
13907  *
13908  * Values:
13909  * - 0b0 - Open drain is disabled on UART1
13910  * - 0b1 - Open drain is enabled on UART1
13911  */
13912 /*@{*/
13913 /*! @brief Read current value of the SIM_SOPT5_UART1ODE field. */
13914 #define SIM_RD_SOPT5_UART1ODE(base) ((SIM_SOPT5_REG(base) & SIM_SOPT5_UART1ODE_MASK) >> SIM_SOPT5_UART1ODE_SHIFT)
13915 #define SIM_BRD_SOPT5_UART1ODE(base) (BME_UBFX32(&SIM_SOPT5_REG(base), SIM_SOPT5_UART1ODE_SHIFT, SIM_SOPT5_UART1ODE_WIDTH))
13916 
13917 /*! @brief Set the UART1ODE field to a new value. */
13918 #define SIM_WR_SOPT5_UART1ODE(base, value) (SIM_RMW_SOPT5(base, SIM_SOPT5_UART1ODE_MASK, SIM_SOPT5_UART1ODE(value)))
13919 #define SIM_BWR_SOPT5_UART1ODE(base, value) (BME_BFI32(&SIM_SOPT5_REG(base), ((uint32_t)(value) << SIM_SOPT5_UART1ODE_SHIFT), SIM_SOPT5_UART1ODE_SHIFT, SIM_SOPT5_UART1ODE_WIDTH))
13920 /*@}*/
13921 
13922 /*!
13923  * @name Register SIM_SOPT5, field UART2ODE[18] (RW)
13924  *
13925  * Values:
13926  * - 0b0 - Open drain is disabled on UART2
13927  * - 0b1 - Open drain is enabled on UART2
13928  */
13929 /*@{*/
13930 /*! @brief Read current value of the SIM_SOPT5_UART2ODE field. */
13931 #define SIM_RD_SOPT5_UART2ODE(base) ((SIM_SOPT5_REG(base) & SIM_SOPT5_UART2ODE_MASK) >> SIM_SOPT5_UART2ODE_SHIFT)
13932 #define SIM_BRD_SOPT5_UART2ODE(base) (BME_UBFX32(&SIM_SOPT5_REG(base), SIM_SOPT5_UART2ODE_SHIFT, SIM_SOPT5_UART2ODE_WIDTH))
13933 
13934 /*! @brief Set the UART2ODE field to a new value. */
13935 #define SIM_WR_SOPT5_UART2ODE(base, value) (SIM_RMW_SOPT5(base, SIM_SOPT5_UART2ODE_MASK, SIM_SOPT5_UART2ODE(value)))
13936 #define SIM_BWR_SOPT5_UART2ODE(base, value) (BME_BFI32(&SIM_SOPT5_REG(base), ((uint32_t)(value) << SIM_SOPT5_UART2ODE_SHIFT), SIM_SOPT5_UART2ODE_SHIFT, SIM_SOPT5_UART2ODE_WIDTH))
13937 /*@}*/
13938 
13939 /*******************************************************************************
13940  * SIM_SOPT7 - System Options Register 7
13941  ******************************************************************************/
13942 
13943 /*!
13944  * @brief SIM_SOPT7 - System Options Register 7 (RW)
13945  *
13946  * Reset value: 0x00000000U
13947  */
13948 /*!
13949  * @name Constants and macros for entire SIM_SOPT7 register
13950  */
13951 /*@{*/
13952 #define SIM_RD_SOPT7(base) (SIM_SOPT7_REG(base))
13953 #define SIM_WR_SOPT7(base, value) (SIM_SOPT7_REG(base) = (value))
13954 #define SIM_RMW_SOPT7(base, mask, value) (SIM_WR_SOPT7(base, (SIM_RD_SOPT7(base) & ~(mask)) | (value)))
13955 #define SIM_SET_SOPT7(base, value) (BME_OR32(&SIM_SOPT7_REG(base), (uint32_t)(value)))
13956 #define SIM_CLR_SOPT7(base, value) (BME_AND32(&SIM_SOPT7_REG(base), (uint32_t)(~(value))))
13957 #define SIM_TOG_SOPT7(base, value) (BME_XOR32(&SIM_SOPT7_REG(base), (uint32_t)(value)))
13958 /*@}*/
13959 
13960 /*
13961  * Constants & macros for individual SIM_SOPT7 bitfields
13962  */
13963 
13964 /*!
13965  * @name Register SIM_SOPT7, field ADC0TRGSEL[3:0] (RW)
13966  *
13967  * Selects the ADC0 trigger source when alternative triggers are functional in
13968  * stop and VLPS modes. .
13969  *
13970  * Values:
13971  * - 0b0000 - External trigger pin input (EXTRG_IN)
13972  * - 0b0001 - CMP0 output
13973  * - 0b0010 - Reserved
13974  * - 0b0011 - Reserved
13975  * - 0b0100 - PIT trigger 0
13976  * - 0b0101 - PIT trigger 1
13977  * - 0b0110 - Reserved
13978  * - 0b0111 - Reserved
13979  * - 0b1000 - TPM0 overflow
13980  * - 0b1001 - TPM1 overflow
13981  * - 0b1010 - TPM2 overflow
13982  * - 0b1011 - Reserved
13983  * - 0b1100 - RTC alarm
13984  * - 0b1101 - RTC seconds
13985  * - 0b1110 - LPTMR0 trigger
13986  * - 0b1111 - Reserved
13987  */
13988 /*@{*/
13989 /*! @brief Read current value of the SIM_SOPT7_ADC0TRGSEL field. */
13990 #define SIM_RD_SOPT7_ADC0TRGSEL(base) ((SIM_SOPT7_REG(base) & SIM_SOPT7_ADC0TRGSEL_MASK) >> SIM_SOPT7_ADC0TRGSEL_SHIFT)
13991 #define SIM_BRD_SOPT7_ADC0TRGSEL(base) (BME_UBFX32(&SIM_SOPT7_REG(base), SIM_SOPT7_ADC0TRGSEL_SHIFT, SIM_SOPT7_ADC0TRGSEL_WIDTH))
13992 
13993 /*! @brief Set the ADC0TRGSEL field to a new value. */
13994 #define SIM_WR_SOPT7_ADC0TRGSEL(base, value) (SIM_RMW_SOPT7(base, SIM_SOPT7_ADC0TRGSEL_MASK, SIM_SOPT7_ADC0TRGSEL(value)))
13995 #define SIM_BWR_SOPT7_ADC0TRGSEL(base, value) (BME_BFI32(&SIM_SOPT7_REG(base), ((uint32_t)(value) << SIM_SOPT7_ADC0TRGSEL_SHIFT), SIM_SOPT7_ADC0TRGSEL_SHIFT, SIM_SOPT7_ADC0TRGSEL_WIDTH))
13996 /*@}*/
13997 
13998 /*!
13999  * @name Register SIM_SOPT7, field ADC0PRETRGSEL[4] (RW)
14000  *
14001  * Selects the ADC0 pre-trigger source when alternative triggers are enabled
14002  * through ADC0ALTTRGEN.
14003  *
14004  * Values:
14005  * - 0b0 - Pre-trigger A
14006  * - 0b1 - Pre-trigger B
14007  */
14008 /*@{*/
14009 /*! @brief Read current value of the SIM_SOPT7_ADC0PRETRGSEL field. */
14010 #define SIM_RD_SOPT7_ADC0PRETRGSEL(base) ((SIM_SOPT7_REG(base) & SIM_SOPT7_ADC0PRETRGSEL_MASK) >> SIM_SOPT7_ADC0PRETRGSEL_SHIFT)
14011 #define SIM_BRD_SOPT7_ADC0PRETRGSEL(base) (BME_UBFX32(&SIM_SOPT7_REG(base), SIM_SOPT7_ADC0PRETRGSEL_SHIFT, SIM_SOPT7_ADC0PRETRGSEL_WIDTH))
14012 
14013 /*! @brief Set the ADC0PRETRGSEL field to a new value. */
14014 #define SIM_WR_SOPT7_ADC0PRETRGSEL(base, value) (SIM_RMW_SOPT7(base, SIM_SOPT7_ADC0PRETRGSEL_MASK, SIM_SOPT7_ADC0PRETRGSEL(value)))
14015 #define SIM_BWR_SOPT7_ADC0PRETRGSEL(base, value) (BME_BFI32(&SIM_SOPT7_REG(base), ((uint32_t)(value) << SIM_SOPT7_ADC0PRETRGSEL_SHIFT), SIM_SOPT7_ADC0PRETRGSEL_SHIFT, SIM_SOPT7_ADC0PRETRGSEL_WIDTH))
14016 /*@}*/
14017 
14018 /*!
14019  * @name Register SIM_SOPT7, field ADC0ALTTRGEN[7] (RW)
14020  *
14021  * Enable alternative conversion triggers for ADC0.
14022  *
14023  * Values:
14024  * - 0b0 - TPM1 channel 0 (A) and channel 1 (B) triggers selected for ADC0.
14025  * - 0b1 - Alternate trigger selected for ADC0.
14026  */
14027 /*@{*/
14028 /*! @brief Read current value of the SIM_SOPT7_ADC0ALTTRGEN field. */
14029 #define SIM_RD_SOPT7_ADC0ALTTRGEN(base) ((SIM_SOPT7_REG(base) & SIM_SOPT7_ADC0ALTTRGEN_MASK) >> SIM_SOPT7_ADC0ALTTRGEN_SHIFT)
14030 #define SIM_BRD_SOPT7_ADC0ALTTRGEN(base) (BME_UBFX32(&SIM_SOPT7_REG(base), SIM_SOPT7_ADC0ALTTRGEN_SHIFT, SIM_SOPT7_ADC0ALTTRGEN_WIDTH))
14031 
14032 /*! @brief Set the ADC0ALTTRGEN field to a new value. */
14033 #define SIM_WR_SOPT7_ADC0ALTTRGEN(base, value) (SIM_RMW_SOPT7(base, SIM_SOPT7_ADC0ALTTRGEN_MASK, SIM_SOPT7_ADC0ALTTRGEN(value)))
14034 #define SIM_BWR_SOPT7_ADC0ALTTRGEN(base, value) (BME_BFI32(&SIM_SOPT7_REG(base), ((uint32_t)(value) << SIM_SOPT7_ADC0ALTTRGEN_SHIFT), SIM_SOPT7_ADC0ALTTRGEN_SHIFT, SIM_SOPT7_ADC0ALTTRGEN_WIDTH))
14035 /*@}*/
14036 
14037 /*******************************************************************************
14038  * SIM_SDID - System Device Identification Register
14039  ******************************************************************************/
14040 
14041 /*!
14042  * @brief SIM_SDID - System Device Identification Register (RO)
14043  *
14044  * Reset value: 0x00100480U
14045  */
14046 /*!
14047  * @name Constants and macros for entire SIM_SDID register
14048  */
14049 /*@{*/
14050 #define SIM_RD_SDID(base) (SIM_SDID_REG(base))
14051 /*@}*/
14052 
14053 /*
14054  * Constants & macros for individual SIM_SDID bitfields
14055  */
14056 
14057 /*!
14058  * @name Register SIM_SDID, field PINID[3:0] (RO)
14059  *
14060  * Specifies the pincount of the device.
14061  *
14062  * Values:
14063  * - 0b0000 - 16-pin
14064  * - 0b0001 - 24-pin
14065  * - 0b0010 - 32-pin
14066  * - 0b0011 - Reserved
14067  * - 0b0100 - 48-pin
14068  * - 0b0101 - 64-pin
14069  * - 0b0110 - 80-pin
14070  * - 0b0111 - Reserved
14071  * - 0b1000 - 100-pin
14072  * - 0b1001 - Reserved
14073  * - 0b1010 - Reserved
14074  * - 0b1011 - Reserved
14075  * - 0b1100 - Reserved
14076  * - 0b1101 - Reserved
14077  * - 0b1110 - Reserved
14078  * - 0b1111 - Reserved
14079  */
14080 /*@{*/
14081 /*! @brief Read current value of the SIM_SDID_PINID field. */
14082 #define SIM_RD_SDID_PINID(base) ((SIM_SDID_REG(base) & SIM_SDID_PINID_MASK) >> SIM_SDID_PINID_SHIFT)
14083 #define SIM_BRD_SDID_PINID(base) (BME_UBFX32(&SIM_SDID_REG(base), SIM_SDID_PINID_SHIFT, SIM_SDID_PINID_WIDTH))
14084 /*@}*/
14085 
14086 /*!
14087  * @name Register SIM_SDID, field DIEID[11:7] (RO)
14088  *
14089  * Specifies the silicon implementation number for the device.
14090  */
14091 /*@{*/
14092 /*! @brief Read current value of the SIM_SDID_DIEID field. */
14093 #define SIM_RD_SDID_DIEID(base) ((SIM_SDID_REG(base) & SIM_SDID_DIEID_MASK) >> SIM_SDID_DIEID_SHIFT)
14094 #define SIM_BRD_SDID_DIEID(base) (BME_UBFX32(&SIM_SDID_REG(base), SIM_SDID_DIEID_SHIFT, SIM_SDID_DIEID_WIDTH))
14095 /*@}*/
14096 
14097 /*!
14098  * @name Register SIM_SDID, field REVID[15:12] (RO)
14099  *
14100  * Specifies the silicon implementation number for the device.
14101  */
14102 /*@{*/
14103 /*! @brief Read current value of the SIM_SDID_REVID field. */
14104 #define SIM_RD_SDID_REVID(base) ((SIM_SDID_REG(base) & SIM_SDID_REVID_MASK) >> SIM_SDID_REVID_SHIFT)
14105 #define SIM_BRD_SDID_REVID(base) (BME_UBFX32(&SIM_SDID_REG(base), SIM_SDID_REVID_SHIFT, SIM_SDID_REVID_WIDTH))
14106 /*@}*/
14107 
14108 /*!
14109  * @name Register SIM_SDID, field SRAMSIZE[19:16] (RO)
14110  *
14111  * Specifies the size of the System SRAM
14112  *
14113  * Values:
14114  * - 0b0000 - 0.5 KB
14115  * - 0b0001 - 1 KB
14116  * - 0b0010 - 2 KB
14117  * - 0b0011 - 4 KB
14118  * - 0b0100 - 8 KB
14119  * - 0b0101 - 16 KB
14120  * - 0b0110 - 32 KB
14121  * - 0b0111 - 64 KB
14122  */
14123 /*@{*/
14124 /*! @brief Read current value of the SIM_SDID_SRAMSIZE field. */
14125 #define SIM_RD_SDID_SRAMSIZE(base) ((SIM_SDID_REG(base) & SIM_SDID_SRAMSIZE_MASK) >> SIM_SDID_SRAMSIZE_SHIFT)
14126 #define SIM_BRD_SDID_SRAMSIZE(base) (BME_UBFX32(&SIM_SDID_REG(base), SIM_SDID_SRAMSIZE_SHIFT, SIM_SDID_SRAMSIZE_WIDTH))
14127 /*@}*/
14128 
14129 /*!
14130  * @name Register SIM_SDID, field SERIESID[23:20] (RO)
14131  *
14132  * Specifies the Kinetis family of the device.
14133  *
14134  * Values:
14135  * - 0b0001 - KL family
14136  */
14137 /*@{*/
14138 /*! @brief Read current value of the SIM_SDID_SERIESID field. */
14139 #define SIM_RD_SDID_SERIESID(base) ((SIM_SDID_REG(base) & SIM_SDID_SERIESID_MASK) >> SIM_SDID_SERIESID_SHIFT)
14140 #define SIM_BRD_SDID_SERIESID(base) (BME_UBFX32(&SIM_SDID_REG(base), SIM_SDID_SERIESID_SHIFT, SIM_SDID_SERIESID_WIDTH))
14141 /*@}*/
14142 
14143 /*!
14144  * @name Register SIM_SDID, field SUBFAMID[27:24] (RO)
14145  *
14146  * Specifies the Kinetis sub-family of the device.
14147  *
14148  * Values:
14149  * - 0b0010 - KLx2 Subfamily (low end)
14150  * - 0b0100 - KLx4 Subfamily (basic analog)
14151  * - 0b0101 - KLx5 Subfamily (advanced analog)
14152  * - 0b0110 - KLx6 Subfamily (advanced analog with I2S)
14153  */
14154 /*@{*/
14155 /*! @brief Read current value of the SIM_SDID_SUBFAMID field. */
14156 #define SIM_RD_SDID_SUBFAMID(base) ((SIM_SDID_REG(base) & SIM_SDID_SUBFAMID_MASK) >> SIM_SDID_SUBFAMID_SHIFT)
14157 #define SIM_BRD_SDID_SUBFAMID(base) (BME_UBFX32(&SIM_SDID_REG(base), SIM_SDID_SUBFAMID_SHIFT, SIM_SDID_SUBFAMID_WIDTH))
14158 /*@}*/
14159 
14160 /*!
14161  * @name Register SIM_SDID, field FAMID[31:28] (RO)
14162  *
14163  * Specifies the Kinetis family of the device.
14164  *
14165  * Values:
14166  * - 0b0000 - KL0x Family (low end)
14167  * - 0b0001 - KL1x Family (basic)
14168  * - 0b0010 - KL2x Family (USB)
14169  * - 0b0011 - KL3x Family (Segment LCD)
14170  * - 0b0100 - KL4x Family (USB and Segment LCD)
14171  */
14172 /*@{*/
14173 /*! @brief Read current value of the SIM_SDID_FAMID field. */
14174 #define SIM_RD_SDID_FAMID(base) ((SIM_SDID_REG(base) & SIM_SDID_FAMID_MASK) >> SIM_SDID_FAMID_SHIFT)
14175 #define SIM_BRD_SDID_FAMID(base) (BME_UBFX32(&SIM_SDID_REG(base), SIM_SDID_FAMID_SHIFT, SIM_SDID_FAMID_WIDTH))
14176 /*@}*/
14177 
14178 /*******************************************************************************
14179  * SIM_SCGC4 - System Clock Gating Control Register 4
14180  ******************************************************************************/
14181 
14182 /*!
14183  * @brief SIM_SCGC4 - System Clock Gating Control Register 4 (RW)
14184  *
14185  * Reset value: 0xF0000030U
14186  */
14187 /*!
14188  * @name Constants and macros for entire SIM_SCGC4 register
14189  */
14190 /*@{*/
14191 #define SIM_RD_SCGC4(base) (SIM_SCGC4_REG(base))
14192 #define SIM_WR_SCGC4(base, value) (SIM_SCGC4_REG(base) = (value))
14193 #define SIM_RMW_SCGC4(base, mask, value) (SIM_WR_SCGC4(base, (SIM_RD_SCGC4(base) & ~(mask)) | (value)))
14194 #define SIM_SET_SCGC4(base, value) (BME_OR32(&SIM_SCGC4_REG(base), (uint32_t)(value)))
14195 #define SIM_CLR_SCGC4(base, value) (BME_AND32(&SIM_SCGC4_REG(base), (uint32_t)(~(value))))
14196 #define SIM_TOG_SCGC4(base, value) (BME_XOR32(&SIM_SCGC4_REG(base), (uint32_t)(value)))
14197 /*@}*/
14198 
14199 /* Unified clock gate bit access macros */
14200 #define SIM_SCGC_BIT_REG(base, index) (*((volatile uint32_t *)&SIM_SCGC4_REG(base) + (((uint32_t)(index) >> 5) - 3U)))
14201 #define SIM_SCGC_BIT_SHIFT(index) ((uint32_t)(index) & ((1U << 5) - 1U))
14202 #define SIM_RD_SCGC_BIT(base, index) (SIM_SCGC_BIT_REG((base), (index)) & (1U << SIM_SCGC_BIT_SHIFT(index)))
14203 #define SIM_BRD_SCGC_BIT(base, index) (BME_UBFX32(&SIM_SCGC_BIT_REG((base), (index)), SIM_SCGC_BIT_SHIFT(index), 1))
14204 #define SIM_WR_SCGC_BIT(base, index, value) (SIM_SCGC_BIT_REG((base), (index)) = (SIM_SCGC_BIT_REG((base), (index)) & ~(1U << SIM_SCGC_BIT_SHIFT(index))) | ((uint32_t)(value) << SIM_SCGC_BIT_SHIFT(index)))
14205 #define SIM_BWR_SCGC_BIT(base, index, value) (BME_BFI32(&SIM_SCGC_BIT_REG((base), (index)), ((uint32_t)(value) << SIM_SCGC_BIT_SHIFT(index)), SIM_SCGC_BIT_SHIFT(index), 1))
14206 
14207 /*
14208  * Constants & macros for individual SIM_SCGC4 bitfields
14209  */
14210 
14211 /*!
14212  * @name Register SIM_SCGC4, field I2C0[6] (RW)
14213  *
14214  * This bit controls the clock gate to the I 2 C0 module.
14215  *
14216  * Values:
14217  * - 0b0 - Clock disabled
14218  * - 0b1 - Clock enabled
14219  */
14220 /*@{*/
14221 /*! @brief Read current value of the SIM_SCGC4_I2C0 field. */
14222 #define SIM_RD_SCGC4_I2C0(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_I2C0_MASK) >> SIM_SCGC4_I2C0_SHIFT)
14223 #define SIM_BRD_SCGC4_I2C0(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_I2C0_SHIFT, SIM_SCGC4_I2C0_WIDTH))
14224 
14225 /*! @brief Set the I2C0 field to a new value. */
14226 #define SIM_WR_SCGC4_I2C0(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_I2C0_MASK, SIM_SCGC4_I2C0(value)))
14227 #define SIM_BWR_SCGC4_I2C0(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_I2C0_SHIFT), SIM_SCGC4_I2C0_SHIFT, SIM_SCGC4_I2C0_WIDTH))
14228 /*@}*/
14229 
14230 /*!
14231  * @name Register SIM_SCGC4, field I2C1[7] (RW)
14232  *
14233  * This bit controls the clock gate to the I 2 C1 module.
14234  *
14235  * Values:
14236  * - 0b0 - Clock disabled
14237  * - 0b1 - Clock enabled
14238  */
14239 /*@{*/
14240 /*! @brief Read current value of the SIM_SCGC4_I2C1 field. */
14241 #define SIM_RD_SCGC4_I2C1(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_I2C1_MASK) >> SIM_SCGC4_I2C1_SHIFT)
14242 #define SIM_BRD_SCGC4_I2C1(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_I2C1_SHIFT, SIM_SCGC4_I2C1_WIDTH))
14243 
14244 /*! @brief Set the I2C1 field to a new value. */
14245 #define SIM_WR_SCGC4_I2C1(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_I2C1_MASK, SIM_SCGC4_I2C1(value)))
14246 #define SIM_BWR_SCGC4_I2C1(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_I2C1_SHIFT), SIM_SCGC4_I2C1_SHIFT, SIM_SCGC4_I2C1_WIDTH))
14247 /*@}*/
14248 
14249 /*!
14250  * @name Register SIM_SCGC4, field UART0[10] (RW)
14251  *
14252  * This bit controls the clock gate to the UART0 module.
14253  *
14254  * Values:
14255  * - 0b0 - Clock disabled
14256  * - 0b1 - Clock enabled
14257  */
14258 /*@{*/
14259 /*! @brief Read current value of the SIM_SCGC4_UART0 field. */
14260 #define SIM_RD_SCGC4_UART0(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_UART0_MASK) >> SIM_SCGC4_UART0_SHIFT)
14261 #define SIM_BRD_SCGC4_UART0(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_UART0_SHIFT, SIM_SCGC4_UART0_WIDTH))
14262 
14263 /*! @brief Set the UART0 field to a new value. */
14264 #define SIM_WR_SCGC4_UART0(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_UART0_MASK, SIM_SCGC4_UART0(value)))
14265 #define SIM_BWR_SCGC4_UART0(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_UART0_SHIFT), SIM_SCGC4_UART0_SHIFT, SIM_SCGC4_UART0_WIDTH))
14266 /*@}*/
14267 
14268 /*!
14269  * @name Register SIM_SCGC4, field UART1[11] (RW)
14270  *
14271  * This bit controls the clock gate to the UART1 module.
14272  *
14273  * Values:
14274  * - 0b0 - Clock disabled
14275  * - 0b1 - Clock enabled
14276  */
14277 /*@{*/
14278 /*! @brief Read current value of the SIM_SCGC4_UART1 field. */
14279 #define SIM_RD_SCGC4_UART1(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_UART1_MASK) >> SIM_SCGC4_UART1_SHIFT)
14280 #define SIM_BRD_SCGC4_UART1(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_UART1_SHIFT, SIM_SCGC4_UART1_WIDTH))
14281 
14282 /*! @brief Set the UART1 field to a new value. */
14283 #define SIM_WR_SCGC4_UART1(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_UART1_MASK, SIM_SCGC4_UART1(value)))
14284 #define SIM_BWR_SCGC4_UART1(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_UART1_SHIFT), SIM_SCGC4_UART1_SHIFT, SIM_SCGC4_UART1_WIDTH))
14285 /*@}*/
14286 
14287 /*!
14288  * @name Register SIM_SCGC4, field UART2[12] (RW)
14289  *
14290  * This bit controls the clock gate to the UART2 module.
14291  *
14292  * Values:
14293  * - 0b0 - Clock disabled
14294  * - 0b1 - Clock enabled
14295  */
14296 /*@{*/
14297 /*! @brief Read current value of the SIM_SCGC4_UART2 field. */
14298 #define SIM_RD_SCGC4_UART2(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_UART2_MASK) >> SIM_SCGC4_UART2_SHIFT)
14299 #define SIM_BRD_SCGC4_UART2(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_UART2_SHIFT, SIM_SCGC4_UART2_WIDTH))
14300 
14301 /*! @brief Set the UART2 field to a new value. */
14302 #define SIM_WR_SCGC4_UART2(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_UART2_MASK, SIM_SCGC4_UART2(value)))
14303 #define SIM_BWR_SCGC4_UART2(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_UART2_SHIFT), SIM_SCGC4_UART2_SHIFT, SIM_SCGC4_UART2_WIDTH))
14304 /*@}*/
14305 
14306 /*!
14307  * @name Register SIM_SCGC4, field USBOTG[18] (RW)
14308  *
14309  * This bit controls the clock gate to the USB module.
14310  *
14311  * Values:
14312  * - 0b0 - Clock disabled
14313  * - 0b1 - Clock enabled
14314  */
14315 /*@{*/
14316 /*! @brief Read current value of the SIM_SCGC4_USBOTG field. */
14317 #define SIM_RD_SCGC4_USBOTG(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_USBOTG_MASK) >> SIM_SCGC4_USBOTG_SHIFT)
14318 #define SIM_BRD_SCGC4_USBOTG(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_USBOTG_SHIFT, SIM_SCGC4_USBOTG_WIDTH))
14319 
14320 /*! @brief Set the USBOTG field to a new value. */
14321 #define SIM_WR_SCGC4_USBOTG(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_USBOTG_MASK, SIM_SCGC4_USBOTG(value)))
14322 #define SIM_BWR_SCGC4_USBOTG(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_USBOTG_SHIFT), SIM_SCGC4_USBOTG_SHIFT, SIM_SCGC4_USBOTG_WIDTH))
14323 /*@}*/
14324 
14325 /*!
14326  * @name Register SIM_SCGC4, field CMP[19] (RW)
14327  *
14328  * This bit controls the clock gate to the comparator module.
14329  *
14330  * Values:
14331  * - 0b0 - Clock disabled
14332  * - 0b1 - Clock enabled
14333  */
14334 /*@{*/
14335 /*! @brief Read current value of the SIM_SCGC4_CMP field. */
14336 #define SIM_RD_SCGC4_CMP(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_CMP_MASK) >> SIM_SCGC4_CMP_SHIFT)
14337 #define SIM_BRD_SCGC4_CMP(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_CMP_SHIFT, SIM_SCGC4_CMP_WIDTH))
14338 
14339 /*! @brief Set the CMP field to a new value. */
14340 #define SIM_WR_SCGC4_CMP(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_CMP_MASK, SIM_SCGC4_CMP(value)))
14341 #define SIM_BWR_SCGC4_CMP(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_CMP_SHIFT), SIM_SCGC4_CMP_SHIFT, SIM_SCGC4_CMP_WIDTH))
14342 /*@}*/
14343 
14344 /*!
14345  * @name Register SIM_SCGC4, field SPI0[22] (RW)
14346  *
14347  * This bit controls the clock gate to the SPI0 module.
14348  *
14349  * Values:
14350  * - 0b0 - Clock disabled
14351  * - 0b1 - Clock enabled
14352  */
14353 /*@{*/
14354 /*! @brief Read current value of the SIM_SCGC4_SPI0 field. */
14355 #define SIM_RD_SCGC4_SPI0(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_SPI0_MASK) >> SIM_SCGC4_SPI0_SHIFT)
14356 #define SIM_BRD_SCGC4_SPI0(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_SPI0_SHIFT, SIM_SCGC4_SPI0_WIDTH))
14357 
14358 /*! @brief Set the SPI0 field to a new value. */
14359 #define SIM_WR_SCGC4_SPI0(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_SPI0_MASK, SIM_SCGC4_SPI0(value)))
14360 #define SIM_BWR_SCGC4_SPI0(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_SPI0_SHIFT), SIM_SCGC4_SPI0_SHIFT, SIM_SCGC4_SPI0_WIDTH))
14361 /*@}*/
14362 
14363 /*!
14364  * @name Register SIM_SCGC4, field SPI1[23] (RW)
14365  *
14366  * This bit controls the clock gate to the SPI1 module.
14367  *
14368  * Values:
14369  * - 0b0 - Clock disabled
14370  * - 0b1 - Clock enabled
14371  */
14372 /*@{*/
14373 /*! @brief Read current value of the SIM_SCGC4_SPI1 field. */
14374 #define SIM_RD_SCGC4_SPI1(base) ((SIM_SCGC4_REG(base) & SIM_SCGC4_SPI1_MASK) >> SIM_SCGC4_SPI1_SHIFT)
14375 #define SIM_BRD_SCGC4_SPI1(base) (BME_UBFX32(&SIM_SCGC4_REG(base), SIM_SCGC4_SPI1_SHIFT, SIM_SCGC4_SPI1_WIDTH))
14376 
14377 /*! @brief Set the SPI1 field to a new value. */
14378 #define SIM_WR_SCGC4_SPI1(base, value) (SIM_RMW_SCGC4(base, SIM_SCGC4_SPI1_MASK, SIM_SCGC4_SPI1(value)))
14379 #define SIM_BWR_SCGC4_SPI1(base, value) (BME_BFI32(&SIM_SCGC4_REG(base), ((uint32_t)(value) << SIM_SCGC4_SPI1_SHIFT), SIM_SCGC4_SPI1_SHIFT, SIM_SCGC4_SPI1_WIDTH))
14380 /*@}*/
14381 
14382 /*******************************************************************************
14383  * SIM_SCGC5 - System Clock Gating Control Register 5
14384  ******************************************************************************/
14385 
14386 /*!
14387  * @brief SIM_SCGC5 - System Clock Gating Control Register 5 (RW)
14388  *
14389  * Reset value: 0x00000180U
14390  */
14391 /*!
14392  * @name Constants and macros for entire SIM_SCGC5 register
14393  */
14394 /*@{*/
14395 #define SIM_RD_SCGC5(base) (SIM_SCGC5_REG(base))
14396 #define SIM_WR_SCGC5(base, value) (SIM_SCGC5_REG(base) = (value))
14397 #define SIM_RMW_SCGC5(base, mask, value) (SIM_WR_SCGC5(base, (SIM_RD_SCGC5(base) & ~(mask)) | (value)))
14398 #define SIM_SET_SCGC5(base, value) (BME_OR32(&SIM_SCGC5_REG(base), (uint32_t)(value)))
14399 #define SIM_CLR_SCGC5(base, value) (BME_AND32(&SIM_SCGC5_REG(base), (uint32_t)(~(value))))
14400 #define SIM_TOG_SCGC5(base, value) (BME_XOR32(&SIM_SCGC5_REG(base), (uint32_t)(value)))
14401 /*@}*/
14402 
14403 /*
14404  * Constants & macros for individual SIM_SCGC5 bitfields
14405  */
14406 
14407 /*!
14408  * @name Register SIM_SCGC5, field LPTMR[0] (RW)
14409  *
14410  * This bit controls software access to the Low Power Timer module.
14411  *
14412  * Values:
14413  * - 0b0 - Access disabled
14414  * - 0b1 - Access enabled
14415  */
14416 /*@{*/
14417 /*! @brief Read current value of the SIM_SCGC5_LPTMR field. */
14418 #define SIM_RD_SCGC5_LPTMR(base) ((SIM_SCGC5_REG(base) & SIM_SCGC5_LPTMR_MASK) >> SIM_SCGC5_LPTMR_SHIFT)
14419 #define SIM_BRD_SCGC5_LPTMR(base) (BME_UBFX32(&SIM_SCGC5_REG(base), SIM_SCGC5_LPTMR_SHIFT, SIM_SCGC5_LPTMR_WIDTH))
14420 
14421 /*! @brief Set the LPTMR field to a new value. */
14422 #define SIM_WR_SCGC5_LPTMR(base, value) (SIM_RMW_SCGC5(base, SIM_SCGC5_LPTMR_MASK, SIM_SCGC5_LPTMR(value)))
14423 #define SIM_BWR_SCGC5_LPTMR(base, value) (BME_BFI32(&SIM_SCGC5_REG(base), ((uint32_t)(value) << SIM_SCGC5_LPTMR_SHIFT), SIM_SCGC5_LPTMR_SHIFT, SIM_SCGC5_LPTMR_WIDTH))
14424 /*@}*/
14425 
14426 /*!
14427  * @name Register SIM_SCGC5, field TSI[5] (RW)
14428  *
14429  * This bit controls software access to the TSI module.
14430  *
14431  * Values:
14432  * - 0b0 - Access disabled
14433  * - 0b1 - Access enabled
14434  */
14435 /*@{*/
14436 /*! @brief Read current value of the SIM_SCGC5_TSI field. */
14437 #define SIM_RD_SCGC5_TSI(base) ((SIM_SCGC5_REG(base) & SIM_SCGC5_TSI_MASK) >> SIM_SCGC5_TSI_SHIFT)
14438 #define SIM_BRD_SCGC5_TSI(base) (BME_UBFX32(&SIM_SCGC5_REG(base), SIM_SCGC5_TSI_SHIFT, SIM_SCGC5_TSI_WIDTH))
14439 
14440 /*! @brief Set the TSI field to a new value. */
14441 #define SIM_WR_SCGC5_TSI(base, value) (SIM_RMW_SCGC5(base, SIM_SCGC5_TSI_MASK, SIM_SCGC5_TSI(value)))
14442 #define SIM_BWR_SCGC5_TSI(base, value) (BME_BFI32(&SIM_SCGC5_REG(base), ((uint32_t)(value) << SIM_SCGC5_TSI_SHIFT), SIM_SCGC5_TSI_SHIFT, SIM_SCGC5_TSI_WIDTH))
14443 /*@}*/
14444 
14445 /*!
14446  * @name Register SIM_SCGC5, field PORTA[9] (RW)
14447  *
14448  * This bit controls the clock gate to the Port A module.
14449  *
14450  * Values:
14451  * - 0b0 - Clock disabled
14452  * - 0b1 - Clock enabled
14453  */
14454 /*@{*/
14455 /*! @brief Read current value of the SIM_SCGC5_PORTA field. */
14456 #define SIM_RD_SCGC5_PORTA(base) ((SIM_SCGC5_REG(base) & SIM_SCGC5_PORTA_MASK) >> SIM_SCGC5_PORTA_SHIFT)
14457 #define SIM_BRD_SCGC5_PORTA(base) (BME_UBFX32(&SIM_SCGC5_REG(base), SIM_SCGC5_PORTA_SHIFT, SIM_SCGC5_PORTA_WIDTH))
14458 
14459 /*! @brief Set the PORTA field to a new value. */
14460 #define SIM_WR_SCGC5_PORTA(base, value) (SIM_RMW_SCGC5(base, SIM_SCGC5_PORTA_MASK, SIM_SCGC5_PORTA(value)))
14461 #define SIM_BWR_SCGC5_PORTA(base, value) (BME_BFI32(&SIM_SCGC5_REG(base), ((uint32_t)(value) << SIM_SCGC5_PORTA_SHIFT), SIM_SCGC5_PORTA_SHIFT, SIM_SCGC5_PORTA_WIDTH))
14462 /*@}*/
14463 
14464 /*!
14465  * @name Register SIM_SCGC5, field PORTB[10] (RW)
14466  *
14467  * This bit controls the clock gate to the Port B module.
14468  *
14469  * Values:
14470  * - 0b0 - Clock disabled
14471  * - 0b1 - Clock enabled
14472  */
14473 /*@{*/
14474 /*! @brief Read current value of the SIM_SCGC5_PORTB field. */
14475 #define SIM_RD_SCGC5_PORTB(base) ((SIM_SCGC5_REG(base) & SIM_SCGC5_PORTB_MASK) >> SIM_SCGC5_PORTB_SHIFT)
14476 #define SIM_BRD_SCGC5_PORTB(base) (BME_UBFX32(&SIM_SCGC5_REG(base), SIM_SCGC5_PORTB_SHIFT, SIM_SCGC5_PORTB_WIDTH))
14477 
14478 /*! @brief Set the PORTB field to a new value. */
14479 #define SIM_WR_SCGC5_PORTB(base, value) (SIM_RMW_SCGC5(base, SIM_SCGC5_PORTB_MASK, SIM_SCGC5_PORTB(value)))
14480 #define SIM_BWR_SCGC5_PORTB(base, value) (BME_BFI32(&SIM_SCGC5_REG(base), ((uint32_t)(value) << SIM_SCGC5_PORTB_SHIFT), SIM_SCGC5_PORTB_SHIFT, SIM_SCGC5_PORTB_WIDTH))
14481 /*@}*/
14482 
14483 /*!
14484  * @name Register SIM_SCGC5, field PORTC[11] (RW)
14485  *
14486  * This bit controls the clock gate to the Port C module.
14487  *
14488  * Values:
14489  * - 0b0 - Clock disabled
14490  * - 0b1 - Clock enabled
14491  */
14492 /*@{*/
14493 /*! @brief Read current value of the SIM_SCGC5_PORTC field. */
14494 #define SIM_RD_SCGC5_PORTC(base) ((SIM_SCGC5_REG(base) & SIM_SCGC5_PORTC_MASK) >> SIM_SCGC5_PORTC_SHIFT)
14495 #define SIM_BRD_SCGC5_PORTC(base) (BME_UBFX32(&SIM_SCGC5_REG(base), SIM_SCGC5_PORTC_SHIFT, SIM_SCGC5_PORTC_WIDTH))
14496 
14497 /*! @brief Set the PORTC field to a new value. */
14498 #define SIM_WR_SCGC5_PORTC(base, value) (SIM_RMW_SCGC5(base, SIM_SCGC5_PORTC_MASK, SIM_SCGC5_PORTC(value)))
14499 #define SIM_BWR_SCGC5_PORTC(base, value) (BME_BFI32(&SIM_SCGC5_REG(base), ((uint32_t)(value) << SIM_SCGC5_PORTC_SHIFT), SIM_SCGC5_PORTC_SHIFT, SIM_SCGC5_PORTC_WIDTH))
14500 /*@}*/
14501 
14502 /*!
14503  * @name Register SIM_SCGC5, field PORTD[12] (RW)
14504  *
14505  * This bit controls the clock gate to the Port D module.
14506  *
14507  * Values:
14508  * - 0b0 - Clock disabled
14509  * - 0b1 - Clock enabled
14510  */
14511 /*@{*/
14512 /*! @brief Read current value of the SIM_SCGC5_PORTD field. */
14513 #define SIM_RD_SCGC5_PORTD(base) ((SIM_SCGC5_REG(base) & SIM_SCGC5_PORTD_MASK) >> SIM_SCGC5_PORTD_SHIFT)
14514 #define SIM_BRD_SCGC5_PORTD(base) (BME_UBFX32(&SIM_SCGC5_REG(base), SIM_SCGC5_PORTD_SHIFT, SIM_SCGC5_PORTD_WIDTH))
14515 
14516 /*! @brief Set the PORTD field to a new value. */
14517 #define SIM_WR_SCGC5_PORTD(base, value) (SIM_RMW_SCGC5(base, SIM_SCGC5_PORTD_MASK, SIM_SCGC5_PORTD(value)))
14518 #define SIM_BWR_SCGC5_PORTD(base, value) (BME_BFI32(&SIM_SCGC5_REG(base), ((uint32_t)(value) << SIM_SCGC5_PORTD_SHIFT), SIM_SCGC5_PORTD_SHIFT, SIM_SCGC5_PORTD_WIDTH))
14519 /*@}*/
14520 
14521 /*!
14522  * @name Register SIM_SCGC5, field PORTE[13] (RW)
14523  *
14524  * This bit controls the clock gate to the Port E module.
14525  *
14526  * Values:
14527  * - 0b0 - Clock disabled
14528  * - 0b1 - Clock enabled
14529  */
14530 /*@{*/
14531 /*! @brief Read current value of the SIM_SCGC5_PORTE field. */
14532 #define SIM_RD_SCGC5_PORTE(base) ((SIM_SCGC5_REG(base) & SIM_SCGC5_PORTE_MASK) >> SIM_SCGC5_PORTE_SHIFT)
14533 #define SIM_BRD_SCGC5_PORTE(base) (BME_UBFX32(&SIM_SCGC5_REG(base), SIM_SCGC5_PORTE_SHIFT, SIM_SCGC5_PORTE_WIDTH))
14534 
14535 /*! @brief Set the PORTE field to a new value. */
14536 #define SIM_WR_SCGC5_PORTE(base, value) (SIM_RMW_SCGC5(base, SIM_SCGC5_PORTE_MASK, SIM_SCGC5_PORTE(value)))
14537 #define SIM_BWR_SCGC5_PORTE(base, value) (BME_BFI32(&SIM_SCGC5_REG(base), ((uint32_t)(value) << SIM_SCGC5_PORTE_SHIFT), SIM_SCGC5_PORTE_SHIFT, SIM_SCGC5_PORTE_WIDTH))
14538 /*@}*/
14539 
14540 /*******************************************************************************
14541  * SIM_SCGC6 - System Clock Gating Control Register 6
14542  ******************************************************************************/
14543 
14544 /*!
14545  * @brief SIM_SCGC6 - System Clock Gating Control Register 6 (RW)
14546  *
14547  * Reset value: 0x00000001U
14548  */
14549 /*!
14550  * @name Constants and macros for entire SIM_SCGC6 register
14551  */
14552 /*@{*/
14553 #define SIM_RD_SCGC6(base) (SIM_SCGC6_REG(base))
14554 #define SIM_WR_SCGC6(base, value) (SIM_SCGC6_REG(base) = (value))
14555 #define SIM_RMW_SCGC6(base, mask, value) (SIM_WR_SCGC6(base, (SIM_RD_SCGC6(base) & ~(mask)) | (value)))
14556 #define SIM_SET_SCGC6(base, value) (BME_OR32(&SIM_SCGC6_REG(base), (uint32_t)(value)))
14557 #define SIM_CLR_SCGC6(base, value) (BME_AND32(&SIM_SCGC6_REG(base), (uint32_t)(~(value))))
14558 #define SIM_TOG_SCGC6(base, value) (BME_XOR32(&SIM_SCGC6_REG(base), (uint32_t)(value)))
14559 /*@}*/
14560 
14561 /*
14562  * Constants & macros for individual SIM_SCGC6 bitfields
14563  */
14564 
14565 /*!
14566  * @name Register SIM_SCGC6, field FTF[0] (RW)
14567  *
14568  * This bit controls the clock gate to the flash memory. Flash reads are still
14569  * supported while the flash memory is clock gated, but entry into low power modes
14570  * is blocked.
14571  *
14572  * Values:
14573  * - 0b0 - Clock disabled
14574  * - 0b1 - Clock enabled
14575  */
14576 /*@{*/
14577 /*! @brief Read current value of the SIM_SCGC6_FTF field. */
14578 #define SIM_RD_SCGC6_FTF(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_FTF_MASK) >> SIM_SCGC6_FTF_SHIFT)
14579 #define SIM_BRD_SCGC6_FTF(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_FTF_SHIFT, SIM_SCGC6_FTF_WIDTH))
14580 
14581 /*! @brief Set the FTF field to a new value. */
14582 #define SIM_WR_SCGC6_FTF(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_FTF_MASK, SIM_SCGC6_FTF(value)))
14583 #define SIM_BWR_SCGC6_FTF(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_FTF_SHIFT), SIM_SCGC6_FTF_SHIFT, SIM_SCGC6_FTF_WIDTH))
14584 /*@}*/
14585 
14586 /*!
14587  * @name Register SIM_SCGC6, field DMAMUX[1] (RW)
14588  *
14589  * This bit controls the clock gate to the DMA Mux module.
14590  *
14591  * Values:
14592  * - 0b0 - Clock disabled
14593  * - 0b1 - Clock enabled
14594  */
14595 /*@{*/
14596 /*! @brief Read current value of the SIM_SCGC6_DMAMUX field. */
14597 #define SIM_RD_SCGC6_DMAMUX(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_DMAMUX_MASK) >> SIM_SCGC6_DMAMUX_SHIFT)
14598 #define SIM_BRD_SCGC6_DMAMUX(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_DMAMUX_SHIFT, SIM_SCGC6_DMAMUX_WIDTH))
14599 
14600 /*! @brief Set the DMAMUX field to a new value. */
14601 #define SIM_WR_SCGC6_DMAMUX(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_DMAMUX_MASK, SIM_SCGC6_DMAMUX(value)))
14602 #define SIM_BWR_SCGC6_DMAMUX(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_DMAMUX_SHIFT), SIM_SCGC6_DMAMUX_SHIFT, SIM_SCGC6_DMAMUX_WIDTH))
14603 /*@}*/
14604 
14605 /*!
14606  * @name Register SIM_SCGC6, field PIT[23] (RW)
14607  *
14608  * This bit controls the clock gate to the PIT module.
14609  *
14610  * Values:
14611  * - 0b0 - Clock disabled
14612  * - 0b1 - Clock enabled
14613  */
14614 /*@{*/
14615 /*! @brief Read current value of the SIM_SCGC6_PIT field. */
14616 #define SIM_RD_SCGC6_PIT(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_PIT_MASK) >> SIM_SCGC6_PIT_SHIFT)
14617 #define SIM_BRD_SCGC6_PIT(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_PIT_SHIFT, SIM_SCGC6_PIT_WIDTH))
14618 
14619 /*! @brief Set the PIT field to a new value. */
14620 #define SIM_WR_SCGC6_PIT(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_PIT_MASK, SIM_SCGC6_PIT(value)))
14621 #define SIM_BWR_SCGC6_PIT(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_PIT_SHIFT), SIM_SCGC6_PIT_SHIFT, SIM_SCGC6_PIT_WIDTH))
14622 /*@}*/
14623 
14624 /*!
14625  * @name Register SIM_SCGC6, field TPM0[24] (RW)
14626  *
14627  * This bit controls the clock gate to the TPM0 module.
14628  *
14629  * Values:
14630  * - 0b0 - Clock disabled
14631  * - 0b1 - Clock enabled
14632  */
14633 /*@{*/
14634 /*! @brief Read current value of the SIM_SCGC6_TPM0 field. */
14635 #define SIM_RD_SCGC6_TPM0(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_TPM0_MASK) >> SIM_SCGC6_TPM0_SHIFT)
14636 #define SIM_BRD_SCGC6_TPM0(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_TPM0_SHIFT, SIM_SCGC6_TPM0_WIDTH))
14637 
14638 /*! @brief Set the TPM0 field to a new value. */
14639 #define SIM_WR_SCGC6_TPM0(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_TPM0_MASK, SIM_SCGC6_TPM0(value)))
14640 #define SIM_BWR_SCGC6_TPM0(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_TPM0_SHIFT), SIM_SCGC6_TPM0_SHIFT, SIM_SCGC6_TPM0_WIDTH))
14641 /*@}*/
14642 
14643 /*!
14644  * @name Register SIM_SCGC6, field TPM1[25] (RW)
14645  *
14646  * This bit controls the clock gate to the TPM1 module.
14647  *
14648  * Values:
14649  * - 0b0 - Clock disabled
14650  * - 0b1 - Clock enabled
14651  */
14652 /*@{*/
14653 /*! @brief Read current value of the SIM_SCGC6_TPM1 field. */
14654 #define SIM_RD_SCGC6_TPM1(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_TPM1_MASK) >> SIM_SCGC6_TPM1_SHIFT)
14655 #define SIM_BRD_SCGC6_TPM1(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_TPM1_SHIFT, SIM_SCGC6_TPM1_WIDTH))
14656 
14657 /*! @brief Set the TPM1 field to a new value. */
14658 #define SIM_WR_SCGC6_TPM1(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_TPM1_MASK, SIM_SCGC6_TPM1(value)))
14659 #define SIM_BWR_SCGC6_TPM1(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_TPM1_SHIFT), SIM_SCGC6_TPM1_SHIFT, SIM_SCGC6_TPM1_WIDTH))
14660 /*@}*/
14661 
14662 /*!
14663  * @name Register SIM_SCGC6, field TPM2[26] (RW)
14664  *
14665  * This bit controls the clock gate to the TPM2 module.
14666  *
14667  * Values:
14668  * - 0b0 - Clock disabled
14669  * - 0b1 - Clock enabled
14670  */
14671 /*@{*/
14672 /*! @brief Read current value of the SIM_SCGC6_TPM2 field. */
14673 #define SIM_RD_SCGC6_TPM2(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_TPM2_MASK) >> SIM_SCGC6_TPM2_SHIFT)
14674 #define SIM_BRD_SCGC6_TPM2(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_TPM2_SHIFT, SIM_SCGC6_TPM2_WIDTH))
14675 
14676 /*! @brief Set the TPM2 field to a new value. */
14677 #define SIM_WR_SCGC6_TPM2(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_TPM2_MASK, SIM_SCGC6_TPM2(value)))
14678 #define SIM_BWR_SCGC6_TPM2(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_TPM2_SHIFT), SIM_SCGC6_TPM2_SHIFT, SIM_SCGC6_TPM2_WIDTH))
14679 /*@}*/
14680 
14681 /*!
14682  * @name Register SIM_SCGC6, field ADC0[27] (RW)
14683  *
14684  * This bit controls the clock gate to the ADC0 module.
14685  *
14686  * Values:
14687  * - 0b0 - Clock disabled
14688  * - 0b1 - Clock enabled
14689  */
14690 /*@{*/
14691 /*! @brief Read current value of the SIM_SCGC6_ADC0 field. */
14692 #define SIM_RD_SCGC6_ADC0(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_ADC0_MASK) >> SIM_SCGC6_ADC0_SHIFT)
14693 #define SIM_BRD_SCGC6_ADC0(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_ADC0_SHIFT, SIM_SCGC6_ADC0_WIDTH))
14694 
14695 /*! @brief Set the ADC0 field to a new value. */
14696 #define SIM_WR_SCGC6_ADC0(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_ADC0_MASK, SIM_SCGC6_ADC0(value)))
14697 #define SIM_BWR_SCGC6_ADC0(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_ADC0_SHIFT), SIM_SCGC6_ADC0_SHIFT, SIM_SCGC6_ADC0_WIDTH))
14698 /*@}*/
14699 
14700 /*!
14701  * @name Register SIM_SCGC6, field RTC[29] (RW)
14702  *
14703  * This bit controls software access and interrupts to the RTC module.
14704  *
14705  * Values:
14706  * - 0b0 - Access and interrupts disabled
14707  * - 0b1 - Access and interrupts enabled
14708  */
14709 /*@{*/
14710 /*! @brief Read current value of the SIM_SCGC6_RTC field. */
14711 #define SIM_RD_SCGC6_RTC(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_RTC_MASK) >> SIM_SCGC6_RTC_SHIFT)
14712 #define SIM_BRD_SCGC6_RTC(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_RTC_SHIFT, SIM_SCGC6_RTC_WIDTH))
14713 
14714 /*! @brief Set the RTC field to a new value. */
14715 #define SIM_WR_SCGC6_RTC(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_RTC_MASK, SIM_SCGC6_RTC(value)))
14716 #define SIM_BWR_SCGC6_RTC(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_RTC_SHIFT), SIM_SCGC6_RTC_SHIFT, SIM_SCGC6_RTC_WIDTH))
14717 /*@}*/
14718 
14719 /*!
14720  * @name Register SIM_SCGC6, field DAC0[31] (RW)
14721  *
14722  * This bit controls the clock gate to the DAC0 module.
14723  *
14724  * Values:
14725  * - 0b0 - Clock disabled
14726  * - 0b1 - Clock enabled
14727  */
14728 /*@{*/
14729 /*! @brief Read current value of the SIM_SCGC6_DAC0 field. */
14730 #define SIM_RD_SCGC6_DAC0(base) ((SIM_SCGC6_REG(base) & SIM_SCGC6_DAC0_MASK) >> SIM_SCGC6_DAC0_SHIFT)
14731 #define SIM_BRD_SCGC6_DAC0(base) (BME_UBFX32(&SIM_SCGC6_REG(base), SIM_SCGC6_DAC0_SHIFT, SIM_SCGC6_DAC0_WIDTH))
14732 
14733 /*! @brief Set the DAC0 field to a new value. */
14734 #define SIM_WR_SCGC6_DAC0(base, value) (SIM_RMW_SCGC6(base, SIM_SCGC6_DAC0_MASK, SIM_SCGC6_DAC0(value)))
14735 #define SIM_BWR_SCGC6_DAC0(base, value) (BME_BFI32(&SIM_SCGC6_REG(base), ((uint32_t)(value) << SIM_SCGC6_DAC0_SHIFT), SIM_SCGC6_DAC0_SHIFT, SIM_SCGC6_DAC0_WIDTH))
14736 /*@}*/
14737 
14738 /*******************************************************************************
14739  * SIM_SCGC7 - System Clock Gating Control Register 7
14740  ******************************************************************************/
14741 
14742 /*!
14743  * @brief SIM_SCGC7 - System Clock Gating Control Register 7 (RW)
14744  *
14745  * Reset value: 0x00000100U
14746  */
14747 /*!
14748  * @name Constants and macros for entire SIM_SCGC7 register
14749  */
14750 /*@{*/
14751 #define SIM_RD_SCGC7(base) (SIM_SCGC7_REG(base))
14752 #define SIM_WR_SCGC7(base, value) (SIM_SCGC7_REG(base) = (value))
14753 #define SIM_RMW_SCGC7(base, mask, value) (SIM_WR_SCGC7(base, (SIM_RD_SCGC7(base) & ~(mask)) | (value)))
14754 #define SIM_SET_SCGC7(base, value) (BME_OR32(&SIM_SCGC7_REG(base), (uint32_t)(value)))
14755 #define SIM_CLR_SCGC7(base, value) (BME_AND32(&SIM_SCGC7_REG(base), (uint32_t)(~(value))))
14756 #define SIM_TOG_SCGC7(base, value) (BME_XOR32(&SIM_SCGC7_REG(base), (uint32_t)(value)))
14757 /*@}*/
14758 
14759 /*
14760  * Constants & macros for individual SIM_SCGC7 bitfields
14761  */
14762 
14763 /*!
14764  * @name Register SIM_SCGC7, field DMA[8] (RW)
14765  *
14766  * This bit controls the clock gate to the DMA module.
14767  *
14768  * Values:
14769  * - 0b0 - Clock disabled
14770  * - 0b1 - Clock enabled
14771  */
14772 /*@{*/
14773 /*! @brief Read current value of the SIM_SCGC7_DMA field. */
14774 #define SIM_RD_SCGC7_DMA(base) ((SIM_SCGC7_REG(base) & SIM_SCGC7_DMA_MASK) >> SIM_SCGC7_DMA_SHIFT)
14775 #define SIM_BRD_SCGC7_DMA(base) (BME_UBFX32(&SIM_SCGC7_REG(base), SIM_SCGC7_DMA_SHIFT, SIM_SCGC7_DMA_WIDTH))
14776 
14777 /*! @brief Set the DMA field to a new value. */
14778 #define SIM_WR_SCGC7_DMA(base, value) (SIM_RMW_SCGC7(base, SIM_SCGC7_DMA_MASK, SIM_SCGC7_DMA(value)))
14779 #define SIM_BWR_SCGC7_DMA(base, value) (BME_BFI32(&SIM_SCGC7_REG(base), ((uint32_t)(value) << SIM_SCGC7_DMA_SHIFT), SIM_SCGC7_DMA_SHIFT, SIM_SCGC7_DMA_WIDTH))
14780 /*@}*/
14781 
14782 /*******************************************************************************
14783  * SIM_CLKDIV1 - System Clock Divider Register 1
14784  ******************************************************************************/
14785 
14786 /*!
14787  * @brief SIM_CLKDIV1 - System Clock Divider Register 1 (RW)
14788  *
14789  * Reset value: 0x00010000U
14790  *
14791  * The CLKDIV1 register cannot be written to when the device is in VLPR mode.
14792  * Reset value loaded during System Reset from FTF_FOPT[LPBOOT].
14793  */
14794 /*!
14795  * @name Constants and macros for entire SIM_CLKDIV1 register
14796  */
14797 /*@{*/
14798 #define SIM_RD_CLKDIV1(base) (SIM_CLKDIV1_REG(base))
14799 #define SIM_WR_CLKDIV1(base, value) (SIM_CLKDIV1_REG(base) = (value))
14800 #define SIM_RMW_CLKDIV1(base, mask, value) (SIM_WR_CLKDIV1(base, (SIM_RD_CLKDIV1(base) & ~(mask)) | (value)))
14801 #define SIM_SET_CLKDIV1(base, value) (BME_OR32(&SIM_CLKDIV1_REG(base), (uint32_t)(value)))
14802 #define SIM_CLR_CLKDIV1(base, value) (BME_AND32(&SIM_CLKDIV1_REG(base), (uint32_t)(~(value))))
14803 #define SIM_TOG_CLKDIV1(base, value) (BME_XOR32(&SIM_CLKDIV1_REG(base), (uint32_t)(value)))
14804 /*@}*/
14805 
14806 /*
14807  * Constants & macros for individual SIM_CLKDIV1 bitfields
14808  */
14809 
14810 /*!
14811  * @name Register SIM_CLKDIV1, field OUTDIV4[18:16] (RW)
14812  *
14813  * This field sets the divide value for the bus and flash clock and is in
14814  * addition to the System clock divide ratio. At the end of reset, it is loaded with
14815  * 0001 (divide by two).
14816  *
14817  * Values:
14818  * - 0b000 - Divide-by-1.
14819  * - 0b001 - Divide-by-2.
14820  * - 0b010 - Divide-by-3.
14821  * - 0b011 - Divide-by-4.
14822  * - 0b100 - Divide-by-5.
14823  * - 0b101 - Divide-by-6.
14824  * - 0b110 - Divide-by-7.
14825  * - 0b111 - Divide-by-8.
14826  */
14827 /*@{*/
14828 /*! @brief Read current value of the SIM_CLKDIV1_OUTDIV4 field. */
14829 #define SIM_RD_CLKDIV1_OUTDIV4(base) ((SIM_CLKDIV1_REG(base) & SIM_CLKDIV1_OUTDIV4_MASK) >> SIM_CLKDIV1_OUTDIV4_SHIFT)
14830 #define SIM_BRD_CLKDIV1_OUTDIV4(base) (BME_UBFX32(&SIM_CLKDIV1_REG(base), SIM_CLKDIV1_OUTDIV4_SHIFT, SIM_CLKDIV1_OUTDIV4_WIDTH))
14831 
14832 /*! @brief Set the OUTDIV4 field to a new value. */
14833 #define SIM_WR_CLKDIV1_OUTDIV4(base, value) (SIM_RMW_CLKDIV1(base, SIM_CLKDIV1_OUTDIV4_MASK, SIM_CLKDIV1_OUTDIV4(value)))
14834 #define SIM_BWR_CLKDIV1_OUTDIV4(base, value) (BME_BFI32(&SIM_CLKDIV1_REG(base), ((uint32_t)(value) << SIM_CLKDIV1_OUTDIV4_SHIFT), SIM_CLKDIV1_OUTDIV4_SHIFT, SIM_CLKDIV1_OUTDIV4_WIDTH))
14835 /*@}*/
14836 
14837 /*!
14838  * @name Register SIM_CLKDIV1, field OUTDIV1[31:28] (RW)
14839  *
14840  * This field sets the divide value for the core/system clock, as well as the
14841  * bus/flash clocks. At the end of reset, it is loaded with 0000 (divide by one),
14842  * 0001 (divide by two), 0011 (divide by four), or 0111 (divide by eight)
14843  * depending on the setting of the two FTF_FOPT[LPBOOT] configuration bits.
14844  *
14845  * Values:
14846  * - 0b0000 - Divide-by-1.
14847  * - 0b0001 - Divide-by-2.
14848  * - 0b0010 - Divide-by-3.
14849  * - 0b0011 - Divide-by-4.
14850  * - 0b0100 - Divide-by-5.
14851  * - 0b0101 - Divide-by-6.
14852  * - 0b0110 - Divide-by-7.
14853  * - 0b0111 - Divide-by-8.
14854  * - 0b1000 - Divide-by-9.
14855  * - 0b1001 - Divide-by-10.
14856  * - 0b1010 - Divide-by-11.
14857  * - 0b1011 - Divide-by-12.
14858  * - 0b1100 - Divide-by-13.
14859  * - 0b1101 - Divide-by-14.
14860  * - 0b1110 - Divide-by-15.
14861  * - 0b1111 - Divide-by-16.
14862  */
14863 /*@{*/
14864 /*! @brief Read current value of the SIM_CLKDIV1_OUTDIV1 field. */
14865 #define SIM_RD_CLKDIV1_OUTDIV1(base) ((SIM_CLKDIV1_REG(base) & SIM_CLKDIV1_OUTDIV1_MASK) >> SIM_CLKDIV1_OUTDIV1_SHIFT)
14866 #define SIM_BRD_CLKDIV1_OUTDIV1(base) (BME_UBFX32(&SIM_CLKDIV1_REG(base), SIM_CLKDIV1_OUTDIV1_SHIFT, SIM_CLKDIV1_OUTDIV1_WIDTH))
14867 
14868 /*! @brief Set the OUTDIV1 field to a new value. */
14869 #define SIM_WR_CLKDIV1_OUTDIV1(base, value) (SIM_RMW_CLKDIV1(base, SIM_CLKDIV1_OUTDIV1_MASK, SIM_CLKDIV1_OUTDIV1(value)))
14870 #define SIM_BWR_CLKDIV1_OUTDIV1(base, value) (BME_BFI32(&SIM_CLKDIV1_REG(base), ((uint32_t)(value) << SIM_CLKDIV1_OUTDIV1_SHIFT), SIM_CLKDIV1_OUTDIV1_SHIFT, SIM_CLKDIV1_OUTDIV1_WIDTH))
14871 /*@}*/
14872 
14873 /*******************************************************************************
14874  * SIM_FCFG1 - Flash Configuration Register 1
14875  ******************************************************************************/
14876 
14877 /*!
14878  * @brief SIM_FCFG1 - Flash Configuration Register 1 (RW)
14879  *
14880  * Reset value: 0x0F000000U
14881  */
14882 /*!
14883  * @name Constants and macros for entire SIM_FCFG1 register
14884  */
14885 /*@{*/
14886 #define SIM_RD_FCFG1(base) (SIM_FCFG1_REG(base))
14887 #define SIM_WR_FCFG1(base, value) (SIM_FCFG1_REG(base) = (value))
14888 #define SIM_RMW_FCFG1(base, mask, value) (SIM_WR_FCFG1(base, (SIM_RD_FCFG1(base) & ~(mask)) | (value)))
14889 #define SIM_SET_FCFG1(base, value) (BME_OR32(&SIM_FCFG1_REG(base), (uint32_t)(value)))
14890 #define SIM_CLR_FCFG1(base, value) (BME_AND32(&SIM_FCFG1_REG(base), (uint32_t)(~(value))))
14891 #define SIM_TOG_FCFG1(base, value) (BME_XOR32(&SIM_FCFG1_REG(base), (uint32_t)(value)))
14892 /*@}*/
14893 
14894 /*
14895  * Constants & macros for individual SIM_FCFG1 bitfields
14896  */
14897 
14898 /*!
14899  * @name Register SIM_FCFG1, field FLASHDIS[0] (RW)
14900  *
14901  * Flash accesses are disabled (and generate a bus error) and the Flash memory
14902  * is placed in a low power state. This bit should not be changed during VLP
14903  * modes. Relocate the interrupt vectors out of Flash memory before disabling the
14904  * Flash.
14905  *
14906  * Values:
14907  * - 0b0 - Flash is enabled
14908  * - 0b1 - Flash is disabled
14909  */
14910 /*@{*/
14911 /*! @brief Read current value of the SIM_FCFG1_FLASHDIS field. */
14912 #define SIM_RD_FCFG1_FLASHDIS(base) ((SIM_FCFG1_REG(base) & SIM_FCFG1_FLASHDIS_MASK) >> SIM_FCFG1_FLASHDIS_SHIFT)
14913 #define SIM_BRD_FCFG1_FLASHDIS(base) (BME_UBFX32(&SIM_FCFG1_REG(base), SIM_FCFG1_FLASHDIS_SHIFT, SIM_FCFG1_FLASHDIS_WIDTH))
14914 
14915 /*! @brief Set the FLASHDIS field to a new value. */
14916 #define SIM_WR_FCFG1_FLASHDIS(base, value) (SIM_RMW_FCFG1(base, SIM_FCFG1_FLASHDIS_MASK, SIM_FCFG1_FLASHDIS(value)))
14917 #define SIM_BWR_FCFG1_FLASHDIS(base, value) (BME_BFI32(&SIM_FCFG1_REG(base), ((uint32_t)(value) << SIM_FCFG1_FLASHDIS_SHIFT), SIM_FCFG1_FLASHDIS_SHIFT, SIM_FCFG1_FLASHDIS_WIDTH))
14918 /*@}*/
14919 
14920 /*!
14921  * @name Register SIM_FCFG1, field FLASHDOZE[1] (RW)
14922  *
14923  * When set, Flash memory is disabled for the duration of Doze mode. This bit
14924  * should be clear during VLP modes. The Flash will be automatically enabled again
14925  * at the end of Doze mode so interrupt vectors do not need to be relocated out
14926  * of Flash memory. The wakeup time from Doze mode is extended when this bit is
14927  * set. An attempt by the DMA or other bus master to access the Flash when the
14928  * Flash is disabled will result in a bus error.
14929  *
14930  * Values:
14931  * - 0b0 - Flash remains enabled during Doze mode
14932  * - 0b1 - Flash is disabled for the duration of Doze mode
14933  */
14934 /*@{*/
14935 /*! @brief Read current value of the SIM_FCFG1_FLASHDOZE field. */
14936 #define SIM_RD_FCFG1_FLASHDOZE(base) ((SIM_FCFG1_REG(base) & SIM_FCFG1_FLASHDOZE_MASK) >> SIM_FCFG1_FLASHDOZE_SHIFT)
14937 #define SIM_BRD_FCFG1_FLASHDOZE(base) (BME_UBFX32(&SIM_FCFG1_REG(base), SIM_FCFG1_FLASHDOZE_SHIFT, SIM_FCFG1_FLASHDOZE_WIDTH))
14938 
14939 /*! @brief Set the FLASHDOZE field to a new value. */
14940 #define SIM_WR_FCFG1_FLASHDOZE(base, value) (SIM_RMW_FCFG1(base, SIM_FCFG1_FLASHDOZE_MASK, SIM_FCFG1_FLASHDOZE(value)))
14941 #define SIM_BWR_FCFG1_FLASHDOZE(base, value) (BME_BFI32(&SIM_FCFG1_REG(base), ((uint32_t)(value) << SIM_FCFG1_FLASHDOZE_SHIFT), SIM_FCFG1_FLASHDOZE_SHIFT, SIM_FCFG1_FLASHDOZE_WIDTH))
14942 /*@}*/
14943 
14944 /*!
14945  * @name Register SIM_FCFG1, field PFSIZE[27:24] (RO)
14946  *
14947  * This field specifies the amount of program flash memory available on the
14948  * device . Undefined values are reserved.
14949  *
14950  * Values:
14951  * - 0b0000 - 8 KB of program flash memory, 0.25 KB protection region
14952  * - 0b0001 - 16 KB of program flash memory, 0.5 KB protection region
14953  * - 0b0011 - 32 KB of program flash memory, 1 KB protection region
14954  * - 0b0101 - 64 KB of program flash memory, 2 KB protection region
14955  * - 0b0111 - 128 KB of program flash memory, 4 KB protection region
14956  * - 0b1001 - 256 KB of program flash memory, 8 KB protection region
14957  * - 0b1111 - 128 KB of program flash memory, 4 KB protection region
14958  */
14959 /*@{*/
14960 /*! @brief Read current value of the SIM_FCFG1_PFSIZE field. */
14961 #define SIM_RD_FCFG1_PFSIZE(base) ((SIM_FCFG1_REG(base) & SIM_FCFG1_PFSIZE_MASK) >> SIM_FCFG1_PFSIZE_SHIFT)
14962 #define SIM_BRD_FCFG1_PFSIZE(base) (BME_UBFX32(&SIM_FCFG1_REG(base), SIM_FCFG1_PFSIZE_SHIFT, SIM_FCFG1_PFSIZE_WIDTH))
14963 /*@}*/
14964 
14965 /*******************************************************************************
14966  * SIM_FCFG2 - Flash Configuration Register 2
14967  ******************************************************************************/
14968 
14969 /*!
14970  * @brief SIM_FCFG2 - Flash Configuration Register 2 (RO)
14971  *
14972  * Reset value: 0x7F800000U
14973  */
14974 /*!
14975  * @name Constants and macros for entire SIM_FCFG2 register
14976  */
14977 /*@{*/
14978 #define SIM_RD_FCFG2(base) (SIM_FCFG2_REG(base))
14979 /*@}*/
14980 
14981 /*
14982  * Constants & macros for individual SIM_FCFG2 bitfields
14983  */
14984 
14985 /*!
14986  * @name Register SIM_FCFG2, field MAXADDR0[30:24] (RO)
14987  *
14988  * This field concatenated with leading zeros indicates the first invalid
14989  * address of program flash. For example, if MAXADDR0 = 0x10 the first invalid address
14990  * of program flash is 0x0002_0000. This would be the MAXADDR0 value for a device
14991  * with 128 KB program flash.
14992  */
14993 /*@{*/
14994 /*! @brief Read current value of the SIM_FCFG2_MAXADDR0 field. */
14995 #define SIM_RD_FCFG2_MAXADDR0(base) ((SIM_FCFG2_REG(base) & SIM_FCFG2_MAXADDR0_MASK) >> SIM_FCFG2_MAXADDR0_SHIFT)
14996 #define SIM_BRD_FCFG2_MAXADDR0(base) (BME_UBFX32(&SIM_FCFG2_REG(base), SIM_FCFG2_MAXADDR0_SHIFT, SIM_FCFG2_MAXADDR0_WIDTH))
14997 /*@}*/
14998 
14999 /*******************************************************************************
15000  * SIM_UIDMH - Unique Identification Register Mid-High
15001  ******************************************************************************/
15002 
15003 /*!
15004  * @brief SIM_UIDMH - Unique Identification Register Mid-High (RO)
15005  *
15006  * Reset value: 0x00000000U
15007  */
15008 /*!
15009  * @name Constants and macros for entire SIM_UIDMH register
15010  */
15011 /*@{*/
15012 #define SIM_RD_UIDMH(base) (SIM_UIDMH_REG(base))
15013 /*@}*/
15014 
15015 /*
15016  * Constants & macros for individual SIM_UIDMH bitfields
15017  */
15018 
15019 /*!
15020  * @name Register SIM_UIDMH, field UID[15:0] (RO)
15021  *
15022  * Unique identification for the device.
15023  */
15024 /*@{*/
15025 /*! @brief Read current value of the SIM_UIDMH_UID field. */
15026 #define SIM_RD_UIDMH_UID(base) ((SIM_UIDMH_REG(base) & SIM_UIDMH_UID_MASK) >> SIM_UIDMH_UID_SHIFT)
15027 #define SIM_BRD_UIDMH_UID(base) (BME_UBFX32(&SIM_UIDMH_REG(base), SIM_UIDMH_UID_SHIFT, SIM_UIDMH_UID_WIDTH))
15028 /*@}*/
15029 
15030 /*******************************************************************************
15031  * SIM_UIDML - Unique Identification Register Mid Low
15032  ******************************************************************************/
15033 
15034 /*!
15035  * @brief SIM_UIDML - Unique Identification Register Mid Low (RO)
15036  *
15037  * Reset value: 0x00000000U
15038  */
15039 /*!
15040  * @name Constants and macros for entire SIM_UIDML register
15041  */
15042 /*@{*/
15043 #define SIM_RD_UIDML(base) (SIM_UIDML_REG(base))
15044 /*@}*/
15045 
15046 /*******************************************************************************
15047  * SIM_UIDL - Unique Identification Register Low
15048  ******************************************************************************/
15049 
15050 /*!
15051  * @brief SIM_UIDL - Unique Identification Register Low (RO)
15052  *
15053  * Reset value: 0x00000000U
15054  */
15055 /*!
15056  * @name Constants and macros for entire SIM_UIDL register
15057  */
15058 /*@{*/
15059 #define SIM_RD_UIDL(base) (SIM_UIDL_REG(base))
15060 /*@}*/
15061 
15062 /*******************************************************************************
15063  * SIM_COPC - COP Control Register
15064  ******************************************************************************/
15065 
15066 /*!
15067  * @brief SIM_COPC - COP Control Register (RW)
15068  *
15069  * Reset value: 0x0000000CU
15070  *
15071  * All of the bits in this register can be written only once after a reset.
15072  */
15073 /*!
15074  * @name Constants and macros for entire SIM_COPC register
15075  */
15076 /*@{*/
15077 #define SIM_RD_COPC(base) (SIM_COPC_REG(base))
15078 #define SIM_WR_COPC(base, value) (SIM_COPC_REG(base) = (value))
15079 #define SIM_RMW_COPC(base, mask, value) (SIM_WR_COPC(base, (SIM_RD_COPC(base) & ~(mask)) | (value)))
15080 #define SIM_SET_COPC(base, value) (BME_OR32(&SIM_COPC_REG(base), (uint32_t)(value)))
15081 #define SIM_CLR_COPC(base, value) (BME_AND32(&SIM_COPC_REG(base), (uint32_t)(~(value))))
15082 #define SIM_TOG_COPC(base, value) (BME_XOR32(&SIM_COPC_REG(base), (uint32_t)(value)))
15083 /*@}*/
15084 
15085 /*
15086  * Constants & macros for individual SIM_COPC bitfields
15087  */
15088 
15089 /*!
15090  * @name Register SIM_COPC, field COPW[0] (RW)
15091  *
15092  * Windowed mode is only supported when COP is running from the bus clock. The
15093  * COP window is opened three quarters through the timeout period.
15094  *
15095  * Values:
15096  * - 0b0 - Normal mode
15097  * - 0b1 - Windowed mode
15098  */
15099 /*@{*/
15100 /*! @brief Read current value of the SIM_COPC_COPW field. */
15101 #define SIM_RD_COPC_COPW(base) ((SIM_COPC_REG(base) & SIM_COPC_COPW_MASK) >> SIM_COPC_COPW_SHIFT)
15102 #define SIM_BRD_COPC_COPW(base) (BME_UBFX32(&SIM_COPC_REG(base), SIM_COPC_COPW_SHIFT, SIM_COPC_COPW_WIDTH))
15103 
15104 /*! @brief Set the COPW field to a new value. */
15105 #define SIM_WR_COPC_COPW(base, value) (SIM_RMW_COPC(base, SIM_COPC_COPW_MASK, SIM_COPC_COPW(value)))
15106 #define SIM_BWR_COPC_COPW(base, value) (BME_BFI32(&SIM_COPC_REG(base), ((uint32_t)(value) << SIM_COPC_COPW_SHIFT), SIM_COPC_COPW_SHIFT, SIM_COPC_COPW_WIDTH))
15107 /*@}*/
15108 
15109 /*!
15110  * @name Register SIM_COPC, field COPCLKS[1] (RW)
15111  *
15112  * This write-once bit selects the clock source of the COP watchdog.
15113  *
15114  * Values:
15115  * - 0b0 - Internal 1 kHz clock is source to COP
15116  * - 0b1 - Bus clock is source to COP
15117  */
15118 /*@{*/
15119 /*! @brief Read current value of the SIM_COPC_COPCLKS field. */
15120 #define SIM_RD_COPC_COPCLKS(base) ((SIM_COPC_REG(base) & SIM_COPC_COPCLKS_MASK) >> SIM_COPC_COPCLKS_SHIFT)
15121 #define SIM_BRD_COPC_COPCLKS(base) (BME_UBFX32(&SIM_COPC_REG(base), SIM_COPC_COPCLKS_SHIFT, SIM_COPC_COPCLKS_WIDTH))
15122 
15123 /*! @brief Set the COPCLKS field to a new value. */
15124 #define SIM_WR_COPC_COPCLKS(base, value) (SIM_RMW_COPC(base, SIM_COPC_COPCLKS_MASK, SIM_COPC_COPCLKS(value)))
15125 #define SIM_BWR_COPC_COPCLKS(base, value) (BME_BFI32(&SIM_COPC_REG(base), ((uint32_t)(value) << SIM_COPC_COPCLKS_SHIFT), SIM_COPC_COPCLKS_SHIFT, SIM_COPC_COPCLKS_WIDTH))
15126 /*@}*/
15127 
15128 /*!
15129  * @name Register SIM_COPC, field COPT[3:2] (RW)
15130  *
15131  * These write-once bits select the timeout period of the COP. The COPT field
15132  * along with the COPCLKS bit define the COP timeout period.
15133  *
15134  * Values:
15135  * - 0b00 - COP disabled
15136  * - 0b01 - COP timeout after 2^5 LPO cycles or 213 bus clock cycles
15137  * - 0b10 - COP timeout after 2^8 LPO cycles or 216 bus clock cycles
15138  * - 0b11 - COP timeout after 2^10 LPO cycles or 218 bus clock cycles
15139  */
15140 /*@{*/
15141 /*! @brief Read current value of the SIM_COPC_COPT field. */
15142 #define SIM_RD_COPC_COPT(base) ((SIM_COPC_REG(base) & SIM_COPC_COPT_MASK) >> SIM_COPC_COPT_SHIFT)
15143 #define SIM_BRD_COPC_COPT(base) (BME_UBFX32(&SIM_COPC_REG(base), SIM_COPC_COPT_SHIFT, SIM_COPC_COPT_WIDTH))
15144 
15145 /*! @brief Set the COPT field to a new value. */
15146 #define SIM_WR_COPC_COPT(base, value) (SIM_RMW_COPC(base, SIM_COPC_COPT_MASK, SIM_COPC_COPT(value)))
15147 #define SIM_BWR_COPC_COPT(base, value) (BME_BFI32(&SIM_COPC_REG(base), ((uint32_t)(value) << SIM_COPC_COPT_SHIFT), SIM_COPC_COPT_SHIFT, SIM_COPC_COPT_WIDTH))
15148 /*@}*/
15149 
15150 /*******************************************************************************
15151  * SIM_SRVCOP - Service COP Register
15152  ******************************************************************************/
15153 
15154 /*!
15155  * @brief SIM_SRVCOP - Service COP Register (WO)
15156  *
15157  * Reset value: 0x00000000U
15158  */
15159 /*!
15160  * @name Constants and macros for entire SIM_SRVCOP register
15161  */
15162 /*@{*/
15163 #define SIM_WR_SRVCOP(base, value) (SIM_SRVCOP_REG(base) = (value))
15164 /*@}*/
15165 
15166 /*
15167  * Constants & macros for individual SIM_SRVCOP bitfields
15168  */
15169 
15170 /*!
15171  * @name Register SIM_SRVCOP, field SRVCOP[7:0] (WO)
15172  *
15173  * Write 0x55 and then 0xAA (in that order) to reset the COP timeout counter.
15174  */
15175 /*@{*/
15176 /*! @brief Set the SRVCOP field to a new value. */
15177 #define SIM_WR_SRVCOP_SRVCOP(base, value) (SIM_WR_SRVCOP(base, SIM_SRVCOP_SRVCOP(value)))
15178 #define SIM_BWR_SRVCOP_SRVCOP(base, value) (SIM_WR_SRVCOP_SRVCOP(base, value))
15179 /*@}*/
15180 
15181 /*
15182  * MKL25Z4 SMC
15183  *
15184  * System Mode Controller
15185  *
15186  * Registers defined in this header file:
15187  * - SMC_PMPROT - Power Mode Protection register
15188  * - SMC_PMCTRL - Power Mode Control register
15189  * - SMC_STOPCTRL - Stop Control Register
15190  * - SMC_PMSTAT - Power Mode Status register
15191  */
15192 
15193 #define SMC_INSTANCE_COUNT (1U) /*!< Number of instances of the SMC module. */
15194 #define SMC_IDX (0U) /*!< Instance number for SMC. */
15195 
15196 /*******************************************************************************
15197  * SMC_PMPROT - Power Mode Protection register
15198  ******************************************************************************/
15199 
15200 /*!
15201  * @brief SMC_PMPROT - Power Mode Protection register (RW)
15202  *
15203  * Reset value: 0x00U
15204  *
15205  * This register provides protection for entry into any low-power run or stop
15206  * mode. The enabling of the low-power run or stop mode occurs by configuring the
15207  * Power Mode Control register (PMCTRL). The PMPROT register can be written only
15208  * once after any system reset. If the MCU is configured for a disallowed or
15209  * reserved power mode, the MCU remains in its current power mode. For example, if the
15210  * MCU is in normal RUN mode and AVLP is 0, an attempt to enter VLPR mode using
15211  * PMCTRL[RUNM] is blocked and the RUNM bits remain 00b, indicating the MCU is
15212  * still in Normal Run mode. This register is reset on Chip Reset not VLLS and by
15213  * reset types that trigger Chip Reset not VLLS. It is unaffected by reset types
15214  * that do not trigger Chip Reset not VLLS. See the Reset section details for more
15215  * information.
15216  */
15217 /*!
15218  * @name Constants and macros for entire SMC_PMPROT register
15219  */
15220 /*@{*/
15221 #define SMC_RD_PMPROT(base) (SMC_PMPROT_REG(base))
15222 #define SMC_WR_PMPROT(base, value) (SMC_PMPROT_REG(base) = (value))
15223 #define SMC_RMW_PMPROT(base, mask, value) (SMC_WR_PMPROT(base, (SMC_RD_PMPROT(base) & ~(mask)) | (value)))
15224 #define SMC_SET_PMPROT(base, value) (BME_OR8(&SMC_PMPROT_REG(base), (uint8_t)(value)))
15225 #define SMC_CLR_PMPROT(base, value) (BME_AND8(&SMC_PMPROT_REG(base), (uint8_t)(~(value))))
15226 #define SMC_TOG_PMPROT(base, value) (BME_XOR8(&SMC_PMPROT_REG(base), (uint8_t)(value)))
15227 /*@}*/
15228 
15229 /*
15230  * Constants & macros for individual SMC_PMPROT bitfields
15231  */
15232 
15233 /*!
15234  * @name Register SMC_PMPROT, field AVLLS[1] (RW)
15235  *
15236  * Provided the appropriate control bits are set up in PMCTRL, this write once
15237  * bit allows the MCU to enter any very-low-leakage stop mode (VLLSx).
15238  *
15239  * Values:
15240  * - 0b0 - Any VLLSx mode is not allowed
15241  * - 0b1 - Any VLLSx mode is allowed
15242  */
15243 /*@{*/
15244 /*! @brief Read current value of the SMC_PMPROT_AVLLS field. */
15245 #define SMC_RD_PMPROT_AVLLS(base) ((SMC_PMPROT_REG(base) & SMC_PMPROT_AVLLS_MASK) >> SMC_PMPROT_AVLLS_SHIFT)
15246 #define SMC_BRD_PMPROT_AVLLS(base) (BME_UBFX8(&SMC_PMPROT_REG(base), SMC_PMPROT_AVLLS_SHIFT, SMC_PMPROT_AVLLS_WIDTH))
15247 
15248 /*! @brief Set the AVLLS field to a new value. */
15249 #define SMC_WR_PMPROT_AVLLS(base, value) (SMC_RMW_PMPROT(base, SMC_PMPROT_AVLLS_MASK, SMC_PMPROT_AVLLS(value)))
15250 #define SMC_BWR_PMPROT_AVLLS(base, value) (BME_BFI8(&SMC_PMPROT_REG(base), ((uint8_t)(value) << SMC_PMPROT_AVLLS_SHIFT), SMC_PMPROT_AVLLS_SHIFT, SMC_PMPROT_AVLLS_WIDTH))
15251 /*@}*/
15252 
15253 /*!
15254  * @name Register SMC_PMPROT, field ALLS[3] (RW)
15255  *
15256  * This write once bit allows the MCU to enter any low-leakage stop mode (LLS),
15257  * provided the appropriate control bits are set up in PMCTRL.
15258  *
15259  * Values:
15260  * - 0b0 - LLS is not allowed
15261  * - 0b1 - LLS is allowed
15262  */
15263 /*@{*/
15264 /*! @brief Read current value of the SMC_PMPROT_ALLS field. */
15265 #define SMC_RD_PMPROT_ALLS(base) ((SMC_PMPROT_REG(base) & SMC_PMPROT_ALLS_MASK) >> SMC_PMPROT_ALLS_SHIFT)
15266 #define SMC_BRD_PMPROT_ALLS(base) (BME_UBFX8(&SMC_PMPROT_REG(base), SMC_PMPROT_ALLS_SHIFT, SMC_PMPROT_ALLS_WIDTH))
15267 
15268 /*! @brief Set the ALLS field to a new value. */
15269 #define SMC_WR_PMPROT_ALLS(base, value) (SMC_RMW_PMPROT(base, SMC_PMPROT_ALLS_MASK, SMC_PMPROT_ALLS(value)))
15270 #define SMC_BWR_PMPROT_ALLS(base, value) (BME_BFI8(&SMC_PMPROT_REG(base), ((uint8_t)(value) << SMC_PMPROT_ALLS_SHIFT), SMC_PMPROT_ALLS_SHIFT, SMC_PMPROT_ALLS_WIDTH))
15271 /*@}*/
15272 
15273 /*!
15274  * @name Register SMC_PMPROT, field AVLP[5] (RW)
15275  *
15276  * Provided the appropriate control bits are set up in PMCTRL, this write-once
15277  * bit allows the MCU to enter any very-low-power modes: VLPR, VLPW, and VLPS.
15278  *
15279  * Values:
15280  * - 0b0 - VLPR, VLPW and VLPS are not allowed
15281  * - 0b1 - VLPR, VLPW and VLPS are allowed
15282  */
15283 /*@{*/
15284 /*! @brief Read current value of the SMC_PMPROT_AVLP field. */
15285 #define SMC_RD_PMPROT_AVLP(base) ((SMC_PMPROT_REG(base) & SMC_PMPROT_AVLP_MASK) >> SMC_PMPROT_AVLP_SHIFT)
15286 #define SMC_BRD_PMPROT_AVLP(base) (BME_UBFX8(&SMC_PMPROT_REG(base), SMC_PMPROT_AVLP_SHIFT, SMC_PMPROT_AVLP_WIDTH))
15287 
15288 /*! @brief Set the AVLP field to a new value. */
15289 #define SMC_WR_PMPROT_AVLP(base, value) (SMC_RMW_PMPROT(base, SMC_PMPROT_AVLP_MASK, SMC_PMPROT_AVLP(value)))
15290 #define SMC_BWR_PMPROT_AVLP(base, value) (BME_BFI8(&SMC_PMPROT_REG(base), ((uint8_t)(value) << SMC_PMPROT_AVLP_SHIFT), SMC_PMPROT_AVLP_SHIFT, SMC_PMPROT_AVLP_WIDTH))
15291 /*@}*/
15292 
15293 /*******************************************************************************
15294  * SMC_PMCTRL - Power Mode Control register
15295  ******************************************************************************/
15296 
15297 /*!
15298  * @brief SMC_PMCTRL - Power Mode Control register (RW)
15299  *
15300  * Reset value: 0x00U
15301  *
15302  * The PMCTRL register controls entry into low-power run and stop modes,
15303  * provided that the selected power mode is allowed via an appropriate setting of the
15304  * protection (PMPROT) register. This register is reset on Chip POR not VLLS and by
15305  * reset types that trigger Chip POR not VLLS. It is unaffected by reset types
15306  * that do not trigger Chip POR not VLLS. See the Reset section details for more
15307  * information.
15308  */
15309 /*!
15310  * @name Constants and macros for entire SMC_PMCTRL register
15311  */
15312 /*@{*/
15313 #define SMC_RD_PMCTRL(base) (SMC_PMCTRL_REG(base))
15314 #define SMC_WR_PMCTRL(base, value) (SMC_PMCTRL_REG(base) = (value))
15315 #define SMC_RMW_PMCTRL(base, mask, value) (SMC_WR_PMCTRL(base, (SMC_RD_PMCTRL(base) & ~(mask)) | (value)))
15316 #define SMC_SET_PMCTRL(base, value) (BME_OR8(&SMC_PMCTRL_REG(base), (uint8_t)(value)))
15317 #define SMC_CLR_PMCTRL(base, value) (BME_AND8(&SMC_PMCTRL_REG(base), (uint8_t)(~(value))))
15318 #define SMC_TOG_PMCTRL(base, value) (BME_XOR8(&SMC_PMCTRL_REG(base), (uint8_t)(value)))
15319 /*@}*/
15320 
15321 /*
15322  * Constants & macros for individual SMC_PMCTRL bitfields
15323  */
15324 
15325 /*!
15326  * @name Register SMC_PMCTRL, field STOPM[2:0] (RW)
15327  *
15328  * When written, controls entry into the selected stop mode when Sleep-Now or
15329  * Sleep-On-Exit mode is entered with SLEEPDEEP=1 . Writes to this field are
15330  * blocked if the protection level has not been enabled using the PMPROT register.
15331  * After any system reset, this field is cleared by hardware on any successful write
15332  * to the PMPROT register. When set to VLLSx, the VLLSM bits in the STOPCTRL
15333  * register is used to further select the particular VLLS submode which will be
15334  * entered. When set to STOP, the PSTOPO bits in the STOPCTRL register can be used to
15335  * select a Partial Stop mode if desired.
15336  *
15337  * Values:
15338  * - 0b000 - Normal Stop (STOP)
15339  * - 0b001 - Reserved
15340  * - 0b010 - Very-Low-Power Stop (VLPS)
15341  * - 0b011 - Low-Leakage Stop (LLS)
15342  * - 0b100 - Very-Low-Leakage Stop (VLLSx)
15343  * - 0b101 - Reserved
15344  * - 0b110 - Reseved
15345  * - 0b111 - Reserved
15346  */
15347 /*@{*/
15348 /*! @brief Read current value of the SMC_PMCTRL_STOPM field. */
15349 #define SMC_RD_PMCTRL_STOPM(base) ((SMC_PMCTRL_REG(base) & SMC_PMCTRL_STOPM_MASK) >> SMC_PMCTRL_STOPM_SHIFT)
15350 #define SMC_BRD_PMCTRL_STOPM(base) (BME_UBFX8(&SMC_PMCTRL_REG(base), SMC_PMCTRL_STOPM_SHIFT, SMC_PMCTRL_STOPM_WIDTH))
15351 
15352 /*! @brief Set the STOPM field to a new value. */
15353 #define SMC_WR_PMCTRL_STOPM(base, value) (SMC_RMW_PMCTRL(base, SMC_PMCTRL_STOPM_MASK, SMC_PMCTRL_STOPM(value)))
15354 #define SMC_BWR_PMCTRL_STOPM(base, value) (BME_BFI8(&SMC_PMCTRL_REG(base), ((uint8_t)(value) << SMC_PMCTRL_STOPM_SHIFT), SMC_PMCTRL_STOPM_SHIFT, SMC_PMCTRL_STOPM_WIDTH))
15355 /*@}*/
15356 
15357 /*!
15358  * @name Register SMC_PMCTRL, field STOPA[3] (RO)
15359  *
15360  * When set, this read-only status bit indicates an interrupt or reset occured
15361  * during the previous stop mode entry sequence, preventing the system from
15362  * entering that mode. This bit is cleared by hardware at the beginning of any stop
15363  * mode entry sequence and is set if the sequence was aborted.
15364  *
15365  * Values:
15366  * - 0b0 - The previous stop mode entry was successsful.
15367  * - 0b1 - The previous stop mode entry was aborted.
15368  */
15369 /*@{*/
15370 /*! @brief Read current value of the SMC_PMCTRL_STOPA field. */
15371 #define SMC_RD_PMCTRL_STOPA(base) ((SMC_PMCTRL_REG(base) & SMC_PMCTRL_STOPA_MASK) >> SMC_PMCTRL_STOPA_SHIFT)
15372 #define SMC_BRD_PMCTRL_STOPA(base) (BME_UBFX8(&SMC_PMCTRL_REG(base), SMC_PMCTRL_STOPA_SHIFT, SMC_PMCTRL_STOPA_WIDTH))
15373 /*@}*/
15374 
15375 /*!
15376  * @name Register SMC_PMCTRL, field RUNM[6:5] (RW)
15377  *
15378  * When written, causes entry into the selected run mode. Writes to this field
15379  * are blocked if the protection level has not been enabled using the PMPROT
15380  * register. This field is cleared by hardware on any exit to normal RUN mode. RUNM
15381  * must be set to VLPR only when PMSTAT=RUN. After being written to VLPR, RUNM
15382  * should not be written back to RUN until PMSTAT=VLPR. RUNM must be set to RUN only
15383  * when PMSTAT=VLPR. After being written to RUN, RUNM should not be written back
15384  * to VLPR until PMSTAT=RUN.
15385  *
15386  * Values:
15387  * - 0b00 - Normal Run mode (RUN)
15388  * - 0b01 - Reserved
15389  * - 0b10 - Very-Low-Power Run mode (VLPR)
15390  * - 0b11 - Reserved
15391  */
15392 /*@{*/
15393 /*! @brief Read current value of the SMC_PMCTRL_RUNM field. */
15394 #define SMC_RD_PMCTRL_RUNM(base) ((SMC_PMCTRL_REG(base) & SMC_PMCTRL_RUNM_MASK) >> SMC_PMCTRL_RUNM_SHIFT)
15395 #define SMC_BRD_PMCTRL_RUNM(base) (BME_UBFX8(&SMC_PMCTRL_REG(base), SMC_PMCTRL_RUNM_SHIFT, SMC_PMCTRL_RUNM_WIDTH))
15396 
15397 /*! @brief Set the RUNM field to a new value. */
15398 #define SMC_WR_PMCTRL_RUNM(base, value) (SMC_RMW_PMCTRL(base, SMC_PMCTRL_RUNM_MASK, SMC_PMCTRL_RUNM(value)))
15399 #define SMC_BWR_PMCTRL_RUNM(base, value) (BME_BFI8(&SMC_PMCTRL_REG(base), ((uint8_t)(value) << SMC_PMCTRL_RUNM_SHIFT), SMC_PMCTRL_RUNM_SHIFT, SMC_PMCTRL_RUNM_WIDTH))
15400 /*@}*/
15401 
15402 /*******************************************************************************
15403  * SMC_STOPCTRL - Stop Control Register
15404  ******************************************************************************/
15405 
15406 /*!
15407  * @brief SMC_STOPCTRL - Stop Control Register (RW)
15408  *
15409  * Reset value: 0x03U
15410  *
15411  * The STOPCTRL register provides various control bits allowing the user to fine
15412  * tune power consumption during the stop mode selected by the STOPM field. This
15413  * register is reset on Chip POR not VLLS and by reset types that trigger Chip
15414  * POR not VLLS. It is unaffected by reset types that do not trigger Chip POR not
15415  * VLLS. See the Reset section details for more information.
15416  */
15417 /*!
15418  * @name Constants and macros for entire SMC_STOPCTRL register
15419  */
15420 /*@{*/
15421 #define SMC_RD_STOPCTRL(base) (SMC_STOPCTRL_REG(base))
15422 #define SMC_WR_STOPCTRL(base, value) (SMC_STOPCTRL_REG(base) = (value))
15423 #define SMC_RMW_STOPCTRL(base, mask, value) (SMC_WR_STOPCTRL(base, (SMC_RD_STOPCTRL(base) & ~(mask)) | (value)))
15424 #define SMC_SET_STOPCTRL(base, value) (BME_OR8(&SMC_STOPCTRL_REG(base), (uint8_t)(value)))
15425 #define SMC_CLR_STOPCTRL(base, value) (BME_AND8(&SMC_STOPCTRL_REG(base), (uint8_t)(~(value))))
15426 #define SMC_TOG_STOPCTRL(base, value) (BME_XOR8(&SMC_STOPCTRL_REG(base), (uint8_t)(value)))
15427 /*@}*/
15428 
15429 /*
15430  * Constants & macros for individual SMC_STOPCTRL bitfields
15431  */
15432 
15433 /*!
15434  * @name Register SMC_STOPCTRL, field VLLSM[2:0] (RW)
15435  *
15436  * This field controls which VLLS sub-mode to enter if STOPM=VLLS.
15437  *
15438  * Values:
15439  * - 0b000 - VLLS0
15440  * - 0b001 - VLLS1
15441  * - 0b010 - Reserved
15442  * - 0b011 - VLLS3
15443  * - 0b100 - Reserved
15444  * - 0b101 - Reserved
15445  * - 0b110 - Reserved
15446  * - 0b111 - Reserved
15447  */
15448 /*@{*/
15449 /*! @brief Read current value of the SMC_STOPCTRL_VLLSM field. */
15450 #define SMC_RD_STOPCTRL_VLLSM(base) ((SMC_STOPCTRL_REG(base) & SMC_STOPCTRL_VLLSM_MASK) >> SMC_STOPCTRL_VLLSM_SHIFT)
15451 #define SMC_BRD_STOPCTRL_VLLSM(base) (BME_UBFX8(&SMC_STOPCTRL_REG(base), SMC_STOPCTRL_VLLSM_SHIFT, SMC_STOPCTRL_VLLSM_WIDTH))
15452 
15453 /*! @brief Set the VLLSM field to a new value. */
15454 #define SMC_WR_STOPCTRL_VLLSM(base, value) (SMC_RMW_STOPCTRL(base, SMC_STOPCTRL_VLLSM_MASK, SMC_STOPCTRL_VLLSM(value)))
15455 #define SMC_BWR_STOPCTRL_VLLSM(base, value) (BME_BFI8(&SMC_STOPCTRL_REG(base), ((uint8_t)(value) << SMC_STOPCTRL_VLLSM_SHIFT), SMC_STOPCTRL_VLLSM_SHIFT, SMC_STOPCTRL_VLLSM_WIDTH))
15456 /*@}*/
15457 
15458 /*!
15459  * @name Register SMC_STOPCTRL, field PORPO[5] (RW)
15460  *
15461  * This bit controls whether the POR detect circuit is enabled in VLLS0 mode.
15462  *
15463  * Values:
15464  * - 0b0 - POR detect circuit is enabled in VLLS0
15465  * - 0b1 - POR detect circuit is disabled in VLLS0
15466  */
15467 /*@{*/
15468 /*! @brief Read current value of the SMC_STOPCTRL_PORPO field. */
15469 #define SMC_RD_STOPCTRL_PORPO(base) ((SMC_STOPCTRL_REG(base) & SMC_STOPCTRL_PORPO_MASK) >> SMC_STOPCTRL_PORPO_SHIFT)
15470 #define SMC_BRD_STOPCTRL_PORPO(base) (BME_UBFX8(&SMC_STOPCTRL_REG(base), SMC_STOPCTRL_PORPO_SHIFT, SMC_STOPCTRL_PORPO_WIDTH))
15471 
15472 /*! @brief Set the PORPO field to a new value. */
15473 #define SMC_WR_STOPCTRL_PORPO(base, value) (SMC_RMW_STOPCTRL(base, SMC_STOPCTRL_PORPO_MASK, SMC_STOPCTRL_PORPO(value)))
15474 #define SMC_BWR_STOPCTRL_PORPO(base, value) (BME_BFI8(&SMC_STOPCTRL_REG(base), ((uint8_t)(value) << SMC_STOPCTRL_PORPO_SHIFT), SMC_STOPCTRL_PORPO_SHIFT, SMC_STOPCTRL_PORPO_WIDTH))
15475 /*@}*/
15476 
15477 /*!
15478  * @name Register SMC_STOPCTRL, field PSTOPO[7:6] (RW)
15479  *
15480  * These bits control whether a Partial Stop mode is entered when STOPM=STOP.
15481  * When entering a Partial Stop mode from RUN mode, the PMC, MCG and flash remain
15482  * fully powered, allowing the device to wakeup almost instantaneously at the
15483  * expense of higher power consumption. In PSTOP2, only system clocks are gated
15484  * allowing peripherals running on bus clock to remain fully functional. In PSTOP1,
15485  * both system and bus clocks are gated.
15486  *
15487  * Values:
15488  * - 0b00 - STOP - Normal Stop mode
15489  * - 0b01 - PSTOP1 - Partial Stop with both system and bus clocks disabled
15490  * - 0b10 - PSTOP2 - Partial Stop with system clock disabled and bus clock
15491  * enabled
15492  * - 0b11 - Reserved
15493  */
15494 /*@{*/
15495 /*! @brief Read current value of the SMC_STOPCTRL_PSTOPO field. */
15496 #define SMC_RD_STOPCTRL_PSTOPO(base) ((SMC_STOPCTRL_REG(base) & SMC_STOPCTRL_PSTOPO_MASK) >> SMC_STOPCTRL_PSTOPO_SHIFT)
15497 #define SMC_BRD_STOPCTRL_PSTOPO(base) (BME_UBFX8(&SMC_STOPCTRL_REG(base), SMC_STOPCTRL_PSTOPO_SHIFT, SMC_STOPCTRL_PSTOPO_WIDTH))
15498 
15499 /*! @brief Set the PSTOPO field to a new value. */
15500 #define SMC_WR_STOPCTRL_PSTOPO(base, value) (SMC_RMW_STOPCTRL(base, SMC_STOPCTRL_PSTOPO_MASK, SMC_STOPCTRL_PSTOPO(value)))
15501 #define SMC_BWR_STOPCTRL_PSTOPO(base, value) (BME_BFI8(&SMC_STOPCTRL_REG(base), ((uint8_t)(value) << SMC_STOPCTRL_PSTOPO_SHIFT), SMC_STOPCTRL_PSTOPO_SHIFT, SMC_STOPCTRL_PSTOPO_WIDTH))
15502 /*@}*/
15503 
15504 /*******************************************************************************
15505  * SMC_PMSTAT - Power Mode Status register
15506  ******************************************************************************/
15507 
15508 /*!
15509  * @brief SMC_PMSTAT - Power Mode Status register (RO)
15510  *
15511  * Reset value: 0x01U
15512  *
15513  * PMSTAT is a read-only, one-hot register which indicates the current power
15514  * mode of the system. This register is reset on Chip POR not VLLS and by reset
15515  * types that trigger Chip POR not VLLS. It is unaffected by reset types that do not
15516  * trigger Chip POR not VLLS. See the Reset section details for more information.
15517  */
15518 /*!
15519  * @name Constants and macros for entire SMC_PMSTAT register
15520  */
15521 /*@{*/
15522 #define SMC_RD_PMSTAT(base) (SMC_PMSTAT_REG(base))
15523 /*@}*/
15524 
15525 /*
15526  * Constants & macros for individual SMC_PMSTAT bitfields
15527  */
15528 
15529 /*!
15530  * @name Register SMC_PMSTAT, field PMSTAT[6:0] (RO)
15531  *
15532  * When debug is enabled, the PMSTAT will not update to STOP or VLPS When a
15533  * PSTOP mode is enabled, the PMSTAT will not update to STOP or VLPS
15534  */
15535 /*@{*/
15536 /*! @brief Read current value of the SMC_PMSTAT_PMSTAT field. */
15537 #define SMC_RD_PMSTAT_PMSTAT(base) ((SMC_PMSTAT_REG(base) & SMC_PMSTAT_PMSTAT_MASK) >> SMC_PMSTAT_PMSTAT_SHIFT)
15538 #define SMC_BRD_PMSTAT_PMSTAT(base) (BME_UBFX8(&SMC_PMSTAT_REG(base), SMC_PMSTAT_PMSTAT_SHIFT, SMC_PMSTAT_PMSTAT_WIDTH))
15539 /*@}*/
15540 
15541 /*
15542  * MKL25Z4 SPI
15543  *
15544  * Serial Peripheral Interface
15545  *
15546  * Registers defined in this header file:
15547  * - SPI_C1 - SPI control register 1
15548  * - SPI_C2 - SPI control register 2
15549  * - SPI_BR - SPI baud rate register
15550  * - SPI_S - SPI status register
15551  * - SPI_D - SPI data register
15552  * - SPI_M - SPI match register
15553  */
15554 
15555 #define SPI_INSTANCE_COUNT (2U) /*!< Number of instances of the SPI module. */
15556 #define SPI0_IDX (0U) /*!< Instance number for SPI0. */
15557 #define SPI1_IDX (1U) /*!< Instance number for SPI1. */
15558 
15559 /*******************************************************************************
15560  * SPI_C1 - SPI control register 1
15561  ******************************************************************************/
15562 
15563 /*!
15564  * @brief SPI_C1 - SPI control register 1 (RW)
15565  *
15566  * Reset value: 0x04U
15567  *
15568  * This read/write register includes the SPI enable control, interrupt enables,
15569  * and configuration options.
15570  */
15571 /*!
15572  * @name Constants and macros for entire SPI_C1 register
15573  */
15574 /*@{*/
15575 #define SPI_RD_C1(base) (SPI_C1_REG(base))
15576 #define SPI_WR_C1(base, value) (SPI_C1_REG(base) = (value))
15577 #define SPI_RMW_C1(base, mask, value) (SPI_WR_C1(base, (SPI_RD_C1(base) & ~(mask)) | (value)))
15578 #define SPI_SET_C1(base, value) (BME_OR8(&SPI_C1_REG(base), (uint8_t)(value)))
15579 #define SPI_CLR_C1(base, value) (BME_AND8(&SPI_C1_REG(base), (uint8_t)(~(value))))
15580 #define SPI_TOG_C1(base, value) (BME_XOR8(&SPI_C1_REG(base), (uint8_t)(value)))
15581 /*@}*/
15582 
15583 /*
15584  * Constants & macros for individual SPI_C1 bitfields
15585  */
15586 
15587 /*!
15588  * @name Register SPI_C1, field LSBFE[0] (RW)
15589  *
15590  * This bit does not affect the position of the MSB and LSB in the data
15591  * register. Reads and writes of the data register always have the MSB in bit 7.
15592  *
15593  * Values:
15594  * - 0b0 - SPI serial data transfers start with most significant bit
15595  * - 0b1 - SPI serial data transfers start with least significant bit
15596  */
15597 /*@{*/
15598 /*! @brief Read current value of the SPI_C1_LSBFE field. */
15599 #define SPI_RD_C1_LSBFE(base) ((SPI_C1_REG(base) & SPI_C1_LSBFE_MASK) >> SPI_C1_LSBFE_SHIFT)
15600 #define SPI_BRD_C1_LSBFE(base) (BME_UBFX8(&SPI_C1_REG(base), SPI_C1_LSBFE_SHIFT, SPI_C1_LSBFE_WIDTH))
15601 
15602 /*! @brief Set the LSBFE field to a new value. */
15603 #define SPI_WR_C1_LSBFE(base, value) (SPI_RMW_C1(base, SPI_C1_LSBFE_MASK, SPI_C1_LSBFE(value)))
15604 #define SPI_BWR_C1_LSBFE(base, value) (BME_BFI8(&SPI_C1_REG(base), ((uint8_t)(value) << SPI_C1_LSBFE_SHIFT), SPI_C1_LSBFE_SHIFT, SPI_C1_LSBFE_WIDTH))
15605 /*@}*/
15606 
15607 /*!
15608  * @name Register SPI_C1, field SSOE[1] (RW)
15609  *
15610  * This bit is used in combination with the mode fault enable (MODFEN) bit in
15611  * the C2 register and the master/slave (MSTR) control bit to determine the
15612  * function of the SS pin.
15613  *
15614  * Values:
15615  * - 0b0 - When MODFEN is 0: In master mode, SS pin function is general-purpose
15616  * I/O (not SPI). In slave mode, SS pin function is slave select input. When
15617  * MODFEN is 1: In master mode, SS pin function is SS input for mode fault.
15618  * In slave mode, SS pin function is slave select input.
15619  * - 0b1 - When MODFEN is 0: In master mode, SS pin function is general-purpose
15620  * I/O (not SPI). In slave mode, SS pin function is slave select input. When
15621  * MODFEN is 1: In master mode, SS pin function is automatic SS output. In
15622  * slave mode: SS pin function is slave select input.
15623  */
15624 /*@{*/
15625 /*! @brief Read current value of the SPI_C1_SSOE field. */
15626 #define SPI_RD_C1_SSOE(base) ((SPI_C1_REG(base) & SPI_C1_SSOE_MASK) >> SPI_C1_SSOE_SHIFT)
15627 #define SPI_BRD_C1_SSOE(base) (BME_UBFX8(&SPI_C1_REG(base), SPI_C1_SSOE_SHIFT, SPI_C1_SSOE_WIDTH))
15628 
15629 /*! @brief Set the SSOE field to a new value. */
15630 #define SPI_WR_C1_SSOE(base, value) (SPI_RMW_C1(base, SPI_C1_SSOE_MASK, SPI_C1_SSOE(value)))
15631 #define SPI_BWR_C1_SSOE(base, value) (BME_BFI8(&SPI_C1_REG(base), ((uint8_t)(value) << SPI_C1_SSOE_SHIFT), SPI_C1_SSOE_SHIFT, SPI_C1_SSOE_WIDTH))
15632 /*@}*/
15633 
15634 /*!
15635  * @name Register SPI_C1, field CPHA[2] (RW)
15636  *
15637  * This bit selects one of two clock formats for different kinds of synchronous
15638  * serial peripheral devices. Refer to the description of "SPI Clock Formats" for
15639  * details.
15640  *
15641  * Values:
15642  * - 0b0 - First edge on SPSCK occurs at the middle of the first cycle of a data
15643  * transfer
15644  * - 0b1 - First edge on SPSCK occurs at the start of the first cycle of a data
15645  * transfer
15646  */
15647 /*@{*/
15648 /*! @brief Read current value of the SPI_C1_CPHA field. */
15649 #define SPI_RD_C1_CPHA(base) ((SPI_C1_REG(base) & SPI_C1_CPHA_MASK) >> SPI_C1_CPHA_SHIFT)
15650 #define SPI_BRD_C1_CPHA(base) (BME_UBFX8(&SPI_C1_REG(base), SPI_C1_CPHA_SHIFT, SPI_C1_CPHA_WIDTH))
15651 
15652 /*! @brief Set the CPHA field to a new value. */
15653 #define SPI_WR_C1_CPHA(base, value) (SPI_RMW_C1(base, SPI_C1_CPHA_MASK, SPI_C1_CPHA(value)))
15654 #define SPI_BWR_C1_CPHA(base, value) (BME_BFI8(&SPI_C1_REG(base), ((uint8_t)(value) << SPI_C1_CPHA_SHIFT), SPI_C1_CPHA_SHIFT, SPI_C1_CPHA_WIDTH))
15655 /*@}*/
15656 
15657 /*!
15658  * @name Register SPI_C1, field CPOL[3] (RW)
15659  *
15660  * This bit selects an inverted or non-inverted SPI clock. To transmit data
15661  * between SPI modules, the SPI modules must have identical CPOL values. This bit
15662  * effectively places an inverter in series with the clock signal either from a
15663  * master SPI device or to a slave SPI device. Refer to the description of "SPI Clock
15664  * Formats" for details.
15665  *
15666  * Values:
15667  * - 0b0 - Active-high SPI clock (idles low)
15668  * - 0b1 - Active-low SPI clock (idles high)
15669  */
15670 /*@{*/
15671 /*! @brief Read current value of the SPI_C1_CPOL field. */
15672 #define SPI_RD_C1_CPOL(base) ((SPI_C1_REG(base) & SPI_C1_CPOL_MASK) >> SPI_C1_CPOL_SHIFT)
15673 #define SPI_BRD_C1_CPOL(base) (BME_UBFX8(&SPI_C1_REG(base), SPI_C1_CPOL_SHIFT, SPI_C1_CPOL_WIDTH))
15674 
15675 /*! @brief Set the CPOL field to a new value. */
15676 #define SPI_WR_C1_CPOL(base, value) (SPI_RMW_C1(base, SPI_C1_CPOL_MASK, SPI_C1_CPOL(value)))
15677 #define SPI_BWR_C1_CPOL(base, value) (BME_BFI8(&SPI_C1_REG(base), ((uint8_t)(value) << SPI_C1_CPOL_SHIFT), SPI_C1_CPOL_SHIFT, SPI_C1_CPOL_WIDTH))
15678 /*@}*/
15679 
15680 /*!
15681  * @name Register SPI_C1, field MSTR[4] (RW)
15682  *
15683  * This bit selects master or slave mode operation.
15684  *
15685  * Values:
15686  * - 0b0 - SPI module configured as a slave SPI device
15687  * - 0b1 - SPI module configured as a master SPI device
15688  */
15689 /*@{*/
15690 /*! @brief Read current value of the SPI_C1_MSTR field. */
15691 #define SPI_RD_C1_MSTR(base) ((SPI_C1_REG(base) & SPI_C1_MSTR_MASK) >> SPI_C1_MSTR_SHIFT)
15692 #define SPI_BRD_C1_MSTR(base) (BME_UBFX8(&SPI_C1_REG(base), SPI_C1_MSTR_SHIFT, SPI_C1_MSTR_WIDTH))
15693 
15694 /*! @brief Set the MSTR field to a new value. */
15695 #define SPI_WR_C1_MSTR(base, value) (SPI_RMW_C1(base, SPI_C1_MSTR_MASK, SPI_C1_MSTR(value)))
15696 #define SPI_BWR_C1_MSTR(base, value) (BME_BFI8(&SPI_C1_REG(base), ((uint8_t)(value) << SPI_C1_MSTR_SHIFT), SPI_C1_MSTR_SHIFT, SPI_C1_MSTR_WIDTH))
15697 /*@}*/
15698 
15699 /*!
15700  * @name Register SPI_C1, field SPTIE[5] (RW)
15701  *
15702  * This is the interrupt enable bit for SPI transmit buffer empty (SPTEF). An
15703  * interrupt occurs when the SPI transmit buffer is empty (SPTEF is set).
15704  *
15705  * Values:
15706  * - 0b0 - Interrupts from SPTEF inhibited (use polling)
15707  * - 0b1 - When SPTEF is 1, hardware interrupt requested
15708  */
15709 /*@{*/
15710 /*! @brief Read current value of the SPI_C1_SPTIE field. */
15711 #define SPI_RD_C1_SPTIE(base) ((SPI_C1_REG(base) & SPI_C1_SPTIE_MASK) >> SPI_C1_SPTIE_SHIFT)
15712 #define SPI_BRD_C1_SPTIE(base) (BME_UBFX8(&SPI_C1_REG(base), SPI_C1_SPTIE_SHIFT, SPI_C1_SPTIE_WIDTH))
15713 
15714 /*! @brief Set the SPTIE field to a new value. */
15715 #define SPI_WR_C1_SPTIE(base, value) (SPI_RMW_C1(base, SPI_C1_SPTIE_MASK, SPI_C1_SPTIE(value)))
15716 #define SPI_BWR_C1_SPTIE(base, value) (BME_BFI8(&SPI_C1_REG(base), ((uint8_t)(value) << SPI_C1_SPTIE_SHIFT), SPI_C1_SPTIE_SHIFT, SPI_C1_SPTIE_WIDTH))
15717 /*@}*/
15718 
15719 /*!
15720  * @name Register SPI_C1, field SPE[6] (RW)
15721  *
15722  * This bit enables the SPI system and dedicates the SPI port pins to SPI system
15723  * functions. If SPE is cleared, the SPI is disabled and forced into an idle
15724  * state, and all status bits in the S register are reset.
15725  *
15726  * Values:
15727  * - 0b0 - SPI system inactive
15728  * - 0b1 - SPI system enabled
15729  */
15730 /*@{*/
15731 /*! @brief Read current value of the SPI_C1_SPE field. */
15732 #define SPI_RD_C1_SPE(base) ((SPI_C1_REG(base) & SPI_C1_SPE_MASK) >> SPI_C1_SPE_SHIFT)
15733 #define SPI_BRD_C1_SPE(base) (BME_UBFX8(&SPI_C1_REG(base), SPI_C1_SPE_SHIFT, SPI_C1_SPE_WIDTH))
15734 
15735 /*! @brief Set the SPE field to a new value. */
15736 #define SPI_WR_C1_SPE(base, value) (SPI_RMW_C1(base, SPI_C1_SPE_MASK, SPI_C1_SPE(value)))
15737 #define SPI_BWR_C1_SPE(base, value) (BME_BFI8(&SPI_C1_REG(base), ((uint8_t)(value) << SPI_C1_SPE_SHIFT), SPI_C1_SPE_SHIFT, SPI_C1_SPE_WIDTH))
15738 /*@}*/
15739 
15740 /*!
15741  * @name Register SPI_C1, field SPIE[7] (RW)
15742  *
15743  * This bit enables the interrupt for SPI receive buffer full (SPRF) and mode
15744  * fault (MODF) events.
15745  *
15746  * Values:
15747  * - 0b0 - Interrupts from SPRF and MODF are inhibited-use polling
15748  * - 0b1 - Request a hardware interrupt when SPRF or MODF is 1
15749  */
15750 /*@{*/
15751 /*! @brief Read current value of the SPI_C1_SPIE field. */
15752 #define SPI_RD_C1_SPIE(base) ((SPI_C1_REG(base) & SPI_C1_SPIE_MASK) >> SPI_C1_SPIE_SHIFT)
15753 #define SPI_BRD_C1_SPIE(base) (BME_UBFX8(&SPI_C1_REG(base), SPI_C1_SPIE_SHIFT, SPI_C1_SPIE_WIDTH))
15754 
15755 /*! @brief Set the SPIE field to a new value. */
15756 #define SPI_WR_C1_SPIE(base, value) (SPI_RMW_C1(base, SPI_C1_SPIE_MASK, SPI_C1_SPIE(value)))
15757 #define SPI_BWR_C1_SPIE(base, value) (BME_BFI8(&SPI_C1_REG(base), ((uint8_t)(value) << SPI_C1_SPIE_SHIFT), SPI_C1_SPIE_SHIFT, SPI_C1_SPIE_WIDTH))
15758 /*@}*/
15759 
15760 /*******************************************************************************
15761  * SPI_C2 - SPI control register 2
15762  ******************************************************************************/
15763 
15764 /*!
15765  * @brief SPI_C2 - SPI control register 2 (RW)
15766  *
15767  * Reset value: 0x00U
15768  *
15769  * This read/write register is used to control optional features of the SPI
15770  * system. Bit 6 is not implemented and always reads 0.
15771  */
15772 /*!
15773  * @name Constants and macros for entire SPI_C2 register
15774  */
15775 /*@{*/
15776 #define SPI_RD_C2(base) (SPI_C2_REG(base))
15777 #define SPI_WR_C2(base, value) (SPI_C2_REG(base) = (value))
15778 #define SPI_RMW_C2(base, mask, value) (SPI_WR_C2(base, (SPI_RD_C2(base) & ~(mask)) | (value)))
15779 #define SPI_SET_C2(base, value) (BME_OR8(&SPI_C2_REG(base), (uint8_t)(value)))
15780 #define SPI_CLR_C2(base, value) (BME_AND8(&SPI_C2_REG(base), (uint8_t)(~(value))))
15781 #define SPI_TOG_C2(base, value) (BME_XOR8(&SPI_C2_REG(base), (uint8_t)(value)))
15782 /*@}*/
15783 
15784 /*
15785  * Constants & macros for individual SPI_C2 bitfields
15786  */
15787 
15788 /*!
15789  * @name Register SPI_C2, field SPC0[0] (RW)
15790  *
15791  * This bit enables bidirectional pin configurations.
15792  *
15793  * Values:
15794  * - 0b0 - SPI uses separate pins for data input and data output (pin mode is
15795  * normal). In master mode of operation: MISO is master in and MOSI is master
15796  * out. In slave mode of operation: MISO is slave out and MOSI is slave in.
15797  * - 0b1 - SPI configured for single-wire bidirectional operation (pin mode is
15798  * bidirectional). In master mode of operation: MISO is not used by SPI; MOSI
15799  * is master in when BIDIROE is 0 or master I/O when BIDIROE is 1. In slave
15800  * mode of operation: MISO is slave in when BIDIROE is 0 or slave I/O when
15801  * BIDIROE is 1; MOSI is not used by SPI.
15802  */
15803 /*@{*/
15804 /*! @brief Read current value of the SPI_C2_SPC0 field. */
15805 #define SPI_RD_C2_SPC0(base) ((SPI_C2_REG(base) & SPI_C2_SPC0_MASK) >> SPI_C2_SPC0_SHIFT)
15806 #define SPI_BRD_C2_SPC0(base) (BME_UBFX8(&SPI_C2_REG(base), SPI_C2_SPC0_SHIFT, SPI_C2_SPC0_WIDTH))
15807 
15808 /*! @brief Set the SPC0 field to a new value. */
15809 #define SPI_WR_C2_SPC0(base, value) (SPI_RMW_C2(base, SPI_C2_SPC0_MASK, SPI_C2_SPC0(value)))
15810 #define SPI_BWR_C2_SPC0(base, value) (BME_BFI8(&SPI_C2_REG(base), ((uint8_t)(value) << SPI_C2_SPC0_SHIFT), SPI_C2_SPC0_SHIFT, SPI_C2_SPC0_WIDTH))
15811 /*@}*/
15812 
15813 /*!
15814  * @name Register SPI_C2, field SPISWAI[1] (RW)
15815  *
15816  * This bit is used for power conservation while the device is in wait mode.
15817  *
15818  * Values:
15819  * - 0b0 - SPI clocks continue to operate in wait mode
15820  * - 0b1 - SPI clocks stop when the MCU enters wait mode
15821  */
15822 /*@{*/
15823 /*! @brief Read current value of the SPI_C2_SPISWAI field. */
15824 #define SPI_RD_C2_SPISWAI(base) ((SPI_C2_REG(base) & SPI_C2_SPISWAI_MASK) >> SPI_C2_SPISWAI_SHIFT)
15825 #define SPI_BRD_C2_SPISWAI(base) (BME_UBFX8(&SPI_C2_REG(base), SPI_C2_SPISWAI_SHIFT, SPI_C2_SPISWAI_WIDTH))
15826 
15827 /*! @brief Set the SPISWAI field to a new value. */
15828 #define SPI_WR_C2_SPISWAI(base, value) (SPI_RMW_C2(base, SPI_C2_SPISWAI_MASK, SPI_C2_SPISWAI(value)))
15829 #define SPI_BWR_C2_SPISWAI(base, value) (BME_BFI8(&SPI_C2_REG(base), ((uint8_t)(value) << SPI_C2_SPISWAI_SHIFT), SPI_C2_SPISWAI_SHIFT, SPI_C2_SPISWAI_WIDTH))
15830 /*@}*/
15831 
15832 /*!
15833  * @name Register SPI_C2, field RXDMAE[2] (RW)
15834  *
15835  * This is the enable bit for a receive DMA request. When this bit is set to 1,
15836  * a receive DMA request is asserted when both SPRF and SPE are set, and the
15837  * interrupt from SPRF is disabled.
15838  *
15839  * Values:
15840  * - 0b0 - DMA request for receive is disabled and interrupt from SPRF is allowed
15841  * - 0b1 - DMA request for receive is enabled and interrupt from SPRF is disabled
15842  */
15843 /*@{*/
15844 /*! @brief Read current value of the SPI_C2_RXDMAE field. */
15845 #define SPI_RD_C2_RXDMAE(base) ((SPI_C2_REG(base) & SPI_C2_RXDMAE_MASK) >> SPI_C2_RXDMAE_SHIFT)
15846 #define SPI_BRD_C2_RXDMAE(base) (BME_UBFX8(&SPI_C2_REG(base), SPI_C2_RXDMAE_SHIFT, SPI_C2_RXDMAE_WIDTH))
15847 
15848 /*! @brief Set the RXDMAE field to a new value. */
15849 #define SPI_WR_C2_RXDMAE(base, value) (SPI_RMW_C2(base, SPI_C2_RXDMAE_MASK, SPI_C2_RXDMAE(value)))
15850 #define SPI_BWR_C2_RXDMAE(base, value) (BME_BFI8(&SPI_C2_REG(base), ((uint8_t)(value) << SPI_C2_RXDMAE_SHIFT), SPI_C2_RXDMAE_SHIFT, SPI_C2_RXDMAE_WIDTH))
15851 /*@}*/
15852 
15853 /*!
15854  * @name Register SPI_C2, field BIDIROE[3] (RW)
15855  *
15856  * When bidirectional mode is enabled, because SPI pin control 0 (SPC0) is set
15857  * to 1, the BIDIROE bit determines whether the SPI data output driver is enabled
15858  * to the single bidirectional SPI I/O pin. Depending on whether the SPI is
15859  * configured as a master or a slave, it uses the MOSI (MOMI) or MISO (SISO) pin,
15860  * respectively, as the single SPI data I/O pin. When SPC0 is 0, BIDIROE has no
15861  * meaning or effect.
15862  *
15863  * Values:
15864  * - 0b0 - Output driver disabled so SPI data I/O pin acts as an input
15865  * - 0b1 - SPI I/O pin enabled as an output
15866  */
15867 /*@{*/
15868 /*! @brief Read current value of the SPI_C2_BIDIROE field. */
15869 #define SPI_RD_C2_BIDIROE(base) ((SPI_C2_REG(base) & SPI_C2_BIDIROE_MASK) >> SPI_C2_BIDIROE_SHIFT)
15870 #define SPI_BRD_C2_BIDIROE(base) (BME_UBFX8(&SPI_C2_REG(base), SPI_C2_BIDIROE_SHIFT, SPI_C2_BIDIROE_WIDTH))
15871 
15872 /*! @brief Set the BIDIROE field to a new value. */
15873 #define SPI_WR_C2_BIDIROE(base, value) (SPI_RMW_C2(base, SPI_C2_BIDIROE_MASK, SPI_C2_BIDIROE(value)))
15874 #define SPI_BWR_C2_BIDIROE(base, value) (BME_BFI8(&SPI_C2_REG(base), ((uint8_t)(value) << SPI_C2_BIDIROE_SHIFT), SPI_C2_BIDIROE_SHIFT, SPI_C2_BIDIROE_WIDTH))
15875 /*@}*/
15876 
15877 /*!
15878  * @name Register SPI_C2, field MODFEN[4] (RW)
15879  *
15880  * When the SPI is configured for slave mode, this bit has no meaning or effect.
15881  * (The SS pin is the slave select input.) In master mode, this bit determines
15882  * how the SS pin is used. For details, refer to the description of the SSOE bit
15883  * in the C1 register.
15884  *
15885  * Values:
15886  * - 0b0 - Mode fault function disabled, master SS pin reverts to
15887  * general-purpose I/O not controlled by SPI
15888  * - 0b1 - Mode fault function enabled, master SS pin acts as the mode fault
15889  * input or the slave select output
15890  */
15891 /*@{*/
15892 /*! @brief Read current value of the SPI_C2_MODFEN field. */
15893 #define SPI_RD_C2_MODFEN(base) ((SPI_C2_REG(base) & SPI_C2_MODFEN_MASK) >> SPI_C2_MODFEN_SHIFT)
15894 #define SPI_BRD_C2_MODFEN(base) (BME_UBFX8(&SPI_C2_REG(base), SPI_C2_MODFEN_SHIFT, SPI_C2_MODFEN_WIDTH))
15895 
15896 /*! @brief Set the MODFEN field to a new value. */
15897 #define SPI_WR_C2_MODFEN(base, value) (SPI_RMW_C2(base, SPI_C2_MODFEN_MASK, SPI_C2_MODFEN(value)))
15898 #define SPI_BWR_C2_MODFEN(base, value) (BME_BFI8(&SPI_C2_REG(base), ((uint8_t)(value) << SPI_C2_MODFEN_SHIFT), SPI_C2_MODFEN_SHIFT, SPI_C2_MODFEN_WIDTH))
15899 /*@}*/
15900 
15901 /*!
15902  * @name Register SPI_C2, field TXDMAE[5] (RW)
15903  *
15904  * This bit enables a transmit DMA request. When this bit is set to 1, a
15905  * transmit DMA request is asserted when both SPTEF and SPE are set, and the interrupt
15906  * from SPTEF is disabled.
15907  *
15908  * Values:
15909  * - 0b0 - DMA request for transmit is disabled and interrupt from SPTEF is
15910  * allowed
15911  * - 0b1 - DMA request for transmit is enabled and interrupt from SPTEF is
15912  * disabled
15913  */
15914 /*@{*/
15915 /*! @brief Read current value of the SPI_C2_TXDMAE field. */
15916 #define SPI_RD_C2_TXDMAE(base) ((SPI_C2_REG(base) & SPI_C2_TXDMAE_MASK) >> SPI_C2_TXDMAE_SHIFT)
15917 #define SPI_BRD_C2_TXDMAE(base) (BME_UBFX8(&SPI_C2_REG(base), SPI_C2_TXDMAE_SHIFT, SPI_C2_TXDMAE_WIDTH))
15918 
15919 /*! @brief Set the TXDMAE field to a new value. */
15920 #define SPI_WR_C2_TXDMAE(base, value) (SPI_RMW_C2(base, SPI_C2_TXDMAE_MASK, SPI_C2_TXDMAE(value)))
15921 #define SPI_BWR_C2_TXDMAE(base, value) (BME_BFI8(&SPI_C2_REG(base), ((uint8_t)(value) << SPI_C2_TXDMAE_SHIFT), SPI_C2_TXDMAE_SHIFT, SPI_C2_TXDMAE_WIDTH))
15922 /*@}*/
15923 
15924 /*!
15925  * @name Register SPI_C2, field SPMIE[7] (RW)
15926  *
15927  * This is the interrupt enable bit for the SPI receive data buffer hardware
15928  * match (SPMF) function.
15929  *
15930  * Values:
15931  * - 0b0 - Interrupts from SPMF inhibited (use polling)
15932  * - 0b1 - When SPMF is 1, requests a hardware interrupt
15933  */
15934 /*@{*/
15935 /*! @brief Read current value of the SPI_C2_SPMIE field. */
15936 #define SPI_RD_C2_SPMIE(base) ((SPI_C2_REG(base) & SPI_C2_SPMIE_MASK) >> SPI_C2_SPMIE_SHIFT)
15937 #define SPI_BRD_C2_SPMIE(base) (BME_UBFX8(&SPI_C2_REG(base), SPI_C2_SPMIE_SHIFT, SPI_C2_SPMIE_WIDTH))
15938 
15939 /*! @brief Set the SPMIE field to a new value. */
15940 #define SPI_WR_C2_SPMIE(base, value) (SPI_RMW_C2(base, SPI_C2_SPMIE_MASK, SPI_C2_SPMIE(value)))
15941 #define SPI_BWR_C2_SPMIE(base, value) (BME_BFI8(&SPI_C2_REG(base), ((uint8_t)(value) << SPI_C2_SPMIE_SHIFT), SPI_C2_SPMIE_SHIFT, SPI_C2_SPMIE_WIDTH))
15942 /*@}*/
15943 
15944 /*******************************************************************************
15945  * SPI_BR - SPI baud rate register
15946  ******************************************************************************/
15947 
15948 /*!
15949  * @brief SPI_BR - SPI baud rate register (RW)
15950  *
15951  * Reset value: 0x00U
15952  *
15953  * Use this register to set the prescaler and bit rate divisor for an SPI
15954  * master. This register may be read or written at any time.
15955  */
15956 /*!
15957  * @name Constants and macros for entire SPI_BR register
15958  */
15959 /*@{*/
15960 #define SPI_RD_BR(base) (SPI_BR_REG(base))
15961 #define SPI_WR_BR(base, value) (SPI_BR_REG(base) = (value))
15962 #define SPI_RMW_BR(base, mask, value) (SPI_WR_BR(base, (SPI_RD_BR(base) & ~(mask)) | (value)))
15963 #define SPI_SET_BR(base, value) (BME_OR8(&SPI_BR_REG(base), (uint8_t)(value)))
15964 #define SPI_CLR_BR(base, value) (BME_AND8(&SPI_BR_REG(base), (uint8_t)(~(value))))
15965 #define SPI_TOG_BR(base, value) (BME_XOR8(&SPI_BR_REG(base), (uint8_t)(value)))
15966 /*@}*/
15967 
15968 /*
15969  * Constants & macros for individual SPI_BR bitfields
15970  */
15971 
15972 /*!
15973  * @name Register SPI_BR, field SPR[3:0] (RW)
15974  *
15975  * This 4-bit field selects one of nine divisors for the SPI baud rate divider.
15976  * The input to this divider comes from the SPI baud rate prescaler. Refer to the
15977  * description of "SPI Baud Rate Generation" for details.
15978  *
15979  * Values:
15980  * - 0b0000 - Baud rate divisor is 2
15981  * - 0b0001 - Baud rate divisor is 4
15982  * - 0b0010 - Baud rate divisor is 8
15983  * - 0b0011 - Baud rate divisor is 16
15984  * - 0b0100 - Baud rate divisor is 32
15985  * - 0b0101 - Baud rate divisor is 64
15986  * - 0b0110 - Baud rate divisor is 128
15987  * - 0b0111 - Baud rate divisor is 256
15988  * - 0b1000 - Baud rate divisor is 512
15989  */
15990 /*@{*/
15991 /*! @brief Read current value of the SPI_BR_SPR field. */
15992 #define SPI_RD_BR_SPR(base) ((SPI_BR_REG(base) & SPI_BR_SPR_MASK) >> SPI_BR_SPR_SHIFT)
15993 #define SPI_BRD_BR_SPR(base) (BME_UBFX8(&SPI_BR_REG(base), SPI_BR_SPR_SHIFT, SPI_BR_SPR_WIDTH))
15994 
15995 /*! @brief Set the SPR field to a new value. */
15996 #define SPI_WR_BR_SPR(base, value) (SPI_RMW_BR(base, SPI_BR_SPR_MASK, SPI_BR_SPR(value)))
15997 #define SPI_BWR_BR_SPR(base, value) (BME_BFI8(&SPI_BR_REG(base), ((uint8_t)(value) << SPI_BR_SPR_SHIFT), SPI_BR_SPR_SHIFT, SPI_BR_SPR_WIDTH))
15998 /*@}*/
15999 
16000 /*!
16001  * @name Register SPI_BR, field SPPR[6:4] (RW)
16002  *
16003  * This 3-bit field selects one of eight divisors for the SPI baud rate
16004  * prescaler. The input to this prescaler is the bus rate clock (BUSCLK). The output of
16005  * this prescaler drives the input of the SPI baud rate divider. Refer to the
16006  * description of "SPI Baud Rate Generation" for details.
16007  *
16008  * Values:
16009  * - 0b000 - Baud rate prescaler divisor is 1
16010  * - 0b001 - Baud rate prescaler divisor is 2
16011  * - 0b010 - Baud rate prescaler divisor is 3
16012  * - 0b011 - Baud rate prescaler divisor is 4
16013  * - 0b100 - Baud rate prescaler divisor is 5
16014  * - 0b101 - Baud rate prescaler divisor is 6
16015  * - 0b110 - Baud rate prescaler divisor is 7
16016  * - 0b111 - Baud rate prescaler divisor is 8
16017  */
16018 /*@{*/
16019 /*! @brief Read current value of the SPI_BR_SPPR field. */
16020 #define SPI_RD_BR_SPPR(base) ((SPI_BR_REG(base) & SPI_BR_SPPR_MASK) >> SPI_BR_SPPR_SHIFT)
16021 #define SPI_BRD_BR_SPPR(base) (BME_UBFX8(&SPI_BR_REG(base), SPI_BR_SPPR_SHIFT, SPI_BR_SPPR_WIDTH))
16022 
16023 /*! @brief Set the SPPR field to a new value. */
16024 #define SPI_WR_BR_SPPR(base, value) (SPI_RMW_BR(base, SPI_BR_SPPR_MASK, SPI_BR_SPPR(value)))
16025 #define SPI_BWR_BR_SPPR(base, value) (BME_BFI8(&SPI_BR_REG(base), ((uint8_t)(value) << SPI_BR_SPPR_SHIFT), SPI_BR_SPPR_SHIFT, SPI_BR_SPPR_WIDTH))
16026 /*@}*/
16027 
16028 /*******************************************************************************
16029  * SPI_S - SPI status register
16030  ******************************************************************************/
16031 
16032 /*!
16033  * @brief SPI_S - SPI status register (RW)
16034  *
16035  * Reset value: 0x20U
16036  *
16037  * This register contains read-only status bits. Writes have no meaning or
16038  * effect. Bits 3 through 0 are not implemented and always read 0.
16039  */
16040 /*!
16041  * @name Constants and macros for entire SPI_S register
16042  */
16043 /*@{*/
16044 #define SPI_RD_S(base) (SPI_S_REG(base))
16045 #define SPI_WR_S(base, value) (SPI_S_REG(base) = (value))
16046 #define SPI_RMW_S(base, mask, value) (SPI_WR_S(base, (SPI_RD_S(base) & ~(mask)) | (value)))
16047 #define SPI_SET_S(base, value) (BME_OR8(&SPI_S_REG(base), (uint8_t)(value)))
16048 #define SPI_CLR_S(base, value) (BME_AND8(&SPI_S_REG(base), (uint8_t)(~(value))))
16049 #define SPI_TOG_S(base, value) (BME_XOR8(&SPI_S_REG(base), (uint8_t)(value)))
16050 /*@}*/
16051 
16052 /*
16053  * Constants & macros for individual SPI_S bitfields
16054  */
16055 
16056 /*!
16057  * @name Register SPI_S, field MODF[4] (RO)
16058  *
16059  * MODF is set if the SPI is configured as a master and the slave select input
16060  * goes low, indicating some other SPI device is also configured as a master. The
16061  * SS pin acts as a mode fault error input only when MSTR is 1, MODFEN is 1, and
16062  * SSOE is 0; otherwise, MODF will never be set. MODF is cleared by reading MODF
16063  * while it is 1 and then writing to the SPI control register 1 (C1).
16064  *
16065  * Values:
16066  * - 0b0 - No mode fault error
16067  * - 0b1 - Mode fault error detected
16068  */
16069 /*@{*/
16070 /*! @brief Read current value of the SPI_S_MODF field. */
16071 #define SPI_RD_S_MODF(base) ((SPI_S_REG(base) & SPI_S_MODF_MASK) >> SPI_S_MODF_SHIFT)
16072 #define SPI_BRD_S_MODF(base) (BME_UBFX8(&SPI_S_REG(base), SPI_S_MODF_SHIFT, SPI_S_MODF_WIDTH))
16073 /*@}*/
16074 
16075 /*!
16076  * @name Register SPI_S, field SPTEF[5] (RO)
16077  *
16078  * This bit is set when the transmit data buffer is empty. When the transmit DMA
16079  * request is disabled (TXDMAE is 0), SPTEF is cleared by reading the S register
16080  * with SPTEF set and then writing a data value to the transmit buffer at D. The
16081  * S register must be read with SPTEF set to 1 before writing data to the D
16082  * register; otherwise, the D write is ignored. When the transmit DMA request is
16083  * enabled (TXDMAE is 1), SPTEF is automatically cleared when the DMA transfer for
16084  * the transmit DMA request is completed (TX DMA Done is asserted). SPTEF is
16085  * automatically set when all data from the transmit buffer transfers into the transmit
16086  * shift register. For an idle SPI, data written to D is transferred to the
16087  * shifter almost immediately so that SPTEF is set within two bus cycles, allowing a
16088  * second set of data to be queued into the transmit buffer. After completion of
16089  * the transfer of the data in the shift register, the queued data from the
16090  * transmit buffer automatically moves to the shifter, and SPTEF is set to indicate
16091  * that room exists for new data in the transmit buffer. If no new data is waiting
16092  * in the transmit buffer, SPTEF simply remains set and no data moves from the
16093  * buffer to the shifter. If a transfer does not stop, the last data that was
16094  * transmitted is sent out again.
16095  *
16096  * Values:
16097  * - 0b0 - SPI transmit buffer not empty
16098  * - 0b1 - SPI transmit buffer empty
16099  */
16100 /*@{*/
16101 /*! @brief Read current value of the SPI_S_SPTEF field. */
16102 #define SPI_RD_S_SPTEF(base) ((SPI_S_REG(base) & SPI_S_SPTEF_MASK) >> SPI_S_SPTEF_SHIFT)
16103 #define SPI_BRD_S_SPTEF(base) (BME_UBFX8(&SPI_S_REG(base), SPI_S_SPTEF_SHIFT, SPI_S_SPTEF_WIDTH))
16104 /*@}*/
16105 
16106 /*!
16107  * @name Register SPI_S, field SPMF[6] (W1C)
16108  *
16109  * SPMF is set after SPRF is 1 when the value in the receive data buffer matches
16110  * the value in the M register. To clear the flag, read SPMF when it is set and
16111  * then write a 1 to it.
16112  *
16113  * Values:
16114  * - 0b0 - Value in the receive data buffer does not match the value in the M
16115  * register
16116  * - 0b1 - Value in the receive data buffer matches the value in the M register
16117  */
16118 /*@{*/
16119 /*! @brief Read current value of the SPI_S_SPMF field. */
16120 #define SPI_RD_S_SPMF(base) ((SPI_S_REG(base) & SPI_S_SPMF_MASK) >> SPI_S_SPMF_SHIFT)
16121 #define SPI_BRD_S_SPMF(base) (BME_UBFX8(&SPI_S_REG(base), SPI_S_SPMF_SHIFT, SPI_S_SPMF_WIDTH))
16122 
16123 /*! @brief Set the SPMF field to a new value. */
16124 #define SPI_WR_S_SPMF(base, value) (SPI_RMW_S(base, SPI_S_SPMF_MASK, SPI_S_SPMF(value)))
16125 #define SPI_BWR_S_SPMF(base, value) (BME_BFI8(&SPI_S_REG(base), ((uint8_t)(value) << SPI_S_SPMF_SHIFT), SPI_S_SPMF_SHIFT, SPI_S_SPMF_WIDTH))
16126 /*@}*/
16127 
16128 /*!
16129  * @name Register SPI_S, field SPRF[7] (RO)
16130  *
16131  * SPRF is set at the completion of an SPI transfer to indicate that received
16132  * data may be read from the SPI data (D) register. When the receive DMA request is
16133  * disabled (RXDMAE is 0), SPRF is cleared by reading SPRF while it is set and
16134  * then reading the SPI data register. When the receive DMA request is enabled
16135  * (RXDMAE is 1), SPRF is automatically cleared when the DMA transfer for the
16136  * receive DMA request is completed (RX DMA Done is asserted).
16137  *
16138  * Values:
16139  * - 0b0 - No data available in the receive data buffer
16140  * - 0b1 - Data available in the receive data buffer
16141  */
16142 /*@{*/
16143 /*! @brief Read current value of the SPI_S_SPRF field. */
16144 #define SPI_RD_S_SPRF(base) ((SPI_S_REG(base) & SPI_S_SPRF_MASK) >> SPI_S_SPRF_SHIFT)
16145 #define SPI_BRD_S_SPRF(base) (BME_UBFX8(&SPI_S_REG(base), SPI_S_SPRF_SHIFT, SPI_S_SPRF_WIDTH))
16146 /*@}*/
16147 
16148 /*******************************************************************************
16149  * SPI_D - SPI data register
16150  ******************************************************************************/
16151 
16152 /*!
16153  * @brief SPI_D - SPI data register (RW)
16154  *
16155  * Reset value: 0x00U
16156  *
16157  * This register is both the input and output register for SPI data. A write to
16158  * the register writes to the transmit data buffer, allowing data to be queued
16159  * and transmitted. When the SPI is configured as a master, data queued in the
16160  * transmit data buffer is transmitted immediately after the previous transmission
16161  * has completed. The SPTEF bit in the S register indicates when the transmit data
16162  * buffer is ready to accept new data. When the transmit DMA request is disabled
16163  * (TXDMAE is 0): The S register must be read when SPTEF is set before writing to
16164  * the SPI data register; otherwise, the write is ignored. When the transmit DMA
16165  * request is enabled (TXDMAE is 1) when SPTEF is set, the SPI data register can
16166  * be written automatically by DMA without reading the S register first. Data
16167  * may be read from the SPI data register any time after SPRF is set and before
16168  * another transfer is finished. Failure to read the data out of the receive data
16169  * buffer before a new transfer ends causes a receive overrun condition, and the
16170  * data from the new transfer is lost. The new data is lost because the receive
16171  * buffer still held the previous character and was not ready to accept the new
16172  * data. There is no indication for a receive overrun condition, so the application
16173  * system designer must ensure that previous data has been read from the receive
16174  * buffer before a new transfer is initiated.
16175  */
16176 /*!
16177  * @name Constants and macros for entire SPI_D register
16178  */
16179 /*@{*/
16180 #define SPI_RD_D(base) (SPI_D_REG(base))
16181 #define SPI_WR_D(base, value) (SPI_D_REG(base) = (value))
16182 #define SPI_RMW_D(base, mask, value) (SPI_WR_D(base, (SPI_RD_D(base) & ~(mask)) | (value)))
16183 #define SPI_SET_D(base, value) (BME_OR8(&SPI_D_REG(base), (uint8_t)(value)))
16184 #define SPI_CLR_D(base, value) (BME_AND8(&SPI_D_REG(base), (uint8_t)(~(value))))
16185 #define SPI_TOG_D(base, value) (BME_XOR8(&SPI_D_REG(base), (uint8_t)(value)))
16186 /*@}*/
16187 
16188 /*******************************************************************************
16189  * SPI_M - SPI match register
16190  ******************************************************************************/
16191 
16192 /*!
16193  * @brief SPI_M - SPI match register (RW)
16194  *
16195  * Reset value: 0x00U
16196  *
16197  * This register contains the hardware compare value. When the value received in
16198  * the SPI receive data buffer equals this hardware compare value, the SPI match
16199  * flag (SPMF) sets.
16200  */
16201 /*!
16202  * @name Constants and macros for entire SPI_M register
16203  */
16204 /*@{*/
16205 #define SPI_RD_M(base) (SPI_M_REG(base))
16206 #define SPI_WR_M(base, value) (SPI_M_REG(base) = (value))
16207 #define SPI_RMW_M(base, mask, value) (SPI_WR_M(base, (SPI_RD_M(base) & ~(mask)) | (value)))
16208 #define SPI_SET_M(base, value) (BME_OR8(&SPI_M_REG(base), (uint8_t)(value)))
16209 #define SPI_CLR_M(base, value) (BME_AND8(&SPI_M_REG(base), (uint8_t)(~(value))))
16210 #define SPI_TOG_M(base, value) (BME_XOR8(&SPI_M_REG(base), (uint8_t)(value)))
16211 /*@}*/
16212 
16213 /*
16214  * MKL25Z4 TPM
16215  *
16216  * Timer/PWM Module
16217  *
16218  * Registers defined in this header file:
16219  * - TPM_SC - Status and Control
16220  * - TPM_CNT - Counter
16221  * - TPM_MOD - Modulo
16222  * - TPM_CnSC - Channel (n) Status and Control
16223  * - TPM_CnV - Channel (n) Value
16224  * - TPM_STATUS - Capture and Compare Status
16225  * - TPM_CONF - Configuration
16226  */
16227 
16228 #define TPM_INSTANCE_COUNT (3U) /*!< Number of instances of the TPM module. */
16229 #define TPM0_IDX (0U) /*!< Instance number for TPM0. */
16230 #define TPM1_IDX (1U) /*!< Instance number for TPM1. */
16231 #define TPM2_IDX (2U) /*!< Instance number for TPM2. */
16232 
16233 /*******************************************************************************
16234  * TPM_SC - Status and Control
16235  ******************************************************************************/
16236 
16237 /*!
16238  * @brief TPM_SC - Status and Control (RW)
16239  *
16240  * Reset value: 0x00000000U
16241  *
16242  * SC contains the overflow status flag and control bits used to configure the
16243  * interrupt enable, module configuration and prescaler factor. These controls
16244  * relate to all channels within this module.
16245  */
16246 /*!
16247  * @name Constants and macros for entire TPM_SC register
16248  */
16249 /*@{*/
16250 #define TPM_RD_SC(base) (TPM_SC_REG(base))
16251 #define TPM_WR_SC(base, value) (TPM_SC_REG(base) = (value))
16252 #define TPM_RMW_SC(base, mask, value) (TPM_WR_SC(base, (TPM_RD_SC(base) & ~(mask)) | (value)))
16253 #define TPM_SET_SC(base, value) (BME_OR32(&TPM_SC_REG(base), (uint32_t)(value)))
16254 #define TPM_CLR_SC(base, value) (BME_AND32(&TPM_SC_REG(base), (uint32_t)(~(value))))
16255 #define TPM_TOG_SC(base, value) (BME_XOR32(&TPM_SC_REG(base), (uint32_t)(value)))
16256 /*@}*/
16257 
16258 /*
16259  * Constants & macros for individual TPM_SC bitfields
16260  */
16261 
16262 /*!
16263  * @name Register TPM_SC, field PS[2:0] (RW)
16264  *
16265  * Selects one of 8 division factors for the clock mode selected by CMOD. This
16266  * field is write protected. It can be written only when the counter is disabled.
16267  *
16268  * Values:
16269  * - 0b000 - Divide by 1
16270  * - 0b001 - Divide by 2
16271  * - 0b010 - Divide by 4
16272  * - 0b011 - Divide by 8
16273  * - 0b100 - Divide by 16
16274  * - 0b101 - Divide by 32
16275  * - 0b110 - Divide by 64
16276  * - 0b111 - Divide by 128
16277  */
16278 /*@{*/
16279 /*! @brief Read current value of the TPM_SC_PS field. */
16280 #define TPM_RD_SC_PS(base) ((TPM_SC_REG(base) & TPM_SC_PS_MASK) >> TPM_SC_PS_SHIFT)
16281 #define TPM_BRD_SC_PS(base) (BME_UBFX32(&TPM_SC_REG(base), TPM_SC_PS_SHIFT, TPM_SC_PS_WIDTH))
16282 
16283 /*! @brief Set the PS field to a new value. */
16284 #define TPM_WR_SC_PS(base, value) (TPM_RMW_SC(base, (TPM_SC_PS_MASK | TPM_SC_TOF_MASK), TPM_SC_PS(value)))
16285 #define TPM_BWR_SC_PS(base, value) (BME_BFI32(&TPM_SC_REG(base), ((uint32_t)(value) << TPM_SC_PS_SHIFT), TPM_SC_PS_SHIFT, TPM_SC_PS_WIDTH))
16286 /*@}*/
16287 
16288 /*!
16289  * @name Register TPM_SC, field CMOD[4:3] (RW)
16290  *
16291  * Selects the LPTPM counter clock modes. When disabling the counter, this field
16292  * remain set until acknolwedged in the LPTPM clock domain.
16293  *
16294  * Values:
16295  * - 0b00 - LPTPM counter is disabled
16296  * - 0b01 - LPTPM counter increments on every LPTPM counter clock
16297  * - 0b10 - LPTPM counter increments on rising edge of LPTPM_EXTCLK synchronized
16298  * to the LPTPM counter clock
16299  * - 0b11 - Reserved
16300  */
16301 /*@{*/
16302 /*! @brief Read current value of the TPM_SC_CMOD field. */
16303 #define TPM_RD_SC_CMOD(base) ((TPM_SC_REG(base) & TPM_SC_CMOD_MASK) >> TPM_SC_CMOD_SHIFT)
16304 #define TPM_BRD_SC_CMOD(base) (BME_UBFX32(&TPM_SC_REG(base), TPM_SC_CMOD_SHIFT, TPM_SC_CMOD_WIDTH))
16305 
16306 /*! @brief Set the CMOD field to a new value. */
16307 #define TPM_WR_SC_CMOD(base, value) (TPM_RMW_SC(base, (TPM_SC_CMOD_MASK | TPM_SC_TOF_MASK), TPM_SC_CMOD(value)))
16308 #define TPM_BWR_SC_CMOD(base, value) (BME_BFI32(&TPM_SC_REG(base), ((uint32_t)(value) << TPM_SC_CMOD_SHIFT), TPM_SC_CMOD_SHIFT, TPM_SC_CMOD_WIDTH))
16309 /*@}*/
16310 
16311 /*!
16312  * @name Register TPM_SC, field CPWMS[5] (RW)
16313  *
16314  * Selects CPWM mode. This mode configures the LPTPM to operate in up-down
16315  * counting mode. This field is write protected. It can be written only when the
16316  * counter is disabled.
16317  *
16318  * Values:
16319  * - 0b0 - LPTPM counter operates in up counting mode.
16320  * - 0b1 - LPTPM counter operates in up-down counting mode.
16321  */
16322 /*@{*/
16323 /*! @brief Read current value of the TPM_SC_CPWMS field. */
16324 #define TPM_RD_SC_CPWMS(base) ((TPM_SC_REG(base) & TPM_SC_CPWMS_MASK) >> TPM_SC_CPWMS_SHIFT)
16325 #define TPM_BRD_SC_CPWMS(base) (BME_UBFX32(&TPM_SC_REG(base), TPM_SC_CPWMS_SHIFT, TPM_SC_CPWMS_WIDTH))
16326 
16327 /*! @brief Set the CPWMS field to a new value. */
16328 #define TPM_WR_SC_CPWMS(base, value) (TPM_RMW_SC(base, (TPM_SC_CPWMS_MASK | TPM_SC_TOF_MASK), TPM_SC_CPWMS(value)))
16329 #define TPM_BWR_SC_CPWMS(base, value) (BME_BFI32(&TPM_SC_REG(base), ((uint32_t)(value) << TPM_SC_CPWMS_SHIFT), TPM_SC_CPWMS_SHIFT, TPM_SC_CPWMS_WIDTH))
16330 /*@}*/
16331 
16332 /*!
16333  * @name Register TPM_SC, field TOIE[6] (RW)
16334  *
16335  * Enables LPTPM overflow interrupts.
16336  *
16337  * Values:
16338  * - 0b0 - Disable TOF interrupts. Use software polling or DMA request.
16339  * - 0b1 - Enable TOF interrupts. An interrupt is generated when TOF equals one.
16340  */
16341 /*@{*/
16342 /*! @brief Read current value of the TPM_SC_TOIE field. */
16343 #define TPM_RD_SC_TOIE(base) ((TPM_SC_REG(base) & TPM_SC_TOIE_MASK) >> TPM_SC_TOIE_SHIFT)
16344 #define TPM_BRD_SC_TOIE(base) (BME_UBFX32(&TPM_SC_REG(base), TPM_SC_TOIE_SHIFT, TPM_SC_TOIE_WIDTH))
16345 
16346 /*! @brief Set the TOIE field to a new value. */
16347 #define TPM_WR_SC_TOIE(base, value) (TPM_RMW_SC(base, (TPM_SC_TOIE_MASK | TPM_SC_TOF_MASK), TPM_SC_TOIE(value)))
16348 #define TPM_BWR_SC_TOIE(base, value) (BME_BFI32(&TPM_SC_REG(base), ((uint32_t)(value) << TPM_SC_TOIE_SHIFT), TPM_SC_TOIE_SHIFT, TPM_SC_TOIE_WIDTH))
16349 /*@}*/
16350 
16351 /*!
16352  * @name Register TPM_SC, field TOF[7] (W1C)
16353  *
16354  * Set by hardware when the LPTPM counter equals the value in the MOD register
16355  * and increments. The TOF bit is cleared by writing a 1 to TOF bit. Writing a 0
16356  * to TOF has no effect. If another LPTPM overflow occurs between the flag setting
16357  * and the flag clearing, the write operation has no effect; therefore, TOF
16358  * remains set indicating another overflow has occurred. In this case a TOF interrupt
16359  * request is not lost due to a delay in clearing the previous TOF.
16360  *
16361  * Values:
16362  * - 0b0 - LPTPM counter has not overflowed.
16363  * - 0b1 - LPTPM counter has overflowed.
16364  */
16365 /*@{*/
16366 /*! @brief Read current value of the TPM_SC_TOF field. */
16367 #define TPM_RD_SC_TOF(base) ((TPM_SC_REG(base) & TPM_SC_TOF_MASK) >> TPM_SC_TOF_SHIFT)
16368 #define TPM_BRD_SC_TOF(base) (BME_UBFX32(&TPM_SC_REG(base), TPM_SC_TOF_SHIFT, TPM_SC_TOF_WIDTH))
16369 
16370 /*! @brief Set the TOF field to a new value. */
16371 #define TPM_WR_SC_TOF(base, value) (TPM_RMW_SC(base, TPM_SC_TOF_MASK, TPM_SC_TOF(value)))
16372 #define TPM_BWR_SC_TOF(base, value) (BME_BFI32(&TPM_SC_REG(base), ((uint32_t)(value) << TPM_SC_TOF_SHIFT), TPM_SC_TOF_SHIFT, TPM_SC_TOF_WIDTH))
16373 /*@}*/
16374 
16375 /*!
16376  * @name Register TPM_SC, field DMA[8] (RW)
16377  *
16378  * Enables DMA transfers for the overflow flag.
16379  *
16380  * Values:
16381  * - 0b0 - Disables DMA transfers.
16382  * - 0b1 - Enables DMA transfers.
16383  */
16384 /*@{*/
16385 /*! @brief Read current value of the TPM_SC_DMA field. */
16386 #define TPM_RD_SC_DMA(base) ((TPM_SC_REG(base) & TPM_SC_DMA_MASK) >> TPM_SC_DMA_SHIFT)
16387 #define TPM_BRD_SC_DMA(base) (BME_UBFX32(&TPM_SC_REG(base), TPM_SC_DMA_SHIFT, TPM_SC_DMA_WIDTH))
16388 
16389 /*! @brief Set the DMA field to a new value. */
16390 #define TPM_WR_SC_DMA(base, value) (TPM_RMW_SC(base, (TPM_SC_DMA_MASK | TPM_SC_TOF_MASK), TPM_SC_DMA(value)))
16391 #define TPM_BWR_SC_DMA(base, value) (BME_BFI32(&TPM_SC_REG(base), ((uint32_t)(value) << TPM_SC_DMA_SHIFT), TPM_SC_DMA_SHIFT, TPM_SC_DMA_WIDTH))
16392 /*@}*/
16393 
16394 /*******************************************************************************
16395  * TPM_CNT - Counter
16396  ******************************************************************************/
16397 
16398 /*!
16399  * @brief TPM_CNT - Counter (RW)
16400  *
16401  * Reset value: 0x00000000U
16402  *
16403  * The CNT register contains the LPTPM counter value. Reset clears the CNT
16404  * register. Writing any value to COUNT also clears the counter. When debug is active,
16405  * the LPTPM counter does not increment unless configured otherwise. Reading the
16406  * CNT register adds two wait states to the register access due to
16407  * synchronization delays.
16408  */
16409 /*!
16410  * @name Constants and macros for entire TPM_CNT register
16411  */
16412 /*@{*/
16413 #define TPM_RD_CNT(base) (TPM_CNT_REG(base))
16414 #define TPM_WR_CNT(base, value) (TPM_CNT_REG(base) = (value))
16415 #define TPM_RMW_CNT(base, mask, value) (TPM_WR_CNT(base, (TPM_RD_CNT(base) & ~(mask)) | (value)))
16416 #define TPM_SET_CNT(base, value) (BME_OR32(&TPM_CNT_REG(base), (uint32_t)(value)))
16417 #define TPM_CLR_CNT(base, value) (BME_AND32(&TPM_CNT_REG(base), (uint32_t)(~(value))))
16418 #define TPM_TOG_CNT(base, value) (BME_XOR32(&TPM_CNT_REG(base), (uint32_t)(value)))
16419 /*@}*/
16420 
16421 /*
16422  * Constants & macros for individual TPM_CNT bitfields
16423  */
16424 
16425 /*!
16426  * @name Register TPM_CNT, field COUNT[15:0] (RW)
16427  */
16428 /*@{*/
16429 /*! @brief Read current value of the TPM_CNT_COUNT field. */
16430 #define TPM_RD_CNT_COUNT(base) ((TPM_CNT_REG(base) & TPM_CNT_COUNT_MASK) >> TPM_CNT_COUNT_SHIFT)
16431 #define TPM_BRD_CNT_COUNT(base) (BME_UBFX32(&TPM_CNT_REG(base), TPM_CNT_COUNT_SHIFT, TPM_CNT_COUNT_WIDTH))
16432 
16433 /*! @brief Set the COUNT field to a new value. */
16434 #define TPM_WR_CNT_COUNT(base, value) (TPM_RMW_CNT(base, TPM_CNT_COUNT_MASK, TPM_CNT_COUNT(value)))
16435 #define TPM_BWR_CNT_COUNT(base, value) (BME_BFI32(&TPM_CNT_REG(base), ((uint32_t)(value) << TPM_CNT_COUNT_SHIFT), TPM_CNT_COUNT_SHIFT, TPM_CNT_COUNT_WIDTH))
16436 /*@}*/
16437 
16438 /*******************************************************************************
16439  * TPM_MOD - Modulo
16440  ******************************************************************************/
16441 
16442 /*!
16443  * @brief TPM_MOD - Modulo (RW)
16444  *
16445  * Reset value: 0x0000FFFFU
16446  *
16447  * The Modulo register contains the modulo value for the LPTPM counter. When the
16448  * LPTPM counter reaches the modulo value and increments, the overflow flag
16449  * (TOF) is set and the next value of LPTPM counter depends on the selected counting
16450  * method (see Counter ). Writing to the MOD register latches the value into a
16451  * buffer. The MOD register is updated with the value of its write buffer according
16452  * to MOD Register Update . It is recommended to initialize the LPTPM counter
16453  * (write to CNT) before writing to the MOD register to avoid confusion about when
16454  * the first counter overflow will occur.
16455  */
16456 /*!
16457  * @name Constants and macros for entire TPM_MOD register
16458  */
16459 /*@{*/
16460 #define TPM_RD_MOD(base) (TPM_MOD_REG(base))
16461 #define TPM_WR_MOD(base, value) (TPM_MOD_REG(base) = (value))
16462 #define TPM_RMW_MOD(base, mask, value) (TPM_WR_MOD(base, (TPM_RD_MOD(base) & ~(mask)) | (value)))
16463 #define TPM_SET_MOD(base, value) (BME_OR32(&TPM_MOD_REG(base), (uint32_t)(value)))
16464 #define TPM_CLR_MOD(base, value) (BME_AND32(&TPM_MOD_REG(base), (uint32_t)(~(value))))
16465 #define TPM_TOG_MOD(base, value) (BME_XOR32(&TPM_MOD_REG(base), (uint32_t)(value)))
16466 /*@}*/
16467 
16468 /*
16469  * Constants & macros for individual TPM_MOD bitfields
16470  */
16471 
16472 /*!
16473  * @name Register TPM_MOD, field MOD[15:0] (RW)
16474  *
16475  * When writing this field, all bytes must be written at the same time.
16476  */
16477 /*@{*/
16478 /*! @brief Read current value of the TPM_MOD_MOD field. */
16479 #define TPM_RD_MOD_MOD(base) ((TPM_MOD_REG(base) & TPM_MOD_MOD_MASK) >> TPM_MOD_MOD_SHIFT)
16480 #define TPM_BRD_MOD_MOD(base) (BME_UBFX32(&TPM_MOD_REG(base), TPM_MOD_MOD_SHIFT, TPM_MOD_MOD_WIDTH))
16481 
16482 /*! @brief Set the MOD field to a new value. */
16483 #define TPM_WR_MOD_MOD(base, value) (TPM_RMW_MOD(base, TPM_MOD_MOD_MASK, TPM_MOD_MOD(value)))
16484 #define TPM_BWR_MOD_MOD(base, value) (BME_BFI32(&TPM_MOD_REG(base), ((uint32_t)(value) << TPM_MOD_MOD_SHIFT), TPM_MOD_MOD_SHIFT, TPM_MOD_MOD_WIDTH))
16485 /*@}*/
16486 
16487 /*******************************************************************************
16488  * TPM_CnSC - Channel (n) Status and Control
16489  ******************************************************************************/
16490 
16491 /*!
16492  * @brief TPM_CnSC - Channel (n) Status and Control (RW)
16493  *
16494  * Reset value: 0x00000000U
16495  *
16496  * CnSC contains the channel-interrupt-status flag and control bits used to
16497  * configure the interrupt enable, channel configuration, and pin function. When
16498  * switching from one channel mode to a different channel mode, the channel must
16499  * first be disabled and this must be acknowledged in the LPTPM counter clock domain.
16500  * Mode, Edge, and Level Selection CPWMS MSnB:MSnA ELSnB:ELSnA Mode
16501  * Configuration X 00 00 None Channel disabled X 01/10/11 00 Software compare Pin not used
16502  * for LPTPM 0 00 01 Input capture Capture on Rising Edge Only 10 Capture on
16503  * Falling Edge Only 11 Capture on Rising or Falling Edge 01 01 Output compare Toggle
16504  * Output on match 10 Clear Output on match 11 Set Output on match 10 10
16505  * Edge-aligned PWM High-true pulses (clear Output on match, set Output on reload) X1
16506  * Low-true pulses (set Output on match, clear Output on reload) 11 10 Output compare
16507  * Pulse Output low on match X1 Pulse Output high on match 1 10 10
16508  * Center-aligned PWM High-true pulses (clear Output on match-up, set Output on match-down) X1
16509  * Low-true pulses (set Output on match-up, clear Output on match-down)
16510  */
16511 /*!
16512  * @name Constants and macros for entire TPM_CnSC register
16513  */
16514 /*@{*/
16515 #define TPM_RD_CnSC(base, index) (TPM_CnSC_REG(base, index))
16516 #define TPM_WR_CnSC(base, index, value) (TPM_CnSC_REG(base, index) = (value))
16517 #define TPM_RMW_CnSC(base, index, mask, value) (TPM_WR_CnSC(base, index, (TPM_RD_CnSC(base, index) & ~(mask)) | (value)))
16518 #define TPM_SET_CnSC(base, index, value) (BME_OR32(&TPM_CnSC_REG(base, index), (uint32_t)(value)))
16519 #define TPM_CLR_CnSC(base, index, value) (BME_AND32(&TPM_CnSC_REG(base, index), (uint32_t)(~(value))))
16520 #define TPM_TOG_CnSC(base, index, value) (BME_XOR32(&TPM_CnSC_REG(base, index), (uint32_t)(value)))
16521 /*@}*/
16522 
16523 /*
16524  * Constants & macros for individual TPM_CnSC bitfields
16525  */
16526 
16527 /*!
16528  * @name Register TPM_CnSC, field DMA[0] (RW)
16529  *
16530  * Enables DMA transfers for the channel.
16531  *
16532  * Values:
16533  * - 0b0 - Disable DMA transfers.
16534  * - 0b1 - Enable DMA transfers.
16535  */
16536 /*@{*/
16537 /*! @brief Read current value of the TPM_CnSC_DMA field. */
16538 #define TPM_RD_CnSC_DMA(base, index) ((TPM_CnSC_REG(base, index) & TPM_CnSC_DMA_MASK) >> TPM_CnSC_DMA_SHIFT)
16539 #define TPM_BRD_CnSC_DMA(base, index) (BME_UBFX32(&TPM_CnSC_REG(base, index), TPM_CnSC_DMA_SHIFT, TPM_CnSC_DMA_WIDTH))
16540 
16541 /*! @brief Set the DMA field to a new value. */
16542 #define TPM_WR_CnSC_DMA(base, index, value) (TPM_RMW_CnSC(base, index, (TPM_CnSC_DMA_MASK | TPM_CnSC_CHF_MASK), TPM_CnSC_DMA(value)))
16543 #define TPM_BWR_CnSC_DMA(base, index, value) (BME_BFI32(&TPM_CnSC_REG(base, index), ((uint32_t)(value) << TPM_CnSC_DMA_SHIFT), TPM_CnSC_DMA_SHIFT, TPM_CnSC_DMA_WIDTH))
16544 /*@}*/
16545 
16546 /*!
16547  * @name Register TPM_CnSC, field ELSA[2] (RW)
16548  *
16549  * The functionality of ELSB and ELSA depends on the channel mode. When a
16550  * channel is disabled, this bit will not change state until acknowledged in the LPTPM
16551  * counter clock domain.
16552  */
16553 /*@{*/
16554 /*! @brief Read current value of the TPM_CnSC_ELSA field. */
16555 #define TPM_RD_CnSC_ELSA(base, index) ((TPM_CnSC_REG(base, index) & TPM_CnSC_ELSA_MASK) >> TPM_CnSC_ELSA_SHIFT)
16556 #define TPM_BRD_CnSC_ELSA(base, index) (BME_UBFX32(&TPM_CnSC_REG(base, index), TPM_CnSC_ELSA_SHIFT, TPM_CnSC_ELSA_WIDTH))
16557 
16558 /*! @brief Set the ELSA field to a new value. */
16559 #define TPM_WR_CnSC_ELSA(base, index, value) (TPM_RMW_CnSC(base, index, (TPM_CnSC_ELSA_MASK | TPM_CnSC_CHF_MASK), TPM_CnSC_ELSA(value)))
16560 #define TPM_BWR_CnSC_ELSA(base, index, value) (BME_BFI32(&TPM_CnSC_REG(base, index), ((uint32_t)(value) << TPM_CnSC_ELSA_SHIFT), TPM_CnSC_ELSA_SHIFT, TPM_CnSC_ELSA_WIDTH))
16561 /*@}*/
16562 
16563 /*!
16564  * @name Register TPM_CnSC, field ELSB[3] (RW)
16565  *
16566  * The functionality of ELSB and ELSA depends on the channel mode. When a
16567  * channel is disabled, this bit will not change state until acknowledged in the LPTPM
16568  * counter clock domain.
16569  */
16570 /*@{*/
16571 /*! @brief Read current value of the TPM_CnSC_ELSB field. */
16572 #define TPM_RD_CnSC_ELSB(base, index) ((TPM_CnSC_REG(base, index) & TPM_CnSC_ELSB_MASK) >> TPM_CnSC_ELSB_SHIFT)
16573 #define TPM_BRD_CnSC_ELSB(base, index) (BME_UBFX32(&TPM_CnSC_REG(base, index), TPM_CnSC_ELSB_SHIFT, TPM_CnSC_ELSB_WIDTH))
16574 
16575 /*! @brief Set the ELSB field to a new value. */
16576 #define TPM_WR_CnSC_ELSB(base, index, value) (TPM_RMW_CnSC(base, index, (TPM_CnSC_ELSB_MASK | TPM_CnSC_CHF_MASK), TPM_CnSC_ELSB(value)))
16577 #define TPM_BWR_CnSC_ELSB(base, index, value) (BME_BFI32(&TPM_CnSC_REG(base, index), ((uint32_t)(value) << TPM_CnSC_ELSB_SHIFT), TPM_CnSC_ELSB_SHIFT, TPM_CnSC_ELSB_WIDTH))
16578 /*@}*/
16579 
16580 /*!
16581  * @name Register TPM_CnSC, field MSA[4] (RW)
16582  *
16583  * Used for further selections in the channel logic. Its functionality is
16584  * dependent on the channel mode. When a channel is disabled, this bit will not change
16585  * state until acknowledged in the LPTPM counter clock domain.
16586  */
16587 /*@{*/
16588 /*! @brief Read current value of the TPM_CnSC_MSA field. */
16589 #define TPM_RD_CnSC_MSA(base, index) ((TPM_CnSC_REG(base, index) & TPM_CnSC_MSA_MASK) >> TPM_CnSC_MSA_SHIFT)
16590 #define TPM_BRD_CnSC_MSA(base, index) (BME_UBFX32(&TPM_CnSC_REG(base, index), TPM_CnSC_MSA_SHIFT, TPM_CnSC_MSA_WIDTH))
16591 
16592 /*! @brief Set the MSA field to a new value. */
16593 #define TPM_WR_CnSC_MSA(base, index, value) (TPM_RMW_CnSC(base, index, (TPM_CnSC_MSA_MASK | TPM_CnSC_CHF_MASK), TPM_CnSC_MSA(value)))
16594 #define TPM_BWR_CnSC_MSA(base, index, value) (BME_BFI32(&TPM_CnSC_REG(base, index), ((uint32_t)(value) << TPM_CnSC_MSA_SHIFT), TPM_CnSC_MSA_SHIFT, TPM_CnSC_MSA_WIDTH))
16595 /*@}*/
16596 
16597 /*!
16598  * @name Register TPM_CnSC, field MSB[5] (RW)
16599  *
16600  * Used for further selections in the channel logic. Its functionality is
16601  * dependent on the channel mode. When a channel is disabled, this bit will not change
16602  * state until acknowledged in the LPTPM counter clock domain.
16603  */
16604 /*@{*/
16605 /*! @brief Read current value of the TPM_CnSC_MSB field. */
16606 #define TPM_RD_CnSC_MSB(base, index) ((TPM_CnSC_REG(base, index) & TPM_CnSC_MSB_MASK) >> TPM_CnSC_MSB_SHIFT)
16607 #define TPM_BRD_CnSC_MSB(base, index) (BME_UBFX32(&TPM_CnSC_REG(base, index), TPM_CnSC_MSB_SHIFT, TPM_CnSC_MSB_WIDTH))
16608 
16609 /*! @brief Set the MSB field to a new value. */
16610 #define TPM_WR_CnSC_MSB(base, index, value) (TPM_RMW_CnSC(base, index, (TPM_CnSC_MSB_MASK | TPM_CnSC_CHF_MASK), TPM_CnSC_MSB(value)))
16611 #define TPM_BWR_CnSC_MSB(base, index, value) (BME_BFI32(&TPM_CnSC_REG(base, index), ((uint32_t)(value) << TPM_CnSC_MSB_SHIFT), TPM_CnSC_MSB_SHIFT, TPM_CnSC_MSB_WIDTH))
16612 /*@}*/
16613 
16614 /*!
16615  * @name Register TPM_CnSC, field CHIE[6] (RW)
16616  *
16617  * Enables channel interrupts.
16618  *
16619  * Values:
16620  * - 0b0 - Disable channel interrupts.
16621  * - 0b1 - Enable channel interrupts.
16622  */
16623 /*@{*/
16624 /*! @brief Read current value of the TPM_CnSC_CHIE field. */
16625 #define TPM_RD_CnSC_CHIE(base, index) ((TPM_CnSC_REG(base, index) & TPM_CnSC_CHIE_MASK) >> TPM_CnSC_CHIE_SHIFT)
16626 #define TPM_BRD_CnSC_CHIE(base, index) (BME_UBFX32(&TPM_CnSC_REG(base, index), TPM_CnSC_CHIE_SHIFT, TPM_CnSC_CHIE_WIDTH))
16627 
16628 /*! @brief Set the CHIE field to a new value. */
16629 #define TPM_WR_CnSC_CHIE(base, index, value) (TPM_RMW_CnSC(base, index, (TPM_CnSC_CHIE_MASK | TPM_CnSC_CHF_MASK), TPM_CnSC_CHIE(value)))
16630 #define TPM_BWR_CnSC_CHIE(base, index, value) (BME_BFI32(&TPM_CnSC_REG(base, index), ((uint32_t)(value) << TPM_CnSC_CHIE_SHIFT), TPM_CnSC_CHIE_SHIFT, TPM_CnSC_CHIE_WIDTH))
16631 /*@}*/
16632 
16633 /*!
16634  * @name Register TPM_CnSC, field CHF[7] (W1C)
16635  *
16636  * Set by hardware when an event occurs on the channel. CHF is cleared by
16637  * writing a 1 to the CHF bit. Writing a 0 to CHF has no effect. If another event
16638  * occurs between the CHF sets and the write operation, the write operation has no
16639  * effect; therefore, CHF remains set indicating another event has occurred. In this
16640  * case a CHF interrupt request is not lost due to the delay in clearing the
16641  * previous CHF.
16642  *
16643  * Values:
16644  * - 0b0 - No channel event has occurred.
16645  * - 0b1 - A channel event has occurred.
16646  */
16647 /*@{*/
16648 /*! @brief Read current value of the TPM_CnSC_CHF field. */
16649 #define TPM_RD_CnSC_CHF(base, index) ((TPM_CnSC_REG(base, index) & TPM_CnSC_CHF_MASK) >> TPM_CnSC_CHF_SHIFT)
16650 #define TPM_BRD_CnSC_CHF(base, index) (BME_UBFX32(&TPM_CnSC_REG(base, index), TPM_CnSC_CHF_SHIFT, TPM_CnSC_CHF_WIDTH))
16651 
16652 /*! @brief Set the CHF field to a new value. */
16653 #define TPM_WR_CnSC_CHF(base, index, value) (TPM_RMW_CnSC(base, index, TPM_CnSC_CHF_MASK, TPM_CnSC_CHF(value)))
16654 #define TPM_BWR_CnSC_CHF(base, index, value) (BME_BFI32(&TPM_CnSC_REG(base, index), ((uint32_t)(value) << TPM_CnSC_CHF_SHIFT), TPM_CnSC_CHF_SHIFT, TPM_CnSC_CHF_WIDTH))
16655 /*@}*/
16656 
16657 /*******************************************************************************
16658  * TPM_CnV - Channel (n) Value
16659  ******************************************************************************/
16660 
16661 /*!
16662  * @brief TPM_CnV - Channel (n) Value (RW)
16663  *
16664  * Reset value: 0x00000000U
16665  *
16666  * These registers contain the captured LPTPM counter value for the input modes
16667  * or the match value for the output modes. In input capture mode, any write to a
16668  * CnV register is ignored. In compare modes, writing to a CnV register latches
16669  * the value into a buffer. A CnV register is updated with the value of its write
16670  * buffer according to CnV Register Update .
16671  */
16672 /*!
16673  * @name Constants and macros for entire TPM_CnV register
16674  */
16675 /*@{*/
16676 #define TPM_RD_CnV(base, index) (TPM_CnV_REG(base, index))
16677 #define TPM_WR_CnV(base, index, value) (TPM_CnV_REG(base, index) = (value))
16678 #define TPM_RMW_CnV(base, index, mask, value) (TPM_WR_CnV(base, index, (TPM_RD_CnV(base, index) & ~(mask)) | (value)))
16679 #define TPM_SET_CnV(base, index, value) (BME_OR32(&TPM_CnV_REG(base, index), (uint32_t)(value)))
16680 #define TPM_CLR_CnV(base, index, value) (BME_AND32(&TPM_CnV_REG(base, index), (uint32_t)(~(value))))
16681 #define TPM_TOG_CnV(base, index, value) (BME_XOR32(&TPM_CnV_REG(base, index), (uint32_t)(value)))
16682 /*@}*/
16683 
16684 /*
16685  * Constants & macros for individual TPM_CnV bitfields
16686  */
16687 
16688 /*!
16689  * @name Register TPM_CnV, field VAL[15:0] (RW)
16690  *
16691  * Captured LPTPM counter value of the input modes or the match value for the
16692  * output modes. When writing this field, all bytes must be written at the same
16693  * time.
16694  */
16695 /*@{*/
16696 /*! @brief Read current value of the TPM_CnV_VAL field. */
16697 #define TPM_RD_CnV_VAL(base, index) ((TPM_CnV_REG(base, index) & TPM_CnV_VAL_MASK) >> TPM_CnV_VAL_SHIFT)
16698 #define TPM_BRD_CnV_VAL(base, index) (BME_UBFX32(&TPM_CnV_REG(base, index), TPM_CnV_VAL_SHIFT, TPM_CnV_VAL_WIDTH))
16699 
16700 /*! @brief Set the VAL field to a new value. */
16701 #define TPM_WR_CnV_VAL(base, index, value) (TPM_RMW_CnV(base, index, TPM_CnV_VAL_MASK, TPM_CnV_VAL(value)))
16702 #define TPM_BWR_CnV_VAL(base, index, value) (BME_BFI32(&TPM_CnV_REG(base, index), ((uint32_t)(value) << TPM_CnV_VAL_SHIFT), TPM_CnV_VAL_SHIFT, TPM_CnV_VAL_WIDTH))
16703 /*@}*/
16704 
16705 /*******************************************************************************
16706  * TPM_STATUS - Capture and Compare Status
16707  ******************************************************************************/
16708 
16709 /*!
16710  * @brief TPM_STATUS - Capture and Compare Status (RW)
16711  *
16712  * Reset value: 0x00000000U
16713  *
16714  * The STATUS register contains a copy of the status flag CHnF bit (in CnSC) for
16715  * each LPTPM channel, as well as the TOF bit (in SC), for software convenience.
16716  * Each CHnF bit in STATUS is a mirror of CHnF bit in CnSC. All CHnF bits can be
16717  * checked using only one read of STATUS. All CHnF bits can be cleared by
16718  * writing all ones to STATUS. Hardware sets the individual channel flags when an event
16719  * occurs on the channel. CHF is cleared by writing a 1 to the CHF bit. Writing
16720  * a 0 to CHF has no effect. If another event occurs between the flag setting and
16721  * the write operation, the write operation has no effect; therefore, CHF
16722  * remains set indicating another event has occurred. In this case a CHF interrupt
16723  * request is not lost due to the clearing sequence for a previous CHF.
16724  */
16725 /*!
16726  * @name Constants and macros for entire TPM_STATUS register
16727  */
16728 /*@{*/
16729 #define TPM_RD_STATUS(base) (TPM_STATUS_REG(base))
16730 #define TPM_WR_STATUS(base, value) (TPM_STATUS_REG(base) = (value))
16731 #define TPM_RMW_STATUS(base, mask, value) (TPM_WR_STATUS(base, (TPM_RD_STATUS(base) & ~(mask)) | (value)))
16732 #define TPM_SET_STATUS(base, value) (BME_OR32(&TPM_STATUS_REG(base), (uint32_t)(value)))
16733 #define TPM_CLR_STATUS(base, value) (BME_AND32(&TPM_STATUS_REG(base), (uint32_t)(~(value))))
16734 #define TPM_TOG_STATUS(base, value) (BME_XOR32(&TPM_STATUS_REG(base), (uint32_t)(value)))
16735 /*@}*/
16736 
16737 /*
16738  * Constants & macros for individual TPM_STATUS bitfields
16739  */
16740 
16741 /*!
16742  * @name Register TPM_STATUS, field CH0F[0] (W1C)
16743  *
16744  * See the register description.
16745  *
16746  * Values:
16747  * - 0b0 - No channel event has occurred.
16748  * - 0b1 - A channel event has occurred.
16749  */
16750 /*@{*/
16751 /*! @brief Read current value of the TPM_STATUS_CH0F field. */
16752 #define TPM_RD_STATUS_CH0F(base) ((TPM_STATUS_REG(base) & TPM_STATUS_CH0F_MASK) >> TPM_STATUS_CH0F_SHIFT)
16753 #define TPM_BRD_STATUS_CH0F(base) (BME_UBFX32(&TPM_STATUS_REG(base), TPM_STATUS_CH0F_SHIFT, TPM_STATUS_CH0F_WIDTH))
16754 
16755 /*! @brief Set the CH0F field to a new value. */
16756 #define TPM_WR_STATUS_CH0F(base, value) (TPM_RMW_STATUS(base, (TPM_STATUS_CH0F_MASK | TPM_STATUS_CH1F_MASK | TPM_STATUS_CH2F_MASK | TPM_STATUS_CH3F_MASK | TPM_STATUS_CH4F_MASK | TPM_STATUS_CH5F_MASK | TPM_STATUS_TOF_MASK), TPM_STATUS_CH0F(value)))
16757 #define TPM_BWR_STATUS_CH0F(base, value) (BME_BFI32(&TPM_STATUS_REG(base), ((uint32_t)(value) << TPM_STATUS_CH0F_SHIFT), TPM_STATUS_CH0F_SHIFT, TPM_STATUS_CH0F_WIDTH))
16758 /*@}*/
16759 
16760 /*!
16761  * @name Register TPM_STATUS, field CH1F[1] (W1C)
16762  *
16763  * See the register description.
16764  *
16765  * Values:
16766  * - 0b0 - No channel event has occurred.
16767  * - 0b1 - A channel event has occurred.
16768  */
16769 /*@{*/
16770 /*! @brief Read current value of the TPM_STATUS_CH1F field. */
16771 #define TPM_RD_STATUS_CH1F(base) ((TPM_STATUS_REG(base) & TPM_STATUS_CH1F_MASK) >> TPM_STATUS_CH1F_SHIFT)
16772 #define TPM_BRD_STATUS_CH1F(base) (BME_UBFX32(&TPM_STATUS_REG(base), TPM_STATUS_CH1F_SHIFT, TPM_STATUS_CH1F_WIDTH))
16773 
16774 /*! @brief Set the CH1F field to a new value. */
16775 #define TPM_WR_STATUS_CH1F(base, value) (TPM_RMW_STATUS(base, (TPM_STATUS_CH1F_MASK | TPM_STATUS_CH0F_MASK | TPM_STATUS_CH2F_MASK | TPM_STATUS_CH3F_MASK | TPM_STATUS_CH4F_MASK | TPM_STATUS_CH5F_MASK | TPM_STATUS_TOF_MASK), TPM_STATUS_CH1F(value)))
16776 #define TPM_BWR_STATUS_CH1F(base, value) (BME_BFI32(&TPM_STATUS_REG(base), ((uint32_t)(value) << TPM_STATUS_CH1F_SHIFT), TPM_STATUS_CH1F_SHIFT, TPM_STATUS_CH1F_WIDTH))
16777 /*@}*/
16778 
16779 /*!
16780  * @name Register TPM_STATUS, field CH2F[2] (W1C)
16781  *
16782  * See the register description.
16783  *
16784  * Values:
16785  * - 0b0 - No channel event has occurred.
16786  * - 0b1 - A channel event has occurred.
16787  */
16788 /*@{*/
16789 /*! @brief Read current value of the TPM_STATUS_CH2F field. */
16790 #define TPM_RD_STATUS_CH2F(base) ((TPM_STATUS_REG(base) & TPM_STATUS_CH2F_MASK) >> TPM_STATUS_CH2F_SHIFT)
16791 #define TPM_BRD_STATUS_CH2F(base) (BME_UBFX32(&TPM_STATUS_REG(base), TPM_STATUS_CH2F_SHIFT, TPM_STATUS_CH2F_WIDTH))
16792 
16793 /*! @brief Set the CH2F field to a new value. */
16794 #define TPM_WR_STATUS_CH2F(base, value) (TPM_RMW_STATUS(base, (TPM_STATUS_CH2F_MASK | TPM_STATUS_CH0F_MASK | TPM_STATUS_CH1F_MASK | TPM_STATUS_CH3F_MASK | TPM_STATUS_CH4F_MASK | TPM_STATUS_CH5F_MASK | TPM_STATUS_TOF_MASK), TPM_STATUS_CH2F(value)))
16795 #define TPM_BWR_STATUS_CH2F(base, value) (BME_BFI32(&TPM_STATUS_REG(base), ((uint32_t)(value) << TPM_STATUS_CH2F_SHIFT), TPM_STATUS_CH2F_SHIFT, TPM_STATUS_CH2F_WIDTH))
16796 /*@}*/
16797 
16798 /*!
16799  * @name Register TPM_STATUS, field CH3F[3] (W1C)
16800  *
16801  * See the register description.
16802  *
16803  * Values:
16804  * - 0b0 - No channel event has occurred.
16805  * - 0b1 - A channel event has occurred.
16806  */
16807 /*@{*/
16808 /*! @brief Read current value of the TPM_STATUS_CH3F field. */
16809 #define TPM_RD_STATUS_CH3F(base) ((TPM_STATUS_REG(base) & TPM_STATUS_CH3F_MASK) >> TPM_STATUS_CH3F_SHIFT)
16810 #define TPM_BRD_STATUS_CH3F(base) (BME_UBFX32(&TPM_STATUS_REG(base), TPM_STATUS_CH3F_SHIFT, TPM_STATUS_CH3F_WIDTH))
16811 
16812 /*! @brief Set the CH3F field to a new value. */
16813 #define TPM_WR_STATUS_CH3F(base, value) (TPM_RMW_STATUS(base, (TPM_STATUS_CH3F_MASK | TPM_STATUS_CH0F_MASK | TPM_STATUS_CH1F_MASK | TPM_STATUS_CH2F_MASK | TPM_STATUS_CH4F_MASK | TPM_STATUS_CH5F_MASK | TPM_STATUS_TOF_MASK), TPM_STATUS_CH3F(value)))
16814 #define TPM_BWR_STATUS_CH3F(base, value) (BME_BFI32(&TPM_STATUS_REG(base), ((uint32_t)(value) << TPM_STATUS_CH3F_SHIFT), TPM_STATUS_CH3F_SHIFT, TPM_STATUS_CH3F_WIDTH))
16815 /*@}*/
16816 
16817 /*!
16818  * @name Register TPM_STATUS, field CH4F[4] (W1C)
16819  *
16820  * See the register description.
16821  *
16822  * Values:
16823  * - 0b0 - No channel event has occurred.
16824  * - 0b1 - A channel event has occurred.
16825  */
16826 /*@{*/
16827 /*! @brief Read current value of the TPM_STATUS_CH4F field. */
16828 #define TPM_RD_STATUS_CH4F(base) ((TPM_STATUS_REG(base) & TPM_STATUS_CH4F_MASK) >> TPM_STATUS_CH4F_SHIFT)
16829 #define TPM_BRD_STATUS_CH4F(base) (BME_UBFX32(&TPM_STATUS_REG(base), TPM_STATUS_CH4F_SHIFT, TPM_STATUS_CH4F_WIDTH))
16830 
16831 /*! @brief Set the CH4F field to a new value. */
16832 #define TPM_WR_STATUS_CH4F(base, value) (TPM_RMW_STATUS(base, (TPM_STATUS_CH4F_MASK | TPM_STATUS_CH0F_MASK | TPM_STATUS_CH1F_MASK | TPM_STATUS_CH2F_MASK | TPM_STATUS_CH3F_MASK | TPM_STATUS_CH5F_MASK | TPM_STATUS_TOF_MASK), TPM_STATUS_CH4F(value)))
16833 #define TPM_BWR_STATUS_CH4F(base, value) (BME_BFI32(&TPM_STATUS_REG(base), ((uint32_t)(value) << TPM_STATUS_CH4F_SHIFT), TPM_STATUS_CH4F_SHIFT, TPM_STATUS_CH4F_WIDTH))
16834 /*@}*/
16835 
16836 /*!
16837  * @name Register TPM_STATUS, field CH5F[5] (W1C)
16838  *
16839  * See the register description.
16840  *
16841  * Values:
16842  * - 0b0 - No channel event has occurred.
16843  * - 0b1 - A channel event has occurred.
16844  */
16845 /*@{*/
16846 /*! @brief Read current value of the TPM_STATUS_CH5F field. */
16847 #define TPM_RD_STATUS_CH5F(base) ((TPM_STATUS_REG(base) & TPM_STATUS_CH5F_MASK) >> TPM_STATUS_CH5F_SHIFT)
16848 #define TPM_BRD_STATUS_CH5F(base) (BME_UBFX32(&TPM_STATUS_REG(base), TPM_STATUS_CH5F_SHIFT, TPM_STATUS_CH5F_WIDTH))
16849 
16850 /*! @brief Set the CH5F field to a new value. */
16851 #define TPM_WR_STATUS_CH5F(base, value) (TPM_RMW_STATUS(base, (TPM_STATUS_CH5F_MASK | TPM_STATUS_CH0F_MASK | TPM_STATUS_CH1F_MASK | TPM_STATUS_CH2F_MASK | TPM_STATUS_CH3F_MASK | TPM_STATUS_CH4F_MASK | TPM_STATUS_TOF_MASK), TPM_STATUS_CH5F(value)))
16852 #define TPM_BWR_STATUS_CH5F(base, value) (BME_BFI32(&TPM_STATUS_REG(base), ((uint32_t)(value) << TPM_STATUS_CH5F_SHIFT), TPM_STATUS_CH5F_SHIFT, TPM_STATUS_CH5F_WIDTH))
16853 /*@}*/
16854 
16855 /*!
16856  * @name Register TPM_STATUS, field TOF[8] (W1C)
16857  *
16858  * See register description
16859  *
16860  * Values:
16861  * - 0b0 - LPTPM counter has not overflowed.
16862  * - 0b1 - LPTPM counter has overflowed.
16863  */
16864 /*@{*/
16865 /*! @brief Read current value of the TPM_STATUS_TOF field. */
16866 #define TPM_RD_STATUS_TOF(base) ((TPM_STATUS_REG(base) & TPM_STATUS_TOF_MASK) >> TPM_STATUS_TOF_SHIFT)
16867 #define TPM_BRD_STATUS_TOF(base) (BME_UBFX32(&TPM_STATUS_REG(base), TPM_STATUS_TOF_SHIFT, TPM_STATUS_TOF_WIDTH))
16868 
16869 /*! @brief Set the TOF field to a new value. */
16870 #define TPM_WR_STATUS_TOF(base, value) (TPM_RMW_STATUS(base, (TPM_STATUS_TOF_MASK | TPM_STATUS_CH0F_MASK | TPM_STATUS_CH1F_MASK | TPM_STATUS_CH2F_MASK | TPM_STATUS_CH3F_MASK | TPM_STATUS_CH4F_MASK | TPM_STATUS_CH5F_MASK), TPM_STATUS_TOF(value)))
16871 #define TPM_BWR_STATUS_TOF(base, value) (BME_BFI32(&TPM_STATUS_REG(base), ((uint32_t)(value) << TPM_STATUS_TOF_SHIFT), TPM_STATUS_TOF_SHIFT, TPM_STATUS_TOF_WIDTH))
16872 /*@}*/
16873 
16874 /*******************************************************************************
16875  * TPM_CONF - Configuration
16876  ******************************************************************************/
16877 
16878 /*!
16879  * @brief TPM_CONF - Configuration (RW)
16880  *
16881  * Reset value: 0x00000000U
16882  *
16883  * This register selects the behavior in debug and wait modes and the use of an
16884  * external global time base.
16885  */
16886 /*!
16887  * @name Constants and macros for entire TPM_CONF register
16888  */
16889 /*@{*/
16890 #define TPM_RD_CONF(base) (TPM_CONF_REG(base))
16891 #define TPM_WR_CONF(base, value) (TPM_CONF_REG(base) = (value))
16892 #define TPM_RMW_CONF(base, mask, value) (TPM_WR_CONF(base, (TPM_RD_CONF(base) & ~(mask)) | (value)))
16893 #define TPM_SET_CONF(base, value) (BME_OR32(&TPM_CONF_REG(base), (uint32_t)(value)))
16894 #define TPM_CLR_CONF(base, value) (BME_AND32(&TPM_CONF_REG(base), (uint32_t)(~(value))))
16895 #define TPM_TOG_CONF(base, value) (BME_XOR32(&TPM_CONF_REG(base), (uint32_t)(value)))
16896 /*@}*/
16897 
16898 /*
16899  * Constants & macros for individual TPM_CONF bitfields
16900  */
16901 
16902 /*!
16903  * @name Register TPM_CONF, field DOZEEN[5] (RW)
16904  *
16905  * Configures the LPTPM behavior in wait mode.
16906  *
16907  * Values:
16908  * - 0b0 - Internal LPTPM counter continues in Doze mode.
16909  * - 0b1 - Internal LPTPM counter is paused and does not increment during Doze
16910  * mode. Trigger inputs and input capture events are also ignored.
16911  */
16912 /*@{*/
16913 /*! @brief Read current value of the TPM_CONF_DOZEEN field. */
16914 #define TPM_RD_CONF_DOZEEN(base) ((TPM_CONF_REG(base) & TPM_CONF_DOZEEN_MASK) >> TPM_CONF_DOZEEN_SHIFT)
16915 #define TPM_BRD_CONF_DOZEEN(base) (BME_UBFX32(&TPM_CONF_REG(base), TPM_CONF_DOZEEN_SHIFT, TPM_CONF_DOZEEN_WIDTH))
16916 
16917 /*! @brief Set the DOZEEN field to a new value. */
16918 #define TPM_WR_CONF_DOZEEN(base, value) (TPM_RMW_CONF(base, TPM_CONF_DOZEEN_MASK, TPM_CONF_DOZEEN(value)))
16919 #define TPM_BWR_CONF_DOZEEN(base, value) (BME_BFI32(&TPM_CONF_REG(base), ((uint32_t)(value) << TPM_CONF_DOZEEN_SHIFT), TPM_CONF_DOZEEN_SHIFT, TPM_CONF_DOZEEN_WIDTH))
16920 /*@}*/
16921 
16922 /*!
16923  * @name Register TPM_CONF, field DBGMODE[7:6] (RW)
16924  *
16925  * Configures the LPTPM behavior in debug mode. All other configurations are
16926  * reserved.
16927  *
16928  * Values:
16929  * - 0b00 - LPTPM counter is paused and does not increment during debug mode.
16930  * Trigger inputs and input capture events are also ignored.
16931  * - 0b11 - LPTPM counter continues in debug mode.
16932  */
16933 /*@{*/
16934 /*! @brief Read current value of the TPM_CONF_DBGMODE field. */
16935 #define TPM_RD_CONF_DBGMODE(base) ((TPM_CONF_REG(base) & TPM_CONF_DBGMODE_MASK) >> TPM_CONF_DBGMODE_SHIFT)
16936 #define TPM_BRD_CONF_DBGMODE(base) (BME_UBFX32(&TPM_CONF_REG(base), TPM_CONF_DBGMODE_SHIFT, TPM_CONF_DBGMODE_WIDTH))
16937 
16938 /*! @brief Set the DBGMODE field to a new value. */
16939 #define TPM_WR_CONF_DBGMODE(base, value) (TPM_RMW_CONF(base, TPM_CONF_DBGMODE_MASK, TPM_CONF_DBGMODE(value)))
16940 #define TPM_BWR_CONF_DBGMODE(base, value) (BME_BFI32(&TPM_CONF_REG(base), ((uint32_t)(value) << TPM_CONF_DBGMODE_SHIFT), TPM_CONF_DBGMODE_SHIFT, TPM_CONF_DBGMODE_WIDTH))
16941 /*@}*/
16942 
16943 /*!
16944  * @name Register TPM_CONF, field GTBEEN[9] (RW)
16945  *
16946  * Configures the LPTPM to use an externally generated global time base counter.
16947  * When an externally generated timebase is used, the internal LPTPM counter is
16948  * not used by the channels but can be used to generate a periodic interrupt or
16949  * DMA request using the Modulo register and timer overflow flag.
16950  *
16951  * Values:
16952  * - 0b0 - All channels use the internally generated LPTPM counter as their
16953  * timebase
16954  * - 0b1 - All channels use an externally generated global timebase as their
16955  * timebase
16956  */
16957 /*@{*/
16958 /*! @brief Read current value of the TPM_CONF_GTBEEN field. */
16959 #define TPM_RD_CONF_GTBEEN(base) ((TPM_CONF_REG(base) & TPM_CONF_GTBEEN_MASK) >> TPM_CONF_GTBEEN_SHIFT)
16960 #define TPM_BRD_CONF_GTBEEN(base) (BME_UBFX32(&TPM_CONF_REG(base), TPM_CONF_GTBEEN_SHIFT, TPM_CONF_GTBEEN_WIDTH))
16961 
16962 /*! @brief Set the GTBEEN field to a new value. */
16963 #define TPM_WR_CONF_GTBEEN(base, value) (TPM_RMW_CONF(base, TPM_CONF_GTBEEN_MASK, TPM_CONF_GTBEEN(value)))
16964 #define TPM_BWR_CONF_GTBEEN(base, value) (BME_BFI32(&TPM_CONF_REG(base), ((uint32_t)(value) << TPM_CONF_GTBEEN_SHIFT), TPM_CONF_GTBEEN_SHIFT, TPM_CONF_GTBEEN_WIDTH))
16965 /*@}*/
16966 
16967 /*!
16968  * @name Register TPM_CONF, field CSOT[16] (RW)
16969  *
16970  * When set, the LPTPM counter will not start incrementing after it is enabled
16971  * until a rising edge on the selected trigger input is detected. If the LPTPM
16972  * counter is stopped due to an overflow, a rising edge on the selected trigger
16973  * input will also cause the LPTPM counter to start incrementing again. The trigger
16974  * input is ignored if the LPTPM counter is paused during debug mode or doze mode.
16975  * This field should only be changed when the LPTPM counter is disabled.
16976  *
16977  * Values:
16978  * - 0b0 - LPTPM counter starts to increment immediately, once it is enabled.
16979  * - 0b1 - LPTPM counter only starts to increment when it a rising edge on the
16980  * selected input trigger is detected, after it has been enabled or after it
16981  * has stopped due to overflow.
16982  */
16983 /*@{*/
16984 /*! @brief Read current value of the TPM_CONF_CSOT field. */
16985 #define TPM_RD_CONF_CSOT(base) ((TPM_CONF_REG(base) & TPM_CONF_CSOT_MASK) >> TPM_CONF_CSOT_SHIFT)
16986 #define TPM_BRD_CONF_CSOT(base) (BME_UBFX32(&TPM_CONF_REG(base), TPM_CONF_CSOT_SHIFT, TPM_CONF_CSOT_WIDTH))
16987 
16988 /*! @brief Set the CSOT field to a new value. */
16989 #define TPM_WR_CONF_CSOT(base, value) (TPM_RMW_CONF(base, TPM_CONF_CSOT_MASK, TPM_CONF_CSOT(value)))
16990 #define TPM_BWR_CONF_CSOT(base, value) (BME_BFI32(&TPM_CONF_REG(base), ((uint32_t)(value) << TPM_CONF_CSOT_SHIFT), TPM_CONF_CSOT_SHIFT, TPM_CONF_CSOT_WIDTH))
16991 /*@}*/
16992 
16993 /*!
16994  * @name Register TPM_CONF, field CSOO[17] (RW)
16995  *
16996  * When set, the LPTPM counter will stop incrementing once the counter equals
16997  * the MOD value and incremented (this also sets the TOF). Reloading the counter
16998  * with zero due to writing to the counter register or due to a trigger input does
16999  * not cause the counter to stop incrementing. Once the counter has stopped
17000  * incrementing, the counter will not start incrementing unless it is disabled and
17001  * then enabled again, or a rising edge on the selected trigger input is detected
17002  * when CSOT set. This field should only be changed when the LPTPM counter is
17003  * disabled.
17004  *
17005  * Values:
17006  * - 0b0 - LPTPM counter continues incrementing or decrementing after overflow
17007  * - 0b1 - LPTPM counter stops incrementing or decrementing after overflow.
17008  */
17009 /*@{*/
17010 /*! @brief Read current value of the TPM_CONF_CSOO field. */
17011 #define TPM_RD_CONF_CSOO(base) ((TPM_CONF_REG(base) & TPM_CONF_CSOO_MASK) >> TPM_CONF_CSOO_SHIFT)
17012 #define TPM_BRD_CONF_CSOO(base) (BME_UBFX32(&TPM_CONF_REG(base), TPM_CONF_CSOO_SHIFT, TPM_CONF_CSOO_WIDTH))
17013 
17014 /*! @brief Set the CSOO field to a new value. */
17015 #define TPM_WR_CONF_CSOO(base, value) (TPM_RMW_CONF(base, TPM_CONF_CSOO_MASK, TPM_CONF_CSOO(value)))
17016 #define TPM_BWR_CONF_CSOO(base, value) (BME_BFI32(&TPM_CONF_REG(base), ((uint32_t)(value) << TPM_CONF_CSOO_SHIFT), TPM_CONF_CSOO_SHIFT, TPM_CONF_CSOO_WIDTH))
17017 /*@}*/
17018 
17019 /*!
17020  * @name Register TPM_CONF, field CROT[18] (RW)
17021  *
17022  * When set, the LPTPM counter will reload with zero (and initialize PWM outputs
17023  * to their default value) when a rising edge is detected on the selected
17024  * trigger input. The trigger input is ignored if the LPTPM counter is paused during
17025  * debug mode or doze mode. This field should only be changed when the LPTPM
17026  * counter is disabled.
17027  *
17028  * Values:
17029  * - 0b0 - Counter is not reloaded due to a rising edge on the selected input
17030  * trigger
17031  * - 0b1 - Counter is reloaded when a rising edge is detected on the selected
17032  * input trigger
17033  */
17034 /*@{*/
17035 /*! @brief Read current value of the TPM_CONF_CROT field. */
17036 #define TPM_RD_CONF_CROT(base) ((TPM_CONF_REG(base) & TPM_CONF_CROT_MASK) >> TPM_CONF_CROT_SHIFT)
17037 #define TPM_BRD_CONF_CROT(base) (BME_UBFX32(&TPM_CONF_REG(base), TPM_CONF_CROT_SHIFT, TPM_CONF_CROT_WIDTH))
17038 
17039 /*! @brief Set the CROT field to a new value. */
17040 #define TPM_WR_CONF_CROT(base, value) (TPM_RMW_CONF(base, TPM_CONF_CROT_MASK, TPM_CONF_CROT(value)))
17041 #define TPM_BWR_CONF_CROT(base, value) (BME_BFI32(&TPM_CONF_REG(base), ((uint32_t)(value) << TPM_CONF_CROT_SHIFT), TPM_CONF_CROT_SHIFT, TPM_CONF_CROT_WIDTH))
17042 /*@}*/
17043 
17044 /*!
17045  * @name Register TPM_CONF, field TRGSEL[27:24] (RW)
17046  *
17047  * Selects the input trigger to use for starting the counter and/or reloading
17048  * the counter. This field should only be changed when the LPTPM counter is
17049  * disabled. See Chip configuration section for available options.
17050  */
17051 /*@{*/
17052 /*! @brief Read current value of the TPM_CONF_TRGSEL field. */
17053 #define TPM_RD_CONF_TRGSEL(base) ((TPM_CONF_REG(base) & TPM_CONF_TRGSEL_MASK) >> TPM_CONF_TRGSEL_SHIFT)
17054 #define TPM_BRD_CONF_TRGSEL(base) (BME_UBFX32(&TPM_CONF_REG(base), TPM_CONF_TRGSEL_SHIFT, TPM_CONF_TRGSEL_WIDTH))
17055 
17056 /*! @brief Set the TRGSEL field to a new value. */
17057 #define TPM_WR_CONF_TRGSEL(base, value) (TPM_RMW_CONF(base, TPM_CONF_TRGSEL_MASK, TPM_CONF_TRGSEL(value)))
17058 #define TPM_BWR_CONF_TRGSEL(base, value) (BME_BFI32(&TPM_CONF_REG(base), ((uint32_t)(value) << TPM_CONF_TRGSEL_SHIFT), TPM_CONF_TRGSEL_SHIFT, TPM_CONF_TRGSEL_WIDTH))
17059 /*@}*/
17060 
17061 /*
17062  * MKL25Z4 TSI
17063  *
17064  * Touch sense input
17065  *
17066  * Registers defined in this header file:
17067  * - TSI_GENCS - TSI General Control and Status Register
17068  * - TSI_DATA - TSI DATA Register
17069  * - TSI_TSHD - TSI Threshold Register
17070  */
17071 
17072 #define TSI_INSTANCE_COUNT (1U) /*!< Number of instances of the TSI module. */
17073 #define TSI0_IDX (0U) /*!< Instance number for TSI0. */
17074 
17075 /*******************************************************************************
17076  * TSI_GENCS - TSI General Control and Status Register
17077  ******************************************************************************/
17078 
17079 /*!
17080  * @brief TSI_GENCS - TSI General Control and Status Register (RW)
17081  *
17082  * Reset value: 0x00000000U
17083  *
17084  * This control register provides various control and configuration information
17085  * for the TSI module. When TSI is working, the configuration bits (GENCS[TSIEN],
17086  * GENCS[TSIIEN], and GENCS[STM]) must not be changed. The EOSF flag is kept
17087  * until the software acknowledge it.
17088  */
17089 /*!
17090  * @name Constants and macros for entire TSI_GENCS register
17091  */
17092 /*@{*/
17093 #define TSI_RD_GENCS(base) (TSI_GENCS_REG(base))
17094 #define TSI_WR_GENCS(base, value) (TSI_GENCS_REG(base) = (value))
17095 #define TSI_RMW_GENCS(base, mask, value) (TSI_WR_GENCS(base, (TSI_RD_GENCS(base) & ~(mask)) | (value)))
17096 #define TSI_SET_GENCS(base, value) (BME_OR32(&TSI_GENCS_REG(base), (uint32_t)(value)))
17097 #define TSI_CLR_GENCS(base, value) (BME_AND32(&TSI_GENCS_REG(base), (uint32_t)(~(value))))
17098 #define TSI_TOG_GENCS(base, value) (BME_XOR32(&TSI_GENCS_REG(base), (uint32_t)(value)))
17099 /*@}*/
17100 
17101 /*
17102  * Constants & macros for individual TSI_GENCS bitfields
17103  */
17104 
17105 /*!
17106  * @name Register TSI_GENCS, field CURSW[1] (RW)
17107  *
17108  * This bit specifies if the current sources of electrode oscillator and
17109  * reference oscillator are swapped.
17110  *
17111  * Values:
17112  * - 0b0 - The current source pair are not swapped.
17113  * - 0b1 - The current source pair are swapped.
17114  */
17115 /*@{*/
17116 /*! @brief Read current value of the TSI_GENCS_CURSW field. */
17117 #define TSI_RD_GENCS_CURSW(base) ((TSI_GENCS_REG(base) & TSI_GENCS_CURSW_MASK) >> TSI_GENCS_CURSW_SHIFT)
17118 #define TSI_BRD_GENCS_CURSW(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_CURSW_SHIFT, TSI_GENCS_CURSW_WIDTH))
17119 
17120 /*! @brief Set the CURSW field to a new value. */
17121 #define TSI_WR_GENCS_CURSW(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_CURSW_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_CURSW(value)))
17122 #define TSI_BWR_GENCS_CURSW(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_CURSW_SHIFT), TSI_GENCS_CURSW_SHIFT, TSI_GENCS_CURSW_WIDTH))
17123 /*@}*/
17124 
17125 /*!
17126  * @name Register TSI_GENCS, field EOSF[2] (W1C)
17127  *
17128  * This flag is set when all active electrodes are finished scanning after a
17129  * scan trigger. Write "1" , when this flag is set, to clear it.
17130  *
17131  * Values:
17132  * - 0b0 - Scan not complete.
17133  * - 0b1 - Scan complete.
17134  */
17135 /*@{*/
17136 /*! @brief Read current value of the TSI_GENCS_EOSF field. */
17137 #define TSI_RD_GENCS_EOSF(base) ((TSI_GENCS_REG(base) & TSI_GENCS_EOSF_MASK) >> TSI_GENCS_EOSF_SHIFT)
17138 #define TSI_BRD_GENCS_EOSF(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_EOSF_SHIFT, TSI_GENCS_EOSF_WIDTH))
17139 
17140 /*! @brief Set the EOSF field to a new value. */
17141 #define TSI_WR_GENCS_EOSF(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_EOSF(value)))
17142 #define TSI_BWR_GENCS_EOSF(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_EOSF_SHIFT), TSI_GENCS_EOSF_SHIFT, TSI_GENCS_EOSF_WIDTH))
17143 /*@}*/
17144 
17145 /*!
17146  * @name Register TSI_GENCS, field SCNIP[3] (RO)
17147  *
17148  * This read-only bit indicates if scan is in progress. This bit will get
17149  * asserted after the analog bias circuit is stable after a trigger and it changes
17150  * automatically by the TSI.
17151  *
17152  * Values:
17153  * - 0b0 - No scan in progress.
17154  * - 0b1 - Scan in progress.
17155  */
17156 /*@{*/
17157 /*! @brief Read current value of the TSI_GENCS_SCNIP field. */
17158 #define TSI_RD_GENCS_SCNIP(base) ((TSI_GENCS_REG(base) & TSI_GENCS_SCNIP_MASK) >> TSI_GENCS_SCNIP_SHIFT)
17159 #define TSI_BRD_GENCS_SCNIP(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_SCNIP_SHIFT, TSI_GENCS_SCNIP_WIDTH))
17160 /*@}*/
17161 
17162 /*!
17163  * @name Register TSI_GENCS, field STM[4] (RW)
17164  *
17165  * This bit specifies the trigger mode. User is allowed to change this bit when
17166  * TSI is not working in progress.
17167  *
17168  * Values:
17169  * - 0b0 - Software trigger scan.
17170  * - 0b1 - Hardware trigger scan.
17171  */
17172 /*@{*/
17173 /*! @brief Read current value of the TSI_GENCS_STM field. */
17174 #define TSI_RD_GENCS_STM(base) ((TSI_GENCS_REG(base) & TSI_GENCS_STM_MASK) >> TSI_GENCS_STM_SHIFT)
17175 #define TSI_BRD_GENCS_STM(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_STM_SHIFT, TSI_GENCS_STM_WIDTH))
17176 
17177 /*! @brief Set the STM field to a new value. */
17178 #define TSI_WR_GENCS_STM(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_STM_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_STM(value)))
17179 #define TSI_BWR_GENCS_STM(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_STM_SHIFT), TSI_GENCS_STM_SHIFT, TSI_GENCS_STM_WIDTH))
17180 /*@}*/
17181 
17182 /*!
17183  * @name Register TSI_GENCS, field STPE[5] (RW)
17184  *
17185  * This bit enables TSI module function in low power modes (stop, VLPS, LLS and
17186  * VLLS{3,2,1}).
17187  *
17188  * Values:
17189  * - 0b0 - TSI is disabled when MCU goes into low power mode.
17190  * - 0b1 - Allows TSI to continue running in all low power modes.
17191  */
17192 /*@{*/
17193 /*! @brief Read current value of the TSI_GENCS_STPE field. */
17194 #define TSI_RD_GENCS_STPE(base) ((TSI_GENCS_REG(base) & TSI_GENCS_STPE_MASK) >> TSI_GENCS_STPE_SHIFT)
17195 #define TSI_BRD_GENCS_STPE(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_STPE_SHIFT, TSI_GENCS_STPE_WIDTH))
17196 
17197 /*! @brief Set the STPE field to a new value. */
17198 #define TSI_WR_GENCS_STPE(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_STPE_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_STPE(value)))
17199 #define TSI_BWR_GENCS_STPE(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_STPE_SHIFT), TSI_GENCS_STPE_SHIFT, TSI_GENCS_STPE_WIDTH))
17200 /*@}*/
17201 
17202 /*!
17203  * @name Register TSI_GENCS, field TSIIEN[6] (RW)
17204  *
17205  * This bit enables TSI module interrupt request to CPU when the scan completes.
17206  * The interrupt will wake MCU from low power mode if this interrupt is enabled.
17207  *
17208  * Values:
17209  * - 0b0 - TSI interrupt is disabled.
17210  * - 0b1 - TSI interrupt is enabled.
17211  */
17212 /*@{*/
17213 /*! @brief Read current value of the TSI_GENCS_TSIIEN field. */
17214 #define TSI_RD_GENCS_TSIIEN(base) ((TSI_GENCS_REG(base) & TSI_GENCS_TSIIEN_MASK) >> TSI_GENCS_TSIIEN_SHIFT)
17215 #define TSI_BRD_GENCS_TSIIEN(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_TSIIEN_SHIFT, TSI_GENCS_TSIIEN_WIDTH))
17216 
17217 /*! @brief Set the TSIIEN field to a new value. */
17218 #define TSI_WR_GENCS_TSIIEN(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_TSIIEN_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_TSIIEN(value)))
17219 #define TSI_BWR_GENCS_TSIIEN(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_TSIIEN_SHIFT), TSI_GENCS_TSIIEN_SHIFT, TSI_GENCS_TSIIEN_WIDTH))
17220 /*@}*/
17221 
17222 /*!
17223  * @name Register TSI_GENCS, field TSIEN[7] (RW)
17224  *
17225  * This bit enables TSI module.
17226  *
17227  * Values:
17228  * - 0b0 - TSI module disabled.
17229  * - 0b1 - TSI module enabled.
17230  */
17231 /*@{*/
17232 /*! @brief Read current value of the TSI_GENCS_TSIEN field. */
17233 #define TSI_RD_GENCS_TSIEN(base) ((TSI_GENCS_REG(base) & TSI_GENCS_TSIEN_MASK) >> TSI_GENCS_TSIEN_SHIFT)
17234 #define TSI_BRD_GENCS_TSIEN(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_TSIEN_SHIFT, TSI_GENCS_TSIEN_WIDTH))
17235 
17236 /*! @brief Set the TSIEN field to a new value. */
17237 #define TSI_WR_GENCS_TSIEN(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_TSIEN_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_TSIEN(value)))
17238 #define TSI_BWR_GENCS_TSIEN(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_TSIEN_SHIFT), TSI_GENCS_TSIEN_SHIFT, TSI_GENCS_TSIEN_WIDTH))
17239 /*@}*/
17240 
17241 /*!
17242  * @name Register TSI_GENCS, field NSCN[12:8] (RW)
17243  *
17244  * These bits indicate the scan number for each electrode. The scan number is
17245  * equal to NSCN + 1, which allows the scan time ranges from 1 to 32. By default,
17246  * NSCN is configured as 0, which asserts the TSI scans once on the selected
17247  * eletrode channel.
17248  *
17249  * Values:
17250  * - 0b00000 - Once per electrode
17251  * - 0b00001 - Twice per electrode
17252  * - 0b00010 - 3 times per electrode
17253  * - 0b00011 - 4 times per electrode
17254  * - 0b00100 - 5 times per electrode
17255  * - 0b00101 - 6 times per electrode
17256  * - 0b00110 - 7 times per electrode
17257  * - 0b00111 - 8 times per electrode
17258  * - 0b01000 - 9 times per electrode
17259  * - 0b01001 - 10 times per electrode
17260  * - 0b01010 - 11 times per electrode
17261  * - 0b01011 - 12 times per electrode
17262  * - 0b01100 - 13 times per electrode
17263  * - 0b01101 - 14 times per electrode
17264  * - 0b01110 - 15 times per electrode
17265  * - 0b01111 - 16 times per electrode
17266  * - 0b10000 - 17 times per electrode
17267  * - 0b10001 - 18 times per electrode
17268  * - 0b10010 - 19 times per electrode
17269  * - 0b10011 - 20 times per electrode
17270  * - 0b10100 - 21 times per electrode
17271  * - 0b10101 - 22 times per electrode
17272  * - 0b10110 - 23 times per electrode
17273  * - 0b10111 - 24 times per electrode
17274  * - 0b11000 - 25 times per electrode
17275  * - 0b11001 - 26 times per electrode
17276  * - 0b11010 - 27 times per electrode
17277  * - 0b11011 - 28 times per electrode
17278  * - 0b11100 - 29 times per electrode
17279  * - 0b11101 - 30 times per electrode
17280  * - 0b11110 - 31 times per electrode
17281  * - 0b11111 - 32 times per electrode
17282  */
17283 /*@{*/
17284 /*! @brief Read current value of the TSI_GENCS_NSCN field. */
17285 #define TSI_RD_GENCS_NSCN(base) ((TSI_GENCS_REG(base) & TSI_GENCS_NSCN_MASK) >> TSI_GENCS_NSCN_SHIFT)
17286 #define TSI_BRD_GENCS_NSCN(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_NSCN_SHIFT, TSI_GENCS_NSCN_WIDTH))
17287 
17288 /*! @brief Set the NSCN field to a new value. */
17289 #define TSI_WR_GENCS_NSCN(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_NSCN_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_NSCN(value)))
17290 #define TSI_BWR_GENCS_NSCN(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_NSCN_SHIFT), TSI_GENCS_NSCN_SHIFT, TSI_GENCS_NSCN_WIDTH))
17291 /*@}*/
17292 
17293 /*!
17294  * @name Register TSI_GENCS, field PS[15:13] (RW)
17295  *
17296  * These bits indicate the prescaler of the output of electrode oscillator.
17297  *
17298  * Values:
17299  * - 0b000 - Electrode Oscillator Frequency divided by 1
17300  * - 0b001 - Electrode Oscillator Frequency divided by 2
17301  * - 0b010 - Electrode Oscillator Frequency divided by 4
17302  * - 0b011 - Electrode Oscillator Frequency divided by 8
17303  * - 0b100 - Electrode Oscillator Frequency divided by 16
17304  * - 0b101 - Electrode Oscillator Frequency divided by 32
17305  * - 0b110 - Electrode Oscillator Frequency divided by 64
17306  * - 0b111 - Electrode Oscillator Frequency divided by 128
17307  */
17308 /*@{*/
17309 /*! @brief Read current value of the TSI_GENCS_PS field. */
17310 #define TSI_RD_GENCS_PS(base) ((TSI_GENCS_REG(base) & TSI_GENCS_PS_MASK) >> TSI_GENCS_PS_SHIFT)
17311 #define TSI_BRD_GENCS_PS(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_PS_SHIFT, TSI_GENCS_PS_WIDTH))
17312 
17313 /*! @brief Set the PS field to a new value. */
17314 #define TSI_WR_GENCS_PS(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_PS_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_PS(value)))
17315 #define TSI_BWR_GENCS_PS(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_PS_SHIFT), TSI_GENCS_PS_SHIFT, TSI_GENCS_PS_WIDTH))
17316 /*@}*/
17317 
17318 /*!
17319  * @name Register TSI_GENCS, field EXTCHRG[18:16] (RW)
17320  *
17321  * These bits indicate the electrode oscillator charge and discharge current
17322  * value.
17323  *
17324  * Values:
17325  * - 0b000 - 500 nA.
17326  * - 0b001 - 1 uA.
17327  * - 0b010 - 2 uA.
17328  * - 0b011 - 4 uA.
17329  * - 0b100 - 8 uA.
17330  * - 0b101 - 16 uA.
17331  * - 0b110 - 32 uA.
17332  * - 0b111 - 64 uA.
17333  */
17334 /*@{*/
17335 /*! @brief Read current value of the TSI_GENCS_EXTCHRG field. */
17336 #define TSI_RD_GENCS_EXTCHRG(base) ((TSI_GENCS_REG(base) & TSI_GENCS_EXTCHRG_MASK) >> TSI_GENCS_EXTCHRG_SHIFT)
17337 #define TSI_BRD_GENCS_EXTCHRG(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_EXTCHRG_SHIFT, TSI_GENCS_EXTCHRG_WIDTH))
17338 
17339 /*! @brief Set the EXTCHRG field to a new value. */
17340 #define TSI_WR_GENCS_EXTCHRG(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_EXTCHRG_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_EXTCHRG(value)))
17341 #define TSI_BWR_GENCS_EXTCHRG(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_EXTCHRG_SHIFT), TSI_GENCS_EXTCHRG_SHIFT, TSI_GENCS_EXTCHRG_WIDTH))
17342 /*@}*/
17343 
17344 /*!
17345  * @name Register TSI_GENCS, field DVOLT[20:19] (RW)
17346  *
17347  * These bits indicate the oscillator's voltage rails as below.
17348  *
17349  * Values:
17350  * - 0b00 - DV = 1.03 V; VP = 1.33 V; Vm = 0.30 V.
17351  * - 0b01 - DV = 0.73 V; VP = 1.18 V; Vm = 0.45 V.
17352  * - 0b10 - DV = 0.43 V; VP = 1.03 V; Vm = 0.60 V.
17353  * - 0b11 - DV = 0.29 V; VP = 0.95 V; Vm = 0.67 V.
17354  */
17355 /*@{*/
17356 /*! @brief Read current value of the TSI_GENCS_DVOLT field. */
17357 #define TSI_RD_GENCS_DVOLT(base) ((TSI_GENCS_REG(base) & TSI_GENCS_DVOLT_MASK) >> TSI_GENCS_DVOLT_SHIFT)
17358 #define TSI_BRD_GENCS_DVOLT(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_DVOLT_SHIFT, TSI_GENCS_DVOLT_WIDTH))
17359 
17360 /*! @brief Set the DVOLT field to a new value. */
17361 #define TSI_WR_GENCS_DVOLT(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_DVOLT_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_DVOLT(value)))
17362 #define TSI_BWR_GENCS_DVOLT(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_DVOLT_SHIFT), TSI_GENCS_DVOLT_SHIFT, TSI_GENCS_DVOLT_WIDTH))
17363 /*@}*/
17364 
17365 /*!
17366  * @name Register TSI_GENCS, field REFCHRG[23:21] (RW)
17367  *
17368  * These bits indicate the reference oscillator charge and discharge current
17369  * value.
17370  *
17371  * Values:
17372  * - 0b000 - 500 nA.
17373  * - 0b001 - 1 uA.
17374  * - 0b010 - 2 uA.
17375  * - 0b011 - 4 uA.
17376  * - 0b100 - 8 uA.
17377  * - 0b101 - 16 uA.
17378  * - 0b110 - 32 uA.
17379  * - 0b111 - 64 uA.
17380  */
17381 /*@{*/
17382 /*! @brief Read current value of the TSI_GENCS_REFCHRG field. */
17383 #define TSI_RD_GENCS_REFCHRG(base) ((TSI_GENCS_REG(base) & TSI_GENCS_REFCHRG_MASK) >> TSI_GENCS_REFCHRG_SHIFT)
17384 #define TSI_BRD_GENCS_REFCHRG(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_REFCHRG_SHIFT, TSI_GENCS_REFCHRG_WIDTH))
17385 
17386 /*! @brief Set the REFCHRG field to a new value. */
17387 #define TSI_WR_GENCS_REFCHRG(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_REFCHRG_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_REFCHRG(value)))
17388 #define TSI_BWR_GENCS_REFCHRG(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_REFCHRG_SHIFT), TSI_GENCS_REFCHRG_SHIFT, TSI_GENCS_REFCHRG_WIDTH))
17389 /*@}*/
17390 
17391 /*!
17392  * @name Register TSI_GENCS, field MODE[27:24] (RW)
17393  *
17394  * Set up TSI analog modes, especially, setting MODE[3:2] to not 2'b00 will
17395  * configure TSI to noise detection modes. MODE[1:0] take no effect on TSI operation
17396  * mode and should always write to 2'b00 for setting up. When reading this field
17397  * will return the analog status. Refer to chapter "Noise detection mode" for
17398  * details.
17399  *
17400  * Values:
17401  * - 0b0000 - Set TSI in capacitive sensing(non-noise detection) mode.
17402  * - 0b0100 - Set TSI analog to work in single threshold noise detection mode
17403  * and the frequency limitation circuit is disabled.
17404  * - 0b1000 - Set TSI analog to work in single threshold noise detection mode
17405  * and the frequency limitation circuit is enabled to work in higher
17406  * frequencies operations.
17407  * - 0b1100 - Set TSI analog to work in automatic noise detection mode.
17408  */
17409 /*@{*/
17410 /*! @brief Read current value of the TSI_GENCS_MODE field. */
17411 #define TSI_RD_GENCS_MODE(base) ((TSI_GENCS_REG(base) & TSI_GENCS_MODE_MASK) >> TSI_GENCS_MODE_SHIFT)
17412 #define TSI_BRD_GENCS_MODE(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_MODE_SHIFT, TSI_GENCS_MODE_WIDTH))
17413 
17414 /*! @brief Set the MODE field to a new value. */
17415 #define TSI_WR_GENCS_MODE(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_MODE_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_MODE(value)))
17416 #define TSI_BWR_GENCS_MODE(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_MODE_SHIFT), TSI_GENCS_MODE_SHIFT, TSI_GENCS_MODE_WIDTH))
17417 /*@}*/
17418 
17419 /*!
17420  * @name Register TSI_GENCS, field ESOR[28] (RW)
17421  *
17422  * This bit is used to select out-of-range or end-of-scan event to generate an
17423  * interrupt.
17424  *
17425  * Values:
17426  * - 0b0 - Out-of-range interrupt is allowed.
17427  * - 0b1 - End-of-scan interrupt is allowed.
17428  */
17429 /*@{*/
17430 /*! @brief Read current value of the TSI_GENCS_ESOR field. */
17431 #define TSI_RD_GENCS_ESOR(base) ((TSI_GENCS_REG(base) & TSI_GENCS_ESOR_MASK) >> TSI_GENCS_ESOR_SHIFT)
17432 #define TSI_BRD_GENCS_ESOR(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_ESOR_SHIFT, TSI_GENCS_ESOR_WIDTH))
17433 
17434 /*! @brief Set the ESOR field to a new value. */
17435 #define TSI_WR_GENCS_ESOR(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_ESOR_MASK | TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK), TSI_GENCS_ESOR(value)))
17436 #define TSI_BWR_GENCS_ESOR(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_ESOR_SHIFT), TSI_GENCS_ESOR_SHIFT, TSI_GENCS_ESOR_WIDTH))
17437 /*@}*/
17438 
17439 /*!
17440  * @name Register TSI_GENCS, field OUTRGF[31] (W1C)
17441  *
17442  * This flag is set if the result register of the enabled electrode is out of
17443  * the range defined by the TSI_THRESHOLD register. This flag is set only when TSI
17444  * is configured in non-noise detection mode. It can be read once the CPU wakes.
17445  * Write "1" , when this flag is set, to clear it.
17446  */
17447 /*@{*/
17448 /*! @brief Read current value of the TSI_GENCS_OUTRGF field. */
17449 #define TSI_RD_GENCS_OUTRGF(base) ((TSI_GENCS_REG(base) & TSI_GENCS_OUTRGF_MASK) >> TSI_GENCS_OUTRGF_SHIFT)
17450 #define TSI_BRD_GENCS_OUTRGF(base) (BME_UBFX32(&TSI_GENCS_REG(base), TSI_GENCS_OUTRGF_SHIFT, TSI_GENCS_OUTRGF_WIDTH))
17451 
17452 /*! @brief Set the OUTRGF field to a new value. */
17453 #define TSI_WR_GENCS_OUTRGF(base, value) (TSI_RMW_GENCS(base, (TSI_GENCS_OUTRGF_MASK | TSI_GENCS_EOSF_MASK), TSI_GENCS_OUTRGF(value)))
17454 #define TSI_BWR_GENCS_OUTRGF(base, value) (BME_BFI32(&TSI_GENCS_REG(base), ((uint32_t)(value) << TSI_GENCS_OUTRGF_SHIFT), TSI_GENCS_OUTRGF_SHIFT, TSI_GENCS_OUTRGF_WIDTH))
17455 /*@}*/
17456 
17457 /*******************************************************************************
17458  * TSI_DATA - TSI DATA Register
17459  ******************************************************************************/
17460 
17461 /*!
17462  * @brief TSI_DATA - TSI DATA Register (RW)
17463  *
17464  * Reset value: 0x00000000U
17465  */
17466 /*!
17467  * @name Constants and macros for entire TSI_DATA register
17468  */
17469 /*@{*/
17470 #define TSI_RD_DATA(base) (TSI_DATA_REG(base))
17471 #define TSI_WR_DATA(base, value) (TSI_DATA_REG(base) = (value))
17472 #define TSI_RMW_DATA(base, mask, value) (TSI_WR_DATA(base, (TSI_RD_DATA(base) & ~(mask)) | (value)))
17473 #define TSI_SET_DATA(base, value) (BME_OR32(&TSI_DATA_REG(base), (uint32_t)(value)))
17474 #define TSI_CLR_DATA(base, value) (BME_AND32(&TSI_DATA_REG(base), (uint32_t)(~(value))))
17475 #define TSI_TOG_DATA(base, value) (BME_XOR32(&TSI_DATA_REG(base), (uint32_t)(value)))
17476 /*@}*/
17477 
17478 /*
17479  * Constants & macros for individual TSI_DATA bitfields
17480  */
17481 
17482 /*!
17483  * @name Register TSI_DATA, field TSICNT[15:0] (RO)
17484  *
17485  * These read-only bits record the accumulated scan counter value ticked by the
17486  * reference oscillator.
17487  */
17488 /*@{*/
17489 /*! @brief Read current value of the TSI_DATA_TSICNT field. */
17490 #define TSI_RD_DATA_TSICNT(base) ((TSI_DATA_REG(base) & TSI_DATA_TSICNT_MASK) >> TSI_DATA_TSICNT_SHIFT)
17491 #define TSI_BRD_DATA_TSICNT(base) (BME_UBFX32(&TSI_DATA_REG(base), TSI_DATA_TSICNT_SHIFT, TSI_DATA_TSICNT_WIDTH))
17492 /*@}*/
17493 
17494 /*!
17495  * @name Register TSI_DATA, field SWTS[22] (WORZ)
17496  *
17497  * This write-only bit is a software start trigger. When STM bit is clear, write
17498  * "1" to this bit will start a scan. The electrode channel to be scanned is
17499  * determinated by TSI_DATA[TSICH] bits.
17500  *
17501  * Values:
17502  * - 0b0 - No effect.
17503  * - 0b1 - Start a scan to determine which channel is specified by
17504  * TSI_DATA[TSICH].
17505  */
17506 /*@{*/
17507 /*! @brief Set the SWTS field to a new value. */
17508 #define TSI_WR_DATA_SWTS(base, value) (TSI_RMW_DATA(base, TSI_DATA_SWTS_MASK, TSI_DATA_SWTS(value)))
17509 #define TSI_BWR_DATA_SWTS(base, value) (BME_BFI32(&TSI_DATA_REG(base), ((uint32_t)(value) << TSI_DATA_SWTS_SHIFT), TSI_DATA_SWTS_SHIFT, TSI_DATA_SWTS_WIDTH))
17510 /*@}*/
17511 
17512 /*!
17513  * @name Register TSI_DATA, field DMAEN[23] (RW)
17514  *
17515  * This bit is used together with the TSI interrupt enable bits(TSIIE, ESOR) to
17516  * generate a DMA transfer request instead of an interrupt.
17517  *
17518  * Values:
17519  * - 0b0 - Interrupt is selected when the interrupt enable bit is set and the
17520  * corresponding TSI events assert.
17521  * - 0b1 - DMA transfer request is selected when the interrupt enable bit is set
17522  * and the corresponding TSI events assert.
17523  */
17524 /*@{*/
17525 /*! @brief Read current value of the TSI_DATA_DMAEN field. */
17526 #define TSI_RD_DATA_DMAEN(base) ((TSI_DATA_REG(base) & TSI_DATA_DMAEN_MASK) >> TSI_DATA_DMAEN_SHIFT)
17527 #define TSI_BRD_DATA_DMAEN(base) (BME_UBFX32(&TSI_DATA_REG(base), TSI_DATA_DMAEN_SHIFT, TSI_DATA_DMAEN_WIDTH))
17528 
17529 /*! @brief Set the DMAEN field to a new value. */
17530 #define TSI_WR_DATA_DMAEN(base, value) (TSI_RMW_DATA(base, TSI_DATA_DMAEN_MASK, TSI_DATA_DMAEN(value)))
17531 #define TSI_BWR_DATA_DMAEN(base, value) (BME_BFI32(&TSI_DATA_REG(base), ((uint32_t)(value) << TSI_DATA_DMAEN_SHIFT), TSI_DATA_DMAEN_SHIFT, TSI_DATA_DMAEN_WIDTH))
17532 /*@}*/
17533 
17534 /*!
17535  * @name Register TSI_DATA, field TSICH[31:28] (RW)
17536  *
17537  * These bits specify current channel to be measured. In hardware trigger mode
17538  * (TSI_GENCS[STM] = 1), the scan will not start until the hardware trigger
17539  * occurs. In software trigger mode (TSI_GENCS[STM] = 0), the scan starts immediately
17540  * when TSI_DATA[SWTS] bit is written by 1.
17541  *
17542  * Values:
17543  * - 0b0000 - Channel 0.
17544  * - 0b0001 - Channel 1.
17545  * - 0b0010 - Channel 2.
17546  * - 0b0011 - Channel 3.
17547  * - 0b0100 - Channel 4.
17548  * - 0b0101 - Channel 5.
17549  * - 0b0110 - Channel 6.
17550  * - 0b0111 - Channel 7.
17551  * - 0b1000 - Channel 8.
17552  * - 0b1001 - Channel 9.
17553  * - 0b1010 - Channel 10.
17554  * - 0b1011 - Channel 11.
17555  * - 0b1100 - Channel 12.
17556  * - 0b1101 - Channel 13.
17557  * - 0b1110 - Channel 14.
17558  * - 0b1111 - Channel 15.
17559  */
17560 /*@{*/
17561 /*! @brief Read current value of the TSI_DATA_TSICH field. */
17562 #define TSI_RD_DATA_TSICH(base) ((TSI_DATA_REG(base) & TSI_DATA_TSICH_MASK) >> TSI_DATA_TSICH_SHIFT)
17563 #define TSI_BRD_DATA_TSICH(base) (BME_UBFX32(&TSI_DATA_REG(base), TSI_DATA_TSICH_SHIFT, TSI_DATA_TSICH_WIDTH))
17564 
17565 /*! @brief Set the TSICH field to a new value. */
17566 #define TSI_WR_DATA_TSICH(base, value) (TSI_RMW_DATA(base, TSI_DATA_TSICH_MASK, TSI_DATA_TSICH(value)))
17567 #define TSI_BWR_DATA_TSICH(base, value) (BME_BFI32(&TSI_DATA_REG(base), ((uint32_t)(value) << TSI_DATA_TSICH_SHIFT), TSI_DATA_TSICH_SHIFT, TSI_DATA_TSICH_WIDTH))
17568 /*@}*/
17569 
17570 /*******************************************************************************
17571  * TSI_TSHD - TSI Threshold Register
17572  ******************************************************************************/
17573 
17574 /*!
17575  * @brief TSI_TSHD - TSI Threshold Register (RW)
17576  *
17577  * Reset value: 0x00000000U
17578  */
17579 /*!
17580  * @name Constants and macros for entire TSI_TSHD register
17581  */
17582 /*@{*/
17583 #define TSI_RD_TSHD(base) (TSI_TSHD_REG(base))
17584 #define TSI_WR_TSHD(base, value) (TSI_TSHD_REG(base) = (value))
17585 #define TSI_RMW_TSHD(base, mask, value) (TSI_WR_TSHD(base, (TSI_RD_TSHD(base) & ~(mask)) | (value)))
17586 #define TSI_SET_TSHD(base, value) (BME_OR32(&TSI_TSHD_REG(base), (uint32_t)(value)))
17587 #define TSI_CLR_TSHD(base, value) (BME_AND32(&TSI_TSHD_REG(base), (uint32_t)(~(value))))
17588 #define TSI_TOG_TSHD(base, value) (BME_XOR32(&TSI_TSHD_REG(base), (uint32_t)(value)))
17589 /*@}*/
17590 
17591 /*
17592  * Constants & macros for individual TSI_TSHD bitfields
17593  */
17594 
17595 /*!
17596  * @name Register TSI_TSHD, field THRESL[15:0] (RW)
17597  *
17598  * This half-word specifies the low threshold of the wakeup channel.
17599  */
17600 /*@{*/
17601 /*! @brief Read current value of the TSI_TSHD_THRESL field. */
17602 #define TSI_RD_TSHD_THRESL(base) ((TSI_TSHD_REG(base) & TSI_TSHD_THRESL_MASK) >> TSI_TSHD_THRESL_SHIFT)
17603 #define TSI_BRD_TSHD_THRESL(base) (BME_UBFX32(&TSI_TSHD_REG(base), TSI_TSHD_THRESL_SHIFT, TSI_TSHD_THRESL_WIDTH))
17604 
17605 /*! @brief Set the THRESL field to a new value. */
17606 #define TSI_WR_TSHD_THRESL(base, value) (TSI_RMW_TSHD(base, TSI_TSHD_THRESL_MASK, TSI_TSHD_THRESL(value)))
17607 #define TSI_BWR_TSHD_THRESL(base, value) (BME_BFI32(&TSI_TSHD_REG(base), ((uint32_t)(value) << TSI_TSHD_THRESL_SHIFT), TSI_TSHD_THRESL_SHIFT, TSI_TSHD_THRESL_WIDTH))
17608 /*@}*/
17609 
17610 /*!
17611  * @name Register TSI_TSHD, field THRESH[31:16] (RW)
17612  *
17613  * This half-word specifies the high threshold of the wakeup channel.
17614  */
17615 /*@{*/
17616 /*! @brief Read current value of the TSI_TSHD_THRESH field. */
17617 #define TSI_RD_TSHD_THRESH(base) ((TSI_TSHD_REG(base) & TSI_TSHD_THRESH_MASK) >> TSI_TSHD_THRESH_SHIFT)
17618 #define TSI_BRD_TSHD_THRESH(base) (BME_UBFX32(&TSI_TSHD_REG(base), TSI_TSHD_THRESH_SHIFT, TSI_TSHD_THRESH_WIDTH))
17619 
17620 /*! @brief Set the THRESH field to a new value. */
17621 #define TSI_WR_TSHD_THRESH(base, value) (TSI_RMW_TSHD(base, TSI_TSHD_THRESH_MASK, TSI_TSHD_THRESH(value)))
17622 #define TSI_BWR_TSHD_THRESH(base, value) (BME_BFI32(&TSI_TSHD_REG(base), ((uint32_t)(value) << TSI_TSHD_THRESH_SHIFT), TSI_TSHD_THRESH_SHIFT, TSI_TSHD_THRESH_WIDTH))
17623 /*@}*/
17624 
17625 /*
17626  * MKL25Z4 UART
17627  *
17628  * Universal Asynchronous Receiver/Transmitter (UART)
17629  *
17630  * Registers defined in this header file:
17631  * - UART_BDH - UART Baud Rate Register: High
17632  * - UART_BDL - UART Baud Rate Register: Low
17633  * - UART_C1 - UART Control Register 1
17634  * - UART_C2 - UART Control Register 2
17635  * - UART_S1 - UART Status Register 1
17636  * - UART_S2 - UART Status Register 2
17637  * - UART_C3 - UART Control Register 3
17638  * - UART_D - UART Data Register
17639  * - UART_C4 - UART Control Register 4
17640  */
17641 
17642 #define UART_INSTANCE_COUNT (3U) /*!< Number of instances of the UART module. */
17643 #define UART1_IDX (1U) /*!< Instance number for UART1. */
17644 #define UART2_IDX (2U) /*!< Instance number for UART2. */
17645 
17646 /*******************************************************************************
17647  * UART_BDH - UART Baud Rate Register: High
17648  ******************************************************************************/
17649 
17650 /*!
17651  * @brief UART_BDH - UART Baud Rate Register: High (RW)
17652  *
17653  * Reset value: 0x00U
17654  *
17655  * This register, along with UART_BDL, controls the prescale divisor for UART
17656  * baud rate generation. To update the 13-bit baud rate setting [SBR12:SBR0], first
17657  * write to UART_BDH to buffer the high half of the new value and then write to
17658  * UART_BDL. The working value in UART_BDH does not change until UART_BDL is
17659  * written.
17660  */
17661 /*!
17662  * @name Constants and macros for entire UART_BDH register
17663  */
17664 /*@{*/
17665 #define UART_RD_BDH(base) (UART_BDH_REG(base))
17666 #define UART_WR_BDH(base, value) (UART_BDH_REG(base) = (value))
17667 #define UART_RMW_BDH(base, mask, value) (UART_WR_BDH(base, (UART_RD_BDH(base) & ~(mask)) | (value)))
17668 #define UART_SET_BDH(base, value) (BME_OR8(&UART_BDH_REG(base), (uint8_t)(value)))
17669 #define UART_CLR_BDH(base, value) (BME_AND8(&UART_BDH_REG(base), (uint8_t)(~(value))))
17670 #define UART_TOG_BDH(base, value) (BME_XOR8(&UART_BDH_REG(base), (uint8_t)(value)))
17671 /*@}*/
17672 
17673 /*
17674  * Constants & macros for individual UART_BDH bitfields
17675  */
17676 
17677 /*!
17678  * @name Register UART_BDH, field SBR[4:0] (RW)
17679  *
17680  * The 13 bits in SBR[12:0] are referred to collectively as BR, and they set the
17681  * modulo divide rate for the UART baud rate generator. When BR is cleared, the
17682  * UART baud rate generator is disabled to reduce supply current. When BR is 1 -
17683  * 8191, the UART baud rate equals BUSCLK/(16*BR).
17684  */
17685 /*@{*/
17686 /*! @brief Read current value of the UART_BDH_SBR field. */
17687 #define UART_RD_BDH_SBR(base) ((UART_BDH_REG(base) & UART_BDH_SBR_MASK) >> UART_BDH_SBR_SHIFT)
17688 #define UART_BRD_BDH_SBR(base) (BME_UBFX8(&UART_BDH_REG(base), UART_BDH_SBR_SHIFT, UART_BDH_SBR_WIDTH))
17689 
17690 /*! @brief Set the SBR field to a new value. */
17691 #define UART_WR_BDH_SBR(base, value) (UART_RMW_BDH(base, UART_BDH_SBR_MASK, UART_BDH_SBR(value)))
17692 #define UART_BWR_BDH_SBR(base, value) (BME_BFI8(&UART_BDH_REG(base), ((uint8_t)(value) << UART_BDH_SBR_SHIFT), UART_BDH_SBR_SHIFT, UART_BDH_SBR_WIDTH))
17693 /*@}*/
17694 
17695 /*!
17696  * @name Register UART_BDH, field SBNS[5] (RW)
17697  *
17698  * SBNS determines whether data characters are one or two stop bits.
17699  *
17700  * Values:
17701  * - 0b0 - One stop bit.
17702  * - 0b1 - Two stop bit.
17703  */
17704 /*@{*/
17705 /*! @brief Read current value of the UART_BDH_SBNS field. */
17706 #define UART_RD_BDH_SBNS(base) ((UART_BDH_REG(base) & UART_BDH_SBNS_MASK) >> UART_BDH_SBNS_SHIFT)
17707 #define UART_BRD_BDH_SBNS(base) (BME_UBFX8(&UART_BDH_REG(base), UART_BDH_SBNS_SHIFT, UART_BDH_SBNS_WIDTH))
17708 
17709 /*! @brief Set the SBNS field to a new value. */
17710 #define UART_WR_BDH_SBNS(base, value) (UART_RMW_BDH(base, UART_BDH_SBNS_MASK, UART_BDH_SBNS(value)))
17711 #define UART_BWR_BDH_SBNS(base, value) (BME_BFI8(&UART_BDH_REG(base), ((uint8_t)(value) << UART_BDH_SBNS_SHIFT), UART_BDH_SBNS_SHIFT, UART_BDH_SBNS_WIDTH))
17712 /*@}*/
17713 
17714 /*!
17715  * @name Register UART_BDH, field RXEDGIE[6] (RW)
17716  *
17717  * Values:
17718  * - 0b0 - Hardware interrupts from UART_S2[RXEDGIF] disabled (use polling).
17719  * - 0b1 - Hardware interrupt requested when UART_S2[RXEDGIF] flag is 1.
17720  */
17721 /*@{*/
17722 /*! @brief Read current value of the UART_BDH_RXEDGIE field. */
17723 #define UART_RD_BDH_RXEDGIE(base) ((UART_BDH_REG(base) & UART_BDH_RXEDGIE_MASK) >> UART_BDH_RXEDGIE_SHIFT)
17724 #define UART_BRD_BDH_RXEDGIE(base) (BME_UBFX8(&UART_BDH_REG(base), UART_BDH_RXEDGIE_SHIFT, UART_BDH_RXEDGIE_WIDTH))
17725 
17726 /*! @brief Set the RXEDGIE field to a new value. */
17727 #define UART_WR_BDH_RXEDGIE(base, value) (UART_RMW_BDH(base, UART_BDH_RXEDGIE_MASK, UART_BDH_RXEDGIE(value)))
17728 #define UART_BWR_BDH_RXEDGIE(base, value) (BME_BFI8(&UART_BDH_REG(base), ((uint8_t)(value) << UART_BDH_RXEDGIE_SHIFT), UART_BDH_RXEDGIE_SHIFT, UART_BDH_RXEDGIE_WIDTH))
17729 /*@}*/
17730 
17731 /*!
17732  * @name Register UART_BDH, field LBKDIE[7] (RW)
17733  *
17734  * Values:
17735  * - 0b0 - Hardware interrupts from UART_S2[LBKDIF] disabled (use polling).
17736  * - 0b1 - Hardware interrupt requested when UART_S2[LBKDIF] flag is 1.
17737  */
17738 /*@{*/
17739 /*! @brief Read current value of the UART_BDH_LBKDIE field. */
17740 #define UART_RD_BDH_LBKDIE(base) ((UART_BDH_REG(base) & UART_BDH_LBKDIE_MASK) >> UART_BDH_LBKDIE_SHIFT)
17741 #define UART_BRD_BDH_LBKDIE(base) (BME_UBFX8(&UART_BDH_REG(base), UART_BDH_LBKDIE_SHIFT, UART_BDH_LBKDIE_WIDTH))
17742 
17743 /*! @brief Set the LBKDIE field to a new value. */
17744 #define UART_WR_BDH_LBKDIE(base, value) (UART_RMW_BDH(base, UART_BDH_LBKDIE_MASK, UART_BDH_LBKDIE(value)))
17745 #define UART_BWR_BDH_LBKDIE(base, value) (BME_BFI8(&UART_BDH_REG(base), ((uint8_t)(value) << UART_BDH_LBKDIE_SHIFT), UART_BDH_LBKDIE_SHIFT, UART_BDH_LBKDIE_WIDTH))
17746 /*@}*/
17747 
17748 /*******************************************************************************
17749  * UART_BDL - UART Baud Rate Register: Low
17750  ******************************************************************************/
17751 
17752 /*!
17753  * @brief UART_BDL - UART Baud Rate Register: Low (RW)
17754  *
17755  * Reset value: 0x04U
17756  *
17757  * This register, along with UART_BDH, control the prescale divisor for UART
17758  * baud rate generation. To update the 13-bit baud rate setting [SBR12:SBR0], first
17759  * write to UART_BDH to buffer the high half of the new value and then write to
17760  * UART_BDL. The working value in UART_BDH does not change until UART_BDL is
17761  * written. UART_BDL is reset to a non-zero value, so after reset the baud rate
17762  * generator remains disabled until the first time the receiver or transmitter is
17763  * enabled; that is, UART_C2[RE] or UART_C2[TE] bits are written to 1.
17764  */
17765 /*!
17766  * @name Constants and macros for entire UART_BDL register
17767  */
17768 /*@{*/
17769 #define UART_RD_BDL(base) (UART_BDL_REG(base))
17770 #define UART_WR_BDL(base, value) (UART_BDL_REG(base) = (value))
17771 #define UART_RMW_BDL(base, mask, value) (UART_WR_BDL(base, (UART_RD_BDL(base) & ~(mask)) | (value)))
17772 #define UART_SET_BDL(base, value) (BME_OR8(&UART_BDL_REG(base), (uint8_t)(value)))
17773 #define UART_CLR_BDL(base, value) (BME_AND8(&UART_BDL_REG(base), (uint8_t)(~(value))))
17774 #define UART_TOG_BDL(base, value) (BME_XOR8(&UART_BDL_REG(base), (uint8_t)(value)))
17775 /*@}*/
17776 
17777 /*******************************************************************************
17778  * UART_C1 - UART Control Register 1
17779  ******************************************************************************/
17780 
17781 /*!
17782  * @brief UART_C1 - UART Control Register 1 (RW)
17783  *
17784  * Reset value: 0x00U
17785  *
17786  * This read/write register controls various optional features of the UART
17787  * system.
17788  */
17789 /*!
17790  * @name Constants and macros for entire UART_C1 register
17791  */
17792 /*@{*/
17793 #define UART_RD_C1(base) (UART_C1_REG(base))
17794 #define UART_WR_C1(base, value) (UART_C1_REG(base) = (value))
17795 #define UART_RMW_C1(base, mask, value) (UART_WR_C1(base, (UART_RD_C1(base) & ~(mask)) | (value)))
17796 #define UART_SET_C1(base, value) (BME_OR8(&UART_C1_REG(base), (uint8_t)(value)))
17797 #define UART_CLR_C1(base, value) (BME_AND8(&UART_C1_REG(base), (uint8_t)(~(value))))
17798 #define UART_TOG_C1(base, value) (BME_XOR8(&UART_C1_REG(base), (uint8_t)(value)))
17799 /*@}*/
17800 
17801 /*
17802  * Constants & macros for individual UART_C1 bitfields
17803  */
17804 
17805 /*!
17806  * @name Register UART_C1, field PT[0] (RW)
17807  *
17808  * Provided parity is enabled (PE = 1), this bit selects even or odd parity. Odd
17809  * parity means the total number of 1s in the data character, including the
17810  * parity bit, is odd. Even parity means the total number of 1s in the data
17811  * character, including the parity bit, is even.
17812  *
17813  * Values:
17814  * - 0b0 - Even parity.
17815  * - 0b1 - Odd parity.
17816  */
17817 /*@{*/
17818 /*! @brief Read current value of the UART_C1_PT field. */
17819 #define UART_RD_C1_PT(base) ((UART_C1_REG(base) & UART_C1_PT_MASK) >> UART_C1_PT_SHIFT)
17820 #define UART_BRD_C1_PT(base) (BME_UBFX8(&UART_C1_REG(base), UART_C1_PT_SHIFT, UART_C1_PT_WIDTH))
17821 
17822 /*! @brief Set the PT field to a new value. */
17823 #define UART_WR_C1_PT(base, value) (UART_RMW_C1(base, UART_C1_PT_MASK, UART_C1_PT(value)))
17824 #define UART_BWR_C1_PT(base, value) (BME_BFI8(&UART_C1_REG(base), ((uint8_t)(value) << UART_C1_PT_SHIFT), UART_C1_PT_SHIFT, UART_C1_PT_WIDTH))
17825 /*@}*/
17826 
17827 /*!
17828  * @name Register UART_C1, field PE[1] (RW)
17829  *
17830  * Enables hardware parity generation and checking. When parity is enabled, the
17831  * most significant bit (msb) of the data character, eighth or ninth data bit, is
17832  * treated as the parity bit.
17833  *
17834  * Values:
17835  * - 0b0 - No hardware parity generation or checking.
17836  * - 0b1 - Parity enabled.
17837  */
17838 /*@{*/
17839 /*! @brief Read current value of the UART_C1_PE field. */
17840 #define UART_RD_C1_PE(base) ((UART_C1_REG(base) & UART_C1_PE_MASK) >> UART_C1_PE_SHIFT)
17841 #define UART_BRD_C1_PE(base) (BME_UBFX8(&UART_C1_REG(base), UART_C1_PE_SHIFT, UART_C1_PE_WIDTH))
17842 
17843 /*! @brief Set the PE field to a new value. */
17844 #define UART_WR_C1_PE(base, value) (UART_RMW_C1(base, UART_C1_PE_MASK, UART_C1_PE(value)))
17845 #define UART_BWR_C1_PE(base, value) (BME_BFI8(&UART_C1_REG(base), ((uint8_t)(value) << UART_C1_PE_SHIFT), UART_C1_PE_SHIFT, UART_C1_PE_WIDTH))
17846 /*@}*/
17847 
17848 /*!
17849  * @name Register UART_C1, field ILT[2] (RW)
17850  *
17851  * Setting this bit to 1 ensures that the stop bits and logic 1 bits at the end
17852  * of a character do not count toward the 10 or 11 bit times of logic high level
17853  * needed by the idle line detection logic.
17854  *
17855  * Values:
17856  * - 0b0 - Idle character bit count starts after start bit.
17857  * - 0b1 - Idle character bit count starts after stop bit.
17858  */
17859 /*@{*/
17860 /*! @brief Read current value of the UART_C1_ILT field. */
17861 #define UART_RD_C1_ILT(base) ((UART_C1_REG(base) & UART_C1_ILT_MASK) >> UART_C1_ILT_SHIFT)
17862 #define UART_BRD_C1_ILT(base) (BME_UBFX8(&UART_C1_REG(base), UART_C1_ILT_SHIFT, UART_C1_ILT_WIDTH))
17863 
17864 /*! @brief Set the ILT field to a new value. */
17865 #define UART_WR_C1_ILT(base, value) (UART_RMW_C1(base, UART_C1_ILT_MASK, UART_C1_ILT(value)))
17866 #define UART_BWR_C1_ILT(base, value) (BME_BFI8(&UART_C1_REG(base), ((uint8_t)(value) << UART_C1_ILT_SHIFT), UART_C1_ILT_SHIFT, UART_C1_ILT_WIDTH))
17867 /*@}*/
17868 
17869 /*!
17870  * @name Register UART_C1, field WAKE[3] (RW)
17871  *
17872  * Values:
17873  * - 0b0 - Idle-line wakeup.
17874  * - 0b1 - Address-mark wakeup.
17875  */
17876 /*@{*/
17877 /*! @brief Read current value of the UART_C1_WAKE field. */
17878 #define UART_RD_C1_WAKE(base) ((UART_C1_REG(base) & UART_C1_WAKE_MASK) >> UART_C1_WAKE_SHIFT)
17879 #define UART_BRD_C1_WAKE(base) (BME_UBFX8(&UART_C1_REG(base), UART_C1_WAKE_SHIFT, UART_C1_WAKE_WIDTH))
17880 
17881 /*! @brief Set the WAKE field to a new value. */
17882 #define UART_WR_C1_WAKE(base, value) (UART_RMW_C1(base, UART_C1_WAKE_MASK, UART_C1_WAKE(value)))
17883 #define UART_BWR_C1_WAKE(base, value) (BME_BFI8(&UART_C1_REG(base), ((uint8_t)(value) << UART_C1_WAKE_SHIFT), UART_C1_WAKE_SHIFT, UART_C1_WAKE_WIDTH))
17884 /*@}*/
17885 
17886 /*!
17887  * @name Register UART_C1, field M[4] (RW)
17888  *
17889  * Values:
17890  * - 0b0 - Normal - start + 8 data bits (lsb first) + stop.
17891  * - 0b1 - Receiver and transmitter use 9-bit data characters start + 8 data
17892  * bits (lsb first) + 9th data bit + stop.
17893  */
17894 /*@{*/
17895 /*! @brief Read current value of the UART_C1_M field. */
17896 #define UART_RD_C1_M(base) ((UART_C1_REG(base) & UART_C1_M_MASK) >> UART_C1_M_SHIFT)
17897 #define UART_BRD_C1_M(base) (BME_UBFX8(&UART_C1_REG(base), UART_C1_M_SHIFT, UART_C1_M_WIDTH))
17898 
17899 /*! @brief Set the M field to a new value. */
17900 #define UART_WR_C1_M(base, value) (UART_RMW_C1(base, UART_C1_M_MASK, UART_C1_M(value)))
17901 #define UART_BWR_C1_M(base, value) (BME_BFI8(&UART_C1_REG(base), ((uint8_t)(value) << UART_C1_M_SHIFT), UART_C1_M_SHIFT, UART_C1_M_WIDTH))
17902 /*@}*/
17903 
17904 /*!
17905  * @name Register UART_C1, field RSRC[5] (RW)
17906  *
17907  * This bit has no meaning or effect unless the LOOPS bit is set to 1. When
17908  * LOOPS is set, the receiver input is internally connected to the TxD pin and RSRC
17909  * determines whether this connection is also connected to the transmitter output.
17910  *
17911  * Values:
17912  * - 0b0 - Provided LOOPS is set, RSRC is cleared, selects internal loop back
17913  * mode and the UART does not use the RxD pins.
17914  * - 0b1 - Single-wire UART mode where the TxD pin is connected to the
17915  * transmitter output and receiver input.
17916  */
17917 /*@{*/
17918 /*! @brief Read current value of the UART_C1_RSRC field. */
17919 #define UART_RD_C1_RSRC(base) ((UART_C1_REG(base) & UART_C1_RSRC_MASK) >> UART_C1_RSRC_SHIFT)
17920 #define UART_BRD_C1_RSRC(base) (BME_UBFX8(&UART_C1_REG(base), UART_C1_RSRC_SHIFT, UART_C1_RSRC_WIDTH))
17921 
17922 /*! @brief Set the RSRC field to a new value. */
17923 #define UART_WR_C1_RSRC(base, value) (UART_RMW_C1(base, UART_C1_RSRC_MASK, UART_C1_RSRC(value)))
17924 #define UART_BWR_C1_RSRC(base, value) (BME_BFI8(&UART_C1_REG(base), ((uint8_t)(value) << UART_C1_RSRC_SHIFT), UART_C1_RSRC_SHIFT, UART_C1_RSRC_WIDTH))
17925 /*@}*/
17926 
17927 /*!
17928  * @name Register UART_C1, field UARTSWAI[6] (RW)
17929  *
17930  * Values:
17931  * - 0b0 - UART clocks continue to run in wait mode so the UART can be the
17932  * source of an interrupt that wakes up the CPU.
17933  * - 0b1 - UART clocks freeze while CPU is in wait mode.
17934  */
17935 /*@{*/
17936 /*! @brief Read current value of the UART_C1_UARTSWAI field. */
17937 #define UART_RD_C1_UARTSWAI(base) ((UART_C1_REG(base) & UART_C1_UARTSWAI_MASK) >> UART_C1_UARTSWAI_SHIFT)
17938 #define UART_BRD_C1_UARTSWAI(base) (BME_UBFX8(&UART_C1_REG(base), UART_C1_UARTSWAI_SHIFT, UART_C1_UARTSWAI_WIDTH))
17939 
17940 /*! @brief Set the UARTSWAI field to a new value. */
17941 #define UART_WR_C1_UARTSWAI(base, value) (UART_RMW_C1(base, UART_C1_UARTSWAI_MASK, UART_C1_UARTSWAI(value)))
17942 #define UART_BWR_C1_UARTSWAI(base, value) (BME_BFI8(&UART_C1_REG(base), ((uint8_t)(value) << UART_C1_UARTSWAI_SHIFT), UART_C1_UARTSWAI_SHIFT, UART_C1_UARTSWAI_WIDTH))
17943 /*@}*/
17944 
17945 /*!
17946  * @name Register UART_C1, field LOOPS[7] (RW)
17947  *
17948  * Selects between loop back modes and normal 2-pin full-duplex modes. When
17949  * LOOPS is set, the transmitter output is internally connected to the receiver input.
17950  *
17951  * Values:
17952  * - 0b0 - Normal operation - RxD and TxD use separate pins.
17953  * - 0b1 - Loop mode or single-wire mode where transmitter outputs are
17954  * internally connected to receiver input. (See RSRC bit.) RxD pin is not used by UART.
17955  */
17956 /*@{*/
17957 /*! @brief Read current value of the UART_C1_LOOPS field. */
17958 #define UART_RD_C1_LOOPS(base) ((UART_C1_REG(base) & UART_C1_LOOPS_MASK) >> UART_C1_LOOPS_SHIFT)
17959 #define UART_BRD_C1_LOOPS(base) (BME_UBFX8(&UART_C1_REG(base), UART_C1_LOOPS_SHIFT, UART_C1_LOOPS_WIDTH))
17960 
17961 /*! @brief Set the LOOPS field to a new value. */
17962 #define UART_WR_C1_LOOPS(base, value) (UART_RMW_C1(base, UART_C1_LOOPS_MASK, UART_C1_LOOPS(value)))
17963 #define UART_BWR_C1_LOOPS(base, value) (BME_BFI8(&UART_C1_REG(base), ((uint8_t)(value) << UART_C1_LOOPS_SHIFT), UART_C1_LOOPS_SHIFT, UART_C1_LOOPS_WIDTH))
17964 /*@}*/
17965 
17966 /*******************************************************************************
17967  * UART_C2 - UART Control Register 2
17968  ******************************************************************************/
17969 
17970 /*!
17971  * @brief UART_C2 - UART Control Register 2 (RW)
17972  *
17973  * Reset value: 0x00U
17974  *
17975  * This register can be read or written at any time.
17976  */
17977 /*!
17978  * @name Constants and macros for entire UART_C2 register
17979  */
17980 /*@{*/
17981 #define UART_RD_C2(base) (UART_C2_REG(base))
17982 #define UART_WR_C2(base, value) (UART_C2_REG(base) = (value))
17983 #define UART_RMW_C2(base, mask, value) (UART_WR_C2(base, (UART_RD_C2(base) & ~(mask)) | (value)))
17984 #define UART_SET_C2(base, value) (BME_OR8(&UART_C2_REG(base), (uint8_t)(value)))
17985 #define UART_CLR_C2(base, value) (BME_AND8(&UART_C2_REG(base), (uint8_t)(~(value))))
17986 #define UART_TOG_C2(base, value) (BME_XOR8(&UART_C2_REG(base), (uint8_t)(value)))
17987 /*@}*/
17988 
17989 /*
17990  * Constants & macros for individual UART_C2 bitfields
17991  */
17992 
17993 /*!
17994  * @name Register UART_C2, field SBK[0] (RW)
17995  *
17996  * Writing a 1 and then a 0 to SBK queues a break character in the transmit data
17997  * stream. Additional break characters of 10 or 11 or 12, 13 or 14 or 15 if
17998  * BRK13 = 1, bit times of logic 0 are queued as long as SBK is set. Depending on the
17999  * timing of the set and clear of SBK relative to the information currently
18000  * being transmitted, a second break character may be queued before software clears
18001  * SBK.
18002  *
18003  * Values:
18004  * - 0b0 - Normal transmitter operation.
18005  * - 0b1 - Queue break character(s) to be sent.
18006  */
18007 /*@{*/
18008 /*! @brief Read current value of the UART_C2_SBK field. */
18009 #define UART_RD_C2_SBK(base) ((UART_C2_REG(base) & UART_C2_SBK_MASK) >> UART_C2_SBK_SHIFT)
18010 #define UART_BRD_C2_SBK(base) (BME_UBFX8(&UART_C2_REG(base), UART_C2_SBK_SHIFT, UART_C2_SBK_WIDTH))
18011 
18012 /*! @brief Set the SBK field to a new value. */
18013 #define UART_WR_C2_SBK(base, value) (UART_RMW_C2(base, UART_C2_SBK_MASK, UART_C2_SBK(value)))
18014 #define UART_BWR_C2_SBK(base, value) (BME_BFI8(&UART_C2_REG(base), ((uint8_t)(value) << UART_C2_SBK_SHIFT), UART_C2_SBK_SHIFT, UART_C2_SBK_WIDTH))
18015 /*@}*/
18016 
18017 /*!
18018  * @name Register UART_C2, field RWU[1] (RW)
18019  *
18020  * This bit can be written to 1 to place the UART receiver in a standby state
18021  * where it waits for automatic hardware detection of a selected wakeup condition.
18022  * The wakeup condition is an idle line between messages, WAKE = 0, idle-line
18023  * wakeup, or a logic 1 in the most significant data bit in a character, WAKE = 1,
18024  * address-mark wakeup. Application software sets RWU and, normally, a selected
18025  * hardware condition automatically clears RWU.
18026  *
18027  * Values:
18028  * - 0b0 - Normal UART receiver operation.
18029  * - 0b1 - UART receiver in standby waiting for wakeup condition.
18030  */
18031 /*@{*/
18032 /*! @brief Read current value of the UART_C2_RWU field. */
18033 #define UART_RD_C2_RWU(base) ((UART_C2_REG(base) & UART_C2_RWU_MASK) >> UART_C2_RWU_SHIFT)
18034 #define UART_BRD_C2_RWU(base) (BME_UBFX8(&UART_C2_REG(base), UART_C2_RWU_SHIFT, UART_C2_RWU_WIDTH))
18035 
18036 /*! @brief Set the RWU field to a new value. */
18037 #define UART_WR_C2_RWU(base, value) (UART_RMW_C2(base, UART_C2_RWU_MASK, UART_C2_RWU(value)))
18038 #define UART_BWR_C2_RWU(base, value) (BME_BFI8(&UART_C2_REG(base), ((uint8_t)(value) << UART_C2_RWU_SHIFT), UART_C2_RWU_SHIFT, UART_C2_RWU_WIDTH))
18039 /*@}*/
18040 
18041 /*!
18042  * @name Register UART_C2, field RE[2] (RW)
18043  *
18044  * When the UART receiver is off, the RxD pin reverts to being a general-purpose
18045  * port I/O pin. If LOOPS is set the RxD pin reverts to being a general-purpose
18046  * I/O pin even if RE is set.
18047  *
18048  * Values:
18049  * - 0b0 - Receiver off.
18050  * - 0b1 - Receiver on.
18051  */
18052 /*@{*/
18053 /*! @brief Read current value of the UART_C2_RE field. */
18054 #define UART_RD_C2_RE(base) ((UART_C2_REG(base) & UART_C2_RE_MASK) >> UART_C2_RE_SHIFT)
18055 #define UART_BRD_C2_RE(base) (BME_UBFX8(&UART_C2_REG(base), UART_C2_RE_SHIFT, UART_C2_RE_WIDTH))
18056 
18057 /*! @brief Set the RE field to a new value. */
18058 #define UART_WR_C2_RE(base, value) (UART_RMW_C2(base, UART_C2_RE_MASK, UART_C2_RE(value)))
18059 #define UART_BWR_C2_RE(base, value) (BME_BFI8(&UART_C2_REG(base), ((uint8_t)(value) << UART_C2_RE_SHIFT), UART_C2_RE_SHIFT, UART_C2_RE_WIDTH))
18060 /*@}*/
18061 
18062 /*!
18063  * @name Register UART_C2, field TE[3] (RW)
18064  *
18065  * TE must be 1 to use the UART transmitter. When TE is set, the UART forces the
18066  * TxD pin to act as an output for the UART system. When the UART is configured
18067  * for single-wire operation (LOOPS = RSRC = 1), TXDIR controls the direction of
18068  * traffic on the single UART communication line (TxD pin). TE can also queue an
18069  * idle character by clearing TE then setting TE while a transmission is in
18070  * progress. When TE is written to 0, the transmitter keeps control of the port TxD
18071  * pin until any data, queued idle, or queued break character finishes transmitting
18072  * before allowing the pin to revert to a general-purpose I/O pin.
18073  *
18074  * Values:
18075  * - 0b0 - Transmitter off.
18076  * - 0b1 - Transmitter on.
18077  */
18078 /*@{*/
18079 /*! @brief Read current value of the UART_C2_TE field. */
18080 #define UART_RD_C2_TE(base) ((UART_C2_REG(base) & UART_C2_TE_MASK) >> UART_C2_TE_SHIFT)
18081 #define UART_BRD_C2_TE(base) (BME_UBFX8(&UART_C2_REG(base), UART_C2_TE_SHIFT, UART_C2_TE_WIDTH))
18082 
18083 /*! @brief Set the TE field to a new value. */
18084 #define UART_WR_C2_TE(base, value) (UART_RMW_C2(base, UART_C2_TE_MASK, UART_C2_TE(value)))
18085 #define UART_BWR_C2_TE(base, value) (BME_BFI8(&UART_C2_REG(base), ((uint8_t)(value) << UART_C2_TE_SHIFT), UART_C2_TE_SHIFT, UART_C2_TE_WIDTH))
18086 /*@}*/
18087 
18088 /*!
18089  * @name Register UART_C2, field ILIE[4] (RW)
18090  *
18091  * Values:
18092  * - 0b0 - Hardware interrupts from IDLE disabled; use polling.
18093  * - 0b1 - Hardware interrupt requested when IDLE flag is 1.
18094  */
18095 /*@{*/
18096 /*! @brief Read current value of the UART_C2_ILIE field. */
18097 #define UART_RD_C2_ILIE(base) ((UART_C2_REG(base) & UART_C2_ILIE_MASK) >> UART_C2_ILIE_SHIFT)
18098 #define UART_BRD_C2_ILIE(base) (BME_UBFX8(&UART_C2_REG(base), UART_C2_ILIE_SHIFT, UART_C2_ILIE_WIDTH))
18099 
18100 /*! @brief Set the ILIE field to a new value. */
18101 #define UART_WR_C2_ILIE(base, value) (UART_RMW_C2(base, UART_C2_ILIE_MASK, UART_C2_ILIE(value)))
18102 #define UART_BWR_C2_ILIE(base, value) (BME_BFI8(&UART_C2_REG(base), ((uint8_t)(value) << UART_C2_ILIE_SHIFT), UART_C2_ILIE_SHIFT, UART_C2_ILIE_WIDTH))
18103 /*@}*/
18104 
18105 /*!
18106  * @name Register UART_C2, field RIE[5] (RW)
18107  *
18108  * Values:
18109  * - 0b0 - Hardware interrupts from RDRF disabled; use polling.
18110  * - 0b1 - Hardware interrupt requested when RDRF flag is 1.
18111  */
18112 /*@{*/
18113 /*! @brief Read current value of the UART_C2_RIE field. */
18114 #define UART_RD_C2_RIE(base) ((UART_C2_REG(base) & UART_C2_RIE_MASK) >> UART_C2_RIE_SHIFT)
18115 #define UART_BRD_C2_RIE(base) (BME_UBFX8(&UART_C2_REG(base), UART_C2_RIE_SHIFT, UART_C2_RIE_WIDTH))
18116 
18117 /*! @brief Set the RIE field to a new value. */
18118 #define UART_WR_C2_RIE(base, value) (UART_RMW_C2(base, UART_C2_RIE_MASK, UART_C2_RIE(value)))
18119 #define UART_BWR_C2_RIE(base, value) (BME_BFI8(&UART_C2_REG(base), ((uint8_t)(value) << UART_C2_RIE_SHIFT), UART_C2_RIE_SHIFT, UART_C2_RIE_WIDTH))
18120 /*@}*/
18121 
18122 /*!
18123  * @name Register UART_C2, field TCIE[6] (RW)
18124  *
18125  * Values:
18126  * - 0b0 - Hardware interrupts from TC disabled; use polling.
18127  * - 0b1 - Hardware interrupt requested when TC flag is 1.
18128  */
18129 /*@{*/
18130 /*! @brief Read current value of the UART_C2_TCIE field. */
18131 #define UART_RD_C2_TCIE(base) ((UART_C2_REG(base) & UART_C2_TCIE_MASK) >> UART_C2_TCIE_SHIFT)
18132 #define UART_BRD_C2_TCIE(base) (BME_UBFX8(&UART_C2_REG(base), UART_C2_TCIE_SHIFT, UART_C2_TCIE_WIDTH))
18133 
18134 /*! @brief Set the TCIE field to a new value. */
18135 #define UART_WR_C2_TCIE(base, value) (UART_RMW_C2(base, UART_C2_TCIE_MASK, UART_C2_TCIE(value)))
18136 #define UART_BWR_C2_TCIE(base, value) (BME_BFI8(&UART_C2_REG(base), ((uint8_t)(value) << UART_C2_TCIE_SHIFT), UART_C2_TCIE_SHIFT, UART_C2_TCIE_WIDTH))
18137 /*@}*/
18138 
18139 /*!
18140  * @name Register UART_C2, field TIE[7] (RW)
18141  *
18142  * Values:
18143  * - 0b0 - Hardware interrupts from TDRE disabled; use polling.
18144  * - 0b1 - Hardware interrupt requested when TDRE flag is 1.
18145  */
18146 /*@{*/
18147 /*! @brief Read current value of the UART_C2_TIE field. */
18148 #define UART_RD_C2_TIE(base) ((UART_C2_REG(base) & UART_C2_TIE_MASK) >> UART_C2_TIE_SHIFT)
18149 #define UART_BRD_C2_TIE(base) (BME_UBFX8(&UART_C2_REG(base), UART_C2_TIE_SHIFT, UART_C2_TIE_WIDTH))
18150 
18151 /*! @brief Set the TIE field to a new value. */
18152 #define UART_WR_C2_TIE(base, value) (UART_RMW_C2(base, UART_C2_TIE_MASK, UART_C2_TIE(value)))
18153 #define UART_BWR_C2_TIE(base, value) (BME_BFI8(&UART_C2_REG(base), ((uint8_t)(value) << UART_C2_TIE_SHIFT), UART_C2_TIE_SHIFT, UART_C2_TIE_WIDTH))
18154 /*@}*/
18155 
18156 /*******************************************************************************
18157  * UART_S1 - UART Status Register 1
18158  ******************************************************************************/
18159 
18160 /*!
18161  * @brief UART_S1 - UART Status Register 1 (RO)
18162  *
18163  * Reset value: 0xC0U
18164  *
18165  * This register has eight read-only status flags. Writes have no effect.
18166  * Special software sequences, which do not involve writing to this register, clear
18167  * these status flags.
18168  */
18169 /*!
18170  * @name Constants and macros for entire UART_S1 register
18171  */
18172 /*@{*/
18173 #define UART_RD_S1(base) (UART_S1_REG(base))
18174 /*@}*/
18175 
18176 /*
18177  * Constants & macros for individual UART_S1 bitfields
18178  */
18179 
18180 /*!
18181  * @name Register UART_S1, field PF[0] (RO)
18182  *
18183  * PF is set at the same time as RDRF when parity is enabled (PE = 1) and the
18184  * parity bit in the received character does not agree with the expected parity
18185  * value. To clear PF, read UART_S1 and then read the UART data register (UART_D).
18186  *
18187  * Values:
18188  * - 0b0 - No parity error.
18189  * - 0b1 - Parity error.
18190  */
18191 /*@{*/
18192 /*! @brief Read current value of the UART_S1_PF field. */
18193 #define UART_RD_S1_PF(base) ((UART_S1_REG(base) & UART_S1_PF_MASK) >> UART_S1_PF_SHIFT)
18194 #define UART_BRD_S1_PF(base) (BME_UBFX8(&UART_S1_REG(base), UART_S1_PF_SHIFT, UART_S1_PF_WIDTH))
18195 /*@}*/
18196 
18197 /*!
18198  * @name Register UART_S1, field FE[1] (RO)
18199  *
18200  * FE is set at the same time as RDRF when the receiver detects a logic 0 where
18201  * the stop bits was expected. This suggests the receiver was not properly
18202  * aligned to a character frame. To clear FE, read UART_S1 with FE set and then read
18203  * the UART data register (UART_D).
18204  *
18205  * Values:
18206  * - 0b0 - No framing error detected. This does not guarantee the framing is
18207  * correct.
18208  * - 0b1 - Framing error.
18209  */
18210 /*@{*/
18211 /*! @brief Read current value of the UART_S1_FE field. */
18212 #define UART_RD_S1_FE(base) ((UART_S1_REG(base) & UART_S1_FE_MASK) >> UART_S1_FE_SHIFT)
18213 #define UART_BRD_S1_FE(base) (BME_UBFX8(&UART_S1_REG(base), UART_S1_FE_SHIFT, UART_S1_FE_WIDTH))
18214 /*@}*/
18215 
18216 /*!
18217  * @name Register UART_S1, field NF[2] (RO)
18218  *
18219  * The advanced sampling technique used in the receiver takes seven samples
18220  * during the start bit and three samples in each data bit and the stop bits. If any
18221  * of these samples disagrees with the rest of the samples within any bit time in
18222  * the frame, the flag NF is set at the same time as RDRF is set for the
18223  * character. To clear NF, read UART_S1 and then read the UART data register (UART_D).
18224  *
18225  * Values:
18226  * - 0b0 - No noise detected.
18227  * - 0b1 - Noise detected in the received character in UART_D.
18228  */
18229 /*@{*/
18230 /*! @brief Read current value of the UART_S1_NF field. */
18231 #define UART_RD_S1_NF(base) ((UART_S1_REG(base) & UART_S1_NF_MASK) >> UART_S1_NF_SHIFT)
18232 #define UART_BRD_S1_NF(base) (BME_UBFX8(&UART_S1_REG(base), UART_S1_NF_SHIFT, UART_S1_NF_WIDTH))
18233 /*@}*/
18234 
18235 /*!
18236  * @name Register UART_S1, field OR[3] (RO)
18237  *
18238  * OR is set when a new serial character is ready to be transferred to the
18239  * receive data register (buffer), but the previously received character has not been
18240  * read from UART_D yet. In this case, the new character, and all associated
18241  * error information, is lost because there is no room to move it into UART_D. To
18242  * clear OR, read UART_S1 with OR set and then read the UART data register (UART_D).
18243  *
18244  * Values:
18245  * - 0b0 - No overrun.
18246  * - 0b1 - Receive overrun (new UART data lost).
18247  */
18248 /*@{*/
18249 /*! @brief Read current value of the UART_S1_OR field. */
18250 #define UART_RD_S1_OR(base) ((UART_S1_REG(base) & UART_S1_OR_MASK) >> UART_S1_OR_SHIFT)
18251 #define UART_BRD_S1_OR(base) (BME_UBFX8(&UART_S1_REG(base), UART_S1_OR_SHIFT, UART_S1_OR_WIDTH))
18252 /*@}*/
18253 
18254 /*!
18255  * @name Register UART_S1, field IDLE[4] (RO)
18256  *
18257  * IDLE is set when the UART receive line becomes idle for a full character time
18258  * after a period of activity. When ILT is cleared, the receiver starts counting
18259  * idle bit times after the start bit. If the receive character is all 1s, these
18260  * bit times and the stop bits time count toward the full character time of
18261  * logic high, 10 or 11 bit times depending on the M control bit, needed for the
18262  * receiver to detect an idle line. When ILT is set, the receiver doesn't start
18263  * counting idle bit times until after the stop bits. The stop bits and any logic high
18264  * bit times at the end of the previous character do not count toward the full
18265  * character time of logic high needed for the receiver to detect an idle line. To
18266  * clear IDLE, read UART_S1 with IDLE set and then read the UART data register
18267  * (UART_D). After IDLE has been cleared, it cannot become set again until after a
18268  * new character has been received and RDRF has been set. IDLE is set only once
18269  * even if the receive line remains idle for an extended period.
18270  *
18271  * Values:
18272  * - 0b0 - No idle line detected.
18273  * - 0b1 - Idle line was detected.
18274  */
18275 /*@{*/
18276 /*! @brief Read current value of the UART_S1_IDLE field. */
18277 #define UART_RD_S1_IDLE(base) ((UART_S1_REG(base) & UART_S1_IDLE_MASK) >> UART_S1_IDLE_SHIFT)
18278 #define UART_BRD_S1_IDLE(base) (BME_UBFX8(&UART_S1_REG(base), UART_S1_IDLE_SHIFT, UART_S1_IDLE_WIDTH))
18279 /*@}*/
18280 
18281 /*!
18282  * @name Register UART_S1, field RDRF[5] (RO)
18283  *
18284  * RDRF becomes set when a character transfers from the receive shifter into the
18285  * receive data register (UART_D). To clear RDRF, read UART_S1 with RDRF set and
18286  * then read the UART data register (UART_D).
18287  *
18288  * Values:
18289  * - 0b0 - Receive data register empty.
18290  * - 0b1 - Receive data register full.
18291  */
18292 /*@{*/
18293 /*! @brief Read current value of the UART_S1_RDRF field. */
18294 #define UART_RD_S1_RDRF(base) ((UART_S1_REG(base) & UART_S1_RDRF_MASK) >> UART_S1_RDRF_SHIFT)
18295 #define UART_BRD_S1_RDRF(base) (BME_UBFX8(&UART_S1_REG(base), UART_S1_RDRF_SHIFT, UART_S1_RDRF_WIDTH))
18296 /*@}*/
18297 
18298 /*!
18299  * @name Register UART_S1, field TC[6] (RO)
18300  *
18301  * TC is set out of reset and when TDRE is set and no data, preamble, or break
18302  * character is being transmitted. TC is cleared automatically by reading UART_S1
18303  * with TC set and then doing one of the following: Write to the UART data
18304  * register (UART_D) to transmit new data Queue a preamble by changing TE from 0 to 1
18305  * Queue a break character by writing 1 to UART_C2[SBK]
18306  *
18307  * Values:
18308  * - 0b0 - Transmitter active (sending data, a preamble, or a break).
18309  * - 0b1 - Transmitter idle (transmission activity complete).
18310  */
18311 /*@{*/
18312 /*! @brief Read current value of the UART_S1_TC field. */
18313 #define UART_RD_S1_TC(base) ((UART_S1_REG(base) & UART_S1_TC_MASK) >> UART_S1_TC_SHIFT)
18314 #define UART_BRD_S1_TC(base) (BME_UBFX8(&UART_S1_REG(base), UART_S1_TC_SHIFT, UART_S1_TC_WIDTH))
18315 /*@}*/
18316 
18317 /*!
18318  * @name Register UART_S1, field TDRE[7] (RO)
18319  *
18320  * TDRE is set out of reset and when a transmit data value transfers from the
18321  * transmit data buffer to the transmit shifter, leaving room for a new character
18322  * in the buffer. To clear TDRE, read UART_S1 with TDRE set and then write to the
18323  * UART data register (UART_D).
18324  *
18325  * Values:
18326  * - 0b0 - Transmit data register (buffer) full.
18327  * - 0b1 - Transmit data register (buffer) empty.
18328  */
18329 /*@{*/
18330 /*! @brief Read current value of the UART_S1_TDRE field. */
18331 #define UART_RD_S1_TDRE(base) ((UART_S1_REG(base) & UART_S1_TDRE_MASK) >> UART_S1_TDRE_SHIFT)
18332 #define UART_BRD_S1_TDRE(base) (BME_UBFX8(&UART_S1_REG(base), UART_S1_TDRE_SHIFT, UART_S1_TDRE_WIDTH))
18333 /*@}*/
18334 
18335 /*******************************************************************************
18336  * UART_S2 - UART Status Register 2
18337  ******************************************************************************/
18338 
18339 /*!
18340  * @brief UART_S2 - UART Status Register 2 (RW)
18341  *
18342  * Reset value: 0x00U
18343  *
18344  * This register contains one read-only status flag. When using an internal
18345  * oscillator in a LIN system, it is necessary to raise the break detection threshold
18346  * one bit time. Under the worst case timing conditions allowed in LIN, it is
18347  * possible that a 0x00 data character can appear to be 10.26 bit times long at a
18348  * slave running 14% faster than the master. This would trigger normal break
18349  * detection circuitry designed to detect a 10-bit break symbol. When the LBKDE bit is
18350  * set, framing errors are inhibited and the break detection threshold changes
18351  * from 10 bits to 11 bits, preventing false detection of a 0x00 data character as
18352  * a LIN break symbol.
18353  */
18354 /*!
18355  * @name Constants and macros for entire UART_S2 register
18356  */
18357 /*@{*/
18358 #define UART_RD_S2(base) (UART_S2_REG(base))
18359 #define UART_WR_S2(base, value) (UART_S2_REG(base) = (value))
18360 #define UART_RMW_S2(base, mask, value) (UART_WR_S2(base, (UART_RD_S2(base) & ~(mask)) | (value)))
18361 #define UART_SET_S2(base, value) (BME_OR8(&UART_S2_REG(base), (uint8_t)(value)))
18362 #define UART_CLR_S2(base, value) (BME_AND8(&UART_S2_REG(base), (uint8_t)(~(value))))
18363 #define UART_TOG_S2(base, value) (BME_XOR8(&UART_S2_REG(base), (uint8_t)(value)))
18364 /*@}*/
18365 
18366 /*
18367  * Constants & macros for individual UART_S2 bitfields
18368  */
18369 
18370 /*!
18371  * @name Register UART_S2, field RAF[0] (RO)
18372  *
18373  * RAF is set when the UART receiver detects the beginning of a valid start bit,
18374  * and RAF is cleared automatically when the receiver detects an idle line. This
18375  * status flag can be used to check whether an UART character is being received
18376  * before instructing the MCU to go to stop mode.
18377  *
18378  * Values:
18379  * - 0b0 - UART receiver idle waiting for a start bit.
18380  * - 0b1 - UART receiver active (RxD input not idle).
18381  */
18382 /*@{*/
18383 /*! @brief Read current value of the UART_S2_RAF field. */
18384 #define UART_RD_S2_RAF(base) ((UART_S2_REG(base) & UART_S2_RAF_MASK) >> UART_S2_RAF_SHIFT)
18385 #define UART_BRD_S2_RAF(base) (BME_UBFX8(&UART_S2_REG(base), UART_S2_RAF_SHIFT, UART_S2_RAF_WIDTH))
18386 /*@}*/
18387 
18388 /*!
18389  * @name Register UART_S2, field LBKDE[1] (RW)
18390  *
18391  * LBKDE selects a longer break character detection length. While LBKDE is set,
18392  * framing error (FE) and receive data register full (RDRF) flags are prevented
18393  * from setting.
18394  *
18395  * Values:
18396  * - 0b0 - Break character is detected at length 10 bit times (if M = 0, SBNS =
18397  * 0) or 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1, SBNS =
18398  * 1).
18399  * - 0b1 - Break character is detected at length of 11 bit times (if M = 0, SBNS
18400  * = 0) or 12 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 13 (if M = 1, SBNS
18401  * = 1).
18402  */
18403 /*@{*/
18404 /*! @brief Read current value of the UART_S2_LBKDE field. */
18405 #define UART_RD_S2_LBKDE(base) ((UART_S2_REG(base) & UART_S2_LBKDE_MASK) >> UART_S2_LBKDE_SHIFT)
18406 #define UART_BRD_S2_LBKDE(base) (BME_UBFX8(&UART_S2_REG(base), UART_S2_LBKDE_SHIFT, UART_S2_LBKDE_WIDTH))
18407 
18408 /*! @brief Set the LBKDE field to a new value. */
18409 #define UART_WR_S2_LBKDE(base, value) (UART_RMW_S2(base, UART_S2_LBKDE_MASK, UART_S2_LBKDE(value)))
18410 #define UART_BWR_S2_LBKDE(base, value) (BME_BFI8(&UART_S2_REG(base), ((uint8_t)(value) << UART_S2_LBKDE_SHIFT), UART_S2_LBKDE_SHIFT, UART_S2_LBKDE_WIDTH))
18411 /*@}*/
18412 
18413 /*!
18414  * @name Register UART_S2, field BRK13[2] (RW)
18415  *
18416  * BRK13 selects a longer transmitted break character length. Detection of a
18417  * framing error is not affected by the state of this bit.
18418  *
18419  * Values:
18420  * - 0b0 - Break character is transmitted with length of 10 bit times (if M = 0,
18421  * SBNS = 0) or 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1,
18422  * SBNS = 1).
18423  * - 0b1 - Break character is transmitted with length of 13 bit times (if M = 0,
18424  * SBNS = 0) or 14 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 15 (if M = 1,
18425  * SBNS = 1).
18426  */
18427 /*@{*/
18428 /*! @brief Read current value of the UART_S2_BRK13 field. */
18429 #define UART_RD_S2_BRK13(base) ((UART_S2_REG(base) & UART_S2_BRK13_MASK) >> UART_S2_BRK13_SHIFT)
18430 #define UART_BRD_S2_BRK13(base) (BME_UBFX8(&UART_S2_REG(base), UART_S2_BRK13_SHIFT, UART_S2_BRK13_WIDTH))
18431 
18432 /*! @brief Set the BRK13 field to a new value. */
18433 #define UART_WR_S2_BRK13(base, value) (UART_RMW_S2(base, UART_S2_BRK13_MASK, UART_S2_BRK13(value)))
18434 #define UART_BWR_S2_BRK13(base, value) (BME_BFI8(&UART_S2_REG(base), ((uint8_t)(value) << UART_S2_BRK13_SHIFT), UART_S2_BRK13_SHIFT, UART_S2_BRK13_WIDTH))
18435 /*@}*/
18436 
18437 /*!
18438  * @name Register UART_S2, field RWUID[3] (RW)
18439  *
18440  * RWUID controls whether the idle character that wakes up the receiver sets the
18441  * IDLE bit.
18442  *
18443  * Values:
18444  * - 0b0 - During receive standby state (RWU = 1), the IDLE bit does not get set
18445  * upon detection of an idle character.
18446  * - 0b1 - During receive standby state (RWU = 1), the IDLE bit gets set upon
18447  * detection of an idle character.
18448  */
18449 /*@{*/
18450 /*! @brief Read current value of the UART_S2_RWUID field. */
18451 #define UART_RD_S2_RWUID(base) ((UART_S2_REG(base) & UART_S2_RWUID_MASK) >> UART_S2_RWUID_SHIFT)
18452 #define UART_BRD_S2_RWUID(base) (BME_UBFX8(&UART_S2_REG(base), UART_S2_RWUID_SHIFT, UART_S2_RWUID_WIDTH))
18453 
18454 /*! @brief Set the RWUID field to a new value. */
18455 #define UART_WR_S2_RWUID(base, value) (UART_RMW_S2(base, UART_S2_RWUID_MASK, UART_S2_RWUID(value)))
18456 #define UART_BWR_S2_RWUID(base, value) (BME_BFI8(&UART_S2_REG(base), ((uint8_t)(value) << UART_S2_RWUID_SHIFT), UART_S2_RWUID_SHIFT, UART_S2_RWUID_WIDTH))
18457 /*@}*/
18458 
18459 /*!
18460  * @name Register UART_S2, field RXINV[4] (RW)
18461  *
18462  * Setting this bit reverses the polarity of the received data input. Setting
18463  * RXINV inverts the RxD input for all cases: data bits, start and stop bits,
18464  * break, and idle.
18465  *
18466  * Values:
18467  * - 0b0 - Receive data not inverted.
18468  * - 0b1 - Receive data inverted.
18469  */
18470 /*@{*/
18471 /*! @brief Read current value of the UART_S2_RXINV field. */
18472 #define UART_RD_S2_RXINV(base) ((UART_S2_REG(base) & UART_S2_RXINV_MASK) >> UART_S2_RXINV_SHIFT)
18473 #define UART_BRD_S2_RXINV(base) (BME_UBFX8(&UART_S2_REG(base), UART_S2_RXINV_SHIFT, UART_S2_RXINV_WIDTH))
18474 
18475 /*! @brief Set the RXINV field to a new value. */
18476 #define UART_WR_S2_RXINV(base, value) (UART_RMW_S2(base, UART_S2_RXINV_MASK, UART_S2_RXINV(value)))
18477 #define UART_BWR_S2_RXINV(base, value) (BME_BFI8(&UART_S2_REG(base), ((uint8_t)(value) << UART_S2_RXINV_SHIFT), UART_S2_RXINV_SHIFT, UART_S2_RXINV_WIDTH))
18478 /*@}*/
18479 
18480 /*!
18481  * @name Register UART_S2, field RXEDGIF[6] (RW)
18482  *
18483  * RXEDGIF is set when an active edge, falling if RXINV = 0, rising if RXINV=1,
18484  * on the RxD pin occurs. RXEDGIF is cleared by writing a 1 to it.
18485  *
18486  * Values:
18487  * - 0b0 - No active edge on the receive pin has occurred.
18488  * - 0b1 - An active edge on the receive pin has occurred.
18489  */
18490 /*@{*/
18491 /*! @brief Read current value of the UART_S2_RXEDGIF field. */
18492 #define UART_RD_S2_RXEDGIF(base) ((UART_S2_REG(base) & UART_S2_RXEDGIF_MASK) >> UART_S2_RXEDGIF_SHIFT)
18493 #define UART_BRD_S2_RXEDGIF(base) (BME_UBFX8(&UART_S2_REG(base), UART_S2_RXEDGIF_SHIFT, UART_S2_RXEDGIF_WIDTH))
18494 
18495 /*! @brief Set the RXEDGIF field to a new value. */
18496 #define UART_WR_S2_RXEDGIF(base, value) (UART_RMW_S2(base, UART_S2_RXEDGIF_MASK, UART_S2_RXEDGIF(value)))
18497 #define UART_BWR_S2_RXEDGIF(base, value) (BME_BFI8(&UART_S2_REG(base), ((uint8_t)(value) << UART_S2_RXEDGIF_SHIFT), UART_S2_RXEDGIF_SHIFT, UART_S2_RXEDGIF_WIDTH))
18498 /*@}*/
18499 
18500 /*!
18501  * @name Register UART_S2, field LBKDIF[7] (RW)
18502  *
18503  * LBKDIF is set when the LIN break detect circuitry is enabled and a LIN break
18504  * character is detected. LBKDIF is cleared by writing a 1 to it.
18505  *
18506  * Values:
18507  * - 0b0 - No LIN break character has been detected.
18508  * - 0b1 - LIN break character has been detected.
18509  */
18510 /*@{*/
18511 /*! @brief Read current value of the UART_S2_LBKDIF field. */
18512 #define UART_RD_S2_LBKDIF(base) ((UART_S2_REG(base) & UART_S2_LBKDIF_MASK) >> UART_S2_LBKDIF_SHIFT)
18513 #define UART_BRD_S2_LBKDIF(base) (BME_UBFX8(&UART_S2_REG(base), UART_S2_LBKDIF_SHIFT, UART_S2_LBKDIF_WIDTH))
18514 
18515 /*! @brief Set the LBKDIF field to a new value. */
18516 #define UART_WR_S2_LBKDIF(base, value) (UART_RMW_S2(base, UART_S2_LBKDIF_MASK, UART_S2_LBKDIF(value)))
18517 #define UART_BWR_S2_LBKDIF(base, value) (BME_BFI8(&UART_S2_REG(base), ((uint8_t)(value) << UART_S2_LBKDIF_SHIFT), UART_S2_LBKDIF_SHIFT, UART_S2_LBKDIF_WIDTH))
18518 /*@}*/
18519 
18520 /*******************************************************************************
18521  * UART_C3 - UART Control Register 3
18522  ******************************************************************************/
18523 
18524 /*!
18525  * @brief UART_C3 - UART Control Register 3 (RW)
18526  *
18527  * Reset value: 0x00U
18528  */
18529 /*!
18530  * @name Constants and macros for entire UART_C3 register
18531  */
18532 /*@{*/
18533 #define UART_RD_C3(base) (UART_C3_REG(base))
18534 #define UART_WR_C3(base, value) (UART_C3_REG(base) = (value))
18535 #define UART_RMW_C3(base, mask, value) (UART_WR_C3(base, (UART_RD_C3(base) & ~(mask)) | (value)))
18536 #define UART_SET_C3(base, value) (BME_OR8(&UART_C3_REG(base), (uint8_t)(value)))
18537 #define UART_CLR_C3(base, value) (BME_AND8(&UART_C3_REG(base), (uint8_t)(~(value))))
18538 #define UART_TOG_C3(base, value) (BME_XOR8(&UART_C3_REG(base), (uint8_t)(value)))
18539 /*@}*/
18540 
18541 /*
18542  * Constants & macros for individual UART_C3 bitfields
18543  */
18544 
18545 /*!
18546  * @name Register UART_C3, field PEIE[0] (RW)
18547  *
18548  * This bit enables the parity error flag (PF) to generate hardware interrupt
18549  * requests.
18550  *
18551  * Values:
18552  * - 0b0 - PF interrupts disabled; use polling).
18553  * - 0b1 - Hardware interrupt requested when PF is set.
18554  */
18555 /*@{*/
18556 /*! @brief Read current value of the UART_C3_PEIE field. */
18557 #define UART_RD_C3_PEIE(base) ((UART_C3_REG(base) & UART_C3_PEIE_MASK) >> UART_C3_PEIE_SHIFT)
18558 #define UART_BRD_C3_PEIE(base) (BME_UBFX8(&UART_C3_REG(base), UART_C3_PEIE_SHIFT, UART_C3_PEIE_WIDTH))
18559 
18560 /*! @brief Set the PEIE field to a new value. */
18561 #define UART_WR_C3_PEIE(base, value) (UART_RMW_C3(base, UART_C3_PEIE_MASK, UART_C3_PEIE(value)))
18562 #define UART_BWR_C3_PEIE(base, value) (BME_BFI8(&UART_C3_REG(base), ((uint8_t)(value) << UART_C3_PEIE_SHIFT), UART_C3_PEIE_SHIFT, UART_C3_PEIE_WIDTH))
18563 /*@}*/
18564 
18565 /*!
18566  * @name Register UART_C3, field FEIE[1] (RW)
18567  *
18568  * This bit enables the framing error flag (FE) to generate hardware interrupt
18569  * requests.
18570  *
18571  * Values:
18572  * - 0b0 - FE interrupts disabled; use polling).
18573  * - 0b1 - Hardware interrupt requested when FE is set.
18574  */
18575 /*@{*/
18576 /*! @brief Read current value of the UART_C3_FEIE field. */
18577 #define UART_RD_C3_FEIE(base) ((UART_C3_REG(base) & UART_C3_FEIE_MASK) >> UART_C3_FEIE_SHIFT)
18578 #define UART_BRD_C3_FEIE(base) (BME_UBFX8(&UART_C3_REG(base), UART_C3_FEIE_SHIFT, UART_C3_FEIE_WIDTH))
18579 
18580 /*! @brief Set the FEIE field to a new value. */
18581 #define UART_WR_C3_FEIE(base, value) (UART_RMW_C3(base, UART_C3_FEIE_MASK, UART_C3_FEIE(value)))
18582 #define UART_BWR_C3_FEIE(base, value) (BME_BFI8(&UART_C3_REG(base), ((uint8_t)(value) << UART_C3_FEIE_SHIFT), UART_C3_FEIE_SHIFT, UART_C3_FEIE_WIDTH))
18583 /*@}*/
18584 
18585 /*!
18586  * @name Register UART_C3, field NEIE[2] (RW)
18587  *
18588  * This bit enables the noise flag (NF) to generate hardware interrupt requests.
18589  *
18590  * Values:
18591  * - 0b0 - NF interrupts disabled; use polling).
18592  * - 0b1 - Hardware interrupt requested when NF is set.
18593  */
18594 /*@{*/
18595 /*! @brief Read current value of the UART_C3_NEIE field. */
18596 #define UART_RD_C3_NEIE(base) ((UART_C3_REG(base) & UART_C3_NEIE_MASK) >> UART_C3_NEIE_SHIFT)
18597 #define UART_BRD_C3_NEIE(base) (BME_UBFX8(&UART_C3_REG(base), UART_C3_NEIE_SHIFT, UART_C3_NEIE_WIDTH))
18598 
18599 /*! @brief Set the NEIE field to a new value. */
18600 #define UART_WR_C3_NEIE(base, value) (UART_RMW_C3(base, UART_C3_NEIE_MASK, UART_C3_NEIE(value)))
18601 #define UART_BWR_C3_NEIE(base, value) (BME_BFI8(&UART_C3_REG(base), ((uint8_t)(value) << UART_C3_NEIE_SHIFT), UART_C3_NEIE_SHIFT, UART_C3_NEIE_WIDTH))
18602 /*@}*/
18603 
18604 /*!
18605  * @name Register UART_C3, field ORIE[3] (RW)
18606  *
18607  * This bit enables the overrun flag (OR) to generate hardware interrupt
18608  * requests.
18609  *
18610  * Values:
18611  * - 0b0 - OR interrupts disabled; use polling.
18612  * - 0b1 - Hardware interrupt requested when OR is set.
18613  */
18614 /*@{*/
18615 /*! @brief Read current value of the UART_C3_ORIE field. */
18616 #define UART_RD_C3_ORIE(base) ((UART_C3_REG(base) & UART_C3_ORIE_MASK) >> UART_C3_ORIE_SHIFT)
18617 #define UART_BRD_C3_ORIE(base) (BME_UBFX8(&UART_C3_REG(base), UART_C3_ORIE_SHIFT, UART_C3_ORIE_WIDTH))
18618 
18619 /*! @brief Set the ORIE field to a new value. */
18620 #define UART_WR_C3_ORIE(base, value) (UART_RMW_C3(base, UART_C3_ORIE_MASK, UART_C3_ORIE(value)))
18621 #define UART_BWR_C3_ORIE(base, value) (BME_BFI8(&UART_C3_REG(base), ((uint8_t)(value) << UART_C3_ORIE_SHIFT), UART_C3_ORIE_SHIFT, UART_C3_ORIE_WIDTH))
18622 /*@}*/
18623 
18624 /*!
18625  * @name Register UART_C3, field TXINV[4] (RW)
18626  *
18627  * Setting this bit reverses the polarity of the transmitted data output.
18628  * Setting TXINV inverts the TxD output for all cases: data bits, start and stop bits,
18629  * break, and idle.
18630  *
18631  * Values:
18632  * - 0b0 - Transmit data not inverted.
18633  * - 0b1 - Transmit data inverted.
18634  */
18635 /*@{*/
18636 /*! @brief Read current value of the UART_C3_TXINV field. */
18637 #define UART_RD_C3_TXINV(base) ((UART_C3_REG(base) & UART_C3_TXINV_MASK) >> UART_C3_TXINV_SHIFT)
18638 #define UART_BRD_C3_TXINV(base) (BME_UBFX8(&UART_C3_REG(base), UART_C3_TXINV_SHIFT, UART_C3_TXINV_WIDTH))
18639 
18640 /*! @brief Set the TXINV field to a new value. */
18641 #define UART_WR_C3_TXINV(base, value) (UART_RMW_C3(base, UART_C3_TXINV_MASK, UART_C3_TXINV(value)))
18642 #define UART_BWR_C3_TXINV(base, value) (BME_BFI8(&UART_C3_REG(base), ((uint8_t)(value) << UART_C3_TXINV_SHIFT), UART_C3_TXINV_SHIFT, UART_C3_TXINV_WIDTH))
18643 /*@}*/
18644 
18645 /*!
18646  * @name Register UART_C3, field TXDIR[5] (RW)
18647  *
18648  * When the UART is configured for single-wire half-duplex operation (LOOPS =
18649  * RSRC = 1), this bit determines the direction of data at the TxD pin.
18650  *
18651  * Values:
18652  * - 0b0 - TxD pin is an input in single-wire mode.
18653  * - 0b1 - TxD pin is an output in single-wire mode.
18654  */
18655 /*@{*/
18656 /*! @brief Read current value of the UART_C3_TXDIR field. */
18657 #define UART_RD_C3_TXDIR(base) ((UART_C3_REG(base) & UART_C3_TXDIR_MASK) >> UART_C3_TXDIR_SHIFT)
18658 #define UART_BRD_C3_TXDIR(base) (BME_UBFX8(&UART_C3_REG(base), UART_C3_TXDIR_SHIFT, UART_C3_TXDIR_WIDTH))
18659 
18660 /*! @brief Set the TXDIR field to a new value. */
18661 #define UART_WR_C3_TXDIR(base, value) (UART_RMW_C3(base, UART_C3_TXDIR_MASK, UART_C3_TXDIR(value)))
18662 #define UART_BWR_C3_TXDIR(base, value) (BME_BFI8(&UART_C3_REG(base), ((uint8_t)(value) << UART_C3_TXDIR_SHIFT), UART_C3_TXDIR_SHIFT, UART_C3_TXDIR_WIDTH))
18663 /*@}*/
18664 
18665 /*!
18666  * @name Register UART_C3, field T8[6] (RW)
18667  *
18668  * When the UART is configured for 9-bit data (M = 1), T8 may be thought of as a
18669  * ninth transmit data bit to the left of the msb of the data in the UART_D
18670  * register. When writing 9-bit data, the entire 9-bit value is transferred to the
18671  * UART shift register after UART_D is written so T8 should be written, if it needs
18672  * to change from its previous value, before UART_D is written. If T8 does not
18673  * need to change in the new value, such as when it is used to generate mark or
18674  * space parity, it need not be written each time UART_D is written.
18675  */
18676 /*@{*/
18677 /*! @brief Read current value of the UART_C3_T8 field. */
18678 #define UART_RD_C3_T8(base) ((UART_C3_REG(base) & UART_C3_T8_MASK) >> UART_C3_T8_SHIFT)
18679 #define UART_BRD_C3_T8(base) (BME_UBFX8(&UART_C3_REG(base), UART_C3_T8_SHIFT, UART_C3_T8_WIDTH))
18680 
18681 /*! @brief Set the T8 field to a new value. */
18682 #define UART_WR_C3_T8(base, value) (UART_RMW_C3(base, UART_C3_T8_MASK, UART_C3_T8(value)))
18683 #define UART_BWR_C3_T8(base, value) (BME_BFI8(&UART_C3_REG(base), ((uint8_t)(value) << UART_C3_T8_SHIFT), UART_C3_T8_SHIFT, UART_C3_T8_WIDTH))
18684 /*@}*/
18685 
18686 /*!
18687  * @name Register UART_C3, field R8[7] (RO)
18688  *
18689  * When the UART is configured for 9-bit data (M = 1), R8 can be thought of as a
18690  * ninth receive data bit to the left of the msb of the buffered data in the
18691  * UART_D register. When reading 9-bit data, read R8 before reading UART_D because
18692  * reading UART_D completes automatic flag clearing sequences that could allow R8
18693  * and UART_D to be overwritten with new data.
18694  */
18695 /*@{*/
18696 /*! @brief Read current value of the UART_C3_R8 field. */
18697 #define UART_RD_C3_R8(base) ((UART_C3_REG(base) & UART_C3_R8_MASK) >> UART_C3_R8_SHIFT)
18698 #define UART_BRD_C3_R8(base) (BME_UBFX8(&UART_C3_REG(base), UART_C3_R8_SHIFT, UART_C3_R8_WIDTH))
18699 /*@}*/
18700 
18701 /*******************************************************************************
18702  * UART_D - UART Data Register
18703  ******************************************************************************/
18704 
18705 /*!
18706  * @brief UART_D - UART Data Register (RW)
18707  *
18708  * Reset value: 0x00U
18709  *
18710  * This register is actually two separate registers. Reads return the contents
18711  * of the read-only receive data buffer and writes go to the write-only transmit
18712  * data buffer. Reads and writes of this register are also involved in the
18713  * automatic flag clearing mechanisms for the UART status flags.
18714  */
18715 /*!
18716  * @name Constants and macros for entire UART_D register
18717  */
18718 /*@{*/
18719 #define UART_RD_D(base) (UART_D_REG(base))
18720 #define UART_WR_D(base, value) (UART_D_REG(base) = (value))
18721 #define UART_RMW_D(base, mask, value) (UART_WR_D(base, (UART_RD_D(base) & ~(mask)) | (value)))
18722 #define UART_SET_D(base, value) (BME_OR8(&UART_D_REG(base), (uint8_t)(value)))
18723 #define UART_CLR_D(base, value) (BME_AND8(&UART_D_REG(base), (uint8_t)(~(value))))
18724 #define UART_TOG_D(base, value) (BME_XOR8(&UART_D_REG(base), (uint8_t)(value)))
18725 /*@}*/
18726 
18727 /*
18728  * Constants & macros for individual UART_D bitfields
18729  */
18730 
18731 /*!
18732  * @name Register UART_D, field R0T0[0] (RW)
18733  *
18734  * Read receive data buffer 0 or write transmit data buffer 0.
18735  */
18736 /*@{*/
18737 /*! @brief Read current value of the UART_D_R0T0 field. */
18738 #define UART_RD_D_R0T0(base) ((UART_D_REG(base) & UART_D_R0T0_MASK) >> UART_D_R0T0_SHIFT)
18739 #define UART_BRD_D_R0T0(base) (BME_UBFX8(&UART_D_REG(base), UART_D_R0T0_SHIFT, UART_D_R0T0_WIDTH))
18740 
18741 /*! @brief Set the R0T0 field to a new value. */
18742 #define UART_WR_D_R0T0(base, value) (UART_RMW_D(base, UART_D_R0T0_MASK, UART_D_R0T0(value)))
18743 #define UART_BWR_D_R0T0(base, value) (BME_BFI8(&UART_D_REG(base), ((uint8_t)(value) << UART_D_R0T0_SHIFT), UART_D_R0T0_SHIFT, UART_D_R0T0_WIDTH))
18744 /*@}*/
18745 
18746 /*!
18747  * @name Register UART_D, field R1T1[1] (RW)
18748  *
18749  * Read receive data buffer 1 or write transmit data buffer 1.
18750  */
18751 /*@{*/
18752 /*! @brief Read current value of the UART_D_R1T1 field. */
18753 #define UART_RD_D_R1T1(base) ((UART_D_REG(base) & UART_D_R1T1_MASK) >> UART_D_R1T1_SHIFT)
18754 #define UART_BRD_D_R1T1(base) (BME_UBFX8(&UART_D_REG(base), UART_D_R1T1_SHIFT, UART_D_R1T1_WIDTH))
18755 
18756 /*! @brief Set the R1T1 field to a new value. */
18757 #define UART_WR_D_R1T1(base, value) (UART_RMW_D(base, UART_D_R1T1_MASK, UART_D_R1T1(value)))
18758 #define UART_BWR_D_R1T1(base, value) (BME_BFI8(&UART_D_REG(base), ((uint8_t)(value) << UART_D_R1T1_SHIFT), UART_D_R1T1_SHIFT, UART_D_R1T1_WIDTH))
18759 /*@}*/
18760 
18761 /*!
18762  * @name Register UART_D, field R2T2[2] (RW)
18763  *
18764  * Read receive data buffer 2 or write transmit data buffer 2.
18765  */
18766 /*@{*/
18767 /*! @brief Read current value of the UART_D_R2T2 field. */
18768 #define UART_RD_D_R2T2(base) ((UART_D_REG(base) & UART_D_R2T2_MASK) >> UART_D_R2T2_SHIFT)
18769 #define UART_BRD_D_R2T2(base) (BME_UBFX8(&UART_D_REG(base), UART_D_R2T2_SHIFT, UART_D_R2T2_WIDTH))
18770 
18771 /*! @brief Set the R2T2 field to a new value. */
18772 #define UART_WR_D_R2T2(base, value) (UART_RMW_D(base, UART_D_R2T2_MASK, UART_D_R2T2(value)))
18773 #define UART_BWR_D_R2T2(base, value) (BME_BFI8(&UART_D_REG(base), ((uint8_t)(value) << UART_D_R2T2_SHIFT), UART_D_R2T2_SHIFT, UART_D_R2T2_WIDTH))
18774 /*@}*/
18775 
18776 /*!
18777  * @name Register UART_D, field R3T3[3] (RW)
18778  *
18779  * Read receive data buffer 3 or write transmit data buffer 3.
18780  */
18781 /*@{*/
18782 /*! @brief Read current value of the UART_D_R3T3 field. */
18783 #define UART_RD_D_R3T3(base) ((UART_D_REG(base) & UART_D_R3T3_MASK) >> UART_D_R3T3_SHIFT)
18784 #define UART_BRD_D_R3T3(base) (BME_UBFX8(&UART_D_REG(base), UART_D_R3T3_SHIFT, UART_D_R3T3_WIDTH))
18785 
18786 /*! @brief Set the R3T3 field to a new value. */
18787 #define UART_WR_D_R3T3(base, value) (UART_RMW_D(base, UART_D_R3T3_MASK, UART_D_R3T3(value)))
18788 #define UART_BWR_D_R3T3(base, value) (BME_BFI8(&UART_D_REG(base), ((uint8_t)(value) << UART_D_R3T3_SHIFT), UART_D_R3T3_SHIFT, UART_D_R3T3_WIDTH))
18789 /*@}*/
18790 
18791 /*!
18792  * @name Register UART_D, field R4T4[4] (RW)
18793  *
18794  * Read receive data buffer 4 or write transmit data buffer 4.
18795  */
18796 /*@{*/
18797 /*! @brief Read current value of the UART_D_R4T4 field. */
18798 #define UART_RD_D_R4T4(base) ((UART_D_REG(base) & UART_D_R4T4_MASK) >> UART_D_R4T4_SHIFT)
18799 #define UART_BRD_D_R4T4(base) (BME_UBFX8(&UART_D_REG(base), UART_D_R4T4_SHIFT, UART_D_R4T4_WIDTH))
18800 
18801 /*! @brief Set the R4T4 field to a new value. */
18802 #define UART_WR_D_R4T4(base, value) (UART_RMW_D(base, UART_D_R4T4_MASK, UART_D_R4T4(value)))
18803 #define UART_BWR_D_R4T4(base, value) (BME_BFI8(&UART_D_REG(base), ((uint8_t)(value) << UART_D_R4T4_SHIFT), UART_D_R4T4_SHIFT, UART_D_R4T4_WIDTH))
18804 /*@}*/
18805 
18806 /*!
18807  * @name Register UART_D, field R5T5[5] (RW)
18808  *
18809  * Read receive data buffer 5 or write transmit data buffer 5.
18810  */
18811 /*@{*/
18812 /*! @brief Read current value of the UART_D_R5T5 field. */
18813 #define UART_RD_D_R5T5(base) ((UART_D_REG(base) & UART_D_R5T5_MASK) >> UART_D_R5T5_SHIFT)
18814 #define UART_BRD_D_R5T5(base) (BME_UBFX8(&UART_D_REG(base), UART_D_R5T5_SHIFT, UART_D_R5T5_WIDTH))
18815 
18816 /*! @brief Set the R5T5 field to a new value. */
18817 #define UART_WR_D_R5T5(base, value) (UART_RMW_D(base, UART_D_R5T5_MASK, UART_D_R5T5(value)))
18818 #define UART_BWR_D_R5T5(base, value) (BME_BFI8(&UART_D_REG(base), ((uint8_t)(value) << UART_D_R5T5_SHIFT), UART_D_R5T5_SHIFT, UART_D_R5T5_WIDTH))
18819 /*@}*/
18820 
18821 /*!
18822  * @name Register UART_D, field R6T6[6] (RW)
18823  *
18824  * Read receive data buffer 6 or write transmit data buffer 6.
18825  */
18826 /*@{*/
18827 /*! @brief Read current value of the UART_D_R6T6 field. */
18828 #define UART_RD_D_R6T6(base) ((UART_D_REG(base) & UART_D_R6T6_MASK) >> UART_D_R6T6_SHIFT)
18829 #define UART_BRD_D_R6T6(base) (BME_UBFX8(&UART_D_REG(base), UART_D_R6T6_SHIFT, UART_D_R6T6_WIDTH))
18830 
18831 /*! @brief Set the R6T6 field to a new value. */
18832 #define UART_WR_D_R6T6(base, value) (UART_RMW_D(base, UART_D_R6T6_MASK, UART_D_R6T6(value)))
18833 #define UART_BWR_D_R6T6(base, value) (BME_BFI8(&UART_D_REG(base), ((uint8_t)(value) << UART_D_R6T6_SHIFT), UART_D_R6T6_SHIFT, UART_D_R6T6_WIDTH))
18834 /*@}*/
18835 
18836 /*!
18837  * @name Register UART_D, field R7T7[7] (RW)
18838  *
18839  * Read receive data buffer 7 or write transmit data buffer 7.
18840  */
18841 /*@{*/
18842 /*! @brief Read current value of the UART_D_R7T7 field. */
18843 #define UART_RD_D_R7T7(base) ((UART_D_REG(base) & UART_D_R7T7_MASK) >> UART_D_R7T7_SHIFT)
18844 #define UART_BRD_D_R7T7(base) (BME_UBFX8(&UART_D_REG(base), UART_D_R7T7_SHIFT, UART_D_R7T7_WIDTH))
18845 
18846 /*! @brief Set the R7T7 field to a new value. */
18847 #define UART_WR_D_R7T7(base, value) (UART_RMW_D(base, UART_D_R7T7_MASK, UART_D_R7T7(value)))
18848 #define UART_BWR_D_R7T7(base, value) (BME_BFI8(&UART_D_REG(base), ((uint8_t)(value) << UART_D_R7T7_SHIFT), UART_D_R7T7_SHIFT, UART_D_R7T7_WIDTH))
18849 /*@}*/
18850 
18851 /*******************************************************************************
18852  * UART_C4 - UART Control Register 4
18853  ******************************************************************************/
18854 
18855 /*!
18856  * @brief UART_C4 - UART Control Register 4 (RW)
18857  *
18858  * Reset value: 0x00U
18859  */
18860 /*!
18861  * @name Constants and macros for entire UART_C4 register
18862  */
18863 /*@{*/
18864 #define UART_RD_C4(base) (UART_C4_REG(base))
18865 #define UART_WR_C4(base, value) (UART_C4_REG(base) = (value))
18866 #define UART_RMW_C4(base, mask, value) (UART_WR_C4(base, (UART_RD_C4(base) & ~(mask)) | (value)))
18867 #define UART_SET_C4(base, value) (BME_OR8(&UART_C4_REG(base), (uint8_t)(value)))
18868 #define UART_CLR_C4(base, value) (BME_AND8(&UART_C4_REG(base), (uint8_t)(~(value))))
18869 #define UART_TOG_C4(base, value) (BME_XOR8(&UART_C4_REG(base), (uint8_t)(value)))
18870 /*@}*/
18871 
18872 /*
18873  * Constants & macros for individual UART_C4 bitfields
18874  */
18875 
18876 /*!
18877  * @name Register UART_C4, field RDMAS[5] (RW)
18878  *
18879  * RDMAS configures the receiver data register full flag, RDRF, to generate
18880  * interrupt or DMA requests if RIE is set. If RIE is cleared, the RDRF DMA and RDRF
18881  * interrupt request signals are not asserted when the RDRF flag is set,
18882  * regardless of the state of RDMAS.
18883  *
18884  * Values:
18885  * - 0b0 - If RIE is set and the RDRF flag is set, the RDRF interrupt request
18886  * signal is asserted to request interrupt service.
18887  * - 0b1 - If RIE is set and the RDRF flag is set, the RDRF DMA request signal
18888  * is asserted to request a DMA transfer.
18889  */
18890 /*@{*/
18891 /*! @brief Read current value of the UART_C4_RDMAS field. */
18892 #define UART_RD_C4_RDMAS(base) ((UART_C4_REG(base) & UART_C4_RDMAS_MASK) >> UART_C4_RDMAS_SHIFT)
18893 #define UART_BRD_C4_RDMAS(base) (BME_UBFX8(&UART_C4_REG(base), UART_C4_RDMAS_SHIFT, UART_C4_RDMAS_WIDTH))
18894 
18895 /*! @brief Set the RDMAS field to a new value. */
18896 #define UART_WR_C4_RDMAS(base, value) (UART_RMW_C4(base, UART_C4_RDMAS_MASK, UART_C4_RDMAS(value)))
18897 #define UART_BWR_C4_RDMAS(base, value) (BME_BFI8(&UART_C4_REG(base), ((uint8_t)(value) << UART_C4_RDMAS_SHIFT), UART_C4_RDMAS_SHIFT, UART_C4_RDMAS_WIDTH))
18898 /*@}*/
18899 
18900 /*!
18901  * @name Register UART_C4, field TDMAS[7] (RW)
18902  *
18903  * TDMAS configures the transmit data register empty flag, TDRE, to generate
18904  * interrupt or DMA requests if TIE is set. If UART_C2[TIE] is cleared, TDRE DMA and
18905  * TDRE interrupt request signals are not asserted when the TDRE flag is set,
18906  * regardless of the state of TDMAS. If UART_C2[TIE] and TDMAS are both set, then
18907  * UART_C2[TCIE] must be cleared, and UART_D must not be written outside of
18908  * servicing of a DMA request.
18909  *
18910  * Values:
18911  * - 0b0 - If TIE is set and the TDRE flag is set, the TDRE interrupt request
18912  * signal is asserted to request interrupt service.
18913  * - 0b1 - If TIE is set and the TDRE flag is set, the TDRE DMA request signal
18914  * is asserted to request a DMA transfer.
18915  */
18916 /*@{*/
18917 /*! @brief Read current value of the UART_C4_TDMAS field. */
18918 #define UART_RD_C4_TDMAS(base) ((UART_C4_REG(base) & UART_C4_TDMAS_MASK) >> UART_C4_TDMAS_SHIFT)
18919 #define UART_BRD_C4_TDMAS(base) (BME_UBFX8(&UART_C4_REG(base), UART_C4_TDMAS_SHIFT, UART_C4_TDMAS_WIDTH))
18920 
18921 /*! @brief Set the TDMAS field to a new value. */
18922 #define UART_WR_C4_TDMAS(base, value) (UART_RMW_C4(base, UART_C4_TDMAS_MASK, UART_C4_TDMAS(value)))
18923 #define UART_BWR_C4_TDMAS(base, value) (BME_BFI8(&UART_C4_REG(base), ((uint8_t)(value) << UART_C4_TDMAS_SHIFT), UART_C4_TDMAS_SHIFT, UART_C4_TDMAS_WIDTH))
18924 /*@}*/
18925 
18926 /*
18927  * MKL25Z4 UART0
18928  *
18929  * Universal Asynchronous Receiver/Transmitter
18930  *
18931  * Registers defined in this header file:
18932  * - UART0_BDH - UART Baud Rate Register High
18933  * - UART0_BDL - UART Baud Rate Register Low
18934  * - UART0_C1 - UART Control Register 1
18935  * - UART0_C2 - UART Control Register 2
18936  * - UART0_S1 - UART Status Register 1
18937  * - UART0_S2 - UART Status Register 2
18938  * - UART0_C3 - UART Control Register 3
18939  * - UART0_D - UART Data Register
18940  * - UART0_MA1 - UART Match Address Registers 1
18941  * - UART0_MA2 - UART Match Address Registers 2
18942  * - UART0_C4 - UART Control Register 4
18943  * - UART0_C5 - UART Control Register 5
18944  */
18945 
18946 #define UART0_INSTANCE_COUNT (1U) /*!< Number of instances of the UART0 module. */
18947 #define UART0_IDX (0U) /*!< Instance number for UART0. */
18948 
18949 /*******************************************************************************
18950  * UART0_BDH - UART Baud Rate Register High
18951  ******************************************************************************/
18952 
18953 /*!
18954  * @brief UART0_BDH - UART Baud Rate Register High (RW)
18955  *
18956  * Reset value: 0x00U
18957  *
18958  * This register, along with UART _BDL, controls the prescale divisor for UART
18959  * baud rate generation. The 13-bit baud rate setting [SBR12:SBR0] should only be
18960  * updated when the transmitter and receiver are both disabled.
18961  */
18962 /*!
18963  * @name Constants and macros for entire UART0_BDH register
18964  */
18965 /*@{*/
18966 #define UART0_RD_BDH(base) (UART0_BDH_REG(base))
18967 #define UART0_WR_BDH(base, value) (UART0_BDH_REG(base) = (value))
18968 #define UART0_RMW_BDH(base, mask, value) (UART0_WR_BDH(base, (UART0_RD_BDH(base) & ~(mask)) | (value)))
18969 #define UART0_SET_BDH(base, value) (BME_OR8(&UART0_BDH_REG(base), (uint8_t)(value)))
18970 #define UART0_CLR_BDH(base, value) (BME_AND8(&UART0_BDH_REG(base), (uint8_t)(~(value))))
18971 #define UART0_TOG_BDH(base, value) (BME_XOR8(&UART0_BDH_REG(base), (uint8_t)(value)))
18972 /*@}*/
18973 
18974 /*
18975  * Constants & macros for individual UART0_BDH bitfields
18976  */
18977 
18978 /*!
18979  * @name Register UART0_BDH, field SBR[4:0] (RW)
18980  *
18981  * The 13 bits in SBR[12:0] are referred to collectively as BR, and they set the
18982  * modulo divide rate for the baud rate generator. When BR is 1 - 8191, the baud
18983  * rate equals baud clock / ((OSR+1) * BR).
18984  */
18985 /*@{*/
18986 /*! @brief Read current value of the UART0_BDH_SBR field. */
18987 #define UART0_RD_BDH_SBR(base) ((UART0_BDH_REG(base) & UART0_BDH_SBR_MASK) >> UART0_BDH_SBR_SHIFT)
18988 #define UART0_BRD_BDH_SBR(base) (BME_UBFX8(&UART0_BDH_REG(base), UART0_BDH_SBR_SHIFT, UART0_BDH_SBR_WIDTH))
18989 
18990 /*! @brief Set the SBR field to a new value. */
18991 #define UART0_WR_BDH_SBR(base, value) (UART0_RMW_BDH(base, UART0_BDH_SBR_MASK, UART0_BDH_SBR(value)))
18992 #define UART0_BWR_BDH_SBR(base, value) (BME_BFI8(&UART0_BDH_REG(base), ((uint8_t)(value) << UART0_BDH_SBR_SHIFT), UART0_BDH_SBR_SHIFT, UART0_BDH_SBR_WIDTH))
18993 /*@}*/
18994 
18995 /*!
18996  * @name Register UART0_BDH, field SBNS[5] (RW)
18997  *
18998  * SBNS determines whether data characters are one or two stop bits. This bit
18999  * should only be changed when the transmitter and receiver are both disabled.
19000  *
19001  * Values:
19002  * - 0b0 - One stop bit.
19003  * - 0b1 - Two stop bit.
19004  */
19005 /*@{*/
19006 /*! @brief Read current value of the UART0_BDH_SBNS field. */
19007 #define UART0_RD_BDH_SBNS(base) ((UART0_BDH_REG(base) & UART0_BDH_SBNS_MASK) >> UART0_BDH_SBNS_SHIFT)
19008 #define UART0_BRD_BDH_SBNS(base) (BME_UBFX8(&UART0_BDH_REG(base), UART0_BDH_SBNS_SHIFT, UART0_BDH_SBNS_WIDTH))
19009 
19010 /*! @brief Set the SBNS field to a new value. */
19011 #define UART0_WR_BDH_SBNS(base, value) (UART0_RMW_BDH(base, UART0_BDH_SBNS_MASK, UART0_BDH_SBNS(value)))
19012 #define UART0_BWR_BDH_SBNS(base, value) (BME_BFI8(&UART0_BDH_REG(base), ((uint8_t)(value) << UART0_BDH_SBNS_SHIFT), UART0_BDH_SBNS_SHIFT, UART0_BDH_SBNS_WIDTH))
19013 /*@}*/
19014 
19015 /*!
19016  * @name Register UART0_BDH, field RXEDGIE[6] (RW)
19017  *
19018  * Values:
19019  * - 0b0 - Hardware interrupts from UART _S2[RXEDGIF] disabled (use polling).
19020  * - 0b1 - Hardware interrupt requested when UART _S2[RXEDGIF] flag is 1.
19021  */
19022 /*@{*/
19023 /*! @brief Read current value of the UART0_BDH_RXEDGIE field. */
19024 #define UART0_RD_BDH_RXEDGIE(base) ((UART0_BDH_REG(base) & UART0_BDH_RXEDGIE_MASK) >> UART0_BDH_RXEDGIE_SHIFT)
19025 #define UART0_BRD_BDH_RXEDGIE(base) (BME_UBFX8(&UART0_BDH_REG(base), UART0_BDH_RXEDGIE_SHIFT, UART0_BDH_RXEDGIE_WIDTH))
19026 
19027 /*! @brief Set the RXEDGIE field to a new value. */
19028 #define UART0_WR_BDH_RXEDGIE(base, value) (UART0_RMW_BDH(base, UART0_BDH_RXEDGIE_MASK, UART0_BDH_RXEDGIE(value)))
19029 #define UART0_BWR_BDH_RXEDGIE(base, value) (BME_BFI8(&UART0_BDH_REG(base), ((uint8_t)(value) << UART0_BDH_RXEDGIE_SHIFT), UART0_BDH_RXEDGIE_SHIFT, UART0_BDH_RXEDGIE_WIDTH))
19030 /*@}*/
19031 
19032 /*!
19033  * @name Register UART0_BDH, field LBKDIE[7] (RW)
19034  *
19035  * Values:
19036  * - 0b0 - Hardware interrupts from UART _S2[LBKDIF] disabled (use polling).
19037  * - 0b1 - Hardware interrupt requested when UART _S2[LBKDIF] flag is 1.
19038  */
19039 /*@{*/
19040 /*! @brief Read current value of the UART0_BDH_LBKDIE field. */
19041 #define UART0_RD_BDH_LBKDIE(base) ((UART0_BDH_REG(base) & UART0_BDH_LBKDIE_MASK) >> UART0_BDH_LBKDIE_SHIFT)
19042 #define UART0_BRD_BDH_LBKDIE(base) (BME_UBFX8(&UART0_BDH_REG(base), UART0_BDH_LBKDIE_SHIFT, UART0_BDH_LBKDIE_WIDTH))
19043 
19044 /*! @brief Set the LBKDIE field to a new value. */
19045 #define UART0_WR_BDH_LBKDIE(base, value) (UART0_RMW_BDH(base, UART0_BDH_LBKDIE_MASK, UART0_BDH_LBKDIE(value)))
19046 #define UART0_BWR_BDH_LBKDIE(base, value) (BME_BFI8(&UART0_BDH_REG(base), ((uint8_t)(value) << UART0_BDH_LBKDIE_SHIFT), UART0_BDH_LBKDIE_SHIFT, UART0_BDH_LBKDIE_WIDTH))
19047 /*@}*/
19048 
19049 /*******************************************************************************
19050  * UART0_BDL - UART Baud Rate Register Low
19051  ******************************************************************************/
19052 
19053 /*!
19054  * @brief UART0_BDL - UART Baud Rate Register Low (RW)
19055  *
19056  * Reset value: 0x04U
19057  *
19058  * This register, along with UART _BDH, control the prescale divisor for UART
19059  * baud rate generation. The 13-bit baud rate setting [SBR12:SBR0] can only be
19060  * updated when the transmitter and receiver are both disabled. UART _BDL is reset to
19061  * a non-zero value, so after reset the baud rate generator remains disabled
19062  * until the first time the receiver or transmitter is enabled; that is, UART
19063  * _C2[RE] or UART _C2[TE] bits are written to 1.
19064  */
19065 /*!
19066  * @name Constants and macros for entire UART0_BDL register
19067  */
19068 /*@{*/
19069 #define UART0_RD_BDL(base) (UART0_BDL_REG(base))
19070 #define UART0_WR_BDL(base, value) (UART0_BDL_REG(base) = (value))
19071 #define UART0_RMW_BDL(base, mask, value) (UART0_WR_BDL(base, (UART0_RD_BDL(base) & ~(mask)) | (value)))
19072 #define UART0_SET_BDL(base, value) (BME_OR8(&UART0_BDL_REG(base), (uint8_t)(value)))
19073 #define UART0_CLR_BDL(base, value) (BME_AND8(&UART0_BDL_REG(base), (uint8_t)(~(value))))
19074 #define UART0_TOG_BDL(base, value) (BME_XOR8(&UART0_BDL_REG(base), (uint8_t)(value)))
19075 /*@}*/
19076 
19077 /*******************************************************************************
19078  * UART0_C1 - UART Control Register 1
19079  ******************************************************************************/
19080 
19081 /*!
19082  * @brief UART0_C1 - UART Control Register 1 (RW)
19083  *
19084  * Reset value: 0x00U
19085  *
19086  * This read/write register controls various optional features of the UART
19087  * system. This register should only be altered when the transmitter and receiver are
19088  * both disabled.
19089  */
19090 /*!
19091  * @name Constants and macros for entire UART0_C1 register
19092  */
19093 /*@{*/
19094 #define UART0_RD_C1(base) (UART0_C1_REG(base))
19095 #define UART0_WR_C1(base, value) (UART0_C1_REG(base) = (value))
19096 #define UART0_RMW_C1(base, mask, value) (UART0_WR_C1(base, (UART0_RD_C1(base) & ~(mask)) | (value)))
19097 #define UART0_SET_C1(base, value) (BME_OR8(&UART0_C1_REG(base), (uint8_t)(value)))
19098 #define UART0_CLR_C1(base, value) (BME_AND8(&UART0_C1_REG(base), (uint8_t)(~(value))))
19099 #define UART0_TOG_C1(base, value) (BME_XOR8(&UART0_C1_REG(base), (uint8_t)(value)))
19100 /*@}*/
19101 
19102 /*
19103  * Constants & macros for individual UART0_C1 bitfields
19104  */
19105 
19106 /*!
19107  * @name Register UART0_C1, field PT[0] (RW)
19108  *
19109  * Provided parity is enabled (PE = 1), this bit selects even or odd parity. Odd
19110  * parity means the total number of 1s in the data character, including the
19111  * parity bit, is odd. Even parity means the total number of 1s in the data
19112  * character, including the parity bit, is even.
19113  *
19114  * Values:
19115  * - 0b0 - Even parity.
19116  * - 0b1 - Odd parity.
19117  */
19118 /*@{*/
19119 /*! @brief Read current value of the UART0_C1_PT field. */
19120 #define UART0_RD_C1_PT(base) ((UART0_C1_REG(base) & UART0_C1_PT_MASK) >> UART0_C1_PT_SHIFT)
19121 #define UART0_BRD_C1_PT(base) (BME_UBFX8(&UART0_C1_REG(base), UART0_C1_PT_SHIFT, UART0_C1_PT_WIDTH))
19122 
19123 /*! @brief Set the PT field to a new value. */
19124 #define UART0_WR_C1_PT(base, value) (UART0_RMW_C1(base, UART0_C1_PT_MASK, UART0_C1_PT(value)))
19125 #define UART0_BWR_C1_PT(base, value) (BME_BFI8(&UART0_C1_REG(base), ((uint8_t)(value) << UART0_C1_PT_SHIFT), UART0_C1_PT_SHIFT, UART0_C1_PT_WIDTH))
19126 /*@}*/
19127 
19128 /*!
19129  * @name Register UART0_C1, field PE[1] (RW)
19130  *
19131  * Enables hardware parity generation and checking. When parity is enabled, the
19132  * bit immediately before the stop bit is treated as the parity bit.
19133  *
19134  * Values:
19135  * - 0b0 - No hardware parity generation or checking.
19136  * - 0b1 - Parity enabled.
19137  */
19138 /*@{*/
19139 /*! @brief Read current value of the UART0_C1_PE field. */
19140 #define UART0_RD_C1_PE(base) ((UART0_C1_REG(base) & UART0_C1_PE_MASK) >> UART0_C1_PE_SHIFT)
19141 #define UART0_BRD_C1_PE(base) (BME_UBFX8(&UART0_C1_REG(base), UART0_C1_PE_SHIFT, UART0_C1_PE_WIDTH))
19142 
19143 /*! @brief Set the PE field to a new value. */
19144 #define UART0_WR_C1_PE(base, value) (UART0_RMW_C1(base, UART0_C1_PE_MASK, UART0_C1_PE(value)))
19145 #define UART0_BWR_C1_PE(base, value) (BME_BFI8(&UART0_C1_REG(base), ((uint8_t)(value) << UART0_C1_PE_SHIFT), UART0_C1_PE_SHIFT, UART0_C1_PE_WIDTH))
19146 /*@}*/
19147 
19148 /*!
19149  * @name Register UART0_C1, field ILT[2] (RW)
19150  *
19151  * Setting this bit to 1 ensures that the stop bits and logic 1 bits at the end
19152  * of a character do not count toward the 10 to 13 bit times of logic high level
19153  * needed by the idle line detection logic.
19154  *
19155  * Values:
19156  * - 0b0 - Idle character bit count starts after start bit.
19157  * - 0b1 - Idle character bit count starts after stop bit.
19158  */
19159 /*@{*/
19160 /*! @brief Read current value of the UART0_C1_ILT field. */
19161 #define UART0_RD_C1_ILT(base) ((UART0_C1_REG(base) & UART0_C1_ILT_MASK) >> UART0_C1_ILT_SHIFT)
19162 #define UART0_BRD_C1_ILT(base) (BME_UBFX8(&UART0_C1_REG(base), UART0_C1_ILT_SHIFT, UART0_C1_ILT_WIDTH))
19163 
19164 /*! @brief Set the ILT field to a new value. */
19165 #define UART0_WR_C1_ILT(base, value) (UART0_RMW_C1(base, UART0_C1_ILT_MASK, UART0_C1_ILT(value)))
19166 #define UART0_BWR_C1_ILT(base, value) (BME_BFI8(&UART0_C1_REG(base), ((uint8_t)(value) << UART0_C1_ILT_SHIFT), UART0_C1_ILT_SHIFT, UART0_C1_ILT_WIDTH))
19167 /*@}*/
19168 
19169 /*!
19170  * @name Register UART0_C1, field WAKE[3] (RW)
19171  *
19172  * Values:
19173  * - 0b0 - Idle-line wakeup.
19174  * - 0b1 - Address-mark wakeup.
19175  */
19176 /*@{*/
19177 /*! @brief Read current value of the UART0_C1_WAKE field. */
19178 #define UART0_RD_C1_WAKE(base) ((UART0_C1_REG(base) & UART0_C1_WAKE_MASK) >> UART0_C1_WAKE_SHIFT)
19179 #define UART0_BRD_C1_WAKE(base) (BME_UBFX8(&UART0_C1_REG(base), UART0_C1_WAKE_SHIFT, UART0_C1_WAKE_WIDTH))
19180 
19181 /*! @brief Set the WAKE field to a new value. */
19182 #define UART0_WR_C1_WAKE(base, value) (UART0_RMW_C1(base, UART0_C1_WAKE_MASK, UART0_C1_WAKE(value)))
19183 #define UART0_BWR_C1_WAKE(base, value) (BME_BFI8(&UART0_C1_REG(base), ((uint8_t)(value) << UART0_C1_WAKE_SHIFT), UART0_C1_WAKE_SHIFT, UART0_C1_WAKE_WIDTH))
19184 /*@}*/
19185 
19186 /*!
19187  * @name Register UART0_C1, field M[4] (RW)
19188  *
19189  * Values:
19190  * - 0b0 - Receiver and transmitter use 8-bit data characters.
19191  * - 0b1 - Receiver and transmitter use 9-bit data characters.
19192  */
19193 /*@{*/
19194 /*! @brief Read current value of the UART0_C1_M field. */
19195 #define UART0_RD_C1_M(base) ((UART0_C1_REG(base) & UART0_C1_M_MASK) >> UART0_C1_M_SHIFT)
19196 #define UART0_BRD_C1_M(base) (BME_UBFX8(&UART0_C1_REG(base), UART0_C1_M_SHIFT, UART0_C1_M_WIDTH))
19197 
19198 /*! @brief Set the M field to a new value. */
19199 #define UART0_WR_C1_M(base, value) (UART0_RMW_C1(base, UART0_C1_M_MASK, UART0_C1_M(value)))
19200 #define UART0_BWR_C1_M(base, value) (BME_BFI8(&UART0_C1_REG(base), ((uint8_t)(value) << UART0_C1_M_SHIFT), UART0_C1_M_SHIFT, UART0_C1_M_WIDTH))
19201 /*@}*/
19202 
19203 /*!
19204  * @name Register UART0_C1, field RSRC[5] (RW)
19205  *
19206  * This bit has no meaning or effect unless the LOOPS bit is set to 1. When
19207  * LOOPS is set, the receiver input is internally connected to the UART _TX pin and
19208  * RSRC determines whether this connection is also connected to the transmitter
19209  * output.
19210  *
19211  * Values:
19212  * - 0b0 - Provided LOOPS is set, RSRC is cleared, selects internal loop back
19213  * mode and the UART does not use the UART _RX pins.
19214  * - 0b1 - Single-wire UART mode where the UART _TX pin is connected to the
19215  * transmitter output and receiver input.
19216  */
19217 /*@{*/
19218 /*! @brief Read current value of the UART0_C1_RSRC field. */
19219 #define UART0_RD_C1_RSRC(base) ((UART0_C1_REG(base) & UART0_C1_RSRC_MASK) >> UART0_C1_RSRC_SHIFT)
19220 #define UART0_BRD_C1_RSRC(base) (BME_UBFX8(&UART0_C1_REG(base), UART0_C1_RSRC_SHIFT, UART0_C1_RSRC_WIDTH))
19221 
19222 /*! @brief Set the RSRC field to a new value. */
19223 #define UART0_WR_C1_RSRC(base, value) (UART0_RMW_C1(base, UART0_C1_RSRC_MASK, UART0_C1_RSRC(value)))
19224 #define UART0_BWR_C1_RSRC(base, value) (BME_BFI8(&UART0_C1_REG(base), ((uint8_t)(value) << UART0_C1_RSRC_SHIFT), UART0_C1_RSRC_SHIFT, UART0_C1_RSRC_WIDTH))
19225 /*@}*/
19226 
19227 /*!
19228  * @name Register UART0_C1, field DOZEEN[6] (RW)
19229  *
19230  * Values:
19231  * - 0b0 - UART is enabled in Wait mode.
19232  * - 0b1 - UART is disabled in Wait mode.
19233  */
19234 /*@{*/
19235 /*! @brief Read current value of the UART0_C1_DOZEEN field. */
19236 #define UART0_RD_C1_DOZEEN(base) ((UART0_C1_REG(base) & UART0_C1_DOZEEN_MASK) >> UART0_C1_DOZEEN_SHIFT)
19237 #define UART0_BRD_C1_DOZEEN(base) (BME_UBFX8(&UART0_C1_REG(base), UART0_C1_DOZEEN_SHIFT, UART0_C1_DOZEEN_WIDTH))
19238 
19239 /*! @brief Set the DOZEEN field to a new value. */
19240 #define UART0_WR_C1_DOZEEN(base, value) (UART0_RMW_C1(base, UART0_C1_DOZEEN_MASK, UART0_C1_DOZEEN(value)))
19241 #define UART0_BWR_C1_DOZEEN(base, value) (BME_BFI8(&UART0_C1_REG(base), ((uint8_t)(value) << UART0_C1_DOZEEN_SHIFT), UART0_C1_DOZEEN_SHIFT, UART0_C1_DOZEEN_WIDTH))
19242 /*@}*/
19243 
19244 /*!
19245  * @name Register UART0_C1, field LOOPS[7] (RW)
19246  *
19247  * Selects between loop back modes and normal 2-pin full-duplex modes. When
19248  * LOOPS is set, the transmitter output is internally connected to the receiver input.
19249  *
19250  * Values:
19251  * - 0b0 - Normal operation - UART _RX and UART _TX use separate pins.
19252  * - 0b1 - Loop mode or single-wire mode where transmitter outputs are
19253  * internally connected to receiver input. (See RSRC bit.) UART _RX pin is not used by
19254  * UART .
19255  */
19256 /*@{*/
19257 /*! @brief Read current value of the UART0_C1_LOOPS field. */
19258 #define UART0_RD_C1_LOOPS(base) ((UART0_C1_REG(base) & UART0_C1_LOOPS_MASK) >> UART0_C1_LOOPS_SHIFT)
19259 #define UART0_BRD_C1_LOOPS(base) (BME_UBFX8(&UART0_C1_REG(base), UART0_C1_LOOPS_SHIFT, UART0_C1_LOOPS_WIDTH))
19260 
19261 /*! @brief Set the LOOPS field to a new value. */
19262 #define UART0_WR_C1_LOOPS(base, value) (UART0_RMW_C1(base, UART0_C1_LOOPS_MASK, UART0_C1_LOOPS(value)))
19263 #define UART0_BWR_C1_LOOPS(base, value) (BME_BFI8(&UART0_C1_REG(base), ((uint8_t)(value) << UART0_C1_LOOPS_SHIFT), UART0_C1_LOOPS_SHIFT, UART0_C1_LOOPS_WIDTH))
19264 /*@}*/
19265 
19266 /*******************************************************************************
19267  * UART0_C2 - UART Control Register 2
19268  ******************************************************************************/
19269 
19270 /*!
19271  * @brief UART0_C2 - UART Control Register 2 (RW)
19272  *
19273  * Reset value: 0x00U
19274  *
19275  * This register can be read or written at any time.
19276  */
19277 /*!
19278  * @name Constants and macros for entire UART0_C2 register
19279  */
19280 /*@{*/
19281 #define UART0_RD_C2(base) (UART0_C2_REG(base))
19282 #define UART0_WR_C2(base, value) (UART0_C2_REG(base) = (value))
19283 #define UART0_RMW_C2(base, mask, value) (UART0_WR_C2(base, (UART0_RD_C2(base) & ~(mask)) | (value)))
19284 #define UART0_SET_C2(base, value) (BME_OR8(&UART0_C2_REG(base), (uint8_t)(value)))
19285 #define UART0_CLR_C2(base, value) (BME_AND8(&UART0_C2_REG(base), (uint8_t)(~(value))))
19286 #define UART0_TOG_C2(base, value) (BME_XOR8(&UART0_C2_REG(base), (uint8_t)(value)))
19287 /*@}*/
19288 
19289 /*
19290  * Constants & macros for individual UART0_C2 bitfields
19291  */
19292 
19293 /*!
19294  * @name Register UART0_C2, field SBK[0] (RW)
19295  *
19296  * Writing a 1 and then a 0 to SBK queues a break character in the transmit data
19297  * stream. Additional break characters of 10 to 13, or 13 to 16 if BRK13 = 1,
19298  * bit times of logic 0 are queued as long as SBK is set. Depending on the timing
19299  * of the set and clear of SBK relative to the information currently being
19300  * transmitted, a second break character may be queued before software clears SBK.
19301  *
19302  * Values:
19303  * - 0b0 - Normal transmitter operation.
19304  * - 0b1 - Queue break character(s) to be sent.
19305  */
19306 /*@{*/
19307 /*! @brief Read current value of the UART0_C2_SBK field. */
19308 #define UART0_RD_C2_SBK(base) ((UART0_C2_REG(base) & UART0_C2_SBK_MASK) >> UART0_C2_SBK_SHIFT)
19309 #define UART0_BRD_C2_SBK(base) (BME_UBFX8(&UART0_C2_REG(base), UART0_C2_SBK_SHIFT, UART0_C2_SBK_WIDTH))
19310 
19311 /*! @brief Set the SBK field to a new value. */
19312 #define UART0_WR_C2_SBK(base, value) (UART0_RMW_C2(base, UART0_C2_SBK_MASK, UART0_C2_SBK(value)))
19313 #define UART0_BWR_C2_SBK(base, value) (BME_BFI8(&UART0_C2_REG(base), ((uint8_t)(value) << UART0_C2_SBK_SHIFT), UART0_C2_SBK_SHIFT, UART0_C2_SBK_WIDTH))
19314 /*@}*/
19315 
19316 /*!
19317  * @name Register UART0_C2, field RWU[1] (RW)
19318  *
19319  * This bit can be written to 1 to place the UART receiver in a standby state
19320  * where it waits for automatic hardware detection of a selected wakeup condition.
19321  * The wakeup condition is an idle line between messages, WAKE = 0, idle-line
19322  * wakeup, or a logic 1 in the most significant data bit in a character, WAKE = 1,
19323  * address-mark wakeup. Application software sets RWU and, normally, a selected
19324  * hardware condition automatically clears RWU.
19325  *
19326  * Values:
19327  * - 0b0 - Normal UART receiver operation.
19328  * - 0b1 - UART receiver in standby waiting for wakeup condition.
19329  */
19330 /*@{*/
19331 /*! @brief Read current value of the UART0_C2_RWU field. */
19332 #define UART0_RD_C2_RWU(base) ((UART0_C2_REG(base) & UART0_C2_RWU_MASK) >> UART0_C2_RWU_SHIFT)
19333 #define UART0_BRD_C2_RWU(base) (BME_UBFX8(&UART0_C2_REG(base), UART0_C2_RWU_SHIFT, UART0_C2_RWU_WIDTH))
19334 
19335 /*! @brief Set the RWU field to a new value. */
19336 #define UART0_WR_C2_RWU(base, value) (UART0_RMW_C2(base, UART0_C2_RWU_MASK, UART0_C2_RWU(value)))
19337 #define UART0_BWR_C2_RWU(base, value) (BME_BFI8(&UART0_C2_REG(base), ((uint8_t)(value) << UART0_C2_RWU_SHIFT), UART0_C2_RWU_SHIFT, UART0_C2_RWU_WIDTH))
19338 /*@}*/
19339 
19340 /*!
19341  * @name Register UART0_C2, field RE[2] (RW)
19342  *
19343  * When the UART receiver is off or LOOPS is set, the UART _RX pin is not used
19344  * by the UART . When RE is written to 0, the receiver finishes receiving the
19345  * current character (if any).
19346  *
19347  * Values:
19348  * - 0b0 - Receiver disabled.
19349  * - 0b1 - Receiver enabled.
19350  */
19351 /*@{*/
19352 /*! @brief Read current value of the UART0_C2_RE field. */
19353 #define UART0_RD_C2_RE(base) ((UART0_C2_REG(base) & UART0_C2_RE_MASK) >> UART0_C2_RE_SHIFT)
19354 #define UART0_BRD_C2_RE(base) (BME_UBFX8(&UART0_C2_REG(base), UART0_C2_RE_SHIFT, UART0_C2_RE_WIDTH))
19355 
19356 /*! @brief Set the RE field to a new value. */
19357 #define UART0_WR_C2_RE(base, value) (UART0_RMW_C2(base, UART0_C2_RE_MASK, UART0_C2_RE(value)))
19358 #define UART0_BWR_C2_RE(base, value) (BME_BFI8(&UART0_C2_REG(base), ((uint8_t)(value) << UART0_C2_RE_SHIFT), UART0_C2_RE_SHIFT, UART0_C2_RE_WIDTH))
19359 /*@}*/
19360 
19361 /*!
19362  * @name Register UART0_C2, field TE[3] (RW)
19363  *
19364  * TE must be 1 to use the UART transmitter. When TE is set, the UART forces the
19365  * UART _TX pin to act as an output for the UART system. When the UART is
19366  * configured for single-wire operation (LOOPS = RSRC = 1), TXDIR controls the
19367  * direction of traffic on the single UART communication line ( UART _TX pin). TE can
19368  * also queue an idle character by clearing TE then setting TE while a transmission
19369  * is in progress. When TE is written to 0, the transmitter keeps control of the
19370  * port UART _TX pin until any data, queued idle, or queued break character
19371  * finishes transmitting before allowing the pin to tristate.
19372  *
19373  * Values:
19374  * - 0b0 - Transmitter disabled.
19375  * - 0b1 - Transmitter enabled.
19376  */
19377 /*@{*/
19378 /*! @brief Read current value of the UART0_C2_TE field. */
19379 #define UART0_RD_C2_TE(base) ((UART0_C2_REG(base) & UART0_C2_TE_MASK) >> UART0_C2_TE_SHIFT)
19380 #define UART0_BRD_C2_TE(base) (BME_UBFX8(&UART0_C2_REG(base), UART0_C2_TE_SHIFT, UART0_C2_TE_WIDTH))
19381 
19382 /*! @brief Set the TE field to a new value. */
19383 #define UART0_WR_C2_TE(base, value) (UART0_RMW_C2(base, UART0_C2_TE_MASK, UART0_C2_TE(value)))
19384 #define UART0_BWR_C2_TE(base, value) (BME_BFI8(&UART0_C2_REG(base), ((uint8_t)(value) << UART0_C2_TE_SHIFT), UART0_C2_TE_SHIFT, UART0_C2_TE_WIDTH))
19385 /*@}*/
19386 
19387 /*!
19388  * @name Register UART0_C2, field ILIE[4] (RW)
19389  *
19390  * Values:
19391  * - 0b0 - Hardware interrupts from IDLE disabled; use polling.
19392  * - 0b1 - Hardware interrupt requested when IDLE flag is 1.
19393  */
19394 /*@{*/
19395 /*! @brief Read current value of the UART0_C2_ILIE field. */
19396 #define UART0_RD_C2_ILIE(base) ((UART0_C2_REG(base) & UART0_C2_ILIE_MASK) >> UART0_C2_ILIE_SHIFT)
19397 #define UART0_BRD_C2_ILIE(base) (BME_UBFX8(&UART0_C2_REG(base), UART0_C2_ILIE_SHIFT, UART0_C2_ILIE_WIDTH))
19398 
19399 /*! @brief Set the ILIE field to a new value. */
19400 #define UART0_WR_C2_ILIE(base, value) (UART0_RMW_C2(base, UART0_C2_ILIE_MASK, UART0_C2_ILIE(value)))
19401 #define UART0_BWR_C2_ILIE(base, value) (BME_BFI8(&UART0_C2_REG(base), ((uint8_t)(value) << UART0_C2_ILIE_SHIFT), UART0_C2_ILIE_SHIFT, UART0_C2_ILIE_WIDTH))
19402 /*@}*/
19403 
19404 /*!
19405  * @name Register UART0_C2, field RIE[5] (RW)
19406  *
19407  * Values:
19408  * - 0b0 - Hardware interrupts from RDRF disabled; use polling.
19409  * - 0b1 - Hardware interrupt requested when RDRF flag is 1.
19410  */
19411 /*@{*/
19412 /*! @brief Read current value of the UART0_C2_RIE field. */
19413 #define UART0_RD_C2_RIE(base) ((UART0_C2_REG(base) & UART0_C2_RIE_MASK) >> UART0_C2_RIE_SHIFT)
19414 #define UART0_BRD_C2_RIE(base) (BME_UBFX8(&UART0_C2_REG(base), UART0_C2_RIE_SHIFT, UART0_C2_RIE_WIDTH))
19415 
19416 /*! @brief Set the RIE field to a new value. */
19417 #define UART0_WR_C2_RIE(base, value) (UART0_RMW_C2(base, UART0_C2_RIE_MASK, UART0_C2_RIE(value)))
19418 #define UART0_BWR_C2_RIE(base, value) (BME_BFI8(&UART0_C2_REG(base), ((uint8_t)(value) << UART0_C2_RIE_SHIFT), UART0_C2_RIE_SHIFT, UART0_C2_RIE_WIDTH))
19419 /*@}*/
19420 
19421 /*!
19422  * @name Register UART0_C2, field TCIE[6] (RW)
19423  *
19424  * Values:
19425  * - 0b0 - Hardware interrupts from TC disabled; use polling.
19426  * - 0b1 - Hardware interrupt requested when TC flag is 1.
19427  */
19428 /*@{*/
19429 /*! @brief Read current value of the UART0_C2_TCIE field. */
19430 #define UART0_RD_C2_TCIE(base) ((UART0_C2_REG(base) & UART0_C2_TCIE_MASK) >> UART0_C2_TCIE_SHIFT)
19431 #define UART0_BRD_C2_TCIE(base) (BME_UBFX8(&UART0_C2_REG(base), UART0_C2_TCIE_SHIFT, UART0_C2_TCIE_WIDTH))
19432 
19433 /*! @brief Set the TCIE field to a new value. */
19434 #define UART0_WR_C2_TCIE(base, value) (UART0_RMW_C2(base, UART0_C2_TCIE_MASK, UART0_C2_TCIE(value)))
19435 #define UART0_BWR_C2_TCIE(base, value) (BME_BFI8(&UART0_C2_REG(base), ((uint8_t)(value) << UART0_C2_TCIE_SHIFT), UART0_C2_TCIE_SHIFT, UART0_C2_TCIE_WIDTH))
19436 /*@}*/
19437 
19438 /*!
19439  * @name Register UART0_C2, field TIE[7] (RW)
19440  *
19441  * Values:
19442  * - 0b0 - Hardware interrupts from TDRE disabled; use polling.
19443  * - 0b1 - Hardware interrupt requested when TDRE flag is 1.
19444  */
19445 /*@{*/
19446 /*! @brief Read current value of the UART0_C2_TIE field. */
19447 #define UART0_RD_C2_TIE(base) ((UART0_C2_REG(base) & UART0_C2_TIE_MASK) >> UART0_C2_TIE_SHIFT)
19448 #define UART0_BRD_C2_TIE(base) (BME_UBFX8(&UART0_C2_REG(base), UART0_C2_TIE_SHIFT, UART0_C2_TIE_WIDTH))
19449 
19450 /*! @brief Set the TIE field to a new value. */
19451 #define UART0_WR_C2_TIE(base, value) (UART0_RMW_C2(base, UART0_C2_TIE_MASK, UART0_C2_TIE(value)))
19452 #define UART0_BWR_C2_TIE(base, value) (BME_BFI8(&UART0_C2_REG(base), ((uint8_t)(value) << UART0_C2_TIE_SHIFT), UART0_C2_TIE_SHIFT, UART0_C2_TIE_WIDTH))
19453 /*@}*/
19454 
19455 /*******************************************************************************
19456  * UART0_S1 - UART Status Register 1
19457  ******************************************************************************/
19458 
19459 /*!
19460  * @brief UART0_S1 - UART Status Register 1 (RW)
19461  *
19462  * Reset value: 0xC0U
19463  */
19464 /*!
19465  * @name Constants and macros for entire UART0_S1 register
19466  */
19467 /*@{*/
19468 #define UART0_RD_S1(base) (UART0_S1_REG(base))
19469 #define UART0_WR_S1(base, value) (UART0_S1_REG(base) = (value))
19470 #define UART0_RMW_S1(base, mask, value) (UART0_WR_S1(base, (UART0_RD_S1(base) & ~(mask)) | (value)))
19471 #define UART0_SET_S1(base, value) (BME_OR8(&UART0_S1_REG(base), (uint8_t)(value)))
19472 #define UART0_CLR_S1(base, value) (BME_AND8(&UART0_S1_REG(base), (uint8_t)(~(value))))
19473 #define UART0_TOG_S1(base, value) (BME_XOR8(&UART0_S1_REG(base), (uint8_t)(value)))
19474 /*@}*/
19475 
19476 /*
19477  * Constants & macros for individual UART0_S1 bitfields
19478  */
19479 
19480 /*!
19481  * @name Register UART0_S1, field PF[0] (W1C)
19482  *
19483  * PF is set at the same time as RDRF when parity is enabled (PE = 1) and the
19484  * parity bit in the received character does not agree with the expected parity
19485  * value. To clear PF, write a logic one to the PF.
19486  *
19487  * Values:
19488  * - 0b0 - No parity error.
19489  * - 0b1 - Parity error.
19490  */
19491 /*@{*/
19492 /*! @brief Read current value of the UART0_S1_PF field. */
19493 #define UART0_RD_S1_PF(base) ((UART0_S1_REG(base) & UART0_S1_PF_MASK) >> UART0_S1_PF_SHIFT)
19494 #define UART0_BRD_S1_PF(base) (BME_UBFX8(&UART0_S1_REG(base), UART0_S1_PF_SHIFT, UART0_S1_PF_WIDTH))
19495 
19496 /*! @brief Set the PF field to a new value. */
19497 #define UART0_WR_S1_PF(base, value) (UART0_RMW_S1(base, (UART0_S1_PF_MASK | UART0_S1_FE_MASK | UART0_S1_NF_MASK | UART0_S1_OR_MASK | UART0_S1_IDLE_MASK), UART0_S1_PF(value)))
19498 #define UART0_BWR_S1_PF(base, value) (BME_BFI8(&UART0_S1_REG(base), ((uint8_t)(value) << UART0_S1_PF_SHIFT), UART0_S1_PF_SHIFT, UART0_S1_PF_WIDTH))
19499 /*@}*/
19500 
19501 /*!
19502  * @name Register UART0_S1, field FE[1] (W1C)
19503  *
19504  * FE is set at the same time as RDRF when the receiver detects a logic 0 where
19505  * a stop bit was expected. This suggests the receiver was not properly aligned
19506  * to a character frame. To clear FE, write a logic one to the FE flag.
19507  *
19508  * Values:
19509  * - 0b0 - No framing error detected. This does not guarantee the framing is
19510  * correct.
19511  * - 0b1 - Framing error.
19512  */
19513 /*@{*/
19514 /*! @brief Read current value of the UART0_S1_FE field. */
19515 #define UART0_RD_S1_FE(base) ((UART0_S1_REG(base) & UART0_S1_FE_MASK) >> UART0_S1_FE_SHIFT)
19516 #define UART0_BRD_S1_FE(base) (BME_UBFX8(&UART0_S1_REG(base), UART0_S1_FE_SHIFT, UART0_S1_FE_WIDTH))
19517 
19518 /*! @brief Set the FE field to a new value. */
19519 #define UART0_WR_S1_FE(base, value) (UART0_RMW_S1(base, (UART0_S1_FE_MASK | UART0_S1_PF_MASK | UART0_S1_NF_MASK | UART0_S1_OR_MASK | UART0_S1_IDLE_MASK), UART0_S1_FE(value)))
19520 #define UART0_BWR_S1_FE(base, value) (BME_BFI8(&UART0_S1_REG(base), ((uint8_t)(value) << UART0_S1_FE_SHIFT), UART0_S1_FE_SHIFT, UART0_S1_FE_WIDTH))
19521 /*@}*/
19522 
19523 /*!
19524  * @name Register UART0_S1, field NF[2] (W1C)
19525  *
19526  * The advanced sampling technique used in the receiver takes three samples in
19527  * each of the received bits. If any of these samples disagrees with the rest of
19528  * the samples within any bit time in the frame, the flag NF is set at the same
19529  * time as RDRF is set for the character. To clear NF, write logic one to the NF.
19530  *
19531  * Values:
19532  * - 0b0 - No noise detected.
19533  * - 0b1 - Noise detected in the received character in UART _D.
19534  */
19535 /*@{*/
19536 /*! @brief Read current value of the UART0_S1_NF field. */
19537 #define UART0_RD_S1_NF(base) ((UART0_S1_REG(base) & UART0_S1_NF_MASK) >> UART0_S1_NF_SHIFT)
19538 #define UART0_BRD_S1_NF(base) (BME_UBFX8(&UART0_S1_REG(base), UART0_S1_NF_SHIFT, UART0_S1_NF_WIDTH))
19539 
19540 /*! @brief Set the NF field to a new value. */
19541 #define UART0_WR_S1_NF(base, value) (UART0_RMW_S1(base, (UART0_S1_NF_MASK | UART0_S1_PF_MASK | UART0_S1_FE_MASK | UART0_S1_OR_MASK | UART0_S1_IDLE_MASK), UART0_S1_NF(value)))
19542 #define UART0_BWR_S1_NF(base, value) (BME_BFI8(&UART0_S1_REG(base), ((uint8_t)(value) << UART0_S1_NF_SHIFT), UART0_S1_NF_SHIFT, UART0_S1_NF_WIDTH))
19543 /*@}*/
19544 
19545 /*!
19546  * @name Register UART0_S1, field OR[3] (W1C)
19547  *
19548  * OR is set when a new serial character is ready to be transferred to the
19549  * receive data buffer, but the previously received character has not been read from
19550  * UART _D yet. In this case, the new character, and all associated error
19551  * information, is lost because there is no room to move it into UART _D. To clear OR,
19552  * write a logic 1 to the OR flag.
19553  *
19554  * Values:
19555  * - 0b0 - No overrun.
19556  * - 0b1 - Receive overrun (new UART data lost).
19557  */
19558 /*@{*/
19559 /*! @brief Read current value of the UART0_S1_OR field. */
19560 #define UART0_RD_S1_OR(base) ((UART0_S1_REG(base) & UART0_S1_OR_MASK) >> UART0_S1_OR_SHIFT)
19561 #define UART0_BRD_S1_OR(base) (BME_UBFX8(&UART0_S1_REG(base), UART0_S1_OR_SHIFT, UART0_S1_OR_WIDTH))
19562 
19563 /*! @brief Set the OR field to a new value. */
19564 #define UART0_WR_S1_OR(base, value) (UART0_RMW_S1(base, (UART0_S1_OR_MASK | UART0_S1_PF_MASK | UART0_S1_FE_MASK | UART0_S1_NF_MASK | UART0_S1_IDLE_MASK), UART0_S1_OR(value)))
19565 #define UART0_BWR_S1_OR(base, value) (BME_BFI8(&UART0_S1_REG(base), ((uint8_t)(value) << UART0_S1_OR_SHIFT), UART0_S1_OR_SHIFT, UART0_S1_OR_WIDTH))
19566 /*@}*/
19567 
19568 /*!
19569  * @name Register UART0_S1, field IDLE[4] (W1C)
19570  *
19571  * IDLE is set when the UART receive line becomes idle for a full character time
19572  * after a period of activity. When ILT is cleared, the receiver starts counting
19573  * idle bit times after the start bit. If the receive character is all 1s, these
19574  * bit times and the stop bits time count toward the full character time of
19575  * logic high, 10 to 13 bit times, needed for the receiver to detect an idle line.
19576  * When ILT is set, the receiver doesn't start counting idle bit times until after
19577  * the stop bits. The stop bits and any logic high bit times at the end of the
19578  * previous character do not count toward the full character time of logic high
19579  * needed for the receiver to detect an idle line. To clear IDLE, write logic 1 to
19580  * the IDLE flag. After IDLE has been cleared, it cannot become set again until
19581  * after a new character has been received and RDRF has been set. IDLE is set only
19582  * once even if the receive line remains idle for an extended period.
19583  *
19584  * Values:
19585  * - 0b0 - No idle line detected.
19586  * - 0b1 - Idle line was detected.
19587  */
19588 /*@{*/
19589 /*! @brief Read current value of the UART0_S1_IDLE field. */
19590 #define UART0_RD_S1_IDLE(base) ((UART0_S1_REG(base) & UART0_S1_IDLE_MASK) >> UART0_S1_IDLE_SHIFT)
19591 #define UART0_BRD_S1_IDLE(base) (BME_UBFX8(&UART0_S1_REG(base), UART0_S1_IDLE_SHIFT, UART0_S1_IDLE_WIDTH))
19592 
19593 /*! @brief Set the IDLE field to a new value. */
19594 #define UART0_WR_S1_IDLE(base, value) (UART0_RMW_S1(base, (UART0_S1_IDLE_MASK | UART0_S1_PF_MASK | UART0_S1_FE_MASK | UART0_S1_NF_MASK | UART0_S1_OR_MASK), UART0_S1_IDLE(value)))
19595 #define UART0_BWR_S1_IDLE(base, value) (BME_BFI8(&UART0_S1_REG(base), ((uint8_t)(value) << UART0_S1_IDLE_SHIFT), UART0_S1_IDLE_SHIFT, UART0_S1_IDLE_WIDTH))
19596 /*@}*/
19597 
19598 /*!
19599  * @name Register UART0_S1, field RDRF[5] (RO)
19600  *
19601  * RDRF becomes set whenever the receive data buffer is full. To clear RDRF,
19602  * read the UART data register ( UART _D).
19603  *
19604  * Values:
19605  * - 0b0 - Receive data buffer empty.
19606  * - 0b1 - Receive data buffer full.
19607  */
19608 /*@{*/
19609 /*! @brief Read current value of the UART0_S1_RDRF field. */
19610 #define UART0_RD_S1_RDRF(base) ((UART0_S1_REG(base) & UART0_S1_RDRF_MASK) >> UART0_S1_RDRF_SHIFT)
19611 #define UART0_BRD_S1_RDRF(base) (BME_UBFX8(&UART0_S1_REG(base), UART0_S1_RDRF_SHIFT, UART0_S1_RDRF_WIDTH))
19612 /*@}*/
19613 
19614 /*!
19615  * @name Register UART0_S1, field TC[6] (RO)
19616  *
19617  * TC is set out of reset and when TDRE is set and no data, preamble, or break
19618  * character is being transmitted. TC is cleared automatically by one of the
19619  * following: Write to the UART data register ( UART _D) to transmit new data Queue a
19620  * preamble by changing TE from 0 to 1 Queue a break character by writing 1 to
19621  * UART _C2[SBK]
19622  *
19623  * Values:
19624  * - 0b0 - Transmitter active (sending data, a preamble, or a break).
19625  * - 0b1 - Transmitter idle (transmission activity complete).
19626  */
19627 /*@{*/
19628 /*! @brief Read current value of the UART0_S1_TC field. */
19629 #define UART0_RD_S1_TC(base) ((UART0_S1_REG(base) & UART0_S1_TC_MASK) >> UART0_S1_TC_SHIFT)
19630 #define UART0_BRD_S1_TC(base) (BME_UBFX8(&UART0_S1_REG(base), UART0_S1_TC_SHIFT, UART0_S1_TC_WIDTH))
19631 /*@}*/
19632 
19633 /*!
19634  * @name Register UART0_S1, field TDRE[7] (RO)
19635  *
19636  * TDRE is set out of reset and whenever there is room to write data to the
19637  * transmit data buffer. To clear TDRE, write to the UART data register ( UART _D).
19638  *
19639  * Values:
19640  * - 0b0 - Transmit data buffer full.
19641  * - 0b1 - Transmit data buffer empty.
19642  */
19643 /*@{*/
19644 /*! @brief Read current value of the UART0_S1_TDRE field. */
19645 #define UART0_RD_S1_TDRE(base) ((UART0_S1_REG(base) & UART0_S1_TDRE_MASK) >> UART0_S1_TDRE_SHIFT)
19646 #define UART0_BRD_S1_TDRE(base) (BME_UBFX8(&UART0_S1_REG(base), UART0_S1_TDRE_SHIFT, UART0_S1_TDRE_WIDTH))
19647 /*@}*/
19648 
19649 /*******************************************************************************
19650  * UART0_S2 - UART Status Register 2
19651  ******************************************************************************/
19652 
19653 /*!
19654  * @brief UART0_S2 - UART Status Register 2 (RW)
19655  *
19656  * Reset value: 0x00U
19657  *
19658  * This register contains one read-only status flag. When using an internal
19659  * oscillator in a LIN system, it is necessary to raise the break detection threshold
19660  * one bit time. Under the worst case timing conditions allowed in LIN, it is
19661  * possible that a 0x00 data character can appear to be 10.26 bit times long at a
19662  * slave running 14% faster than the master. This would trigger normal break
19663  * detection circuitry designed to detect a 10-bit break symbol. When the LBKDE bit is
19664  * set, framing errors are inhibited and the break detection threshold
19665  * increases, preventing false detection of a 0x00 data character as a LIN break symbol.
19666  */
19667 /*!
19668  * @name Constants and macros for entire UART0_S2 register
19669  */
19670 /*@{*/
19671 #define UART0_RD_S2(base) (UART0_S2_REG(base))
19672 #define UART0_WR_S2(base, value) (UART0_S2_REG(base) = (value))
19673 #define UART0_RMW_S2(base, mask, value) (UART0_WR_S2(base, (UART0_RD_S2(base) & ~(mask)) | (value)))
19674 #define UART0_SET_S2(base, value) (BME_OR8(&UART0_S2_REG(base), (uint8_t)(value)))
19675 #define UART0_CLR_S2(base, value) (BME_AND8(&UART0_S2_REG(base), (uint8_t)(~(value))))
19676 #define UART0_TOG_S2(base, value) (BME_XOR8(&UART0_S2_REG(base), (uint8_t)(value)))
19677 /*@}*/
19678 
19679 /*
19680  * Constants & macros for individual UART0_S2 bitfields
19681  */
19682 
19683 /*!
19684  * @name Register UART0_S2, field RAF[0] (RO)
19685  *
19686  * RAF is set when the UART receiver detects the beginning of a valid start bit,
19687  * and RAF is cleared automatically when the receiver detects an idle line.
19688  *
19689  * Values:
19690  * - 0b0 - UART receiver idle waiting for a start bit.
19691  * - 0b1 - UART receiver active ( UART _RXD input not idle).
19692  */
19693 /*@{*/
19694 /*! @brief Read current value of the UART0_S2_RAF field. */
19695 #define UART0_RD_S2_RAF(base) ((UART0_S2_REG(base) & UART0_S2_RAF_MASK) >> UART0_S2_RAF_SHIFT)
19696 #define UART0_BRD_S2_RAF(base) (BME_UBFX8(&UART0_S2_REG(base), UART0_S2_RAF_SHIFT, UART0_S2_RAF_WIDTH))
19697 /*@}*/
19698 
19699 /*!
19700  * @name Register UART0_S2, field LBKDE[1] (RW)
19701  *
19702  * LBKDE selects a longer break character detection length. While LBKDE is set,
19703  * framing error (FE) and receive data register full (RDRF) flags are prevented
19704  * from setting.
19705  *
19706  * Values:
19707  * - 0b0 - Break character is detected at length 10 bit times (if M = 0, SBNS =
19708  * 0) or 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1, SBNS = 1
19709  * or M10 = 1, SNBS = 0) or 13 (if M10 = 1, SNBS = 1).
19710  * - 0b1 - Break character is detected at length of 11 bit times (if M = 0, SBNS
19711  * = 0) or 12 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 14 (if M = 1, SBNS
19712  * = 1 or M10 = 1, SNBS = 0) or 15 (if M10 = 1, SNBS = 1).
19713  */
19714 /*@{*/
19715 /*! @brief Read current value of the UART0_S2_LBKDE field. */
19716 #define UART0_RD_S2_LBKDE(base) ((UART0_S2_REG(base) & UART0_S2_LBKDE_MASK) >> UART0_S2_LBKDE_SHIFT)
19717 #define UART0_BRD_S2_LBKDE(base) (BME_UBFX8(&UART0_S2_REG(base), UART0_S2_LBKDE_SHIFT, UART0_S2_LBKDE_WIDTH))
19718 
19719 /*! @brief Set the LBKDE field to a new value. */
19720 #define UART0_WR_S2_LBKDE(base, value) (UART0_RMW_S2(base, UART0_S2_LBKDE_MASK, UART0_S2_LBKDE(value)))
19721 #define UART0_BWR_S2_LBKDE(base, value) (BME_BFI8(&UART0_S2_REG(base), ((uint8_t)(value) << UART0_S2_LBKDE_SHIFT), UART0_S2_LBKDE_SHIFT, UART0_S2_LBKDE_WIDTH))
19722 /*@}*/
19723 
19724 /*!
19725  * @name Register UART0_S2, field BRK13[2] (RW)
19726  *
19727  * BRK13 selects a longer transmitted break character length. Detection of a
19728  * framing error is not affected by the state of this bit. This bit should only be
19729  * changed when the transmitter is disabled.
19730  *
19731  * Values:
19732  * - 0b0 - Break character is transmitted with length of 10 bit times (if M = 0,
19733  * SBNS = 0) or 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1,
19734  * SBNS = 1 or M10 = 1, SNBS = 0) or 13 (if M10 = 1, SNBS = 1).
19735  * - 0b1 - Break character is transmitted with length of 13 bit times (if M = 0,
19736  * SBNS = 0) or 14 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 15 (if M = 1,
19737  * SBNS = 1 or M10 = 1, SNBS = 0) or 16 (if M10 = 1, SNBS = 1).
19738  */
19739 /*@{*/
19740 /*! @brief Read current value of the UART0_S2_BRK13 field. */
19741 #define UART0_RD_S2_BRK13(base) ((UART0_S2_REG(base) & UART0_S2_BRK13_MASK) >> UART0_S2_BRK13_SHIFT)
19742 #define UART0_BRD_S2_BRK13(base) (BME_UBFX8(&UART0_S2_REG(base), UART0_S2_BRK13_SHIFT, UART0_S2_BRK13_WIDTH))
19743 
19744 /*! @brief Set the BRK13 field to a new value. */
19745 #define UART0_WR_S2_BRK13(base, value) (UART0_RMW_S2(base, UART0_S2_BRK13_MASK, UART0_S2_BRK13(value)))
19746 #define UART0_BWR_S2_BRK13(base, value) (BME_BFI8(&UART0_S2_REG(base), ((uint8_t)(value) << UART0_S2_BRK13_SHIFT), UART0_S2_BRK13_SHIFT, UART0_S2_BRK13_WIDTH))
19747 /*@}*/
19748 
19749 /*!
19750  * @name Register UART0_S2, field RWUID[3] (RW)
19751  *
19752  * RWUID controls whether the idle character that wakes up the receiver sets the
19753  * IDLE bit. This bit should only be changed when the receiver is disabled.
19754  *
19755  * Values:
19756  * - 0b0 - During receive standby state (RWU = 1), the IDLE bit does not get set
19757  * upon detection of an idle character.
19758  * - 0b1 - During receive standby state (RWU = 1), the IDLE bit gets set upon
19759  * detection of an idle character.
19760  */
19761 /*@{*/
19762 /*! @brief Read current value of the UART0_S2_RWUID field. */
19763 #define UART0_RD_S2_RWUID(base) ((UART0_S2_REG(base) & UART0_S2_RWUID_MASK) >> UART0_S2_RWUID_SHIFT)
19764 #define UART0_BRD_S2_RWUID(base) (BME_UBFX8(&UART0_S2_REG(base), UART0_S2_RWUID_SHIFT, UART0_S2_RWUID_WIDTH))
19765 
19766 /*! @brief Set the RWUID field to a new value. */
19767 #define UART0_WR_S2_RWUID(base, value) (UART0_RMW_S2(base, UART0_S2_RWUID_MASK, UART0_S2_RWUID(value)))
19768 #define UART0_BWR_S2_RWUID(base, value) (BME_BFI8(&UART0_S2_REG(base), ((uint8_t)(value) << UART0_S2_RWUID_SHIFT), UART0_S2_RWUID_SHIFT, UART0_S2_RWUID_WIDTH))
19769 /*@}*/
19770 
19771 /*!
19772  * @name Register UART0_S2, field RXINV[4] (RW)
19773  *
19774  * Setting this bit reverses the polarity of the received data input. Setting
19775  * RXINV inverts the UART _RXD input for all cases: data bits, start and stop bits,
19776  * break, and idle.
19777  *
19778  * Values:
19779  * - 0b0 - Receive data not inverted.
19780  * - 0b1 - Receive data inverted.
19781  */
19782 /*@{*/
19783 /*! @brief Read current value of the UART0_S2_RXINV field. */
19784 #define UART0_RD_S2_RXINV(base) ((UART0_S2_REG(base) & UART0_S2_RXINV_MASK) >> UART0_S2_RXINV_SHIFT)
19785 #define UART0_BRD_S2_RXINV(base) (BME_UBFX8(&UART0_S2_REG(base), UART0_S2_RXINV_SHIFT, UART0_S2_RXINV_WIDTH))
19786 
19787 /*! @brief Set the RXINV field to a new value. */
19788 #define UART0_WR_S2_RXINV(base, value) (UART0_RMW_S2(base, UART0_S2_RXINV_MASK, UART0_S2_RXINV(value)))
19789 #define UART0_BWR_S2_RXINV(base, value) (BME_BFI8(&UART0_S2_REG(base), ((uint8_t)(value) << UART0_S2_RXINV_SHIFT), UART0_S2_RXINV_SHIFT, UART0_S2_RXINV_WIDTH))
19790 /*@}*/
19791 
19792 /*!
19793  * @name Register UART0_S2, field MSBF[5] (RW)
19794  *
19795  * Setting this bit reverses the order of the bits that are transmitted and
19796  * received on the wire. This bit does not affect the polarity of the bits, the
19797  * location of the parity bit or the location of the start or stop bits. This bit
19798  * should only be changed when the transmitter and receiver are both disabled.
19799  *
19800  * Values:
19801  * - 0b0 - LSB (bit0) is the first bit that is transmitted following the start
19802  * bit. Further, the first bit received after the start bit is identified as
19803  * bit0.
19804  * - 0b1 - MSB (bit9, bit8, bit7 or bit6) is the first bit that is transmitted
19805  * following the start bit depending on the setting of C1[M], C1[PE] and
19806  * C4[M10]. Further, the first bit received after the start bit is identified as
19807  * bit9, bit8, bit7 or bit6 depending on the setting of C1[M] and C1[PE].
19808  */
19809 /*@{*/
19810 /*! @brief Read current value of the UART0_S2_MSBF field. */
19811 #define UART0_RD_S2_MSBF(base) ((UART0_S2_REG(base) & UART0_S2_MSBF_MASK) >> UART0_S2_MSBF_SHIFT)
19812 #define UART0_BRD_S2_MSBF(base) (BME_UBFX8(&UART0_S2_REG(base), UART0_S2_MSBF_SHIFT, UART0_S2_MSBF_WIDTH))
19813 
19814 /*! @brief Set the MSBF field to a new value. */
19815 #define UART0_WR_S2_MSBF(base, value) (UART0_RMW_S2(base, UART0_S2_MSBF_MASK, UART0_S2_MSBF(value)))
19816 #define UART0_BWR_S2_MSBF(base, value) (BME_BFI8(&UART0_S2_REG(base), ((uint8_t)(value) << UART0_S2_MSBF_SHIFT), UART0_S2_MSBF_SHIFT, UART0_S2_MSBF_WIDTH))
19817 /*@}*/
19818 
19819 /*!
19820  * @name Register UART0_S2, field RXEDGIF[6] (RW)
19821  *
19822  * RXEDGIF is set when an active edge, falling if RXINV = 0, rising if RXINV=1,
19823  * on the UART _RX pin occurs. RXEDGIF is cleared by writing a 1 to it.
19824  *
19825  * Values:
19826  * - 0b0 - No active edge on the receive pin has occurred.
19827  * - 0b1 - An active edge on the receive pin has occurred.
19828  */
19829 /*@{*/
19830 /*! @brief Read current value of the UART0_S2_RXEDGIF field. */
19831 #define UART0_RD_S2_RXEDGIF(base) ((UART0_S2_REG(base) & UART0_S2_RXEDGIF_MASK) >> UART0_S2_RXEDGIF_SHIFT)
19832 #define UART0_BRD_S2_RXEDGIF(base) (BME_UBFX8(&UART0_S2_REG(base), UART0_S2_RXEDGIF_SHIFT, UART0_S2_RXEDGIF_WIDTH))
19833 
19834 /*! @brief Set the RXEDGIF field to a new value. */
19835 #define UART0_WR_S2_RXEDGIF(base, value) (UART0_RMW_S2(base, UART0_S2_RXEDGIF_MASK, UART0_S2_RXEDGIF(value)))
19836 #define UART0_BWR_S2_RXEDGIF(base, value) (BME_BFI8(&UART0_S2_REG(base), ((uint8_t)(value) << UART0_S2_RXEDGIF_SHIFT), UART0_S2_RXEDGIF_SHIFT, UART0_S2_RXEDGIF_WIDTH))
19837 /*@}*/
19838 
19839 /*!
19840  * @name Register UART0_S2, field LBKDIF[7] (RW)
19841  *
19842  * LBKDIF is set when the LIN break detect circuitry is enabled and a LIN break
19843  * character is detected. LBKDIF is cleared by writing a 1 to it.
19844  *
19845  * Values:
19846  * - 0b0 - No LIN break character has been detected.
19847  * - 0b1 - LIN break character has been detected.
19848  */
19849 /*@{*/
19850 /*! @brief Read current value of the UART0_S2_LBKDIF field. */
19851 #define UART0_RD_S2_LBKDIF(base) ((UART0_S2_REG(base) & UART0_S2_LBKDIF_MASK) >> UART0_S2_LBKDIF_SHIFT)
19852 #define UART0_BRD_S2_LBKDIF(base) (BME_UBFX8(&UART0_S2_REG(base), UART0_S2_LBKDIF_SHIFT, UART0_S2_LBKDIF_WIDTH))
19853 
19854 /*! @brief Set the LBKDIF field to a new value. */
19855 #define UART0_WR_S2_LBKDIF(base, value) (UART0_RMW_S2(base, UART0_S2_LBKDIF_MASK, UART0_S2_LBKDIF(value)))
19856 #define UART0_BWR_S2_LBKDIF(base, value) (BME_BFI8(&UART0_S2_REG(base), ((uint8_t)(value) << UART0_S2_LBKDIF_SHIFT), UART0_S2_LBKDIF_SHIFT, UART0_S2_LBKDIF_WIDTH))
19857 /*@}*/
19858 
19859 /*******************************************************************************
19860  * UART0_C3 - UART Control Register 3
19861  ******************************************************************************/
19862 
19863 /*!
19864  * @brief UART0_C3 - UART Control Register 3 (RW)
19865  *
19866  * Reset value: 0x00U
19867  */
19868 /*!
19869  * @name Constants and macros for entire UART0_C3 register
19870  */
19871 /*@{*/
19872 #define UART0_RD_C3(base) (UART0_C3_REG(base))
19873 #define UART0_WR_C3(base, value) (UART0_C3_REG(base) = (value))
19874 #define UART0_RMW_C3(base, mask, value) (UART0_WR_C3(base, (UART0_RD_C3(base) & ~(mask)) | (value)))
19875 #define UART0_SET_C3(base, value) (BME_OR8(&UART0_C3_REG(base), (uint8_t)(value)))
19876 #define UART0_CLR_C3(base, value) (BME_AND8(&UART0_C3_REG(base), (uint8_t)(~(value))))
19877 #define UART0_TOG_C3(base, value) (BME_XOR8(&UART0_C3_REG(base), (uint8_t)(value)))
19878 /*@}*/
19879 
19880 /*
19881  * Constants & macros for individual UART0_C3 bitfields
19882  */
19883 
19884 /*!
19885  * @name Register UART0_C3, field PEIE[0] (RW)
19886  *
19887  * This bit enables the parity error flag (PF) to generate hardware interrupt
19888  * requests.
19889  *
19890  * Values:
19891  * - 0b0 - PF interrupts disabled; use polling).
19892  * - 0b1 - Hardware interrupt requested when PF is set.
19893  */
19894 /*@{*/
19895 /*! @brief Read current value of the UART0_C3_PEIE field. */
19896 #define UART0_RD_C3_PEIE(base) ((UART0_C3_REG(base) & UART0_C3_PEIE_MASK) >> UART0_C3_PEIE_SHIFT)
19897 #define UART0_BRD_C3_PEIE(base) (BME_UBFX8(&UART0_C3_REG(base), UART0_C3_PEIE_SHIFT, UART0_C3_PEIE_WIDTH))
19898 
19899 /*! @brief Set the PEIE field to a new value. */
19900 #define UART0_WR_C3_PEIE(base, value) (UART0_RMW_C3(base, UART0_C3_PEIE_MASK, UART0_C3_PEIE(value)))
19901 #define UART0_BWR_C3_PEIE(base, value) (BME_BFI8(&UART0_C3_REG(base), ((uint8_t)(value) << UART0_C3_PEIE_SHIFT), UART0_C3_PEIE_SHIFT, UART0_C3_PEIE_WIDTH))
19902 /*@}*/
19903 
19904 /*!
19905  * @name Register UART0_C3, field FEIE[1] (RW)
19906  *
19907  * This bit enables the framing error flag (FE) to generate hardware interrupt
19908  * requests.
19909  *
19910  * Values:
19911  * - 0b0 - FE interrupts disabled; use polling.
19912  * - 0b1 - Hardware interrupt requested when FE is set.
19913  */
19914 /*@{*/
19915 /*! @brief Read current value of the UART0_C3_FEIE field. */
19916 #define UART0_RD_C3_FEIE(base) ((UART0_C3_REG(base) & UART0_C3_FEIE_MASK) >> UART0_C3_FEIE_SHIFT)
19917 #define UART0_BRD_C3_FEIE(base) (BME_UBFX8(&UART0_C3_REG(base), UART0_C3_FEIE_SHIFT, UART0_C3_FEIE_WIDTH))
19918 
19919 /*! @brief Set the FEIE field to a new value. */
19920 #define UART0_WR_C3_FEIE(base, value) (UART0_RMW_C3(base, UART0_C3_FEIE_MASK, UART0_C3_FEIE(value)))
19921 #define UART0_BWR_C3_FEIE(base, value) (BME_BFI8(&UART0_C3_REG(base), ((uint8_t)(value) << UART0_C3_FEIE_SHIFT), UART0_C3_FEIE_SHIFT, UART0_C3_FEIE_WIDTH))
19922 /*@}*/
19923 
19924 /*!
19925  * @name Register UART0_C3, field NEIE[2] (RW)
19926  *
19927  * This bit enables the noise flag (NF) to generate hardware interrupt requests.
19928  *
19929  * Values:
19930  * - 0b0 - NF interrupts disabled; use polling.
19931  * - 0b1 - Hardware interrupt requested when NF is set.
19932  */
19933 /*@{*/
19934 /*! @brief Read current value of the UART0_C3_NEIE field. */
19935 #define UART0_RD_C3_NEIE(base) ((UART0_C3_REG(base) & UART0_C3_NEIE_MASK) >> UART0_C3_NEIE_SHIFT)
19936 #define UART0_BRD_C3_NEIE(base) (BME_UBFX8(&UART0_C3_REG(base), UART0_C3_NEIE_SHIFT, UART0_C3_NEIE_WIDTH))
19937 
19938 /*! @brief Set the NEIE field to a new value. */
19939 #define UART0_WR_C3_NEIE(base, value) (UART0_RMW_C3(base, UART0_C3_NEIE_MASK, UART0_C3_NEIE(value)))
19940 #define UART0_BWR_C3_NEIE(base, value) (BME_BFI8(&UART0_C3_REG(base), ((uint8_t)(value) << UART0_C3_NEIE_SHIFT), UART0_C3_NEIE_SHIFT, UART0_C3_NEIE_WIDTH))
19941 /*@}*/
19942 
19943 /*!
19944  * @name Register UART0_C3, field ORIE[3] (RW)
19945  *
19946  * This bit enables the overrun flag (OR) to generate hardware interrupt
19947  * requests.
19948  *
19949  * Values:
19950  * - 0b0 - OR interrupts disabled; use polling.
19951  * - 0b1 - Hardware interrupt requested when OR is set.
19952  */
19953 /*@{*/
19954 /*! @brief Read current value of the UART0_C3_ORIE field. */
19955 #define UART0_RD_C3_ORIE(base) ((UART0_C3_REG(base) & UART0_C3_ORIE_MASK) >> UART0_C3_ORIE_SHIFT)
19956 #define UART0_BRD_C3_ORIE(base) (BME_UBFX8(&UART0_C3_REG(base), UART0_C3_ORIE_SHIFT, UART0_C3_ORIE_WIDTH))
19957 
19958 /*! @brief Set the ORIE field to a new value. */
19959 #define UART0_WR_C3_ORIE(base, value) (UART0_RMW_C3(base, UART0_C3_ORIE_MASK, UART0_C3_ORIE(value)))
19960 #define UART0_BWR_C3_ORIE(base, value) (BME_BFI8(&UART0_C3_REG(base), ((uint8_t)(value) << UART0_C3_ORIE_SHIFT), UART0_C3_ORIE_SHIFT, UART0_C3_ORIE_WIDTH))
19961 /*@}*/
19962 
19963 /*!
19964  * @name Register UART0_C3, field TXINV[4] (RW)
19965  *
19966  * Setting this bit reverses the polarity of the transmitted data output.
19967  * Setting TXINV inverts the UART _TXD output for all cases: data bits, start and stop
19968  * bits, break, and idle.
19969  *
19970  * Values:
19971  * - 0b0 - Transmit data not inverted.
19972  * - 0b1 - Transmit data inverted.
19973  */
19974 /*@{*/
19975 /*! @brief Read current value of the UART0_C3_TXINV field. */
19976 #define UART0_RD_C3_TXINV(base) ((UART0_C3_REG(base) & UART0_C3_TXINV_MASK) >> UART0_C3_TXINV_SHIFT)
19977 #define UART0_BRD_C3_TXINV(base) (BME_UBFX8(&UART0_C3_REG(base), UART0_C3_TXINV_SHIFT, UART0_C3_TXINV_WIDTH))
19978 
19979 /*! @brief Set the TXINV field to a new value. */
19980 #define UART0_WR_C3_TXINV(base, value) (UART0_RMW_C3(base, UART0_C3_TXINV_MASK, UART0_C3_TXINV(value)))
19981 #define UART0_BWR_C3_TXINV(base, value) (BME_BFI8(&UART0_C3_REG(base), ((uint8_t)(value) << UART0_C3_TXINV_SHIFT), UART0_C3_TXINV_SHIFT, UART0_C3_TXINV_WIDTH))
19982 /*@}*/
19983 
19984 /*!
19985  * @name Register UART0_C3, field TXDIR[5] (RW)
19986  *
19987  * When the is configured for single-wire half-duplex operation (LOOPS = RSRC =
19988  * 1), this bit determines the direction of data at the UART_TXD pin. When
19989  * clearing TXDIR, the transmitter will finish receiving the current character (if any)
19990  * before the receiver starts receiving data from the UART_TXD pin.
19991  *
19992  * Values:
19993  * - 0b0 - UART _TXD pin is an input in single-wire mode.
19994  * - 0b1 - UART _TXD pin is an output in single-wire mode.
19995  */
19996 /*@{*/
19997 /*! @brief Read current value of the UART0_C3_TXDIR field. */
19998 #define UART0_RD_C3_TXDIR(base) ((UART0_C3_REG(base) & UART0_C3_TXDIR_MASK) >> UART0_C3_TXDIR_SHIFT)
19999 #define UART0_BRD_C3_TXDIR(base) (BME_UBFX8(&UART0_C3_REG(base), UART0_C3_TXDIR_SHIFT, UART0_C3_TXDIR_WIDTH))
20000 
20001 /*! @brief Set the TXDIR field to a new value. */
20002 #define UART0_WR_C3_TXDIR(base, value) (UART0_RMW_C3(base, UART0_C3_TXDIR_MASK, UART0_C3_TXDIR(value)))
20003 #define UART0_BWR_C3_TXDIR(base, value) (BME_BFI8(&UART0_C3_REG(base), ((uint8_t)(value) << UART0_C3_TXDIR_SHIFT), UART0_C3_TXDIR_SHIFT, UART0_C3_TXDIR_WIDTH))
20004 /*@}*/
20005 
20006 /*!
20007  * @name Register UART0_C3, field R9T8[6] (RW)
20008  *
20009  * When the UART is configured for 9-bit data (M = 1), T8 may be thought of as a
20010  * ninth transmit data bit to the left of the msb of the data in the UART_D
20011  * register. When writing 9-bit data, the entire 9-bit value is transferred to the
20012  * UART transmit buffer after UART_D is written so T8 should be written, if it
20013  * needs to change from its previous value, before UART_D is written. If T8 does not
20014  * need to change in the new value, such as when it is used to generate mark or
20015  * space parity, it need not be written each time UART_D is written. When the UART
20016  * is configured for 10-bit data (M10 = 1), R9 can be thought of as a tenth
20017  * receive data bit. When reading 10-bit data, read R9 and R8 before reading UART_D
20018  * because reading UART_D completes automatic flag clearing sequences that could
20019  * allow R8, R9 and UART_D to be overwritten with new data.
20020  */
20021 /*@{*/
20022 /*! @brief Read current value of the UART0_C3_R9T8 field. */
20023 #define UART0_RD_C3_R9T8(base) ((UART0_C3_REG(base) & UART0_C3_R9T8_MASK) >> UART0_C3_R9T8_SHIFT)
20024 #define UART0_BRD_C3_R9T8(base) (BME_UBFX8(&UART0_C3_REG(base), UART0_C3_R9T8_SHIFT, UART0_C3_R9T8_WIDTH))
20025 
20026 /*! @brief Set the R9T8 field to a new value. */
20027 #define UART0_WR_C3_R9T8(base, value) (UART0_RMW_C3(base, UART0_C3_R9T8_MASK, UART0_C3_R9T8(value)))
20028 #define UART0_BWR_C3_R9T8(base, value) (BME_BFI8(&UART0_C3_REG(base), ((uint8_t)(value) << UART0_C3_R9T8_SHIFT), UART0_C3_R9T8_SHIFT, UART0_C3_R9T8_WIDTH))
20029 /*@}*/
20030 
20031 /*!
20032  * @name Register UART0_C3, field R8T9[7] (RW)
20033  *
20034  * When the UART is configured for 9-bit data (M = 1), R8 can be thought of as a
20035  * ninth receive data bit to the left of the msb of the buffered data in the
20036  * UART_D register. When reading 9-bit data, read R8 before reading UART_D because
20037  * reading UART_D completes automatic flag clearing sequences that could allow R8
20038  * and UART_D to be overwritten with new data. When the UART is configured for
20039  * 10-bit data (M10 = 1), T9 may be thought of as a tenth transmit data bit. When
20040  * writing 10-bit data, the entire 10-bit value is transferred to the UART
20041  * transmit buffer when UART_D is written so T9 and T8 should be written, if it needs to
20042  * change from its previous value, before UART_D is written. If T9 and T8 do not
20043  * need to change in the new value, such as when it is used to generate mark or
20044  * space parity, they need not be written each time UART_D is written.
20045  */
20046 /*@{*/
20047 /*! @brief Read current value of the UART0_C3_R8T9 field. */
20048 #define UART0_RD_C3_R8T9(base) ((UART0_C3_REG(base) & UART0_C3_R8T9_MASK) >> UART0_C3_R8T9_SHIFT)
20049 #define UART0_BRD_C3_R8T9(base) (BME_UBFX8(&UART0_C3_REG(base), UART0_C3_R8T9_SHIFT, UART0_C3_R8T9_WIDTH))
20050 
20051 /*! @brief Set the R8T9 field to a new value. */
20052 #define UART0_WR_C3_R8T9(base, value) (UART0_RMW_C3(base, UART0_C3_R8T9_MASK, UART0_C3_R8T9(value)))
20053 #define UART0_BWR_C3_R8T9(base, value) (BME_BFI8(&UART0_C3_REG(base), ((uint8_t)(value) << UART0_C3_R8T9_SHIFT), UART0_C3_R8T9_SHIFT, UART0_C3_R8T9_WIDTH))
20054 /*@}*/
20055 
20056 /*******************************************************************************
20057  * UART0_D - UART Data Register
20058  ******************************************************************************/
20059 
20060 /*!
20061  * @brief UART0_D - UART Data Register (RW)
20062  *
20063  * Reset value: 0x00U
20064  *
20065  * This register is actually two separate registers. Reads return the contents
20066  * of the read-only receive data buffer and writes go to the write-only transmit
20067  * data buffer. Reads and writes of this register are also involved in the
20068  * automatic flag clearing mechanisms for some of the UART status flags.
20069  */
20070 /*!
20071  * @name Constants and macros for entire UART0_D register
20072  */
20073 /*@{*/
20074 #define UART0_RD_D(base) (UART0_D_REG(base))
20075 #define UART0_WR_D(base, value) (UART0_D_REG(base) = (value))
20076 #define UART0_RMW_D(base, mask, value) (UART0_WR_D(base, (UART0_RD_D(base) & ~(mask)) | (value)))
20077 #define UART0_SET_D(base, value) (BME_OR8(&UART0_D_REG(base), (uint8_t)(value)))
20078 #define UART0_CLR_D(base, value) (BME_AND8(&UART0_D_REG(base), (uint8_t)(~(value))))
20079 #define UART0_TOG_D(base, value) (BME_XOR8(&UART0_D_REG(base), (uint8_t)(value)))
20080 /*@}*/
20081 
20082 /*
20083  * Constants & macros for individual UART0_D bitfields
20084  */
20085 
20086 /*!
20087  * @name Register UART0_D, field R0T0[0] (RW)
20088  *
20089  * Read receive data buffer 0 or write transmit data buffer 0.
20090  */
20091 /*@{*/
20092 /*! @brief Read current value of the UART0_D_R0T0 field. */
20093 #define UART0_RD_D_R0T0(base) ((UART0_D_REG(base) & UART0_D_R0T0_MASK) >> UART0_D_R0T0_SHIFT)
20094 #define UART0_BRD_D_R0T0(base) (BME_UBFX8(&UART0_D_REG(base), UART0_D_R0T0_SHIFT, UART0_D_R0T0_WIDTH))
20095 
20096 /*! @brief Set the R0T0 field to a new value. */
20097 #define UART0_WR_D_R0T0(base, value) (UART0_RMW_D(base, UART0_D_R0T0_MASK, UART0_D_R0T0(value)))
20098 #define UART0_BWR_D_R0T0(base, value) (BME_BFI8(&UART0_D_REG(base), ((uint8_t)(value) << UART0_D_R0T0_SHIFT), UART0_D_R0T0_SHIFT, UART0_D_R0T0_WIDTH))
20099 /*@}*/
20100 
20101 /*!
20102  * @name Register UART0_D, field R1T1[1] (RW)
20103  *
20104  * Read receive data buffer 1 or write transmit data buffer 1.
20105  */
20106 /*@{*/
20107 /*! @brief Read current value of the UART0_D_R1T1 field. */
20108 #define UART0_RD_D_R1T1(base) ((UART0_D_REG(base) & UART0_D_R1T1_MASK) >> UART0_D_R1T1_SHIFT)
20109 #define UART0_BRD_D_R1T1(base) (BME_UBFX8(&UART0_D_REG(base), UART0_D_R1T1_SHIFT, UART0_D_R1T1_WIDTH))
20110 
20111 /*! @brief Set the R1T1 field to a new value. */
20112 #define UART0_WR_D_R1T1(base, value) (UART0_RMW_D(base, UART0_D_R1T1_MASK, UART0_D_R1T1(value)))
20113 #define UART0_BWR_D_R1T1(base, value) (BME_BFI8(&UART0_D_REG(base), ((uint8_t)(value) << UART0_D_R1T1_SHIFT), UART0_D_R1T1_SHIFT, UART0_D_R1T1_WIDTH))
20114 /*@}*/
20115 
20116 /*!
20117  * @name Register UART0_D, field R2T2[2] (RW)
20118  *
20119  * Read receive data buffer 2 or write transmit data buffer 2.
20120  */
20121 /*@{*/
20122 /*! @brief Read current value of the UART0_D_R2T2 field. */
20123 #define UART0_RD_D_R2T2(base) ((UART0_D_REG(base) & UART0_D_R2T2_MASK) >> UART0_D_R2T2_SHIFT)
20124 #define UART0_BRD_D_R2T2(base) (BME_UBFX8(&UART0_D_REG(base), UART0_D_R2T2_SHIFT, UART0_D_R2T2_WIDTH))
20125 
20126 /*! @brief Set the R2T2 field to a new value. */
20127 #define UART0_WR_D_R2T2(base, value) (UART0_RMW_D(base, UART0_D_R2T2_MASK, UART0_D_R2T2(value)))
20128 #define UART0_BWR_D_R2T2(base, value) (BME_BFI8(&UART0_D_REG(base), ((uint8_t)(value) << UART0_D_R2T2_SHIFT), UART0_D_R2T2_SHIFT, UART0_D_R2T2_WIDTH))
20129 /*@}*/
20130 
20131 /*!
20132  * @name Register UART0_D, field R3T3[3] (RW)
20133  *
20134  * Read receive data buffer 3 or write transmit data buffer 3.
20135  */
20136 /*@{*/
20137 /*! @brief Read current value of the UART0_D_R3T3 field. */
20138 #define UART0_RD_D_R3T3(base) ((UART0_D_REG(base) & UART0_D_R3T3_MASK) >> UART0_D_R3T3_SHIFT)
20139 #define UART0_BRD_D_R3T3(base) (BME_UBFX8(&UART0_D_REG(base), UART0_D_R3T3_SHIFT, UART0_D_R3T3_WIDTH))
20140 
20141 /*! @brief Set the R3T3 field to a new value. */
20142 #define UART0_WR_D_R3T3(base, value) (UART0_RMW_D(base, UART0_D_R3T3_MASK, UART0_D_R3T3(value)))
20143 #define UART0_BWR_D_R3T3(base, value) (BME_BFI8(&UART0_D_REG(base), ((uint8_t)(value) << UART0_D_R3T3_SHIFT), UART0_D_R3T3_SHIFT, UART0_D_R3T3_WIDTH))
20144 /*@}*/
20145 
20146 /*!
20147  * @name Register UART0_D, field R4T4[4] (RW)
20148  *
20149  * Read receive data buffer 4 or write transmit data buffer 4.
20150  */
20151 /*@{*/
20152 /*! @brief Read current value of the UART0_D_R4T4 field. */
20153 #define UART0_RD_D_R4T4(base) ((UART0_D_REG(base) & UART0_D_R4T4_MASK) >> UART0_D_R4T4_SHIFT)
20154 #define UART0_BRD_D_R4T4(base) (BME_UBFX8(&UART0_D_REG(base), UART0_D_R4T4_SHIFT, UART0_D_R4T4_WIDTH))
20155 
20156 /*! @brief Set the R4T4 field to a new value. */
20157 #define UART0_WR_D_R4T4(base, value) (UART0_RMW_D(base, UART0_D_R4T4_MASK, UART0_D_R4T4(value)))
20158 #define UART0_BWR_D_R4T4(base, value) (BME_BFI8(&UART0_D_REG(base), ((uint8_t)(value) << UART0_D_R4T4_SHIFT), UART0_D_R4T4_SHIFT, UART0_D_R4T4_WIDTH))
20159 /*@}*/
20160 
20161 /*!
20162  * @name Register UART0_D, field R5T5[5] (RW)
20163  *
20164  * Read receive data buffer 5 or write transmit data buffer 5.
20165  */
20166 /*@{*/
20167 /*! @brief Read current value of the UART0_D_R5T5 field. */
20168 #define UART0_RD_D_R5T5(base) ((UART0_D_REG(base) & UART0_D_R5T5_MASK) >> UART0_D_R5T5_SHIFT)
20169 #define UART0_BRD_D_R5T5(base) (BME_UBFX8(&UART0_D_REG(base), UART0_D_R5T5_SHIFT, UART0_D_R5T5_WIDTH))
20170 
20171 /*! @brief Set the R5T5 field to a new value. */
20172 #define UART0_WR_D_R5T5(base, value) (UART0_RMW_D(base, UART0_D_R5T5_MASK, UART0_D_R5T5(value)))
20173 #define UART0_BWR_D_R5T5(base, value) (BME_BFI8(&UART0_D_REG(base), ((uint8_t)(value) << UART0_D_R5T5_SHIFT), UART0_D_R5T5_SHIFT, UART0_D_R5T5_WIDTH))
20174 /*@}*/
20175 
20176 /*!
20177  * @name Register UART0_D, field R6T6[6] (RW)
20178  *
20179  * Read receive data buffer 6 or write transmit data buffer 6.
20180  */
20181 /*@{*/
20182 /*! @brief Read current value of the UART0_D_R6T6 field. */
20183 #define UART0_RD_D_R6T6(base) ((UART0_D_REG(base) & UART0_D_R6T6_MASK) >> UART0_D_R6T6_SHIFT)
20184 #define UART0_BRD_D_R6T6(base) (BME_UBFX8(&UART0_D_REG(base), UART0_D_R6T6_SHIFT, UART0_D_R6T6_WIDTH))
20185 
20186 /*! @brief Set the R6T6 field to a new value. */
20187 #define UART0_WR_D_R6T6(base, value) (UART0_RMW_D(base, UART0_D_R6T6_MASK, UART0_D_R6T6(value)))
20188 #define UART0_BWR_D_R6T6(base, value) (BME_BFI8(&UART0_D_REG(base), ((uint8_t)(value) << UART0_D_R6T6_SHIFT), UART0_D_R6T6_SHIFT, UART0_D_R6T6_WIDTH))
20189 /*@}*/
20190 
20191 /*!
20192  * @name Register UART0_D, field R7T7[7] (RW)
20193  *
20194  * Read receive data buffer 7 or write transmit data buffer 7.
20195  */
20196 /*@{*/
20197 /*! @brief Read current value of the UART0_D_R7T7 field. */
20198 #define UART0_RD_D_R7T7(base) ((UART0_D_REG(base) & UART0_D_R7T7_MASK) >> UART0_D_R7T7_SHIFT)
20199 #define UART0_BRD_D_R7T7(base) (BME_UBFX8(&UART0_D_REG(base), UART0_D_R7T7_SHIFT, UART0_D_R7T7_WIDTH))
20200 
20201 /*! @brief Set the R7T7 field to a new value. */
20202 #define UART0_WR_D_R7T7(base, value) (UART0_RMW_D(base, UART0_D_R7T7_MASK, UART0_D_R7T7(value)))
20203 #define UART0_BWR_D_R7T7(base, value) (BME_BFI8(&UART0_D_REG(base), ((uint8_t)(value) << UART0_D_R7T7_SHIFT), UART0_D_R7T7_SHIFT, UART0_D_R7T7_WIDTH))
20204 /*@}*/
20205 
20206 /*******************************************************************************
20207  * UART0_MA1 - UART Match Address Registers 1
20208  ******************************************************************************/
20209 
20210 /*!
20211  * @brief UART0_MA1 - UART Match Address Registers 1 (RW)
20212  *
20213  * Reset value: 0x00U
20214  *
20215  * The MA1 and MA2 registers are compared to input data addresses when the most
20216  * significant bit is set and the associated C4[MAEN] bit is set. If a match
20217  * occurs, the following data is transferred to the data register. If a match fails,
20218  * the following data is discarded. Software should only write a MA register when
20219  * the associated C4[MAEN] bit is clear.
20220  */
20221 /*!
20222  * @name Constants and macros for entire UART0_MA1 register
20223  */
20224 /*@{*/
20225 #define UART0_RD_MA1(base) (UART0_MA1_REG(base))
20226 #define UART0_WR_MA1(base, value) (UART0_MA1_REG(base) = (value))
20227 #define UART0_RMW_MA1(base, mask, value) (UART0_WR_MA1(base, (UART0_RD_MA1(base) & ~(mask)) | (value)))
20228 #define UART0_SET_MA1(base, value) (BME_OR8(&UART0_MA1_REG(base), (uint8_t)(value)))
20229 #define UART0_CLR_MA1(base, value) (BME_AND8(&UART0_MA1_REG(base), (uint8_t)(~(value))))
20230 #define UART0_TOG_MA1(base, value) (BME_XOR8(&UART0_MA1_REG(base), (uint8_t)(value)))
20231 /*@}*/
20232 
20233 /*******************************************************************************
20234  * UART0_MA2 - UART Match Address Registers 2
20235  ******************************************************************************/
20236 
20237 /*!
20238  * @brief UART0_MA2 - UART Match Address Registers 2 (RW)
20239  *
20240  * Reset value: 0x00U
20241  *
20242  * The MA1 and MA2 registers are compared to input data addresses when the most
20243  * significant bit is set and the associated C4[MAEN] bit is set. If a match
20244  * occurs, the following data is transferred to the data register. If a match fails,
20245  * the following data is discarded. Software should only write a MA register when
20246  * the associated C4[MAEN] bit is clear.
20247  */
20248 /*!
20249  * @name Constants and macros for entire UART0_MA2 register
20250  */
20251 /*@{*/
20252 #define UART0_RD_MA2(base) (UART0_MA2_REG(base))
20253 #define UART0_WR_MA2(base, value) (UART0_MA2_REG(base) = (value))
20254 #define UART0_RMW_MA2(base, mask, value) (UART0_WR_MA2(base, (UART0_RD_MA2(base) & ~(mask)) | (value)))
20255 #define UART0_SET_MA2(base, value) (BME_OR8(&UART0_MA2_REG(base), (uint8_t)(value)))
20256 #define UART0_CLR_MA2(base, value) (BME_AND8(&UART0_MA2_REG(base), (uint8_t)(~(value))))
20257 #define UART0_TOG_MA2(base, value) (BME_XOR8(&UART0_MA2_REG(base), (uint8_t)(value)))
20258 /*@}*/
20259 
20260 /*******************************************************************************
20261  * UART0_C4 - UART Control Register 4
20262  ******************************************************************************/
20263 
20264 /*!
20265  * @brief UART0_C4 - UART Control Register 4 (RW)
20266  *
20267  * Reset value: 0x0FU
20268  */
20269 /*!
20270  * @name Constants and macros for entire UART0_C4 register
20271  */
20272 /*@{*/
20273 #define UART0_RD_C4(base) (UART0_C4_REG(base))
20274 #define UART0_WR_C4(base, value) (UART0_C4_REG(base) = (value))
20275 #define UART0_RMW_C4(base, mask, value) (UART0_WR_C4(base, (UART0_RD_C4(base) & ~(mask)) | (value)))
20276 #define UART0_SET_C4(base, value) (BME_OR8(&UART0_C4_REG(base), (uint8_t)(value)))
20277 #define UART0_CLR_C4(base, value) (BME_AND8(&UART0_C4_REG(base), (uint8_t)(~(value))))
20278 #define UART0_TOG_C4(base, value) (BME_XOR8(&UART0_C4_REG(base), (uint8_t)(value)))
20279 /*@}*/
20280 
20281 /*
20282  * Constants & macros for individual UART0_C4 bitfields
20283  */
20284 
20285 /*!
20286  * @name Register UART0_C4, field OSR[4:0] (RW)
20287  *
20288  * This field configures the oversampling ratio for the receiver between 4x
20289  * (00011) and 32x (11111). Writing an invalid oversampling ratio will default to an
20290  * oversampling ratio of 16 (01111). This field should only be changed when the
20291  * transmitter and receiver are both disabled.
20292  */
20293 /*@{*/
20294 /*! @brief Read current value of the UART0_C4_OSR field. */
20295 #define UART0_RD_C4_OSR(base) ((UART0_C4_REG(base) & UART0_C4_OSR_MASK) >> UART0_C4_OSR_SHIFT)
20296 #define UART0_BRD_C4_OSR(base) (BME_UBFX8(&UART0_C4_REG(base), UART0_C4_OSR_SHIFT, UART0_C4_OSR_WIDTH))
20297 
20298 /*! @brief Set the OSR field to a new value. */
20299 #define UART0_WR_C4_OSR(base, value) (UART0_RMW_C4(base, UART0_C4_OSR_MASK, UART0_C4_OSR(value)))
20300 #define UART0_BWR_C4_OSR(base, value) (BME_BFI8(&UART0_C4_REG(base), ((uint8_t)(value) << UART0_C4_OSR_SHIFT), UART0_C4_OSR_SHIFT, UART0_C4_OSR_WIDTH))
20301 /*@}*/
20302 
20303 /*!
20304  * @name Register UART0_C4, field M10[5] (RW)
20305  *
20306  * The M10 bit causes a tenth bit to be part of the serial transmission. This
20307  * bit should only be changed when the transmitter and receiver are both disabled.
20308  *
20309  * Values:
20310  * - 0b0 - Receiver and transmitter use 8-bit or 9-bit data characters.
20311  * - 0b1 - Receiver and transmitter use 10-bit data characters.
20312  */
20313 /*@{*/
20314 /*! @brief Read current value of the UART0_C4_M10 field. */
20315 #define UART0_RD_C4_M10(base) ((UART0_C4_REG(base) & UART0_C4_M10_MASK) >> UART0_C4_M10_SHIFT)
20316 #define UART0_BRD_C4_M10(base) (BME_UBFX8(&UART0_C4_REG(base), UART0_C4_M10_SHIFT, UART0_C4_M10_WIDTH))
20317 
20318 /*! @brief Set the M10 field to a new value. */
20319 #define UART0_WR_C4_M10(base, value) (UART0_RMW_C4(base, UART0_C4_M10_MASK, UART0_C4_M10(value)))
20320 #define UART0_BWR_C4_M10(base, value) (BME_BFI8(&UART0_C4_REG(base), ((uint8_t)(value) << UART0_C4_M10_SHIFT), UART0_C4_M10_SHIFT, UART0_C4_M10_WIDTH))
20321 /*@}*/
20322 
20323 /*!
20324  * @name Register UART0_C4, field MAEN2[6] (RW)
20325  *
20326  * Refer to Match address operation for more information.
20327  *
20328  * Values:
20329  * - 0b0 - All data received is transferred to the data buffer if MAEN1 is
20330  * cleared.
20331  * - 0b1 - All data received with the most significant bit cleared, is
20332  * discarded. All data received with the most significant bit set, is compared with
20333  * contents of MA2 register. If no match occurs, the data is discarded. If
20334  * match occurs, data is transferred to the data buffer.
20335  */
20336 /*@{*/
20337 /*! @brief Read current value of the UART0_C4_MAEN2 field. */
20338 #define UART0_RD_C4_MAEN2(base) ((UART0_C4_REG(base) & UART0_C4_MAEN2_MASK) >> UART0_C4_MAEN2_SHIFT)
20339 #define UART0_BRD_C4_MAEN2(base) (BME_UBFX8(&UART0_C4_REG(base), UART0_C4_MAEN2_SHIFT, UART0_C4_MAEN2_WIDTH))
20340 
20341 /*! @brief Set the MAEN2 field to a new value. */
20342 #define UART0_WR_C4_MAEN2(base, value) (UART0_RMW_C4(base, UART0_C4_MAEN2_MASK, UART0_C4_MAEN2(value)))
20343 #define UART0_BWR_C4_MAEN2(base, value) (BME_BFI8(&UART0_C4_REG(base), ((uint8_t)(value) << UART0_C4_MAEN2_SHIFT), UART0_C4_MAEN2_SHIFT, UART0_C4_MAEN2_WIDTH))
20344 /*@}*/
20345 
20346 /*!
20347  * @name Register UART0_C4, field MAEN1[7] (RW)
20348  *
20349  * Refer to Match address operation for more information.
20350  *
20351  * Values:
20352  * - 0b0 - All data received is transferred to the data buffer if MAEN2 is
20353  * cleared.
20354  * - 0b1 - All data received with the most significant bit cleared, is
20355  * discarded. All data received with the most significant bit set, is compared with
20356  * contents of MA1 register. If no match occurs, the data is discarded. If
20357  * match occurs, data is transferred to the data buffer.
20358  */
20359 /*@{*/
20360 /*! @brief Read current value of the UART0_C4_MAEN1 field. */
20361 #define UART0_RD_C4_MAEN1(base) ((UART0_C4_REG(base) & UART0_C4_MAEN1_MASK) >> UART0_C4_MAEN1_SHIFT)
20362 #define UART0_BRD_C4_MAEN1(base) (BME_UBFX8(&UART0_C4_REG(base), UART0_C4_MAEN1_SHIFT, UART0_C4_MAEN1_WIDTH))
20363 
20364 /*! @brief Set the MAEN1 field to a new value. */
20365 #define UART0_WR_C4_MAEN1(base, value) (UART0_RMW_C4(base, UART0_C4_MAEN1_MASK, UART0_C4_MAEN1(value)))
20366 #define UART0_BWR_C4_MAEN1(base, value) (BME_BFI8(&UART0_C4_REG(base), ((uint8_t)(value) << UART0_C4_MAEN1_SHIFT), UART0_C4_MAEN1_SHIFT, UART0_C4_MAEN1_WIDTH))
20367 /*@}*/
20368 
20369 /*******************************************************************************
20370  * UART0_C5 - UART Control Register 5
20371  ******************************************************************************/
20372 
20373 /*!
20374  * @brief UART0_C5 - UART Control Register 5 (RW)
20375  *
20376  * Reset value: 0x00U
20377  */
20378 /*!
20379  * @name Constants and macros for entire UART0_C5 register
20380  */
20381 /*@{*/
20382 #define UART0_RD_C5(base) (UART0_C5_REG(base))
20383 #define UART0_WR_C5(base, value) (UART0_C5_REG(base) = (value))
20384 #define UART0_RMW_C5(base, mask, value) (UART0_WR_C5(base, (UART0_RD_C5(base) & ~(mask)) | (value)))
20385 #define UART0_SET_C5(base, value) (BME_OR8(&UART0_C5_REG(base), (uint8_t)(value)))
20386 #define UART0_CLR_C5(base, value) (BME_AND8(&UART0_C5_REG(base), (uint8_t)(~(value))))
20387 #define UART0_TOG_C5(base, value) (BME_XOR8(&UART0_C5_REG(base), (uint8_t)(value)))
20388 /*@}*/
20389 
20390 /*
20391  * Constants & macros for individual UART0_C5 bitfields
20392  */
20393 
20394 /*!
20395  * @name Register UART0_C5, field RESYNCDIS[0] (RW)
20396  *
20397  * When set, disables the resynchronization of the received data word when a
20398  * data one followed by data zero transition is detected. This bit should only be
20399  * changed when the receiver is disabled.
20400  *
20401  * Values:
20402  * - 0b0 - Resynchronization during received data word is supported
20403  * - 0b1 - Resynchronization during received data word is disabled
20404  */
20405 /*@{*/
20406 /*! @brief Read current value of the UART0_C5_RESYNCDIS field. */
20407 #define UART0_RD_C5_RESYNCDIS(base) ((UART0_C5_REG(base) & UART0_C5_RESYNCDIS_MASK) >> UART0_C5_RESYNCDIS_SHIFT)
20408 #define UART0_BRD_C5_RESYNCDIS(base) (BME_UBFX8(&UART0_C5_REG(base), UART0_C5_RESYNCDIS_SHIFT, UART0_C5_RESYNCDIS_WIDTH))
20409 
20410 /*! @brief Set the RESYNCDIS field to a new value. */
20411 #define UART0_WR_C5_RESYNCDIS(base, value) (UART0_RMW_C5(base, UART0_C5_RESYNCDIS_MASK, UART0_C5_RESYNCDIS(value)))
20412 #define UART0_BWR_C5_RESYNCDIS(base, value) (BME_BFI8(&UART0_C5_REG(base), ((uint8_t)(value) << UART0_C5_RESYNCDIS_SHIFT), UART0_C5_RESYNCDIS_SHIFT, UART0_C5_RESYNCDIS_WIDTH))
20413 /*@}*/
20414 
20415 /*!
20416  * @name Register UART0_C5, field BOTHEDGE[1] (RW)
20417  *
20418  * Enables sampling of the received data on both edges of the baud rate clock,
20419  * effectively doubling the number of times the receiver samples the input data
20420  * for a given oversampling ratio. This bit must be set for oversampling ratios
20421  * between x4 and x7 and is optional for higher oversampling ratios. This bit should
20422  * only be changed when the receiver is disabled.
20423  *
20424  * Values:
20425  * - 0b0 - Receiver samples input data using the rising edge of the baud rate
20426  * clock.
20427  * - 0b1 - Receiver samples input data using the rising and falling edge of the
20428  * baud rate clock.
20429  */
20430 /*@{*/
20431 /*! @brief Read current value of the UART0_C5_BOTHEDGE field. */
20432 #define UART0_RD_C5_BOTHEDGE(base) ((UART0_C5_REG(base) & UART0_C5_BOTHEDGE_MASK) >> UART0_C5_BOTHEDGE_SHIFT)
20433 #define UART0_BRD_C5_BOTHEDGE(base) (BME_UBFX8(&UART0_C5_REG(base), UART0_C5_BOTHEDGE_SHIFT, UART0_C5_BOTHEDGE_WIDTH))
20434 
20435 /*! @brief Set the BOTHEDGE field to a new value. */
20436 #define UART0_WR_C5_BOTHEDGE(base, value) (UART0_RMW_C5(base, UART0_C5_BOTHEDGE_MASK, UART0_C5_BOTHEDGE(value)))
20437 #define UART0_BWR_C5_BOTHEDGE(base, value) (BME_BFI8(&UART0_C5_REG(base), ((uint8_t)(value) << UART0_C5_BOTHEDGE_SHIFT), UART0_C5_BOTHEDGE_SHIFT, UART0_C5_BOTHEDGE_WIDTH))
20438 /*@}*/
20439 
20440 /*!
20441  * @name Register UART0_C5, field RDMAE[5] (RW)
20442  *
20443  * RDMAE configures the receiver data register full flag, S1[RDRF], to generate
20444  * a DMA request.
20445  *
20446  * Values:
20447  * - 0b0 - DMA request disabled.
20448  * - 0b1 - DMA request enabled.
20449  */
20450 /*@{*/
20451 /*! @brief Read current value of the UART0_C5_RDMAE field. */
20452 #define UART0_RD_C5_RDMAE(base) ((UART0_C5_REG(base) & UART0_C5_RDMAE_MASK) >> UART0_C5_RDMAE_SHIFT)
20453 #define UART0_BRD_C5_RDMAE(base) (BME_UBFX8(&UART0_C5_REG(base), UART0_C5_RDMAE_SHIFT, UART0_C5_RDMAE_WIDTH))
20454 
20455 /*! @brief Set the RDMAE field to a new value. */
20456 #define UART0_WR_C5_RDMAE(base, value) (UART0_RMW_C5(base, UART0_C5_RDMAE_MASK, UART0_C5_RDMAE(value)))
20457 #define UART0_BWR_C5_RDMAE(base, value) (BME_BFI8(&UART0_C5_REG(base), ((uint8_t)(value) << UART0_C5_RDMAE_SHIFT), UART0_C5_RDMAE_SHIFT, UART0_C5_RDMAE_WIDTH))
20458 /*@}*/
20459 
20460 /*!
20461  * @name Register UART0_C5, field TDMAE[7] (RW)
20462  *
20463  * TDMAE configures the transmit data register empty flag, S1[TDRE], to generate
20464  * a DMA request.
20465  *
20466  * Values:
20467  * - 0b0 - DMA request disabled.
20468  * - 0b1 - DMA request enabled.
20469  */
20470 /*@{*/
20471 /*! @brief Read current value of the UART0_C5_TDMAE field. */
20472 #define UART0_RD_C5_TDMAE(base) ((UART0_C5_REG(base) & UART0_C5_TDMAE_MASK) >> UART0_C5_TDMAE_SHIFT)
20473 #define UART0_BRD_C5_TDMAE(base) (BME_UBFX8(&UART0_C5_REG(base), UART0_C5_TDMAE_SHIFT, UART0_C5_TDMAE_WIDTH))
20474 
20475 /*! @brief Set the TDMAE field to a new value. */
20476 #define UART0_WR_C5_TDMAE(base, value) (UART0_RMW_C5(base, UART0_C5_TDMAE_MASK, UART0_C5_TDMAE(value)))
20477 #define UART0_BWR_C5_TDMAE(base, value) (BME_BFI8(&UART0_C5_REG(base), ((uint8_t)(value) << UART0_C5_TDMAE_SHIFT), UART0_C5_TDMAE_SHIFT, UART0_C5_TDMAE_WIDTH))
20478 /*@}*/
20479 
20480 /*
20481  * MKL25Z4 USB
20482  *
20483  * Universal Serial Bus, OTG Capable Controller
20484  *
20485  * Registers defined in this header file:
20486  * - USB_PERID - Peripheral ID register
20487  * - USB_IDCOMP - Peripheral ID Complement register
20488  * - USB_REV - Peripheral Revision register
20489  * - USB_ADDINFO - Peripheral Additional Info register
20490  * - USB_OTGISTAT - OTG Interrupt Status register
20491  * - USB_OTGICR - OTG Interrupt Control Register
20492  * - USB_OTGSTAT - OTG Status register
20493  * - USB_OTGCTL - OTG Control register
20494  * - USB_ISTAT - Interrupt Status register
20495  * - USB_INTEN - Interrupt Enable register
20496  * - USB_ERRSTAT - Error Interrupt Status register
20497  * - USB_ERREN - Error Interrupt Enable register
20498  * - USB_STAT - Status register
20499  * - USB_CTL - Control register
20500  * - USB_ADDR - Address register
20501  * - USB_BDTPAGE1 - BDT Page Register 1
20502  * - USB_FRMNUML - Frame Number Register Low
20503  * - USB_FRMNUMH - Frame Number Register High
20504  * - USB_TOKEN - Token register
20505  * - USB_SOFTHLD - SOF Threshold Register
20506  * - USB_BDTPAGE2 - BDT Page Register 2
20507  * - USB_BDTPAGE3 - BDT Page Register 3
20508  * - USB_ENDPT - Endpoint Control register
20509  * - USB_USBCTRL - USB Control register
20510  * - USB_OBSERVE - USB OTG Observe register
20511  * - USB_CONTROL - USB OTG Control register
20512  * - USB_USBTRC0 - USB Transceiver Control Register 0
20513  * - USB_USBFRMADJUST - Frame Adjust Register
20514  */
20515 
20516 #define USB_INSTANCE_COUNT (1U) /*!< Number of instances of the USB module. */
20517 #define USB0_IDX (0U) /*!< Instance number for USB0. */
20518 
20519 /*******************************************************************************
20520  * USB_PERID - Peripheral ID register
20521  ******************************************************************************/
20522 
20523 /*!
20524  * @brief USB_PERID - Peripheral ID register (RO)
20525  *
20526  * Reset value: 0x04U
20527  *
20528  * Reads back the value of 0x04. This value is defined for the USB peripheral.
20529  */
20530 /*!
20531  * @name Constants and macros for entire USB_PERID register
20532  */
20533 /*@{*/
20534 #define USB_RD_PERID(base) (USB_PERID_REG(base))
20535 /*@}*/
20536 
20537 /*
20538  * Constants & macros for individual USB_PERID bitfields
20539  */
20540 
20541 /*!
20542  * @name Register USB_PERID, field ID[5:0] (RO)
20543  *
20544  * This field always reads 0x4h.
20545  */
20546 /*@{*/
20547 /*! @brief Read current value of the USB_PERID_ID field. */
20548 #define USB_RD_PERID_ID(base) ((USB_PERID_REG(base) & USB_PERID_ID_MASK) >> USB_PERID_ID_SHIFT)
20549 #define USB_BRD_PERID_ID(base) (BME_UBFX8(&USB_PERID_REG(base), USB_PERID_ID_SHIFT, USB_PERID_ID_WIDTH))
20550 /*@}*/
20551 
20552 /*******************************************************************************
20553  * USB_IDCOMP - Peripheral ID Complement register
20554  ******************************************************************************/
20555 
20556 /*!
20557  * @brief USB_IDCOMP - Peripheral ID Complement register (RO)
20558  *
20559  * Reset value: 0xFBU
20560  *
20561  * Reads back the complement of the Peripheral ID register. For the USB
20562  * peripheral, the value is 0xFB.
20563  */
20564 /*!
20565  * @name Constants and macros for entire USB_IDCOMP register
20566  */
20567 /*@{*/
20568 #define USB_RD_IDCOMP(base) (USB_IDCOMP_REG(base))
20569 /*@}*/
20570 
20571 /*
20572  * Constants & macros for individual USB_IDCOMP bitfields
20573  */
20574 
20575 /*!
20576  * @name Register USB_IDCOMP, field NID[5:0] (RO)
20577  *
20578  * Ones complement of peripheral identification bits.
20579  */
20580 /*@{*/
20581 /*! @brief Read current value of the USB_IDCOMP_NID field. */
20582 #define USB_RD_IDCOMP_NID(base) ((USB_IDCOMP_REG(base) & USB_IDCOMP_NID_MASK) >> USB_IDCOMP_NID_SHIFT)
20583 #define USB_BRD_IDCOMP_NID(base) (BME_UBFX8(&USB_IDCOMP_REG(base), USB_IDCOMP_NID_SHIFT, USB_IDCOMP_NID_WIDTH))
20584 /*@}*/
20585 
20586 /*******************************************************************************
20587  * USB_REV - Peripheral Revision register
20588  ******************************************************************************/
20589 
20590 /*!
20591  * @brief USB_REV - Peripheral Revision register (RO)
20592  *
20593  * Reset value: 0x33U
20594  *
20595  * Contains the revision number of the USB module.
20596  */
20597 /*!
20598  * @name Constants and macros for entire USB_REV register
20599  */
20600 /*@{*/
20601 #define USB_RD_REV(base) (USB_REV_REG(base))
20602 /*@}*/
20603 
20604 /*******************************************************************************
20605  * USB_ADDINFO - Peripheral Additional Info register
20606  ******************************************************************************/
20607 
20608 /*!
20609  * @brief USB_ADDINFO - Peripheral Additional Info register (RO)
20610  *
20611  * Reset value: 0x01U
20612  *
20613  * Reads back the value of the fixed Interrupt Request Level (IRQNUM) along with
20614  * the Host Enable bit.
20615  */
20616 /*!
20617  * @name Constants and macros for entire USB_ADDINFO register
20618  */
20619 /*@{*/
20620 #define USB_RD_ADDINFO(base) (USB_ADDINFO_REG(base))
20621 /*@}*/
20622 
20623 /*
20624  * Constants & macros for individual USB_ADDINFO bitfields
20625  */
20626 
20627 /*!
20628  * @name Register USB_ADDINFO, field IEHOST[0] (RO)
20629  *
20630  * When this bit is set, the USB peripheral is operating in host mode.
20631  */
20632 /*@{*/
20633 /*! @brief Read current value of the USB_ADDINFO_IEHOST field. */
20634 #define USB_RD_ADDINFO_IEHOST(base) ((USB_ADDINFO_REG(base) & USB_ADDINFO_IEHOST_MASK) >> USB_ADDINFO_IEHOST_SHIFT)
20635 #define USB_BRD_ADDINFO_IEHOST(base) (BME_UBFX8(&USB_ADDINFO_REG(base), USB_ADDINFO_IEHOST_SHIFT, USB_ADDINFO_IEHOST_WIDTH))
20636 /*@}*/
20637 
20638 /*!
20639  * @name Register USB_ADDINFO, field IRQNUM[7:3] (RO)
20640  */
20641 /*@{*/
20642 /*! @brief Read current value of the USB_ADDINFO_IRQNUM field. */
20643 #define USB_RD_ADDINFO_IRQNUM(base) ((USB_ADDINFO_REG(base) & USB_ADDINFO_IRQNUM_MASK) >> USB_ADDINFO_IRQNUM_SHIFT)
20644 #define USB_BRD_ADDINFO_IRQNUM(base) (BME_UBFX8(&USB_ADDINFO_REG(base), USB_ADDINFO_IRQNUM_SHIFT, USB_ADDINFO_IRQNUM_WIDTH))
20645 /*@}*/
20646 
20647 /*******************************************************************************
20648  * USB_OTGISTAT - OTG Interrupt Status register
20649  ******************************************************************************/
20650 
20651 /*!
20652  * @brief USB_OTGISTAT - OTG Interrupt Status register (RW)
20653  *
20654  * Reset value: 0x00U
20655  *
20656  * Records changes of the ID sense and VBUS signals. Software can read this
20657  * register to determine the event that triggers interrupt. Only bits that have
20658  * changed since the last software read are set. Writing a one to a bit clears the
20659  * associated interrupt.
20660  */
20661 /*!
20662  * @name Constants and macros for entire USB_OTGISTAT register
20663  */
20664 /*@{*/
20665 #define USB_RD_OTGISTAT(base) (USB_OTGISTAT_REG(base))
20666 #define USB_WR_OTGISTAT(base, value) (USB_OTGISTAT_REG(base) = (value))
20667 #define USB_RMW_OTGISTAT(base, mask, value) (USB_WR_OTGISTAT(base, (USB_RD_OTGISTAT(base) & ~(mask)) | (value)))
20668 #define USB_SET_OTGISTAT(base, value) (BME_OR8(&USB_OTGISTAT_REG(base), (uint8_t)(value)))
20669 #define USB_CLR_OTGISTAT(base, value) (BME_AND8(&USB_OTGISTAT_REG(base), (uint8_t)(~(value))))
20670 #define USB_TOG_OTGISTAT(base, value) (BME_XOR8(&USB_OTGISTAT_REG(base), (uint8_t)(value)))
20671 /*@}*/
20672 
20673 /*
20674  * Constants & macros for individual USB_OTGISTAT bitfields
20675  */
20676 
20677 /*!
20678  * @name Register USB_OTGISTAT, field AVBUSCHG[0] (RW)
20679  *
20680  * This bit is set when a change in VBUS is detected on an A device.
20681  */
20682 /*@{*/
20683 /*! @brief Read current value of the USB_OTGISTAT_AVBUSCHG field. */
20684 #define USB_RD_OTGISTAT_AVBUSCHG(base) ((USB_OTGISTAT_REG(base) & USB_OTGISTAT_AVBUSCHG_MASK) >> USB_OTGISTAT_AVBUSCHG_SHIFT)
20685 #define USB_BRD_OTGISTAT_AVBUSCHG(base) (BME_UBFX8(&USB_OTGISTAT_REG(base), USB_OTGISTAT_AVBUSCHG_SHIFT, USB_OTGISTAT_AVBUSCHG_WIDTH))
20686 
20687 /*! @brief Set the AVBUSCHG field to a new value. */
20688 #define USB_WR_OTGISTAT_AVBUSCHG(base, value) (USB_RMW_OTGISTAT(base, USB_OTGISTAT_AVBUSCHG_MASK, USB_OTGISTAT_AVBUSCHG(value)))
20689 #define USB_BWR_OTGISTAT_AVBUSCHG(base, value) (BME_BFI8(&USB_OTGISTAT_REG(base), ((uint8_t)(value) << USB_OTGISTAT_AVBUSCHG_SHIFT), USB_OTGISTAT_AVBUSCHG_SHIFT, USB_OTGISTAT_AVBUSCHG_WIDTH))
20690 /*@}*/
20691 
20692 /*!
20693  * @name Register USB_OTGISTAT, field B_SESS_CHG[2] (RW)
20694  *
20695  * This bit is set when a change in VBUS is detected on a B device.
20696  */
20697 /*@{*/
20698 /*! @brief Read current value of the USB_OTGISTAT_B_SESS_CHG field. */
20699 #define USB_RD_OTGISTAT_B_SESS_CHG(base) ((USB_OTGISTAT_REG(base) & USB_OTGISTAT_B_SESS_CHG_MASK) >> USB_OTGISTAT_B_SESS_CHG_SHIFT)
20700 #define USB_BRD_OTGISTAT_B_SESS_CHG(base) (BME_UBFX8(&USB_OTGISTAT_REG(base), USB_OTGISTAT_B_SESS_CHG_SHIFT, USB_OTGISTAT_B_SESS_CHG_WIDTH))
20701 
20702 /*! @brief Set the B_SESS_CHG field to a new value. */
20703 #define USB_WR_OTGISTAT_B_SESS_CHG(base, value) (USB_RMW_OTGISTAT(base, USB_OTGISTAT_B_SESS_CHG_MASK, USB_OTGISTAT_B_SESS_CHG(value)))
20704 #define USB_BWR_OTGISTAT_B_SESS_CHG(base, value) (BME_BFI8(&USB_OTGISTAT_REG(base), ((uint8_t)(value) << USB_OTGISTAT_B_SESS_CHG_SHIFT), USB_OTGISTAT_B_SESS_CHG_SHIFT, USB_OTGISTAT_B_SESS_CHG_WIDTH))
20705 /*@}*/
20706 
20707 /*!
20708  * @name Register USB_OTGISTAT, field SESSVLDCHG[3] (RW)
20709  *
20710  * This bit is set when a change in VBUS is detected indicating a session valid
20711  * or a session no longer valid.
20712  */
20713 /*@{*/
20714 /*! @brief Read current value of the USB_OTGISTAT_SESSVLDCHG field. */
20715 #define USB_RD_OTGISTAT_SESSVLDCHG(base) ((USB_OTGISTAT_REG(base) & USB_OTGISTAT_SESSVLDCHG_MASK) >> USB_OTGISTAT_SESSVLDCHG_SHIFT)
20716 #define USB_BRD_OTGISTAT_SESSVLDCHG(base) (BME_UBFX8(&USB_OTGISTAT_REG(base), USB_OTGISTAT_SESSVLDCHG_SHIFT, USB_OTGISTAT_SESSVLDCHG_WIDTH))
20717 
20718 /*! @brief Set the SESSVLDCHG field to a new value. */
20719 #define USB_WR_OTGISTAT_SESSVLDCHG(base, value) (USB_RMW_OTGISTAT(base, USB_OTGISTAT_SESSVLDCHG_MASK, USB_OTGISTAT_SESSVLDCHG(value)))
20720 #define USB_BWR_OTGISTAT_SESSVLDCHG(base, value) (BME_BFI8(&USB_OTGISTAT_REG(base), ((uint8_t)(value) << USB_OTGISTAT_SESSVLDCHG_SHIFT), USB_OTGISTAT_SESSVLDCHG_SHIFT, USB_OTGISTAT_SESSVLDCHG_WIDTH))
20721 /*@}*/
20722 
20723 /*!
20724  * @name Register USB_OTGISTAT, field LINE_STATE_CHG[5] (RW)
20725  *
20726  * This bit is set when the USB line state changes. The interrupt associated
20727  * with this bit can be used to detect Reset, Resume, Connect, and Data Line Pulse
20728  * signaling
20729  */
20730 /*@{*/
20731 /*! @brief Read current value of the USB_OTGISTAT_LINE_STATE_CHG field. */
20732 #define USB_RD_OTGISTAT_LINE_STATE_CHG(base) ((USB_OTGISTAT_REG(base) & USB_OTGISTAT_LINE_STATE_CHG_MASK) >> USB_OTGISTAT_LINE_STATE_CHG_SHIFT)
20733 #define USB_BRD_OTGISTAT_LINE_STATE_CHG(base) (BME_UBFX8(&USB_OTGISTAT_REG(base), USB_OTGISTAT_LINE_STATE_CHG_SHIFT, USB_OTGISTAT_LINE_STATE_CHG_WIDTH))
20734 
20735 /*! @brief Set the LINE_STATE_CHG field to a new value. */
20736 #define USB_WR_OTGISTAT_LINE_STATE_CHG(base, value) (USB_RMW_OTGISTAT(base, USB_OTGISTAT_LINE_STATE_CHG_MASK, USB_OTGISTAT_LINE_STATE_CHG(value)))
20737 #define USB_BWR_OTGISTAT_LINE_STATE_CHG(base, value) (BME_BFI8(&USB_OTGISTAT_REG(base), ((uint8_t)(value) << USB_OTGISTAT_LINE_STATE_CHG_SHIFT), USB_OTGISTAT_LINE_STATE_CHG_SHIFT, USB_OTGISTAT_LINE_STATE_CHG_WIDTH))
20738 /*@}*/
20739 
20740 /*!
20741  * @name Register USB_OTGISTAT, field ONEMSEC[6] (RW)
20742  *
20743  * This bit is set when the 1 millisecond timer expires. This bit stays asserted
20744  * until cleared by software. The interrupt must be serviced every millisecond
20745  * to avoid losing 1msec counts.
20746  */
20747 /*@{*/
20748 /*! @brief Read current value of the USB_OTGISTAT_ONEMSEC field. */
20749 #define USB_RD_OTGISTAT_ONEMSEC(base) ((USB_OTGISTAT_REG(base) & USB_OTGISTAT_ONEMSEC_MASK) >> USB_OTGISTAT_ONEMSEC_SHIFT)
20750 #define USB_BRD_OTGISTAT_ONEMSEC(base) (BME_UBFX8(&USB_OTGISTAT_REG(base), USB_OTGISTAT_ONEMSEC_SHIFT, USB_OTGISTAT_ONEMSEC_WIDTH))
20751 
20752 /*! @brief Set the ONEMSEC field to a new value. */
20753 #define USB_WR_OTGISTAT_ONEMSEC(base, value) (USB_RMW_OTGISTAT(base, USB_OTGISTAT_ONEMSEC_MASK, USB_OTGISTAT_ONEMSEC(value)))
20754 #define USB_BWR_OTGISTAT_ONEMSEC(base, value) (BME_BFI8(&USB_OTGISTAT_REG(base), ((uint8_t)(value) << USB_OTGISTAT_ONEMSEC_SHIFT), USB_OTGISTAT_ONEMSEC_SHIFT, USB_OTGISTAT_ONEMSEC_WIDTH))
20755 /*@}*/
20756 
20757 /*!
20758  * @name Register USB_OTGISTAT, field IDCHG[7] (RW)
20759  *
20760  * This bit is set when a change in the ID Signal from the USB connector is
20761  * sensed.
20762  */
20763 /*@{*/
20764 /*! @brief Read current value of the USB_OTGISTAT_IDCHG field. */
20765 #define USB_RD_OTGISTAT_IDCHG(base) ((USB_OTGISTAT_REG(base) & USB_OTGISTAT_IDCHG_MASK) >> USB_OTGISTAT_IDCHG_SHIFT)
20766 #define USB_BRD_OTGISTAT_IDCHG(base) (BME_UBFX8(&USB_OTGISTAT_REG(base), USB_OTGISTAT_IDCHG_SHIFT, USB_OTGISTAT_IDCHG_WIDTH))
20767 
20768 /*! @brief Set the IDCHG field to a new value. */
20769 #define USB_WR_OTGISTAT_IDCHG(base, value) (USB_RMW_OTGISTAT(base, USB_OTGISTAT_IDCHG_MASK, USB_OTGISTAT_IDCHG(value)))
20770 #define USB_BWR_OTGISTAT_IDCHG(base, value) (BME_BFI8(&USB_OTGISTAT_REG(base), ((uint8_t)(value) << USB_OTGISTAT_IDCHG_SHIFT), USB_OTGISTAT_IDCHG_SHIFT, USB_OTGISTAT_IDCHG_WIDTH))
20771 /*@}*/
20772 
20773 /*******************************************************************************
20774  * USB_OTGICR - OTG Interrupt Control Register
20775  ******************************************************************************/
20776 
20777 /*!
20778  * @brief USB_OTGICR - OTG Interrupt Control Register (RW)
20779  *
20780  * Reset value: 0x00U
20781  *
20782  * Enables the corresponding interrupt status bits defined in the OTG Interrupt
20783  * Status Register.
20784  */
20785 /*!
20786  * @name Constants and macros for entire USB_OTGICR register
20787  */
20788 /*@{*/
20789 #define USB_RD_OTGICR(base) (USB_OTGICR_REG(base))
20790 #define USB_WR_OTGICR(base, value) (USB_OTGICR_REG(base) = (value))
20791 #define USB_RMW_OTGICR(base, mask, value) (USB_WR_OTGICR(base, (USB_RD_OTGICR(base) & ~(mask)) | (value)))
20792 #define USB_SET_OTGICR(base, value) (BME_OR8(&USB_OTGICR_REG(base), (uint8_t)(value)))
20793 #define USB_CLR_OTGICR(base, value) (BME_AND8(&USB_OTGICR_REG(base), (uint8_t)(~(value))))
20794 #define USB_TOG_OTGICR(base, value) (BME_XOR8(&USB_OTGICR_REG(base), (uint8_t)(value)))
20795 /*@}*/
20796 
20797 /*
20798  * Constants & macros for individual USB_OTGICR bitfields
20799  */
20800 
20801 /*!
20802  * @name Register USB_OTGICR, field AVBUSEN[0] (RW)
20803  *
20804  * Values:
20805  * - 0b0 - Disables the AVBUSCHG interrupt.
20806  * - 0b1 - Enables the AVBUSCHG interrupt.
20807  */
20808 /*@{*/
20809 /*! @brief Read current value of the USB_OTGICR_AVBUSEN field. */
20810 #define USB_RD_OTGICR_AVBUSEN(base) ((USB_OTGICR_REG(base) & USB_OTGICR_AVBUSEN_MASK) >> USB_OTGICR_AVBUSEN_SHIFT)
20811 #define USB_BRD_OTGICR_AVBUSEN(base) (BME_UBFX8(&USB_OTGICR_REG(base), USB_OTGICR_AVBUSEN_SHIFT, USB_OTGICR_AVBUSEN_WIDTH))
20812 
20813 /*! @brief Set the AVBUSEN field to a new value. */
20814 #define USB_WR_OTGICR_AVBUSEN(base, value) (USB_RMW_OTGICR(base, USB_OTGICR_AVBUSEN_MASK, USB_OTGICR_AVBUSEN(value)))
20815 #define USB_BWR_OTGICR_AVBUSEN(base, value) (BME_BFI8(&USB_OTGICR_REG(base), ((uint8_t)(value) << USB_OTGICR_AVBUSEN_SHIFT), USB_OTGICR_AVBUSEN_SHIFT, USB_OTGICR_AVBUSEN_WIDTH))
20816 /*@}*/
20817 
20818 /*!
20819  * @name Register USB_OTGICR, field BSESSEN[2] (RW)
20820  *
20821  * Values:
20822  * - 0b0 - Disables the B_SESS_CHG interrupt.
20823  * - 0b1 - Enables the B_SESS_CHG interrupt.
20824  */
20825 /*@{*/
20826 /*! @brief Read current value of the USB_OTGICR_BSESSEN field. */
20827 #define USB_RD_OTGICR_BSESSEN(base) ((USB_OTGICR_REG(base) & USB_OTGICR_BSESSEN_MASK) >> USB_OTGICR_BSESSEN_SHIFT)
20828 #define USB_BRD_OTGICR_BSESSEN(base) (BME_UBFX8(&USB_OTGICR_REG(base), USB_OTGICR_BSESSEN_SHIFT, USB_OTGICR_BSESSEN_WIDTH))
20829 
20830 /*! @brief Set the BSESSEN field to a new value. */
20831 #define USB_WR_OTGICR_BSESSEN(base, value) (USB_RMW_OTGICR(base, USB_OTGICR_BSESSEN_MASK, USB_OTGICR_BSESSEN(value)))
20832 #define USB_BWR_OTGICR_BSESSEN(base, value) (BME_BFI8(&USB_OTGICR_REG(base), ((uint8_t)(value) << USB_OTGICR_BSESSEN_SHIFT), USB_OTGICR_BSESSEN_SHIFT, USB_OTGICR_BSESSEN_WIDTH))
20833 /*@}*/
20834 
20835 /*!
20836  * @name Register USB_OTGICR, field SESSVLDEN[3] (RW)
20837  *
20838  * Values:
20839  * - 0b0 - Disables the SESSVLDCHG interrupt.
20840  * - 0b1 - Enables the SESSVLDCHG interrupt.
20841  */
20842 /*@{*/
20843 /*! @brief Read current value of the USB_OTGICR_SESSVLDEN field. */
20844 #define USB_RD_OTGICR_SESSVLDEN(base) ((USB_OTGICR_REG(base) & USB_OTGICR_SESSVLDEN_MASK) >> USB_OTGICR_SESSVLDEN_SHIFT)
20845 #define USB_BRD_OTGICR_SESSVLDEN(base) (BME_UBFX8(&USB_OTGICR_REG(base), USB_OTGICR_SESSVLDEN_SHIFT, USB_OTGICR_SESSVLDEN_WIDTH))
20846 
20847 /*! @brief Set the SESSVLDEN field to a new value. */
20848 #define USB_WR_OTGICR_SESSVLDEN(base, value) (USB_RMW_OTGICR(base, USB_OTGICR_SESSVLDEN_MASK, USB_OTGICR_SESSVLDEN(value)))
20849 #define USB_BWR_OTGICR_SESSVLDEN(base, value) (BME_BFI8(&USB_OTGICR_REG(base), ((uint8_t)(value) << USB_OTGICR_SESSVLDEN_SHIFT), USB_OTGICR_SESSVLDEN_SHIFT, USB_OTGICR_SESSVLDEN_WIDTH))
20850 /*@}*/
20851 
20852 /*!
20853  * @name Register USB_OTGICR, field LINESTATEEN[5] (RW)
20854  *
20855  * Values:
20856  * - 0b0 - Disables the LINE_STAT_CHG interrupt.
20857  * - 0b1 - Enables the LINE_STAT_CHG interrupt.
20858  */
20859 /*@{*/
20860 /*! @brief Read current value of the USB_OTGICR_LINESTATEEN field. */
20861 #define USB_RD_OTGICR_LINESTATEEN(base) ((USB_OTGICR_REG(base) & USB_OTGICR_LINESTATEEN_MASK) >> USB_OTGICR_LINESTATEEN_SHIFT)
20862 #define USB_BRD_OTGICR_LINESTATEEN(base) (BME_UBFX8(&USB_OTGICR_REG(base), USB_OTGICR_LINESTATEEN_SHIFT, USB_OTGICR_LINESTATEEN_WIDTH))
20863 
20864 /*! @brief Set the LINESTATEEN field to a new value. */
20865 #define USB_WR_OTGICR_LINESTATEEN(base, value) (USB_RMW_OTGICR(base, USB_OTGICR_LINESTATEEN_MASK, USB_OTGICR_LINESTATEEN(value)))
20866 #define USB_BWR_OTGICR_LINESTATEEN(base, value) (BME_BFI8(&USB_OTGICR_REG(base), ((uint8_t)(value) << USB_OTGICR_LINESTATEEN_SHIFT), USB_OTGICR_LINESTATEEN_SHIFT, USB_OTGICR_LINESTATEEN_WIDTH))
20867 /*@}*/
20868 
20869 /*!
20870  * @name Register USB_OTGICR, field ONEMSECEN[6] (RW)
20871  *
20872  * Values:
20873  * - 0b0 - Diables the 1ms timer interrupt.
20874  * - 0b1 - Enables the 1ms timer interrupt.
20875  */
20876 /*@{*/
20877 /*! @brief Read current value of the USB_OTGICR_ONEMSECEN field. */
20878 #define USB_RD_OTGICR_ONEMSECEN(base) ((USB_OTGICR_REG(base) & USB_OTGICR_ONEMSECEN_MASK) >> USB_OTGICR_ONEMSECEN_SHIFT)
20879 #define USB_BRD_OTGICR_ONEMSECEN(base) (BME_UBFX8(&USB_OTGICR_REG(base), USB_OTGICR_ONEMSECEN_SHIFT, USB_OTGICR_ONEMSECEN_WIDTH))
20880 
20881 /*! @brief Set the ONEMSECEN field to a new value. */
20882 #define USB_WR_OTGICR_ONEMSECEN(base, value) (USB_RMW_OTGICR(base, USB_OTGICR_ONEMSECEN_MASK, USB_OTGICR_ONEMSECEN(value)))
20883 #define USB_BWR_OTGICR_ONEMSECEN(base, value) (BME_BFI8(&USB_OTGICR_REG(base), ((uint8_t)(value) << USB_OTGICR_ONEMSECEN_SHIFT), USB_OTGICR_ONEMSECEN_SHIFT, USB_OTGICR_ONEMSECEN_WIDTH))
20884 /*@}*/
20885 
20886 /*!
20887  * @name Register USB_OTGICR, field IDEN[7] (RW)
20888  *
20889  * Values:
20890  * - 0b0 - The ID interrupt is disabled
20891  * - 0b1 - The ID interrupt is enabled
20892  */
20893 /*@{*/
20894 /*! @brief Read current value of the USB_OTGICR_IDEN field. */
20895 #define USB_RD_OTGICR_IDEN(base) ((USB_OTGICR_REG(base) & USB_OTGICR_IDEN_MASK) >> USB_OTGICR_IDEN_SHIFT)
20896 #define USB_BRD_OTGICR_IDEN(base) (BME_UBFX8(&USB_OTGICR_REG(base), USB_OTGICR_IDEN_SHIFT, USB_OTGICR_IDEN_WIDTH))
20897 
20898 /*! @brief Set the IDEN field to a new value. */
20899 #define USB_WR_OTGICR_IDEN(base, value) (USB_RMW_OTGICR(base, USB_OTGICR_IDEN_MASK, USB_OTGICR_IDEN(value)))
20900 #define USB_BWR_OTGICR_IDEN(base, value) (BME_BFI8(&USB_OTGICR_REG(base), ((uint8_t)(value) << USB_OTGICR_IDEN_SHIFT), USB_OTGICR_IDEN_SHIFT, USB_OTGICR_IDEN_WIDTH))
20901 /*@}*/
20902 
20903 /*******************************************************************************
20904  * USB_OTGSTAT - OTG Status register
20905  ******************************************************************************/
20906 
20907 /*!
20908  * @brief USB_OTGSTAT - OTG Status register (RW)
20909  *
20910  * Reset value: 0x00U
20911  *
20912  * Displays the actual value from the external comparator outputs of the ID pin
20913  * and VBUS.
20914  */
20915 /*!
20916  * @name Constants and macros for entire USB_OTGSTAT register
20917  */
20918 /*@{*/
20919 #define USB_RD_OTGSTAT(base) (USB_OTGSTAT_REG(base))
20920 #define USB_WR_OTGSTAT(base, value) (USB_OTGSTAT_REG(base) = (value))
20921 #define USB_RMW_OTGSTAT(base, mask, value) (USB_WR_OTGSTAT(base, (USB_RD_OTGSTAT(base) & ~(mask)) | (value)))
20922 #define USB_SET_OTGSTAT(base, value) (BME_OR8(&USB_OTGSTAT_REG(base), (uint8_t)(value)))
20923 #define USB_CLR_OTGSTAT(base, value) (BME_AND8(&USB_OTGSTAT_REG(base), (uint8_t)(~(value))))
20924 #define USB_TOG_OTGSTAT(base, value) (BME_XOR8(&USB_OTGSTAT_REG(base), (uint8_t)(value)))
20925 /*@}*/
20926 
20927 /*
20928  * Constants & macros for individual USB_OTGSTAT bitfields
20929  */
20930 
20931 /*!
20932  * @name Register USB_OTGSTAT, field AVBUSVLD[0] (RW)
20933  *
20934  * Values:
20935  * - 0b0 - The VBUS voltage is below the A VBUS Valid threshold.
20936  * - 0b1 - The VBUS voltage is above the A VBUS Valid threshold.
20937  */
20938 /*@{*/
20939 /*! @brief Read current value of the USB_OTGSTAT_AVBUSVLD field. */
20940 #define USB_RD_OTGSTAT_AVBUSVLD(base) ((USB_OTGSTAT_REG(base) & USB_OTGSTAT_AVBUSVLD_MASK) >> USB_OTGSTAT_AVBUSVLD_SHIFT)
20941 #define USB_BRD_OTGSTAT_AVBUSVLD(base) (BME_UBFX8(&USB_OTGSTAT_REG(base), USB_OTGSTAT_AVBUSVLD_SHIFT, USB_OTGSTAT_AVBUSVLD_WIDTH))
20942 
20943 /*! @brief Set the AVBUSVLD field to a new value. */
20944 #define USB_WR_OTGSTAT_AVBUSVLD(base, value) (USB_RMW_OTGSTAT(base, USB_OTGSTAT_AVBUSVLD_MASK, USB_OTGSTAT_AVBUSVLD(value)))
20945 #define USB_BWR_OTGSTAT_AVBUSVLD(base, value) (BME_BFI8(&USB_OTGSTAT_REG(base), ((uint8_t)(value) << USB_OTGSTAT_AVBUSVLD_SHIFT), USB_OTGSTAT_AVBUSVLD_SHIFT, USB_OTGSTAT_AVBUSVLD_WIDTH))
20946 /*@}*/
20947 
20948 /*!
20949  * @name Register USB_OTGSTAT, field BSESSEND[2] (RW)
20950  *
20951  * Values:
20952  * - 0b0 - The VBUS voltage is above the B session end threshold.
20953  * - 0b1 - The VBUS voltage is below the B session end threshold.
20954  */
20955 /*@{*/
20956 /*! @brief Read current value of the USB_OTGSTAT_BSESSEND field. */
20957 #define USB_RD_OTGSTAT_BSESSEND(base) ((USB_OTGSTAT_REG(base) & USB_OTGSTAT_BSESSEND_MASK) >> USB_OTGSTAT_BSESSEND_SHIFT)
20958 #define USB_BRD_OTGSTAT_BSESSEND(base) (BME_UBFX8(&USB_OTGSTAT_REG(base), USB_OTGSTAT_BSESSEND_SHIFT, USB_OTGSTAT_BSESSEND_WIDTH))
20959 
20960 /*! @brief Set the BSESSEND field to a new value. */
20961 #define USB_WR_OTGSTAT_BSESSEND(base, value) (USB_RMW_OTGSTAT(base, USB_OTGSTAT_BSESSEND_MASK, USB_OTGSTAT_BSESSEND(value)))
20962 #define USB_BWR_OTGSTAT_BSESSEND(base, value) (BME_BFI8(&USB_OTGSTAT_REG(base), ((uint8_t)(value) << USB_OTGSTAT_BSESSEND_SHIFT), USB_OTGSTAT_BSESSEND_SHIFT, USB_OTGSTAT_BSESSEND_WIDTH))
20963 /*@}*/
20964 
20965 /*!
20966  * @name Register USB_OTGSTAT, field SESS_VLD[3] (RW)
20967  *
20968  * Values:
20969  * - 0b0 - The VBUS voltage is below the B session valid threshold
20970  * - 0b1 - The VBUS voltage is above the B session valid threshold.
20971  */
20972 /*@{*/
20973 /*! @brief Read current value of the USB_OTGSTAT_SESS_VLD field. */
20974 #define USB_RD_OTGSTAT_SESS_VLD(base) ((USB_OTGSTAT_REG(base) & USB_OTGSTAT_SESS_VLD_MASK) >> USB_OTGSTAT_SESS_VLD_SHIFT)
20975 #define USB_BRD_OTGSTAT_SESS_VLD(base) (BME_UBFX8(&USB_OTGSTAT_REG(base), USB_OTGSTAT_SESS_VLD_SHIFT, USB_OTGSTAT_SESS_VLD_WIDTH))
20976 
20977 /*! @brief Set the SESS_VLD field to a new value. */
20978 #define USB_WR_OTGSTAT_SESS_VLD(base, value) (USB_RMW_OTGSTAT(base, USB_OTGSTAT_SESS_VLD_MASK, USB_OTGSTAT_SESS_VLD(value)))
20979 #define USB_BWR_OTGSTAT_SESS_VLD(base, value) (BME_BFI8(&USB_OTGSTAT_REG(base), ((uint8_t)(value) << USB_OTGSTAT_SESS_VLD_SHIFT), USB_OTGSTAT_SESS_VLD_SHIFT, USB_OTGSTAT_SESS_VLD_WIDTH))
20980 /*@}*/
20981 
20982 /*!
20983  * @name Register USB_OTGSTAT, field LINESTATESTABLE[5] (RW)
20984  *
20985  * Indicates that the internal signals that control the LINE_STATE_CHG field of
20986  * OTGISTAT are stable for at least 1 millisecond. First read LINE_STATE_CHG
20987  * field and then read this field. If this field reads as 1, then the value of
20988  * LINE_STATE_CHG can be considered stable.
20989  *
20990  * Values:
20991  * - 0b0 - The LINE_STAT_CHG bit is not yet stable.
20992  * - 0b1 - The LINE_STAT_CHG bit has been debounced and is stable.
20993  */
20994 /*@{*/
20995 /*! @brief Read current value of the USB_OTGSTAT_LINESTATESTABLE field. */
20996 #define USB_RD_OTGSTAT_LINESTATESTABLE(base) ((USB_OTGSTAT_REG(base) & USB_OTGSTAT_LINESTATESTABLE_MASK) >> USB_OTGSTAT_LINESTATESTABLE_SHIFT)
20997 #define USB_BRD_OTGSTAT_LINESTATESTABLE(base) (BME_UBFX8(&USB_OTGSTAT_REG(base), USB_OTGSTAT_LINESTATESTABLE_SHIFT, USB_OTGSTAT_LINESTATESTABLE_WIDTH))
20998 
20999 /*! @brief Set the LINESTATESTABLE field to a new value. */
21000 #define USB_WR_OTGSTAT_LINESTATESTABLE(base, value) (USB_RMW_OTGSTAT(base, USB_OTGSTAT_LINESTATESTABLE_MASK, USB_OTGSTAT_LINESTATESTABLE(value)))
21001 #define USB_BWR_OTGSTAT_LINESTATESTABLE(base, value) (BME_BFI8(&USB_OTGSTAT_REG(base), ((uint8_t)(value) << USB_OTGSTAT_LINESTATESTABLE_SHIFT), USB_OTGSTAT_LINESTATESTABLE_SHIFT, USB_OTGSTAT_LINESTATESTABLE_WIDTH))
21002 /*@}*/
21003 
21004 /*!
21005  * @name Register USB_OTGSTAT, field ONEMSECEN[6] (RW)
21006  *
21007  * This bit is reserved for the 1ms count, but it is not useful to software.
21008  */
21009 /*@{*/
21010 /*! @brief Read current value of the USB_OTGSTAT_ONEMSECEN field. */
21011 #define USB_RD_OTGSTAT_ONEMSECEN(base) ((USB_OTGSTAT_REG(base) & USB_OTGSTAT_ONEMSECEN_MASK) >> USB_OTGSTAT_ONEMSECEN_SHIFT)
21012 #define USB_BRD_OTGSTAT_ONEMSECEN(base) (BME_UBFX8(&USB_OTGSTAT_REG(base), USB_OTGSTAT_ONEMSECEN_SHIFT, USB_OTGSTAT_ONEMSECEN_WIDTH))
21013 
21014 /*! @brief Set the ONEMSECEN field to a new value. */
21015 #define USB_WR_OTGSTAT_ONEMSECEN(base, value) (USB_RMW_OTGSTAT(base, USB_OTGSTAT_ONEMSECEN_MASK, USB_OTGSTAT_ONEMSECEN(value)))
21016 #define USB_BWR_OTGSTAT_ONEMSECEN(base, value) (BME_BFI8(&USB_OTGSTAT_REG(base), ((uint8_t)(value) << USB_OTGSTAT_ONEMSECEN_SHIFT), USB_OTGSTAT_ONEMSECEN_SHIFT, USB_OTGSTAT_ONEMSECEN_WIDTH))
21017 /*@}*/
21018 
21019 /*!
21020  * @name Register USB_OTGSTAT, field ID[7] (RW)
21021  *
21022  * Indicates the current state of the ID pin on the USB connector
21023  *
21024  * Values:
21025  * - 0b0 - Indicates a Type A cable is plugged into the USB connector.
21026  * - 0b1 - Indicates no cable is attached or a Type B cable is plugged into the
21027  * USB connector.
21028  */
21029 /*@{*/
21030 /*! @brief Read current value of the USB_OTGSTAT_ID field. */
21031 #define USB_RD_OTGSTAT_ID(base) ((USB_OTGSTAT_REG(base) & USB_OTGSTAT_ID_MASK) >> USB_OTGSTAT_ID_SHIFT)
21032 #define USB_BRD_OTGSTAT_ID(base) (BME_UBFX8(&USB_OTGSTAT_REG(base), USB_OTGSTAT_ID_SHIFT, USB_OTGSTAT_ID_WIDTH))
21033 
21034 /*! @brief Set the ID field to a new value. */
21035 #define USB_WR_OTGSTAT_ID(base, value) (USB_RMW_OTGSTAT(base, USB_OTGSTAT_ID_MASK, USB_OTGSTAT_ID(value)))
21036 #define USB_BWR_OTGSTAT_ID(base, value) (BME_BFI8(&USB_OTGSTAT_REG(base), ((uint8_t)(value) << USB_OTGSTAT_ID_SHIFT), USB_OTGSTAT_ID_SHIFT, USB_OTGSTAT_ID_WIDTH))
21037 /*@}*/
21038 
21039 /*******************************************************************************
21040  * USB_OTGCTL - OTG Control register
21041  ******************************************************************************/
21042 
21043 /*!
21044  * @brief USB_OTGCTL - OTG Control register (RW)
21045  *
21046  * Reset value: 0x00U
21047  *
21048  * Controls the operation of VBUS and Data Line termination resistors.
21049  */
21050 /*!
21051  * @name Constants and macros for entire USB_OTGCTL register
21052  */
21053 /*@{*/
21054 #define USB_RD_OTGCTL(base) (USB_OTGCTL_REG(base))
21055 #define USB_WR_OTGCTL(base, value) (USB_OTGCTL_REG(base) = (value))
21056 #define USB_RMW_OTGCTL(base, mask, value) (USB_WR_OTGCTL(base, (USB_RD_OTGCTL(base) & ~(mask)) | (value)))
21057 #define USB_SET_OTGCTL(base, value) (BME_OR8(&USB_OTGCTL_REG(base), (uint8_t)(value)))
21058 #define USB_CLR_OTGCTL(base, value) (BME_AND8(&USB_OTGCTL_REG(base), (uint8_t)(~(value))))
21059 #define USB_TOG_OTGCTL(base, value) (BME_XOR8(&USB_OTGCTL_REG(base), (uint8_t)(value)))
21060 /*@}*/
21061 
21062 /*
21063  * Constants & macros for individual USB_OTGCTL bitfields
21064  */
21065 
21066 /*!
21067  * @name Register USB_OTGCTL, field OTGEN[2] (RW)
21068  *
21069  * Values:
21070  * - 0b0 - If USB_EN is 1 and HOST_MODE is 0 in the Control Register (CTL), then
21071  * the D+ Data Line pull-up resistors are enabled. If HOST_MODE is 1 the D+
21072  * and D- Data Line pull-down resistors are engaged.
21073  * - 0b1 - The pull-up and pull-down controls in this register are used.
21074  */
21075 /*@{*/
21076 /*! @brief Read current value of the USB_OTGCTL_OTGEN field. */
21077 #define USB_RD_OTGCTL_OTGEN(base) ((USB_OTGCTL_REG(base) & USB_OTGCTL_OTGEN_MASK) >> USB_OTGCTL_OTGEN_SHIFT)
21078 #define USB_BRD_OTGCTL_OTGEN(base) (BME_UBFX8(&USB_OTGCTL_REG(base), USB_OTGCTL_OTGEN_SHIFT, USB_OTGCTL_OTGEN_WIDTH))
21079 
21080 /*! @brief Set the OTGEN field to a new value. */
21081 #define USB_WR_OTGCTL_OTGEN(base, value) (USB_RMW_OTGCTL(base, USB_OTGCTL_OTGEN_MASK, USB_OTGCTL_OTGEN(value)))
21082 #define USB_BWR_OTGCTL_OTGEN(base, value) (BME_BFI8(&USB_OTGCTL_REG(base), ((uint8_t)(value) << USB_OTGCTL_OTGEN_SHIFT), USB_OTGCTL_OTGEN_SHIFT, USB_OTGCTL_OTGEN_WIDTH))
21083 /*@}*/
21084 
21085 /*!
21086  * @name Register USB_OTGCTL, field DMLOW[4] (RW)
21087  *
21088  * Values:
21089  * - 0b0 - D- pulldown resistor is not enabled.
21090  * - 0b1 - D- pulldown resistor is enabled.
21091  */
21092 /*@{*/
21093 /*! @brief Read current value of the USB_OTGCTL_DMLOW field. */
21094 #define USB_RD_OTGCTL_DMLOW(base) ((USB_OTGCTL_REG(base) & USB_OTGCTL_DMLOW_MASK) >> USB_OTGCTL_DMLOW_SHIFT)
21095 #define USB_BRD_OTGCTL_DMLOW(base) (BME_UBFX8(&USB_OTGCTL_REG(base), USB_OTGCTL_DMLOW_SHIFT, USB_OTGCTL_DMLOW_WIDTH))
21096 
21097 /*! @brief Set the DMLOW field to a new value. */
21098 #define USB_WR_OTGCTL_DMLOW(base, value) (USB_RMW_OTGCTL(base, USB_OTGCTL_DMLOW_MASK, USB_OTGCTL_DMLOW(value)))
21099 #define USB_BWR_OTGCTL_DMLOW(base, value) (BME_BFI8(&USB_OTGCTL_REG(base), ((uint8_t)(value) << USB_OTGCTL_DMLOW_SHIFT), USB_OTGCTL_DMLOW_SHIFT, USB_OTGCTL_DMLOW_WIDTH))
21100 /*@}*/
21101 
21102 /*!
21103  * @name Register USB_OTGCTL, field DPLOW[5] (RW)
21104  *
21105  * This bit should always be enabled together with bit 4 (DMLOW)
21106  *
21107  * Values:
21108  * - 0b0 - D+ pulldown resistor is not enabled.
21109  * - 0b1 - D+ pulldown resistor is enabled.
21110  */
21111 /*@{*/
21112 /*! @brief Read current value of the USB_OTGCTL_DPLOW field. */
21113 #define USB_RD_OTGCTL_DPLOW(base) ((USB_OTGCTL_REG(base) & USB_OTGCTL_DPLOW_MASK) >> USB_OTGCTL_DPLOW_SHIFT)
21114 #define USB_BRD_OTGCTL_DPLOW(base) (BME_UBFX8(&USB_OTGCTL_REG(base), USB_OTGCTL_DPLOW_SHIFT, USB_OTGCTL_DPLOW_WIDTH))
21115 
21116 /*! @brief Set the DPLOW field to a new value. */
21117 #define USB_WR_OTGCTL_DPLOW(base, value) (USB_RMW_OTGCTL(base, USB_OTGCTL_DPLOW_MASK, USB_OTGCTL_DPLOW(value)))
21118 #define USB_BWR_OTGCTL_DPLOW(base, value) (BME_BFI8(&USB_OTGCTL_REG(base), ((uint8_t)(value) << USB_OTGCTL_DPLOW_SHIFT), USB_OTGCTL_DPLOW_SHIFT, USB_OTGCTL_DPLOW_WIDTH))
21119 /*@}*/
21120 
21121 /*!
21122  * @name Register USB_OTGCTL, field DPHIGH[7] (RW)
21123  *
21124  * Values:
21125  * - 0b0 - D+ pullup resistor is not enabled
21126  * - 0b1 - D+ pullup resistor is enabled
21127  */
21128 /*@{*/
21129 /*! @brief Read current value of the USB_OTGCTL_DPHIGH field. */
21130 #define USB_RD_OTGCTL_DPHIGH(base) ((USB_OTGCTL_REG(base) & USB_OTGCTL_DPHIGH_MASK) >> USB_OTGCTL_DPHIGH_SHIFT)
21131 #define USB_BRD_OTGCTL_DPHIGH(base) (BME_UBFX8(&USB_OTGCTL_REG(base), USB_OTGCTL_DPHIGH_SHIFT, USB_OTGCTL_DPHIGH_WIDTH))
21132 
21133 /*! @brief Set the DPHIGH field to a new value. */
21134 #define USB_WR_OTGCTL_DPHIGH(base, value) (USB_RMW_OTGCTL(base, USB_OTGCTL_DPHIGH_MASK, USB_OTGCTL_DPHIGH(value)))
21135 #define USB_BWR_OTGCTL_DPHIGH(base, value) (BME_BFI8(&USB_OTGCTL_REG(base), ((uint8_t)(value) << USB_OTGCTL_DPHIGH_SHIFT), USB_OTGCTL_DPHIGH_SHIFT, USB_OTGCTL_DPHIGH_WIDTH))
21136 /*@}*/
21137 
21138 /*******************************************************************************
21139  * USB_ISTAT - Interrupt Status register
21140  ******************************************************************************/
21141 
21142 /*!
21143  * @brief USB_ISTAT - Interrupt Status register (W1C)
21144  *
21145  * Reset value: 0x00U
21146  *
21147  * Contains fields for each of the interrupt sources within the USB Module. Each
21148  * of these fields are qualified with their respective interrupt enable bits.
21149  * All fields of this register are logically OR'd together along with the OTG
21150  * Interrupt Status Register (OTGSTAT) to form a single interrupt source for the
21151  * processor's interrupt controller. After an interrupt bit has been set it may only
21152  * be cleared by writing a one to the respective interrupt bit. This register
21153  * contains the value of 0x00 after a reset.
21154  */
21155 /*!
21156  * @name Constants and macros for entire USB_ISTAT register
21157  */
21158 /*@{*/
21159 #define USB_RD_ISTAT(base) (USB_ISTAT_REG(base))
21160 #define USB_WR_ISTAT(base, value) (USB_ISTAT_REG(base) = (value))
21161 #define USB_RMW_ISTAT(base, mask, value) (USB_WR_ISTAT(base, (USB_RD_ISTAT(base) & ~(mask)) | (value)))
21162 #define USB_SET_ISTAT(base, value) (BME_OR8(&USB_ISTAT_REG(base), (uint8_t)(value)))
21163 #define USB_CLR_ISTAT(base, value) (BME_AND8(&USB_ISTAT_REG(base), (uint8_t)(~(value))))
21164 #define USB_TOG_ISTAT(base, value) (BME_XOR8(&USB_ISTAT_REG(base), (uint8_t)(value)))
21165 /*@}*/
21166 
21167 /*
21168  * Constants & macros for individual USB_ISTAT bitfields
21169  */
21170 
21171 /*!
21172  * @name Register USB_ISTAT, field USBRST[0] (W1C)
21173  *
21174  * This bit is set when the USB Module has decoded a valid USB reset. This
21175  * informs the processor that it should write 0x00 into the address register and
21176  * enable endpoint 0. USBRST is set after a USB reset has been detected for 2.5
21177  * microseconds. It is not asserted again until the USB reset condition has been
21178  * removed and then reasserted.
21179  */
21180 /*@{*/
21181 /*! @brief Read current value of the USB_ISTAT_USBRST field. */
21182 #define USB_RD_ISTAT_USBRST(base) ((USB_ISTAT_REG(base) & USB_ISTAT_USBRST_MASK) >> USB_ISTAT_USBRST_SHIFT)
21183 #define USB_BRD_ISTAT_USBRST(base) (BME_UBFX8(&USB_ISTAT_REG(base), USB_ISTAT_USBRST_SHIFT, USB_ISTAT_USBRST_WIDTH))
21184 
21185 /*! @brief Set the USBRST field to a new value. */
21186 #define USB_WR_ISTAT_USBRST(base, value) (USB_RMW_ISTAT(base, (USB_ISTAT_USBRST_MASK | USB_ISTAT_ERROR_MASK | USB_ISTAT_SOFTOK_MASK | USB_ISTAT_TOKDNE_MASK | USB_ISTAT_SLEEP_MASK | USB_ISTAT_RESUME_MASK | USB_ISTAT_ATTACH_MASK | USB_ISTAT_STALL_MASK), USB_ISTAT_USBRST(value)))
21187 #define USB_BWR_ISTAT_USBRST(base, value) (BME_BFI8(&USB_ISTAT_REG(base), ((uint8_t)(value) << USB_ISTAT_USBRST_SHIFT), USB_ISTAT_USBRST_SHIFT, USB_ISTAT_USBRST_WIDTH))
21188 /*@}*/
21189 
21190 /*!
21191  * @name Register USB_ISTAT, field ERROR[1] (W1C)
21192  *
21193  * This bit is set when any of the error conditions within Error Interrupt
21194  * Status (ERRSTAT) register occur. The processor must then read the ERRSTAT register
21195  * to determine the source of the error.
21196  */
21197 /*@{*/
21198 /*! @brief Read current value of the USB_ISTAT_ERROR field. */
21199 #define USB_RD_ISTAT_ERROR(base) ((USB_ISTAT_REG(base) & USB_ISTAT_ERROR_MASK) >> USB_ISTAT_ERROR_SHIFT)
21200 #define USB_BRD_ISTAT_ERROR(base) (BME_UBFX8(&USB_ISTAT_REG(base), USB_ISTAT_ERROR_SHIFT, USB_ISTAT_ERROR_WIDTH))
21201 
21202 /*! @brief Set the ERROR field to a new value. */
21203 #define USB_WR_ISTAT_ERROR(base, value) (USB_RMW_ISTAT(base, (USB_ISTAT_ERROR_MASK | USB_ISTAT_USBRST_MASK | USB_ISTAT_SOFTOK_MASK | USB_ISTAT_TOKDNE_MASK | USB_ISTAT_SLEEP_MASK | USB_ISTAT_RESUME_MASK | USB_ISTAT_ATTACH_MASK | USB_ISTAT_STALL_MASK), USB_ISTAT_ERROR(value)))
21204 #define USB_BWR_ISTAT_ERROR(base, value) (BME_BFI8(&USB_ISTAT_REG(base), ((uint8_t)(value) << USB_ISTAT_ERROR_SHIFT), USB_ISTAT_ERROR_SHIFT, USB_ISTAT_ERROR_WIDTH))
21205 /*@}*/
21206 
21207 /*!
21208  * @name Register USB_ISTAT, field SOFTOK[2] (W1C)
21209  *
21210  * This bit is set when the USB Module receives a Start Of Frame (SOF) token. In
21211  * Host mode this field is set when the SOF threshold is reached, so that
21212  * software can prepare for the next SOF.
21213  */
21214 /*@{*/
21215 /*! @brief Read current value of the USB_ISTAT_SOFTOK field. */
21216 #define USB_RD_ISTAT_SOFTOK(base) ((USB_ISTAT_REG(base) & USB_ISTAT_SOFTOK_MASK) >> USB_ISTAT_SOFTOK_SHIFT)
21217 #define USB_BRD_ISTAT_SOFTOK(base) (BME_UBFX8(&USB_ISTAT_REG(base), USB_ISTAT_SOFTOK_SHIFT, USB_ISTAT_SOFTOK_WIDTH))
21218 
21219 /*! @brief Set the SOFTOK field to a new value. */
21220 #define USB_WR_ISTAT_SOFTOK(base, value) (USB_RMW_ISTAT(base, (USB_ISTAT_SOFTOK_MASK | USB_ISTAT_USBRST_MASK | USB_ISTAT_ERROR_MASK | USB_ISTAT_TOKDNE_MASK | USB_ISTAT_SLEEP_MASK | USB_ISTAT_RESUME_MASK | USB_ISTAT_ATTACH_MASK | USB_ISTAT_STALL_MASK), USB_ISTAT_SOFTOK(value)))
21221 #define USB_BWR_ISTAT_SOFTOK(base, value) (BME_BFI8(&USB_ISTAT_REG(base), ((uint8_t)(value) << USB_ISTAT_SOFTOK_SHIFT), USB_ISTAT_SOFTOK_SHIFT, USB_ISTAT_SOFTOK_WIDTH))
21222 /*@}*/
21223 
21224 /*!
21225  * @name Register USB_ISTAT, field TOKDNE[3] (W1C)
21226  *
21227  * This bit is set when the current token being processed has completed. The
21228  * processor must immediately read the STATUS (STAT) register to determine the
21229  * EndPoint and BD used for this token. Clearing this bit (by writing a one) causes
21230  * STAT to be cleared or the STAT holding register to be loaded into the STAT
21231  * register.
21232  */
21233 /*@{*/
21234 /*! @brief Read current value of the USB_ISTAT_TOKDNE field. */
21235 #define USB_RD_ISTAT_TOKDNE(base) ((USB_ISTAT_REG(base) & USB_ISTAT_TOKDNE_MASK) >> USB_ISTAT_TOKDNE_SHIFT)
21236 #define USB_BRD_ISTAT_TOKDNE(base) (BME_UBFX8(&USB_ISTAT_REG(base), USB_ISTAT_TOKDNE_SHIFT, USB_ISTAT_TOKDNE_WIDTH))
21237 
21238 /*! @brief Set the TOKDNE field to a new value. */
21239 #define USB_WR_ISTAT_TOKDNE(base, value) (USB_RMW_ISTAT(base, (USB_ISTAT_TOKDNE_MASK | USB_ISTAT_USBRST_MASK | USB_ISTAT_ERROR_MASK | USB_ISTAT_SOFTOK_MASK | USB_ISTAT_SLEEP_MASK | USB_ISTAT_RESUME_MASK | USB_ISTAT_ATTACH_MASK | USB_ISTAT_STALL_MASK), USB_ISTAT_TOKDNE(value)))
21240 #define USB_BWR_ISTAT_TOKDNE(base, value) (BME_BFI8(&USB_ISTAT_REG(base), ((uint8_t)(value) << USB_ISTAT_TOKDNE_SHIFT), USB_ISTAT_TOKDNE_SHIFT, USB_ISTAT_TOKDNE_WIDTH))
21241 /*@}*/
21242 
21243 /*!
21244  * @name Register USB_ISTAT, field SLEEP[4] (W1C)
21245  *
21246  * This bit is set when the USB Module detects a constant idle on the USB bus
21247  * for 3 ms. The sleep timer is reset by activity on the USB bus.
21248  */
21249 /*@{*/
21250 /*! @brief Read current value of the USB_ISTAT_SLEEP field. */
21251 #define USB_RD_ISTAT_SLEEP(base) ((USB_ISTAT_REG(base) & USB_ISTAT_SLEEP_MASK) >> USB_ISTAT_SLEEP_SHIFT)
21252 #define USB_BRD_ISTAT_SLEEP(base) (BME_UBFX8(&USB_ISTAT_REG(base), USB_ISTAT_SLEEP_SHIFT, USB_ISTAT_SLEEP_WIDTH))
21253 
21254 /*! @brief Set the SLEEP field to a new value. */
21255 #define USB_WR_ISTAT_SLEEP(base, value) (USB_RMW_ISTAT(base, (USB_ISTAT_SLEEP_MASK | USB_ISTAT_USBRST_MASK | USB_ISTAT_ERROR_MASK | USB_ISTAT_SOFTOK_MASK | USB_ISTAT_TOKDNE_MASK | USB_ISTAT_RESUME_MASK | USB_ISTAT_ATTACH_MASK | USB_ISTAT_STALL_MASK), USB_ISTAT_SLEEP(value)))
21256 #define USB_BWR_ISTAT_SLEEP(base, value) (BME_BFI8(&USB_ISTAT_REG(base), ((uint8_t)(value) << USB_ISTAT_SLEEP_SHIFT), USB_ISTAT_SLEEP_SHIFT, USB_ISTAT_SLEEP_WIDTH))
21257 /*@}*/
21258 
21259 /*!
21260  * @name Register USB_ISTAT, field RESUME[5] (W1C)
21261  *
21262  * This bit is set depending upon the DP/DM signals, and can be used to signal
21263  * remote wake-up signaling on the USB bus. When not in suspend mode this
21264  * interrupt must be disabled.
21265  */
21266 /*@{*/
21267 /*! @brief Read current value of the USB_ISTAT_RESUME field. */
21268 #define USB_RD_ISTAT_RESUME(base) ((USB_ISTAT_REG(base) & USB_ISTAT_RESUME_MASK) >> USB_ISTAT_RESUME_SHIFT)
21269 #define USB_BRD_ISTAT_RESUME(base) (BME_UBFX8(&USB_ISTAT_REG(base), USB_ISTAT_RESUME_SHIFT, USB_ISTAT_RESUME_WIDTH))
21270 
21271 /*! @brief Set the RESUME field to a new value. */
21272 #define USB_WR_ISTAT_RESUME(base, value) (USB_RMW_ISTAT(base, (USB_ISTAT_RESUME_MASK | USB_ISTAT_USBRST_MASK | USB_ISTAT_ERROR_MASK | USB_ISTAT_SOFTOK_MASK | USB_ISTAT_TOKDNE_MASK | USB_ISTAT_SLEEP_MASK | USB_ISTAT_ATTACH_MASK | USB_ISTAT_STALL_MASK), USB_ISTAT_RESUME(value)))
21273 #define USB_BWR_ISTAT_RESUME(base, value) (BME_BFI8(&USB_ISTAT_REG(base), ((uint8_t)(value) << USB_ISTAT_RESUME_SHIFT), USB_ISTAT_RESUME_SHIFT, USB_ISTAT_RESUME_WIDTH))
21274 /*@}*/
21275 
21276 /*!
21277  * @name Register USB_ISTAT, field ATTACH[6] (W1C)
21278  *
21279  * This bit is set when the USB Module detects an attach of a USB device. This
21280  * signal is only valid if HOSTMODEEN is true. This interrupt signifies that a
21281  * peripheral is now present and must be configured.
21282  */
21283 /*@{*/
21284 /*! @brief Read current value of the USB_ISTAT_ATTACH field. */
21285 #define USB_RD_ISTAT_ATTACH(base) ((USB_ISTAT_REG(base) & USB_ISTAT_ATTACH_MASK) >> USB_ISTAT_ATTACH_SHIFT)
21286 #define USB_BRD_ISTAT_ATTACH(base) (BME_UBFX8(&USB_ISTAT_REG(base), USB_ISTAT_ATTACH_SHIFT, USB_ISTAT_ATTACH_WIDTH))
21287 
21288 /*! @brief Set the ATTACH field to a new value. */
21289 #define USB_WR_ISTAT_ATTACH(base, value) (USB_RMW_ISTAT(base, (USB_ISTAT_ATTACH_MASK | USB_ISTAT_USBRST_MASK | USB_ISTAT_ERROR_MASK | USB_ISTAT_SOFTOK_MASK | USB_ISTAT_TOKDNE_MASK | USB_ISTAT_SLEEP_MASK | USB_ISTAT_RESUME_MASK | USB_ISTAT_STALL_MASK), USB_ISTAT_ATTACH(value)))
21290 #define USB_BWR_ISTAT_ATTACH(base, value) (BME_BFI8(&USB_ISTAT_REG(base), ((uint8_t)(value) << USB_ISTAT_ATTACH_SHIFT), USB_ISTAT_ATTACH_SHIFT, USB_ISTAT_ATTACH_WIDTH))
21291 /*@}*/
21292 
21293 /*!
21294  * @name Register USB_ISTAT, field STALL[7] (W1C)
21295  *
21296  * In Target mode this bit is asserted when a STALL handshake is sent by the
21297  * SIE. In Host mode this bit is set when the USB Module detects a STALL acknowledge
21298  * during the handshake phase of a USB transaction.This interrupt can be used to
21299  * determine whether the last USB transaction was completed successfully or
21300  * stalled.
21301  */
21302 /*@{*/
21303 /*! @brief Read current value of the USB_ISTAT_STALL field. */
21304 #define USB_RD_ISTAT_STALL(base) ((USB_ISTAT_REG(base) & USB_ISTAT_STALL_MASK) >> USB_ISTAT_STALL_SHIFT)
21305 #define USB_BRD_ISTAT_STALL(base) (BME_UBFX8(&USB_ISTAT_REG(base), USB_ISTAT_STALL_SHIFT, USB_ISTAT_STALL_WIDTH))
21306 
21307 /*! @brief Set the STALL field to a new value. */
21308 #define USB_WR_ISTAT_STALL(base, value) (USB_RMW_ISTAT(base, (USB_ISTAT_STALL_MASK | USB_ISTAT_USBRST_MASK | USB_ISTAT_ERROR_MASK | USB_ISTAT_SOFTOK_MASK | USB_ISTAT_TOKDNE_MASK | USB_ISTAT_SLEEP_MASK | USB_ISTAT_RESUME_MASK | USB_ISTAT_ATTACH_MASK), USB_ISTAT_STALL(value)))
21309 #define USB_BWR_ISTAT_STALL(base, value) (BME_BFI8(&USB_ISTAT_REG(base), ((uint8_t)(value) << USB_ISTAT_STALL_SHIFT), USB_ISTAT_STALL_SHIFT, USB_ISTAT_STALL_WIDTH))
21310 /*@}*/
21311 
21312 /*******************************************************************************
21313  * USB_INTEN - Interrupt Enable register
21314  ******************************************************************************/
21315 
21316 /*!
21317  * @brief USB_INTEN - Interrupt Enable register (RW)
21318  *
21319  * Reset value: 0x00U
21320  *
21321  * Contains enable fields for each of the interrupt sources within the USB
21322  * Module. Setting any of these bits enables the respective interrupt source in the
21323  * ISTAT register. This register contains the value of 0x00 after a reset.
21324  */
21325 /*!
21326  * @name Constants and macros for entire USB_INTEN register
21327  */
21328 /*@{*/
21329 #define USB_RD_INTEN(base) (USB_INTEN_REG(base))
21330 #define USB_WR_INTEN(base, value) (USB_INTEN_REG(base) = (value))
21331 #define USB_RMW_INTEN(base, mask, value) (USB_WR_INTEN(base, (USB_RD_INTEN(base) & ~(mask)) | (value)))
21332 #define USB_SET_INTEN(base, value) (BME_OR8(&USB_INTEN_REG(base), (uint8_t)(value)))
21333 #define USB_CLR_INTEN(base, value) (BME_AND8(&USB_INTEN_REG(base), (uint8_t)(~(value))))
21334 #define USB_TOG_INTEN(base, value) (BME_XOR8(&USB_INTEN_REG(base), (uint8_t)(value)))
21335 /*@}*/
21336 
21337 /*
21338  * Constants & macros for individual USB_INTEN bitfields
21339  */
21340 
21341 /*!
21342  * @name Register USB_INTEN, field USBRSTEN[0] (RW)
21343  *
21344  * Values:
21345  * - 0b0 - Disables the USBRST interrupt.
21346  * - 0b1 - Enables the USBRST interrupt.
21347  */
21348 /*@{*/
21349 /*! @brief Read current value of the USB_INTEN_USBRSTEN field. */
21350 #define USB_RD_INTEN_USBRSTEN(base) ((USB_INTEN_REG(base) & USB_INTEN_USBRSTEN_MASK) >> USB_INTEN_USBRSTEN_SHIFT)
21351 #define USB_BRD_INTEN_USBRSTEN(base) (BME_UBFX8(&USB_INTEN_REG(base), USB_INTEN_USBRSTEN_SHIFT, USB_INTEN_USBRSTEN_WIDTH))
21352 
21353 /*! @brief Set the USBRSTEN field to a new value. */
21354 #define USB_WR_INTEN_USBRSTEN(base, value) (USB_RMW_INTEN(base, USB_INTEN_USBRSTEN_MASK, USB_INTEN_USBRSTEN(value)))
21355 #define USB_BWR_INTEN_USBRSTEN(base, value) (BME_BFI8(&USB_INTEN_REG(base), ((uint8_t)(value) << USB_INTEN_USBRSTEN_SHIFT), USB_INTEN_USBRSTEN_SHIFT, USB_INTEN_USBRSTEN_WIDTH))
21356 /*@}*/
21357 
21358 /*!
21359  * @name Register USB_INTEN, field ERROREN[1] (RW)
21360  *
21361  * Values:
21362  * - 0b0 - Disables the ERROR interrupt.
21363  * - 0b1 - Enables the ERROR interrupt.
21364  */
21365 /*@{*/
21366 /*! @brief Read current value of the USB_INTEN_ERROREN field. */
21367 #define USB_RD_INTEN_ERROREN(base) ((USB_INTEN_REG(base) & USB_INTEN_ERROREN_MASK) >> USB_INTEN_ERROREN_SHIFT)
21368 #define USB_BRD_INTEN_ERROREN(base) (BME_UBFX8(&USB_INTEN_REG(base), USB_INTEN_ERROREN_SHIFT, USB_INTEN_ERROREN_WIDTH))
21369 
21370 /*! @brief Set the ERROREN field to a new value. */
21371 #define USB_WR_INTEN_ERROREN(base, value) (USB_RMW_INTEN(base, USB_INTEN_ERROREN_MASK, USB_INTEN_ERROREN(value)))
21372 #define USB_BWR_INTEN_ERROREN(base, value) (BME_BFI8(&USB_INTEN_REG(base), ((uint8_t)(value) << USB_INTEN_ERROREN_SHIFT), USB_INTEN_ERROREN_SHIFT, USB_INTEN_ERROREN_WIDTH))
21373 /*@}*/
21374 
21375 /*!
21376  * @name Register USB_INTEN, field SOFTOKEN[2] (RW)
21377  *
21378  * Values:
21379  * - 0b0 - Disbles the SOFTOK interrupt.
21380  * - 0b1 - Enables the SOFTOK interrupt.
21381  */
21382 /*@{*/
21383 /*! @brief Read current value of the USB_INTEN_SOFTOKEN field. */
21384 #define USB_RD_INTEN_SOFTOKEN(base) ((USB_INTEN_REG(base) & USB_INTEN_SOFTOKEN_MASK) >> USB_INTEN_SOFTOKEN_SHIFT)
21385 #define USB_BRD_INTEN_SOFTOKEN(base) (BME_UBFX8(&USB_INTEN_REG(base), USB_INTEN_SOFTOKEN_SHIFT, USB_INTEN_SOFTOKEN_WIDTH))
21386 
21387 /*! @brief Set the SOFTOKEN field to a new value. */
21388 #define USB_WR_INTEN_SOFTOKEN(base, value) (USB_RMW_INTEN(base, USB_INTEN_SOFTOKEN_MASK, USB_INTEN_SOFTOKEN(value)))
21389 #define USB_BWR_INTEN_SOFTOKEN(base, value) (BME_BFI8(&USB_INTEN_REG(base), ((uint8_t)(value) << USB_INTEN_SOFTOKEN_SHIFT), USB_INTEN_SOFTOKEN_SHIFT, USB_INTEN_SOFTOKEN_WIDTH))
21390 /*@}*/
21391 
21392 /*!
21393  * @name Register USB_INTEN, field TOKDNEEN[3] (RW)
21394  *
21395  * Values:
21396  * - 0b0 - Disables the TOKDNE interrupt.
21397  * - 0b1 - Enables the TOKDNE interrupt.
21398  */
21399 /*@{*/
21400 /*! @brief Read current value of the USB_INTEN_TOKDNEEN field. */
21401 #define USB_RD_INTEN_TOKDNEEN(base) ((USB_INTEN_REG(base) & USB_INTEN_TOKDNEEN_MASK) >> USB_INTEN_TOKDNEEN_SHIFT)
21402 #define USB_BRD_INTEN_TOKDNEEN(base) (BME_UBFX8(&USB_INTEN_REG(base), USB_INTEN_TOKDNEEN_SHIFT, USB_INTEN_TOKDNEEN_WIDTH))
21403 
21404 /*! @brief Set the TOKDNEEN field to a new value. */
21405 #define USB_WR_INTEN_TOKDNEEN(base, value) (USB_RMW_INTEN(base, USB_INTEN_TOKDNEEN_MASK, USB_INTEN_TOKDNEEN(value)))
21406 #define USB_BWR_INTEN_TOKDNEEN(base, value) (BME_BFI8(&USB_INTEN_REG(base), ((uint8_t)(value) << USB_INTEN_TOKDNEEN_SHIFT), USB_INTEN_TOKDNEEN_SHIFT, USB_INTEN_TOKDNEEN_WIDTH))
21407 /*@}*/
21408 
21409 /*!
21410  * @name Register USB_INTEN, field SLEEPEN[4] (RW)
21411  *
21412  * Values:
21413  * - 0b0 - Disables the SLEEP interrupt.
21414  * - 0b1 - Enables the SLEEP interrupt.
21415  */
21416 /*@{*/
21417 /*! @brief Read current value of the USB_INTEN_SLEEPEN field. */
21418 #define USB_RD_INTEN_SLEEPEN(base) ((USB_INTEN_REG(base) & USB_INTEN_SLEEPEN_MASK) >> USB_INTEN_SLEEPEN_SHIFT)
21419 #define USB_BRD_INTEN_SLEEPEN(base) (BME_UBFX8(&USB_INTEN_REG(base), USB_INTEN_SLEEPEN_SHIFT, USB_INTEN_SLEEPEN_WIDTH))
21420 
21421 /*! @brief Set the SLEEPEN field to a new value. */
21422 #define USB_WR_INTEN_SLEEPEN(base, value) (USB_RMW_INTEN(base, USB_INTEN_SLEEPEN_MASK, USB_INTEN_SLEEPEN(value)))
21423 #define USB_BWR_INTEN_SLEEPEN(base, value) (BME_BFI8(&USB_INTEN_REG(base), ((uint8_t)(value) << USB_INTEN_SLEEPEN_SHIFT), USB_INTEN_SLEEPEN_SHIFT, USB_INTEN_SLEEPEN_WIDTH))
21424 /*@}*/
21425 
21426 /*!
21427  * @name Register USB_INTEN, field RESUMEEN[5] (RW)
21428  *
21429  * Values:
21430  * - 0b0 - Disables the RESUME interrupt.
21431  * - 0b1 - Enables the RESUME interrupt.
21432  */
21433 /*@{*/
21434 /*! @brief Read current value of the USB_INTEN_RESUMEEN field. */
21435 #define USB_RD_INTEN_RESUMEEN(base) ((USB_INTEN_REG(base) & USB_INTEN_RESUMEEN_MASK) >> USB_INTEN_RESUMEEN_SHIFT)
21436 #define USB_BRD_INTEN_RESUMEEN(base) (BME_UBFX8(&USB_INTEN_REG(base), USB_INTEN_RESUMEEN_SHIFT, USB_INTEN_RESUMEEN_WIDTH))
21437 
21438 /*! @brief Set the RESUMEEN field to a new value. */
21439 #define USB_WR_INTEN_RESUMEEN(base, value) (USB_RMW_INTEN(base, USB_INTEN_RESUMEEN_MASK, USB_INTEN_RESUMEEN(value)))
21440 #define USB_BWR_INTEN_RESUMEEN(base, value) (BME_BFI8(&USB_INTEN_REG(base), ((uint8_t)(value) << USB_INTEN_RESUMEEN_SHIFT), USB_INTEN_RESUMEEN_SHIFT, USB_INTEN_RESUMEEN_WIDTH))
21441 /*@}*/
21442 
21443 /*!
21444  * @name Register USB_INTEN, field ATTACHEN[6] (RW)
21445  *
21446  * Values:
21447  * - 0b0 - Disables the ATTACH interrupt.
21448  * - 0b1 - Enables the ATTACH interrupt.
21449  */
21450 /*@{*/
21451 /*! @brief Read current value of the USB_INTEN_ATTACHEN field. */
21452 #define USB_RD_INTEN_ATTACHEN(base) ((USB_INTEN_REG(base) & USB_INTEN_ATTACHEN_MASK) >> USB_INTEN_ATTACHEN_SHIFT)
21453 #define USB_BRD_INTEN_ATTACHEN(base) (BME_UBFX8(&USB_INTEN_REG(base), USB_INTEN_ATTACHEN_SHIFT, USB_INTEN_ATTACHEN_WIDTH))
21454 
21455 /*! @brief Set the ATTACHEN field to a new value. */
21456 #define USB_WR_INTEN_ATTACHEN(base, value) (USB_RMW_INTEN(base, USB_INTEN_ATTACHEN_MASK, USB_INTEN_ATTACHEN(value)))
21457 #define USB_BWR_INTEN_ATTACHEN(base, value) (BME_BFI8(&USB_INTEN_REG(base), ((uint8_t)(value) << USB_INTEN_ATTACHEN_SHIFT), USB_INTEN_ATTACHEN_SHIFT, USB_INTEN_ATTACHEN_WIDTH))
21458 /*@}*/
21459 
21460 /*!
21461  * @name Register USB_INTEN, field STALLEN[7] (RW)
21462  *
21463  * Values:
21464  * - 0b0 - Diasbles the STALL interrupt.
21465  * - 0b1 - Enables the STALL interrupt.
21466  */
21467 /*@{*/
21468 /*! @brief Read current value of the USB_INTEN_STALLEN field. */
21469 #define USB_RD_INTEN_STALLEN(base) ((USB_INTEN_REG(base) & USB_INTEN_STALLEN_MASK) >> USB_INTEN_STALLEN_SHIFT)
21470 #define USB_BRD_INTEN_STALLEN(base) (BME_UBFX8(&USB_INTEN_REG(base), USB_INTEN_STALLEN_SHIFT, USB_INTEN_STALLEN_WIDTH))
21471 
21472 /*! @brief Set the STALLEN field to a new value. */
21473 #define USB_WR_INTEN_STALLEN(base, value) (USB_RMW_INTEN(base, USB_INTEN_STALLEN_MASK, USB_INTEN_STALLEN(value)))
21474 #define USB_BWR_INTEN_STALLEN(base, value) (BME_BFI8(&USB_INTEN_REG(base), ((uint8_t)(value) << USB_INTEN_STALLEN_SHIFT), USB_INTEN_STALLEN_SHIFT, USB_INTEN_STALLEN_WIDTH))
21475 /*@}*/
21476 
21477 /*******************************************************************************
21478  * USB_ERRSTAT - Error Interrupt Status register
21479  ******************************************************************************/
21480 
21481 /*!
21482  * @brief USB_ERRSTAT - Error Interrupt Status register (RW)
21483  *
21484  * Reset value: 0x00U
21485  *
21486  * Contains enable bits for each of the error sources within the USB Module.
21487  * Each of these bits are qualified with their respective error enable bits. All
21488  * bits of this register are logically OR'd together and the result placed in the
21489  * ERROR bit of the ISTAT register. After an interrupt bit has been set it may only
21490  * be cleared by writing a one to the respective interrupt bit. Each bit is set
21491  * as soon as the error conditions is detected. Therefore, the interrupt does not
21492  * typically correspond with the end of a token being processed. This register
21493  * contains the value of 0x00 after a reset.
21494  */
21495 /*!
21496  * @name Constants and macros for entire USB_ERRSTAT register
21497  */
21498 /*@{*/
21499 #define USB_RD_ERRSTAT(base) (USB_ERRSTAT_REG(base))
21500 #define USB_WR_ERRSTAT(base, value) (USB_ERRSTAT_REG(base) = (value))
21501 #define USB_RMW_ERRSTAT(base, mask, value) (USB_WR_ERRSTAT(base, (USB_RD_ERRSTAT(base) & ~(mask)) | (value)))
21502 #define USB_SET_ERRSTAT(base, value) (BME_OR8(&USB_ERRSTAT_REG(base), (uint8_t)(value)))
21503 #define USB_CLR_ERRSTAT(base, value) (BME_AND8(&USB_ERRSTAT_REG(base), (uint8_t)(~(value))))
21504 #define USB_TOG_ERRSTAT(base, value) (BME_XOR8(&USB_ERRSTAT_REG(base), (uint8_t)(value)))
21505 /*@}*/
21506 
21507 /*
21508  * Constants & macros for individual USB_ERRSTAT bitfields
21509  */
21510 
21511 /*!
21512  * @name Register USB_ERRSTAT, field PIDERR[0] (W1C)
21513  *
21514  * This bit is set when the PID check field fails.
21515  */
21516 /*@{*/
21517 /*! @brief Read current value of the USB_ERRSTAT_PIDERR field. */
21518 #define USB_RD_ERRSTAT_PIDERR(base) ((USB_ERRSTAT_REG(base) & USB_ERRSTAT_PIDERR_MASK) >> USB_ERRSTAT_PIDERR_SHIFT)
21519 #define USB_BRD_ERRSTAT_PIDERR(base) (BME_UBFX8(&USB_ERRSTAT_REG(base), USB_ERRSTAT_PIDERR_SHIFT, USB_ERRSTAT_PIDERR_WIDTH))
21520 
21521 /*! @brief Set the PIDERR field to a new value. */
21522 #define USB_WR_ERRSTAT_PIDERR(base, value) (USB_RMW_ERRSTAT(base, (USB_ERRSTAT_PIDERR_MASK | USB_ERRSTAT_CRC5EOF_MASK | USB_ERRSTAT_CRC16_MASK | USB_ERRSTAT_DFN8_MASK | USB_ERRSTAT_BTOERR_MASK | USB_ERRSTAT_DMAERR_MASK | USB_ERRSTAT_BTSERR_MASK), USB_ERRSTAT_PIDERR(value)))
21523 #define USB_BWR_ERRSTAT_PIDERR(base, value) (BME_BFI8(&USB_ERRSTAT_REG(base), ((uint8_t)(value) << USB_ERRSTAT_PIDERR_SHIFT), USB_ERRSTAT_PIDERR_SHIFT, USB_ERRSTAT_PIDERR_WIDTH))
21524 /*@}*/
21525 
21526 /*!
21527  * @name Register USB_ERRSTAT, field CRC5EOF[1] (W1C)
21528  *
21529  * This error interrupt has two functions. When the USB Module is operating in
21530  * peripheral mode (HOSTMODEEN=0), this interrupt detects CRC5 errors in the token
21531  * packets generated by the host. If set the token packet was rejected due to a
21532  * CRC5 error. When the USB Module is operating in host mode (HOSTMODEEN=1), this
21533  * interrupt detects End Of Frame (EOF) error conditions. This occurs when the
21534  * USB Module is transmitting or receiving data and the SOF counter reaches zero.
21535  * This interrupt is useful when developing USB packet scheduling software to
21536  * ensure that no USB transactions cross the start of the next frame.
21537  */
21538 /*@{*/
21539 /*! @brief Read current value of the USB_ERRSTAT_CRC5EOF field. */
21540 #define USB_RD_ERRSTAT_CRC5EOF(base) ((USB_ERRSTAT_REG(base) & USB_ERRSTAT_CRC5EOF_MASK) >> USB_ERRSTAT_CRC5EOF_SHIFT)
21541 #define USB_BRD_ERRSTAT_CRC5EOF(base) (BME_UBFX8(&USB_ERRSTAT_REG(base), USB_ERRSTAT_CRC5EOF_SHIFT, USB_ERRSTAT_CRC5EOF_WIDTH))
21542 
21543 /*! @brief Set the CRC5EOF field to a new value. */
21544 #define USB_WR_ERRSTAT_CRC5EOF(base, value) (USB_RMW_ERRSTAT(base, (USB_ERRSTAT_CRC5EOF_MASK | USB_ERRSTAT_PIDERR_MASK | USB_ERRSTAT_CRC16_MASK | USB_ERRSTAT_DFN8_MASK | USB_ERRSTAT_BTOERR_MASK | USB_ERRSTAT_DMAERR_MASK | USB_ERRSTAT_BTSERR_MASK), USB_ERRSTAT_CRC5EOF(value)))
21545 #define USB_BWR_ERRSTAT_CRC5EOF(base, value) (BME_BFI8(&USB_ERRSTAT_REG(base), ((uint8_t)(value) << USB_ERRSTAT_CRC5EOF_SHIFT), USB_ERRSTAT_CRC5EOF_SHIFT, USB_ERRSTAT_CRC5EOF_WIDTH))
21546 /*@}*/
21547 
21548 /*!
21549  * @name Register USB_ERRSTAT, field CRC16[2] (W1C)
21550  *
21551  * This bit is set when a data packet is rejected due to a CRC16 error.
21552  */
21553 /*@{*/
21554 /*! @brief Read current value of the USB_ERRSTAT_CRC16 field. */
21555 #define USB_RD_ERRSTAT_CRC16(base) ((USB_ERRSTAT_REG(base) & USB_ERRSTAT_CRC16_MASK) >> USB_ERRSTAT_CRC16_SHIFT)
21556 #define USB_BRD_ERRSTAT_CRC16(base) (BME_UBFX8(&USB_ERRSTAT_REG(base), USB_ERRSTAT_CRC16_SHIFT, USB_ERRSTAT_CRC16_WIDTH))
21557 
21558 /*! @brief Set the CRC16 field to a new value. */
21559 #define USB_WR_ERRSTAT_CRC16(base, value) (USB_RMW_ERRSTAT(base, (USB_ERRSTAT_CRC16_MASK | USB_ERRSTAT_PIDERR_MASK | USB_ERRSTAT_CRC5EOF_MASK | USB_ERRSTAT_DFN8_MASK | USB_ERRSTAT_BTOERR_MASK | USB_ERRSTAT_DMAERR_MASK | USB_ERRSTAT_BTSERR_MASK), USB_ERRSTAT_CRC16(value)))
21560 #define USB_BWR_ERRSTAT_CRC16(base, value) (BME_BFI8(&USB_ERRSTAT_REG(base), ((uint8_t)(value) << USB_ERRSTAT_CRC16_SHIFT), USB_ERRSTAT_CRC16_SHIFT, USB_ERRSTAT_CRC16_WIDTH))
21561 /*@}*/
21562 
21563 /*!
21564  * @name Register USB_ERRSTAT, field DFN8[3] (W1C)
21565  *
21566  * This bit is set if the data field received was not 8 bits in length. USB
21567  * Specification 1.0 requires that data fields be an integral number of bytes. If the
21568  * data field was not an integral number of bytes, this bit is set.
21569  */
21570 /*@{*/
21571 /*! @brief Read current value of the USB_ERRSTAT_DFN8 field. */
21572 #define USB_RD_ERRSTAT_DFN8(base) ((USB_ERRSTAT_REG(base) & USB_ERRSTAT_DFN8_MASK) >> USB_ERRSTAT_DFN8_SHIFT)
21573 #define USB_BRD_ERRSTAT_DFN8(base) (BME_UBFX8(&USB_ERRSTAT_REG(base), USB_ERRSTAT_DFN8_SHIFT, USB_ERRSTAT_DFN8_WIDTH))
21574 
21575 /*! @brief Set the DFN8 field to a new value. */
21576 #define USB_WR_ERRSTAT_DFN8(base, value) (USB_RMW_ERRSTAT(base, (USB_ERRSTAT_DFN8_MASK | USB_ERRSTAT_PIDERR_MASK | USB_ERRSTAT_CRC5EOF_MASK | USB_ERRSTAT_CRC16_MASK | USB_ERRSTAT_BTOERR_MASK | USB_ERRSTAT_DMAERR_MASK | USB_ERRSTAT_BTSERR_MASK), USB_ERRSTAT_DFN8(value)))
21577 #define USB_BWR_ERRSTAT_DFN8(base, value) (BME_BFI8(&USB_ERRSTAT_REG(base), ((uint8_t)(value) << USB_ERRSTAT_DFN8_SHIFT), USB_ERRSTAT_DFN8_SHIFT, USB_ERRSTAT_DFN8_WIDTH))
21578 /*@}*/
21579 
21580 /*!
21581  * @name Register USB_ERRSTAT, field BTOERR[4] (W1C)
21582  *
21583  * This bit is set when a bus turnaround timeout error occurs. The USB module
21584  * contains a bus turnaround timer that keeps track of the amount of time elapsed
21585  * between the token and data phases of a SETUP or OUT TOKEN or the data and
21586  * handshake phases of a IN TOKEN. If more than 16 bit times are counted from the
21587  * previous EOP before a transition from IDLE, a bus turnaround timeout error occurs.
21588  */
21589 /*@{*/
21590 /*! @brief Read current value of the USB_ERRSTAT_BTOERR field. */
21591 #define USB_RD_ERRSTAT_BTOERR(base) ((USB_ERRSTAT_REG(base) & USB_ERRSTAT_BTOERR_MASK) >> USB_ERRSTAT_BTOERR_SHIFT)
21592 #define USB_BRD_ERRSTAT_BTOERR(base) (BME_UBFX8(&USB_ERRSTAT_REG(base), USB_ERRSTAT_BTOERR_SHIFT, USB_ERRSTAT_BTOERR_WIDTH))
21593 
21594 /*! @brief Set the BTOERR field to a new value. */
21595 #define USB_WR_ERRSTAT_BTOERR(base, value) (USB_RMW_ERRSTAT(base, (USB_ERRSTAT_BTOERR_MASK | USB_ERRSTAT_PIDERR_MASK | USB_ERRSTAT_CRC5EOF_MASK | USB_ERRSTAT_CRC16_MASK | USB_ERRSTAT_DFN8_MASK | USB_ERRSTAT_DMAERR_MASK | USB_ERRSTAT_BTSERR_MASK), USB_ERRSTAT_BTOERR(value)))
21596 #define USB_BWR_ERRSTAT_BTOERR(base, value) (BME_BFI8(&USB_ERRSTAT_REG(base), ((uint8_t)(value) << USB_ERRSTAT_BTOERR_SHIFT), USB_ERRSTAT_BTOERR_SHIFT, USB_ERRSTAT_BTOERR_WIDTH))
21597 /*@}*/
21598 
21599 /*!
21600  * @name Register USB_ERRSTAT, field DMAERR[5] (W1C)
21601  *
21602  * This bit is set if the USB Module has requested a DMA access to read a new
21603  * BDT but has not been given the bus before it needs to receive or transmit data.
21604  * If processing a TX transfer this would cause a transmit data underflow
21605  * condition. If processing a RX transfer this would cause a receive data overflow
21606  * condition. This interrupt is useful when developing device arbitration hardware for
21607  * the microprocessor and the USB module to minimize bus request and bus grant
21608  * latency. This bit is also set if a data packet to or from the host is larger
21609  * than the buffer size allocated in the BDT. In this case the data packet is
21610  * truncated as it is put in buffer memory.
21611  */
21612 /*@{*/
21613 /*! @brief Read current value of the USB_ERRSTAT_DMAERR field. */
21614 #define USB_RD_ERRSTAT_DMAERR(base) ((USB_ERRSTAT_REG(base) & USB_ERRSTAT_DMAERR_MASK) >> USB_ERRSTAT_DMAERR_SHIFT)
21615 #define USB_BRD_ERRSTAT_DMAERR(base) (BME_UBFX8(&USB_ERRSTAT_REG(base), USB_ERRSTAT_DMAERR_SHIFT, USB_ERRSTAT_DMAERR_WIDTH))
21616 
21617 /*! @brief Set the DMAERR field to a new value. */
21618 #define USB_WR_ERRSTAT_DMAERR(base, value) (USB_RMW_ERRSTAT(base, (USB_ERRSTAT_DMAERR_MASK | USB_ERRSTAT_PIDERR_MASK | USB_ERRSTAT_CRC5EOF_MASK | USB_ERRSTAT_CRC16_MASK | USB_ERRSTAT_DFN8_MASK | USB_ERRSTAT_BTOERR_MASK | USB_ERRSTAT_BTSERR_MASK), USB_ERRSTAT_DMAERR(value)))
21619 #define USB_BWR_ERRSTAT_DMAERR(base, value) (BME_BFI8(&USB_ERRSTAT_REG(base), ((uint8_t)(value) << USB_ERRSTAT_DMAERR_SHIFT), USB_ERRSTAT_DMAERR_SHIFT, USB_ERRSTAT_DMAERR_WIDTH))
21620 /*@}*/
21621 
21622 /*!
21623  * @name Register USB_ERRSTAT, field BTSERR[7] (W1C)
21624  *
21625  * This bit is set when a bit stuff error is detected. If set, the corresponding
21626  * packet is rejected due to the error.
21627  */
21628 /*@{*/
21629 /*! @brief Read current value of the USB_ERRSTAT_BTSERR field. */
21630 #define USB_RD_ERRSTAT_BTSERR(base) ((USB_ERRSTAT_REG(base) & USB_ERRSTAT_BTSERR_MASK) >> USB_ERRSTAT_BTSERR_SHIFT)
21631 #define USB_BRD_ERRSTAT_BTSERR(base) (BME_UBFX8(&USB_ERRSTAT_REG(base), USB_ERRSTAT_BTSERR_SHIFT, USB_ERRSTAT_BTSERR_WIDTH))
21632 
21633 /*! @brief Set the BTSERR field to a new value. */
21634 #define USB_WR_ERRSTAT_BTSERR(base, value) (USB_RMW_ERRSTAT(base, (USB_ERRSTAT_BTSERR_MASK | USB_ERRSTAT_PIDERR_MASK | USB_ERRSTAT_CRC5EOF_MASK | USB_ERRSTAT_CRC16_MASK | USB_ERRSTAT_DFN8_MASK | USB_ERRSTAT_BTOERR_MASK | USB_ERRSTAT_DMAERR_MASK), USB_ERRSTAT_BTSERR(value)))
21635 #define USB_BWR_ERRSTAT_BTSERR(base, value) (BME_BFI8(&USB_ERRSTAT_REG(base), ((uint8_t)(value) << USB_ERRSTAT_BTSERR_SHIFT), USB_ERRSTAT_BTSERR_SHIFT, USB_ERRSTAT_BTSERR_WIDTH))
21636 /*@}*/
21637 
21638 /*******************************************************************************
21639  * USB_ERREN - Error Interrupt Enable register
21640  ******************************************************************************/
21641 
21642 /*!
21643  * @brief USB_ERREN - Error Interrupt Enable register (RW)
21644  *
21645  * Reset value: 0x00U
21646  *
21647  * Contains enable bits for each of the error interrupt sources within the USB
21648  * module. Setting any of these bits enables the respective interrupt source in
21649  * ERRSTAT. Each bit is set as soon as the error conditions is detected. Therefore,
21650  * the interrupt does not typically correspond with the end of a token being
21651  * processed. This register contains the value of 0x00 after a reset.
21652  */
21653 /*!
21654  * @name Constants and macros for entire USB_ERREN register
21655  */
21656 /*@{*/
21657 #define USB_RD_ERREN(base) (USB_ERREN_REG(base))
21658 #define USB_WR_ERREN(base, value) (USB_ERREN_REG(base) = (value))
21659 #define USB_RMW_ERREN(base, mask, value) (USB_WR_ERREN(base, (USB_RD_ERREN(base) & ~(mask)) | (value)))
21660 #define USB_SET_ERREN(base, value) (BME_OR8(&USB_ERREN_REG(base), (uint8_t)(value)))
21661 #define USB_CLR_ERREN(base, value) (BME_AND8(&USB_ERREN_REG(base), (uint8_t)(~(value))))
21662 #define USB_TOG_ERREN(base, value) (BME_XOR8(&USB_ERREN_REG(base), (uint8_t)(value)))
21663 /*@}*/
21664 
21665 /*
21666  * Constants & macros for individual USB_ERREN bitfields
21667  */
21668 
21669 /*!
21670  * @name Register USB_ERREN, field PIDERREN[0] (RW)
21671  *
21672  * Values:
21673  * - 0b0 - Disables the PIDERR interrupt.
21674  * - 0b1 - Enters the PIDERR interrupt.
21675  */
21676 /*@{*/
21677 /*! @brief Read current value of the USB_ERREN_PIDERREN field. */
21678 #define USB_RD_ERREN_PIDERREN(base) ((USB_ERREN_REG(base) & USB_ERREN_PIDERREN_MASK) >> USB_ERREN_PIDERREN_SHIFT)
21679 #define USB_BRD_ERREN_PIDERREN(base) (BME_UBFX8(&USB_ERREN_REG(base), USB_ERREN_PIDERREN_SHIFT, USB_ERREN_PIDERREN_WIDTH))
21680 
21681 /*! @brief Set the PIDERREN field to a new value. */
21682 #define USB_WR_ERREN_PIDERREN(base, value) (USB_RMW_ERREN(base, USB_ERREN_PIDERREN_MASK, USB_ERREN_PIDERREN(value)))
21683 #define USB_BWR_ERREN_PIDERREN(base, value) (BME_BFI8(&USB_ERREN_REG(base), ((uint8_t)(value) << USB_ERREN_PIDERREN_SHIFT), USB_ERREN_PIDERREN_SHIFT, USB_ERREN_PIDERREN_WIDTH))
21684 /*@}*/
21685 
21686 /*!
21687  * @name Register USB_ERREN, field CRC5EOFEN[1] (RW)
21688  *
21689  * Values:
21690  * - 0b0 - Disables the CRC5/EOF interrupt.
21691  * - 0b1 - Enables the CRC5/EOF interrupt.
21692  */
21693 /*@{*/
21694 /*! @brief Read current value of the USB_ERREN_CRC5EOFEN field. */
21695 #define USB_RD_ERREN_CRC5EOFEN(base) ((USB_ERREN_REG(base) & USB_ERREN_CRC5EOFEN_MASK) >> USB_ERREN_CRC5EOFEN_SHIFT)
21696 #define USB_BRD_ERREN_CRC5EOFEN(base) (BME_UBFX8(&USB_ERREN_REG(base), USB_ERREN_CRC5EOFEN_SHIFT, USB_ERREN_CRC5EOFEN_WIDTH))
21697 
21698 /*! @brief Set the CRC5EOFEN field to a new value. */
21699 #define USB_WR_ERREN_CRC5EOFEN(base, value) (USB_RMW_ERREN(base, USB_ERREN_CRC5EOFEN_MASK, USB_ERREN_CRC5EOFEN(value)))
21700 #define USB_BWR_ERREN_CRC5EOFEN(base, value) (BME_BFI8(&USB_ERREN_REG(base), ((uint8_t)(value) << USB_ERREN_CRC5EOFEN_SHIFT), USB_ERREN_CRC5EOFEN_SHIFT, USB_ERREN_CRC5EOFEN_WIDTH))
21701 /*@}*/
21702 
21703 /*!
21704  * @name Register USB_ERREN, field CRC16EN[2] (RW)
21705  *
21706  * Values:
21707  * - 0b0 - Disables the CRC16 interrupt.
21708  * - 0b1 - Enables the CRC16 interrupt.
21709  */
21710 /*@{*/
21711 /*! @brief Read current value of the USB_ERREN_CRC16EN field. */
21712 #define USB_RD_ERREN_CRC16EN(base) ((USB_ERREN_REG(base) & USB_ERREN_CRC16EN_MASK) >> USB_ERREN_CRC16EN_SHIFT)
21713 #define USB_BRD_ERREN_CRC16EN(base) (BME_UBFX8(&USB_ERREN_REG(base), USB_ERREN_CRC16EN_SHIFT, USB_ERREN_CRC16EN_WIDTH))
21714 
21715 /*! @brief Set the CRC16EN field to a new value. */
21716 #define USB_WR_ERREN_CRC16EN(base, value) (USB_RMW_ERREN(base, USB_ERREN_CRC16EN_MASK, USB_ERREN_CRC16EN(value)))
21717 #define USB_BWR_ERREN_CRC16EN(base, value) (BME_BFI8(&USB_ERREN_REG(base), ((uint8_t)(value) << USB_ERREN_CRC16EN_SHIFT), USB_ERREN_CRC16EN_SHIFT, USB_ERREN_CRC16EN_WIDTH))
21718 /*@}*/
21719 
21720 /*!
21721  * @name Register USB_ERREN, field DFN8EN[3] (RW)
21722  *
21723  * Values:
21724  * - 0b0 - Disables the DFN8 interrupt.
21725  * - 0b1 - Enables the DFN8 interrupt.
21726  */
21727 /*@{*/
21728 /*! @brief Read current value of the USB_ERREN_DFN8EN field. */
21729 #define USB_RD_ERREN_DFN8EN(base) ((USB_ERREN_REG(base) & USB_ERREN_DFN8EN_MASK) >> USB_ERREN_DFN8EN_SHIFT)
21730 #define USB_BRD_ERREN_DFN8EN(base) (BME_UBFX8(&USB_ERREN_REG(base), USB_ERREN_DFN8EN_SHIFT, USB_ERREN_DFN8EN_WIDTH))
21731 
21732 /*! @brief Set the DFN8EN field to a new value. */
21733 #define USB_WR_ERREN_DFN8EN(base, value) (USB_RMW_ERREN(base, USB_ERREN_DFN8EN_MASK, USB_ERREN_DFN8EN(value)))
21734 #define USB_BWR_ERREN_DFN8EN(base, value) (BME_BFI8(&USB_ERREN_REG(base), ((uint8_t)(value) << USB_ERREN_DFN8EN_SHIFT), USB_ERREN_DFN8EN_SHIFT, USB_ERREN_DFN8EN_WIDTH))
21735 /*@}*/
21736 
21737 /*!
21738  * @name Register USB_ERREN, field BTOERREN[4] (RW)
21739  *
21740  * Values:
21741  * - 0b0 - Disables the BTOERR interrupt.
21742  * - 0b1 - Enables the BTOERR interrupt.
21743  */
21744 /*@{*/
21745 /*! @brief Read current value of the USB_ERREN_BTOERREN field. */
21746 #define USB_RD_ERREN_BTOERREN(base) ((USB_ERREN_REG(base) & USB_ERREN_BTOERREN_MASK) >> USB_ERREN_BTOERREN_SHIFT)
21747 #define USB_BRD_ERREN_BTOERREN(base) (BME_UBFX8(&USB_ERREN_REG(base), USB_ERREN_BTOERREN_SHIFT, USB_ERREN_BTOERREN_WIDTH))
21748 
21749 /*! @brief Set the BTOERREN field to a new value. */
21750 #define USB_WR_ERREN_BTOERREN(base, value) (USB_RMW_ERREN(base, USB_ERREN_BTOERREN_MASK, USB_ERREN_BTOERREN(value)))
21751 #define USB_BWR_ERREN_BTOERREN(base, value) (BME_BFI8(&USB_ERREN_REG(base), ((uint8_t)(value) << USB_ERREN_BTOERREN_SHIFT), USB_ERREN_BTOERREN_SHIFT, USB_ERREN_BTOERREN_WIDTH))
21752 /*@}*/
21753 
21754 /*!
21755  * @name Register USB_ERREN, field DMAERREN[5] (RW)
21756  *
21757  * Values:
21758  * - 0b0 - Disables the DMAERR interrupt.
21759  * - 0b1 - Enables the DMAERR interrupt.
21760  */
21761 /*@{*/
21762 /*! @brief Read current value of the USB_ERREN_DMAERREN field. */
21763 #define USB_RD_ERREN_DMAERREN(base) ((USB_ERREN_REG(base) & USB_ERREN_DMAERREN_MASK) >> USB_ERREN_DMAERREN_SHIFT)
21764 #define USB_BRD_ERREN_DMAERREN(base) (BME_UBFX8(&USB_ERREN_REG(base), USB_ERREN_DMAERREN_SHIFT, USB_ERREN_DMAERREN_WIDTH))
21765 
21766 /*! @brief Set the DMAERREN field to a new value. */
21767 #define USB_WR_ERREN_DMAERREN(base, value) (USB_RMW_ERREN(base, USB_ERREN_DMAERREN_MASK, USB_ERREN_DMAERREN(value)))
21768 #define USB_BWR_ERREN_DMAERREN(base, value) (BME_BFI8(&USB_ERREN_REG(base), ((uint8_t)(value) << USB_ERREN_DMAERREN_SHIFT), USB_ERREN_DMAERREN_SHIFT, USB_ERREN_DMAERREN_WIDTH))
21769 /*@}*/
21770 
21771 /*!
21772  * @name Register USB_ERREN, field BTSERREN[7] (RW)
21773  *
21774  * Values:
21775  * - 0b0 - Disables the BTSERR interrupt.
21776  * - 0b1 - Enables the BTSERR interrupt.
21777  */
21778 /*@{*/
21779 /*! @brief Read current value of the USB_ERREN_BTSERREN field. */
21780 #define USB_RD_ERREN_BTSERREN(base) ((USB_ERREN_REG(base) & USB_ERREN_BTSERREN_MASK) >> USB_ERREN_BTSERREN_SHIFT)
21781 #define USB_BRD_ERREN_BTSERREN(base) (BME_UBFX8(&USB_ERREN_REG(base), USB_ERREN_BTSERREN_SHIFT, USB_ERREN_BTSERREN_WIDTH))
21782 
21783 /*! @brief Set the BTSERREN field to a new value. */
21784 #define USB_WR_ERREN_BTSERREN(base, value) (USB_RMW_ERREN(base, USB_ERREN_BTSERREN_MASK, USB_ERREN_BTSERREN(value)))
21785 #define USB_BWR_ERREN_BTSERREN(base, value) (BME_BFI8(&USB_ERREN_REG(base), ((uint8_t)(value) << USB_ERREN_BTSERREN_SHIFT), USB_ERREN_BTSERREN_SHIFT, USB_ERREN_BTSERREN_WIDTH))
21786 /*@}*/
21787 
21788 /*******************************************************************************
21789  * USB_STAT - Status register
21790  ******************************************************************************/
21791 
21792 /*!
21793  * @brief USB_STAT - Status register (RO)
21794  *
21795  * Reset value: 0x00U
21796  *
21797  * Reports the transaction status within the USB module. When the processor's
21798  * interrupt controller has received a TOKDNE, interrupt the Status Register must
21799  * be read to determine the status of the previous endpoint communication. The
21800  * data in the status register is valid when TOKDNE interrupt is asserted. The
21801  * Status register is actually a read window into a status FIFO maintained by the USB
21802  * module. When the USB module uses a BD, it updates the Status register. If
21803  * another USB transaction is performed before the TOKDNE interrupt is serviced, the
21804  * USB module stores the status of the next transaction in the STAT FIFO. Thus
21805  * STAT is actually a four byte FIFO that allows the processor core to process one
21806  * transaction while the SIE is processing the next transaction. Clearing the
21807  * TOKDNE bit in the ISTAT register causes the SIE to update STAT with the contents
21808  * of the next STAT value. If the data in the STAT holding register is valid, the
21809  * SIE immediately reasserts to TOKDNE interrupt.
21810  */
21811 /*!
21812  * @name Constants and macros for entire USB_STAT register
21813  */
21814 /*@{*/
21815 #define USB_RD_STAT(base) (USB_STAT_REG(base))
21816 /*@}*/
21817 
21818 /*
21819  * Constants & macros for individual USB_STAT bitfields
21820  */
21821 
21822 /*!
21823  * @name Register USB_STAT, field ODD[2] (RO)
21824  *
21825  * This bit is set if the last buffer descriptor updated was in the odd bank of
21826  * the BDT.
21827  */
21828 /*@{*/
21829 /*! @brief Read current value of the USB_STAT_ODD field. */
21830 #define USB_RD_STAT_ODD(base) ((USB_STAT_REG(base) & USB_STAT_ODD_MASK) >> USB_STAT_ODD_SHIFT)
21831 #define USB_BRD_STAT_ODD(base) (BME_UBFX8(&USB_STAT_REG(base), USB_STAT_ODD_SHIFT, USB_STAT_ODD_WIDTH))
21832 /*@}*/
21833 
21834 /*!
21835  * @name Register USB_STAT, field TX[3] (RO)
21836  *
21837  * Values:
21838  * - 0b0 - The most recent transaction was a receive operation.
21839  * - 0b1 - The most recent transaction was a transmit operation.
21840  */
21841 /*@{*/
21842 /*! @brief Read current value of the USB_STAT_TX field. */
21843 #define USB_RD_STAT_TX(base) ((USB_STAT_REG(base) & USB_STAT_TX_MASK) >> USB_STAT_TX_SHIFT)
21844 #define USB_BRD_STAT_TX(base) (BME_UBFX8(&USB_STAT_REG(base), USB_STAT_TX_SHIFT, USB_STAT_TX_WIDTH))
21845 /*@}*/
21846 
21847 /*!
21848  * @name Register USB_STAT, field ENDP[7:4] (RO)
21849  *
21850  * This four-bit field encodes the endpoint address that received or transmitted
21851  * the previous token. This allows the processor core to determine the BDT entry
21852  * that was updated by the last USB transaction.
21853  */
21854 /*@{*/
21855 /*! @brief Read current value of the USB_STAT_ENDP field. */
21856 #define USB_RD_STAT_ENDP(base) ((USB_STAT_REG(base) & USB_STAT_ENDP_MASK) >> USB_STAT_ENDP_SHIFT)
21857 #define USB_BRD_STAT_ENDP(base) (BME_UBFX8(&USB_STAT_REG(base), USB_STAT_ENDP_SHIFT, USB_STAT_ENDP_WIDTH))
21858 /*@}*/
21859 
21860 /*******************************************************************************
21861  * USB_CTL - Control register
21862  ******************************************************************************/
21863 
21864 /*!
21865  * @brief USB_CTL - Control register (RW)
21866  *
21867  * Reset value: 0x00U
21868  *
21869  * Provides various control and configuration information for the USB module.
21870  */
21871 /*!
21872  * @name Constants and macros for entire USB_CTL register
21873  */
21874 /*@{*/
21875 #define USB_RD_CTL(base) (USB_CTL_REG(base))
21876 #define USB_WR_CTL(base, value) (USB_CTL_REG(base) = (value))
21877 #define USB_RMW_CTL(base, mask, value) (USB_WR_CTL(base, (USB_RD_CTL(base) & ~(mask)) | (value)))
21878 #define USB_SET_CTL(base, value) (BME_OR8(&USB_CTL_REG(base), (uint8_t)(value)))
21879 #define USB_CLR_CTL(base, value) (BME_AND8(&USB_CTL_REG(base), (uint8_t)(~(value))))
21880 #define USB_TOG_CTL(base, value) (BME_XOR8(&USB_CTL_REG(base), (uint8_t)(value)))
21881 /*@}*/
21882 
21883 /*
21884  * Constants & macros for individual USB_CTL bitfields
21885  */
21886 
21887 /*!
21888  * @name Register USB_CTL, field USBENSOFEN[0] (RW)
21889  *
21890  * Setting this bit causes the SIE to reset all of its ODD bits to the BDTs.
21891  * Therefore, setting this bit resets much of the logic in the SIE. When host mode
21892  * is enabled, clearing this bit causes the SIE to stop sending SOF tokens.
21893  *
21894  * Values:
21895  * - 0b0 - Disables the USB Module.
21896  * - 0b1 - Enables the USB Module.
21897  */
21898 /*@{*/
21899 /*! @brief Read current value of the USB_CTL_USBENSOFEN field. */
21900 #define USB_RD_CTL_USBENSOFEN(base) ((USB_CTL_REG(base) & USB_CTL_USBENSOFEN_MASK) >> USB_CTL_USBENSOFEN_SHIFT)
21901 #define USB_BRD_CTL_USBENSOFEN(base) (BME_UBFX8(&USB_CTL_REG(base), USB_CTL_USBENSOFEN_SHIFT, USB_CTL_USBENSOFEN_WIDTH))
21902 
21903 /*! @brief Set the USBENSOFEN field to a new value. */
21904 #define USB_WR_CTL_USBENSOFEN(base, value) (USB_RMW_CTL(base, USB_CTL_USBENSOFEN_MASK, USB_CTL_USBENSOFEN(value)))
21905 #define USB_BWR_CTL_USBENSOFEN(base, value) (BME_BFI8(&USB_CTL_REG(base), ((uint8_t)(value) << USB_CTL_USBENSOFEN_SHIFT), USB_CTL_USBENSOFEN_SHIFT, USB_CTL_USBENSOFEN_WIDTH))
21906 /*@}*/
21907 
21908 /*!
21909  * @name Register USB_CTL, field ODDRST[1] (RW)
21910  *
21911  * Setting this bit to 1 resets all the BDT ODD ping/pong fields to 0, which
21912  * then specifies the EVEN BDT bank.
21913  */
21914 /*@{*/
21915 /*! @brief Read current value of the USB_CTL_ODDRST field. */
21916 #define USB_RD_CTL_ODDRST(base) ((USB_CTL_REG(base) & USB_CTL_ODDRST_MASK) >> USB_CTL_ODDRST_SHIFT)
21917 #define USB_BRD_CTL_ODDRST(base) (BME_UBFX8(&USB_CTL_REG(base), USB_CTL_ODDRST_SHIFT, USB_CTL_ODDRST_WIDTH))
21918 
21919 /*! @brief Set the ODDRST field to a new value. */
21920 #define USB_WR_CTL_ODDRST(base, value) (USB_RMW_CTL(base, USB_CTL_ODDRST_MASK, USB_CTL_ODDRST(value)))
21921 #define USB_BWR_CTL_ODDRST(base, value) (BME_BFI8(&USB_CTL_REG(base), ((uint8_t)(value) << USB_CTL_ODDRST_SHIFT), USB_CTL_ODDRST_SHIFT, USB_CTL_ODDRST_WIDTH))
21922 /*@}*/
21923 
21924 /*!
21925  * @name Register USB_CTL, field RESUME[2] (RW)
21926  *
21927  * When set to 1 this bit enables the USB Module to execute resume signaling.
21928  * This allows the USB Module to perform remote wake-up. Software must set RESUME
21929  * to 1 for the required amount of time and then clear it to 0. If the HOSTMODEEN
21930  * bit is set, the USB module appends a Low Speed End of Packet to the Resume
21931  * signaling when the RESUME bit is cleared. For more information on RESUME
21932  * signaling see Section 7.1.4.5 of the USB specification version 1.0.
21933  */
21934 /*@{*/
21935 /*! @brief Read current value of the USB_CTL_RESUME field. */
21936 #define USB_RD_CTL_RESUME(base) ((USB_CTL_REG(base) & USB_CTL_RESUME_MASK) >> USB_CTL_RESUME_SHIFT)
21937 #define USB_BRD_CTL_RESUME(base) (BME_UBFX8(&USB_CTL_REG(base), USB_CTL_RESUME_SHIFT, USB_CTL_RESUME_WIDTH))
21938 
21939 /*! @brief Set the RESUME field to a new value. */
21940 #define USB_WR_CTL_RESUME(base, value) (USB_RMW_CTL(base, USB_CTL_RESUME_MASK, USB_CTL_RESUME(value)))
21941 #define USB_BWR_CTL_RESUME(base, value) (BME_BFI8(&USB_CTL_REG(base), ((uint8_t)(value) << USB_CTL_RESUME_SHIFT), USB_CTL_RESUME_SHIFT, USB_CTL_RESUME_WIDTH))
21942 /*@}*/
21943 
21944 /*!
21945  * @name Register USB_CTL, field HOSTMODEEN[3] (RW)
21946  *
21947  * When set to 1, this bit enables the USB Module to operate in Host mode. In
21948  * host mode, the USB module performs USB transactions under the programmed control
21949  * of the host processor.
21950  */
21951 /*@{*/
21952 /*! @brief Read current value of the USB_CTL_HOSTMODEEN field. */
21953 #define USB_RD_CTL_HOSTMODEEN(base) ((USB_CTL_REG(base) & USB_CTL_HOSTMODEEN_MASK) >> USB_CTL_HOSTMODEEN_SHIFT)
21954 #define USB_BRD_CTL_HOSTMODEEN(base) (BME_UBFX8(&USB_CTL_REG(base), USB_CTL_HOSTMODEEN_SHIFT, USB_CTL_HOSTMODEEN_WIDTH))
21955 
21956 /*! @brief Set the HOSTMODEEN field to a new value. */
21957 #define USB_WR_CTL_HOSTMODEEN(base, value) (USB_RMW_CTL(base, USB_CTL_HOSTMODEEN_MASK, USB_CTL_HOSTMODEEN(value)))
21958 #define USB_BWR_CTL_HOSTMODEEN(base, value) (BME_BFI8(&USB_CTL_REG(base), ((uint8_t)(value) << USB_CTL_HOSTMODEEN_SHIFT), USB_CTL_HOSTMODEEN_SHIFT, USB_CTL_HOSTMODEEN_WIDTH))
21959 /*@}*/
21960 
21961 /*!
21962  * @name Register USB_CTL, field RESET[4] (RW)
21963  *
21964  * Setting this bit enables the USB Module to generate USB reset signaling. This
21965  * allows the USB Module to reset USB peripherals. This control signal is only
21966  * valid in Host mode (HOSTMODEEN=1). Software must set RESET to 1 for the
21967  * required amount of time and then clear it to 0 to end reset signaling. For more
21968  * information on reset signaling see Section 7.1.4.3 of the USB specification version
21969  * 1.0.
21970  */
21971 /*@{*/
21972 /*! @brief Read current value of the USB_CTL_RESET field. */
21973 #define USB_RD_CTL_RESET(base) ((USB_CTL_REG(base) & USB_CTL_RESET_MASK) >> USB_CTL_RESET_SHIFT)
21974 #define USB_BRD_CTL_RESET(base) (BME_UBFX8(&USB_CTL_REG(base), USB_CTL_RESET_SHIFT, USB_CTL_RESET_WIDTH))
21975 
21976 /*! @brief Set the RESET field to a new value. */
21977 #define USB_WR_CTL_RESET(base, value) (USB_RMW_CTL(base, USB_CTL_RESET_MASK, USB_CTL_RESET(value)))
21978 #define USB_BWR_CTL_RESET(base, value) (BME_BFI8(&USB_CTL_REG(base), ((uint8_t)(value) << USB_CTL_RESET_SHIFT), USB_CTL_RESET_SHIFT, USB_CTL_RESET_WIDTH))
21979 /*@}*/
21980 
21981 /*!
21982  * @name Register USB_CTL, field TXSUSPENDTOKENBUSY[5] (RW)
21983  *
21984  * In Host mode, TOKEN_BUSY is set when the USB module is busy executing a USB
21985  * token. Software must not write more token commands to the Token Register when
21986  * TOKEN_BUSY is set.. Software should check this field before writing any tokens
21987  * to the Token Register to ensure that token commands are not lost. In Target
21988  * mode, TXD_SUSPEND is set when the SIE has disabled packet transmission and
21989  * reception. Clearing this bit allows the SIE to continue token processing. This bit
21990  * is set by the SIE when a SETUP Token is received allowing software to dequeue
21991  * any pending packet transactions in the BDT before resuming token processing.
21992  */
21993 /*@{*/
21994 /*! @brief Read current value of the USB_CTL_TXSUSPENDTOKENBUSY field. */
21995 #define USB_RD_CTL_TXSUSPENDTOKENBUSY(base) ((USB_CTL_REG(base) & USB_CTL_TXSUSPENDTOKENBUSY_MASK) >> USB_CTL_TXSUSPENDTOKENBUSY_SHIFT)
21996 #define USB_BRD_CTL_TXSUSPENDTOKENBUSY(base) (BME_UBFX8(&USB_CTL_REG(base), USB_CTL_TXSUSPENDTOKENBUSY_SHIFT, USB_CTL_TXSUSPENDTOKENBUSY_WIDTH))
21997 
21998 /*! @brief Set the TXSUSPENDTOKENBUSY field to a new value. */
21999 #define USB_WR_CTL_TXSUSPENDTOKENBUSY(base, value) (USB_RMW_CTL(base, USB_CTL_TXSUSPENDTOKENBUSY_MASK, USB_CTL_TXSUSPENDTOKENBUSY(value)))
22000 #define USB_BWR_CTL_TXSUSPENDTOKENBUSY(base, value) (BME_BFI8(&USB_CTL_REG(base), ((uint8_t)(value) << USB_CTL_TXSUSPENDTOKENBUSY_SHIFT), USB_CTL_TXSUSPENDTOKENBUSY_SHIFT, USB_CTL_TXSUSPENDTOKENBUSY_WIDTH))
22001 /*@}*/
22002 
22003 /*!
22004  * @name Register USB_CTL, field SE0[6] (RW)
22005  */
22006 /*@{*/
22007 /*! @brief Read current value of the USB_CTL_SE0 field. */
22008 #define USB_RD_CTL_SE0(base) ((USB_CTL_REG(base) & USB_CTL_SE0_MASK) >> USB_CTL_SE0_SHIFT)
22009 #define USB_BRD_CTL_SE0(base) (BME_UBFX8(&USB_CTL_REG(base), USB_CTL_SE0_SHIFT, USB_CTL_SE0_WIDTH))
22010 
22011 /*! @brief Set the SE0 field to a new value. */
22012 #define USB_WR_CTL_SE0(base, value) (USB_RMW_CTL(base, USB_CTL_SE0_MASK, USB_CTL_SE0(value)))
22013 #define USB_BWR_CTL_SE0(base, value) (BME_BFI8(&USB_CTL_REG(base), ((uint8_t)(value) << USB_CTL_SE0_SHIFT), USB_CTL_SE0_SHIFT, USB_CTL_SE0_WIDTH))
22014 /*@}*/
22015 
22016 /*!
22017  * @name Register USB_CTL, field JSTATE[7] (RW)
22018  *
22019  * The polarity of this signal is affected by the current state of LSEN .
22020  */
22021 /*@{*/
22022 /*! @brief Read current value of the USB_CTL_JSTATE field. */
22023 #define USB_RD_CTL_JSTATE(base) ((USB_CTL_REG(base) & USB_CTL_JSTATE_MASK) >> USB_CTL_JSTATE_SHIFT)
22024 #define USB_BRD_CTL_JSTATE(base) (BME_UBFX8(&USB_CTL_REG(base), USB_CTL_JSTATE_SHIFT, USB_CTL_JSTATE_WIDTH))
22025 
22026 /*! @brief Set the JSTATE field to a new value. */
22027 #define USB_WR_CTL_JSTATE(base, value) (USB_RMW_CTL(base, USB_CTL_JSTATE_MASK, USB_CTL_JSTATE(value)))
22028 #define USB_BWR_CTL_JSTATE(base, value) (BME_BFI8(&USB_CTL_REG(base), ((uint8_t)(value) << USB_CTL_JSTATE_SHIFT), USB_CTL_JSTATE_SHIFT, USB_CTL_JSTATE_WIDTH))
22029 /*@}*/
22030 
22031 /*******************************************************************************
22032  * USB_ADDR - Address register
22033  ******************************************************************************/
22034 
22035 /*!
22036  * @brief USB_ADDR - Address register (RW)
22037  *
22038  * Reset value: 0x00U
22039  *
22040  * Holds the unique USB address that the USB module decodes when in Peripheral
22041  * mode (HOSTMODEEN=0). When operating in Host mode (HOSTMODEEN=1) the USB module
22042  * transmits this address with a TOKEN packet. This enables the USB module to
22043  * uniquely address an USB peripheral. In either mode, USB_EN within the control
22044  * register must be 1. The Address register is reset to 0x00 after the reset input
22045  * becomes active or the USB module decodes a USB reset signal. This action
22046  * initializes the Address register to decode address 0x00 as required by the USB
22047  * specification.
22048  */
22049 /*!
22050  * @name Constants and macros for entire USB_ADDR register
22051  */
22052 /*@{*/
22053 #define USB_RD_ADDR(base) (USB_ADDR_REG(base))
22054 #define USB_WR_ADDR(base, value) (USB_ADDR_REG(base) = (value))
22055 #define USB_RMW_ADDR(base, mask, value) (USB_WR_ADDR(base, (USB_RD_ADDR(base) & ~(mask)) | (value)))
22056 #define USB_SET_ADDR(base, value) (BME_OR8(&USB_ADDR_REG(base), (uint8_t)(value)))
22057 #define USB_CLR_ADDR(base, value) (BME_AND8(&USB_ADDR_REG(base), (uint8_t)(~(value))))
22058 #define USB_TOG_ADDR(base, value) (BME_XOR8(&USB_ADDR_REG(base), (uint8_t)(value)))
22059 /*@}*/
22060 
22061 /*
22062  * Constants & macros for individual USB_ADDR bitfields
22063  */
22064 
22065 /*!
22066  * @name Register USB_ADDR, field ADDR[6:0] (RW)
22067  *
22068  * Defines the USB address that the USB module decodes in peripheral mode, or
22069  * transmits when in host mode.
22070  */
22071 /*@{*/
22072 /*! @brief Read current value of the USB_ADDR_ADDR field. */
22073 #define USB_RD_ADDR_ADDR(base) ((USB_ADDR_REG(base) & USB_ADDR_ADDR_MASK) >> USB_ADDR_ADDR_SHIFT)
22074 #define USB_BRD_ADDR_ADDR(base) (BME_UBFX8(&USB_ADDR_REG(base), USB_ADDR_ADDR_SHIFT, USB_ADDR_ADDR_WIDTH))
22075 
22076 /*! @brief Set the ADDR field to a new value. */
22077 #define USB_WR_ADDR_ADDR(base, value) (USB_RMW_ADDR(base, USB_ADDR_ADDR_MASK, USB_ADDR_ADDR(value)))
22078 #define USB_BWR_ADDR_ADDR(base, value) (BME_BFI8(&USB_ADDR_REG(base), ((uint8_t)(value) << USB_ADDR_ADDR_SHIFT), USB_ADDR_ADDR_SHIFT, USB_ADDR_ADDR_WIDTH))
22079 /*@}*/
22080 
22081 /*!
22082  * @name Register USB_ADDR, field LSEN[7] (RW)
22083  *
22084  * Informs the USB module that the next token command written to the token
22085  * register must be performed at low speed. This enables the USB module to perform the
22086  * necessary preamble required for low-speed data transmissions.
22087  */
22088 /*@{*/
22089 /*! @brief Read current value of the USB_ADDR_LSEN field. */
22090 #define USB_RD_ADDR_LSEN(base) ((USB_ADDR_REG(base) & USB_ADDR_LSEN_MASK) >> USB_ADDR_LSEN_SHIFT)
22091 #define USB_BRD_ADDR_LSEN(base) (BME_UBFX8(&USB_ADDR_REG(base), USB_ADDR_LSEN_SHIFT, USB_ADDR_LSEN_WIDTH))
22092 
22093 /*! @brief Set the LSEN field to a new value. */
22094 #define USB_WR_ADDR_LSEN(base, value) (USB_RMW_ADDR(base, USB_ADDR_LSEN_MASK, USB_ADDR_LSEN(value)))
22095 #define USB_BWR_ADDR_LSEN(base, value) (BME_BFI8(&USB_ADDR_REG(base), ((uint8_t)(value) << USB_ADDR_LSEN_SHIFT), USB_ADDR_LSEN_SHIFT, USB_ADDR_LSEN_WIDTH))
22096 /*@}*/
22097 
22098 /*******************************************************************************
22099  * USB_BDTPAGE1 - BDT Page Register 1
22100  ******************************************************************************/
22101 
22102 /*!
22103  * @brief USB_BDTPAGE1 - BDT Page Register 1 (RW)
22104  *
22105  * Reset value: 0x00U
22106  *
22107  * Provides address bits 15 through 9 of the base address where the current
22108  * Buffer Descriptor Table (BDT) resides in system memory. The 32-bit BDT Base
22109  * Address is always aligned on 512-byte boundaries, so bits 8 through 0 of the base
22110  * address are always zero.
22111  */
22112 /*!
22113  * @name Constants and macros for entire USB_BDTPAGE1 register
22114  */
22115 /*@{*/
22116 #define USB_RD_BDTPAGE1(base) (USB_BDTPAGE1_REG(base))
22117 #define USB_WR_BDTPAGE1(base, value) (USB_BDTPAGE1_REG(base) = (value))
22118 #define USB_RMW_BDTPAGE1(base, mask, value) (USB_WR_BDTPAGE1(base, (USB_RD_BDTPAGE1(base) & ~(mask)) | (value)))
22119 #define USB_SET_BDTPAGE1(base, value) (BME_OR8(&USB_BDTPAGE1_REG(base), (uint8_t)(value)))
22120 #define USB_CLR_BDTPAGE1(base, value) (BME_AND8(&USB_BDTPAGE1_REG(base), (uint8_t)(~(value))))
22121 #define USB_TOG_BDTPAGE1(base, value) (BME_XOR8(&USB_BDTPAGE1_REG(base), (uint8_t)(value)))
22122 /*@}*/
22123 
22124 /*
22125  * Constants & macros for individual USB_BDTPAGE1 bitfields
22126  */
22127 
22128 /*!
22129  * @name Register USB_BDTPAGE1, field BDTBA[7:1] (RW)
22130  *
22131  * Provides address bits 15 through 9 of the BDT base address.
22132  */
22133 /*@{*/
22134 /*! @brief Read current value of the USB_BDTPAGE1_BDTBA field. */
22135 #define USB_RD_BDTPAGE1_BDTBA(base) ((USB_BDTPAGE1_REG(base) & USB_BDTPAGE1_BDTBA_MASK) >> USB_BDTPAGE1_BDTBA_SHIFT)
22136 #define USB_BRD_BDTPAGE1_BDTBA(base) (BME_UBFX8(&USB_BDTPAGE1_REG(base), USB_BDTPAGE1_BDTBA_SHIFT, USB_BDTPAGE1_BDTBA_WIDTH))
22137 
22138 /*! @brief Set the BDTBA field to a new value. */
22139 #define USB_WR_BDTPAGE1_BDTBA(base, value) (USB_RMW_BDTPAGE1(base, USB_BDTPAGE1_BDTBA_MASK, USB_BDTPAGE1_BDTBA(value)))
22140 #define USB_BWR_BDTPAGE1_BDTBA(base, value) (BME_BFI8(&USB_BDTPAGE1_REG(base), ((uint8_t)(value) << USB_BDTPAGE1_BDTBA_SHIFT), USB_BDTPAGE1_BDTBA_SHIFT, USB_BDTPAGE1_BDTBA_WIDTH))
22141 /*@}*/
22142 
22143 /*******************************************************************************
22144  * USB_FRMNUML - Frame Number Register Low
22145  ******************************************************************************/
22146 
22147 /*!
22148  * @brief USB_FRMNUML - Frame Number Register Low (RW)
22149  *
22150  * Reset value: 0x00U
22151  *
22152  * Contains an 11-bit value used to compute the address where the current Buffer
22153  * Descriptor Table (BDT) resides in system memory.
22154  */
22155 /*!
22156  * @name Constants and macros for entire USB_FRMNUML register
22157  */
22158 /*@{*/
22159 #define USB_RD_FRMNUML(base) (USB_FRMNUML_REG(base))
22160 #define USB_WR_FRMNUML(base, value) (USB_FRMNUML_REG(base) = (value))
22161 #define USB_RMW_FRMNUML(base, mask, value) (USB_WR_FRMNUML(base, (USB_RD_FRMNUML(base) & ~(mask)) | (value)))
22162 #define USB_SET_FRMNUML(base, value) (BME_OR8(&USB_FRMNUML_REG(base), (uint8_t)(value)))
22163 #define USB_CLR_FRMNUML(base, value) (BME_AND8(&USB_FRMNUML_REG(base), (uint8_t)(~(value))))
22164 #define USB_TOG_FRMNUML(base, value) (BME_XOR8(&USB_FRMNUML_REG(base), (uint8_t)(value)))
22165 /*@}*/
22166 
22167 /*******************************************************************************
22168  * USB_FRMNUMH - Frame Number Register High
22169  ******************************************************************************/
22170 
22171 /*!
22172  * @brief USB_FRMNUMH - Frame Number Register High (RW)
22173  *
22174  * Reset value: 0x00U
22175  *
22176  * Contains an 11-bit value used to compute the address where the current Buffer
22177  * Descriptor Table (BDT) resides in system memory.
22178  */
22179 /*!
22180  * @name Constants and macros for entire USB_FRMNUMH register
22181  */
22182 /*@{*/
22183 #define USB_RD_FRMNUMH(base) (USB_FRMNUMH_REG(base))
22184 #define USB_WR_FRMNUMH(base, value) (USB_FRMNUMH_REG(base) = (value))
22185 #define USB_RMW_FRMNUMH(base, mask, value) (USB_WR_FRMNUMH(base, (USB_RD_FRMNUMH(base) & ~(mask)) | (value)))
22186 #define USB_SET_FRMNUMH(base, value) (BME_OR8(&USB_FRMNUMH_REG(base), (uint8_t)(value)))
22187 #define USB_CLR_FRMNUMH(base, value) (BME_AND8(&USB_FRMNUMH_REG(base), (uint8_t)(~(value))))
22188 #define USB_TOG_FRMNUMH(base, value) (BME_XOR8(&USB_FRMNUMH_REG(base), (uint8_t)(value)))
22189 /*@}*/
22190 
22191 /*
22192  * Constants & macros for individual USB_FRMNUMH bitfields
22193  */
22194 
22195 /*!
22196  * @name Register USB_FRMNUMH, field FRM[2:0] (RW)
22197  *
22198  * This 3-bit field and the 8-bit field in the Frame Number Register Low are
22199  * used to compute the address where the current Buffer Descriptor Table (BDT)
22200  * resides in system memory.
22201  */
22202 /*@{*/
22203 /*! @brief Read current value of the USB_FRMNUMH_FRM field. */
22204 #define USB_RD_FRMNUMH_FRM(base) ((USB_FRMNUMH_REG(base) & USB_FRMNUMH_FRM_MASK) >> USB_FRMNUMH_FRM_SHIFT)
22205 #define USB_BRD_FRMNUMH_FRM(base) (BME_UBFX8(&USB_FRMNUMH_REG(base), USB_FRMNUMH_FRM_SHIFT, USB_FRMNUMH_FRM_WIDTH))
22206 
22207 /*! @brief Set the FRM field to a new value. */
22208 #define USB_WR_FRMNUMH_FRM(base, value) (USB_RMW_FRMNUMH(base, USB_FRMNUMH_FRM_MASK, USB_FRMNUMH_FRM(value)))
22209 #define USB_BWR_FRMNUMH_FRM(base, value) (BME_BFI8(&USB_FRMNUMH_REG(base), ((uint8_t)(value) << USB_FRMNUMH_FRM_SHIFT), USB_FRMNUMH_FRM_SHIFT, USB_FRMNUMH_FRM_WIDTH))
22210 /*@}*/
22211 
22212 /*******************************************************************************
22213  * USB_TOKEN - Token register
22214  ******************************************************************************/
22215 
22216 /*!
22217  * @brief USB_TOKEN - Token register (RW)
22218  *
22219  * Reset value: 0x00U
22220  *
22221  * Used to initiate USB transactions when in host mode (HOSTMODEEN=1). When the
22222  * software needs to execute a USB transaction to a peripheral, it writes the
22223  * TOKEN type and endpoint to this register. After this register has been written,
22224  * the USB module begins the specified USB transaction to the address contained in
22225  * the address register. The processor core must always check that the
22226  * TOKEN_BUSY bit in the control register is not 1 before writing to the Token Register.
22227  * This ensures that the token commands are not overwritten before they can be
22228  * executed. The address register and endpoint control register 0 are also used when
22229  * performing a token command and therefore must also be written before the
22230  * Token Register. The address register is used to select the USB peripheral address
22231  * transmitted by the token command. The endpoint control register determines the
22232  * handshake and retry policies used during the transfer.
22233  */
22234 /*!
22235  * @name Constants and macros for entire USB_TOKEN register
22236  */
22237 /*@{*/
22238 #define USB_RD_TOKEN(base) (USB_TOKEN_REG(base))
22239 #define USB_WR_TOKEN(base, value) (USB_TOKEN_REG(base) = (value))
22240 #define USB_RMW_TOKEN(base, mask, value) (USB_WR_TOKEN(base, (USB_RD_TOKEN(base) & ~(mask)) | (value)))
22241 #define USB_SET_TOKEN(base, value) (BME_OR8(&USB_TOKEN_REG(base), (uint8_t)(value)))
22242 #define USB_CLR_TOKEN(base, value) (BME_AND8(&USB_TOKEN_REG(base), (uint8_t)(~(value))))
22243 #define USB_TOG_TOKEN(base, value) (BME_XOR8(&USB_TOKEN_REG(base), (uint8_t)(value)))
22244 /*@}*/
22245 
22246 /*
22247  * Constants & macros for individual USB_TOKEN bitfields
22248  */
22249 
22250 /*!
22251  * @name Register USB_TOKEN, field TOKENENDPT[3:0] (RW)
22252  *
22253  * Holds the Endpoint address for the token command. The four bit value written
22254  * must be a valid endpoint.
22255  */
22256 /*@{*/
22257 /*! @brief Read current value of the USB_TOKEN_TOKENENDPT field. */
22258 #define USB_RD_TOKEN_TOKENENDPT(base) ((USB_TOKEN_REG(base) & USB_TOKEN_TOKENENDPT_MASK) >> USB_TOKEN_TOKENENDPT_SHIFT)
22259 #define USB_BRD_TOKEN_TOKENENDPT(base) (BME_UBFX8(&USB_TOKEN_REG(base), USB_TOKEN_TOKENENDPT_SHIFT, USB_TOKEN_TOKENENDPT_WIDTH))
22260 
22261 /*! @brief Set the TOKENENDPT field to a new value. */
22262 #define USB_WR_TOKEN_TOKENENDPT(base, value) (USB_RMW_TOKEN(base, USB_TOKEN_TOKENENDPT_MASK, USB_TOKEN_TOKENENDPT(value)))
22263 #define USB_BWR_TOKEN_TOKENENDPT(base, value) (BME_BFI8(&USB_TOKEN_REG(base), ((uint8_t)(value) << USB_TOKEN_TOKENENDPT_SHIFT), USB_TOKEN_TOKENENDPT_SHIFT, USB_TOKEN_TOKENENDPT_WIDTH))
22264 /*@}*/
22265 
22266 /*!
22267  * @name Register USB_TOKEN, field TOKENPID[7:4] (RW)
22268  *
22269  * Contains the token type executed by the USB module.
22270  *
22271  * Values:
22272  * - 0b0001 - OUT Token. USB Module performs an OUT (TX) transaction.
22273  * - 0b1001 - IN Token. USB Module performs an In (RX) transaction.
22274  * - 0b1101 - SETUP Token. USB Module performs a SETUP (TX) transaction
22275  */
22276 /*@{*/
22277 /*! @brief Read current value of the USB_TOKEN_TOKENPID field. */
22278 #define USB_RD_TOKEN_TOKENPID(base) ((USB_TOKEN_REG(base) & USB_TOKEN_TOKENPID_MASK) >> USB_TOKEN_TOKENPID_SHIFT)
22279 #define USB_BRD_TOKEN_TOKENPID(base) (BME_UBFX8(&USB_TOKEN_REG(base), USB_TOKEN_TOKENPID_SHIFT, USB_TOKEN_TOKENPID_WIDTH))
22280 
22281 /*! @brief Set the TOKENPID field to a new value. */
22282 #define USB_WR_TOKEN_TOKENPID(base, value) (USB_RMW_TOKEN(base, USB_TOKEN_TOKENPID_MASK, USB_TOKEN_TOKENPID(value)))
22283 #define USB_BWR_TOKEN_TOKENPID(base, value) (BME_BFI8(&USB_TOKEN_REG(base), ((uint8_t)(value) << USB_TOKEN_TOKENPID_SHIFT), USB_TOKEN_TOKENPID_SHIFT, USB_TOKEN_TOKENPID_WIDTH))
22284 /*@}*/
22285 
22286 /*******************************************************************************
22287  * USB_SOFTHLD - SOF Threshold Register
22288  ******************************************************************************/
22289 
22290 /*!
22291  * @brief USB_SOFTHLD - SOF Threshold Register (RW)
22292  *
22293  * Reset value: 0x00U
22294  *
22295  * The SOF Threshold Register is used only in Host mode (HOSTMODEEN=1). When in
22296  * Host mode, the 14-bit SOF counter counts the interval between SOF frames. The
22297  * SOF must be transmitted every 1ms so therefore the SOF counter is loaded with
22298  * a value of 12000. When the SOF counter reaches zero, a Start Of Frame (SOF)
22299  * token is transmitted. The SOF threshold register is used to program the number
22300  * of USB byte times before the SOF to stop initiating token packet transactions.
22301  * This register must be set to a value that ensures that other packets are not
22302  * actively being transmitted when the SOF time counts to zero. When the SOF
22303  * counter reaches the threshold value, no more tokens are transmitted until after the
22304  * SOF has been transmitted. The value programmed into the threshold register
22305  * must reserve enough time to ensure the worst case transaction completes. In
22306  * general the worst case transaction is an IN token followed by a data packet from
22307  * the target followed by the response from the host. The actual time required is
22308  * a function of the maximum packet size on the bus. Typical values for the SOF
22309  * threshold are: 64-byte packets=74; 32-byte packets=42; 16-byte packets=26;
22310  * 8-byte packets=18.
22311  */
22312 /*!
22313  * @name Constants and macros for entire USB_SOFTHLD register
22314  */
22315 /*@{*/
22316 #define USB_RD_SOFTHLD(base) (USB_SOFTHLD_REG(base))
22317 #define USB_WR_SOFTHLD(base, value) (USB_SOFTHLD_REG(base) = (value))
22318 #define USB_RMW_SOFTHLD(base, mask, value) (USB_WR_SOFTHLD(base, (USB_RD_SOFTHLD(base) & ~(mask)) | (value)))
22319 #define USB_SET_SOFTHLD(base, value) (BME_OR8(&USB_SOFTHLD_REG(base), (uint8_t)(value)))
22320 #define USB_CLR_SOFTHLD(base, value) (BME_AND8(&USB_SOFTHLD_REG(base), (uint8_t)(~(value))))
22321 #define USB_TOG_SOFTHLD(base, value) (BME_XOR8(&USB_SOFTHLD_REG(base), (uint8_t)(value)))
22322 /*@}*/
22323 
22324 /*******************************************************************************
22325  * USB_BDTPAGE2 - BDT Page Register 2
22326  ******************************************************************************/
22327 
22328 /*!
22329  * @brief USB_BDTPAGE2 - BDT Page Register 2 (RW)
22330  *
22331  * Reset value: 0x00U
22332  *
22333  * Contains an 8-bit value used to compute the address where the current Buffer
22334  * Descriptor Table (BDT) resides in system memory.
22335  */
22336 /*!
22337  * @name Constants and macros for entire USB_BDTPAGE2 register
22338  */
22339 /*@{*/
22340 #define USB_RD_BDTPAGE2(base) (USB_BDTPAGE2_REG(base))
22341 #define USB_WR_BDTPAGE2(base, value) (USB_BDTPAGE2_REG(base) = (value))
22342 #define USB_RMW_BDTPAGE2(base, mask, value) (USB_WR_BDTPAGE2(base, (USB_RD_BDTPAGE2(base) & ~(mask)) | (value)))
22343 #define USB_SET_BDTPAGE2(base, value) (BME_OR8(&USB_BDTPAGE2_REG(base), (uint8_t)(value)))
22344 #define USB_CLR_BDTPAGE2(base, value) (BME_AND8(&USB_BDTPAGE2_REG(base), (uint8_t)(~(value))))
22345 #define USB_TOG_BDTPAGE2(base, value) (BME_XOR8(&USB_BDTPAGE2_REG(base), (uint8_t)(value)))
22346 /*@}*/
22347 
22348 /*******************************************************************************
22349  * USB_BDTPAGE3 - BDT Page Register 3
22350  ******************************************************************************/
22351 
22352 /*!
22353  * @brief USB_BDTPAGE3 - BDT Page Register 3 (RW)
22354  *
22355  * Reset value: 0x00U
22356  *
22357  * Contains an 8-bit value used to compute the address where the current Buffer
22358  * Descriptor Table (BDT) resides in system memory.
22359  */
22360 /*!
22361  * @name Constants and macros for entire USB_BDTPAGE3 register
22362  */
22363 /*@{*/
22364 #define USB_RD_BDTPAGE3(base) (USB_BDTPAGE3_REG(base))
22365 #define USB_WR_BDTPAGE3(base, value) (USB_BDTPAGE3_REG(base) = (value))
22366 #define USB_RMW_BDTPAGE3(base, mask, value) (USB_WR_BDTPAGE3(base, (USB_RD_BDTPAGE3(base) & ~(mask)) | (value)))
22367 #define USB_SET_BDTPAGE3(base, value) (BME_OR8(&USB_BDTPAGE3_REG(base), (uint8_t)(value)))
22368 #define USB_CLR_BDTPAGE3(base, value) (BME_AND8(&USB_BDTPAGE3_REG(base), (uint8_t)(~(value))))
22369 #define USB_TOG_BDTPAGE3(base, value) (BME_XOR8(&USB_BDTPAGE3_REG(base), (uint8_t)(value)))
22370 /*@}*/
22371 
22372 /*******************************************************************************
22373  * USB_ENDPT - Endpoint Control register
22374  ******************************************************************************/
22375 
22376 /*!
22377  * @brief USB_ENDPT - Endpoint Control register (RW)
22378  *
22379  * Reset value: 0x00U
22380  *
22381  * Contains the endpoint control bits for each of the 16 endpoints available
22382  * within the USB module for a decoded address. The format for these registers is
22383  * shown in the following figure. Endpoint 0 (ENDPT0) is associated with control
22384  * pipe 0, which is required for all USB functions. Therefore, after a USBRST
22385  * interrupt occurs the processor core should set ENDPT0 to contain 0x0D. In Host mode
22386  * ENDPT0 is used to determine the handshake, retry and low speed
22387  * characteristics of the host transfer. For Control, Bulk and Interrupt transfers, the EPHSHK
22388  * bit should be 1. For Isochronous transfers it should be 0. Common values to
22389  * use for ENDPT0 in host mode are 0x4D for Control, Bulk, and Interrupt transfers,
22390  * and 0x4C for Isochronous transfers.
22391  */
22392 /*!
22393  * @name Constants and macros for entire USB_ENDPT register
22394  */
22395 /*@{*/
22396 #define USB_RD_ENDPT(base, index) (USB_ENDPT_REG(base, index))
22397 #define USB_WR_ENDPT(base, index, value) (USB_ENDPT_REG(base, index) = (value))
22398 #define USB_RMW_ENDPT(base, index, mask, value) (USB_WR_ENDPT(base, index, (USB_RD_ENDPT(base, index) & ~(mask)) | (value)))
22399 #define USB_SET_ENDPT(base, index, value) (BME_OR8(&USB_ENDPT_REG(base, index), (uint8_t)(value)))
22400 #define USB_CLR_ENDPT(base, index, value) (BME_AND8(&USB_ENDPT_REG(base, index), (uint8_t)(~(value))))
22401 #define USB_TOG_ENDPT(base, index, value) (BME_XOR8(&USB_ENDPT_REG(base, index), (uint8_t)(value)))
22402 /*@}*/
22403 
22404 /*
22405  * Constants & macros for individual USB_ENDPT bitfields
22406  */
22407 
22408 /*!
22409  * @name Register USB_ENDPT, field EPHSHK[0] (RW)
22410  *
22411  * When set this bit enables an endpoint to perform handshaking during a
22412  * transaction to this endpoint. This bit is generally 1 unless the endpoint is
22413  * Isochronous.
22414  */
22415 /*@{*/
22416 /*! @brief Read current value of the USB_ENDPT_EPHSHK field. */
22417 #define USB_RD_ENDPT_EPHSHK(base, index) ((USB_ENDPT_REG(base, index) & USB_ENDPT_EPHSHK_MASK) >> USB_ENDPT_EPHSHK_SHIFT)
22418 #define USB_BRD_ENDPT_EPHSHK(base, index) (BME_UBFX8(&USB_ENDPT_REG(base, index), USB_ENDPT_EPHSHK_SHIFT, USB_ENDPT_EPHSHK_WIDTH))
22419 
22420 /*! @brief Set the EPHSHK field to a new value. */
22421 #define USB_WR_ENDPT_EPHSHK(base, index, value) (USB_RMW_ENDPT(base, index, USB_ENDPT_EPHSHK_MASK, USB_ENDPT_EPHSHK(value)))
22422 #define USB_BWR_ENDPT_EPHSHK(base, index, value) (BME_BFI8(&USB_ENDPT_REG(base, index), ((uint8_t)(value) << USB_ENDPT_EPHSHK_SHIFT), USB_ENDPT_EPHSHK_SHIFT, USB_ENDPT_EPHSHK_WIDTH))
22423 /*@}*/
22424 
22425 /*!
22426  * @name Register USB_ENDPT, field EPSTALL[1] (RW)
22427  *
22428  * When set this bit indicates that the endpoint is called. This bit has
22429  * priority over all other control bits in the EndPoint Enable Register, but it is only
22430  * valid if EPTXEN=1 or EPRXEN=1. Any access to this endpoint causes the USB
22431  * Module to return a STALL handshake. After an endpoint is stalled it requires
22432  * intervention from the Host Controller.
22433  */
22434 /*@{*/
22435 /*! @brief Read current value of the USB_ENDPT_EPSTALL field. */
22436 #define USB_RD_ENDPT_EPSTALL(base, index) ((USB_ENDPT_REG(base, index) & USB_ENDPT_EPSTALL_MASK) >> USB_ENDPT_EPSTALL_SHIFT)
22437 #define USB_BRD_ENDPT_EPSTALL(base, index) (BME_UBFX8(&USB_ENDPT_REG(base, index), USB_ENDPT_EPSTALL_SHIFT, USB_ENDPT_EPSTALL_WIDTH))
22438 
22439 /*! @brief Set the EPSTALL field to a new value. */
22440 #define USB_WR_ENDPT_EPSTALL(base, index, value) (USB_RMW_ENDPT(base, index, USB_ENDPT_EPSTALL_MASK, USB_ENDPT_EPSTALL(value)))
22441 #define USB_BWR_ENDPT_EPSTALL(base, index, value) (BME_BFI8(&USB_ENDPT_REG(base, index), ((uint8_t)(value) << USB_ENDPT_EPSTALL_SHIFT), USB_ENDPT_EPSTALL_SHIFT, USB_ENDPT_EPSTALL_WIDTH))
22442 /*@}*/
22443 
22444 /*!
22445  * @name Register USB_ENDPT, field EPTXEN[2] (RW)
22446  *
22447  * This bit, when set, enables the endpoint for TX transfers.
22448  */
22449 /*@{*/
22450 /*! @brief Read current value of the USB_ENDPT_EPTXEN field. */
22451 #define USB_RD_ENDPT_EPTXEN(base, index) ((USB_ENDPT_REG(base, index) & USB_ENDPT_EPTXEN_MASK) >> USB_ENDPT_EPTXEN_SHIFT)
22452 #define USB_BRD_ENDPT_EPTXEN(base, index) (BME_UBFX8(&USB_ENDPT_REG(base, index), USB_ENDPT_EPTXEN_SHIFT, USB_ENDPT_EPTXEN_WIDTH))
22453 
22454 /*! @brief Set the EPTXEN field to a new value. */
22455 #define USB_WR_ENDPT_EPTXEN(base, index, value) (USB_RMW_ENDPT(base, index, USB_ENDPT_EPTXEN_MASK, USB_ENDPT_EPTXEN(value)))
22456 #define USB_BWR_ENDPT_EPTXEN(base, index, value) (BME_BFI8(&USB_ENDPT_REG(base, index), ((uint8_t)(value) << USB_ENDPT_EPTXEN_SHIFT), USB_ENDPT_EPTXEN_SHIFT, USB_ENDPT_EPTXEN_WIDTH))
22457 /*@}*/
22458 
22459 /*!
22460  * @name Register USB_ENDPT, field EPRXEN[3] (RW)
22461  *
22462  * This bit, when set, enables the endpoint for RX transfers.
22463  */
22464 /*@{*/
22465 /*! @brief Read current value of the USB_ENDPT_EPRXEN field. */
22466 #define USB_RD_ENDPT_EPRXEN(base, index) ((USB_ENDPT_REG(base, index) & USB_ENDPT_EPRXEN_MASK) >> USB_ENDPT_EPRXEN_SHIFT)
22467 #define USB_BRD_ENDPT_EPRXEN(base, index) (BME_UBFX8(&USB_ENDPT_REG(base, index), USB_ENDPT_EPRXEN_SHIFT, USB_ENDPT_EPRXEN_WIDTH))
22468 
22469 /*! @brief Set the EPRXEN field to a new value. */
22470 #define USB_WR_ENDPT_EPRXEN(base, index, value) (USB_RMW_ENDPT(base, index, USB_ENDPT_EPRXEN_MASK, USB_ENDPT_EPRXEN(value)))
22471 #define USB_BWR_ENDPT_EPRXEN(base, index, value) (BME_BFI8(&USB_ENDPT_REG(base, index), ((uint8_t)(value) << USB_ENDPT_EPRXEN_SHIFT), USB_ENDPT_EPRXEN_SHIFT, USB_ENDPT_EPRXEN_WIDTH))
22472 /*@}*/
22473 
22474 /*!
22475  * @name Register USB_ENDPT, field EPCTLDIS[4] (RW)
22476  *
22477  * This bit, when set, disables control (SETUP) transfers. When cleared, control
22478  * transfers are enabled. This applies if and only if the EPRXEN and EPTXEN bits
22479  * are also set.
22480  */
22481 /*@{*/
22482 /*! @brief Read current value of the USB_ENDPT_EPCTLDIS field. */
22483 #define USB_RD_ENDPT_EPCTLDIS(base, index) ((USB_ENDPT_REG(base, index) & USB_ENDPT_EPCTLDIS_MASK) >> USB_ENDPT_EPCTLDIS_SHIFT)
22484 #define USB_BRD_ENDPT_EPCTLDIS(base, index) (BME_UBFX8(&USB_ENDPT_REG(base, index), USB_ENDPT_EPCTLDIS_SHIFT, USB_ENDPT_EPCTLDIS_WIDTH))
22485 
22486 /*! @brief Set the EPCTLDIS field to a new value. */
22487 #define USB_WR_ENDPT_EPCTLDIS(base, index, value) (USB_RMW_ENDPT(base, index, USB_ENDPT_EPCTLDIS_MASK, USB_ENDPT_EPCTLDIS(value)))
22488 #define USB_BWR_ENDPT_EPCTLDIS(base, index, value) (BME_BFI8(&USB_ENDPT_REG(base, index), ((uint8_t)(value) << USB_ENDPT_EPCTLDIS_SHIFT), USB_ENDPT_EPCTLDIS_SHIFT, USB_ENDPT_EPCTLDIS_WIDTH))
22489 /*@}*/
22490 
22491 /*!
22492  * @name Register USB_ENDPT, field RETRYDIS[6] (RW)
22493  *
22494  * This is a Host mode only bit and is present in the control register for
22495  * endpoint 0 (ENDPT0) only. When set this bit causes the host to not retry NAK'ed
22496  * (Negative Acknowledgement) transactions. When a transaction is NAKed, the BDT PID
22497  * field is updated with the NAK PID, and the TOKEN_DNE interrupt is set. When
22498  * this bit is cleared NAKed transactions is retried in hardware. This bit must be
22499  * set when the host is attempting to poll an interrupt endpoint.
22500  */
22501 /*@{*/
22502 /*! @brief Read current value of the USB_ENDPT_RETRYDIS field. */
22503 #define USB_RD_ENDPT_RETRYDIS(base, index) ((USB_ENDPT_REG(base, index) & USB_ENDPT_RETRYDIS_MASK) >> USB_ENDPT_RETRYDIS_SHIFT)
22504 #define USB_BRD_ENDPT_RETRYDIS(base, index) (BME_UBFX8(&USB_ENDPT_REG(base, index), USB_ENDPT_RETRYDIS_SHIFT, USB_ENDPT_RETRYDIS_WIDTH))
22505 
22506 /*! @brief Set the RETRYDIS field to a new value. */
22507 #define USB_WR_ENDPT_RETRYDIS(base, index, value) (USB_RMW_ENDPT(base, index, USB_ENDPT_RETRYDIS_MASK, USB_ENDPT_RETRYDIS(value)))
22508 #define USB_BWR_ENDPT_RETRYDIS(base, index, value) (BME_BFI8(&USB_ENDPT_REG(base, index), ((uint8_t)(value) << USB_ENDPT_RETRYDIS_SHIFT), USB_ENDPT_RETRYDIS_SHIFT, USB_ENDPT_RETRYDIS_WIDTH))
22509 /*@}*/
22510 
22511 /*!
22512  * @name Register USB_ENDPT, field HOSTWOHUB[7] (RW)
22513  *
22514  * This is a Host mode only field and is present in the control register for
22515  * endpoint 0 (ENDPT0) only. When set this bit allows the host to communicate to a
22516  * directly connected low speed device. When cleared, the host produces the
22517  * PRE_PID. It then switches to low-speed signaling when sends a token to a low speed
22518  * device as required to communicate with a low speed device through a hub.
22519  */
22520 /*@{*/
22521 /*! @brief Read current value of the USB_ENDPT_HOSTWOHUB field. */
22522 #define USB_RD_ENDPT_HOSTWOHUB(base, index) ((USB_ENDPT_REG(base, index) & USB_ENDPT_HOSTWOHUB_MASK) >> USB_ENDPT_HOSTWOHUB_SHIFT)
22523 #define USB_BRD_ENDPT_HOSTWOHUB(base, index) (BME_UBFX8(&USB_ENDPT_REG(base, index), USB_ENDPT_HOSTWOHUB_SHIFT, USB_ENDPT_HOSTWOHUB_WIDTH))
22524 
22525 /*! @brief Set the HOSTWOHUB field to a new value. */
22526 #define USB_WR_ENDPT_HOSTWOHUB(base, index, value) (USB_RMW_ENDPT(base, index, USB_ENDPT_HOSTWOHUB_MASK, USB_ENDPT_HOSTWOHUB(value)))
22527 #define USB_BWR_ENDPT_HOSTWOHUB(base, index, value) (BME_BFI8(&USB_ENDPT_REG(base, index), ((uint8_t)(value) << USB_ENDPT_HOSTWOHUB_SHIFT), USB_ENDPT_HOSTWOHUB_SHIFT, USB_ENDPT_HOSTWOHUB_WIDTH))
22528 /*@}*/
22529 
22530 /*******************************************************************************
22531  * USB_USBCTRL - USB Control register
22532  ******************************************************************************/
22533 
22534 /*!
22535  * @brief USB_USBCTRL - USB Control register (RW)
22536  *
22537  * Reset value: 0xC0U
22538  */
22539 /*!
22540  * @name Constants and macros for entire USB_USBCTRL register
22541  */
22542 /*@{*/
22543 #define USB_RD_USBCTRL(base) (USB_USBCTRL_REG(base))
22544 #define USB_WR_USBCTRL(base, value) (USB_USBCTRL_REG(base) = (value))
22545 #define USB_RMW_USBCTRL(base, mask, value) (USB_WR_USBCTRL(base, (USB_RD_USBCTRL(base) & ~(mask)) | (value)))
22546 #define USB_SET_USBCTRL(base, value) (BME_OR8(&USB_USBCTRL_REG(base), (uint8_t)(value)))
22547 #define USB_CLR_USBCTRL(base, value) (BME_AND8(&USB_USBCTRL_REG(base), (uint8_t)(~(value))))
22548 #define USB_TOG_USBCTRL(base, value) (BME_XOR8(&USB_USBCTRL_REG(base), (uint8_t)(value)))
22549 /*@}*/
22550 
22551 /*
22552  * Constants & macros for individual USB_USBCTRL bitfields
22553  */
22554 
22555 /*!
22556  * @name Register USB_USBCTRL, field PDE[6] (RW)
22557  *
22558  * Enables the weak pulldowns on the USB transceiver.
22559  *
22560  * Values:
22561  * - 0b0 - Weak pulldowns are disabled on D+ and D-.
22562  * - 0b1 - Weak pulldowns are enabled on D+ and D-.
22563  */
22564 /*@{*/
22565 /*! @brief Read current value of the USB_USBCTRL_PDE field. */
22566 #define USB_RD_USBCTRL_PDE(base) ((USB_USBCTRL_REG(base) & USB_USBCTRL_PDE_MASK) >> USB_USBCTRL_PDE_SHIFT)
22567 #define USB_BRD_USBCTRL_PDE(base) (BME_UBFX8(&USB_USBCTRL_REG(base), USB_USBCTRL_PDE_SHIFT, USB_USBCTRL_PDE_WIDTH))
22568 
22569 /*! @brief Set the PDE field to a new value. */
22570 #define USB_WR_USBCTRL_PDE(base, value) (USB_RMW_USBCTRL(base, USB_USBCTRL_PDE_MASK, USB_USBCTRL_PDE(value)))
22571 #define USB_BWR_USBCTRL_PDE(base, value) (BME_BFI8(&USB_USBCTRL_REG(base), ((uint8_t)(value) << USB_USBCTRL_PDE_SHIFT), USB_USBCTRL_PDE_SHIFT, USB_USBCTRL_PDE_WIDTH))
22572 /*@}*/
22573 
22574 /*!
22575  * @name Register USB_USBCTRL, field SUSP[7] (RW)
22576  *
22577  * Places the USB transceiver into the suspend state.
22578  *
22579  * Values:
22580  * - 0b0 - USB transceiver is not in suspend state.
22581  * - 0b1 - USB transceiver is in suspend state.
22582  */
22583 /*@{*/
22584 /*! @brief Read current value of the USB_USBCTRL_SUSP field. */
22585 #define USB_RD_USBCTRL_SUSP(base) ((USB_USBCTRL_REG(base) & USB_USBCTRL_SUSP_MASK) >> USB_USBCTRL_SUSP_SHIFT)
22586 #define USB_BRD_USBCTRL_SUSP(base) (BME_UBFX8(&USB_USBCTRL_REG(base), USB_USBCTRL_SUSP_SHIFT, USB_USBCTRL_SUSP_WIDTH))
22587 
22588 /*! @brief Set the SUSP field to a new value. */
22589 #define USB_WR_USBCTRL_SUSP(base, value) (USB_RMW_USBCTRL(base, USB_USBCTRL_SUSP_MASK, USB_USBCTRL_SUSP(value)))
22590 #define USB_BWR_USBCTRL_SUSP(base, value) (BME_BFI8(&USB_USBCTRL_REG(base), ((uint8_t)(value) << USB_USBCTRL_SUSP_SHIFT), USB_USBCTRL_SUSP_SHIFT, USB_USBCTRL_SUSP_WIDTH))
22591 /*@}*/
22592 
22593 /*******************************************************************************
22594  * USB_OBSERVE - USB OTG Observe register
22595  ******************************************************************************/
22596 
22597 /*!
22598  * @brief USB_OBSERVE - USB OTG Observe register (RO)
22599  *
22600  * Reset value: 0x50U
22601  *
22602  * Provides visibility on the state of the pull-ups and pull-downs at the
22603  * transceiver. Useful when interfacing to an external OTG control module via a serial
22604  * interface.
22605  */
22606 /*!
22607  * @name Constants and macros for entire USB_OBSERVE register
22608  */
22609 /*@{*/
22610 #define USB_RD_OBSERVE(base) (USB_OBSERVE_REG(base))
22611 /*@}*/
22612 
22613 /*
22614  * Constants & macros for individual USB_OBSERVE bitfields
22615  */
22616 
22617 /*!
22618  * @name Register USB_OBSERVE, field DMPD[4] (RO)
22619  *
22620  * Provides observability of the D- Pulldown . signal output from the USB OTG
22621  * module
22622  *
22623  * Values:
22624  * - 0b0 - D- pulldown disabled.
22625  * - 0b1 - D- pulldown enabled.
22626  */
22627 /*@{*/
22628 /*! @brief Read current value of the USB_OBSERVE_DMPD field. */
22629 #define USB_RD_OBSERVE_DMPD(base) ((USB_OBSERVE_REG(base) & USB_OBSERVE_DMPD_MASK) >> USB_OBSERVE_DMPD_SHIFT)
22630 #define USB_BRD_OBSERVE_DMPD(base) (BME_UBFX8(&USB_OBSERVE_REG(base), USB_OBSERVE_DMPD_SHIFT, USB_OBSERVE_DMPD_WIDTH))
22631 /*@}*/
22632 
22633 /*!
22634  * @name Register USB_OBSERVE, field DPPD[6] (RO)
22635  *
22636  * Provides observability of the D+ Pulldown . signal output from the USB OTG
22637  * module
22638  *
22639  * Values:
22640  * - 0b0 - D+ pulldown disabled.
22641  * - 0b1 - D+ pulldown enabled.
22642  */
22643 /*@{*/
22644 /*! @brief Read current value of the USB_OBSERVE_DPPD field. */
22645 #define USB_RD_OBSERVE_DPPD(base) ((USB_OBSERVE_REG(base) & USB_OBSERVE_DPPD_MASK) >> USB_OBSERVE_DPPD_SHIFT)
22646 #define USB_BRD_OBSERVE_DPPD(base) (BME_UBFX8(&USB_OBSERVE_REG(base), USB_OBSERVE_DPPD_SHIFT, USB_OBSERVE_DPPD_WIDTH))
22647 /*@}*/
22648 
22649 /*!
22650  * @name Register USB_OBSERVE, field DPPU[7] (RO)
22651  *
22652  * Provides observability of the D+ Pullup . signal output from the USB OTG
22653  * module
22654  *
22655  * Values:
22656  * - 0b0 - D+ pullup disabled.
22657  * - 0b1 - D+ pullup enabled.
22658  */
22659 /*@{*/
22660 /*! @brief Read current value of the USB_OBSERVE_DPPU field. */
22661 #define USB_RD_OBSERVE_DPPU(base) ((USB_OBSERVE_REG(base) & USB_OBSERVE_DPPU_MASK) >> USB_OBSERVE_DPPU_SHIFT)
22662 #define USB_BRD_OBSERVE_DPPU(base) (BME_UBFX8(&USB_OBSERVE_REG(base), USB_OBSERVE_DPPU_SHIFT, USB_OBSERVE_DPPU_WIDTH))
22663 /*@}*/
22664 
22665 /*******************************************************************************
22666  * USB_CONTROL - USB OTG Control register
22667  ******************************************************************************/
22668 
22669 /*!
22670  * @brief USB_CONTROL - USB OTG Control register (RW)
22671  *
22672  * Reset value: 0x00U
22673  */
22674 /*!
22675  * @name Constants and macros for entire USB_CONTROL register
22676  */
22677 /*@{*/
22678 #define USB_RD_CONTROL(base) (USB_CONTROL_REG(base))
22679 #define USB_WR_CONTROL(base, value) (USB_CONTROL_REG(base) = (value))
22680 #define USB_RMW_CONTROL(base, mask, value) (USB_WR_CONTROL(base, (USB_RD_CONTROL(base) & ~(mask)) | (value)))
22681 #define USB_SET_CONTROL(base, value) (BME_OR8(&USB_CONTROL_REG(base), (uint8_t)(value)))
22682 #define USB_CLR_CONTROL(base, value) (BME_AND8(&USB_CONTROL_REG(base), (uint8_t)(~(value))))
22683 #define USB_TOG_CONTROL(base, value) (BME_XOR8(&USB_CONTROL_REG(base), (uint8_t)(value)))
22684 /*@}*/
22685 
22686 /*
22687  * Constants & macros for individual USB_CONTROL bitfields
22688  */
22689 
22690 /*!
22691  * @name Register USB_CONTROL, field DPPULLUPNONOTG[4] (RW)
22692  *
22693  * Provides control of the DP Pullup in the USB OTG module, if USB is configured
22694  * in non-OTG device mode.
22695  *
22696  * Values:
22697  * - 0b0 - DP Pullup in non-OTG device mode is not enabled.
22698  * - 0b1 - DP Pullup in non-OTG device mode is enabled.
22699  */
22700 /*@{*/
22701 /*! @brief Read current value of the USB_CONTROL_DPPULLUPNONOTG field. */
22702 #define USB_RD_CONTROL_DPPULLUPNONOTG(base) ((USB_CONTROL_REG(base) & USB_CONTROL_DPPULLUPNONOTG_MASK) >> USB_CONTROL_DPPULLUPNONOTG_SHIFT)
22703 #define USB_BRD_CONTROL_DPPULLUPNONOTG(base) (BME_UBFX8(&USB_CONTROL_REG(base), USB_CONTROL_DPPULLUPNONOTG_SHIFT, USB_CONTROL_DPPULLUPNONOTG_WIDTH))
22704 
22705 /*! @brief Set the DPPULLUPNONOTG field to a new value. */
22706 #define USB_WR_CONTROL_DPPULLUPNONOTG(base, value) (USB_RMW_CONTROL(base, USB_CONTROL_DPPULLUPNONOTG_MASK, USB_CONTROL_DPPULLUPNONOTG(value)))
22707 #define USB_BWR_CONTROL_DPPULLUPNONOTG(base, value) (BME_BFI8(&USB_CONTROL_REG(base), ((uint8_t)(value) << USB_CONTROL_DPPULLUPNONOTG_SHIFT), USB_CONTROL_DPPULLUPNONOTG_SHIFT, USB_CONTROL_DPPULLUPNONOTG_WIDTH))
22708 /*@}*/
22709 
22710 /*******************************************************************************
22711  * USB_USBTRC0 - USB Transceiver Control Register 0
22712  ******************************************************************************/
22713 
22714 /*!
22715  * @brief USB_USBTRC0 - USB Transceiver Control Register 0 (RW)
22716  *
22717  * Reset value: 0x00U
22718  */
22719 /*!
22720  * @name Constants and macros for entire USB_USBTRC0 register
22721  */
22722 /*@{*/
22723 #define USB_RD_USBTRC0(base) (USB_USBTRC0_REG(base))
22724 #define USB_WR_USBTRC0(base, value) (USB_USBTRC0_REG(base) = (value))
22725 #define USB_RMW_USBTRC0(base, mask, value) (USB_WR_USBTRC0(base, (USB_RD_USBTRC0(base) & ~(mask)) | (value)))
22726 #define USB_SET_USBTRC0(base, value) (BME_OR8(&USB_USBTRC0_REG(base), (uint8_t)(value)))
22727 #define USB_CLR_USBTRC0(base, value) (BME_AND8(&USB_USBTRC0_REG(base), (uint8_t)(~(value))))
22728 #define USB_TOG_USBTRC0(base, value) (BME_XOR8(&USB_USBTRC0_REG(base), (uint8_t)(value)))
22729 /*@}*/
22730 
22731 /*
22732  * Constants & macros for individual USB_USBTRC0 bitfields
22733  */
22734 
22735 /*!
22736  * @name Register USB_USBTRC0, field USB_RESUME_INT[0] (RO)
22737  *
22738  * Values:
22739  * - 0b0 - No interrupt was generated.
22740  * - 0b1 - Interrupt was generated because of the USB asynchronous interrupt.
22741  */
22742 /*@{*/
22743 /*! @brief Read current value of the USB_USBTRC0_USB_RESUME_INT field. */
22744 #define USB_RD_USBTRC0_USB_RESUME_INT(base) ((USB_USBTRC0_REG(base) & USB_USBTRC0_USB_RESUME_INT_MASK) >> USB_USBTRC0_USB_RESUME_INT_SHIFT)
22745 #define USB_BRD_USBTRC0_USB_RESUME_INT(base) (BME_UBFX8(&USB_USBTRC0_REG(base), USB_USBTRC0_USB_RESUME_INT_SHIFT, USB_USBTRC0_USB_RESUME_INT_WIDTH))
22746 /*@}*/
22747 
22748 /*!
22749  * @name Register USB_USBTRC0, field SYNC_DET[1] (RO)
22750  *
22751  * Values:
22752  * - 0b0 - Synchronous interrupt has not been detected.
22753  * - 0b1 - Synchronous interrupt has been detected.
22754  */
22755 /*@{*/
22756 /*! @brief Read current value of the USB_USBTRC0_SYNC_DET field. */
22757 #define USB_RD_USBTRC0_SYNC_DET(base) ((USB_USBTRC0_REG(base) & USB_USBTRC0_SYNC_DET_MASK) >> USB_USBTRC0_SYNC_DET_SHIFT)
22758 #define USB_BRD_USBTRC0_SYNC_DET(base) (BME_UBFX8(&USB_USBTRC0_REG(base), USB_USBTRC0_SYNC_DET_SHIFT, USB_USBTRC0_SYNC_DET_WIDTH))
22759 /*@}*/
22760 
22761 /*!
22762  * @name Register USB_USBTRC0, field USBRESMEN[5] (RW)
22763  *
22764  * This bit, when set, allows the USB module to send an asynchronous wakeup
22765  * event to the MCU upon detection of resume signaling on the USB bus. The MCU then
22766  * re-enables clocks to the USB module. It is used for low-power suspend mode when
22767  * USB module clocks are stopped or the USB transceiver is in Suspend mode.
22768  * Async wakeup only works in device mode.
22769  *
22770  * Values:
22771  * - 0b0 - USB asynchronous wakeup from suspend mode disabled.
22772  * - 0b1 - USB asynchronous wakeup from suspend mode enabled. The asynchronous
22773  * resume interrupt differs from the synchronous resume interrupt in that it
22774  * asynchronously detects K-state using the unfiltered state of the D+ and D-
22775  * pins. This interupt should only be enabled when the Transceiver is
22776  * suspended.
22777  */
22778 /*@{*/
22779 /*! @brief Read current value of the USB_USBTRC0_USBRESMEN field. */
22780 #define USB_RD_USBTRC0_USBRESMEN(base) ((USB_USBTRC0_REG(base) & USB_USBTRC0_USBRESMEN_MASK) >> USB_USBTRC0_USBRESMEN_SHIFT)
22781 #define USB_BRD_USBTRC0_USBRESMEN(base) (BME_UBFX8(&USB_USBTRC0_REG(base), USB_USBTRC0_USBRESMEN_SHIFT, USB_USBTRC0_USBRESMEN_WIDTH))
22782 
22783 /*! @brief Set the USBRESMEN field to a new value. */
22784 #define USB_WR_USBTRC0_USBRESMEN(base, value) (USB_RMW_USBTRC0(base, USB_USBTRC0_USBRESMEN_MASK, USB_USBTRC0_USBRESMEN(value)))
22785 #define USB_BWR_USBTRC0_USBRESMEN(base, value) (BME_BFI8(&USB_USBTRC0_REG(base), ((uint8_t)(value) << USB_USBTRC0_USBRESMEN_SHIFT), USB_USBTRC0_USBRESMEN_SHIFT, USB_USBTRC0_USBRESMEN_WIDTH))
22786 /*@}*/
22787 
22788 /*!
22789  * @name Register USB_USBTRC0, field USBRESET[7] (WO)
22790  *
22791  * Generates a hard reset to the USB_OTG module. After this bit is set and the
22792  * reset occurs, this bit is automatically cleared. This bit is always read as
22793  * zero. Wait two USB clock cycles after setting this bit.
22794  *
22795  * Values:
22796  * - 0b0 - Normal USB module operation.
22797  * - 0b1 - Returns the USB module to its reset state.
22798  */
22799 /*@{*/
22800 /*! @brief Set the USBRESET field to a new value. */
22801 #define USB_WR_USBTRC0_USBRESET(base, value) (USB_RMW_USBTRC0(base, USB_USBTRC0_USBRESET_MASK, USB_USBTRC0_USBRESET(value)))
22802 #define USB_BWR_USBTRC0_USBRESET(base, value) (USB_WR_USBTRC0_USBRESET(base, value))
22803 /*@}*/
22804 
22805 /*******************************************************************************
22806  * USB_USBFRMADJUST - Frame Adjust Register
22807  ******************************************************************************/
22808 
22809 /*!
22810  * @brief USB_USBFRMADJUST - Frame Adjust Register (RW)
22811  *
22812  * Reset value: 0x00U
22813  */
22814 /*!
22815  * @name Constants and macros for entire USB_USBFRMADJUST register
22816  */
22817 /*@{*/
22818 #define USB_RD_USBFRMADJUST(base) (USB_USBFRMADJUST_REG(base))
22819 #define USB_WR_USBFRMADJUST(base, value) (USB_USBFRMADJUST_REG(base) = (value))
22820 #define USB_RMW_USBFRMADJUST(base, mask, value) (USB_WR_USBFRMADJUST(base, (USB_RD_USBFRMADJUST(base) & ~(mask)) | (value)))
22821 #define USB_SET_USBFRMADJUST(base, value) (BME_OR8(&USB_USBFRMADJUST_REG(base), (uint8_t)(value)))
22822 #define USB_CLR_USBFRMADJUST(base, value) (BME_AND8(&USB_USBFRMADJUST_REG(base), (uint8_t)(~(value))))
22823 #define USB_TOG_USBFRMADJUST(base, value) (BME_XOR8(&USB_USBFRMADJUST_REG(base), (uint8_t)(value)))
22824 /*@}*/
22825 
22826 /* Instance numbers for core modules */
22827 #define JTAG_IDX (0) /*!< Instance number for JTAG. */
22828 #define TPIU_IDX (0) /*!< Instance number for TPIU. */
22829 #define SCB_IDX (0) /*!< Instance number for SCB. */
22830 #define SWD_IDX (0) /*!< Instance number for SWD. */
22831 #define CoreDebug_IDX (0) /*!< Instance number for CoreDebug. */
22832 
22833 #if defined(__IAR_SYSTEMS_ICC__)
22834  /* Restore checking of "Error[Pm008]: sections of code should not be 'commented out' (MISRA C 2004 rule 2.4)" */
22835  #pragma diag_default=pm008
22836 #endif
22837 
22838 #endif /* __MKL25Z4_EXTENSION_H__ */
22839 /* EOF */
CMSIS Peripheral Access Layer for MKL25Z4.