Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
0002 /*  pg.h (c) 1998  Grant R. Guenther <grant@torque.net>
0003                Under the terms of the GNU General Public License
0004 
0005 
0006     pg.h defines the user interface to the generic ATAPI packet
0007         command driver for parallel port ATAPI devices (pg). The
0008     driver is loosely modelled after the generic SCSI driver, sg,
0009     although the actual interface is different.
0010 
0011     The pg driver provides a simple character device interface for
0012         sending ATAPI commands to a device.  With the exception of the
0013     ATAPI reset operation, all operations are performed by a pair
0014         of read and write operations to the appropriate /dev/pgN device.
0015     A write operation delivers a command and any outbound data in
0016         a single buffer.  Normally, the write will succeed unless the
0017         device is offline or malfunctioning, or there is already another
0018     command pending.  If the write succeeds, it should be followed
0019         immediately by a read operation, to obtain any returned data and
0020         status information.  A read will fail if there is no operation
0021         in progress.
0022 
0023     As a special case, the device can be reset with a write operation,
0024         and in this case, no following read is expected, or permitted.
0025 
0026     There are no ioctl() operations.  Any single operation
0027     may transfer at most PG_MAX_DATA bytes.  Note that the driver must
0028         copy the data through an internal buffer.  In keeping with all
0029     current ATAPI devices, command packets are assumed to be exactly
0030     12 bytes in length.
0031 
0032     To permit future changes to this interface, the headers in the
0033     read and write buffers contain a single character "magic" flag.
0034         Currently this flag must be the character "P".
0035 
0036 */
0037 
0038 #ifndef _UAPI_LINUX_PG_H
0039 #define _UAPI_LINUX_PG_H
0040 
0041 #define PG_MAGIC    'P'
0042 #define PG_RESET    'Z'
0043 #define PG_COMMAND  'C'
0044 
0045 #define PG_MAX_DATA 32768
0046 
0047 struct pg_write_hdr {
0048 
0049     char    magic;      /* == PG_MAGIC */
0050     char    func;       /* PG_RESET or PG_COMMAND */
0051     int     dlen;       /* number of bytes expected to transfer */
0052     int     timeout;    /* number of seconds before timeout */
0053     char    packet[12]; /* packet command */
0054 
0055 };
0056 
0057 struct pg_read_hdr {
0058 
0059     char    magic;      /* == PG_MAGIC */
0060     char    scsi;       /* "scsi" status == sense key */
0061     int dlen;       /* size of device transfer request */
0062     int     duration;   /* time in seconds command took */
0063     char    pad[12];    /* not used */
0064 
0065 };
0066 
0067 #endif /* _UAPI_LINUX_PG_H */