'\" te
.\"  Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SU 7D "Jun 18, 2004"
.SH NAME
su \- asynchronous serial port driver
.SH SYNOPSIS
.LP
.nf
#include <fcntl.h>
#include <sys/termios.h>
open("/dev/tty\fI[a-z]\fR", _\fImode\fR);
open("/dev/term\fI[a-z]\fR", _\fImode\fR);
open("/dev/cua\fI[a-z]\fR", _\fImode\fR);
.fi

.LP
.nf

.fi

.SH DESCRIPTION
.sp
.LP
The \fBsu\fR module is a loadable STREAMS driver that provides basic support
for standard \fBUARTS\fR that use Intel-8250, National
Semiconductor-16450/16550 hardware and Southbridge 1535D (16550 compatable)
Super I/O hardware. The module also provides keyboard and mouse I/O support for
Sun machines using those same Intel, National Semiconductor and Southbridge
chipsets. The \fBsu\fR driver provides basic asynchronous communication support
for serial ports. Both the serial devices and keyboard/mouse devices will have
streams built with appropriate modules pushed atop the  \fBsu\fR driver by
means of either the \fBautopush\fR(1M) or \fBdacf.conf\fR(4) facilities,
depending on the OS revision and architecture in use.
.sp
.LP
The \fBsu\fR module supports those \fBtermio\fR(7I) device control functions
specified by flags in the \fBc_cflag\fR word of the \fBtermios\fR structure,
and by the \fBIGNBRK,\fR \fBIGNPAR,\fR \fBPARMRK,\fR or \fBINPCK\fR flags in
the \fBc_iflag\fR word of the \fBtermios\fR structure. All other
\fBtermio\fR(7I) functions must be performed by \fBSTREAMS\fR modules pushed
atop the driver.  When a device is opened, the \fBldterm\fR(7M) and
\fBttcompat\fR(7M) \fBSTREAMS\fR modules are automatically pushed on top of the
stream, providing the standard \fBtermio\fR(7I) interface.
.sp
.LP
The character-special devices \fB/dev/ttya\fR and \fB/dev/ttyb\fR are used to
access the two standard serial ports. The \fBsu\fR module supports up to ten
serial ports, including the standard ports. The \fBtty\fR\fI[a-z]\fR devices
have minor device numbers in the range 00-03, and may be assigned names of the
form \fB/dev/ttyd_\fR\fIn_,\fR where \fI_n_\fR denotes the line to be accessed.
These device names are typically used to provide a logical access point for a
\fI_dial-in_\fR line that is used with a modem.
.sp
.LP
To allow a single tty line to be connected to a modem and used for incoming and
outgoing calls, a special feature is available that is controlled by the minor
device number. By accessing character-special devices with names of the form
\fB/dev/cua\fR\fI_n, \fR it is possible to open a port without the \fBCarrier
Detect\fR signal being asserted, either through hardware or an equivalent
software mechanism. These devices are commonly known as \fI_dial-out_\fR lines.
.SH APPLICATION PROGRAMMING INTERFACE
.sp
.LP
Once a \fB/dev/cua\fR\fI_n_\fR line is opened, the corresponding tty, or ttyd
line cannot be opened until the \fB/dev/cua\fR\fI_n_\fR line is closed. A
blocking open will wait until the \fB/dev/cua\fR\fI_n_\fR line is closed (which
will drop \fBData Terminal Ready\fR, after which \fBCarrier Detect\fR will
usually drop as well) and carrier is detected again. A non-blocking open will
return an error. If the \fB/dev/ttyd\fR\fI_n_\fR line has been opened
successfully (usually only when carrier is recognized on the modem), the
corresponding \fB/dev/cua\fR\fI_n_\fR line cannot be opened. This allows a
modem to be attached to a device, (for example, \fB/dev/ttyd0\fR, which is
renamed from \fB/dev/tty00\fR) and used for dial-in (by enabling the line for
login in \fB/etc/inittab\fR) or dial-out (by \fBtip\fR(1) or \fBuucp\fR(1C)) as
\fB/dev/cua0\fR when no one is logged in on the line.
.SH IOCTLS
.sp
.LP
The standard set of \fBtermio\fR \fBioctl()\fR calls are supported by \fBsu\fR.
.sp
.LP
Breaks can be generated by the \fBTCSBRK,\fR \fBTIOCSBRK,\fR and \fBTIOCCBRK\fR
\fBioctl()\fR calls.
.sp
.LP
The input and output line speeds may be set to any of the following baud rates:
0, 50, 75, 110, 134, 150, 200, 300, 600,   1200, 1800, 2400, 4800, 9600, 19200,
38400, 57600 or 115200. The speeds cannot be set independently; for example,
when the output speed is set, the input speed is automatically set to the same
speed.
.sp
.LP
When the  \fBsu\fR module is used to service the serial console port, it
supports a BREAK condition that allows the system to enter the debugger or the
monitor. The BREAK condition is generated by hardware and it is usually enabled
by default.
.sp
.LP
A BREAK condition originating from erroneous electrical signals cannot be
distinguished from one deliberately sent by remote DCE. The Alternate Break
sequence can be used as a remedy against this. Due to a risk of incorrect
sequence interpretation, SLIP and certain other binary protocols should not be
run over the serial console port when Alternate Break sequence is in effect.
Although PPP is a binary protocol, it is able to avoid these sequences using
the ACCM feature in \fIRFC 1662\fR. For Solaris PPP 4.0, you do this by adding
the following line to the \fB/etc/ppp/options\fR file (or other configuration
files used for the connection; see \fBpppd\fR(1M) for details):
.sp
.in +2
.nf
asyncmap  0x00002000
.fi
.in -2

