1
2
3
13
14
15
16
17
22
30
31
35
36
37
38
39
40
41
42
43
44
45
46
50
51
57
58
64
65
66
70
71
72
78
79
83
84
88
89
90
91
92
93
94
95
96
97
98
99
100
101
107
108
112
113
114
115
116
117
118
119
120
121
122
123
124
128
129
130
137
138
139
140
141
142
143
144
145
146
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/* ... */
#ifndef OPENOCD_JTAG_COMMANDS_H
#define OPENOCD_JTAG_COMMANDS_H
/* ... */
enum scan_type {
SCAN_IN = 1,
SCAN_OUT = 2,
SCAN_IO = 3
...};
/* ... */
struct scan_command {
bool ir_scan;
unsigned int num_fields;
struct scan_field *fields;
tap_state_t end_state;
...};
struct statemove_command {
tap_state_t end_state;
...};
struct pathmove_command {
unsigned int num_states;
tap_state_t *path;
...};
struct runtest_command {
unsigned int num_cycles;
tap_state_t end_state;
...};
struct stableclocks_command {
unsigned int num_cycles;
...};
struct reset_command {
int trst;
int srst;
...};
struct end_state_command {
tap_state_t end_state;
...};
struct sleep_command {
uint32_t us;
...};
/* ... */
struct tms_command {
unsigned int num_bits;
const uint8_t *bits;
...};
/* ... */
union jtag_command_container {
struct scan_command *scan;
struct statemove_command *statemove;
struct pathmove_command *pathmove;
struct runtest_command *runtest;
struct stableclocks_command *stableclocks;
struct reset_command *reset;
struct end_state_command *end_state;
struct sleep_command *sleep;
struct tms_command *tms;
...};
/* ... */
enum jtag_command_type {
JTAG_SCAN = 1,
/* ... */
JTAG_TLR_RESET = 2,
JTAG_RUNTEST = 3,
JTAG_RESET = 4,
JTAG_PATHMOVE = 6,
JTAG_SLEEP = 7,
JTAG_STABLECLOCKS = 8,
JTAG_TMS = 9,
...};
struct jtag_command {
union jtag_command_container cmd;
enum jtag_command_type type;
struct jtag_command *next;
...};
void *cmd_queue_alloc(size_t size);
void jtag_queue_command(struct jtag_command *cmd);
void jtag_command_queue_reset(void);
struct jtag_command *jtag_command_queue_get(void);
void jtag_scan_field_clone(struct scan_field *dst, const struct scan_field *src);
enum scan_type jtag_scan_type(const struct scan_command *cmd);
unsigned int jtag_scan_size(const struct scan_command *cmd);
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd);
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer);
/* ... */
#endif