]> git.sur5r.net Git - openocd/commitdiff
jtag: remove useless declarations
authorZachary T Welch <zw@superlucidity.net>
Tue, 10 Nov 2009 05:21:06 +0000 (21:21 -0800)
committerZachary T Welch <zw@superlucidity.net>
Tue, 10 Nov 2009 05:39:28 +0000 (21:39 -0800)
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/amt_jtagaccel.c
src/jtag/ft2232.c
src/jtag/gw16012.c
src/jtag/parport.c
src/jtag/tcl.c
src/jtag/vsllink.c

index e3f440cce83fc6ba9fa99bed292c963a62e3401a..abfaadc95a77393e158010e3b2744e1ff974992d 100644 (file)
@@ -72,15 +72,6 @@ static int data_mode = IEEE1284_MODE_EPP | IEEE1284_DATA ;
 
 #endif // PARPORT_USE_PPDEV
 
-static int amt_jtagaccel_execute_queue(void);
-static int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx);
-static int amt_jtagaccel_speed(int speed);
-static int amt_jtagaccel_init(void);
-static int amt_jtagaccel_quit(void);
-
-static int amt_jtagaccel_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
 /* tap_move[i][j]: tap movement command to go from state i to state j
  * 0: Test-Logic-Reset
  * 1: Run-Test/Idle
@@ -101,28 +92,6 @@ static uint8_t amt_jtagaccel_tap_move[6][6][2] =
 };
 
 
-jtag_interface_t amt_jtagaccel_interface =
-{
-       .name = "amt_jtagaccel",
-
-       .execute_queue = amt_jtagaccel_execute_queue,
-
-       .speed = amt_jtagaccel_speed,
-       .register_commands = amt_jtagaccel_register_commands,
-       .init = amt_jtagaccel_init,
-       .quit = amt_jtagaccel_quit,
-};
-
-static int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx)
-{
-       register_command(cmd_ctx, NULL, "parport_port", amt_jtagaccel_handle_parport_port_command,
-                                        COMMAND_CONFIG, NULL);
-       register_command(cmd_ctx, NULL, "rtck", amt_jtagaccel_handle_rtck_command,
-                                        COMMAND_CONFIG, NULL);
-
-       return ERROR_OK;
-}
-
 static void amt_jtagaccel_reset(int trst, int srst)
 {
        if (trst == 1)
@@ -571,3 +540,24 @@ static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx,
 
        return ERROR_OK;
 }
+
+static int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx)
+{
+       register_command(cmd_ctx, NULL, "parport_port",
+                       amt_jtagaccel_handle_parport_port_command, COMMAND_CONFIG,
+                       NULL);
+       register_command(cmd_ctx, NULL, "rtck",
+                       amt_jtagaccel_handle_rtck_command, COMMAND_CONFIG,
+                       NULL);
+
+       return ERROR_OK;
+}
+
+jtag_interface_t amt_jtagaccel_interface = {
+               .name = "amt_jtagaccel",
+               .register_commands = &amt_jtagaccel_register_commands,
+               .init = &amt_jtagaccel_init,
+               .quit = &amt_jtagaccel_quit,
+               .speed = &amt_jtagaccel_speed,
+               .execute_queue = &amt_jtagaccel_execute_queue,
+       };
index b3389cc88253415463131f493138d15ece25ffe3..243479db225e70d23b88b3bb21d15416d2e5d788 100644 (file)
  #endif
 #endif
 
-static int ft2232_execute_queue(void);
-static int ft2232_speed(int speed);
-static int ft2232_speed_div(int speed, int* khz);
-static int ft2232_khz(int khz, int* jtag_speed);
-static int ft2232_register_commands(struct command_context_s* cmd_ctx);
-static int ft2232_init(void);
-static int ft2232_quit(void);
-
-static int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-static int ft2232_handle_serial_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-static int ft2232_handle_layout_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-static int ft2232_handle_vid_pid_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-static int ft2232_handle_latency_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-
 /**
  * Send out \a num_cycles on the TCK line while the TAP(s) are in a
  * stable state.  Calling code must ensure that current state is stable,
@@ -349,18 +335,6 @@ static void move_to_state(tap_state_t goal_state)
        clock_tms(0x4b,  tms_bits, tms_count, 0);
 }
 
-jtag_interface_t ft2232_interface =
-{
-       .name                   = "ft2232",
-       .execute_queue          = ft2232_execute_queue,
-       .speed                  = ft2232_speed,
-       .speed_div              = ft2232_speed_div,
-       .khz                    = ft2232_khz,
-       .register_commands      = ft2232_register_commands,
-       .init                   = ft2232_init,
-       .quit                   = ft2232_quit,
-};
-
 static int ft2232_write(uint8_t* buf, int size, uint32_t* bytes_written)
 {
 #if BUILD_FT2232_FTD2XX == 1
@@ -590,21 +564,6 @@ static int ft2232_khz(int khz, int* jtag_speed)
        return ERROR_OK;
 }
 
-static int ft2232_register_commands(struct command_context_s* cmd_ctx)
-{
-       register_command(cmd_ctx, NULL, "ft2232_device_desc", ft2232_handle_device_desc_command,
-                       COMMAND_CONFIG, "the USB device description of the FTDI FT2232 device");
-       register_command(cmd_ctx, NULL, "ft2232_serial", ft2232_handle_serial_command,
-                       COMMAND_CONFIG, "the serial number of the FTDI FT2232 device");
-       register_command(cmd_ctx, NULL, "ft2232_layout", ft2232_handle_layout_command,
-                       COMMAND_CONFIG, "the layout of the FT2232 GPIO signals used to control output-enables and reset signals");
-       register_command(cmd_ctx, NULL, "ft2232_vid_pid", ft2232_handle_vid_pid_command,
-                       COMMAND_CONFIG, "the vendor ID and product ID of the FTDI FT2232 device");
-       register_command(cmd_ctx, NULL, "ft2232_latency", ft2232_handle_latency_command,
-                       COMMAND_CONFIG, "set the FT2232 latency timer to a new value");
-       return ERROR_OK;
-}
-
 static void ft2232_end_state(tap_state_t state)
 {
        if (tap_is_state_stable(state))
@@ -1804,7 +1763,7 @@ static int ft2232_execute_command(jtag_command_t *cmd)
        return retval;
 }
 
-static int ft2232_execute_queue()
+static int ft2232_execute_queue(void)
 {
        jtag_command_t* cmd = jtag_command_queue;       /* currently processed command */
        int retval;
