dRonin
adbada4
dRonin firmware
|
PIOS Comamnds to initialize and clear watchdog timer. More...
Files | |
file | pios_wdg.h |
SPI functions header. | |
Macros | |
#define | PIOS_WDG_ACTUATOR 0x0001 |
#define | PIOS_WDG_STABILIZATION 0x0002 |
#define | PIOS_WDG_ATTITUDE 0x0004 |
#define | PIOS_WDG_MANUAL 0x0008 |
#define | PIOS_WDG_SENSORS 0x0010 |
Functions | |
uint16_t | PIOS_WDG_Init () |
Initialize the watchdog timer for a specified timeout. More... | |
bool | PIOS_WDG_RegisterFlag (uint16_t flag_requested) |
Register a module against the watchdog. More... | |
bool | PIOS_WDG_UpdateFlag (uint16_t flag) |
Function called by modules to indicate they are still running. More... | |
uint16_t | PIOS_WDG_GetBootupFlags () |
Returns the flags that were set at bootup. More... | |
uint16_t | PIOS_WDG_GetActiveFlags () |
Returns the currently active flags. More... | |
void | PIOS_WDG_Clear (void) |
Clear the watchdog timer. More... | |
static bool | PIOS_WDG_Check () |
This function returns true if the watchdog would have expired. More... | |
Variables | |
unsigned int | wdg_registered_flags |
unsigned int | wdg_updated_flags |
uint32_t | wdg_cleared_time |
uint32_t | wdg_last_update_time |
bool | wdg_expired |
PIOS Comamnds to initialize and clear watchdog timer.
#define PIOS_WDG_ACTUATOR 0x0001 |
Definition at line 35 of file pios_wdg.h.
#define PIOS_WDG_ATTITUDE 0x0004 |
Definition at line 37 of file pios_wdg.h.
#define PIOS_WDG_MANUAL 0x0008 |
Definition at line 38 of file pios_wdg.h.
#define PIOS_WDG_SENSORS 0x0010 |
Definition at line 39 of file pios_wdg.h.
#define PIOS_WDG_STABILIZATION 0x0002 |
Definition at line 36 of file pios_wdg.h.
|
static |
This function returns true if the watchdog would have expired.
Definition at line 155 of file pios_wdg.c.
void PIOS_WDG_Clear | ( | void | ) |
Clear the watchdog timer.
This function must be called at the appropriate delay to prevent a reset event occuring
Definition at line 147 of file pios_wdg.c.
uint16_t PIOS_WDG_GetActiveFlags | ( | ) |
Returns the currently active flags.
For external monitoring
Definition at line 137 of file pios_wdg.c.
uint16_t PIOS_WDG_GetBootupFlags | ( | ) |
Returns the flags that were set at bootup.
This is used for diagnostics, if only one flag not set this was likely the module that wasn't running before reset
Definition at line 125 of file pios_wdg.c.
uint16_t PIOS_WDG_Init | ( | ) |
Initialize the watchdog timer for a specified timeout.
It is important to note that this function returns the achieved timeout for this hardware. For hardware indendence this should be checked when scheduling updates. Other hardware dependent details may need to be considered such as a window time which sets a minimum update time, and this function should return a recommended delay for clearing.
For the STM32 nominal clock rate is 32 khz, but for the maximum clock rate of 60 khz and a prescalar of 4 yields a clock rate of 15 khz. The delay that is set in the watchdog assumes the nominal clock rate, but the delay for FreeRTOS to use is 75% of the minimal delay.
[in] | delayMs | The delay period in ms |
It is important to note that this function returns the achieved timeout for this hardware. For hardware independence this should be checked when scheduling updates. Other hardware dependent details may need to be considered such as a window time which sets a minimum update time, and this function should return a recommended delay for clearing.
For the STM32 nominal clock rate is 32 khz, but for the maximum clock rate of 60 khz and a prescaler of 4 yields a clock rate of 15 khz. The delay that is set in the watchdog assumes the nominal clock rate, but the delay for RTOS to use is 75% of the minimal delay.
Definition at line 63 of file pios_wdg.c.
bool PIOS_WDG_RegisterFlag | ( | uint16_t | flag_requested | ) |
Register a module against the watchdog.
There are two ways to use PIOS WDG: this is for when multiple modules must be monitored. In this case they must first register against the watchdog system and only when all of the modules have been updated with the watchdog be cleared. Each module must have its own bit in the 16 bit
[in] | flag | the bit this module wants to use |
Definition at line 86 of file pios_wdg.c.
bool PIOS_WDG_UpdateFlag | ( | uint16_t | flag | ) |
Function called by modules to indicate they are still running.
This function will set this flag in the active flags register (which is a backup regsiter) and if all the registered flags are set will clear the watchdog and set only this flag in the backup register
[in] | flag | the flag to set |
Definition at line 102 of file pios_wdg.c.
uint32_t wdg_cleared_time |
Definition at line 39 of file pios_wdg.c.
bool wdg_expired |
Definition at line 42 of file pios_wdg.c.
uint32_t wdg_last_update_time |
Definition at line 40 of file pios_wdg.c.
unsigned int wdg_registered_flags |
Definition at line 37 of file pios_wdg.c.
unsigned int wdg_updated_flags |
Definition at line 38 of file pios_wdg.c.