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