@@ -4011,3 +3970,37 @@ static void ktlink_blink(void)
        buffer_write(high_output);
        buffer_write(high_direction);
 }
+
+static int ft2232_register_commands(struct command_context_s* cmd_ctx)
+{
+       register_command(cmd_ctx, NULL, "ft2232_device_desc",
+                       ft2232_handle_device_desc_command, COMMAND_CONFIG,
+                       "the USB device description of the FTDI FT2232 device");
+       register_command(cmd_ctx, NULL, "ft2232_serial",
+                       ft2232_handle_serial_command, COMMAND_CONFIG,
+                       "the serial number of the FTDI FT2232 device");
+       register_command(cmd_ctx, NULL, "ft2232_layout",
+                       ft2232_handle_layout_command, COMMAND_CONFIG,
+                       "the layout of the FT2232 GPIO signals used "
+                       "to control output-enables and reset signals");
+       register_command(cmd_ctx, NULL, "ft2232_vid_pid",
+                       ft2232_handle_vid_pid_command, COMMAND_CONFIG,
+                       "the vendor ID and product ID of the FTDI FT2232 device");
+       register_command(cmd_ctx, NULL, "ft2232_latency",
+                       ft2232_handle_latency_command, COMMAND_CONFIG,
+                       "set the FT2232 latency timer to a new value");
+
+       return ERROR_OK;
+}
+
+
+jtag_interface_t ft2232_interface = {
+               .name = "ft2232",
+               .register_commands = &ft2232_register_commands,
+               .init = &ft2232_init,
+               .quit = &ft2232_quit,
+               .speed = &ft2232_speed,
+               .speed_div = &ft2232_speed_div,
+               .khz = &ft2232_khz,
+               .execute_queue = &ft2232_execute_queue,
+       };
index 4b0ffd73853a6c7e3a817dade2cbea026d4c6692..35473ab80de3766de3b325859b241bcd33f18b47 100644 (file)
@@ -78,34 +78,6 @@ static uint8_t gw16012_control_value = 0x0;
 static int device_handle;
 #endif
 
