Home | History | Annotate | Line # | Download | only in ic
lptvar.h revision 1.46
      1 /*	$NetBSD: lptvar.h,v 1.46 1997/10/14 15:50:17 is Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1993, 1994 Charles Hannum.
      5  * Copyright (c) 1990 William F. Jolitz, TeleMuse
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This software is a component of "386BSD" developed by
     19  *	William F. Jolitz, TeleMuse.
     20  * 4. Neither the name of the developer nor the name "386BSD"
     21  *    may be used to endorse or promote products derived from this software
     22  *    without specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
     25  * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
     26  * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
     27  * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
     28  * NOT MAKE USE OF THIS WORK.
     29  *
     30  * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
     31  * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
     32  * REFERENCES SUCH AS THE  "PORTING UNIX TO THE 386" SERIES
     33  * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
     34  * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
     35  * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
     36  * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
     37  * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
     38  *
     39  * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
     40  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     41  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     42  * ARE DISCLAIMED.  IN NO EVENT SHALL THE DEVELOPER BE LIABLE
     43  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     44  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     45  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     46  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     47  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     48  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     49  * SUCH DAMAGE.
     50  */
     51 
     52 /*
     53  * Device Driver for AT style parallel printer port
     54  */
     55 
     56 #ifndef _LPT_VAR_H_
     57 #define _LPT_VAR_H_
     58 
     59 struct lpt_softc {
     60 	struct device sc_dev;
     61 	void *sc_ih;
     62 	size_t sc_count;
     63 	struct buf *sc_inbuf;
     64 	u_char *sc_cp;
     65 	int sc_spinmax;
     66 	bus_space_tag_t sc_iot;
     67 	bus_space_handle_t sc_ioh;
     68 	u_char sc_state;
     69 #define	LPT_OPEN	0x01	/* device is open */
     70 #define	LPT_OBUSY	0x02	/* printer is busy doing output */
     71 #define	LPT_INIT	0x04	/* waiting to initialize for open */
     72 	u_char sc_flags;
     73 #define	LPT_AUTOLF	0x20	/* automatic LF on CR */
     74 #define	LPT_NOPRIME	0x40	/* don't prime on open */
     75 #define	LPT_NOINTR	0x80	/* do not use interrupt */
     76 	u_char sc_control;
     77 	u_char sc_laststatus;
     78 };
     79 
     80 #define LPS_INVERT      (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK)
     81 #define LPS_MASK        (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK|LPS_NOPAPER)
     82 #define NOT_READY()     ((bus_space_read_1(iot, ioh, lpt_status) ^ LPS_INVERT) & LPS_MASK)
     83 #define NOT_READY_ERR() lptnotready(bus_space_read_1(iot, ioh, lpt_status), sc)
     84 
     85 int lptnotready __P((u_char, struct lpt_softc *));
     86 void lptwakeup __P((void *arg));
     87 int lptpushbytes __P((struct lpt_softc *));
     88 
     89 void lpt_attach_subr __P((struct lpt_softc *));
     90 int lptintr __P((void *));
     91 
     92 #endif /* _LPT_VAR_H_ */
     93