Subject: Re: interrupting parallel port lossage
To: Ken Hornstein <kenh@cmf.nrl.navy.mil>
From: Bakul Shah <bakul@netcom.com>
List: port-i386
Date: 03/22/1995 18:40:33
> I had gotten in a new printer recently, and I discovered that when printing
> medium-to-large files that it dropped/munged characters, causing printer
> errors.  I remembered a number of people reported this problem, but as far
> as I can remember, no one proposed a fix.

The protocol is something like:

1. wait for BUSY to be deasserted.
2. write data byte
3. after at least 500 ns, pulse *STROBE low for at least 500 ns
4. Some time later the printer will pulse *ACK low for at least 5 us.
   It will (or at least ought to) lower BUSY when *ACK goes high.

May be you need to put *two* delays in lpintr()?

	/* is printer online and ready for output */
	if (NOT_READY() && NOT_READY_ERR())
		return 0;

	if (sc->sc_count) {
		/* send char */
		outb(iobase + lpt_data, *sc->sc_cp++);
--------->      inb(0x84);
		outb(iobase + lpt_control, control | LPC_STROBE);
--------->      inb(0x84);
		sc->sc_count--;
		outb(iobase + lpt_control, control);
	...