-static int gw16012_execute_queue(void);
-static int gw16012_register_commands(struct command_context_s *cmd_ctx);
-static int gw16012_speed(int speed);
-static int gw16012_init(void);
-static int gw16012_quit(void);
-
-static int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-jtag_interface_t gw16012_interface =
-{
-       .name = "gw16012",
-
-       .execute_queue = gw16012_execute_queue,
-
-       .speed = gw16012_speed,
-       .register_commands = gw16012_register_commands,
-       .init = gw16012_init,
-       .quit = gw16012_quit,
-};
-
-static int gw16012_register_commands(struct command_context_s *cmd_ctx)
-{
-       register_command(cmd_ctx, NULL, "parport_port", gw16012_handle_parport_port_command,
-                                        COMMAND_CONFIG, NULL);
-
-       return ERROR_OK;
-}
-
 static void gw16012_data(uint8_t value)
 {
        value = (value & 0x7f) | gw16012_msb;
@@ -589,3 +561,21 @@ static int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx
 
        return ERROR_OK;
 }
+
+static int gw16012_register_commands(struct command_context_s *cmd_ctx)
+{
+       register_command(cmd_ctx, NULL, "parport_port",
+                       gw16012_handle_parport_port_command, COMMAND_CONFIG,
+                       NULL);
+
+       return ERROR_OK;
+}
+
+jtag_interface_t gw16012_interface = {
+               .name = "gw16012",
+               .register_commands = &gw16012_register_commands,
+               .init = &gw16012_init,
+               .quit = &gw16012_quit,
+               .speed = &gw16012_speed,
+               .execute_queue = &gw16012_execute_queue,
+       };
index 12a5eea56dbb27f45d80ba606321073e15ec91e7..fdf7df4da0de60a4bc31c1010f8f77f60ae6c146 100644 (file)
@@ -118,43 +118,6 @@ static unsigned long dataport;
 static unsigned long statusport;
 #endif
 
-/* low level command set
- */
-static int parport_read(void);
-static void parport_write(int tck, int tms, int tdi);
-static void parport_reset(int trst, int srst);
-static void parport_led(int on);
-
-static int parport_speed(int speed);
-static int parport_register_commands(struct command_context_s *cmd_ctx);
-static int parport_init(void);
-static int parport_quit(void);
-
-/* interface commands */
-static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-jtag_interface_t parport_interface =
-{
-       .name = "parport",
-
-       .execute_queue = bitbang_execute_queue,
-
-       .speed = parport_speed,
-       .register_commands = parport_register_commands,
-       .init = parport_init,
-       .quit = parport_quit,
-};
-
-static bitbang_interface_t parport_bitbang =
-{
-       .read = parport_read,
-       .write = parport_write,
-       .reset = parport_reset,
-       .blink = parport_led
-};
-
 static int parport_read(void)
 {
        int data = 0;
@@ -244,18 +207,6 @@ static int parport_speed(int speed)
        return ERROR_OK;
 }
 
-static int parport_register_commands(struct command_context_s *cmd_ctx)
-{
-       register_command(cmd_ctx, NULL, "parport_port", parport_handle_parport_port_command,
-               COMMAND_CONFIG, "either the address of the I/O port or the number of the '/dev/parport' device");
-       register_command(cmd_ctx, NULL, "parport_cable", parport_handle_parport_cable_command,
-               COMMAND_CONFIG, "the layout of the parallel port cable used to connect to the target");
-       register_command(cmd_ctx, NULL, "parport_write_on_exit", parport_handle_write_on_exit_command,
-               COMMAND_CONFIG, "configure the parallel driver to write a known value to the parallel interface");
-
-       return ERROR_OK;
-}
-
 #if PARPORT_USE_GIVEIO == 1
 static int parport_get_giveio_access(void)
 {
@@ -282,6 +233,13 @@ static int parport_get_giveio_access(void)
 }
 #endif
 
