This article is from a FAQ concerning SCO operating systems. While some of the information may be applicable to any OS, or any Unix or Linux OS, it may be specific to SCO Xenix, Open Desktop or Openserver.

There is lots of Linux, Mac OS X and general Unix info elsewhere on this site: Search this site is the best way to find anything.

Serial Communications and UUCP

How do I adjust my 16550's trigger level?

The answer is different for Unix and Xenix, but much of the information is the same, so it's been grouped together here. We will deal with the common information first, and the specific details for Xenix and Unix.


Hate these ads?

By default, Xenix and Unix set the 16550's trigger level to 14. This means that once fourteen characters have been received, the 16550 will generate an interrupt (it will also generate an interrupt if the buffer is not full but serial data flow has stopped, so the system doesn't always have to wait until the trigger level is reached). This give the system two character times in which to begin to clear the buffer; at high speed on a highly loaded system, this may not be enough, and you may still lose characters even though you have a 16550. On the other hand, this value should generally be set as high as possible to reduce the number of interrupts generated; servicing an interrupt is quite costly in terms of CPU time.

There is an array in the kernel called sio_fifoctl[]. It is a 16-byte array with control values for different minor numbers. To find which array element will be used for a particular serial port, AND the minor number of the port with 0x0F (for example, /dev/tty2A has a minor number of 136 and /dev/tty2a of 8; either one ANDed with 0x0F yields 8, so sio_fifoctl[8] controls this port).

There are four different values you may wish to use for the entries in sio_fifoctl[]. A value of 0x0F sets the trigger value to 1; 0x4F sets it to 4; 0x8F sets it to 8; 0xCF sets it to 14 (these values are determined by the 16550 itself, not by SCO, and other values will not set the trigger level to intermediate values).

In Xenix, this parameter is set by patching the disk image of the kernel (/xenix) using adb (the info on how to find adb is elsewhere in this FAQ). The following is a sample adb session to change the trigger level of /dev/tty2A to 8 from 14 (the line numbers in parentheses are for the explanation below); the asterisks are adb's prompt and should not be typed in:

  1. cp /xenix /xenix.save
  2. adb -w /xenix -
  3. * sio_fifoctl+8/x
  4. sio_fifoctl+0x8: 0xcfcf
  5. * sio_fifoctl+0x8/w 0xcf8f
  6. sio_fifoctl+0x8: 0xcfcf= 0xcf8f
  7. * $q

Line 1 makes a backup, and line 2 runs adb in write mode. Line 3 tells adb to print the current value of sio_fifoctl[8]. Line 4 is adb's reply, which includes two bytes from this array (the rightmost one is the value for sio_fifoctl[8], and the leftmost is for sio_fifoctl[9]). You must look at these carefully, as one half will have to be changed while the other will have to be left alone. In line 5, we write 0xCF8F into this location; note that the value for sio_fifoctl[9] is left unchanged at 0xCF. Line 6 is adb's reply giving the old and new values. Line 7 quits adb.

For Unix, there is a table at the end of the text file /etc/conf/pack.d/sio/space.c which gives the same array. It is formatted in the same manner (to find the appropriate value, AND the minor device number with 0x0F).

If you run Unix, check the man page for the sar command to see if you have the -g option to check for serial I/O overruns. If so, try running it. If you see overruns, this indicates that your trigger level is set too high and the system doesn't have adequate time to service the 16550. The cure is to turn the trigger level down one notch and try again.

The information for Xenix in this answer is taken from the comp.unix.xenix.sco FAQ, maintained by Chip Rosenthal. The copyright for that document reads:

This collection is Copyright 1992-1994, Unicom Systems Development, Inc. All rights reserved. Permission granted to reproduce and distribute this document provided this notice remains intact and any changes to the document are clearly marked. We have tried to review all information, but cannot guarantee it for any particular purpose. We do not offer any warranties or representations, nor do we accept any liability for any damage resulting from the use or misuse of information or procedures in this document.


Technorati tags:  

Comments /SCOFAQ/FAQ_scotec5trigger.html


Add your comments

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Views for this page
Today This Week This Month This Year  Overall
2434286 459

/SCOFAQ/FAQ_trigger.html copyright 1997-2003 (various) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

More:
       - FAQ




Unix/Linux Consultants


http://www.cleverminds.net Need expert advice? Want a second opinion? CleverMinds is a one-stop-shop for a wide range of technology solutions. We support Unix, Linux, SCO as well as CMS, ecom, blogs, podcasts, search engines consulting and more. Contact us at web2.0@cleverminds.net 0r (617) 894-1282


http://echo3.net/ Unix/Linux Custom Applications, Web Hosting, C/C++ Programming Courses


larryi@ccamedical.com SCO OS5, Debian Linux, RedHat Linux, MySQL, Apache, AJAX development using dXport/dL4/Unibasic, Windows Connectivity, Sharing Resouces, Automation, Shell Scripting


Twitter
  • May 12 16:04
    Hmmm.. think I'm doing something at the gym that is hurting my neck.. not sure what.. I'll have to eliminate something for a few days to see
  • May 12 05:02
    It's not good to sound annoyed with customers:









Change Congress

Related Posts