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

📄 sbc.h

📁 Atmel的AT91SAM7x256芯片的usb存储的源程序
💻 H
📖 第 1 页 / 共 2 页
字号:
    unsigned char  pVendorID[8];            //!< T10 vendor identification
    unsigned char  pProductID[16];          //!< Vendor-defined product ID
    unsigned char  pProductRevisionLevel[4];//!< Vendor-defined product revision
    unsigned char  pVendorSpecific[20];     //!< Vendor-specific data
    unsigned char  bUnused3;                //!< Unused features
    unsigned char  bReserved3;              //!< Reserved bits
    unsigned short pVersionDescriptors[8];  //!< Standards the device complies to
    unsigned char  pReserved4[22];          //!< Reserved bytes

} __attribute__ ((packed)) SBCInquiryData; // GCC

//! \brief  Data structure for the READ (10) command
//! \see    sbc3r07.pdf - Section 5.7 - Table 34
typedef struct {

    unsigned char bOperationCode;          //!< 0x28 : SBC_READ_10
    unsigned char bObsolete1:1,            //!< Obsolete bit
                  isFUA_NV:1,              //!< Cache control bit
                  bReserved1:1,            //!< Reserved bit
                  isFUA:1,                 //!< Cache control bit
                  isDPO:1,                 //!< Cache control bit
                  bRdProtect:3;            //!< Protection information to send
    unsigned char pLogicalBlockAddress[4]; //!< Index of first block to read
    unsigned char bGroupNumber:5,          //!< Information grouping
                  bReserved2:3;            //!< Reserved bits
    unsigned char pTransferLength[2];      //!< Number of blocks to transmit
    unsigned char bControl;                //!< 0x00

} __attribute__ ((packed)) SBCRead10; // GCC

//! \brief  Structure for the READ CAPACITY (10) command
//! \see    sbc3r07.pdf - Section 5.11.1 - Table 40
typedef struct {

    unsigned char bOperationCode;          //!< 0x25 : RBC_READ_CAPACITY
    unsigned char bObsolete1:1,            //!< Obsolete bit
                  bReserved1:7;            //!< Reserved bits
    unsigned char pLogicalBlockAddress[4]; //!< Block to evaluate if PMI is set
    unsigned char pReserved2[2];           //!< Reserved bytes
    unsigned char isPMI:1,                 //!< Partial medium indicator bit
                  bReserved3:7;            //!< Reserved bits
    unsigned char bControl;                //!< 0x00

} SBCReadCapacity10;

//! \brief  Data returned by the device after a READ CAPACITY (10) command
//! \see    sbc3r07.pdf - Section 5.11.2 - Table 41
typedef struct {

    unsigned char pLogicalBlockAddress[4]; //!< Address of last logical block
    unsigned char pLogicalBlockLength[4];  //!< Length of last logical block

} SBCReadCapacity10Data;

//! \brief  Structure for the REQUEST SENSE command
//! \see    spc4r06.pdf - Section 6.26 - Table 170
typedef struct {

    unsigned char bOperationCode;    //!< 0x03 : SBC_REQUEST_SENSE
    unsigned char isDesc    :1,      //!< Type of information expected
                  bReserved1:7;      //!< Reserved bits
    unsigned char pReserved2[2];     //!< Reserved bytes
    unsigned char bAllocationLength; //!< Size of host buffer
    unsigned char bControl;          //!< 0x00

} SBCRequestSense;

//! \brief  Fixed format sense data returned after a REQUEST SENSE command has
//!         been received with a DESC bit cleared.
//! \see    spc4r06.pdf - Section 4.5.3 - Table 26
typedef struct {

    unsigned char bResponseCode:7,                //!< Sense data format
                  isValid      :1;                //!< Information field is standard
    unsigned char bObsolete1;                     //!< Obsolete byte
    unsigned char bSenseKey :4,                   //!< Generic error information
                  bReserved1:1,                   //!< Reserved bit
                  isILI     :1,                   //!< SSC
                  isEOM     :1,                   //!< SSC
                  isFilemark:1;                   //!< SSC
    unsigned char pInformation[4];                //!< Command-specific
    unsigned char bAdditionalSenseLength;         //!< sizeof(SBCRequestSense_data)-8
    unsigned char pCommandSpecificInformation[4]; //!< Command-specific
    unsigned char bAdditionalSenseCode;           //!< Additional error information
    unsigned char bAdditionalSenseCodeQualifier;  //!< Further error information
    unsigned char bFieldReplaceableUnitCode;      //!< Specific component code
    unsigned char bSenseKeySpecific:7,            //!< Additional exception info
                  isSKSV           :1;            //!< Is sense key specific valid?
    unsigned char pSenseKeySpecific[2];           //!< Additional exception info

} SBCRequestSenseData;

//! \brief  Data structure for the TEST UNIT READY command
//! \see    spc4r06.pdf - Section 6.34 - Table 192
typedef struct {

    unsigned char bOperationCode; //!< 0x00 : SBC_TEST_UNIT_READY
    unsigned char pReserved1[4];  //!< Reserved bits
    unsigned char bControl;       //!< 0x00

} __attribute__ ((packed)) SBCTestUnitReady; // GCC

//! \brief  Structure for the WRITE (10) command
//! \see    sbc3r07.pdf - Section 5.26 - Table 70
typedef struct {

    unsigned char bOperationCode;          //!< 0x2A : SBC_WRITE_10
    unsigned char bObsolete1:1,            //!< Obsolete bit
                  isFUA_NV:1,              //!< Cache control bit
                  bReserved1:1,            //!< Reserved bit
                  isFUA:1,                 //!< Cache control bit
                  isDPO:1,                 //!< Cache control bit
                  bWrProtect:3;            //!< Protection information to send
    unsigned char pLogicalBlockAddress[4]; //!< First block to write
    unsigned char bGroupNumber:5,          //!< Information grouping
                  bReserved2:3;            //!< Reserved bits
    unsigned char pTransferLength[2];      //!< Number of blocks to write
    unsigned char bControl;                //!< 0x00

} SBCWrite10;

//! \brief  Structure for the PREVENT/ALLOW MEDIUM REMOVAL command
//! \see    sbc3r07.pdf - Section 5.5 - Table 30
typedef struct {

    unsigned char bOperationCode; //!< 0x1E : SBC_PREVENT_ALLOW_MEDIUM_REMOVAL
    unsigned char pReserved1[3];  //!< Reserved bytes
    unsigned char bPrevent:2,     //!< Accept/prohibit removal
                  bReserved2:6;   //!< Reserved bits
    unsigned char bControl;       //!< 0x00

} __attribute__ ((packed)) SBCMediumRemoval; // GCC

//! \brief  Structure for the MODE SENSE (6) command
//! \see    spc4r06 - Section 6.9.1 - Table 98
typedef struct {

    unsigned char bOperationCode;    //!< 0x1A : SBC_MODE_SENSE_6
    unsigned char bReserved1:3,      //!< Reserved bits
                  isDBD:1,           //!< Disable block descriptors bit
                  bReserved2:4;      //!< Reserved bits
    unsigned char bPageCode:6,       //!< Mode page to return
                  bPC:2;             //!< Type of parameter values to return
    unsigned char bSubpageCode;      //!< Mode subpage to return
    unsigned char bAllocationLength; //!< Host buffer allocated size
    unsigned char bControl;          //!< 0x00

} __attribute__ ((packed)) SBCModeSense6; // GCC

//! \brief  Header for the data returned after a MODE SENSE (6) command
//! \see    spc4r06.pdf - Section 7.4.3 - Table 268
typedef struct {

    unsigned char bModeDataLength;          //!< Length of mode data to follow
    unsigned char bMediumType;              //!< Type of medium (SBC_MEDIUM_TYPE_DIRECT_ACCESS_BLOCK_DEVICE)
    unsigned char bReserved1:4,             //!< Reserved bits
                  isDPOFUA:1,               //!< DPO/FUA bits supported ?
                  bReserved2:2,             //!< Reserved bits
                  isWP:1;                   //!< Is medium write-protected ?
    unsigned char bBlockDescriptorLength;   //!< Length of all block descriptors

} __attribute__ ((packed)) SBCModeParameterHeader6; // GCC

//! \brief  Informational exceptions control mode page
//! \see    spc4r06.pdf - Section 7.4.11 - Table 285
typedef struct {

    unsigned char bPageCode:6,       //!< 0x1C : SBC_PAGE_INFORMATIONAL_EXCEPTIONS_CONTROL
                  isSPF:1,           //!< Page or subpage data format
                  isPS:1;            //!< Parameters saveable ?
    unsigned char bPageLength;       //!< Length of page data (0x0A)
    unsigned char isLogErr:1,        //!< Should informational exceptions be logged ?
                  isEBackErr:1,      //!< Enable background error bit
                  isTest:1,          //!< Create a device test failure ?
                  isDExcpt:1,        //!< Disable exception control bit
                  isEWasc:1,         //!< Report warnings ?
                  isEBF:1,           //!< Enable background function bit
                  bReserved1:1,      //!< Reserved bit
                  isPerf:1;          //!< Delay acceptable when treating exceptions ?
    unsigned char bMRIE:4,           //!< Method of reporting informational exceptions
                  bReserved2:4;      //!< Reserved bits
    unsigned char pIntervalTimer[4]; //!< Error reporting period
    unsigned char pReportCount[4];   //!< Maximum number of time a report can be issued

} __attribute__ ((packed)) SBCInformationalExceptionsControl; // GCC

//! \brief  Read/write error recovery mode page
//! \see    sbc3r07.pdf - Section 6.3.5 - Table 122
typedef struct {

    unsigned char bPageCode:6,           //!< 0x01 : SBC_PAGE_READ_WRITE_ERROR_RECOVERY
                  isSPF:1,               //!< Page or subpage data format
                  isPS:1;                //!< Parameters saveable ?
    unsigned char bPageLength;           //!< Length of page data (0x0A)
    unsigned char isDCR:1,               //!< Disable correction bit
                  isDTE:1,               //!< Data terminate on error bit
                  isPER:1,               //!< Post error bit
                  isEER:1,               //!< Enable early recovery bit
                  isRC:1,                //!< Read continuous bit
                  isTB:1,                //!< Transfer block bit
                  isARRE:1,              //!< Automatic read reallocation enabled bit
                  isAWRE:1;              //!< Automatic write reallocation enabled bit
    unsigned char bReadRetryCount;       //!< Number of retries when reading
    unsigned char pObsolete1[3];         //!< Obsolete bytes
    unsigned char bReserved1;            //!< Reserved byte
    unsigned char bWriteRetryCount;      //!< Number of retries when writing
    unsigned char bReserved2;            //!< Reserved byte
    unsigned char pRecoveryTimeLimit[2]; //!< Maximum time duration for error recovery

} __attribute__ ((packed)) SBCReadWriteErrorRecovery; // GCC

//! \brief  Generic structure for holding information about SBC commands
//! \see    SBCInquiry
//! \see    SBCRead10
//! \see    SBCReadCapacity10
//! \see    SBCRequestSense
//! \see    SBCTestUnitReady
//! \see    SBCWrite10
typedef union {

    unsigned char          bOperationCode;  //!< Operation code of the command
    SBCInquiry          inquiry;        //!< INQUIRY command
    SBCRead10          read10;         //!< READ (10) command
    SBCReadCapacity10 readCapacity10; //!< READ CAPACITY (10) command
    SBCRequestSense    requestSense;   //!< REQUEST SENSE command
    SBCTestUnitReady  testUnitReady;  //!< TEST UNIT READY command
    SBCWrite10         write10;        //!< WRITE (10) command
    SBCMediumRemoval   mediumRemoval;  //!< PREVENT/ALLOW MEDIUM REMOVAL command
    SBCModeSense6     modeSense6;     //!< MODE SENSE (6) command

} SBCCommand;

#ifdef __ICCARM__          // IAR
#pragma pack()             // IAR
#endif                     // IAR

#endif //#ifndef SBC_H

⌨️ 快捷键说明

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