From 94efc6470992bfff2308c7f10600765a56ffb8f1 Mon Sep 17 00:00:00 2001 From: oharboe Date: Sun, 20 Jul 2008 17:13:08 +0000 Subject: Duane Ellis - script commands for stm32 git-svn-id: svn://svn.berlios.de/openocd/trunk@842 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/tcl/mmr_helpers.tcl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/tcl/mmr_helpers.tcl') diff --git a/src/tcl/mmr_helpers.tcl b/src/tcl/mmr_helpers.tcl index 5dac48a8..ea2210ac 100644 --- a/src/tcl/mmr_helpers.tcl +++ b/src/tcl/mmr_helpers.tcl @@ -13,7 +13,7 @@ proc show_mmr32_reg { NAME } { set a [set [set NAME]] if ![catch { set v [memread32 $a] } msg ] { - puts [format "%10s: (0x%08x): 0x%08x" $NAME $a $v] + puts [format "%15s: (0x%08x): 0x%08x" $NAME $a $v] # Was a helper defined? set fn show_${NAME}_helper @@ -36,7 +36,7 @@ proc show_mmr32_bits { NAMES VAL } { upvar $NAMES MYNAMES - set w 0 + set w 5 foreach {IDX N} $MYNAMES { set l [string length $N] if { $l > $w } { set w $l } @@ -57,3 +57,16 @@ proc show_mmr32_bits { NAMES VAL } { puts "" } } + + +proc show_mmr_bitfield { MSB LSB VAL FIELDNAME FIELDVALUES } { + set width [expr (($MSB - $LSB + 1) + 7) / 4] + set nval [show_normalize_bitfield $VAL $MSB $LSB ] + set name0 [lindex $FIELDVALUES 0 ] + if [ string compare $name0 _NUMBER_ ] { + set sval [lindex $FIELDVALUES $nval] + } else { + set sval "" + } + puts [format "%-15s: %d (0x%0*x) %s" $FIELDNAME $nval $width $nval $sval ] +} -- cgit v1.2.3-18-g5258