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

📄 rbccmd.h

📁 smartARM2400 USB OTG例程
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************Copyright (c)****************************************************
**                            Guangzhou ZHIYUAN electronics Co.,LTD.
**                                      
**                                 http://www.embedtools.com
**
**--------------File Info---------------------------------------------------------------------------------
** File name:               RBCCmd.h
** Latest modified Date:    2007-10-8
** Latest Version:          1.0
** Descriptions:            RBC模块使用的结构和宏定义
**
**--------------------------------------------------------------------------------------------------------
** Created by:              Lizhenming
** Created date:            2007-09-14
** Version:                 1.0
** Descriptions:            The original version
**
*********************************************************************************************************/

#ifndef __RBC_COMMAND_H
#define __RBC_COMMAND_H

/*
 *  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


/*
 *  for START_STOP_RBC
 */
#define __PWR_NOCHANGE    0
#define __PWR_ACTIVE      1
#define __PWR_IDLE        2
#define __PWR_STANDBY     3
#define __PWR_SLEEP       5
#define __PWR_DEVCTRL     7

#define __MEDIUM_STOP     0
#define __MEDIUM_READY    1
#define __MEDIUM_UNLOAD   2
#define __MEDIUM_LOAD     3

/*
 *  DeviceType field for Inquiry Data
 */
#define __DIRECT_ACCESS_DEVICE            0x00                          /*  disks                       */
#define __SEQUENTIAL_ACCESS_DEVICE        0x01                          /*  tapes                       */
#define __PRINTER_DEVICE                  0x02                          /*  printers                    */
#define __PROCESSOR_DEVICE                0x03                          /*  scanners, printers, etc     */
#define __WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04                          /*  worms                       */
#define __READ_ONLY_DIRECT_ACCESS_DEVICE  0x05                          /*  cdroms                      */
#define __SCANNER_DEVICE                  0x06                          /*  scanners                    */
#define __OPTICAL_DEVICE                  0x07                          /*  optical disks               */
#define __MEDIUM_CHANGER                  0x08                          /*  jukebox                     */
#define __COMMUNICATION_DEVICE            0x09                          /*  network                     */

#define __ASC0T18_DEVICE                  0x0A                          /*  ASC IT8                     */
#define __ASC1T18_DEVICE                  0x0B                          /*  ASC IT8                     */

#define __SCC2_DEVICE                     0x0C                          /*  Storage Controller device   */
#define __SES_DEVICE                      0x0D                          /*  Enclousre Service device    */
#define __RBC_DEVICE                      0x0E                          /*  RBC device                  */
#define __OCRW_DEVICE                     0x0F                          /*  optical Card Reader /writer */
                                                                        /*  Device                      */

#define __LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
#define __DEVICE_QUALIFIER_NOT_SUPPORTED  0x03

/*
 *  DeviceTypeQualifier field设备类型
 */
#define __REMOVABLE_MASK  0x80
#define __NOT_REMOVABLE   0x0                                           /* disks                        */
#define __REMOVABLE       0x80                                          /* CD-ROM                       */


#define __VPDPAGE_SERIAL_NUMBER   0x80
#define __VPDPAGE_DEVICE_IDENTITY 0x83

/*
 *  Mode Sense/Select page constants.
 */
#define __MODE_PAGE_RBC_DEVICE_PARAMETERS 0x06
#define __MODE_PAGE_ALL                   0x3F

#define __PAGECTRL_CURRENT    0x0
#define __PAGECTRL_CHANGEABLE 0x1
#define __PAGECTRL_DEFAULT    0x2
#define __PAGECTRL_SAVED      0x3

#define __MEDIUMREMOVAL_PROHIBITED_ALL    0x3
#define __MEDIUMREMOVAL_ALLOWED_ALL       0x0
#define __MEDIUMREMOVAL_ALLOWED_CHANGER   0x1
#define __MEDIUMREMOVAL_ALLOWED_DATA      0x2


#define __SCSI_RESPONSECODE_CURRENT_ERROR     0x70
#define __SCSI_RESPONSECODE_PREVIOUS_ERROR    0x71

/*
 *  Sense codes
 */

#define __SCSI_SENSE_NO_SENSE         0x00
#define __SCSI_SENSE_RECOVERED_ERROR  0x01
#define __SCSI_SENSE_NOT_READY        0x02
#define __SCSI_SENSE_MEDIUM_ERROR     0x03
#define __SCSI_SENSE_HARDWARE_ERROR   0x04
#define __SCSI_SENSE_ILLEGAL_REQUEST  0x05
#define __SCSI_SENSE_UNIT_ATTENTION   0x06
#define __SCSI_SENSE_DATA_PROTECT     0x07
#define __SCSI_SENSE_BLANK_CHECK      0x08
#define __SCSI_SENSE_UNIQUE           0x09
#define __SCSI_SENSE_COPY_ABORTED     0x0A
#define __SCSI_SENSE_ABORTED_COMMAND  0x0B
#define __SCSI_SENSE_EQUAL            0x0C
#define __SCSI_SENSE_VOL_OVERFLOW     0x0D
#define __SCSI_SENSE_MISCOMPARE       0x0E
#define __SCSI_SENSE_RESERVED         0x0F

/*
 *  Additional tape bit
 */

#define __SCSI_ILLEGAL_LENGTH         0x20
#define __SCSI_EOM                    0x40
#define __SCSI_FILE_MARK              0x80

/*
 *  Additional Sense codes
 */

#define __SCSI_ADSENSE_NO_SENSE             0x00
#define __SCSI_ADSENSE_LUN_NOT_READY        0x04
#define __SCSI_ADSENSE_ILLEGAL_COMMAND      0x20
#define __SCSI_ADSENSE_ILLEGAL_BLOCK        0x21
#define __SCSI_ADSENSE_INVALID_PARAMETER    0x26
#define __SCSI_ADSENSE_INVALID_LUN          0x25
#define __SCSI_ADSENSE_INVALID_CDB          0x24
#define __SCSI_ADSENSE_MUSIC_AREA           0xA0
#define __SCSI_ADSENSE_DATA_AREA            0xA1
#define __SCSI_ADSENSE_VOLUME_OVERFLOW      0xA7

#define __SCSI_ADSENSE_NO_MEDIA_IN_DEVICE   0x3A
#define __SCSI_ADSENSE_FORMAT_ERROR		    0x31
#define __SCSI_ADSENSE_CMDSEQ_ERROR		    0x2C
#define __SCSI_ADSENSE_MEDIUM_CHANGED       0x28
#define __SCSI_ADSENSE_BUS_RESET            0x29
#define __SCSI_ADWRITE_PROTECT              0x27
#define __SCSI_ADSENSE_TRACK_ERROR          0x14
#define __SCSI_ADSENSE_SAVE_ERROR           0x39
#define __SCSI_ADSENSE_SEEK_ERROR           0x15
#define __SCSI_ADSENSE_REC_DATA_NOECC       0x17
#define __SCSI_ADSENSE_REC_DATA_ECC         0x18

/*
 *  Additional sense code qualifier
 */

#define __SCSI_SENSEQ_FORMAT_IN_PROGRESS            0x04
#define __SCSI_SENSEQ_INIT_COMMAND_REQUIRED         0x02
#define __SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED  0x03
#define __SCSI_SENSEQ_BECOMING_READY                0x01
#define __SCSI_SENSEQ_FILEMARK_DETECTED             0x01
#define __SCSI_SENSEQ_SETMARK_DETECTED              0x03
#define __SCSI_SENSEQ_END_OF_MEDIA_DETECTED         0x02
#define __SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED   0x04


