⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scsidefs.h

📁 使用ASPI包装成的一些通用类
💻 H
📖 第 1 页 / 共 2 页
字号:
////////////////////////////////////////////////////////////
//
// Module SCSIDEFS.H
//
// ASPI class library
// SCSI structures and definitions
//
// Project: A Programmer's Guide to SCSI
//
// Copyright (C) 1997, Brian Sawert
// Portions copyright (C) 1995, Larry Martin
// All rights reserved
//
////////////////////////////////////////////////////////////


#ifndef SCSIDEFS_H_INCLUDED
#define SCSIDEFS_H_INCLUDED

#pragma pack(push,1)

#define SCSI_Cmd_TestUnitReady      0x00
#define SCSI_Cmd_Rewind          0x01
#define SCSI_Cmd_RequestSense    0x03
#define SCSI_Cmd_FormatUnit         0x04
#define SCSI_Cmd_ReadBlockLimits 0x05
#define SCSI_Cmd_Read            0x08
#define SCSI_Cmd_Write           0x0A
#define SCSI_Cmd_WriteFilemarks     0x10
#define SCSI_Cmd_Space           0x11
#define SCSI_Cmd_Inquiry         0x12
#define SCSI_Cmd_ModeSelect         0x15
#define SCSI_Cmd_ReserveUnit     0x16
#define SCSI_Cmd_ReleaseUnit     0x17
#define SCSI_Cmd_Erase           0x19
#define SCSI_Cmd_ModeSense       0x1A
#define SCSI_Cmd_LoadUnload         0x1B
#define SCSI_Cmd_SendDiagnostic     0x1D
#define SCSI_Cmd_PreventAllow    0x1E
#define SCSI_Cmd_ReadCapacity    0x25
#define SCSI_Cmd_Locate          0x2B
#define SCSI_Cmd_ReadPosition    0x34
#define SCSI_Cmd_ReadToc         0x43



/* ********************* WARNING ********************************** */
/* The structures below expect that the compiler lays out bitfields */
/* LSB first.                                         */
/* **************************************************************** */

typedef struct SCSI_Cdb_Generic6_s {
   unsigned int CommandCode   : 8;
   unsigned int Reserved1     : 5;
   unsigned int Lun        : 3;
   unsigned int Reserved2     : 8;
   unsigned int Reserved3     : 8;
   unsigned int Reserved4     : 8;
   unsigned int Link       : 1;
   unsigned int Flag       : 1;
   unsigned int Reserved5     : 4;
   unsigned int VendorSpecific   : 2;
   } SCSI_Cdb_Generic6_t;

typedef struct SCSI_Cdb_TestUnitReady_s {
   unsigned int CommandCode   : 8;  /* should be 0x00 */
   unsigned int            : 5;  /* must be 0 */
   unsigned int Lun        : 3;
   unsigned int            : 8;  /* must be 0 */
   unsigned int            : 8;
   unsigned int            : 8;
   unsigned int Link       : 1;
   unsigned int Flag       : 1;
   unsigned int            : 4;
   unsigned int VendorSpecific   : 2;
   } SCSI_Cdb_TestUnitReady_t;

typedef struct SCSI_Cdb_Rewind_s {
   unsigned int CommandCode   : 8;  /* should be 0x01 */
   unsigned int Immediate     : 1;
   unsigned int            : 4;
   unsigned int Lun        : 3;
   unsigned int            : 8;
   unsigned int            : 8;
   unsigned int            : 8;
   unsigned int Link       : 1;
   unsigned int Flag       : 1;
   unsigned int            : 4;
   unsigned int VendorSpecific   : 2;
   } SCSI_Cdb_Rewind_t;

typedef struct SCSI_Cdb_RequestSense_s {
   unsigned int CommandCode      : 8;  /* should be 0x03 */
   unsigned int               : 5;  /* must be 0 */
   unsigned int Lun           : 3;
   unsigned int               : 8;  /* must be 0 */
   unsigned int               : 8;
   unsigned int AllocationLength : 8;
   unsigned int Link          : 1;
   unsigned int Flag          : 1;
   unsigned int               : 4;
   unsigned int VendorSpecific      : 2;
   } SCSI_Cdb_RequestSense_t;

