xref: /onnv-gate/usr/src/uts/common/sys/prnio.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) 2001 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_PRNIO_H
28*0Sstevel@tonic-gate #define	_SYS_PRNIO_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  * Printing system I/O interface
34*0Sstevel@tonic-gate  */
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include <sys/types.h>
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 #define	PRNIOC			'p'
44*0Sstevel@tonic-gate #define	PRNIOC_GET_IFCAP	_IOR(PRNIOC, 90, uint_t)
45*0Sstevel@tonic-gate #define	PRNIOC_SET_IFCAP	_IOR(PRNIOC, 91, uint_t)
46*0Sstevel@tonic-gate #define	PRNIOC_GET_IFINFO	_IOWR(PRNIOC, 92, struct prn_interface_info)
47*0Sstevel@tonic-gate #define	PRNIOC_GET_STATUS	_IOR(PRNIOC, 93, uint_t)
48*0Sstevel@tonic-gate #define	PRNIOC_GET_1284_DEVID	_IOWR(PRNIOC, 94, struct prn_1284_device_id)
49*0Sstevel@tonic-gate #define	PRNIOC_GET_1284_STATUS	_IOR(PRNIOC, 95, uchar_t)
50*0Sstevel@tonic-gate #define	PRNIOC_GET_TIMEOUTS	_IOR(PRNIOC, 96, struct prn_timeouts)
51*0Sstevel@tonic-gate #define	PRNIOC_SET_TIMEOUTS	_IOW(PRNIOC, 97, struct prn_timeouts)
52*0Sstevel@tonic-gate #define	PRNIOC_RESET		_IO(PRNIOC, 98)
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate /*
55*0Sstevel@tonic-gate  * interface capabilities
56*0Sstevel@tonic-gate  */
57*0Sstevel@tonic-gate #define	PRN_BIDI	0x0001	/* bi-directional operation is supported */
58*0Sstevel@tonic-gate #define	PRN_HOTPLUG	0x0002	/* interface allows device hotplugging */
59*0Sstevel@tonic-gate #define	PRN_1284_DEVID	0x0004	/* device can return 1284 device ID */
60*0Sstevel@tonic-gate #define	PRN_1284_STATUS	0x0008	/* device can return status lines state */
61*0Sstevel@tonic-gate #define	PRN_TIMEOUTS	0x0010	/* timeouts are supported */
62*0Sstevel@tonic-gate #define	PRN_STREAMS	0x0020	/* special flush semantics */
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate /*
65*0Sstevel@tonic-gate  * printer interface info
66*0Sstevel@tonic-gate  */
67*0Sstevel@tonic-gate struct prn_interface_info {
68*0Sstevel@tonic-gate 	uint_t		if_len;		/* length of buffer */
69*0Sstevel@tonic-gate 	uint_t		if_rlen;	/* actual length of info string */
70*0Sstevel@tonic-gate 	char		*if_data;	/* buffer address */
71*0Sstevel@tonic-gate #ifndef _LP64
72*0Sstevel@tonic-gate 	int		if_filler;	/* preserve struct size in 32 bit */
73*0Sstevel@tonic-gate #endif
74*0Sstevel@tonic-gate };
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate /*
77*0Sstevel@tonic-gate  * printer interface info string (recommended values)
78*0Sstevel@tonic-gate  */
79*0Sstevel@tonic-gate #define	PRN_PARALLEL	"parallel"	/* parallel port (Centronics or 1284) */
80*0Sstevel@tonic-gate #define	PRN_SERIAL	"serial"	/* serial port (EIA-232, EIA-485) */
81*0Sstevel@tonic-gate #define	PRN_USB		"USB"		/* USB */
82*0Sstevel@tonic-gate #define	PRN_1394	"1394"		/* IEEE 1394 (Firewire) */
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate /*
85*0Sstevel@tonic-gate  * status bits for PRNIOC_GET_STATUS
86*0Sstevel@tonic-gate  */
87*0Sstevel@tonic-gate #define	PRN_ONLINE	0x01	/* device is connected */
88*0Sstevel@tonic-gate #define	PRN_READY	0x02	/* device is ready to communicate */
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate /*
91*0Sstevel@tonic-gate  * 1284 pins status bits
92*0Sstevel@tonic-gate  */
93*0Sstevel@tonic-gate #define	PRN_1284_NOFAULT	0x08	/* device is not in error state */
94*0Sstevel@tonic-gate #define	PRN_1284_SELECT		0x10	/* device selected */
95*0Sstevel@tonic-gate #define	PRN_1284_PE		0x20	/* paper error */
96*0Sstevel@tonic-gate #define	PRN_1284_BUSY		0x80	/* device busy */
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate /*
99*0Sstevel@tonic-gate  * IEEE 1284 device ID
100*0Sstevel@tonic-gate  */
101*0Sstevel@tonic-gate struct prn_1284_device_id {
102*0Sstevel@tonic-gate 	uint_t		id_len;		/* length of buffer */
103*0Sstevel@tonic-gate 	uint_t		id_rlen;	/* actual length of device ID string */
104*0Sstevel@tonic-gate 	char		*id_data;	/* buffer address */
105*0Sstevel@tonic-gate #ifndef _LP64
106*0Sstevel@tonic-gate 	int		id_filler;	/* preserve struct size in 32 bit */
107*0Sstevel@tonic-gate #endif
108*0Sstevel@tonic-gate };
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate /*
111*0Sstevel@tonic-gate  * printer driver timeouts
112*0Sstevel@tonic-gate  */
113*0Sstevel@tonic-gate struct prn_timeouts {
114*0Sstevel@tonic-gate 	uint_t		tmo_forward;	/* forward transfer timeout */
115*0Sstevel@tonic-gate 	uint_t		tmo_reverse;	/* reverse transfer timeout */
116*0Sstevel@tonic-gate };
117*0Sstevel@tonic-gate 
118*0Sstevel@tonic-gate /*
119*0Sstevel@tonic-gate  * driver support for 32-bit applications
120*0Sstevel@tonic-gate  */
121*0Sstevel@tonic-gate #ifdef _KERNEL
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate struct prn_interface_info32 {
124*0Sstevel@tonic-gate 	uint_t		if_len;		/* length of buffer */
125*0Sstevel@tonic-gate 	uint_t		if_rlen;	/* actual length of info string */
126*0Sstevel@tonic-gate 	caddr32_t	if_data;	/* buffer address */
127*0Sstevel@tonic-gate };
128*0Sstevel@tonic-gate 
129*0Sstevel@tonic-gate struct prn_1284_device_id32 {
130*0Sstevel@tonic-gate 	uint_t		id_len;		/* length of buffer */
131*0Sstevel@tonic-gate 	uint_t		id_rlen;	/* actual length of device id string */
132*0Sstevel@tonic-gate 	caddr32_t	id_data;	/* buffer address */
133*0Sstevel@tonic-gate };
134*0Sstevel@tonic-gate 
135*0Sstevel@tonic-gate #endif
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate #ifdef	__cplusplus
138*0Sstevel@tonic-gate }
139*0Sstevel@tonic-gate #endif
140*0Sstevel@tonic-gate 
141*0Sstevel@tonic-gate #endif	/* _SYS_PRNIO_H */
142