main: invoke jtag_interface_quit() explicitly
[fw/openocd] / src / jtag / at91rm9200.c
index 706257533e3a02132a3e447e8126c2f9d44fb235..ff9f7a4126046863c2747b391a9321b2db6431e9 100644 (file)
@@ -118,7 +118,7 @@ static void at91rm9200_write(int tck, int tms, int tdi);
 static void at91rm9200_reset(int trst, int srst);
 
 static int at91rm9200_speed(int speed);
-static int at91rm9200_register_commands(struct command_context_s *cmd_ctx);
+static int at91rm9200_register_commands(struct command_context *cmd_ctx);
 static int at91rm9200_init(void);
 static int at91rm9200_quit(void);
 
@@ -185,26 +185,33 @@ static int at91rm9200_speed(int speed)
        return ERROR_OK;
 }
 
-static int at91rm9200_handle_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int at91rm9200_handle_device_command(struct command_context *cmd_ctx, char *cmd, char **CMD_ARGV, int argc)
 {
-       if (argc == 0)
+       if (CMD_ARGC == 0)
                return ERROR_OK;
 
        /* only if the device name wasn't overwritten by cmdline */
        if (at91rm9200_device == 0)
        {
-               at91rm9200_device = malloc(strlen(args[0]) + sizeof(char));
-               strcpy(at91rm9200_device, args[0]);
+               at91rm9200_device = malloc(strlen(CMD_ARGV[0]) + sizeof(char));
+               strcpy(at91rm9200_device, CMD_ARGV[0]);
        }
 
        return ERROR_OK;
 }
 
-static int at91rm9200_register_commands(struct command_context_s *cmd_ctx)
+static const struct command_registration at91rm9200_command_handlers[] = {
+       {
+               .name = "at91rm9200_device",
+               .handler = &at91rm9200_handle_device_command,
+               .mode = COMMAND_CONFIG,
+               .help = "query armjtagew info",
+       },
+};
+
+static int at91rm9200_register_commands(struct command_context *cmd_ctx)
 {
-       register_command(cmd_ctx, NULL, "at91rm9200_device", at91rm9200_handle_device_command,
-               COMMAND_CONFIG, NULL);
-       return ERROR_OK;
+       return register_commands(cmd_ctx, NULL, at91rm9200_command_handlers);
 }
 
 static int at91rm9200_init(void)