⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oemintr.c

📁 深圳市微逻辑电子有限公司 巨果&#8226 Kingmos&reg 系统核心
💻 C
📖 第 1 页 / 共 3 页
字号:
				s2410INT->rINTPND = BIT_EINT8_23;

			RETAILMSG(0, (TEXT("INT:???\r\n")));
			return SYSINTR_NOP;
		}					
	}
/*
	else if (IntPendVal == INTSRC_ADC) // INTSRC_ADC
	{
        // Touch Panel Int
    	SubIntPendVal = s2410INT->rSUBSRCPND;
       	
    	if(SubIntPendVal & INTSUB_TC) 
		{
       		s2410INT->rINTSUBMSK |= INTSUB_TC;
       		s2410INT->rSUBSRCPND  = INTSUB_TC;
       	
            s2410INT->rINTMSK |= BIT_ADC;
   	        s2410INT->rSRCPND  = BIT_ADC;        
       	    if (s2410INT->rINTPND & BIT_ADC) 
       	    	s2410INT->rINTPND = BIT_ADC;
           
			if( (s2410ADC->rADCDAT0 & 0x8000) || (s2410ADC->rADCDAT1 & 0x8000) ){
				s2410INT->rINTMSK |= BIT_TIMER1;     // Mask timer1 interrupt.
		   		s2410INT->rSRCPND = BIT_TIMER1;     // Clear pending bit
   				if (s2410INT->rINTPND & BIT_TIMER1) 
   					s2410INT->rINTPND = BIT_TIMER1;
				//RETAILMSG(0,(TEXT("INT Touch pen up \r\n")));

      	        odo_tsb->status = TOUCH_PEN_UP;
      		}
			else {
				//RETAILMSG(0,(TEXT("INT Touch pen down \r\n")));
   	            odo_tsb->status = TOUCH_PEN_DOWN;
			}
       
	        return SYSINTR_TOUCH_CHANGED;
		}
       	else if(SubIntPendVal & INTSUB_ADC)
		{
       		s2410INT->rINTSUBMSK |= INTSUB_ADC;
       		s2410INT->rSUBSRCPND = INTSUB_ADC;

	        s2410INT->rINTMSK |= BIT_ADC;
   		    s2410INT->rSRCPND = BIT_ADC;        
       		if (s2410INT->rINTPND & BIT_ADC) 
       			s2410INT->rINTPND = BIT_ADC;
            	
        	s2410INT->rINTMSK &= ~BIT_ADC;

           	return SYSINTR_NOP;
       	}
       	else
       		return SYSINTR_NOP;
	}
*/
	else if (IntPendVal == INTSRC_TIMER1) // INTSRC_TIMER1
	{ /*
   	 if( bTouchSample )
  	  {
   		tickCount++;
   		if( tch->status = 0 )
   		{   //idle statue
   			#define TOUCH_IDLE_TICK ( 500 / RESCHED_PERIOD )	// 500ms
   			if( tickCount >= TOUCH_IDLE_TICK )
   			{   
 	  	    	tickCount = 0;
		       	return SYSINTR_TOUCH_CHANGED;
   			}
   		}
   		else
   		{	//down pen statue
   			#define TOUCH_DOWN_TICK ( 20 / RESCHED_PERIOD )	// 20ms
   			if( tickCount >= 5 )
   			{   // 50ms
 	  	    	tickCount = 0;
		       	return SYSINTR_TOUCH_CHANGED;
   			}
   		}
    	}		
	*/
   
		s2410INT->rINTMSK |= BIT_TIMER1;
    	s2410INT->rSRCPND = BIT_TIMER1;
	    if (s2410INT->rINTPND & BIT_TIMER1) 
    	   s2410INT->rINTPND = BIT_TIMER1;
		return SYSINTR_TOUCH_CHANGED;
		
/*		
       // Timer 1 interrupt to get touch point
      	s2410INT->rINTMSK |= BIT_TIMER1;
       	s2410INT->rSRCPND = BIT_TIMER1;
  	    if (s2410INT->rINTPND & BIT_TIMER1) 
  	    	s2410INT->rINTPND = BIT_TIMER1;

		// charlie, 020620
		if( (s2410ADC->rADCDAT0 & 0x8000) || (s2410ADC->rADCDAT1 & 0x8000) ){
			//RETAILMSG(0,(TEXT("INT Touch SYSINTR_TOUCH_CHANGED 1\r\n")));
			odo_tsb->status = TOUCH_PEN_UP;
			return SYSINTR_TOUCH_CHANGED;
		}

        if(odo_tsb->status == TOUCH_PEN_UP) 
		{
			//RETAILMSG(0,(TEXT("INT Touch SYSINTR_TOUCH_CHANGED 2 \r\n")));
			odo_tsb->status = TOUCH_PEN_UP;
			return SYSINTR_TOUCH_CHANGED;
		}
        else 
		{
			unsigned int TmpTCON;

        	odo_tsb->status = TOUCH_PEN_SAMPLE;
			TmpTCON = s2410PWM->rTCON;	// get TCON value to temp TCON register
			TmpTCON &= ~0xf00;     		// clear fields of Timer 1 
			TmpTCON |= 0x200;     		// interval mode(auto reload), update TCVNTB4, stop 
			s2410PWM->rTCON = TmpTCON;	// put the value to TCON register

			TmpTCON = s2410PWM->rTCON;	// get TCON value to temp TCON register
			TmpTCON &= ~0xf00;     		// clear fields of Timer 1 
			TmpTCON |= 0x100;     		// interval mode, no operation, start for Timer 4 
			s2410PWM->rTCON = TmpTCON;	// put the value to TCON register

			//RETAILMSG(0,(TEXT("INT Touch SYSINTR_TOUCH\r\n")));
	
        	return SYSINTR_TOUCH;
		}
*/		
	}

	else if (IntPendVal == INTSRC_EINT0)  { // POWER BUTTON
		s2410INT->rINTMSK |= BIT_EINT0;
		s2410INT->rSRCPND  = BIT_EINT0;	/* Interrupt Clear				*/
		if (s2410INT->rINTPND & BIT_EINT0) 
			s2410INT->rINTPND  = BIT_EINT0;

		return(SYSINTR_POWER);	
	}

	else if(IntPendVal == INTSRC_DMA1) // AUDIO DMA input.
	{  
		s2410INT->rINTMSK |= BIT_DMA1;
		s2410INT->rSRCPND  = BIT_DMA1;
		if (s2410INT->rINTPND & BIT_DMA1) 
			s2410INT->rINTPND  = BIT_DMA1;

		return(SYSINTR_AUDIO);
	}
	else if(IntPendVal == INTSRC_DMA2) // AUDIO DMA output.
	{  
		s2410INT->rINTMSK |= BIT_DMA2;
		s2410INT->rSRCPND  = BIT_DMA2;
		if (s2410INT->rINTPND & BIT_DMA2) 
			s2410INT->rINTPND  = BIT_DMA2;

		return(SYSINTR_AUDIO);
	}

	else if(IntPendVal == INTSRC_USBH) 	// USB.
	{
		s2410INT->rINTMSK |= BIT_USBH;
		s2410INT->rSRCPND  = BIT_USBH;        
		if (s2410INT->rINTPND & BIT_USBH) 
			s2410INT->rINTPND  = BIT_USBH;
		//RETAILMSG(1, (TEXT("INT:SYSINTR_USB INT\r\n")));
		return(SYSINTR_USB);     
	} 

	else if (IntPendVal == INTSRC_DMA3)
	{
		s2410INT->rINTMSK |= BIT_USBD; // USBD interrupt should be masked
		//s2410INT->rINTMSK |= BIT_DMA3;
		s2410INT->rSRCPND = BIT_DMA3;
		if (s2410INT->rINTPND & BIT_DMA3) 
			s2410INT->rINTPND = BIT_DMA3;
		usbdShMem->usbdDma3Int=1;
		return SYSINTR_USBD;  
		//Correct. DMA3 interrupt will be connected to USBD interrupt.
		//break;
	}

	else if(IntPendVal == INTSRC_USBD) 
	{
		s2410INT->rINTMSK |= BIT_USBD;
//		UsbdClearEir();	 //:-)
		{
//	static volatile struct udcreg *s2410USBD = (volatile struct udcreg *)(0xB1200140);
	
			usbdShMem->usbdEir|=*(volatile BYTE *)&s2410USBD->EIR;
			usbdShMem->usbdUir|=*(volatile BYTE *)&s2410USBD->UIR;
			*(volatile BYTE *)&s2410USBD->EIR=usbdShMem->usbdEir;
			*(volatile BYTE *)&s2410USBD->UIR=usbdShMem->usbdUir;			
		}
		s2410INT->rSRCPND = BIT_USBD;
		if (s2410INT->rINTPND & BIT_USBD) 
			s2410INT->rINTPND = BIT_USBD;
		//RETAILMSG(1,(TEXT("INT_USBD\r\n")));
		return SYSINTR_USBD;
    }

	else if(IntPendVal == INTSRC_UART0){
#ifdef xyg_ser_sub_mask
		SubIntPendVal = s2410INT->rSUBSRCPND;

		// Note that we only mask the sub source interrupt - the serial driver will clear the
		// sub source pending register.
		//
		if( bPrint )
		{
			RETAILMSG(1, (TEXT("rINTMSK=0x%x, SubIntPendVal=0x%x,rINTSUBMSK=0x%x.\r\n"),s2410INT->rINTMSK ,SubIntPendVal,s2410INT->rINTSUBMSK));
			bPrint = FALSE;
		}
		if(SubIntPendVal & INTSUB_ERR0){
			s2410INT->rINTSUBMSK |= INTSUB_ERR0;
		}
		else if(SubIntPendVal & INTSUB_RXD0){
			s2410INT->rINTSUBMSK |= INTSUB_RXD0;
		}
		else if(SubIntPendVal & INTSUB_TXD0){
			s2410INT->rINTSUBMSK |= INTSUB_TXD0;
		}
		else{
			RETAILMSG(1, (TEXT("1111111.\r\n")));			
			return(SYSINTR_NOP);
		}
#endif
		// NOTE: Don't clear INTSRC:UART0 here - serial driver does that.
		//
//		if (s2410INT->rINTPND & BIT_UART0){ 
		//	s2410INT->rINTPND  = BIT_UART0;
//		}
		//s2410INT->rINTMSK |= BIT_UART0;
		nIntrCount++;
		s2410INT->rINTMSK |= BIT_UART0;
		if( s2410INT->rINTPND & BIT_UART0 )
		    s2410INT->rINTPND = BIT_UART0;

		return(SYSINTR_SERIAL);
	}
	else if(IntPendVal == INTSRC_UART1){
#ifdef xyg_ser_sub_mask
		SubIntPendVal = s2410INT->rSUBSRCPND;

		if(SubIntPendVal & INTSUB_ERR1){
			s2410INT->rINTSUBMSK |= INTSUB_ERR1;
		}       
		else if(SubIntPendVal & INTSUB_RXD1){
			s2410INT->rINTSUBMSK |= INTSUB_RXD1;
		}       
		else if(SubIntPendVal & INTSUB_TXD1){
			s2410INT->rINTSUBMSK |= INTSUB_TXD1;
		}       
		else{
			RETAILMSG(1, (TEXT("222222.\r\n")));						
			return(SYSINTR_NOP);
		}
#endif

		if (s2410INT->rINTPND & BIT_UART1){ 
			s2410INT->rINTPND  = BIT_UART1;
		}
		s2410INT->rINTMSK |= BIT_UART1;
		
		return(SYSINTR_IR);
	}

/*
	else if(IntPendVal == INTSRC_UART0)	// SERIAL (UART0) (physical COM1: P1 connector).
	{  
		SubIntPendVal = s2410INT->rSUBSRCPND;

		// Note that we only mask the sub source interrupt - the serial driver will clear the
		// sub source pending register.
		//
		if(SubIntPendVal & INTSUB_ERR0) 
		{
			s2410INT->rINTSUBMSK |= INTSUB_ERR0;
		}
		else if(SubIntPendVal & INTSUB_RXD0) 
		{
			s2410INT->rINTSUBMSK |= INTSUB_RXD0;
		}
		else if(SubIntPendVal & INTSUB_TXD0) 
		{
			s2410INT->rINTSUBMSK |= INTSUB_TXD0;
		}
		else
		{
			return(SYSINTR_NOP);
		}
	
		// NOTE: Don't clear INTSRC:UART0 here - serial driver does that.
		//
		s2410INT->rINTMSK |= BIT_UART0;
		if (s2410INT->rINTPND & BIT_UART0) 
			s2410INT->rINTPND  = BIT_UART0;

		return(SYSINTR_SERIAL);
	}
	else if(IntPendVal == INTSRC_UART2)	// IrDA (UART2)
	{
		SubIntPendVal = s2410INT->rSUBSRCPND;

		if(SubIntPendVal & INTSUB_ERR2) 
		{
			s2410INT->rINTSUBMSK |= INTSUB_ERR2;
		}       
		else if(SubIntPendVal & INTSUB_RXD2) 
		{
			s2410INT->rINTSUBMSK |= INTSUB_RXD2;
		}       
		else if(SubIntPendVal & INTSUB_TXD2) 
		{
			s2410INT->rINTSUBMSK |= INTSUB_TXD2;
		}       
		else
		{
			return(SYSINTR_NOP);
		}

		// NOTE: Don't clear INTSRC:UART2 here - serial driver does that.
		//
		s2410INT->rINTMSK |= BIT_UART2;
		if (s2410INT->rINTPND & BIT_UART2) 
			s2410INT->rINTPND  = BIT_UART2;
		
		return(SYSINTR_IR);
	}
*/
	else if (IntPendVal == INTSRC_RTC)
	{
		s2410INT->rSRCPND  = BIT_RTC; 	/* Interrupt Clear 				*/
		if (s2410INT->rINTPND & BIT_RTC) 
			s2410INT->rINTPND  = BIT_RTC;
		s2410INT->rINTMSK  |= BIT_RTC;	/* Alarm Interrupt Disable 		*/

		return (SYSINTR_RTC_ALARM);
	}
	RETAILMSG(1, (TEXT("33333.\r\n")));				
	return(SYSINTR_NOP);
}

// ********************************************************************
//声明:DWORD OEM_GetTickCount( void )
//参数:无    
//返回值:
//功能描述:得到系统tick
//引用: 被GetTickCount调用
// ********************************************************************

DWORD OEM_GetTickCount( void )
{
	return (RESCHED_PERIOD * ulTickCount);
}

DWORD OEM_GetSysTickCount( void )
{
	return 0;
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -