Zephyr API 3.6.99
|
Watchdog Interface . More...
Data Structures | |
struct | wdt_window |
Watchdog timeout window. More... | |
struct | wdt_timeout_cfg |
Watchdog timeout configuration. More... | |
Typedefs | |
typedef void(* | wdt_callback_t) (const struct device *dev, int channel_id) |
Watchdog callback. | |
Functions | |
int | wdt_setup (const struct device *dev, uint8_t options) |
Set up watchdog instance. | |
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. | |
int | wdt_feed (const struct device *dev, int channel_id) |
Feed specified watchdog timeout. | |
Watchdog options | |
#define | WDT_OPT_PAUSE_IN_SLEEP BIT(0) |
Pause watchdog timer when CPU is in sleep state. | |
#define | WDT_OPT_PAUSE_HALTED_BY_DBG BIT(1) |
Pause watchdog timer when CPU is halted by the debugger. | |
Watchdog behavior flags | |
#define | WDT_FLAG_RESET_NONE (0 << WDT_FLAG_RESET_SHIFT) |
Reset: none. | |
#define | WDT_FLAG_RESET_CPU_CORE (1 << WDT_FLAG_RESET_SHIFT) |
Reset: CPU core. | |
#define | WDT_FLAG_RESET_SOC (2 << WDT_FLAG_RESET_SHIFT) |
Reset: SoC. | |
Watchdog Interface .
#define WDT_FLAG_RESET_CPU_CORE (1 << WDT_FLAG_RESET_SHIFT) |
#include <zephyr/drivers/watchdog.h>
Reset: CPU core.
#define WDT_FLAG_RESET_NONE (0 << WDT_FLAG_RESET_SHIFT) |
#include <zephyr/drivers/watchdog.h>
Reset: none.
#define WDT_FLAG_RESET_SOC (2 << WDT_FLAG_RESET_SHIFT) |
#include <zephyr/drivers/watchdog.h>
Reset: SoC.
#define WDT_OPT_PAUSE_HALTED_BY_DBG BIT(1) |
#include <zephyr/drivers/watchdog.h>
Pause watchdog timer when CPU is halted by the debugger.
#define WDT_OPT_PAUSE_IN_SLEEP BIT(0) |
#include <zephyr/drivers/watchdog.h>
Pause watchdog timer when CPU is in sleep state.
typedef void(* wdt_callback_t) (const struct device *dev, int channel_id) |
#include <zephyr/drivers/watchdog.h>
Watchdog callback.
dev | Watchdog device instance. |
channel_id | Channel identifier. |
int wdt_disable | ( | const struct device * | dev | ) |
#include <zephyr/drivers/watchdog.h>
Disable watchdog instance.
This function disables the watchdog instance and automatically uninstalls all timeouts. To set up a new watchdog, install timeouts and call wdt_setup() again. Not all watchdogs can be restarted after they are disabled.
dev | Watchdog device instance. |
0 | If successful. |
-EFAULT | If watchdog instance is not enabled. |
-EPERM | If watchdog can not be disabled directly by application code. |
-errno | In case of any other failure. |
int wdt_feed | ( | const struct device * | dev, |
int | channel_id ) |
#include <zephyr/drivers/watchdog.h>
Feed specified watchdog timeout.
dev | Watchdog device instance. |
channel_id | Channel index. |
0 | If successful. |
-EAGAIN | If completing the feed operation would stall the caller, for example due to an in-progress watchdog operation such as a previous wdt_feed() call. |
-EINVAL | If there is no installed timeout for supplied channel. |
-errno | In case of any other failure. |
|
inlinestatic |
#include <zephyr/drivers/watchdog.h>
Install a new timeout.
dev | Watchdog device instance. | |
[in] | cfg | Timeout configuration. |
channel_id | If successful, a non-negative value indicating the index of the channel to which the timeout was assigned. This value is supposed to be used as the parameter in calls to wdt_feed(). |
-EBUSY | If timeout can not be installed while watchdog has already been setup. |
-ENOMEM | If no more timeouts can be installed. |
-ENOTSUP | If any of the set flags is not supported. |
-EINVAL | If any of the window timeout value is out of possible range. This value is also returned if watchdog supports only one timeout value for all timeouts and the supplied timeout window differs from windows for alarms installed so far. |
-errno | In case of any other failure. |
#include <zephyr/drivers/watchdog.h>
Set up watchdog instance.
This function is used for configuring global watchdog settings that affect all timeouts. It should be called after installing timeouts. After successful return, all installed timeouts are valid and must be serviced periodically by calling wdt_feed().
dev | Watchdog device instance. |
options | Configuration options (see WDT_OPT). |
0 | If successful. |
-ENOTSUP | If any of the set options is not supported. |
-EBUSY | If watchdog instance has been already setup. |
-errno | In case of any other failure. |