This is an automated email from Gerrit.

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

-- gerrit

commit 3f1b953c5575d40d598cae14f35adfa63e10f246
Author: Robert Jordens <[email protected]>
Date:   Mon Mar 5 09:34:45 2018 +0100

    xilinx-stat: support xilinx STAT register readout
    
    * Tested on xcku040 and xc7a100t
    
    Change-Id: Ifdd67de8af82bee244d79f35f26752f5db0ba39e
    Signed-off-by: Robert Jördens <[email protected]>

diff --git a/tcl/fpga/xilinx-stat.cfg b/tcl/fpga/xilinx-stat.cfg
new file mode 100644
index 0000000..dbeae0e
--- /dev/null
+++ b/tcl/fpga/xilinx-stat.cfg
@@ -0,0 +1,36 @@
+proc xilinx_flip32 {v} {
+       # bit-reverse a 32-bit unsigned integer
+       return [scan [string reverse [format "%032bb0" $v]] "%i"]
+}
+
+proc xilinx_cfg_op {op} {
+       # return a CFG opcode corresponding to the given oepration
+       array set ops {
+               NOP 0b00
+               READ 0b01
+               WRITE 0b10
+       }
+       return $ops($op)
+}
+
+proc xilinx_cfg {type op addr words} {
+       # return a CFG command
+       return [expr ($type << 29) | ([xilinx_cfg_op $op] << 27) \
+               | ($addr << 13) | $words]
+}
+
+proc xilinx_get_stat {tap} {
+       # return the value of the STAT register of the given TAP
+       set CFG_IN_IR 0x05
+       set CFG_OUT_IR 0x04
+       set CFG_STAT 0b00111
+       set SYNC [xilinx_flip32 0xaa995566]
+       set NOP [xilinx_flip32 [xilinx_cfg 1 NOP 0 0]]
+       set READ_STAT [xilinx_flip32 [xilinx_cfg 1 READ $CFG_STAT 1]]
+       irscan $tap $CFG_IN_IR
+       drscan $tap 32 $SYNC 32 $NOP 32 $READ_STAT 32 $NOP 32 $NOP
+       irscan $tap $CFG_OUT_IR
+       set stat [scan 0x[drscan $tap 32 0] %i]
+       pathmove RESET
+       return [xilinx_flip32 $stat]
+}

-- 


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

Reply via email to