From fc2d9f87615b7a5562cb9cd58fb95953e5d89818 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Fri, 20 Nov 2009 21:06:28 -0800 Subject: [PATCH] vsllink: use register_commands() Use register_commands() with command registration array. --- src/jtag/vsllink.c | 55 +++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/jtag/vsllink.c b/src/jtag/vsllink.c index 3526198e..8287e84a 100644 --- a/src/jtag/vsllink.c +++ b/src/jtag/vsllink.c @@ -1856,28 +1856,43 @@ static void vsllink_debug_buffer(uint8_t *buffer, int length) } #endif // _DEBUG_USB_COMMS_ || _DEBUG_JTAG_IO_ +static const struct command_registration vsllink_command_handlers[] = { + { + .name = "vsllink_usb_vid", + .handler = &vsllink_handle_usb_vid_command, + .mode = COMMAND_CONFIG, + }, + { + .name = "vsllink_usb_pid", + .handler = &vsllink_handle_usb_pid_command, + .mode = COMMAND_CONFIG, + }, + { + .name = "vsllink_usb_bulkin", + .handler = &vsllink_handle_usb_bulkin_command, + .mode = COMMAND_CONFIG, + }, + { + .name = "vsllink_usb_bulkout", + .handler = &vsllink_handle_usb_bulkout_command, + .mode = COMMAND_CONFIG, + }, + { + .name = "vsllink_usb_interface", + .handler = &vsllink_handle_usb_interface_command, + .mode = COMMAND_CONFIG, + }, + { + .name = "vsllink_mode", + .handler = &vsllink_handle_mode_command, + .mode = COMMAND_CONFIG, + }, + COMMAND_REGISTRATION_DONE +}; + static int vsllink_register_commands(struct command_context *cmd_ctx) { - COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_vid", - vsllink_handle_usb_vid_command, COMMAND_CONFIG, - NULL); - COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_pid", - vsllink_handle_usb_pid_command, COMMAND_CONFIG, - NULL); - COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_bulkin", - vsllink_handle_usb_bulkin_command, COMMAND_CONFIG, - NULL); - COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_bulkout", - vsllink_handle_usb_bulkout_command, COMMAND_CONFIG, - NULL); - COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_interface", - vsllink_handle_usb_interface_command, COMMAND_CONFIG, - NULL); - COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_mode", - vsllink_handle_mode_command, COMMAND_CONFIG, - NULL); - - return ERROR_OK; + return register_commands(cmd_ctx, NULL, vsllink_command_handlers); } struct jtag_interface vsllink_interface = { -- 2.39.5