+static bitbang_interface_t parport_bitbang = {
+               .read = &parport_read,
+               .write = &parport_write,
+               .reset = &parport_reset,
+               .blink = &parport_led,
+       };
+
 static int parport_init(void)
 {
        cable_t *cur_cable;
@@ -479,3 +437,32 @@ static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ct
 
        return ERROR_OK;
 }
+
+static int parport_register_commands(struct command_context_s *cmd_ctx)
+{
+       register_command(cmd_ctx, NULL, "parport_port",
+                       parport_handle_parport_port_command, COMMAND_CONFIG,
+                       "either the address of the I/O port "
+                       "or the number of the '/dev/parport' device");
+
+       register_command(cmd_ctx, NULL, "parport_cable",
+                       parport_handle_parport_cable_command, COMMAND_CONFIG,
+                       "the layout of the parallel port cable "
+                       "used to connect to the target");
+
+       register_command(cmd_ctx, NULL, "parport_write_on_exit",
+                       parport_handle_write_on_exit_command, COMMAND_CONFIG,
+                       "configure the parallel driver to write "
+                       "a known value to the parallel interface");
+
+       return ERROR_OK;
+}
+
+jtag_interface_t parport_interface = {
+               .name = "parport",
+               .register_commands = &parport_register_commands,
+               .init = &parport_init,
+               .quit = &parport_quit,
+               .speed = &parport_speed,
+               .execute_queue = &bitbang_execute_queue,
+       };
index 574f266ee4081da3e58f27c6987bf3c246d290d1..71efc8b5d3d8dbd149cee63a31a6eedf6787fd64 100644 (file)
@@ -51,32 +51,6 @@ static const Jim_Nvp nvp_jtag_tap_event[] = {
 
 extern jtag_interface_t *jtag_interface;
 
-/* jtag commands */
-static int handle_interface_list_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc);
-static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_rclk_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_nsrst_assert_width_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
-static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
-static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args);
-
-static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_verify_jtag_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_tms_sequence_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-
 enum jtag_tap_cfg_param {
        JCFG_EVENT
 };
@@ -604,59 +578,6 @@ void jtag_notify_event(enum jtag_event event)
 }
 
 
