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

📄 fx_mass_storage.h

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifdef I86_USB_SUPPORT
/**
%file Fx_mass_storage.h
%desc
Header file for mass storage driver.
%author Moshe Bakir
*/

#ifndef __FX_MASS_STORAGE_H
#define __FX_MASS_STORAGE_H

//////////////////////////////////////////////////////////////////////////////
// Mass Storage Class - Commands sets 
//////////////////////////////////////////////////////////////////////////////

#define MASS_STORAGE_REDUCED_BLOCK_COMMANDS 0x01        
#define MASS_STORAGE_SFF_8020               0x02
#define MASS_STORAGE_QIC_157                0x03
#define MASS_STORAGE_UFI                    0x04
#define MASS_STORAGE_SFF_8070               0x05
#define MASS_STORAGE_SCSI_TRANSPARENT       0x06

//////////////////////////////////////////////////////////////////////////////
// Mass Storage Class - Protocols
//////////////////////////////////////////////////////////////////////////////

#define MASS_STORAGE_CBI_COMMAND_COMPLETION 0x00
#define MASS_STORAGE_CBI_NO_COMMAND_COMP    0x01
#define MASS_STORAGE_BULK_ONLY              0x50

//////////////////////////////////////////////////////////////////////////////
// UFI command opcodes
//////////////////////////////////////////////////////////////////////////////

#define  UFI_FORMAT_UNIT                    0x04
#define  UFI_INQUIRY                        0x12
#define  UFI_START_STOP                     0x1B
#define  UFI_MODE_SELECT                    0x55
#define  UFI_MODE_SENSE                     0x5A
#define  UFI_PREVENT_ALLOW_MEDIUM_REMOVAL   0x1E
#define  UFI_READ_10                        0x28
#define  UFI_READ_12                        0xA8
#define  UFI_READ_CAPACITY                  0x25
#define  UFI_READ_FORMAT_CAPACITIES         0x23
#define  UFI_REQUEST_SENSE                  0x03
#define  UFI_REZERO_UNIT                    0x01
#define  UFI_SEEK                           0x2B
#define  UFI_SEND_DIAGNOSTIC                0x1D
#define  UFI_TEST_UNIT_READY                0x00
#define  UFI_VERIFY                         0x2F
#define  UFI_WRITE_10                       0x2A
#define  UFI_WRITE_12                       0xAA
#define  UFI_WRITE_AND_VERIFY               0x2E

#pragma pack(1)

// Generic UFI command
typedef struct tagSUFICMD
{
    // Byte 0 - opcode 12H    
    unsigned uwOpcode                  : 8; 

    // Byte 1 
    unsigned uwReserved1               : 5;
    unsigned uwLun                     : 3;

    // Bytes 2-11
    USHORT uwReserved2[5];

} SUFICMD, *PSUFICMD;

//////////////////////////////////////////////////////////////////////////////
// INQUERY Command 12H
//////////////////////////////////////////////////////////////////////////////

// Inquiery command
typedef struct tagSUFIINQUIRYCMD
{
    // Byte 0 - opcode 12H
    unsigned uwOpcode                  : 8; 

    // Byte 1 from LSB to MSB, UFI supports only 0 for uwEvpd
    unsigned uwEvpd                    : 1;
    unsigned uwReserved1               : 4;
    unsigned uwLun                     : 3;

    // Byte 2 - UFI supports only code page 0
    unsigned uwPageCode                : 8; 

    // Byte 3
    unsigned uwReserved2               : 8; 

    // Byte 4 - specifies the maximum number of bytes of inquery
    // data to be returned
    unsigned uwAllocationLength        : 8; 

} SUFIINQUIRYCMD, *PSUFIINQUIRYCMD;


// Inquiery response data
typedef struct tagSUFIINQUIRYDATA
{
    // Byte 0 from LSB to MSB - identifies the device currently connected 
    // to the requested logical unit, 0 - direct access, 0x1F none
    unsigned uwPeriferialDeviceType    : 5; 
    unsigned uwReserved1               : 3; 

    // Byte 1 from LSB to MSB
    unsigned uwReserved2               : 7; 
    // Shall be set to one to indicate removeable media
    unsigned uwRemovableMediaBit       : 1; 

    // Byte 2 - all fields has to be zero to comply with UFI
    unsigned uwAnsiVersion             : 3; 
    unsigned uwEmcaVersion             : 3; 
    unsigned uwIsoVersion              : 2; 

    // Byte 3 - value of 01H shall be used for UFI device
    unsigned uwResponseDataFormat      : 4; 
    unsigned uwReserved3               : 4;

    // Byte 4 - includes length from byte 5 to 35 inclusively - 31 (0x1F)
    // This field shall not be adjusted to reflect possible transaction if 
    // the  allocation length of command is too small to transfer all the 
    // parameters
    unsigned uwAdditionalLength        : 8; 

    // Byte 5
    unsigned uwReserved4               : 8;

    // Byte 6,7
    unsigned uwReserved5               :16;

    // Byte 8..15(8 bytes) of ASCII, left-aligned
    BYTE byVendorInformation[8];

    // Byte 16..31(16 bytes) of ASCII, left-aligned
    BYTE byProductIdentification[16];

    // Byte 32..35(4 bytes) of ASCII format "x.xx", left-aligned
    // firmware revision version
    BYTE byProductRevision[4];

} SUFIINQUIRYDATA, *PSUFIINQUIRYDATA;


