![]() |
S32 SDK
|
Watchdog Timer Peripheral Driver.
In order to be able to use the Watchdog in your application, the first thing to do is initializing it with the desired configuration. This is done by calling the WDOG_DRV_Init function. One of the arguments passed to this function is the configuration which will be used for the Watchdog, specified by the wdog_user_config_t structure.
The wdog_user_config_t structure allows you to configure the following:
Please note that if the updates are disabled the Watchdog cannot be later modified without forcing a reset (this implies that further calls of the WDOG_DRV_Init, WDOG_DRV_Deinit or WDOG_DRV_SetInt functions will lead to a reset).
As mentioned before, a timeout interrupt may be enabled by specifying it at the module initialization. The WDOG_DRV_Init only allows enabling/disabling the interrupt, and it does not set up the ISR to be used for the interrupt request. In order to set up a function to be called after a reset-triggering event (and also enable/disable the interrupt), the WDOG_DRV_SetInt function may be used. Please note that, due to the 128 bus clocks delay before the reset, a limited amount of job can be done in the ISR.
Variables | |
WDOG_Type *const | g_wdogBase [WDOG_INSTANCE_COUNT] |
Table of base addresses for WDOG instances. More... | |
const IRQn_Type | g_wdogIrqId [WDOG_INSTANCE_COUNT] |
Table to save WDOG IRQ enum numbers defined in CMSIS header file. More... | |
WDOG Driver API | |
status_t | WDOG_DRV_Init (uint32_t instance, const wdog_user_config_t *userConfigPtr) |
Initializes the WDOG driver. More... | |
void | WDOG_DRV_Deinit (uint32_t instance) |
De-initializes the WDOG driver. More... | |
void | WDOG_DRV_GetConfig (uint32_t instance, wdog_user_config_t *config) |
Gets the current configuration of the WDOG. More... | |
status_t | WDOG_DRV_SetInt (uint32_t instance, bool enable, void(*handler)(void)) |
Enables/Disables the WDOG timeout interrupt and sets a function to be called when a timeout interrupt is received, before reset. More... | |
void | WDOG_DRV_Trigger (uint32_t instance) |
Refreshes the WDOG counter. More... | |
void WDOG_DRV_Deinit | ( | uint32_t | instance | ) |
De-initializes the WDOG driver.
[in] | instance | WDOG peripheral instance number |
Definition at line 146 of file wdog_driver.c.
void WDOG_DRV_GetConfig | ( | uint32_t | instance, |
wdog_user_config_t * | config | ||
) |
Gets the current configuration of the WDOG.
[in] | instance | WDOG peripheral instance number |
[out] | config | the current configuration |
Definition at line 208 of file wdog_driver.c.
status_t WDOG_DRV_Init | ( | uint32_t | instance, |
const wdog_user_config_t * | userConfigPtr | ||
) |
Initializes the WDOG driver.
[in] | instance | WDOG peripheral instance number |
[in] | userConfigPtr | pointer to the WDOG user configuration structure |
Definition at line 106 of file wdog_driver.c.
status_t WDOG_DRV_SetInt | ( | uint32_t | instance, |
bool | enable, | ||
void(*)(void) | handler | ||
) |
Enables/Disables the WDOG timeout interrupt and sets a function to be called when a timeout interrupt is received, before reset.
[in] | instance | WDOG peripheral instance number |
[in] | enable | enable/disable interrupt |
[in] | handler | timeout interrupt handler |
Definition at line 227 of file wdog_driver.c.
void WDOG_DRV_Trigger | ( | uint32_t | instance | ) |
Refreshes the WDOG counter.
[in] | instance | WDOG peripheral instance number |
Definition at line 269 of file wdog_driver.c.
WDOG_Type* const g_wdogBase[WDOG_INSTANCE_COUNT] |
Table of base addresses for WDOG instances.
Definition at line 55 of file wdog_driver.c.
const IRQn_Type g_wdogIrqId[WDOG_INSTANCE_COUNT] |
Table to save WDOG IRQ enum numbers defined in CMSIS header file.
Definition at line 58 of file wdog_driver.c.