Async ports permit the connection to a computer of optional devices such as terminals, printers, fax machines, and modems. Async ports are provided by adapter devices such as the 8-, 16-, or 64-port IBM adapters or the 128-port Digiboard adapter, which reside on the Micro Channel and provide multiple asynchronous connections, typically RS232 or RS422. Many adapters, such as the three IBM async adapters mentioned above, were originally designed for servicing terminals and printers, and so are optimized for output (sends). Input processing (receives) is not as well optimized, perhaps because the assumption was once made that users could not type very fast. This is not a great concern when data transmission is slow and irregular, as with keyboard input. It becomes a problem with raw-mode applications, where massive chunks of input are transmitted by other computers and by devices such as fax machines. In raw-mode processing, data is treated as a continuous stream; input bytes are not assembled into lines, and erase and kill processing are disabled.
While some adapters have inherent limitations, the guidelines and techniques described here can provide better performance from these adapters for raw-mode transfers.
A shell script containing appropriate stty commands to implement most of the following tuning techniques is given at the end of the section.
# stty -echo < /dev/ttyn
# stty -opost < /dev/ttyn
Also, concentrator saturation is a concern because, if the concentrator box approaches overload, no additional throughput is accepted. The effective baud rate is lowered, and there is a noticeable slowdown in work.
The fastport.sh script is intended to condition a TTY port for fast file transfers in raw mode; for example, when a fax machine is to be connected. Using the script may improve CPU performance by a factor of 3 at 38,400 baud. The fastport.sh script is not intended for the canonical processing that is used when interacting with a user at an async terminal, because canonical processing cannot be easily buffered. The bandwidth of the canonical read is too small for the fast-port settings to make a perceptible difference.
Any TTY port can be configured as a fast port. The improved performance is the result of reducing the number of interrupts to the CPU during the read cycle on a given TTY line. To configure a TTY port as a fast port, do the following:
#**************************************************************** # # Configures a fastport for "raw" async I/O. # #**************************************************************** set -x sync;sync i=$1 if [ $i -le 100 ] then # for the native async ports and the 8-, 16-, and 64-port adapters # set vmin=255 and vtime=0.5 secs with the following stty stty -g </dev/tty$i |awk ' BEGIN { FS=":";OFS=":" } { $5="ff";$6=5;print $0 } ' >foo # for a 128-port adapter, remove the preceding stty, then # uncomment and use the # following stty instead to # set vmin=255 and vtime=0 to offload line discipline processing # stty -g </dev/tty$i |awk ' BEGIN { FS=":";OFS=":" } # { $5="ff";$6=0;print $0 } ' >foo stty `cat foo ` </dev/tty$i sleep 2 # set raw mode with minimal input and output processing stty -opost -icanon -isig -icrnl -echo -onlcr</dev/tty$i rm foo sync;sync else echo "Usage is fastport.sh < TTY number >" fi
# fastport.sh ttynumber