xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/linux/pg.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1*53ee8cc1Swenshuai.xi /* 	pg.h (c) 1998  Grant R. Guenther <grant@torque.net>
2*53ee8cc1Swenshuai.xi  		       Under the terms of the GNU General Public License
3*53ee8cc1Swenshuai.xi 
4*53ee8cc1Swenshuai.xi 
5*53ee8cc1Swenshuai.xi 	pg.h defines the user interface to the generic ATAPI packet
6*53ee8cc1Swenshuai.xi         command driver for parallel port ATAPI devices (pg). The
7*53ee8cc1Swenshuai.xi 	driver is loosely modelled after the generic SCSI driver, sg,
8*53ee8cc1Swenshuai.xi 	although the actual interface is different.
9*53ee8cc1Swenshuai.xi 
10*53ee8cc1Swenshuai.xi 	The pg driver provides a simple character device interface for
11*53ee8cc1Swenshuai.xi         sending ATAPI commands to a device.  With the exception of the
12*53ee8cc1Swenshuai.xi 	ATAPI reset operation, all operations are performed by a pair
13*53ee8cc1Swenshuai.xi         of read and write operations to the appropriate /dev/pgN device.
14*53ee8cc1Swenshuai.xi 	A write operation delivers a command and any outbound data in
15*53ee8cc1Swenshuai.xi         a single buffer.  Normally, the write will succeed unless the
16*53ee8cc1Swenshuai.xi         device is offline or malfunctioning, or there is already another
17*53ee8cc1Swenshuai.xi 	command pending.  If the write succeeds, it should be followed
18*53ee8cc1Swenshuai.xi         immediately by a read operation, to obtain any returned data and
19*53ee8cc1Swenshuai.xi         status information.  A read will fail if there is no operation
20*53ee8cc1Swenshuai.xi         in progress.
21*53ee8cc1Swenshuai.xi 
22*53ee8cc1Swenshuai.xi 	As a special case, the device can be reset with a write operation,
23*53ee8cc1Swenshuai.xi         and in this case, no following read is expected, or permitted.
24*53ee8cc1Swenshuai.xi 
25*53ee8cc1Swenshuai.xi 	There are no ioctl() operations.  Any single operation
26*53ee8cc1Swenshuai.xi 	may transfer at most PG_MAX_DATA bytes.  Note that the driver must
27*53ee8cc1Swenshuai.xi         copy the data through an internal buffer.  In keeping with all
28*53ee8cc1Swenshuai.xi 	current ATAPI devices, command packets are assumed to be exactly
29*53ee8cc1Swenshuai.xi 	12 bytes in length.
30*53ee8cc1Swenshuai.xi 
31*53ee8cc1Swenshuai.xi 	To permit future changes to this interface, the headers in the
32*53ee8cc1Swenshuai.xi 	read and write buffers contain a single character "magic" flag.
33*53ee8cc1Swenshuai.xi         Currently this flag must be the character "P".
34*53ee8cc1Swenshuai.xi 
35*53ee8cc1Swenshuai.xi */
36*53ee8cc1Swenshuai.xi 
37*53ee8cc1Swenshuai.xi #define PG_MAGIC	'P'
38*53ee8cc1Swenshuai.xi #define PG_RESET	'Z'
39*53ee8cc1Swenshuai.xi #define PG_COMMAND	'C'
40*53ee8cc1Swenshuai.xi 
41*53ee8cc1Swenshuai.xi #define PG_MAX_DATA	32768
42*53ee8cc1Swenshuai.xi 
43*53ee8cc1Swenshuai.xi struct pg_write_hdr {
44*53ee8cc1Swenshuai.xi 
45*53ee8cc1Swenshuai.xi 	char	magic;		/* == PG_MAGIC */
46*53ee8cc1Swenshuai.xi 	char	func;		/* PG_RESET or PG_COMMAND */
47*53ee8cc1Swenshuai.xi 	int     dlen;		/* number of bytes expected to transfer */
48*53ee8cc1Swenshuai.xi 	int     timeout;	/* number of seconds before timeout */
49*53ee8cc1Swenshuai.xi 	char	packet[12];	/* packet command */
50*53ee8cc1Swenshuai.xi 
51*53ee8cc1Swenshuai.xi };
52*53ee8cc1Swenshuai.xi 
53*53ee8cc1Swenshuai.xi struct pg_read_hdr {
54*53ee8cc1Swenshuai.xi 
55*53ee8cc1Swenshuai.xi 	char	magic;		/* == PG_MAGIC */
56*53ee8cc1Swenshuai.xi 	char	scsi;		/* "scsi" status == sense key */
57*53ee8cc1Swenshuai.xi 	int	dlen;		/* size of device transfer request */
58*53ee8cc1Swenshuai.xi 	int     duration;	/* time in seconds command took */
59*53ee8cc1Swenshuai.xi 	char    pad[12];	/* not used */
60*53ee8cc1Swenshuai.xi 
61*53ee8cc1Swenshuai.xi };
62*53ee8cc1Swenshuai.xi 
63*53ee8cc1Swenshuai.xi /* end of pg.h */
64