Functions | |
static bool | WatchdogRunning (void) |
Determines if the watchdog timer is enabled. More... | |
static void | WatchdogEnable (void) |
Enables the watchdog timer. More... | |
static void | WatchdogResetEnable (void) |
Enables the watchdog timer reset. More... | |
static void | WatchdogResetDisable (void) |
Disables the watchdog timer reset. More... | |
static void | WatchdogLock (void) |
Enables the watchdog timer lock mechanism. More... | |
static void | WatchdogUnlock (void) |
Disables the watchdog timer lock mechanism. More... | |
static bool | WatchdogLockState (void) |
Gets the state of the watchdog timer lock mechanism. More... | |
static void | WatchdogReloadSet (uint32_t ui32LoadVal) |
Sets the watchdog timer reload value. More... | |
static uint32_t | WatchdogReloadGet (void) |
Gets the watchdog timer reload value. More... | |
static uint32_t | WatchdogValueGet (void) |
Gets the current watchdog timer value. More... | |
static void | WatchdogIntRegister (void(*pfnHandler)(void)) |
Registers an interrupt handler for the watchdog timer interrupt in the dynamic interrupt table. More... | |
static void | WatchdogIntUnregister (void) |
Unregisters an interrupt handler for the watchdog timer interrupt in the dynamic interrupt table. More... | |
static void | WatchdogIntEnable (void) |
Enables the watchdog timer. More... | |
static uint32_t | WatchdogIntStatus (void) |
Gets the current watchdog timer interrupt status. More... | |
static void | WatchdogIntClear (void) |
Clears the watchdog timer interrupt. More... | |
static void | WatchdogIntTypeSet (uint32_t ui32Type) |
Sets the type of interrupt generated by the watchdog. More... | |
static void | WatchdogStallEnable (void) |
Enables stalling of the watchdog timer during debug events. More... | |
static void | WatchdogStallDisable (void) |
Disables stalling of the watchdog timer during debug events. More... | |
The Watchdog Timer (WDT) allows the application to regain control if the system stalls due to unexpected software behavior. The WDT can generate a normal interrupt or a non-maskable interrupt on the first time-out and a system reset on the following time-out if the application fails to restart the WDT.
WDT has the following features:
The WDT runs at system HF clock divided by 32; however, when in powerdown it runs at LF clock (32 kHz) - if the LF clock to the MCU domain is enabled.
If application does not restart the WDT, using WatchdogIntClear(), before a time-out:
A reset caused by the WDT can be detected as a "warm reset" using SysCtrlResetSourceGet(). However, it is not possible to detect which of the warm reset sources that caused the reset.
Typical use case:
The API functions can be grouped like this:
Watchdog configuration:
Status:
Interrupt configuration:
Register protection:
Stall configuration for debugging:
|
inlinestatic |
Enables the watchdog timer.
This function enables the watchdog timer counter and interrupt.
Once enabled, the watchdog interrupt can only be disabled by a hardware reset.
Referenced by WatchdogIntEnable().
|
inlinestatic |
Clears the watchdog timer interrupt.
The watchdog timer interrupt source is cleared, so that it no longer asserts.
|
inlinestatic |
Enables the watchdog timer.
This function enables the watchdog timer interrupt by calling WatchdogEnable().
|
inlinestatic |
Registers an interrupt handler for the watchdog timer interrupt in the dynamic interrupt table.
This function registers a function as the interrupt handler for a specific interrupt and enables the corresponding interrupt in the interrupt controller.
The watchdog timer interrupt must be enabled via WatchdogIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source via WatchdogIntClear().
pfnHandler | is a pointer to the function to be called when the watchdog timer interrupt occurs. |
|
inlinestatic |
Gets the current watchdog timer interrupt status.
This function returns the interrupt status for the watchdog timer module.
|
inlinestatic |
Sets the type of interrupt generated by the watchdog.
This function sets the type of interrupt that is generated if the watchdog timer expires.
When configured to generate an NMI, the watchdog interrupt must still be enabled with WatchdogIntEnable(), and it must still be cleared inside the NMI handler with WatchdogIntClear().
ui32Type | is the type of interrupt to generate.
|
|
inlinestatic |
Unregisters an interrupt handler for the watchdog timer interrupt in the dynamic interrupt table.
This function does the actual unregistering of the interrupt handler. This function clears the handler to be called when a watchdog timer interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.
|
inlinestatic |
Enables the watchdog timer lock mechanism.
This function locks out write access to the watchdog timer configuration registers.
|
inlinestatic |
Gets the state of the watchdog timer lock mechanism.
This function returns the lock state of the watchdog timer registers.
true
: Watchdog timer registers are locked.false
: Registers are not locked.
|
inlinestatic |
Gets the watchdog timer reload value.
This function gets the value that is loaded into the watchdog timer when the count reaches zero for the first time.
|
inlinestatic |
Sets the watchdog timer reload value.
This function configures the value to load into the watchdog timer when the count reaches zero for the first time; if the watchdog timer is running when this function is called, then the value is immediately loaded into the watchdog timer counter. If the ui32LoadVal
parameter is 0, then an interrupt is immediately generated.
ui32LoadVal | is the load value for the watchdog timer. |
|
inlinestatic |
Disables the watchdog timer reset.
This function disables the capability of the watchdog timer to issue a reset to the processor after a second timeout condition.
|
inlinestatic |
Enables the watchdog timer reset.
This function enables the capability of the watchdog timer to issue a reset to the processor after a second timeout condition.
|
inlinestatic |
Determines if the watchdog timer is enabled.
This function checks to see if the watchdog timer is enabled.
true
: Watchdog timer is enabled.false
: Watchdog timer is disabled.
|
inlinestatic |
Disables stalling of the watchdog timer during debug events.
This function disables the debug mode stall of the watchdog timer. By doing so, the watchdog timer continues to count regardless of the processor debug state.
|
inlinestatic |
Enables stalling of the watchdog timer during debug events.
This function allows the watchdog timer to stop counting when the processor is stopped by the debugger. By doing so, the watchdog is prevented from expiring and resetting the system (if reset is enabled). The watchdog instead expires after the appropriate number of processor cycles have been executed while debugging (or at the appropriate time after the processor has been restarted).
|
inlinestatic |
Disables the watchdog timer lock mechanism.
This function enables write access to the watchdog timer configuration registers.
|
inlinestatic |
#define WATCHDOG_INT_TIMEOUT 0x00000001 |
Referenced by WatchdogIntClear().
#define WATCHDOG_INT_TYPE_INT WDT_CTL_INTTYPE_MASKABLE |
Referenced by WatchdogIntTypeSet().
#define WATCHDOG_INT_TYPE_NMI WDT_CTL_INTTYPE_NONMASKABLE |
Referenced by WatchdogIntTypeSet().
#define WATCHDOG_LOCK_LOCKED 0x00000001 |
Referenced by WatchdogLock(), and WatchdogLockState().
#define WATCHDOG_LOCK_UNLOCK 0x1ACCE551 |
Referenced by WatchdogUnlock().
#define WATCHDOG_LOCK_UNLOCKED 0x00000000 |