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