diff --git a/src/target/riscv/batch.c b/src/target/riscv/batch.c index 4115a373f..d82a88b95 100644 --- a/src/target/riscv/batch.c +++ b/src/target/riscv/batch.c @@ -157,6 +157,8 @@ int riscv_batch_run_from(struct riscv_batch *batch, size_t start_idx, LOG_TARGET_DEBUG(batch->target, "Running batch of scans [%zu, %zu)", start_idx, batch->used_scans); + select_dmi(batch->target); + for (size_t i = start_idx; i < batch->used_scans; ++i) { if (bscan_tunnel_ir_width != 0) riscv_add_bscan_tunneled_scan(batch->target, batch->fields + i, batch->bscan_ctxt + i); diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 83f03f1a2..81101a1f3 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -435,7 +435,7 @@ void riscv_log_dmi_scan(const struct target *target, int idle, const struct scan /*** Utility functions. ***/ -static void select_dmi(struct target *target) +void select_dmi(struct target *target) { if (bscan_tunnel_ir_width != 0) { select_dmi_via_bscan(target); diff --git a/src/target/riscv/riscv.h b/src/target/riscv/riscv.h index d3703d1ae..8c41368bc 100644 --- a/src/target/riscv/riscv.h +++ b/src/target/riscv/riscv.h @@ -378,6 +378,7 @@ extern int bscan_tunnel_ir_width; int dtmcontrol_scan_via_bscan(struct target *target, uint32_t out, uint32_t *in_ptr); void select_dmi_via_bscan(struct target *target); +void select_dmi(struct target *target); /*** OpenOCD Interface */ int riscv_openocd_poll(struct target *target);