From dea4be2539c5ea63836ec78dca08b52fa8b26ab5 Mon Sep 17 00:00:00 2001 From: Matthew Skolaut Date: Fri, 21 Aug 2020 05:01:47 -0500 Subject: [PATCH] Add ifdef to check for libftdi 1.5 to use ftdi_tcioflush instead of ftdi_usb_purge_buffers --- src/platforms/hosted/libftdi_jtagtap.c | 5 +++++ src/platforms/hosted/libftdi_swdptap.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/platforms/hosted/libftdi_jtagtap.c b/src/platforms/hosted/libftdi_jtagtap.c index 99f21dd..26bcc30 100644 --- a/src/platforms/hosted/libftdi_jtagtap.c +++ b/src/platforms/hosted/libftdi_jtagtap.c @@ -47,7 +47,12 @@ static uint8_t jtagtap_next(uint8_t dTMS, uint8_t dTDI); int libftdi_jtagtap_init(jtag_proc_t *jtag_proc) { assert(ftdic != NULL); + /* select new buffer flush function if libftdi 1.5 */ +#ifdef _Ftdi_Pragma + int err = ftdi_tcioflush(ftdic); +#else int err = ftdi_usb_purge_buffers(ftdic); +#endif if (err != 0) { DEBUG_WARN("ftdi_usb_purge_buffer: %d: %s\n", err, ftdi_get_error_string(ftdic)); diff --git a/src/platforms/hosted/libftdi_swdptap.c b/src/platforms/hosted/libftdi_swdptap.c index 91e5428..c749180 100644 --- a/src/platforms/hosted/libftdi_swdptap.c +++ b/src/platforms/hosted/libftdi_swdptap.c @@ -46,7 +46,12 @@ int libftdi_swdptap_init(swd_proc_t *swd_proc) DEBUG_WARN("SWD not possible or missing item in cable description.\n"); return -1; } + /* select new buffer flush function if libftdi 1.5 */ +#ifdef _Ftdi_Pragma + int err = ftdi_tcioflush(ftdic); +#else int err = ftdi_usb_purge_buffers(ftdic); +#endif if (err != 0) { DEBUG_WARN("ftdi_usb_purge_buffer: %d: %s\n", err, ftdi_get_error_string(ftdic));