// Periferial device type definitions
#define  UFI_DIRECT_ACCESS_DEVICE   0x00
#define  UFI_NO_DEVICE              0x1F

//////////////////////////////////////////////////////////////////////////////
// READ FORMAT CAPACITIES Command 23H
//////////////////////////////////////////////////////////////////////////////

// Read Format Capacities Command
typedef struct tagSUFIREADFORMATCAPCMD
{
    // Byte 0 - opcode 23H
    unsigned uwOpcode                  : 8; 

    // Byte 1 from LSB to MSB
    unsigned uwReserved1               : 5;
    unsigned uwLun                     : 3;

    // Bytes 2-6
    unsigned uwReserved2               : 8; 
    unsigned uwReserved3               :16; 
    unsigned uwReserved4               :16; 

    // Bytes 7-8 - Allocation length - the number of returned bytes should 
    // not excceed this value
    unsigned uwAllocationLengthMsb     : 8;
    unsigned uwAllocationLengthLsb     : 8;

} SUFIREADFORMATCAPCMD, *PSUFIREADFORMATCAPCMD;

// Current/Maximum Capacity descriptor
typedef struct tagSUFICAPDESC
{
    // Bytes 0-3, Indicates the total number of addressable blocks for the 
    // descriptor's media type
    unsigned uwNumberOfBlocksMsb      : 8;
    unsigned uwNumberOfBlocksMidMsb   : 8;
    unsigned uwNumberOfBlocksMidLsb   : 8;
    unsigned uwNumberOfBlocksLsb      : 8;

    // Byte 4, specifies the type of descriptor returned to the Host
    unsigned  uwDescriptorCode        : 2;
    unsigned  uwReserved5             : 6;

    // Byte 5
    unsigned  uwReserved4             : 8;

    // Bytes 6,7 - indicates the number of addressable blocks for the given
    // capacity descriptor
    unsigned  uwBlockLengthMsb        : 8;
    unsigned  uwBlockLengthLsb        : 8;

} SUFICAPDESC, *PSUFICAPDESC;

// Capacity List header
typedef struct tagSUFICAPLISTHDR
{
    // Bytes 0,1
    unsigned uwReserved1              :16;

    // Byte 2
    unsigned uwReserved2              : 8;

    // Byte 3 - specifies the length in bytes of the Capacity Descriptors 
    // that follow. Each capacity descriptor is eight bytes in length, making
    // the Capacity List Length equal to eight times the number of descriptors
    unsigned uwCapacityListLength     : 8;

    // Current / Maximum Capacity Descriptor
    SUFICAPDESC sDesc[1];

} SUFICAPLISTHDR, *PSUFICAPLISTHDR;

// Descriptor Code Definition
#define UFI_UNFORMATTED_MEDIA           0x01
#define UFI_FORMATTED_MEDIA             0x02
#define UFI_NO_CARTRIDGE_IN_DRIVE       0x03

//////////////////////////////////////////////////////////////////////////////
// READ CAPACITY Command 25H - allows the host to request capacities of 
// the currently installed media
//////////////////////////////////////////////////////////////////////////////

// Read Capacity Command
typedef struct tagSUFIREADCAPCMD
{
    // Byte 0 - opcode 25H
    unsigned uwOpcode                  : 8;

    // Byte 1 from LSB to MSB - should be set to 0 for UFI
    unsigned uwRelAdr                  : 1;
    unsigned uwReserved1               : 4;
    unsigned uwLun                     : 3;

    // Bytes 2-5 - Logical Block address should be set to zero
    unsigned uwLbaMsb                  : 8;
    unsigned uwLbaMidMsb               : 8;
    unsigned uwLbaMidLsb               : 8;
    unsigned uwLbaLsb                  : 8;

    // Bytes 6-7
    unsigned uwReserved2               :16;

    // Byte 8 - PMI bit should be set to 0
    unsigned uwPmi                     : 1;
    unsigned uwReserved3               : 7;

} SUFIREADCAPCMD, *PSUFIREADCAPCMD;

// Read Capacity Data 
typedef struct tagSUFIREADCAPDATA
{
    // Holds the last valid Logical Block Address for use with media 
    // access commands
    unsigned uwLastLbaMsb              : 8;
    unsigned uwLastLbaMidMsb           : 8;
    unsigned uwLastLbaMidLsb           : 8;
    unsigned uwLastLbaLsb              : 8;

    // Specifies the length in bytes of each logical block for the given
    // capacity descriptor
    unsigned uwBlockLengthMsb          : 8;
    unsigned uwBlockLengthMidMsb       : 8;
    unsigned uwBlockLengthMidLsb       : 8;
    unsigned uwBlockLengthLsb          : 8;

} SUFIREADCAPDATA, *PSUFIREADCAPDATA;

//////////////////////////////////////////////////////////////////////////////
// REQUEST SENSE Command 03H
//////////////////////////////////////////////////////////////////////////////

// Request Sence Command
typedef struct tagSUFIREQSENSECMD
{
    // Byte 0 - opcode 03H
    unsigned uwOpcode                  : 8;

    // Byte 1 from LSB to MSB
    unsigned uwReserved1               : 5;
    unsigned uwLun                     : 3;

    // Bytes 2-3
    unsigned uwReserved2               :16;

    // Byte 4
    unsigned uwAllocationLength        : 8;

} SUFIREQSENSECMD, *PSUFIREQSENSECMD;

//
typedef struct tagSUFIREQSENSEDATA
{
    // Byte 0, Error Code shall be set to 70H
    unsigned uwErrorCode               : 7; 
    // Indicates valid information field 1, or otherwise 0.
    unsigned uwValid                   : 1; 

    // Byte 1
    unsigned uwReserved1               : 8;

    // Byte 2
    unsigned uwSenseKey                : 4; 
    unsigned uwReserved2               : 4;

    // Bytes 3-6, 
    unsigned uwInformationMsb          : 8;
    unsigned uwInformationMidMsb       : 8;
    unsigned uwInformationMidLsb       : 8;
    unsigned uwInformationLsb          : 8;

    // Byte 7 - Has to be 10
    unsigned uwAdditionalSenseLength   : 8; 

    // Byte 8,9
    USHORT uwReserved3;

    // Byte 10,11
    USHORT uwReserved4;

    // Byte 12
    unsigned uwAdditionalSenseCode      : 8; 

    // Byte 13
    unsigned wAdditionalSenseQualifier  : 8; 

    // Byte 14, 15
    USHORT uwReserved5;

    // Byte 16,17
    USHORT uwReserved6;

} SUFIREQSENSEDATA, *PSUFIREQSENSEDATA;

// Sens Key Codes
#define SK_NO_SENS                  0x00
#define SK_RECOVERED_ERROR          0x01
#define SK_NOT_READY                0x02
#define SK_MEDIUM_ERROR             0x03
#define SK_HARDWARE_ERROR           0x04
#define SK_ILLEGAL_REQUEST          0x05
#define SK_UNIT_ATTENTION           0x06
#define SK_DATA_PROTECT             0x07
#define SK_BLANK_CHECK              0x08
#define SK_VENDOR_SPECIFIC          0x09
#define SK_RESERVED1                0x0A
#define SK_ABORTED_COMMAND          0x0B
#define SK_RESERVED2                0x0C
#define SK_VOLUME_OVERFLOW          0x0D
#define SK_MISCOMPARE               0x0E
#define SK_RESERVED3                0x0F

// Additional Sens Code + Additional Sens Code Qualifier
#define ASC_WRITE_FAULT                             0x0300
#define ASC_DEVICE_NOT_READY_INIT_REQUIRED          0x0402
#define ASC_DEVICE_IS_BUSY                          0x04FF
#define ASC_UNRECOVERED_READ_ERROR                  0x1100
#define ASC_INVALID_OPCODE                          0x2000
#define ASC_LBA_OUT_OF_RANGE                        0x2100
#define ASC_INVALID_FIELD_IN_COMMAND_PACKET         0x2400
#define ASC_INVALID_FIELD_IN_PARAM_LIST             0x2600
#define ASC_PARAMETER_NOT_SUPPORTED                 0x2601
#define ASC_WRITE_PROTECTED                         0x2700

⌨️ 快捷键说明

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