rbccmd.h
来自「51环境下的FAT及FAT32文件系统源码」· C头文件 代码 · 共 702 行 · 第 1/2 页
H
702 行
/*
// RBC commands
*/
#define RBC_CMD_FORMAT 0x04
#define RBC_CMD_READ10 0x28
#define RBC_CMD_READCAPACITY 0x25
#define RBC_CMD_STARTSTOPUNIT 0x1B
#define RBC_CMD_SYNCCACHE 0x35
#define RBC_CMD_VERIFY10 0x2F
#define RBC_CMD_WRITE10 0x2A
/*
// SPC-2 commands
*/
#define SPC_CMD_INQUIRY 0x12
#define SPC_CMD_MODESELECT6 0x15
#define SPC_CMD_MODESENSE6 0x1A
#define SPC_CMD_PERSISTANTRESERVIN 0x5E
#define SPC_CMD_PERSISTANTRESERVOUT 0x5F
#define SPC_CMD_PRVENTALLOWMEDIUMREMOVAL 0x1E
#define SPC_CMD_RELEASE6 0x17
#define SPC_CMD_REQUESTSENSE 0x03
#define SPC_CMD_RESERVE6 0x16
#define SPC_CMD_TESTUNITREADY 0x00
#define SPC_CMD_WRITEBUFFER 0x3B
#define SPC_CMD_READLONG 0x23
/*
// ATAPI Command Descriptor Block - 13 Bytes
*/
typedef struct _READ_10 {
UINT8 OperationCode;
UINT8 Reserved1;
UINT8 LBA_3;
UINT8 LBA_2;
UINT8 LBA_1;
UINT8 LBA_0;
UINT8 Reserved2;
UINT8 XferLen_1;
UINT8 XferLen_0;
UINT8 Reserved3[3];
} READ_10, *pREAD_10;
typedef struct _WRITE_10 {
UINT8 OperationCode;
UINT8 Reserved1;
UINT8 LBA_3;
UINT8 LBA_2;
UINT8 LBA_1;
UINT8 LBA_0;
UINT8 Reserved2;
UINT8 XferLen_1;
UINT8 XferLen_0;
UINT8 Reserved3[3];
} WRITE_10, *pWRITE_10;
typedef struct _MODE_SENSE_10 {
UINT8 OperationCode;
UINT8 Reserved1;
UINT8 PageCode : 6;
UINT8 Pc : 2;
UINT8 Reserved2[4];
UINT8 ParameterListLengthMsb;
UINT8 ParameterListLengthLsb;
UINT8 Reserved3[3];
} MODE_SENSE_10, *pMODE_SENSE_10;
typedef struct _MODE_SELECT_10 {
UINT8 OperationCode;
UINT8 Reserved1 : 4;
UINT8 PFBit : 1;
UINT8 Reserved2 : 3;
UINT8 Reserved3[5];
UINT8 ParameterListLengthMsb;
UINT8 ParameterListLengthLsb;
UINT8 Reserved4[3];
} MODE_SELECT_10, *pMODE_SELECT_10;
/*
////////////////////////////////////////////////////////////////////////////////////
// Command Descriptor Block - max = 16 Bytes
// _RBC : Reduced Block Command
// _SPC : SPC-2 SCSI primary Command - 2
////////////////////////////////////////////////////////////////////////////////////
*/
/*
// Generic
*/
typedef struct _GENERIC_CDB {
UINT8 OperationCode;
UINT8 Reserved[15];
} GENERIC_CDB,*pGENERIC_CDB;
typedef struct _GENERIC_RBC {
UINT8 OperationCode;
UINT8 Reserved[8];
UINT8 Control;
} GENERIC_RBC,*pGENERIC_RBC;
/*
// format unit
*/
typedef struct _FORMAT_RBC {
UINT8 OperationCode; // 04H
UINT8 VendorSpecific;
UINT8 Increment : 1;
UINT8 PercentorTime : 1;
UINT8 Progress : 1;
UINT8 Immediate : 1;
UINT8 VendorSpecific1 : 4;
UINT8 Reserved2[2];
UINT8 Control;
} FORMAT_RBC, *pFORMAT_RBC;
/*
// Read Command
*/
typedef struct _READ_RBC {
UINT8 OperationCode; // 10H
UINT8 VendorSpecific;
union{
struct
{
UINT8 LBA_3;
UINT8 LBA_2;
UINT8 LBA_1;
UINT8 LBA_0;
} LBA_W8 ;
UINT32 LBA_W32;
}LBA;
UINT8 Reserved;
//UINT8 XferLength_1;
//UINT8 XferLength_0;
UINT16 XferLength;
UINT8 Control;
//UINT8 Reserved1[3];
} READ_RBC, *pREAD_RBC;
/*
// Read Capacity Data - returned in Big Endian format
*/
typedef struct _READ_CAPACITY_DATA {
UINT8 LBA_3;
UINT8 LBA_2;
UINT8 LBA_1;
UINT8 LBA_0;
UINT8 BlockLen_3;
UINT8 BlockLen_2;
UINT8 BlockLen_1;
UINT8 BlockLen_0;
} READ_CAPACITY_DATA, *pREAD_CAPACITY_DATA;
//////////////////////////////////////////////////
typedef struct _READ_LONG_CMD{
UINT8 OperationCode;
UINT8 LogicalUnitNum :3;
UINT8 RES_1 :5;
UINT8 RES_2;
UINT8 RES_3;
UINT8 RES_4;
UINT8 RES_5;
UINT8 RES_6;
UINT16 AllocationLen;
UINT8 RES_7;
UINT8 RES_8;
UINT8 RES_9;
}READ_LONG_CMD, *pREAD_LONG_CMD;
typedef struct _READ_LONG {
UINT8 RES_1;
UINT8 RES_2;
UINT8 RES_3;
UINT8 CAP_LIST_LEN;
UINT8 LBA_3;
UINT8 LBA_2;
UINT8 LBA_1;
UINT8 LBA_0;
UINT8 Descripter;
UINT8 BlockLen_2;
UINT8 BlockLen_1;
UINT8 BlockLen_0;
} READ_LONG, *pREAD_LONG;
/*
// Read Capacity command
*/
typedef struct _READ_CAPACITY_RBC {
UINT8 OperationCode; /* 10H */
union {
FLEXI_INT32 l0[2];
UINT32 l[2];
READ_CAPACITY_DATA CapData; /* Reserved area, here is used as temp*/
} tmpVar;
UINT8 Control;
} READ_CAPACITY_RBC, *pREAD_CAPACITY_RBC;
typedef struct _READ_CAPACITY_RSP {
UINT32 LastLBA;
UINT32 BlockSize;
} READ_CAPACITY_RSP, *pREAD_CAPACITY_RSP;
/*
// START_STOP_UNIT
*/
typedef struct _START_STOP_RBC {
UINT8 OperationCode; /*1BH*/
UINT8 Immediate: 1;
UINT8 Reserved1 : 7;
UINT8 Reserved2[2];
union _START_STOP_FLAGS
{
struct
{
UINT8 Start : 1;
UINT8 LoadEject : 1;
UINT8 Reserved3 : 2;
UINT8 PowerConditions: 4;
} bits0;
struct
{
UINT8 MediumState : 2;
UINT8 Reserved3 : 2;
UINT8 PowerConditions: 4;
} bits1;
} Flags;
UINT8 Control;
} START_STOP_RBC, *pSTART_STOP_RBC;
/*
// Synchronize Cache
*/
typedef struct _SYNCHRONIZE_CACHE_RBC {
UINT8 OperationCode; // 0x35
UINT8 Reserved[8];
UINT8 Control;
} SYNCHRONIZE_CACHE_RBC, *pSYNCHRONIZE_CACHE_RBC;
/*
// Write Command
*/
typedef struct _WRITE_RBC {
UINT8 OperationCode; // 2AH
//UINT8 Reserved0 : 3;
//UINT8 FUA : 1;
//UINT8 Reserved1 : 4;
UINT8 VendorSpecific;
union{
struct
{
UINT8 LBA_3;
UINT8 LBA_2;
UINT8 LBA_1;
UINT8 LBA_0;
} LBA_W8 ;
UINT32 LBA_W32;
} LBA;
UINT8 Reserved2;
UINT16 XferLength;
UINT8 Control;
} WRITE_RBC, *pWRITE_RBC;
/*
// VERIFY Command
*/
typedef struct _VERIFY_RBC {
UINT8 OperationCode; // 2FH
UINT8 Reserved0;
UINT8 LBA_3; // Big Endian
UINT8 LBA_2;
UINT8 LBA_1;
UINT8 LBA_0;
UINT8 Reserved1;
UINT8 VerifyLength_1; // Big Endian
UINT8 VerifyLength_0;
UINT8 Control;
} VERIFY_RBC, *pVERIFY_RBC;
/*
//***********************************************************************************
// SPC-2 of SCSI-3 commands
//***********************************************************************************
*/
/*
// INQUIRY Command
*/
typedef struct _INQUIRY_SPC {
UINT8 OperationCode; // 12H
UINT8 EnableVPD:1 ;
UINT8 CmdSupportData:1 ;
UINT8 Reserved0:6 ;
UINT8 PageCode;
UINT8 Reserved1;
UINT8 AllocationLen;
UINT8 Control;
} INQUIRY_SPC, *pINQUIRY_SPC;
/*
typedef struct _STD_INQUIRYDATA {
UINT8 DeviceType : 5;
UINT8 Reserved0 : 3;
UINT8 Reserved1 : 7;
UINT8 RemovableMedia : 1;
UINT8 Reserved2;
UINT8 Reserved3 : 5;
UINT8 NormACA : 1;
UINT8 Obsolete0 : 1;
UINT8 AERC : 1;
UINT8 Reserved4[3];
UINT8 SoftReset : 1;
UINT8 CommandQueue : 1;
UINT8 Reserved5 : 1;
UINT8 LinkedCommands : 1;
UINT8 Synchronous : 1;
UINT8 Wide16Bit : 1;
UINT8 Wide32Bit : 1;
UINT8 RelativeAddressing : 1;
UINT8 VendorId[8];
UINT8 ProductId[16];
UINT8 ProductRevisionLevel[4];
// Above is 36 bytes
// can be tranmitted by Bulk
UINT8 VendorSpecific[20];
UINT8 InfoUnitSupport : 1;
UINT8 QuickArbitSupport : 1;
UINT8 Clocking : 2;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?