WDOG
Detailed Description
Watchdog (WDOG) Peripheral API.
This module contains functions to control the WDOG peripheral of Silicon Labs 32-bit MCUs and SoCs. The WDOG resets the system in case of a fault condition.
Data Structures |
|
struct | WDOG_Init_TypeDef |
Macros |
|
#define | DEFAULT_WDOG WDOG0 |
#define | WDOG_INIT_DEFAULT |
#define | WDOG_SYNC_TIMEOUT 30000 |
Enumerations |
|
enum |
WDOG_ClkSel_TypeDef
{
wdogClkSelULFRCO = _WDOG_CTRL_CLKSEL_ULFRCO, wdogClkSelLFRCO = _WDOG_CTRL_CLKSEL_LFRCO, wdogClkSelLFXO = _WDOG_CTRL_CLKSEL_LFXO } |
enum |
WDOG_PeriodSel_TypeDef
{
wdogPeriod_9 = 0x0, wdogPeriod_17 = 0x1, wdogPeriod_33 = 0x2, wdogPeriod_65 = 0x3, wdogPeriod_129 = 0x4, wdogPeriod_257 = 0x5, wdogPeriod_513 = 0x6, wdogPeriod_1k = 0x7, wdogPeriod_2k = 0x8, wdogPeriod_4k = 0x9, wdogPeriod_8k = 0xA, wdogPeriod_16k = 0xB, wdogPeriod_32k = 0xC, wdogPeriod_64k = 0xD, wdogPeriod_128k = 0xE, wdogPeriod_256k = 0xF } |
enum |
WDOG_WarnSel_TypeDef
{
wdogWarnDisable = 0, wdogWarnTime25pct = 1, wdogWarnTime50pct = 2, wdogWarnTime75pct = 3 } |
enum |
WDOG_WinSel_TypeDef
{
wdogIllegalWindowDisable = 0, wdogIllegalWindowTime12_5pct = 1, wdogIllegalWindowTime25_0pct = 2, wdogIllegalWindowTime37_5pct = 3, wdogIllegalWindowTime50_0pct = 4, wdogIllegalWindowTime62_5pct = 5, wdogIllegalWindowTime75_0pct = 6, wdogIllegalWindowTime87_5pct = 7 } |
Functions |
|
__STATIC_INLINE void | WDOG_Enable (bool enable) |
Enable/disable the watchdog timer.
|
|
__STATIC_INLINE void | WDOG_Feed (void) |
Feed the watchdog.
|
|
__STATIC_INLINE void | WDOG_Init (const WDOG_Init_TypeDef *init) |
Initialize watchdog (assuming the watchdog configuration has not been locked).
|
|
__STATIC_INLINE bool | WDOG_IsEnabled (void) |
Get enabled status of the watchdog.
|
|
__STATIC_INLINE bool | WDOG_IsLocked (void) |
Get locked status of the watchdog.
|
|
__STATIC_INLINE void | WDOG_Lock (void) |
Lock the watchdog configuration.
|
|
void | WDOGn_Enable (WDOG_TypeDef *wdog, bool enable) |
Enable/disable the watchdog timer.
|
|
void | WDOGn_Feed (WDOG_TypeDef *wdog) |
Feed WDOG.
|
|
void | WDOGn_Init (WDOG_TypeDef *wdog, const WDOG_Init_TypeDef *init) |
Initialize WDOG (assuming the WDOG configuration has not been locked).
|
|
__STATIC_INLINE void | WDOGn_IntClear (WDOG_TypeDef *wdog, uint32_t flags) |
Clear one or more pending WDOG interrupts.
|
|
__STATIC_INLINE void | WDOGn_IntDisable (WDOG_TypeDef *wdog, uint32_t flags) |
Disable one or more WDOG interrupts.
|
|
__STATIC_INLINE void | WDOGn_IntEnable (WDOG_TypeDef *wdog, uint32_t flags) |
Enable one or more WDOG interrupts.
|
|
__STATIC_INLINE uint32_t | WDOGn_IntGet (WDOG_TypeDef *wdog) |
Get pending WDOG interrupt flags.
|
|
__STATIC_INLINE uint32_t | WDOGn_IntGetEnabled (WDOG_TypeDef *wdog) |
Get enabled and pending WDOG interrupt flags.
|
|
__STATIC_INLINE void | WDOGn_IntSet (WDOG_TypeDef *wdog, uint32_t flags) |
Set one or more pending WDOG interrupts from SW.
|
|
__STATIC_INLINE bool | WDOGn_IsEnabled (WDOG_TypeDef *wdog) |
Get enabled status of the watchdog.
|
|
__STATIC_INLINE bool | WDOGn_IsLocked (WDOG_TypeDef *wdog) |
Get locked status of the watchdog.
|
|
void | WDOGn_Lock (WDOG_TypeDef *wdog) |
Lock the WDOG configuration.
|
|
void | WDOGn_SyncWait (WDOG_TypeDef *wdog) |
Wait for the WDOG to complete all synchronization of register changes and commands.
|
|
void | WDOGn_Unlock (WDOG_TypeDef *wdog) |
Unlock the WDOG configuration.
|
|
Macro Definition Documentation
#define DEFAULT_WDOG WDOG0 |
Default WDOG instance for deprecated functions.
Definition at line
60
of file
em_wdog.h
.
Referenced by WDOG_Enable() , WDOG_Feed() , WDOG_Init() , WDOG_IsEnabled() , WDOG_IsLocked() , and WDOG_Lock() .
#define WDOG_INIT_DEFAULT |
Suggested default configuration for WDOG initialization structure.
Definition at line
199
of file
em_wdog.h
.
Enumeration Type Documentation
enum WDOG_ClkSel_TypeDef |
Watchdog period selection.
Definition at line
80
of file
em_wdog.h
.
enum WDOG_WarnSel_TypeDef |
Select watchdog warning timeout period as percentage of timeout.
Definition at line
102
of file
em_wdog.h
.
enum WDOG_WinSel_TypeDef |
Select watchdog illegal window limit.
Definition at line
113
of file
em_wdog.h
.
Function Documentation
__STATIC_INLINE void WDOG_Enable | ( | bool |
enable
|
) |
Enable/disable the watchdog timer.
-
Deprecated:
- Deprecated function. New code should use WDOGn_Enable() . This function uses DEFAULT_WDOG .
- Parameters
-
[in] enable
Set to true to enable watchdog, false to disable. Watchdog cannot be disabled if watchdog has been locked.
Definition at line
414
of file
em_wdog.h
.
References DEFAULT_WDOG , and WDOGn_Enable() .
__STATIC_INLINE void WDOG_Feed | ( | void |
|
) |
Feed the watchdog.
-
Deprecated:
- Deprecated function. New code should use WDOGn_Feed() . This function uses DEFAULT_WDOG .
Definition at line
427
of file
em_wdog.h
.
References DEFAULT_WDOG , and WDOGn_Feed() .
__STATIC_INLINE void WDOG_Init | ( | const WDOG_Init_TypeDef * |
init
|
) |
Initialize watchdog (assuming the watchdog configuration has not been locked).
-
Deprecated:
- Deprecated function. New code should use WDOGn_Init() . This function uses DEFAULT_WDOG .
- Parameters
-
[in] init
Structure holding watchdog configuration. A default setting WDOG_INIT_DEFAULT is available for initialization.
Definition at line
445
of file
em_wdog.h
.
References DEFAULT_WDOG , and WDOGn_Init() .
__STATIC_INLINE bool WDOG_IsEnabled | ( | void |
|
) |
Get enabled status of the watchdog.
-
Deprecated:
- Deprecated function. New code should use WDOGn_IsEnabled() . This function uses DEFAULT_WDOG .
Definition at line
471
of file
em_wdog.h
.
References DEFAULT_WDOG , and WDOGn_IsEnabled() .
__STATIC_INLINE bool WDOG_IsLocked | ( | void |
|
) |
Get locked status of the watchdog.
-
Deprecated:
- Deprecated function. New code should use WDOGn_IsLocked() . This function uses DEFAULT_WDOG .
Definition at line
484
of file
em_wdog.h
.
References DEFAULT_WDOG , and WDOGn_IsLocked() .
__STATIC_INLINE void WDOG_Lock | ( | void |
|
) |
Lock the watchdog configuration.
-
Deprecated:
- Deprecated function. New code should use WDOGn_Lock() . This function uses DEFAULT_WDOG .
Definition at line
458
of file
em_wdog.h
.
References DEFAULT_WDOG , and WDOGn_Lock() .
void WDOGn_Enable | ( | WDOG_TypeDef * |
wdog,
|
bool |
enable
|
||
) |
Enable/disable the watchdog timer.
- Note
- This function modifies the WDOG CTRL register which requires synchronization into the low-frequency domain. If this register is modified before a previous update to the same register has completed, this function will stall until the previous synchronization has completed.
- Parameters
-
[in] wdog
A pointer to the WDOG peripheral register block. [in] enable
True to enable Watchdog, false to disable. Watchdog cannot be disabled if it's been locked.
Definition at line
80
of file
em_wdog.c
.
References BUS_RegBitWrite() .
Referenced by WDOG_Enable() , and WDOGn_Init() .
void WDOGn_Feed | ( | WDOG_TypeDef * |
wdog
|
) |
Feed WDOG.
When WDOG is activated, it must be fed (i.e., clearing the counter) before it reaches the defined timeout period. Otherwise, WDOG will generate a reset.
- Note
- Note that WDOG is an asynchronous peripheral and when calling the WDOGn_Feed() function the hardware starts the process of clearing the counter. This process takes some time before it completes depending on the selected oscillator (up to 4 peripheral clock cycles). When using the ULFRCO for instance as the oscillator the watchdog runs on a 1 kHz clock and a watchdog clear operation might take up to 4 ms.
If the device enters EM2 or EM3 while a command is in progress then that command will be aborted. An application can use WDOGn_SyncWait() to wait for a command to complete.
- Parameters
-
[in] wdog
A pointer to the WDOG peripheral register block.
Definition at line
142
of file
em_wdog.c
.
References CORE_DECLARE_IRQ_STATE , CORE_ENTER_ATOMIC , and CORE_EXIT_ATOMIC .
Referenced by WDOG_Feed() .
void WDOGn_Init | ( | WDOG_TypeDef * |
wdog,
|
const WDOG_Init_TypeDef * |
init
|
||
) |
Initialize WDOG (assuming the WDOG configuration has not been locked).
- Note
- This function modifies the WDOG CTRL register which requires synchronization into the low-frequency domain. If this register is modified before a previous update to the same register has completed, this function will stall until the previous synchronization has completed.
- Parameters
-
[in] wdog
Pointer to the WDOG peripheral register block. [in] init
The structure holding the WDOG configuration. A default setting WDOG_INIT_DEFAULT is available for initialization.
Definition at line
204
of file
em_wdog.c
.
References WDOG_Init_TypeDef::clkSel , WDOG_Init_TypeDef::debugRun , WDOG_Init_TypeDef::em2Run , WDOG_Init_TypeDef::em3Run , WDOG_Init_TypeDef::em4Block , WDOG_Init_TypeDef::enable , WDOG_Init_TypeDef::lock , WDOG_Init_TypeDef::perSel , WDOG_Init_TypeDef::resetDisable , WDOG_Init_TypeDef::swoscBlock , WDOG_Init_TypeDef::warnSel , WDOGn_Enable() , WDOGn_Lock() , and WDOG_Init_TypeDef::winSel .
Referenced by WDOG_Init() .
__STATIC_INLINE void WDOGn_IntClear | ( | WDOG_TypeDef * |
wdog,
|
uint32_t |
flags
|
||
) |
Clear one or more pending WDOG interrupts.
- Parameters
-
[in] wdog
Pointer to WDOG peripheral register block. [in] flags
WDOG interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources.
Definition at line
252
of file
em_wdog.h
.
__STATIC_INLINE void WDOGn_IntDisable | ( | WDOG_TypeDef * |
wdog,
|
uint32_t |
flags
|
||
) |
Disable one or more WDOG interrupts.
- Parameters
-
[in] wdog
Pointer to WDOG peripheral register block. [in] flags
WDOG interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt.
Definition at line
272
of file
em_wdog.h
.
__STATIC_INLINE void WDOGn_IntEnable | ( | WDOG_TypeDef * |
wdog,
|
uint32_t |
flags
|
||
) |
Enable one or more WDOG interrupts.
- Note
- Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using WDOG_IntClear() prior to enabling the interrupt.
- Parameters
-
[in] wdog
Pointer to WDOG peripheral register block. [in] flags
WDOG interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt.
Definition at line
297
of file
em_wdog.h
.
__STATIC_INLINE uint32_t WDOGn_IntGet | ( | WDOG_TypeDef * |
wdog
|
) |
Get pending WDOG interrupt flags.
- Note
- The event bits are not cleared by the use of this function.
- Parameters
-
[in] wdog
Pointer to WDOG peripheral register block.
- Returns
- Pending WDOG interrupt sources. Returns a set of interrupt flags OR-ed together for the interrupt sources set.
Definition at line
320
of file
em_wdog.h
.
__STATIC_INLINE uint32_t WDOGn_IntGetEnabled | ( | WDOG_TypeDef * |
wdog
|
) |
Get enabled and pending WDOG interrupt flags.
Useful for handling more interrupt sources in the same interrupt handler.
- Parameters
-
[in] wdog
Pointer to WDOG peripheral register block.
- Returns
- Pending and enabled WDOG interrupt sources. Returns a set of interrupt flags OR-ed together for the interrupt sources set.
Definition at line
339
of file
em_wdog.h
.
__STATIC_INLINE void WDOGn_IntSet | ( | WDOG_TypeDef * |
wdog,
|
uint32_t |
flags
|
||
) |
Set one or more pending WDOG interrupts from SW.
- Parameters
-
[in] wdog
Pointer to WDOG peripheral register block. [in] flags
WDOG interrupt sources to set to pending. Use a set of interrupt flags (WDOG_IFS_nnn).
Definition at line
360
of file
em_wdog.h
.
__STATIC_INLINE bool WDOGn_IsEnabled | ( | WDOG_TypeDef * |
wdog
|
) |
Get enabled status of the watchdog.
- Parameters
-
[in] wdog
Pointer to WDOG peripheral register block.
Definition at line
377
of file
em_wdog.h
.
Referenced by WDOG_IsEnabled() .
__STATIC_INLINE bool WDOGn_IsLocked | ( | WDOG_TypeDef * |
wdog
|
) |
Get locked status of the watchdog.
- Parameters
-
[in] wdog
Pointer to WDOG peripheral register block.
Definition at line
393
of file
em_wdog.h
.
Referenced by WDOG_IsLocked() .
void WDOGn_Lock | ( | WDOG_TypeDef * |
wdog
|
) |
Lock the WDOG configuration.
This prevents errors from overwriting the WDOG configuration, possibly disabling it. Only a reset can unlock the WDOG configuration once locked.
If the LFRCO or LFXO clocks are used to clock WDOG, consider using the option of inhibiting those clocks to be disabled. See the WDOG_Enable() initialization structure.
- Note
- This function modifies the WDOG CTRL register which requires synchronization into the low-frequency domain. If this register is modified before a previous update to the same register has completed, this function will stall until the previous synchronization has completed.
- Parameters
-
[in] wdog
A pointer to WDOG peripheral register block.
Definition at line
285
of file
em_wdog.c
.
References BUS_RegBitWrite() .
Referenced by WDOG_Lock() , and WDOGn_Init() .
void WDOGn_SyncWait | ( | WDOG_TypeDef * |
wdog
|
) |
Wait for the WDOG to complete all synchronization of register changes and commands.
- Parameters
-
[in] wdog
A pointer to WDOG peripheral register block.
Definition at line
308
of file
em_wdog.c
.
void WDOGn_Unlock | ( | WDOG_TypeDef * |
wdog
|
) |
Unlock the WDOG configuration.
Note that this function will have no effect on devices where a reset is the only way to unlock the watchdog.
- Parameters
-
[in] wdog
A pointer to WDOG peripheral register block.
Definition at line
332
of file
em_wdog.c
.