Check for errors after read/write.

The code doesn't do anything intelligent if errors are found.
But MemTestBlock now also passes. I'm not quite sure why.

Change-Id: I8512f0a96db9e34d3db6a4a9bcef6e56f191d4c1
__archive__
Tim Newsome 2017-02-15 20:41:39 -08:00
parent 035b4dd17a
commit ef3875a320
1 changed files with 12 additions and 4 deletions

View File

@ -2353,8 +2353,12 @@ static int read_memory(struct target *target, uint32_t address,
return ERROR_FAIL;
}
}
dmi_write(target, DMI_ABSTRACTCS, 0);
// TODO: Check for errors.
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR);
uint32_t abstractcs = dmi_read(target, DMI_ABSTRACTCS);
if (get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)) {
// TODO: retry with more delay?
return ERROR_FAIL;
}
return ERROR_OK;
}
@ -2413,8 +2417,12 @@ static int write_memory(struct target *target, uint32_t address,
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_AUTOEXEC0);
}
}
dmi_write(target, DMI_ABSTRACTCS, 0);
// TODO: Check for errors.
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR);
uint32_t abstractcs = dmi_read(target, DMI_ABSTRACTCS);
if (get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)) {
// TODO: retry with more delay?
return ERROR_FAIL;
}
return ERROR_OK;
}