The MCUXpresso SDK provides a peripheral driver for the Watchdog module (WDOG) of MCUXpresso SDK devices.
Typical use case
config.enablePowerdown = false;
|
#define | WDOG_REFRESH_KEY (0xAAAA5555U) |
|
Data Fields |
bool | enableWait |
| continue or suspend WDOG in wait mode
|
|
bool | enableStop |
| continue or suspend WDOG in stop mode
|
|
bool | enableDebug |
| continue or suspend WDOG in debug mode
|
|
This structure contains the settings for all of the WDOG interrupt configurations.
Enumerator |
---|
kWDOG_InterruptEnable |
WDOG timeout generates an interrupt before reset.
|
This structure contains the WDOG status flags for use in the WDOG functions.
Enumerator |
---|
kWDOG_RunningFlag |
Running flag, set when WDOG is enabled.
|
kWDOG_PowerOnResetFlag |
Power On flag, set when reset is the result of a powerOnReset.
|
kWDOG_TimeoutResetFlag |
Timeout flag, set when reset is the result of a timeout.
|
kWDOG_SoftwareResetFlag |
Software flag, set when reset is the result of a software.
|
kWDOG_InterruptFlag |
interrupt flag,whether interrupt has occurred or not
|
This function initializes the WDOG configuration structure to default values. The default values are as follows.
* wdogConfig->enableWdog = true;
* wdogConfig->workMode.enableWait = true;
* wdogConfig->workMode.enableStop = false;
* wdogConfig->workMode.enableDebug = false;
* wdogConfig->enableInterrupt = false;
* wdogConfig->enablePowerdown = false;
* wdogConfig->resetExtension = flase;
* wdogConfig->timeoutValue = 0xFFU;
* wdogConfig->interruptTimeValue = 0x04u;
*
- Parameters
-
config | Pointer to the WDOG configuration structure. |
- See Also
- wdog_config_t
void WDOG_Init |
( |
WDOG_Type * |
base, |
|
|
const wdog_config_t * |
config |
|
) |
| |
This function initializes the WDOG. When called, the WDOG runs according to the configuration.
This is an example.
- Parameters
-
base | WDOG peripheral base address |
config | The configuration of WDOG |
void WDOG_Deinit |
( |
WDOG_Type * |
base | ) |
|
This function shuts down the WDOG. Watchdog Enable bit is a write one once only bit. It is not possible to clear this bit by a software write, once the bit is set. This bit(WDE) can be set/reset only in debug mode(exception).
static void WDOG_Enable |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function writes a value into the WDOG_WCR register to enable the WDOG. This is a write one once only bit. It is not possible to clear this bit by a software write, once the bit is set. only debug mode exception.
- Parameters
-
base | WDOG peripheral base address |
static void WDOG_Disable |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function writes a value into the WDOG_WCR register to disable the WDOG. This is a write one once only bit. It is not possible to clear this bit by a software write,once the bit is set. only debug mode exception
- Parameters
-
base | WDOG peripheral base address |
static void WDOG_EnableInterrupts |
( |
WDOG_Type * |
base, |
|
|
uint16_t |
mask |
|
) |
| |
|
inlinestatic |
This bit is a write once only bit. Once the software does a write access to this bit, it will get locked and cannot be reprogrammed until the next system reset assertion
- Parameters
-
base | WDOG peripheral base address |
mask | The interrupts to enable The parameter can be combination of the following source if defined.
|
uint16_t WDOG_GetStatusFlags |
( |
WDOG_Type * |
base | ) |
|
This function gets all reset status flags.
- Parameters
-
base | WDOG peripheral base address |
- Returns
- State of the status flag: asserted (true) or not-asserted (false).
- See Also
- _wdog_status_flags
- true: a related status flag has been set.
- false: a related status flag is not set.
void WDOG_ClearInterruptStatus |
( |
WDOG_Type * |
base, |
|
|
uint16_t |
mask |
|
) |
| |
This function clears the WDOG status flag.
This is an example for clearing the interrupt flag.
* WDOG_ClearStatusFlags(wdog_base,KWDOG_InterruptFlag);
*
- Parameters
-
base | WDOG peripheral base address |
mask | The status flags to clear. The parameter could be any combination of the following values. kWDOG_TimeoutFlag |
static void WDOG_SetTimeoutValue |
( |
WDOG_Type * |
base, |
|
|
uint16_t |
timeoutCount |
|
) |
| |
|
inlinestatic |
This function sets the timeout value. This function writes a value into WCR registers. The time-out value can be written at any point of time but it is loaded to the counter at the time when WDOG is enabled or after the service routine has been performed.
- Parameters
-
base | WDOG peripheral base address |
timeoutCount | WDOG timeout value; count of WDOG clock tick. |
static void WDOG_SetInterrputTimeoutValue |
( |
WDOG_Type * |
base, |
|
|
uint16_t |
timeoutCount |
|
) |
| |
|
inlinestatic |
This function sets the interrupt count timeout value. This function writes a value into WIC registers which are wirte-once. This field is write once only. Once the software does a write access to this field, it will get locked and cannot be reprogrammed until the next system reset assertion.
- Parameters
-
base | WDOG peripheral base address |
timeoutCount | WDOG timeout value; count of WDOG clock tick. |
static void WDOG_DisablePowerDownEnable |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function disable the WDOG power down enable(PDE). This function writes a value into WMCR registers which are wirte-once. This field is write once only. Once software sets this bit it cannot be reset until the next system reset.
- Parameters
-
base | WDOG peripheral base address |
void WDOG_Refresh |
( |
WDOG_Type * |
base | ) |
|
This function feeds the WDOG. This function should be called before the WDOG timer is in timeout. Otherwise, a reset is asserted.
- Parameters
-
base | WDOG peripheral base address |