X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fjtag%2Famt_jtagaccel.c;h=a34387f8b43df0db78ea98dfc676cbe3e6da010e;hb=cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e;hp=6c39d88e88053e93a2193bf58b2f0794ef9c0885;hpb=dc575dc5bf8cb597a0e9a47794744ae6b1928087;p=fw%2Fopenocd diff --git a/src/jtag/amt_jtagaccel.c b/src/jtag/amt_jtagaccel.c index 6c39d88e8..a34387f8b 100644 --- a/src/jtag/amt_jtagaccel.c +++ b/src/jtag/amt_jtagaccel.c @@ -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 @@ -92,8 +83,8 @@ static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, static uint8_t amt_jtagaccel_tap_move[6][6][2] = { /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ - {{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* RESET */ - {{0x1f, 0x00}, {0x00, 0x00}, {0x85, 0x08}, {0x05, 0x00}, {0x8b, 0x08}, {0x0b, 0x00}}, /* IDLE */ + {{0x1f, 0x00}, {0x0f, 0x00}, {0x05, 0x00}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* RESET */ + {{0x1f, 0x00}, {0x00, 0x00}, {0x04, 0x00}, {0x05, 0x00}, {0x06, 0x00}, {0x0b, 0x00}}, /* IDLE */ {{0x1f, 0x00}, {0x0d, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* DRSHIFT */ {{0x1f, 0x00}, {0x0c, 0x00}, {0x08, 0x00}, {0x00, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* DRPAUSE */ {{0x1f, 0x00}, {0x0d, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x00, 0x00}, {0x01, 0x00}}, /* IRSHIFT */ @@ -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) @@ -374,7 +343,7 @@ static int amt_jtagaccel_execute_queue(void) break; case JTAG_SLEEP: #ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("sleep %i", cmd->cmd.sleep->us); + LOG_DEBUG("sleep %" PRIi32, cmd->cmd.sleep->us); #endif jtag_sleep(cmd->cmd.sleep->us); break; @@ -526,17 +495,16 @@ 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) { /* only if the port wasn't overwritten by cmdline */ if (amt_jtagaccel_port == 0) { - int retval = parse_u16(args[0], &amt_jtagaccel_port); - if (ERROR_OK != retval) - return retval; + uint16_t port; + COMMAND_PARSE_NUMBER(u16, args[0], port); + amt_jtagaccel_port = port; } else { @@ -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; +} + +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, + };