Make this work on fast platforms by making sure signals are held for at

least 1us.  Documentation I've found for the simple (SPP) parallel port
mode says that data should be stable 500ns before STROBE, STROBE should
be pulsed for no less than 500ns, and that data should be stable another
500ns after STROBE has been de-asserted.

Makes lpt@ebus on my Sun Ultra5 work with my HP DeskJet 712C, at least in
polled mode.  Thanks to Martin for astutely noting it was probably a bug
with STROBE being pulsed too quickly.
This commit is contained in:
rafal 2002-12-10 07:19:25 +00:00
parent 764daa3585
commit 3171f081c8
1 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpt.c,v 1.60 2002/10/23 09:13:17 jdolecek Exp $ */
/* $NetBSD: lpt.c,v 1.61 2002/12/10 07:19:25 rafal Exp $ */
/*
* Copyright (c) 1993, 1994 Charles M. Hannum.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.60 2002/10/23 09:13:17 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.61 2002/12/10 07:19:25 rafal Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -311,10 +311,13 @@ lptpushbytes(sc)
}
bus_space_write_1(iot, ioh, lpt_data, *sc->sc_cp++);
DELAY(1);
bus_space_write_1(iot, ioh, lpt_control,
control | LPC_STROBE);
DELAY(1);
sc->sc_count--;
bus_space_write_1(iot, ioh, lpt_control, control);
DELAY(1);
/* adapt busy-wait algorithm */
if (spin*2 + 16 < sc->sc_spinmax)
@ -402,6 +405,7 @@ lptintr(arg)
DELAY(1);
sc->sc_count--;
bus_space_write_1(iot, ioh, lpt_control, control);
DELAY(1);
sc->sc_state |= LPT_OBUSY;
} else
sc->sc_state &= ~LPT_OBUSY;