typedef struct SCSI_SenseData_s {
   unsigned int ErrorCode           : 7;
   unsigned int Valid               : 1;
   unsigned int SegmentNumber       : 8;
   unsigned int SenseKey            : 4;
   unsigned int                  : 1;
   unsigned int IllegalLength       : 1;
   unsigned int EndOfMedia          : 1;
   unsigned int FileMark            : 1;
   unsigned int InformationByte3    : 8;
   unsigned int InformationByte2    : 8;
   unsigned int InformationByte1    : 8;
   unsigned int InformationByte0    : 8;
   unsigned int AdditionalLength    : 8;
   unsigned int                  : 8;
   unsigned int                  : 8;
   unsigned int                  : 8;
   unsigned int                  : 8;
   unsigned int Asc              : 8;
   unsigned int Asq              : 8;
   unsigned int                  : 8;
   unsigned int BitPointer          : 3;
   unsigned int BitPointerValid     : 1;
   unsigned int                  : 2;
   unsigned int CdbError            : 1;
   unsigned int SenseKeySpecificValid  : 1;
   } SCSI_SenseData_t;

// Sense keys
#define SCSI_Skey_NoSense        0x00
#define SCSI_Skey_RecoveredError 0x01
#define SCSI_Skey_NotReady       0x02
#define SCSI_Skey_MediumError    0x03
#define SCSI_Skey_HardwareError     0x04
#define SCSI_Skey_IllegalRequest 0x05
#define SCSI_Skey_UnitAttention     0x06
#define SCSI_Skey_DataProtect    0x07
#define SCSI_Skey_BlankCheck     0x08
#define SCSI_Skey_VendorSpecific 0x09
#define SCSI_Skey_CopyAborted    0x0A
#define SCSI_Skey_AbortedCommand 0x0B
#define SCSI_Skey_Equal          0x0C
#define SCSI_Skey_VolumeOverflow 0x0D
#define SCSI_Skey_Miscompare     0x0E
#define SCSI_Skey_Reserved       0x0F

typedef struct SCSI_Cdb_ReadBlockLimits_s {
   unsigned int CommandCode   : 8;  /* should be 0x05 */
   unsigned int            : 5;
   unsigned int Lun        : 3;
   unsigned int            : 8;
   unsigned int            : 8;
   unsigned int            : 8;
   unsigned int Link       : 1;
   unsigned int Flag       : 1;
   unsigned int            : 4;
   unsigned int VendorSpecific   : 2;
   } SCSI_Cdb_ReadBlockLimits_t;

typedef struct SCSI_BlockLimits_s {
   unsigned int               : 8;
   unsigned int MaxBlockSize2    : 8;
   unsigned int MaxBlockSize1    : 8;
   unsigned int MaxBlockSize0    : 8;
   unsigned int MinBlockSize1    : 8;
   unsigned int MinBlockSize0    : 8;
   } SCSI_BlockLimits_t;

typedef struct SCSI_Cdb_Read_s {
   unsigned int CommandCode      : 8;  /* should be 0x08 */
   unsigned int LBA2             : 5;
   unsigned int Lun              : 3;
   unsigned int LBA1             : 8;
   unsigned int LBA0             : 8;
   unsigned int Length           : 8;
   unsigned int Link             : 1;
   unsigned int Flag             : 1;
   unsigned int                  : 4;
   unsigned int VendorSpecific   : 2;
   } SCSI_Cdb_Read_t;


typedef struct SCSI_Cdb_Write_s {
   unsigned int CommandCode         : 8;  /* should be 0x08 */
   unsigned int Fixed               : 1;
   unsigned int                  : 4;
   unsigned int Lun              : 3;
   unsigned int Count2              : 8;
   unsigned int Count1              : 8;
   unsigned int Count0              : 8;
   unsigned int Link             : 1;
   unsigned int Flag             : 1;
   unsigned int                  : 4;
   unsigned int VendorSpecific         : 2;
   } SCSI_Cdb_Write_t;


