oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
watchdog.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 * This file is part of oveRTOS.
7 */
8
30#ifndef OVE_WATCHDOG_H
31#define OVE_WATCHDOG_H
32
33#include "ove/types.h"
34#include "ove_config.h"
35#include "ove/storage.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41#ifdef CONFIG_OVE_WATCHDOG
42
57int ove_watchdog_init(ove_watchdog_t *wdt, ove_watchdog_storage_t *storage, uint32_t timeout_ms);
58
69
82#ifdef OVE_HEAP_WATCHDOG
83int ove_watchdog_create(ove_watchdog_t *wdt, uint32_t timeout_ms);
84
95#endif /* OVE_HEAP_WATCHDOG */
96
108
120
134
135#else /* !CONFIG_OVE_WATCHDOG */
136
137/* P0-3: _init/_deinit stubs so OVE_WATCHDOG_DEFINE_STATIC links cleanly
138 * when CONFIG_OVE_WATCHDOG=n. */
139static inline int ove_watchdog_init(ove_watchdog_t *w, ove_watchdog_storage_t *s, uint32_t t)
140{
141 (void)w;
142 (void)s;
143 (void)t;
145}
146static inline void ove_watchdog_deinit(ove_watchdog_t w)
147{
148 (void)w;
149}
150
151static inline int ove_watchdog_create(ove_watchdog_t *w, uint32_t t)
152{
153 (void)w;
154 (void)t;
156}
157static inline void ove_watchdog_destroy(ove_watchdog_t w)
158{
159 (void)w;
160}
161static inline int ove_watchdog_start(ove_watchdog_t w)
162{
163 (void)w;
165}
166static inline int ove_watchdog_stop(ove_watchdog_t w)
167{
168 (void)w;
170}
171static inline int ove_watchdog_feed(ove_watchdog_t w)
172{
173 (void)w;
175}
176
177#endif /* CONFIG_OVE_WATCHDOG */
178
179#ifdef __cplusplus
180}
181#endif
182
/* end of ove_watchdog group */
184
185#endif /* OVE_WATCHDOG_H */
struct ove_watchdog * ove_watchdog_t
Opaque handle for a software watchdog object.
Definition types.h:235
@ OVE_ERR_NOT_SUPPORTED
Definition types.h:98
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_create(ove_watchdog_t *wdt, uint32_t timeout_ms)
Allocate and initialise a heap-backed watchdog timer.
int ove_watchdog_feed(ove_watchdog_t wdt)
Feed (pet) the watchdog to prevent a system reset.
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.
int ove_watchdog_stop(ove_watchdog_t wdt)
Stop (disarm) the watchdog timer.
void ove_watchdog_deinit(ove_watchdog_t wdt)
Deinitialise a statically-allocated watchdog timer.