File syn_watchdog.c¶
FileList > sched > syn_watchdog.c
Go to the source code of this file
Task-level watchdog implementation.
#include "../system/syn_errlog.h"#include "../util/syn_assert.h"#include "syn_watchdog.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| void | syn_watchdog_checkin (SYN_Watchdog * wdt, int8_t id) Check in a task (reset its timeout). |
| void | syn_watchdog_init (SYN_Watchdog * wdt, SYN_WDT_Entry * entries, uint8_t capacity, SYN_WDT_TimeoutCallback callback, void * ctx) Initialize the watchdog monitor. |
| int8_t | syn_watchdog_register (SYN_Watchdog * wdt, const char * name, uint32_t timeout_ms) Register a task for monitoring. |
| void | syn_watchdog_unregister (SYN_Watchdog * wdt, int8_t id) Unregister a task. |
| void | syn_watchdog_update (SYN_Watchdog * wdt) Check all tasks for timeouts. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_WDT_ERR_TIMEOUT 0x0200 |
Public Functions Documentation¶
function syn_watchdog_checkin¶
Check in a task (reset its timeout).
Parameters:
wdtWatchdog.idTask ID returned by syn_watchdog_register().
function syn_watchdog_init¶
Initialize the watchdog monitor.
void syn_watchdog_init (
SYN_Watchdog * wdt,
SYN_WDT_Entry * entries,
uint8_t capacity,
SYN_WDT_TimeoutCallback callback,
void * ctx
)
Parameters:
wdtWatchdog instance.entriesArray of entries (caller-owned).capacityMaximum number of monitored tasks.callbackTimeout handler.ctxContext for callback.
function syn_watchdog_register¶
Register a task for monitoring.
Parameters:
wdtWatchdog.nameTask name.timeout_msMaximum allowed time between check-ins.
Returns:
Task ID (index) for use with syn_watchdog_checkin(), or -1 if full.
function syn_watchdog_unregister¶
Unregister a task.
Parameters:
wdtWatchdog.idTask ID returned by syn_watchdog_register().
function syn_watchdog_update¶
Check all tasks for timeouts.
Call from your main loop or a periodic timer. If any task has exceeded its timeout, the callback is invoked.
Parameters:
wdtWatchdog instance.
Macro Definition Documentation¶
define SYN_WDT_ERR_TIMEOUT¶
Watchdog timeout detected.
The documentation for this class was generated from the following file src/syntropic/sched/syn_watchdog.c