ULINK driver: Implement variable TCK frequency in OpenULINK firmware
[openocd.git] / src / jtag / drivers / OpenULINK / include / msgtypes.h
blobcb356128a0e3425b5d3ea99fb4e6367b3dfd9af0
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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 /**
22 * @file Definition of the commands supported by the OpenULINK firmware.
24 * Basically, two types of commands can be distinguished:
25 * - Commands with fixed payload size
26 * - Commands with variable payload size
28 * SCAN commands (in all variations) carry payloads of variable size, all
29 * other commands carry payloads of fixed size.
31 * In the case of SCAN commands, the payload size (n) is calculated by
32 * dividing the scan_size_bits variable by 8, rounding up the result.
34 * Offset zero always contains the command ID.
36 ****************************************************************************
37 * CMD_SCAN_IN, CMD_SLOW_SCAN_IN: *
38 * *
39 * OUT: *
40 * offset 1: scan_size_bytes *
41 * offset 2: bits_last_byte *
42 * offset 3: tms_count_start + tms_count_end *
43 * offset 4: tms_sequence_start *
44 * offset 5: tms_sequence_end *
45 * *
46 * IN: *
47 * offset 0..n: TDO data *
48 ****************************************************************************
49 * CMD_SCAN_OUT, CMD_SLOW_SCAN_OUT: *
50 * *
51 * OUT: *
52 * offset 1: scan_size_bytes *
53 * offset 2: bits_last_byte *
54 * offset 3: tms_count_start + tms_count_end *
55 * offset 4: tms_sequence_start *
56 * offset 5: tms_sequence_end *
57 * offset 6..x: TDI data *
58 ****************************************************************************
59 * CMD_SCAN_IO, CMD_SLOW_SCAN_IO: *
60 * *
61 * OUT: *
62 * offset 1: scan_size_bytes *
63 * offset 2: bits_last_byte *
64 * offset 3: tms_count_start + tms_count_end *
65 * offset 4: tms_sequence_start *
66 * offset 5: tms_sequence_end *
67 * offset 6..x: TDI data *
68 * *
69 * IN: *
70 * offset 0..n: TDO data *
71 ****************************************************************************
72 * CMD_CLOCK_TMS, CMD_SLOW_CLOCK_TMS: *
73 * *
74 * OUT: *
75 * offset 1: tms_count *
76 * offset 2: tms_sequence *
77 ****************************************************************************
78 * CMD_CLOCK_TCK, CMD_SLOW_CLOCK_TCK: *
79 * *
80 * OUT: *
81 * offset 1: low byte of tck_count *
82 * offset 2: high byte of tck_count *
83 ****************************************************************************
84 * CMD_CLOCK_SLEEP_US: *
85 * *
86 * OUT: *
87 * offset 1: low byte of sleep_us *
88 * offset 2: high byte of sleep_us *
89 ****************************************************************************
90 * CMD_CLOCK_SLEEP_MS: *
91 * *
92 * OUT: *
93 * offset 1: low byte of sleep_ms *
94 * offset 2: high byte of sleep_ms *
95 ****************************************************************************
96 * CMD_GET_SIGNALS: *
97 * *
98 * IN: *
99 * offset 0: current state of input signals *
100 * offset 1: current state of output signals *
101 ****************************************************************************
102 * CMD_SET_SIGNALS: *
104 * OUT: *
105 * offset 1: signals that should be de-asserted *
106 * offset 2: signals that should be asserted *
107 ****************************************************************************
108 * CMD_CONFIGURE_TCK_FREQ: *
110 * OUT: *
111 * offset 1: delay value for scan_in function *
112 * offset 2: delay value for scan_out function *
113 * offset 3: delay value for scan_io function *
114 * offset 4: delay value for clock_tck function *
115 * offset 5: delay value for clock_tms function *
116 ****************************************************************************
117 * CMD_SET_LEDS: *
119 * OUT: *
120 * offset 1: LED states: *
121 * Bit 0: turn COM LED on *
122 * Bit 1: turn RUN LED on *
123 * Bit 2: turn COM LED off *
124 * Bit 3: turn RUN LED off *
125 * Bits 7..4: Reserved *
126 ****************************************************************************
127 * CMD_TEST: *
129 * OUT: *
130 * offset 1: unused dummy value *
131 ****************************************************************************
134 #ifndef __MSGTYPES_H
135 #define __MSGTYPES_H
138 * Command IDs:
140 * Bits 7..6: Reserved, should always be zero
141 * Bits 5..0: Command ID. There are 62 usable IDs. Of this 63 available IDs,
142 * the IDs 0x00..0x1F are commands with variable payload size,
143 * the IDs 0x20..0x3F are commands with fixed payload size.
146 #define CMD_ID_MASK 0x3F
148 /* Commands with variable payload size */
149 #define CMD_SCAN_IN 0x00
150 #define CMD_SLOW_SCAN_IN 0x01
151 #define CMD_SCAN_OUT 0x02
152 #define CMD_SLOW_SCAN_OUT 0x03
153 #define CMD_SCAN_IO 0x04
154 #define CMD_SLOW_SCAN_IO 0x05
156 /* Commands with fixed payload size */
157 #define CMD_CLOCK_TMS 0x20
158 #define CMD_SLOW_CLOCK_TMS 0x21
159 #define CMD_CLOCK_TCK 0x22
160 #define CMD_SLOW_CLOCK_TCK 0x23
161 #define CMD_SLEEP_US 0x24
162 #define CMD_SLEEP_MS 0x25
163 #define CMD_GET_SIGNALS 0x26
164 #define CMD_SET_SIGNALS 0x27
165 #define CMD_CONFIGURE_TCK_FREQ 0x28
166 #define CMD_SET_LEDS 0x29
167 #define CMD_TEST 0x2A
169 /* JTAG signal definition for jtag_get_signals() -- Input signals! */
170 #define SIGNAL_TDO (1<<0)
171 #define SIGNAL_BRKOUT (1<<1)
172 #define SIGNAL_TRAP (1<<2)
173 #define SIGNAL_RTCK (1<<3)
175 /* JTAG signal definition for jtag_get_signals() -- Output signals! */
176 #define SIGNAL_TDI (1<<0)
177 #define SIGNAL_TMS (1<<1)
178 #define SIGNAL_TCK (1<<2)
179 #define SIGNAL_TRST (1<<3)
180 #define SIGNAL_BRKIN (1<<4)
181 #define SIGNAL_RESET (1<<5)
182 #define SIGNAL_OCDSE (1<<6)
184 /* LED definitions for CMD_SET_LEDS and CMD_CLEAR_LEDS commands */
185 #define COM_LED_ON (1<<0)
186 #define RUN_LED_ON (1<<1)
187 #define COM_LED_OFF (1<<2)
188 #define RUN_LED_OFF (1<<3)
190 #endif