1 /* $NetBSD: lptvar.h,v 1.9 2007/03/08 14:45:07 he Exp $ */
4 * Copyright (c) 2004 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef __DEV_PPBUS_LPTVAR_H
33 #define __DEV_PPBUS_LPTVAR_H
35 #include <machine/vmparam.h>
36 #include <dev/ppbus/ppbus_device.h>
38 /* #define LPINITRDY 4 wait up to 4 seconds for a ready
39 #define BUFSTATSIZE 32
40 #define LPTOUTINITIAL 10 initial timeout to wait for ready 1/10 s
41 #define LPTOUTMAX 1 maximal timeout 1 s */
42 #define LPPRI (PZERO+8)
43 #define BUFSIZE PAGE_SIZE
45 #define LPTUNIT(s) (minor(s) & 0xff)
46 #define LPTCTL(s) (minor(s) & 0x100)
48 /* Wait up to 16 seconds for a ready */
49 #define LPT_TIMEOUT ((hz)*16)
50 #define LPT_STEP ((hz)/4)
53 struct ppbus_device_softc ppbus_dev
;
57 #define OPEN (unsigned)(1<<0) /* device is open */
58 #define ASLP (unsigned)(1<<1) /* awaiting draining of printer */
59 #define EERROR (unsigned)(1<<2) /* error was received from printer */
60 #define OBUSY (unsigned)(1<<3) /* printer is busy doing output */
61 #define LPTOUT (unsigned)(1<<4) /* timeout while not selected */
62 #define TOUT (unsigned)(1<<5) /* timeout while not selected */
63 #define LPTINIT (unsigned)(1<<6) /* waiting to initialize for open */
64 #define INTERRUPTED (unsigned)(1<<7) /* write call was interrupted */
65 #define HAVEBUS (unsigned)(1<<8) /* the driver owns the bus */
67 int sc_flags
; /* flags from lptio.h */
71 bus_addr_t sc_in_baddr
;
72 bus_addr_t sc_out_baddr
;
75 #define MAX_SLEEP (hz*5) /* Timeout while waiting for device ready */
76 #define MAX_SPIN 20 /* Max delay for device ready in usecs */
79 static volatile int lptdebug
= 1;
81 #define LPT_DPRINTF(arg) if(lptdebug) printf arg
83 #define LPT_DPRINTF(arg) if(lptdebug) printf("WARNING: LPT_DPRINTF " \
85 #endif /* LPT_DPRINTF */
87 #define LPT_DPRINTF(arg)
88 #endif /* LPT_DEBUG */
91 static volatile int lptverbose
= 1;
93 #define LPT_VPRINTF(arg) if(lptverbose) printf arg
95 #define LPT_VPRINTF(arg) if(lptverbose) printf("WARNING: LPT_VPRINTF " \
97 #endif /* LPT_VPRINTF */
99 #define LPT_VPRINTF(arg)
100 #endif /* LPT_VERBOSE */
102 #endif /* __DEV_PPBUS_LPTVAR_H */