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>
This commit is contained in:
parent
303b493c22
commit
2248c387f2
|
@ -751,37 +751,8 @@ COMMAND_HANDLER(handle_dap_baseaddr_command)
|
||||||
struct target *target = get_current_target(CMD_CTX);
|
struct target *target = get_current_target(CMD_CTX);
|
||||||
struct armv7m_common *armv7m = target_to_armv7m(target);
|
struct armv7m_common *armv7m = target_to_armv7m(target);
|
||||||
struct swjdp_common *swjdp = &armv7m->swjdp_info;
|
struct swjdp_common *swjdp = &armv7m->swjdp_info;
|
||||||
uint32_t apsel, apselsave, baseaddr;
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
apselsave = swjdp->apsel;
|
return CALL_COMMAND_HANDLER(dap_baseaddr_command, swjdp);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue