lpt.h revision 43989
1/*-
2 * Copyright (c) 1997 Nicolas Souchu
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * Distantly from :
27 *	@(#)lptreg.h      1.1 (Berkeley) 12/19/90
28 *	Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp
29 *	From Id: nlpt.h,v 1.3 1999/01/10 12:04:54 nsouch Exp
30 *
31 *	$Id$
32 */
33#ifndef __NLPT_H
34#define __NLPT_H
35
36#define	LPS_NERR		0x08	/* printer no error */
37#define	LPS_SEL			0x10	/* printer selected */
38#define	LPS_OUT			0x20	/* printer out of paper */
39#define	LPS_NACK		0x40	/* printer no ack of data */
40#define	LPS_NBSY		0x80	/* printer no ack of data */
41
42#define	LPC_STB			0x01	/* strobe data to printer */
43#define	LPC_AUTOL		0x02	/* automatic linefeed */
44#define	LPC_NINIT		0x04	/* initialize printer */
45#define	LPC_SEL			0x08	/* printer selected */
46#define	LPC_ENA			0x10	/* enable IRQ */
47
48struct lpt_data {
49	unsigned short lpt_unit;
50
51	struct ppb_device lpt_dev;
52
53	short	sc_state;
54	/* default case: negative prime, negative ack, handshake strobe,
55	   prime once */
56	u_char	sc_control;
57	char	sc_flags;
58#define LP_POS_INIT	0x04	/* if we are a postive init signal */
59#define LP_POS_ACK	0x08	/* if we are a positive going ack */
60#define LP_NO_PRIME	0x10	/* don't prime the printer at all */
61#define LP_PRIMEOPEN	0x20	/* prime on every open */
62#define LP_AUTOLF	0x40	/* tell printer to do an automatic lf */
63#define LP_BYPASS	0x80	/* bypass  printer ready checks */
64	struct	buf *sc_inbuf;
65	struct	buf *sc_statbuf;
66	short	sc_xfercnt ;
67	char	sc_primed;
68	char	*sc_cp ;
69	u_short	sc_irq ;	/* IRQ status of port */
70#define LP_HAS_IRQ	0x01	/* we have an irq available */
71#define LP_USE_IRQ	0x02	/* we are using our irq */
72#define LP_ENABLE_IRQ	0x04	/* enable IRQ on open */
73#define LP_ENABLE_EXT	0x10	/* we shall use advanced mode when possible */
74	u_char	sc_backoff ;	/* time to call lptout() again */
75
76#ifdef DEVFS
77	void	*devfs_token;
78	void	*devfs_token_ctl;
79#endif
80};
81
82#endif
83