tcl/target: add SPDX tag
[fw/openocd] / tcl / target / bluenrg-x.cfg
index 66473251fdab9fd8c7d1a3fc765405016c1d9ede..afa1b513b26981434e6274e03a4623eda0c0926f 100644 (file)
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
 #
 # bluenrg-1/2 and bluenrg-lp devices support only SWD transports.
 #
@@ -47,11 +49,14 @@ if {![using_hla]} {
    cortex_m reset_config sysresetreq
 }
 
+set JTAG_IDCODE_B2 0x0200A041
+set JTAG_IDCODE_B1 0x0
+
 $_TARGETNAME configure -event halted {
     global WDOG_VALUE
     global WDOG_VALUE_SET
     set _JTAG_IDCODE [mrw 0x40000004]
-    if {$_JTAG_IDCODE != 0x0201E041} {
+    if {$_JTAG_IDCODE == $JTAG_IDCODE_B2 || $_JTAG_IDCODE == $JTAG_IDCODE_B1} {
         # Stop watchdog during halt, if enabled. Only Bluenrg-1/2
         set WDOG_VALUE [mrw 0x40700008]
         if [expr {$WDOG_VALUE & (1 << 1)}] {
@@ -64,8 +69,8 @@ $_TARGETNAME configure -event resumed {
     global WDOG_VALUE
     global WDOG_VALUE_SET
     set _JTAG_IDCODE [mrw 0x40000004]
-    if {$_JTAG_IDCODE != 0x0201E041} {
-        if [expr $WDOG_VALUE_SET] {
+    if {$_JTAG_IDCODE == $JTAG_IDCODE_B2 || $_JTAG_IDCODE == $JTAG_IDCODE_B1} {
+        if {$WDOG_VALUE_SET} {
             # Restore watchdog enable value after resume. Only Bluenrg-1/2
             mww 0x40700008 $WDOG_VALUE
             set WDOG_VALUE_SET 0