![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The Watchdog Timer (WDT) regains control in case of system failure (due to a software error) to increase application reliability. The WDT can generate a reset or an interrupt when the counter reaches a given timeout value.
The wdt driver provides a structure wdt_config_t which contains all the programmable features of WDT. The WDT_Init() function takes the argument of structure pointer to wdt_config_t and configures the WDT features, then enable WDT. For the most simple user scenarios, only need to provide WDT service function to feed the WDT timer to avoid reset. But considering user may have some enhanced situation which needs to re-configure the features, such as to re-install timeout value, enable/disable interrupt functionality of WDT, several function groups are designed as below:
Data Structures | |
struct | wdt_config_t |
structure for WDT module initialization configuration. More... | |
Driver version | |
#define | FSL_WDT_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
WDT driver version 2.0.0. More... | |
WDT refresh pattern. | |
#define | WDT_REFRESH_PATTERN (0x76U) |
Refresh pattern to restart WDT. | |
Initialization Interfaces | |
void | WDT_Init (WDT_Type *base, const wdt_config_t *config) |
Initializes the WDT module with input configuration Call this function to do initialization configuration for WDT module. More... | |
void | WDT_GetDefaultConfig (wdt_config_t *config) |
Prepares an available pre-defined setting for module's configuration. More... | |
WDT Operation Interfaces | |
static void | WDT_Enable (WDT_Type *base, bool enable) |
Enable/Disable the WDT module. More... | |
static void | WDT_SetTimeoutValue (WDT_Type *base, wdt_timeout_value_t timeoutValue) |
Sets the WDT timeout value. | |
static uint32_t | WDT_GetCounterValue (WDT_Type *base) |
Gets the WDT timeout value. | |
void | WDT_Refresh (WDT_Type *base) |
Refreshes the WDT timer. More... | |
Interrupt Control Interfaces | |
static void | WDT_EnableInterrupt (WDT_Type *base) |
Enables the WDT interrupt, if config->timeoutMode = kWDT_TimeoutModeInterrupt for calling WDT_Init, the WDT interrupt is by default enabled, this function does not take effect. More... | |
static void | WDT_DisableInterrupt (WDT_Type *base) |
Enables the WDT interrupt, if config->timeoutMode = kWDT_TimeoutModeReset for calling WDT_Init, the WDT interrupt is by default disabled, this function does not take effect. More... | |
Status get/clear interface. | |
static bool | WDT_GetInterruptStatus (WDT_Type *base) |
Gets WDT interrupt status. More... | |
static void | WDT_ClearInterruptStatus (WDT_Type *base) |
Clear WDT interrupt status. More... | |
struct wdt_config_t |
#define FSL_WDT_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
enum wdt_reset_width_t |
enum wdt_timeout_value_t |
void WDT_Init | ( | WDT_Type * | base, |
const wdt_config_t * | config | ||
) |
The configurations are:
base | WDT peripheral base address. |
config | The pointer to WDT configuration structure, wdt_config_t. |
void WDT_GetDefaultConfig | ( | wdt_config_t * | config | ) |
This function initializes the WDT configuration structure to default values. config->timeoutValue = kWDT_TimeoutVal2ToThePowerOf16; config->timeoutMode =kWDT_TimeoutModeReset; config->resetWidth = kWDT_ResetWidthLen2; config->enableWDT = false;
config | Pointer to the WDT configuration structure, wdt_config_t. |
|
inlinestatic |
This function enable/disables the WDT. To disable the WDT Watchdog, call WDT_Enable(base, false).
base | WDT peripheral base address. |
enable | Enable the feature or not. |
void WDT_Refresh | ( | WDT_Type * | base | ) |
This function feeds/services the WDT.
base | WDT peripheral base address. |
|
inlinestatic |
This function set WDT timeout response mode to generate interrupt.
base | WDT peripheral base address |
|
inlinestatic |
This function set WDT timeout response mode to generate reset.
base | WDT peripheral base address |
|
inlinestatic |
base | WDT peripheral base address |
|
inlinestatic |
base | WDT peripheral base address |