1 /* $NetBSD: lptvar.h,v 1.50 2000/03/23 07:01:31 thorpej Exp $ */ 2 3 /* 4 * Copyright (c) 1993, 1994 Charles M. 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 #include <sys/callout.h> 60 61 struct lpt_softc { 62 struct device sc_dev; 63 void *sc_ih; 64 struct callout sc_wakeup_ch; 65 size_t sc_count; 66 void *sc_inbuf; 67 u_char *sc_cp; 68 int sc_spinmax; 69 bus_space_tag_t sc_iot; 70 bus_space_handle_t sc_ioh; 71 u_char sc_dev_ok; /* device attached correctly */ 72 u_char sc_state; 73 #define LPT_OPEN 0x01 /* device is open */ 74 #define LPT_OBUSY 0x02 /* printer is busy doing output */ 75 #define LPT_INIT 0x04 /* waiting to initialize for open */ 76 u_char sc_flags; 77 #define LPT_AUTOLF 0x20 /* automatic LF on CR */ 78 #define LPT_NOPRIME 0x40 /* don't prime on open */ 79 #define LPT_NOINTR 0x80 /* do not use interrupt */ 80 u_char sc_control; 81 u_char sc_laststatus; 82 }; 83 84 #define LPS_INVERT (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK) 85 #define LPS_MASK (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK|LPS_NOPAPER) 86 #define NOT_READY() ((bus_space_read_1(iot, ioh, lpt_status) ^ LPS_INVERT) & LPS_MASK) 87 #define NOT_READY_ERR() lptnotready(bus_space_read_1(iot, ioh, lpt_status), sc) 88 89 int lptnotready __P((u_char, struct lpt_softc *)); 90 void lptwakeup __P((void *arg)); 91 int lptpushbytes __P((struct lpt_softc *)); 92 93 void lpt_attach_subr __P((struct lpt_softc *)); 94 int lptintr __P((void *)); 95 96 #endif /* _LPT_VAR_H_ */ 97