TS-UART low latency patch

Problem: when receiving small amounts of data, such as only a byte or two at a time, the latency between read() calls (which can be 10-20ms) is much greater than the time it takes to receive the data, resulting in poor performance.

Solution: Use the setserial command with the "low_latency" option to configure the port.

 From the man page of setserial for this option:
Minimize the receive latency of the serial device at the cost of
greater  CPU  utilization.   (Normally  there  is  an average of
5-10ms latency before characters are handed off to the line dis-
cipline  to  minimize  overhead.)   This  is off by default, but
certain real-time applications may find this useful.

However, we discovered that the TS-UART driver did not appear to support this option.  Further analysis provided a fix which results in the low_latency option to setserial working correctly.  However, some boards as shipped do not have this patched driver installed.   If you need this option and find that you receive an error message from setserial when trying to use it with a TS-UART,  it is likely that you will need to update your TS-UART core driver (tsuart0 for Linux 2.4 and  tsuart1 for Linux 2.6).

There are several ways to upgrade the TS-UART core driver.
  1. Re-compile from source using the latest source files:
  2. Patch your existing source files and re-compile. This option is useful if you do not want or need any other driver changes that may be present.
  3. Use the pre-compiled binary
The latest source files (as of 5/7/2009)  can be downloaded here:
Linux 2.4 
tsuart0.c (md5sum 0553956c7909b8249c4f9bd007dd0589)
tsuart.h (md5sum 96e531830e98847ed0c75bf795606285)
Linux 2.6
tsuart1.c (md5sum 44df8a7af9522f15cfc191c110deee8b)
tsuart1.h (md5sum 219fc3cb3b917d815b3168da3eb86a6b)

To patch your existing driver file (either Linux version), add the following lines of code to the function tsuart_verify_port()  in the main code path before the final return statement:
if (ser->baud_base < 9600) {
   ser->baud_base = 115200; // required to allow ioctl to set low_latency
The pre-compiled binary (as of 5/7/2009)  can be downloaded here:
Linux 2.4  tsuart0.o (md5sum cbd608377548b952efce84e85a3d71b8)
Linux 2.6  tsuart1.ko (md5sum 33a440b515c6ed4bcfaf7c25dd626703)

Initial version:  5/7/2009  4:44 p.m. MST