National Instruments PCI-232-4, PCI-232-2, PCI-485-8, PCI-232-8, PCI-485-4 User Manual

...
NOTE TO USERS
U
SING
PCI S

Contents

ERIAL WITH LINUX
This document contains instructions to help you install and configure the National Instruments serial hardware for Linux. This document includes information about the PCI-232/2, PCI-232/4, PCI-232/8, PCI-485/2, PCI-485/4, PCI-485/8, PCI-232/2 Isolated, PCI-232/4 Isolated, PCI-485/2 Isolated, and PCI-485/4 Isolated interfaces.
This document assumes that you are already familiar with Linux.
Related Documentation............................... ............................................2
Contributions...................................................................................2
Gather What You Need to Get Started....................................................2
Quick Start..............................................................................................4
Setup........................................................................................................5
Create Devices.................................................................................5
MAKEDEV Example...............................................................5
Find Interface Information...............................................................5
Assign Serial Driver.........................................................................6
setserial Example......................................................................7
Assign Serial Drivers Using PCI-485.......................................7
Assign Serial Drivers Using PCI Eight-Port Interfaces............7
Enable PCI Interrupt........................................................................7
Configuration..........................................................................................8
View Your Hardware Resources.....................................................8
Enable FIFO Buffers........................................................................8
FIFO Example..........................................................................9
Configure struct termios..................................................................9
Configure PCI-485..................................................................................10
Select Transceiver Mode.................................................................10
rs485 Example..........................................................................10
Lower Baud Rate Selection.............................................................10
Test the Setup..........................................................................................11
natinst.com™, National Instruments™, and NI-Serial™ are trademarks of National Instruments Corporation. Product and company names mentioned herein are trademarks or trade names of their respective companies.
322539A-01 © Copyright 1999 National Instruments Corp. All rights reserved. August 1999
Troubleshooting and Common Questions...............................................12
Error Codes.......................................................................................12
Common Questions..........................................................................13
Assign Driver....................................................... ....................................15
Sample /etc/rc.d/rc.serial File............................ .. ....................................17

Related Documentation

The following documents contain information that you might find helpful as you read this document:
Linux Serial-Progr amming-HOWTO b y Peter Baumann. You can find
the latest version of this document at the following locations:
ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/Serial-P
rogramming-HOWTO
http://metalab.unc.edu/LDP/HOWTO/Serial-Programming
-HOWTO.html
Linux Serial-HOWT O by David Lawyer . You can find the latest version
of this document at the following locations:
ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/Serial-H
OWTO
http://metalab.unc.edu/LDP/HOWTO/Serial-HOWTO.html

Contributions

Thanks to Vern Howie for providing suggestions and examples from his serial suite. Also, thanks to David Lawyer, Greg Hankins, and Peter Baumann for providing so much information in their HOWTOs.

Gather What You Need to Get Started

Before you install your PCI serial interface for Linux, make sure you have the following:
Linux kernel version 2.2.3 or later. The product has been thoroughly
tested with kernel version 2.2.3; howe ver , the product might work with
earlier kernel versions.
If you do not have kernel version 2.2.3 or later, or if you do not have
the following options already compiled into your kernel, you need to
recompile you kernel. Include the following options when you
configure and recompile the kernel using
Using PCI Serial with Linux 2 www.natinst.com
make menuconfig.
a. General Setup
PCI Support –PCI Quirks – Backward-compatible
/proc/pci
b. Character Devices
Standard/generic dumb serial support – Extended dumb serial driver options – Support more than four serial ports – Support for sharing serial interrupts
setserial 2.14 or later. To find the version of setserial
enter the
following:
linux# setserial –V
PCI Utilities 1.10 or later. You can download PCI Utilities 1.10 from
ftp://metalab.unc.edu/pub/Linux/hardware
PCI-SERIAL.tar.gz. You can download this file from the National Instruments FTP site at
ind_comm/serial/linux/
ftp://ftp.natinst.com/support/
After you have the file, extract and unzip it by entering the following:
linux# tar zxvf PCI-SERIAL.tar.gz
The tar command extracts and unzips PCI-SERIAL.tar.gz and creates the sub-directory
PCI-SERIAL. Enter the following to make
sure all necessary files are included:
linux# cd PCI-SERIAL linux PCI-SERIAL# ls
FIFOtrigger intenable serialtest FIFOtrigger_pci.c interrupt_enable.c serialtest.c Clock_speed.c rs485 termios_program.c clockspeed rs485.c
Configure your BIOS to include a Plug and Play aware OS.
You need superuser privileges to do most of the steps and program segments in this document.
© National Instruments Corporation 3 Using PCI Serial with Linux

