From 2df9794bea81599a5186446f63ea5523735af8bd Mon Sep 17 00:00:00 2001 From: Dylan Laduranty Date: Wed, 5 Jul 2023 09:48:44 +0200 Subject: [PATCH 1/3] cpu/nrf5x/periph/wdt: add compatibility wrapper for nRF9160/nRF53 Signed-off-by: Dylan Laduranty --- cpu/nrf5x_common/periph/wdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cpu/nrf5x_common/periph/wdt.c b/cpu/nrf5x_common/periph/wdt.c index 95c3f3cefed8..63c922e7af28 100644 --- a/cpu/nrf5x_common/periph/wdt.c +++ b/cpu/nrf5x_common/periph/wdt.c @@ -42,6 +42,18 @@ #define NRF_WDT_HALT_MODE (WDT_CONFIG_HALT_Run) #endif +/* Compatibility wrapper for nRF53/nRF9160 */ +#ifdef NRF_WDT0_S +#define NRF_WDT NRF_WDT0_S +#elif defined(NRF_WDT_S) +#define NRF_WDT NRF_WDT_S +#endif + +/* Wrapper around vendor files inconsistency */ +#ifdef WDT_RUNSTATUS_RUNSTATUSWDT_Running +#define WDT_RUNSTATUS_RUNSTATUS_Running WDT_RUNSTATUS_RUNSTATUSWDT_Running +#endif + #ifdef MODULE_PERIPH_WDT_CB static wdt_cb_t wdt_cb; static void *wdt_arg; From 8ccad4aca7bf594af1840eb1de5994ee06954257 Mon Sep 17 00:00:00 2001 From: Dylan Laduranty Date: Wed, 5 Jul 2023 09:49:28 +0200 Subject: [PATCH 2/3] cpu/nrf5x_common: enable periph_wdt on nRF9160/nRF53 Signed-off-by: Dylan Laduranty --- cpu/nrf5x_common/Makefile.features | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/nrf5x_common/Makefile.features b/cpu/nrf5x_common/Makefile.features index c1a65daa58af..f1e5edbdc273 100644 --- a/cpu/nrf5x_common/Makefile.features +++ b/cpu/nrf5x_common/Makefile.features @@ -3,6 +3,7 @@ FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_timer_periodic FEATURES_PROVIDED += periph_uart_modecfg +FEATURES_PROVIDED += periph_wdt periph_wdt_cb ifeq (,$(filter nrf5340_app,$(CPU_MODEL))) FEATURES_PROVIDED += periph_flashpage @@ -16,7 +17,6 @@ ifeq (,$(filter nrf9160 nrf5340_app,$(CPU_MODEL))) FEATURES_PROVIDED += periph_hwrng FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_temperature - FEATURES_PROVIDED += periph_wdt periph_wdt_cb # Various other features (if any) FEATURES_PROVIDED += ble_nimble From 1df1279de5b8265cb552bcf1c4611f431cb512fc Mon Sep 17 00:00:00 2001 From: Dylan Laduranty Date: Wed, 5 Jul 2023 09:50:02 +0200 Subject: [PATCH 3/3] cpu/nrf{53,9160}: enable periph_wdt in Kconfig Signed-off-by: Dylan Laduranty --- cpu/nrf53/Kconfig | 2 ++ cpu/nrf9160/Kconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cpu/nrf53/Kconfig b/cpu/nrf53/Kconfig index 756140d48c4d..7fb7e7edf9bd 100644 --- a/cpu/nrf53/Kconfig +++ b/cpu/nrf53/Kconfig @@ -14,6 +14,8 @@ config CPU_FAM_NRF53 select HAS_PERIPH_GPIO_IRQ select HAS_PERIPH_TIMER_PERIODIC select HAS_PERIPH_UART_MODECFG + select HAS_PERIPH_WDT + select HAS_PERIPH_WDT_CB ## CPU Models config CPU_MODEL_NRF5340_APP diff --git a/cpu/nrf9160/Kconfig b/cpu/nrf9160/Kconfig index e55b2c0dc6c8..f164faf590a1 100644 --- a/cpu/nrf9160/Kconfig +++ b/cpu/nrf9160/Kconfig @@ -19,6 +19,8 @@ config CPU_FAM_NRF9160 select HAS_PERIPH_TIMER_PERIODIC select HAS_PERIPH_UART_MODECFG select HAS_PERIPH_SPI_GPIO_MODE + select HAS_PERIPH_WDT + select HAS_PERIPH_WDT_CB ## CPU Models config CPU_MODEL_NRF9160