예제 #1
0
static void udc_int_hndlr(int irq, void *dev_id, struct pt_regs *regs)
{
	__u32 status = Ser0UDCSR;
	
	if (start_time==0) {
		start_time = jiffies;
	}
	
	//PRINTKD("[%lu]Status %d Mask %d\n", (jiffies-start_time)*10, status, Ser0UDCCR);

	UDC_flip(Ser0UDCSR, status); // clear all pending sources
	
	/* ReSeT Interrupt Request - UDC has been reset */
	if (status & UDCSR_RSTIR)
	{
		Ser0UDCCR = 0xFC;
		
		if (second_reset) {
			UDC_write(Ser0UDCCR, UDCCR_TIM);
			//UDC_write(Ser0UDCCR, UDCCR_TIM | UDCCR_REM); // Errata 29
		}
		else {
			Ser0UDCCR = UDCCR_TIM;
			//Ser0UDCCR = UDCCR_TIM | UDCCR_REM; // Errata 29
		}
		
		if (Ser0UDCCR & UDCCR_TIM || second_reset==1) {
			/* starting 20ms or so reset sequence now... */
			ep0_reset();  // just set state to idle
			ep1_reset();  // flush dma, clear false stall
			ep2_reset();  // flush dma, clear false stall
		}
		second_reset = 1;
		//UDC_flip(Ser0UDCSR, status); // clear all pending sources
		PRINTKI("[%lu]Reset: Mask %d\n", (jiffies-start_time)*10, Ser0UDCCR);		
		return;
	}
	
	second_reset = 0;
	
	// /* RESume Interrupt Request ojo eliminar?*/
	if ( status & UDCSR_RESIR )
	{
		core_kicker();
		Ser0UDCCR = 0xFC;
		Ser0UDCCR = UDCCR_TIM | UDCCR_RESIM;
		
		//UDC_flip(Ser0UDCSR, status); // clear all pending sources
		PRINTKD("[%lu]Resume: Mask %d\n", (jiffies-start_time)*10, Ser0UDCCR);
		
		return;
	}

	/* SUSpend Interrupt Request */
	if ( status & UDCSR_SUSIR )
	{
		Ser0UDCCR = 0xFC;
		// Does not seems to help either to be necessary
		// if (tr==2) {
			// core_kicker();
		// }
		
		UDC_write(Ser0UDCCR, UDCCR_TIM | UDCCR_SUSIM); 
		//UDC_write(Ser0UDCCR, UDCCR_TIM | UDCCR_SUSIM | UDCCR_REM); // Errata 29
		//UDC_flip(Ser0UDCSR, status); // clear all pending sources
		PRINTKI("[%lu]Suspended: Mask %d\n", (jiffies-start_time)*10, Ser0UDCCR);
		return;
	}	
	
	//UDC_flip(Ser0UDCSR, status); // clear all pending sources
		
	if (status & UDCSR_RIR)
		ep1_int_hndlr();

	if (status & UDCSR_TIR)
		ep2_int_hndlr();
	
	if (status & UDCSR_EIR)
		ep0_int_hndlr();
}
예제 #2
0
파일: usb_ctl.c 프로젝트: hugh712/Jollen
static void
udc_int_hndlr(int irq, void *dev_id, struct pt_regs *regs)
{
  	__u8 saveIdx = UD_INDEX;
    	__u8 usb_status = UD_USBINT;
  	__u8 usbd_status = UD_INT;
	static int sb_debug_cnt = 1;	

	LOG("usb_status = 0x%02x, usbd_status = 0x%02x\n",
			usb_status, usbd_status);

	if ( usb_status & UD_USBINT_RESET ) {

	    LOG("\n[%d]RESET interrupt\n",sb_debug_cnt++);
	    if( usbctl_next_state_on_event(kEvReset) != kError ) {
		LOG("%s Resetting\n",pszMe);

		ep0_reset();
		ep1_reset();/* output */
		ep2_reset();/* input */

	    }

	   // reset_usbd();
	    reconfig_usbd();
	    UD_USBINT = UD_USBINT_RESET; //RESET_INT should be cleared after reconfig_usbd().- by samsung src
	    ep0_state = EP0_STATE_IDLE;

	}


	/* RESume Interrupt Request */
	if ( usb_status & UD_USBINT_RESUM ) {
 		LOG("[%d]RESUME interrupt\n", sb_debug_cnt++);
		UD_USBINT = UD_USBINT_RESUM;/* clear */
		usbctl_next_state_on_event( kEvResume );

	}


	/* SUSpend Interrupt Request */
	if ( usb_status & UD_USBINT_SUSPND ) { 
		LOG("[%d]SUSPEND interrupt\n", sb_debug_cnt++);
		UD_USBINT = UD_USBINT_SUSPND; /* clear */
		usbctl_next_state_on_event( kEvSuspend );

	}

	if ( usbd_status & UD_INT_EP0 ) {
		LOG("\n[%d]EP0 interrupt\n",sb_debug_cnt++);
		UD_INT = UD_INT_EP0; /* clear */
		ep0_int_hndlr();

	}

         /* output */
	if ( usbd_status & UD_INT_EP1 ) { 
		LOG("[%d]EP1 interrupt\n", sb_debug_cnt++);
		UD_INT = UD_INT_EP1;/* clear */
		ep1_int_hndlr(usbd_status);

	}
        /* input */
	if ( usbd_status & UD_INT_EP2 ) {
		LOG("[%d]EP2 interrupt\n", sb_debug_cnt++); 
		UD_INT = UD_INT_EP2; /* clear */
		ep2_int_hndlr(usbd_status);
		
	}

	if(usbd_status & UD_INT_EP3) UD_INT = UD_INT_EP3;
	if(usbd_status & UD_INT_EP4) UD_INT = UD_INT_EP4;
	
  	Clear_pending(INT_USBD);
	UD_INDEX= saveIdx;
	
}