1 /**	$MirOS: src/sys/dev/ic/lptvar.h,v 1.2 2005/03/06 21:27:40 tg Exp $	*/
2 /*	$OpenBSD: lptvar.h,v 1.3 2002/03/14 01:26:54 millert Exp $ */
3 /*	$NetBSD: lpt.c,v 1.42 1996/10/21 22:41:14 thorpej Exp $	*/
4 
5 /*
6  * Copyright (c) 2003 Thorsten Glaser.
7  * Copyright (c) 1999 Pablo Ruiz Garcia.
8  * Copyright (c) 1994 Matthias Pfaller.
9  * Copyright (c) 1994 Poul-Henning Kamp
10  * Copyright (c) 1993, 1994 Charles Hannum.
11  * Copyright (c) 1990 William F. Jolitz, TeleMuse
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  * 3. All advertising materials mentioning features or use of this software
23  *    must display the following acknowledgement:
24  *	This software is a component of "386BSD" developed by
25  *	William F. Jolitz, TeleMuse.
26  * 4. Neither the name of the developer nor the name "386BSD"
27  *    may be used to endorse or promote products derived from this software
28  *    without specific prior written permission.
29  *
30  * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
31  * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
32  * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
33  * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
34  * NOT MAKE USE OF THIS WORK.
35  *
36  * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
37  * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
38  * REFERENCES SUCH AS THE  "PORTING UNIX TO THE 386" SERIES
39  * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
40  * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
41  * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
42  * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
43  * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
44  *
45  * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48  * ARE DISCLAIMED.  IN NO EVENT SHALL THE DEVELOPER BE LIABLE
49  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55  * SUCH DAMAGE.
56  */
57 
58 #ifndef	_SYS_DEV_IC_LPTVAR_H
59 #define	_SYS_DEV_IC_LPTVAR_H
60 
61 #include <sys/timeout.h>
62 
63 struct lpt_softc {
64 	struct device sc_dev;
65 	void *sc_ih;
66 	struct timeout sc_wakeup_tmo;
67 
68 	size_t sc_count;
69 	struct buf *sc_inbuf;
70 	u_int8_t *sc_cp;
71 	int sc_spinmax;
72 	bus_space_tag_t sc_iot;	/* bus tag */
73 	bus_space_handle_t sc_ioh; /* handle to the registers */
74 	u_int8_t sc_state;
75 #define	LPT_OPEN	0x01	/* device is open */
76 #define	LPT_OBUSY	0x02	/* printer is busy doing output */
77 #define	LPT_INIT	0x04	/* waiting to initialize for open */
78 	u_int8_t sc_flags;
79 #define	LPT_POLLED	0x10	/* configured for polling only */
80 #define	LPT_AUTOLF	0x20	/* automatic LF on CR */
81 #define	LPT_NOPRIME	0x40	/* don't prime on open */
82 #define	LPT_NOINTR	0x80	/* do not use interrupt */
83 	u_int8_t sc_control;
84 	u_int8_t sc_laststatus;
85 
86 #if defined(INET) && defined(PLIP)
87 #ifdef	__NetBSD__
88 	struct ethercom	sc_ethercom;
89 #else
90 	struct arpcom	sc_arpcom;
91 #endif
92 	struct timeout	sc_pliptimeout;
93 	u_char		*sc_ifbuf;
94 	int		sc_ifierrs;	/* consecutive input errors */
95 	int		sc_ifoerrs;	/* consecutive output errors */
96 	int		sc_ifsoftint;	/* i/o software interrupt */
97 	volatile int	sc_pending;	/* interrputs pending */
98 #define PLIP_IPENDING	1
99 #define PLIP_OPENDING	2
100 #endif
101 };
102 
103 int	lptintr(void *);
104 int	lpt_port_test(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
105 	    bus_size_t, u_int8_t, u_int8_t);
106 void	lpt_attach_common(struct lpt_softc *);
107 
108 #endif	/* ndef _SYS_DEV_IC_LPTVAR_H */
109