DEBUG_JTAG_IO("0x%02x 0x%02x", command, _data);
- usb_out_buffer[0] = (uint16_t) 2;
+ usb_out_buffer[0] = 2;
+ usb_out_buffer[1] = 0;
usb_out_buffer[2] = command;
usb_out_buffer[3] = _data;
* For the purpose of padding we assume that we are in idle or pause state. */
int opendous_tap_execute(void)
{
- int byte_length, byte_length_out;
+ int byte_length;
int i, j;
int result;
- int output_counter;
+
+#ifdef _DEBUG_USB_COMMS_
+ int byte_length_out;
+#endif
if (tap_length > 0) {
/* memset(tdo_buffer,0,OPENDOUS_TAP_BUFFER_SIZE); */
/* LOG_INFO("OPENDOUS tap execute %d",tap_length); */
byte_length = (tap_length + 3) / 4;
- byte_length_out = (tap_length + 7) / 8;
#ifdef _DEBUG_USB_COMMS_
+ byte_length_out = (tap_length + 7) / 8;
LOG_DEBUG("opendous is sending %d bytes", byte_length);
#endif
- output_counter = 0;
for (j = 0, i = 0; j < byte_length;) {
- int recieve;
+ int receive;
int transmit = byte_length - j;
if (transmit > OPENDOUS_MAX_TAP_TRANSMIT) {
transmit = OPENDOUS_MAX_TAP_TRANSMIT;
- recieve = (OPENDOUS_MAX_TAP_TRANSMIT) / 2;
+ receive = (OPENDOUS_MAX_TAP_TRANSMIT) / 2;
usb_out_buffer[2] = JTAG_CMD_TAP_OUTPUT;
} else {
usb_out_buffer[2] = JTAG_CMD_TAP_OUTPUT | ((tap_length % 4) << 4);
- recieve = (transmit + 1) / 2;
+ receive = (transmit + 1) / 2;
}
usb_out_buffer[0] = (transmit + 1) & 0xff;
usb_out_buffer[1] = ((transmit + 1) >> 8) & 0xff;
memmove(usb_out_buffer + 3, tms_buffer + j, transmit);
- result = opendous_usb_message(opendous_jtag_handle, 3 + transmit, recieve);
- if (result != recieve) {
- LOG_ERROR("opendous_tap_execute, wrong result %d, expected %d", result, recieve);
+ result = opendous_usb_message(opendous_jtag_handle, 3 + transmit, receive);
+ if (result != receive) {
+ LOG_ERROR("opendous_tap_execute, wrong result %d, expected %d", result, receive);
return ERROR_JTAG_QUEUE_FAILED;
}
- memmove(tdo_buffer + i, usb_in_buffer, recieve);
- i += recieve;
+ memmove(tdo_buffer + i, usb_in_buffer, receive);
+ i += receive;
j += transmit;
}
- result = byte_length_out;
#ifdef _DEBUG_USB_COMMS_
- LOG_DEBUG("opendous tap result %d", result);
- opendous_debug_buffer(tdo_buffer, result);
+ LOG_DEBUG("opendous tap result %d", byte_length_out);
+ opendous_debug_buffer(tdo_buffer, byte_length_out);
#endif
/* LOG_INFO("eStick tap execute %d",tap_length); */