-int jtag_register_commands(struct command_context_s *cmd_ctx)
-{
-       register_jim(cmd_ctx, "jtag", jim_jtag_command, "perform jtag tap actions");
-
-       register_command(cmd_ctx, NULL, "interface", handle_interface_command,
-               COMMAND_CONFIG, "try to configure interface");
-       register_command(cmd_ctx, NULL,
-               "interface_list", &handle_interface_list_command,
-               COMMAND_ANY, "list all built-in interfaces");
-       register_command(cmd_ctx, NULL, "jtag_khz", handle_jtag_khz_command,
-               COMMAND_ANY, "set maximum jtag speed (if supported); "
-               "parameter is maximum khz, or 0 for adaptive clocking (RTCK).");
-       register_command(cmd_ctx, NULL, "jtag_rclk", handle_jtag_rclk_command,
-               COMMAND_ANY, "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed");
-       register_command(cmd_ctx, NULL, "reset_config", handle_reset_config_command,
-               COMMAND_ANY,
-               "reset_config "
-               "[none|trst_only|srst_only|trst_and_srst] "
-               "[srst_pulls_trst|trst_pulls_srst|combined|separate] "
-               "[srst_gates_jtag|srst_nogate] "
-               "[trst_push_pull|trst_open_drain] "
-               "[srst_push_pull|srst_open_drain]");
-       register_command(cmd_ctx, NULL, "jtag_nsrst_delay", handle_jtag_nsrst_delay_command,
-               COMMAND_ANY, "jtag_nsrst_delay <ms> - delay after deasserting srst in ms");
-       register_command(cmd_ctx, NULL, "jtag_ntrst_delay", handle_jtag_ntrst_delay_command,
-               COMMAND_ANY, "jtag_ntrst_delay <ms> - delay after deasserting trst in ms");
-       register_command(cmd_ctx, NULL, "jtag_nsrst_assert_width", handle_jtag_nsrst_assert_width_command,
-               COMMAND_ANY, "jtag_nsrst_assert_width <ms> - delay after asserting srst in ms");
-       register_command(cmd_ctx, NULL, "jtag_ntrst_assert_width", handle_jtag_ntrst_assert_width_command,
-               COMMAND_ANY, "jtag_ntrst_assert_width <ms> - delay after asserting trst in ms");
-
-       register_command(cmd_ctx, NULL, "scan_chain", handle_scan_chain_command,
-               COMMAND_EXEC, "print current scan chain configuration");
-
-       register_command(cmd_ctx, NULL, "jtag_reset", handle_jtag_reset_command,
-               COMMAND_EXEC, "toggle reset lines <trst> <srst>");
-       register_command(cmd_ctx, NULL, "runtest", handle_runtest_command,
-               COMMAND_EXEC, "move to Run-Test/Idle, and execute <num_cycles>");
-       register_command(cmd_ctx, NULL, "irscan", handle_irscan_command,
-               COMMAND_EXEC, "execute IR scan <device> <instr> [dev2] [instr2] ...");
-       register_jim(cmd_ctx, "drscan", Jim_Command_drscan, "execute DR scan <device> <num_bits> <value> <num_bits1> <value2> ...");
-       register_jim(cmd_ctx, "flush_count", Jim_Command_flush_count, "returns number of times the JTAG queue has been flushed");
-       register_jim(cmd_ctx, "pathmove", Jim_Command_pathmove, "move JTAG to state1 then to state2, state3, etc. <state1>,<state2>,<stat3>...");
-
-       register_command(cmd_ctx, NULL, "verify_ircapture", handle_verify_ircapture_command,
-               COMMAND_ANY, "verify value captured during Capture-IR <enable | disable>");
-       register_command(cmd_ctx, NULL, "verify_jtag", handle_verify_jtag_command,
-               COMMAND_ANY, "verify value capture <enable | disable>");
-       register_command(cmd_ctx, NULL, "tms_sequence", handle_tms_sequence_command,
-               COMMAND_ANY, "choose short(default) or long tms_sequence <short | long>");
-       return ERROR_OK;
-}
-
 static int default_khz(int khz, int *jtag_speed)
 {
        LOG_ERROR("Translation from khz to jtag_speed not implemented");
@@ -681,6 +602,22 @@ static int default_srst_asserted(int *srst_asserted)
        return ERROR_OK;
 }
 
