#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
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 */
};
-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)
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;
OSVERSIONINFO version;
version.dwOSVersionInfoSize = sizeof version;
- if (!GetVersionEx(&version )) {
+ if (!GetVersionEx(&version)) {
errno = EINVAL;
return -1;
}
if (version.dwPlatformId != VER_PLATFORM_WIN32_NT)
return 0;
- h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
+ h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
errno = ENODEV;
return -1;
}
- CloseHandle(h );
+ CloseHandle(h);
return 0;
}
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
{
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)
{
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,
+ };