jtag_command_t -> struct jtag_command
[fw/openocd] / src / jtag / amt_jtagaccel.c
index e3f440cce83fc6ba9fa99bed292c963a62e3401a..87d9cd3c2fca310a62be72de272dab124f09e88a 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)
@@ -320,7 +289,7 @@ static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffe
 
 static int amt_jtagaccel_execute_queue(void)
 {
-       jtag_command_t *cmd = jtag_command_queue; /* currently processed command */
+       struct jtag_command *cmd = jtag_command_queue; /* currently processed command */
        int scan_size;
        enum scan_type type;
        uint8_t *buffer;
@@ -526,8 +495,7 @@ static int amt_jtagaccel_quit(void)
        return ERROR_OK;
 }
 
-static int amt_jtagaccel_handle_parport_port_command(
-               struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+COMMAND_HANDLER(amt_jtagaccel_handle_parport_port_command)
 {
        if (argc == 1)
        {
@@ -550,7 +518,7 @@ static int amt_jtagaccel_handle_parport_port_command(
        return ERROR_OK;
 }
 
-static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command)
 {
        if (argc == 0)
        {
@@ -571,3 +539,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;
+}
+
+struct jtag_interface 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,
+       };