.sp
.LP
By default, the Alternate Break sequence is a three character sequence:
carriage return, tilde and control-B (CR ~ CTRL-B), but may be changed by the
driver. For more information on breaking (entering the debugger or monitor),
see \fBkbd\fR(1) and \fBkb\fR(7M).
.SH ERRORS
.sp
.LP
An \fBopen()\fR will fail under the following conditions:
.sp
.ne 2
.na
\fB\fBENXIO\fR\fR
.ad
.RS 9n
The unit being opened does not exist.
.RE

.sp
.ne 2
.na
\fB\fBEBUSY\fR\fR
.ad
.RS 9n
The dial-out device is being opened while the dial-in device is already open,
or the dial-in device is being opened with a no-delay open and the dial-out
device is already open.
.RE

.sp
.ne 2
.na
\fB\fBEBUSY\fR\fR
.ad
.RS 9n
The unit has been marked as exclusive-use by another process with a
\fBTIOCEXCL\fR \fBioctl()\fR call.
.RE

.SH FILES
.sp
.ne 2
.na
\fB\fB/dev/cua/[a-z]\fR\fR
.ad
.RS 19n
dial-out tty lines
.RE

.sp
.ne 2
.na
\fB\fB/dev/term/[a-z]\fR\fR
.ad
.RS 19n
dial-in tty lines
.RE

.sp
.ne 2
.na
\fB\fB/dev/tty[a-z]\fR\fR
.ad
.RS 19n
binary compatibility package device names
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Architecture	 SPARC
.TE

.SH SEE ALSO
.sp
.LP
\fBstrconf\fR(1), \fBkbd\fR(1), \fBtip\fR(1),\fBuucp\fR(1C),
\fBautopush\fR(1M), \fBkstat\fR(1M), \fBpppd\fR(1M), \fBioctl\fR(2),
\fBopen\fR(2), \fBtermios\fR(3C), \fBdacf.conf\fR(4), \fBattributes\fR(5),
\fBkb\fR(7M), \fBldterm\fR(7M), \fBttcompat\fR(7M), \fBtermio\fR(7I)
.SH DIAGNOSTICS
.sp
.LP
The \fBsu\fR driver keeps track of various warning and error conditions using
\fBkstat\fR counters. The output of the \fBkstat su\fR command provides
\fBkstat\fR counters. The counters and their meaning follow:
.sp
.ne 2
.na
\fBsilo overflow\fR
.ad
.RS 24n
The internal chip FIFO received more data than it could handle. This indicates
that the Solaris operating environment was not servicing data interrupts fast
enough possibly due to a system with too many interrupts or a data line with a
data rate that is too high.
.RE

.sp
.ne 2
.na
\fBring buffer overflow\fR
.ad
.RS 24n
The \fBsu\fR module was unable to  store  data it removed from the chips
internal FIFO into a software buffer. The user process is not reading data fast
enough, possibly due to an overloaded system. If  possible, the application
should enable flow control (either CTSRTS or XONXOFF) to allow the driver to
backpressure the remote system when the local buffers fill up.
.RE