Skip to content

Commit 2f29b80

Browse files
authored
Merge pull request riscv-collab#1096 from en-sc/en-sc/run-batch-busy
target/riscv: reset `dmi.busy` after batches
2 parents 59ce92a + c05a10d commit 2f29b80

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/target/riscv/riscv-013.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,12 +2742,16 @@ static int batch_run(struct target *target, struct riscv_batch *batch)
27422742
const int result = riscv_batch_run_from(batch, 0, &info->learned_delays,
27432743
/*resets_delays*/ r->reset_delays_wait >= 0,
27442744
r->reset_delays_wait);
2745+
if (result != ERROR_OK)
2746+
return result;
27452747
/* TODO: To use `riscv_batch_finished_scans()` here, it is needed for
27462748
* all scans to not discard input, meaning
27472749
* "riscv_batch_add_dm_write(..., false)" should not be used. */
27482750
const size_t finished_scans = batch->used_scans;
27492751
decrement_reset_delays_counter(target, finished_scans);
2750-
return result;
2752+
if (riscv_batch_was_batch_busy(batch))
2753+
return increase_dmi_busy_delay(target);
2754+
return ERROR_OK;
27512755
}
27522756

27532757
/* It is expected that during creation of the batch
@@ -2770,12 +2774,12 @@ static int batch_run_timeout(struct target *target, struct riscv_batch *batch)
27702774
&info->learned_delays,
27712775
/*resets_delays*/ r->reset_delays_wait >= 0,
27722776
r->reset_delays_wait);
2777+
if (result != ERROR_OK)
2778+
return result;
27732779
const size_t new_finished_scans = riscv_batch_finished_scans(batch);
27742780
assert(new_finished_scans >= finished_scans);
27752781
decrement_reset_delays_counter(target, new_finished_scans - finished_scans);
27762782
finished_scans = new_finished_scans;
2777-
if (result != ERROR_OK)
2778-
return result;
27792783
if (!riscv_batch_was_batch_busy(batch)) {
27802784
assert(finished_scans == batch->used_scans);
27812785
return ERROR_OK;

0 commit comments

Comments
 (0)