Quick Start

This section is for experienced Linux users who are familiar with the
lspci and setserial tools. If you are not familiar with either of these
tools or if you require a detailed explanation of the steps, skip to the next section, Setup.
1. If you do not have enough available serial devices (
/dev/ttyS*) for
each port on your multiport interface, create a new serial device by entering the following:
linux# cd /dev linux /dev# ./MAKEDEV ttyS<
port number
>
2. Find the port address, IRQ, and memory assignment of your PCI serial interface by enter the following:
linux# lspci -v -n -d 1093:*
3. Assign the serial driver to your devices. Make sure you precede the port addresses with
0x.
For a PCI-232 interface, enter the following:
linux# setserial /dev/ttyS<
16550a port < ^fourport
port address
port number
> irq <
> uart
irq
>
For a PCI-485 interface, which supports a higher baud_base of
460.8K at startup, enter the following:
linux# setserial /dev/ttyS<
16550a port < baud_base 460800 ^fourport
port address
port number
> irq <
> uart
irq
>
4. Enable the PCI interrupt on your interface. To use intenable (from the
PCI-SERIAL directory) to enable interrupts on your PCI serial
interface, enter the following:
linux PCI-SERIAL# ./intenable <
found in lspci
pci memory address
>
5. If you have a PCI-485 interface, set the transcei ver mode for each serial port. Refer to the section Select Transceiver Mode for more information about selecting a PCI-485 transceiver mode.
6. After you connect a cable between the two ports, test the setup by running
linux# ./serialtest <
serialtest (from the PCI-SERIAL directory).
port number
receive port number
>
> <
transmit
Using PCI Serial with Linux 4 www.natinst.com

Setup

Create Devices

After you install the serial hardware (as shown in your PCI serial getting started manual), follow these steps to set up the interface.
Create a device for each port on your multiport interface. You only need to do this step once. Port address is the I/O address of the device, and port number is the device/serial port number of the port. Port number is used in the following context: your computer are typically named from port number you choose needs to be four or greater.
ttyS<
port number
/dev/ttyS0 to /dev/ttyS3, the
>. Since serial ports built into
Enter the each serial port on the interface by entering the following.
linux# cd /dev linux /dev# ./MAKEDEV ttyS<

MAKEDEV Example

Enter the following to make the devices for a two-port interface:
linux# cd /dev linux /dev# ./MAKEDEV ttyS4 linux /dev# ./MAKEDEV ttyS5

Find Interface Information

