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