X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Flibsigrok-internal.h;h=a2350e02ddf3aed2c48c89bcab2ac8eb8f59dfae;hb=e1a712ca268df9c179377cf5c48ece8b87ed0ed7;hp=25297f4c9386561d8583494cf9e2c2c75e7cd3f6;hpb=968b1a23f23e1f22f7e438a39e3235b4f21b8b14;p=libsigrok.git diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 25297f4c..a2350e02 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -32,6 +32,9 @@ #ifdef HAVE_LIBUSB_1_0 #include #endif +#ifdef HAVE_LIBFTDI +#include +#endif #include #include #include @@ -981,6 +984,21 @@ static inline void write_dblle_inc(uint8_t **p, double x) libusb_handle_events_timeout(ctx, tv) #endif +/* + * Convenience for FTDI library version dependency. + * - Version 1.5 introduced ftdi_tciflush(), ftdi_tcoflush(), and + * ftdi_tcioflush() all within the same commit, and deprecated + * ftdi_usb_purge_buffers() which suffered from inverse semantics. + * The API is drop-in compatible (arguments count and data types are + * identical). The libsigrok source code always flushes RX and TX at + * the same time, never individually. + */ +#if defined HAVE_FTDI_TCIOFLUSH && HAVE_FTDI_TCIOFLUSH +# define PURGE_FTDI_BOTH ftdi_tcioflush +#else +# define PURGE_FTDI_BOTH ftdi_usb_purge_buffers +#endif + /* Static definitions of structs ending with an all-zero entry are a * problem when compiling with -Wmissing-field-initializers: GCC * suppresses the warning only with { 0 }, clang wants { } */