mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:12:57 +01:00
drivers/wdt: add periph_wdt_auto_start for early watchdog
Add an option to enable the watchdog early to detect hangs during initialisation.
This commit is contained in:
parent
fb603f2660
commit
b8a6988e79
@ -254,6 +254,10 @@ ifneq (,$(filter periph_timer_periodic,$(USEMODULE)))
|
||||
FEATURES_REQUIRED += periph_timer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter periph_wdt_auto_start,$(USEMODULE)))
|
||||
FEATURES_REQUIRED += periph_wdt
|
||||
endif
|
||||
|
||||
ifneq (,$(filter-out netdev_default netdev_new_api netdev_legacy_api, $(filter netdev_%,$(USEMODULE))))
|
||||
USEMODULE += netdev
|
||||
# Don't register netdevs if there is only a single one of them
|
||||
|
@ -230,6 +230,23 @@ extern "C" {
|
||||
#define WDT_HAS_INIT (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief If `periph_wdt_auto_start` is used, this will be the lower bound
|
||||
* of when the WDT can be kicked.
|
||||
*/
|
||||
#ifndef CONFIG_PERIPH_WDT_WIN_MIN_MS
|
||||
#define CONFIG_PERIPH_WDT_WIN_MIN_MS (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief If `periph_wdt_auto_start` is used, this will be the max period
|
||||
* after which the WDT must be kicked or else it will reboot the
|
||||
* system.
|
||||
*/
|
||||
#ifndef CONFIG_PERIPH_WDT_WIN_MAX_MS
|
||||
#define CONFIG_PERIPH_WDT_WIN_MAX_MS (1024)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Start watchdog timer
|
||||
*/
|
||||
|
@ -102,6 +102,11 @@ void periph_init(void)
|
||||
|
||||
#if defined(MODULE_PERIPH_INIT_WDT) && WDT_HAS_INIT
|
||||
wdt_init();
|
||||
|
||||
if (IS_ACTIVE(MODULE_PERIPH_WDT_AUTO_START)) {
|
||||
wdt_setup_reboot(CONFIG_PERIPH_WDT_WIN_MIN_MS, CONFIG_PERIPH_WDT_WIN_MAX_MS);
|
||||
wdt_start();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MODULE_PERIPH_INIT_PTP)
|
||||
|
Loading…
Reference in New Issue
Block a user