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
Go to the documentation of this file.
1
16
17#ifndef SAPI_WATCHDOG_H
18#define SAPI_WATCHDOG_H
19
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* ============================================================================
28 * Types & Constants
29 * ========================================================================== */
30
34typedef struct sapi_watchdog_s *sapi_watchdog_t;
35
47
69
87
101
102/* ============================================================================
103 * API: Core Watchdog Operations
104 * ========================================================================== */
105
134sapi_status_t sapi_watchdog_create(sapi_watchdog_t *handle_out,
135 const sapi_watchdog_config_t *config);
136
151sapi_status_t sapi_watchdog_start(sapi_watchdog_t watchdog);
152
167sapi_status_t sapi_watchdog_stop(sapi_watchdog_t watchdog);
168
194sapi_status_t sapi_watchdog_kick(sapi_watchdog_t watchdog);
195
219sapi_status_t sapi_watchdog_get_status(sapi_watchdog_t watchdog,
220 sapi_watchdog_status_t *status_out);
221
235sapi_status_t sapi_watchdog_destroy(sapi_watchdog_t watchdog);
236
237/* ============================================================================
238 * API: Watchdog Manager (Global)
239 * ========================================================================== */
240
254
268
269/* ============================================================================
270 * Watchdog Timeout Callback (Invoked by Framework)
271 * ========================================================================== */
272
288void sapi_watchdog_timeout_handler(uint32_t watchdog_id);
289
305void sapi_watchdog_timer_tick(void);
306
307#ifdef __cplusplus
308}
309#endif
310
311#endif /* SAPI_WATCHDOG_H */
312 /* WATCHDOG */
sapi_status_t
Common result/status codes.
Definition sapi_status.h:27
uint32_t sapi_duration_ms_t
Definition sapi_types.h:27
sapi_status_t sapi_watchdog_stop(sapi_watchdog_t watchdog)
Stop watchdog timer.
sapi_status_t sapi_watchdog_manager_initialize(void)
Initialize watchdog manager (call once at startup).
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.
void sapi_watchdog_timeout_handler(uint32_t watchdog_id)
Watchdog timeout handler (INTERNAL - called by framework).
sapi_watchdog_type_t
Watchdog type.
sapi_watchdog_action_t
Recovery action when watchdog fires.
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_manager_shutdown(void)
Shutdown watchdog manager (call once at shutdown).
sapi_status_t sapi_watchdog_kick(sapi_watchdog_t watchdog)
Kick (pet) watchdog - prove liveness.
sapi_status_t sapi_watchdog_start(sapi_watchdog_t watchdog)
Start watchdog timer.
void sapi_watchdog_timer_tick(void)
Poll all active watchdogs for expiry (call periodically).
@ SAPI_WATCHDOG_CHECKPOINT
@ SAPI_WATCHDOG_CHANNEL
@ SAPI_WATCHDOG_SYSTEM
@ SAPI_WATCHDOG_TASK
@ SAPI_WATCHDOG_ACTION_LOG
@ SAPI_WATCHDOG_ACTION_REBOOT
@ SAPI_WATCHDOG_ACTION_SAFESTATE
@ SAPI_WATCHDOG_ACTION_FAILOVER
@ SAPI_WATCHDOG_ACTION_CUSTOM
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
Watchdog configuration.
sapi_watchdog_action_t action
void(*) custom_action(void *ctx)
sapi_duration_ms_t timeout_ms
sapi_watchdog_type_t type
Watchdog handle (opaque).
Watchdog health/status information.
sapi_duration_ms_t time_since_last_kick
sapi_duration_ms_t time_until_fire