xref: /illumos-gate/usr/src/uts/common/sys/prnio.h (revision 2d6eb4a5)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_PRNIO_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_PRNIO_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * Printing system I/O interface
32*7c478bd9Sstevel@tonic-gate  */
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/ioccom.h>
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
38*7c478bd9Sstevel@tonic-gate extern "C" {
39*7c478bd9Sstevel@tonic-gate #endif
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #define	PRNIOC			'p'
42*7c478bd9Sstevel@tonic-gate #define	PRNIOC_GET_IFCAP	_IOR(PRNIOC, 90, uint_t)
43*7c478bd9Sstevel@tonic-gate #define	PRNIOC_SET_IFCAP	_IOR(PRNIOC, 91, uint_t)
44*7c478bd9Sstevel@tonic-gate #define	PRNIOC_GET_IFINFO	_IOWR(PRNIOC, 92, struct prn_interface_info)
45*7c478bd9Sstevel@tonic-gate #define	PRNIOC_GET_STATUS	_IOR(PRNIOC, 93, uint_t)
46*7c478bd9Sstevel@tonic-gate #define	PRNIOC_GET_1284_DEVID	_IOWR(PRNIOC, 94, struct prn_1284_device_id)
47*7c478bd9Sstevel@tonic-gate #define	PRNIOC_GET_1284_STATUS	_IOR(PRNIOC, 95, uchar_t)
48*7c478bd9Sstevel@tonic-gate #define	PRNIOC_GET_TIMEOUTS	_IOR(PRNIOC, 96, struct prn_timeouts)
49*7c478bd9Sstevel@tonic-gate #define	PRNIOC_SET_TIMEOUTS	_IOW(PRNIOC, 97, struct prn_timeouts)
50*7c478bd9Sstevel@tonic-gate #define	PRNIOC_RESET		_IO(PRNIOC, 98)
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /*
53*7c478bd9Sstevel@tonic-gate  * interface capabilities
54*7c478bd9Sstevel@tonic-gate  */
55*7c478bd9Sstevel@tonic-gate #define	PRN_BIDI	0x0001	/* bi-directional operation is supported */
56*7c478bd9Sstevel@tonic-gate #define	PRN_HOTPLUG	0x0002	/* interface allows device hotplugging */
57*7c478bd9Sstevel@tonic-gate #define	PRN_1284_DEVID	0x0004	/* device can return 1284 device ID */
58*7c478bd9Sstevel@tonic-gate #define	PRN_1284_STATUS	0x0008	/* device can return status lines state */
59*7c478bd9Sstevel@tonic-gate #define	PRN_TIMEOUTS	0x0010	/* timeouts are supported */
60*7c478bd9Sstevel@tonic-gate #define	PRN_STREAMS	0x0020	/* special flush semantics */
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate /*
63*7c478bd9Sstevel@tonic-gate  * printer interface info
64*7c478bd9Sstevel@tonic-gate  */
65*7c478bd9Sstevel@tonic-gate struct prn_interface_info {
66*7c478bd9Sstevel@tonic-gate 	uint_t		if_len;		/* length of buffer */
67*7c478bd9Sstevel@tonic-gate 	uint_t		if_rlen;	/* actual length of info string */
68*7c478bd9Sstevel@tonic-gate 	char		*if_data;	/* buffer address */
69*7c478bd9Sstevel@tonic-gate #ifndef _LP64
70*7c478bd9Sstevel@tonic-gate 	int		if_filler;	/* preserve struct size in 32 bit */
71*7c478bd9Sstevel@tonic-gate #endif
72*7c478bd9Sstevel@tonic-gate };
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate /*
75*7c478bd9Sstevel@tonic-gate  * printer interface info string (recommended values)
76*7c478bd9Sstevel@tonic-gate  */
77*7c478bd9Sstevel@tonic-gate #define	PRN_PARALLEL	"parallel"	/* parallel port (Centronics or 1284) */
78*7c478bd9Sstevel@tonic-gate #define	PRN_SERIAL	"serial"	/* serial port (EIA-232, EIA-485) */
79*7c478bd9Sstevel@tonic-gate #define	PRN_USB		"USB"		/* USB */
80*7c478bd9Sstevel@tonic-gate #define	PRN_1394	"1394"		/* IEEE 1394 (Firewire) */
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate /*
83*7c478bd9Sstevel@tonic-gate  * status bits for PRNIOC_GET_STATUS
84*7c478bd9Sstevel@tonic-gate  */
85*7c478bd9Sstevel@tonic-gate #define	PRN_ONLINE	0x01	/* device is connected */
86*7c478bd9Sstevel@tonic-gate #define	PRN_READY	0x02	/* device is ready to communicate */
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate /*
89*7c478bd9Sstevel@tonic-gate  * 1284 pins status bits
90*7c478bd9Sstevel@tonic-gate  */
91*7c478bd9Sstevel@tonic-gate #define	PRN_1284_NOFAULT	0x08	/* device is not in error state */
92*7c478bd9Sstevel@tonic-gate #define	PRN_1284_SELECT		0x10	/* device selected */
93*7c478bd9Sstevel@tonic-gate #define	PRN_1284_PE		0x20	/* paper error */
94*7c478bd9Sstevel@tonic-gate #define	PRN_1284_BUSY		0x80	/* device busy */
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate /*
97*7c478bd9Sstevel@tonic-gate  * IEEE 1284 device ID
98*7c478bd9Sstevel@tonic-gate  */
99*7c478bd9Sstevel@tonic-gate struct prn_1284_device_id {
100*7c478bd9Sstevel@tonic-gate 	uint_t		id_len;		/* length of buffer */
101*7c478bd9Sstevel@tonic-gate 	uint_t		id_rlen;	/* actual length of device ID string */
102*7c478bd9Sstevel@tonic-gate 	char		*id_data;	/* buffer address */
103*7c478bd9Sstevel@tonic-gate #ifndef _LP64
104*7c478bd9Sstevel@tonic-gate 	int		id_filler;	/* preserve struct size in 32 bit */
105*7c478bd9Sstevel@tonic-gate #endif
106*7c478bd9Sstevel@tonic-gate };
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate /*
109*7c478bd9Sstevel@tonic-gate  * printer driver timeouts
110*7c478bd9Sstevel@tonic-gate  */
111*7c478bd9Sstevel@tonic-gate struct prn_timeouts {
112*7c478bd9Sstevel@tonic-gate 	uint_t		tmo_forward;	/* forward transfer timeout */
113*7c478bd9Sstevel@tonic-gate 	uint_t		tmo_reverse;	/* reverse transfer timeout */
114*7c478bd9Sstevel@tonic-gate };
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate /*
117*7c478bd9Sstevel@tonic-gate  * driver support for 32-bit applications
118*7c478bd9Sstevel@tonic-gate  */
119*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate struct prn_interface_info32 {
122*7c478bd9Sstevel@tonic-gate 	uint_t		if_len;		/* length of buffer */
123*7c478bd9Sstevel@tonic-gate 	uint_t		if_rlen;	/* actual length of info string */
124*7c478bd9Sstevel@tonic-gate 	caddr32_t	if_data;	/* buffer address */
125*7c478bd9Sstevel@tonic-gate };
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate struct prn_1284_device_id32 {
128*7c478bd9Sstevel@tonic-gate 	uint_t		id_len;		/* length of buffer */
129*7c478bd9Sstevel@tonic-gate 	uint_t		id_rlen;	/* actual length of device id string */
130*7c478bd9Sstevel@tonic-gate 	caddr32_t	id_data;	/* buffer address */
131*7c478bd9Sstevel@tonic-gate };
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate #endif
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
136*7c478bd9Sstevel@tonic-gate }
137*7c478bd9Sstevel@tonic-gate #endif
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_PRNIO_H */
140