diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/target/riscv/riscv-013.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 6a71298..8dfdde4 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -563,7 +563,7 @@ static int execute_abstract_command(struct target *target, uint32_t command) command, errors[get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)], abstractcs); // Clear the error. - dmi_write(target, DMI_ABSTRACTCS, 0); + dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR); return ERROR_FAIL; } @@ -1858,7 +1858,6 @@ static int read_memory(struct target *target, uint32_t address, abstract_register_size(xlen(target)) | reg_number_to_no(S1)) != ERROR_OK) { return ERROR_FAIL; } - dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR); uint32_t abstractcs; for (uint32_t i = 0; i < count; i++) { @@ -1891,11 +1890,11 @@ static int read_memory(struct target *target, uint32_t address, } } dmi_write(target, DMI_ABSTRACTAUTO, 0); - dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR); - abstractcs = dmi_read(target, DMI_ABSTRACTCS); + abstractcs = dmi_read(target, DMI_ABSTRACTCS); unsigned cmderr = get_field(abstractcs, DMI_ABSTRACTCS_CMDERR); if (cmderr == CMDERR_BUSY) { - dmi_write(target, DMI_ABSTRACTCS, 0); + // Clear the error and wait longer. + dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR); increase_ac_busy_delay(target); } else if (cmderr) { LOG_ERROR("cmderr=%d", get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)); @@ -1980,9 +1979,6 @@ static int write_memory(struct target *target, uint32_t address, AC_ACCESS_REGISTER_WRITE | AC_ACCESS_REGISTER_POSTEXEC | abstract_register_size(xlen(target)) | reg_number_to_no(S1), true); - scans_add_dmi_write(scans, DMI_ABSTRACTCS, - DMI_ABSTRACTCS_CMDERR, - false); scans_add_dmi_write(scans, DMI_ABSTRACTAUTO, 0x1 << DMI_ABSTRACTAUTO_AUTOEXECDATA_OFFSET, false); @@ -2001,7 +1997,7 @@ static int write_memory(struct target *target, uint32_t address, uint32_t abstractcs = dmi_read(target, DMI_ABSTRACTCS); unsigned cmderr = get_field(abstractcs, DMI_ABSTRACTCS_CMDERR); if (cmderr == CMDERR_BUSY) { - dmi_write(target, DMI_ABSTRACTCS, 0); + dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR); increase_ac_busy_delay(target); } else if (cmderr) { LOG_ERROR("cmderr=%d", get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)); |