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

📄 armint.c

📁 三星2410的bsp
💻 C
📖 第 1 页 / 共 2 页
字号:
	}  
	else if (IntPendVal == INTSRC_EINT8_23)		// EINT8 ~ 23
	{ 

		s2410INT->rINTMSK |= BIT_EINT8_23;	
		submask = s2410IOP->rEINTPEND;

		if ( submask & (1 << 18)) // EINT28 : SDMMC_CARD_DETECT
		{
			s2410IOP->rEINTMASK |= (1 << 18);
			s2410IOP->rEINTPEND  = (1 << 18);
			s2410INT->rSRCPND  = BIT_EINT8_23;
			if (s2410INT->rINTPND & BIT_EINT8_23) s2410INT->rINTPND = BIT_EINT8_23;

			//RETAILMSG(1, (TEXT("ARMINT.C - SYSINTR_SDMMC_CARD_DETECT\r\n")));			
			return SYSINTR_SDMMC_CARD_DETECT;
		}
		if ( submask & (1 << 9))	// 0x200 EINT9 : CS8900
		{
			s2410IOP->rEINTMASK |= 0x200;
			s2410IOP->rEINTPEND = 0x200;

			s2410INT->rSRCPND = BIT_EINT8_23;        
			if (s2410INT->rINTPND & BIT_EINT8_23) s2410INT->rINTPND = BIT_EINT8_23;

			//RETAILMSG(1, (TEXT("INT:SYSINTR_ETHER INT\r\n")));
			return SYSINTR_ETHER;
		}
		if ( submask & (1 << 14))	// 0x4000 EINT14 : DM9000
			{
			s2410IOP->rEINTMASK |= 0x4000;
			s2410IOP->rEINTPEND = 0x4000;
			s2410INT->rSRCPND = BIT_EINT8_23;        
			if (s2410INT->rINTPND & BIT_EINT8_23) s2410INT->rINTPND = BIT_EINT8_23;
			
//		        RETAILMSG(1,(TEXT("DM9000 interrupt----\r\n")));	
		   	 return SYSINTR_DM9000 ;
			}
		if ( submask & (1 << 13))	
		{
			s2410IOP->rEINTMASK |= 0x2000;
			s2410IOP->rEINTPEND = 0x2000;

			s2410INT->rSRCPND = BIT_EINT8_23;        
			if (s2410INT->rINTPND & BIT_EINT8_23) s2410INT->rINTPND = BIT_EINT8_23;

			RETAILMSG(1, (TEXT("INT:SYSINTR_16550 INT..........\r\n")));
			return SYSINTR_16550;
		}
		if (submask & (1 << 8))	// 0x100 EINT8 : PCMCIA_LEVEL
		{
			s2410IOP->rEINTMASK |= 0x100;
			s2410IOP->rEINTPEND = 0x100;

			s2410INT->rSRCPND = BIT_EINT8_23;        
			if (s2410INT->rINTPND & BIT_EINT8_23) s2410INT->rINTPND = BIT_EINT8_23;

			//RETAILMSG(1, (TEXT("INT:SYSINTR_PCMCIA_LEVEL INT\r\n")));
			return SYSINTR_PCMCIA_LEVEL;
		}
		else
		{
			s2410INT->rSRCPND = BIT_EINT8_23;        
			if (s2410INT->rINTPND & BIT_EINT8_23) 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
	{
       // 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();	 //:-)
		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)	// 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);
	}
	
	return(SYSINTR_NOP);
}

void UsbdClearEir(void)
{
	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;
}

⌨️ 快捷键说明

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