You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ag...@apache.org on 2022/09/27 18:46:38 UTC

[mynewt-core] 01/01: da1469x: Add option to not disable watchdog on init

This is an automated email from the ASF dual-hosted git repository.

agross pushed a commit to branch watchdog-disable-option
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 2a4cb99715bc7ec2dfcd95a304facabe91a8e462
Author: Andy Gross <an...@juul.com>
AuthorDate: Fri Sep 23 13:32:10 2022 -0500

    da1469x: Add option to not disable watchdog on init
    
    This patch adds a facility to control whether or not the Dialog watchdog is
    disabled when the hal_watchdog_init function is being called.
    
    Signed-off-by: Andy Gross <an...@juul.com>
---
 hw/mcu/dialog/da1469x/src/hal_watchdog.c | 5 ++++-
 hw/mcu/dialog/da1469x/syscfg.yml         | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/mcu/dialog/da1469x/src/hal_watchdog.c b/hw/mcu/dialog/da1469x/src/hal_watchdog.c
index c8e07fbd5..d7c7bbeff 100644
--- a/hw/mcu/dialog/da1469x/src/hal_watchdog.c
+++ b/hw/mcu/dialog/da1469x/src/hal_watchdog.c
@@ -27,7 +27,10 @@ int
 hal_watchdog_init(uint32_t expire_msecs)
 {
     SYS_WDOG->WATCHDOG_CTRL_REG = SYS_WDOG_WATCHDOG_CTRL_REG_WDOG_FREEZE_EN_Msk;
+
+#if MYNEWT_VAL(MCU_WATCHDOG_DISABLE_ON_INIT)
     GPREG->SET_FREEZE_REG |= GPREG_SET_FREEZE_REG_FRZ_SYS_WDOG_Msk;
+#endif
 
 #if MYNEWT_VAL_CHOICE(MCU_LPCLK_SOURCE, RCX)
     g_hal_watchdog_reload_val = expire_msecs / 21;
@@ -40,7 +43,7 @@ hal_watchdog_init(uint32_t expire_msecs)
         /* wait */
     }
     SYS_WDOG->WATCHDOG_REG = g_hal_watchdog_reload_val;
-    
+
     return 0;
 }
 
diff --git a/hw/mcu/dialog/da1469x/syscfg.yml b/hw/mcu/dialog/da1469x/syscfg.yml
index 2fecdc0cd..fe4e45b6e 100644
--- a/hw/mcu/dialog/da1469x/syscfg.yml
+++ b/hw/mcu/dialog/da1469x/syscfg.yml
@@ -454,6 +454,11 @@ syscfg.defs:
         restrictions:
             - '!GPADC_BATTERY'
 
+    MCU_WATCHDOG_DISABLE_ON_INIT:
+        description: >
+          'Disable watchdog on init'
+        value: 1
+
 syscfg.vals:
     OS_TICKS_PER_SEC: 128