diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2021-10-07 19:42:54 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-11-28 10:55:49 +0000 |
commit | 248161cbf47af9f7fc8c00b5efa79a1ff8e65848 (patch) | |
tree | edea7cc086b97fb56777c2dd8a416e8478e6b53c /src/jtag | |
parent | a3b69dee622066d3a2b70c32775818d82b5ffb54 (diff) | |
download | riscv-openocd-248161cbf47af9f7fc8c00b5efa79a1ff8e65848.zip riscv-openocd-248161cbf47af9f7fc8c00b5efa79a1ff8e65848.tar.gz riscv-openocd-248161cbf47af9f7fc8c00b5efa79a1ff8e65848.tar.bz2 |
jtag/cmsis_dap: switch to command 'adapter serial'
The driver cmsis_dap defines the command 'cmsis_dap_serial' to
specify the serial string of the adapter.
Remove and deprecate the driver command, and use 'adapter serial'.
Change-Id: I88e2d4de360a6c6f23529bb18494962a267250df
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6649
Tested-by: jenkins
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/drivers/cmsis_dap.c | 24 | ||||
-rw-r--r-- | src/jtag/drivers/cmsis_dap.h | 2 | ||||
-rw-r--r-- | src/jtag/drivers/cmsis_dap_usb_bulk.c | 2 | ||||
-rw-r--r-- | src/jtag/drivers/cmsis_dap_usb_hid.c | 2 | ||||
-rw-r--r-- | src/jtag/startup.tcl | 6 |
5 files changed, 11 insertions, 25 deletions
diff --git a/src/jtag/drivers/cmsis_dap.c b/src/jtag/drivers/cmsis_dap.c index c0898fc..e7562d0 100644 --- a/src/jtag/drivers/cmsis_dap.c +++ b/src/jtag/drivers/cmsis_dap.c @@ -76,7 +76,6 @@ static const struct cmsis_dap_backend *const cmsis_dap_backends[] = { /* vid = pid = 0 marks the end of the list */ static uint16_t cmsis_dap_vid[MAX_USB_IDS + 1] = { 0 }; static uint16_t cmsis_dap_pid[MAX_USB_IDS + 1] = { 0 }; -static char *cmsis_dap_serial; static int cmsis_dap_backend = -1; static bool swd_mode; @@ -289,13 +288,13 @@ static int cmsis_dap_open(void) if (cmsis_dap_backend >= 0) { /* Use forced backend */ backend = cmsis_dap_backends[cmsis_dap_backend]; - if (backend->open(dap, cmsis_dap_vid, cmsis_dap_pid, cmsis_dap_serial) != ERROR_OK) + if (backend->open(dap, cmsis_dap_vid, cmsis_dap_pid, adapter_get_required_serial()) != ERROR_OK) backend = NULL; } else { /* Try all backends */ for (unsigned int i = 0; i < ARRAY_SIZE(cmsis_dap_backends); i++) { backend = cmsis_dap_backends[i]; - if (backend->open(dap, cmsis_dap_vid, cmsis_dap_pid, cmsis_dap_serial) == ERROR_OK) + if (backend->open(dap, cmsis_dap_vid, cmsis_dap_pid, adapter_get_required_serial()) == ERROR_OK) break; else backend = NULL; @@ -325,8 +324,6 @@ static void cmsis_dap_close(struct cmsis_dap *dap) free(cmsis_dap_handle->packet_buffer); free(cmsis_dap_handle); cmsis_dap_handle = NULL; - free(cmsis_dap_serial); - cmsis_dap_serial = NULL; for (int i = 0; i < MAX_PENDING_REQUESTS; i++) { free(pending_fifo[i].transfers); @@ -2056,16 +2053,6 @@ COMMAND_HANDLER(cmsis_dap_handle_vid_pid_command) return ERROR_OK; } -COMMAND_HANDLER(cmsis_dap_handle_serial_command) -{ - if (CMD_ARGC == 1) - cmsis_dap_serial = strdup(CMD_ARGV[0]); - else - LOG_ERROR("expected exactly one argument to cmsis_dap_serial <serial-number>"); - - return ERROR_OK; -} - COMMAND_HANDLER(cmsis_dap_handle_backend_command) { if (CMD_ARGC == 1) { @@ -2123,13 +2110,6 @@ static const struct command_registration cmsis_dap_command_handlers[] = { .usage = "(vid pid)*", }, { - .name = "cmsis_dap_serial", - .handler = &cmsis_dap_handle_serial_command, - .mode = COMMAND_CONFIG, - .help = "set the serial number of the adapter", - .usage = "serial_string", - }, - { .name = "cmsis_dap_backend", .handler = &cmsis_dap_handle_backend_command, .mode = COMMAND_CONFIG, diff --git a/src/jtag/drivers/cmsis_dap.h b/src/jtag/drivers/cmsis_dap.h index f6d9df2..7c64d49 100644 --- a/src/jtag/drivers/cmsis_dap.h +++ b/src/jtag/drivers/cmsis_dap.h @@ -24,7 +24,7 @@ struct cmsis_dap { struct cmsis_dap_backend { const char *name; - int (*open)(struct cmsis_dap *dap, uint16_t vids[], uint16_t pids[], char *serial); + int (*open)(struct cmsis_dap *dap, uint16_t vids[], uint16_t pids[], const char *serial); void (*close)(struct cmsis_dap *dap); int (*read)(struct cmsis_dap *dap, int timeout_ms); int (*write)(struct cmsis_dap *dap, int len, int timeout_ms); diff --git a/src/jtag/drivers/cmsis_dap_usb_bulk.c b/src/jtag/drivers/cmsis_dap_usb_bulk.c index 26c6784..819596b 100644 --- a/src/jtag/drivers/cmsis_dap_usb_bulk.c +++ b/src/jtag/drivers/cmsis_dap_usb_bulk.c @@ -55,7 +55,7 @@ static int cmsis_dap_usb_interface = -1; static void cmsis_dap_usb_close(struct cmsis_dap *dap); static int cmsis_dap_usb_alloc(struct cmsis_dap *dap, unsigned int pkt_sz); -static int cmsis_dap_usb_open(struct cmsis_dap *dap, uint16_t vids[], uint16_t pids[], char *serial) +static int cmsis_dap_usb_open(struct cmsis_dap *dap, uint16_t vids[], uint16_t pids[], const char *serial) { int err; struct libusb_context *ctx; diff --git a/src/jtag/drivers/cmsis_dap_usb_hid.c b/src/jtag/drivers/cmsis_dap_usb_hid.c index 5bb8ee8..912ba39 100644 --- a/src/jtag/drivers/cmsis_dap_usb_hid.c +++ b/src/jtag/drivers/cmsis_dap_usb_hid.c @@ -48,7 +48,7 @@ struct cmsis_dap_backend_data { static void cmsis_dap_hid_close(struct cmsis_dap *dap); static int cmsis_dap_hid_alloc(struct cmsis_dap *dap, unsigned int pkt_sz); -static int cmsis_dap_hid_open(struct cmsis_dap *dap, uint16_t vids[], uint16_t pids[], char *serial) +static int cmsis_dap_hid_open(struct cmsis_dap *dap, uint16_t vids[], uint16_t pids[], const char *serial) { hid_device *dev = NULL; int i; diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl index b6c185e..94030db 100644 --- a/src/jtag/startup.tcl +++ b/src/jtag/startup.tcl @@ -741,4 +741,10 @@ proc "aice serial" {args} { eval adapter serial $args } +lappend _telnet_autocomplete_skip cmsis_dap_serial +proc cmsis_dap_serial args { + echo "DEPRECATED! use 'adapter serial' not 'cmsis_dap_serial'" + eval adapter serial $args +} + # END MIGRATION AIDS |