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

📄 aspi.h

📁 一个SCSI的Tape设备读写等操作的软件.
💻 H
📖 第 1 页 / 共 3 页
字号:
|-----+-----------------------------------------------------------------------|
| 5   |                           Control                                     |
+=============================================================================+
*/
typedef struct   
{
  unsigned cmd : 8;				//0x1B
  unsigned immediate : 1;		//return immediatly ?
  unsigned _reserved1 : 4;		//n/a
  unsigned lun : 3;				//logical unit number
  unsigned _reserved2 : 8;		//n/a
  unsigned _reserved3 : 8;		//n/a
  unsigned load : 1;			//load=1 unload=0
  unsigned retention : 1;		//retension tape ?
  unsigned eot : 1;				//reposition to end of tape before unload ?
  unsigned _reserved4 : 5;		//n/a
  unsigned control : 8;			//
}_ld;

/*
                          Table 177 - LOCATE command
+=====-========-========-========-========-========-========-========-========+
|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
|Byte |        |        |        |        |        |        |        |        |
|=====+=======================================================================|
| 0   |                           Operation code (2Bh)                        |
|-----+-----------------------------------------------------------------------|
| 1   |    Logical unit number   |      Reserved   |   BT   |   CP   | Immed  |
|-----+-----------------------------------------------------------------------|
| 2   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 3   | (MSB)                                                                 |
|-----+---                                                                 ---|
| 4   |                                                                       |
|-----+---                        Block address                            ---|
| 5   |                                                                       |
|-----+---                                                                 ---|
| 6   |                                                                 (LSB) |
|-----+-----------------------------------------------------------------------|
| 7   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 8   |                           Partition                                   |
|-----+-----------------------------------------------------------------------|
| 9   |                           Control                                     |
+=============================================================================+
*/
typedef struct 
{
  unsigned cmd : 8;			//0x2B
  unsigned immediate : 1;	//return immediately
  unsigned cp : 1;			//use and update partition field ?
  unsigned bt : 1;			//SCSI- (0) or device-block (1)
  unsigned _reserved1 : 2;	//n/a
  unsigned lun : 3;			//logical unit number
  unsigned _reserved2 : 8;	//n/a
  unsigned blk_1 : 8;		//block adress
  unsigned blk_2 : 8;		//block adress
  unsigned blk_3 : 8;		//block adress
  unsigned blk_4 : 8;		//block adress
  unsigned _reserved3 : 8;	//n/a
  unsigned partition : 8;	//partition number
  unsigned control : 8;		//
}_loc;

/*
                     Table 192 - WRITE FILEMARKS command
+=====-========-========-========-========-========-========-========-========+
|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
|Byte |        |        |        |        |        |        |        |        |
|=====+=======================================================================|
| 0   |                           Operation code (10h)                        |
|-----+-----------------------------------------------------------------------|
| 1   |   Logical unit number    |         Reserved         |  WSmk  | Immed  |
|-----+-----------------------------------------------------------------------|
| 2   | (MSB)                                                                 |
|-----+---                                                                 ---|
| 3   |                           Transfer length                             |
|-----+---                                                                 ---|
| 4   |                                                                 (LSB) |
|-----+-----------------------------------------------------------------------|
| 5   |                           Control                                     |
+=============================================================================+
*/
typedef struct 
{  
  unsigned cmd : 8;				//0x10
  unsigned immediate : 1;		//return immediatly ?
  unsigned wsmk : 1;			//write setmarks ?
  unsigned _reserved1 : 3;		//n/a
  unsigned lun : 3;				//logical unit number
  unsigned len_2 : 8;			//number of marks
  unsigned len_1 : 8;			//number of marks
  unsigned len_0 : 8;			//number of marks
  unsigned control : 8;			//
}_wrmk;


/*
                           Table 178 - READ command
+=====-========-========-========-========-========-========-========-========+
|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
|Byte |        |        |        |        |        |        |        |        |
|=====+=======================================================================|
| 0   |                           Operation code (08h)                        |
|-----+-----------------------------------------------------------------------|
| 1   |   Logical unit number     |        Reserved         |  SILI  | Fixed  |
|-----+-----------------------------------------------------------------------|
| 2   | (MSB)                                                                 |
|-----+---                                                                 ---|
| 3   |                           Transfer length                             |
|-----+---                                                                 ---|
| 4   |                                                                 (LSB) |
|-----+-----------------------------------------------------------------------|
| 5   |                           Control                                     |
+=============================================================================+
*/
typedef struct   
{  
  unsigned cmd : 8;				//0x08
  unsigned fixed : 1;			//
  unsigned sili : 1;			//
  unsigned _reserved1 : 3;		//n/a
  unsigned lun : 3;				//logical unit number
  unsigned len_2 : 8;			//	
  unsigned len_1 : 8;			//
  unsigned len_0 : 8;			//
  unsigned control : 8;			//
}_rdwr;

/*
                          Table 188 - SPACE command
+=====-========-========-========-========-========-========-========-========+
|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
|Byte |        |        |        |        |        |        |        |        |
|=====+=======================================================================|
| 0   |                           Operation  (11h)                            |
|-----+-----------------------------------------------------------------------|
| 1   |   Logical unit number    |     Reserved    |           Code           |
|-----+-----------------------------------------------------------------------|
| 2   | (MSB)                                                                 |
|-----+---                                                                 ---|
| 3   |                           Count                                       |
|-----+---                                                                 ---|
| 4   |                                                                 (LSB) |
|-----+-----------------------------------------------------------------------|
| 5   |                           Control                                     |
+=============================================================================+
*/
typedef struct 
{
  unsigned cmd : 8;						//0x11
  unsigned code : 3;					//blocks 		000 
										//filemarks 	001 
										//seq filemarks	010	
										//EOD 			011
										//setmarks		100
										//seq setmarks	101
  unsigned _reserved1 : 2;				//n/a
  unsigned lun : 3;						//logical unit number
  unsigned cnt2 : 8;					//
  unsigned cnt1 : 8;					//
  unsigned cnt0 : 8;					//	
  unsigned control : 8;					//
}_spc;

/*
                          Table 175 - ERASE command
+=====-========-========-========-========-========-========-========-========+
|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
|Byte |        |        |        |        |        |        |        |        |
|=====+=======================================================================|
| 0   |                           Operation code (19h)                        |
|-----+-----------------------------------------------------------------------|
| 1   |   Logical unit number    |         Reserved          | Immed |  Long  |
|-----+-----------------------------------------------------------------------|
| 2   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 3   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 4   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 5   |                           Control                                     |
+=============================================================================+
*/
typedef struct 	
{
	unsigned cmd : 8;				//0x19
	unsigned big : 1;				//shall all remaining medium in the 
									//current partition be erased beginning 
									//at the current logical position ?
	unsigned immediate : 1;			//return immediatly ?
	unsigned _reserved1 : 3;		//n/a
	unsigned lun : 3;				//logical unit number
	unsigned _reserved2 : 8;		//n/a
	unsigned _reserved3 : 8;		//n/a
	unsigned _reserved4 : 8;		//n/a
	unsigned control : 8;			//
}_ers;

/*
                       Table 54 - MODE SENSE(6) command
+=====-========-========-========-========-========-========-========-========+
|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
|Byte |        |        |        |        |        |        |        |        |
|=====+=======================================================================|
| 0   |                           Operation code (1Ah)                        |
|-----+-----------------------------------------------------------------------|
| 1   | Logical unit number      |Reserved|   DBD  |         Reserved         |
|-----+-----------------------------------------------------------------------|
| 2   |       PC        |                   Page code                         |
|-----+-----------------------------------------------------------------------|
| 3   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 4   |                           Allocation length                           |
|-----+-----------------------------------------------------------------------|
| 5   |                           Control                                     |
+=============================================================================+
*/
typedef struct 
{
	unsigned cmd : 8;				//0x1A
	unsigned _reserved1 : 3;		//n/a
	unsigned dbd : 1;				//disable block descriptor ?
	unsigned _reserved2 : 1;		//n/a
	unsigned lun : 3;				//logical unit number
	unsigned pagecode : 6;			//page code
	unsigned pc : 2;				//page control:	current values		00
									//				changable values	01
									//				default values		10
									//				saved values		11
	unsigned _reserved3 : 8;		//n/a
	unsigned len : 8;				//allocation length
	unsigned control : 8;			//
}_mdsn;


/*
                      Table 52 - MODE SELECT(6) command
+=====-========-========-========-========-========-========-========-========+
|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
|Byte |        |        |        |        |        |        |        |        |
|=====+=======================================================================|
| 0   |                           Operation code (15h)                        |
|-----+-----------------------------------------------------------------------|
| 1   | Logical unit number      |   PF   |         Reserved         |  SP    |
|-----+-----------------------------------------------------------------------|
| 2   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 3   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 4   |                           Parameter list length                       |
|-----+-----------------------------------------------------------------------|
| 5   |                           Control                                     |
+=============================================================================+
*/
typedef struct 
{
	unsigned cmd : 8;				//0x15
	unsigned sp : 1;				//save page ?
	unsigned _reserved1 : 3;		//n/a
	unsigned pf : 1;				//SCSI1 or standard ?
	unsigned lun : 3;				//logical unit number
	unsigned _reserved2 : 8;		//n/a
	unsigned _reserved3 : 8;		//n/a
	unsigned len : 8;				//allocation length
	unsigned control : 8;			//
}_mdsl;



typedef union  
{
  _ccb6 c6;				//Generic 6Byte Command
  _ers ers;				//ERASE
  _inq inq;				//HA INQUIRY
  _cpy cpy;				//COPY
  _rsv rsv;				//RESERVE
  _stp stp;				//START/STOP
  _rem rem;				//LOCK/UNLOCK
  _ld ld;				//LOAD/UNLOAD
  _rdwr rdwr;			//READ/WRITE
  _wrmk wrmk;			//WRITE FILEMARK
  _mdsn mdsn;			//MODE SENSE	
  _mdsl mdsl;			//MODE SELECT
  _spc spc;				//SPACE
  _ccb10 c10;			//Generic 10Byte Command
}_ccb;

/*
This is the most important structure; all commands are wrapped inside these
parameters.
*/
typedef struct
{
	BYTE	SRB_Cmd;				//ASPI command code = SC_EXEC_SCSI_CMD
	BYTE	SRB_Status;				//ASPI command status byte
	BYTE	SRB_HaId;				//ASPI host adapter number
	BYTE	SRB_Flags;				//ASPI request flags
	DWORD	SRB_Hdr_Rsvd;			//Reserved
	BYTE	SRB_Target;				//Target's SCSI ID
	BYTE	SRB_Lun;				//Target's LUN number
	WORD	SRB_Rsvd1;				//Reserved for Alignment
	DWORD	SRB_BufLen;				//Data Allocation Length
	BYTE	*SRB_BufPointer;		//Data Buffer Pointer
	BYTE	SRB_SenseLen;			//Sense Allocation Length
	BYTE	SRB_CDBLen;				//CDB Length
	BYTE	SRB_HaStat;				//Host Adapter Status
	BYTE	SRB_TargStat;			//Target Status
	HANDLE	SRB_PostProc;			//Post routine
	void	*SRB_Rsvd2;				//Reserved
	BYTE	SRB_Rsvd3[16];			//Reserved for alignment
	_ccb	ccb;					//SCSI Command Descriptor Block
	BYTE	SRB_Rsvd4[4];			//Reserved for alignment
	BYTE	SenseArea[SENSE_LEN+2]; //Request Sense buffer
} SRB_MyExecSCSICmd, *PSRB_MyExecSCSICmd;









⌨️ 快捷键说明

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