TAMS 81622 Installation instructions

TAMS 81622 PCI GPIO Card
for Linux
Installation & Operation Instructions

TAMS 81622 PCI GPIO Card
Installation & Operation Instructions
Test & Measurement Systems Inc.
750 14th Street SW
Loveland, CO 80537
USA
Telephone (970) 669 6553
Fax (970) 669 3090
Web Site www.tamsinc.com
Email [email protected]
Copyright Test & Measurement Systems Inc. 2000-2003

Contents
General Information....................................................................... 3
Unpacking your product
Overview of the TAMS 81622 GPIO Interface
Installing the Interface ................................................................... 5
Driver Installation.......................................................................... 6
Interface Configuration.................................................................. 8
Related Software Documentation................................................ 11
Standard Instrument Control Library for Linux
BASIC For Linux
Additional GPIO Documentation Online
Technical Information.................................................................. 12
Connector Pinouts
TAMS 81622 Enhancements beyond the HP 2074/5 .................. 14
TAMS 81622 PCI DMA
TAMS 81622 PCTL Delay
BootingAfter Configuration Changes
Appendix A: Wiring ................................................................... 17
Appendix B: File Locations........................................................ 20
Appendix C: TAMS 61622 SICL Extensions............................. 21
Warranty Information.................................................................... 28

General Information
Unpacking Your Product
When you open your TAMS GPIO Card shipment, examine its contents.
Note: The name of the product you have purchased is the TAMS 81622
(GPIO Card for Linux). It includes the TAMS 622-66501 GPIO card and the
t61622card driver for RedHatLinux. Seethe ReadMe for the versionsupported.
Please complete the registration card and return it to TAMS.
3

Overview of the TAMS 81622 GPIO Interface
This guide explains how to install and configure the TAMS 81622 GPIO (General
Purpose Input Output) interface.
GPIO is a parallel interface that is flexible and allows a variety of custom
connections. APCI expansion slot is required to accommodate the GPIO
interface card.
The TAMS GPIO card has a rotary DIP switch on the upper edge to set the
unique identifier for the card. This is the only switch that needs to be set prior to
installing the card. All other configuration is done in software.
Since the configuration of the GPIO interface (aside from setting the unique card
identifier) is done in software, rather than using DIP-switches or jumpers, this
guide also provides an explanation of the configuration process as it relates to
SICL. A detailed description of the TAMS GPIO’s functionality is included to aid
in this configuration process.
The TAMS 81622 provides 16 bit data exchange with peripheral devices that do
not support more common interface protocols like HP-IB or RS-232. Connection
flexibility is augmented in the TAMS GPIO interface by extra status and control
lines, a choice of handshake methods, several data-latching options, and
selectable data width and polarity.
There are two basic modes for the data ports in the TAMS GPIO interface. The
TAMS GPIO can be configured like the HP 98622 GPIO interface, which is called
Compatibility Mode. Alternately, the TAMS 81622 can be configured with a bi-
directional data port and auxiliary control lines, which is called Enhanced Mode
and is the same as that supported by HP 2074/5.
4

Installing the Interface
This section explains how to install the TAMS GPIO interface in the computer. To
complete the installation:
1. Make sure the computer is shut down properly, the power is turned off, and
the power cord is unplugged.
2. Refer to the Owner’s Guide of your computer for instructions on opening
your computer and installing PCI boards.
3. The rotary DIP switch on the upper edge of the TAMS 622-66501 card
should be set to the PCI slot number the card is going to reside in. If you
have multiple TAMS 622-66501 cards installed in a single machine, it is
important that the rotary DIP switches each be set to a unique number,
which is guaranteed if you set the switch to the slot number. (Be sure to
note the position of the rotary DIP switch, as you will need to know this when
you configure the card.)
4. Install the GPIO interface in the PC by plugging the card into the PCI slot.
5. Follow the instructions being careful to handle the TAMS 622-66501 board
only by its metal bracket. Avoid contact with the edges. After the board has
been plugged in and the retaining screw installed the computer should be
reassembled.
6. Prepare and install the GPIO interface cable.
Note: The TAMS 622-66501 card is a PCI device. Unlike most EISA and ISA
devices a PCI device does not require an I/O address or IRQ setting. These
settings are handled automatically.
5

