update files to correct FSF address
[openocd.git] / src / jtag / drivers / OpenULINK / include / msgtypes.h
blob9dbbeddde2e89c27f12c2941e8770519f0356170
1 /***************************************************************************
2 * Copyright (C) 2011 by Martin Schmoelzer *
3 * <martin.schmoelzer@student.tuwien.ac.at> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
19 ***************************************************************************/
21 /**
22 * @file
23 * Definition of the commands supported by the OpenULINK firmware.
25 * Basically, two types of commands can be distinguished:
26 * - Commands with fixed payload size
27 * - Commands with variable payload size
29 * SCAN commands (in all variations) carry payloads of variable size, all
30 * other commands carry payloads of fixed size.
32 * In the case of SCAN commands, the payload size (n) is calculated by
33 * dividing the scan_size_bits variable by 8, rounding up the result.
35 * Offset zero always contains the command ID.
37 ****************************************************************************
38 * CMD_SCAN_IN, CMD_SLOW_SCAN_IN: *
39 * *
40 * OUT: *
41 * offset 1: scan_size_bytes *
42 * offset 2: bits_last_byte *
43 * offset 3: tms_count_start + tms_count_end *
44 * offset 4: tms_sequence_start *
45 * offset 5: tms_sequence_end *
46 * *
47 * IN: *
48 * offset 0..n: TDO data *
49 ****************************************************************************
50 * CMD_SCAN_OUT, CMD_SLOW_SCAN_OUT: *
51 * *
52 * OUT: *
53 * offset 1: scan_size_bytes *
54 * offset 2: bits_last_byte *
55 * offset 3: tms_count_start + tms_count_end *
56 * offset 4: tms_sequence_start *
57 * offset 5: tms_sequence_end *
58 * offset 6..x: TDI data *
59 ****************************************************************************
60 * CMD_SCAN_IO, CMD_SLOW_SCAN_IO: *
61 * *
62 * OUT: *
63 * offset 1: scan_size_bytes *
64 * offset 2: bits_last_byte *
65 * offset 3: tms_count_start + tms_count_end *
66 * offset 4: tms_sequence_start *
67 * offset 5: tms_sequence_end *
68 * offset 6..x: TDI data *
69 * *
70 * IN: *
71 * offset 0..n: TDO data *
72 ****************************************************************************
73 * CMD_CLOCK_TMS, CMD_SLOW_CLOCK_TMS: *
74 * *
75 * OUT: *
76 * offset 1: tms_count *
77 * offset 2: tms_sequence *
78 ****************************************************************************
79 * CMD_CLOCK_TCK, CMD_SLOW_CLOCK_TCK: *
80 * *
81 * OUT: *
82 * offset 1: low byte of tck_count *
83 * offset 2: high byte of tck_count *
84 ****************************************************************************
85 * CMD_CLOCK_SLEEP_US: *
86 * *
87 * OUT: *
88 * offset 1: low byte of sleep_us *
89 * offset 2: high byte of sleep_us *
90 ****************************************************************************
91 * CMD_CLOCK_SLEEP_MS: *
92 * *
93 * OUT: *
94 * offset 1: low byte of sleep_ms *
95 * offset 2: high byte of sleep_ms *
96 ****************************************************************************
97 * CMD_GET_SIGNALS: *
98 * *
99 * IN: *
100 * offset 0: current state of input signals *
101 * offset 1: current state of output signals *
102 ****************************************************************************
103 * CMD_SET_SIGNALS: *
105 * OUT: *
106 * offset 1: signals that should be de-asserted *
107 * offset 2: signals that should be asserted *
108 ****************************************************************************
109 * CMD_CONFIGURE_TCK_FREQ: *
111 * OUT: *
112 * offset 1: delay value for scan_in function *
113 * offset 2: delay value for scan_out function *
114 * offset 3: delay value for scan_io function *
115 * offset 4: delay value for clock_tck function *
116 * offset 5: delay value for clock_tms function *
117 ****************************************************************************
118 * CMD_SET_LEDS: *
120 * OUT: *
121 * offset 1: LED states: *
122 * Bit 0: turn COM LED on *
123 * Bit 1: turn RUN LED on *
124 * Bit 2: turn COM LED off *
125 * Bit 3: turn RUN LED off *
126 * Bits 7..4: Reserved *
127 ****************************************************************************
128 * CMD_TEST: *
130 * OUT: *
131 * offset 1: unused dummy value *
132 ****************************************************************************
135 #ifndef __MSGTYPES_H
136 #define __MSGTYPES_H
139 * Command IDs:
141 * Bits 7..6: Reserved, should always be zero
142 * Bits 5..0: Command ID. There are 62 usable IDs. Of this 63 available IDs,
143 * the IDs 0x00..0x1F are commands with variable payload size,
144 * the IDs 0x20..0x3F are commands with fixed payload size.
147 #define CMD_ID_MASK 0x3F
149 /* Commands with variable payload size */
150 #define CMD_SCAN_IN 0x00
151 #define CMD_SLOW_SCAN_IN 0x01
152 #define CMD_SCAN_OUT 0x02
153 #define CMD_SLOW_SCAN_OUT 0x03
154 #define CMD_SCAN_IO 0x04
155 #define CMD_SLOW_SCAN_IO 0x05
157 /* Commands with fixed payload size */
158 #define CMD_CLOCK_TMS 0x20
159 #define CMD_SLOW_CLOCK_TMS 0x21
160 #define CMD_CLOCK_TCK 0x22
161 #define CMD_SLOW_CLOCK_TCK 0x23
162 #define CMD_SLEEP_US 0x24
163 #define CMD_SLEEP_MS 0x25
164 #define CMD_GET_SIGNALS 0x26
165 #define CMD_SET_SIGNALS 0x27
166 #define CMD_CONFIGURE_TCK_FREQ 0x28
167 #define CMD_SET_LEDS 0x29
168 #define CMD_TEST 0x2A
170 /* JTAG signal definition for jtag_get_signals() -- Input signals! */
171 #define SIGNAL_TDO (1<<0)
172 #define SIGNAL_BRKOUT (1<<1)
173 #define SIGNAL_TRAP (1<<2)
174 #define SIGNAL_RTCK (1<<3)
176 /* JTAG signal definition for jtag_get_signals() -- Output signals! */
177 #define SIGNAL_TDI (1<<0)
178 #define SIGNAL_TMS (1<<1)
179 #define SIGNAL_TCK (1<<2)
180 #define SIGNAL_TRST (1<<3)
181 #define SIGNAL_BRKIN (1<<4)
182 #define SIGNAL_RESET (1<<5)
183 #define SIGNAL_OCDSE (1<<6)
185 /* LED definitions for CMD_SET_LEDS and CMD_CLEAR_LEDS commands */
186 #define COM_LED_ON (1<<0)
187 #define RUN_LED_ON (1<<1)
188 #define COM_LED_OFF (1<<2)
189 #define RUN_LED_OFF (1<<3)
191 #endif