| MINI58_BSP V3.01.003 The Board Support Package for Mini58 Series MCU

wdt.h
Go to the documentation of this file.
1/**************************************************************************/
12#ifndef __WDT_H__
13#define __WDT_H__
14
15#ifdef __cplusplus
16 extern "C"
17{
18#endif
19
20
32#define WDT_TIMEOUT_2POW4 (0UL << WDT_CTL_TOUTSEL_Pos)
33#define WDT_TIMEOUT_2POW6 (1UL << WDT_CTL_TOUTSEL_Pos)
34#define WDT_TIMEOUT_2POW8 (2UL << WDT_CTL_TOUTSEL_Pos)
35#define WDT_TIMEOUT_2POW10 (3UL << WDT_CTL_TOUTSEL_Pos)
36#define WDT_TIMEOUT_2POW12 (4UL << WDT_CTL_TOUTSEL_Pos)
37#define WDT_TIMEOUT_2POW14 (5UL << WDT_CTL_TOUTSEL_Pos)
38#define WDT_TIMEOUT_2POW16 (6UL << WDT_CTL_TOUTSEL_Pos)
39#define WDT_TIMEOUT_2POW18 (7UL << WDT_CTL_TOUTSEL_Pos)
41#define WDT_RESET_DELAY_3CLK (3UL << WDT_ALTCTL_RSTDSEL_Pos)
42#define WDT_RESET_DELAY_18CLK (2UL << WDT_ALTCTL_RSTDSEL_Pos)
43#define WDT_RESET_DELAY_130CLK (1UL << WDT_ALTCTL_RSTDSEL_Pos)
44#define WDT_RESET_DELAY_1026CLK (0UL << WDT_ALTCTL_RSTDSEL_Pos) /* end of group Mini58_WDT_EXPORTED_CONSTANTS */
48
49
58#define WDT_CLEAR_RESET_FLAG() (WDT->CTL = (WDT->CTL & ~(WDT_CTL_IF_Msk | WDT_CTL_WKF_Msk)) | WDT_CTL_RSTF_Msk)
59
64#define WDT_CLEAR_TIMEOUT_INT_FLAG() (WDT->CTL = (WDT->CTL & ~(WDT_CTL_RSTF_Msk | WDT_CTL_WKF_Msk)) | WDT_CTL_IF_Msk)
65
70#define WDT_CLEAR_TIMEOUT_WAKEUP_FLAG() (WDT->CTL = (WDT->CTL & ~(WDT_CTL_RSTF_Msk | WDT_CTL_IF_Msk)) | WDT_CTL_WKF_Msk)
71
79#define WDT_GET_RESET_FLAG() (WDT->CTL & WDT_CTL_RSTF_Msk ? 1 : 0)
80
88#define WDT_GET_TIMEOUT_INT_FLAG() (WDT->CTL & WDT_CTL_IF_Msk ? 1 : 0)
89
97#define WDT_GET_TIMEOUT_WAKEUP_FLAG() (WDT->CTL & WDT_CTL_WKF_Msk ? 1 : 0)
98
105#define WDT_RESET_COUNTER() (WDT->CTL = (WDT->CTL & ~(WDT_CTL_IF_Msk | WDT_CTL_WKF_Msk | WDT_CTL_RSTF_Msk)) | WDT_CTL_RSTCNT_Msk)
106
107
108 void WDT_Open(uint32_t u32TimeoutInterval,
109 uint32_t u32ResetDelay,
110 uint32_t u32EnableReset,
111 uint32_t u32EnableWakeup);
112 void WDT_Close(void);
113
114 void WDT_EnableInt(void);
115 void WDT_DisableInt(void);
116 /* end of group Mini58_WDT_EXPORTED_FUNCTIONS */
118 /* end of group Mini58_WDT_Driver */
120 /* end of group Mini58_Device_Driver */
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif //__WDT_H__
128
129/*** (C) COPYRIGHT 2022 Nuvoton Technology Corp. ***/
WDT_Close
void WDT_Close(void)
This function stops WDT counting and disable WDT module.
Definition: wdt.c:65
WDT_DisableInt
void WDT_DisableInt(void)
This function disables the WDT time-out interrupt.
Definition: wdt.c:87
WDT_EnableInt
void WDT_EnableInt(void)
This function enables the WDT time-out interrupt.
Definition: wdt.c:76
WDT_Open
void WDT_Open(uint32_t u32TimeoutInterval, uint32_t u32ResetDelay, uint32_t u32EnableReset, uint32_t u32EnableWakeup)
This function make WDT module start counting with different time-out interval.
Definition: wdt.c:47