[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
i386 lpt speedup
- To: misc_(_at_)_openbsd_(_dot_)_org
- Subject: i386 lpt speedup
- From: Geoff Steckel <gwes_(_at_)_oat_(_dot_)_com>
- Date: Thu, 6 Apr 2000 20:14:49 -0400 (EDT)
The i386 "vanilla" LPT interface is set up to use an interrupt
for every character. Many modern printers can accept large blocks
of characters at a time. Substantial overhead can be removed with
the following change to lpt.c. I recommend its inclusion in OpenBSD.
I have used this for about 4 months now with no ill effects.
Note that the time spent in the lpt interrupt is bounded by the
clist maximum length.
regards,
Geoff Steckel
*** dev/ic/lpt.c Wed Mar 24 18:17:20 1999
--- /data/26/src/sys/dev/ic/lpt.c Mon Dec 27 14:00:49 1999
***************
*** 395,409 ****
(sc->sc_flags & LPT_NOINTR))
return 0;
/* is printer online and ready for output */
if (NOT_READY() && NOT_READY_ERR())
return -1;
if (sc->sc_count) {
u_int8_t control = sc->sc_control;
/* send char */
bus_space_write_1(iot, ioh, lpt_data, *sc->sc_cp++);
! delay (50);
bus_space_write_1(iot, ioh, lpt_control, control | LPC_STROBE);
sc->sc_count--;
bus_space_write_1(iot, ioh, lpt_control, control);
--- 395,421 ----
(sc->sc_flags & LPT_NOINTR))
return 0;
+ for (;;) {
+ int i ;
/* is printer online and ready for output */
+ for (i = 0 ; i < 10 ; i++)
+ if (NOT_READY())
+ delay(5) ;
+ else
+ goto ok ;
+ NOT_READY_ERR() ;
+ return -1 ;
+ #if 0
if (NOT_READY() && NOT_READY_ERR())
return -1;
+ #endif
+ ok:
if (sc->sc_count) {
u_int8_t control = sc->sc_control;
/* send char */
bus_space_write_1(iot, ioh, lpt_data, *sc->sc_cp++);
! delay (5);
bus_space_write_1(iot, ioh, lpt_control, control | LPC_STROBE);
sc->sc_count--;
bus_space_write_1(iot, ioh, lpt_control, control);
***************
*** 414,419 ****
--- 426,433 ----
if (sc->sc_count == 0) {
/* none, wake up the top half to get more */
wakeup((caddr_t)sc);
+ break ;
+ }
}
return 1;
Visit your host, monkey.org