arm_adi_v5: dap_queue_ap_* DAP->AP parameter

Move the mandatory dap_ap_select() call into the dap_queue_ap_read/write
wrapper.

This avoids the need for dap_ap_select() and the notion of a "current" AP
within target code.

Change-Id: I5cde8f3eef2c662f7458be6f3b3dd44ea693bd74
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/3164
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
This commit is contained in:
Andreas Fritiofson
2015-12-07 00:05:16 +01:00
parent ff65aff3a6
commit 54e89cae84
4 changed files with 38 additions and 57 deletions

View File

@@ -893,9 +893,7 @@ static int ap_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value
int retval;
LOG_DEBUG("DAP_REG[0x%02x] <- %08" PRIX32, reg, value);
dap_ap_select(dap, SIM3X_AP);
retval = dap_queue_ap_write(dap, reg, value);
retval = dap_queue_ap_write(dap_ap(dap, SIM3X_AP), reg, value);
if (retval != ERROR_OK) {
LOG_DEBUG("DAP: failed to queue a write request");
return retval;
@@ -914,9 +912,7 @@ static int ap_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *resul
{
int retval;
dap_ap_select(dap, SIM3X_AP);
retval = dap_queue_ap_read(dap, reg, result);
retval = dap_queue_ap_read(dap_ap(dap, SIM3X_AP), reg, result);
if (retval != ERROR_OK) {
LOG_DEBUG("DAP: failed to queue a read request");
return retval;