|
oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
|
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. | |
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:
_create() / _destroy() — unified API that works in both heap and zero-heap mode. In zero-heap mode these are macros that generate per-call-site static storage._init() / _deinit() — explicit storage control with caller-supplied buffers. Use when creating objects in loops, arrays, or structs.CONFIG_OVE_WATCHDOG. | 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.
| [out] | wdt | Receives the initialised watchdog handle. |
| [in] | storage | Pointer to statically-allocated watchdog storage. |
| [in] | timeout_ms | Watchdog timeout period in milliseconds. |
CONFIG_OVE_WATCHDOG. | 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.
| [in] | wdt | Watchdog handle returned by ove_watchdog_init. |
CONFIG_OVE_WATCHDOG. | 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.
| [out] | wdt | Receives the created watchdog handle. |
| [in] | timeout_ms | Watchdog timeout period in milliseconds. |
CONFIG_OVE_WATCHDOG and OVE_HEAP_WATCHDOG. | 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.
| [in] | wdt | Watchdog handle returned by ove_watchdog_create. |
CONFIG_OVE_WATCHDOG and OVE_HEAP_WATCHDOG. | 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.
| [in] | wdt | Watchdog handle. |
CONFIG_OVE_WATCHDOG. | 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.
| [in] | wdt | Watchdog handle. |
CONFIG_OVE_WATCHDOG. | 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.
| [in] | wdt | Watchdog handle. |
CONFIG_OVE_WATCHDOG.