An I/O port is a way to get data into and out of a computer. There are many types of I/O ports such as serial ports, parallel ports, disk drive controllers, ethernet boards, etc. We will be dealing with serial ports since modems and terminals are serial devices. Each serial port must have an I/O address, and an interrupt (IRQ). There are the four serial ports corresponding to COM1 - COM4:
ttyS0 (COM1) address 0x3f8 IRQ 4
ttyS1 (COM2) address 0x2f8 IRQ 3
ttyS2 (COM3) address 0x3e8 IRQ 4
ttyS3 (COM4) address 0x2e8 IRQ 3
If Linux does not detect any serial ports when it boots, then
make sure that serial support is enabled and compiled into the
kernel. In this document, I refer to COM1 as ttyS0
, COM2
as ttyS1
, COM3 as ttyS2
, and COM4 as ttyS3
. Notice
that by default these devices have overlapping IRQs. You cannot use
all of the ports in this default configuration, and you must
reassign different IRQs. See section
Can I Use More Than Two Serial Devices? on setting IRQs.
On some installations, two extra devices will be created,
/dev/modem
for your modem and /dev/mouse
for your
mouse. Both of these are symbolic links to the appropriate
device in /dev
which you specified during the
installation (unless you have a bus mouse, then /dev/mouse
will point to the bus mouse device).
There has been some discussion on the merits of /dev/mouse
and
/dev/modem
. I strongly discourage the use of these links.
In particular, if you are planning on using your modem for dialin
you may run into problems because the lock files may not work
correctly if you use /dev/modem
. Use them if you like, but
be sure they point to the right device. However, if you change or
remove this link, some applications (minicom
for example) might
need reconfiguration.
Each ttyS device has a corresponding cua device. There has been some talk about abolishing cua so perhaps it's best to use ttyS. The main difference between cua and ttyS is that for an ordinary "open" command (without certain flags) in an application program, cua will open the port even if the modem control signals (such as DCD) say not to. (stty must have been set to check modem control signals.) A ttyS port would refuse to open in such a case, but it can be forced to open by giving a certain flag to the "open" command.
Thus a ttyS port can do everything a cua port can. Except that a "forced" open results in read statements in the program behaving in a certain way but the programmer may prevent this by adding some other statements to the program. Eliminating cua would brings Linux more into compliance with the Posix standard and avoids certain problems with lock files.
/dev
/dev/ttyS0 major 4, minor 64 /dev/cua0 major 5, minor 64
/dev/ttyS1 major 4, minor 65 /dev/cua1 major 5, minor 65
/dev/ttyS2 major 4, minor 66 /dev/cua2 major 5, minor 66
/dev/ttyS3 major 4, minor 67 /dev/cua3 major 5, minor 67
Note that all distributions should come with these devices already made
correctly (unless cua is abolished). You can verify this by typing:
linux% ls -l /dev/cua*
linux% ls -l /dev/ttyS*
/dev
If you don't have a device, you will have to create it with the
mknod
command. Example, suppose you needed to create devices
for ttyS0
:
linux# mknod -m 666 /dev/cua0 c 5 64
linux# mknod -m 666 /dev/ttyS0 c 4 64
You can use the MAKEDEV
script, which lives in /dev
.
This simplifies the making of devices. For example, if you needed
to make the devices for ttyS0
you would type:
linux# cd /dev
linux# ./MAKEDEV ttyS0
This handles the devices creation for the incoming and outgoing
devices, and should set the correct permissions.
The devices your multiport board uses depends on what kind of board
you have. Some of these are listed in detail in rc.serial
or
in 0setserial
which comes with the setserial
package. I highly recommend getting the latest version of
setserial
if you are trying to use multiport boards. You will
probably need to create these devices. Either use the mknod
command, or the MAKEDEV
script. Devices for multiport boards are
made by adding ``64 + port number''. So, if you wanted to create
devices for ttyS17
, you would type:
linux# mknod -m 666 /dev/cua17 c 5 81
linux# mknod -m 666 /dev/ttyS17 c 4 81
Note that ``64 + 17 = 81''. Using the MAKEDEV
script, you would
type:
linux# cd /dev
linux# ./MAKEDEV ttyS17
Note: the SIIG manual for the IO1812 listing for COM5-COM8 is wrong. They should be COM5=0x250, COM6=0x258, COM7=0x260, and COM8=0x268.
Note: the Digi PC/8 Interrupt Status Register is at 0x140.
Note: for an AST Fourport, you might need to specify skip_test
in rc.serial
.
Read the information that comes with the driver. These boards use special devices, and not the standard ones. This information varies depending on your hardware.