Installing a PCMCIA Device for QNX
Start the driver
The pcmciatrap utility can be very useful in determining which PCMCIA
driver to start and how to start it.
pcmciatrap - Autodetect PCMCIA adapter and optionally start correct driver.
pcmciatrap [options] [query] Print command line necessary to start driver.
pcmciatrap [options] start Start driver.
Options:
-q Quiet output
-v Verbose output for debugging.
Entering pcmciatrap start will start the appropriate PCMCIA driver for
your system.
Once this has been done you can use the pin command to view PCMCIA
statistics.
pin - display information about PCMCIA devices and servers (QNX)
pin [options]... [command]
Options:
-n node Information about server on this node
-s socket Information about this socket only (1 based)
Commands:
status Show status of each socket (default)
resources Port, irq and memory resources
config Attempt to make configuration file entries
cis Decode CIS on card
clear Clear all resource tables on server
file Cause server to reread configuration file
For example pin will display the number of slots you have and details
of any devices currently inserted. It should look something like this:
Sock Win Type Flags PID Base Size IRQ Base Size DMA
1 Empty ----MF---------- None
2 Empty ----MF---------- None
Configuring the Resources Required
The next step is to tell QNX which resources can be safely used by the
inserted cards. The PCMCIA Manager attempts to allocate resources to the cards
as they are inserted and we need to nake sure that it won't allocate resources
that are required elsewhere. To do this we need to edit the
/etc/config/pcmcia.node file. The file on my system looks like
this:
[resources]
memory = 0xd0000-0xd1fff
ports = 0x280-0x29f, 0x300-0x33f
rports = 0x2e8+8, 0x3e8+8, 0x170+8, 0x376+2
irqs = 12,7,5,3
- [resources]
- This tells the PCMCIA Manager that we are definig the resource set that it
may use. This is obligatory.
- memory = 0xd0000-0xd1fff
- This allocates a range of memory into which the PCMCIA Manager can put
inserted cards.
- ports = 0x280-0x29f, 0x300-0x33f
- These are the I/O ports that the cards can use. The PCMCIA Manager uses
the range on a best-fit, first-come first-served basis. If you have
insufficient ports then not all the devices will be able to start.
- rports = 0x2e8+8, 0x3e8+8 0x170+8 0x376+2
- This represents the range of ports that the PCMCIA Manager MUST not
use.
- irqs = 12,7,5,3
- The valid range of interrupts that can be assigned to cards as they are
inserted.
Configure Cards
Before QNX can auto-detect and configure the cards you must tell it about
them. Take a look at the /etc/config/pcmcia.cards file for a list of
all those currently supported. Entries follow the same format as the pin
config output:
; socket 1
[device]
manufacturer = "Socket Communications Inc"
product = "Socket EA PCMCIA LAN Adapter Revision E"
info1 = "Ethernet ID 00C01B006B0D"
regbase = 0x10000
config = 0x01, 0x0601, irq any, io any+32 (width=16)
config = 0x03, 0x0601, irq any, io 0x2a0-0x2bf (width=16)
config = 0x05, 0x0601, irq any, io 0x2c0-0x2df (width=16)
config = 0x07, 0x0601, irq any, io 0x2e0-0x2ff (width=16)
config = 0x09, 0x0601, irq any, io 0x300-0x31f (width=16)
config = 0x0b, 0x0601, irq any, io 0x320-0x33f (width=16)
config = 0x0d, 0x0601, irq any, io 0x340-0x35f (width=16)
config = 0x0f, 0x0601, irq any, io 0x360-0x37f (width=16)
register = 0, 0x40, 0x40 ; level mode interrupts
Any lines that begin with '#' or ';' are treated as
comments and ignored.
- [device]
- Tells the PCMCIA Manager that we are specifying a device description.
- manufacturer = "Socket Communications Inc"
- The Manufacturers ID is used by the PCMCIA Manager to find the best match
to the information retrieved from the Card Information Structure (CIS) when
the card is inserted. This can include wildcards like * ?.
- product = "Socket EA PCMCIA LAN Adapter Revision E"
- This is the product specifier as designated by the card manufacturer. When
more than one card from a manufacturer is inserted the product line will be
read to determine which is which. Wildcards are acceptable in this field.
- info1 = "Ethernet ID 00C01B006B0D"
- There are two optional info lines info1 and info2 which
contain manufacturer specific information about the card.
- regbase = 0x10000
- This line tells the server where in the card register space the
configuration registers reside. By default it will be 0x100.
- config = 0x01, 0x0601, irq any, io any+32 (width=16)
config = 0x03, 0x0601, irq any, io 0x2a0-0x2bf (width=16)
config = 0x05, 0x0601, irq any, io 0x2c0-0x2df (width=16)
config = 0x07, 0x0601, irq any, io 0x2e0-0x2ff (width=16)
config = 0x09, 0x0601, irq any, io 0x300-0x31f (width=16)
config = 0x0b, 0x0601, irq any, io 0x320-0x33f (width=16)
config = 0x0d, 0x0601, irq any, io 0x340-0x35f (width=16)
config = 0x0f, 0x0601, irq any, io 0x360-0x37f (width=16)
- This is broken down into the following fields:
- index
- This is a numeric constant that indicates the configuration index
value to be written to the card configuration register.
- type
- The type of card that is inserted. High order byte is generic and the
low order byte is specific.
- 0x0201 Serial/ modem devices with 8250/16450 devices
- 0x0301 PC Parallel ports
- 0x0401 ATA Hard Disk
- 0x0501 VGA Adaptor
- 0x0601 NE2000 compatible network card
- 0x0602 NCR Wavelan Card
- 0x8001 Adaptec T340 SCSI Adaptor (NCR53C400)
- 0x8101 New Media .WAVJammer
- resource
- Specifies what resources this configuration requires. POssible values
are:
- irq
- Specifies the IRQ to assign to the card. Multiple values can be
used by specifying irq | irq | irq and any of those entered may be
used.
- io
- The IO port range that may be used.The following options are
valied:
- start - end
- start + length
- ANY + length
- width=8
- width=16
- offset=
offset is not currently supported
- mem
to specify a 4K page aligned memory range.
NOTE: You will not ordinarily have to create one of these
descriptions by hand.
The /etc/config/pcmcia.cards file contains an up to date list of all
descriptions that are known to currently work with QNX. If your card does not
appear in this file it can be added by doing the following:
pin config > /tmp/pin.cfg
cat /tmp/pin.cfg >> /etc/config/pcmcia.cards
Once this has been done slay the PCMCIA Manager and re-start it and issue the
pin command. You should now see something like this:
Sock Win Type Flags PID Base Size IRQ Base Size DMA
1 0 NE2000 C---I-+--------W None 0x280 32 5
2 Empty ----MF---------- None
Take a note of these settings because you will need them when starting the
driver for the card.
Start the Driver
All that remains is for your to start the appropriate device driver to talk to
your hardware. QNX allows for the dynamic starting and stopping of device
drivers from the command line. So in our example above with the NE2000
compatible Network card you would enter:
Net.ether1000 -l2 -i5 -p 280 &
Automatically Launching the Driver when the Card is Inserted
Under Construction
For more details please see the PcmciaLaunch documentation.