/* 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
{
int retval = ERROR_OK;
for (i = 0; i < argc; i += 2)
{
- retval = parse_u16(args[i], &ft2232_vid[i >> 1]);
- if (ERROR_OK != retval)
- break;
- retval = parse_u16(args[i + 1], &ft2232_pid[i >> 1]);
- if (ERROR_OK != retval)
- break;
+ COMMAND_PARSE_NUMBER(u16, args[i], ft2232_vid[i >> 1]);
+ COMMAND_PARSE_NUMBER(u16, args[i + 1], ft2232_pid[i >> 1]);
}
/*
/* only if the port wasn't overwritten by cmdline */
if (gw16012_port == 0)
{
- int retval = parse_u16(args[0], &gw16012_port);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(u16, args[0], gw16012_port);
}
else
{
/* only if the port wasn't overwritten by cmdline */
if (parport_port == 0)
{
- int retval = parse_u16(args[0], &parport_port);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(u16, args[0], parport_port);
}
else
{
if (argc == 1)
{
unsigned delay;
- int retval = parse_uint(args[0], &delay);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(uint, args[0], delay);
+
jtag_set_nsrst_delay(delay);
}
command_print(cmd_ctx, "jtag_nsrst_delay: %u", jtag_get_nsrst_delay());
if (argc == 1)
{
unsigned delay;
- int retval = parse_uint(args[0], &delay);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(uint, args[0], delay);
+
jtag_set_ntrst_delay(delay);
}
command_print(cmd_ctx, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
if (argc == 1)
{
unsigned delay;
- int retval = parse_uint(args[0], &delay);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(uint, args[0], delay);
+
jtag_set_nsrst_assert_width(delay);
}
command_print(cmd_ctx, "jtag_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
if (argc == 1)
{
unsigned delay;
- int retval = parse_uint(args[0], &delay);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(uint, args[0], delay);
+
jtag_set_ntrst_assert_width(delay);
}
command_print(cmd_ctx, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
LOG_DEBUG("handle jtag speed");
unsigned cur_speed = 0;
- int retval = parse_uint(args[0], &cur_speed);
- if (ERROR_OK != retval)
- return retval;
- retval = jtag_config_speed(cur_speed);
+ COMMAND_PARSE_NUMBER(uint, args[0], cur_speed);
+ retval = jtag_config_speed(cur_speed);
}
command_print(cmd_ctx, "jtag_speed: %d", jtag_get_speed());
if (argc == 1)
{
unsigned khz = 0;
- int retval = parse_uint(args[0], &khz);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(uint, args[0], khz);
+
retval = jtag_config_khz(khz);
if (ERROR_OK != retval)
return retval;
if (argc == 1)
{
unsigned khz = 0;
- int retval = parse_uint(args[0], &khz);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(uint, args[0], khz);
+
retval = jtag_config_rclk(khz);
if (ERROR_OK != retval)
return retval;
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num_clocks;
- int retval = parse_uint(args[0], &num_clocks);
- if (ERROR_OK != retval)
- return retval;
+ COMMAND_PARSE_NUMBER(uint, args[0], num_clocks);
jtag_add_runtest(num_clocks, TAP_IDLE);
return jtag_execute_queue();
return ERROR_OK;
}
- return parse_u16(args[0], &vsllink_usb_vid);
+ COMMAND_PARSE_NUMBER(u16, args[0], vsllink_usb_vid);
+ return ERROR_OK;
}
static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
LOG_ERROR("parameter error, should be one parameter for PID");
return ERROR_OK;
}
- return parse_u16(args[0], &vsllink_usb_pid);
+ COMMAND_PARSE_NUMBER(u16, args[0], vsllink_usb_pid);
+ return ERROR_OK;
}
static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
return ERROR_OK;
}
- int retval = parse_u8(args[0], &vsllink_usb_bulkin);
- if (ERROR_OK == retval)
- vsllink_usb_bulkin |= 0x80;
+ COMMAND_PARSE_NUMBER(u8, args[0], vsllink_usb_bulkin);
- return retval;
+ vsllink_usb_bulkin |= 0x80;
+
+ return ERROR_OK;
}
static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
return ERROR_OK;
}
- int retval = parse_u8(args[0], &vsllink_usb_bulkout);
- if (ERROR_OK == retval)
- vsllink_usb_bulkout &= ~0x80;
+ COMMAND_PARSE_NUMBER(u8, args[0], vsllink_usb_bulkin);
- return retval;
+ vsllink_usb_bulkout &= ~0x80;
+
+ return ERROR_OK;
}
static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
return ERROR_OK;
}
- return parse_u8(args[0], &vsllink_usb_interface);
+ COMMAND_PARSE_NUMBER(u8, args[0], vsllink_usb_interface);
+ return ERROR_OK;
}
/***************************************************************************/