olpt.c (108470) | olpt.c (111748) |
---|---|
1/* 2 * Copyright (c) 1990 William F. Jolitz, TeleMuse 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 32 unchanged lines hidden (view full) --- 41 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 42 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 44 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 45 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 46 * SUCH DAMAGE. 47 * 48 * from: unknown origin, 386BSD 0.1 | 1/* 2 * Copyright (c) 1990 William F. Jolitz, TeleMuse 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 32 unchanged lines hidden (view full) --- 41 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 42 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 44 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 45 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 46 * SUCH DAMAGE. 47 * 48 * from: unknown origin, 386BSD 0.1 |
49 * $FreeBSD: head/sys/pc98/cbus/olpt.c 108470 2002-12-30 21:18:15Z schweikh $ | 49 * $FreeBSD: head/sys/pc98/cbus/olpt.c 111748 2003-03-02 16:54:40Z des $ |
50 */ 51 52/* 53 * Device Driver for AT parallel printer port 54 * Written by William Jolitz 12/18/90 55 */ 56 57/* --- 472 unchanged lines hidden (view full) --- 530 if (trys++ >= LPINITRDY*4) { 531 splx(s); 532 sc->sc_state = 0; 533 lprintf(("status %x\n", inb(port+lpt_status))); 534 return (EBUSY); 535 } 536 537 /* wait 1/4 second, give up if we get a signal */ | 50 */ 51 52/* 53 * Device Driver for AT parallel printer port 54 * Written by William Jolitz 12/18/90 55 */ 56 57/* --- 472 unchanged lines hidden (view full) --- 530 if (trys++ >= LPINITRDY*4) { 531 splx(s); 532 sc->sc_state = 0; 533 lprintf(("status %x\n", inb(port+lpt_status))); 534 return (EBUSY); 535 } 536 537 /* wait 1/4 second, give up if we get a signal */ |
538 if (tsleep ((caddr_t)sc, LPPRI|PCATCH, "lptinit", hz/4) != | 538 if (tsleep (sc, LPPRI|PCATCH, "lptinit", hz/4) != |
539 EWOULDBLOCK) { 540 sc->sc_state = 0; 541 splx(s); 542 return (EBUSY); 543 } 544 545 /* is printer online and ready for output */ 546 } while ((inb(port+lpt_status) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != --- 49 unchanged lines hidden (view full) --- 596 * Avoid possible hangs do to missed interrupts 597 */ 598 if (sc->sc_xfercnt) { 599 pl = spltty(); 600 lpt_intr(sc); 601 splx(pl); 602 } else { 603 sc->sc_state &= ~OBUSY; | 539 EWOULDBLOCK) { 540 sc->sc_state = 0; 541 splx(s); 542 return (EBUSY); 543 } 544 545 /* is printer online and ready for output */ 546 } while ((inb(port+lpt_status) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != --- 49 unchanged lines hidden (view full) --- 596 * Avoid possible hangs do to missed interrupts 597 */ 598 if (sc->sc_xfercnt) { 599 pl = spltty(); 600 lpt_intr(sc); 601 splx(pl); 602 } else { 603 sc->sc_state &= ~OBUSY; |
604 wakeup((caddr_t)sc); | 604 wakeup(sc); |
605 } 606} 607 608/* 609 * lptclose -- close the device, free the local line buffer. 610 * 611 * Check for interrupted write call added. 612 */ --- 16 unchanged lines hidden (view full) --- 629 sc->sc_state &= ~OPEN; 630 631#ifndef PC98 632 /* if the last write was interrupted, don't complete it */ 633 if((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) 634 while ((inb(port+lpt_status) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != 635 (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) 636 /* wait 1/4 second, give up if we get a signal */ | 605 } 606} 607 608/* 609 * lptclose -- close the device, free the local line buffer. 610 * 611 * Check for interrupted write call added. 612 */ --- 16 unchanged lines hidden (view full) --- 629 sc->sc_state &= ~OPEN; 630 631#ifndef PC98 632 /* if the last write was interrupted, don't complete it */ 633 if((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) 634 while ((inb(port+lpt_status) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != 635 (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) 636 /* wait 1/4 second, give up if we get a signal */ |
637 if (tsleep ((caddr_t)sc, LPPRI|PCATCH, | 637 if (tsleep (sc, LPPRI|PCATCH, |
638 "lpclose", hz) != EWOULDBLOCK) 639 break; 640 641 outb(sc->sc_port+lpt_control, LPC_NINIT); 642#endif 643 brelse(sc->sc_inbuf); 644 645end_close: --- 41 unchanged lines hidden (view full) --- 687 * little longer .. 688 */ 689 tic = tic + tic + 1; 690 /* 691 * But no more than 10 seconds. (vak) 692 */ 693 if (tic > MAX_SLEEP) 694 tic = MAX_SLEEP; | 638 "lpclose", hz) != EWOULDBLOCK) 639 break; 640 641 outb(sc->sc_port+lpt_control, LPC_NINIT); 642#endif 643 brelse(sc->sc_inbuf); 644 645end_close: --- 41 unchanged lines hidden (view full) --- 687 * little longer .. 688 */ 689 tic = tic + tic + 1; 690 /* 691 * But no more than 10 seconds. (vak) 692 */ 693 if (tic > MAX_SLEEP) 694 tic = MAX_SLEEP; |
695 err = tsleep((caddr_t)sc, LPPRI, | 695 err = tsleep(sc, LPPRI, |
696 "lptpoll", tic); 697 if (err != EWOULDBLOCK) { 698 return (err); 699 } 700 } 701 } 702 703 /* output data */ --- 45 unchanged lines hidden (view full) --- 749 if ((sc->sc_state & OBUSY) == 0){ 750 lprintf(("\nC %d. ", sc->sc_xfercnt)); 751 pl = spltty(); 752 lpt_intr(sc); 753 (void) splx(pl); 754 } 755 lprintf(("W ")); 756 if (sc->sc_state & OBUSY) | 696 "lptpoll", tic); 697 if (err != EWOULDBLOCK) { 698 return (err); 699 } 700 } 701 } 702 703 /* output data */ --- 45 unchanged lines hidden (view full) --- 749 if ((sc->sc_state & OBUSY) == 0){ 750 lprintf(("\nC %d. ", sc->sc_xfercnt)); 751 pl = spltty(); 752 lpt_intr(sc); 753 (void) splx(pl); 754 } 755 lprintf(("W ")); 756 if (sc->sc_state & OBUSY) |
757 if ((err = tsleep ((caddr_t)sc, | 757 if ((err = tsleep (sc, |
758 LPPRI|PCATCH, "lpwrite", 0))) { 759 sc->sc_state |= INTERRUPTED; 760 return(err); 761 } 762 } 763 /* check to see if we must do a polled write */ 764 if(!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) { 765 lprintf(("p")); --- 60 unchanged lines hidden --- | 758 LPPRI|PCATCH, "lpwrite", 0))) { 759 sc->sc_state |= INTERRUPTED; 760 return(err); 761 } 762 } 763 /* check to see if we must do a polled write */ 764 if(!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) { 765 lprintf(("p")); --- 60 unchanged lines hidden --- |