Add ifdef to check for libftdi 1.5 to use ftdi_tcioflush instead of ftdi_usb_purge_buffers

This commit is contained in:
Matthew Skolaut 2020-08-21 05:01:47 -05:00 committed by UweBonnes
parent 7e1b0321e2
commit dea4be2539
2 changed files with 10 additions and 0 deletions

View File

@ -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));

View File

@ -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));