jtag: rename CamelCase symbols
No major cross dependency, just changes internal to each file or function. Change-Id: Ie6258a090ce53de5db65df6a77d57ac6bb899488 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6301 Tested-by: jenkins
This commit is contained in:
@@ -158,7 +158,7 @@ int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[],
|
||||
struct libusb_device_handle **out,
|
||||
adapter_get_alternate_serial_fn adapter_get_alternate_serial)
|
||||
{
|
||||
int cnt, idx, errCode;
|
||||
int cnt, idx, err_code;
|
||||
int retval = ERROR_FAIL;
|
||||
bool serial_mismatch = false;
|
||||
struct libusb_device_handle *libusb_handle = NULL;
|
||||
@@ -180,11 +180,11 @@ int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[],
|
||||
if (jtag_usb_get_location() && !jtag_libusb_location_equal(devs[idx]))
|
||||
continue;
|
||||
|
||||
errCode = libusb_open(devs[idx], &libusb_handle);
|
||||
err_code = libusb_open(devs[idx], &libusb_handle);
|
||||
|
||||
if (errCode) {
|
||||
if (err_code) {
|
||||
LOG_ERROR("libusb_open() failed with %s",
|
||||
libusb_error_name(errCode));
|
||||
libusb_error_name(err_code));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -222,13 +222,13 @@ void jtag_libusb_close(struct libusb_device_handle *dev)
|
||||
libusb_exit(jtag_libusb_context);
|
||||
}
|
||||
|
||||
int jtag_libusb_control_transfer(struct libusb_device_handle *dev, uint8_t requestType,
|
||||
uint8_t request, uint16_t wValue, uint16_t wIndex, char *bytes,
|
||||
int jtag_libusb_control_transfer(struct libusb_device_handle *dev, uint8_t request_type,
|
||||
uint8_t request, uint16_t value, uint16_t index, char *bytes,
|
||||
uint16_t size, unsigned int timeout)
|
||||
{
|
||||
int transferred = 0;
|
||||
|
||||
transferred = libusb_control_transfer(dev, requestType, request, wValue, wIndex,
|
||||
transferred = libusb_control_transfer(dev, request_type, request, value, index,
|
||||
(unsigned char *)bytes, size, timeout);
|
||||
|
||||
if (transferred < 0)
|
||||
@@ -275,28 +275,28 @@ int jtag_libusb_set_configuration(struct libusb_device_handle *devh,
|
||||
int configuration)
|
||||
{
|
||||
struct libusb_device *udev = libusb_get_device(devh);
|
||||
int retCode = -99;
|
||||
int retval = -99;
|
||||
|
||||
struct libusb_config_descriptor *config = NULL;
|
||||
int current_config = -1;
|
||||
|
||||
retCode = libusb_get_configuration(devh, ¤t_config);
|
||||
if (retCode != 0)
|
||||
return retCode;
|
||||
retval = libusb_get_configuration(devh, ¤t_config);
|
||||
if (retval != 0)
|
||||
return retval;
|
||||
|
||||
retCode = libusb_get_config_descriptor(udev, configuration, &config);
|
||||
if (retCode != 0 || config == NULL)
|
||||
return retCode;
|
||||
retval = libusb_get_config_descriptor(udev, configuration, &config);
|
||||
if (retval != 0 || config == NULL)
|
||||
return retval;
|
||||
|
||||
/* Only change the configuration if it is not already set to the
|
||||
same one. Otherwise this issues a lightweight reset and hangs
|
||||
LPC-Link2 with JLink firmware. */
|
||||
if (current_config != config->bConfigurationValue)
|
||||
retCode = libusb_set_configuration(devh, config->bConfigurationValue);
|
||||
retval = libusb_set_configuration(devh, config->bConfigurationValue);
|
||||
|
||||
libusb_free_config_descriptor(config);
|
||||
|
||||
return retCode;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int jtag_libusb_choose_interface(struct libusb_device_handle *devh,
|
||||
|
||||
@@ -33,8 +33,8 @@ int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[],
|
||||
adapter_get_alternate_serial_fn adapter_get_alternate_serial);
|
||||
void jtag_libusb_close(struct libusb_device_handle *dev);
|
||||
int jtag_libusb_control_transfer(struct libusb_device_handle *dev,
|
||||
uint8_t requestType, uint8_t request, uint16_t wValue,
|
||||
uint16_t wIndex, char *bytes, uint16_t size, unsigned int timeout);
|
||||
uint8_t request_type, uint8_t request, uint16_t value,
|
||||
uint16_t index, char *bytes, uint16_t size, unsigned int timeout);
|
||||
int jtag_libusb_bulk_write(struct libusb_device_handle *dev, int ep,
|
||||
char *bytes, int size, int timeout, int *transferred);
|
||||
int jtag_libusb_bulk_read(struct libusb_device_handle *dev, int ep,
|
||||
|
||||
@@ -97,14 +97,14 @@
|
||||
#define ST7_PC_TDO ST7_PC_IO9
|
||||
#define ST7_PA_DBGACK ST7_PA_IO10
|
||||
|
||||
static struct libusb_device_handle *pHDev;
|
||||
static struct libusb_device_handle *hdev;
|
||||
|
||||
/*
|
||||
* ep1 commands are up to USB_EP1OUT_SIZE bytes in length.
|
||||
* This function takes care of zeroing the unused bytes before sending the packet.
|
||||
* Any reply packet is not handled by this function.
|
||||
*/
|
||||
static int ep1_generic_commandl(struct libusb_device_handle *pHDev_param, size_t length, ...)
|
||||
static int ep1_generic_commandl(struct libusb_device_handle *hdev_param, size_t length, ...)
|
||||
{
|
||||
uint8_t usb_buffer[USB_EP1OUT_SIZE];
|
||||
uint8_t *usb_buffer_p;
|
||||
@@ -130,7 +130,7 @@ static int ep1_generic_commandl(struct libusb_device_handle *pHDev_param, size_t
|
||||
);
|
||||
|
||||
usb_ret = jtag_libusb_bulk_write(
|
||||
pHDev_param,
|
||||
hdev_param,
|
||||
USB_EP1OUT_ADDR,
|
||||
(char *)usb_buffer, sizeof(usb_buffer),
|
||||
USB_TIMEOUT_MS,
|
||||
@@ -144,7 +144,7 @@ static int ep1_generic_commandl(struct libusb_device_handle *pHDev_param, size_t
|
||||
|
||||
#if 0
|
||||
static ssize_t ep1_memory_read(
|
||||
struct libusb_device_handle *pHDev_param, uint16_t addr,
|
||||
struct libusb_device_handle *hdev_param, uint16_t addr,
|
||||
size_t length, uint8_t *buffer)
|
||||
{
|
||||
uint8_t usb_buffer[USB_EP1OUT_SIZE];
|
||||
@@ -174,7 +174,7 @@ static ssize_t ep1_memory_read(
|
||||
usb_buffer[3] = length;
|
||||
|
||||
usb_ret = jtag_libusb_bulk_write(
|
||||
pHDev_param, USB_EP1OUT_ADDR,
|
||||
hdev_param, USB_EP1OUT_ADDR,
|
||||
(char *)usb_buffer, sizeof(usb_buffer),
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -184,7 +184,7 @@ static ssize_t ep1_memory_read(
|
||||
break;
|
||||
|
||||
usb_ret = jtag_libusb_bulk_read(
|
||||
pHDev_param, USB_EP1IN_ADDR,
|
||||
hdev_param, USB_EP1IN_ADDR,
|
||||
(char *)buffer, length,
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -203,7 +203,7 @@ static ssize_t ep1_memory_read(
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t ep1_memory_write(struct libusb_device_handle *pHDev_param, uint16_t addr,
|
||||
static ssize_t ep1_memory_write(struct libusb_device_handle *hdev_param, uint16_t addr,
|
||||
size_t length, uint8_t const *buffer)
|
||||
{
|
||||
uint8_t usb_buffer[USB_EP1OUT_SIZE];
|
||||
@@ -239,7 +239,7 @@ static ssize_t ep1_memory_write(struct libusb_device_handle *pHDev_param, uint16
|
||||
int transferred;
|
||||
|
||||
usb_ret = jtag_libusb_bulk_write(
|
||||
pHDev_param, USB_EP1OUT_ADDR,
|
||||
hdev_param, USB_EP1OUT_ADDR,
|
||||
(char *)usb_buffer, sizeof(usb_buffer),
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -259,7 +259,7 @@ static ssize_t ep1_memory_write(struct libusb_device_handle *pHDev_param, uint16
|
||||
|
||||
|
||||
#if 0
|
||||
static ssize_t ep1_memory_writel(struct libusb_device_handle *pHDev_param, uint16_t addr,
|
||||
static ssize_t ep1_memory_writel(struct libusb_device_handle *hdev_param, uint16_t addr,
|
||||
size_t length, ...)
|
||||
{
|
||||
uint8_t buffer[USB_EP1OUT_SIZE - 4];
|
||||
@@ -279,7 +279,7 @@ static ssize_t ep1_memory_writel(struct libusb_device_handle *pHDev_param, uint1
|
||||
remain--;
|
||||
}
|
||||
|
||||
return ep1_memory_write(pHDev_param, addr, length, buffer);
|
||||
return ep1_memory_write(hdev_param, addr, length, buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -296,7 +296,7 @@ static ssize_t ep1_memory_writel(struct libusb_device_handle *pHDev_param, uint1
|
||||
static uint8_t dtc_entry_download;
|
||||
|
||||
/* The buffer is specially formatted to represent a valid image to load into the DTC. */
|
||||
static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const uint8_t *buffer,
|
||||
static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const uint8_t *buffer,
|
||||
size_t length)
|
||||
{
|
||||
struct header_s {
|
||||
@@ -312,7 +312,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const
|
||||
|
||||
/* Stop the DTC before loading anything. */
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev_param, 1,
|
||||
hdev_param, 1,
|
||||
EP1_CMD_DTC_STOP
|
||||
);
|
||||
if (usb_err < 0)
|
||||
@@ -346,7 +346,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const
|
||||
case DTCLOAD_LOAD:
|
||||
/* Send the DTC program to ST7 RAM. */
|
||||
usb_err = ep1_memory_write(
|
||||
pHDev_param,
|
||||
hdev_param,
|
||||
DTC_LOAD_BUFFER,
|
||||
header->length + 1, buffer
|
||||
);
|
||||
@@ -355,7 +355,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const
|
||||
|
||||
/* Load it into the DTC. */
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev_param, 3,
|
||||
hdev_param, 3,
|
||||
EP1_CMD_DTC_LOAD,
|
||||
(DTC_LOAD_BUFFER >> 8),
|
||||
DTC_LOAD_BUFFER
|
||||
@@ -367,7 +367,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const
|
||||
|
||||
case DTCLOAD_RUN:
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev_param, 3,
|
||||
hdev_param, 3,
|
||||
EP1_CMD_DTC_CALL,
|
||||
buffer[0],
|
||||
EP1_CMD_DTC_WAIT
|
||||
@@ -383,7 +383,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const
|
||||
|
||||
case DTCLOAD_LUT:
|
||||
usb_err = ep1_memory_write(
|
||||
pHDev_param,
|
||||
hdev_param,
|
||||
ST7_USB_BUF_EP0OUT + lut_start,
|
||||
header->length + 1, buffer
|
||||
);
|
||||
@@ -415,7 +415,7 @@ static int dtc_start_download(void)
|
||||
|
||||
/* set up for download mode and make sure EP2 is set up to transmit */
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev, 7,
|
||||
hdev, 7,
|
||||
|
||||
EP1_CMD_DTC_STOP,
|
||||
EP1_CMD_SET_UPLOAD,
|
||||
@@ -430,7 +430,7 @@ static int dtc_start_download(void)
|
||||
|
||||
/* read back ep2txr */
|
||||
usb_err = jtag_libusb_bulk_read(
|
||||
pHDev, USB_EP1IN_ADDR,
|
||||
hdev, USB_EP1IN_ADDR,
|
||||
(char *)&ep2txr, 1,
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -439,7 +439,7 @@ static int dtc_start_download(void)
|
||||
return usb_err;
|
||||
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev, 13,
|
||||
hdev, 13,
|
||||
|
||||
EP1_CMD_MEMORY_WRITE, /* preinitialize poll byte */
|
||||
DTC_STATUS_POLL_BYTE >> 8,
|
||||
@@ -460,7 +460,7 @@ static int dtc_start_download(void)
|
||||
|
||||
/* wait for completion */
|
||||
usb_err = jtag_libusb_bulk_read(
|
||||
pHDev, USB_EP1IN_ADDR,
|
||||
hdev, USB_EP1IN_ADDR,
|
||||
(char *)&ep2txr, 1,
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -470,7 +470,7 @@ static int dtc_start_download(void)
|
||||
}
|
||||
|
||||
static int dtc_run_download(
|
||||
struct libusb_device_handle *pHDev_param,
|
||||
struct libusb_device_handle *hdev_param,
|
||||
uint8_t *command_buffer,
|
||||
int command_buffer_size,
|
||||
uint8_t *reply_buffer,
|
||||
@@ -485,7 +485,7 @@ static int dtc_run_download(
|
||||
LOG_DEBUG("%d/%d", command_buffer_size, reply_buffer_size);
|
||||
|
||||
usb_err = jtag_libusb_bulk_write(
|
||||
pHDev_param,
|
||||
hdev_param,
|
||||
USB_EP2OUT_ADDR,
|
||||
(char *)command_buffer, USB_EP2BANK_SIZE,
|
||||
USB_TIMEOUT_MS,
|
||||
@@ -498,7 +498,7 @@ static int dtc_run_download(
|
||||
/* Wait for DTC to finish running command buffer */
|
||||
for (i = 50;; ) {
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev_param, 4,
|
||||
hdev_param, 4,
|
||||
|
||||
EP1_CMD_MEMORY_READ,
|
||||
DTC_STATUS_POLL_BYTE >> 8,
|
||||
@@ -509,7 +509,7 @@ static int dtc_run_download(
|
||||
return usb_err;
|
||||
|
||||
usb_err = jtag_libusb_bulk_read(
|
||||
pHDev_param,
|
||||
hdev_param,
|
||||
USB_EP1IN_ADDR,
|
||||
&dtc_status, 1,
|
||||
USB_TIMEOUT_MS,
|
||||
@@ -530,7 +530,7 @@ static int dtc_run_download(
|
||||
|
||||
if (reply_buffer && reply_buffer_size) {
|
||||
usb_err = jtag_libusb_bulk_read(
|
||||
pHDev_param,
|
||||
hdev_param,
|
||||
USB_EP2IN_ADDR,
|
||||
(char *)reply_buffer, reply_buffer_size,
|
||||
USB_TIMEOUT_MS,
|
||||
@@ -656,7 +656,7 @@ static int dtc_queue_run(void)
|
||||
|
||||
dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = DTC_CMD_STOP;
|
||||
|
||||
usb_err = dtc_run_download(pHDev,
|
||||
usb_err = dtc_run_download(hdev,
|
||||
dtc_queue.cmd_buffer, dtc_queue.cmd_index,
|
||||
reply_buffer, sizeof(reply_buffer)
|
||||
);
|
||||
@@ -940,7 +940,7 @@ static void rlink_reset(int trst, int srst)
|
||||
|
||||
/* Read port A for bit op */
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev, 4,
|
||||
hdev, 4,
|
||||
EP1_CMD_MEMORY_READ,
|
||||
ST7_PADR >> 8,
|
||||
ST7_PADR,
|
||||
@@ -952,7 +952,7 @@ static void rlink_reset(int trst, int srst)
|
||||
}
|
||||
|
||||
usb_err = jtag_libusb_bulk_read(
|
||||
pHDev, USB_EP1IN_ADDR,
|
||||
hdev, USB_EP1IN_ADDR,
|
||||
(char *)&bitmap, 1,
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -971,7 +971,7 @@ static void rlink_reset(int trst, int srst)
|
||||
* port B has no OR, and we want to emulate open drain on NSRST, so we initialize DR to 0
|
||||
*and assert NSRST by setting DDR to 1. */
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev, 9,
|
||||
hdev, 9,
|
||||
EP1_CMD_MEMORY_WRITE,
|
||||
ST7_PADR >> 8,
|
||||
ST7_PADR,
|
||||
@@ -988,7 +988,7 @@ static void rlink_reset(int trst, int srst)
|
||||
}
|
||||
|
||||
usb_err = jtag_libusb_bulk_read(
|
||||
pHDev, USB_EP1IN_ADDR,
|
||||
hdev, USB_EP1IN_ADDR,
|
||||
(char *)&bitmap, 1,
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -1005,7 +1005,7 @@ static void rlink_reset(int trst, int srst)
|
||||
|
||||
/* write port B and read dummy to ensure completion before returning */
|
||||
usb_err = ep1_generic_commandl(
|
||||
pHDev, 6,
|
||||
hdev, 6,
|
||||
EP1_CMD_MEMORY_WRITE,
|
||||
ST7_PBDDR >> 8,
|
||||
ST7_PBDDR,
|
||||
@@ -1019,7 +1019,7 @@ static void rlink_reset(int trst, int srst)
|
||||
}
|
||||
|
||||
usb_err = jtag_libusb_bulk_read(
|
||||
pHDev, USB_EP1IN_ADDR,
|
||||
hdev, USB_EP1IN_ADDR,
|
||||
(char *)&bitmap, 1,
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -1297,7 +1297,7 @@ static int rlink_execute_queue(void)
|
||||
|
||||
#ifndef AUTOMATIC_BUSY_LED
|
||||
/* turn LED on */
|
||||
ep1_generic_commandl(pHDev, 2,
|
||||
ep1_generic_commandl(hdev, 2,
|
||||
EP1_CMD_SET_PORTD_LEDS,
|
||||
~(ST7_PD_NBUSY_LED)
|
||||
);
|
||||
@@ -1381,7 +1381,7 @@ static int rlink_execute_queue(void)
|
||||
|
||||
#ifndef AUTOMATIC_BUSY_LED
|
||||
/* turn LED off */
|
||||
ep1_generic_commandl(pHDev, 2,
|
||||
ep1_generic_commandl(hdev, 2,
|
||||
EP1_CMD_SET_PORTD_LEDS,
|
||||
~0
|
||||
);
|
||||
@@ -1404,7 +1404,7 @@ static int rlink_speed(int speed)
|
||||
|
||||
for (i = rlink_speed_table_size; i--; ) {
|
||||
if (rlink_speed_table[i].prescaler == speed) {
|
||||
if (dtc_load_from_buffer(pHDev, rlink_speed_table[i].dtc,
|
||||
if (dtc_load_from_buffer(hdev, rlink_speed_table[i].dtc,
|
||||
rlink_speed_table[i].dtc_size) != 0) {
|
||||
LOG_ERROR(
|
||||
"An error occurred while trying to load DTC code for speed \"%d\".",
|
||||
@@ -1470,11 +1470,11 @@ static int rlink_init(void)
|
||||
|
||||
const uint16_t vids[] = { USB_IDVENDOR, 0 };
|
||||
const uint16_t pids[] = { USB_IDPRODUCT, 0 };
|
||||
if (jtag_libusb_open(vids, pids, NULL, &pHDev, NULL) != ERROR_OK)
|
||||
if (jtag_libusb_open(vids, pids, NULL, &hdev, NULL) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
|
||||
struct libusb_device_descriptor descriptor;
|
||||
struct libusb_device *usb_dev = libusb_get_device(pHDev);
|
||||
struct libusb_device *usb_dev = libusb_get_device(hdev);
|
||||
int r = libusb_get_device_descriptor(usb_dev, &descriptor);
|
||||
if (r < 0) {
|
||||
LOG_ERROR("error %d getting device descriptor", r);
|
||||
@@ -1492,17 +1492,17 @@ static int rlink_init(void)
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Opened device, pHDev = %p", pHDev);
|
||||
LOG_DEBUG("Opened device, hdev = %p", hdev);
|
||||
|
||||
/* usb_set_configuration required under win32 */
|
||||
libusb_set_configuration(pHDev, config->bConfigurationValue);
|
||||
libusb_set_configuration(hdev, config->bConfigurationValue);
|
||||
|
||||
retries = 3;
|
||||
do {
|
||||
i = libusb_claim_interface(pHDev, 0);
|
||||
i = libusb_claim_interface(hdev, 0);
|
||||
if (i != LIBUSB_SUCCESS) {
|
||||
LOG_ERROR("usb_claim_interface: %s", libusb_error_name(i));
|
||||
j = libusb_detach_kernel_driver(pHDev, 0);
|
||||
j = libusb_detach_kernel_driver(hdev, 0);
|
||||
if (j != LIBUSB_SUCCESS)
|
||||
LOG_ERROR("detach kernel driver: %s", libusb_error_name(j));
|
||||
} else {
|
||||
@@ -1515,7 +1515,7 @@ static int rlink_init(void)
|
||||
LOG_ERROR("Initialisation failed.");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
if (libusb_set_interface_alt_setting(pHDev, 0, 0) != LIBUSB_SUCCESS) {
|
||||
if (libusb_set_interface_alt_setting(hdev, 0, 0) != LIBUSB_SUCCESS) {
|
||||
LOG_ERROR("Failed to set interface.");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
@@ -1531,7 +1531,7 @@ static int rlink_init(void)
|
||||
*/
|
||||
for (i = 0; i < 5; i++) {
|
||||
j = ep1_generic_commandl(
|
||||
pHDev, 1,
|
||||
hdev, 1,
|
||||
EP1_CMD_GET_FWREV
|
||||
);
|
||||
if (j < USB_EP1OUT_SIZE) {
|
||||
@@ -1539,7 +1539,7 @@ static int rlink_init(void)
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
j = jtag_libusb_bulk_read(
|
||||
pHDev, USB_EP1IN_ADDR,
|
||||
hdev, USB_EP1IN_ADDR,
|
||||
(char *)reply_buffer, sizeof(reply_buffer),
|
||||
200,
|
||||
&transferred
|
||||
@@ -1563,7 +1563,7 @@ static int rlink_init(void)
|
||||
|
||||
/* Probe port E for adapter presence */
|
||||
ep1_generic_commandl(
|
||||
pHDev, 16,
|
||||
hdev, 16,
|
||||
EP1_CMD_MEMORY_WRITE, /* Drive sense pin with 0 */
|
||||
ST7_PEDR >> 8,
|
||||
ST7_PEDR,
|
||||
@@ -1583,7 +1583,7 @@ static int rlink_init(void)
|
||||
);
|
||||
|
||||
jtag_libusb_bulk_read(
|
||||
pHDev, USB_EP1IN_ADDR,
|
||||
hdev, USB_EP1IN_ADDR,
|
||||
(char *)reply_buffer, 1,
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -1593,7 +1593,7 @@ static int rlink_init(void)
|
||||
LOG_WARNING("target detection problem");
|
||||
|
||||
ep1_generic_commandl(
|
||||
pHDev, 11,
|
||||
hdev, 11,
|
||||
EP1_CMD_MEMORY_READ, /* Read back */
|
||||
ST7_PEDR >> 8,
|
||||
ST7_PEDR,
|
||||
@@ -1608,7 +1608,7 @@ static int rlink_init(void)
|
||||
);
|
||||
|
||||
jtag_libusb_bulk_read(
|
||||
pHDev, USB_EP1IN_ADDR,
|
||||
hdev, USB_EP1IN_ADDR,
|
||||
(char *)reply_buffer, 1,
|
||||
USB_TIMEOUT_MS,
|
||||
&transferred
|
||||
@@ -1620,7 +1620,7 @@ static int rlink_init(void)
|
||||
|
||||
/* float ports A and B */
|
||||
ep1_generic_commandl(
|
||||
pHDev, 11,
|
||||
hdev, 11,
|
||||
EP1_CMD_MEMORY_WRITE,
|
||||
ST7_PADDR >> 8,
|
||||
ST7_PADDR,
|
||||
@@ -1636,7 +1636,7 @@ static int rlink_init(void)
|
||||
|
||||
/* make sure DTC is stopped, set VPP control, set up ports A and B */
|
||||
ep1_generic_commandl(
|
||||
pHDev, 14,
|
||||
hdev, 14,
|
||||
EP1_CMD_DTC_STOP,
|
||||
EP1_CMD_SET_PORTD_VPP,
|
||||
~(ST7_PD_VPP_SHDN),
|
||||
@@ -1657,7 +1657,7 @@ static int rlink_init(void)
|
||||
|
||||
/* set LED updating mode and make sure they're unlit */
|
||||
ep1_generic_commandl(
|
||||
pHDev, 3,
|
||||
hdev, 3,
|
||||
#ifdef AUTOMATIC_BUSY_LED
|
||||
EP1_CMD_LEDUE_BUSY,
|
||||
#else
|
||||
@@ -1678,7 +1678,7 @@ static int rlink_quit(void)
|
||||
{
|
||||
/* stop DTC and make sure LEDs are off */
|
||||
ep1_generic_commandl(
|
||||
pHDev, 6,
|
||||
hdev, 6,
|
||||
EP1_CMD_DTC_STOP,
|
||||
EP1_CMD_LEDUE_NONE,
|
||||
EP1_CMD_SET_PORTD_LEDS,
|
||||
@@ -1687,8 +1687,8 @@ static int rlink_quit(void)
|
||||
~0
|
||||
);
|
||||
|
||||
libusb_release_interface(pHDev, 0);
|
||||
libusb_close(pHDev);
|
||||
libusb_release_interface(hdev, 0);
|
||||
libusb_close(hdev);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ RESULT usbtojtagraw_fini(uint8_t interface_index)
|
||||
return usbtoxxx_fini_command(USB_TO_JTAG_RAW, interface_index);
|
||||
}
|
||||
|
||||
RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t kHz)
|
||||
RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t khz)
|
||||
{
|
||||
uint8_t cfg_buf[4];
|
||||
|
||||
@@ -48,7 +48,7 @@ RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t kHz)
|
||||
}
|
||||
#endif
|
||||
|
||||
SET_LE_U32(&cfg_buf[0], kHz);
|
||||
SET_LE_U32(&cfg_buf[0], khz);
|
||||
|
||||
return usbtoxxx_conf_command(USB_TO_JTAG_RAW, interface_index, cfg_buf, 4);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ RESULT usbtopwr_config(uint8_t interface_index)
|
||||
return usbtoxxx_conf_command(USB_TO_POWER, interface_index, NULL, 0);
|
||||
}
|
||||
|
||||
RESULT usbtopwr_output(uint8_t interface_index, uint16_t mV)
|
||||
RESULT usbtopwr_output(uint8_t interface_index, uint16_t millivolt)
|
||||
{
|
||||
#if PARAM_CHECK
|
||||
if (interface_index > 7) {
|
||||
@@ -58,6 +58,6 @@ RESULT usbtopwr_output(uint8_t interface_index, uint16_t mV)
|
||||
}
|
||||
#endif
|
||||
|
||||
return usbtoxxx_out_command(USB_TO_POWER, interface_index, (uint8_t *)&mV,
|
||||
return usbtoxxx_out_command(USB_TO_POWER, interface_index, (uint8_t *)&millivolt,
|
||||
2, 0);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ RESULT usbtousart_status(uint8_t interface_index,
|
||||
/* USB_TO_SPI */
|
||||
RESULT usbtospi_init(uint8_t interface_index);
|
||||
RESULT usbtospi_fini(uint8_t interface_index);
|
||||
RESULT usbtospi_config(uint8_t interface_index, uint32_t kHz, uint8_t mode);
|
||||
RESULT usbtospi_config(uint8_t interface_index, uint32_t khz, uint8_t mode);
|
||||
RESULT usbtospi_io(uint8_t interface_index, uint8_t *out, uint8_t *in,
|
||||
uint16_t bytelen);
|
||||
|
||||
@@ -82,7 +82,7 @@ RESULT usbtolpcicp_poll_ready(uint8_t interface_index, uint8_t data,
|
||||
/* USB_TO_JTAG_LL */
|
||||
RESULT usbtojtagll_init(uint8_t interface_index);
|
||||
RESULT usbtojtagll_fini(uint8_t interface_index);
|
||||
RESULT usbtojtagll_config(uint8_t interface_index, uint32_t kHz);
|
||||
RESULT usbtojtagll_config(uint8_t interface_index, uint32_t khz);
|
||||
RESULT usbtojtagll_tms(uint8_t interface_index, uint8_t *tms, uint8_t bytelen);
|
||||
RESULT usbtojtagll_tms_clocks(uint8_t interface_index, uint32_t bytelen,
|
||||
uint8_t tms);
|
||||
@@ -94,7 +94,7 @@ RESULT usbtojtagll_scan(uint8_t interface_index, uint8_t *data,
|
||||
/* USB_TO_JTAG_HL */
|
||||
RESULT usbtojtaghl_init(uint8_t interface_index);
|
||||
RESULT usbtojtaghl_fini(uint8_t interface_index);
|
||||
RESULT usbtojtaghl_config(uint8_t interface_index, uint32_t kHz, uint8_t ub,
|
||||
RESULT usbtojtaghl_config(uint8_t interface_index, uint32_t khz, uint8_t ub,
|
||||
uint8_t ua, uint16_t bb, uint16_t ba);
|
||||
RESULT usbtojtaghl_ir(uint8_t interface_index, uint8_t *ir, uint16_t bitlen,
|
||||
uint8_t idle, uint8_t want_ret);
|
||||
@@ -108,7 +108,7 @@ RESULT usbtojtaghl_register_callback(uint8_t index, jtag_callback_t send_callbac
|
||||
/* USB_TO_JTAG_RAW */
|
||||
RESULT usbtojtagraw_init(uint8_t interface_index);
|
||||
RESULT usbtojtagraw_fini(uint8_t interface_index);
|
||||
RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t kHz);
|
||||
RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t khz);
|
||||
RESULT usbtojtagraw_execute(uint8_t interface_index, uint8_t *tdi,
|
||||
uint8_t *tms, uint8_t *tdo, uint32_t bitlen);
|
||||
|
||||
@@ -123,7 +123,7 @@ RESULT usbtoc2_readdata(uint8_t interface_index, uint8_t *buf, uint8_t len);
|
||||
/* USB_TO_I2C */
|
||||
RESULT usbtoi2c_init(uint8_t interface_index);
|
||||
RESULT usbtoi2c_fini(uint8_t interface_index);
|
||||
RESULT usbtoi2c_config(uint8_t interface_index, uint16_t kHz,
|
||||
RESULT usbtoi2c_config(uint8_t interface_index, uint16_t khz,
|
||||
uint16_t byte_interval, uint16_t max_dly);
|
||||
RESULT usbtoi2c_read(uint8_t interface_index, uint16_t chip_addr,
|
||||
uint8_t *data, uint16_t data_len, uint8_t stop,
|
||||
@@ -165,7 +165,7 @@ RESULT usbtomsp430sbw_poll(uint8_t interface_index, uint32_t dr, uint32_t mask,
|
||||
RESULT usbtopwr_init(uint8_t interface_index);
|
||||
RESULT usbtopwr_fini(uint8_t interface_index);
|
||||
RESULT usbtopwr_config(uint8_t interface_index);
|
||||
RESULT usbtopwr_output(uint8_t interface_index, uint16_t mV);
|
||||
RESULT usbtopwr_output(uint8_t interface_index, uint16_t millivolt);
|
||||
|
||||
/* USB_TO_POLL */
|
||||
RESULT usbtopoll_start(uint16_t retry_cnt, uint16_t interval_us);
|
||||
@@ -190,14 +190,14 @@ RESULT usbtoswd_transact(uint8_t interface_index, uint8_t request,
|
||||
/* USB_TO_SWIM */
|
||||
RESULT usbtoswim_init(uint8_t interface_index);
|
||||
RESULT usbtoswim_fini(uint8_t interface_index);
|
||||
RESULT usbtoswim_config(uint8_t interface_index, uint8_t mHz, uint8_t cnt0,
|
||||
RESULT usbtoswim_config(uint8_t interface_index, uint8_t mhz, uint8_t cnt0,
|
||||
uint8_t cnt1);
|
||||
RESULT usbtoswim_srst(uint8_t interface_index);
|
||||
RESULT usbtoswim_wotf(uint8_t interface_index, uint8_t *data,
|
||||
uint16_t bytelen, uint32_t addr);
|
||||
RESULT usbtoswim_rotf(uint8_t interface_index, uint8_t *data,
|
||||
uint16_t bytelen, uint32_t addr);
|
||||
RESULT usbtoswim_sync(uint8_t interface_index, uint8_t mHz);
|
||||
RESULT usbtoswim_sync(uint8_t interface_index, uint8_t mhz);
|
||||
RESULT usbtoswim_enable(uint8_t interface_index);
|
||||
|
||||
/* USB_TO_BDM */
|
||||
@@ -210,14 +210,14 @@ RESULT usbtobdm_transact(uint8_t interface_index, uint8_t *out,
|
||||
/* USB_TO_DUSI */
|
||||
RESULT usbtodusi_init(uint8_t interface_index);
|
||||
RESULT usbtodusi_fini(uint8_t interface_index);
|
||||
RESULT usbtodusi_config(uint8_t interface_index, uint32_t kHz, uint8_t mode);
|
||||
RESULT usbtodusi_config(uint8_t interface_index, uint32_t khz, uint8_t mode);
|
||||
RESULT usbtodusi_io(uint8_t interface_index, uint8_t *mo, uint8_t *mi,
|
||||
uint8_t *so, uint8_t *si, uint32_t bitlen);
|
||||
|
||||
/* USB_TO_MICROWIRE */
|
||||
RESULT usbtomicrowire_init(uint8_t interface_index);
|
||||
RESULT usbtomicrowire_fini(uint8_t interface_index);
|
||||
RESULT usbtomicrowire_config(uint8_t interface_index, uint16_t kHz,
|
||||
RESULT usbtomicrowire_config(uint8_t interface_index, uint16_t khz,
|
||||
uint8_t sel_polarity);
|
||||
RESULT usbtomicrowire_transport(uint8_t interface_index,
|
||||
uint32_t opcode, uint8_t opcode_bitlen,
|
||||
@@ -230,7 +230,7 @@ RESULT usbtomicrowire_poll(uint8_t interface_index, uint16_t interval_us,
|
||||
/* USB_TO_PWM */
|
||||
RESULT usbtopwm_init(uint8_t interface_index);
|
||||
RESULT usbtopwm_fini(uint8_t interface_index);
|
||||
RESULT usbtopwm_config(uint8_t interface_index, uint16_t kHz, uint8_t mode);
|
||||
RESULT usbtopwm_config(uint8_t interface_index, uint16_t khz, uint8_t mode);
|
||||
RESULT usbtopwm_out(uint8_t interface_index, uint16_t count, uint16_t *rate);
|
||||
RESULT usbtopwm_in(uint8_t interface_index, uint16_t count, uint16_t *rate);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ struct interface_swd_t {
|
||||
struct interface_jtag_raw_t {
|
||||
RESULT(*init)(uint8_t interface_index);
|
||||
RESULT(*fini)(uint8_t interface_index);
|
||||
RESULT(*config)(uint8_t interface_index, uint32_t kHz);
|
||||
RESULT(*config)(uint8_t interface_index, uint32_t khz);
|
||||
RESULT(*execute)(uint8_t interface_index, uint8_t *tdi, uint8_t *tms,
|
||||
uint8_t *tdo, uint32_t bitlen);
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define XLNX_XVC_VSEC_HDR 0x04
|
||||
#define XLNX_XVC_LEN_REG 0x0C
|
||||
#define XLNX_XVC_TMS_REG 0x10
|
||||
#define XLNX_XVC_TDx_REG 0x14
|
||||
#define XLNX_XVC_TDX_REG 0x14
|
||||
|
||||
#define XLNX_XVC_CAP_SIZE 0x20
|
||||
#define XLNX_XVC_VSEC_ID 0x8
|
||||
@@ -103,11 +103,11 @@ static int xlnx_pcie_xvc_transact(size_t num_bits, uint32_t tms, uint32_t tdi,
|
||||
if (err != ERROR_OK)
|
||||
return err;
|
||||
|
||||
err = xlnx_pcie_xvc_write_reg(XLNX_XVC_TDx_REG, tdi);
|
||||
err = xlnx_pcie_xvc_write_reg(XLNX_XVC_TDX_REG, tdi);
|
||||
if (err != ERROR_OK)
|
||||
return err;
|
||||
|
||||
err = xlnx_pcie_xvc_read_reg(XLNX_XVC_TDx_REG, tdo);
|
||||
err = xlnx_pcie_xvc_read_reg(XLNX_XVC_TDX_REG, tdo);
|
||||
if (err != ERROR_OK)
|
||||
return err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user