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