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

📄 rbccmd.h

📁 次文件包括uCOS-II中使用,ZLG_FS在CF卡上的例子,ARM采用的是LPC2210.
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 1999-2003 PHILIPS Semiconductors - APIC
//
// Module Name:
//
//	rbcCMD.h
//
// Abstract:
//
//    These are the structures and defines used in the Reduced Block Command set//

// Author:
//
//     Hilbert Zhang ZhenYu
//
// Revision History:
//
//		Created  29 Apr. 1999
//
// Copyright @ 1999-2003, PHILIPS Semiconductors - APIC. All rights reserved.
//
//  Implementation Notes:
//      1. LUN
//          In SCSI-2, 3 bits LUN locates the highest 3 bits of the byte next to
//          OperationCode of the command Request.
//          In SCSI-3, 4 Bits LUN is controlled by Transport Protocol,
//              RBC and SPC-2 are parts of SCSI-3
//
*/

#ifndef __RBC_COMMAND_
#define __RBC_COMMAND_

#ifndef BIG_ENDIAN
#define BIG_ENDIAN
#endif

#include "BasicTyp.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 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
*/
/*
// Generic
*/
typedef struct _GENERIC_CDB {
//	INT8 OperationCode;
    INT8 Reserved[15];
} GENERIC_CDB,*PGENERIC_CDB;

typedef struct _GENERIC_RBC {
//	INT8 OperationCode;
    INT8 Reserved[8];
	INT8 Control;
} GENERIC_RBC,*PGENERIC_RBC;

/*
// format unit
*/
typedef struct _FORMAT_RBC {
//	INT8 OperationCode;	/* 04H */
	INT8 VendorSpecific;
	unsigned Increment : 1;
	unsigned PercentorTime : 1;
	unsigned Progress : 1;
    unsigned Immediate : 1;
	unsigned VendorSpecific1 : 4;
	INT8 Reserved2[2];
	INT8 Control;
} FORMAT_RBC, *PFORMAT_RBC;


/*
// Read Command
*/
typedef struct _READ_RBC {
//	INT8 OperationCode;	/* 10H */
	INT8 VendorSpecific;
//    union{
//        struct
//        {
	        INT8 LBA_3;
	        INT8 LBA_2;
	        INT8 LBA_1;
	        INT8 LBA_0;
//        } LBA_W8 ;

//       INT32 LBA_W32;
//    }   LBA;
	INT8 Reserved;
    INT8 XferLength_1;
	INT8 XferLength_0;
    INT8 Control;
} READ_RBC, *PREAD_RBC;


/*
// Read Capacity Data - returned in Big Endian format
*/
typedef struct _READ_CAPACITY_DATA {

    INT8 LBA_3;
    INT8 LBA_2;
    INT8 LBA_1;
    INT8 LBA_0;

    INT8 BlockLen_3;
    INT8 BlockLen_2;
    INT8 BlockLen_1;
    INT8 BlockLen_0;
} READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;//8

/*
// Read Capacity command
*/
typedef struct _READ_CAPACITY_RBC {
//	INT8                OperationCode;	/* 10H */
    union   {
		FLEXI_INT32			l0[2];
        INT32               l[2];
        READ_CAPACITY_DATA  CapData;       /* Reserved area, here is used as temp*/
    } tmpVar;

	INT8                Control;
} READ_CAPACITY_RBC, *PREAD_CAPACITY_RBC;

/*
// START_STOP_UNIT
*/
typedef struct _START_STOP_RBC {
//    INT8 OperationCode;    /*1BH*/
    unsigned Immediate: 1;
    unsigned Reserved1 : 7;
    INT8 Reserved2[2];
	union _START_STOP_FLAGS
    {
        struct
        {
            unsigned Start          : 1;
            unsigned LoadEject      : 1;
            unsigned Reserved3      : 2;
            unsigned PowerConditions: 4;
        } bits0;

        struct
        {
            unsigned MediumState    : 2;
            unsigned Reserved3      : 2;
            unsigned PowerConditions: 4;
        } bits1;
    } Flags;
    INT8 Control;

⌨️ 快捷键说明

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