]> git.sur5r.net Git - openocd/commitdiff
ARMv7-M: use command handler for "dap baseaddr".
authorDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 29 Jan 2010 22:16:14 +0000 (14:16 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 29 Jan 2010 22:16:14 +0000 (14:16 -0800)
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>
src/target/armv7m.c

index c172a27dc9233da0ecf5718c2c2683d09610b4aa..edfcdf9c54c816ee4d5abc2a360a9697780056db 100644 (file)
@@ -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);
 }
 
 /*