libftdi: Use asynchronous transfers if header indicate newer libftdi1.
This is a hack to keep travis happy. Setting up travis to use a recent libftdi1 is a major issue.
This commit is contained in:
parent
9b6e19785e
commit
40ba261982
|
@ -1,5 +1,6 @@
|
||||||
SYS = $(shell $(CC) -dumpmachine)
|
SYS = $(shell $(CC) -dumpmachine)
|
||||||
CFLAGS += -DENABLE_DEBUG -DPLATFORM_HAS_DEBUG
|
CFLAGS += -DENABLE_DEBUG -DPLATFORM_HAS_DEBUG
|
||||||
|
CFLAGS += -DUSE_USB_VERSION_BIT
|
||||||
CFLAGS +=-I ./target -I./platforms/pc
|
CFLAGS +=-I ./target -I./platforms/pc
|
||||||
|
|
||||||
ifneq (, $(findstring linux, $(SYS)))
|
ifneq (, $(findstring linux, $(SYS)))
|
||||||
|
|
|
@ -343,8 +343,15 @@ bool libftdi_srst_get_val(void)
|
||||||
|
|
||||||
void libftdi_buffer_flush(void)
|
void libftdi_buffer_flush(void)
|
||||||
{
|
{
|
||||||
|
#if defined(USE_USB_VERSION_BIT)
|
||||||
|
static struct ftdi_transfer_control *tc_write = NULL;
|
||||||
|
if (tc_write)
|
||||||
|
ftdi_transfer_data_done(tc_write);
|
||||||
|
tc_write = ftdi_write_data_submit(ftdic, outbuf, bufptr);
|
||||||
|
#else
|
||||||
assert(ftdi_write_data(ftdic, outbuf, bufptr) == bufptr);
|
assert(ftdi_write_data(ftdic, outbuf, bufptr) == bufptr);
|
||||||
DEBUG_WIRE("FT2232 libftdi_buffer flush: %d bytes\n", bufptr);
|
DEBUG_WIRE("FT2232 libftdi_buffer flush: %d bytes\n", bufptr);
|
||||||
|
#endif
|
||||||
bufptr = 0;
|
bufptr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,10 +365,18 @@ int libftdi_buffer_write(const uint8_t *data, int size)
|
||||||
|
|
||||||
int libftdi_buffer_read(uint8_t *data, int size)
|
int libftdi_buffer_read(uint8_t *data, int size)
|
||||||
{
|
{
|
||||||
|
#if defined(USE_USB_VERSION_BIT)
|
||||||
|
struct ftdi_transfer_control *tc;
|
||||||
|
outbuf[bufptr++] = SEND_IMMEDIATE;
|
||||||
|
libftdi_buffer_flush();
|
||||||
|
tc = ftdi_read_data_submit(ftdic, data, size);
|
||||||
|
ftdi_transfer_data_done(tc);
|
||||||
|
#else
|
||||||
int index = 0;
|
int index = 0;
|
||||||
outbuf[bufptr++] = SEND_IMMEDIATE;
|
outbuf[bufptr++] = SEND_IMMEDIATE;
|
||||||
libftdi_buffer_flush();
|
libftdi_buffer_flush();
|
||||||
while((index += ftdi_read_data(ftdic, data + index, size-index)) != size);
|
while((index += ftdi_read_data(ftdic, data + index, size-index)) != size);
|
||||||
|
#endif
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue