rbccmd.h

来自「51环境下的FAT及FAT32文件系统源码」· C头文件 代码 · 共 702 行 · 第 1/2 页

H
702
字号
    UINT8 Reserved6 : 4;

    UINT8  Reserved7 ;
    UINT16 VersionDescriptor[8] ;

    UINT8 Reserved8[22];
} STD_INQUIRYDATA, *pSTD_INQUIRYDATA;
*/

/*
typedef struct _SERIALNUMBER_PAGE {
    UINT8 DeviceType : 5;
    UINT8 DeviceTypeQualifier : 3;

    UINT8 PageCode ;
    UINT8 Reserved0 ;

    UINT8 PageLength ;
    UINT8 SerialNumber[24] ;

}VPD_SERIAL_PAGE,*pVPD_SERIAL_PAGE;
*/
/*
#define ASCII_ID_STRING 32
typedef struct _ID_DESCRIPTOR {
	UINT8   CodeSet : 4;
	UINT8   Reserved0 : 4;

	UINT8   IDType : 4;
    UINT8   Association : 2;
    UINT8   Reserved1 : 2;

    UINT8   Reserved2;

	UINT8   IDLength ;
	UINT8   AsciiID[ASCII_ID_STRING];
} ASCII_ID_DESCRIPTOR,*pASCII_ID_DESCRIPTOR;
*/
/*
typedef struct _DEVICE_ID_PAGE
{
    UINT8 DeviceType : 5;
    UINT8 DeviceTypeQualifier : 3;

    UINT8 PageCode ;
    UINT8 Reserved0 ;

    UINT8 PageLength ;

    ASCII_ID_DESCRIPTOR   AsciiIdDescriptor[1];
} VPD_DEVICE_ID_PAGE, *pVPD_DEVICE_ID_PAGE;
*/
/*
// Mode Select
*/
typedef struct _MODE_SELECT_SPC {
	UINT8 OperationCode;	// 15H
	UINT8 SavePage : 1 ;
	UINT8 Reseved0 : 3 ;
	UINT8 PageFormat : 1 ;
	UINT8 Reserved1 : 3 ;
	UINT8 Reserved2[2];
	UINT8 ParameterLen;
	UINT8 Control;
} MODE_SELECT_SPC, *pMODE_SELECT_SPC;

typedef struct _MBR_BLOCK {
  UINT8 Res[454];
  unsigned long StartSector;
  unsigned long TotalSector;
  UINT8 Res1[50];
} MBR_BLOCK,*pMBR_BLOCK;

typedef struct _BPB_BLOCK {
  UINT8 BS_jmpBoo[3];
  UINT8 BS_OEMName[8];
  UINT16 BPB_BytesPerSec;
  UINT8 BPB_SecPerClus;
  UINT16 BPB_RsvdSecCnt;
  UINT8 BPB_NumFATs;
  UINT16 BPB_RootEntCnt;
  UINT16 BPB_TotSec16;
  UINT8 BPB_Media;
  UINT16 BPB_FATSz16;
  UINT16 BPB_SecPerTrk;
  UINT16 BPB_NumHeads;
  unsigned long BPB_HiddSec;
  unsigned long BPB_TotSec32;
  UINT8 BS_DrvNum;
  UINT8 BS_Reserved1;
  UINT8 BS_BootSig;
  UINT8 BS_VolID[4];
  UINT8 BS_VolLab[11];
  UINT8 BS_FilSysType[8];
  UINT8 ExecutableCode[448];
  UINT8 Marker[2];
} BPB_BLOCK,*pBPB_BLOCK;

typedef struct _BPB_BLOCK32 {
  UINT8 BS_jmpBoo[3];
  UINT8 BS_OEMName[8];
  UINT16 BPB_BytesPerSec;
  UINT8 BPB_SecPerClus;
  UINT16 BPB_RsvdSecCnt;
  UINT8 BPB_NumFATs;
  UINT16 BPB_RootEntCnt;
  UINT16 BPB_TotSec16;
  UINT8 BPB_Media;
  UINT16 BPB_FATSz16;
  UINT16 BPB_SecPerTrk;
  UINT16 BPB_NumHeads;
  unsigned long BPB_HiddSec;
  unsigned long BPB_TotSec32;
  UINT32 BPB_FATSz32;
  UINT16 BPB_ExtFlags;
  UINT16 BPB_FSVer;
  UINT32 BPB_RootClus;
  UINT16 BPB_FSInfo;
  UINT16 BPB_BkBootSec;
  UINT8  BPB_Reserved[12];
  UINT8  BS_DrvNum;
  UINT8  BS_Reserved1;
  UINT8  BS_BootSig;
  UINT32 BS_VolID;
  UINT8  BS_VolLab[11];
  UINT8  BS_FilSysType[8];

} BPB_BLOCK32,*pBPB_BLOCK32;

typedef struct _SYS_INFO_BLOCK{
  unsigned long StartSector;
  unsigned long TotalSector;
  //UINT8 BS_jmpBoo[3];
  //UINT8 BS_OEMName[8];
  UINT16 BPB_BytesPerSec;
  UINT8 BPB_SecPerClus;
  //UINT8 BPB_RsvdSecCn[2];
  UINT8 BPB_NumFATs;
  UINT16 BPB_RootEntCnt;
  UINT16 BPB_TotSec16;
  UINT8 BPB_Media;
  UINT16 BPB_FATSz16;
  UINT32 BPB_FATSz32;
  UINT16 BPB_SecPerTrk;
  UINT16 BPB_NumHeads;
  unsigned long BPB_HiddSec;
  unsigned long BPB_TotSec32;
  UINT8 BS_DrvNum;
  //UINT8 BS_Reserved1;
  UINT8 BS_BootSig;
  UINT8 BS_VolID[4];
  UINT8 BS_VolLab[11];
  UINT8 BS_FilSysType[8];
  //UINT8 ExecutableCode[448];
  //UINT8 Marker[2];
  ///////////////////////////////
  unsigned long FatStartSector;
  unsigned long RootStartSector;
  //unsigned long DataStartSector;
  unsigned long FirstDataSector;
  //unsigned long FirstSectorofCluster;
  unsigned long TotCluster;
  unsigned char bFatType;
} SYS_INFO_BLOCK,*pSYS_INFO_BLOCK;

typedef struct _FILE_INFO{
  unsigned char bFileOpen;
  unsigned int StartCluster;   // current cluster
  unsigned long LengthInByte;
  unsigned int ClusterPointer; // next cluster
  unsigned long SectorPointer;
  unsigned int OffsetofSector; 
  unsigned char SectorofCluster;// 0~(sector/cluster-1)		    
  unsigned long pointer;	   // current sector(DSN)
//  unsigned int	FatSectorPointer;  // FSN
} FILE_INFO, *pFILE_INFO;

typedef struct _DIR_INFO{
	unsigned char name[8];      //0
	unsigned char extension[3]; //9
	unsigned char attribute;    //11
	unsigned char Reserved[10]; //21
	unsigned int lastUpdateDate; //23
	unsigned int lastUpdateTime; //25
	unsigned int startCluster;   //27
	unsigned long length;        //28
} DIR_INFO, *pDIR_INFO;
/*
// Mode Sense
*/
typedef struct _MODE_SENSE_SPC {
    UINT8 OperationCode;	    // 1AH
    UINT8 Reseved0 : 3 ;
    UINT8 DisableBlockDescriptor : 1 ;
    UINT8 Reserved0 : 4 ;
    UINT8 PageCode:6 ;
    UINT8 PageControl : 2 ;
    UINT8 Reserved1;
    UINT8 ParameterLen;
    UINT8 Control;
} MODE_SENSE_SPC, *pMODE_SENSE_SPC;

/*
typedef struct _MODE_PARAMETER_HEAD {
    UINT8 DataLen;
    UINT8 MediumType;
    UINT8 DeviceParameter;
    UINT8 BlockDescriptorLen;
} MODE_PARAMETER_HEAD, *pMODE_PARAMETER_HEAD;
*/
/*
// Define Device Capabilities page.
*/
/*
typedef struct _MODE_RBC_DEVICE_PARAMETERS_PAGE {
    UINT8 PageCode : 6;
	UINT8 Reserved : 1;
    UINT8 PageSavable : 1;
    UINT8 PageLength;
    UINT8 WriteCacheDisable : 1;
    UINT8 Reserved1 : 7;
    UINT8 LogicalBlockSize[2];
    UINT8 NumberOfLogicalBlocks[5];
    UINT8 PowerPerformance;
    UINT8 Lockable : 1;
    UINT8 Formattable : 1;
    UINT8 Writable : 1;
    UINT8 Readable : 1;
    UINT8 Reserved2 : 4;
    UINT8 Reserved3;
}MODE_RBC_DEVICE_PARAMETERS_PAGE, *pMODE_RBC_DEVICE_PARAMETERS_PAGE;
*/
/*
// prevent/allow medium removal
*/
typedef struct _MEDIA_REMOVAL_SPC {
	UINT8 OperationCode;    // 1EH
	UINT8 Reserved0[3];
	UINT8 Prevent;
	//UINT8 Reserved1:6 ;
	//UINT8 Control;
} MEDIA_REMOVAL_SPC, *pMEDIA_REMOVAL_SPC;

