statemove_command_t -> struct statemove_command
[openocd.git] / src / jtag / commands.h
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * Copyright (C) 2007,2008 Øyvind Harboe *
6 * oyvind.harboe@zylin.com *
7 * *
8 * Copyright (C) 2009 Zachary T Welch *
9 * zw@superlucidity.net *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU General Public License *
22 * along with this program; if not, write to the *
23 * Free Software Foundation, Inc., *
24 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 ***************************************************************************/
26 #ifndef JTAG_COMMANDS_H
27 #define JTAG_COMMANDS_H
28
29 #include "jtag.h"
30
31 /**
32 * The inferred type of a scan_command_s structure, indicating whether
33 * the command has the host scan in from the device, the host scan out
34 * to the device, or both.
35 */
36 enum scan_type {
37 /// From device to host,
38 SCAN_IN = 1,
39 /// From host to device,
40 SCAN_OUT = 2,
41 /// Full-duplex scan.
42 SCAN_IO = 3
43 };
44
45 /**
46 * The scan_command provide a means of encapsulating a set of scan_field_s
47 * structures that should be scanned in/out to the device.
48 */
49 struct scan_command {
50 /// instruction/not data scan
51 bool ir_scan;
52 /// number of fields in *fields array
53 int num_fields;
54 /// pointer to an array of data scan fields
55 struct scan_field* fields;
56 /// state in which JTAG commands should finish
57 tap_state_t end_state;
58 };
59
60 struct statemove_command {
61 /// state in which JTAG commands should finish
62 tap_state_t end_state;
63 };
64
65 typedef struct pathmove_command_s
66 {
67 /// number of states in *path
68 int num_states;
69 /// states that have to be passed
70 tap_state_t* path;
71 } pathmove_command_t;
72
73 typedef struct runtest_command_s
74 {
75 /// number of cycles to spend in Run-Test/Idle state
76 int num_cycles;
77 /// state in which JTAG commands should finish
78 tap_state_t end_state;
79 } runtest_command_t;
80
81
82 typedef struct stableclocks_command_s
83 {
84 /// number of clock cycles that should be sent
85 int num_cycles;
86 } stableclocks_command_t;
87
88
89 typedef struct reset_command_s
90 {
91 /// Set TRST output: 0 = deassert, 1 = assert, -1 = no change
92 int trst;
93 /// Set SRST output: 0 = deassert, 1 = assert, -1 = no change
94 int srst;
95 } reset_command_t;
96
97 typedef struct end_state_command_s
98 {
99 /// state in which JTAG commands should finish
100 tap_state_t end_state;
101 } end_state_command_t;
102
103 typedef struct sleep_command_s
104 {
105 /// number of microseconds to sleep
106 uint32_t us;
107 } sleep_command_t;
108
109 /**
110 * Defines a container type that hold a pointer to a JTAG command
111 * structure of any defined type.
112 */
113 typedef union jtag_command_container_u
114 {
115 struct scan_command* scan;
116 struct statemove_command* statemove;
117 pathmove_command_t* pathmove;
118 runtest_command_t* runtest;
119 stableclocks_command_t* stableclocks;
120 reset_command_t* reset;
121 end_state_command_t* end_state;
122 sleep_command_t* sleep;
123 } jtag_command_container_t;
124
125 /**
126 * The type of the @c jtag_command_container_u contained by a
127 * @c jtag_command_s structure.
128 */
129 enum jtag_command_type {
130 JTAG_SCAN = 1,
131 JTAG_STATEMOVE = 2,
132 JTAG_RUNTEST = 3,
133 JTAG_RESET = 4,
134 JTAG_PATHMOVE = 6,
135 JTAG_SLEEP = 7,
136 JTAG_STABLECLOCKS = 8
137 };
138
139 typedef struct jtag_command_s
140 {
141 jtag_command_container_t cmd;
142 enum jtag_command_type type;
143 struct jtag_command_s* next;
144 } jtag_command_t;
145
146 /// The current queue of jtag_command_s structures.
147 extern jtag_command_t* jtag_command_queue;
148
149 void* cmd_queue_alloc(size_t size);
150 void cmd_queue_free(void);
151
152 void jtag_queue_command(jtag_command_t *cmd);
153 void jtag_command_queue_reset(void);
154
155 enum scan_type jtag_scan_type(const struct scan_command* cmd);
156 int jtag_scan_size(const struct scan_command* cmd);
157 int jtag_read_buffer(uint8_t* buffer, const struct scan_command* cmd);
158 int jtag_build_buffer(const struct scan_command* cmd, uint8_t** buffer);
159
160 #endif // JTAG_COMMANDS_H

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)