I'm attempting to write to the parallel port for the first time using the vxWorks lptDrv driver, but a call to write() always seems to return a -1. Here's the code I'm using:
#define PARALLEL_PORT "/lpt/0"
/* Create a device for the parallel port */
lptDevCreate(PARALLEL_PORT,0)
/*open the parallel port*/
parallelPortFD = open(PARALLEL_PORT, O_CREAT|O_WRONLY, 0))
LOCAL UINT32 watchdogBit = 0x01;
if (write(parallelPortFD, (char*) watchdogBit, sizeof(UINT32)) == -1)
{
/* Always hits this block */
}
Both calls to lptDevCreate and open return okay. I currently don't have the hardware plugged into the parallel port, so that makes it difficult to test, but I don't think that would cause a write failure either.
For some more info, I was able to call lptShow(), but I'm not sure what I'm looking at:
controlReg = 0xff
statusReg = 0xff
created = TRUE
autofeed = TRUE
inservice = FALSE
normalInt = 0
defaultInt = 0
retryCnt = 1
busyWait (loop) = 10000
strobeWait (loop) = 10000
timeout (sec) = 1
intLevel (IRQ) = 7