diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-10 05:32:04 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-13 10:51:46 -0800 |
commit | d02fee197f62331e36e9de110040f0170341c3e8 (patch) | |
tree | e9145b9281376db79b0b81cd3c0ad14078e49ff4 /src/target | |
parent | 63a26b421b1731df5826a157ea633b9d2c02aaee (diff) | |
download | openocd_libswd-d02fee197f62331e36e9de110040f0170341c3e8.tar.gz openocd_libswd-d02fee197f62331e36e9de110040f0170341c3e8.tar.bz2 openocd_libswd-d02fee197f62331e36e9de110040f0170341c3e8.tar.xz openocd_libswd-d02fee197f62331e36e9de110040f0170341c3e8.zip |
arm_adi,armv7[am]: use COMMAND_HELPER for helpers
Rewrites the dap_* command helpers to use the COMMAND_HELPER paradigm.
Uses CALL_COMMAND_HELPER to hide inherited calling conventions.
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/arm_adi_v5.c | 12 | ||||
-rw-r--r-- | src/target/arm_adi_v5.h | 15 | ||||
-rw-r--r-- | src/target/armv7a.c | 8 | ||||
-rw-r--r-- | src/target/armv7m.c | 6 |
4 files changed, 18 insertions, 23 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 0fc29768..4a7a37c0 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1364,8 +1364,7 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i return ERROR_OK; } -int dap_baseaddr_command(struct command_context_s *cmd_ctx, - swjdp_common_t *swjdp, char **args, int argc) +DAP_COMMAND_HANDLER(dap_baseaddr_command) { uint32_t apsel, apselsave, baseaddr; int retval; @@ -1395,8 +1394,7 @@ int dap_baseaddr_command(struct command_context_s *cmd_ctx, return retval; } -int dap_memaccess_command(struct command_context_s *cmd_ctx, - swjdp_common_t *swjdp, char **args, int argc) +DAP_COMMAND_HANDLER(dap_memaccess_command) { uint32_t memaccess_tck; @@ -1418,8 +1416,7 @@ int dap_memaccess_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -int dap_apsel_command(struct command_context_s *cmd_ctx, - swjdp_common_t *swjdp, char **args, int argc) +DAP_COMMAND_HANDLER(dap_apsel_command) { uint32_t apsel, apid; int retval; @@ -1444,8 +1441,7 @@ int dap_apsel_command(struct command_context_s *cmd_ctx, return retval; } -int dap_apid_command(struct command_context_s *cmd_ctx, - swjdp_common_t *swjdp, char **args, int argc) +DAP_COMMAND_HANDLER(dap_apid_command) { uint32_t apsel, apselsave, apid; int retval; diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index 442b45ca..90b4cbd0 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -158,13 +158,12 @@ int ahbap_debugport_init(swjdp_common_t *swjdp); /* Commands for user dap access */ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, int apsel); -int dap_baseaddr_command(struct command_context_s *cmd_ctx, - swjdp_common_t *swjdp, char **args, int argc); -int dap_memaccess_command(struct command_context_s *cmd_ctx, - swjdp_common_t *swjdp, char **args, int argc); -int dap_apsel_command(struct command_context_s *cmd_ctx, - swjdp_common_t *swjdp, char **args, int argc); -int dap_apid_command(struct command_context_s *cmd_ctx, - swjdp_common_t *swjdp, char **args, int argc); + +#define DAP_COMMAND_HANDLER(name) \ + COMMAND_HELPER(name, swjdp_common_t *swjdp) +DAP_COMMAND_HANDLER(dap_baseaddr_command); +DAP_COMMAND_HANDLER(dap_memaccess_command); +DAP_COMMAND_HANDLER(dap_apsel_command); +DAP_COMMAND_HANDLER(dap_apid_command); #endif diff --git a/src/target/armv7a.c b/src/target/armv7a.c index f0679260..eb5bfa9e 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -236,7 +236,7 @@ COMMAND_HANDLER(handle_dap_baseaddr_command) struct armv7a_common_s *armv7a = target_to_armv7a(target); swjdp_common_t *swjdp = &armv7a->swjdp_info; - return dap_baseaddr_command(cmd_ctx, swjdp, args, argc); + return CALL_COMMAND_HANDLER(dap_baseaddr_command, swjdp); } COMMAND_HANDLER(handle_dap_memaccess_command) @@ -245,7 +245,7 @@ COMMAND_HANDLER(handle_dap_memaccess_command) struct armv7a_common_s *armv7a = target_to_armv7a(target); swjdp_common_t *swjdp = &armv7a->swjdp_info; - return dap_memaccess_command(cmd_ctx, swjdp, args, argc); + return CALL_COMMAND_HANDLER(dap_memaccess_command, swjdp); } COMMAND_HANDLER(handle_dap_apsel_command) @@ -254,7 +254,7 @@ COMMAND_HANDLER(handle_dap_apsel_command) struct armv7a_common_s *armv7a = target_to_armv7a(target); swjdp_common_t *swjdp = &armv7a->swjdp_info; - return dap_apsel_command(cmd_ctx, swjdp, args, argc); + return CALL_COMMAND_HANDLER(dap_apsel_command, swjdp); } COMMAND_HANDLER(handle_dap_apid_command) @@ -263,7 +263,7 @@ COMMAND_HANDLER(handle_dap_apid_command) struct armv7a_common_s *armv7a = target_to_armv7a(target); swjdp_common_t *swjdp = &armv7a->swjdp_info; - return dap_apid_command(cmd_ctx, swjdp, args, argc); + return CALL_COMMAND_HANDLER(dap_apid_command, swjdp); } COMMAND_HANDLER(handle_dap_info_command) diff --git a/src/target/armv7m.c b/src/target/armv7m.c index f6de5e11..0f9d8114 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -788,7 +788,7 @@ COMMAND_HANDLER(handle_dap_apid_command) struct armv7m_common_s *armv7m = target_to_armv7m(target); swjdp_common_t *swjdp = &armv7m->swjdp_info; - return dap_apid_command(cmd_ctx, swjdp, args, argc); + return CALL_COMMAND_HANDLER(dap_apid_command, swjdp); } COMMAND_HANDLER(handle_dap_apsel_command) @@ -797,7 +797,7 @@ COMMAND_HANDLER(handle_dap_apsel_command) struct armv7m_common_s *armv7m = target_to_armv7m(target); swjdp_common_t *swjdp = &armv7m->swjdp_info; - return dap_apsel_command(cmd_ctx, swjdp, args, argc); + return CALL_COMMAND_HANDLER(dap_apsel_command, swjdp); } COMMAND_HANDLER(handle_dap_memaccess_command) @@ -806,7 +806,7 @@ COMMAND_HANDLER(handle_dap_memaccess_command) struct armv7m_common_s *armv7m = target_to_armv7m(target); swjdp_common_t *swjdp = &armv7m->swjdp_info; - return dap_memaccess_command(cmd_ctx, swjdp, args, argc); + return CALL_COMMAND_HANDLER(dap_memaccess_command, swjdp); } |