Merge pull request #792 from yegorich/ftdi-fix-deprecated-call
avrftdi: don't use the deprecated ftdi_usb_purge_buffers routine
This commit is contained in:
commit
97c34f7b26
|
@ -36,6 +36,7 @@ option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
include(CheckSymbolExists)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(FindPackageMessage)
|
include(FindPackageMessage)
|
||||||
|
|
||||||
|
@ -238,6 +239,8 @@ find_library(HAVE_LIBFTDI1 NAMES ${PREFERRED_LIBFTDI1})
|
||||||
if(HAVE_LIBFTDI1)
|
if(HAVE_LIBFTDI1)
|
||||||
set(LIB_LIBFTDI1 ${HAVE_LIBFTDI1})
|
set(LIB_LIBFTDI1 ${HAVE_LIBFTDI1})
|
||||||
set(HAVE_LIBFTDI_TYPE_232H 1)
|
set(HAVE_LIBFTDI_TYPE_232H 1)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${LIB_LIBFTDI1} ${LIB_LIBUSB} ${LIB_LIBUSB_1_0})
|
||||||
|
check_symbol_exists(ftdi_tcioflush "libftdi1/ftdi.h" HAVE_FTDI_TCIOFLUSH)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
|
@ -720,7 +720,11 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
|
||||||
/* set SPI mode */
|
/* set SPI mode */
|
||||||
E(ftdi_set_bitmode(pdata->ftdic, 0, BITMODE_RESET) < 0, pdata->ftdic);
|
E(ftdi_set_bitmode(pdata->ftdic, 0, BITMODE_RESET) < 0, pdata->ftdic);
|
||||||
E(ftdi_set_bitmode(pdata->ftdic, pdata->pin_direction & 0xff, BITMODE_MPSSE) < 0, pdata->ftdic);
|
E(ftdi_set_bitmode(pdata->ftdic, pdata->pin_direction & 0xff, BITMODE_MPSSE) < 0, pdata->ftdic);
|
||||||
|
#ifdef HAVE_FTDI_TCIOFLUSH
|
||||||
|
E(ftdi_tcioflush(pdata->ftdic), pdata->ftdic);
|
||||||
|
#else
|
||||||
E(ftdi_usb_purge_buffers(pdata->ftdic), pdata->ftdic);
|
E(ftdi_usb_purge_buffers(pdata->ftdic), pdata->ftdic);
|
||||||
|
#endif
|
||||||
|
|
||||||
write_flush(pdata);
|
write_flush(pdata);
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,9 @@
|
||||||
/* Define if lex/flex has yylex_destroy */
|
/* Define if lex/flex has yylex_destroy */
|
||||||
#cmakedefine HAVE_YYLEX_DESTROY 1
|
#cmakedefine HAVE_YYLEX_DESTROY 1
|
||||||
|
|
||||||
|
/* Define if ftdi1 has 'ftdi_tcioflush' function. */
|
||||||
|
#cmakedefine HAVE_FTDI_TCIOFLUSH 1
|
||||||
|
|
||||||
/* ----- Libraries and Headers ----- */
|
/* ----- Libraries and Headers ----- */
|
||||||
|
|
||||||
/* Define to 1 if the system has the type `uint_t'. */
|
/* Define to 1 if the system has the type `uint_t'. */
|
||||||
|
|
|
@ -195,6 +195,8 @@ if test x$have_libftdi1 = xyes; then
|
||||||
LIBFTDI1="-lftdi1"
|
LIBFTDI1="-lftdi1"
|
||||||
AC_DEFINE([HAVE_LIBFTDI1])
|
AC_DEFINE([HAVE_LIBFTDI1])
|
||||||
AC_SUBST(LIBFTDI1, $LIBFTDI1)
|
AC_SUBST(LIBFTDI1, $LIBFTDI1)
|
||||||
|
LIBS="${LIBS} ${LIBFTDI1}"
|
||||||
|
AC_CHECK_FUNCS(ftdi_tcioflush)
|
||||||
else
|
else
|
||||||
if test x$have_libftdi = xyes; then
|
if test x$have_libftdi = xyes; then
|
||||||
LIBFTDI="-lftdi -lusb"
|
LIBFTDI="-lftdi -lusb"
|
||||||
|
|
Loading…
Reference in New Issue