![]() |
Data Logger BLE Cellular Board
|
Watchdog application wrapper for initializing, starting, and feeding the watchdog timer using Zephyr watchdog APIs. More...
#include "../jfet_files/jfet_common.h"#include <zephyr/device.h>#include <zephyr/drivers/watchdog.h>#include <zephyr/kernel.h>#include "watchdog_app.h"#include <zephyr/logging/log.h>Go to the source code of this file.
Classes | |
| struct | wdt_config_storage |
| Watchdog configuration storage. More... | |
| struct | wdt_data_storage |
| Watchdog runtime data storage. More... | |
Macros | |
| #define | WDT_FEED_WORKER_DELAY_MS ((CONFIG_WATCHDOG_APPLICATION_TIMEOUT_SEC * 1000) / 2) |
| #define | WATCHDOG_TIMEOUT_MSEC (CONFIG_WATCHDOG_APPLICATION_TIMEOUT_SEC * 1000) |
Functions | |
| LOG_MODULE_REGISTER (watchdog_app) | |
| static void | watchdog_notify_event (const struct watchdog_evt *evt) |
| Notify the registered watchdog event handler of an event. | |
| static void | primary_feed_worker (struct k_work *work_desc) |
| Primary watchdog feeding work handler. | |
| static int | watchdog_timeout_install (const struct wdt_config_storage *config, struct wdt_data_storage *data) |
| Installs a watchdog timeout configuration and registers it with the WDT device. | |
| static int | watchdog_start (const struct wdt_config_storage *config) |
| Starts the watchdog timer hardware instance. | |
| static int | watchdog_feed_enable (const struct wdt_config_storage *config, struct wdt_data_storage *data) |
| Enable periodic feeding of the hardware watchdog. | |
| static int | watchdog_enable (const struct wdt_config_storage *config, struct wdt_data_storage *data) |
| Enable and initialize the watchdog: verify device readiness, install the timeout, start the watchdog hardware, and enable periodic feeding. | |
| int | watchdog_init_and_start (void) |
| Initialize and start the watchdog timer. | |
| void | watchdog_register_handler (watchdog_evt_handler_t evt_handler) |
| Register handler to receive watchdog callback events. | |
Variables | |
| static watchdog_evt_handler_t | app_evt_handler |
| Registered application event handler. | |
| static bool | init_and_start |
| Flag set when the library has been initialized and started. */. | |
| static const struct wdt_config_storage | wdt_config |
| Watchdog device configuration storage. | |
| static struct wdt_data_storage | wdt_data |
Watchdog application wrapper for initializing, starting, and feeding the watchdog timer using Zephyr watchdog APIs.
Definition in file watchdog_app.c.
| #define WATCHDOG_TIMEOUT_MSEC (CONFIG_WATCHDOG_APPLICATION_TIMEOUT_SEC * 1000) |
Definition at line 25 of file watchdog_app.c.
| #define WDT_FEED_WORKER_DELAY_MS ((CONFIG_WATCHDOG_APPLICATION_TIMEOUT_SEC * 1000) / 2) |
Definition at line 24 of file watchdog_app.c.
| LOG_MODULE_REGISTER | ( | watchdog_app | ) |
|
static |
Primary watchdog feeding work handler.
This work handler feeds the watchdog timer periodically unless the stopWDTFeed flag is set. If feeding succeeds, the work is rescheduled after WDT_FEED_WORKER_DELAY_MS. If the flag is set, the function returns early to allow the watchdog to timeout.
| work_desc | Pointer to the work item descriptor. |
Definition at line 85 of file watchdog_app.c.


|
static |
Enable and initialize the watchdog: verify device readiness, install the timeout, start the watchdog hardware, and enable periodic feeding.
| config | pointer to watchdog configuration storage (wdt device and params) |
| data | pointer to watchdog runtime data storage (channel id, workqueue, etc.) |
Definition at line 223 of file watchdog_app.c.


|
static |
Enable periodic feeding of the hardware watchdog.
| config | Pointer to the stored watchdog configuration (must not be NULL). |
| data | Pointer to runtime watchdog data (must not be NULL). |
This function initializes a delayed work item which will periodically call primary_feed_worker to feed the watchdog and schedules the first invocation. It also performs an immediate feed to ensure the watchdog does not expire while setup completes and notifies interested subsystems about the feed event.
Definition at line 182 of file watchdog_app.c.


| int watchdog_init_and_start | ( | void | ) |
Initialize and start the watchdog timer.
Initialize and start application watchdog module.
Definition at line 258 of file watchdog_app.c.


|
static |
Notify the registered watchdog event handler of an event.
| evt | Pointer to the watchdog event data. |
Definition at line 59 of file watchdog_app.c.

| void watchdog_register_handler | ( | watchdog_evt_handler_t | evt_handler | ) |
Register handler to receive watchdog callback events.
| evt_handler | Event handler. Handler is de-registered if parameter is NULL. |
Definition at line 291 of file watchdog_app.c.

|
static |
Starts the watchdog timer hardware instance.
| config | Pointer to watchdog configuration storage. |
Definition at line 151 of file watchdog_app.c.


|
static |
Installs a watchdog timeout configuration and registers it with the WDT device.
| config | Pointer to the watchdog configuration storage containing the WDT device. |
| data | Pointer to the watchdog data storage where the channel ID will be stored. |
Definition at line 116 of file watchdog_app.c.


|
static |
Registered application event handler.
Definition at line 48 of file watchdog_app.c.
|
static |
Flag set when the library has been initialized and started. */.
Definition at line 50 of file watchdog_app.c.
|
static |
Watchdog device configuration storage.
Definition at line 68 of file watchdog_app.c.
|
static |
Definition at line 72 of file watchdog_app.c.