jtag/drivers: Add vid_pid command to OpenJTAG

Enable support for USB vid and pid combinations other than 0x0403/0x6001
on OpenJTAG adapters.

Change-Id: Ibb5fb14a6f33abbc011dbf3179df20d79ed74a7a
Signed-off-by: N S <nlshipp@yahoo.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8100
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
N S 2024-01-21 17:45:06 -08:00 committed by Antonio Borneo
parent 79f519bb63
commit 3b5ef1726a
2 changed files with 27 additions and 0 deletions

View File

@ -3445,6 +3445,15 @@ Currently valid @var{variant} values include:
The USB device description string of the adapter.
This value is only used with the standard variant.
@end deffn
@deffn {Config Command} {openjtag vid_pid} vid pid
The USB vendor ID and product ID of the adapter. If not specified, default
0x0403:0x6001 is used.
This value is only used with the standard variant.
@example
openjtag vid_pid 0x403 0x6014
@end example
@end deffn
@end deffn

View File

@ -861,6 +861,17 @@ COMMAND_HANDLER(openjtag_handle_variant_command)
return ERROR_OK;
}
COMMAND_HANDLER(openjtag_handle_vid_pid_command)
{
if (CMD_ARGC != 2)
return ERROR_COMMAND_SYNTAX_ERROR;
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], openjtag_vid);
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[1], openjtag_pid);
return ERROR_OK;
}
static const struct command_registration openjtag_subcommand_handlers[] = {
{
.name = "device_desc",
@ -876,6 +887,13 @@ static const struct command_registration openjtag_subcommand_handlers[] = {
.help = "set the OpenJTAG variant",
.usage = "variant-string",
},
{
.name = "vid_pid",
.handler = openjtag_handle_vid_pid_command,
.mode = COMMAND_CONFIG,
.help = "USB VID and PID of the adapter",
.usage = "vid pid",
},
COMMAND_REGISTRATION_DONE
};