Driver Installation
Note: Driver installation assumes basic knowledge about software installation
procedures specific to the platform. Refer to your platform specific operating
system documentation or contact your system administrator.
To install the t61622 driver it is not necessary for the TAMS 622-66501 interface
card(s) to be present in the system.
Note: You must have root permission to install the software. In addition, you
must have permission to write to the directories listed inAppendix B. Installation
of the TAMS GPIO driver (T81622) also requires that the TAMS I/O Libraries
(T82091) are already installed.
1Make sure that the I/O Libraries (T82091) for Linux are installed.
2Insert the installation CD-ROM into the drive and wait for the busy light to
remain off.
3Mount the CD-ROM. For example:
/bin/mount /dev/cdrom /mnt/cdrom
On some systems this step will be unnecessary since the Linux system will
mount the CD-ROM automatically.
/dev/cdrom is the device file for your CD-ROM drive and /mnt/cdrom
is a directory used as a mount point.
4Change to the directory where the driver is.
5Use RPM to install the driver. Architecture-specific versions of the software
have been provided for systems running the supported kernels; the
whichrpm.sh program returns the name of the correct RPM for your
system. (Note the use of backquotes (‘) rather than single quotes (‘).)
/bin/rpm –i ‘./whichrpm.sh‘
If this an upgrade over an existing version use the “-U” instead of “-i”:
/bin/rpm –U ‘./whichrpm.sh‘
6

6The T81622 RPM will automatically load the t61622 kernel module and build
the required device files.
7Once the installation is complete, unmount the CD.
cd /
/bin/umount /dev/cdrom
8Once the CD is unmounted, you may remove the media from the drive and
store it in a safe place.
In general, the installation procedure places the files in the necessary directories
by default. Appendix B is a reference for the Linux systems administrator, who
might wish to know where these files are placed.
You will still need to configure the new TAMS GPIO card as a SICL interface
card, as covered in the next section.
7

Interface Configuration
After installation of the driver software and loading of the t61622 kernel module
(handled automatically by the RPM package), the SICL configuration file /etc/
opt/sicl/hwconfig.cf needs to be edited to reflect the new interface
card. The version of SICL you are using includes the /opt/sicl/bin/
iosetup program, this can be used in place of manually editing the
hwconfig.cf file. You will still want to refer to this section for a description of
the fields.)
After configuration, the system does NOT need to be rebooted, nor does the
driver module need to be reloaded. However, the SICL iclear function should be
used after making changes to ensure that the configuration changes have taken
effect. See the man page on iclear (1).
For further configuration information, see the “Installing and Configuring the I/O
Libraries” chapter of the I/O Libraries Installation and Configuration Guide for
Linux.
For each TAMS 622-66501 card that you want to configure in your system, you
need to add a line to the hwconfig.cf file. While most users do not need to
see or use this file directly, having used iosetup to make configuration changes,
the fields and their respective meanings are important to know to properly use
the GPIO card.
The content of each line is as follows:
<lu> <name> t61622 <location> <sig> <polarity> <mode> <read_clk> <delay>
The fields are defined as:
Logical Unit (lu) The SICL Logical Unit number for this interface. This number
must be unique for the SICL interfaces currently configured on this machine. A
good choice for a logical unit number would be 12.
Symbolic Name (name) The unique SICL symbolic name. Agood choice would
be “gpio”.
Location The unique ID specified by the rotary DIP switch on the TAMS 622-
66501 being configured. This value is in the range 0-9
Signal (sig) Selects an Unix signal to be used by t61622 driver for interrupts. The value
must be in decimal format and must be 0 or one of the values defined in the signal.h
header file. Allowed signals are SIGIOT, SIGUSR1,
8

