Improve jtag command argument parsing.
This commit is contained in:
@@ -1407,7 +1407,8 @@ static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, cha
|
||||
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)
|
||||
@@ -1417,7 +1418,8 @@ static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, cha
|
||||
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)
|
||||
@@ -1428,11 +1430,11 @@ static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx,
|
||||
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)
|
||||
@@ -1443,11 +1445,11 @@ static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx,
|
||||
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)
|
||||
@@ -1458,7 +1460,8 @@ static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ct
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
return parse_u8(args[0], &vsllink_usb_interface);
|
||||
COMMAND_PARSE_NUMBER(u8, args[0], vsllink_usb_interface);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user