8#ifndef ZEPHYR_INCLUDE_DRIVERS_WATCHDOG_H_
9#define ZEPHYR_INCLUDE_DRIVERS_WATCHDOG_H_
35#define WDT_OPT_PAUSE_IN_SLEEP BIT(0)
38#define WDT_OPT_PAUSE_HALTED_BY_DBG BIT(1)
50#define WDT_FLAG_RESET_SHIFT (0)
52#define WDT_FLAG_RESET_MASK (0x3 << WDT_FLAG_RESET_SHIFT)
56#define WDT_FLAG_RESET_NONE (0 << WDT_FLAG_RESET_SHIFT)
58#define WDT_FLAG_RESET_CPU_CORE (1 << WDT_FLAG_RESET_SHIFT)
60#define WDT_FLAG_RESET_SOC (2 << WDT_FLAG_RESET_SHIFT)
95#if defined(CONFIG_WDT_MULTISTAGE) || defined(__DOXYGEN__)
115typedef int (*wdt_api_setup)(
const struct device *dev,
uint8_t options);
121typedef int (*wdt_api_disable)(
const struct device *dev);
127typedef int (*wdt_api_install_timeout)(
const struct device *dev,
134typedef int (*wdt_api_feed)(
const struct device *dev,
int channel_id);
136__subsystem
struct wdt_driver_api {
138 wdt_api_disable disable;
139 wdt_api_install_timeout install_timeout;
164static inline int z_impl_wdt_setup(
const struct device *dev,
uint8_t options)
166 const struct wdt_driver_api *api =
167 (
const struct wdt_driver_api *)dev->
api;
169 return api->setup(dev, options);
188static inline int z_impl_wdt_disable(
const struct device *dev)
190 const struct wdt_driver_api *api =
191 (
const struct wdt_driver_api *)dev->
api;
193 return api->disable(dev);
221 const struct wdt_driver_api *api =
222 (
const struct wdt_driver_api *) dev->
api;
224 return api->install_timeout(dev, cfg);
242static inline int z_impl_wdt_feed(
const struct device *dev,
int channel_id)
244 const struct wdt_driver_api *api =
245 (
const struct wdt_driver_api *)dev->
api;
247 return api->feed(dev, channel_id);
256#include <zephyr/syscalls/watchdog.h>
void(* wdt_callback_t)(const struct device *dev, int channel_id)
Watchdog callback.
Definition watchdog.h:87
int wdt_disable(const struct device *dev)
Disable watchdog instance.
static int wdt_install_timeout(const struct device *dev, const struct wdt_timeout_cfg *cfg)
Install a new timeout.
Definition watchdog.h:218
int wdt_setup(const struct device *dev, uint8_t options)
Set up watchdog instance.
int wdt_feed(const struct device *dev, int channel_id)
Feed specified watchdog timeout.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:417
Watchdog timeout configuration.
Definition watchdog.h:90
wdt_callback_t callback
Timeout callback (can be NULL).
Definition watchdog.h:94
struct wdt_timeout_cfg * next
Pointer to the next timeout configuration.
Definition watchdog.h:103
uint8_t flags
Flags (see WDT_FLAGS).
Definition watchdog.h:106
struct wdt_window window
Timing parameters of watchdog timeout.
Definition watchdog.h:92
Watchdog timeout window.
Definition watchdog.h:74
uint32_t max
Upper limit of watchdog feed timeout in milliseconds.
Definition watchdog.h:78
uint32_t min
Lower limit of watchdog feed timeout in milliseconds.
Definition watchdog.h:76