EFR32 Mighty Gecko 1 Software Documentation
efr32mg1-doc-5.1.2
|
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 |
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. More... | |
__STATIC_INLINE void | WDOG_Feed (void) |
Feed the watchdog. More... | |
__STATIC_INLINE void | WDOG_Init (const WDOG_Init_TypeDef *init) |
Initialize watchdog (assuming the watchdog configuration has not been locked). More... | |
__STATIC_INLINE void | WDOG_Lock (void) |
Lock the watchdog configuration. More... | |
void | WDOGn_Enable (WDOG_TypeDef *wdog, bool enable) |
Enable/disable the watchdog timer. More... | |
void | WDOGn_Feed (WDOG_TypeDef *wdog) |
Feed the watchdog. More... | |
void | WDOGn_Init (WDOG_TypeDef *wdog, const WDOG_Init_TypeDef *init) |
Initialize watchdog (assuming the watchdog configuration has not been locked). More... | |
__STATIC_INLINE void | WDOGn_IntClear (WDOG_TypeDef *wdog, uint32_t flags) |
Clear one or more pending WDOG interrupts. More... | |
__STATIC_INLINE void | WDOGn_IntDisable (WDOG_TypeDef *wdog, uint32_t flags) |
Disable one or more WDOG interrupts. More... | |
__STATIC_INLINE void | WDOGn_IntEnable (WDOG_TypeDef *wdog, uint32_t flags) |
Enable one or more WDOG interrupts. More... | |
__STATIC_INLINE uint32_t | WDOGn_IntGet (WDOG_TypeDef *wdog) |
Get pending WDOG interrupt flags. More... | |
__STATIC_INLINE uint32_t | WDOGn_IntGetEnabled (WDOG_TypeDef *wdog) |
Get enabled and pending WDOG interrupt flags. More... | |
__STATIC_INLINE void | WDOGn_IntSet (WDOG_TypeDef *wdog, uint32_t flags) |
Set one or more pending WDOG interrupts from SW. More... | |
void | WDOGn_Lock (WDOG_TypeDef *wdog) |
Lock the watchdog configuration. More... | |
#define DEFAULT_WDOG WDOG0 |
Default WDOG instance for deprecated functions.
Definition at line 334 of file em_wdog.h.
Referenced by WDOG_Enable(), WDOG_Feed(), WDOG_Init(), and WDOG_Lock().
#define WDOG_INIT_DEFAULT |
Suggested default config for WDOG init structure.
enum WDOG_ClkSel_TypeDef |
Watchdog period selection.
enum WDOG_WarnSel_TypeDef |
enum WDOG_WinSel_TypeDef |
__STATIC_INLINE void WDOG_Enable | ( | bool | enable | ) |
Enable/disable the watchdog timer.
[in] | enable | true to enable watchdog, false to disable. Watchdog cannot be disabled if watchdog has been locked. |
Definition at line 350 of file em_wdog.h.
References DEFAULT_WDOG, and WDOGn_Enable().
__STATIC_INLINE void WDOG_Feed | ( | void | ) |
Feed the watchdog.
Definition at line 364 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).
[in] | init | Structure holding watchdog configuration. A default setting WDOG_INIT_DEFAULT is available for init. |
Definition at line 383 of file em_wdog.h.
References DEFAULT_WDOG, and WDOGn_Init().
__STATIC_INLINE void WDOG_Lock | ( | void | ) |
Lock the watchdog configuration.
Definition at line 397 of file em_wdog.h.
References DEFAULT_WDOG, and WDOGn_Lock().
void WDOGn_Enable | ( | WDOG_TypeDef * | wdog, |
bool | enable | ||
) |
Enable/disable the watchdog timer.
[in] | wdog | Pointer to WDOG peripheral register block. |
[in] | enable | true to enable watchdog, false to disable. Watchdog cannot be disabled if watchdog has been locked. |
Definition at line 75 of file em_wdog.c.
References _WDOG_CTRL_EN_SHIFT, BUS_RegBitRead(), BUS_RegBitWrite(), WDOG_TypeDef::CTRL, WDOG_TypeDef::SYNCBUSY, WDOG_CTRL_LOCK, and WDOG_SYNCBUSY_CTRL.
Referenced by WDOG_Enable().
void WDOGn_Feed | ( | WDOG_TypeDef * | wdog | ) |
Feed the watchdog.
When the watchdog is activated, it must be fed (ie clearing the counter) before it reaches the defined timeout period. Otherwise, the watchdog will generate a reset.
[in] | wdog | Pointer to WDOG peripheral register block. |
Definition at line 115 of file em_wdog.c.
References WDOG_TypeDef::CMD, WDOG_TypeDef::CTRL, WDOG_TypeDef::SYNCBUSY, WDOG_CMD_CLEAR, WDOG_CTRL_EN, WDOG_SYNCBUSY_CMD, and WDOG_SYNCBUSY_CTRL.
Referenced by WDOG_Feed().
void WDOGn_Init | ( | WDOG_TypeDef * | wdog, |
const WDOG_Init_TypeDef * | init | ||
) |
Initialize watchdog (assuming the watchdog configuration has not been locked).
[in] | wdog | Pointer to WDOG peripheral register block. |
[in] | init | Structure holding watchdog configuration. A default setting WDOG_INIT_DEFAULT is available for init. |
Definition at line 158 of file em_wdog.c.
References _WDOG_CTRL_CLKSEL_SHIFT, _WDOG_CTRL_PERSEL_SHIFT, _WDOG_CTRL_WARNSEL_MASK, _WDOG_CTRL_WARNSEL_SHIFT, _WDOG_CTRL_WINSEL_MASK, _WDOG_CTRL_WINSEL_SHIFT, WDOG_Init_TypeDef::clkSel, WDOG_TypeDef::CTRL, 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_TypeDef::SYNCBUSY, WDOG_Init_TypeDef::warnSel, WDOG_CTRL_DEBUGRUN, WDOG_CTRL_EM2RUN, WDOG_CTRL_EM3RUN, WDOG_CTRL_EM4BLOCK, WDOG_CTRL_EN, WDOG_CTRL_LOCK, WDOG_CTRL_SWOSCBLOCK, WDOG_CTRL_WDOGRSTDIS, WDOG_SYNCBUSY_CTRL, 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.
[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 226 of file em_wdog.h.
References WDOG_TypeDef::IFC.
__STATIC_INLINE void WDOGn_IntDisable | ( | WDOG_TypeDef * | wdog, |
uint32_t | flags | ||
) |
Disable one or more WDOG interrupts.
[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 242 of file em_wdog.h.
References WDOG_TypeDef::IEN.
__STATIC_INLINE void WDOGn_IntEnable | ( | WDOG_TypeDef * | wdog, |
uint32_t | flags | ||
) |
Enable one or more WDOG interrupts.
[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 263 of file em_wdog.h.
References WDOG_TypeDef::IEN.
__STATIC_INLINE uint32_t WDOGn_IntGet | ( | WDOG_TypeDef * | wdog | ) |
Get pending WDOG interrupt flags.
[in] | wdog | Pointer to WDOG peripheral register block. |
Definition at line 282 of file em_wdog.h.
References WDOG_TypeDef::IF.
__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.
[in] | wdog | Pointer to WDOG peripheral register block. |
Definition at line 301 of file em_wdog.h.
References WDOG_TypeDef::IEN, and WDOG_TypeDef::IF.
__STATIC_INLINE void WDOGn_IntSet | ( | WDOG_TypeDef * | wdog, |
uint32_t | flags | ||
) |
Set one or more pending WDOG interrupts from SW.
[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 322 of file em_wdog.h.
References WDOG_TypeDef::IFS.
void WDOGn_Lock | ( | WDOG_TypeDef * | wdog | ) |
Lock the watchdog configuration.
This prevents errors from overwriting the watchdog configuration, possibly disabling it. Only a reset can unlock the watchdog config, once locked.
If the LFRCO or LFXO clocks are used to clock the watchdog, one should consider using the option of inhibiting those clocks to be disabled, please see the WDOG_Enable() init structure.
[in] | wdog | Pointer to WDOG peripheral register block. |
Definition at line 243 of file em_wdog.c.
References _WDOG_CTRL_LOCK_SHIFT, BUS_RegBitWrite(), WDOG_TypeDef::CTRL, WDOG_TypeDef::SYNCBUSY, and WDOG_SYNCBUSY_CTRL.
Referenced by WDOG_Lock().