scan_field_t -> struct scan_field
[fw/openocd] / src / svf / svf.c
index 9c597bf7d68e1711cfc2149be61a563bfe109557..348145d98e2fe51549d7b71cf4279de8f112d4ed 100644 (file)
@@ -210,14 +210,13 @@ 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;
 static int svf_command_buffer_size = 0;
 static int svf_line_number = 1;
 
-static jtag_tap_t *tap = NULL;
+static struct jtag_tap *tap = NULL;
 
 #define SVF_MAX_BUFFER_SIZE_TO_COMMIT  (4 * 1024)
 static uint8_t *svf_tdi_buffer = NULL, *svf_tdo_buffer = NULL, *svf_mask_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 <file>");
-
-       return ERROR_OK;
-}
-
 static void svf_free_xxd_para(svf_xxr_para_t *para)
 {
        if (NULL != para)
@@ -310,10 +301,10 @@ int svf_add_statemove(tap_state_t state_to)
        return ERROR_FAIL;
 }
 
-static int handle_svf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+COMMAND_HANDLER(handle_svf_command)
 {
 #define SVF_NUM_OF_OPTIONS                     1
-       int command_num = 0, i;
+       int command_num = 0;
        int ret = ERROR_OK;
        long long time_ago;
 
@@ -325,7 +316,7 @@ static int handle_svf_command(struct command_context_s *cmd_ctx, char *cmd, char
 
        // parse variant
        svf_quiet = 0;
-       for (i = 1; i < argc; i++)
+       for (unsigned i = 1; i < argc; i++)
        {
                if (!strcmp(args[i], "quiet"))
                {
@@ -773,7 +764,7 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str)
        // for XXR
        svf_xxr_para_t *xxr_para_tmp;
        uint8_t **pbuffer_tmp;
-       scan_field_t field;
+       struct scan_field field;
        // for STATE
        tap_state_t *path = NULL, state;
 
@@ -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 <file>");
+
+       return ERROR_OK;
+}