ubi9021的51驱动程序

源代码在线查看: usbmass.h

软件大小: 104 K
上传用户: fy8855773
关键词: 9021 ubi 驱动程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				#ifndef NULL
				#define NULL 					((void*)0)
				#endif
				
				
				#define		UMO_READ_USB1_PACKET_UNIT	1		//1=if device is USB1.1 read in packet unit
				
				/******************************************************************************
				 *	SCSI Commands
				 ******************************************************************************/
				
				#define  SCSI_CMD_FORMATUNIT		0x04
				#define  SCSI_CMD_INQUIRY			0x12
				#define  SCSI_CMD_STARTSTOP			0x1B
				#define  SCSI_CMD_MODESELECT6		0x15	//subClass=6(SCSI-2)
				#define  SCSI_CMD_MODESELECT10		0x55	//subClass!=6
				#define  SCSI_CMD_MODESENSE6		0x1A	//subClass=6(SCSI-2)
				#define  SCSI_CMD_MODESENSE10		0x5A	//subClass!=6
				#define  SCSI_CMD_PREVENTALLOW		0x1e
				#define  SCSI_CMD_READ10			0x28
				#define  SCSI_CMD_READCAPACITY		0x25
				#define  SCSI_CMD_READFORMATCAP		0x23
				#define  SCSI_CMD_REQUESTSENSE		0x03
				#define  SCSI_CMD_REZEROUNITPOS		0x01
				#define  SCSI_CMD_SEEK10			0x2B
				#define  SCSI_CMD_SENDDIAGNOSTIC	0x1D
				#define  SCSI_CMD_TESTUNITREADY		0x00
				#define  SCSI_CMD_VERIFY			0x2F
				#define  SCSI_CMD_WRITE10			0x2A
				#define  SCSI_CMD_WRITENVERIFY		0x2E
				#define  SCSI_CMD_TO_STALL_EPIN		0xFF	//not a SCSI command!!
				
				
					
				/******************************************************************************
				 *	SCSI Command Byte Wrapper
				 ******************************************************************************/
				
				#define	READ_FLAG	((U16)0x8000)	//for "SCSI_StartReadWrite(,,*)"
				#define	WRITE_FLAG	((U16)0)		//for "SCSI_StartReadWrite(,,*)"
				
				
				#define  SET_CBW_SIZE(dwSz)			(gCBW[8]=(U8)(dwSz),gCBW[9]=(U8)((dwSz)>>8),\
													 gCBW[10]=(U8)((dwSz)>>16),gCBW[11]=(U8)((dwSz)>>24))
				#define  SET_CBW_BULKIN()			(gCBW[12]=(U8)0x80)
				#define  SET_CBW_BULKOUT()			(gCBW[12]=(U8)0x00)
				#define  SET_CBW_LUN(bLun)		(gCBW[13]=bLun )
				#define  SET_CBW_LENGTH(bLn)		(gCBW[14]=(U8)bLn)
				#define  SET_CBW_CMD(bCmd)			(gCBW[15]=(U8)(bCmd))
				#define  SET_CBW_PAGEADDR(dwPA)		(gCBW[17]=(U8)((dwPA)>>24),\
													 gCBW[18]=(U8)((dwPA)>>16),\
													 gCBW[19]=(U8)((dwPA)>>8),\
													 gCBW[20]=(U8)(dwPA))
				#define  SET_CBW_PAGECNT(wPN)		(gCBW[22]=(U8)((wPN)>>8),gCBW[23]=(U8)(wPN))
				
					
					
					#define	SCSI_Inquiry(pBuf)				SCSI_CMD(SCSI_CMD_INQUIRY,pBuf)
					#define	SCSI_ReadFormatCapacity(pBuf)	SCSI_CMD(SCSI_CMD_READFORMATCAP,pBuf)
					#define	SCSI_ModeSense(bPgCode,pBuf)	SCSI_CMD(SCSI_CMD_MODESENSE6,pBuf)
					#define	SCSI_PreventAllow(fPrev)		SCSI_CMD(SCSI_CMD_PREVENTALLOW,(U8*)fPrev)
				//	#define	SCSI_RequestSense(pBuf)			SCSI_CMD(SCSI_CMD_REQUESTSENSE,pBuf)
					#define	SCSI_ReadCapacity(pBuf)			SCSI_CMD(SCSI_CMD_READCAPACITY,pBuf)
					#define	SCSI_TestUnit()					SCSI_CMD(SCSI_CMD_TESTUNITREADY,NULL)
				
				#define	DEV_WriteRegMultiWithZero(reg,cnt)	DEV_WriteRegMulti(reg,cnt,TxNULL)
				#define	DEV_ReadRegMultiAndDiscard(reg,cnt)	DEV_ReadRegMulti(reg,cnt,TxNULL)
					
				
				
					U8	UM_InitMultiLun(U8* tBUF);
					U8 SCSI_GetDataIn(U16 totBytCnt, U8* buf);
					U8 SCSI_SafeCSW(void);
					U8 SCSI_RequestSense(void);
					int USB_boot_setup();
					int UBI9021_read_sector_lba(short *buf, int stSec, int secCnt);
					U8		DEV_WaitForIrqV(U8 bIRQ);			

相关资源