Skip to content

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).

void syn_watchdog_checkin (
    SYN_Watchdog * wdt,
    int8_t id
) 

Parameters:


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:

  • wdt Watchdog instance.
  • entries Array of entries (caller-owned).
  • capacity Maximum number of monitored tasks.
  • callback Timeout handler.
  • ctx Context for callback.

function syn_watchdog_register

Register a task for monitoring.

int8_t syn_watchdog_register (
    SYN_Watchdog * wdt,
    const char * name,
    uint32_t timeout_ms
) 

Parameters:

  • wdt Watchdog.
  • name Task name.
  • timeout_ms Maximum 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.

void syn_watchdog_unregister (
    SYN_Watchdog * wdt,
    int8_t id
) 

Parameters:


function syn_watchdog_update

Check all tasks for timeouts.

void syn_watchdog_update (
    SYN_Watchdog * wdt
) 

Call from your main loop or a periodic timer. If any task has exceeded its timeout, the callback is invoked.

Parameters:

  • wdt Watchdog instance.

Macro Definition Documentation

define SYN_WDT_ERR_TIMEOUT

#define SYN_WDT_ERR_TIMEOUT `0x0200`

Watchdog timeout detected.



The documentation for this class was generated from the following file src/syntropic/sched/syn_watchdog.c