]> 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_wdog.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_wdog.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_WDOG_REGISTERS_H__
81 #define __HW_WDOG_REGISTERS_H__
82
83 #include "MK64F12.h"
84 #include "fsl_bitaccess.h"
85
86 /*
87  * MK64F12 WDOG
88  *
89  * Generation 2008 Watchdog Timer
90  *
91  * Registers defined in this header file:
92  * - HW_WDOG_STCTRLH - Watchdog Status and Control Register High
93  * - HW_WDOG_STCTRLL - Watchdog Status and Control Register Low
94  * - HW_WDOG_TOVALH - Watchdog Time-out Value Register High
95  * - HW_WDOG_TOVALL - Watchdog Time-out Value Register Low
96  * - HW_WDOG_WINH - Watchdog Window Register High
97  * - HW_WDOG_WINL - Watchdog Window Register Low
98  * - HW_WDOG_REFRESH - Watchdog Refresh register
99  * - HW_WDOG_UNLOCK - Watchdog Unlock register
100  * - HW_WDOG_TMROUTH - Watchdog Timer Output Register High
101  * - HW_WDOG_TMROUTL - Watchdog Timer Output Register Low
102  * - HW_WDOG_RSTCNT - Watchdog Reset Count register
103  * - HW_WDOG_PRESC - Watchdog Prescaler register
104  *
105  * - hw_wdog_t - Struct containing all module registers.
106  */
107
108 #define HW_WDOG_INSTANCE_COUNT (1U) /*!< Number of instances of the WDOG module. */
109
110 /*******************************************************************************
111  * HW_WDOG_STCTRLH - Watchdog Status and Control Register High
112  ******************************************************************************/
113
114 /*!
115  * @brief HW_WDOG_STCTRLH - Watchdog Status and Control Register High (RW)
116  *
117  * Reset value: 0x01D3U
118  */
119 typedef union _hw_wdog_stctrlh
120 {
121     uint16_t U;
122     struct _hw_wdog_stctrlh_bitfields
123     {
124         uint16_t WDOGEN : 1;           /*!< [0]  */
125         uint16_t CLKSRC : 1;           /*!< [1]  */
126         uint16_t IRQRSTEN : 1;         /*!< [2]  */
127         uint16_t WINEN : 1;            /*!< [3]  */
128         uint16_t ALLOWUPDATE : 1;      /*!< [4]  */
129         uint16_t DBGEN : 1;            /*!< [5]  */
130         uint16_t STOPEN : 1;           /*!< [6]  */
131         uint16_t WAITEN : 1;           /*!< [7]  */
132         uint16_t RESERVED0 : 2;        /*!< [9:8]  */
133         uint16_t TESTWDOG : 1;         /*!< [10]  */
134         uint16_t TESTSEL : 1;          /*!< [11]  */
135         uint16_t BYTESEL : 2;          /*!< [13:12]  */
136         uint16_t DISTESTWDOG : 1;      /*!< [14]  */
137         uint16_t RESERVED1 : 1;        /*!< [15]  */
138     } B;
139 } hw_wdog_stctrlh_t;
140
141 /*!
142  * @name Constants and macros for entire WDOG_STCTRLH register
143  */
144 /*@{*/
145 #define HW_WDOG_STCTRLH_ADDR(x)  ((x) + 0x0U)
146
147 #define HW_WDOG_STCTRLH(x)       (*(__IO hw_wdog_stctrlh_t *) HW_WDOG_STCTRLH_ADDR(x))
148 #define HW_WDOG_STCTRLH_RD(x)    (HW_WDOG_STCTRLH(x).U)
149 #define HW_WDOG_STCTRLH_WR(x, v) (HW_WDOG_STCTRLH(x).U = (v))
150 #define HW_WDOG_STCTRLH_SET(x, v) (HW_WDOG_STCTRLH_WR(x, HW_WDOG_STCTRLH_RD(x) |  (v)))
151 #define HW_WDOG_STCTRLH_CLR(x, v) (HW_WDOG_STCTRLH_WR(x, HW_WDOG_STCTRLH_RD(x) & ~(v)))
152 #define HW_WDOG_STCTRLH_TOG(x, v) (HW_WDOG_STCTRLH_WR(x, HW_WDOG_STCTRLH_RD(x) ^  (v)))
153 /*@}*/
154
155 /*
156  * Constants & macros for individual WDOG_STCTRLH bitfields
157  */
158
159 /*!
160  * @name Register WDOG_STCTRLH, field WDOGEN[0] (RW)
161  *
162  * Enables or disables the WDOG's operation. In the disabled state, the watchdog
163  * timer is kept in the reset state, but the other exception conditions can
164  * still trigger a reset/interrupt. A change in the value of this bit must be held
165  * for more than one WDOG_CLK cycle for the WDOG to be enabled or disabled.
166  *
167  * Values:
168  * - 0 - WDOG is disabled.
169  * - 1 - WDOG is enabled.
170  */
171 /*@{*/
172 #define BP_WDOG_STCTRLH_WDOGEN (0U)        /*!< Bit position for WDOG_STCTRLH_WDOGEN. */
173 #define BM_WDOG_STCTRLH_WDOGEN (0x0001U)   /*!< Bit mask for WDOG_STCTRLH_WDOGEN. */
174 #define BS_WDOG_STCTRLH_WDOGEN (1U)        /*!< Bit field size in bits for WDOG_STCTRLH_WDOGEN. */
175
176 /*! @brief Read current value of the WDOG_STCTRLH_WDOGEN field. */
177 #define BR_WDOG_STCTRLH_WDOGEN(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_WDOGEN))
178
179 /*! @brief Format value for bitfield WDOG_STCTRLH_WDOGEN. */
180 #define BF_WDOG_STCTRLH_WDOGEN(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_WDOGEN) & BM_WDOG_STCTRLH_WDOGEN)
181
182 /*! @brief Set the WDOGEN field to a new value. */
183 #define BW_WDOG_STCTRLH_WDOGEN(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_WDOGEN) = (v))
184 /*@}*/
185
186 /*!
187  * @name Register WDOG_STCTRLH, field CLKSRC[1] (RW)
188  *
189  * Selects clock source for the WDOG timer and other internal timing operations.
190  *
191  * Values:
192  * - 0 - WDOG clock sourced from LPO .
193  * - 1 - WDOG clock sourced from alternate clock source.
194  */
195 /*@{*/
196 #define BP_WDOG_STCTRLH_CLKSRC (1U)        /*!< Bit position for WDOG_STCTRLH_CLKSRC. */
197 #define BM_WDOG_STCTRLH_CLKSRC (0x0002U)   /*!< Bit mask for WDOG_STCTRLH_CLKSRC. */
198 #define BS_WDOG_STCTRLH_CLKSRC (1U)        /*!< Bit field size in bits for WDOG_STCTRLH_CLKSRC. */
199
200 /*! @brief Read current value of the WDOG_STCTRLH_CLKSRC field. */
201 #define BR_WDOG_STCTRLH_CLKSRC(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_CLKSRC))
202
203 /*! @brief Format value for bitfield WDOG_STCTRLH_CLKSRC. */
204 #define BF_WDOG_STCTRLH_CLKSRC(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_CLKSRC) & BM_WDOG_STCTRLH_CLKSRC)
205
206 /*! @brief Set the CLKSRC field to a new value. */
207 #define BW_WDOG_STCTRLH_CLKSRC(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_CLKSRC) = (v))
208 /*@}*/
209
210 /*!
211  * @name Register WDOG_STCTRLH, field IRQRSTEN[2] (RW)
212  *
213  * Used to enable the debug breadcrumbs feature. A change in this bit is updated
214  * immediately, as opposed to updating after WCT.
215  *
216  * Values:
217  * - 0 - WDOG time-out generates reset only.
218  * - 1 - WDOG time-out initially generates an interrupt. After WCT, it generates
219  *     a reset.
220  */
221 /*@{*/
222 #define BP_WDOG_STCTRLH_IRQRSTEN (2U)      /*!< Bit position for WDOG_STCTRLH_IRQRSTEN. */
223 #define BM_WDOG_STCTRLH_IRQRSTEN (0x0004U) /*!< Bit mask for WDOG_STCTRLH_IRQRSTEN. */
224 #define BS_WDOG_STCTRLH_IRQRSTEN (1U)      /*!< Bit field size in bits for WDOG_STCTRLH_IRQRSTEN. */
225
226 /*! @brief Read current value of the WDOG_STCTRLH_IRQRSTEN field. */
227 #define BR_WDOG_STCTRLH_IRQRSTEN(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_IRQRSTEN))
228
229 /*! @brief Format value for bitfield WDOG_STCTRLH_IRQRSTEN. */
230 #define BF_WDOG_STCTRLH_IRQRSTEN(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_IRQRSTEN) & BM_WDOG_STCTRLH_IRQRSTEN)
231
232 /*! @brief Set the IRQRSTEN field to a new value. */
233 #define BW_WDOG_STCTRLH_IRQRSTEN(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_IRQRSTEN) = (v))
234 /*@}*/
235
236 /*!
237  * @name Register WDOG_STCTRLH, field WINEN[3] (RW)
238  *
239  * Enables Windowing mode.
240  *
241  * Values:
242  * - 0 - Windowing mode is disabled.
243  * - 1 - Windowing mode is enabled.
244  */
245 /*@{*/
246 #define BP_WDOG_STCTRLH_WINEN (3U)         /*!< Bit position for WDOG_STCTRLH_WINEN. */
247 #define BM_WDOG_STCTRLH_WINEN (0x0008U)    /*!< Bit mask for WDOG_STCTRLH_WINEN. */
248 #define BS_WDOG_STCTRLH_WINEN (1U)         /*!< Bit field size in bits for WDOG_STCTRLH_WINEN. */
249
250 /*! @brief Read current value of the WDOG_STCTRLH_WINEN field. */
251 #define BR_WDOG_STCTRLH_WINEN(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_WINEN))
252
253 /*! @brief Format value for bitfield WDOG_STCTRLH_WINEN. */
254 #define BF_WDOG_STCTRLH_WINEN(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_WINEN) & BM_WDOG_STCTRLH_WINEN)
255
256 /*! @brief Set the WINEN field to a new value. */
257 #define BW_WDOG_STCTRLH_WINEN(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_WINEN) = (v))
258 /*@}*/
259
260 /*!
261  * @name Register WDOG_STCTRLH, field ALLOWUPDATE[4] (RW)
262  *
263  * Enables updates to watchdog write-once registers, after the reset-triggered
264  * initial configuration window (WCT) closes, through unlock sequence.
265  *
266  * Values:
267  * - 0 - No further updates allowed to WDOG write-once registers.
268  * - 1 - WDOG write-once registers can be unlocked for updating.
269  */
270 /*@{*/
271 #define BP_WDOG_STCTRLH_ALLOWUPDATE (4U)   /*!< Bit position for WDOG_STCTRLH_ALLOWUPDATE. */
272 #define BM_WDOG_STCTRLH_ALLOWUPDATE (0x0010U) /*!< Bit mask for WDOG_STCTRLH_ALLOWUPDATE. */
273 #define BS_WDOG_STCTRLH_ALLOWUPDATE (1U)   /*!< Bit field size in bits for WDOG_STCTRLH_ALLOWUPDATE. */
274
275 /*! @brief Read current value of the WDOG_STCTRLH_ALLOWUPDATE field. */
276 #define BR_WDOG_STCTRLH_ALLOWUPDATE(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_ALLOWUPDATE))
277
278 /*! @brief Format value for bitfield WDOG_STCTRLH_ALLOWUPDATE. */
279 #define BF_WDOG_STCTRLH_ALLOWUPDATE(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_ALLOWUPDATE) & BM_WDOG_STCTRLH_ALLOWUPDATE)
280
281 /*! @brief Set the ALLOWUPDATE field to a new value. */
282 #define BW_WDOG_STCTRLH_ALLOWUPDATE(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_ALLOWUPDATE) = (v))
283 /*@}*/
284
285 /*!
286  * @name Register WDOG_STCTRLH, field DBGEN[5] (RW)
287  *
288  * Enables or disables WDOG in Debug mode.
289  *
290  * Values:
291  * - 0 - WDOG is disabled in CPU Debug mode.
292  * - 1 - WDOG is enabled in CPU Debug mode.
293  */
294 /*@{*/
295 #define BP_WDOG_STCTRLH_DBGEN (5U)         /*!< Bit position for WDOG_STCTRLH_DBGEN. */
296 #define BM_WDOG_STCTRLH_DBGEN (0x0020U)    /*!< Bit mask for WDOG_STCTRLH_DBGEN. */
297 #define BS_WDOG_STCTRLH_DBGEN (1U)         /*!< Bit field size in bits for WDOG_STCTRLH_DBGEN. */
298
299 /*! @brief Read current value of the WDOG_STCTRLH_DBGEN field. */
300 #define BR_WDOG_STCTRLH_DBGEN(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_DBGEN))
301
302 /*! @brief Format value for bitfield WDOG_STCTRLH_DBGEN. */
303 #define BF_WDOG_STCTRLH_DBGEN(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_DBGEN) & BM_WDOG_STCTRLH_DBGEN)
304
305 /*! @brief Set the DBGEN field to a new value. */
306 #define BW_WDOG_STCTRLH_DBGEN(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_DBGEN) = (v))
307 /*@}*/
308
309 /*!
310  * @name Register WDOG_STCTRLH, field STOPEN[6] (RW)
311  *
312  * Enables or disables WDOG in Stop mode.
313  *
314  * Values:
315  * - 0 - WDOG is disabled in CPU Stop mode.
316  * - 1 - WDOG is enabled in CPU Stop mode.
317  */
318 /*@{*/
319 #define BP_WDOG_STCTRLH_STOPEN (6U)        /*!< Bit position for WDOG_STCTRLH_STOPEN. */
320 #define BM_WDOG_STCTRLH_STOPEN (0x0040U)   /*!< Bit mask for WDOG_STCTRLH_STOPEN. */
321 #define BS_WDOG_STCTRLH_STOPEN (1U)        /*!< Bit field size in bits for WDOG_STCTRLH_STOPEN. */
322
323 /*! @brief Read current value of the WDOG_STCTRLH_STOPEN field. */
324 #define BR_WDOG_STCTRLH_STOPEN(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_STOPEN))
325
326 /*! @brief Format value for bitfield WDOG_STCTRLH_STOPEN. */
327 #define BF_WDOG_STCTRLH_STOPEN(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_STOPEN) & BM_WDOG_STCTRLH_STOPEN)
328
329 /*! @brief Set the STOPEN field to a new value. */
330 #define BW_WDOG_STCTRLH_STOPEN(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_STOPEN) = (v))
331 /*@}*/
332
333 /*!
334  * @name Register WDOG_STCTRLH, field WAITEN[7] (RW)
335  *
336  * Enables or disables WDOG in Wait mode.
337  *
338  * Values:
339  * - 0 - WDOG is disabled in CPU Wait mode.
340  * - 1 - WDOG is enabled in CPU Wait mode.
341  */
342 /*@{*/
343 #define BP_WDOG_STCTRLH_WAITEN (7U)        /*!< Bit position for WDOG_STCTRLH_WAITEN. */
344 #define BM_WDOG_STCTRLH_WAITEN (0x0080U)   /*!< Bit mask for WDOG_STCTRLH_WAITEN. */
345 #define BS_WDOG_STCTRLH_WAITEN (1U)        /*!< Bit field size in bits for WDOG_STCTRLH_WAITEN. */
346
347 /*! @brief Read current value of the WDOG_STCTRLH_WAITEN field. */
348 #define BR_WDOG_STCTRLH_WAITEN(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_WAITEN))
349
350 /*! @brief Format value for bitfield WDOG_STCTRLH_WAITEN. */
351 #define BF_WDOG_STCTRLH_WAITEN(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_WAITEN) & BM_WDOG_STCTRLH_WAITEN)
352
353 /*! @brief Set the WAITEN field to a new value. */
354 #define BW_WDOG_STCTRLH_WAITEN(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_WAITEN) = (v))
355 /*@}*/
356
357 /*!
358  * @name Register WDOG_STCTRLH, field TESTWDOG[10] (RW)
359  *
360  * Puts the watchdog in the functional test mode. In this mode, the watchdog
361  * timer and the associated compare and reset generation logic is tested for correct
362  * operation. The clock for the timer is switched from the main watchdog clock
363  * to the fast clock input for watchdog functional test. The TESTSEL bit selects
364  * the test to be run.
365  */
366 /*@{*/
367 #define BP_WDOG_STCTRLH_TESTWDOG (10U)     /*!< Bit position for WDOG_STCTRLH_TESTWDOG. */
368 #define BM_WDOG_STCTRLH_TESTWDOG (0x0400U) /*!< Bit mask for WDOG_STCTRLH_TESTWDOG. */
369 #define BS_WDOG_STCTRLH_TESTWDOG (1U)      /*!< Bit field size in bits for WDOG_STCTRLH_TESTWDOG. */
370
371 /*! @brief Read current value of the WDOG_STCTRLH_TESTWDOG field. */
372 #define BR_WDOG_STCTRLH_TESTWDOG(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_TESTWDOG))
373
374 /*! @brief Format value for bitfield WDOG_STCTRLH_TESTWDOG. */
375 #define BF_WDOG_STCTRLH_TESTWDOG(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_TESTWDOG) & BM_WDOG_STCTRLH_TESTWDOG)
376
377 /*! @brief Set the TESTWDOG field to a new value. */
378 #define BW_WDOG_STCTRLH_TESTWDOG(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_TESTWDOG) = (v))
379 /*@}*/
380
381 /*!
382  * @name Register WDOG_STCTRLH, field TESTSEL[11] (RW)
383  *
384  * Effective only if TESTWDOG is set. Selects the test to be run on the watchdog
385  * timer.
386  *
387  * Values:
388  * - 0 - Quick test. The timer runs in normal operation. You can load a small
389  *     time-out value to do a quick test.
390  * - 1 - Byte test. Puts the timer in the byte test mode where individual bytes
391  *     of the timer are enabled for operation and are compared for time-out
392  *     against the corresponding byte of the programmed time-out value. Select the
393  *     byte through BYTESEL[1:0] for testing.
394  */
395 /*@{*/
396 #define BP_WDOG_STCTRLH_TESTSEL (11U)      /*!< Bit position for WDOG_STCTRLH_TESTSEL. */
397 #define BM_WDOG_STCTRLH_TESTSEL (0x0800U)  /*!< Bit mask for WDOG_STCTRLH_TESTSEL. */
398 #define BS_WDOG_STCTRLH_TESTSEL (1U)       /*!< Bit field size in bits for WDOG_STCTRLH_TESTSEL. */
399
400 /*! @brief Read current value of the WDOG_STCTRLH_TESTSEL field. */
401 #define BR_WDOG_STCTRLH_TESTSEL(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_TESTSEL))
402
403 /*! @brief Format value for bitfield WDOG_STCTRLH_TESTSEL. */
404 #define BF_WDOG_STCTRLH_TESTSEL(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_TESTSEL) & BM_WDOG_STCTRLH_TESTSEL)
405
406 /*! @brief Set the TESTSEL field to a new value. */
407 #define BW_WDOG_STCTRLH_TESTSEL(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_TESTSEL) = (v))
408 /*@}*/
409
410 /*!
411  * @name Register WDOG_STCTRLH, field BYTESEL[13:12] (RW)
412  *
413  * This 2-bit field selects the byte to be tested when the watchdog is in the
414  * byte test mode.
415  *
416  * Values:
417  * - 00 - Byte 0 selected
418  * - 01 - Byte 1 selected
419  * - 10 - Byte 2 selected
420  * - 11 - Byte 3 selected
421  */
422 /*@{*/
423 #define BP_WDOG_STCTRLH_BYTESEL (12U)      /*!< Bit position for WDOG_STCTRLH_BYTESEL. */
424 #define BM_WDOG_STCTRLH_BYTESEL (0x3000U)  /*!< Bit mask for WDOG_STCTRLH_BYTESEL. */
425 #define BS_WDOG_STCTRLH_BYTESEL (2U)       /*!< Bit field size in bits for WDOG_STCTRLH_BYTESEL. */
426
427 /*! @brief Read current value of the WDOG_STCTRLH_BYTESEL field. */
428 #define BR_WDOG_STCTRLH_BYTESEL(x) (HW_WDOG_STCTRLH(x).B.BYTESEL)
429
430 /*! @brief Format value for bitfield WDOG_STCTRLH_BYTESEL. */
431 #define BF_WDOG_STCTRLH_BYTESEL(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_BYTESEL) & BM_WDOG_STCTRLH_BYTESEL)
432
433 /*! @brief Set the BYTESEL field to a new value. */
434 #define BW_WDOG_STCTRLH_BYTESEL(x, v) (HW_WDOG_STCTRLH_WR(x, (HW_WDOG_STCTRLH_RD(x) & ~BM_WDOG_STCTRLH_BYTESEL) | BF_WDOG_STCTRLH_BYTESEL(v)))
435 /*@}*/
436
437 /*!
438  * @name Register WDOG_STCTRLH, field DISTESTWDOG[14] (RW)
439  *
440  * Allows the WDOG's functional test mode to be disabled permanently. After it
441  * is set, it can only be cleared by a reset. It cannot be unlocked for editing
442  * after it is set.
443  *
444  * Values:
445  * - 0 - WDOG functional test mode is not disabled.
446  * - 1 - WDOG functional test mode is disabled permanently until reset.
447  */
448 /*@{*/
449 #define BP_WDOG_STCTRLH_DISTESTWDOG (14U)  /*!< Bit position for WDOG_STCTRLH_DISTESTWDOG. */
450 #define BM_WDOG_STCTRLH_DISTESTWDOG (0x4000U) /*!< Bit mask for WDOG_STCTRLH_DISTESTWDOG. */
451 #define BS_WDOG_STCTRLH_DISTESTWDOG (1U)   /*!< Bit field size in bits for WDOG_STCTRLH_DISTESTWDOG. */
452
453 /*! @brief Read current value of the WDOG_STCTRLH_DISTESTWDOG field. */
454 #define BR_WDOG_STCTRLH_DISTESTWDOG(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_DISTESTWDOG))
455
456 /*! @brief Format value for bitfield WDOG_STCTRLH_DISTESTWDOG. */
457 #define BF_WDOG_STCTRLH_DISTESTWDOG(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLH_DISTESTWDOG) & BM_WDOG_STCTRLH_DISTESTWDOG)
458
459 /*! @brief Set the DISTESTWDOG field to a new value. */
460 #define BW_WDOG_STCTRLH_DISTESTWDOG(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLH_ADDR(x), BP_WDOG_STCTRLH_DISTESTWDOG) = (v))
461 /*@}*/
462
463 /*******************************************************************************
464  * HW_WDOG_STCTRLL - Watchdog Status and Control Register Low
465  ******************************************************************************/
466
467 /*!
468  * @brief HW_WDOG_STCTRLL - Watchdog Status and Control Register Low (RW)
469  *
470  * Reset value: 0x0001U
471  */
472 typedef union _hw_wdog_stctrll
473 {
474     uint16_t U;
475     struct _hw_wdog_stctrll_bitfields
476     {
477         uint16_t RESERVED0 : 15;       /*!< [14:0]  */
478         uint16_t INTFLG : 1;           /*!< [15]  */
479     } B;
480 } hw_wdog_stctrll_t;
481
482 /*!
483  * @name Constants and macros for entire WDOG_STCTRLL register
484  */
485 /*@{*/
486 #define HW_WDOG_STCTRLL_ADDR(x)  ((x) + 0x2U)
487
488 #define HW_WDOG_STCTRLL(x)       (*(__IO hw_wdog_stctrll_t *) HW_WDOG_STCTRLL_ADDR(x))
489 #define HW_WDOG_STCTRLL_RD(x)    (HW_WDOG_STCTRLL(x).U)
490 #define HW_WDOG_STCTRLL_WR(x, v) (HW_WDOG_STCTRLL(x).U = (v))
491 #define HW_WDOG_STCTRLL_SET(x, v) (HW_WDOG_STCTRLL_WR(x, HW_WDOG_STCTRLL_RD(x) |  (v)))
492 #define HW_WDOG_STCTRLL_CLR(x, v) (HW_WDOG_STCTRLL_WR(x, HW_WDOG_STCTRLL_RD(x) & ~(v)))
493 #define HW_WDOG_STCTRLL_TOG(x, v) (HW_WDOG_STCTRLL_WR(x, HW_WDOG_STCTRLL_RD(x) ^  (v)))
494 /*@}*/
495
496 /*
497  * Constants & macros for individual WDOG_STCTRLL bitfields
498  */
499
500 /*!
501  * @name Register WDOG_STCTRLL, field INTFLG[15] (RW)
502  *
503  * Interrupt flag. It is set when an exception occurs. IRQRSTEN = 1 is a
504  * precondition to set this flag. INTFLG = 1 results in an interrupt being issued
505  * followed by a reset, WCT later. The interrupt can be cleared by writing 1 to this
506  * bit. It also gets cleared on a system reset.
507  */
508 /*@{*/
509 #define BP_WDOG_STCTRLL_INTFLG (15U)       /*!< Bit position for WDOG_STCTRLL_INTFLG. */
510 #define BM_WDOG_STCTRLL_INTFLG (0x8000U)   /*!< Bit mask for WDOG_STCTRLL_INTFLG. */
511 #define BS_WDOG_STCTRLL_INTFLG (1U)        /*!< Bit field size in bits for WDOG_STCTRLL_INTFLG. */
512
513 /*! @brief Read current value of the WDOG_STCTRLL_INTFLG field. */
514 #define BR_WDOG_STCTRLL_INTFLG(x) (BITBAND_ACCESS16(HW_WDOG_STCTRLL_ADDR(x), BP_WDOG_STCTRLL_INTFLG))
515
516 /*! @brief Format value for bitfield WDOG_STCTRLL_INTFLG. */
517 #define BF_WDOG_STCTRLL_INTFLG(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_STCTRLL_INTFLG) & BM_WDOG_STCTRLL_INTFLG)
518
519 /*! @brief Set the INTFLG field to a new value. */
520 #define BW_WDOG_STCTRLL_INTFLG(x, v) (BITBAND_ACCESS16(HW_WDOG_STCTRLL_ADDR(x), BP_WDOG_STCTRLL_INTFLG) = (v))
521 /*@}*/
522
523 /*******************************************************************************
524  * HW_WDOG_TOVALH - Watchdog Time-out Value Register High
525  ******************************************************************************/
526
527 /*!
528  * @brief HW_WDOG_TOVALH - Watchdog Time-out Value Register High (RW)
529  *
530  * Reset value: 0x004CU
531  */
532 typedef union _hw_wdog_tovalh
533 {
534     uint16_t U;
535     struct _hw_wdog_tovalh_bitfields
536     {
537         uint16_t TOVALHIGH : 16;       /*!< [15:0]  */
538     } B;
539 } hw_wdog_tovalh_t;
540
541 /*!
542  * @name Constants and macros for entire WDOG_TOVALH register
543  */
544 /*@{*/
545 #define HW_WDOG_TOVALH_ADDR(x)   ((x) + 0x4U)
546
547 #define HW_WDOG_TOVALH(x)        (*(__IO hw_wdog_tovalh_t *) HW_WDOG_TOVALH_ADDR(x))
548 #define HW_WDOG_TOVALH_RD(x)     (HW_WDOG_TOVALH(x).U)
549 #define HW_WDOG_TOVALH_WR(x, v)  (HW_WDOG_TOVALH(x).U = (v))
550 #define HW_WDOG_TOVALH_SET(x, v) (HW_WDOG_TOVALH_WR(x, HW_WDOG_TOVALH_RD(x) |  (v)))
551 #define HW_WDOG_TOVALH_CLR(x, v) (HW_WDOG_TOVALH_WR(x, HW_WDOG_TOVALH_RD(x) & ~(v)))
552 #define HW_WDOG_TOVALH_TOG(x, v) (HW_WDOG_TOVALH_WR(x, HW_WDOG_TOVALH_RD(x) ^  (v)))
553 /*@}*/
554
555 /*
556  * Constants & macros for individual WDOG_TOVALH bitfields
557  */
558
559 /*!
560  * @name Register WDOG_TOVALH, field TOVALHIGH[15:0] (RW)
561  *
562  * Defines the upper 16 bits of the 32-bit time-out value for the watchdog
563  * timer. It is defined in terms of cycles of the watchdog clock.
564  */
565 /*@{*/
566 #define BP_WDOG_TOVALH_TOVALHIGH (0U)      /*!< Bit position for WDOG_TOVALH_TOVALHIGH. */
567 #define BM_WDOG_TOVALH_TOVALHIGH (0xFFFFU) /*!< Bit mask for WDOG_TOVALH_TOVALHIGH. */
568 #define BS_WDOG_TOVALH_TOVALHIGH (16U)     /*!< Bit field size in bits for WDOG_TOVALH_TOVALHIGH. */
569
570 /*! @brief Read current value of the WDOG_TOVALH_TOVALHIGH field. */
571 #define BR_WDOG_TOVALH_TOVALHIGH(x) (HW_WDOG_TOVALH(x).U)
572
573 /*! @brief Format value for bitfield WDOG_TOVALH_TOVALHIGH. */
574 #define BF_WDOG_TOVALH_TOVALHIGH(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_TOVALH_TOVALHIGH) & BM_WDOG_TOVALH_TOVALHIGH)
575
576 /*! @brief Set the TOVALHIGH field to a new value. */
577 #define BW_WDOG_TOVALH_TOVALHIGH(x, v) (HW_WDOG_TOVALH_WR(x, v))
578 /*@}*/
579
580 /*******************************************************************************
581  * HW_WDOG_TOVALL - Watchdog Time-out Value Register Low
582  ******************************************************************************/
583
584 /*!
585  * @brief HW_WDOG_TOVALL - Watchdog Time-out Value Register Low (RW)
586  *
587  * Reset value: 0x4B4CU
588  *
589  * The time-out value of the watchdog must be set to a minimum of four watchdog
590  * clock cycles. This is to take into account the delay in new settings taking
591  * effect in the watchdog clock domain.
592  */
593 typedef union _hw_wdog_tovall
594 {
595     uint16_t U;
596     struct _hw_wdog_tovall_bitfields
597     {
598         uint16_t TOVALLOW : 16;        /*!< [15:0]  */
599     } B;
600 } hw_wdog_tovall_t;
601
602 /*!
603  * @name Constants and macros for entire WDOG_TOVALL register
604  */
605 /*@{*/
606 #define HW_WDOG_TOVALL_ADDR(x)   ((x) + 0x6U)
607
608 #define HW_WDOG_TOVALL(x)        (*(__IO hw_wdog_tovall_t *) HW_WDOG_TOVALL_ADDR(x))
609 #define HW_WDOG_TOVALL_RD(x)     (HW_WDOG_TOVALL(x).U)
610 #define HW_WDOG_TOVALL_WR(x, v)  (HW_WDOG_TOVALL(x).U = (v))
611 #define HW_WDOG_TOVALL_SET(x, v) (HW_WDOG_TOVALL_WR(x, HW_WDOG_TOVALL_RD(x) |  (v)))
612 #define HW_WDOG_TOVALL_CLR(x, v) (HW_WDOG_TOVALL_WR(x, HW_WDOG_TOVALL_RD(x) & ~(v)))
613 #define HW_WDOG_TOVALL_TOG(x, v) (HW_WDOG_TOVALL_WR(x, HW_WDOG_TOVALL_RD(x) ^  (v)))
614 /*@}*/
615
616 /*
617  * Constants & macros for individual WDOG_TOVALL bitfields
618  */
619
620 /*!
621  * @name Register WDOG_TOVALL, field TOVALLOW[15:0] (RW)
622  *
623  * Defines the lower 16 bits of the 32-bit time-out value for the watchdog
624  * timer. It is defined in terms of cycles of the watchdog clock.
625  */
626 /*@{*/
627 #define BP_WDOG_TOVALL_TOVALLOW (0U)       /*!< Bit position for WDOG_TOVALL_TOVALLOW. */
628 #define BM_WDOG_TOVALL_TOVALLOW (0xFFFFU)  /*!< Bit mask for WDOG_TOVALL_TOVALLOW. */
629 #define BS_WDOG_TOVALL_TOVALLOW (16U)      /*!< Bit field size in bits for WDOG_TOVALL_TOVALLOW. */
630
631 /*! @brief Read current value of the WDOG_TOVALL_TOVALLOW field. */
632 #define BR_WDOG_TOVALL_TOVALLOW(x) (HW_WDOG_TOVALL(x).U)
633
634 /*! @brief Format value for bitfield WDOG_TOVALL_TOVALLOW. */
635 #define BF_WDOG_TOVALL_TOVALLOW(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_TOVALL_TOVALLOW) & BM_WDOG_TOVALL_TOVALLOW)
636
637 /*! @brief Set the TOVALLOW field to a new value. */
638 #define BW_WDOG_TOVALL_TOVALLOW(x, v) (HW_WDOG_TOVALL_WR(x, v))
639 /*@}*/
640
641 /*******************************************************************************
642  * HW_WDOG_WINH - Watchdog Window Register High
643  ******************************************************************************/
644
645 /*!
646  * @brief HW_WDOG_WINH - Watchdog Window Register High (RW)
647  *
648  * Reset value: 0x0000U
649  *
650  * You must set the Window Register value lower than the Time-out Value Register.
651  */
652 typedef union _hw_wdog_winh
653 {
654     uint16_t U;
655     struct _hw_wdog_winh_bitfields
656     {
657         uint16_t WINHIGH : 16;         /*!< [15:0]  */
658     } B;
659 } hw_wdog_winh_t;
660
661 /*!
662  * @name Constants and macros for entire WDOG_WINH register
663  */
664 /*@{*/
665 #define HW_WDOG_WINH_ADDR(x)     ((x) + 0x8U)
666
667 #define HW_WDOG_WINH(x)          (*(__IO hw_wdog_winh_t *) HW_WDOG_WINH_ADDR(x))
668 #define HW_WDOG_WINH_RD(x)       (HW_WDOG_WINH(x).U)
669 #define HW_WDOG_WINH_WR(x, v)    (HW_WDOG_WINH(x).U = (v))
670 #define HW_WDOG_WINH_SET(x, v)   (HW_WDOG_WINH_WR(x, HW_WDOG_WINH_RD(x) |  (v)))
671 #define HW_WDOG_WINH_CLR(x, v)   (HW_WDOG_WINH_WR(x, HW_WDOG_WINH_RD(x) & ~(v)))
672 #define HW_WDOG_WINH_TOG(x, v)   (HW_WDOG_WINH_WR(x, HW_WDOG_WINH_RD(x) ^  (v)))
673 /*@}*/
674
675 /*
676  * Constants & macros for individual WDOG_WINH bitfields
677  */
678
679 /*!
680  * @name Register WDOG_WINH, field WINHIGH[15:0] (RW)
681  *
682  * Defines the upper 16 bits of the 32-bit window for the windowed mode of
683  * operation of the watchdog. It is defined in terms of cycles of the watchdog clock.
684  * In this mode, the watchdog can be refreshed only when the timer has reached a
685  * value greater than or equal to this window length. A refresh outside this
686  * window resets the system or if IRQRSTEN is set, it interrupts and then resets the
687  * system.
688  */
689 /*@{*/
690 #define BP_WDOG_WINH_WINHIGH (0U)          /*!< Bit position for WDOG_WINH_WINHIGH. */
691 #define BM_WDOG_WINH_WINHIGH (0xFFFFU)     /*!< Bit mask for WDOG_WINH_WINHIGH. */
692 #define BS_WDOG_WINH_WINHIGH (16U)         /*!< Bit field size in bits for WDOG_WINH_WINHIGH. */
693
694 /*! @brief Read current value of the WDOG_WINH_WINHIGH field. */
695 #define BR_WDOG_WINH_WINHIGH(x) (HW_WDOG_WINH(x).U)
696
697 /*! @brief Format value for bitfield WDOG_WINH_WINHIGH. */
698 #define BF_WDOG_WINH_WINHIGH(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_WINH_WINHIGH) & BM_WDOG_WINH_WINHIGH)
699
700 /*! @brief Set the WINHIGH field to a new value. */
701 #define BW_WDOG_WINH_WINHIGH(x, v) (HW_WDOG_WINH_WR(x, v))
702 /*@}*/
703
704 /*******************************************************************************
705  * HW_WDOG_WINL - Watchdog Window Register Low
706  ******************************************************************************/
707
708 /*!
709  * @brief HW_WDOG_WINL - Watchdog Window Register Low (RW)
710  *
711  * Reset value: 0x0010U
712  *
713  * You must set the Window Register value lower than the Time-out Value Register.
714  */
715 typedef union _hw_wdog_winl
716 {
717     uint16_t U;
718     struct _hw_wdog_winl_bitfields
719     {
720         uint16_t WINLOW : 16;          /*!< [15:0]  */
721     } B;
722 } hw_wdog_winl_t;
723
724 /*!
725  * @name Constants and macros for entire WDOG_WINL register
726  */
727 /*@{*/
728 #define HW_WDOG_WINL_ADDR(x)     ((x) + 0xAU)
729
730 #define HW_WDOG_WINL(x)          (*(__IO hw_wdog_winl_t *) HW_WDOG_WINL_ADDR(x))
731 #define HW_WDOG_WINL_RD(x)       (HW_WDOG_WINL(x).U)
732 #define HW_WDOG_WINL_WR(x, v)    (HW_WDOG_WINL(x).U = (v))
733 #define HW_WDOG_WINL_SET(x, v)   (HW_WDOG_WINL_WR(x, HW_WDOG_WINL_RD(x) |  (v)))
734 #define HW_WDOG_WINL_CLR(x, v)   (HW_WDOG_WINL_WR(x, HW_WDOG_WINL_RD(x) & ~(v)))
735 #define HW_WDOG_WINL_TOG(x, v)   (HW_WDOG_WINL_WR(x, HW_WDOG_WINL_RD(x) ^  (v)))
736 /*@}*/
737
738 /*
739  * Constants & macros for individual WDOG_WINL bitfields
740  */
741
742 /*!
743  * @name Register WDOG_WINL, field WINLOW[15:0] (RW)
744  *
745  * Defines the lower 16 bits of the 32-bit window for the windowed mode of
746  * operation of the watchdog. It is defined in terms of cycles of the pre-scaled
747  * watchdog clock. In this mode, the watchdog can be refreshed only when the timer
748  * reaches a value greater than or equal to this window length value. A refresh
749  * outside of this window resets the system or if IRQRSTEN is set, it interrupts and
750  * then resets the system.
751  */
752 /*@{*/
753 #define BP_WDOG_WINL_WINLOW  (0U)          /*!< Bit position for WDOG_WINL_WINLOW. */
754 #define BM_WDOG_WINL_WINLOW  (0xFFFFU)     /*!< Bit mask for WDOG_WINL_WINLOW. */
755 #define BS_WDOG_WINL_WINLOW  (16U)         /*!< Bit field size in bits for WDOG_WINL_WINLOW. */
756
757 /*! @brief Read current value of the WDOG_WINL_WINLOW field. */
758 #define BR_WDOG_WINL_WINLOW(x) (HW_WDOG_WINL(x).U)
759
760 /*! @brief Format value for bitfield WDOG_WINL_WINLOW. */
761 #define BF_WDOG_WINL_WINLOW(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_WINL_WINLOW) & BM_WDOG_WINL_WINLOW)
762
763 /*! @brief Set the WINLOW field to a new value. */
764 #define BW_WDOG_WINL_WINLOW(x, v) (HW_WDOG_WINL_WR(x, v))
765 /*@}*/
766
767 /*******************************************************************************
768  * HW_WDOG_REFRESH - Watchdog Refresh register
769  ******************************************************************************/
770
771 /*!
772  * @brief HW_WDOG_REFRESH - Watchdog Refresh register (RW)
773  *
774  * Reset value: 0xB480U
775  */
776 typedef union _hw_wdog_refresh
777 {
778     uint16_t U;
779     struct _hw_wdog_refresh_bitfields
780     {
781         uint16_t WDOGREFRESH : 16;     /*!< [15:0]  */
782     } B;
783 } hw_wdog_refresh_t;
784
785 /*!
786  * @name Constants and macros for entire WDOG_REFRESH register
787  */
788 /*@{*/
789 #define HW_WDOG_REFRESH_ADDR(x)  ((x) + 0xCU)
790
791 #define HW_WDOG_REFRESH(x)       (*(__IO hw_wdog_refresh_t *) HW_WDOG_REFRESH_ADDR(x))
792 #define HW_WDOG_REFRESH_RD(x)    (HW_WDOG_REFRESH(x).U)
793 #define HW_WDOG_REFRESH_WR(x, v) (HW_WDOG_REFRESH(x).U = (v))
794 #define HW_WDOG_REFRESH_SET(x, v) (HW_WDOG_REFRESH_WR(x, HW_WDOG_REFRESH_RD(x) |  (v)))
795 #define HW_WDOG_REFRESH_CLR(x, v) (HW_WDOG_REFRESH_WR(x, HW_WDOG_REFRESH_RD(x) & ~(v)))
796 #define HW_WDOG_REFRESH_TOG(x, v) (HW_WDOG_REFRESH_WR(x, HW_WDOG_REFRESH_RD(x) ^  (v)))
797 /*@}*/
798
799 /*
800  * Constants & macros for individual WDOG_REFRESH bitfields
801  */
802
803 /*!
804  * @name Register WDOG_REFRESH, field WDOGREFRESH[15:0] (RW)
805  *
806  * Watchdog refresh register. A sequence of 0xA602 followed by 0xB480 within 20
807  * bus clock cycles written to this register refreshes the WDOG and prevents it
808  * from resetting the system. Writing a value other than the above mentioned
809  * sequence or if the sequence is longer than 20 bus cycles, resets the system, or if
810  * IRQRSTEN is set, it interrupts and then resets the system.
811  */
812 /*@{*/
813 #define BP_WDOG_REFRESH_WDOGREFRESH (0U)   /*!< Bit position for WDOG_REFRESH_WDOGREFRESH. */
814 #define BM_WDOG_REFRESH_WDOGREFRESH (0xFFFFU) /*!< Bit mask for WDOG_REFRESH_WDOGREFRESH. */
815 #define BS_WDOG_REFRESH_WDOGREFRESH (16U)  /*!< Bit field size in bits for WDOG_REFRESH_WDOGREFRESH. */
816
817 /*! @brief Read current value of the WDOG_REFRESH_WDOGREFRESH field. */
818 #define BR_WDOG_REFRESH_WDOGREFRESH(x) (HW_WDOG_REFRESH(x).U)
819
820 /*! @brief Format value for bitfield WDOG_REFRESH_WDOGREFRESH. */
821 #define BF_WDOG_REFRESH_WDOGREFRESH(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_REFRESH_WDOGREFRESH) & BM_WDOG_REFRESH_WDOGREFRESH)
822
823 /*! @brief Set the WDOGREFRESH field to a new value. */
824 #define BW_WDOG_REFRESH_WDOGREFRESH(x, v) (HW_WDOG_REFRESH_WR(x, v))
825 /*@}*/
826
827 /*******************************************************************************
828  * HW_WDOG_UNLOCK - Watchdog Unlock register
829  ******************************************************************************/
830
831 /*!
832  * @brief HW_WDOG_UNLOCK - Watchdog Unlock register (RW)
833  *
834  * Reset value: 0xD928U
835  */
836 typedef union _hw_wdog_unlock
837 {
838     uint16_t U;
839     struct _hw_wdog_unlock_bitfields
840     {
841         uint16_t WDOGUNLOCK : 16;      /*!< [15:0]  */
842     } B;
843 } hw_wdog_unlock_t;
844
845 /*!
846  * @name Constants and macros for entire WDOG_UNLOCK register
847  */
848 /*@{*/
849 #define HW_WDOG_UNLOCK_ADDR(x)   ((x) + 0xEU)
850
851 #define HW_WDOG_UNLOCK(x)        (*(__IO hw_wdog_unlock_t *) HW_WDOG_UNLOCK_ADDR(x))
852 #define HW_WDOG_UNLOCK_RD(x)     (HW_WDOG_UNLOCK(x).U)
853 #define HW_WDOG_UNLOCK_WR(x, v)  (HW_WDOG_UNLOCK(x).U = (v))
854 #define HW_WDOG_UNLOCK_SET(x, v) (HW_WDOG_UNLOCK_WR(x, HW_WDOG_UNLOCK_RD(x) |  (v)))
855 #define HW_WDOG_UNLOCK_CLR(x, v) (HW_WDOG_UNLOCK_WR(x, HW_WDOG_UNLOCK_RD(x) & ~(v)))
856 #define HW_WDOG_UNLOCK_TOG(x, v) (HW_WDOG_UNLOCK_WR(x, HW_WDOG_UNLOCK_RD(x) ^  (v)))
857 /*@}*/
858
859 /*
860  * Constants & macros for individual WDOG_UNLOCK bitfields
861  */
862
863 /*!
864  * @name Register WDOG_UNLOCK, field WDOGUNLOCK[15:0] (RW)
865  *
866  * Writing the unlock sequence values to this register to makes the watchdog
867  * write-once registers writable again. The required unlock sequence is 0xC520
868  * followed by 0xD928 within 20 bus clock cycles. A valid unlock sequence opens a
869  * window equal in length to the WCT within which you can update the registers.
870  * Writing a value other than the above mentioned sequence or if the sequence is
871  * longer than 20 bus cycles, resets the system or if IRQRSTEN is set, it interrupts
872  * and then resets the system. The unlock sequence is effective only if
873  * ALLOWUPDATE is set.
874  */
875 /*@{*/
876 #define BP_WDOG_UNLOCK_WDOGUNLOCK (0U)     /*!< Bit position for WDOG_UNLOCK_WDOGUNLOCK. */
877 #define BM_WDOG_UNLOCK_WDOGUNLOCK (0xFFFFU) /*!< Bit mask for WDOG_UNLOCK_WDOGUNLOCK. */
878 #define BS_WDOG_UNLOCK_WDOGUNLOCK (16U)    /*!< Bit field size in bits for WDOG_UNLOCK_WDOGUNLOCK. */
879
880 /*! @brief Read current value of the WDOG_UNLOCK_WDOGUNLOCK field. */
881 #define BR_WDOG_UNLOCK_WDOGUNLOCK(x) (HW_WDOG_UNLOCK(x).U)
882
883 /*! @brief Format value for bitfield WDOG_UNLOCK_WDOGUNLOCK. */
884 #define BF_WDOG_UNLOCK_WDOGUNLOCK(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_UNLOCK_WDOGUNLOCK) & BM_WDOG_UNLOCK_WDOGUNLOCK)
885
886 /*! @brief Set the WDOGUNLOCK field to a new value. */
887 #define BW_WDOG_UNLOCK_WDOGUNLOCK(x, v) (HW_WDOG_UNLOCK_WR(x, v))
888 /*@}*/
889
890 /*******************************************************************************
891  * HW_WDOG_TMROUTH - Watchdog Timer Output Register High
892  ******************************************************************************/
893
894 /*!
895  * @brief HW_WDOG_TMROUTH - Watchdog Timer Output Register High (RW)
896  *
897  * Reset value: 0x0000U
898  */
899 typedef union _hw_wdog_tmrouth
900 {
901     uint16_t U;
902     struct _hw_wdog_tmrouth_bitfields
903     {
904         uint16_t TIMEROUTHIGH : 16;    /*!< [15:0]  */
905     } B;
906 } hw_wdog_tmrouth_t;
907
908 /*!
909  * @name Constants and macros for entire WDOG_TMROUTH register
910  */
911 /*@{*/
912 #define HW_WDOG_TMROUTH_ADDR(x)  ((x) + 0x10U)
913
914 #define HW_WDOG_TMROUTH(x)       (*(__IO hw_wdog_tmrouth_t *) HW_WDOG_TMROUTH_ADDR(x))
915 #define HW_WDOG_TMROUTH_RD(x)    (HW_WDOG_TMROUTH(x).U)
916 #define HW_WDOG_TMROUTH_WR(x, v) (HW_WDOG_TMROUTH(x).U = (v))
917 #define HW_WDOG_TMROUTH_SET(x, v) (HW_WDOG_TMROUTH_WR(x, HW_WDOG_TMROUTH_RD(x) |  (v)))
918 #define HW_WDOG_TMROUTH_CLR(x, v) (HW_WDOG_TMROUTH_WR(x, HW_WDOG_TMROUTH_RD(x) & ~(v)))
919 #define HW_WDOG_TMROUTH_TOG(x, v) (HW_WDOG_TMROUTH_WR(x, HW_WDOG_TMROUTH_RD(x) ^  (v)))
920 /*@}*/
921
922 /*
923  * Constants & macros for individual WDOG_TMROUTH bitfields
924  */
925
926 /*!
927  * @name Register WDOG_TMROUTH, field TIMEROUTHIGH[15:0] (RW)
928  *
929  * Shows the value of the upper 16 bits of the watchdog timer.
930  */
931 /*@{*/
932 #define BP_WDOG_TMROUTH_TIMEROUTHIGH (0U)  /*!< Bit position for WDOG_TMROUTH_TIMEROUTHIGH. */
933 #define BM_WDOG_TMROUTH_TIMEROUTHIGH (0xFFFFU) /*!< Bit mask for WDOG_TMROUTH_TIMEROUTHIGH. */
934 #define BS_WDOG_TMROUTH_TIMEROUTHIGH (16U) /*!< Bit field size in bits for WDOG_TMROUTH_TIMEROUTHIGH. */
935
936 /*! @brief Read current value of the WDOG_TMROUTH_TIMEROUTHIGH field. */
937 #define BR_WDOG_TMROUTH_TIMEROUTHIGH(x) (HW_WDOG_TMROUTH(x).U)
938
939 /*! @brief Format value for bitfield WDOG_TMROUTH_TIMEROUTHIGH. */
940 #define BF_WDOG_TMROUTH_TIMEROUTHIGH(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_TMROUTH_TIMEROUTHIGH) & BM_WDOG_TMROUTH_TIMEROUTHIGH)
941
942 /*! @brief Set the TIMEROUTHIGH field to a new value. */
943 #define BW_WDOG_TMROUTH_TIMEROUTHIGH(x, v) (HW_WDOG_TMROUTH_WR(x, v))
944 /*@}*/
945
946 /*******************************************************************************
947  * HW_WDOG_TMROUTL - Watchdog Timer Output Register Low
948  ******************************************************************************/
949
950 /*!
951  * @brief HW_WDOG_TMROUTL - Watchdog Timer Output Register Low (RW)
952  *
953  * Reset value: 0x0000U
954  *
955  * During Stop mode, the WDOG_TIMER_OUT will be caught at the pre-stop value of
956  * the watchdog timer. After exiting Stop mode, a maximum delay of 1 WDOG_CLK
957  * cycle + 3 bus clock cycles will occur before the WDOG_TIMER_OUT starts following
958  * the watchdog timer.
959  */
960 typedef union _hw_wdog_tmroutl
961 {
962     uint16_t U;
963     struct _hw_wdog_tmroutl_bitfields
964     {
965         uint16_t TIMEROUTLOW : 16;     /*!< [15:0]  */
966     } B;
967 } hw_wdog_tmroutl_t;
968
969 /*!
970  * @name Constants and macros for entire WDOG_TMROUTL register
971  */
972 /*@{*/
973 #define HW_WDOG_TMROUTL_ADDR(x)  ((x) + 0x12U)
974
975 #define HW_WDOG_TMROUTL(x)       (*(__IO hw_wdog_tmroutl_t *) HW_WDOG_TMROUTL_ADDR(x))
976 #define HW_WDOG_TMROUTL_RD(x)    (HW_WDOG_TMROUTL(x).U)
977 #define HW_WDOG_TMROUTL_WR(x, v) (HW_WDOG_TMROUTL(x).U = (v))
978 #define HW_WDOG_TMROUTL_SET(x, v) (HW_WDOG_TMROUTL_WR(x, HW_WDOG_TMROUTL_RD(x) |  (v)))
979 #define HW_WDOG_TMROUTL_CLR(x, v) (HW_WDOG_TMROUTL_WR(x, HW_WDOG_TMROUTL_RD(x) & ~(v)))
980 #define HW_WDOG_TMROUTL_TOG(x, v) (HW_WDOG_TMROUTL_WR(x, HW_WDOG_TMROUTL_RD(x) ^  (v)))
981 /*@}*/
982
983 /*
984  * Constants & macros for individual WDOG_TMROUTL bitfields
985  */
986
987 /*!
988  * @name Register WDOG_TMROUTL, field TIMEROUTLOW[15:0] (RW)
989  *
990  * Shows the value of the lower 16 bits of the watchdog timer.
991  */
992 /*@{*/
993 #define BP_WDOG_TMROUTL_TIMEROUTLOW (0U)   /*!< Bit position for WDOG_TMROUTL_TIMEROUTLOW. */
994 #define BM_WDOG_TMROUTL_TIMEROUTLOW (0xFFFFU) /*!< Bit mask for WDOG_TMROUTL_TIMEROUTLOW. */
995 #define BS_WDOG_TMROUTL_TIMEROUTLOW (16U)  /*!< Bit field size in bits for WDOG_TMROUTL_TIMEROUTLOW. */
996
997 /*! @brief Read current value of the WDOG_TMROUTL_TIMEROUTLOW field. */
998 #define BR_WDOG_TMROUTL_TIMEROUTLOW(x) (HW_WDOG_TMROUTL(x).U)
999
1000 /*! @brief Format value for bitfield WDOG_TMROUTL_TIMEROUTLOW. */
1001 #define BF_WDOG_TMROUTL_TIMEROUTLOW(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_TMROUTL_TIMEROUTLOW) & BM_WDOG_TMROUTL_TIMEROUTLOW)
1002
1003 /*! @brief Set the TIMEROUTLOW field to a new value. */
1004 #define BW_WDOG_TMROUTL_TIMEROUTLOW(x, v) (HW_WDOG_TMROUTL_WR(x, v))
1005 /*@}*/
1006
1007 /*******************************************************************************
1008  * HW_WDOG_RSTCNT - Watchdog Reset Count register
1009  ******************************************************************************/
1010
1011 /*!
1012  * @brief HW_WDOG_RSTCNT - Watchdog Reset Count register (RW)
1013  *
1014  * Reset value: 0x0000U
1015  */
1016 typedef union _hw_wdog_rstcnt
1017 {
1018     uint16_t U;
1019     struct _hw_wdog_rstcnt_bitfields
1020     {
1021         uint16_t RSTCNT : 16;          /*!< [15:0]  */
1022     } B;
1023 } hw_wdog_rstcnt_t;
1024
1025 /*!
1026  * @name Constants and macros for entire WDOG_RSTCNT register
1027  */
1028 /*@{*/
1029 #define HW_WDOG_RSTCNT_ADDR(x)   ((x) + 0x14U)
1030
1031 #define HW_WDOG_RSTCNT(x)        (*(__IO hw_wdog_rstcnt_t *) HW_WDOG_RSTCNT_ADDR(x))
1032 #define HW_WDOG_RSTCNT_RD(x)     (HW_WDOG_RSTCNT(x).U)
1033 #define HW_WDOG_RSTCNT_WR(x, v)  (HW_WDOG_RSTCNT(x).U = (v))
1034 #define HW_WDOG_RSTCNT_SET(x, v) (HW_WDOG_RSTCNT_WR(x, HW_WDOG_RSTCNT_RD(x) |  (v)))
1035 #define HW_WDOG_RSTCNT_CLR(x, v) (HW_WDOG_RSTCNT_WR(x, HW_WDOG_RSTCNT_RD(x) & ~(v)))
1036 #define HW_WDOG_RSTCNT_TOG(x, v) (HW_WDOG_RSTCNT_WR(x, HW_WDOG_RSTCNT_RD(x) ^  (v)))
1037 /*@}*/
1038
1039 /*
1040  * Constants & macros for individual WDOG_RSTCNT bitfields
1041  */
1042
1043 /*!
1044  * @name Register WDOG_RSTCNT, field RSTCNT[15:0] (RW)
1045  *
1046  * Counts the number of times the watchdog resets the system. This register is
1047  * reset only on a POR. Writing 1 to the bit to be cleared enables you to clear
1048  * the contents of this register.
1049  */
1050 /*@{*/
1051 #define BP_WDOG_RSTCNT_RSTCNT (0U)         /*!< Bit position for WDOG_RSTCNT_RSTCNT. */
1052 #define BM_WDOG_RSTCNT_RSTCNT (0xFFFFU)    /*!< Bit mask for WDOG_RSTCNT_RSTCNT. */
1053 #define BS_WDOG_RSTCNT_RSTCNT (16U)        /*!< Bit field size in bits for WDOG_RSTCNT_RSTCNT. */
1054
1055 /*! @brief Read current value of the WDOG_RSTCNT_RSTCNT field. */
1056 #define BR_WDOG_RSTCNT_RSTCNT(x) (HW_WDOG_RSTCNT(x).U)
1057
1058 /*! @brief Format value for bitfield WDOG_RSTCNT_RSTCNT. */
1059 #define BF_WDOG_RSTCNT_RSTCNT(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_RSTCNT_RSTCNT) & BM_WDOG_RSTCNT_RSTCNT)
1060
1061 /*! @brief Set the RSTCNT field to a new value. */
1062 #define BW_WDOG_RSTCNT_RSTCNT(x, v) (HW_WDOG_RSTCNT_WR(x, v))
1063 /*@}*/
1064
1065 /*******************************************************************************
1066  * HW_WDOG_PRESC - Watchdog Prescaler register
1067  ******************************************************************************/
1068
1069 /*!
1070  * @brief HW_WDOG_PRESC - Watchdog Prescaler register (RW)
1071  *
1072  * Reset value: 0x0400U
1073  */
1074 typedef union _hw_wdog_presc
1075 {
1076     uint16_t U;
1077     struct _hw_wdog_presc_bitfields
1078     {
1079         uint16_t RESERVED0 : 8;        /*!< [7:0]  */
1080         uint16_t PRESCVAL : 3;         /*!< [10:8]  */
1081         uint16_t RESERVED1 : 5;        /*!< [15:11]  */
1082     } B;
1083 } hw_wdog_presc_t;
1084
1085 /*!
1086  * @name Constants and macros for entire WDOG_PRESC register
1087  */
1088 /*@{*/
1089 #define HW_WDOG_PRESC_ADDR(x)    ((x) + 0x16U)
1090
1091 #define HW_WDOG_PRESC(x)         (*(__IO hw_wdog_presc_t *) HW_WDOG_PRESC_ADDR(x))
1092 #define HW_WDOG_PRESC_RD(x)      (HW_WDOG_PRESC(x).U)
1093 #define HW_WDOG_PRESC_WR(x, v)   (HW_WDOG_PRESC(x).U = (v))
1094 #define HW_WDOG_PRESC_SET(x, v)  (HW_WDOG_PRESC_WR(x, HW_WDOG_PRESC_RD(x) |  (v)))
1095 #define HW_WDOG_PRESC_CLR(x, v)  (HW_WDOG_PRESC_WR(x, HW_WDOG_PRESC_RD(x) & ~(v)))
1096 #define HW_WDOG_PRESC_TOG(x, v)  (HW_WDOG_PRESC_WR(x, HW_WDOG_PRESC_RD(x) ^  (v)))
1097 /*@}*/
1098
1099 /*
1100  * Constants & macros for individual WDOG_PRESC bitfields
1101  */
1102
1103 /*!
1104  * @name Register WDOG_PRESC, field PRESCVAL[10:8] (RW)
1105  *
1106  * 3-bit prescaler for the watchdog clock source. A value of zero indicates no
1107  * division of the input WDOG clock. The watchdog clock is divided by (PRESCVAL +
1108  * 1) to provide the prescaled WDOG_CLK.
1109  */
1110 /*@{*/
1111 #define BP_WDOG_PRESC_PRESCVAL (8U)        /*!< Bit position for WDOG_PRESC_PRESCVAL. */
1112 #define BM_WDOG_PRESC_PRESCVAL (0x0700U)   /*!< Bit mask for WDOG_PRESC_PRESCVAL. */
1113 #define BS_WDOG_PRESC_PRESCVAL (3U)        /*!< Bit field size in bits for WDOG_PRESC_PRESCVAL. */
1114
1115 /*! @brief Read current value of the WDOG_PRESC_PRESCVAL field. */
1116 #define BR_WDOG_PRESC_PRESCVAL(x) (HW_WDOG_PRESC(x).B.PRESCVAL)
1117
1118 /*! @brief Format value for bitfield WDOG_PRESC_PRESCVAL. */
1119 #define BF_WDOG_PRESC_PRESCVAL(v) ((uint16_t)((uint16_t)(v) << BP_WDOG_PRESC_PRESCVAL) & BM_WDOG_PRESC_PRESCVAL)
1120
1121 /*! @brief Set the PRESCVAL field to a new value. */
1122 #define BW_WDOG_PRESC_PRESCVAL(x, v) (HW_WDOG_PRESC_WR(x, (HW_WDOG_PRESC_RD(x) & ~BM_WDOG_PRESC_PRESCVAL) | BF_WDOG_PRESC_PRESCVAL(v)))
1123 /*@}*/
1124
1125 /*******************************************************************************
1126  * hw_wdog_t - module struct
1127  ******************************************************************************/
1128 /*!
1129  * @brief All WDOG module registers.
1130  */
1131 #pragma pack(1)
1132 typedef struct _hw_wdog
1133 {
1134     __IO hw_wdog_stctrlh_t STCTRLH;        /*!< [0x0] Watchdog Status and Control Register High */
1135     __IO hw_wdog_stctrll_t STCTRLL;        /*!< [0x2] Watchdog Status and Control Register Low */
1136     __IO hw_wdog_tovalh_t TOVALH;          /*!< [0x4] Watchdog Time-out Value Register High */
1137     __IO hw_wdog_tovall_t TOVALL;          /*!< [0x6] Watchdog Time-out Value Register Low */
1138     __IO hw_wdog_winh_t WINH;              /*!< [0x8] Watchdog Window Register High */
1139     __IO hw_wdog_winl_t WINL;              /*!< [0xA] Watchdog Window Register Low */
1140     __IO hw_wdog_refresh_t REFRESH;        /*!< [0xC] Watchdog Refresh register */
1141     __IO hw_wdog_unlock_t UNLOCK;          /*!< [0xE] Watchdog Unlock register */
1142     __IO hw_wdog_tmrouth_t TMROUTH;        /*!< [0x10] Watchdog Timer Output Register High */
1143     __IO hw_wdog_tmroutl_t TMROUTL;        /*!< [0x12] Watchdog Timer Output Register Low */
1144     __IO hw_wdog_rstcnt_t RSTCNT;          /*!< [0x14] Watchdog Reset Count register */
1145     __IO hw_wdog_presc_t PRESC;            /*!< [0x16] Watchdog Prescaler register */
1146 } hw_wdog_t;
1147 #pragma pack()
1148
1149 /*! @brief Macro to access all WDOG registers. */
1150 /*! @param x WDOG module instance base address. */
1151 /*! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
1152  *     use the '&' operator, like <code>&HW_WDOG(WDOG_BASE)</code>. */
1153 #define HW_WDOG(x)     (*(hw_wdog_t *)(x))
1154
1155 #endif /* __HW_WDOG_REGISTERS_H__ */
1156 /* EOF */