summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2011-02-28 20:40:47 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-03-02 19:04:16 +0100
commit0eed61b7c4cb31338562db426cea0d1a999e0d9f (patch)
tree76d3765ff711e38f6ca4a5f1c08924e3b5b86f29
parentb992dd58f1bef87c35e942efef6070915dc74a37 (diff)
downloadopenocd_libswd-0eed61b7c4cb31338562db426cea0d1a999e0d9f.tar.gz
openocd_libswd-0eed61b7c4cb31338562db426cea0d1a999e0d9f.tar.bz2
openocd_libswd-0eed61b7c4cb31338562db426cea0d1a999e0d9f.tar.xz
openocd_libswd-0eed61b7c4cb31338562db426cea0d1a999e0d9f.zip
jlink: add jlink_pid to specify the pid to use
this will allow us to use multiple jlink at the same time as when the USB-Address is specified the PID change from 0x0101 to (0x101 + usb_adress) Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
-rw-r--r--doc/openocd.texi2
-rw-r--r--src/jtag/drivers/jlink.c27
2 files changed, 27 insertions, 2 deletions
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 5b123860..353daa4f 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2323,6 +2323,8 @@ Segger jlink USB adapter
@c dumps status
@c command: jlink hw_jtag (2|3)
@c sets version 2 or 3
+@c command: jlink pid
+@c set the pid of the interface we want to use
@end deffn
@deffn {Interface Driver} {parport}
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index 8a2c5ab3..faecab2d 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -136,6 +136,10 @@ static enum tap_state jlink_last_state = TAP_RESET;
static struct jlink* jlink_handle;
+/* pid could be specified at runtime */
+static uint16_t vids[] = { VID, 0 };
+static uint16_t pids[] = { PID, 0 };
+
/***************************************************************************/
/* External interface implementation */
@@ -621,6 +625,21 @@ static int jlink_get_version_info(void)
return ERROR_OK;
}
+COMMAND_HANDLER(jlink_pid_command)
+{
+ if (CMD_ARGC != 1)
+ {
+ LOG_ERROR("Need exactly one argument to jlink_pid");
+ return ERROR_FAIL;
+ }
+
+ pids[0] = strtoul(CMD_ARGV[0], NULL, 16);
+ pids[1] = 0;
+ vids[1] = 0;
+
+ return ERROR_OK;
+}
+
COMMAND_HANDLER(jlink_handle_jlink_info_command)
{
if (jlink_get_version_info() == ERROR_OK)
@@ -670,6 +689,12 @@ static const struct command_registration jlink_subcommand_handlers[] = {
.help = "access J-Link HW JTAG command version",
.usage = "[2|3]",
},
+ {
+ .name = "pid",
+ .handler = &jlink_pid_command,
+ .mode = COMMAND_CONFIG,
+ .help = "set the pid of the interface we want to use",
+ },
COMMAND_REGISTRATION_DONE
};
@@ -871,8 +896,6 @@ static struct jlink* jlink_usb_open()
{
usb_init();
- const uint16_t vids[] = { VID, 0 };
- const uint16_t pids[] = { PID, 0 };
struct usb_dev_handle *dev;
if (jtag_usb_open(vids, pids, &dev) != ERROR_OK)
return NULL;