Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
|
Task Watchdog APIs . More...
Typedefs | |
typedef void(* | task_wdt_callback_t) (int channel_id, void *user_data) |
Task watchdog callback. | |
Functions | |
int | task_wdt_init (const struct device *hw_wdt) |
Initialize task watchdog. | |
int | task_wdt_add (uint32_t reload_period, task_wdt_callback_t callback, void *user_data) |
Install new timeout. | |
int | task_wdt_delete (int channel_id) |
Delete task watchdog channel. | |
int | task_wdt_feed (int channel_id) |
Feed specified watchdog channel. | |
Task Watchdog APIs .
typedef void(* task_wdt_callback_t) (int channel_id, void *user_data) |
#include <zephyr/task_wdt/task_wdt.h>
Task watchdog callback.
int task_wdt_add | ( | uint32_t | reload_period, |
task_wdt_callback_t | callback, | ||
void * | user_data ) |
#include <zephyr/task_wdt/task_wdt.h>
Install new timeout.
Adds a new timeout to the list of task watchdog channels.
reload_period | Period in milliseconds used to reset the timeout |
callback | Function to be called when watchdog timer expired. Pass NULL to use system reset handler. |
user_data | User data to associate with the watchdog channel. |
channel_id | If successful, a non-negative value indicating the index of the channel to which the timeout was assigned. This ID is supposed to be used as the parameter in calls to task_wdt_feed(). |
-EINVAL | If the reload_period is invalid. |
-ENOMEM | If no more timeouts can be installed. |
int task_wdt_delete | ( | int | channel_id | ) |
#include <zephyr/task_wdt/task_wdt.h>
Delete task watchdog channel.
Deletes the specified channel from the list of task watchdog channels. The channel is now available again for other tasks via task_wdt_add() function.
channel_id | Index of the channel as returned by task_wdt_add(). |
0 | If successful. |
-EINVAL | If there is no installed timeout for supplied channel. |
int task_wdt_feed | ( | int | channel_id | ) |
#include <zephyr/task_wdt/task_wdt.h>
Feed specified watchdog channel.
This function loops through all installed task watchdogs and updates the internal kernel timer used as for the software watchdog with the next due timeout.
channel_id | Index of the fed channel as returned by task_wdt_add(). |
0 | If successful. |
-EINVAL | If there is no installed timeout for supplied channel. |
int task_wdt_init | ( | const struct device * | hw_wdt | ) |
#include <zephyr/task_wdt/task_wdt.h>
Initialize task watchdog.
This function sets up necessary kernel timers and the hardware watchdog (if desired as fallback). It has to be called before task_wdt_add() and task_wdt_feed().
hw_wdt | Pointer to the hardware watchdog device used as fallback. Pass NULL if no hardware watchdog fallback is desired. |
0 | If successful. |
-ENOTSUP | If assigning a hardware watchdog is not supported. |
-Errno | Negative errno if the fallback hw_wdt is used and the install timeout API fails. See wdt_install_timeout() API for possible return values. |