Editorial review of Serial Port Configuration.

Minor shuffling to remove redundancy.

Sponsored by:	iXsystems
This commit is contained in:
Dru Lavigne 2014-05-07 16:22:52 +00:00
parent ad7752d013
commit c3f6f5d58b
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=44785

View file

@ -534,68 +534,19 @@
signal.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2>
<title>Kernel Configuration</title>
<para>&os; supports four serial ports by default. In the
&ms-dos; world, these are known as <filename>COM1</filename>,
<filename>COM2</filename>, <filename>COM3</filename>, and
<filename>COM4</filename>. &os; currently supports
<quote>dumb</quote> multiport serial interface cards, such as
the BocaBoard 1008 and 2016, as well as more intelligent
multi-port cards such as those made by Digiboard and Stallion
Technologies. However, the default kernel only looks for the
standard COM ports.</para>
<para>To see if the kernel recognizes the serial ports, watch
for messages while the kernel is booting, or use
<command>/sbin/dmesg</command> to replay the kernel's boot
messages. Look for messages that start with the characters
<literal>uart</literal>:</para>
<screen>&prompt.root; <userinput>/sbin/dmesg | grep 'uart'</userinput></screen>
<para>If the kernel does not recognize all of the serial ports,
configure <filename>/boot/device.hints</filename>. When
editing this file, one can comment out or completely remove
lines for devices that do not exist on the system.</para>
<note>
<para><literal>port IO_COM1</literal> is a substitution for
<literal>port 0x3f8</literal>, <literal>IO_COM2</literal> is
<literal>0x2f8</literal>, <literal>IO_COM3</literal> is
<literal>0x3e8</literal>, and <literal>IO_COM4</literal> is
<literal>0x2e8</literal>. These are fairly common port
addresses for their respective serial ports and interrupts
4, 3, 5, and 9 are fairly common interrupt request lines.
Regular serial ports <emphasis>cannot</emphasis> share
interrupts on ISA-bus PCs. Multiport boards have on-board
electronics that allow all the 16550A's on the board to
share one or two interrupt request lines.</para>
</note>
</sect2>
<sect2>
<title>Device Special Files</title>
<para>Most devices in the kernel are accessed through
<quote>device special files</quote> which are located in
<filename class="directory">/dev</filename>. The
<filename>sio</filename> devices are accessed through the
<filename>/dev/ttyu<replaceable>N</replaceable></filename>
(dial-in) and
<filename>/dev/cuau<replaceable>N</replaceable></filename>
(call-out) devices. &os; also provides initialization
<para>&os; also provides initialization
devices
(<filename>/dev/ttyu<replaceable>N</replaceable>.init</filename>
and
<filename>/dev/cuau<replaceable>N</replaceable>.init</filename>)
(<filename>/dev/ttyu<replaceable>N</replaceable>.init</filename> and
<filename>/dev/cuau<replaceable>N</replaceable>.init</filename>
or
<filename>/dev/cuad<replaceable>N</replaceable>.init</filename>)
and locking devices
(<filename>/dev/ttyu<replaceable>N</replaceable>.lock</filename>
and
<filename>/dev/cuau<replaceable>N</replaceable>.lock</filename>).
<filename>/dev/cuau<replaceable>N</replaceable>.lock</filename>
or
<filename>/dev/cuad<replaceable>N</replaceable>.lock</filename>).
The initialization devices are used to initialize
communications port parameters each time a port is opened,
such as <literal>crtscts</literal> for modems which use
@ -607,28 +558,56 @@
devices, and setting terminal options, respectively.</para>
</sect2>
<sect2 xml:id="serial-hw-config">
<title>Serial Port Configuration</title>
<para>By default, &os; supports four serial ports which are
commonly known as <filename>COM1</filename>,
<filename>COM2</filename>, <filename>COM3</filename>, and
<filename>COM4</filename>. &os; also supports
dumb multi-port serial interface cards, such as
the BocaBoard 1008 and 2016, as well as more intelligent
multi-port cards such as those made by Digiboard. However,
the default kernel only looks for the
standard <filename>COM</filename> ports.</para>
<para>To see if the system recognizes the serial ports, look for
system boot messages that start with
<literal>uart</literal>:</para>
<screen>&prompt.root; <userinput>grep uart /var/run/dmesg.boot</userinput></screen>
<para>If the system does not recognize all of the needed serial ports,
additional entries can be added to
<filename>/boot/device.hints</filename>. This file already
contains <literal>hint.uart.0.*</literal> entries for
<filename>COM1</filename> and <literal>hint.uart.1.*</literal> entries
for <filename>COM2</filename>. When adding a port entry for
<filename>COM3</filename> use
<literal>0x3E8</literal>, and for <filename>COM4</filename> use
<literal>0x2E8</literal>. Common <acronym>IRQ</acronym> addresses
are <literal>5</literal> for <filename>COM3</filename> and
<literal>9</literal> for <filename>COM4</filename>.</para>
<indexterm><primary><filename>ttyu</filename></primary></indexterm>
<indexterm><primary><filename>cuau</filename></primary></indexterm>
<para>The
<filename>ttyu<replaceable>N</replaceable></filename> (or
<filename>cuau<replaceable>N</replaceable></filename>)
is the regular device to open for applications. When a
process opens the device, it will have a default set of
terminal I/O settings. These settings can be viewed with the
command:</para>
<para>To determine the default set of terminal
<acronym>I/O</acronym> settings used by the port, specify its
device name. This example determines the settings for the
call-in port on <filename>COM2</filename>:</para>
<screen>&prompt.root; <userinput>stty -a -f /dev/ttyu1</userinput></screen>
<screen>&prompt.root; <userinput>stty -a -f /dev/<replaceable>ttyu1</replaceable></userinput></screen>
<para>When the settings are changed for a device, the settings
are in effect until the device is closed. When the device is
<para>System-wide initialization of serial devices is
controlled by <filename>/etc/rc.d/serial</filename>. This
file affects the default settings of serial devices. To
change the settings for a device, use <command>stty</command>.
By default, the changed settings
are in effect until the device is closed and when the device is
reopened, it goes back to the default set. To permanently
change the default set, open and adjust the settings of the
<quote>initial state</quote> device. For example, to turn on
initialization device. For example, to turn on
<option>CLOCAL</option> mode, 8 bit communication, and
<option>XON/XOFF</option> flow control for
<filename>ttyu5</filename>, type:</para>
@ -640,24 +619,16 @@
<secondary><filename>rc.serial</filename></secondary>
</indexterm>
<para>System-wide initialization of serial devices is
controlled by <filename>/etc/rc.d/serial</filename>. This
file affects the default settings of serial devices.</para>
<para>To prevent certain settings from being changed by an
application, make adjustments to the <quote>lock state</quote>
application, make adjustments to the locking
device. For example, to lock the speed of
<filename>ttyu5</filename> to 57600&nbsp;bps, type:</para>
<screen>&prompt.root; <userinput>stty -f /dev/ttyu5.lock 57600</userinput></screen>
<para>Now, an application that opens
<para>Now, any application that opens
<filename>ttyu5</filename> and tries to change the speed
of the port will be stuck with 57600&nbsp;bps.</para>
<para>The initial state and lock state devices should only be
writable by <systemitem
class="username">root</systemitem>.</para>
</sect2>
</sect1>