SIGUSR2 SIGIO or SIGURG. A value of 0 sets the default signal which is
SIGURG. Asignal is used by the t61622 driver to notify applications about kernel
events. You can select an alternate signal to avoid conflicts within your
application.
Polarity The logic polarity of various interface lines. A“0” sets active low
polarity; a “1” sets active high. Each bit controls the polarity of one function:
0b<Pullup><Data Out><Data In><PSTS><PFLG><PCTL>. For example,
0b111000 activates the pull up resistors and sets both Data Out and Data In to
active high, while PSTS, PFLG, and PCTL are all active low.
Mode A2-digit hexidecimal number that onfigures handshake and data port
mode. The most significant digit configures the data port.
HP 98622 compatibility mode:
0 = No DOUT clear at reset
1 = Clear DOUT at reset
Enhanced (bi-directional DINs) data port:
2 = No DOUT clear at reset
3 = Clear DOUT at reset
The least significant digit selects the PFLG/PCTL handshake mode.
0 = Full handshake
1 = Pulse handshake
2 =Async-Write/Pulse-Read handshake
For example, 0x10 specifies compatibility mode with DOUT cleared on reset and
full handshaking.
Read Clock (read_clk) Determines when data input registers are latched. The
first hex digit is for the upper (most significant) byte. Second hex digit is for the
lower byte. Valid values for each digit are:
0 = when register is read
1 = at busy edge
2 = at ready edge
Delay The delay (settling time) from data write to PCTL set:
0 = 200 nanoseconds
1 = 400 nanoseconds
2 = 700 nanoseconds
3 = 1.2 microseconds
4 = 2 microseconds
5 = 5 microseconds
6 = 10 microseconds
7 = 50 microseconds
9

The t61622 driver provides an alternate delay configuration method. The delay
may be expressed in nanoseconds or in microseconds. If the delay is expressed
in nanoseconds the decimal value representing that delay should be suffixed with
“ns”. If the delay is expressed in microseconds the decimal value representing
delay should be suffixed with “us”.Adecimal point is allowed. The minimum
delay is 90ns and maximum delay is 245us. Examples: 150ns, 2500ns (same as
2.5us), 1.15us, 90us.
10

Related Software Documentation
Standard Instrument Control Library for Linux
To configure the TAMS GPIO interface for the Standard Instrument Control
Library (SICL) for Linux, see the “Installing and Configuring the I/O Libraries”
chapter of the I/O Libraries Installation and Configuration Guide for Linux.
To develop SICL I/O applications for the TAMS card on Linux, see the “Using
GPIO with SICL” chapter of the SICL User’s Guide. SICL functions, including
those that are GPIO specific, are fully defined in the SICL User’s Guide. The
TAMS card also provides functionality enhancements.
BASIC for Linux
The TAMS GPIO interface is supported on version 11.0 of TAMS BASIC for
Linux.
When the GPIO interface has been configured for SICL, it is also ready to be
used from within BASIC for Linux. BASIC users will need to know the SICL
Logical Unit Number that has been assigned to the interface during
configuration, as this will correspond to the Select Code used to identify the
interface in their BASIC programs.
More information for the use of the GPIO interface is found on the TAMS BASIC
Documentation CD. Relevant sections are the “Linux Highlights” section of the
BASIC Language Reference, and the GPIO chapter of the BASIC Interface
Reference on the CD.
Additional GPIO Documentation Online
Technical articles and other additional GPIO documentation can be found on the
TAMS web site:
http://www.tamsinc.com/support/
11

Technical Information
This section provides a detailed, functional description of the TAMS 81622 GPIO
interface. You will need to understand this information in order to set the
appropriate configuration values. This information should also be helpful when
you are preparing and installing the GPIO cable.
After you have read this section and decided how you want to configure the
TAMS 622-66501 card, refer to your software documentation to configure your I/
O application software for the TAMS 622-66501 card. (See the “Related Software
Documentation” section of this guide.)
This section contains the following :
•Connector Pinouts
•Data Lines
•Peripheral Information Lines:
♦Peripheral Control and Peripheral Flag Handshake Lines (PCTL and
PFLG)
♦Input/Output Direction Control Line (I/O)
♦Peripheral Status Line (PSTS)
♦Peripheral Reset Line (P_RESET)
♦External Interrupt Request Line (EIR)
♦Control Output Lines (CTL0 and CTL1)
♦Status Input Lines (STI0 and STI1)
•Direct MemoryAccess (DMA)
12

