From 8d6dcb9d39f0f948ef44beff991337b830fc4567 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Mon, 9 Nov 2009 21:21:06 -0800 Subject: jtag: remove useless declarations Contrary to my previous assessment, some opportunities to remove forward declarations were overlooked. Remove them by moving the definitions of the command registration and interface structure to the end of files. --- src/jtag/vsllink.c | 85 ++++++++++++++++++++++-------------------------------- 1 file changed, 35 insertions(+), 50 deletions(-) (limited to 'src/jtag/vsllink.c') diff --git a/src/jtag/vsllink.c b/src/jtag/vsllink.c index 3c1a0462..b0084673 100644 --- a/src/jtag/vsllink.c +++ b/src/jtag/vsllink.c @@ -176,23 +176,6 @@ typedef struct static int pending_scan_results_length; static pending_scan_result_t pending_scan_results_buffer[MAX_PENDING_SCAN_RESULTS]; -/* External interface functions */ -static int vsllink_execute_queue(void); -static int vsllink_speed(int speed); -static int vsllink_khz(int khz, int *jtag_speed); -static int vsllink_speed_div(int jtag_speed, int *khz); -static int vsllink_register_commands(struct command_context_s *cmd_ctx); -static int vsllink_init(void); -static int vsllink_quit(void); - -/* CLI command handler functions */ -static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_mode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - /* Queue command functions */ static void vsllink_end_state(tap_state_t state); static void vsllink_state_move_dma(void); @@ -255,21 +238,6 @@ static int last_tms; static vsllink_jtag_t* vsllink_jtag_handle = NULL; -/***************************************************************************/ -/* External interface implementation */ - -jtag_interface_t vsllink_interface = -{ - .name = "vsllink", - .execute_queue = vsllink_execute_queue, - .speed = vsllink_speed, - .khz = vsllink_khz, - .speed_div = vsllink_speed_div, - .register_commands = vsllink_register_commands, - .init = vsllink_init, - .quit = vsllink_quit -}; - static void reset_command_pointer(void) { if (vsllink_mode == VSLLINK_MODE_NORMAL) @@ -1357,24 +1325,6 @@ static void vsllink_simple_command(uint8_t command) } } -static int vsllink_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_interface", vsllink_handle_usb_interface_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_mode", vsllink_handle_mode_command, - COMMAND_CONFIG, NULL); - - return ERROR_OK; -} - static int vsllink_handle_mode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc != 1) { @@ -1932,3 +1882,38 @@ static void vsllink_debug_buffer(uint8_t *buffer, int length) } } #endif // _DEBUG_USB_COMMS_ || _DEBUG_JTAG_IO_ + +static int vsllink_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "vsllink_usb_vid", + vsllink_handle_usb_vid_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_usb_pid", + vsllink_handle_usb_pid_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", + vsllink_handle_usb_bulkin_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", + vsllink_handle_usb_bulkout_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_usb_interface", + vsllink_handle_usb_interface_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_mode", + vsllink_handle_mode_command, COMMAND_CONFIG, + NULL); + + return ERROR_OK; +} + +jtag_interface_t vsllink_interface = { + .name = "vsllink", + .register_commands = &vsllink_register_commands, + .init = &vsllink_init, + .quit = &vsllink_quit, + .khz = &vsllink_khz, + .speed = &vsllink_speed, + .speed_div = &vsllink_speed_div, + .execute_queue = &vsllink_execute_queue, + }; -- cgit v1.2.3