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