Even if you don't need the extra layer of safety, a parport card is a good way to add extra I/O lines with EMC.
A PCI parport card I've come to use is made with the Netmos 9815 chipset. It has good +5V signals, and can come in a single or dual ports. What's more, they are inexpensive - you can find them for $11-$22 on the internet, just shop around.
To find the I/O addresses for these cards:
# lspci -v
Look for the entry with "NetMos" in it. Example of a 2-port card:
0000:01:0a.0 Communication controller: Netmos Technology PCI 9815 Multi-I/O Controller (rev 01) Subsystem: LSI Losgic / Symbios Logic 2POS (2 port parallel adapter) Flags: medium devsel, IRQ 5 I/O ports at b800 [size=8] I/O ports at bc00 [size=8] I/O ports at c000 [size=8] I/O ports at c400 [size=8] I/O ports at c800 [size=8] I/O ports at cc00 [size=16]
From experimentation, I've found the first port (the on-card port) uses the third address listed (c000), and the second port (the one that attaches with a ribbon cable) uses the first address listed (b800).
You can then open an editor and put the addresses into the appropriate place in your .hal file.
loadrt hal_parport cfg="0x378 0xc000"You must also direct emc to run the "read" and "write" functions for the second card. For example,
addf parport.1.read base-thread 1 addf parport.1.write base-thread -1
Please note that your values will differ. The Netmos cards are Plug-N-Play, and will change their settings depending on your system or even which slot you put them into, so if you're like me and like to 'get under the hood' and re-arrange things, be sure to check these values before you start EMC.
If you have another type of parport card, you may find that in the lspci -v the IO ports are shown as disabled, One remedy to this is as follows;
03:09.0 0701: 14db:2121 (prog-if 02 [ECP])
Subsystem: 14db:2121 Control: I/O- Mem- BusMaster?- SpecCycle?- MemWINV?- VGASnoop- ParErr?- Stepping- SERR- FastB2B?- Status: Cap+ 66MHz- UDF- FastB2B?+ ParErr?- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- Interrupt: pin A routed to IRQ 0 Region 0: I/O ports at b040 [disabled] [size=8] Region 1: I/O ports at b050 [disabled] [size=4] Region 2: I/O ports at b048 [disabled] [size=8] Region 3: I/O ports at b054 [disabled] [size=4] Capabilities: [a0] Power Management version 1 Flags: PMEClk- DSI- D1- D2- AuxCurrent?=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D0 PME-Enable- DSel=0 DScale=0 PME-
If the IO ports are disabled, you can run the following commands before starting EMC;
/sbin/insmod /lib/modules/2.6.24-16-rtai/kernel/drivers/parport/parport_pc.ko /sbin/rmmod ppdev /sbin/rmmod lp /sbin/rmmod parport_pc
This will load parport_pc which will initialize parport cards provided they are supported by parport_pc. The above commands can be added to /etc/rc.local so they run at boot time and initialize the ports. You must make sure that parport_pc is not loaded before you start EMC2 or it will error. The commands above will unload parport_pc, lp and ppdev.
Once this is working, edit the relevant .hal file and modify loadrt hal_parport cfg line as usual.
The data sheets from Moschip describe the register layout. Try google "9815 site:moschip.com" or whatever your chip type is.