arm-jtag-ew,jlink: switch to COMMAND_HANDLER
authorZachary T Welch <zw@superlucidity.net>
Sun, 15 Nov 2009 17:12:44 +0000 (09:12 -0800)
committerZachary T Welch <zw@superlucidity.net>
Sun, 15 Nov 2009 17:12:44 +0000 (09:12 -0800)
These drivers were overlooked during the recent upgrade.  Convert them,
moving their registration routines to eliminate their declarations.

src/jtag/arm-jtag-ew.c
src/jtag/jlink.c

index 0568d1c..18b353a 100644 (file)
@@ -63,9 +63,6 @@ static int armjtagew_register_commands(struct command_context *cmd_ctx);
 static int armjtagew_init(void);
 static int armjtagew_quit(void);
 
-/* CLI command handler functions */
-static int armjtagew_handle_armjtagew_info_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc);
-
 /* Queue command functions */
 static void armjtagew_end_state(tap_state_t state);
 static void armjtagew_state_move(void);
@@ -240,13 +237,6 @@ static int armjtagew_khz(int khz, int *jtag_speed)
        return ERROR_OK;
 }
 
-static int armjtagew_register_commands(struct command_context *cmd_ctx)
-{
-       register_command(cmd_ctx, NULL, "armjtagew_info", armjtagew_handle_armjtagew_info_command, COMMAND_EXEC,
-               "query armjtagew info");
-       return ERROR_OK;
-}
-
 static int armjtagew_init(void)
 {
        int check_cnt;
@@ -520,7 +510,7 @@ static int armjtagew_get_version_info(void)
        return ERROR_OK;
 }
 
-static int armjtagew_handle_armjtagew_info_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc)
+COMMAND_HANDLER(armjtagew_handle_armjtagew_info_command)
 {
        if (armjtagew_get_version_info() == ERROR_OK)
        {
@@ -531,6 +521,14 @@ static int armjtagew_handle_armjtagew_info_command(struct command_context *cmd_c
        return ERROR_OK;
 }
 
+static int armjtagew_register_commands(struct command_context *cmd_ctx)
+{
+       register_command(cmd_ctx, NULL, "armjtagew_info", 
+                       &armjtagew_handle_armjtagew_info_command, COMMAND_EXEC,
+                       "query armjtagew info");
+       return ERROR_OK;
+}
+
 /***************************************************************************/
 /* ARM-JTAG-EW tap functions */
 
index 27d400d..2422135 100644 (file)
@@ -91,10 +91,6 @@ static int jlink_register_commands(struct command_context *cmd_ctx);
 static int jlink_init(void);
 static int jlink_quit(void);
 
-/* CLI command handler functions */
-static int jlink_handle_jlink_info_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc);
-static int jlink_handle_jlink_hw_jtag_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc);
-
 /* Queue command functions */
 static void jlink_end_state(tap_state_t state);
 static void jlink_state_move(void);
@@ -290,18 +286,6 @@ static int jlink_khz(int khz, int *jtag_speed)
        return ERROR_OK;
 }
 
-static int jlink_register_commands(struct command_context *cmd_ctx)
-{
-
-       register_command(cmd_ctx, NULL, "jlink_info",
-               &jlink_handle_jlink_info_command, COMMAND_EXEC,
-               "query jlink info");
-       register_command(cmd_ctx, NULL, "jlink_hw_jtag",
-               &jlink_handle_jlink_hw_jtag_command, COMMAND_EXEC,
-               "set/get jlink hw jtag command version [2 | 3]");
-       return ERROR_OK;
-}
-
 static int jlink_init(void)
 {
        int i;
@@ -630,7 +614,7 @@ static int jlink_get_version_info(void)
        return ERROR_OK;
 }
 
-static int jlink_handle_jlink_info_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc)
+COMMAND_HANDLER(jlink_handle_jlink_info_command)
 {
        if (jlink_get_version_info() == ERROR_OK)
        {
@@ -641,7 +625,7 @@ static int jlink_handle_jlink_info_command(struct command_context *cmd_ctx, char
        return ERROR_OK;
 }
 
-static int jlink_handle_jlink_hw_jtag_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc)
+COMMAND_HANDLER(jlink_handle_jlink_hw_jtag_command)
 {
        switch (argc) {
        case 0:
@@ -665,6 +649,18 @@ static int jlink_handle_jlink_hw_jtag_command(struct command_context *cmd_ctx, c
        return ERROR_OK;
 }
 
+static int jlink_register_commands(struct command_context *cmd_ctx)
+{
+
+       register_command(cmd_ctx, NULL, "jlink_info",
+               &jlink_handle_jlink_info_command, COMMAND_EXEC,
+               "query jlink info");
+       register_command(cmd_ctx, NULL, "jlink_hw_jtag",
+               &jlink_handle_jlink_hw_jtag_command, COMMAND_EXEC,
+               "set/get jlink hw jtag command version [2 | 3]");
+       return ERROR_OK;
+}
+
 /***************************************************************************/
 /* J-Link tap functions */