[Linux-parport] questions about CyberParallel PCIe and modes
vinai
for_usenet at yahoo.com
Wed Sep 16 16:24:33 EDT 2009
Hi All,
I am relatively new to low-level parallel port hardware and operation, though not to linux.
We have some data acquisition hardware that we use a parallel port to trigger the start of. The relevant section of our code that does this is:
if (use_parallel_port==1) {
if (ioperm(BASEPORT,3,1)) {
perror("ioperm");
exit(1);
}
//Set the data signals (D0-7) of the port to all low (0)
outb(0,BASEPORT+2);
outb(0,BASEPORT);
outb(32,BASEPORT+2);
//Read from port
if (logging==1) {
log_message(LOG_FILE, "# INFO: Waiting for parallel port signal");
}
while (continue_waiting==0) {
portVal=inb(BASEPORT);
if ((portVal & 0x01)==0) continue_waiting=1;
}
}
On an older set of hardware where the parallel ports are on the motherboard (at address value 0x378 - which is what BASEPORT is defined as), this code does what it's supposed to - the program is launched, and it waits till it receives a trigger pulse that is fed to the relevant pin of the parallel port.
On newer hardware (a SIIG PCI express parallel port card), the above loop never waits. As soon as the program has launched, data acquisition begins without the trigger pulse. The only difference I've found is in the content of /proc/sys/dev/parport/parport0/modes. On the motherboard port (which works), that file has the contents PCSPP,TRISTATE. In the system with the SIIG card, the mode is PCSPP only. The output of lspci for the add-on PCI express card is:
03:00.0 Parallel controller: Oxford Semiconductor Ltd OX9162 Mode 0 (parallel port)
and it responds to setpci with the vendor and device ID 1415:8403. Its address, when loaded by the parport driver, is fcd8. This is on the kernel 2.6.18 version running on Centos 5.3 x86_64.
Is there a way to force this card to add the tristate mode when the parport driver is loaded, or to change the above code to wait appropriately till a trigger is received ?
Thanks all.
cheers
vinai
More information about the Linux-parport
mailing list