target: restructure dap support
[openocd.git] / tcl / target / icepick.cfg
1 #
2 # Copyright (C) 2011 by Karl Kurbjun
3 # Copyright (C) 2009 by David Brownell
4 #
5
6 # Utilities for TI ICEpick-C/D used in most TI SoCs
7 # Details about the ICEPick are available in the the TRM for each SoC
8 # and http://processors.wiki.ti.com/index.php/ICEPICK
9
10 # create "constants"
11 proc CONST { key } {
12
13 array set constant {
14 # define ICEPick instructions
15 IR_BYPASS 0x00
16 IR_ROUTER 0x02
17 IR_CONNECT 0x07
18 IF_BYPASS 0x3F
19 }
20 return $constant($key)
21 }
22
23 # Instruction to connect to the icepick module
24 proc icepick_c_connect {jrc} {
25
26 # Send CONNECT instruction in IR state
27 irscan $jrc [CONST IR_CONNECT] -endstate IRPAUSE
28
29 # Send write and connect key
30 drscan $jrc 8 0x89 -endstate DRPAUSE
31 }
32
33 # Instruction to disconnect to the icepick module
34 proc icepick_c_disconnect {jrc} {
35
36 # Send CONNECT instruction in IR state
37 irscan $jrc [CONST IR_CONNECT] -endstate IRPAUSE
38
39 # Send write and connect key
40 drscan $jrc 8 0x86 -endstate DRPAUSE
41 }
42
43 #
44 # icepick_c_router:
45 # this function is for sending router commands
46 # arguments are:
47 # jrc: TAP name for the ICEpick
48 # rw: read/write (0 for read, 1 for write)
49 # block: icepick or DAP
50 # register: which register to read/write
51 # payload: value to read/write
52 # this function is for sending router commands
53 #
54 proc icepick_c_router {jrc rw block register payload} {
55
56 set new_dr_value \
57 [expr ( ($rw & 0x1) << 31) | ( ($block & 0x7) << 28) | \
58 ( ($register & 0xF) << 24) | ( $payload & 0xFFFFFF ) ]
59
60 # echo "\tNew router value:\t0x[format %x $new_dr_value]"
61
62 # select router
63 irscan $jrc [CONST IR_ROUTER] -endstate IRPAUSE
64
65 # ROUTER instructions are 32 bits wide
66 set old_dr_value 0x[drscan $jrc 32 $new_dr_value -endstate DRPAUSE]
67 # echo "\tOld router value:\t0x[format %x $old_dr_value]"
68 }
69
70 # Configure the icepick control register
71 proc icepick_c_setup {jrc} {
72
73 # send a router write, block is 0, register is 1, value is 0x2100
74 icepick_c_router $jrc 1 0x0 0x1 0x001000
75 }
76
77 # jrc == TAP name for the ICEpick
78 # port == a port number, 0..15
79 proc icepick_c_tapenable {jrc port} {
80
81 # First CONNECT to the ICEPick
82 # echo "Connecting to ICEPick"
83 icepick_c_connect $jrc
84
85 # echo "Configuring the ICEpick"
86 icepick_c_setup $jrc
87
88 # NOTE: it's important not to enter RUN/IDLE state until
89 # done sending these instructions and data to the ICEpick.
90 # And never to enter RESET, which will disable the TAPs.
91
92 # first enable power and clock for TAP
93 icepick_c_router $jrc 1 0x2 $port 0x100048
94
95 # TRM states that the register should be read back here, skipped for now
96
97 # enable debug "default" mode
98 icepick_c_router $jrc 1 0x2 $port 0x102048
99
100 # TRM states that debug enable and debug mode should be read back and
101 # confirmed - skipped for now
102
103 # Finally select the tap
104 icepick_c_router $jrc 1 0x2 $port 0x102148
105
106 # Enter the bypass state
107 irscan $jrc [CONST IR_BYPASS] -endstate RUN/IDLE
108 runtest 10
109 }
110
111 # jrc == TAP name for the ICEpick
112 # coreid== core id number 0..15 (not same as port number!)
113 proc icepick_d_set_core_control {jrc coreid value } {
114 icepick_c_router $jrc 1 0x6 $coreid $value
115 }
116
117 # jrc == TAP name for the ICEpick
118 # port == a port number, 0..15
119 # Follow the sequence described in
120 # http://processors.wiki.ti.com/images/f/f6/Router_Scan_Sequence-ICEpick-D.pdf
121 proc icepick_d_tapenable {jrc port coreid { value 0x2008 } } {
122 # First CONNECT to the ICEPick
123 icepick_c_connect $jrc
124 icepick_c_setup $jrc
125
126 # Select the port
127 icepick_c_router $jrc 1 0x2 $port 0x2108
128
129 # Set icepick core control for $coreid
130 icepick_d_set_core_control $jrc $coreid $value
131
132 # Enter the bypass state
133 irscan $jrc [CONST IF_BYPASS] -endstate RUN/IDLE
134 runtest 10
135 }
136
137 # This function uses the ICEPick to send a warm system reset
138 proc icepick_c_wreset {jrc} {
139
140 # send a router write, block is 0, register is 1, value is 0x2100
141 icepick_c_router $jrc 1 0x0 0x1 0x002101
142 }
143

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)