summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2010-01-29 14:16:14 -0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2010-01-29 14:16:14 -0800
commit2248c387f2c413c89d0f175b464a6e60ea20e75b (patch)
treefa290818654c6d7fa691d6be8be82b974405cc99
parent303b493c229475df26d69d102bbaf5ae5e5e7a3f (diff)
downloadopenocd+libswd-2248c387f2c413c89d0f175b464a6e60ea20e75b.tar.gz
openocd+libswd-2248c387f2c413c89d0f175b464a6e60ea20e75b.tar.bz2
openocd+libswd-2248c387f2c413c89d0f175b464a6e60ea20e75b.tar.xz
openocd+libswd-2248c387f2c413c89d0f175b464a6e60ea20e75b.zip
ARMv7-M: use command handler for "dap baseaddr".
Make the ARMv7-M DAP code reuse the command handler for "dap baseaddr". For some reason, this DAP command wasn't converted earlier. This is a code shrink and simplification; it also removes a needless transport dependency on JTAG. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
-rw-r--r--src/target/armv7m.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/src/target/armv7m.c b/src/target/armv7m.c
index c172a27d..edfcdf9c 100644
--- a/src/target/armv7m.c
+++ b/src/target/armv7m.c
@@ -751,37 +751,8 @@ COMMAND_HANDLER(handle_dap_baseaddr_command)
struct target *target = get_current_target(CMD_CTX);
struct armv7m_common *armv7m = target_to_armv7m(target);
struct swjdp_common *swjdp = &armv7m->swjdp_info;
- uint32_t apsel, apselsave, baseaddr;
- int retval;
- apselsave = swjdp->apsel;
- switch (CMD_ARGC) {
- case 0:
- apsel = swjdp->apsel;
- break;
- case 1:
- COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
- break;
- default:
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
-
- if (apselsave != apsel)
- dap_ap_select(swjdp, apsel);
-
- /* NOTE: assumes we're talking to a MEM-AP, which
- * has a base address. There are other kinds of AP,
- * though they're not common for now. This should
- * use the ID register to verify it's a MEM-AP.
- */
- dap_ap_read_reg_u32(swjdp, AP_REG_BASE, &baseaddr);
- retval = swjdp_transaction_endcheck(swjdp);
- command_print(CMD_CTX, "0x%8.8" PRIx32 "", baseaddr);
-
- if (apselsave != apsel)
- dap_ap_select(swjdp, apselsave);
-
- return retval;
+ return CALL_COMMAND_HANDLER(dap_baseaddr_command, swjdp);
}
/*