+static int handle_interface_list_command(struct command_context_s *cmd_ctx,
+               char *cmd, char **args, int argc)
+{
+       if (strcmp(cmd, "interface_list") == 0 && argc > 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(cmd_ctx, "The following JTAG interfaces are available:");
+       for (unsigned i = 0; NULL != jtag_interfaces[i]; i++)
+       {
+               const char *name = jtag_interfaces[i]->name;
+               command_print(cmd_ctx, "%u: %s", i + 1, name);
+       }
+
+       return ERROR_OK;
+}
+
 static int handle_interface_command(struct command_context_s *cmd_ctx,
                char *cmd, char **args, int argc)
 {
@@ -726,22 +663,6 @@ static int handle_interface_command(struct command_context_s *cmd_ctx,
        return ERROR_JTAG_INVALID_INTERFACE;
 }
 
-static int handle_interface_list_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc)
-{
-       if (strcmp(cmd, "interface_list") == 0 && argc > 0)
-               return ERROR_COMMAND_SYNTAX_ERROR;
-
-       command_print(cmd_ctx, "The following JTAG interfaces are available:");
-       for (unsigned i = 0; NULL != jtag_interfaces[i]; i++)
-       {
-               const char *name = jtag_interfaces[i]->name;
-               command_print(cmd_ctx, "%u: %s", i + 1, name);
-       }
-
-       return ERROR_OK;
-}
-
 static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
        jtag_tap_t *tap;
@@ -1501,3 +1422,90 @@ static int handle_tms_sequence_command(struct command_context_s *cmd_ctx, char *
 
        return ERROR_OK;
 }
+
+int jtag_register_commands(struct command_context_s *cmd_ctx)
+{
+       register_jim(cmd_ctx, "jtag", jim_jtag_command,
+                       "perform jtag tap actions");
+
+       register_command(cmd_ctx, NULL, "interface",
+                       handle_interface_command, COMMAND_CONFIG,
+                       "try to configure interface");
+       register_command(cmd_ctx, NULL, "interface_list",
+                       &handle_interface_list_command, COMMAND_ANY,
+                       "list all built-in interfaces");
+
+       register_command(cmd_ctx, NULL, "jtag_khz",
+                       handle_jtag_khz_command, COMMAND_ANY,
+                       "set maximum jtag speed (if supported); "
+                       "parameter is maximum khz, or 0 for adaptive clocking (RTCK).");
+       register_command(cmd_ctx, NULL, "jtag_rclk",
+                       handle_jtag_rclk_command, COMMAND_ANY,
+                       "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed");
+       register_command(cmd_ctx, NULL, "reset_config",
+                       handle_reset_config_command, COMMAND_ANY,
+                       "reset_config "
+                       "[none|trst_only|srst_only|trst_and_srst] "
+                       "[srst_pulls_trst|trst_pulls_srst|combined|separate] "
+                       "[srst_gates_jtag|srst_nogate] "
+                       "[trst_push_pull|trst_open_drain] "
+                       "[srst_push_pull|srst_open_drain]");
+
+       register_command(cmd_ctx, NULL, "jtag_nsrst_delay",
+                       handle_jtag_nsrst_delay_command, COMMAND_ANY,
+                       "jtag_nsrst_delay <ms> "
+                       "- delay after deasserting srst in ms");
+       register_command(cmd_ctx, NULL, "jtag_ntrst_delay",
+                       handle_jtag_ntrst_delay_command, COMMAND_ANY,
+                       "jtag_ntrst_delay <ms> "
+                       "- delay after deasserting trst in ms");
+
+       register_command(cmd_ctx, NULL, "jtag_nsrst_assert_width",
+                       handle_jtag_nsrst_assert_width_command, COMMAND_ANY,
+                       "jtag_nsrst_assert_width <ms> "
+                       "- delay after asserting srst in ms");
+       register_command(cmd_ctx, NULL, "jtag_ntrst_assert_width",
+                       handle_jtag_ntrst_assert_width_command, COMMAND_ANY,
+                       "jtag_ntrst_assert_width <ms> "
+                       "- delay after asserting trst in ms");
+
+       register_command(cmd_ctx, NULL, "scan_chain",
+                       handle_scan_chain_command, COMMAND_EXEC,
+                       "print current scan chain configuration");
+
+       register_command(cmd_ctx, NULL, "jtag_reset",
+                       handle_jtag_reset_command, COMMAND_EXEC,
+                       "toggle reset lines <trst> <srst>");
+       register_command(cmd_ctx, NULL, "runtest",
+                       handle_runtest_command, COMMAND_EXEC,
+                       "move to Run-Test/Idle, and execute <num_cycles>");
+       register_command(cmd_ctx, NULL, "irscan",
+                       handle_irscan_command, COMMAND_EXEC,
+                       "execute IR scan <device> <instr> [dev2] [instr2] ...");
+
+       register_jim(cmd_ctx, "drscan", Jim_Command_drscan,
+                       "execute DR scan <device> "
+                       "<num_bits> <value> <num_bits1> <value2> ...");
+
+       register_jim(cmd_ctx, "flush_count", Jim_Command_flush_count,
+                       "returns number of times the JTAG queue has been flushed");
+
+       register_jim(cmd_ctx, "pathmove", Jim_Command_pathmove,
+                       "<state1>,<state2>,<state3>... "
+                       "- move JTAG to state1 then to state2, state3, etc.");
+
+       register_command(cmd_ctx, NULL, "verify_ircapture",
+                       handle_verify_ircapture_command, COMMAND_ANY,
+                       "verify value captured during Capture-IR <enable | disable>");
+       register_command(cmd_ctx, NULL, "verify_jtag",
+                       handle_verify_jtag_command, COMMAND_ANY,
+                       "verify value capture <enable | disable>");
+
+       register_command(cmd_ctx, NULL, "tms_sequence",
+                       handle_tms_sequence_command, COMMAND_ANY,
+                       "choose short(default) or long tms_sequence <short | long>");
+
+       return ERROR_OK;
+}
+
+
index 3c1a0462ae45213056e5d639dd151be404ee60de..b00846733aca245488e26e08a6bab47fd0ea0724 100644 (file)
@@ -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,
+       };