Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_watchdog.h File Reference

Watchdog mechanism for detecting system/task hang conditions. More...

Include dependency graph for sapi_watchdog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sapi_watchdog_config_t
 Watchdog configuration. More...
struct  sapi_watchdog_status_t
 Watchdog health/status information. More...

Enumerations

enum  sapi_watchdog_type_t { SAPI_WATCHDOG_SYSTEM , SAPI_WATCHDOG_TASK , SAPI_WATCHDOG_CHANNEL , SAPI_WATCHDOG_CHECKPOINT }
 Watchdog type. More...
enum  sapi_watchdog_action_t {
  SAPI_WATCHDOG_ACTION_LOG , SAPI_WATCHDOG_ACTION_SAFESTATE , SAPI_WATCHDOG_ACTION_REBOOT , SAPI_WATCHDOG_ACTION_FAILOVER ,
  SAPI_WATCHDOG_ACTION_CUSTOM
}
 Recovery action when watchdog fires. More...

Functions

sapi_status_t sapi_watchdog_create (sapi_watchdog_t *handle_out, const sapi_watchdog_config_t *config)
 Create a watchdog.
sapi_status_t sapi_watchdog_start (sapi_watchdog_t watchdog)
 Start watchdog timer.
sapi_status_t sapi_watchdog_stop (sapi_watchdog_t watchdog)
 Stop watchdog timer.
sapi_status_t sapi_watchdog_kick (sapi_watchdog_t watchdog)
 Kick (pet) watchdog - prove liveness.
sapi_status_t sapi_watchdog_get_status (sapi_watchdog_t watchdog, sapi_watchdog_status_t *status_out)
 Get watchdog status.
sapi_status_t sapi_watchdog_destroy (sapi_watchdog_t watchdog)
 Destroy watchdog.
sapi_status_t sapi_watchdog_manager_initialize (void)
 Initialize watchdog manager (call once at startup).
sapi_status_t sapi_watchdog_manager_shutdown (void)
 Shutdown watchdog manager (call once at shutdown).
void sapi_watchdog_timeout_handler (uint32_t watchdog_id)
 Watchdog timeout handler (INTERNAL - called by framework).
void sapi_watchdog_timer_tick (void)
 Poll all active watchdogs for expiry (call periodically).

Detailed Description

Watchdog mechanism for detecting system/task hang conditions.

Provides system-level, task-level, and channel-level watchdog timers that detect hung components and trigger recovery actions (log, safe-state, reboot, failover, or a custom callback). Implemented as a fixed-size static pool, timed via sapi_timer_now() - see src/watchdog/sapi_watchdog.c and sapi_watchdog_timer_tick()'s own doc for how expiry is detected (poll-driven, not an OS-specific interrupt of its own).

Definition in file sapi_watchdog.h.