From db6c2871dd3f106ca8b5dc8828a17f8b729de181 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Mon, 9 Nov 2009 21:24:45 -0800 Subject: [PATCH] svf,xsvf,arm7_9_common: trim forard declarations Remove forward declarations by reordering command registration. --- src/svf/svf.c | 18 +++++----- src/target/arm7_9_common.c | 73 ++++++++++++++++++++------------------ src/xsvf/xsvf.c | 17 +++++---- 3 files changed, 55 insertions(+), 53 deletions(-) diff --git a/src/svf/svf.c b/src/svf/svf.c index 9c597bf7..ba6ed1b7 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -210,7 +210,6 @@ static int svf_read_command_from_file(int fd); static int svf_check_tdo(void); static int svf_add_check_para(uint8_t enabled, int buffer_offset, int bit_len); static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str); -static int handle_svf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int svf_fd = 0; static char *svf_command_buffer = NULL; @@ -225,14 +224,6 @@ static int svf_buffer_index = 0, svf_buffer_size = 0; static int svf_quiet = 0; -int svf_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "svf", handle_svf_command, - COMMAND_EXEC, "run svf "); - - return ERROR_OK; -} - static void svf_free_xxd_para(svf_xxr_para_t *para) { if (NULL != para) @@ -1468,3 +1459,12 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) return ERROR_OK; } + +int svf_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "svf", + &handle_svf_command, COMMAND_EXEC, + "run svf "); + + return ERROR_OK; +} diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index b251ec5b..a3c6a56c 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -39,16 +39,6 @@ int arm7_9_debug_entry(target_t *target); -/* command handler forward declarations */ -int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_write_xpsr_im8_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_read_core_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_write_core_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_dbgrq_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_fast_memory_access_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_dcc_downloads_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_etm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - /** * Clear watchpoints for an ARM7/9 target. * @@ -2881,31 +2871,6 @@ int arm7_9_blank_check_memory(struct target_s *target, uint32_t address, uint32_ return ERROR_OK; } -int arm7_9_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *arm7_9_cmd; - - arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", NULL, COMMAND_ANY, "arm7/9 specific commands"); - - register_command(cmd_ctx, arm7_9_cmd, "write_xpsr", handle_arm7_9_write_xpsr_command, COMMAND_EXEC, "write program status register "); - register_command(cmd_ctx, arm7_9_cmd, "write_xpsr_im8", handle_arm7_9_write_xpsr_im8_command, COMMAND_EXEC, "write program status register <8bit immediate> "); - - register_command(cmd_ctx, arm7_9_cmd, "write_core_reg", handle_arm7_9_write_core_reg_command, COMMAND_EXEC, "write core register "); - - register_command(cmd_ctx, arm7_9_cmd, "dbgrq", handle_arm7_9_dbgrq_command, - COMMAND_ANY, "use EmbeddedICE dbgrq instead of breakpoint for target halt requests "); - register_command(cmd_ctx, arm7_9_cmd, "fast_memory_access", handle_arm7_9_fast_memory_access_command, - COMMAND_ANY, "use fast memory accesses instead of slower but potentially safer accesses "); - register_command(cmd_ctx, arm7_9_cmd, "dcc_downloads", handle_arm7_9_dcc_downloads_command, - COMMAND_ANY, "use DCC downloads for larger memory writes "); - - armv4_5_register_commands(cmd_ctx); - - etm_register_commands(cmd_ctx); - - return ERROR_OK; -} - int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { uint32_t value; @@ -3178,3 +3143,41 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9) return ERROR_OK; } + +int arm7_9_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *arm7_9_cmd; + + arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", + NULL, COMMAND_ANY, "arm7/9 specific commands"); + + register_command(cmd_ctx, arm7_9_cmd, "write_xpsr", + handle_arm7_9_write_xpsr_command, COMMAND_EXEC, + "write program status register "); + register_command(cmd_ctx, arm7_9_cmd, "write_xpsr_im8", + handle_arm7_9_write_xpsr_im8_command, COMMAND_EXEC, + "write program status register " + "<8bit immediate> "); + + register_command(cmd_ctx, arm7_9_cmd, "write_core_reg", + handle_arm7_9_write_core_reg_command, COMMAND_EXEC, + "write core register "); + + register_command(cmd_ctx, arm7_9_cmd, "dbgrq", + handle_arm7_9_dbgrq_command, COMMAND_ANY, + "use EmbeddedICE dbgrq instead of breakpoint " + "for target halt requests "); + register_command(cmd_ctx, arm7_9_cmd, "fast_memory_access", + handle_arm7_9_fast_memory_access_command, COMMAND_ANY, + "use fast memory accesses instead of slower " + "but potentially safer accesses "); + register_command(cmd_ctx, arm7_9_cmd, "dcc_downloads", + handle_arm7_9_dcc_downloads_command, COMMAND_ANY, + "use DCC downloads for larger memory writes "); + + armv4_5_register_commands(cmd_ctx); + + etm_register_commands(cmd_ctx); + + return ERROR_OK; +} diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index 719470ee..17af9ead 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -123,7 +123,6 @@ LSDR 1 TDI (0) #define XSTATE_MAX_PATH 12 -static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int xsvf_fd = 0; @@ -161,14 +160,6 @@ static tap_state_t xsvf_to_tap(int xsvf_state) -int xsvf_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "xsvf", handle_xsvf_command, - COMMAND_EXEC, "run xsvf [virt2] [quiet]"); - - return ERROR_OK; -} - static int xsvf_read_buffer(int num_bits, int fd, uint8_t* buf) { int num_bytes; @@ -1059,6 +1050,14 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha return ERROR_OK; } +int xsvf_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "xsvf", + &handle_xsvf_command, COMMAND_EXEC, + "run xsvf [virt2] [quiet]"); + + return ERROR_OK; +} #if 0 /* this comment style used to try and keep uncrustify from adding * at begin of line */ -- 2.39.5