|
|
#include "scsi.h"
union scsi_cdb {
struct SixCmd {
unsigned char opcode;
unsigned char misc:5;
unsigned char lun:3;
unsigned char data[3];
unsigned char control;
} six;
struct TenCmd {
unsigned char opcode;
unsigned char misc:5;
unsigned char lun:3;
unsigned long block;
unsigned char reserved;
unsigned short length;
unsigned char control;
} ten;
struct TwelveCmd {
unsigned char opcode;
unsigned char misc:5;
unsigned char lun:3;
unsigned long block;
unsigned long length;
unsigned char reserved;
unsigned char control;
} twelve;
unsigned char raw[12+sizeof(struct scsi_sense)];
};
A request to a peripheral device is performed by sending a command
descriptor block (CDB) to the target. The CDB consists of an operation
code byte, a logical unit number (LUN), command parameters, if any,
and a control byte.
The operation code byte has a group code field and a command code field. There are eight different group codes and thirty-two different commands per group yielding 256 different operation codes.
Group codes are divided as follows:
struct scsi_sense indicates
the default location to write SCSI sense information.