📄 scsi.h
字号:
/***********************************************************************//* *//* MODULE: scsi.h 1.4 *//* DATE: 11:19:31 - 98/10/21 *//* PURPOSE: General SCSI command definitions *//* *//*---------------------------------------------------------------------*//* *//* Copyright 1991, 1992, Integrated Systems, Inc. *//* ALL RIGHTS RESERVED *//* *//* Permission is hereby granted to licensees of Integrated Systems, *//* Inc. products to use or abstract this computer program for the *//* sole purpose of implementing a product based on Integrated *//* Systems, Inc. products. No other rights to reproduce, use, *//* or disseminate this computer program, whether in part or in *//* whole, are granted. *//* *//* Integrated Systems, Inc. makes no representation or warranties *//* with respect to the performance of this computer program, and *//* specifically disclaims any responsibility for any damages, *//* special or consequential, connected with the use of this program. *//* *//***********************************************************************/#if defined(__cplusplus)extern "C" {#endif#ifndef _SCSI_H#define _SCSI_H/*---------------------------------------------------------------------*//* Must include bsp.h before this file To determine big/little endian *//*---------------------------------------------------------------------*/#ifndef _BSP_H #include "bsp.h"#endif/***********************************************************************//* HOST_ID This will be the target id of the host controler *//* (on board scsi controller) it is recommended that this be set *//* to 7 giving the host controller the highest priority on the bus *//***********************************************************************/#define HOST_ID 7 /* Controller ID *//***********************************************************************//* Values returned by scsi commands *//***********************************************************************/#define STAT_OK 0x0#define STAT_CHECKCOND 0x1 /* target wants to give some info */ #define STAT_ERR 0x2 /* SCSI error that may be retried */#define STAT_TIMEOUT 0x3 /* Target selection timed out */#define STAT_BUSY 0x4 /* target busy try again */#define STAT_SEMFAIL 0x5 /* semaphore call failed */ #define STAT_NOMEM 0x6 /* no memory available for request*/ #define STAT_RETRYEXC 0x7 /* Failed after alloted retries */ #define STAT_RESET 0x8 /* SCSI bus reset (should retry) */#define STAT_BADSIZE 0x9 /* Drive shows no blocks */#define STAT_NOMEDIA 0xA /* Removeable disk not in drive */#define STAT_BLANK 0xB /* end of recorded data */#define STAT_BAD_CMD 0xC /* Target reports Illegal Request */#define STAT_NO_SENSE 0xD /* request sense returned no sense*//***********************************************************************//* Structural definition of SCSI commands and data. *//***********************************************************************//***********************************************************************//* Test Unit Ready command -- All Devices *//***********************************************************************/#define TEST_UNIT_READY 0x00#define TEST_UNIT_READY_DLEN 4typedef struct test_unit_ready_c { unsigned char code; unsigned char lun:3, :5; unsigned char res[3]; unsigned char vu1:2, :4, flag:1, link:1; } TEST_UNIT_READY_STRUCT;/*---------------------------------------------------------------------*//* This command does not return any data, only status. *//* If unit is ready it will return GOOD status. If not the target *//* will return a check condition with an extended sense key of NOT *//* Ready. *//*---------------------------------------------------------------------*//***********************************************************************//* Read Capacity command -- DIRECT ACCESS DEVICES *//***********************************************************************/#define READ_CAPACITY 0x25#define READ_CAPACITY_DLEN 10typedef struct { unsigned char code; unsigned char lun:3, :4, reladr:1; /* address reletive to last */ /* command (must be linked cmd) */ unsigned char block[4]; /* start block to look for next */ /* delay block (must be 0 if pmi */ /* is 0 */ unsigned char res[2]; unsigned char :7, pmi:1; /* partial medium indicator */ unsigned char vu:2, :4, flag:1, link:1; } CAPACITY_STRUCT;typedef struct { /* Returned data structure */ unsigned long blocks; /* Number of blocks on device */ unsigned long bsize; /* Size of blocks */ } CAPACITY_RET_STRUCT;/***********************************************************************//* Read Block Limits command -- Sequential ACCESS DEVICES *//***********************************************************************/#define READ_BLOCK_LIMITS 0x05#define READ_BLOCK_LIMITS_DLEN 6typedef struct { unsigned char code; unsigned char lun:3, :5; unsigned char res[3]; unsigned char vu:2, :4, flag:1, link:1; } BLOCK_LIMITS_STRUCT;typedef struct { /* Returned data structure */ unsigned long max_block_limit; /* Max size of a block */ unsigned short min_block_length_limit; /* Min size of blocks */ } BLOCK_LIMITS_RET_STRUCT;/***********************************************************************//* read command *//***********************************************************************/#define READ 0x08#define READ_DLEN 6typedef struct { unsigned long code:8, /* Command number. */ lun:3, /* Logical unit number. */ block:21; /* block number. */ unsigned char blocks; /* Blocks to read. */ unsigned char vu:2, /* Vendor unique */ :4, flag:1, /* Flag command bit. */ link:1; /* Linked command bit. */ } READ_STRUCT;/***********************************************************************//* write command *//***********************************************************************/#define WRITE 0x0A#define WRITE_DLEN 6typedef struct { unsigned long code:8, /* Command number. */ lun:3, /* Logical unit number. */ block:21; /* block number. */ unsigned char blocks; /* Blocks to read. */ unsigned char vu:2, /* Vendor unique */ :4, flag:1, /* Flag command bit. */ link:1; /* Linked command bit. */ } WRITE_STRUCT;/***********************************************************************//* read/write extended command structure *//***********************************************************************/#define R_W_EXT_DLEN 10#define WRITE_EXT 0x2A#define READ_EXT 0x28typedef struct { /* extended read */ unsigned char code; /* Command number. */ unsigned char lun:3, /* logical Unit Number. */ :5; unsigned char block_b3; /* msb byte of block addr */ unsigned char block_b2; unsigned char block_b1; /* msb byte of block addr */ unsigned char block_b0; unsigned char res; /* reserved */ unsigned char blocks_msb; /* Blocks to write */ unsigned char blocks_lsb; unsigned char vu:2, /* Vendor unique. */ :4, flag:1, /* Flag command bit. */ link:1; /* Linked command bit. */ } RW_EXT_STRUCT;/***********************************************************************//* read/write sequential command structure *//***********************************************************************/#define R_W_SEQ_DLEN 6#ifdef MRItypedef packed struct#endif#ifdef GHS#pragma pack(1)typedef struct#endif#if _SDS#pragma maxalign(1)typedef struct#endif { /* sequential read/write */ unsigned char code:8; /* Command number. */ unsigned char lun:3, /* logical Unit Number. */ :3, sili:1, /* SILI */ fixed:1; /* Fixed */ unsigned long blocks:24, /* 24 bits of transfer length */ vu:2, /* Vendor unique. */ :4, flag:1, /* Flag command bit. */ link:1; /* Linked command bit. */ }RW_SEQ_STRUCT;#ifdef GHS#pragma pack()#endif#if _SDS#pragma maxalign()#endif/***********************************************************************//* Inquiry command -- COMMON FOR ALL DEVICES *//***********************************************************************/#define INQUIRY 0x12#define INQUIRY_DLEN 0x6typedef struct { unsigned char code; unsigned char lun:3, :5; unsigned char res[2]; unsigned char dlen; unsigned char vu:2, :4, flag:1, link:1; } INQUIRY_STRUCT;#if BSP_LITTLE_ENDIANtypedef struct { /* Common returned data header */ unsigned char device; /* Device type code. */ unsigned char qualifier:7, /* Device type qualifier. */ rmb:1; /* Removeable media. */ unsigned char ansivers:3, /* ANSI version. */ ecmavers:3, /* ECMA version. */ isiovers:2; /* ISO version. */ unsigned char format:4, /* Response format. */ :4; /* Reserved */ unsigned char length; /* Additional Data length. */ unsigned char :8; /* Reserved */ unsigned char :8; /* Reserved */ unsigned char stffre:1, /* support for soft reset alter */ cmdque:1, /* support for command queuing */ res:1, /* reserved */ linked:1, /* support for linked commands */ sync:1, /* support for synchronous trans */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -