1*53ee8cc1Swenshuai.xi //<MStar Software> 2*53ee8cc1Swenshuai.xi //****************************************************************************** 3*53ee8cc1Swenshuai.xi // MStar Software 4*53ee8cc1Swenshuai.xi // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved. 5*53ee8cc1Swenshuai.xi // All software, firmware and related documentation herein ("MStar Software") are 6*53ee8cc1Swenshuai.xi // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by 7*53ee8cc1Swenshuai.xi // law, including, but not limited to, copyright law and international treaties. 8*53ee8cc1Swenshuai.xi // Any use, modification, reproduction, retransmission, or republication of all 9*53ee8cc1Swenshuai.xi // or part of MStar Software is expressly prohibited, unless prior written 10*53ee8cc1Swenshuai.xi // permission has been granted by MStar. 11*53ee8cc1Swenshuai.xi // 12*53ee8cc1Swenshuai.xi // By accessing, browsing and/or using MStar Software, you acknowledge that you 13*53ee8cc1Swenshuai.xi // have read, understood, and agree, to be bound by below terms ("Terms") and to 14*53ee8cc1Swenshuai.xi // comply with all applicable laws and regulations: 15*53ee8cc1Swenshuai.xi // 16*53ee8cc1Swenshuai.xi // 1. MStar shall retain any and all right, ownership and interest to MStar 17*53ee8cc1Swenshuai.xi // Software and any modification/derivatives thereof. 18*53ee8cc1Swenshuai.xi // No right, ownership, or interest to MStar Software and any 19*53ee8cc1Swenshuai.xi // modification/derivatives thereof is transferred to you under Terms. 20*53ee8cc1Swenshuai.xi // 21*53ee8cc1Swenshuai.xi // 2. You understand that MStar Software might include, incorporate or be 22*53ee8cc1Swenshuai.xi // supplied together with third party`s software and the use of MStar 23*53ee8cc1Swenshuai.xi // Software may require additional licenses from third parties. 24*53ee8cc1Swenshuai.xi // Therefore, you hereby agree it is your sole responsibility to separately 25*53ee8cc1Swenshuai.xi // obtain any and all third party right and license necessary for your use of 26*53ee8cc1Swenshuai.xi // such third party`s software. 27*53ee8cc1Swenshuai.xi // 28*53ee8cc1Swenshuai.xi // 3. MStar Software and any modification/derivatives thereof shall be deemed as 29*53ee8cc1Swenshuai.xi // MStar`s confidential information and you agree to keep MStar`s 30*53ee8cc1Swenshuai.xi // confidential information in strictest confidence and not disclose to any 31*53ee8cc1Swenshuai.xi // third party. 32*53ee8cc1Swenshuai.xi // 33*53ee8cc1Swenshuai.xi // 4. MStar Software is provided on an "AS IS" basis without warranties of any 34*53ee8cc1Swenshuai.xi // kind. Any warranties are hereby expressly disclaimed by MStar, including 35*53ee8cc1Swenshuai.xi // without limitation, any warranties of merchantability, non-infringement of 36*53ee8cc1Swenshuai.xi // intellectual property rights, fitness for a particular purpose, error free 37*53ee8cc1Swenshuai.xi // and in conformity with any international standard. You agree to waive any 38*53ee8cc1Swenshuai.xi // claim against MStar for any loss, damage, cost or expense that you may 39*53ee8cc1Swenshuai.xi // incur related to your use of MStar Software. 40*53ee8cc1Swenshuai.xi // In no event shall MStar be liable for any direct, indirect, incidental or 41*53ee8cc1Swenshuai.xi // consequential damages, including without limitation, lost of profit or 42*53ee8cc1Swenshuai.xi // revenues, lost or damage of data, and unauthorized system use. 43*53ee8cc1Swenshuai.xi // You agree that this Section 4 shall still apply without being affected 44*53ee8cc1Swenshuai.xi // even if MStar Software has been modified by MStar in accordance with your 45*53ee8cc1Swenshuai.xi // request or instruction for your use, except otherwise agreed by both 46*53ee8cc1Swenshuai.xi // parties in writing. 47*53ee8cc1Swenshuai.xi // 48*53ee8cc1Swenshuai.xi // 5. If requested, MStar may from time to time provide technical supports or 49*53ee8cc1Swenshuai.xi // services in relation with MStar Software to you for your use of 50*53ee8cc1Swenshuai.xi // MStar Software in conjunction with your or your customer`s product 51*53ee8cc1Swenshuai.xi // ("Services"). 52*53ee8cc1Swenshuai.xi // You understand and agree that, except otherwise agreed by both parties in 53*53ee8cc1Swenshuai.xi // writing, Services are provided on an "AS IS" basis and the warranty 54*53ee8cc1Swenshuai.xi // disclaimer set forth in Section 4 above shall apply. 55*53ee8cc1Swenshuai.xi // 56*53ee8cc1Swenshuai.xi // 6. Nothing contained herein shall be construed as by implication, estoppels 57*53ee8cc1Swenshuai.xi // or otherwise: 58*53ee8cc1Swenshuai.xi // (a) conferring any license or right to use MStar name, trademark, service 59*53ee8cc1Swenshuai.xi // mark, symbol or any other identification; 60*53ee8cc1Swenshuai.xi // (b) obligating MStar or any of its affiliates to furnish any person, 61*53ee8cc1Swenshuai.xi // including without limitation, you and your customers, any assistance 62*53ee8cc1Swenshuai.xi // of any kind whatsoever, or any information; or 63*53ee8cc1Swenshuai.xi // (c) conferring any license or right under any intellectual property right. 64*53ee8cc1Swenshuai.xi // 65*53ee8cc1Swenshuai.xi // 7. These terms shall be governed by and construed in accordance with the laws 66*53ee8cc1Swenshuai.xi // of Taiwan, R.O.C., excluding its conflict of law rules. 67*53ee8cc1Swenshuai.xi // Any and all dispute arising out hereof or related hereto shall be finally 68*53ee8cc1Swenshuai.xi // settled by arbitration referred to the Chinese Arbitration Association, 69*53ee8cc1Swenshuai.xi // Taipei in accordance with the ROC Arbitration Law and the Arbitration 70*53ee8cc1Swenshuai.xi // Rules of the Association by three (3) arbitrators appointed in accordance 71*53ee8cc1Swenshuai.xi // with the said Rules. 72*53ee8cc1Swenshuai.xi // The place of arbitration shall be in Taipei, Taiwan and the language shall 73*53ee8cc1Swenshuai.xi // be English. 74*53ee8cc1Swenshuai.xi // The arbitration award shall be final and binding to both parties. 75*53ee8cc1Swenshuai.xi // 76*53ee8cc1Swenshuai.xi //****************************************************************************** 77*53ee8cc1Swenshuai.xi //<MStar Software> 78*53ee8cc1Swenshuai.xi /////////////////////////////////////////////////////////////////////////////// 79*53ee8cc1Swenshuai.xi // 80*53ee8cc1Swenshuai.xi // File name: drvScsi.h 81*53ee8cc1Swenshuai.xi // Version: 1.0 82*53ee8cc1Swenshuai.xi // Date: 2003/7/13 83*53ee8cc1Swenshuai.xi // Description: 84*53ee8cc1Swenshuai.xi // 85*53ee8cc1Swenshuai.xi // 86*53ee8cc1Swenshuai.xi // Author: 87*53ee8cc1Swenshuai.xi // Email: 88*53ee8cc1Swenshuai.xi // Phone: (03) 578-7888 89*53ee8cc1Swenshuai.xi // Company: Faraday Tech. Corp. 90*53ee8cc1Swenshuai.xi /////////////////////////////////////////////////////////////////////////////// 91*53ee8cc1Swenshuai.xi #ifndef SCSI_H 92*53ee8cc1Swenshuai.xi #define SCSI_H 93*53ee8cc1Swenshuai.xi 94*53ee8cc1Swenshuai.xi 95*53ee8cc1Swenshuai.xi 96*53ee8cc1Swenshuai.xi /* 97*53ee8cc1Swenshuai.xi * This header file contains public constants and structures used by 98*53ee8cc1Swenshuai.xi * the scsi code for linux. 99*53ee8cc1Swenshuai.xi */ 100*53ee8cc1Swenshuai.xi //=================== 1.Condition Definition ============================================================ 101*53ee8cc1Swenshuai.xi //======================================================================================================== 102*53ee8cc1Swenshuai.xi #define ScsiCmd_Fail_Retry 3 103*53ee8cc1Swenshuai.xi #define TestUnitReady_Fail_Retry 0x3 104*53ee8cc1Swenshuai.xi #define Scsi_Max_Transfer_Len 16384 //65536;;yuwen 105*53ee8cc1Swenshuai.xi #define SCSI_DbgPrint printf 106*53ee8cc1Swenshuai.xi //#define printk printf 107*53ee8cc1Swenshuai.xi //=================== 2.Define Data Type ================================================================ 108*53ee8cc1Swenshuai.xi //======================================================================================================== 109*53ee8cc1Swenshuai.xi 110*53ee8cc1Swenshuai.xi #ifndef BOOLEAN 111*53ee8cc1Swenshuai.xi #define BOOLEAN UINT8 112*53ee8cc1Swenshuai.xi #endif 113*53ee8cc1Swenshuai.xi #define INT32U UINT32 114*53ee8cc1Swenshuai.xi #define INT16U UINT16 115*53ee8cc1Swenshuai.xi #define INT8U UINT8 116*53ee8cc1Swenshuai.xi /* 117*53ee8cc1Swenshuai.xi * SCSI opcodes 118*53ee8cc1Swenshuai.xi */ 119*53ee8cc1Swenshuai.xi 120*53ee8cc1Swenshuai.xi #define TEST_UNIT_READY 0x00 121*53ee8cc1Swenshuai.xi #define REQUEST_SENSE 0x03 122*53ee8cc1Swenshuai.xi #define FORMAT_UNIT 0x04 //Option (unsupport) 123*53ee8cc1Swenshuai.xi #define INQUIRY 0x12 124*53ee8cc1Swenshuai.xi #define MODE_SELECT 0x15 //(unsupport) 125*53ee8cc1Swenshuai.xi #define RESERVE 0x16 //Option (unsupport) 126*53ee8cc1Swenshuai.xi #define RELEASE 0x17 //Option (unsupport) 127*53ee8cc1Swenshuai.xi #define MODE_SENSE 0x1a 128*53ee8cc1Swenshuai.xi #define MODE_SENSE_5A 0x5a 129*53ee8cc1Swenshuai.xi #define START_STOP 0x1b // (unsupport) 130*53ee8cc1Swenshuai.xi #define ALLOW_MEDIUM_REMOVAL 0x1e 131*53ee8cc1Swenshuai.xi #define READ_CAPACITY 0x25 132*53ee8cc1Swenshuai.xi #define READ_FORMAT_CAPACITY 0x23 133*53ee8cc1Swenshuai.xi #define READ_10 0x28 134*53ee8cc1Swenshuai.xi #define WRITE_10 0x2a 135*53ee8cc1Swenshuai.xi #define VERIFY 0x2f //(unsupport) 136*53ee8cc1Swenshuai.xi #define SYNCHRONIZE_CACHE 0x35 //Option (unsupport) 137*53ee8cc1Swenshuai.xi #define WRITE_BUFFER 0x3b //Option (unsupport) 138*53ee8cc1Swenshuai.xi #define PERSISTENT_RESERVE_IN 0x5e //Option (unsupport) 139*53ee8cc1Swenshuai.xi #define PERSISTENT_RESERVE_OUT 0x5f //Option (unsupport) 140*53ee8cc1Swenshuai.xi 141*53ee8cc1Swenshuai.xi #define SEND_DIAGNOSTIC 0x1d //(unsupport) 142*53ee8cc1Swenshuai.xi 143*53ee8cc1Swenshuai.xi #define TYPE_DISK 0x00 144*53ee8cc1Swenshuai.xi 145*53ee8cc1Swenshuai.xi /* 146*53ee8cc1Swenshuai.xi * FIXME(eric) - one of the great regrets that I have is that I failed to define 147*53ee8cc1Swenshuai.xi * these structure elements as something like sc_foo instead of foo. This would 148*53ee8cc1Swenshuai.xi * make it so much easier to grep through sources and so forth. I propose that 149*53ee8cc1Swenshuai.xi * all new elements that get added to these structures follow this convention. 150*53ee8cc1Swenshuai.xi * As time goes on and as people have the stomach for it, it should be possible to 151*53ee8cc1Swenshuai.xi * go back and retrofit at least some of the elements here with with the prefix. 152*53ee8cc1Swenshuai.xi */ 153*53ee8cc1Swenshuai.xi #define MAX_COMMAND_SIZE 16 154*53ee8cc1Swenshuai.xi #define SCSI_SENSE_BUFFERSIZE 64 155*53ee8cc1Swenshuai.xi 156*53ee8cc1Swenshuai.xi /* 157*53ee8cc1Swenshuai.xi * These are the values that the SCpnt->sc_data_direction and 158*53ee8cc1Swenshuai.xi * SRpnt->sr_data_direction can take. These need to be set 159*53ee8cc1Swenshuai.xi * The SCSI_DATA_UNKNOWN value is essentially the default. 160*53ee8cc1Swenshuai.xi * In the event that the command creator didn't bother to 161*53ee8cc1Swenshuai.xi * set a value, you will see SCSI_DATA_UNKNOWN. 162*53ee8cc1Swenshuai.xi */ 163*53ee8cc1Swenshuai.xi #define SCSI_DATA_UNKNOWN 0 164*53ee8cc1Swenshuai.xi #define SCSI_DATA_WRITE 1 165*53ee8cc1Swenshuai.xi #define SCSI_DATA_READ 2 166*53ee8cc1Swenshuai.xi #define SCSI_DATA_NONE 3 167*53ee8cc1Swenshuai.xi 168*53ee8cc1Swenshuai.xi /* 169*53ee8cc1Swenshuai.xi * SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft 170*53ee8cc1Swenshuai.xi * T10/1561-D Revision 4 Draft dated 7th November 2002. 171*53ee8cc1Swenshuai.xi */ 172*53ee8cc1Swenshuai.xi #define SAM_STAT_GOOD 0x00 173*53ee8cc1Swenshuai.xi #define SAM_STAT_CHECK_CONDITION 0x02 174*53ee8cc1Swenshuai.xi #define SAM_STAT_CONDITION_MET 0x04 175*53ee8cc1Swenshuai.xi #define SAM_STAT_BUSY 0x08 176*53ee8cc1Swenshuai.xi #define SAM_STAT_INTERMEDIATE 0x10 177*53ee8cc1Swenshuai.xi #define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14 178*53ee8cc1Swenshuai.xi #define SAM_STAT_RESERVATION_CONFLICT 0x18 179*53ee8cc1Swenshuai.xi #define SAM_STAT_COMMAND_TERMINATED 0x22 /* obsolete in SAM-3 */ 180*53ee8cc1Swenshuai.xi #define SAM_STAT_TASK_SET_FULL 0x28 181*53ee8cc1Swenshuai.xi #define SAM_STAT_ACA_ACTIVE 0x30 182*53ee8cc1Swenshuai.xi #define SAM_STAT_TASK_ABORTED 0x40 183*53ee8cc1Swenshuai.xi 184*53ee8cc1Swenshuai.xi 185*53ee8cc1Swenshuai.xi /* 186*53ee8cc1Swenshuai.xi * Overrides for Emacs so that we follow Linus's tabbing style. 187*53ee8cc1Swenshuai.xi * Emacs will notice this stuff at the end of the file and automatically 188*53ee8cc1Swenshuai.xi * adjust the settings for this buffer only. This must remain at the end 189*53ee8cc1Swenshuai.xi * of the file. 190*53ee8cc1Swenshuai.xi * --------------------------------------------------------------------------- 191*53ee8cc1Swenshuai.xi * Local variables: 192*53ee8cc1Swenshuai.xi * c-indent-level: 4 193*53ee8cc1Swenshuai.xi * c-brace-imaginary-offset: 0 194*53ee8cc1Swenshuai.xi * c-brace-offset: -4 195*53ee8cc1Swenshuai.xi * c-argdecl-indent: 4 196*53ee8cc1Swenshuai.xi * c-label-offset: -4 197*53ee8cc1Swenshuai.xi * c-continued-statement-offset: 4 198*53ee8cc1Swenshuai.xi * c-continued-brace-offset: 0 199*53ee8cc1Swenshuai.xi * indent-tabs-mode: nil 200*53ee8cc1Swenshuai.xi * tab-width: 8 201*53ee8cc1Swenshuai.xi * End: 202*53ee8cc1Swenshuai.xi */ 203*53ee8cc1Swenshuai.xi #define CBW_TAG 0x01020304 // temp 204*53ee8cc1Swenshuai.xi 205*53ee8cc1Swenshuai.xi #define CBW_SIGNATE 0x43425355 206*53ee8cc1Swenshuai.xi #define CSW_SIGNATE 0x53425355 207*53ee8cc1Swenshuai.xi #define CSW_STATUS_CMD_PASS 0x00 208*53ee8cc1Swenshuai.xi #define CSW_STATUS_CMD_FAIL 0x01 209*53ee8cc1Swenshuai.xi #define CSW_STATUS_PHASE_ERROR 0x02 210*53ee8cc1Swenshuai.xi 211*53ee8cc1Swenshuai.xi #define CBW_FLAG_IN 0x80 212*53ee8cc1Swenshuai.xi #define CBW_FLAG_OUT 0x00 213*53ee8cc1Swenshuai.xi 214*53ee8cc1Swenshuai.xi #define CB_LENGTH_TEST_UNIT_READY 0x06 215*53ee8cc1Swenshuai.xi #define CB_LENGTH_REQUEST_SENSE 0x0C 216*53ee8cc1Swenshuai.xi #define CB_LENGTH_INQUIRY 0x06 217*53ee8cc1Swenshuai.xi #define CB_LENGTH_MODE_SENSE 0x06 218*53ee8cc1Swenshuai.xi #define CB_LENGTH_MODE_SENSE_OperCode5A 0x0B 219*53ee8cc1Swenshuai.xi //#define CB_LENGTH_ALLOW_MEDIUM_REMOVAL 0x1e 220*53ee8cc1Swenshuai.xi #define CB_LENGTH_READ_CAPACITY 0x0A 221*53ee8cc1Swenshuai.xi #define CB_LENGTH_READ_10 0x0A 222*53ee8cc1Swenshuai.xi #define CB_LENGTH_WRITE_10 0x0A 223*53ee8cc1Swenshuai.xi 224*53ee8cc1Swenshuai.xi 225*53ee8cc1Swenshuai.xi 226*53ee8cc1Swenshuai.xi #define DATA_LENGTH_INQUIRY 36 227*53ee8cc1Swenshuai.xi #define DATA_LENGTH_MODE_SENSE 32 //192 , yuwen 228*53ee8cc1Swenshuai.xi #define DATA_LENGTH_MODE_SENSE_OperCode5A 32 229*53ee8cc1Swenshuai.xi #define DATA_LENGTH_REQUEST_SENSE 18 230*53ee8cc1Swenshuai.xi #define DATA_LENGTH_READ_CAPACITY 8 231*53ee8cc1Swenshuai.xi 232*53ee8cc1Swenshuai.xi 233*53ee8cc1Swenshuai.xi 234*53ee8cc1Swenshuai.xi 235*53ee8cc1Swenshuai.xi 236*53ee8cc1Swenshuai.xi 237*53ee8cc1Swenshuai.xi //=================== 3.Structure Definition ============================================================= 238*53ee8cc1Swenshuai.xi //======================================================================================================== 239*53ee8cc1Swenshuai.xi 240*53ee8cc1Swenshuai.xi 241*53ee8cc1Swenshuai.xi //typedef struct CommandBlockWrapper 242*53ee8cc1Swenshuai.xi //{ 243*53ee8cc1Swenshuai.xi // UINT32 u32Signature; 244*53ee8cc1Swenshuai.xi // INT32U u32Tag; 245*53ee8cc1Swenshuai.xi // INT32U u32DataTransferLength; 246*53ee8cc1Swenshuai.xi // INT8U u8Flags; 247*53ee8cc1Swenshuai.xi // INT8U u8LUN; 248*53ee8cc1Swenshuai.xi // INT8U u8CBLength; 249*53ee8cc1Swenshuai.xi // INT8U u8CB[16]; 250*53ee8cc1Swenshuai.xi //} CBW; 251*53ee8cc1Swenshuai.xi 252*53ee8cc1Swenshuai.xi //typedef struct CommandStatusWrapper 253*53ee8cc1Swenshuai.xi //{ 254*53ee8cc1Swenshuai.xi // INT32U u32Signature; 255*53ee8cc1Swenshuai.xi // INT32U u32Tag; 256*53ee8cc1Swenshuai.xi // INT32U u32DataResidue; 257*53ee8cc1Swenshuai.xi // INT8U u8Status; 258*53ee8cc1Swenshuai.xi //} CSW; 259*53ee8cc1Swenshuai.xi 260*53ee8cc1Swenshuai.xi typedef enum 261*53ee8cc1Swenshuai.xi { 262*53ee8cc1Swenshuai.xi SCSI_OPSTATE_TEST_UNIT_READY = 0, 263*53ee8cc1Swenshuai.xi SCSI_OPSTATE_REQUEST_SENSE, 264*53ee8cc1Swenshuai.xi SCSI_OPSTATE_INQUIRY, 265*53ee8cc1Swenshuai.xi SCSI_OPSTATE_MODE_SELECT, 266*53ee8cc1Swenshuai.xi SCSI_OPSTATE_MODE_SENSE, 267*53ee8cc1Swenshuai.xi SCSI_OPSTATE_ALLOW_MEDIUM_REMOVAL, 268*53ee8cc1Swenshuai.xi SCSI_OPSTATE_READ_CAPACITY, 269*53ee8cc1Swenshuai.xi SCSI_OPSTATE_READ_10, 270*53ee8cc1Swenshuai.xi SCSI_OPSTATE_WRITE_10 271*53ee8cc1Swenshuai.xi } ScsiOpState; 272*53ee8cc1Swenshuai.xi 273*53ee8cc1Swenshuai.xi 274*53ee8cc1Swenshuai.xi typedef struct ScsiDevice 275*53ee8cc1Swenshuai.xi { 276*53ee8cc1Swenshuai.xi // Get by INQUIRY command 277*53ee8cc1Swenshuai.xi UINT8 u8DeviceType; 278*53ee8cc1Swenshuai.xi //UINT8 u8VendorID[8]; //Colin, moved to LUN device 279*53ee8cc1Swenshuai.xi //UINT8 u8ProductID[16]; 280*53ee8cc1Swenshuai.xi //UINT8 u8ProductVer[4]; 281*53ee8cc1Swenshuai.xi } Scsi_Device; 282*53ee8cc1Swenshuai.xi 283*53ee8cc1Swenshuai.xi // extern Scsi_Device tScsi_Device; 284*53ee8cc1Swenshuai.xi #define BUFFER_LOGI 0 285*53ee8cc1Swenshuai.xi #define BUFFER_PHY 1 286*53ee8cc1Swenshuai.xi struct scsi_cmnd 287*53ee8cc1Swenshuai.xi { 288*53ee8cc1Swenshuai.xi 289*53ee8cc1Swenshuai.xi unsigned char lun; //no use?? 290*53ee8cc1Swenshuai.xi // unsigned int channel; //no use 291*53ee8cc1Swenshuai.xi unsigned char cmd_len; 292*53ee8cc1Swenshuai.xi // unsigned char old_cmd_len; //no use 293*53ee8cc1Swenshuai.xi unsigned char sc_data_direction; 294*53ee8cc1Swenshuai.xi // unsigned char sc_old_data_direction; //no use 295*53ee8cc1Swenshuai.xi 296*53ee8cc1Swenshuai.xi /* These elements define the operation we are about to perform */ 297*53ee8cc1Swenshuai.xi // unsigned char cmnd[MAX_COMMAND_SIZE]; 298*53ee8cc1Swenshuai.xi U32 request_bufflen; /* Actual request size */ 299*53ee8cc1Swenshuai.xi 300*53ee8cc1Swenshuai.xi U32 request_buffer; /* Actual requested buffer */ 301*53ee8cc1Swenshuai.xi 302*53ee8cc1Swenshuai.xi U8 result; /* Status code from lower level driver */ 303*53ee8cc1Swenshuai.xi 304*53ee8cc1Swenshuai.xi unsigned char tag; /* SCSI-II queued command tag */ 305*53ee8cc1Swenshuai.xi // unsigned long pid; /* Process ID, starts at 0 */ 306*53ee8cc1Swenshuai.xi }; 307*53ee8cc1Swenshuai.xi 308*53ee8cc1Swenshuai.xi typedef struct scsi_cmnd Scsi_Cmnd; 309*53ee8cc1Swenshuai.xi 310*53ee8cc1Swenshuai.xi 311*53ee8cc1Swenshuai.xi 312*53ee8cc1Swenshuai.xi 313*53ee8cc1Swenshuai.xi struct LUN_Device 314*53ee8cc1Swenshuai.xi { 315*53ee8cc1Swenshuai.xi UINT8 u8LunNum; 316*53ee8cc1Swenshuai.xi /* file system : YPING add */ 317*53ee8cc1Swenshuai.xi // FAT_FileSysStruct FileSys; 318*53ee8cc1Swenshuai.xi 319*53ee8cc1Swenshuai.xi // Get by READ CAPACITY command 320*53ee8cc1Swenshuai.xi UINT32 u32BlockSize; 321*53ee8cc1Swenshuai.xi UINT32 u32BlockTotalNum; 322*53ee8cc1Swenshuai.xi 323*53ee8cc1Swenshuai.xi // Get by TEST UNIT READY command 324*53ee8cc1Swenshuai.xi UINT8 bDeviceReady; 325*53ee8cc1Swenshuai.xi UINT8 bDeviceValid; 326*53ee8cc1Swenshuai.xi // Save Write Protection information 327*53ee8cc1Swenshuai.xi UINT8 bWriteProtect; 328*53ee8cc1Swenshuai.xi UINT8 bRMB; 329*53ee8cc1Swenshuai.xi 330*53ee8cc1Swenshuai.xi UINT8 u8VendorID[8]; 331*53ee8cc1Swenshuai.xi UINT8 u8ProductID[16]; 332*53ee8cc1Swenshuai.xi UINT8 u8ProductVer[4]; 333*53ee8cc1Swenshuai.xi }; 334*53ee8cc1Swenshuai.xi 335*53ee8cc1Swenshuai.xi 336*53ee8cc1Swenshuai.xi struct us_data { 337*53ee8cc1Swenshuai.xi 338*53ee8cc1Swenshuai.xi Scsi_Cmnd *srb; /* current srb */ 339*53ee8cc1Swenshuai.xi Scsi_Device device; 340*53ee8cc1Swenshuai.xi UINT8 max_lun; 341*53ee8cc1Swenshuai.xi // For one Device but have many LUN 342*53ee8cc1Swenshuai.xi BOOLEAN bFileSystemInit; 343*53ee8cc1Swenshuai.xi struct LUN_Device* Mass_stor_device; 344*53ee8cc1Swenshuai.xi 345*53ee8cc1Swenshuai.xi 346*53ee8cc1Swenshuai.xi 347*53ee8cc1Swenshuai.xi }; 348*53ee8cc1Swenshuai.xi 349*53ee8cc1Swenshuai.xi 350*53ee8cc1Swenshuai.xi 351*53ee8cc1Swenshuai.xi //=================== 4.Extern Function Definition ======================================================= 352*53ee8cc1Swenshuai.xi //======================================================================================================== 353*53ee8cc1Swenshuai.xi 354*53ee8cc1Swenshuai.xi //extern void vSCSI_REQUEST_SENSE(void); 355*53ee8cc1Swenshuai.xi extern BOOLEAN vSCSI_REQUEST_SENSE(U8); 356*53ee8cc1Swenshuai.xi extern BOOLEAN bSCSI_INQUIRY(U8); 357*53ee8cc1Swenshuai.xi extern BOOLEAN bSCSI_READ_CAPACITY(U8); 358*53ee8cc1Swenshuai.xi extern BOOLEAN bSCSI_TEST_UNIT_READY(U8); 359*53ee8cc1Swenshuai.xi 360*53ee8cc1Swenshuai.xi extern BOOLEAN bInit_USB_LUN(U8); 361*53ee8cc1Swenshuai.xi 362*53ee8cc1Swenshuai.xi 363*53ee8cc1Swenshuai.xi extern BOOLEAN bSCSI_Initial(void); 364*53ee8cc1Swenshuai.xi 365*53ee8cc1Swenshuai.xi extern BOOLEAN bSCSI_ERASE( struct LUN_Device* LunDevice, UINT32 u32BlockAddr, UINT32 u32BlockNum, 366*53ee8cc1Swenshuai.xi UINT32 u32SectorSize); 367*53ee8cc1Swenshuai.xi //extern BOOLEAN bSCSI_Read_10(U8 lun, UINT32 u32BlockAddr, UINT32 u32BlockNum,UINT32 u8Buffer); 368*53ee8cc1Swenshuai.xi //extern BOOLEAN bSCSI_Write_10(U8 lun, UINT32 u32BlockAddr, UINT32 u32BlockNum, UINT32 u8Buffer); 369*53ee8cc1Swenshuai.xi extern BOOLEAN bSCSI_Read_Write10(BOOLEAN DoWrite, U8 lun, INT32U u32BlockAddr, INT32U u32BlockNum,U32 u8Buffer); 370*53ee8cc1Swenshuai.xi extern BOOLEAN vSCSI_EJECT_DEVICE(U8 lun); 371*53ee8cc1Swenshuai.xi 372*53ee8cc1Swenshuai.xi extern BOOLEAN bSCSI_MODE_SENSE(U8); 373*53ee8cc1Swenshuai.xi extern BOOLEAN bSCSI_MODE_SENSE_OperCode5A(U8); 374*53ee8cc1Swenshuai.xi //=================== 5.Extern Variable Definition ======================================================= 375*53ee8cc1Swenshuai.xi //======================================================================================================== 376*53ee8cc1Swenshuai.xi extern struct us_data Mass_stor_us1; 377*53ee8cc1Swenshuai.xi 378*53ee8cc1Swenshuai.xi //extern struct us_data *Mass_stor_us; 379*53ee8cc1Swenshuai.xi extern struct us_data us_data_Signal; 380*53ee8cc1Swenshuai.xi extern struct LUN_Device Mass_stor_device_1; 381*53ee8cc1Swenshuai.xi //extern INT8U u8Drive; 382*53ee8cc1Swenshuai.xi 383*53ee8cc1Swenshuai.xi 384*53ee8cc1Swenshuai.xi 385*53ee8cc1Swenshuai.xi 386*53ee8cc1Swenshuai.xi 387*53ee8cc1Swenshuai.xi 388*53ee8cc1Swenshuai.xi #endif 389*53ee8cc1Swenshuai.xi 390