TCL scripts: collect duplicated procedures
authorAntonio Borneo <borneo.antonio@gmail.com>
Tue, 21 Sep 2010 08:06:37 +0000 (16:06 +0800)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 21 Sep 2010 10:25:59 +0000 (12:25 +0200)
TCL procedures mrw and mmw, originally in DaVinci target code,
are duplicated in other TCL scripts.
Moved in a common helper file, and added help/usage description.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
tcl/mem_helper.tcl [new file with mode: 0644]
tcl/target/c100helper.tcl
tcl/target/davinci.cfg
tcl/target/stellaris.cfg

diff --git a/tcl/mem_helper.tcl b/tcl/mem_helper.tcl
new file mode 100644 (file)
index 0000000..d811490
--- /dev/null
@@ -0,0 +1,22 @@
+# Helper for common memory read/modify/write procedures
+
+# mrw: "memory read word", returns value of $reg
+proc mrw {reg} {
+       set value ""
+       ocd_mem2array value 32 $reg 1
+       return $value(0)
+}
+
+add_usage_text mrw "address"
+add_help_text mrw "Returns value of word in memory."
+
+# mmw: "memory modify word", updates value of $reg
+#       $reg <== ((value & ~$clearbits) | $setbits)
+proc mmw {reg setbits clearbits} {
+       set old [mrw $reg]
+       set new [expr ($old & ~$clearbits) | $setbits]
+       mww $reg $new
+}
+
+add_usage_text mmw "address setbits clearbits"
+add_help_text mmw "Modify word in memory. new_val = (old_val & ~clearbits) | setbits;"
index 45adc62c6a6e02c8448de4495d45ba8ab98f32d1..32510660ee41ae837d309c28fcf3740e466db00f 100644 (file)
@@ -25,13 +25,7 @@ proc helpC100 {} {
     puts "22) flashUBOOT:        will prgram NOR sectors 0-3 with u-boot.bin"
 }
 
-# mrw,mmw from davinci.cfg
-# mrw: "memory read word", returns value of $reg
-proc mrw {reg} {
-    set value ""
-    mem2array value 32 $reg 1
-    return $value(0)
-}
+source [find mem_helper.tcl]
 
 # read a 64-bit register (memory mapped)
 proc mr64bit {reg} {
@@ -50,14 +44,6 @@ proc mw64bit {reg value} {
     mww [expr $reg+4] $high
 }
 
-# mmw: "memory modify word", updates value of $reg
-#      $reg <== ((value & ~$clearbits) | $setbits)
-proc mmw {reg setbits clearbits} {
-    set old [mrw $reg]
-    set new [expr ($old & ~$clearbits) | $setbits]
-    mww $reg $new
-}
-
 
 proc showNOR {} {
     puts "This is the current NOR setup"
index 6e9091e5ffa702d774148f3fc379858f8229431e..9e9369dc185c7c35fd16f0ec66f339b37b587df1 100644 (file)
@@ -7,20 +7,7 @@ proc davinci_pinmux {soc reg value} {
        mww [expr [dict get $soc sysbase] + 4 * $reg] $value
 }
 
-# mrw: "memory read word", returns value of $reg
-proc mrw {reg} {
-       set value ""
-       mem2array value 32 $reg 1
-       return $value(0)
-}
-
-# mmw: "memory modify word", updates value of $reg
-#      $reg <== ((value & ~$clearbits) | $setbits)
-proc mmw {reg setbits clearbits} {
-       set old [mrw $reg]
-       set new [expr ($old & ~$clearbits) | $setbits]
-       mww $reg $new
-}
+source [find mem_helper.tcl]
 
 #
 # pll_setup: initialize PLL
index 6ba5f14a208425a8a74dc4fd2fed467378b27bbe..b663ce3dc35f22a700b831b66ddf5da42140233f 100644 (file)
@@ -46,12 +46,7 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE
 # this, if you're using a slower clock.
 adapter_khz 500
 
-# mrw: "memory read word", returns value of $reg
-proc mrw {reg} {
-       set value ""
-       mem2array value 32 $reg 1
-       return $value(0)
-}
+source [find mem_helper.tcl]
 
 $_TARGETNAME configure -event reset-start {
        adapter_khz 500

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)