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


/**************************************************************** 
 NAME: usbmain.c 
 DESC: endpoint interrupt handler 
       USB init jobs 
 HISTORY: 
 Mar.25.2002:purnnamu: ported for S3C2410X. 
 Mar.27.2002:purnnamu: DMA is enabled. 
 ****************************************************************/ 
#include  
#include  
#include "option.h" 
#include "2410addr.h" 
#include "2410lib.h" 
#include "def.h" 
 
#include "2410usb.h" 
#include "usbmain.h" 
#include "usblib.h" 
#include "usbsetup.h" 
#include "usbout.h" 
#include "usbin.h" 
 
/************************** 
    Some PrepareEp1Fifo() should be deleted 
 **************************/    
void UsbdMain(void) 
{ 
    //ChangeUPllValue(0x48,0x3,0x2);  //UCLK=48Mhz      
    ChangeUPllValue(40,1,2);  //UCLK=48Mhz      
    InitDescriptorTable(); 
    //ResetUsbd(); 
     
    ConfigUsbd();  
 
    //DetectVbus(); //not used in S3C2400X 
#ifdef _FOR_UDISK_ 
	if(USBD_flg==0) 
		PrepareEp1Fifo();  
#else 
	PrepareEp1Fifo();  
#endif    
} 
 
void __irq IsrUsbd(void) 
{ 
    U8 usbdIntpnd,epIntpnd; 
    U8 saveIndexReg=rINDEX_REG;	//PUSH rINDEX_REG 
    usbdIntpnd=rUSB_INT_REG;	//0x52000158(L) 
    epIntpnd=rEP_INT_REG;		//0x52000148(L) 
   // Uart_Printf( "[INT:EP_I=%x,USBI=%x]\n",epIntpnd,usbdIntpnd ); 
 
    if(usbdIntpnd&SUSPEND_INT)	//#define SUSPEND_INT=0x01   
    { 
    	rUSB_INT_REG=SUSPEND_INT;//Clear Suspend INT,write "0x01" 
    	//DbgPrintf( "