This is an automated email from Gerrit.

"Erhan Kurubas <erhan.kuru...@espressif.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7016

-- gerrit

commit 16581c29afd25712413c88d05766dd1c2b0788a2
Author: Erhan Kurubas <erhan.kuru...@espressif.com>
Date:   Sat Jun 4 00:25:19 2022 +0200

    tcl: add get_bit & get_bitfield memory helper functions
    
    Signed-off-by: Erhan Kurubas <erhan.kuru...@espressif.com>
    Change-Id: I21506526e3ebd9c3a70a25ba60bf83aee431feb6

diff --git a/tcl/mmr_helpers.tcl b/tcl/mmr_helpers.tcl
index d9b6e63834..24d7ab02ea 100644
--- a/tcl/mmr_helpers.tcl
+++ b/tcl/mmr_helpers.tcl
@@ -70,3 +70,22 @@ proc show_mmr_bitfield { MSB LSB VAL FIELDNAME FIELDVALUES } 
{
     }
     echo [format "%-15s: %d (0x%0*x) %s" $FIELDNAME $nval $width $nval $sval ]
 }
+
+# Give: ADDR - address of the register.
+#       BIT - bit's number.
+
+proc mmr_get_bit { ADDR BIT } {
+       set val [memread32 $ADDR]
+    set bit_val [expr {$val & [expr {1 << $BIT}]}]
+    return $bit_val
+}
+
+
+# Give: ADDR - address of the register.
+#       MSB - MSB bit's number.
+#       LSB - LSB bit's number.
+
+proc mmr_get_bitfield { ADDR MSB LSB } {
+       set rval [memread32 $ADDR]
+    return normalize_bitfield $rval $MSB $LSB
+}

-- 

Reply via email to