oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Functions
Watchdog

Hardware or software watchdog timer control. More...

Functions

int ove_watchdog_init (ove_watchdog_t *wdt, ove_watchdog_storage_t *storage, uint32_t timeout_ms)
 Initialise a watchdog timer using caller-provided static storage.
 
void ove_watchdog_deinit (ove_watchdog_t wdt)
 Deinitialise a statically-allocated watchdog timer.
 
int ove_watchdog_create (ove_watchdog_t *wdt, uint32_t timeout_ms)
 Allocate and initialise a heap-backed watchdog timer.
 
void ove_watchdog_destroy (ove_watchdog_t wdt)
 Destroy a heap-allocated watchdog timer.
 
int ove_watchdog_start (ove_watchdog_t wdt)
 Start (arm) the watchdog timer.
 
int ove_watchdog_stop (ove_watchdog_t wdt)
 Stop (disarm) the watchdog timer.
 
int ove_watchdog_feed (ove_watchdog_t wdt)
 Feed (pet) the watchdog to prevent a system reset.
 

Detailed Description

Hardware or software watchdog timer control.

Provides a portable interface for arming, servicing, and disarming a watchdog timer. If the watchdog is not fed within timeout_ms milliseconds after being started, the system will reset (or invoke the backend's expiry action).

Two allocation strategies are supported:

Note
Requires CONFIG_OVE_WATCHDOG.

Function Documentation

◆ ove_watchdog_init()

int ove_watchdog_init ( ove_watchdog_t wdt,
ove_watchdog_storage_t *  storage,
uint32_t  timeout_ms 
)

Initialise a watchdog timer using caller-provided static storage.

Configures the watchdog with a timeout of timeout_ms milliseconds. The watchdog does not start counting until ove_watchdog_start is called. The caller must ensure storage remains valid for the watchdog's lifetime.

Parameters
[out]wdtReceives the initialised watchdog handle.
[in]storagePointer to statically-allocated watchdog storage.
[in]timeout_msWatchdog timeout period in milliseconds.
Returns
OVE_OK on success, negative error code on failure.
Note
Requires CONFIG_OVE_WATCHDOG.

◆ ove_watchdog_deinit()

void ove_watchdog_deinit ( ove_watchdog_t  wdt)

Deinitialise a statically-allocated watchdog timer.

Stops the watchdog if running and releases all associated RTOS resources. The backing storage memory is not freed.

Parameters
[in]wdtWatchdog handle returned by ove_watchdog_init.
Note
Requires CONFIG_OVE_WATCHDOG.

◆ ove_watchdog_create()

int ove_watchdog_create ( ove_watchdog_t wdt,
uint32_t  timeout_ms 
)

Allocate and initialise a heap-backed watchdog timer.

Configures the watchdog with a timeout of timeout_ms milliseconds. The watchdog does not start counting until ove_watchdog_start is called. The returned handle must be freed with ove_watchdog_destroy.

Parameters
[out]wdtReceives the created watchdog handle.
[in]timeout_msWatchdog timeout period in milliseconds.
Returns
OVE_OK on success, negative error code on failure.
Note
Requires CONFIG_OVE_WATCHDOG and OVE_HEAP_WATCHDOG.

◆ ove_watchdog_destroy()

void ove_watchdog_destroy ( ove_watchdog_t  wdt)

Destroy a heap-allocated watchdog timer.

Stops the watchdog if running and frees all resources. Must only be called on handles obtained from ove_watchdog_create.

Parameters
[in]wdtWatchdog handle returned by ove_watchdog_create.
Note
Requires CONFIG_OVE_WATCHDOG and OVE_HEAP_WATCHDOG.

◆ ove_watchdog_start()

int ove_watchdog_start ( ove_watchdog_t  wdt)

Start (arm) the watchdog timer.

Begins the countdown. The watchdog must be fed with ove_watchdog_feed at intervals shorter than the configured timeout, or the system will reset.

Parameters
[in]wdtWatchdog handle.
Returns
OVE_OK on success, negative error code on failure.
Note
Requires CONFIG_OVE_WATCHDOG.

◆ ove_watchdog_stop()

int ove_watchdog_stop ( ove_watchdog_t  wdt)

Stop (disarm) the watchdog timer.

Halts the countdown. The watchdog will not reset the system while stopped. Call ove_watchdog_start to re-arm.

Parameters
[in]wdtWatchdog handle.
Returns
OVE_OK on success, negative error code on failure.
Note
Requires CONFIG_OVE_WATCHDOG.

◆ ove_watchdog_feed()

int ove_watchdog_feed ( ove_watchdog_t  wdt)

Feed (pet) the watchdog to prevent a system reset.

Resets the watchdog countdown to the configured timeout. Must be called periodically while the watchdog is running, with an interval shorter than the timeout_ms value passed to ove_watchdog_init or ove_watchdog_create.

Parameters
[in]wdtWatchdog handle.
Returns
OVE_OK on success, negative error code on failure.
Note
Requires CONFIG_OVE_WATCHDOG.