]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K22F/device/MK22F51212/MK22F51212_rtc.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_K22F / device / MK22F51212 / MK22F51212_rtc.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:    K22P121M120SF7RM, Rev. 1, March 24, 2014
9 **     Version:             rev. 2.5, 2014-05-06
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-07-23)
48 **         Initial version.
49 **     - rev. 1.1 (2013-09-17)
50 **         RM rev. 0.4 update.
51 **     - rev. 2.0 (2013-10-29)
52 **         Register accessor macros added to the memory map.
53 **         Symbols for Processor Expert memory map compatibility added to the memory map.
54 **         Startup file for gcc has been updated according to CMSIS 3.2.
55 **         System initialization updated.
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-20)
59 **         Update according to reference manual rev. 0.6,
60 **     - rev. 2.3 (2014-01-13)
61 **         Update according to reference manual rev. 0.61,
62 **     - rev. 2.4 (2014-02-10)
63 **         The declaration of clock configurations has been moved to separate header file system_MK22F51212.h
64 **     - rev. 2.5 (2014-05-06)
65 **         Update according to reference manual rev. 1.0,
66 **         Update of system and startup files.
67 **         Module access macro module_BASES replaced by module_BASE_PTRS.
68 **
69 ** ###################################################################
70 */
71
72 /*
73  * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
74  *
75  * This file was generated automatically and any changes may be lost.
76  */
77 #ifndef __HW_RTC_REGISTERS_H__
78 #define __HW_RTC_REGISTERS_H__
79
80 #include "MK22F51212.h"
81 #include "fsl_bitaccess.h"
82
83 /*
84  * MK22F51212 RTC
85  *
86  * Secure Real Time Clock
87  *
88  * Registers defined in this header file:
89  * - HW_RTC_TSR - RTC Time Seconds Register
90  * - HW_RTC_TPR - RTC Time Prescaler Register
91  * - HW_RTC_TAR - RTC Time Alarm Register
92  * - HW_RTC_TCR - RTC Time Compensation Register
93  * - HW_RTC_CR - RTC Control Register
94  * - HW_RTC_SR - RTC Status Register
95  * - HW_RTC_LR - RTC Lock Register
96  * - HW_RTC_IER - RTC Interrupt Enable Register
97  * - HW_RTC_WAR - RTC Write Access Register
98  * - HW_RTC_RAR - RTC Read Access Register
99  *
100  * - hw_rtc_t - Struct containing all module registers.
101  */
102
103 #define HW_RTC_INSTANCE_COUNT (1U) /*!< Number of instances of the RTC module. */
104
105 /*******************************************************************************
106  * HW_RTC_TSR - RTC Time Seconds Register
107  ******************************************************************************/
108
109 /*!
110  * @brief HW_RTC_TSR - RTC Time Seconds Register (RW)
111  *
112  * Reset value: 0x00000000U
113  */
114 typedef union _hw_rtc_tsr
115 {
116     uint32_t U;
117     struct _hw_rtc_tsr_bitfields
118     {
119         uint32_t TSR : 32;             /*!< [31:0] Time Seconds Register */
120     } B;
121 } hw_rtc_tsr_t;
122
123 /*!
124  * @name Constants and macros for entire RTC_TSR register
125  */
126 /*@{*/
127 #define HW_RTC_TSR_ADDR(x)       ((x) + 0x0U)
128
129 #define HW_RTC_TSR(x)            (*(__IO hw_rtc_tsr_t *) HW_RTC_TSR_ADDR(x))
130 #define HW_RTC_TSR_RD(x)         (HW_RTC_TSR(x).U)
131 #define HW_RTC_TSR_WR(x, v)      (HW_RTC_TSR(x).U = (v))
132 #define HW_RTC_TSR_SET(x, v)     (HW_RTC_TSR_WR(x, HW_RTC_TSR_RD(x) |  (v)))
133 #define HW_RTC_TSR_CLR(x, v)     (HW_RTC_TSR_WR(x, HW_RTC_TSR_RD(x) & ~(v)))
134 #define HW_RTC_TSR_TOG(x, v)     (HW_RTC_TSR_WR(x, HW_RTC_TSR_RD(x) ^  (v)))
135 /*@}*/
136
137 /*
138  * Constants & macros for individual RTC_TSR bitfields
139  */
140
141 /*!
142  * @name Register RTC_TSR, field TSR[31:0] (RW)
143  *
144  * When the time counter is enabled, the TSR is read only and increments once a
145  * second provided SR[TOF] or SR[TIF] are not set. The time counter will read as
146  * zero when SR[TOF] or SR[TIF] are set. When the time counter is disabled, the
147  * TSR can be read or written. Writing to the TSR when the time counter is
148  * disabled will clear the SR[TOF] and/or the SR[TIF]. Writing to TSR with zero is
149  * supported, but not recommended because TSR will read as zero when SR[TIF] or
150  * SR[TOF] are set (indicating the time is invalid).
151  */
152 /*@{*/
153 #define BP_RTC_TSR_TSR       (0U)          /*!< Bit position for RTC_TSR_TSR. */
154 #define BM_RTC_TSR_TSR       (0xFFFFFFFFU) /*!< Bit mask for RTC_TSR_TSR. */
155 #define BS_RTC_TSR_TSR       (32U)         /*!< Bit field size in bits for RTC_TSR_TSR. */
156
157 /*! @brief Read current value of the RTC_TSR_TSR field. */
158 #define BR_RTC_TSR_TSR(x)    (HW_RTC_TSR(x).U)
159
160 /*! @brief Format value for bitfield RTC_TSR_TSR. */
161 #define BF_RTC_TSR_TSR(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_TSR_TSR) & BM_RTC_TSR_TSR)
162
163 /*! @brief Set the TSR field to a new value. */
164 #define BW_RTC_TSR_TSR(x, v) (HW_RTC_TSR_WR(x, v))
165 /*@}*/
166
167 /*******************************************************************************
168  * HW_RTC_TPR - RTC Time Prescaler Register
169  ******************************************************************************/
170
171 /*!
172  * @brief HW_RTC_TPR - RTC Time Prescaler Register (RW)
173  *
174  * Reset value: 0x00000000U
175  */
176 typedef union _hw_rtc_tpr
177 {
178     uint32_t U;
179     struct _hw_rtc_tpr_bitfields
180     {
181         uint32_t TPR : 16;             /*!< [15:0] Time Prescaler Register */
182         uint32_t RESERVED0 : 16;       /*!< [31:16]  */
183     } B;
184 } hw_rtc_tpr_t;
185
186 /*!
187  * @name Constants and macros for entire RTC_TPR register
188  */
189 /*@{*/
190 #define HW_RTC_TPR_ADDR(x)       ((x) + 0x4U)
191
192 #define HW_RTC_TPR(x)            (*(__IO hw_rtc_tpr_t *) HW_RTC_TPR_ADDR(x))
193 #define HW_RTC_TPR_RD(x)         (HW_RTC_TPR(x).U)
194 #define HW_RTC_TPR_WR(x, v)      (HW_RTC_TPR(x).U = (v))
195 #define HW_RTC_TPR_SET(x, v)     (HW_RTC_TPR_WR(x, HW_RTC_TPR_RD(x) |  (v)))
196 #define HW_RTC_TPR_CLR(x, v)     (HW_RTC_TPR_WR(x, HW_RTC_TPR_RD(x) & ~(v)))
197 #define HW_RTC_TPR_TOG(x, v)     (HW_RTC_TPR_WR(x, HW_RTC_TPR_RD(x) ^  (v)))
198 /*@}*/
199
200 /*
201  * Constants & macros for individual RTC_TPR bitfields
202  */
203
204 /*!
205  * @name Register RTC_TPR, field TPR[15:0] (RW)
206  *
207  * When the time counter is enabled, the TPR is read only and increments every
208  * 32.768 kHz clock cycle. The time counter will read as zero when SR[TOF] or
209  * SR[TIF] are set. When the time counter is disabled, the TPR can be read or
210  * written. The TSR[TSR] increments when bit 14 of the TPR transitions from a logic one
211  * to a logic zero.
212  */
213 /*@{*/
214 #define BP_RTC_TPR_TPR       (0U)          /*!< Bit position for RTC_TPR_TPR. */
215 #define BM_RTC_TPR_TPR       (0x0000FFFFU) /*!< Bit mask for RTC_TPR_TPR. */
216 #define BS_RTC_TPR_TPR       (16U)         /*!< Bit field size in bits for RTC_TPR_TPR. */
217
218 /*! @brief Read current value of the RTC_TPR_TPR field. */
219 #define BR_RTC_TPR_TPR(x)    (HW_RTC_TPR(x).B.TPR)
220
221 /*! @brief Format value for bitfield RTC_TPR_TPR. */
222 #define BF_RTC_TPR_TPR(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_TPR_TPR) & BM_RTC_TPR_TPR)
223
224 /*! @brief Set the TPR field to a new value. */
225 #define BW_RTC_TPR_TPR(x, v) (HW_RTC_TPR_WR(x, (HW_RTC_TPR_RD(x) & ~BM_RTC_TPR_TPR) | BF_RTC_TPR_TPR(v)))
226 /*@}*/
227
228 /*******************************************************************************
229  * HW_RTC_TAR - RTC Time Alarm Register
230  ******************************************************************************/
231
232 /*!
233  * @brief HW_RTC_TAR - RTC Time Alarm Register (RW)
234  *
235  * Reset value: 0x00000000U
236  */
237 typedef union _hw_rtc_tar
238 {
239     uint32_t U;
240     struct _hw_rtc_tar_bitfields
241     {
242         uint32_t TAR : 32;             /*!< [31:0] Time Alarm Register */
243     } B;
244 } hw_rtc_tar_t;
245
246 /*!
247  * @name Constants and macros for entire RTC_TAR register
248  */
249 /*@{*/
250 #define HW_RTC_TAR_ADDR(x)       ((x) + 0x8U)
251
252 #define HW_RTC_TAR(x)            (*(__IO hw_rtc_tar_t *) HW_RTC_TAR_ADDR(x))
253 #define HW_RTC_TAR_RD(x)         (HW_RTC_TAR(x).U)
254 #define HW_RTC_TAR_WR(x, v)      (HW_RTC_TAR(x).U = (v))
255 #define HW_RTC_TAR_SET(x, v)     (HW_RTC_TAR_WR(x, HW_RTC_TAR_RD(x) |  (v)))
256 #define HW_RTC_TAR_CLR(x, v)     (HW_RTC_TAR_WR(x, HW_RTC_TAR_RD(x) & ~(v)))
257 #define HW_RTC_TAR_TOG(x, v)     (HW_RTC_TAR_WR(x, HW_RTC_TAR_RD(x) ^  (v)))
258 /*@}*/
259
260 /*
261  * Constants & macros for individual RTC_TAR bitfields
262  */
263
264 /*!
265  * @name Register RTC_TAR, field TAR[31:0] (RW)
266  *
267  * When the time counter is enabled, the SR[TAF] is set whenever the TAR[TAR]
268  * equals the TSR[TSR] and the TSR[TSR] increments. Writing to the TAR clears the
269  * SR[TAF].
270  */
271 /*@{*/
272 #define BP_RTC_TAR_TAR       (0U)          /*!< Bit position for RTC_TAR_TAR. */
273 #define BM_RTC_TAR_TAR       (0xFFFFFFFFU) /*!< Bit mask for RTC_TAR_TAR. */
274 #define BS_RTC_TAR_TAR       (32U)         /*!< Bit field size in bits for RTC_TAR_TAR. */
275
276 /*! @brief Read current value of the RTC_TAR_TAR field. */
277 #define BR_RTC_TAR_TAR(x)    (HW_RTC_TAR(x).U)
278
279 /*! @brief Format value for bitfield RTC_TAR_TAR. */
280 #define BF_RTC_TAR_TAR(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_TAR_TAR) & BM_RTC_TAR_TAR)
281
282 /*! @brief Set the TAR field to a new value. */
283 #define BW_RTC_TAR_TAR(x, v) (HW_RTC_TAR_WR(x, v))
284 /*@}*/
285
286 /*******************************************************************************
287  * HW_RTC_TCR - RTC Time Compensation Register
288  ******************************************************************************/
289
290 /*!
291  * @brief HW_RTC_TCR - RTC Time Compensation Register (RW)
292  *
293  * Reset value: 0x00000000U
294  */
295 typedef union _hw_rtc_tcr
296 {
297     uint32_t U;
298     struct _hw_rtc_tcr_bitfields
299     {
300         uint32_t TCR : 8;              /*!< [7:0] Time Compensation Register */
301         uint32_t CIR : 8;              /*!< [15:8] Compensation Interval Register */
302         uint32_t TCV : 8;              /*!< [23:16] Time Compensation Value */
303         uint32_t CIC : 8;              /*!< [31:24] Compensation Interval Counter */
304     } B;
305 } hw_rtc_tcr_t;
306
307 /*!
308  * @name Constants and macros for entire RTC_TCR register
309  */
310 /*@{*/
311 #define HW_RTC_TCR_ADDR(x)       ((x) + 0xCU)
312
313 #define HW_RTC_TCR(x)            (*(__IO hw_rtc_tcr_t *) HW_RTC_TCR_ADDR(x))
314 #define HW_RTC_TCR_RD(x)         (HW_RTC_TCR(x).U)
315 #define HW_RTC_TCR_WR(x, v)      (HW_RTC_TCR(x).U = (v))
316 #define HW_RTC_TCR_SET(x, v)     (HW_RTC_TCR_WR(x, HW_RTC_TCR_RD(x) |  (v)))
317 #define HW_RTC_TCR_CLR(x, v)     (HW_RTC_TCR_WR(x, HW_RTC_TCR_RD(x) & ~(v)))
318 #define HW_RTC_TCR_TOG(x, v)     (HW_RTC_TCR_WR(x, HW_RTC_TCR_RD(x) ^  (v)))
319 /*@}*/
320
321 /*
322  * Constants & macros for individual RTC_TCR bitfields
323  */
324
325 /*!
326  * @name Register RTC_TCR, field TCR[7:0] (RW)
327  *
328  * Configures the number of 32.768 kHz clock cycles in each second. This
329  * register is double buffered and writes do not take affect until the end of the
330  * current compensation interval.
331  *
332  * Values:
333  * - 10000000 - Time Prescaler Register overflows every 32896 clock cycles.
334  * - 11111111 - Time Prescaler Register overflows every 32769 clock cycles.
335  * - 0 - Time Prescaler Register overflows every 32768 clock cycles.
336  * - 1 - Time Prescaler Register overflows every 32767 clock cycles.
337  * - 1111111 - Time Prescaler Register overflows every 32641 clock cycles.
338  */
339 /*@{*/
340 #define BP_RTC_TCR_TCR       (0U)          /*!< Bit position for RTC_TCR_TCR. */
341 #define BM_RTC_TCR_TCR       (0x000000FFU) /*!< Bit mask for RTC_TCR_TCR. */
342 #define BS_RTC_TCR_TCR       (8U)          /*!< Bit field size in bits for RTC_TCR_TCR. */
343
344 /*! @brief Read current value of the RTC_TCR_TCR field. */
345 #define BR_RTC_TCR_TCR(x)    (HW_RTC_TCR(x).B.TCR)
346
347 /*! @brief Format value for bitfield RTC_TCR_TCR. */
348 #define BF_RTC_TCR_TCR(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_TCR_TCR) & BM_RTC_TCR_TCR)
349
350 /*! @brief Set the TCR field to a new value. */
351 #define BW_RTC_TCR_TCR(x, v) (HW_RTC_TCR_WR(x, (HW_RTC_TCR_RD(x) & ~BM_RTC_TCR_TCR) | BF_RTC_TCR_TCR(v)))
352 /*@}*/
353
354 /*!
355  * @name Register RTC_TCR, field CIR[15:8] (RW)
356  *
357  * Configures the compensation interval in seconds from 1 to 256 to control how
358  * frequently the TCR should adjust the number of 32.768 kHz cycles in each
359  * second. The value written should be one less than the number of seconds. For
360  * example, write zero to configure for a compensation interval of one second. This
361  * register is double buffered and writes do not take affect until the end of the
362  * current compensation interval.
363  */
364 /*@{*/
365 #define BP_RTC_TCR_CIR       (8U)          /*!< Bit position for RTC_TCR_CIR. */
366 #define BM_RTC_TCR_CIR       (0x0000FF00U) /*!< Bit mask for RTC_TCR_CIR. */
367 #define BS_RTC_TCR_CIR       (8U)          /*!< Bit field size in bits for RTC_TCR_CIR. */
368
369 /*! @brief Read current value of the RTC_TCR_CIR field. */
370 #define BR_RTC_TCR_CIR(x)    (HW_RTC_TCR(x).B.CIR)
371
372 /*! @brief Format value for bitfield RTC_TCR_CIR. */
373 #define BF_RTC_TCR_CIR(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_TCR_CIR) & BM_RTC_TCR_CIR)
374
375 /*! @brief Set the CIR field to a new value. */
376 #define BW_RTC_TCR_CIR(x, v) (HW_RTC_TCR_WR(x, (HW_RTC_TCR_RD(x) & ~BM_RTC_TCR_CIR) | BF_RTC_TCR_CIR(v)))
377 /*@}*/
378
379 /*!
380  * @name Register RTC_TCR, field TCV[23:16] (RO)
381  *
382  * Current value used by the compensation logic for the present second interval.
383  * Updated once a second if the CIC equals 0 with the contents of the TCR field.
384  * If the CIC does not equal zero then it is loaded with zero (compensation is
385  * not enabled for that second increment).
386  */
387 /*@{*/
388 #define BP_RTC_TCR_TCV       (16U)         /*!< Bit position for RTC_TCR_TCV. */
389 #define BM_RTC_TCR_TCV       (0x00FF0000U) /*!< Bit mask for RTC_TCR_TCV. */
390 #define BS_RTC_TCR_TCV       (8U)          /*!< Bit field size in bits for RTC_TCR_TCV. */
391
392 /*! @brief Read current value of the RTC_TCR_TCV field. */
393 #define BR_RTC_TCR_TCV(x)    (HW_RTC_TCR(x).B.TCV)
394 /*@}*/
395
396 /*!
397  * @name Register RTC_TCR, field CIC[31:24] (RO)
398  *
399  * Current value of the compensation interval counter. If the compensation
400  * interval counter equals zero then it is loaded with the contents of the CIR. If the
401  * CIC does not equal zero then it is decremented once a second.
402  */
403 /*@{*/
404 #define BP_RTC_TCR_CIC       (24U)         /*!< Bit position for RTC_TCR_CIC. */
405 #define BM_RTC_TCR_CIC       (0xFF000000U) /*!< Bit mask for RTC_TCR_CIC. */
406 #define BS_RTC_TCR_CIC       (8U)          /*!< Bit field size in bits for RTC_TCR_CIC. */
407
408 /*! @brief Read current value of the RTC_TCR_CIC field. */
409 #define BR_RTC_TCR_CIC(x)    (HW_RTC_TCR(x).B.CIC)
410 /*@}*/
411
412 /*******************************************************************************
413  * HW_RTC_CR - RTC Control Register
414  ******************************************************************************/
415
416 /*!
417  * @brief HW_RTC_CR - RTC Control Register (RW)
418  *
419  * Reset value: 0x00000000U
420  */
421 typedef union _hw_rtc_cr
422 {
423     uint32_t U;
424     struct _hw_rtc_cr_bitfields
425     {
426         uint32_t SWR : 1;              /*!< [0] Software Reset */
427         uint32_t WPE : 1;              /*!< [1] Wakeup Pin Enable */
428         uint32_t SUP : 1;              /*!< [2] Supervisor Access */
429         uint32_t UM : 1;               /*!< [3] Update Mode */
430         uint32_t WPS : 1;              /*!< [4] Wakeup Pin Select */
431         uint32_t RESERVED0 : 3;        /*!< [7:5]  */
432         uint32_t OSCE : 1;             /*!< [8] Oscillator Enable */
433         uint32_t CLKO : 1;             /*!< [9] Clock Output */
434         uint32_t SC16P : 1;            /*!< [10] Oscillator 16pF Load Configure */
435         uint32_t SC8P : 1;             /*!< [11] Oscillator 8pF Load Configure */
436         uint32_t SC4P : 1;             /*!< [12] Oscillator 4pF Load Configure */
437         uint32_t SC2P : 1;             /*!< [13] Oscillator 2pF Load Configure */
438         uint32_t RESERVED1 : 18;       /*!< [31:14]  */
439     } B;
440 } hw_rtc_cr_t;
441
442 /*!
443  * @name Constants and macros for entire RTC_CR register
444  */
445 /*@{*/
446 #define HW_RTC_CR_ADDR(x)        ((x) + 0x10U)
447
448 #define HW_RTC_CR(x)             (*(__IO hw_rtc_cr_t *) HW_RTC_CR_ADDR(x))
449 #define HW_RTC_CR_RD(x)          (HW_RTC_CR(x).U)
450 #define HW_RTC_CR_WR(x, v)       (HW_RTC_CR(x).U = (v))
451 #define HW_RTC_CR_SET(x, v)      (HW_RTC_CR_WR(x, HW_RTC_CR_RD(x) |  (v)))
452 #define HW_RTC_CR_CLR(x, v)      (HW_RTC_CR_WR(x, HW_RTC_CR_RD(x) & ~(v)))
453 #define HW_RTC_CR_TOG(x, v)      (HW_RTC_CR_WR(x, HW_RTC_CR_RD(x) ^  (v)))
454 /*@}*/
455
456 /*
457  * Constants & macros for individual RTC_CR bitfields
458  */
459
460 /*!
461  * @name Register RTC_CR, field SWR[0] (RW)
462  *
463  * Values:
464  * - 0 - No effect.
465  * - 1 - Resets all RTC registers except for the SWR bit and the RTC_WAR and
466  *     RTC_RAR registers . The SWR bit is cleared by VBAT POR and by software
467  *     explicitly clearing it.
468  */
469 /*@{*/
470 #define BP_RTC_CR_SWR        (0U)          /*!< Bit position for RTC_CR_SWR. */
471 #define BM_RTC_CR_SWR        (0x00000001U) /*!< Bit mask for RTC_CR_SWR. */
472 #define BS_RTC_CR_SWR        (1U)          /*!< Bit field size in bits for RTC_CR_SWR. */
473
474 /*! @brief Read current value of the RTC_CR_SWR field. */
475 #define BR_RTC_CR_SWR(x)     (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SWR))
476
477 /*! @brief Format value for bitfield RTC_CR_SWR. */
478 #define BF_RTC_CR_SWR(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_CR_SWR) & BM_RTC_CR_SWR)
479
480 /*! @brief Set the SWR field to a new value. */
481 #define BW_RTC_CR_SWR(x, v)  (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SWR) = (v))
482 /*@}*/
483
484 /*!
485  * @name Register RTC_CR, field WPE[1] (RW)
486  *
487  * The wakeup pin is optional and not available on all devices.
488  *
489  * Values:
490  * - 0 - Wakeup pin is disabled.
491  * - 1 - Wakeup pin is enabled and wakeup pin asserts if the RTC interrupt
492  *     asserts or the wakeup pin is turned on.
493  */
494 /*@{*/
495 #define BP_RTC_CR_WPE        (1U)          /*!< Bit position for RTC_CR_WPE. */
496 #define BM_RTC_CR_WPE        (0x00000002U) /*!< Bit mask for RTC_CR_WPE. */
497 #define BS_RTC_CR_WPE        (1U)          /*!< Bit field size in bits for RTC_CR_WPE. */
498
499 /*! @brief Read current value of the RTC_CR_WPE field. */
500 #define BR_RTC_CR_WPE(x)     (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_WPE))
501
502 /*! @brief Format value for bitfield RTC_CR_WPE. */
503 #define BF_RTC_CR_WPE(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_CR_WPE) & BM_RTC_CR_WPE)
504
505 /*! @brief Set the WPE field to a new value. */
506 #define BW_RTC_CR_WPE(x, v)  (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_WPE) = (v))
507 /*@}*/
508
509 /*!
510  * @name Register RTC_CR, field SUP[2] (RW)
511  *
512  * Values:
513  * - 0 - Non-supervisor mode write accesses are not supported and generate a bus
514  *     error.
515  * - 1 - Non-supervisor mode write accesses are supported.
516  */
517 /*@{*/
518 #define BP_RTC_CR_SUP        (2U)          /*!< Bit position for RTC_CR_SUP. */
519 #define BM_RTC_CR_SUP        (0x00000004U) /*!< Bit mask for RTC_CR_SUP. */
520 #define BS_RTC_CR_SUP        (1U)          /*!< Bit field size in bits for RTC_CR_SUP. */
521
522 /*! @brief Read current value of the RTC_CR_SUP field. */
523 #define BR_RTC_CR_SUP(x)     (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SUP))
524
525 /*! @brief Format value for bitfield RTC_CR_SUP. */
526 #define BF_RTC_CR_SUP(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_CR_SUP) & BM_RTC_CR_SUP)
527
528 /*! @brief Set the SUP field to a new value. */
529 #define BW_RTC_CR_SUP(x, v)  (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SUP) = (v))
530 /*@}*/
531
532 /*!
533  * @name Register RTC_CR, field UM[3] (RW)
534  *
535  * Allows SR[TCE] to be written even when the Status Register is locked. When
536  * set, the SR[TCE] can always be written if the SR[TIF] or SR[TOF] are set or if
537  * the SR[TCE] is clear.
538  *
539  * Values:
540  * - 0 - Registers cannot be written when locked.
541  * - 1 - Registers can be written when locked under limited conditions.
542  */
543 /*@{*/
544 #define BP_RTC_CR_UM         (3U)          /*!< Bit position for RTC_CR_UM. */
545 #define BM_RTC_CR_UM         (0x00000008U) /*!< Bit mask for RTC_CR_UM. */
546 #define BS_RTC_CR_UM         (1U)          /*!< Bit field size in bits for RTC_CR_UM. */
547
548 /*! @brief Read current value of the RTC_CR_UM field. */
549 #define BR_RTC_CR_UM(x)      (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_UM))
550
551 /*! @brief Format value for bitfield RTC_CR_UM. */
552 #define BF_RTC_CR_UM(v)      ((uint32_t)((uint32_t)(v) << BP_RTC_CR_UM) & BM_RTC_CR_UM)
553
554 /*! @brief Set the UM field to a new value. */
555 #define BW_RTC_CR_UM(x, v)   (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_UM) = (v))
556 /*@}*/
557
558 /*!
559  * @name Register RTC_CR, field WPS[4] (RW)
560  *
561  * The wakeup pin is optional and not available on all devices.
562  *
563  * Values:
564  * - 0 - Wakeup pin asserts (active low, open drain) if the RTC interrupt
565  *     asserts or the wakeup pin is turned on.
566  * - 1 - Wakeup pin instead outputs the RTC 32kHz clock, provided the wakeup pin
567  *     is turned on and the 32kHz clock is output to other peripherals.
568  */
569 /*@{*/
570 #define BP_RTC_CR_WPS        (4U)          /*!< Bit position for RTC_CR_WPS. */
571 #define BM_RTC_CR_WPS        (0x00000010U) /*!< Bit mask for RTC_CR_WPS. */
572 #define BS_RTC_CR_WPS        (1U)          /*!< Bit field size in bits for RTC_CR_WPS. */
573
574 /*! @brief Read current value of the RTC_CR_WPS field. */
575 #define BR_RTC_CR_WPS(x)     (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_WPS))
576
577 /*! @brief Format value for bitfield RTC_CR_WPS. */
578 #define BF_RTC_CR_WPS(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_CR_WPS) & BM_RTC_CR_WPS)
579
580 /*! @brief Set the WPS field to a new value. */
581 #define BW_RTC_CR_WPS(x, v)  (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_WPS) = (v))
582 /*@}*/
583
584 /*!
585  * @name Register RTC_CR, field OSCE[8] (RW)
586  *
587  * Values:
588  * - 0 - 32.768 kHz oscillator is disabled.
589  * - 1 - 32.768 kHz oscillator is enabled. After setting this bit, wait the
590  *     oscillator startup time before enabling the time counter to allow the 32.768
591  *     kHz clock time to stabilize.
592  */
593 /*@{*/
594 #define BP_RTC_CR_OSCE       (8U)          /*!< Bit position for RTC_CR_OSCE. */
595 #define BM_RTC_CR_OSCE       (0x00000100U) /*!< Bit mask for RTC_CR_OSCE. */
596 #define BS_RTC_CR_OSCE       (1U)          /*!< Bit field size in bits for RTC_CR_OSCE. */
597
598 /*! @brief Read current value of the RTC_CR_OSCE field. */
599 #define BR_RTC_CR_OSCE(x)    (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_OSCE))
600
601 /*! @brief Format value for bitfield RTC_CR_OSCE. */
602 #define BF_RTC_CR_OSCE(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_CR_OSCE) & BM_RTC_CR_OSCE)
603
604 /*! @brief Set the OSCE field to a new value. */
605 #define BW_RTC_CR_OSCE(x, v) (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_OSCE) = (v))
606 /*@}*/
607
608 /*!
609  * @name Register RTC_CR, field CLKO[9] (RW)
610  *
611  * Values:
612  * - 0 - The 32 kHz clock is output to other peripherals.
613  * - 1 - The 32 kHz clock is not output to other peripherals.
614  */
615 /*@{*/
616 #define BP_RTC_CR_CLKO       (9U)          /*!< Bit position for RTC_CR_CLKO. */
617 #define BM_RTC_CR_CLKO       (0x00000200U) /*!< Bit mask for RTC_CR_CLKO. */
618 #define BS_RTC_CR_CLKO       (1U)          /*!< Bit field size in bits for RTC_CR_CLKO. */
619
620 /*! @brief Read current value of the RTC_CR_CLKO field. */
621 #define BR_RTC_CR_CLKO(x)    (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_CLKO))
622
623 /*! @brief Format value for bitfield RTC_CR_CLKO. */
624 #define BF_RTC_CR_CLKO(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_CR_CLKO) & BM_RTC_CR_CLKO)
625
626 /*! @brief Set the CLKO field to a new value. */
627 #define BW_RTC_CR_CLKO(x, v) (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_CLKO) = (v))
628 /*@}*/
629
630 /*!
631  * @name Register RTC_CR, field SC16P[10] (RW)
632  *
633  * Values:
634  * - 0 - Disable the load.
635  * - 1 - Enable the additional load.
636  */
637 /*@{*/
638 #define BP_RTC_CR_SC16P      (10U)         /*!< Bit position for RTC_CR_SC16P. */
639 #define BM_RTC_CR_SC16P      (0x00000400U) /*!< Bit mask for RTC_CR_SC16P. */
640 #define BS_RTC_CR_SC16P      (1U)          /*!< Bit field size in bits for RTC_CR_SC16P. */
641
642 /*! @brief Read current value of the RTC_CR_SC16P field. */
643 #define BR_RTC_CR_SC16P(x)   (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SC16P))
644
645 /*! @brief Format value for bitfield RTC_CR_SC16P. */
646 #define BF_RTC_CR_SC16P(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_CR_SC16P) & BM_RTC_CR_SC16P)
647
648 /*! @brief Set the SC16P field to a new value. */
649 #define BW_RTC_CR_SC16P(x, v) (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SC16P) = (v))
650 /*@}*/
651
652 /*!
653  * @name Register RTC_CR, field SC8P[11] (RW)
654  *
655  * Values:
656  * - 0 - Disable the load.
657  * - 1 - Enable the additional load.
658  */
659 /*@{*/
660 #define BP_RTC_CR_SC8P       (11U)         /*!< Bit position for RTC_CR_SC8P. */
661 #define BM_RTC_CR_SC8P       (0x00000800U) /*!< Bit mask for RTC_CR_SC8P. */
662 #define BS_RTC_CR_SC8P       (1U)          /*!< Bit field size in bits for RTC_CR_SC8P. */
663
664 /*! @brief Read current value of the RTC_CR_SC8P field. */
665 #define BR_RTC_CR_SC8P(x)    (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SC8P))
666
667 /*! @brief Format value for bitfield RTC_CR_SC8P. */
668 #define BF_RTC_CR_SC8P(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_CR_SC8P) & BM_RTC_CR_SC8P)
669
670 /*! @brief Set the SC8P field to a new value. */
671 #define BW_RTC_CR_SC8P(x, v) (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SC8P) = (v))
672 /*@}*/
673
674 /*!
675  * @name Register RTC_CR, field SC4P[12] (RW)
676  *
677  * Values:
678  * - 0 - Disable the load.
679  * - 1 - Enable the additional load.
680  */
681 /*@{*/
682 #define BP_RTC_CR_SC4P       (12U)         /*!< Bit position for RTC_CR_SC4P. */
683 #define BM_RTC_CR_SC4P       (0x00001000U) /*!< Bit mask for RTC_CR_SC4P. */
684 #define BS_RTC_CR_SC4P       (1U)          /*!< Bit field size in bits for RTC_CR_SC4P. */
685
686 /*! @brief Read current value of the RTC_CR_SC4P field. */
687 #define BR_RTC_CR_SC4P(x)    (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SC4P))
688
689 /*! @brief Format value for bitfield RTC_CR_SC4P. */
690 #define BF_RTC_CR_SC4P(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_CR_SC4P) & BM_RTC_CR_SC4P)
691
692 /*! @brief Set the SC4P field to a new value. */
693 #define BW_RTC_CR_SC4P(x, v) (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SC4P) = (v))
694 /*@}*/
695
696 /*!
697  * @name Register RTC_CR, field SC2P[13] (RW)
698  *
699  * Values:
700  * - 0 - Disable the load.
701  * - 1 - Enable the additional load.
702  */
703 /*@{*/
704 #define BP_RTC_CR_SC2P       (13U)         /*!< Bit position for RTC_CR_SC2P. */
705 #define BM_RTC_CR_SC2P       (0x00002000U) /*!< Bit mask for RTC_CR_SC2P. */
706 #define BS_RTC_CR_SC2P       (1U)          /*!< Bit field size in bits for RTC_CR_SC2P. */
707
708 /*! @brief Read current value of the RTC_CR_SC2P field. */
709 #define BR_RTC_CR_SC2P(x)    (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SC2P))
710
711 /*! @brief Format value for bitfield RTC_CR_SC2P. */
712 #define BF_RTC_CR_SC2P(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_CR_SC2P) & BM_RTC_CR_SC2P)
713
714 /*! @brief Set the SC2P field to a new value. */
715 #define BW_RTC_CR_SC2P(x, v) (BITBAND_ACCESS32(HW_RTC_CR_ADDR(x), BP_RTC_CR_SC2P) = (v))
716 /*@}*/
717
718 /*******************************************************************************
719  * HW_RTC_SR - RTC Status Register
720  ******************************************************************************/
721
722 /*!
723  * @brief HW_RTC_SR - RTC Status Register (RW)
724  *
725  * Reset value: 0x00000001U
726  */
727 typedef union _hw_rtc_sr
728 {
729     uint32_t U;
730     struct _hw_rtc_sr_bitfields
731     {
732         uint32_t TIF : 1;              /*!< [0] Time Invalid Flag */
733         uint32_t TOF : 1;              /*!< [1] Time Overflow Flag */
734         uint32_t TAF : 1;              /*!< [2] Time Alarm Flag */
735         uint32_t RESERVED0 : 1;        /*!< [3]  */
736         uint32_t TCE : 1;              /*!< [4] Time Counter Enable */
737         uint32_t RESERVED1 : 27;       /*!< [31:5]  */
738     } B;
739 } hw_rtc_sr_t;
740
741 /*!
742  * @name Constants and macros for entire RTC_SR register
743  */
744 /*@{*/
745 #define HW_RTC_SR_ADDR(x)        ((x) + 0x14U)
746
747 #define HW_RTC_SR(x)             (*(__IO hw_rtc_sr_t *) HW_RTC_SR_ADDR(x))
748 #define HW_RTC_SR_RD(x)          (HW_RTC_SR(x).U)
749 #define HW_RTC_SR_WR(x, v)       (HW_RTC_SR(x).U = (v))
750 #define HW_RTC_SR_SET(x, v)      (HW_RTC_SR_WR(x, HW_RTC_SR_RD(x) |  (v)))
751 #define HW_RTC_SR_CLR(x, v)      (HW_RTC_SR_WR(x, HW_RTC_SR_RD(x) & ~(v)))
752 #define HW_RTC_SR_TOG(x, v)      (HW_RTC_SR_WR(x, HW_RTC_SR_RD(x) ^  (v)))
753 /*@}*/
754
755 /*
756  * Constants & macros for individual RTC_SR bitfields
757  */
758
759 /*!
760  * @name Register RTC_SR, field TIF[0] (RO)
761  *
762  * The time invalid flag is set on VBAT POR or software reset. The TSR and TPR
763  * do not increment and read as zero when this bit is set. This bit is cleared by
764  * writing the TSR register when the time counter is disabled.
765  *
766  * Values:
767  * - 0 - Time is valid.
768  * - 1 - Time is invalid and time counter is read as zero.
769  */
770 /*@{*/
771 #define BP_RTC_SR_TIF        (0U)          /*!< Bit position for RTC_SR_TIF. */
772 #define BM_RTC_SR_TIF        (0x00000001U) /*!< Bit mask for RTC_SR_TIF. */
773 #define BS_RTC_SR_TIF        (1U)          /*!< Bit field size in bits for RTC_SR_TIF. */
774
775 /*! @brief Read current value of the RTC_SR_TIF field. */
776 #define BR_RTC_SR_TIF(x)     (BITBAND_ACCESS32(HW_RTC_SR_ADDR(x), BP_RTC_SR_TIF))
777 /*@}*/
778
779 /*!
780  * @name Register RTC_SR, field TOF[1] (RO)
781  *
782  * Time overflow flag is set when the time counter is enabled and overflows. The
783  * TSR and TPR do not increment and read as zero when this bit is set. This bit
784  * is cleared by writing the TSR register when the time counter is disabled.
785  *
786  * Values:
787  * - 0 - Time overflow has not occurred.
788  * - 1 - Time overflow has occurred and time counter is read as zero.
789  */
790 /*@{*/
791 #define BP_RTC_SR_TOF        (1U)          /*!< Bit position for RTC_SR_TOF. */
792 #define BM_RTC_SR_TOF        (0x00000002U) /*!< Bit mask for RTC_SR_TOF. */
793 #define BS_RTC_SR_TOF        (1U)          /*!< Bit field size in bits for RTC_SR_TOF. */
794
795 /*! @brief Read current value of the RTC_SR_TOF field. */
796 #define BR_RTC_SR_TOF(x)     (BITBAND_ACCESS32(HW_RTC_SR_ADDR(x), BP_RTC_SR_TOF))
797 /*@}*/
798
799 /*!
800  * @name Register RTC_SR, field TAF[2] (RO)
801  *
802  * Time alarm flag is set when the TAR[TAR] equals the TSR[TSR] and the TSR[TSR]
803  * increments. This bit is cleared by writing the TAR register.
804  *
805  * Values:
806  * - 0 - Time alarm has not occurred.
807  * - 1 - Time alarm has occurred.
808  */
809 /*@{*/
810 #define BP_RTC_SR_TAF        (2U)          /*!< Bit position for RTC_SR_TAF. */
811 #define BM_RTC_SR_TAF        (0x00000004U) /*!< Bit mask for RTC_SR_TAF. */
812 #define BS_RTC_SR_TAF        (1U)          /*!< Bit field size in bits for RTC_SR_TAF. */
813
814 /*! @brief Read current value of the RTC_SR_TAF field. */
815 #define BR_RTC_SR_TAF(x)     (BITBAND_ACCESS32(HW_RTC_SR_ADDR(x), BP_RTC_SR_TAF))
816 /*@}*/
817
818 /*!
819  * @name Register RTC_SR, field TCE[4] (RW)
820  *
821  * When time counter is disabled the TSR register and TPR register are
822  * writeable, but do not increment. When time counter is enabled the TSR register and TPR
823  * register are not writeable, but increment.
824  *
825  * Values:
826  * - 0 - Time counter is disabled.
827  * - 1 - Time counter is enabled.
828  */
829 /*@{*/
830 #define BP_RTC_SR_TCE        (4U)          /*!< Bit position for RTC_SR_TCE. */
831 #define BM_RTC_SR_TCE        (0x00000010U) /*!< Bit mask for RTC_SR_TCE. */
832 #define BS_RTC_SR_TCE        (1U)          /*!< Bit field size in bits for RTC_SR_TCE. */
833
834 /*! @brief Read current value of the RTC_SR_TCE field. */
835 #define BR_RTC_SR_TCE(x)     (BITBAND_ACCESS32(HW_RTC_SR_ADDR(x), BP_RTC_SR_TCE))
836
837 /*! @brief Format value for bitfield RTC_SR_TCE. */
838 #define BF_RTC_SR_TCE(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_SR_TCE) & BM_RTC_SR_TCE)
839
840 /*! @brief Set the TCE field to a new value. */
841 #define BW_RTC_SR_TCE(x, v)  (BITBAND_ACCESS32(HW_RTC_SR_ADDR(x), BP_RTC_SR_TCE) = (v))
842 /*@}*/
843
844 /*******************************************************************************
845  * HW_RTC_LR - RTC Lock Register
846  ******************************************************************************/
847
848 /*!
849  * @brief HW_RTC_LR - RTC Lock Register (RW)
850  *
851  * Reset value: 0x000000FFU
852  */
853 typedef union _hw_rtc_lr
854 {
855     uint32_t U;
856     struct _hw_rtc_lr_bitfields
857     {
858         uint32_t RESERVED0 : 3;        /*!< [2:0]  */
859         uint32_t TCL : 1;              /*!< [3] Time Compensation Lock */
860         uint32_t CRL : 1;              /*!< [4] Control Register Lock */
861         uint32_t SRL : 1;              /*!< [5] Status Register Lock */
862         uint32_t LRL : 1;              /*!< [6] Lock Register Lock */
863         uint32_t RESERVED1 : 25;       /*!< [31:7]  */
864     } B;
865 } hw_rtc_lr_t;
866
867 /*!
868  * @name Constants and macros for entire RTC_LR register
869  */
870 /*@{*/
871 #define HW_RTC_LR_ADDR(x)        ((x) + 0x18U)
872
873 #define HW_RTC_LR(x)             (*(__IO hw_rtc_lr_t *) HW_RTC_LR_ADDR(x))
874 #define HW_RTC_LR_RD(x)          (HW_RTC_LR(x).U)
875 #define HW_RTC_LR_WR(x, v)       (HW_RTC_LR(x).U = (v))
876 #define HW_RTC_LR_SET(x, v)      (HW_RTC_LR_WR(x, HW_RTC_LR_RD(x) |  (v)))
877 #define HW_RTC_LR_CLR(x, v)      (HW_RTC_LR_WR(x, HW_RTC_LR_RD(x) & ~(v)))
878 #define HW_RTC_LR_TOG(x, v)      (HW_RTC_LR_WR(x, HW_RTC_LR_RD(x) ^  (v)))
879 /*@}*/
880
881 /*
882  * Constants & macros for individual RTC_LR bitfields
883  */
884
885 /*!
886  * @name Register RTC_LR, field TCL[3] (RW)
887  *
888  * After being cleared, this bit can be set only by VBAT POR or software reset.
889  *
890  * Values:
891  * - 0 - Time Compensation Register is locked and writes are ignored.
892  * - 1 - Time Compensation Register is not locked and writes complete as normal.
893  */
894 /*@{*/
895 #define BP_RTC_LR_TCL        (3U)          /*!< Bit position for RTC_LR_TCL. */
896 #define BM_RTC_LR_TCL        (0x00000008U) /*!< Bit mask for RTC_LR_TCL. */
897 #define BS_RTC_LR_TCL        (1U)          /*!< Bit field size in bits for RTC_LR_TCL. */
898
899 /*! @brief Read current value of the RTC_LR_TCL field. */
900 #define BR_RTC_LR_TCL(x)     (BITBAND_ACCESS32(HW_RTC_LR_ADDR(x), BP_RTC_LR_TCL))
901
902 /*! @brief Format value for bitfield RTC_LR_TCL. */
903 #define BF_RTC_LR_TCL(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_LR_TCL) & BM_RTC_LR_TCL)
904
905 /*! @brief Set the TCL field to a new value. */
906 #define BW_RTC_LR_TCL(x, v)  (BITBAND_ACCESS32(HW_RTC_LR_ADDR(x), BP_RTC_LR_TCL) = (v))
907 /*@}*/
908
909 /*!
910  * @name Register RTC_LR, field CRL[4] (RW)
911  *
912  * After being cleared, this bit can only be set by VBAT POR.
913  *
914  * Values:
915  * - 0 - Control Register is locked and writes are ignored.
916  * - 1 - Control Register is not locked and writes complete as normal.
917  */
918 /*@{*/
919 #define BP_RTC_LR_CRL        (4U)          /*!< Bit position for RTC_LR_CRL. */
920 #define BM_RTC_LR_CRL        (0x00000010U) /*!< Bit mask for RTC_LR_CRL. */
921 #define BS_RTC_LR_CRL        (1U)          /*!< Bit field size in bits for RTC_LR_CRL. */
922
923 /*! @brief Read current value of the RTC_LR_CRL field. */
924 #define BR_RTC_LR_CRL(x)     (BITBAND_ACCESS32(HW_RTC_LR_ADDR(x), BP_RTC_LR_CRL))
925
926 /*! @brief Format value for bitfield RTC_LR_CRL. */
927 #define BF_RTC_LR_CRL(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_LR_CRL) & BM_RTC_LR_CRL)
928
929 /*! @brief Set the CRL field to a new value. */
930 #define BW_RTC_LR_CRL(x, v)  (BITBAND_ACCESS32(HW_RTC_LR_ADDR(x), BP_RTC_LR_CRL) = (v))
931 /*@}*/
932
933 /*!
934  * @name Register RTC_LR, field SRL[5] (RW)
935  *
936  * After being cleared, this bit can be set only by VBAT POR or software reset.
937  *
938  * Values:
939  * - 0 - Status Register is locked and writes are ignored.
940  * - 1 - Status Register is not locked and writes complete as normal.
941  */
942 /*@{*/
943 #define BP_RTC_LR_SRL        (5U)          /*!< Bit position for RTC_LR_SRL. */
944 #define BM_RTC_LR_SRL        (0x00000020U) /*!< Bit mask for RTC_LR_SRL. */
945 #define BS_RTC_LR_SRL        (1U)          /*!< Bit field size in bits for RTC_LR_SRL. */
946
947 /*! @brief Read current value of the RTC_LR_SRL field. */
948 #define BR_RTC_LR_SRL(x)     (BITBAND_ACCESS32(HW_RTC_LR_ADDR(x), BP_RTC_LR_SRL))
949
950 /*! @brief Format value for bitfield RTC_LR_SRL. */
951 #define BF_RTC_LR_SRL(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_LR_SRL) & BM_RTC_LR_SRL)
952
953 /*! @brief Set the SRL field to a new value. */
954 #define BW_RTC_LR_SRL(x, v)  (BITBAND_ACCESS32(HW_RTC_LR_ADDR(x), BP_RTC_LR_SRL) = (v))
955 /*@}*/
956
957 /*!
958  * @name Register RTC_LR, field LRL[6] (RW)
959  *
960  * After being cleared, this bit can be set only by VBAT POR or software reset.
961  *
962  * Values:
963  * - 0 - Lock Register is locked and writes are ignored.
964  * - 1 - Lock Register is not locked and writes complete as normal.
965  */
966 /*@{*/
967 #define BP_RTC_LR_LRL        (6U)          /*!< Bit position for RTC_LR_LRL. */
968 #define BM_RTC_LR_LRL        (0x00000040U) /*!< Bit mask for RTC_LR_LRL. */
969 #define BS_RTC_LR_LRL        (1U)          /*!< Bit field size in bits for RTC_LR_LRL. */
970
971 /*! @brief Read current value of the RTC_LR_LRL field. */
972 #define BR_RTC_LR_LRL(x)     (BITBAND_ACCESS32(HW_RTC_LR_ADDR(x), BP_RTC_LR_LRL))
973
974 /*! @brief Format value for bitfield RTC_LR_LRL. */
975 #define BF_RTC_LR_LRL(v)     ((uint32_t)((uint32_t)(v) << BP_RTC_LR_LRL) & BM_RTC_LR_LRL)
976
977 /*! @brief Set the LRL field to a new value. */
978 #define BW_RTC_LR_LRL(x, v)  (BITBAND_ACCESS32(HW_RTC_LR_ADDR(x), BP_RTC_LR_LRL) = (v))
979 /*@}*/
980
981 /*******************************************************************************
982  * HW_RTC_IER - RTC Interrupt Enable Register
983  ******************************************************************************/
984
985 /*!
986  * @brief HW_RTC_IER - RTC Interrupt Enable Register (RW)
987  *
988  * Reset value: 0x00000007U
989  */
990 typedef union _hw_rtc_ier
991 {
992     uint32_t U;
993     struct _hw_rtc_ier_bitfields
994     {
995         uint32_t TIIE : 1;             /*!< [0] Time Invalid Interrupt Enable */
996         uint32_t TOIE : 1;             /*!< [1] Time Overflow Interrupt Enable */
997         uint32_t TAIE : 1;             /*!< [2] Time Alarm Interrupt Enable */
998         uint32_t RESERVED0 : 1;        /*!< [3]  */
999         uint32_t TSIE : 1;             /*!< [4] Time Seconds Interrupt Enable */
1000         uint32_t RESERVED1 : 2;        /*!< [6:5]  */
1001         uint32_t WPON : 1;             /*!< [7] Wakeup Pin On */
1002         uint32_t RESERVED2 : 24;       /*!< [31:8]  */
1003     } B;
1004 } hw_rtc_ier_t;
1005
1006 /*!
1007  * @name Constants and macros for entire RTC_IER register
1008  */
1009 /*@{*/
1010 #define HW_RTC_IER_ADDR(x)       ((x) + 0x1CU)
1011
1012 #define HW_RTC_IER(x)            (*(__IO hw_rtc_ier_t *) HW_RTC_IER_ADDR(x))
1013 #define HW_RTC_IER_RD(x)         (HW_RTC_IER(x).U)
1014 #define HW_RTC_IER_WR(x, v)      (HW_RTC_IER(x).U = (v))
1015 #define HW_RTC_IER_SET(x, v)     (HW_RTC_IER_WR(x, HW_RTC_IER_RD(x) |  (v)))
1016 #define HW_RTC_IER_CLR(x, v)     (HW_RTC_IER_WR(x, HW_RTC_IER_RD(x) & ~(v)))
1017 #define HW_RTC_IER_TOG(x, v)     (HW_RTC_IER_WR(x, HW_RTC_IER_RD(x) ^  (v)))
1018 /*@}*/
1019
1020 /*
1021  * Constants & macros for individual RTC_IER bitfields
1022  */
1023
1024 /*!
1025  * @name Register RTC_IER, field TIIE[0] (RW)
1026  *
1027  * Values:
1028  * - 0 - Time invalid flag does not generate an interrupt.
1029  * - 1 - Time invalid flag does generate an interrupt.
1030  */
1031 /*@{*/
1032 #define BP_RTC_IER_TIIE      (0U)          /*!< Bit position for RTC_IER_TIIE. */
1033 #define BM_RTC_IER_TIIE      (0x00000001U) /*!< Bit mask for RTC_IER_TIIE. */
1034 #define BS_RTC_IER_TIIE      (1U)          /*!< Bit field size in bits for RTC_IER_TIIE. */
1035
1036 /*! @brief Read current value of the RTC_IER_TIIE field. */
1037 #define BR_RTC_IER_TIIE(x)   (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_TIIE))
1038
1039 /*! @brief Format value for bitfield RTC_IER_TIIE. */
1040 #define BF_RTC_IER_TIIE(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_IER_TIIE) & BM_RTC_IER_TIIE)
1041
1042 /*! @brief Set the TIIE field to a new value. */
1043 #define BW_RTC_IER_TIIE(x, v) (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_TIIE) = (v))
1044 /*@}*/
1045
1046 /*!
1047  * @name Register RTC_IER, field TOIE[1] (RW)
1048  *
1049  * Values:
1050  * - 0 - Time overflow flag does not generate an interrupt.
1051  * - 1 - Time overflow flag does generate an interrupt.
1052  */
1053 /*@{*/
1054 #define BP_RTC_IER_TOIE      (1U)          /*!< Bit position for RTC_IER_TOIE. */
1055 #define BM_RTC_IER_TOIE      (0x00000002U) /*!< Bit mask for RTC_IER_TOIE. */
1056 #define BS_RTC_IER_TOIE      (1U)          /*!< Bit field size in bits for RTC_IER_TOIE. */
1057
1058 /*! @brief Read current value of the RTC_IER_TOIE field. */
1059 #define BR_RTC_IER_TOIE(x)   (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_TOIE))
1060
1061 /*! @brief Format value for bitfield RTC_IER_TOIE. */
1062 #define BF_RTC_IER_TOIE(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_IER_TOIE) & BM_RTC_IER_TOIE)
1063
1064 /*! @brief Set the TOIE field to a new value. */
1065 #define BW_RTC_IER_TOIE(x, v) (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_TOIE) = (v))
1066 /*@}*/
1067
1068 /*!
1069  * @name Register RTC_IER, field TAIE[2] (RW)
1070  *
1071  * Values:
1072  * - 0 - Time alarm flag does not generate an interrupt.
1073  * - 1 - Time alarm flag does generate an interrupt.
1074  */
1075 /*@{*/
1076 #define BP_RTC_IER_TAIE      (2U)          /*!< Bit position for RTC_IER_TAIE. */
1077 #define BM_RTC_IER_TAIE      (0x00000004U) /*!< Bit mask for RTC_IER_TAIE. */
1078 #define BS_RTC_IER_TAIE      (1U)          /*!< Bit field size in bits for RTC_IER_TAIE. */
1079
1080 /*! @brief Read current value of the RTC_IER_TAIE field. */
1081 #define BR_RTC_IER_TAIE(x)   (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_TAIE))
1082
1083 /*! @brief Format value for bitfield RTC_IER_TAIE. */
1084 #define BF_RTC_IER_TAIE(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_IER_TAIE) & BM_RTC_IER_TAIE)
1085
1086 /*! @brief Set the TAIE field to a new value. */
1087 #define BW_RTC_IER_TAIE(x, v) (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_TAIE) = (v))
1088 /*@}*/
1089
1090 /*!
1091  * @name Register RTC_IER, field TSIE[4] (RW)
1092  *
1093  * The seconds interrupt is an edge-sensitive interrupt with a dedicated
1094  * interrupt vector. It is generated once a second and requires no software overhead
1095  * (there is no corresponding status flag to clear).
1096  *
1097  * Values:
1098  * - 0 - Seconds interrupt is disabled.
1099  * - 1 - Seconds interrupt is enabled.
1100  */
1101 /*@{*/
1102 #define BP_RTC_IER_TSIE      (4U)          /*!< Bit position for RTC_IER_TSIE. */
1103 #define BM_RTC_IER_TSIE      (0x00000010U) /*!< Bit mask for RTC_IER_TSIE. */
1104 #define BS_RTC_IER_TSIE      (1U)          /*!< Bit field size in bits for RTC_IER_TSIE. */
1105
1106 /*! @brief Read current value of the RTC_IER_TSIE field. */
1107 #define BR_RTC_IER_TSIE(x)   (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_TSIE))
1108
1109 /*! @brief Format value for bitfield RTC_IER_TSIE. */
1110 #define BF_RTC_IER_TSIE(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_IER_TSIE) & BM_RTC_IER_TSIE)
1111
1112 /*! @brief Set the TSIE field to a new value. */
1113 #define BW_RTC_IER_TSIE(x, v) (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_TSIE) = (v))
1114 /*@}*/
1115
1116 /*!
1117  * @name Register RTC_IER, field WPON[7] (RW)
1118  *
1119  * The wakeup pin is optional and not available on all devices. Whenever the
1120  * wakeup pin is enabled and this bit is set, the wakeup pin will assert.
1121  *
1122  * Values:
1123  * - 0 - No effect.
1124  * - 1 - If the wakeup pin is enabled, then the wakeup pin will assert.
1125  */
1126 /*@{*/
1127 #define BP_RTC_IER_WPON      (7U)          /*!< Bit position for RTC_IER_WPON. */
1128 #define BM_RTC_IER_WPON      (0x00000080U) /*!< Bit mask for RTC_IER_WPON. */
1129 #define BS_RTC_IER_WPON      (1U)          /*!< Bit field size in bits for RTC_IER_WPON. */
1130
1131 /*! @brief Read current value of the RTC_IER_WPON field. */
1132 #define BR_RTC_IER_WPON(x)   (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_WPON))
1133
1134 /*! @brief Format value for bitfield RTC_IER_WPON. */
1135 #define BF_RTC_IER_WPON(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_IER_WPON) & BM_RTC_IER_WPON)
1136
1137 /*! @brief Set the WPON field to a new value. */
1138 #define BW_RTC_IER_WPON(x, v) (BITBAND_ACCESS32(HW_RTC_IER_ADDR(x), BP_RTC_IER_WPON) = (v))
1139 /*@}*/
1140
1141 /*******************************************************************************
1142  * HW_RTC_WAR - RTC Write Access Register
1143  ******************************************************************************/
1144
1145 /*!
1146  * @brief HW_RTC_WAR - RTC Write Access Register (RW)
1147  *
1148  * Reset value: 0x000000FFU
1149  */
1150 typedef union _hw_rtc_war
1151 {
1152     uint32_t U;
1153     struct _hw_rtc_war_bitfields
1154     {
1155         uint32_t TSRW : 1;             /*!< [0] Time Seconds Register Write */
1156         uint32_t TPRW : 1;             /*!< [1] Time Prescaler Register Write */
1157         uint32_t TARW : 1;             /*!< [2] Time Alarm Register Write */
1158         uint32_t TCRW : 1;             /*!< [3] Time Compensation Register Write */
1159         uint32_t CRW : 1;              /*!< [4] Control Register Write */
1160         uint32_t SRW : 1;              /*!< [5] Status Register Write */
1161         uint32_t LRW : 1;              /*!< [6] Lock Register Write */
1162         uint32_t IERW : 1;             /*!< [7] Interrupt Enable Register Write */
1163         uint32_t RESERVED0 : 24;       /*!< [31:8]  */
1164     } B;
1165 } hw_rtc_war_t;
1166
1167 /*!
1168  * @name Constants and macros for entire RTC_WAR register
1169  */
1170 /*@{*/
1171 #define HW_RTC_WAR_ADDR(x)       ((x) + 0x800U)
1172
1173 #define HW_RTC_WAR(x)            (*(__IO hw_rtc_war_t *) HW_RTC_WAR_ADDR(x))
1174 #define HW_RTC_WAR_RD(x)         (HW_RTC_WAR(x).U)
1175 #define HW_RTC_WAR_WR(x, v)      (HW_RTC_WAR(x).U = (v))
1176 #define HW_RTC_WAR_SET(x, v)     (HW_RTC_WAR_WR(x, HW_RTC_WAR_RD(x) |  (v)))
1177 #define HW_RTC_WAR_CLR(x, v)     (HW_RTC_WAR_WR(x, HW_RTC_WAR_RD(x) & ~(v)))
1178 #define HW_RTC_WAR_TOG(x, v)     (HW_RTC_WAR_WR(x, HW_RTC_WAR_RD(x) ^  (v)))
1179 /*@}*/
1180
1181 /*
1182  * Constants & macros for individual RTC_WAR bitfields
1183  */
1184
1185 /*!
1186  * @name Register RTC_WAR, field TSRW[0] (RW)
1187  *
1188  * After being cleared, this bit is set only by system reset. It is not affected
1189  * by VBAT POR or software reset.
1190  *
1191  * Values:
1192  * - 0 - Writes to the Time Seconds Register are ignored.
1193  * - 1 - Writes to the Time Seconds Register complete as normal.
1194  */
1195 /*@{*/
1196 #define BP_RTC_WAR_TSRW      (0U)          /*!< Bit position for RTC_WAR_TSRW. */
1197 #define BM_RTC_WAR_TSRW      (0x00000001U) /*!< Bit mask for RTC_WAR_TSRW. */
1198 #define BS_RTC_WAR_TSRW      (1U)          /*!< Bit field size in bits for RTC_WAR_TSRW. */
1199
1200 /*! @brief Read current value of the RTC_WAR_TSRW field. */
1201 #define BR_RTC_WAR_TSRW(x)   (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_TSRW))
1202
1203 /*! @brief Format value for bitfield RTC_WAR_TSRW. */
1204 #define BF_RTC_WAR_TSRW(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_WAR_TSRW) & BM_RTC_WAR_TSRW)
1205
1206 /*! @brief Set the TSRW field to a new value. */
1207 #define BW_RTC_WAR_TSRW(x, v) (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_TSRW) = (v))
1208 /*@}*/
1209
1210 /*!
1211  * @name Register RTC_WAR, field TPRW[1] (RW)
1212  *
1213  * After being cleared, this bit is set only by system reset. It is not affected
1214  * by VBAT POR or software reset.
1215  *
1216  * Values:
1217  * - 0 - Writes to the Time Prescaler Register are ignored.
1218  * - 1 - Writes to the Time Prescaler Register complete as normal.
1219  */
1220 /*@{*/
1221 #define BP_RTC_WAR_TPRW      (1U)          /*!< Bit position for RTC_WAR_TPRW. */
1222 #define BM_RTC_WAR_TPRW      (0x00000002U) /*!< Bit mask for RTC_WAR_TPRW. */
1223 #define BS_RTC_WAR_TPRW      (1U)          /*!< Bit field size in bits for RTC_WAR_TPRW. */
1224
1225 /*! @brief Read current value of the RTC_WAR_TPRW field. */
1226 #define BR_RTC_WAR_TPRW(x)   (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_TPRW))
1227
1228 /*! @brief Format value for bitfield RTC_WAR_TPRW. */
1229 #define BF_RTC_WAR_TPRW(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_WAR_TPRW) & BM_RTC_WAR_TPRW)
1230
1231 /*! @brief Set the TPRW field to a new value. */
1232 #define BW_RTC_WAR_TPRW(x, v) (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_TPRW) = (v))
1233 /*@}*/
1234
1235 /*!
1236  * @name Register RTC_WAR, field TARW[2] (RW)
1237  *
1238  * After being cleared, this bit is set only by system reset. It is not affected
1239  * by VBAT POR or software reset.
1240  *
1241  * Values:
1242  * - 0 - Writes to the Time Alarm Register are ignored.
1243  * - 1 - Writes to the Time Alarm Register complete as normal.
1244  */
1245 /*@{*/
1246 #define BP_RTC_WAR_TARW      (2U)          /*!< Bit position for RTC_WAR_TARW. */
1247 #define BM_RTC_WAR_TARW      (0x00000004U) /*!< Bit mask for RTC_WAR_TARW. */
1248 #define BS_RTC_WAR_TARW      (1U)          /*!< Bit field size in bits for RTC_WAR_TARW. */
1249
1250 /*! @brief Read current value of the RTC_WAR_TARW field. */
1251 #define BR_RTC_WAR_TARW(x)   (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_TARW))
1252
1253 /*! @brief Format value for bitfield RTC_WAR_TARW. */
1254 #define BF_RTC_WAR_TARW(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_WAR_TARW) & BM_RTC_WAR_TARW)
1255
1256 /*! @brief Set the TARW field to a new value. */
1257 #define BW_RTC_WAR_TARW(x, v) (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_TARW) = (v))
1258 /*@}*/
1259
1260 /*!
1261  * @name Register RTC_WAR, field TCRW[3] (RW)
1262  *
1263  * After being cleared, this bit is set only by system reset. It is not affected
1264  * by VBAT POR or software reset.
1265  *
1266  * Values:
1267  * - 0 - Writes to the Time Compensation Register are ignored.
1268  * - 1 - Writes to the Time Compensation Register complete as normal.
1269  */
1270 /*@{*/
1271 #define BP_RTC_WAR_TCRW      (3U)          /*!< Bit position for RTC_WAR_TCRW. */
1272 #define BM_RTC_WAR_TCRW      (0x00000008U) /*!< Bit mask for RTC_WAR_TCRW. */
1273 #define BS_RTC_WAR_TCRW      (1U)          /*!< Bit field size in bits for RTC_WAR_TCRW. */
1274
1275 /*! @brief Read current value of the RTC_WAR_TCRW field. */
1276 #define BR_RTC_WAR_TCRW(x)   (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_TCRW))
1277
1278 /*! @brief Format value for bitfield RTC_WAR_TCRW. */
1279 #define BF_RTC_WAR_TCRW(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_WAR_TCRW) & BM_RTC_WAR_TCRW)
1280
1281 /*! @brief Set the TCRW field to a new value. */
1282 #define BW_RTC_WAR_TCRW(x, v) (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_TCRW) = (v))
1283 /*@}*/
1284
1285 /*!
1286  * @name Register RTC_WAR, field CRW[4] (RW)
1287  *
1288  * After being cleared, this bit is set only by system reset. It is not affected
1289  * by VBAT POR or software reset.
1290  *
1291  * Values:
1292  * - 0 - Writes to the Control Register are ignored.
1293  * - 1 - Writes to the Control Register complete as normal.
1294  */
1295 /*@{*/
1296 #define BP_RTC_WAR_CRW       (4U)          /*!< Bit position for RTC_WAR_CRW. */
1297 #define BM_RTC_WAR_CRW       (0x00000010U) /*!< Bit mask for RTC_WAR_CRW. */
1298 #define BS_RTC_WAR_CRW       (1U)          /*!< Bit field size in bits for RTC_WAR_CRW. */
1299
1300 /*! @brief Read current value of the RTC_WAR_CRW field. */
1301 #define BR_RTC_WAR_CRW(x)    (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_CRW))
1302
1303 /*! @brief Format value for bitfield RTC_WAR_CRW. */
1304 #define BF_RTC_WAR_CRW(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_WAR_CRW) & BM_RTC_WAR_CRW)
1305
1306 /*! @brief Set the CRW field to a new value. */
1307 #define BW_RTC_WAR_CRW(x, v) (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_CRW) = (v))
1308 /*@}*/
1309
1310 /*!
1311  * @name Register RTC_WAR, field SRW[5] (RW)
1312  *
1313  * After being cleared, this bit is set only by system reset. It is not affected
1314  * by VBAT POR or software reset.
1315  *
1316  * Values:
1317  * - 0 - Writes to the Status Register are ignored.
1318  * - 1 - Writes to the Status Register complete as normal.
1319  */
1320 /*@{*/
1321 #define BP_RTC_WAR_SRW       (5U)          /*!< Bit position for RTC_WAR_SRW. */
1322 #define BM_RTC_WAR_SRW       (0x00000020U) /*!< Bit mask for RTC_WAR_SRW. */
1323 #define BS_RTC_WAR_SRW       (1U)          /*!< Bit field size in bits for RTC_WAR_SRW. */
1324
1325 /*! @brief Read current value of the RTC_WAR_SRW field. */
1326 #define BR_RTC_WAR_SRW(x)    (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_SRW))
1327
1328 /*! @brief Format value for bitfield RTC_WAR_SRW. */
1329 #define BF_RTC_WAR_SRW(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_WAR_SRW) & BM_RTC_WAR_SRW)
1330
1331 /*! @brief Set the SRW field to a new value. */
1332 #define BW_RTC_WAR_SRW(x, v) (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_SRW) = (v))
1333 /*@}*/
1334
1335 /*!
1336  * @name Register RTC_WAR, field LRW[6] (RW)
1337  *
1338  * After being cleared, this bit is set only by system reset. It is not affected
1339  * by VBAT POR or software reset.
1340  *
1341  * Values:
1342  * - 0 - Writes to the Lock Register are ignored.
1343  * - 1 - Writes to the Lock Register complete as normal.
1344  */
1345 /*@{*/
1346 #define BP_RTC_WAR_LRW       (6U)          /*!< Bit position for RTC_WAR_LRW. */
1347 #define BM_RTC_WAR_LRW       (0x00000040U) /*!< Bit mask for RTC_WAR_LRW. */
1348 #define BS_RTC_WAR_LRW       (1U)          /*!< Bit field size in bits for RTC_WAR_LRW. */
1349
1350 /*! @brief Read current value of the RTC_WAR_LRW field. */
1351 #define BR_RTC_WAR_LRW(x)    (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_LRW))
1352
1353 /*! @brief Format value for bitfield RTC_WAR_LRW. */
1354 #define BF_RTC_WAR_LRW(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_WAR_LRW) & BM_RTC_WAR_LRW)
1355
1356 /*! @brief Set the LRW field to a new value. */
1357 #define BW_RTC_WAR_LRW(x, v) (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_LRW) = (v))
1358 /*@}*/
1359
1360 /*!
1361  * @name Register RTC_WAR, field IERW[7] (RW)
1362  *
1363  * After being cleared, this bit is set only by system reset. It is not affected
1364  * by VBAT POR or software reset.
1365  *
1366  * Values:
1367  * - 0 - Writes to the Interupt Enable Register are ignored.
1368  * - 1 - Writes to the Interrupt Enable Register complete as normal.
1369  */
1370 /*@{*/
1371 #define BP_RTC_WAR_IERW      (7U)          /*!< Bit position for RTC_WAR_IERW. */
1372 #define BM_RTC_WAR_IERW      (0x00000080U) /*!< Bit mask for RTC_WAR_IERW. */
1373 #define BS_RTC_WAR_IERW      (1U)          /*!< Bit field size in bits for RTC_WAR_IERW. */
1374
1375 /*! @brief Read current value of the RTC_WAR_IERW field. */
1376 #define BR_RTC_WAR_IERW(x)   (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_IERW))
1377
1378 /*! @brief Format value for bitfield RTC_WAR_IERW. */
1379 #define BF_RTC_WAR_IERW(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_WAR_IERW) & BM_RTC_WAR_IERW)
1380
1381 /*! @brief Set the IERW field to a new value. */
1382 #define BW_RTC_WAR_IERW(x, v) (BITBAND_ACCESS32(HW_RTC_WAR_ADDR(x), BP_RTC_WAR_IERW) = (v))
1383 /*@}*/
1384
1385 /*******************************************************************************
1386  * HW_RTC_RAR - RTC Read Access Register
1387  ******************************************************************************/
1388
1389 /*!
1390  * @brief HW_RTC_RAR - RTC Read Access Register (RW)
1391  *
1392  * Reset value: 0x000000FFU
1393  */
1394 typedef union _hw_rtc_rar
1395 {
1396     uint32_t U;
1397     struct _hw_rtc_rar_bitfields
1398     {
1399         uint32_t TSRR : 1;             /*!< [0] Time Seconds Register Read */
1400         uint32_t TPRR : 1;             /*!< [1] Time Prescaler Register Read */
1401         uint32_t TARR : 1;             /*!< [2] Time Alarm Register Read */
1402         uint32_t TCRR : 1;             /*!< [3] Time Compensation Register Read */
1403         uint32_t CRR : 1;              /*!< [4] Control Register Read */
1404         uint32_t SRR : 1;              /*!< [5] Status Register Read */
1405         uint32_t LRR : 1;              /*!< [6] Lock Register Read */
1406         uint32_t IERR : 1;             /*!< [7] Interrupt Enable Register Read */
1407         uint32_t RESERVED0 : 24;       /*!< [31:8]  */
1408     } B;
1409 } hw_rtc_rar_t;
1410
1411 /*!
1412  * @name Constants and macros for entire RTC_RAR register
1413  */
1414 /*@{*/
1415 #define HW_RTC_RAR_ADDR(x)       ((x) + 0x804U)
1416
1417 #define HW_RTC_RAR(x)            (*(__IO hw_rtc_rar_t *) HW_RTC_RAR_ADDR(x))
1418 #define HW_RTC_RAR_RD(x)         (HW_RTC_RAR(x).U)
1419 #define HW_RTC_RAR_WR(x, v)      (HW_RTC_RAR(x).U = (v))
1420 #define HW_RTC_RAR_SET(x, v)     (HW_RTC_RAR_WR(x, HW_RTC_RAR_RD(x) |  (v)))
1421 #define HW_RTC_RAR_CLR(x, v)     (HW_RTC_RAR_WR(x, HW_RTC_RAR_RD(x) & ~(v)))
1422 #define HW_RTC_RAR_TOG(x, v)     (HW_RTC_RAR_WR(x, HW_RTC_RAR_RD(x) ^  (v)))
1423 /*@}*/
1424
1425 /*
1426  * Constants & macros for individual RTC_RAR bitfields
1427  */
1428
1429 /*!
1430  * @name Register RTC_RAR, field TSRR[0] (RW)
1431  *
1432  * After being cleared, this bit is set only by system reset. It is not affected
1433  * by VBAT POR or software reset.
1434  *
1435  * Values:
1436  * - 0 - Reads to the Time Seconds Register are ignored.
1437  * - 1 - Reads to the Time Seconds Register complete as normal.
1438  */
1439 /*@{*/
1440 #define BP_RTC_RAR_TSRR      (0U)          /*!< Bit position for RTC_RAR_TSRR. */
1441 #define BM_RTC_RAR_TSRR      (0x00000001U) /*!< Bit mask for RTC_RAR_TSRR. */
1442 #define BS_RTC_RAR_TSRR      (1U)          /*!< Bit field size in bits for RTC_RAR_TSRR. */
1443
1444 /*! @brief Read current value of the RTC_RAR_TSRR field. */
1445 #define BR_RTC_RAR_TSRR(x)   (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_TSRR))
1446
1447 /*! @brief Format value for bitfield RTC_RAR_TSRR. */
1448 #define BF_RTC_RAR_TSRR(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_RAR_TSRR) & BM_RTC_RAR_TSRR)
1449
1450 /*! @brief Set the TSRR field to a new value. */
1451 #define BW_RTC_RAR_TSRR(x, v) (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_TSRR) = (v))
1452 /*@}*/
1453
1454 /*!
1455  * @name Register RTC_RAR, field TPRR[1] (RW)
1456  *
1457  * After being cleared, this bit is set only by system reset. It is not affected
1458  * by VBAT POR or software reset.
1459  *
1460  * Values:
1461  * - 0 - Reads to the Time Pprescaler Register are ignored.
1462  * - 1 - Reads to the Time Prescaler Register complete as normal.
1463  */
1464 /*@{*/
1465 #define BP_RTC_RAR_TPRR      (1U)          /*!< Bit position for RTC_RAR_TPRR. */
1466 #define BM_RTC_RAR_TPRR      (0x00000002U) /*!< Bit mask for RTC_RAR_TPRR. */
1467 #define BS_RTC_RAR_TPRR      (1U)          /*!< Bit field size in bits for RTC_RAR_TPRR. */
1468
1469 /*! @brief Read current value of the RTC_RAR_TPRR field. */
1470 #define BR_RTC_RAR_TPRR(x)   (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_TPRR))
1471
1472 /*! @brief Format value for bitfield RTC_RAR_TPRR. */
1473 #define BF_RTC_RAR_TPRR(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_RAR_TPRR) & BM_RTC_RAR_TPRR)
1474
1475 /*! @brief Set the TPRR field to a new value. */
1476 #define BW_RTC_RAR_TPRR(x, v) (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_TPRR) = (v))
1477 /*@}*/
1478
1479 /*!
1480  * @name Register RTC_RAR, field TARR[2] (RW)
1481  *
1482  * After being cleared, this bit is set only by system reset. It is not affected
1483  * by VBAT POR or software reset.
1484  *
1485  * Values:
1486  * - 0 - Reads to the Time Alarm Register are ignored.
1487  * - 1 - Reads to the Time Alarm Register complete as normal.
1488  */
1489 /*@{*/
1490 #define BP_RTC_RAR_TARR      (2U)          /*!< Bit position for RTC_RAR_TARR. */
1491 #define BM_RTC_RAR_TARR      (0x00000004U) /*!< Bit mask for RTC_RAR_TARR. */
1492 #define BS_RTC_RAR_TARR      (1U)          /*!< Bit field size in bits for RTC_RAR_TARR. */
1493
1494 /*! @brief Read current value of the RTC_RAR_TARR field. */
1495 #define BR_RTC_RAR_TARR(x)   (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_TARR))
1496
1497 /*! @brief Format value for bitfield RTC_RAR_TARR. */
1498 #define BF_RTC_RAR_TARR(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_RAR_TARR) & BM_RTC_RAR_TARR)
1499
1500 /*! @brief Set the TARR field to a new value. */
1501 #define BW_RTC_RAR_TARR(x, v) (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_TARR) = (v))
1502 /*@}*/
1503
1504 /*!
1505  * @name Register RTC_RAR, field TCRR[3] (RW)
1506  *
1507  * After being cleared, this bit is set only by system reset. It is not affected
1508  * by VBAT POR or software reset.
1509  *
1510  * Values:
1511  * - 0 - Reads to the Time Compensation Register are ignored.
1512  * - 1 - Reads to the Time Compensation Register complete as normal.
1513  */
1514 /*@{*/
1515 #define BP_RTC_RAR_TCRR      (3U)          /*!< Bit position for RTC_RAR_TCRR. */
1516 #define BM_RTC_RAR_TCRR      (0x00000008U) /*!< Bit mask for RTC_RAR_TCRR. */
1517 #define BS_RTC_RAR_TCRR      (1U)          /*!< Bit field size in bits for RTC_RAR_TCRR. */
1518
1519 /*! @brief Read current value of the RTC_RAR_TCRR field. */
1520 #define BR_RTC_RAR_TCRR(x)   (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_TCRR))
1521
1522 /*! @brief Format value for bitfield RTC_RAR_TCRR. */
1523 #define BF_RTC_RAR_TCRR(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_RAR_TCRR) & BM_RTC_RAR_TCRR)
1524
1525 /*! @brief Set the TCRR field to a new value. */
1526 #define BW_RTC_RAR_TCRR(x, v) (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_TCRR) = (v))
1527 /*@}*/
1528
1529 /*!
1530  * @name Register RTC_RAR, field CRR[4] (RW)
1531  *
1532  * After being cleared, this bit is set only by system reset. It is not affected
1533  * by VBAT POR or software reset.
1534  *
1535  * Values:
1536  * - 0 - Reads to the Control Register are ignored.
1537  * - 1 - Reads to the Control Register complete as normal.
1538  */
1539 /*@{*/
1540 #define BP_RTC_RAR_CRR       (4U)          /*!< Bit position for RTC_RAR_CRR. */
1541 #define BM_RTC_RAR_CRR       (0x00000010U) /*!< Bit mask for RTC_RAR_CRR. */
1542 #define BS_RTC_RAR_CRR       (1U)          /*!< Bit field size in bits for RTC_RAR_CRR. */
1543
1544 /*! @brief Read current value of the RTC_RAR_CRR field. */
1545 #define BR_RTC_RAR_CRR(x)    (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_CRR))
1546
1547 /*! @brief Format value for bitfield RTC_RAR_CRR. */
1548 #define BF_RTC_RAR_CRR(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_RAR_CRR) & BM_RTC_RAR_CRR)
1549
1550 /*! @brief Set the CRR field to a new value. */
1551 #define BW_RTC_RAR_CRR(x, v) (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_CRR) = (v))
1552 /*@}*/
1553
1554 /*!
1555  * @name Register RTC_RAR, field SRR[5] (RW)
1556  *
1557  * After being cleared, this bit is set only by system reset. It is not affected
1558  * by VBAT POR or software reset.
1559  *
1560  * Values:
1561  * - 0 - Reads to the Status Register are ignored.
1562  * - 1 - Reads to the Status Register complete as normal.
1563  */
1564 /*@{*/
1565 #define BP_RTC_RAR_SRR       (5U)          /*!< Bit position for RTC_RAR_SRR. */
1566 #define BM_RTC_RAR_SRR       (0x00000020U) /*!< Bit mask for RTC_RAR_SRR. */
1567 #define BS_RTC_RAR_SRR       (1U)          /*!< Bit field size in bits for RTC_RAR_SRR. */
1568
1569 /*! @brief Read current value of the RTC_RAR_SRR field. */
1570 #define BR_RTC_RAR_SRR(x)    (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_SRR))
1571
1572 /*! @brief Format value for bitfield RTC_RAR_SRR. */
1573 #define BF_RTC_RAR_SRR(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_RAR_SRR) & BM_RTC_RAR_SRR)
1574
1575 /*! @brief Set the SRR field to a new value. */
1576 #define BW_RTC_RAR_SRR(x, v) (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_SRR) = (v))
1577 /*@}*/
1578
1579 /*!
1580  * @name Register RTC_RAR, field LRR[6] (RW)
1581  *
1582  * After being cleared, this bit is set only by system reset. It is not affected
1583  * by VBAT POR or software reset.
1584  *
1585  * Values:
1586  * - 0 - Reads to the Lock Register are ignored.
1587  * - 1 - Reads to the Lock Register complete as normal.
1588  */
1589 /*@{*/
1590 #define BP_RTC_RAR_LRR       (6U)          /*!< Bit position for RTC_RAR_LRR. */
1591 #define BM_RTC_RAR_LRR       (0x00000040U) /*!< Bit mask for RTC_RAR_LRR. */
1592 #define BS_RTC_RAR_LRR       (1U)          /*!< Bit field size in bits for RTC_RAR_LRR. */
1593
1594 /*! @brief Read current value of the RTC_RAR_LRR field. */
1595 #define BR_RTC_RAR_LRR(x)    (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_LRR))
1596
1597 /*! @brief Format value for bitfield RTC_RAR_LRR. */
1598 #define BF_RTC_RAR_LRR(v)    ((uint32_t)((uint32_t)(v) << BP_RTC_RAR_LRR) & BM_RTC_RAR_LRR)
1599
1600 /*! @brief Set the LRR field to a new value. */
1601 #define BW_RTC_RAR_LRR(x, v) (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_LRR) = (v))
1602 /*@}*/
1603
1604 /*!
1605  * @name Register RTC_RAR, field IERR[7] (RW)
1606  *
1607  * After being cleared, this bit is set only by system reset. It is not affected
1608  * by VBAT POR or software reset.
1609  *
1610  * Values:
1611  * - 0 - Reads to the Interrupt Enable Register are ignored.
1612  * - 1 - Reads to the Interrupt Enable Register complete as normal.
1613  */
1614 /*@{*/
1615 #define BP_RTC_RAR_IERR      (7U)          /*!< Bit position for RTC_RAR_IERR. */
1616 #define BM_RTC_RAR_IERR      (0x00000080U) /*!< Bit mask for RTC_RAR_IERR. */
1617 #define BS_RTC_RAR_IERR      (1U)          /*!< Bit field size in bits for RTC_RAR_IERR. */
1618
1619 /*! @brief Read current value of the RTC_RAR_IERR field. */
1620 #define BR_RTC_RAR_IERR(x)   (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_IERR))
1621
1622 /*! @brief Format value for bitfield RTC_RAR_IERR. */
1623 #define BF_RTC_RAR_IERR(v)   ((uint32_t)((uint32_t)(v) << BP_RTC_RAR_IERR) & BM_RTC_RAR_IERR)
1624
1625 /*! @brief Set the IERR field to a new value. */
1626 #define BW_RTC_RAR_IERR(x, v) (BITBAND_ACCESS32(HW_RTC_RAR_ADDR(x), BP_RTC_RAR_IERR) = (v))
1627 /*@}*/
1628
1629 /*******************************************************************************
1630  * hw_rtc_t - module struct
1631  ******************************************************************************/
1632 /*!
1633  * @brief All RTC module registers.
1634  */
1635 #pragma pack(1)
1636 typedef struct _hw_rtc
1637 {
1638     __IO hw_rtc_tsr_t TSR;                 /*!< [0x0] RTC Time Seconds Register */
1639     __IO hw_rtc_tpr_t TPR;                 /*!< [0x4] RTC Time Prescaler Register */
1640     __IO hw_rtc_tar_t TAR;                 /*!< [0x8] RTC Time Alarm Register */
1641     __IO hw_rtc_tcr_t TCR;                 /*!< [0xC] RTC Time Compensation Register */
1642     __IO hw_rtc_cr_t CR;                   /*!< [0x10] RTC Control Register */
1643     __IO hw_rtc_sr_t SR;                   /*!< [0x14] RTC Status Register */
1644     __IO hw_rtc_lr_t LR;                   /*!< [0x18] RTC Lock Register */
1645     __IO hw_rtc_ier_t IER;                 /*!< [0x1C] RTC Interrupt Enable Register */
1646     uint8_t _reserved0[2016];
1647     __IO hw_rtc_war_t WAR;                 /*!< [0x800] RTC Write Access Register */
1648     __IO hw_rtc_rar_t RAR;                 /*!< [0x804] RTC Read Access Register */
1649 } hw_rtc_t;
1650 #pragma pack()
1651
1652 /*! @brief Macro to access all RTC registers. */
1653 /*! @param x RTC module instance base address. */
1654 /*! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
1655  *     use the '&' operator, like <code>&HW_RTC(RTC_BASE)</code>. */
1656 #define HW_RTC(x)      (*(hw_rtc_t *)(x))
1657
1658 #endif /* __HW_RTC_REGISTERS_H__ */
1659 /* EOF */