Follow these instructions to find the port address, IRQ, and memory assignment of your PCI serial interface.
Note
Repeat this section each time you add another interface or physical device to the
computer.
Note
This step may be done in normal user mode.
1. Use with the device codes as numbers), and the information only on devices with a National Instruments Vendor ID of 1093), to find the resource information of your serial interface.
linux# lspci -v -n -d 1093:*
Something similar to the following should appear. In this output, the IRQ is 11; the memory location is 0xdff80, and the port addresses are 0xdff0 and 0xdfe0.
/dev directory , then use the MAKEDEV script to create a de vice for
port number
lspci (a command that displays information about the PCI bus)
-v option (be verbose), the -n option (show PCI vendor and
-d 1093:* option (display
>
© National Instruments Corporation 5 Using PCI Serial with Linux
Note PCI Eight-Port Users—The PCI eight-port interfaces show only one I/O port
address listing. The addresses of the other seven I/O ports are calculated b y adding eight to the previous port address, (n × 8 + I/O port) for 0 < n < 8. The something similar to the following:

Assign Serial Driver

Note You need to repeat this step each time you restart your computer or until you set up
your
/etc/rc.d/rc.serial file. (Refer to the section Sample /etc/rc.d/rc.serial File for
more information on setting up the
00:0a.0 Class ff00: 1093:d140 (rev 01)
Flags: medium devsel, IRQ 11
Memory at 000dff80 (low-1M, non-prefetchable) I/O ports at dff0 I/O ports at dfe0
Write down the IRQ, memory location, and all the I/O port addresses for your computer.
lspci call displays
00:0a.0 Class ff00: 1093:d150 (rev 01)
Flags: medium devsel, IRQ 11
Memory at 000dff80 (low-1M, non-prefetchable)
I/O ports at df00
Assign the serial driver to your devices.
/etc/rc.d/rc.serial file.)
Enter the following to use UART, port address, and IRQ. Use information returned from the output, and remember to precede the port address with
linux# setserial /dev/ttyS<
port <
Note
The ^fourport flag is required regardless of how many ports you have on your
interface. The
^fourport flag tells the serial driver that you are not using an AST
setserial to tell the kernel each device’s
port address
port number
> irq <
irq
> uart 16550A
> ^fourport
lspci
0x.
four-port interface.
Caution Using an invalid port can lock up your machine.

setserial Example

Enter the following to assign the serial driver to your devices for the values in the above two-port
linux# setserial /dev/ttyS4 uart 16550A port 0xdff0 irq
11 ^fourport
Using PCI Serial with Linux 6 www.natinst.com
lscpi output:
linux# setserial /dev/ttyS5 uart 16550A port 0xdfe0 irq
11 ^fourport

Assign Serial Drivers Using PCI-485

Since the PCI-485 supports a higher baud_base of 460.8K at start-up, also enter the following at the linux prompt:
linux# setserial /dev/ttyS< 460800
port number
> baud_base
For example, enter the following to assign the serial dri ver to /dev/ttyS4 for a PCI-485 serial port at port address 0xdfe0 and IRQ 11.
linux# setserial /dev/ttyS4 uart 16550A port 0xdfe0 irq
11 ^fourport
linux# setserial /dev/ttyS4 baud_base 460800

Assign Serial Drivers Using PCI Eight-Port Interfaces

Enter the following to assign the serial driver to your devices for the PCI eight-port and are separated by exactly 8 bytes.
linux# setserial /dev/ttyS4 uart 16550A port 0xdf00 irq 11 ^fourport linux# setserial /dev/ttyS5 uart 16550A port 0xdf08 irq 11 ^fourport linux# setserial /dev/ttyS6 uart 16550A port 0xdf10 irq 11 ^fourport linux# setserial /dev/ttyS7 uart 16550A port 0xdf18 irq 11 ^fourport linux# setserial /dev/ttyS8 uart 16550A port 0xdf20 irq 11 ^fourport linux# setserial /dev/ttyS9 uart 16550A port 0xdf28 irq 11 ^fourport linux# setserial /dev/ttyS10 uart 16550A port 0xdf30 irq 11 ^fourport linux# setserial /dev/ttyS11 uart 16550A port 0xdf38 irq 11 ^fourport
lspci output. Notice that the entries for port are consecutive

Enable PCI Interrupt

To enable the PCI interrupt on your serial interface, use intenable, provided in the restart your computer. If you have more than one PCI serial interface, rerun
intenable with another PCI memory address specified in the command
line. Enter the following to use
© National Instruments Corporation 7 Using PCI Serial with Linux
PCI-SERIAL directory. Run intenable each time you
intenable:
linux PCI-SERIAL# ./intenable <
For example, enter the following to enable interrupts for a PCI serial interface with memory at 0x000dff80:
linux PCI-SERIAL# ./intenable dff80

Configuration

View Your Hardware Resources

To see what system resources your serial interface is using, use the
setserial command, as follows: linux# setserial -gv /dev/ttyS<
For the lspci and setserial examples, something similar to the following should appear:
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4 /dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3 /dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4 /dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3 /dev/ttyS4, UART: 16550A, Port: 0xdff0, IRQ: 11 /dev/ttyS5, UART: 16550A, Port: 0xdfe0, IRQ: 11
in lspci
PCI memory address found
>
port number
>

Enable FIFO Buffers

Use FIFOtrigger (from the PCI-SERIAL directory) to enable the receive and transmit FIFOs and to set the trigger levels of these FIFOs.
FIFOtrigger enables the FIFO of only one serial port. T o enable the FIFO
for your other serial ports, rerun number specified in the command line. Enter the following to use
FIFOtrigger: linux PCI-SERIAL#./FIFOtrigger <
<
rx_trigger
Using PCI Serial with Linux 8 www.natinst.com
FIFOtrigger with a different serial port
port number
> <
tx_trigger
>
>
Table 1.
tx_trigger Values
Transmit FIFO Trigger Level tx_trigger
8 0x00 16 0x10 32 0x20 56 0x30
Receive FIFO Trigger Level rx_trigger
The hardware issues a transmit empty interrupt when the number of characters in the transmit FIFO falls below the trigger level. Also, the hardware issues a receive full interrupt when the number of characters in the receive FIFO rises above the trigger level. For more information on FIFO buffers, refer to your PCI serial getting started manual.

FIFO Example

Enter the following to set the receive FIFO trigger level to 56 and the transmit trigger level to 32 for
linux PCI-SERIAL# ./FIFOtrigger 5 0x80 0x20

Configure struct termios

Every serial port has an associated struct termios. By using this
struct termios in a program, you can set the baud rate, character size
(number of data bits), parity, control characters, flow control, and input and output mode. For more information about the termios structure, refer to the
termios man page. To view the termios man page, enter the
following:
linux# man termios
Table 2.
rx_trigger Values
8 0x00 16 0x40 56 0x80 60 0xC0
/dev/ttyS5:
To configure your serial port, use a program segment similar to the
termios_program.c in your PCI-SERIAL directory.
© National Instruments Corporation 9 Using PCI Serial with Linux

Configure PCI-485

If you are using a PCI-485 interface, you can select the transceiver mode for each device and select the lower baud rates listed in
termios_program.c provided in your PCI-SERIAL directory.

Select Transceiver Mode

Use the rs485 program (from the PCI-SERIAL directory) to select the transceiver mode. To set the transceiver mode for other serial ports, rerun different serial port number specified in the command line. For more information on the transceiver control modes, refer to your serial getting started manual. If you do not know which transceiver mode to use, choose Four-Wire Mode.
rs485 sets the transceiver mode for only one serial port.
rs485 with a
Transceiver Mode Mode
Four-Wire Mode 0 Two-Wire Mode: DTR with echo 1 Two-Wire Mode: DTR controlled 2 Two-Wire Mode: TXRDY auto
control
Enter the following to use
linux PCI-SERIAL# ./rs485 <

rs485 Example

Enter the following to select Four-Wire Mode for /dev/ttyS5:
linux PCI-SERIAL# ./rs485 5 0

Lower Baud Rate Selection

To use a baud rate lower than 200, use setserial and the clockspeed program (from the single serial port from 460800 to 115200. After changing the baud base to 115200, the max baud rate you can achieve is 115200 baud (until you change the baud base back to 460800).
Table 3.
PCI-SERIAL directory) to lower the baud base of a
Transceiver Mode Values
rs485:
port number
> <
3
mode
>
After you change the run the your programs. The
Using PCI Serial with Linux 10 www.natinst.com
clockspeed program, you can use the lower baud rate flags in
baud_base of the serial port using setserial and
clockspeed program changes the baud base of only

Test the Setup

one serial port. To change the baud base of your other serial ports, rerun
clockspeed with a different serial port number specified in the command
line. Enter the following to set the baud base. (In this example, high equals a baud base of 460800 and low equals a baud base of 115200):
linux# setserial /dev/ttyS< linux PCI-SERIAL#./clockspeed <
"low"
>
port number
port number
> baud_base 115200
> <
"high" or
For example, enter the following to select a baud base of 115200 for
/dev/ttyS4 and for /dev/ttyS5:
linux# setserial /dev/ttyS4 baud_base 115200 linux# setserial /dev/ttyS5 baud_base 115200 linux PCI-SERIAL# ./clockspeed 4 low linux PCI-SERIAL# ./clockspeed 5 low
Enter the following to change the baud base back to 460800 for
/dev/ttyS4 and for /dev/ttyS5:
linux# setserial /dev/ttyS4 baud_base 460800 linux# setserial /dev/ttyS5 baud_base 460800 linux PCI-SERIAL# ./clockspeed 4 high linux PCI-SERIAL# ./clockspeed 5 high
After you connect the cables to the port (as shown in your PCI serial getting started manual), run the
serialtest program (from the PCI-SERIAL
directory) to verify your setup. Make sure you specify two different ports for the
serialtest program, as shown in the following:
linux PCI-SERIAL# ./serialtest <
<
transmit port number
receive port number
>
>
If the test is successful, it displays a SUCCESS message. If the test hangs, press <ctrl-c> to exit the program, and continue to the next section,
Troubleshooting and Common Questions.
To test
/dev/ttyS4 and /dev/ttyS5, connect a cable between the
two ports and enter the following:
linux PCI-SERIAL# ./serialtest 4 5
© National Instruments Corporation 11 Using PCI Serial with Linux

Troubleshooting and Common Questions

Error Codes

This section lists possible error codes and solutions.
Error Code /dev/ttyS< Solution The /dev/ttyS<
port number
port number
>: no such file or directory
> does not exist in the /dev directory . Enter the
following to create the device:
linux# cd /dev linux /dev# ./MAKEDEV ttyS<
port number
>
Error Code Couldn't change i/o privilege level: Operation not permitted Solution The program requires superuser privileges. Either exit and log in as root, or enter
the following:
linux$ su Password: < linux# <
enter the root password
run the program
>
>
Error Code setserial: Cannot set serial info: Address already in use Solution Make sure you are entering the correct port address into setserial. Also, make
sure you are entering
linux# setserial /dev/ttyS<
0x<
port address
0x if you are specifying a hex number.
port number
> irq <
irq
> ^fourport
> uart 16550a port
Error Code intenable: Can't open /dev/mem: Permission denied Solution The program requires superuser privileges. Either exit and log in as root, or enter
the following:
linux$ su Password: < linux# ./intenable <
Using PCI Serial with Linux 12 www.natinst.com
enter the root password
PCI memory
>
>
Error Code intenable: ERROR: Initial value of interrupt enable register
not equal to 0xC0C
Solution Make sure that you are providing the program with the correct memory address.
Enter the following to check for the memory address:
linux# lspci -v -n -d 1093:*
00:0a.0 Class ff00: 1093:d150 (rev 01) Flags: medium devsel, IRQ 11
Enter this address! -->Memory at 000dff80 non-prefetchable)
I/O ports at dff0 I/O ports at dfe0 I/O ports at dfa8 I/O ports at dfa0
linux# ./intenable dff80
(low-1M,
Error Code rs485: ERROR: Couldn't write to /dev/ttyS<
scratch register
port number
Solution Make sure the device was configured correctly in setserial. Enter the
following:
linux# setserial -gv /dev/ttyS< /dev/ttyS4, UART: 16550A, Port: 0xdff0, IRQ: 11
port number
>
If the port listing does not match the one found by lspci, reconfigure the device by entering the following:
linux# setserial /dev/ttyS<
<
port
> irq <
irq
port number
> ^fourport
> uart 16550a port

Common Questions

What do I do if intenable does not work immediately or causes a segmentation fault?
Enter the following to recompile
intenable. Also, the source code for intenable is available for editing
and viewing at
interrupt_enable.c provided in the PCI-SERIAL
directory.
linux PCI-SERIAL# gcc interrupt_enable.c -o intenable linux PCI-SERIAL# ./intenable <
in lspci
interrupt_enable.c and rerun
PCI memory address found
>
>'s
© National Instruments Corporation 13 Using PCI Serial with Linux
What do I do if FIFOtrigger does not work immediately or causes a segmentation fault?
Enter the following to recompile
FIFOtrigger. Also, the source code for FIFOtrigger is available for
editing and viewing at
PCI-SERIAL directory.
linux PCI-SERIAL# gcc -O FIFOtrigger_pci.c -o
linux PCI-SERIAL# ./FIFOtrigger <
FIFOtrigger_pci.c provided in the
FIFOtrigger
<
FIFOtrigger_pci.c and rerun
port number
rx_trigger
> <
tx_trigger
>
>
What do I do if rs485 does not work immediately?
Enter the following to recompile
rs485 is available for editing and viewing at rs385.c, provided in the PCI-SERIAL directory.
linux PCI-SERIAL# gcc -O rs485.c -o rs485
rs485.c. Also, the source code for
What do I do if clockspeed does not work immediately or if it causes a segmentation fault?
Enter the following to recompile
clockspeed. Also, the source code for clockspeed is available for
editing and viewing at
clock_speed.c, provided in the PCI-SERIAL
clock_speed.c and rerun
directory.
linux PCI-SERIAL# gcc -O clock_speed.c -o clockspeed linux PCI-SERIAL# ./clockspeed <
port number
> <
high/low
>
What do I do if serialtest does not work immediately or if it causes a segmentation fault?
Enter the following to recompile Also, the source code for at
serialtest.c, provided in the PCI-SERIAL directory.
linux PCI-SERIAL# gcc serialtest.c -o serialtest linux PCI-SERIAL# ./serialtest <
serialtest is available for editing and viewing
<
serialtest.c and rerun serialtest.
receive port number
transmit port number
>
>
What do I do if serialtest hangs?
Make sure the interface is seated correctly and tighten the scre w that holds the interface in place. Also, make sure the cables are attached to the correct ports. In some cases,
serialtest hangs if the transceiver modes
(PCI-485) are not set. Try setting both transmit and receive ports to transceiver mode 0 (Four-Wire Mode).
Using PCI Serial with Linux 14 www.natinst.com
linux# ./rs485 < linux# ./rs485 < linux# ./serialtest <
number
transmit port number receive port number
receive port number
>
> 0
> 0
> <
transmit port
What do I do if my ports are not communicating correctly and print strange characters?
Make sure the baud rate, character size, clock speed (if PCI-485) and parity are the same for both the receiver and transmitter. Also make sure the transceiver modes (PCI-485) have been selected for both transceivers.

Assign Driver

How can I use
/dev/ttyS3 as National Instruments serial ports?
/dev/ttyS0, /dev/ttyS1, /dev/ttyS2, or
Check for available serial devices by entering the following:
linux# setserial -gv /dev/ttyS* /dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3 /dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4 /dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
Devices labeled with UART: unknown are available for use. To designate the available device when using
linux# setserial /dev/ttyS<
port 0x<
port address
setserial, enter the following:
port number
> irq <
> uart 16550a
irq
> ^fourport
Use these instructions to automatically assign the driver at startup using
/etc/rc.d/rc.serial.
You should not change the
/etc/rc.d/rc.serial file until you have
your serial interfaces installed and configured. If you add another de vice or interface to your computer, and your also change
/etc/rc.d/rc.serial.
lspci output changes, make sure you
Depending on your Linux distribution, you might not have an directory. In this case, your
/etc/rc.serial. If you do not ha ve /etc/rc.d/, replace the references
to
/etc/rc.d/ with /etc/. If you are using a Debian distribution, replace
the references to
/etc/rc.boot/0setserial.
© National Instruments Corporation 15 Using PCI Serial with Linux
/etc/rc.d/rc.serial with
rc.serial would be located under
/etc/rc.d/
For more information about using setserial, refer to linux # more
/usr/doc/setserial*/README
.
1. Enter the following:
linux# cp /usr/doc/setserial*/rc.serial /etc/rc.d / linux# pico /etc/rc.d/rc.serial
a. Make sure that SETSERIAL= points to the correct location. Check
your
/bin and /sbin directories, and change the SETSERIAL=
line to say either
SETSERIAL=/sbin/setserial
SETSERIAL=/bin/setserial or
b. Under AUTOMATIC CONFIGURATION, leave the following lines
uncommented and delete or comment out (by adding a # to the beginning of the line) all the other lines in the section. (Depending on your version of
AUTO_IRQ=auto_irq ${SETSERIAL} /dev/cua0 ${AUTO_IRQ} skip_test
autoconfig ${STD_FLAGS} ${SETSERIAL} /dev/cua1 ${AUTO_IRQ} skip_test
autoconfig ${STD_FLAGS} ${SETSERIAL} /dev/cua2 ${AUTO_IRQ} skip_test
autoconfig ${STD_FLAGS} ${SETSERIAL} /dev/cua3 ${AUTO_IRQ} autoconfig
${STD_FLAGS}
setserial, ttyS might replace cua):
c. Under MANUAL CONFIGURATION, comment out or delete
everything but the following lines. Change the lines concerning
/dev/cua4-/dev/cua(4+n) (where
n
is the number of ports on
the PCI serial interface) to the following:
# These are the first set of AST Fourport ports # ${SETSERIAL} /dev/ttyS4 uart 16550A port <
address
${SETSERIAL} /dev/ttyS5 uart 16550A port <
address
${SETSERIAL} /dev/ttyS6 uart 16550A port <
address
${SETSERIAL} /dev/ttyS7 uart 16550A port <
address
> irq <
> irq <
> irq <
> irq <
irq
> ^fourport
irq
> ^fourport
irq
> ^fourport
irq
> ^fourport
port
port
port
port
Refer to the section Sample /etc/rc.d/rc.serial File for an example (configured according to the
lspci example above).
2. Enter the following:
linux# pico /etc/rc.d/rc
Using PCI Serial with Linux 16 www.natinst.com
3. Add the following segment to the end of the file (not necessary for Debian distribution):
if [ -f /etc/rc.d/rc.serial ]; then
sh /etc/rc.d/rc.serial fi

Sample /etc/rc.d/rc.serial File

# # /etc/rc.d/rc.serial # Initializes the serial ports on your system # # Distributed with setserial version 2.14 #
# Standard flags you want your serial devices to have # Examples: SAK, pgrp_lockout, session_lockout # STD_FLAGS="session_lockout"
SETSERIAL=/bin/setserial
echo -n "Configuring serial ports...."
# Do wild interrupt detection # ${SETSERIAL} -W /dev/cua0
############################################################### # # AUTOMATIC CONFIGURATION # ###############################################################
# Do AUTOMATIC_IRQ probing # AUTO_IRQ=auto_irq
# These are the standard COM1 through COM4 devices # # ${SETSERIAL} /dev/cua0 ${AUTO_IRQ} skip_test autoconfig ${STD_FLAGS} ${SETSERIAL} /dev/cua1 ${AUTO_IRQ} skip_test autoconfig ${STD_FLAGS} ${SETSERIAL} /dev/cua2 ${AUTO_IRQ} skip_test autoconfig ${STD_FLAGS} ${SETSERIAL} /dev/cua3 ${AUTO_IRQ} autoconfig ${STD_FLAGS}
############################################################### # # MANUAL CONFIGURATION # ###############################################################
© National Instruments Corporation 17 Using PCI Serial with Linux
# Changed for the two-port PCI-SERIAL interface. # ${SETSERIAL} /dev/ttyS4 uart 16550A port 0xdff0 irq 11 ^fourport ${SETSERIAL} /dev/ttyS5 uart 16550A port 0xdfe0 irq 11 ^fourport
########################################################### # # Print the results of the serial configuration process # ###########################################################
echo "done." ${SETSERIAL} -bg /dev/cua? /dev/cua??
Using PCI Serial with Linux 18 www.natinst.com
Loading...