/**************************************************************************
* External interface implementation */
-static int armjtagew_execute_queue(void)
+static int armjtagew_execute_queue(struct jtag_command *cmd_queue)
{
- struct jtag_command *cmd = jtag_command_queue;
+ struct jtag_command *cmd = cmd_queue;
int scan_size;
enum scan_type type;
uint8_t *buffer;
armjtagew_handle = armjtagew_usb_open();
- if (armjtagew_handle == 0) {
+ if (!armjtagew_handle) {
LOG_ERROR(
"Cannot find ARM-JTAG-EW Interface! Please check connection and permissions.");
return ERROR_JTAG_INIT_FAILED;
const uint16_t pids[] = { USB_PID, 0 };
struct libusb_device_handle *dev;
- if (jtag_libusb_open(vids, pids, &dev, NULL) != ERROR_OK)
+ if (jtag_libusb_open(vids, pids, NULL, &dev, NULL) != ERROR_OK)
return NULL;
struct armjtagew *result = malloc(sizeof(struct armjtagew));
static void armjtagew_debug_buffer(uint8_t *buffer, int length)
{
- char line[81];
- char s[4];
- int i;
- int j;
+ char line[8 + 3 * BYTES_PER_LINE + 1];
- for (i = 0; i < length; i += BYTES_PER_LINE) {
- snprintf(line, 5, "%04x", i);
- for (j = i; j < i + BYTES_PER_LINE && j < length; j++) {
- snprintf(s, 4, " %02x", buffer[j]);
- strcat(line, s);
- }
+ for (int i = 0; i < length; i += BYTES_PER_LINE) {
+ int n = snprintf(line, 9, "%04x", i);
+ for (int j = i; j < i + BYTES_PER_LINE && j < length; j++)
+ n += snprintf(line + n, 4, " %02x", buffer[j]);
LOG_DEBUG("%s", line);
/* Prevent GDB timeout (writing to log might take some time) */