Connector Pinouts
The following figure shows you the Pinouts on the TAMS 622-66501 GPIO
interface connector.
TAMS 622-66501 GPIO Connector Pinouts
lebaL)s(eniL
51IDhguorht0IDtupnIataD
51ODhguorht0ODtuptuOataD
GLFPdnaLTCPekahsdnahgalFlarehpirePdnalortnoClarehpireP
O/IlortnocnoitceridtuptuO/tupnI
STSPsutatSlarehpireP
TESER_PteseRlarehpireP
RIEtseuqeRtpurretnIlanretxE
1LTCdna0LTCtuptuOlortnoC
1ITSdna0ITStupnIsutatS
05NIPA57.0otdetimiltnerrucCDstloV5+
13

TAMS 81622 Enhancements beyond the HP 2074/5
TAMS 81622 PCI DMA.
The TAMS 81622 interface has two modes of transfer: DMAand interrupt driven.
A program may control transfer mode used by calls to ihint(). See the SICL
Reference Manual for more information.There are six values that could be
specified to this call:
•I_HINT_USEPOLL
•I_HINT_USEINTR
•I_HINT_USEDMA
•I_HINT_IO
•I_HINT_SYSTEM
•I_HINT_DONTCARE
If I_HINT_USEPOLL is specified, interrupt mode (I_HINT_USEINTR) is used.
This is due to the fact that with advances in hardware and operating systems,
there is no situation that using polled mode would have an advantage over
interrupt mode. Interrupt mode is not noticeably slower than polled and it
releases the processor while waiting for interrupts greatly improving system
overall performance.
If I_HINT_USEINTR is used, all inbound and outbound transfer will be performed
in interrupt mode. Each transfer of a single 8 or 16-bit data item (depending on
configured GPIO width) will be initiated, and the processor freed to perform other
tasks. Once the transfer is complete, the processor will initiate another transfer.
If the transfer is inbound and a termination and/or end character is specified, the
driver will check if the termination condition occurred before initiating another
transfer.
The igpioctrl(id, I_GPIO_READ_EOI,
<end_char>
)and
itermchr(id,
<term_chr>
)calls control end and termination characters.
If I_HINT_USEDMAis specified, DMA will always be used for outbound transfer.
For inbound transfer, if no termination nor end character is specified, DMA is
used. Otherwise interrupt mode (I_HINT_USEINTR) will be used. This will only
happen for the current transfer. No call to ihint() is required to restore DMA
transfer mode. For the next transfer, DMA will be resumed for outbound and if no
termination and/or end character is specified, for inbound transfers.
14

If I_HINT_IO or I_HINT_SYSTEM or I_HINT_DONTCARE is specified, then
DMA(I_HINT_USEDMA) will be used. The I_HINT_IO is intended for best
transfer performance and I_HINT_SYSTEM for best system performance
executing other applications. The fact is that both qualities are delivered best
when DMA is used.
However, there is a difference between above three modes and
I_HINT_USEDMA. It is possible for PCI bus DMA transfers to fail due to
hardware or OS instabilities. If this happens, the three modes described in this
paragraph will switch from that moment to interrupt mode (I_HINT_USEINTR)
until the computer is rebooted.An explicit ihint() call with I_HINT_USEDMA will
always use DMA; and, if a DMA bus error occurs, the iread or iwrite will return
with an error. That said, the PCI bus DMA error is very unlikely to occur.
TAMS 81622 PCTL delay.
The TAMS 81622 is much more flexible than any other available GPIO interface.
With the HP 2074/5 interface a user has a choice of one of eight delay time
values. The gaps between those values are significant and prevent performance
optimization. The TAMS 81622 accepts values directly in nanoseconds. The
range extends from 90 nanoseconds to 245000 nanoseconds (245
microseconds) allowing optimal transfer performance according to the length of
cable used. In addition, the time specified is applied with accuracy at any mode
of transfer, while other available GPIO interfaces add as much as 500 ns when
different modes are used. This caused users to configure more PCTL time than
actually required in order to compensate for worst possible transfer mode cases.
The TAMS 81622 PCTL delay is configurable via the SICL iosetup utility or it may
be changed at any time from within an application by a call to igpioctrl(id,
I_GPIO_PCTL_DELAY,
<val>
)where
<val>
could be one of eight HP 2074/5
compatible values, or directly a value in nanoseconds between 90 and 245000
inclusive.
The eight (0-7) HP 2074/5 compatible values are interpreted as follows:
0 - 200ns, 1 - 400ns, 2 - 700ns, 3 - 1.2µs, 4 - 2µs, 5 - 5µs, 6 - 10µs, 7 - 50µs.
Booting After Configuration Changes
When the TAMS GPIO card is reconfigured via either the SICL configuration
utility or by manually editing hwconfig.cf the system does not require rebooting,
nor does the driver module need to be reloaded, for the changes to
15

take effect. Changes take effect when a session on a newly configured interface
is started for the first time within a process.
Care should be taken when a running application is using the TAMS GPIO
interface while it is reconfigured.
If, for example, a polarity setting is changed on an interface while an application
is using it, it may take effect in the middle of a transfer causing undesired effects.
However, no fatal effects such as a system crash or device hang will be caused.
It is safest to perform an iclear on the interface after modifying its
configuration to guarantee that it is in a known state.
16

Appendix A: Wiring
Data Lines
There are 32 data lines on the TAMS GPIO: 16 designated as data input, and 16
designated as data output. Color codes are provided for the TAMS 622-001
GPIO cable and the HP 5061-4209 GPIO cable.
Data Input Lines
The 16 data input lines are labeled DI0 through DI15. The following table lists the
connector pin numbers and cable wire color codes for the data input lines.
Data Input Lines
lebaL.oNniP100-2269024-1605
0ID24yerGnoetihWkcalB
1ID14eulBnonworBnworB
2ID04teloiVnoetihWdeR
3ID93eulBnoetihWegnarO
4ID83neerGnoetihWwolleY
5ID73wolleYnoetihWneerG
6ID63egnarOnoetihWeulB
7ID53kniPnoetihWteloiV
8ID43neerGnonworBdeR/nworB/etihW
9ID33wolleYnonworBegnarO/nworB/etihW
01ID23egnarOnonworBwolleY/nworB/etihW
11ID13kniPnonworBneerG/nworB/etihW
21ID03yerGnonaTegnarO/deR/etihW
31ID92teloiVnonaTwolleY/deR/etihW
41ID82eulBnonaTneerG/deR/etihW
51ID72neerGnonaTeulB/deR/etihW
17

Data Output Lines
The 16 data output lines are labeled DO0 through DO15. The following table lists
the connector pin numbers and wire color codes for the data output lines.
Data Output Lines
lebaL.oNniP100-2269024-1605
0ID24yerGnoetihWkcalB
1ID14eulBnonworBnworB
2ID04teloiVnoetihWdeR
3ID93eulBnoetihWegnarO
4ID83neerGnoetihWwolleY
5ID73wolleYnoetihWneerG
6ID63egnarOnoetihWeulB
7ID53kniPnoetihWteloiV
8ID43neerGnonworBdeR/nworB/etihW
9ID33wolleYnonworBegnarO/nworB/etihW
01ID23egnarOnonworBwolleY/nworB/etihW
11ID13kniPnonworBneerG/nworB/etihW
21ID03yerGnonaTegnarO/deR/etihW
31ID92teloiVnonaTwolleY/deR/etihW
41ID82eulBnonaTneerG/deR/etihW
51ID72neerGnonaTeulB/deR/etihW
18

Peripheral Information Lines
The following table lists the connector pin numbers and wire color codes for the
peripheral information lines.
Peripheral Information Lines
lebaL.oNniP100-2269024-1605
DRG1 naTnowolleY
DRG81nworBnoteloiV
LTCP91etihWnonaTyerG/etihW
O/I02nworBnoyerGnworB/kcalB/etihW
TESER_P12kniPnoegnarOdeR/kcalB/etihW
0LTC22naTnonworBteloiV/deR/etihW
1LTC32naTnokniPyerG/deR/etihW
DRG42etihWnonworB
DRGytefaS52naTnoegnarO
DRG62wolleYnonaT
DRGytefaS24teloiVnonworB
GLFP44naTnoetihWyerG
STSP54yerGnonworByerG/kcalB/etihW
RIE64egnarOnokniPyerG/nworB/etihW
0ITS74nworBnonaTeulB/nworB/etihW
1ITS84kniPnonaTteloiV/nworB/etihW
DRG94nworBnoetihW
)desuf(5+05egnarOnonaT
19
Table of contents
Other TAMS PCI Card manuals