diff options
Diffstat (limited to 'sys/i386/isa/lpt.c')
-rw-r--r-- | sys/i386/isa/lpt.c | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/sys/i386/isa/lpt.c b/sys/i386/isa/lpt.c index 2b5615817eaf..d9e1592c9ade 100644 --- a/sys/i386/isa/lpt.c +++ b/sys/i386/isa/lpt.c @@ -46,7 +46,7 @@ * SUCH DAMAGE. * * from: unknown origin, 386BSD 0.1 - * $Id: lpt.c,v 1.71 1998/10/22 05:58:39 bde Exp $ + * $Id: lpt.c,v 1.69 1998/06/07 17:10:44 dfr Exp $ */ /* @@ -189,12 +189,9 @@ #ifndef DEBUG -#define lprintf(args) +#define lprintf (void) #else -#define lprintf(args) do { \ - if (lptflag) \ - printf args; \ - } while (0) +#define lprintf if (lptflag) printf static int volatile lptflag = 1; #endif @@ -262,7 +259,6 @@ static struct lpt_softc { static timeout_t lptout; static int lptprobe (struct isa_device *dvp); static int lptattach (struct isa_device *isdp); -static ointhand2_t lptintr; #ifdef INET @@ -318,8 +314,8 @@ lpt_port_test (int port, u_char data, u_char mask) temp = inb(port) & mask; } while (temp != data && --timeout); - lprintf(("Port 0x%x\tout=%x\tin=%x\ttout=%d\n", - port, data, temp, timeout)); + lprintf("Port 0x%x\tout=%x\tin=%x\ttout=%d\n", + port, data, temp, timeout); return (temp == data); } @@ -426,7 +422,6 @@ lptattach(struct isa_device *isdp) struct lpt_softc *sc; int unit; - isdp->id_ointr = lptintr; unit = isdp->id_unit; sc = lpt_sc + unit; sc->sc_port = isdp->id_iobase; @@ -434,7 +429,7 @@ lptattach(struct isa_device *isdp) outb(sc->sc_port+lpt_control, LPC_NINIT); /* check if we can use interrupt */ - lprintf(("oldirq %x\n", sc->sc_irq)); + lprintf("oldirq %x\n", sc->sc_irq); if (isdp->id_irq) { sc->sc_irq = LP_HAS_IRQ | LP_USE_IRQ | LP_ENABLE_IRQ; printf("lpt%d: Interrupt-driven port\n", unit); @@ -443,9 +438,9 @@ lptattach(struct isa_device *isdp) #endif } else { sc->sc_irq = 0; - lprintf(("lpt%d: Polled port\n", unit)); + lprintf("lpt%d: Polled port\n", unit); } - lprintf(("irq %x\n", sc->sc_irq)); + lprintf("irq %x\n", sc->sc_irq); #ifdef DEVFS /* XXX what to do about the flags in the minor number? */ @@ -483,7 +478,7 @@ lptopen (dev_t dev, int flags, int fmt, struct proc *p) #endif if (sc->sc_state) { - lprintf(("lp: still open %x\n", sc->sc_state)); + lprintf("lp: still open %x\n", sc->sc_state); return(EBUSY); } else sc->sc_state |= INIT; @@ -497,7 +492,7 @@ lptopen (dev_t dev, int flags, int fmt, struct proc *p) } s = spltty(); - lprintf(("lp flags 0x%x\n", sc->sc_flags)); + lprintf("lp flags 0x%x\n", sc->sc_flags); port = sc->sc_port; /* set IRQ status according to ENABLE_IRQ flag */ @@ -524,7 +519,7 @@ lptopen (dev_t dev, int flags, int fmt, struct proc *p) if (trys++ >= LPINITRDY*4) { splx(s); sc->sc_state = 0; - lprintf(("status %x\n", inb(port+lpt_status))); + lprintf ("status %x\n", inb(port+lpt_status) ); return (EBUSY); } @@ -556,14 +551,14 @@ lptopen (dev_t dev, int flags, int fmt, struct proc *p) splx(s); /* only use timeout if using interrupt */ - lprintf(("irq %x\n", sc->sc_irq)); + lprintf("irq %x\n", sc->sc_irq); if (sc->sc_irq & LP_USE_IRQ) { sc->sc_state |= TOUT; timeout (lptout, (caddr_t)sc, (sc->sc_backoff = hz/LPTOUTINITIAL)); } - lprintf(("opened.\n")); + lprintf("opened.\n"); return(0); } @@ -573,7 +568,7 @@ lptout (void *arg) struct lpt_softc *sc = arg; int pl; - lprintf(("T %x ", inb(sc->sc_port+lpt_status))); + lprintf ("T %x ", inb(sc->sc_port+lpt_status)); if (sc->sc_state & OPEN) { sc->sc_backoff++; if (sc->sc_backoff > hz/LPTOUTMAX) @@ -630,7 +625,7 @@ lptclose(dev_t dev, int flags, int fmt, struct proc *p) end_close: sc->sc_state = 0; sc->sc_xfercnt = 0; - lprintf(("closed.\n")); + lprintf("closed.\n"); return(0); } @@ -649,7 +644,7 @@ pushbytes(struct lpt_softc * sc) char ch; int port = sc->sc_port; - lprintf(("p")); + lprintf("p"); /* loop for every character .. */ while (sc->sc_xfercnt > 0) { /* printer data */ @@ -720,16 +715,16 @@ lptwrite(dev_t dev, struct uio * uio, int ioflag) uiomove(sc->sc_cp, n, uio); sc->sc_xfercnt = n ; while ((sc->sc_xfercnt > 0)&&(sc->sc_irq & LP_USE_IRQ)) { - lprintf(("i")); + lprintf("i"); /* if the printer is ready for a char, */ /* give it one */ if ((sc->sc_state & OBUSY) == 0){ - lprintf(("\nC %d. ", sc->sc_xfercnt)); + lprintf("\nC %d. ", sc->sc_xfercnt); pl = spltty(); lptintr(sc - lpt_sc); (void) splx(pl); } - lprintf(("W ")); + lprintf("W "); if (sc->sc_state & OBUSY) if ((err = tsleep ((caddr_t)sc, LPPRI|PCATCH, "lpwrite", 0))) { @@ -739,7 +734,7 @@ lptwrite(dev_t dev, struct uio * uio, int ioflag) } /* check to see if we must do a polled write */ if(!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) { - lprintf(("p")); + lprintf("p"); if((err = pushbytes(sc))) return(err); } @@ -754,7 +749,7 @@ lptwrite(dev_t dev, struct uio * uio, int ioflag) * do checking for interrupted write call. */ -static void +void lptintr(int unit) { struct lpt_softc *sc = lpt_sc + unit; @@ -784,7 +779,7 @@ lptintr(int unit) if (sc->sc_xfercnt) { /* send char */ - /*lprintf(("%x ", *sc->sc_cp)); */ + /*lprintf("%x ", *sc->sc_cp); */ outb(port+lpt_data, *sc->sc_cp++) ; outb(port+lpt_control, sc->sc_control|LPC_STB); /* DELAY(X) */ @@ -801,7 +796,7 @@ lptintr(int unit) sc->sc_state &= ~OBUSY; if(!(sc->sc_state & INTERRUPTED)) wakeup((caddr_t)sc); - lprintf(("w ")); + lprintf("w "); return; } else { /* check for error */ if(((sts & (LPS_NERR | LPS_OUT) ) != LPS_NERR) && @@ -809,7 +804,7 @@ lptintr(int unit) sc->sc_state |= ERROR; /* lptout() will jump in and try to restart. */ } - lprintf(("sts %x ", sts)); + lprintf("sts %x ", sts); } static int @@ -992,7 +987,7 @@ lpioctl (struct ifnet *ifp, u_long cmd, caddr_t data) break; default: - lprintf(("LP:ioctl(0x%lx)\n", cmd)); + lprintf("LP:ioctl(0x%lx)\n", cmd); return EINVAL; } return 0; @@ -1089,7 +1084,7 @@ lpintr (int unit) sc->sc_iferrs = 0; if (IF_QFULL(&ipintrq)) { - lprintf(("DROP")); + lprintf("DROP"); IF_DROP(&ipintrq); goto done; } @@ -1138,7 +1133,7 @@ lpintr (int unit) sc->sc_iferrs = 0; if (IF_QFULL(&ipintrq)) { - lprintf(("DROP")); + lprintf("DROP"); IF_DROP(&ipintrq); goto done; } @@ -1160,7 +1155,7 @@ lpintr (int unit) err: outb(lpt_data_port, 0); - lprintf(("R")); + lprintf("R"); sc->sc_if.if_ierrors++; sc->sc_iferrs++; @@ -1224,7 +1219,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, if (ifp->if_flags & IFF_LINK0) { if (!(inb(lpt_stat_port) & CLPIP_SHAKE)) { - lprintf(("&")); + lprintf("&"); lptintr(ifp->if_unit); } @@ -1284,7 +1279,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, nend: if (err) { /* if we didn't timeout... */ ifp->if_oerrors++; - lprintf(("X")); + lprintf("X"); } else { ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; @@ -1293,7 +1288,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, m_freem(m); if (!(inb(lpt_stat_port) & CLPIP_SHAKE)) { - lprintf(("^")); + lprintf("^"); lptintr(ifp->if_unit); } (void) splx(s); @@ -1301,7 +1296,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, } if (inb(lpt_stat_port) & LPIP_SHAKE) { - lprintf(("&")); + lprintf("&"); lptintr(ifp->if_unit); } @@ -1326,7 +1321,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, if (err) { /* if we didn't timeout... */ ifp->if_oerrors++; - lprintf(("X")); + lprintf("X"); } else { ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; @@ -1354,7 +1349,7 @@ lpoutput (struct ifnet *ifp, struct mbuf *m, m_freem(m); if (inb(lpt_stat_port) & LPIP_SHAKE) { - lprintf(("^")); + lprintf("^"); lptintr(ifp->if_unit); } |