diff options
-rw-r--r-- | src/target/riscv/riscv-013.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index b43322e..f24afe1 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1378,6 +1378,8 @@ static int read_memory(struct target *target, uint32_t address, // catches the case where no writes went through at all. uint32_t abstractcs = dmi_read(target, DMI_ABSTRACTCS); + while (get_field(abstractcs, DMI_ABSTRACTCS_BUSY)) + abstractcs = dmi_read(target, DMI_ABSTRACTCS); switch (get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)) { case CMDERR_NONE: LOG_DEBUG("successful (partial?) memory write"); @@ -1560,6 +1562,8 @@ static int write_memory(struct target *target, uint32_t address, // catches the case where no writes went through at all. uint32_t abstractcs = dmi_read(target, DMI_ABSTRACTCS); + while (get_field(abstractcs, DMI_ABSTRACTCS_BUSY)) + abstractcs = dmi_read(target, DMI_ABSTRACTCS); switch (get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)) { case CMDERR_NONE: LOG_DEBUG("successful (partial?) memory write"); |