xref: /titanic_50/usr/src/uts/common/sys/bpp_io.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1990,1991,1997-1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_BPP_IO_H
28 #define	_SYS_BPP_IO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  *	I/O header file for the bidirectional parallel port
34  *	driver (bpp) for the Zebra SBus card.
35  */
36 
37 #include <sys/ioccom.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /*	#defines (not struct elements) below */
44 
45 /*
46  * Minor device number encoding (should not be here):
47  */
48 #define	BPP_UNIT(dev)	getminor(*dev)
49 
50 /*
51  * ioctl defines for cmd argument
52  */
53 	/* set contents of transfer parms structure	*/
54 #define	BPPIOC_SETPARMS		_IOW('b', 1, struct bpp_transfer_parms)
55 	/* read contents of transfer parms structure	*/
56 #define	BPPIOC_GETPARMS		_IOR('b', 2, struct bpp_transfer_parms)
57 	/* set contents of output pins structure	*/
58 #define	BPPIOC_SETOUTPINS	_IOW('b', 3, struct bpp_pins)
59 	/* read contents of output pins structure	*/
60 #define	BPPIOC_GETOUTPINS	_IOR('b', 4, struct bpp_pins)
61 	/* read contents of snapshot error status structure	*/
62 #define	BPPIOC_GETERR		_IOR('b', 5, struct bpp_error_status)
63 	/* pretend to attempt a data transfer	*/
64 #define	BPPIOC_TESTIO		_IO('b', 6)
65 /* ioctl values 7-12 are test-only and are reserved */
66 
67 
68 /*	Structure definitions and locals #defines below */
69 
70 #define	MAX_TIMEOUT	1800000		/* maximum read/write timeout	*/
71 					/* 30 minutes			*/
72 /*
73  * #defines and enum variables, and general comments for the
74  * bpp_transfer_parms structure.
75  */
76 
77 /* Values for read_handshake and write_handshake fields */
78 enum	handshake_t {
79 	BPP_NO_HS = 1,		/* no handshake pins */
80 	BPP_ACK_HS = 2,		/* handshake controlled by ACK line */
81 	BPP_BUSY_HS = 3,	/* handshake controlled by BSY line */
82 	BPP_ACK_BUSY_HS = 4,	/* handshake controlled by ACK and BSY lines */
83 				/* read_handshake only! */
84 	BPP_XSCAN_HS = 5,	/* xerox scanner mode, read_handshake only! */
85 	BPP_HSCAN_HS = 6,	/* HP scanjet scanner mode */
86 				/* read_handshake only! */
87 	BPP_CLEAR_MEM = 7,	/* write 0's to memory, read_handshake only! */
88 	BPP_SET_MEM = 8,	/* write 1's to memory, read_handshake only! */
89 	/* The following handshakes are RESERVED. Do not use. */
90 	BPP_VPRINT_HS = 9,	/* valid only in read/write mode */
91 	BPP_VPLOT_HS = 10	/* valid only in read/write mode */
92 };
93 
94 /*
95  * The read_setup_time field indicates
96  * dstrb- to bsy+ in BPP_HS_NOHS or BPP_HS_ACKHS
97  * dstrb- to ack+ in BPP_HS_ACKHS or BPP_HS_ACKBUSYHS
98  * ack- to dstrb+ in BPP_HS_XSCANHS
99  *
100  * The read_strobe_width field indicates
101  * ack+ to ack- in BPP_HS_ACKHS or BPP_HS_ACKBUSYHS
102  * dstrb+ to dstrb- in BPP_HS_XSCANHS
103  */
104 
105 /* Values allowed for write_handshake field */
106 /*
107  * these are duplicates of the definitions above
108  *	BPP_HS_NOHS
109  *	BPP_HS_ACKHS
110  *	BPP_HS_BUSYHS
111  */
112 
113 /*
114  * The write_setup_time field indicates
115  * data valid to dstrb+ in all handshakes
116  *
117  * The write_strobe_width field indicates
118  * dstrb+ to dstrb- in non-reserved handshakes
119  * minimum dstrb+ to dstrb- in BPP_HS_VPRINTHS or BPP_HS_VPLOTHS
120  */
121 
122 
123 /*
124  * This structure is used to configure the hardware handshake and
125  * timing modes.
126  */
127 struct bpp_transfer_parms {
128 	enum	handshake_t
129 		read_handshake;		/* parallel port read handshake mode */
130 	int	read_setup_time;	/* DSS register - in nanoseconds */
131 	int	read_strobe_width;	/* DSW register - in nanoseconds */
132 	int	read_timeout;		/* wait this many microseconds */
133 					/* before aborting a transfer */
134 	enum	handshake_t
135 		write_handshake;	/* parallel port write handshake mode */
136 	int	write_setup_time;	/* DSS register - in nanoseconds */
137 	int	write_strobe_width;	/* DSW register - in nanoseconds */
138 	int	write_timeout;		/* wait this many microseconds */
139 					/* before aborting a transfer */
140 };
141 
142 struct bpp_pins {
143 	uchar_t	output_reg_pins;	/* pins in P_OR register */
144 	uchar_t	input_reg_pins;		/* pins in P_IR register */
145 };
146 
147 
148 /*
149  * #defines and general comments for
150  * the bpp_pins structure.
151  */
152 /* Values for output_reg_pins field */
153 #define	BPP_SLCTIN_PIN		0x01	/* Select in pin		*/
154 #define	BPP_AFX_PIN		0x02	/* Auto feed pin		*/
155 #define	BPP_INIT_PIN		0x04	/* Initialize pin		*/
156 #define	BPP_V1_PIN		0x08	/* reserved pin 1		*/
157 #define	BPP_V2_PIN		0x10	/* reserved pin 2		*/
158 #define	BPP_V3_PIN		0x20	/* reserved pin 3		*/
159 
160 #define	BPP_ALL_OUT_PINS	(BPP_SLCTIN_PIN | BPP_AFX_PIN | BPP_INIT_PIN |\
161 				BPP_V1_PIN | BPP_V2_PIN | BPP_V3_PIN)
162 
163 /* Values for input_reg_pins field */
164 #define	BPP_ERR_PIN		0x01	/* Error pin			*/
165 #define	BPP_SLCT_PIN		0x02	/* Select pin			*/
166 #define	BPP_PE_PIN		0x04	/* Paper empty pin		*/
167 
168 #define	BPP_ALL_IN_PINS		(BPP_ERR_PIN | BPP_SLCT_PIN | BPP_PE_PIN)
169 
170 struct	bpp_error_status {
171 	char	timeout_occurred;	/* 1 if a timeout occurred	*/
172 	char	bus_error;		/* 1 if an SBus bus error	*/
173 	uchar_t	pin_status;		/* status of pins which could */
174 					/* cause an error */
175 };
176 
177 /*
178  * #defines for the bpp_error_status structure
179  */
180 /* Values for pin_status field */
181 #define	BPP_ERR_ERR		0x01	/* Error pin active		*/
182 #define	BPP_SLCT_ERR		0x02	/* Select pin active		*/
183 #define	BPP_PE_ERR		0x04	/* Paper empty pin active	*/
184 #define	BPP_SLCTIN_ERR		0x10	/* Select in pin active		*/
185 #define	BPP_BUSY_ERR		0x40	/* Busy pin active		*/
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif /* !_SYS_BPP_IO_H */
192