This is an automated email from Gerrit.

Andreas Bolsch ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/4800

-- gerrit

commit 8678bb6379ded7467c125918156463e84e35c282
Author: Andreas Bolsch <[email protected]>
Date:   Sun Dec 9 12:55:00 2018 +0100

    TCL helpers for read-modify-write
    
    Adds halfword and byte variants of 'mmw' command. Some Kinetis
    controllers have a byte-wide clock conf register with various bitfields.
    
    Change-Id: I6b3428a78cbd5c245499543eca0b22a4f1a3052e
    Signed-off-by: Andreas Bolsch <[email protected]>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 776160a..1632d7e 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -7838,6 +7838,18 @@ Otherwise, or if the optional @var{phys} flag is 
specified,
 @var{addr} is interpreted as a physical address.
 @end deffn
 
+@deffn Command mmw addr setmask clearmask
+@deffnx Command mmh addr setmask clearmask
+@deffnx Command mmb addr setmask clearmask
+Reads the specified @var{word} (32 bits),
+@var{halfword} (16 bits), or @var{byte} (8-bit) value,
+at the specified address @var{addr}, clears bits according
+to @var{clearmask}, then sets bits according to @var{setmask},
+and writes back the result.
+When the current target has an MMU which is present and active,
+@var{addr} is interpreted as a virtual address.
+@end deffn
+
 @anchor{imageaccess}
 @section Image loading commands
 @cindex image loading
diff --git a/tcl/mem_helper.tcl b/tcl/mem_helper.tcl
index 5955793..3ed6015 100644
--- a/tcl/mem_helper.tcl
+++ b/tcl/mem_helper.tcl
@@ -40,3 +40,25 @@ proc mmw {reg setbits clearbits} {
 
 add_usage_text mmw "address setbits clearbits"
 add_help_text mmw "Modify word in memory. new_val = (old_val & ~clearbits) | 
setbits;"
+
+# mmh: "memory modify halfword", updates value of $reg
+#       $reg <== ((value & ~$clearbits) | $setbits)
+proc mmh {reg setbits clearbits} {
+       set old [mrh $reg]
+       set new [expr ($old & ~$clearbits) | $setbits]
+       mwh $reg $new
+}
+
+add_usage_text mmh "address setbits clearbits"
+add_help_text mmh "Modify halfword in memory. new_val = (old_val & ~clearbits) 
| setbits;"
+
+# mmb: "memory modify byte", updates value of $reg
+#       $reg <== ((value & ~$clearbits) | $setbits)
+proc mmb {reg setbits clearbits} {
+       set old [mrb $reg]
+       set new [expr ($old & ~$clearbits) | $setbits]
+       mwb $reg $new
+}
+
+add_usage_text mmb "address setbits clearbits"
+add_help_text mmb "Modify byte in memory. new_val = (old_val & ~clearbits) | 
setbits;"

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to