diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-09 23:56:52 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-13 10:51:45 -0800 |
commit | cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e (patch) | |
tree | f129c414d90f81a2caf6054ab7bbcd1306ac1f26 /src/target | |
parent | ddb6138ed428f666064d26bb08036de3afe44bc8 (diff) | |
download | openocd_libswd-cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e.tar.gz openocd_libswd-cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e.tar.bz2 openocd_libswd-cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e.tar.xz openocd_libswd-cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e.zip |
use COMMAND_HANDLER macro to define all commands
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/arm11.c | 9 | ||||
-rw-r--r-- | src/target/arm720t.c | 3 | ||||
-rw-r--r-- | src/target/arm7_9_common.c | 12 | ||||
-rw-r--r-- | src/target/arm920t.c | 15 | ||||
-rw-r--r-- | src/target/arm926ejs.c | 7 | ||||
-rw-r--r-- | src/target/arm966e.c | 3 | ||||
-rw-r--r-- | src/target/arm9tdmi.c | 3 | ||||
-rw-r--r-- | src/target/armv4_5.c | 8 | ||||
-rw-r--r-- | src/target/armv7a.c | 19 | ||||
-rw-r--r-- | src/target/armv7m.c | 15 | ||||
-rw-r--r-- | src/target/cortex_a8.c | 6 | ||||
-rw-r--r-- | src/target/cortex_m3.c | 12 | ||||
-rw-r--r-- | src/target/etb.c | 2 | ||||
-rw-r--r-- | src/target/etm.c | 33 | ||||
-rw-r--r-- | src/target/etm_dummy.c | 2 | ||||
-rw-r--r-- | src/target/oocd_trace.c | 6 | ||||
-rw-r--r-- | src/target/target.c | 48 | ||||
-rw-r--r-- | src/target/target_request.c | 2 | ||||
-rw-r--r-- | src/target/trace.c | 4 | ||||
-rw-r--r-- | src/target/xscale.c | 42 |
20 files changed, 93 insertions, 158 deletions
diff --git a/src/target/arm11.c b/src/target/arm11.c index fe39d6e8..098b0afa 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2028,7 +2028,7 @@ static int arm11_handle_bool(struct command_context_s *cmd_ctx, } #define BOOL_WRAPPER(name, print_name) \ -static int arm11_handle_bool_##name(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) \ +COMMAND_HANDLER(arm11_handle_bool_##name) \ { \ return arm11_handle_bool(cmd_ctx, cmd, args, argc, &arm11_config_##name, print_name); \ } @@ -2038,7 +2038,7 @@ BOOL_WRAPPER(memwrite_error_fatal, "fatal error mode for memory writes") BOOL_WRAPPER(step_irq_enable, "IRQs while stepping") BOOL_WRAPPER(hardware_step, "hardware single step") -static int arm11_handle_vcr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(arm11_handle_vcr) { switch (argc) { case 0: @@ -2185,17 +2185,16 @@ static int arm11_handle_etm_read_write(struct command_context_s *cmd_ctx, char * return ERROR_OK; } -int arm11_handle_etmr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(arm11_handle_etmr) { return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, true); } -int arm11_handle_etmw(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(arm11_handle_etmw) { return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, false); } - #define ARM11_HANDLER(x) .x = arm11_##x target_type_t arm11_target = { diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 6ce79807..6a5a4e74 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -409,8 +409,7 @@ static int arm720t_target_create(struct target_s *target, Jim_Interp *interp) return arm720t_init_arch_info(target, arm720t, target->tap); } -static int arm720t_handle_cp15_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm720t_handle_cp15_command) { int retval; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index b6606a17..6a56417e 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -2871,7 +2871,7 @@ int arm7_9_blank_check_memory(struct target_s *target, uint32_t address, uint32_ return ERROR_OK; } -int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_write_xpsr_command) { uint32_t value; int spsr; @@ -2915,7 +2915,7 @@ int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -int handle_arm7_9_write_xpsr_im8_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_write_xpsr_im8_command) { uint32_t value; int rotate; @@ -2957,7 +2957,7 @@ int handle_arm7_9_write_xpsr_im8_command(struct command_context_s *cmd_ctx, char return ERROR_OK; } -int handle_arm7_9_write_core_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_write_core_reg_command) { uint32_t value; uint32_t mode; @@ -2991,7 +2991,7 @@ int handle_arm7_9_write_core_reg_command(struct command_context_s *cmd_ctx, char return arm7_9_write_core_reg(target, num, mode, value); } -int handle_arm7_9_dbgrq_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_dbgrq_command) { target_t *target = get_current_target(cmd_ctx); armv4_5_common_t *armv4_5; @@ -3024,7 +3024,7 @@ int handle_arm7_9_dbgrq_command(struct command_context_s *cmd_ctx, char *cmd, ch return ERROR_OK; } -int handle_arm7_9_fast_memory_access_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_fast_memory_access_command) { target_t *target = get_current_target(cmd_ctx); armv4_5_common_t *armv4_5; @@ -3057,7 +3057,7 @@ int handle_arm7_9_fast_memory_access_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -int handle_arm7_9_dcc_downloads_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_dcc_downloads_command) { target_t *target = get_current_target(cmd_ctx); armv4_5_common_t *armv4_5; diff --git a/src/target/arm920t.c b/src/target/arm920t.c index e043aee0..5576f60f 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -662,8 +662,7 @@ static int arm920t_target_create(struct target_s *target, Jim_Interp *interp) return arm920t_init_arch_info(target, arm920t, target->tap); } -static int arm920t_handle_read_cache_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_read_cache_command) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); @@ -909,8 +908,7 @@ static int arm920t_handle_read_cache_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int arm920t_handle_read_mmu_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_read_mmu_command) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); @@ -1193,8 +1191,7 @@ static int arm920t_handle_read_mmu_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int arm920t_handle_cp15_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_cp15_command) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -1247,8 +1244,7 @@ static int arm920t_handle_cp15_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int arm920t_handle_cp15i_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_cp15i_command) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -1315,8 +1311,7 @@ static int arm920t_handle_cp15i_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int arm920t_handle_cache_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_cache_info_command) { int retval; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 316f1276..6f347d87 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -713,8 +713,7 @@ static int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp) return arm926ejs_init_arch_info(target, arm926ejs, target->tap); } -static int arm926ejs_handle_cp15_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm926ejs_handle_cp15_command) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -775,9 +774,7 @@ static int arm926ejs_handle_cp15_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -arm926ejs_handle_cache_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm926ejs_handle_cache_info_command) { int retval; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/arm966e.c b/src/target/arm966e.c index 5b464efb..e61943a3 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -162,8 +162,7 @@ int arm966e_write_cp15(target_t *target, int reg_addr, uint32_t value) return ERROR_OK; } -static int arm966e_handle_cp15_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm966e_handle_cp15_command) { int retval; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 58b8efd0..112ec2a4 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -856,8 +856,7 @@ static int arm9tdmi_target_create(struct target_s *target, Jim_Interp *interp) return ERROR_OK; } -static int handle_arm9tdmi_catch_vectors_command( - struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) { target_t *target = get_current_target(cmd_ctx); struct arm7_9_common_s *arm7_9 = target_to_arm7_9(target); diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index 0fe9ee4a..c0a9c8ab 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -307,7 +307,7 @@ int armv4_5_arch_state(struct target_s *target) return ERROR_OK; } -int handle_armv4_5_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_armv4_5_reg_command) { char output[128]; int output_len; @@ -359,7 +359,7 @@ int handle_armv4_5_reg_command(struct command_context_s *cmd_ctx, char *cmd, cha return ERROR_OK; } -int handle_armv4_5_core_state_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_armv4_5_core_state_command) { target_t *target = get_current_target(cmd_ctx); struct armv4_5_common_s *armv4_5 = target_to_armv4_5(target); @@ -387,9 +387,7 @@ int handle_armv4_5_core_state_command(struct command_context_s *cmd_ctx, char *c return ERROR_OK; } -static int -handle_armv4_5_disassemble_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_armv4_5_disassemble_command) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 6dfbb162..f0679260 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -230,8 +230,7 @@ int armv7a_arch_state(struct target_s *target) } -static int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_baseaddr_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -240,8 +239,7 @@ static int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, return dap_baseaddr_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_memaccess_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -250,8 +248,7 @@ static int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, return dap_memaccess_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_apsel_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_apsel_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -260,8 +257,7 @@ static int handle_dap_apsel_command(struct command_context_s *cmd_ctx, return dap_apsel_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_apid_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_apid_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -270,8 +266,7 @@ static int handle_dap_apid_command(struct command_context_s *cmd_ctx, return dap_apid_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_info_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -292,9 +287,7 @@ static int handle_dap_info_command(struct command_context_s *cmd_ctx, return dap_info_command(cmd_ctx, swjdp, apsel); } -static int -handle_armv7a_disassemble_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_armv7a_disassemble_command) { target_t *target = get_current_target(cmd_ctx); struct armv4_5_common_s *armv4_5 = target_to_armv4_5(target); diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 0fcee317..f6de5e11 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -745,8 +745,7 @@ int armv7m_blank_check_memory(struct target_s *target, * Return the debug ap baseaddress in hexadecimal; * no extra output to simplify script processing */ -static int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_baseaddr_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); @@ -783,8 +782,7 @@ static int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, * Return the debug ap id in hexadecimal; * no extra output to simplify script processing */ -static int handle_dap_apid_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_apid_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); @@ -793,8 +791,7 @@ static int handle_dap_apid_command(struct command_context_s *cmd_ctx, return dap_apid_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_apsel_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_apsel_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); @@ -803,8 +800,7 @@ static int handle_dap_apsel_command(struct command_context_s *cmd_ctx, return dap_apsel_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_memaccess_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); @@ -814,8 +810,7 @@ static int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, } -static int handle_dap_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_info_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index 667c5825..3ce861c4 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1526,8 +1526,7 @@ static int cortex_a8_target_create(struct target_s *target, Jim_Interp *interp) return ERROR_OK; } -static int cortex_a8_handle_cache_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(cortex_a8_handle_cache_info_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -1537,8 +1536,7 @@ static int cortex_a8_handle_cache_info_command(struct command_context_s *cmd_ctx } -static int cortex_a8_handle_dbginit_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(cortex_a8_handle_dbginit_command) { target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 6c95b4ea..50842319 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1781,9 +1781,7 @@ static int cortex_m3_verify_pointer(struct command_context_s *cmd_ctx, * that *only* Thumb2 disassembly matters. There are also some small * additions to Thumb2 that are specific to ARMv7-M. */ -static int -handle_cortex_m3_disassemble_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_cortex_m3_disassemble_command) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -1835,9 +1833,7 @@ static const struct { { "reset", VC_CORERESET, }, }; -static int -handle_cortex_m3_vector_catch_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_cortex_m3_vector_catch_command) { target_t *target = get_current_target(cmd_ctx); struct cortex_m3_common_s *cortex_m3 = target_to_cm3(target); @@ -1894,9 +1890,7 @@ write: return ERROR_OK; } -static int -handle_cortex_m3_mask_interrupts_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command) { target_t *target = get_current_target(cmd_ctx); struct cortex_m3_common_s *cortex_m3 = target_to_cm3(target); diff --git a/src/target/etb.c b/src/target/etb.c index 3a4e3fe4..c0c485fe 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -349,7 +349,7 @@ static int etb_write_reg(reg_t *reg, uint32_t value) return ERROR_OK; } -static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etb_config_command) { target_t *target; jtag_tap_t *tap; diff --git a/src/target/etm.c b/src/target/etm.c index f01f3666..0fc92491 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1248,8 +1248,7 @@ static int handle_etm_tracemode_command_update( return ERROR_OK; } -static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_tracemode_command) { target_t *target = get_current_target(cmd_ctx); struct arm *arm = target_to_arm(target); @@ -1371,8 +1370,7 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_config_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_config_command) { target_t *target; struct arm *arm; @@ -1522,8 +1520,7 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, return etm_register_user_commands(cmd_ctx); } -static int handle_etm_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_info_command) { target_t *target; struct arm *arm; @@ -1655,8 +1652,7 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_status_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_status_command) { target_t *target; struct arm *arm; @@ -1732,8 +1728,7 @@ static int handle_etm_status_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_image_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_image_command) { target_t *target; struct arm *arm; @@ -1792,8 +1787,7 @@ static int handle_etm_image_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_dump_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_dump_command) { fileio_t file; target_t *target; @@ -1861,8 +1855,7 @@ static int handle_etm_dump_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_load_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_load_command) { fileio_t file; target_t *target; @@ -1946,8 +1939,7 @@ static int handle_etm_load_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_trigger_percent_command) { target_t *target; struct arm *arm; @@ -1988,8 +1980,7 @@ static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_start_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_start_command) { target_t *target; struct arm *arm; @@ -2037,8 +2028,7 @@ static int handle_etm_start_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_stop_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_stop_command) { target_t *target; struct arm *arm; @@ -2077,8 +2067,7 @@ static int handle_etm_stop_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_analyze_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_analyze_command) { target_t *target; struct arm *arm; diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index 0c5fc111..6bb2cde4 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -25,7 +25,7 @@ #include "etm_dummy.h" -static int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_dummy_config_command) { target_t *target; struct arm *arm; diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index e0048e64..755e1b69 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -289,7 +289,7 @@ etm_capture_driver_t oocd_trace_capture_driver = .read_trace = oocd_trace_read_trace, }; -static int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_oocd_trace_config_command) { target_t *target; struct arm *arm; @@ -326,7 +326,7 @@ static int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, c return ERROR_OK; } -static int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_oocd_trace_status_command) { target_t *target; struct arm *arm; @@ -366,7 +366,7 @@ static int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, c return ERROR_OK; } -static int handle_oocd_trace_resync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_oocd_trace_resync_command) { target_t *target; struct arm *arm; diff --git a/src/target/target.c b/src/target/target.c index 575a99ce..401f4dfb 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1650,7 +1650,7 @@ int target_write_u8(struct target_s *target, uint32_t address, uint8_t value) return retval; } -static int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_targets_command) { target_t *target = all_targets; @@ -1862,7 +1862,7 @@ int handle_target(void *priv) return retval; } -static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_reg_command) { target_t *target; reg_t *reg = NULL; @@ -1993,7 +1993,7 @@ static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -static int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_poll_command) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); @@ -2035,7 +2035,7 @@ static int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, cha return retval; } -static int handle_wait_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_wait_halt_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2102,7 +2102,7 @@ int target_wait_state(target_t *target, enum target_state state, int ms) return ERROR_OK; } -static int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_halt_command) { LOG_DEBUG("-"); @@ -2124,7 +2124,7 @@ static int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, cha return handle_wait_halt_command(cmd_ctx, cmd, args, argc); } -static int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_soft_reset_halt_command) { target_t *target = get_current_target(cmd_ctx); @@ -2135,7 +2135,7 @@ static int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, cha return ERROR_OK; } -static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_reset_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2156,7 +2156,7 @@ static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, ch } -static int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_resume_command) { int current = 1; if (argc > 1) @@ -2178,7 +2178,7 @@ static int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, c return target_resume(target, current, addr, 1, 0); } -static int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_step_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2250,7 +2250,7 @@ static void handle_md_output(struct command_context_s *cmd_ctx, } } -static int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_md_command) { if (argc < 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2299,7 +2299,7 @@ static int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char return retval; } -static int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_mw_command) { if (argc < 2) { @@ -2401,7 +2401,7 @@ static int parse_load_image_command_args(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_load_image_command) { uint8_t *buffer; uint32_t buf_cnt; @@ -2492,7 +2492,7 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm } -static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dump_image_command) { fileio_t fileio; @@ -2700,12 +2700,12 @@ done: return retval; } -static int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_verify_image_command) { return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 1); } -static int handle_test_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_test_image_command) { return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 0); } @@ -2750,8 +2750,7 @@ static int handle_bp_command_set(struct command_context_s *cmd_ctx, return retval; } -static int handle_bp_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_bp_command) { if (argc == 0) return handle_bp_command_list(cmd_ctx); @@ -2779,7 +2778,7 @@ static int handle_bp_command(struct command_context_s *cmd_ctx, return handle_bp_command_set(cmd_ctx, addr, length, hw); } -static int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_rbp_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2793,7 +2792,7 @@ static int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -static int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_wp_command) { target_t *target = get_current_target(cmd_ctx); @@ -2865,7 +2864,7 @@ static int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char return retval; } -static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_rwp_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2886,8 +2885,7 @@ static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char * The low-level target implementation must have logged a detailed error * which is forwarded to telnet/GDB session. */ -static int handle_virt2phys_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_virt2phys_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -3021,7 +3019,7 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, const char *filenam } /* profiling samples the CPU PC as quickly as OpenOCD is able, which will be used as a random sampling of PC */ -static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_profile_command) { target_t *target = get_current_target(cmd_ctx); struct timeval timeout, now; @@ -4539,7 +4537,7 @@ static void free_fastload(void) -static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_fast_load_image_command) { uint8_t *buffer; uint32_t buf_cnt; @@ -4650,7 +4648,7 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha return retval; } -static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_fast_load_command) { if (argc > 0) return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/target_request.c b/src/target/target_request.c index 5bfd57a4..4bfda5bf 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -257,7 +257,7 @@ int delete_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *targe return ERROR_OK; } -static int handle_target_request_debugmsgs_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_target_request_debugmsgs_command) { target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/trace.c b/src/target/trace.c index e74c6160..2c259709 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -47,7 +47,7 @@ int trace_point(target_t *target, uint32_t number) return ERROR_OK; } -static int handle_trace_point_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_trace_point_command) { target_t *target = get_current_target(cmd_ctx); trace_t *trace = target->trace_info; @@ -95,7 +95,7 @@ static int handle_trace_point_command(struct command_context_s *cmd_ctx, char *c return ERROR_OK; } -static int handle_trace_history_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_trace_history_command) { target_t *target = get_current_target(cmd_ctx); trace_t *trace = target->trace_info; diff --git a/src/target/xscale.c b/src/target/xscale.c index 0dc18f0b..6f2d6ee3 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -2989,9 +2989,7 @@ static int xscale_target_create(struct target_s *target, Jim_Interp *interp) target->variant); } -static int -xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_debug_handler_command) { target_t *target = NULL; xscale_common_t *xscale; @@ -3031,9 +3029,7 @@ xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_cache_clean_address_command) { target_t *target = NULL; xscale_common_t *xscale; @@ -3070,9 +3066,7 @@ xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -xscale_handle_cache_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_cache_info_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3121,8 +3115,7 @@ static int xscale_mmu(struct target_s *target, int *enabled) return ERROR_OK; } -static int xscale_handle_mmu_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_mmu_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3157,8 +3150,7 @@ static int xscale_handle_mmu_command(command_context_t *cmd_ctx, return ERROR_OK; } -static int xscale_handle_idcache_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_idcache_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3211,8 +3203,7 @@ static int xscale_handle_idcache_command(command_context_t *cmd_ctx, return ERROR_OK; } -static int xscale_handle_vector_catch_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_vector_catch_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3239,8 +3230,7 @@ static int xscale_handle_vector_catch_command(command_context_t *cmd_ctx, } -static int xscale_handle_vector_table_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_vector_table_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3298,9 +3288,7 @@ static int xscale_handle_vector_table_command(command_context_t *cmd_ctx, } -static int -xscale_handle_trace_buffer_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_trace_buffer_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3379,9 +3367,7 @@ xscale_handle_trace_buffer_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -xscale_handle_trace_image_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_trace_image_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3429,8 +3415,7 @@ xscale_handle_trace_image_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int xscale_handle_dump_trace_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_dump_trace_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3487,9 +3472,7 @@ static int xscale_handle_dump_trace_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -xscale_handle_analyze_trace_buffer_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_analyze_trace_buffer_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3504,8 +3487,7 @@ xscale_handle_analyze_trace_buffer_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int xscale_handle_cp15(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_cp15) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); |