Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Reinforced Safety Watchdog Timer (RSWDT)

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

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.

Returns
Bitmask of 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).

Note
The value returned by this function can be used by rswdt_init() if it is not RSWDT_INVALID_ARGUMENT.
Parameters
ul_usThe desired timeout period (in us).
ul_sclkThe slow clock on board (in Hz).
Returns
If the desired period is beyond the reinforced safety watchdog period, this function returns RSWDT_INVALID_ARGUMENT. Otherwise it returns valid value.

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.

Parameters
p_rswdtPointer to a RSWDT instance.
ul_sclkThe slow clock frequency (in Hz).
Returns
The timeout period in microseconds.

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.

Parameters
p_rswdtPointer to a RSWDT instance.
ul_modeBitmask of reinforced safety watchdog timer mode.
us_counterThe value loaded in the 12-bit Reinforced Safety Watchdog Counter.
us_deltaThe 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.