Driver for the RSWDT (Reinforced Safety Watchdog Timer).
This driver provides access to the main features of the RSWDT controller. The Reinforced Safety Watchdog Timer can be used to prevent system lock-up if the software becomes trapped in a deadlock. It features a 12-bit down counter that allows a watchdog period of up to 16 seconds (slow clock at 32.768 kHz). It can generate a general reset or a processor reset only. In addition, it can be stopped while the processor is in debug mode or idle mode.
Macros | |
#define | RSWDT_KEY_PASSWORD 0xC4000000 |
#define | RSWDT_MAX_VALUE 4095 |
#define | RSWDT_SLCK_DIV 128 |
Functions | |
void | rswdt_disable (Rswdt *p_rswdt) |
Disable the reinforced safety watchdog timer. More... | |
uint32_t | rswdt_get_status (Rswdt *p_rswdt) |
Check the reinforced safety watchdog timer status. More... | |
uint32_t | rswdt_get_timeout_value (uint32_t ul_us, uint32_t ul_sclk) |
Get counter value or permitted range value of reinforced safety watchdog timer from the desired timeout period (in us). More... | |
uint32_t | rswdt_get_us_timeout_period (Rswdt *p_rswdt, uint32_t ul_sclk) |
Get the timeout period of the Reinforced Safety WatchDog Timer in microseconds. More... | |
void | rswdt_init (Rswdt *p_rswdt, uint32_t ul_mode, uint16_t us_counter, uint16_t us_delta) |
Initialize reinforced safety watchdog timer with the given mode. More... | |
void | rswdt_restart (Rswdt *p_rswdt) |
Restart the reinforced safety watchdog timer. More... | |
#define RSWDT_KEY_PASSWORD 0xC4000000 |
Referenced by rswdt_restart().
#define RSWDT_MAX_VALUE 4095 |
Referenced by rswdt_get_timeout_value().
#define RSWDT_SLCK_DIV 128 |
Referenced by rswdt_get_timeout_value(), and rswdt_get_us_timeout_period().
void rswdt_disable | ( | Rswdt * | p_rswdt | ) |
Disable the reinforced safety watchdog timer.
uint32_t rswdt_get_status | ( | Rswdt * | p_rswdt | ) |
Check the reinforced safety watchdog timer status.
uint32_t rswdt_get_timeout_value | ( | uint32_t | ul_us, |
uint32_t | ul_sclk | ||
) |
Get counter value or permitted range value of reinforced safety watchdog timer from the desired timeout period (in us).
ul_us | The desired timeout period (in us). |
ul_sclk | The slow clock on board (in Hz). |
References max, min, RSWDT_INVALID_ARGUMENT, RSWDT_MAX_VALUE, and RSWDT_SLCK_DIV.
uint32_t rswdt_get_us_timeout_period | ( | Rswdt * | p_rswdt, |
uint32_t | ul_sclk | ||
) |
Get the timeout period of the Reinforced Safety WatchDog Timer in microseconds.
p_rswdt | Pointer to a RSWDT instance. |
ul_sclk | The slow clock frequency (in Hz). |
References RSWDT_SLCK_DIV.
void rswdt_init | ( | Rswdt * | p_rswdt, |
uint32_t | ul_mode, | ||
uint16_t | us_counter, | ||
uint16_t | us_delta | ||
) |
Initialize reinforced safety watchdog timer with the given mode.
p_rswdt | Pointer to a RSWDT instance. |
ul_mode | Bitmask of reinforced safety watchdog timer mode. |
us_counter | The value loaded in the 12-bit Reinforced Safety Watchdog Counter. |
us_delta | The permitted range for reloading the Reinforced Safety Watchdog Timer. |
void rswdt_restart | ( | Rswdt * | p_rswdt | ) |
Restart the reinforced safety watchdog timer.
References RSWDT_KEY_PASSWORD.