/*
// Request Sense
*/
typedef struct _REQUEST_SENSE_SPC {
    UINT8 OperationCode;    // 03H
    UINT8 Reserved[3];
    UINT8 AllocationLen;
    UINT8 Control;
} REQUEST_SENSE_SPC, *pREQUEST_SENSE_SPC;
/*
typedef struct _REQUEST_SENSE_DATA {
    UINT8 ResponseCode : 7;
    UINT8 Valid : 1;

    UINT8 SegmentNum;

    UINT8 SenseKey : 4;
    UINT8 Reserved0 : 1;
    UINT8 WrongLenIndicator : 1;
    UINT8 EndofMedium : 1;
    UINT8 FileMark : 1;

    UINT8 Info_0;
    UINT8 Info_1;
    UINT8 Info_2;
    UINT8 Info_3;

    UINT8 AdditionalSenseLen;

    UINT8 CommandSpecInfo_0;
    UINT8 CommandSpecInfo_1;
    UINT8 CommandSpecInfo_2;
    UINT8 CommandSpecInfo_3;

    UINT8 ASC;
    UINT8 ASCQ;
    UINT8 FieldReplacableUnitCode;
    UINT8 SenseKeySpec_0 : 7;
    UINT8 SenseKeySpecValid : 1;
    UINT8 SenseKeySpec_1;
    UINT8 SenseKeySpec_2;

} REQUEST_SENSE_DATA, *pREQUEST_SENSE_DATA;
*/
/*
// Test Unit Ready
*/
typedef struct _TEST_UNIT_SPC {
	UINT8 OperationCode;    // 00H
	UINT8 Reserved[4];
	UINT8 Control;
} TEST_UNIT_SPC, *pTEST_UNIT_SPC;

/*
// Write Buffer
*/

typedef struct _WRITE_BUFFER_SPC {
    UINT8 OperationCode;    
    UINT8 Mod:4 ;
    UINT8 Reserved0:4 ;
	UINT8 BufferID;
    UINT8 BufferOff_2;
    UINT8 BufferOff_1;
    UINT8 BufferOff_0;
    UINT8 ParameterLen_2;
    UINT8 ParameterLen_1;
	UINT8 ParameterLen_0;
    UINT8 Control;
} WRITE_BUFFER_SPC, *pWRITE_BUFFER_SPC;	  

typedef union _CDB_RBC {
    GENERIC_CDB             Cdb_Generic;
  
     // RBC commands
    GENERIC_RBC             RbcCdb_Generic;

    FORMAT_RBC              RbcCdb_Format;
    READ_RBC                RbcCdb_Read;
    READ_CAPACITY_RBC       RbcCdb_ReadCapacity;
    START_STOP_RBC          RbcCdb_OnOffUnit;
    SYNCHRONIZE_CACHE_RBC   RbcCdb_SyncCache;
    VERIFY_RBC              RbcCdb_Verify;
    WRITE_RBC               RbcCdb_Write;

   
    // SPC-2 commands
   
    INQUIRY_SPC             SpcCdb_Inquiry;
    MODE_SELECT_SPC         SpcCdb_ModeSelect;
    MODE_SENSE_SPC          SpcCdb_ModeSense;
    MEDIA_REMOVAL_SPC       SpcCdb_Remove;
    REQUEST_SENSE_SPC       SpcCdb_RequestSense;
    TEST_UNIT_SPC           SpcCdb_TestUnit;
    WRITE_BUFFER_SPC        SpcCdb_WriteBuffer;

    // ATAPI Commands
    READ_10         CmdRead10;
    WRITE_10        CmdWrite10;
    MODE_SELECT_10  CmdModeSel10;
    MODE_SENSE_10   CmdModeSen10;
    //////////////////////////////////////
    READ_LONG_CMD	SpcCdb_ReadLong;

} CDB_RBC, *pCDB_RBC;


⌨️ 快捷键说明

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