OpenOCD
commands.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * Copyright (C) 2005 by Dominic Rath *
5  * Dominic.Rath@gmx.de *
6  * *
7  * Copyright (C) 2007,2008 Øyvind Harboe *
8  * oyvind.harboe@zylin.com *
9  * *
10  * Copyright (C) 2009 Zachary T Welch *
11  * zw@superlucidity.net *
12  ***************************************************************************/
13 
14 #ifndef OPENOCD_JTAG_COMMANDS_H
15 #define OPENOCD_JTAG_COMMANDS_H
16 
22 enum scan_type {
24  SCAN_IN = 1,
26  SCAN_OUT = 2,
28  SCAN_IO = 3
29 };
30 
35 struct scan_command {
37  bool ir_scan;
39  unsigned int num_fields;
41  struct scan_field *fields;
44 };
45 
49 };
50 
53  unsigned int num_states;
56 };
57 
60  unsigned int num_cycles;
63 };
64 
65 
68  unsigned int num_cycles;
69 };
70 
71 
72 struct reset_command {
74  int trst;
76  int srst;
77 };
78 
82 };
83 
84 struct sleep_command {
86  uint32_t us;
87 };
88 
101 struct tms_command {
103  unsigned int num_bits;
105  const uint8_t *bits;
106 };
107 
121  struct tms_command *tms;
122 };
123 
130  /* JTAG_TLR_RESET's non-minidriver implementation is a
131  * vestige from a statemove cmd. The statemove command
132  * is obsolete and replaced by pathmove.
133  *
134  * pathmove does not support reset as one of it's states,
135  * hence the need for an explicit statemove command.
136  */
143  JTAG_TMS = 9,
144 };
145 
146 struct jtag_command {
148  enum jtag_command_type type;
150 };
151 
152 void *cmd_queue_alloc(size_t size);
153 
154 void jtag_queue_command(struct jtag_command *cmd);
155 void jtag_command_queue_reset(void);
157 
158 void jtag_scan_field_clone(struct scan_field *dst, const struct scan_field *src);
159 enum scan_type jtag_scan_type(const struct scan_command *cmd);
160 unsigned int jtag_scan_size(const struct scan_command *cmd);
161 int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd);
162 int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer);
163 
164 #endif /* OPENOCD_JTAG_COMMANDS_H */
struct jtag_command * jtag_command_queue_get(void)
Definition: commands.c:150
unsigned int jtag_scan_size(const struct scan_command *cmd)
Definition: commands.c:181
scan_type
The inferred type of a scan_command structure, indicating whether the command has the host scan in fr...
Definition: commands.h:22
@ SCAN_IN
From device to host,.
Definition: commands.h:24
@ SCAN_OUT
From host to device,.
Definition: commands.h:26
@ SCAN_IO
Full-duplex scan.
Definition: commands.h:28
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
Definition: commands.c:192
void jtag_queue_command(struct jtag_command *cmd)
Definition: commands.c:39
void jtag_scan_field_clone(struct scan_field *dst, const struct scan_field *src)
Copy a struct scan_field for insertion into the queue.
Definition: commands.c:160
enum scan_type jtag_scan_type(const struct scan_command *cmd)
Definition: commands.c:167
jtag_command_type
The type of the jtag_command_container contained by a jtag_command structure.
Definition: commands.h:128
@ JTAG_TLR_RESET
Definition: commands.h:137
@ JTAG_SCAN
Definition: commands.h:129
@ JTAG_PATHMOVE
Definition: commands.h:140
@ JTAG_STABLECLOCKS
Definition: commands.h:142
@ JTAG_RUNTEST
Definition: commands.h:138
@ JTAG_SLEEP
Definition: commands.h:141
@ JTAG_RESET
Definition: commands.h:139
@ JTAG_TMS
Definition: commands.h:143
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
Definition: commands.c:230
void jtag_command_queue_reset(void)
Definition: commands.c:142
void * cmd_queue_alloc(size_t size)
Definition: commands.c:66
enum tap_state tap_state_t
Defines JTAG Test Access Port states.
size_t size
Size of the control block search area.
Definition: rtt/rtt.c:30
tap_state_t end_state
state in which JTAG commands should finish
Definition: commands.h:81
enum jtag_command_type type
Definition: commands.h:148
struct jtag_command * next
Definition: commands.h:149
union jtag_command_container cmd
Definition: commands.h:147
tap_state_t * path
states that have to be passed
Definition: commands.h:55
unsigned int num_states
number of states in *path
Definition: commands.h:53
int trst
Set TRST output: 0 = deassert, 1 = assert, -1 = no change.
Definition: commands.h:74
int srst
Set SRST output: 0 = deassert, 1 = assert, -1 = no change.
Definition: commands.h:76
unsigned int num_cycles
number of cycles to spend in Run-Test/Idle state
Definition: commands.h:60
tap_state_t end_state
state in which JTAG commands should finish
Definition: commands.h:62
The scan_command provide a means of encapsulating a set of scan_field structures that should be scann...
Definition: commands.h:35
bool ir_scan
instruction/not data scan
Definition: commands.h:37
tap_state_t end_state
state in which JTAG commands should finish
Definition: commands.h:43
unsigned int num_fields
number of fields in *fields array
Definition: commands.h:39
struct scan_field * fields
pointer to an array of data scan fields
Definition: commands.h:41
This structure defines a single scan field in the scan.
Definition: jtag.h:87
uint32_t us
number of microseconds to sleep
Definition: commands.h:86
unsigned int num_cycles
number of clock cycles that should be sent
Definition: commands.h:68
tap_state_t end_state
state in which JTAG commands should finish
Definition: commands.h:48
Encapsulates a series of bits to be clocked out, affecting state and mode of the interface.
Definition: commands.h:101
const uint8_t * bits
The bits to clock out; the LSB is bit 0 of bits[0].
Definition: commands.h:105
unsigned int num_bits
How many bits should be clocked out.
Definition: commands.h:103
Defines a container type that hold a pointer to a JTAG command structure of any defined type.
Definition: commands.h:112
struct tms_command * tms
Definition: commands.h:121
struct end_state_command * end_state
Definition: commands.h:119
struct runtest_command * runtest
Definition: commands.h:116
struct pathmove_command * pathmove
Definition: commands.h:115
struct stableclocks_command * stableclocks
Definition: commands.h:117
struct statemove_command * statemove
Definition: commands.h:114
struct sleep_command * sleep
Definition: commands.h:120
struct reset_command * reset
Definition: commands.h:118
struct scan_command * scan
Definition: commands.h:113
uint8_t cmd
Definition: vdebug.c:1