jtag/kitprog: switch to command 'adapter serial'

The driver kitprog defines the command 'kitprog_serial' to specify
the serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: I844cb815af01137392b6d12e1b5972fc77ac092d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6652
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2021-10-07 22:31:27 +02:00
parent b1afd3dba4
commit d7b2313b5a
4 changed files with 11 additions and 34 deletions

View File

@ -2371,9 +2371,9 @@ This command is only available if your libusb1 is at least version 1.0.16.
Specifies the @var{serial_string} of the adapter to use. Specifies the @var{serial_string} of the adapter to use.
If this command is not specified, serial strings are not checked. If this command is not specified, serial strings are not checked.
Only the following adapter drivers use the serial string from this command: Only the following adapter drivers use the serial string from this command:
cmsis_dap, ft232r, ftdi. cmsis_dap, ft232r, ftdi, kitprog.
The following adapters have their own command to specify the serial string: The following adapters have their own command to specify the serial string:
hla, jlink, kitprog, presto, st-link, vsllink, xds110. hla, jlink, presto, st-link, vsllink, xds110.
@end deffn @end deffn
@section Interface Drivers @section Interface Drivers
@ -2896,11 +2896,6 @@ Indicate that a PSoC acquisition sequence needs to be run during adapter init.
Please be aware that the acquisition sequence hard-resets the target. Please be aware that the acquisition sequence hard-resets the target.
@end deffn @end deffn
@deffn {Config Command} {kitprog_serial} serial
Select a KitProg device by its @var{serial}. If left unspecified, the first
device detected by OpenOCD will be used.
@end deffn
@deffn {Command} {kitprog acquire_psoc} @deffn {Command} {kitprog acquire_psoc}
Run a PSoC acquisition sequence immediately. Typically, this should not be used Run a PSoC acquisition sequence immediately. Typically, this should not be used
outside of the target-specific configuration scripts since it hard-resets the outside of the target-specific configuration scripts since it hard-resets the

View File

@ -39,6 +39,7 @@
#include <hidapi.h> #include <hidapi.h>
#include <jtag/adapter.h>
#include <jtag/interface.h> #include <jtag/interface.h>
#include <jtag/swd.h> #include <jtag/swd.h>
#include <jtag/commands.h> #include <jtag/commands.h>
@ -114,7 +115,6 @@ struct pending_transfer_result {
void *buffer; void *buffer;
}; };
static char *kitprog_serial;
static bool kitprog_init_acquire_psoc; static bool kitprog_init_acquire_psoc;
static int pending_transfer_count, pending_queue_len; static int pending_transfer_count, pending_queue_len;
@ -230,7 +230,6 @@ static int kitprog_quit(void)
free(kitprog_handle->packet_buffer); free(kitprog_handle->packet_buffer);
free(kitprog_handle->serial); free(kitprog_handle->serial);
free(kitprog_handle); free(kitprog_handle);
free(kitprog_serial);
free(pending_transfers); free(pending_transfers);
return ERROR_OK; return ERROR_OK;
@ -272,7 +271,7 @@ static int kitprog_usb_open(void)
const uint16_t vids[] = { VID, 0 }; const uint16_t vids[] = { VID, 0 };
const uint16_t pids[] = { PID, 0 }; const uint16_t pids[] = { PID, 0 };
if (jtag_libusb_open(vids, pids, kitprog_serial, if (jtag_libusb_open(vids, pids, adapter_get_required_serial(),
&kitprog_handle->usb_handle, NULL) != ERROR_OK) { &kitprog_handle->usb_handle, NULL) != ERROR_OK) {
LOG_ERROR("Failed to open or find the device"); LOG_ERROR("Failed to open or find the device");
return ERROR_FAIL; return ERROR_FAIL;
@ -851,22 +850,6 @@ COMMAND_HANDLER(kitprog_handle_acquire_psoc_command)
return retval; return retval;
} }
COMMAND_HANDLER(kitprog_handle_serial_command)
{
if (CMD_ARGC == 1) {
kitprog_serial = strdup(CMD_ARGV[0]);
if (!kitprog_serial) {
LOG_ERROR("Failed to allocate memory for the serial number");
return ERROR_FAIL;
}
} else {
LOG_ERROR("expected exactly one argument to kitprog_serial <serial-number>");
return ERROR_FAIL;
}
return ERROR_OK;
}
COMMAND_HANDLER(kitprog_handle_init_acquire_psoc_command) COMMAND_HANDLER(kitprog_handle_init_acquire_psoc_command)
{ {
kitprog_init_acquire_psoc = true; kitprog_init_acquire_psoc = true;
@ -900,13 +883,6 @@ static const struct command_registration kitprog_command_handlers[] = {
.usage = "<cmd>", .usage = "<cmd>",
.chain = kitprog_subcommand_handlers, .chain = kitprog_subcommand_handlers,
}, },
{
.name = "kitprog_serial",
.handler = &kitprog_handle_serial_command,
.mode = COMMAND_CONFIG,
.help = "set the serial number of the adapter",
.usage = "serial_string",
},
{ {
.name = "kitprog_init_acquire_psoc", .name = "kitprog_init_acquire_psoc",
.handler = &kitprog_handle_init_acquire_psoc_command, .handler = &kitprog_handle_init_acquire_psoc_command,

View File

@ -759,4 +759,10 @@ proc "ftdi serial" {args} {
eval adapter serial $args eval adapter serial $args
} }
lappend _telnet_autocomplete_skip kitprog_serial
proc kitprog_serial args {
echo "DEPRECATED! use 'adapter serial' not 'kitprog_serial'"
eval adapter serial $args
}
# END MIGRATION AIDS # END MIGRATION AIDS

View File

@ -9,4 +9,4 @@
adapter driver kitprog adapter driver kitprog
# Optionally specify the serial number of the KitProg you want to use. # Optionally specify the serial number of the KitProg you want to use.
#kitprog_serial 1926402735485200 # adapter serial 1926402735485200