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