#define __WRBUFF_MODE_COMBINED            0x0
#define __WRBUFF_MODE_Vendor              0x1
#define __WRBUFF_MODE_DATA                0x2
#define __WRBUFF_MODE_DOWNLD              0x4
#define __WRBUFF_MODE_DOWNLD_SAVE         0x2
#define __WRBUFF_MODE_DOWNLD_OFFSET       0x6
#define __WRBUFF_MODE_DOWNLD_SAVE_OFFSET  0x7
#define __WRBUFF_MODE_ECHO                0xA


/*
 *  unsolicited status sense code qualifier values
 */

#define __RBC_UNSOLICITED_STATUS              0x02
#define __RBC_UNSOLICITED_SENSE_KEY           0x06

#define __RBC_UNSOLICITED_SC_PWR_STATE_CHNG   0xFF
#define __RBC_UNSOLICITED_SC_EVENT_STATUS     0xFE

#define __RBC_UNSOLICITED_CLASS_ASQ_DEVICE    0x06
#define __RBC_UNSOLICITED_CLASS_ASQ_MEDIA     0x04
#define __RBC_UNSOLICITED_CLASS_ASQ_POWER     0x02

/*********************************************************************************************************
  Command Descriptor Block
      _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  __packed struct _FORMAT_RBC {
    /*
     *	__uint8 OperationCode; 04H
     */
	__uint8 VendorSpecific;
	unsigned Increment : 1;
	unsigned PercentorTime : 1;
	unsigned Progress : 1;
    unsigned Immediate : 1;
	unsigned VendorSpecific1 : 4;
	__uint8 Reserved2[2];
	__uint8 Control;
} __FORMAT_RBC, *__PFORMAT_RBC;


/*
 *  Read10 Command
 */
typedef struct _READ_RBC {
    /*
     *	__uint8 OperationCode; 28H
     */
	__uint8 VendorSpecific;
    __uint8 LBA[4];
	__uint8 Reserved;
    __uint8 XferLength[2];
    __uint8 Control;
} __READ_RBC, *__PREAD_RBC;


/*
 *  Read Capacity Data - returned in Big Endian format
 */
typedef  __packed struct _READ_CAPACITY_DATA {
    __uint8 LBA[4];
    __uint8 BlockLen[4];
} __READ_CAPACITY_DATA, *__PREAD_CAPACITY_DATA;

/*
 *  Read Capacity command
 */
typedef  __packed struct _READ_CAPACITY_RBC {
    /*
     *	__uint8 OperationCode; 25H
     *  CapData;    reserved area,hear is used to return capacity data.
     */
    __READ_CAPACITY_DATA  CapData;                                       
	__uint8                 Control;
} __READ_CAPACITY_RBC, *__PREAD_CAPACITY_RBC;

/*
 *  START_STOP_UNIT
 */
typedef   __packed struct _START_STOP_RBC {
    /*
     *	__uint8 OperationCode; 1BH
     */   
    unsigned Immediate: 1;
    unsigned Reserved1 : 7;
    __uint8 Reserved2[2];
	
    unsigned MediumState    : 2;
    unsigned Reserved3      : 2;
    unsigned PowerConditions: 4;
       
    __uint8 Control;
} __START_STOP_RBC, *__PSTART_STOP_RBC;
/*
 *  Synchronize Cache
 */
typedef struct _SYNCHRONIZE_CACHE_RBC {
    /*
     *	__uint8 OperationCode; 35H
     */
	__uint8 Reserved[8];
	__uint8 Control;

} __SYNCHRONIZE_CACHE_RBC, *__PSYNCHRONIZE_CACHE_RBC;

/*
 *  Write10 Command
 */
typedef  __packed struct _WRITE_RBC {
    /*
     *	__uint8 OperationCode; 2AH
     */
    unsigned Reserved0 : 3;
	unsigned FUA : 1;
	unsigned Reserved1 : 4;
    __uint8 LBA[4];
	__uint8 Reserved2;
    __uint8 XferLength[2];
    __uint8 Control;
} __WRITE_RBC, *__PWRITE_RBC;

/*
 *  VERIFY Command
 */
typedef struct _VERIFY_RBC {
    /*

⌨️ 快捷键说明

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