Merge branch 'master' into update
Change-Id: Icec244b174cc0c67ab58961649a369db7f344824
This commit is contained in:
@@ -958,11 +958,14 @@ static int cmsis_dap_init(void)
|
||||
retval = cmsis_dap_cmd_DAP_TFER_Configure(0, 64, 0);
|
||||
if (retval != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
/* Data Phase (bit 2) must be set to 1 if sticky overrun
|
||||
* detection is enabled */
|
||||
retval = cmsis_dap_cmd_DAP_SWD_Configure(0); /* 1 TRN, no Data Phase */
|
||||
if (retval != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
|
||||
if (swd_mode) {
|
||||
/* Data Phase (bit 2) must be set to 1 if sticky overrun
|
||||
* detection is enabled */
|
||||
retval = cmsis_dap_cmd_DAP_SWD_Configure(0); /* 1 TRN, no Data Phase */
|
||||
if (retval != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
retval = cmsis_dap_cmd_DAP_LED(0x03); /* Both LEDs on */
|
||||
if (retval != ERROR_OK)
|
||||
|
||||
@@ -855,6 +855,7 @@ COMMAND_HANDLER(ftdi_handle_set_signal_command)
|
||||
ftdi_set_signal(sig, *CMD_ARGV[1]);
|
||||
break;
|
||||
}
|
||||
/* fallthrough */
|
||||
default:
|
||||
LOG_ERROR("unknown signal level '%s', use 0, 1 or z", CMD_ARGV[1]);
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
@@ -1217,14 +1218,17 @@ static int ftdi_swd_switch_seq(enum swd_special_seq seq)
|
||||
switch (seq) {
|
||||
case LINE_RESET:
|
||||
LOG_DEBUG("SWD line reset");
|
||||
ftdi_swd_swdio_en(true);
|
||||
mpsse_clock_data_out(mpsse_ctx, swd_seq_line_reset, 0, swd_seq_line_reset_len, SWD_MODE);
|
||||
break;
|
||||
case JTAG_TO_SWD:
|
||||
LOG_DEBUG("JTAG-to-SWD");
|
||||
ftdi_swd_swdio_en(true);
|
||||
mpsse_clock_data_out(mpsse_ctx, swd_seq_jtag_to_swd, 0, swd_seq_jtag_to_swd_len, SWD_MODE);
|
||||
break;
|
||||
case SWD_TO_JTAG:
|
||||
LOG_DEBUG("SWD-to-JTAG");
|
||||
ftdi_swd_swdio_en(true);
|
||||
mpsse_clock_data_out(mpsse_ctx, swd_seq_swd_to_jtag, 0, swd_seq_swd_to_jtag_len, SWD_MODE);
|
||||
break;
|
||||
default:
|
||||
|
||||
+62
-48
@@ -322,7 +322,7 @@ static int jlink_speed(int speed)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_speeds() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_JTAG_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ static int jlink_speed(int speed)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_set_speed() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_JTAG_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ static bool read_device_config(struct device_config *cfg)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_read_raw_config() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ static int select_interface(void)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_available_interfaces() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ static int select_interface(void)
|
||||
|
||||
if (ret < 0) {
|
||||
LOG_ERROR("jaylink_select_interface() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
@@ -442,8 +442,7 @@ static int jlink_register(void)
|
||||
ret = jaylink_register(devh, &conn, connlist, &count);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_register() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_register() failed: %s.", jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -482,7 +481,7 @@ static bool adjust_swd_buffer_size(void)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_free_memory() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -523,6 +522,9 @@ static int jaylink_log_handler(const struct jaylink_context *ctx,
|
||||
case JAYLINK_LOG_LEVEL_DEBUG:
|
||||
tmp = LOG_LVL_DEBUG;
|
||||
break;
|
||||
case JAYLINK_LOG_LEVEL_DEBUG_IO:
|
||||
tmp = LOG_LVL_DEBUG_IO;
|
||||
break;
|
||||
default:
|
||||
tmp = LOG_LVL_WARNING;
|
||||
}
|
||||
@@ -544,15 +546,21 @@ static int jlink_init(void)
|
||||
struct jaylink_hardware_status hwstatus;
|
||||
enum jaylink_usb_address address;
|
||||
size_t length;
|
||||
size_t num_devices;
|
||||
uint32_t host_interfaces;
|
||||
|
||||
LOG_DEBUG("Using libjaylink %s (compiled with %s).",
|
||||
jaylink_version_package_get_string(), JAYLINK_VERSION_PACKAGE_STRING);
|
||||
|
||||
if (!jaylink_library_has_cap(JAYLINK_CAP_HIF_USB) && use_usb_address) {
|
||||
LOG_ERROR("J-Link driver does not support USB devices.");
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
ret = jaylink_init(&jayctx);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_init() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_init() failed: %s.", jaylink_strerror(ret));
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
@@ -560,34 +568,42 @@ static int jlink_init(void)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_log_set_callback() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
ret = jaylink_discovery_scan(jayctx, 0);
|
||||
host_interfaces = JAYLINK_HIF_USB;
|
||||
|
||||
if (use_serial_number)
|
||||
host_interfaces |= JAYLINK_HIF_TCP;
|
||||
|
||||
ret = jaylink_discovery_scan(jayctx, host_interfaces);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_discovery_scan() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
ret = jaylink_get_devices(jayctx, &devs, NULL);
|
||||
ret = jaylink_get_devices(jayctx, &devs, &num_devices);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_devices() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_get_devices() failed: %s.", jaylink_strerror(ret));
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
if (!use_serial_number && !use_usb_address && num_devices > 1) {
|
||||
LOG_ERROR("Multiple devices found, specify the desired device.");
|
||||
jaylink_free_devices(devs, true);
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
found_device = false;
|
||||
|
||||
if (!use_serial_number && !use_usb_address)
|
||||
LOG_INFO("No device selected, using first device.");
|
||||
|
||||
for (i = 0; devs[i]; i++) {
|
||||
if (use_serial_number) {
|
||||
ret = jaylink_device_get_serial_number(devs[i], &tmp);
|
||||
@@ -596,7 +612,7 @@ static int jlink_init(void)
|
||||
continue;
|
||||
} else if (ret != JAYLINK_OK) {
|
||||
LOG_WARNING("jaylink_device_get_serial_number() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -607,9 +623,11 @@ static int jlink_init(void)
|
||||
if (use_usb_address) {
|
||||
ret = jaylink_device_get_usb_address(devs[i], &address);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
if (ret == JAYLINK_ERR_NOT_SUPPORTED) {
|
||||
continue;
|
||||
} else if (ret != JAYLINK_OK) {
|
||||
LOG_WARNING("jaylink_device_get_usb_address() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -624,7 +642,7 @@ static int jlink_init(void)
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_ERROR("Failed to open device: %s.", jaylink_strerror_name(ret));
|
||||
LOG_ERROR("Failed to open device: %s.", jaylink_strerror(ret));
|
||||
}
|
||||
|
||||
jaylink_free_devices(devs, true);
|
||||
@@ -644,7 +662,7 @@ static int jlink_init(void)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_firmware_version() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
jaylink_close(devh);
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
@@ -659,7 +677,7 @@ static int jlink_init(void)
|
||||
ret = jaylink_get_caps(devh, caps);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_caps() failed: %s.", jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_get_caps() failed: %s.", jaylink_strerror(ret));
|
||||
jaylink_close(devh);
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
@@ -670,7 +688,7 @@ static int jlink_init(void)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_extended_caps() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
jaylink_close(devh);
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
@@ -684,7 +702,7 @@ static int jlink_init(void)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("Failed to retrieve hardware version: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
jaylink_close(devh);
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
@@ -725,7 +743,7 @@ static int jlink_init(void)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_hardware_status() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
jaylink_close(devh);
|
||||
jaylink_exit(jayctx);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
@@ -786,8 +804,7 @@ static int jlink_quit(void)
|
||||
ret = jaylink_swo_stop(devh);
|
||||
|
||||
if (ret != JAYLINK_OK)
|
||||
LOG_ERROR("jaylink_swo_stop() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_swo_stop() failed: %s.", jaylink_strerror(ret));
|
||||
}
|
||||
|
||||
if (jaylink_has_cap(caps, JAYLINK_DEV_CAP_REGISTER)) {
|
||||
@@ -795,7 +812,7 @@ static int jlink_quit(void)
|
||||
|
||||
if (ret != JAYLINK_OK)
|
||||
LOG_ERROR("jaylink_unregister() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
}
|
||||
|
||||
jaylink_close(devh);
|
||||
@@ -944,7 +961,7 @@ COMMAND_HANDLER(jlink_serial_command)
|
||||
return ERROR_FAIL;
|
||||
} else if (ret != JAYLINK_OK) {
|
||||
command_print(CMD_CTX, "jaylink_parse_serial_number() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -963,7 +980,7 @@ COMMAND_HANDLER(jlink_handle_hwstatus_command)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
command_print(CMD_CTX, "jaylink_get_hardware_status() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -995,7 +1012,7 @@ COMMAND_HANDLER(jlink_handle_free_memory_command)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
command_print(CMD_CTX, "jaylink_get_free_memory() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1077,7 +1094,7 @@ COMMAND_HANDLER(jlink_handle_target_power_command)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
command_print(CMD_CTX, "jaylink_set_target_power() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1183,7 +1200,7 @@ static int poll_trace(uint8_t *buf, size_t *size)
|
||||
ret = jaylink_swo_read(devh, buf, &length);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_swo_read() failed: %s.", jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_swo_read() failed: %s.", jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1204,7 +1221,7 @@ static uint32_t calculate_trace_buffer_size(void)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_get_free_memory() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1268,7 +1285,7 @@ static int config_trace(bool enabled, enum tpio_pin_protocol pin_protocol,
|
||||
ret = jaylink_swo_stop(devh);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_swo_stop() failed: %s.", jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_swo_stop() failed: %s.", jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1294,7 +1311,7 @@ static int config_trace(bool enabled, enum tpio_pin_protocol pin_protocol,
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_swo_get_speeds() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1310,8 +1327,7 @@ static int config_trace(bool enabled, enum tpio_pin_protocol pin_protocol,
|
||||
buffer_size);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_start_swo() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_start_swo() failed: %s.", jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1570,7 +1586,7 @@ COMMAND_HANDLER(jlink_handle_config_write_command)
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_write_raw_config() failed: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1655,8 +1671,7 @@ COMMAND_HANDLER(jlink_handle_emucom_write_command)
|
||||
LOG_ERROR("Channel not supported by the device.");
|
||||
return ERROR_FAIL;
|
||||
} else if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("Failed to write to channel: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
LOG_ERROR("Failed to write to channel: %s.", jaylink_strerror(ret));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -1704,8 +1719,7 @@ COMMAND_HANDLER(jlink_handle_emucom_read_command)
|
||||
free(buf);
|
||||
return ERROR_FAIL;
|
||||
} else if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("Failed to read from channel: %s.",
|
||||
jaylink_strerror_name(ret));
|
||||
LOG_ERROR("Failed to read from channel: %s.", jaylink_strerror(ret));
|
||||
free(buf);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
@@ -1972,7 +1986,7 @@ static int jlink_flush(void)
|
||||
tap_length, jtag_command_version);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_jtag_io() failed: %s.", jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_jtag_io() failed: %s.", jaylink_strerror(ret));
|
||||
jlink_tap_init();
|
||||
return ERROR_JTAG_QUEUE_FAILED;
|
||||
}
|
||||
@@ -2078,7 +2092,7 @@ static int jlink_swd_run_queue(void)
|
||||
ret = jaylink_swd_io(devh, tms_buffer, tdi_buffer, tdo_buffer, tap_length);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
LOG_ERROR("jaylink_swd_io() failed: %s.", jaylink_strerror_name(ret));
|
||||
LOG_ERROR("jaylink_swd_io() failed: %s.", jaylink_strerror(ret));
|
||||
goto skip;
|
||||
}
|
||||
|
||||
|
||||
@@ -657,6 +657,7 @@ static int kitprog_swd_switch_seq(enum swd_special_seq seq)
|
||||
LOG_DEBUG("JTAG to SWD not supported");
|
||||
/* Fall through to fix target reset issue */
|
||||
}
|
||||
/* fallthrough */
|
||||
case LINE_RESET:
|
||||
LOG_DEBUG("SWD line reset");
|
||||
if (kitprog_swd_seq(SEQUENCE_LINE_RESET) != ERROR_OK)
|
||||
|
||||
Submodule src/jtag/drivers/libjaylink updated: 699b7001d3...8645845c1a
@@ -1650,13 +1650,11 @@ static int stlink_usb_open(struct hl_interface_param_s *param, void **fd)
|
||||
|
||||
h->transport = param->transport;
|
||||
|
||||
const uint16_t vids[] = { param->vid, 0 };
|
||||
const uint16_t pids[] = { param->pid, 0 };
|
||||
const char *serial = param->serial;
|
||||
|
||||
LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s",
|
||||
param->transport, param->vid, param->pid,
|
||||
param->serial ? param->serial : "");
|
||||
for (unsigned i = 0; param->vid[i]; i++) {
|
||||
LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s",
|
||||
param->transport, param->vid[i], param->pid[i],
|
||||
param->serial ? param->serial : "");
|
||||
}
|
||||
|
||||
/*
|
||||
On certain host USB configurations(e.g. MacBook Air)
|
||||
@@ -1668,7 +1666,7 @@ static int stlink_usb_open(struct hl_interface_param_s *param, void **fd)
|
||||
in order to become operational.
|
||||
*/
|
||||
do {
|
||||
if (jtag_libusb_open(vids, pids, serial, &h->fd) != ERROR_OK) {
|
||||
if (jtag_libusb_open(param->vid, param->pid, param->serial, &h->fd) != ERROR_OK) {
|
||||
LOG_ERROR("open failed");
|
||||
goto error_open;
|
||||
}
|
||||
@@ -1683,8 +1681,14 @@ static int stlink_usb_open(struct hl_interface_param_s *param, void **fd)
|
||||
/* RX EP is common for all versions */
|
||||
h->rx_ep = STLINK_RX_EP;
|
||||
|
||||
uint16_t pid;
|
||||
if (jtag_libusb_get_pid(jtag_libusb_get_device(h->fd), &pid) != ERROR_OK) {
|
||||
LOG_DEBUG("libusb_get_pid failed");
|
||||
goto error_open;
|
||||
}
|
||||
|
||||
/* wrap version for first read */
|
||||
switch (param->pid) {
|
||||
switch (pid) {
|
||||
case STLINK_V1_PID:
|
||||
h->version.stlink = 1;
|
||||
h->tx_ep = STLINK_TX_EP;
|
||||
@@ -1736,12 +1740,6 @@ static int stlink_usb_open(struct hl_interface_param_s *param, void **fd)
|
||||
}
|
||||
} while (1);
|
||||
|
||||
/* compare usb vid/pid */
|
||||
if ((param->vid != h->vid) || (param->pid != h->pid))
|
||||
LOG_INFO("vid/pid are not identical: 0x%04X/0x%04X 0x%04X/0x%04X",
|
||||
param->vid, param->pid,
|
||||
h->vid, h->pid);
|
||||
|
||||
/* check if mode is supported */
|
||||
err = ERROR_OK;
|
||||
|
||||
|
||||
@@ -688,14 +688,18 @@ static int icdi_usb_open(struct hl_interface_param_s *param, void **fd)
|
||||
}
|
||||
|
||||
LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x", param->transport,
|
||||
param->vid, param->pid);
|
||||
param->vid[0], param->pid[0]);
|
||||
|
||||
/* TODO: convert libusb_ calls to jtag_libusb_ */
|
||||
if (param->vid[1])
|
||||
LOG_WARNING("Bad configuration: 'hla_vid_pid' command does not accept more than one VID PID pair on ti-icdi!");
|
||||
|
||||
if (libusb_init(&h->usb_ctx) != 0) {
|
||||
LOG_ERROR("libusb init failed");
|
||||
goto error_open;
|
||||
}
|
||||
|
||||
h->usb_dev = libusb_open_device_with_vid_pid(h->usb_ctx, param->vid, param->pid);
|
||||
h->usb_dev = libusb_open_device_with_vid_pid(h->usb_ctx, param->vid[0], param->pid[0]);
|
||||
if (!h->usb_dev) {
|
||||
LOG_ERROR("open failed");
|
||||
goto error_open;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <target/target.h>
|
||||
|
||||
static struct hl_interface_s hl_if = { {0, 0, 0, 0, 0, HL_TRANSPORT_UNKNOWN, false, -1}, 0, 0 };
|
||||
static struct hl_interface_s hl_if = { {0, 0, { 0 }, { 0 }, 0, HL_TRANSPORT_UNKNOWN, false, -1}, 0, 0 };
|
||||
|
||||
int hl_interface_open(enum hl_transports tr)
|
||||
{
|
||||
@@ -264,15 +264,27 @@ COMMAND_HANDLER(hl_interface_handle_layout_command)
|
||||
|
||||
COMMAND_HANDLER(hl_interface_handle_vid_pid_command)
|
||||
{
|
||||
LOG_DEBUG("hl_interface_handle_vid_pid_command");
|
||||
|
||||
if (CMD_ARGC != 2) {
|
||||
LOG_WARNING("ignoring extra IDs in hl_vid_pid (maximum is 1 pair)");
|
||||
if (CMD_ARGC > HLA_MAX_USB_IDS * 2) {
|
||||
LOG_WARNING("ignoring extra IDs in hla_vid_pid "
|
||||
"(maximum is %d pairs)", HLA_MAX_USB_IDS);
|
||||
CMD_ARGC = HLA_MAX_USB_IDS * 2;
|
||||
}
|
||||
if (CMD_ARGC < 2 || (CMD_ARGC & 1)) {
|
||||
LOG_WARNING("incomplete hla_vid_pid configuration directive");
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], hl_if.param.vid);
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[1], hl_if.param.pid);
|
||||
unsigned i;
|
||||
for (i = 0; i < CMD_ARGC; i += 2) {
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], hl_if.param.vid[i / 2]);
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], hl_if.param.pid[i / 2]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Explicitly terminate, in case there are multiple instances of
|
||||
* hla_vid_pid.
|
||||
*/
|
||||
hl_if.param.vid[i / 2] = hl_if.param.pid[i / 2] = 0;
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -29,15 +29,17 @@ enum e_hl_transports;
|
||||
/** */
|
||||
extern const char *hl_transports[];
|
||||
|
||||
#define HLA_MAX_USB_IDS 8
|
||||
|
||||
struct hl_interface_param_s {
|
||||
/** */
|
||||
const char *device_desc;
|
||||
/** */
|
||||
const char *serial;
|
||||
/** */
|
||||
uint16_t vid;
|
||||
/** */
|
||||
uint16_t pid;
|
||||
/** List of recognised VIDs */
|
||||
uint16_t vid[HLA_MAX_USB_IDS + 1];
|
||||
/** List of recognised PIDs */
|
||||
uint16_t pid[HLA_MAX_USB_IDS + 1];
|
||||
/** */
|
||||
unsigned api;
|
||||
/** */
|
||||
|
||||
Reference in New Issue
Block a user