typedef struct SCSI_Cdb_WriteFilemarks_s {
   unsigned int CommandCode   : 8;  /* should be 0x10 */
   unsigned int Immediate     : 1;
   unsigned int Setmark    : 1;
   unsigned int            : 3;
   unsigned int Lun        : 3;
   unsigned int Count2        : 8;
   unsigned int Count1        : 8;
   unsigned int Count0        : 8;
   unsigned int Link       : 1;
   unsigned int Flag       : 1;
   unsigned int            : 4;
   unsigned int VendorSpecific   : 2;
   } SCSI_Cdb_WriteFilemarks_t;

typedef struct SCSI_Cdb_Space_s {
   unsigned int CommandCode   : 8;  /* should be 0x11 */
   unsigned int Code       : 3;
   unsigned int            : 2;
   unsigned int Lun        : 3;
   unsigned int Count2        : 8;
   unsigned int Count1        : 8;
   unsigned int Count0        : 8;
   unsigned int Link       : 1;
   unsigned int Flag       : 1;
   unsigned int            : 4;
   unsigned int VendorSpecific   : 2;
   } SCSI_Cdb_Space_t;

typedef struct SCSI_Cdb_Inquiry_s {
   unsigned int CommandCode      : 8;  /* should be 0x12 */
   unsigned int Evpd          : 1;
   unsigned int               : 4;
   unsigned int Lun           : 3;
   unsigned int PageCode         : 8;
   unsigned int               : 8;
   unsigned int AllocationLength : 8;
   unsigned int Link          : 1;
   unsigned int Flag          : 1;
   unsigned int               : 4;
   unsigned int VendorSpecific      : 2;
   } SCSI_Cdb_Inquiry_t;

typedef struct SCSI_InquiryData_s {
   unsigned int DeviceType             : 5;
   unsigned int DeviceQualifier        : 3;
   unsigned int DeviceModifier            : 7;
   unsigned int RemovableMedia            : 1;
   unsigned int AnsiVersion            : 3;
   unsigned int EcmaVersion            : 3;
   unsigned int IsoVersion             : 2;
   unsigned int ResponseDataFormat        : 4;
   unsigned int                     : 2;
   unsigned int TermIoProcessSupport      : 1;
   unsigned int AsyncEventNotifySupport   : 1;
   unsigned int AdditionalLength       : 8;
   unsigned int                     : 8;
   unsigned int                     : 8;
   unsigned int SoftResetSupport       : 1;
   unsigned int CommandQueueSupport    : 1;
   unsigned int                     : 1;
   unsigned int LinkedCommandSupport      : 1;
   unsigned int SynchronousTransferSupport : 1;
   unsigned int WideBus16Support       : 1;
   unsigned int WideBus32Support       : 1;
   unsigned int RelativeAddressingSupport : 1;
   unsigned char VendorId[8];
   unsigned char ProductId[16];
   unsigned char ProductRevisionLevel[4];
   } SCSI_InquiryData_t;

typedef struct SCSI_Cdb_Erase_s {
   unsigned int CommandCode   : 8;
   unsigned int Long       : 1;
   unsigned int Immediate     : 1;
   unsigned int            : 3;
   unsigned int Lun        : 3;
   unsigned int            : 8;
   unsigned int            : 8;
   unsigned int            : 8;
   unsigned int Link       : 1;
   unsigned int Flag       : 1;
   unsigned int            : 4;
   unsigned int VendorSpecific   : 2;
   } SCSI_Cdb_Erase_t;

typedef struct SCSI_Cdb_Format_s {
   unsigned int CommandCode      : 8;
   unsigned int DefectListFormat : 3;
   unsigned int CompleteList     : 1;
   unsigned int FormatData       : 1;
   unsigned int Lun           : 3;
   unsigned int               : 8;
   unsigned int InterleaveByte1  : 8;
   unsigned int InterleaveByte0  : 8;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -