]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/device/MK64F12/MK64F12_cmt.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / hal / TARGET_Freescale / TARGET_KPSDK_MCUS / TARGET_MCU_K64F / device / device / MK64F12 / MK64F12_cmt.h
1 /*
2 ** ###################################################################
3 **     Compilers:           Keil ARM C/C++ Compiler
4 **                          Freescale C/C++ for Embedded ARM
5 **                          GNU C Compiler
6 **                          IAR ANSI C/C++ Compiler for ARM
7 **
8 **     Reference manual:    K64P144M120SF5RM, Rev.2, January 2014
9 **     Version:             rev. 2.5, 2014-02-10
10 **     Build:               b140604
11 **
12 **     Abstract:
13 **         Extension to the CMSIS register access layer header.
14 **
15 **     Copyright (c) 2014 Freescale Semiconductor, Inc.
16 **     All rights reserved.
17 **
18 **     Redistribution and use in source and binary forms, with or without modification,
19 **     are permitted provided that the following conditions are met:
20 **
21 **     o Redistributions of source code must retain the above copyright notice, this list
22 **       of conditions and the following disclaimer.
23 **
24 **     o Redistributions in binary form must reproduce the above copyright notice, this
25 **       list of conditions and the following disclaimer in the documentation and/or
26 **       other materials provided with the distribution.
27 **
28 **     o Neither the name of Freescale Semiconductor, Inc. nor the names of its
29 **       contributors may be used to endorse or promote products derived from this
30 **       software without specific prior written permission.
31 **
32 **     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33 **     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 **     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 **     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
36 **     ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37 **     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38 **     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
39 **     ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 **     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 **     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 **
43 **     http:                 www.freescale.com
44 **     mail:                 support@freescale.com
45 **
46 **     Revisions:
47 **     - rev. 1.0 (2013-08-12)
48 **         Initial version.
49 **     - rev. 2.0 (2013-10-29)
50 **         Register accessor macros added to the memory map.
51 **         Symbols for Processor Expert memory map compatibility added to the memory map.
52 **         Startup file for gcc has been updated according to CMSIS 3.2.
53 **         System initialization updated.
54 **         MCG - registers updated.
55 **         PORTA, PORTB, PORTC, PORTE - registers for digital filter removed.
56 **     - rev. 2.1 (2013-10-30)
57 **         Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled.
58 **     - rev. 2.2 (2013-12-09)
59 **         DMA - EARS register removed.
60 **         AIPS0, AIPS1 - MPRA register updated.
61 **     - rev. 2.3 (2014-01-24)
62 **         Update according to reference manual rev. 2
63 **         ENET, MCG, MCM, SIM, USB - registers updated
64 **     - rev. 2.4 (2014-02-10)
65 **         The declaration of clock configurations has been moved to separate header file system_MK64F12.h
66 **         Update of SystemInit() and SystemCoreClockUpdate() functions.
67 **     - rev. 2.5 (2014-02-10)
68 **         The declaration of clock configurations has been moved to separate header file system_MK64F12.h
69 **         Update of SystemInit() and SystemCoreClockUpdate() functions.
70 **         Module access macro module_BASES replaced by module_BASE_PTRS.
71 **
72 ** ###################################################################
73 */
74
75 /*
76  * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
77  *
78  * This file was generated automatically and any changes may be lost.
79  */
80 #ifndef __HW_CMT_REGISTERS_H__
81 #define __HW_CMT_REGISTERS_H__
82
83 #include "MK64F12.h"
84 #include "fsl_bitaccess.h"
85
86 /*
87  * MK64F12 CMT
88  *
89  * Carrier Modulator Transmitter
90  *
91  * Registers defined in this header file:
92  * - HW_CMT_CGH1 - CMT Carrier Generator High Data Register 1
93  * - HW_CMT_CGL1 - CMT Carrier Generator Low Data Register 1
94  * - HW_CMT_CGH2 - CMT Carrier Generator High Data Register 2
95  * - HW_CMT_CGL2 - CMT Carrier Generator Low Data Register 2
96  * - HW_CMT_OC - CMT Output Control Register
97  * - HW_CMT_MSC - CMT Modulator Status and Control Register
98  * - HW_CMT_CMD1 - CMT Modulator Data Register Mark High
99  * - HW_CMT_CMD2 - CMT Modulator Data Register Mark Low
100  * - HW_CMT_CMD3 - CMT Modulator Data Register Space High
101  * - HW_CMT_CMD4 - CMT Modulator Data Register Space Low
102  * - HW_CMT_PPS - CMT Primary Prescaler Register
103  * - HW_CMT_DMA - CMT Direct Memory Access Register
104  *
105  * - hw_cmt_t - Struct containing all module registers.
106  */
107
108 #define HW_CMT_INSTANCE_COUNT (1U) /*!< Number of instances of the CMT module. */
109
110 /*******************************************************************************
111  * HW_CMT_CGH1 - CMT Carrier Generator High Data Register 1
112  ******************************************************************************/
113
114 /*!
115  * @brief HW_CMT_CGH1 - CMT Carrier Generator High Data Register 1 (RW)
116  *
117  * Reset value: 0x00U
118  *
119  * This data register contains the primary high value for generating the carrier
120  * output.
121  */
122 typedef union _hw_cmt_cgh1
123 {
124     uint8_t U;
125     struct _hw_cmt_cgh1_bitfields
126     {
127         uint8_t PH : 8;                /*!< [7:0] Primary Carrier High Time Data Value */
128     } B;
129 } hw_cmt_cgh1_t;
130
131 /*!
132  * @name Constants and macros for entire CMT_CGH1 register
133  */
134 /*@{*/
135 #define HW_CMT_CGH1_ADDR(x)      ((x) + 0x0U)
136
137 #define HW_CMT_CGH1(x)           (*(__IO hw_cmt_cgh1_t *) HW_CMT_CGH1_ADDR(x))
138 #define HW_CMT_CGH1_RD(x)        (HW_CMT_CGH1(x).U)
139 #define HW_CMT_CGH1_WR(x, v)     (HW_CMT_CGH1(x).U = (v))
140 #define HW_CMT_CGH1_SET(x, v)    (HW_CMT_CGH1_WR(x, HW_CMT_CGH1_RD(x) |  (v)))
141 #define HW_CMT_CGH1_CLR(x, v)    (HW_CMT_CGH1_WR(x, HW_CMT_CGH1_RD(x) & ~(v)))
142 #define HW_CMT_CGH1_TOG(x, v)    (HW_CMT_CGH1_WR(x, HW_CMT_CGH1_RD(x) ^  (v)))
143 /*@}*/
144
145 /*
146  * Constants & macros for individual CMT_CGH1 bitfields
147  */
148
149 /*!
150  * @name Register CMT_CGH1, field PH[7:0] (RW)
151  *
152  * Contains the number of input clocks required to generate the carrier high
153  * time period. When operating in Time mode, this register is always selected. When
154  * operating in FSK mode, this register and the secondary register pair are
155  * alternately selected under the control of the modulator. The primary carrier high
156  * time value is undefined out of reset. This register must be written to nonzero
157  * values before the carrier generator is enabled to avoid spurious results.
158  */
159 /*@{*/
160 #define BP_CMT_CGH1_PH       (0U)          /*!< Bit position for CMT_CGH1_PH. */
161 #define BM_CMT_CGH1_PH       (0xFFU)       /*!< Bit mask for CMT_CGH1_PH. */
162 #define BS_CMT_CGH1_PH       (8U)          /*!< Bit field size in bits for CMT_CGH1_PH. */
163
164 /*! @brief Read current value of the CMT_CGH1_PH field. */
165 #define BR_CMT_CGH1_PH(x)    (HW_CMT_CGH1(x).U)
166
167 /*! @brief Format value for bitfield CMT_CGH1_PH. */
168 #define BF_CMT_CGH1_PH(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_CGH1_PH) & BM_CMT_CGH1_PH)
169
170 /*! @brief Set the PH field to a new value. */
171 #define BW_CMT_CGH1_PH(x, v) (HW_CMT_CGH1_WR(x, v))
172 /*@}*/
173
174 /*******************************************************************************
175  * HW_CMT_CGL1 - CMT Carrier Generator Low Data Register 1
176  ******************************************************************************/
177
178 /*!
179  * @brief HW_CMT_CGL1 - CMT Carrier Generator Low Data Register 1 (RW)
180  *
181  * Reset value: 0x00U
182  *
183  * This data register contains the primary low value for generating the carrier
184  * output.
185  */
186 typedef union _hw_cmt_cgl1
187 {
188     uint8_t U;
189     struct _hw_cmt_cgl1_bitfields
190     {
191         uint8_t PL : 8;                /*!< [7:0] Primary Carrier Low Time Data Value */
192     } B;
193 } hw_cmt_cgl1_t;
194
195 /*!
196  * @name Constants and macros for entire CMT_CGL1 register
197  */
198 /*@{*/
199 #define HW_CMT_CGL1_ADDR(x)      ((x) + 0x1U)
200
201 #define HW_CMT_CGL1(x)           (*(__IO hw_cmt_cgl1_t *) HW_CMT_CGL1_ADDR(x))
202 #define HW_CMT_CGL1_RD(x)        (HW_CMT_CGL1(x).U)
203 #define HW_CMT_CGL1_WR(x, v)     (HW_CMT_CGL1(x).U = (v))
204 #define HW_CMT_CGL1_SET(x, v)    (HW_CMT_CGL1_WR(x, HW_CMT_CGL1_RD(x) |  (v)))
205 #define HW_CMT_CGL1_CLR(x, v)    (HW_CMT_CGL1_WR(x, HW_CMT_CGL1_RD(x) & ~(v)))
206 #define HW_CMT_CGL1_TOG(x, v)    (HW_CMT_CGL1_WR(x, HW_CMT_CGL1_RD(x) ^  (v)))
207 /*@}*/
208
209 /*
210  * Constants & macros for individual CMT_CGL1 bitfields
211  */
212
213 /*!
214  * @name Register CMT_CGL1, field PL[7:0] (RW)
215  *
216  * Contains the number of input clocks required to generate the carrier low time
217  * period. When operating in Time mode, this register is always selected. When
218  * operating in FSK mode, this register and the secondary register pair are
219  * alternately selected under the control of the modulator. The primary carrier low
220  * time value is undefined out of reset. This register must be written to nonzero
221  * values before the carrier generator is enabled to avoid spurious results.
222  */
223 /*@{*/
224 #define BP_CMT_CGL1_PL       (0U)          /*!< Bit position for CMT_CGL1_PL. */
225 #define BM_CMT_CGL1_PL       (0xFFU)       /*!< Bit mask for CMT_CGL1_PL. */
226 #define BS_CMT_CGL1_PL       (8U)          /*!< Bit field size in bits for CMT_CGL1_PL. */
227
228 /*! @brief Read current value of the CMT_CGL1_PL field. */
229 #define BR_CMT_CGL1_PL(x)    (HW_CMT_CGL1(x).U)
230
231 /*! @brief Format value for bitfield CMT_CGL1_PL. */
232 #define BF_CMT_CGL1_PL(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_CGL1_PL) & BM_CMT_CGL1_PL)
233
234 /*! @brief Set the PL field to a new value. */
235 #define BW_CMT_CGL1_PL(x, v) (HW_CMT_CGL1_WR(x, v))
236 /*@}*/
237
238 /*******************************************************************************
239  * HW_CMT_CGH2 - CMT Carrier Generator High Data Register 2
240  ******************************************************************************/
241
242 /*!
243  * @brief HW_CMT_CGH2 - CMT Carrier Generator High Data Register 2 (RW)
244  *
245  * Reset value: 0x00U
246  *
247  * This data register contains the secondary high value for generating the
248  * carrier output.
249  */
250 typedef union _hw_cmt_cgh2
251 {
252     uint8_t U;
253     struct _hw_cmt_cgh2_bitfields
254     {
255         uint8_t SH : 8;                /*!< [7:0] Secondary Carrier High Time Data Value */
256     } B;
257 } hw_cmt_cgh2_t;
258
259 /*!
260  * @name Constants and macros for entire CMT_CGH2 register
261  */
262 /*@{*/
263 #define HW_CMT_CGH2_ADDR(x)      ((x) + 0x2U)
264
265 #define HW_CMT_CGH2(x)           (*(__IO hw_cmt_cgh2_t *) HW_CMT_CGH2_ADDR(x))
266 #define HW_CMT_CGH2_RD(x)        (HW_CMT_CGH2(x).U)
267 #define HW_CMT_CGH2_WR(x, v)     (HW_CMT_CGH2(x).U = (v))
268 #define HW_CMT_CGH2_SET(x, v)    (HW_CMT_CGH2_WR(x, HW_CMT_CGH2_RD(x) |  (v)))
269 #define HW_CMT_CGH2_CLR(x, v)    (HW_CMT_CGH2_WR(x, HW_CMT_CGH2_RD(x) & ~(v)))
270 #define HW_CMT_CGH2_TOG(x, v)    (HW_CMT_CGH2_WR(x, HW_CMT_CGH2_RD(x) ^  (v)))
271 /*@}*/
272
273 /*
274  * Constants & macros for individual CMT_CGH2 bitfields
275  */
276
277 /*!
278  * @name Register CMT_CGH2, field SH[7:0] (RW)
279  *
280  * Contains the number of input clocks required to generate the carrier high
281  * time period. When operating in Time mode, this register is never selected. When
282  * operating in FSK mode, this register and the primary register pair are
283  * alternately selected under control of the modulator. The secondary carrier high time
284  * value is undefined out of reset. This register must be written to nonzero
285  * values before the carrier generator is enabled when operating in FSK mode.
286  */
287 /*@{*/
288 #define BP_CMT_CGH2_SH       (0U)          /*!< Bit position for CMT_CGH2_SH. */
289 #define BM_CMT_CGH2_SH       (0xFFU)       /*!< Bit mask for CMT_CGH2_SH. */
290 #define BS_CMT_CGH2_SH       (8U)          /*!< Bit field size in bits for CMT_CGH2_SH. */
291
292 /*! @brief Read current value of the CMT_CGH2_SH field. */
293 #define BR_CMT_CGH2_SH(x)    (HW_CMT_CGH2(x).U)
294
295 /*! @brief Format value for bitfield CMT_CGH2_SH. */
296 #define BF_CMT_CGH2_SH(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_CGH2_SH) & BM_CMT_CGH2_SH)
297
298 /*! @brief Set the SH field to a new value. */
299 #define BW_CMT_CGH2_SH(x, v) (HW_CMT_CGH2_WR(x, v))
300 /*@}*/
301
302 /*******************************************************************************
303  * HW_CMT_CGL2 - CMT Carrier Generator Low Data Register 2
304  ******************************************************************************/
305
306 /*!
307  * @brief HW_CMT_CGL2 - CMT Carrier Generator Low Data Register 2 (RW)
308  *
309  * Reset value: 0x00U
310  *
311  * This data register contains the secondary low value for generating the
312  * carrier output.
313  */
314 typedef union _hw_cmt_cgl2
315 {
316     uint8_t U;
317     struct _hw_cmt_cgl2_bitfields
318     {
319         uint8_t SL : 8;                /*!< [7:0] Secondary Carrier Low Time Data Value */
320     } B;
321 } hw_cmt_cgl2_t;
322
323 /*!
324  * @name Constants and macros for entire CMT_CGL2 register
325  */
326 /*@{*/
327 #define HW_CMT_CGL2_ADDR(x)      ((x) + 0x3U)
328
329 #define HW_CMT_CGL2(x)           (*(__IO hw_cmt_cgl2_t *) HW_CMT_CGL2_ADDR(x))
330 #define HW_CMT_CGL2_RD(x)        (HW_CMT_CGL2(x).U)
331 #define HW_CMT_CGL2_WR(x, v)     (HW_CMT_CGL2(x).U = (v))
332 #define HW_CMT_CGL2_SET(x, v)    (HW_CMT_CGL2_WR(x, HW_CMT_CGL2_RD(x) |  (v)))
333 #define HW_CMT_CGL2_CLR(x, v)    (HW_CMT_CGL2_WR(x, HW_CMT_CGL2_RD(x) & ~(v)))
334 #define HW_CMT_CGL2_TOG(x, v)    (HW_CMT_CGL2_WR(x, HW_CMT_CGL2_RD(x) ^  (v)))
335 /*@}*/
336
337 /*
338  * Constants & macros for individual CMT_CGL2 bitfields
339  */
340
341 /*!
342  * @name Register CMT_CGL2, field SL[7:0] (RW)
343  *
344  * Contains the number of input clocks required to generate the carrier low time
345  * period. When operating in Time mode, this register is never selected. When
346  * operating in FSK mode, this register and the primary register pair are
347  * alternately selected under the control of the modulator. The secondary carrier low time
348  * value is undefined out of reset. This register must be written to nonzero
349  * values before the carrier generator is enabled when operating in FSK mode.
350  */
351 /*@{*/
352 #define BP_CMT_CGL2_SL       (0U)          /*!< Bit position for CMT_CGL2_SL. */
353 #define BM_CMT_CGL2_SL       (0xFFU)       /*!< Bit mask for CMT_CGL2_SL. */
354 #define BS_CMT_CGL2_SL       (8U)          /*!< Bit field size in bits for CMT_CGL2_SL. */
355
356 /*! @brief Read current value of the CMT_CGL2_SL field. */
357 #define BR_CMT_CGL2_SL(x)    (HW_CMT_CGL2(x).U)
358
359 /*! @brief Format value for bitfield CMT_CGL2_SL. */
360 #define BF_CMT_CGL2_SL(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_CGL2_SL) & BM_CMT_CGL2_SL)
361
362 /*! @brief Set the SL field to a new value. */
363 #define BW_CMT_CGL2_SL(x, v) (HW_CMT_CGL2_WR(x, v))
364 /*@}*/
365
366 /*******************************************************************************
367  * HW_CMT_OC - CMT Output Control Register
368  ******************************************************************************/
369
370 /*!
371  * @brief HW_CMT_OC - CMT Output Control Register (RW)
372  *
373  * Reset value: 0x00U
374  *
375  * This register is used to control the IRO signal of the CMT module.
376  */
377 typedef union _hw_cmt_oc
378 {
379     uint8_t U;
380     struct _hw_cmt_oc_bitfields
381     {
382         uint8_t RESERVED0 : 5;         /*!< [4:0]  */
383         uint8_t IROPEN : 1;            /*!< [5] IRO Pin Enable */
384         uint8_t CMTPOL : 1;            /*!< [6] CMT Output Polarity */
385         uint8_t IROL : 1;              /*!< [7] IRO Latch Control */
386     } B;
387 } hw_cmt_oc_t;
388
389 /*!
390  * @name Constants and macros for entire CMT_OC register
391  */
392 /*@{*/
393 #define HW_CMT_OC_ADDR(x)        ((x) + 0x4U)
394
395 #define HW_CMT_OC(x)             (*(__IO hw_cmt_oc_t *) HW_CMT_OC_ADDR(x))
396 #define HW_CMT_OC_RD(x)          (HW_CMT_OC(x).U)
397 #define HW_CMT_OC_WR(x, v)       (HW_CMT_OC(x).U = (v))
398 #define HW_CMT_OC_SET(x, v)      (HW_CMT_OC_WR(x, HW_CMT_OC_RD(x) |  (v)))
399 #define HW_CMT_OC_CLR(x, v)      (HW_CMT_OC_WR(x, HW_CMT_OC_RD(x) & ~(v)))
400 #define HW_CMT_OC_TOG(x, v)      (HW_CMT_OC_WR(x, HW_CMT_OC_RD(x) ^  (v)))
401 /*@}*/
402
403 /*
404  * Constants & macros for individual CMT_OC bitfields
405  */
406
407 /*!
408  * @name Register CMT_OC, field IROPEN[5] (RW)
409  *
410  * Enables and disables the IRO signal. When the IRO signal is enabled, it is an
411  * output that drives out either the CMT transmitter output or the state of IROL
412  * depending on whether MSC[MCGEN] is set or not. Also, the state of output is
413  * either inverted or non-inverted, depending on the state of CMTPOL. When the IRO
414  * signal is disabled, it is in a high-impedance state and is unable to draw any
415  * current. This signal is disabled during reset.
416  *
417  * Values:
418  * - 0 - The IRO signal is disabled.
419  * - 1 - The IRO signal is enabled as output.
420  */
421 /*@{*/
422 #define BP_CMT_OC_IROPEN     (5U)          /*!< Bit position for CMT_OC_IROPEN. */
423 #define BM_CMT_OC_IROPEN     (0x20U)       /*!< Bit mask for CMT_OC_IROPEN. */
424 #define BS_CMT_OC_IROPEN     (1U)          /*!< Bit field size in bits for CMT_OC_IROPEN. */
425
426 /*! @brief Read current value of the CMT_OC_IROPEN field. */
427 #define BR_CMT_OC_IROPEN(x)  (BITBAND_ACCESS8(HW_CMT_OC_ADDR(x), BP_CMT_OC_IROPEN))
428
429 /*! @brief Format value for bitfield CMT_OC_IROPEN. */
430 #define BF_CMT_OC_IROPEN(v)  ((uint8_t)((uint8_t)(v) << BP_CMT_OC_IROPEN) & BM_CMT_OC_IROPEN)
431
432 /*! @brief Set the IROPEN field to a new value. */
433 #define BW_CMT_OC_IROPEN(x, v) (BITBAND_ACCESS8(HW_CMT_OC_ADDR(x), BP_CMT_OC_IROPEN) = (v))
434 /*@}*/
435
436 /*!
437  * @name Register CMT_OC, field CMTPOL[6] (RW)
438  *
439  * Controls the polarity of the IRO signal.
440  *
441  * Values:
442  * - 0 - The IRO signal is active-low.
443  * - 1 - The IRO signal is active-high.
444  */
445 /*@{*/
446 #define BP_CMT_OC_CMTPOL     (6U)          /*!< Bit position for CMT_OC_CMTPOL. */
447 #define BM_CMT_OC_CMTPOL     (0x40U)       /*!< Bit mask for CMT_OC_CMTPOL. */
448 #define BS_CMT_OC_CMTPOL     (1U)          /*!< Bit field size in bits for CMT_OC_CMTPOL. */
449
450 /*! @brief Read current value of the CMT_OC_CMTPOL field. */
451 #define BR_CMT_OC_CMTPOL(x)  (BITBAND_ACCESS8(HW_CMT_OC_ADDR(x), BP_CMT_OC_CMTPOL))
452
453 /*! @brief Format value for bitfield CMT_OC_CMTPOL. */
454 #define BF_CMT_OC_CMTPOL(v)  ((uint8_t)((uint8_t)(v) << BP_CMT_OC_CMTPOL) & BM_CMT_OC_CMTPOL)
455
456 /*! @brief Set the CMTPOL field to a new value. */
457 #define BW_CMT_OC_CMTPOL(x, v) (BITBAND_ACCESS8(HW_CMT_OC_ADDR(x), BP_CMT_OC_CMTPOL) = (v))
458 /*@}*/
459
460 /*!
461  * @name Register CMT_OC, field IROL[7] (RW)
462  *
463  * Reads the state of the IRO latch. Writing to IROL changes the state of the
464  * IRO signal when MSC[MCGEN] is cleared and IROPEN is set.
465  */
466 /*@{*/
467 #define BP_CMT_OC_IROL       (7U)          /*!< Bit position for CMT_OC_IROL. */
468 #define BM_CMT_OC_IROL       (0x80U)       /*!< Bit mask for CMT_OC_IROL. */
469 #define BS_CMT_OC_IROL       (1U)          /*!< Bit field size in bits for CMT_OC_IROL. */
470
471 /*! @brief Read current value of the CMT_OC_IROL field. */
472 #define BR_CMT_OC_IROL(x)    (BITBAND_ACCESS8(HW_CMT_OC_ADDR(x), BP_CMT_OC_IROL))
473
474 /*! @brief Format value for bitfield CMT_OC_IROL. */
475 #define BF_CMT_OC_IROL(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_OC_IROL) & BM_CMT_OC_IROL)
476
477 /*! @brief Set the IROL field to a new value. */
478 #define BW_CMT_OC_IROL(x, v) (BITBAND_ACCESS8(HW_CMT_OC_ADDR(x), BP_CMT_OC_IROL) = (v))
479 /*@}*/
480
481 /*******************************************************************************
482  * HW_CMT_MSC - CMT Modulator Status and Control Register
483  ******************************************************************************/
484
485 /*!
486  * @brief HW_CMT_MSC - CMT Modulator Status and Control Register (RW)
487  *
488  * Reset value: 0x00U
489  *
490  * This register contains the modulator and carrier generator enable (MCGEN),
491  * end of cycle interrupt enable (EOCIE), FSK mode select (FSK), baseband enable
492  * (BASE), extended space (EXSPC), prescaler (CMTDIV) bits, and the end of cycle
493  * (EOCF) status bit.
494  */
495 typedef union _hw_cmt_msc
496 {
497     uint8_t U;
498     struct _hw_cmt_msc_bitfields
499     {
500         uint8_t MCGEN : 1;             /*!< [0] Modulator and Carrier Generator Enable */
501         uint8_t EOCIE : 1;             /*!< [1] End of Cycle Interrupt Enable */
502         uint8_t FSK : 1;               /*!< [2] FSK Mode Select */
503         uint8_t BASE : 1;              /*!< [3] Baseband Enable */
504         uint8_t EXSPC : 1;             /*!< [4] Extended Space Enable */
505         uint8_t CMTDIV : 2;            /*!< [6:5] CMT Clock Divide Prescaler */
506         uint8_t EOCF : 1;              /*!< [7] End Of Cycle Status Flag */
507     } B;
508 } hw_cmt_msc_t;
509
510 /*!
511  * @name Constants and macros for entire CMT_MSC register
512  */
513 /*@{*/
514 #define HW_CMT_MSC_ADDR(x)       ((x) + 0x5U)
515
516 #define HW_CMT_MSC(x)            (*(__IO hw_cmt_msc_t *) HW_CMT_MSC_ADDR(x))
517 #define HW_CMT_MSC_RD(x)         (HW_CMT_MSC(x).U)
518 #define HW_CMT_MSC_WR(x, v)      (HW_CMT_MSC(x).U = (v))
519 #define HW_CMT_MSC_SET(x, v)     (HW_CMT_MSC_WR(x, HW_CMT_MSC_RD(x) |  (v)))
520 #define HW_CMT_MSC_CLR(x, v)     (HW_CMT_MSC_WR(x, HW_CMT_MSC_RD(x) & ~(v)))
521 #define HW_CMT_MSC_TOG(x, v)     (HW_CMT_MSC_WR(x, HW_CMT_MSC_RD(x) ^  (v)))
522 /*@}*/
523
524 /*
525  * Constants & macros for individual CMT_MSC bitfields
526  */
527
528 /*!
529  * @name Register CMT_MSC, field MCGEN[0] (RW)
530  *
531  * Setting MCGEN will initialize the carrier generator and modulator and will
532  * enable all clocks. When enabled, the carrier generator and modulator will
533  * function continuously. When MCGEN is cleared, the current modulator cycle will be
534  * allowed to expire before all carrier and modulator clocks are disabled to save
535  * power and the modulator output is forced low. To prevent spurious operation,
536  * the user should initialize all data and control registers before enabling the
537  * system.
538  *
539  * Values:
540  * - 0 - Modulator and carrier generator disabled
541  * - 1 - Modulator and carrier generator enabled
542  */
543 /*@{*/
544 #define BP_CMT_MSC_MCGEN     (0U)          /*!< Bit position for CMT_MSC_MCGEN. */
545 #define BM_CMT_MSC_MCGEN     (0x01U)       /*!< Bit mask for CMT_MSC_MCGEN. */
546 #define BS_CMT_MSC_MCGEN     (1U)          /*!< Bit field size in bits for CMT_MSC_MCGEN. */
547
548 /*! @brief Read current value of the CMT_MSC_MCGEN field. */
549 #define BR_CMT_MSC_MCGEN(x)  (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_MCGEN))
550
551 /*! @brief Format value for bitfield CMT_MSC_MCGEN. */
552 #define BF_CMT_MSC_MCGEN(v)  ((uint8_t)((uint8_t)(v) << BP_CMT_MSC_MCGEN) & BM_CMT_MSC_MCGEN)
553
554 /*! @brief Set the MCGEN field to a new value. */
555 #define BW_CMT_MSC_MCGEN(x, v) (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_MCGEN) = (v))
556 /*@}*/
557
558 /*!
559  * @name Register CMT_MSC, field EOCIE[1] (RW)
560  *
561  * Requests to enable a CPU interrupt when EOCF is set if EOCIE is high.
562  *
563  * Values:
564  * - 0 - CPU interrupt is disabled.
565  * - 1 - CPU interrupt is enabled.
566  */
567 /*@{*/
568 #define BP_CMT_MSC_EOCIE     (1U)          /*!< Bit position for CMT_MSC_EOCIE. */
569 #define BM_CMT_MSC_EOCIE     (0x02U)       /*!< Bit mask for CMT_MSC_EOCIE. */
570 #define BS_CMT_MSC_EOCIE     (1U)          /*!< Bit field size in bits for CMT_MSC_EOCIE. */
571
572 /*! @brief Read current value of the CMT_MSC_EOCIE field. */
573 #define BR_CMT_MSC_EOCIE(x)  (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_EOCIE))
574
575 /*! @brief Format value for bitfield CMT_MSC_EOCIE. */
576 #define BF_CMT_MSC_EOCIE(v)  ((uint8_t)((uint8_t)(v) << BP_CMT_MSC_EOCIE) & BM_CMT_MSC_EOCIE)
577
578 /*! @brief Set the EOCIE field to a new value. */
579 #define BW_CMT_MSC_EOCIE(x, v) (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_EOCIE) = (v))
580 /*@}*/
581
582 /*!
583  * @name Register CMT_MSC, field FSK[2] (RW)
584  *
585  * Enables FSK operation.
586  *
587  * Values:
588  * - 0 - The CMT operates in Time or Baseband mode.
589  * - 1 - The CMT operates in FSK mode.
590  */
591 /*@{*/
592 #define BP_CMT_MSC_FSK       (2U)          /*!< Bit position for CMT_MSC_FSK. */
593 #define BM_CMT_MSC_FSK       (0x04U)       /*!< Bit mask for CMT_MSC_FSK. */
594 #define BS_CMT_MSC_FSK       (1U)          /*!< Bit field size in bits for CMT_MSC_FSK. */
595
596 /*! @brief Read current value of the CMT_MSC_FSK field. */
597 #define BR_CMT_MSC_FSK(x)    (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_FSK))
598
599 /*! @brief Format value for bitfield CMT_MSC_FSK. */
600 #define BF_CMT_MSC_FSK(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_MSC_FSK) & BM_CMT_MSC_FSK)
601
602 /*! @brief Set the FSK field to a new value. */
603 #define BW_CMT_MSC_FSK(x, v) (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_FSK) = (v))
604 /*@}*/
605
606 /*!
607  * @name Register CMT_MSC, field BASE[3] (RW)
608  *
609  * When set, BASE disables the carrier generator and forces the carrier output
610  * high for generation of baseband protocols. When BASE is cleared, the carrier
611  * generator is enabled and the carrier output toggles at the frequency determined
612  * by values stored in the carrier data registers. This field is cleared by
613  * reset. This field is not double-buffered and must not be written to during a
614  * transmission.
615  *
616  * Values:
617  * - 0 - Baseband mode is disabled.
618  * - 1 - Baseband mode is enabled.
619  */
620 /*@{*/
621 #define BP_CMT_MSC_BASE      (3U)          /*!< Bit position for CMT_MSC_BASE. */
622 #define BM_CMT_MSC_BASE      (0x08U)       /*!< Bit mask for CMT_MSC_BASE. */
623 #define BS_CMT_MSC_BASE      (1U)          /*!< Bit field size in bits for CMT_MSC_BASE. */
624
625 /*! @brief Read current value of the CMT_MSC_BASE field. */
626 #define BR_CMT_MSC_BASE(x)   (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_BASE))
627
628 /*! @brief Format value for bitfield CMT_MSC_BASE. */
629 #define BF_CMT_MSC_BASE(v)   ((uint8_t)((uint8_t)(v) << BP_CMT_MSC_BASE) & BM_CMT_MSC_BASE)
630
631 /*! @brief Set the BASE field to a new value. */
632 #define BW_CMT_MSC_BASE(x, v) (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_BASE) = (v))
633 /*@}*/
634
635 /*!
636  * @name Register CMT_MSC, field EXSPC[4] (RW)
637  *
638  * Enables the extended space operation.
639  *
640  * Values:
641  * - 0 - Extended space is disabled.
642  * - 1 - Extended space is enabled.
643  */
644 /*@{*/
645 #define BP_CMT_MSC_EXSPC     (4U)          /*!< Bit position for CMT_MSC_EXSPC. */
646 #define BM_CMT_MSC_EXSPC     (0x10U)       /*!< Bit mask for CMT_MSC_EXSPC. */
647 #define BS_CMT_MSC_EXSPC     (1U)          /*!< Bit field size in bits for CMT_MSC_EXSPC. */
648
649 /*! @brief Read current value of the CMT_MSC_EXSPC field. */
650 #define BR_CMT_MSC_EXSPC(x)  (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_EXSPC))
651
652 /*! @brief Format value for bitfield CMT_MSC_EXSPC. */
653 #define BF_CMT_MSC_EXSPC(v)  ((uint8_t)((uint8_t)(v) << BP_CMT_MSC_EXSPC) & BM_CMT_MSC_EXSPC)
654
655 /*! @brief Set the EXSPC field to a new value. */
656 #define BW_CMT_MSC_EXSPC(x, v) (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_EXSPC) = (v))
657 /*@}*/
658
659 /*!
660  * @name Register CMT_MSC, field CMTDIV[6:5] (RW)
661  *
662  * Causes the CMT to be clocked at the IF signal frequency, or the IF frequency
663  * divided by 2 ,4, or 8 . This field must not be changed during a transmission
664  * because it is not double-buffered.
665  *
666  * Values:
667  * - 00 - IF * 1
668  * - 01 - IF * 2
669  * - 10 - IF * 4
670  * - 11 - IF * 8
671  */
672 /*@{*/
673 #define BP_CMT_MSC_CMTDIV    (5U)          /*!< Bit position for CMT_MSC_CMTDIV. */
674 #define BM_CMT_MSC_CMTDIV    (0x60U)       /*!< Bit mask for CMT_MSC_CMTDIV. */
675 #define BS_CMT_MSC_CMTDIV    (2U)          /*!< Bit field size in bits for CMT_MSC_CMTDIV. */
676
677 /*! @brief Read current value of the CMT_MSC_CMTDIV field. */
678 #define BR_CMT_MSC_CMTDIV(x) (HW_CMT_MSC(x).B.CMTDIV)
679
680 /*! @brief Format value for bitfield CMT_MSC_CMTDIV. */
681 #define BF_CMT_MSC_CMTDIV(v) ((uint8_t)((uint8_t)(v) << BP_CMT_MSC_CMTDIV) & BM_CMT_MSC_CMTDIV)
682
683 /*! @brief Set the CMTDIV field to a new value. */
684 #define BW_CMT_MSC_CMTDIV(x, v) (HW_CMT_MSC_WR(x, (HW_CMT_MSC_RD(x) & ~BM_CMT_MSC_CMTDIV) | BF_CMT_MSC_CMTDIV(v)))
685 /*@}*/
686
687 /*!
688  * @name Register CMT_MSC, field EOCF[7] (RO)
689  *
690  * Sets when: The modulator is not currently active and MCGEN is set to begin
691  * the initial CMT transmission. At the end of each modulation cycle while MCGEN is
692  * set. This is recognized when a match occurs between the contents of the space
693  * period register and the down counter. At this time, the counter is
694  * initialized with, possibly new contents of the mark period buffer, CMD1 and CMD2, and
695  * the space period register is loaded with, possibly new contents of the space
696  * period buffer, CMD3 and CMD4. This flag is cleared by reading MSC followed by an
697  * access of CMD2 or CMD4, or by the DMA transfer.
698  *
699  * Values:
700  * - 0 - End of modulation cycle has not occured since the flag last cleared.
701  * - 1 - End of modulator cycle has occurred.
702  */
703 /*@{*/
704 #define BP_CMT_MSC_EOCF      (7U)          /*!< Bit position for CMT_MSC_EOCF. */
705 #define BM_CMT_MSC_EOCF      (0x80U)       /*!< Bit mask for CMT_MSC_EOCF. */
706 #define BS_CMT_MSC_EOCF      (1U)          /*!< Bit field size in bits for CMT_MSC_EOCF. */
707
708 /*! @brief Read current value of the CMT_MSC_EOCF field. */
709 #define BR_CMT_MSC_EOCF(x)   (BITBAND_ACCESS8(HW_CMT_MSC_ADDR(x), BP_CMT_MSC_EOCF))
710 /*@}*/
711
712 /*******************************************************************************
713  * HW_CMT_CMD1 - CMT Modulator Data Register Mark High
714  ******************************************************************************/
715
716 /*!
717  * @brief HW_CMT_CMD1 - CMT Modulator Data Register Mark High (RW)
718  *
719  * Reset value: 0x00U
720  *
721  * The contents of this register are transferred to the modulator down counter
722  * upon the completion of a modulation period.
723  */
724 typedef union _hw_cmt_cmd1
725 {
726     uint8_t U;
727     struct _hw_cmt_cmd1_bitfields
728     {
729         uint8_t MB : 8;                /*!< [7:0]  */
730     } B;
731 } hw_cmt_cmd1_t;
732
733 /*!
734  * @name Constants and macros for entire CMT_CMD1 register
735  */
736 /*@{*/
737 #define HW_CMT_CMD1_ADDR(x)      ((x) + 0x6U)
738
739 #define HW_CMT_CMD1(x)           (*(__IO hw_cmt_cmd1_t *) HW_CMT_CMD1_ADDR(x))
740 #define HW_CMT_CMD1_RD(x)        (HW_CMT_CMD1(x).U)
741 #define HW_CMT_CMD1_WR(x, v)     (HW_CMT_CMD1(x).U = (v))
742 #define HW_CMT_CMD1_SET(x, v)    (HW_CMT_CMD1_WR(x, HW_CMT_CMD1_RD(x) |  (v)))
743 #define HW_CMT_CMD1_CLR(x, v)    (HW_CMT_CMD1_WR(x, HW_CMT_CMD1_RD(x) & ~(v)))
744 #define HW_CMT_CMD1_TOG(x, v)    (HW_CMT_CMD1_WR(x, HW_CMT_CMD1_RD(x) ^  (v)))
745 /*@}*/
746
747 /*
748  * Constants & macros for individual CMT_CMD1 bitfields
749  */
750
751 /*!
752  * @name Register CMT_CMD1, field MB[7:0] (RW)
753  *
754  * Controls the upper mark periods of the modulator for all modes.
755  */
756 /*@{*/
757 #define BP_CMT_CMD1_MB       (0U)          /*!< Bit position for CMT_CMD1_MB. */
758 #define BM_CMT_CMD1_MB       (0xFFU)       /*!< Bit mask for CMT_CMD1_MB. */
759 #define BS_CMT_CMD1_MB       (8U)          /*!< Bit field size in bits for CMT_CMD1_MB. */
760
761 /*! @brief Read current value of the CMT_CMD1_MB field. */
762 #define BR_CMT_CMD1_MB(x)    (HW_CMT_CMD1(x).U)
763
764 /*! @brief Format value for bitfield CMT_CMD1_MB. */
765 #define BF_CMT_CMD1_MB(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_CMD1_MB) & BM_CMT_CMD1_MB)
766
767 /*! @brief Set the MB field to a new value. */
768 #define BW_CMT_CMD1_MB(x, v) (HW_CMT_CMD1_WR(x, v))
769 /*@}*/
770
771 /*******************************************************************************
772  * HW_CMT_CMD2 - CMT Modulator Data Register Mark Low
773  ******************************************************************************/
774
775 /*!
776  * @brief HW_CMT_CMD2 - CMT Modulator Data Register Mark Low (RW)
777  *
778  * Reset value: 0x00U
779  *
780  * The contents of this register are transferred to the modulator down counter
781  * upon the completion of a modulation period.
782  */
783 typedef union _hw_cmt_cmd2
784 {
785     uint8_t U;
786     struct _hw_cmt_cmd2_bitfields
787     {
788         uint8_t MB : 8;                /*!< [7:0]  */
789     } B;
790 } hw_cmt_cmd2_t;
791
792 /*!
793  * @name Constants and macros for entire CMT_CMD2 register
794  */
795 /*@{*/
796 #define HW_CMT_CMD2_ADDR(x)      ((x) + 0x7U)
797
798 #define HW_CMT_CMD2(x)           (*(__IO hw_cmt_cmd2_t *) HW_CMT_CMD2_ADDR(x))
799 #define HW_CMT_CMD2_RD(x)        (HW_CMT_CMD2(x).U)
800 #define HW_CMT_CMD2_WR(x, v)     (HW_CMT_CMD2(x).U = (v))
801 #define HW_CMT_CMD2_SET(x, v)    (HW_CMT_CMD2_WR(x, HW_CMT_CMD2_RD(x) |  (v)))
802 #define HW_CMT_CMD2_CLR(x, v)    (HW_CMT_CMD2_WR(x, HW_CMT_CMD2_RD(x) & ~(v)))
803 #define HW_CMT_CMD2_TOG(x, v)    (HW_CMT_CMD2_WR(x, HW_CMT_CMD2_RD(x) ^  (v)))
804 /*@}*/
805
806 /*
807  * Constants & macros for individual CMT_CMD2 bitfields
808  */
809
810 /*!
811  * @name Register CMT_CMD2, field MB[7:0] (RW)
812  *
813  * Controls the lower mark periods of the modulator for all modes.
814  */
815 /*@{*/
816 #define BP_CMT_CMD2_MB       (0U)          /*!< Bit position for CMT_CMD2_MB. */
817 #define BM_CMT_CMD2_MB       (0xFFU)       /*!< Bit mask for CMT_CMD2_MB. */
818 #define BS_CMT_CMD2_MB       (8U)          /*!< Bit field size in bits for CMT_CMD2_MB. */
819
820 /*! @brief Read current value of the CMT_CMD2_MB field. */
821 #define BR_CMT_CMD2_MB(x)    (HW_CMT_CMD2(x).U)
822
823 /*! @brief Format value for bitfield CMT_CMD2_MB. */
824 #define BF_CMT_CMD2_MB(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_CMD2_MB) & BM_CMT_CMD2_MB)
825
826 /*! @brief Set the MB field to a new value. */
827 #define BW_CMT_CMD2_MB(x, v) (HW_CMT_CMD2_WR(x, v))
828 /*@}*/
829
830 /*******************************************************************************
831  * HW_CMT_CMD3 - CMT Modulator Data Register Space High
832  ******************************************************************************/
833
834 /*!
835  * @brief HW_CMT_CMD3 - CMT Modulator Data Register Space High (RW)
836  *
837  * Reset value: 0x00U
838  *
839  * The contents of this register are transferred to the space period register
840  * upon the completion of a modulation period.
841  */
842 typedef union _hw_cmt_cmd3
843 {
844     uint8_t U;
845     struct _hw_cmt_cmd3_bitfields
846     {
847         uint8_t SB : 8;                /*!< [7:0]  */
848     } B;
849 } hw_cmt_cmd3_t;
850
851 /*!
852  * @name Constants and macros for entire CMT_CMD3 register
853  */
854 /*@{*/
855 #define HW_CMT_CMD3_ADDR(x)      ((x) + 0x8U)
856
857 #define HW_CMT_CMD3(x)           (*(__IO hw_cmt_cmd3_t *) HW_CMT_CMD3_ADDR(x))
858 #define HW_CMT_CMD3_RD(x)        (HW_CMT_CMD3(x).U)
859 #define HW_CMT_CMD3_WR(x, v)     (HW_CMT_CMD3(x).U = (v))
860 #define HW_CMT_CMD3_SET(x, v)    (HW_CMT_CMD3_WR(x, HW_CMT_CMD3_RD(x) |  (v)))
861 #define HW_CMT_CMD3_CLR(x, v)    (HW_CMT_CMD3_WR(x, HW_CMT_CMD3_RD(x) & ~(v)))
862 #define HW_CMT_CMD3_TOG(x, v)    (HW_CMT_CMD3_WR(x, HW_CMT_CMD3_RD(x) ^  (v)))
863 /*@}*/
864
865 /*
866  * Constants & macros for individual CMT_CMD3 bitfields
867  */
868
869 /*!
870  * @name Register CMT_CMD3, field SB[7:0] (RW)
871  *
872  * Controls the upper space periods of the modulator for all modes.
873  */
874 /*@{*/
875 #define BP_CMT_CMD3_SB       (0U)          /*!< Bit position for CMT_CMD3_SB. */
876 #define BM_CMT_CMD3_SB       (0xFFU)       /*!< Bit mask for CMT_CMD3_SB. */
877 #define BS_CMT_CMD3_SB       (8U)          /*!< Bit field size in bits for CMT_CMD3_SB. */
878
879 /*! @brief Read current value of the CMT_CMD3_SB field. */
880 #define BR_CMT_CMD3_SB(x)    (HW_CMT_CMD3(x).U)
881
882 /*! @brief Format value for bitfield CMT_CMD3_SB. */
883 #define BF_CMT_CMD3_SB(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_CMD3_SB) & BM_CMT_CMD3_SB)
884
885 /*! @brief Set the SB field to a new value. */
886 #define BW_CMT_CMD3_SB(x, v) (HW_CMT_CMD3_WR(x, v))
887 /*@}*/
888
889 /*******************************************************************************
890  * HW_CMT_CMD4 - CMT Modulator Data Register Space Low
891  ******************************************************************************/
892
893 /*!
894  * @brief HW_CMT_CMD4 - CMT Modulator Data Register Space Low (RW)
895  *
896  * Reset value: 0x00U
897  *
898  * The contents of this register are transferred to the space period register
899  * upon the completion of a modulation period.
900  */
901 typedef union _hw_cmt_cmd4
902 {
903     uint8_t U;
904     struct _hw_cmt_cmd4_bitfields
905     {
906         uint8_t SB : 8;                /*!< [7:0]  */
907     } B;
908 } hw_cmt_cmd4_t;
909
910 /*!
911  * @name Constants and macros for entire CMT_CMD4 register
912  */
913 /*@{*/
914 #define HW_CMT_CMD4_ADDR(x)      ((x) + 0x9U)
915
916 #define HW_CMT_CMD4(x)           (*(__IO hw_cmt_cmd4_t *) HW_CMT_CMD4_ADDR(x))
917 #define HW_CMT_CMD4_RD(x)        (HW_CMT_CMD4(x).U)
918 #define HW_CMT_CMD4_WR(x, v)     (HW_CMT_CMD4(x).U = (v))
919 #define HW_CMT_CMD4_SET(x, v)    (HW_CMT_CMD4_WR(x, HW_CMT_CMD4_RD(x) |  (v)))
920 #define HW_CMT_CMD4_CLR(x, v)    (HW_CMT_CMD4_WR(x, HW_CMT_CMD4_RD(x) & ~(v)))
921 #define HW_CMT_CMD4_TOG(x, v)    (HW_CMT_CMD4_WR(x, HW_CMT_CMD4_RD(x) ^  (v)))
922 /*@}*/
923
924 /*
925  * Constants & macros for individual CMT_CMD4 bitfields
926  */
927
928 /*!
929  * @name Register CMT_CMD4, field SB[7:0] (RW)
930  *
931  * Controls the lower space periods of the modulator for all modes.
932  */
933 /*@{*/
934 #define BP_CMT_CMD4_SB       (0U)          /*!< Bit position for CMT_CMD4_SB. */
935 #define BM_CMT_CMD4_SB       (0xFFU)       /*!< Bit mask for CMT_CMD4_SB. */
936 #define BS_CMT_CMD4_SB       (8U)          /*!< Bit field size in bits for CMT_CMD4_SB. */
937
938 /*! @brief Read current value of the CMT_CMD4_SB field. */
939 #define BR_CMT_CMD4_SB(x)    (HW_CMT_CMD4(x).U)
940
941 /*! @brief Format value for bitfield CMT_CMD4_SB. */
942 #define BF_CMT_CMD4_SB(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_CMD4_SB) & BM_CMT_CMD4_SB)
943
944 /*! @brief Set the SB field to a new value. */
945 #define BW_CMT_CMD4_SB(x, v) (HW_CMT_CMD4_WR(x, v))
946 /*@}*/
947
948 /*******************************************************************************
949  * HW_CMT_PPS - CMT Primary Prescaler Register
950  ******************************************************************************/
951
952 /*!
953  * @brief HW_CMT_PPS - CMT Primary Prescaler Register (RW)
954  *
955  * Reset value: 0x00U
956  *
957  * This register is used to set the Primary Prescaler Divider field (PPSDIV).
958  */
959 typedef union _hw_cmt_pps
960 {
961     uint8_t U;
962     struct _hw_cmt_pps_bitfields
963     {
964         uint8_t PPSDIV : 4;            /*!< [3:0] Primary Prescaler Divider */
965         uint8_t RESERVED0 : 4;         /*!< [7:4]  */
966     } B;
967 } hw_cmt_pps_t;
968
969 /*!
970  * @name Constants and macros for entire CMT_PPS register
971  */
972 /*@{*/
973 #define HW_CMT_PPS_ADDR(x)       ((x) + 0xAU)
974
975 #define HW_CMT_PPS(x)            (*(__IO hw_cmt_pps_t *) HW_CMT_PPS_ADDR(x))
976 #define HW_CMT_PPS_RD(x)         (HW_CMT_PPS(x).U)
977 #define HW_CMT_PPS_WR(x, v)      (HW_CMT_PPS(x).U = (v))
978 #define HW_CMT_PPS_SET(x, v)     (HW_CMT_PPS_WR(x, HW_CMT_PPS_RD(x) |  (v)))
979 #define HW_CMT_PPS_CLR(x, v)     (HW_CMT_PPS_WR(x, HW_CMT_PPS_RD(x) & ~(v)))
980 #define HW_CMT_PPS_TOG(x, v)     (HW_CMT_PPS_WR(x, HW_CMT_PPS_RD(x) ^  (v)))
981 /*@}*/
982
983 /*
984  * Constants & macros for individual CMT_PPS bitfields
985  */
986
987 /*!
988  * @name Register CMT_PPS, field PPSDIV[3:0] (RW)
989  *
990  * Divides the CMT clock to generate the Intermediate Frequency clock enable to
991  * the secondary prescaler.
992  *
993  * Values:
994  * - 0000 - Bus clock * 1
995  * - 0001 - Bus clock * 2
996  * - 0010 - Bus clock * 3
997  * - 0011 - Bus clock * 4
998  * - 0100 - Bus clock * 5
999  * - 0101 - Bus clock * 6
1000  * - 0110 - Bus clock * 7
1001  * - 0111 - Bus clock * 8
1002  * - 1000 - Bus clock * 9
1003  * - 1001 - Bus clock * 10
1004  * - 1010 - Bus clock * 11
1005  * - 1011 - Bus clock * 12
1006  * - 1100 - Bus clock * 13
1007  * - 1101 - Bus clock * 14
1008  * - 1110 - Bus clock * 15
1009  * - 1111 - Bus clock * 16
1010  */
1011 /*@{*/
1012 #define BP_CMT_PPS_PPSDIV    (0U)          /*!< Bit position for CMT_PPS_PPSDIV. */
1013 #define BM_CMT_PPS_PPSDIV    (0x0FU)       /*!< Bit mask for CMT_PPS_PPSDIV. */
1014 #define BS_CMT_PPS_PPSDIV    (4U)          /*!< Bit field size in bits for CMT_PPS_PPSDIV. */
1015
1016 /*! @brief Read current value of the CMT_PPS_PPSDIV field. */
1017 #define BR_CMT_PPS_PPSDIV(x) (HW_CMT_PPS(x).B.PPSDIV)
1018
1019 /*! @brief Format value for bitfield CMT_PPS_PPSDIV. */
1020 #define BF_CMT_PPS_PPSDIV(v) ((uint8_t)((uint8_t)(v) << BP_CMT_PPS_PPSDIV) & BM_CMT_PPS_PPSDIV)
1021
1022 /*! @brief Set the PPSDIV field to a new value. */
1023 #define BW_CMT_PPS_PPSDIV(x, v) (HW_CMT_PPS_WR(x, (HW_CMT_PPS_RD(x) & ~BM_CMT_PPS_PPSDIV) | BF_CMT_PPS_PPSDIV(v)))
1024 /*@}*/
1025
1026 /*******************************************************************************
1027  * HW_CMT_DMA - CMT Direct Memory Access Register
1028  ******************************************************************************/
1029
1030 /*!
1031  * @brief HW_CMT_DMA - CMT Direct Memory Access Register (RW)
1032  *
1033  * Reset value: 0x00U
1034  *
1035  * This register is used to enable/disable direct memory access (DMA).
1036  */
1037 typedef union _hw_cmt_dma
1038 {
1039     uint8_t U;
1040     struct _hw_cmt_dma_bitfields
1041     {
1042         uint8_t DMA : 1;               /*!< [0] DMA Enable */
1043         uint8_t RESERVED0 : 7;         /*!< [7:1]  */
1044     } B;
1045 } hw_cmt_dma_t;
1046
1047 /*!
1048  * @name Constants and macros for entire CMT_DMA register
1049  */
1050 /*@{*/
1051 #define HW_CMT_DMA_ADDR(x)       ((x) + 0xBU)
1052
1053 #define HW_CMT_DMA(x)            (*(__IO hw_cmt_dma_t *) HW_CMT_DMA_ADDR(x))
1054 #define HW_CMT_DMA_RD(x)         (HW_CMT_DMA(x).U)
1055 #define HW_CMT_DMA_WR(x, v)      (HW_CMT_DMA(x).U = (v))
1056 #define HW_CMT_DMA_SET(x, v)     (HW_CMT_DMA_WR(x, HW_CMT_DMA_RD(x) |  (v)))
1057 #define HW_CMT_DMA_CLR(x, v)     (HW_CMT_DMA_WR(x, HW_CMT_DMA_RD(x) & ~(v)))
1058 #define HW_CMT_DMA_TOG(x, v)     (HW_CMT_DMA_WR(x, HW_CMT_DMA_RD(x) ^  (v)))
1059 /*@}*/
1060
1061 /*
1062  * Constants & macros for individual CMT_DMA bitfields
1063  */
1064
1065 /*!
1066  * @name Register CMT_DMA, field DMA[0] (RW)
1067  *
1068  * Enables the DMA protocol.
1069  *
1070  * Values:
1071  * - 0 - DMA transfer request and done are disabled.
1072  * - 1 - DMA transfer request and done are enabled.
1073  */
1074 /*@{*/
1075 #define BP_CMT_DMA_DMA       (0U)          /*!< Bit position for CMT_DMA_DMA. */
1076 #define BM_CMT_DMA_DMA       (0x01U)       /*!< Bit mask for CMT_DMA_DMA. */
1077 #define BS_CMT_DMA_DMA       (1U)          /*!< Bit field size in bits for CMT_DMA_DMA. */
1078
1079 /*! @brief Read current value of the CMT_DMA_DMA field. */
1080 #define BR_CMT_DMA_DMA(x)    (BITBAND_ACCESS8(HW_CMT_DMA_ADDR(x), BP_CMT_DMA_DMA))
1081
1082 /*! @brief Format value for bitfield CMT_DMA_DMA. */
1083 #define BF_CMT_DMA_DMA(v)    ((uint8_t)((uint8_t)(v) << BP_CMT_DMA_DMA) & BM_CMT_DMA_DMA)
1084
1085 /*! @brief Set the DMA field to a new value. */
1086 #define BW_CMT_DMA_DMA(x, v) (BITBAND_ACCESS8(HW_CMT_DMA_ADDR(x), BP_CMT_DMA_DMA) = (v))
1087 /*@}*/
1088
1089 /*******************************************************************************
1090  * hw_cmt_t - module struct
1091  ******************************************************************************/
1092 /*!
1093  * @brief All CMT module registers.
1094  */
1095 #pragma pack(1)
1096 typedef struct _hw_cmt
1097 {
1098     __IO hw_cmt_cgh1_t CGH1;               /*!< [0x0] CMT Carrier Generator High Data Register 1 */
1099     __IO hw_cmt_cgl1_t CGL1;               /*!< [0x1] CMT Carrier Generator Low Data Register 1 */
1100     __IO hw_cmt_cgh2_t CGH2;               /*!< [0x2] CMT Carrier Generator High Data Register 2 */
1101     __IO hw_cmt_cgl2_t CGL2;               /*!< [0x3] CMT Carrier Generator Low Data Register 2 */
1102     __IO hw_cmt_oc_t OC;                   /*!< [0x4] CMT Output Control Register */
1103     __IO hw_cmt_msc_t MSC;                 /*!< [0x5] CMT Modulator Status and Control Register */
1104     __IO hw_cmt_cmd1_t CMD1;               /*!< [0x6] CMT Modulator Data Register Mark High */
1105     __IO hw_cmt_cmd2_t CMD2;               /*!< [0x7] CMT Modulator Data Register Mark Low */
1106     __IO hw_cmt_cmd3_t CMD3;               /*!< [0x8] CMT Modulator Data Register Space High */
1107     __IO hw_cmt_cmd4_t CMD4;               /*!< [0x9] CMT Modulator Data Register Space Low */
1108     __IO hw_cmt_pps_t PPS;                 /*!< [0xA] CMT Primary Prescaler Register */
1109     __IO hw_cmt_dma_t DMA;                 /*!< [0xB] CMT Direct Memory Access Register */
1110 } hw_cmt_t;
1111 #pragma pack()
1112
1113 /*! @brief Macro to access all CMT registers. */
1114 /*! @param x CMT module instance base address. */
1115 /*! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
1116  *     use the '&' operator, like <code>&HW_CMT(CMT_BASE)</code>. */
1117 #define HW_CMT(x)      (*(hw_cmt_t *)(x))
1118
1119 #endif /* __HW_CMT_REGISTERS_H__ */
1120 /* EOF */