libftdi Archives

Subject: Re: [PATCH] Deprecate ftdi_usb_purge_* functions & add ftdi_tc*flush methods

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 18 Jan 2019 15:47:48 +0100
Hi,

an updated version of the patch has been applied, thanks a lot Eric!

Link to the patchset:
http://developer.intra2net.com/git/?p=libftdi;a=commit;h=ed46f09c1ccd1351e003a200ba50e3e4778ac478
http://developer.intra2net.com/git/?p=libftdi;a=commit;h=c834fe721339f0fe21be6300db0b71f9fa22b077
http://developer.intra2net.com/git/?p=libftdi;a=commit;h=41b114dab8a6a6324d56f9b4e04466316ae23e8a

Most important commit message:

***********************************
Implement tc[io]flush methods & deprecate broken purge_buffers methods.

The definitions for the SIO_RESET_PURGE_RX or SIO_RESET_PURGE_TX values are
with respect to the FTDI chip, not the CPU.  That is, when the FTDI chip
receives a USB control transfer request with the command SIO_RESET_PURGE_RX,
the FTDI chip empties the FIFO containing data received from the CPU awaiting
transfer out the serial port to the connected serial device (e.g., a modem).
Likewise, upon reception of the SIO_RESET_PURGE_TX command, the FTDI chip
empties the FIFO of data received from the attached serial device destined to
be transmitted to the CPU.

Unfortunately the coding of the previous releases of libfti assumed these
commands had the opposite effect. This resulted in the function
ftdi_usb_purge_tx_buffer clearing data received from the attached serial
device.  Similarly, the function ftdi_usb_purge_rx_buffer cleared the FTDI
FIFO containing data to be transmitted to the attached serial device.  More
seriously, this latter function clear the libftid's internal buffer of data
received from the serial device, destined to the application program.

This patch adds the ftdi_tciflush, ftdi_tcoflush, and ftdi_tcioflush functions
which emulate the Linux serial port tcflush(3) function.
***********************************

There is another patch I didn't apply which are journal notes from testing
the purge functionality. I've attached the patch to this email so it's archived
in various mail archives.

Cheers,
Thomas


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Attachment: 0004-Add-samples-of-purge_test-outputs.patch
Description: Text document

Current Thread
  • Re: [PATCH] Deprecate ftdi_usb_purge_* functions & add ftdi_tc*flush methods, Thomas Jarosch <=