From: OpenOCD-Gerrit <ope...@us...> - 2022-06-10 21:56:43
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 70338509ca52a9b78c52a5d464ba2605fbaf193b (commit) from d1b882f2c014258be5397067e45848fa5465b78b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 70338509ca52a9b78c52a5d464ba2605fbaf193b Author: Erhan Kurubas <erh...@es...> Date: Sat Jun 4 00:25:19 2022 +0200 tcl: add get_bit & get_bitfield memory helper functions Signed-off-by: Erhan Kurubas <erh...@es...> Change-Id: I21506526e3ebd9c3a70a25ba60bf83aee431feb6 Reviewed-on: https://review.openocd.org/c/openocd/+/7016 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/tcl/mmr_helpers.tcl b/tcl/mmr_helpers.tcl index d9b6e6383..61c58e7ca 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 get_mmr_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 get_mmr_bitfield { ADDR MSB LSB } { + set rval [memread32 $ADDR] + return normalize_bitfield $rval $MSB $LSB +} ----------------------------------------------------------------------- Summary of changes: tcl/mmr_helpers.tcl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) hooks/post-receive -- Main OpenOCD repository |