No empty .Rs/.Re
[netbsd-mini2440.git] / sys / dev / ic / lptvar.h
blob7da4bdcad40c97a9d245300912555f5dc20075d8
1 /* $NetBSD: lptvar.h,v 1.55 2008/02/22 20:53:58 dyoung Exp $ */
3 /*
4 * Copyright (c) 1993, 1994 Charles M. Hannum.
5 * Copyright (c) 1990 William F. Jolitz, TeleMuse
6 * All rights reserved.
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.
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.
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.
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.
53 * Device Driver for AT style parallel printer port
56 #ifndef _LPT_VAR_H_
57 #define _LPT_VAR_H_
59 #include <sys/callout.h>
61 struct lpt_softc {
62 device_t sc_dev;
63 void *sc_ih;
64 callout_t sc_wakeup_ch;
65 size_t sc_count;
66 void *sc_sih;
67 void *sc_inbuf;
68 u_char *sc_cp;
69 int sc_spinmax;
70 bus_space_tag_t sc_iot;
71 bus_space_handle_t sc_ioh;
72 u_char sc_dev_ok; /* device attached correctly */
73 u_char sc_state;
74 #define LPT_OPEN 0x01 /* device is open */
75 #define LPT_OBUSY 0x02 /* printer is busy doing output */
76 #define LPT_INIT 0x04 /* waiting to initialize for open */
77 u_char sc_flags;
78 #define LPT_AUTOLF 0x20 /* automatic LF on CR */
79 #define LPT_NOPRIME 0x40 /* don't prime on open */
80 #define LPT_NOINTR 0x80 /* do not use interrupt */
81 u_char sc_control;
82 u_char sc_laststatus;
85 #define LPS_INVERT (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK)
86 #define LPS_MASK (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK|LPS_NOPAPER)
87 #define NOT_READY() ((bus_space_read_1(iot, ioh, lpt_status) ^ LPS_INVERT) & LPS_MASK)
88 #define NOT_READY_ERR() lptnotready(bus_space_read_1(iot, ioh, lpt_status), sc)
90 int lptnotready(u_char, struct lpt_softc *);
91 void lptwakeup(void *arg);
92 int lptpushbytes(struct lpt_softc *);
94 void lpt_attach_subr(struct lpt_softc *);
95 int lpt_detach_subr(device_t, int);
96 int lptintr(void *);
98 #endif /* _LPT_VAR_H_ */