OpenOCD
batch.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 #ifdef HAVE_CONFIG_H
4 #include "config.h"
5 #endif
6 
7 #include "batch.h"
8 #include "debug_defines.h"
9 #include "debug_reg_printer.h"
10 #include "riscv.h"
11 #include "field_helpers.h"
12 
13 // TODO: DTM_DMI_MAX_ADDRESS_LENGTH should be reduced to 32 (per the debug spec)
14 #define DTM_DMI_MAX_ADDRESS_LENGTH ((1<<DTM_DTMCS_ABITS_LENGTH)-1)
15 #define DMI_SCAN_MAX_BIT_LENGTH (DTM_DMI_MAX_ADDRESS_LENGTH + DTM_DMI_DATA_LENGTH + DTM_DMI_OP_LENGTH)
16 
17 #define DMI_SCAN_BUF_SIZE (DIV_ROUND_UP(DMI_SCAN_MAX_BIT_LENGTH, 8))
18 
19 /* Reserve extra room in the batch (needed for the last NOP operation) */
20 #define BATCH_RESERVED_SCANS 1
21 
22 static unsigned int get_dmi_scan_length(const struct target *target)
23 {
24  const unsigned int abits = riscv_get_dmi_address_bits(target);
25  assert(abits > 0);
26  assert(abits <= DTM_DMI_MAX_ADDRESS_LENGTH);
27 
28  return abits + DTM_DMI_DATA_LENGTH + DTM_DMI_OP_LENGTH;
29 }
30 
31 struct riscv_batch *riscv_batch_alloc(struct target *target, size_t scans)
32 {
33  scans += BATCH_RESERVED_SCANS;
34  struct riscv_batch *out = calloc(1, sizeof(*out));
35  if (!out) {
36  LOG_ERROR("Failed to allocate struct riscv_batch");
37  return NULL;
38  }
39 
40  out->target = target;
41  out->allocated_scans = scans;
43  out->was_run = false;
44  out->last_scan_delay = 0;
45 
46  out->data_out = NULL;
47  out->data_in = NULL;
48  out->fields = NULL;
49  out->delay_classes = NULL;
50  out->bscan_ctxt = NULL;
51  out->read_keys = NULL;
52 
53  /* FIXME: There is potential for memory usage reduction. We could allocate
54  * smaller buffers than DMI_SCAN_BUF_SIZE (that is, buffers that correspond to
55  * the real DR scan length on the given target) */
56  out->data_out = malloc(sizeof(*out->data_out) * scans * DMI_SCAN_BUF_SIZE);
57  if (!out->data_out) {
58  LOG_ERROR("Failed to allocate data_out in RISC-V batch.");
59  goto alloc_error;
60  };
61  out->data_in = malloc(sizeof(*out->data_in) * scans * DMI_SCAN_BUF_SIZE);
62  if (!out->data_in) {
63  LOG_ERROR("Failed to allocate data_in in RISC-V batch.");
64  goto alloc_error;
65  }
66  out->fields = malloc(sizeof(*out->fields) * scans);
67  if (!out->fields) {
68  LOG_ERROR("Failed to allocate fields in RISC-V batch.");
69  goto alloc_error;
70  }
71  out->delay_classes = malloc(sizeof(*out->delay_classes) * scans);
72  if (!out->delay_classes) {
73  LOG_ERROR("Failed to allocate delay_classes in RISC-V batch.");
74  goto alloc_error;
75  }
76  if (bscan_tunnel_ir_width != 0) {
77  out->bscan_ctxt = malloc(sizeof(*out->bscan_ctxt) * scans);
78  if (!out->bscan_ctxt) {
79  LOG_ERROR("Failed to allocate bscan_ctxt in RISC-V batch.");
80  goto alloc_error;
81  }
82  }
83  out->read_keys = malloc(sizeof(*out->read_keys) * scans);
84  if (!out->read_keys) {
85  LOG_ERROR("Failed to allocate read_keys in RISC-V batch.");
86  goto alloc_error;
87  }
88 
89  return out;
90 
91 alloc_error:
92  riscv_batch_free(out);
93  return NULL;
94 }
95 
96 void riscv_batch_free(struct riscv_batch *batch)
97 {
98  free(batch->data_in);
99  free(batch->data_out);
100  free(batch->fields);
101  free(batch->delay_classes);
102  free(batch->bscan_ctxt);
103  free(batch->read_keys);
104  free(batch);
105 }
106 
107 bool riscv_batch_full(struct riscv_batch *batch)
108 {
109  return riscv_batch_available_scans(batch) == 0;
110 }
111 
112 static bool riscv_batch_was_scan_busy(const struct riscv_batch *batch,
113  size_t scan_idx)
114 {
115  assert(batch->was_run);
116  assert(scan_idx < batch->used_scans);
117  const struct scan_field *field = batch->fields + scan_idx;
118  assert(field->in_value);
119  const uint64_t in = buf_get_u64(field->in_value, 0, field->num_bits);
120  return get_field(in, DTM_DMI_OP) == DTM_DMI_OP_BUSY;
121 }
122 
123 static void add_idle_before_batch(const struct riscv_batch *batch, size_t start_idx,
124  const struct riscv_scan_delays *delays)
125 {
126  if (!batch->was_run)
127  return;
128  /* Get the delay type of the scan that resulted in the busy response.
129  * Since DMI interactions always end with a NOP, if "start_idx" is zero
130  * the base delay value is used.
131  */
132  const enum riscv_scan_delay_class delay_class = start_idx > 0
133  ? batch->delay_classes[start_idx - 1]
135  const unsigned int new_delay = riscv_scan_get_delay(delays, delay_class);
136  if (new_delay <= batch->last_scan_delay)
137  return;
138  const unsigned int idle_change = new_delay - batch->last_scan_delay;
139  LOG_TARGET_DEBUG(batch->target, "Adding %u idle cycles before the batch.",
140  idle_change);
141  jtag_add_runtest(idle_change, TAP_IDLE);
142 }
143 
144 static unsigned int get_delay(const struct riscv_batch *batch, size_t scan_idx,
145  const struct riscv_scan_delays *delays, bool resets_delays,
146  size_t reset_delays_after)
147 {
148  assert(batch);
149  assert(scan_idx < batch->used_scans);
150  const bool delays_were_reset = resets_delays
151  && (scan_idx >= reset_delays_after);
152  const enum riscv_scan_delay_class delay_class =
153  batch->delay_classes[scan_idx];
154  const unsigned int delay = riscv_scan_get_delay(delays, delay_class);
155  return delays_were_reset ? 0 : delay;
156 }
157 
158 static unsigned int decode_dmi(const struct riscv_batch *batch, char *text,
159  uint32_t address, uint32_t data)
160 {
161  static const struct {
162  uint32_t address;
163  enum riscv_debug_reg_ordinal ordinal;
164  } description[] = {
170  };
171 
172  for (unsigned int i = 0; i < ARRAY_SIZE(description); i++) {
173  if (riscv_get_dmi_address(batch->target, description[i].address)
174  == address) {
175  const struct riscv_debug_reg_ctx context = {
176  .XLEN = { .value = 0, .is_set = false },
177  .DXLEN = { .value = 0, .is_set = false },
178  .abits = { .value = 0, .is_set = false },
179  };
180  return riscv_debug_reg_to_s(text, description[i].ordinal,
181  context, data, RISCV_DEBUG_REG_HIDE_ALL_0);
182  }
183  }
184  if (text)
185  text[0] = '\0';
186  return 0;
187 }
188 
189 static void log_dmi_decoded(const struct riscv_batch *batch, bool write,
190  uint32_t address, uint32_t data)
191 {
192  const size_t size = decode_dmi(batch, /* text */ NULL, address, data) + 1;
193  char * const decoded = malloc(size);
194  if (!decoded) {
195  LOG_ERROR("Not enough memory to allocate %zu bytes.", size);
196  return;
197  }
198  decode_dmi(batch, decoded, address, data);
199  LOG_DEBUG("%s: %s", write ? "write" : "read", decoded);
200  free(decoded);
201 }
202 
203 static void log_batch(const struct riscv_batch *batch, size_t start_idx,
204  const struct riscv_scan_delays *delays, bool resets_delays,
205  size_t reset_delays_after)
206 {
208  return;
209 
210  const unsigned int abits = riscv_get_dmi_address_bits(batch->target);
211 
212  /* Determine the "op" and "address" of the scan that preceded the first
213  * executed scan.
214  * FIXME: The code here assumes that there were no DMI operations between
215  * the last execution of the batch and the current one.
216  * Caching the info about the last executed DMI scan in "dm013_info_t"
217  * would be a more robust solution.
218  */
219  bool last_scan_was_read = false;
220  uint32_t last_scan_address = (uint32_t)(-1) /* to silence maybe-uninitialized */;
221  if (start_idx > 0) {
222  const struct scan_field * const field = &batch->fields[start_idx - 1];
223  assert(field->out_value);
224  last_scan_was_read = buf_get_u32(field->out_value, DTM_DMI_OP_OFFSET,
226  last_scan_address = buf_get_u32(field->out_value,
227  DTM_DMI_ADDRESS_OFFSET, abits);
228  }
229 
230  /* Decode and log every executed scan */
231  for (size_t i = start_idx; i < batch->used_scans; ++i) {
232  static const char * const op_string[] = {"-", "r", "w", "?"};
233  const unsigned int delay = get_delay(batch, i, delays, resets_delays,
234  reset_delays_after);
235  const struct scan_field * const field = &batch->fields[i];
236 
237  assert(field->out_value);
238  const unsigned int out_op = buf_get_u32(field->out_value,
240  const uint32_t out_data = buf_get_u32(field->out_value,
242  const uint32_t out_address = buf_get_u32(field->out_value,
243  DTM_DMI_ADDRESS_OFFSET, abits);
244  if (field->in_value) {
245  static const char * const status_string[] = {
246  "+", "?", "F", "b"
247  };
248  const unsigned int in_op = buf_get_u32(field->in_value,
250  const uint32_t in_data = buf_get_u32(field->in_value,
252  const uint32_t in_address = buf_get_u32(field->in_value,
253  DTM_DMI_ADDRESS_OFFSET, abits);
254 
255  LOG_DEBUG("%db %s %08" PRIx32 " @%02" PRIx32
256  " -> %s %08" PRIx32 " @%02" PRIx32 "; %ui",
257  field->num_bits, op_string[out_op], out_data, out_address,
258  status_string[in_op], in_data, in_address, delay);
259 
260  if (last_scan_was_read && in_op == DTM_DMI_OP_SUCCESS)
261  log_dmi_decoded(batch, /*write*/ false,
262  last_scan_address, in_data);
263  } else {
264  LOG_DEBUG("%db %s %08" PRIx32 " @%02" PRIx32 " -> ?; %ui",
265  field->num_bits, op_string[out_op], out_data, out_address,
266  delay);
267  }
268 
269  if (out_op == DTM_DMI_OP_WRITE)
270  log_dmi_decoded(batch, /*write*/ true, out_address,
271  out_data);
272 
273  last_scan_was_read = out_op == DTM_DMI_OP_READ;
274  last_scan_address = out_address;
275  }
276 }
277 
278 int riscv_batch_run_from(struct riscv_batch *batch, size_t start_idx,
279  const struct riscv_scan_delays *delays, bool resets_delays,
280  size_t reset_delays_after)
281 {
282  assert(batch->used_scans);
283  assert(start_idx < batch->used_scans);
284  assert(batch->last_scan == RISCV_SCAN_TYPE_NOP);
285  assert(!batch->was_run || riscv_batch_was_scan_busy(batch, start_idx));
286  assert(start_idx == 0 || !riscv_batch_was_scan_busy(batch, start_idx - 1));
287 
288  if (batch->was_run)
289  add_idle_before_batch(batch, start_idx, delays);
290 
291  LOG_TARGET_DEBUG(batch->target, "Running batch of scans [%zu, %zu)",
292  start_idx, batch->used_scans);
293 
294  unsigned int delay = 0 /* to silence maybe-uninitialized */;
295  for (size_t i = start_idx; i < batch->used_scans; ++i) {
296  if (bscan_tunnel_ir_width != 0)
297  riscv_add_bscan_tunneled_scan(batch->target->tap, batch->fields + i,
298  batch->bscan_ctxt + i);
299  else
300  jtag_add_dr_scan(batch->target->tap, 1, batch->fields + i, TAP_IDLE);
301 
302  delay = get_delay(batch, i, delays, resets_delays,
303  reset_delays_after);
304  if (delay > 0)
305  jtag_add_runtest(delay, TAP_IDLE);
306  }
307 
308  keep_alive();
309 
310  if (jtag_execute_queue() != ERROR_OK) {
311  LOG_TARGET_ERROR(batch->target, "Unable to execute JTAG queue");
312  return ERROR_FAIL;
313  }
314 
315  keep_alive();
316 
317  if (bscan_tunnel_ir_width != 0) {
318  /* need to right-shift "in" by one bit, because of clock skew between BSCAN TAP and DM TAP */
319  for (size_t i = start_idx; i < batch->used_scans; ++i) {
320  if ((batch->fields + i)->in_value)
321  buffer_shr((batch->fields + i)->in_value, DMI_SCAN_BUF_SIZE, 1);
322  }
323  }
324 
325  log_batch(batch, start_idx, delays, resets_delays, reset_delays_after);
326  batch->was_run = true;
327  batch->last_scan_delay = delay;
328  return ERROR_OK;
329 }
330 
331 void riscv_batch_add_dmi_write(struct riscv_batch *batch, uint32_t address, uint32_t data,
332  bool read_back, enum riscv_scan_delay_class delay_class)
333 {
334  // TODO: Check that the bit width of "address" is no more than dtmcs.abits,
335  // otherwise return an error (during batch creation or when the batch is executed).
336 
337  assert(batch->used_scans < batch->allocated_scans);
338  struct scan_field *field = batch->fields + batch->used_scans;
339 
340  field->num_bits = get_dmi_scan_length(batch->target);
341  assert(field->num_bits <= DMI_SCAN_MAX_BIT_LENGTH);
342 
343  uint8_t *out_value = batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE;
344  uint8_t *in_value = batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE;
345 
346  field->out_value = out_value;
348 
349  if (read_back) {
350  field->in_value = in_value;
352  } else {
353  field->in_value = NULL;
354  }
355 
356  batch->delay_classes[batch->used_scans] = delay_class;
358  batch->used_scans++;
359 }
360 
361 size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, uint32_t address,
362  enum riscv_scan_delay_class delay_class)
363 {
364  // TODO: Check that the bit width of "address" is no more than dtmcs.abits,
365  // otherwise return an error (during batch creation or when the batch is executed).
366 
367  assert(batch->used_scans < batch->allocated_scans);
368  struct scan_field *field = batch->fields + batch->used_scans;
369 
370  field->num_bits = get_dmi_scan_length(batch->target);
371  assert(field->num_bits <= DMI_SCAN_MAX_BIT_LENGTH);
372 
373  uint8_t *out_value = batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE;
374  uint8_t *in_value = batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE;
375 
376  field->out_value = out_value;
377  field->in_value = in_value;
380 
381  batch->delay_classes[batch->used_scans] = delay_class;
383  batch->used_scans++;
384 
385  batch->read_keys[batch->read_keys_used] = batch->used_scans;
386  return batch->read_keys_used++;
387 }
388 
389 uint32_t riscv_batch_get_dmi_read_op(const struct riscv_batch *batch, size_t key)
390 {
391  assert(key < batch->read_keys_used);
392  size_t index = batch->read_keys[key];
393  assert(index < batch->used_scans);
394  uint8_t *base = batch->data_in + DMI_SCAN_BUF_SIZE * index;
395  /* extract "op" field from the DMI read result */
397 }
398 
399 uint32_t riscv_batch_get_dmi_read_data(const struct riscv_batch *batch, size_t key)
400 {
401  assert(key < batch->read_keys_used);
402  size_t index = batch->read_keys[key];
403  assert(index < batch->used_scans);
404  uint8_t *base = batch->data_in + DMI_SCAN_BUF_SIZE * index;
405  /* extract "data" field from the DMI read result */
407 }
408 
409 void riscv_batch_add_nop(struct riscv_batch *batch)
410 {
411  assert(batch->used_scans < batch->allocated_scans);
412  struct scan_field *field = batch->fields + batch->used_scans;
413 
414  field->num_bits = get_dmi_scan_length(batch->target);
415  assert(field->num_bits <= DMI_SCAN_MAX_BIT_LENGTH);
416 
417  uint8_t *out_value = batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE;
418  uint8_t *in_value = batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE;
419 
420  field->out_value = out_value;
421  field->in_value = in_value;
424 
425  /* DMI NOP never triggers any debug module operation,
426  * so the shortest (base) delay can be used. */
427  batch->delay_classes[batch->used_scans] = RISCV_DELAY_BASE;
429  batch->used_scans++;
430 }
431 
433 {
434  assert(batch->allocated_scans >= (batch->used_scans + BATCH_RESERVED_SCANS));
435  return batch->allocated_scans - batch->used_scans - BATCH_RESERVED_SCANS;
436 }
437 
438 bool riscv_batch_was_batch_busy(const struct riscv_batch *batch)
439 {
440  assert(batch->was_run);
441  assert(batch->used_scans);
442  assert(batch->last_scan == RISCV_SCAN_TYPE_NOP);
443  return riscv_batch_was_scan_busy(batch, batch->used_scans - 1);
444 }
445 
446 size_t riscv_batch_finished_scans(const struct riscv_batch *batch)
447 {
448  if (!riscv_batch_was_batch_busy(batch)) {
449  /* Whole batch succeeded. */
450  return batch->used_scans;
451  }
452  assert(batch->used_scans);
453  size_t first_busy = 0;
454  while (!riscv_batch_was_scan_busy(batch, first_busy))
455  ++first_busy;
456  return first_busy;
457 }
const char * description
Definition: arm_adi_v5.c:1018
bool riscv_batch_was_batch_busy(const struct riscv_batch *batch)
Definition: batch.c:438
uint32_t riscv_batch_get_dmi_read_op(const struct riscv_batch *batch, size_t key)
Definition: batch.c:389
struct riscv_batch * riscv_batch_alloc(struct target *target, size_t scans)
Definition: batch.c:31
void riscv_batch_add_nop(struct riscv_batch *batch)
Definition: batch.c:409
static unsigned int get_delay(const struct riscv_batch *batch, size_t scan_idx, const struct riscv_scan_delays *delays, bool resets_delays, size_t reset_delays_after)
Definition: batch.c:144
static void log_batch(const struct riscv_batch *batch, size_t start_idx, const struct riscv_scan_delays *delays, bool resets_delays, size_t reset_delays_after)
Definition: batch.c:203
static unsigned int decode_dmi(const struct riscv_batch *batch, char *text, uint32_t address, uint32_t data)
Definition: batch.c:158
#define DMI_SCAN_BUF_SIZE
Definition: batch.c:17
#define BATCH_RESERVED_SCANS
Definition: batch.c:20
void riscv_batch_add_dmi_write(struct riscv_batch *batch, uint32_t address, uint32_t data, bool read_back, enum riscv_scan_delay_class delay_class)
Definition: batch.c:331
size_t riscv_batch_available_scans(struct riscv_batch *batch)
Definition: batch.c:432
uint32_t riscv_batch_get_dmi_read_data(const struct riscv_batch *batch, size_t key)
Definition: batch.c:399
static void log_dmi_decoded(const struct riscv_batch *batch, bool write, uint32_t address, uint32_t data)
Definition: batch.c:189
size_t riscv_batch_finished_scans(const struct riscv_batch *batch)
Definition: batch.c:446
static unsigned int get_dmi_scan_length(const struct target *target)
Definition: batch.c:22
#define DMI_SCAN_MAX_BIT_LENGTH
Definition: batch.c:15
static bool riscv_batch_was_scan_busy(const struct riscv_batch *batch, size_t scan_idx)
Definition: batch.c:112
void riscv_batch_free(struct riscv_batch *batch)
Definition: batch.c:96
size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, uint32_t address, enum riscv_scan_delay_class delay_class)
Definition: batch.c:361
int riscv_batch_run_from(struct riscv_batch *batch, size_t start_idx, const struct riscv_scan_delays *delays, bool resets_delays, size_t reset_delays_after)
Definition: batch.c:278
bool riscv_batch_full(struct riscv_batch *batch)
Definition: batch.c:107
#define DTM_DMI_MAX_ADDRESS_LENGTH
Definition: batch.c:14
static void add_idle_before_batch(const struct riscv_batch *batch, size_t start_idx, const struct riscv_scan_delays *delays)
Definition: batch.c:123
riscv_scan_delay_class
Definition: batch.h:20
@ RISCV_DELAY_BASE
Definition: batch.h:22
static unsigned int riscv_scan_get_delay(const struct riscv_scan_delays *delays, enum riscv_scan_delay_class delay_class)
Definition: batch.h:65
@ RISCV_SCAN_TYPE_INVALID
Definition: batch.h:11
@ RISCV_SCAN_TYPE_WRITE
Definition: batch.h:14
@ RISCV_SCAN_TYPE_NOP
Definition: batch.h:12
@ RISCV_SCAN_TYPE_READ
Definition: batch.h:13
void buffer_shr(void *_buf, unsigned int buf_len, unsigned int count)
Definition: binarybuffer.c:398
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
Definition: binarybuffer.h:104
static uint64_t buf_get_u64(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 64-bit word.
Definition: binarybuffer.h:134
#define DM_ABSTRACTCS
#define DM_DMCONTROL
#define DM_SBCS
#define DTM_DMI_OP
#define DTM_DMI_DATA_OFFSET
#define DTM_DMI_OP_WRITE
#define DTM_DMI_OP_OFFSET
riscv_debug_reg_ordinal
@ DM_DMSTATUS_ORDINAL
@ DM_COMMAND_ORDINAL
@ DM_ABSTRACTCS_ORDINAL
@ DM_SBCS_ORDINAL
@ DM_DMCONTROL_ORDINAL
#define DTM_DMI_ADDRESS_OFFSET
#define DM_DMSTATUS
#define DM_COMMAND
#define DTM_DMI_OP_BUSY
#define DTM_DMI_OP_READ
#define DTM_DMI_DATA_LENGTH
#define DTM_DMI_OP_LENGTH
#define DTM_DMI_OP_SUCCESS
unsigned int riscv_debug_reg_to_s(char *buf, enum riscv_debug_reg_ordinal reg_ordinal, struct riscv_debug_reg_ctx context, uint64_t value, enum riscv_debug_reg_show show)
This function is used to fill a buffer with a decoded string representation of register's value.
@ RISCV_DEBUG_REG_HIDE_ALL_0
uint32_t size
Size of dw_spi_transaction::buffer.
Definition: dw-spi-helper.h:4
uint32_t address
Starting address. Sector aligned.
Definition: dw-spi-helper.h:0
static uint64_t get_field(uint64_t reg, uint64_t mask)
Definition: field_helpers.h:9
void jtag_add_runtest(unsigned int num_cycles, enum tap_state state)
Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state,...
Definition: jtag/core.c:598
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
Definition: jtag/core.c:1050
void jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, enum tap_state state)
Generate a DR SCAN using the fields passed to the function.
Definition: jtag/core.c:457
@ TAP_IDLE
Definition: jtag.h:53
void keep_alive(void)
Definition: log.c:429
#define ERROR_FAIL
Definition: log.h:175
#define LOG_TARGET_ERROR(target, fmt_str,...)
Definition: log.h:163
#define LOG_TARGET_DEBUG(target, fmt_str,...)
Definition: log.h:151
#define LOG_ERROR(expr ...)
Definition: log.h:134
#define LOG_LEVEL_IS(FOO)
Definition: log.h:101
#define LOG_DEBUG(expr ...)
Definition: log.h:111
#define ERROR_OK
Definition: log.h:169
@ LOG_LVL_DEBUG
Definition: log.h:48
void riscv_add_bscan_tunneled_scan(struct jtag_tap *tap, const struct scan_field *field, riscv_bscan_tunneled_scan_context_t *ctxt)
Definition: riscv.c:6292
unsigned int riscv_get_dmi_address_bits(const struct target *target)
Definition: riscv.c:6131
uint8_t bscan_tunnel_ir_width
Definition: riscv.c:60
void riscv_fill_dmi_write(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d)
Definition: riscv.c:6113
uint32_t riscv_get_dmi_address(const struct target *target, uint32_t dm_address)
Definition: riscv.c:4649
void riscv_fill_dm_nop(const struct target *target, uint8_t *buf)
Definition: riscv.c:6125
void riscv_fill_dmi_read(const struct target *target, uint8_t *buf, uint32_t a)
Definition: riscv.c:6119
struct target * target
Definition: rtt/rtt.c:26
uint8_t * data_in
Definition: batch.h:134
riscv_bscan_tunneled_scan_context_t * bscan_ctxt
Definition: batch.h:141
size_t allocated_scans
Definition: batch.h:130
struct target * target
Definition: batch.h:128
enum riscv_scan_type last_scan
Definition: batch.h:147
enum riscv_scan_delay_class * delay_classes
Definition: batch.h:136
bool was_run
Definition: batch.h:157
size_t * read_keys
Definition: batch.h:150
uint8_t * data_out
Definition: batch.h:133
size_t read_keys_used
Definition: batch.h:151
unsigned int last_scan_delay
Definition: batch.h:161
size_t used_scans
Definition: batch.h:131
struct scan_field * fields
Definition: batch.h:135
struct riscv_debug_reg_ctx::@123 XLEN
struct riscv_debug_reg_ctx::@124 abits
This structure defines a single scan field in the scan.
Definition: jtag.h:87
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
Definition: jtag.h:93
const uint8_t * out_value
A pointer to value to be scanned into the device.
Definition: jtag.h:91
unsigned int num_bits
The number of bits this field specifies.
Definition: jtag.h:89
Definition: target.h:119
struct jtag_tap * tap
Definition: target.h:122
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
Definition: types.h:57
#define NULL
Definition: usb.h:16