ftdi: Output wire debug.
This commit is contained in:
parent
e95e5e3fba
commit
f0b0639189
|
@ -443,6 +443,7 @@ bool libftdi_srst_get_val(void)
|
|||
|
||||
void libftdi_buffer_flush(void)
|
||||
{
|
||||
DEBUG_WIRE("Flush\n");
|
||||
#if defined(USE_USB_VERSION_BIT)
|
||||
static struct ftdi_transfer_control *tc_write = NULL;
|
||||
if (tc_write)
|
||||
|
@ -458,6 +459,13 @@ static struct ftdi_transfer_control *tc_write = NULL;
|
|||
int libftdi_buffer_write(const uint8_t *data, int size)
|
||||
{
|
||||
if((bufptr + size) / BUF_SIZE > 0) libftdi_buffer_flush();
|
||||
DEBUG_WIRE("Write %d bytes:", size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
DEBUG_WIRE(" %02x", data[i]);
|
||||
if (i && ((i & 0xf) == 0xf))
|
||||
DEBUG_WIRE("\n\t");
|
||||
}
|
||||
DEBUG_WIRE("\n");
|
||||
memcpy(outbuf + bufptr, data, size);
|
||||
bufptr += size;
|
||||
return size;
|
||||
|
@ -473,10 +481,18 @@ int libftdi_buffer_read(uint8_t *data, int size)
|
|||
ftdi_transfer_data_done(tc);
|
||||
#else
|
||||
int index = 0;
|
||||
outbuf[bufptr++] = SEND_IMMEDIATE;
|
||||
const uint8_t cmd[1] = {SEND_IMMEDIATE};
|
||||
libftdi_buffer_write(cmd, 1);
|
||||
libftdi_buffer_flush();
|
||||
while((index += ftdi_read_data(ftdic, data + index, size-index)) != size);
|
||||
#endif
|
||||
DEBUG_WIRE("Read %d bytes:", size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
DEBUG_WIRE(" %02x", data[i]);
|
||||
if (i && ((i & 0xf) == 0xf))
|
||||
DEBUG_WIRE("\n\t");
|
||||
}
|
||||
DEBUG_WIRE("\n");
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue