32 #define CMD_QUEUE_PAGE_SIZE (1024 * 1024)
51 LOG_ERROR(
"JTAG API jtag_queue_command() called on non JTAG interface");
92 union worse_case_align {
98 #define ALIGN_SIZE (sizeof(union worse_case_align))
107 p_page = &((*p_page)->next);
115 (*p_page)->address = malloc(alloc_size);
116 (*p_page)->next =
NULL;
121 (*p_page)->used +=
size;
123 t = (*p_page)->address;
167 for (i = 0; i <
cmd->num_fields; i++) {
168 if (
cmd->fields[i].in_value)
170 if (
cmd->fields[i].out_value)
183 for (i = 0; i <
cmd->num_fields; i++)
184 bit_count +=
cmd->fields[i].num_bits;
200 cmd->ir_scan ?
"IRSCAN" :
"DRSCAN",
203 for (i = 0; i <
cmd->num_fields; i++) {
204 if (
cmd->fields[i].out_value) {
209 :
cmd->fields[i].num_bits);
211 LOG_DEBUG(
"fields[%i].out_value[%i]: 0x%s", i,
212 cmd->fields[i].num_bits, char_buf);
216 bit_count,
cmd->fields[i].num_bits);
219 i,
cmd->fields[i].num_bits);
222 bit_count +=
cmd->fields[i].num_bits;
239 for (i = 0; i <
cmd->num_fields; i++) {
243 if (
cmd->fields[i].in_value) {
244 int num_bits =
cmd->fields[i].num_bits;
254 LOG_DEBUG(
"fields[%i].in_value[%i]: 0x%s",
255 i, num_bits, char_buf);
259 if (
cmd->fields[i].in_value)
260 buf_cpy(captured,
cmd->fields[i].in_value, num_bits);
264 bit_count +=
cmd->fields[i].num_bits;
char * buf_to_hex_str(const void *_buf, unsigned buf_len)
void * buf_cpy(const void *from, void *_to, unsigned size)
Copies size bits out of from and into to.
void * buf_set_buf(const void *_src, unsigned src_start, void *_dst, unsigned dst_start, unsigned len)
struct jtag_command * jtag_command_queue
The current queue of jtag_command_s structures.
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
void jtag_queue_command(struct jtag_command *cmd)
void jtag_scan_field_clone(struct scan_field *dst, const struct scan_field *src)
Copy a struct scan_field for insertion into the queue.
enum scan_type jtag_scan_type(const struct scan_command *cmd)
#define CMD_QUEUE_PAGE_SIZE
static struct cmd_queue_page * cmd_queue_pages
static struct jtag_command ** next_command_pointer
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
int jtag_scan_size(const struct scan_command *cmd)
static struct cmd_queue_page * cmd_queue_pages_tail
void jtag_command_queue_reset(void)
void * cmd_queue_alloc(size_t size)
static void cmd_queue_free(void)
scan_type
The inferred type of a scan_command_s structure, indicating whether the command has the host scan in ...
@ SCAN_IN
From device to host,.
@ SCAN_OUT
From host to device,.
bool transport_is_jtag(void)
Returns true if the current debug session is using JTAG as its transport.
The JTAG interface can be implemented with a software or hardware fifo.
#define LOG_DEBUG_IO(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_LEVEL_IS(FOO)
#define LOG_DEBUG(expr ...)
size_t size
Size of the control block search area.
struct cmd_queue_page * next
The scan_command provide a means of encapsulating a set of scan_field_s structures that should be sca...
This structure defines a single scan field in the scan.
int num_bits
The number of bits this field specifies.
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
const uint8_t * out_value
A pointer to value to be scanned into the device.
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.