www.pudn.com > arm_uDisk.rar > USBIN.C


/**************************************************************** 
 NAME: usbin.c 
 DESC: usb bulk-IN operation 
 HISTORY: 
 Mar.25.2002:purnnamu: ported for S3C2410X. 
 ****************************************************************/ 
#include  
#include "option.h" 
#include "2410addr.h" 
#include "2410lib.h" 
#include "def.h" 
 
#include "2410usb.h" 
#include "usbmain.h" 
#include "usb.h" 
#include "usblib.h" 
#include "usbsetup.h" 
#include "usbin.h" 
 
 
 
//static void PrintEpiPkt(U8 *pt,int cnt); 
 
 
// =================================================================== 
// All following commands will operate in case  
// - in_csr1 is valid. 
// =================================================================== 
 
#define SET_EP1_IN_PKT_READY()  rIN_CSR1_REG= ( in_csr1 &(~ EPI_WR_BITS)\ 
					| EPI_IN_PKT_READY ) //IN_CSR1_REG=0x01 
#define SET_EP1_SEND_STALL()	rIN_CSR1_REG= ( in_csr1 & (~EPI_WR_BITS)\ 
					| EPI_SEND_STALL) ) 
#define CLR_EP1_SENT_STALL()	rIN_CSR1_REG= ( in_csr1 & (~EPI_WR_BITS)\ 
					&(~EPI_SENT_STALL) ) 
#define FLUSH_EP1_FIFO() 	rIN_CSR1_REG= ( in_csr1 & (~EPI_WR_BITS)\ 
					| EPI_FIFO_FLUSH) ) 
 
 
// *************************** 
// *** VERY IMPORTANT NOTE *** 
// *************************** 
// Prepare the code for the packit size constraint!!! 
 
// EP1 = IN end point.  
 
U8 ep1Buf[EP1_PKT_SIZE]; 
int transferIndex=0; 
 
#ifdef _FOR_UDISK_ 
extern U8 CBW_flg; 
void PrepareEp1Fifo_1(U8 * buffer,U8 len)  
{ 
	U8 length=len; 
    	U8 in_csr1 = 0; 
    	rINDEX_REG=1; 
 
   	if(length>EP1_PKT_SIZE)  
   		length = EP1_PKT_SIZE; 
     	WrPktEp1(buffer,length); 
 
	if(length