📄 aspi.h
字号:
// ASPI.h : definition file
//
#define ASPI_EXECP(SRB) ((SRB_MyExecSCSICmd *)SRB)
#define ASPI_RESETP(SRB) ((SRB_BusDeviceReset *)SRB)
#define ASPICMD_LOAD 1
#define ASPICMD_UNLOAD 0
enum ASPIERRORS { ASPIERR_OK=0,
ASPIERR_PENDING, //SRB being processed
ASPIERR_ABORTED, //SRB aborted
ASPIERR_ABORTFAILED, //abort failed
ASPIERR_ERR, //SRB completed without error
ASPIERR_SELTIMEOUT, //Selection Timeout
ASPIERR_OVERUNDER, //Data overrun data underrun
ASPIERR_BUSFREE, //Unexpected bus free
ASPIERR_PHASE, //Target bus phase sequence
ASPIERR_TIMEOUT, //Timed out while SRB was
ASPIERR_CMDTIMEOUT, //While processing the SRB, the
ASPIERR_REJECT, //While processing SRB, the
ASPIERR_RESET, //A bus reset was detected.
ASPIERR_PARITY, //A parity error was detected.
ASPIERR_SENSE, //The adapter failed in issuing
ASPIERR_CHKCOND, //Device Check Condition
ASPIERR_RECOVERED, //Recovered Error
ASPIERR_NOTREADY, //Device not ready
ASPIERR_MEDIUMERR, //Medium Error
ASPIERR_HARDERR, //Hardware Error
ASPIERR_ILLEGAL, //Illegal Request
ASPIERR_UNITATT, //Unit Attention
ASPIERR_PROTECTED, //Data Protect
ASPIERR_BLANKCHK, //Blank Check
ASPIERR_VENDOR, //Vendor Specific
ASPIERR_COPYABORT, //Copy Abort
ASPIERR_EQUAL, //Equal (Search)
ASPIERR_TAPEFULL, //Volume Overflow
ASPIERR_MISCOMP, //Miscompare (Search)
ASPIERR_RESERVED, //Reserved
ASPIERR_COMDMET, //Device Condition Met
ASPIERR_BUSY, //Device Busy
ASPIERR_INTERM, //Device Intermediate
ASPIERR_INTCDMET, //Device Intermediate-condition met
ASPIERR_RESCONF, //Device Reservation conflict
ASPIERR_COMTERM, //Device Command Terminated
ASPIERR_QFULL, //Device Queue full
ASPIERR_UNKNOWN, //UNKNOWN
ASPIERR_COMMAND, //Invalid ASPI command
ASPIERR_HA, //Invalid host adapter number
ASPIERR_NODEVICE, //SCSI device not installed
ASPIERR_SRB, //Invalid parameter set in SRB
ASPIERR_ALIGN, //Buffer alignment problem
ASPIERR_SECURE, //Device access security violation
ASPIERR_INIT, //ASPI for windows failed init
ASPIERR_SIZE, //Buffer size too big to handle
ASPIERR_FILEMRK, //Filemark detected
ASPIERR_EOM, //End Of Medium detected
ASPIERR_ILI, //ILI ??? detected
ASPIERR_SETMRK=52, //52
ASPIERR_BOM, //53
ASPIERR_EOD, //54
ASPIERR_IOTERM, //55
ASPIERR_PWRTFLT, //56
ASPIERR_NOWRITE, //57
ASPIERR_EWRTERR, //58
ASPIERR_LUNNRDNC, //59
ASPIERR_LUNBRD, //60
ASPIERR_LUNNRDIR, //
ASPIERR_LUNNRDMI, //
ASPIERR_LUNNRDFP, //
ASPIERR_LUNNSEL, //
ASPIERR_MULTSEL, //
ASPIERR_LUNCFAIL, //
ASPIERR_LUNCTIME, //
ASPIERR_LUNCPAR, //
ASPIERR_TRKFOLOW, //
ASPIERR_LOGOVER, //70
ASPIERR_WRITE, //
ASPIERR_URREAD, //
ASPIERR_RDRETRY, //
ASPIERR_TOOLONG, //
ASPIERR_MULREAD, //
ASPIERR_IBLKRD, //
ASPIERR_NOGAP, //
ASPIERR_MISCORR, //
ASPIERR_RECENTI, //
ASPIERR_RECORD, //80
ASPIERR_FILSET, //
ASPIERR_NOEOD, //
ASPIERR_BLKSEQ, //
ASPIERR_RNDPOS, //
ASPIERR_MECHPOS, //
ASPIERR_RDPOSE, //
ASPIERR_RECDNEC, //
ASPIERR_RECDRET, //
ASPIERR_RECDPHO, //
ASPIERR_RECDNHO, //90
ASPIERR_RECDWEC, //
ASPIERR_PARLLEN, //
ASPIERR_SYNCERR, //
ASPIERR_INVCOC, //
ASPIERR_LBARNG, //
ASPIERR_INVFCDB, //
ASPIERR_NOLOGUN, //
ASPIERR_INVFPL, //
ASPIERR_PARNSUP, //
ASPIERR_PARVINV, //100
ASPIERR_NTHRPAR, //
ASPIERR_WRTPROT, //
ASPIERR_NRDYRDY, //
ASPIERR_POWRON, //
ASPIERR_PARCHN, //
ASPIERR_MPARCHN, //
ASPIERR_LPARCHN, //
ASPIERR_NCPYDIS, //
ASPIERR_CMDSEQ, //
ASPIERR_CMDCLR, //110
ASPIERR_INCPMED, //
ASPIERR_CANTRDU, //
ASPIERR_CANTRDI, //
ASPIERR_CLNCARD, //
ASPIERR_MFRMCRP, //
ASPIERR_TAPELEN, //
ASPIERR_RNDPAR, //
ASPIERR_SAVPAR, //
ASPIERR_NOTAPE, //
ASPIERR_SEQPOS, //120
ASPIERR_POSBOM, //
ASPIERR_POSEOM, //
ASPIERR_REPOS, //
ASPIERR_INVBITS, //
ASPIERR_LUNSCFG, //
ASPIERR_TRGOCHG, //
ASPIERR_CHGUC, //
ASPIERR_CHGOD, //
ASPIERR_CHGINQ, //
ASPIERR_DGFAIL, //130
ASPIERR_MSGERR, //
ASPIERR_INTTRGF, //
ASPIERR_SELRESF, //
ASPIERR_SFTRSTF, //
ASPIERR_INDEMSG, //
ASPIERR_INVMSGE, //
ASPIERR_CMDPHSE, //
ASPIERR_DATPHSE, //
ASPIERR_LGUFSLF, //
ASPIERR_OVRCMD, //140
ASPIERR_WRTAPE, //
ASPIERR_WRTAPSE, //
ASPIERR_POSETIM, //
ASPIERR_ERSFAIL, //
ASPIERR_CRDFAIL, //
ASPIERR_MDLFAIL, //
ASPIERR_UNTAPF, //
ASPIERR_MDRMPRV, //
ASPIERR_OPERREQ, //
ASPIERR_OPERMRR, //150
ASPIERR_OPERSWP, //
ASPIERR_OPERSWE, //
ASPIERR_LOGTRAP, //
ASPIERR_THRCND, //
ASPIERR_LGCNTMX, //
ASPIERR_LGLSCDE, //
ASPIERR_NOTATAPE, //
ASPIERR_NOTINSTALLED}; //158
//
//Its VERY IMPOTANT to have byte-alignment from this point to the end of this header-file,
//since these definitions are used for direct-hardware-access.
//
#pragma pack(1)
typedef struct
{ /* common ccb for 6 byte commands */
unsigned cmd : 8;
unsigned flag0 : 1;
unsigned flag1 : 1;
unsigned flag2 : 1;
unsigned flag3 : 1;
unsigned flag4 : 1;
unsigned lun : 3; //logical unit number
unsigned adr_1 : 8;
unsigned adr_0 : 8;
unsigned len : 8;
unsigned control : 8;
}_ccb6;
typedef struct
{ /* common ccb for 6 byte commands */
unsigned cmd : 8;
unsigned flag0 : 1;
unsigned flag1 : 1;
unsigned flag2 : 1;
unsigned flag3 : 1;
unsigned flag4 : 1;
unsigned lun : 3; //logical unit number
unsigned adr_1 : 8;
unsigned adr_0 : 8;
unsigned len : 8;
unsigned control : 8;
unsigned _reserved1 : 8;
unsigned _reserved2 : 8;
unsigned _reserved3 : 8;
unsigned _reserved4 : 8;
}_ccb10;
typedef struct
{ /* used for the scsi inquiry command */
unsigned cmd : 8; //
unsigned _reserved1 : 5; //n/a
unsigned lun : 3; //logical unit number
unsigned _reserved2 : 7; //n/a
unsigned evpd : 1; //
unsigned vpd : 8; //
unsigned len : 8; //
unsigned control : 8; //
}_inq;
typedef struct
{ /* used for the start/stop unit command */
unsigned cmd : 8; //
unsigned immed : 1; //return immediatly ?
unsigned _reserved1 : 4; //n/a
unsigned lun : 3; //logical unit number
unsigned _reserved2 : 8; //n/a
unsigned _reserved3 : 8; //n/a
unsigned start : 1; //
unsigned eject : 1; //
unsigned _reserved4 : 6; //n/a
unsigned control : 8; //
}_stp;
typedef struct
{ /* used for the allow medium removal command */
unsigned cmd : 8; //
unsigned _reserved1 : 5; //n/a
unsigned lun : 3; //logical unit number
unsigned _reserved2 : 8; //n/a
unsigned _reserved3 : 8; //n/a
unsigned prevent : 1; //prevent medium removal (1) allow removal (0)
unsigned _reserved4 : 7; //n/a
unsigned control : 8; //
}_rem;
/*
Table 35 - COPY command
+=====-========-========-========-========-========-========-========-========+
| Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|Byte | | | | | | | | |
|=====+=======================================================================|
| 0 | Operation code (18h) |
|-----+-----------------------------------------------------------------------|
| 1 | Logical unit number | Reserved | Pad |
|-----+-----------------------------------------------------------------------|
| 2 | (MSB) |
|-----+--- ---|
| 3 | Parameter list length |
|-----+--- ---|
| 4 | (LSB) |
|-----+-----------------------------------------------------------------------|
| 5 | Control |
+=============================================================================+
*/
typedef struct
{
unsigned cmd : 8; //0x18
unsigned pad : 1; //the pad bit (-> cat-bit)
//pad 1, cat 0: - fill destination .... thats ours !
unsigned _reserved1 : 4; //n/a
unsigned lun : 3; //logical unit number
unsigned len_2 : 8; //+ segment descriptor size
unsigned len_1 : 8; // parameter header size
unsigned len_0 : 8; //list length=
unsigned control : 8; //
}_cpy;
/*
Table 343 - RESERVE command
+=====-========-========-========-========-========-========-========-========+
| Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|Byte | | | | | | | | |
|=====+=======================================================================|
| 0 | Operation code (16h) |
|-----+-----------------------------------------------------------------------|
| 1 | Logical unit number | 3rdPty | Third party device ID | Element|
|-----+-----------------------------------------------------------------------|
| 2 | Reservation identification |
|-----+-----------------------------------------------------------------------|
| 3 | (MSB) |
|-----+--- Element list length ---|
| 4 | (LSB) |
|-----+-----------------------------------------------------------------------|
| 5 | Control |
+=============================================================================+
*/
typedef struct
{
unsigned cmd : 8; //0x16
unsigned element : 1; //
unsigned third_party_id : 3; //
unsigned third_party : 1; //
unsigned lun : 3; //logical unit number
unsigned res_id : 8; //
unsigned len_1 : 8; //
unsigned len_0 : 8; //
unsigned control : 8; //
}_rsv;
/*
Table 176 - LOAD UNLOAD command
+=====-========-========-========-========-========-========-========-========+
| Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|Byte | | | | | | | | |
|=====+=======================================================================|
| 0 | Operation code (1Bh) |
|-----+-----------------------------------------------------------------------|
| 1 | Logical unit number | Reserved | Immed |
|-----+-----------------------------------------------------------------------|
| 2 | Reserved |
|-----+-----------------------------------------------------------------------|
| 3 | Reserved |
|-----+-----------------------------------------------------------------------|
| 4 | Reserved | EOT | Reten | Load |
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -