diff options
author | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2015-12-07 00:05:16 +0100 |
---|---|---|
committer | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2015-12-29 20:32:41 +0000 |
commit | 54e89cae84ad513d244d6203de7c20652caa3b38 (patch) | |
tree | 8a12de7f68b03ffa5f57961d7b7e5c565d776646 /src/flash/nor | |
parent | ff65aff3a6e1c58e948ec831eefcf8b277236fbd (diff) | |
download | riscv-openocd-54e89cae84ad513d244d6203de7c20652caa3b38.zip riscv-openocd-54e89cae84ad513d244d6203de7c20652caa3b38.tar.gz riscv-openocd-54e89cae84ad513d244d6203de7c20652caa3b38.tar.bz2 |
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>
Diffstat (limited to 'src/flash/nor')
-rw-r--r-- | src/flash/nor/kinetis.c | 8 | ||||
-rw-r--r-- | src/flash/nor/sim3x.c | 8 |
2 files changed, 4 insertions, 12 deletions
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c index c248b05..d618cfd 100644 --- a/src/flash/nor/kinetis.c +++ b/src/flash/nor/kinetis.c @@ -245,9 +245,7 @@ static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint3 int retval; LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value); - dap_ap_select(dap, 1); - - retval = dap_queue_ap_write(dap, reg, value); + retval = dap_queue_ap_write(dap_ap(dap, 1), reg, value); if (retval != ERROR_OK) { LOG_DEBUG("MDM: failed to queue a write request"); return retval; @@ -267,9 +265,7 @@ static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32 { int retval; - dap_ap_select(dap, 1); - - retval = dap_queue_ap_read(dap, reg, result); + retval = dap_queue_ap_read(dap_ap(dap, 1), reg, result); if (retval != ERROR_OK) { LOG_DEBUG("MDM: failed to queue a read request"); return retval; diff --git a/src/flash/nor/sim3x.c b/src/flash/nor/sim3x.c index e30ca45..df4e19c 100644 --- a/src/flash/nor/sim3x.c +++ b/src/flash/nor/sim3x.c @@ -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; |