📄 interrupt.c
字号:
}
#endif
else if(ulVic1Irq & INT1_UNUSED1)
{
*VIC1_INTCLEAR = INT1_UNUSED1;
retval = SYSINTR_PIO_PLAYBACK;
}
else if(ulVic1Irq & INT1_UNUSED2)
{
*VIC1_INTCLEAR = INT1_UNUSED2;
retval = SYSINTR_PIO_RECORD;
}
//
// Check to see if it is a keyboard interrupt
//
else if(ulVic1Irq & INT1_KEYPAD)
{
*VIC1_INTCLEAR = INT1_KEYPAD;
retval = SYSINTR_KEYBOARD;
}
//
// Check to see if the SPI port has generated an interrupt.
// This is used for the PS/2 keyboard driver.
//
else if(ulVic2Irq & INT2_SPI)
{
fPS2Int = 1;
*VIC2_INTCLEAR = INT2_SPI;
retval = SYSINTR_SPI;
}
//
// Real time clock interrupt. Occurs very infrequently so
// put at the bottom of the interrupt priority list.
//
else if (ulVic2Irq & INT2_RTC)
{
*VIC2_INTCLEAR = INT2_RTC;
// retval = SYSINTR_RTC_ALARM;
}
//
// Check the DMA channels.
//
else if (ulVic1Irq & INT1_DMAM2P0 )
{
*VIC1_INTCLEAR = INT1_DMAM2P0;
retval = SYSINTR_DMA0;
}
else if (ulVic1Irq & INT1_DMAM2P1 )
{
*VIC1_INTCLEAR = INT1_DMAM2P1;
retval = SYSINTR_DMA1;
}
#if 0
else if (ulVic1Irq & INT1_DMAM2P2 )
{
*VIC1_INTCLEAR = INT1_DMAM2P2;
retval = SYSINTR_DMA2;
}
else if (ulVic1Irq & INT1_DMAM2P3 )
{
*VIC1_INTCLEAR = INT1_DMAM2P3;
retval = SYSINTR_DMA3;
}
else if (ulVic1Irq & INT1_DMAM2P4 )
{
*VIC1_INTCLEAR = INT1_DMAM2P4;
retval = SYSINTR_DMA4;
}
else if (ulVic1Irq & INT1_DMAM2P5 )
{
*VIC1_INTCLEAR = INT1_DMAM2P5;
retval = SYSINTR_DMA1;
}
else if (ulVic1Irq & INT1_DMAM2P5 )
{
*VIC1_INTCLEAR = INT1_DMAM2P5;
retval = SYSINTR_DMA5;
}
else if (ulVic1Irq & INT1_DMAM2P6 )
{
*VIC1_INTCLEAR = INT1_DMAM2P6;
retval = SYSINTR_DMA6;
}
else if (ulVic1Irq & INT1_DMAM2P7 )
{
*VIC1_INTCLEAR = INT1_DMAM2P7;
retval = SYSINTR_DMA7;
}
else if (ulVic1Irq & INT1_DMAM2P8 )
{
*VIC1_INTCLEAR = INT1_DMAM2P8;
retval = SYSINTR_DMA8;
}
else if (ulVic1Irq & INT1_DMAM2P9 )
{
*VIC1_INTCLEAR = INT1_DMAM2P9;
retval = SYSINTR_DMA9;
}
#endif // 0
else if (ulVic1Irq & INT1_DMAM2M0 )
{
*VIC1_INTCLEAR = INT1_DMAM2M0;
retval = SYSINTR_DMA_M2M0;
}
/*
else if (ulVic1Irq & INT1_DMAM2M1 )
{
*VIC1_INTCLEAR = INT1_DMAM2M1;
retval = SYSINTR_DMA_M2M1;
}
*/
//
// Check to see if it is a touch pad interrupt.
//
/* else if (ulVic1Irq & INT1_TOUCH)
{
*VIC1_INTCLEAR = INT1_TOUCH;
//RETAILMSG(1, (TEXT("TOUCH\r\n")));
// *VIC1_INTENABLE=INT1_TOUCH;
if( !gfResumeFlag )
{
if( *TIM_DEBUGVALUELOW - dwTimeValueWhenSuspend < 100000 )
{
*TOUCH_TSSETUP2=0x0; // Clear Touch panel interrupt from the device.
*VIC1_INTENABLE=INT1_TOUCH;
}
else
retval = SYSINTR_TOUCH;
}
else
{
// RETAILMSG(1, (TEXT("TOUCH %d\r\n"),dwWakeupSourceIgnored));
retval = SYSINTR_TOUCH;
}
}*/
//
// See if it is timer 2 also used for the touch interface.
//
else if (ulVic1Irq & INT1_TIMER2)
{
*VIC1_INTCLEAR = INT1_TIMER2;
retval = SYSINTR_TIMER2;
}
//
// Check to see if it the IRDA interrupt.
//
else if (ulVic2Irq & INT2_IRDA )
{
*VIC2_INTCLEAR = INT2_IRDA;
retval = SYSINTR_IR;
}
//
// Check to see if it is the IDE interrupt.
//
else if (ulVic2Irq & INT2_EXT3)
{
*VIC2_INTCLEAR = INT2_EXT3;
retval = SYSINTR_IDE;
}
//
// Check to see if it is the USB slave device.
//
else if (ulVic2Irq & INT2_EXT0)
{
#ifdef EP931X_SIMULAT_PS2_KBD
BOOL EP93XPS2ISR ( void );
// DWORD dwStart;
*VIC2_INTCLEAR = INT2_EXT0;
// dwStart=*TIM_DEBUGVALUELOW;
if( EP93XPS2ISR ( ) )
{/*triger interrupt to notice the driver, when get a whole char*/
// retval = SYSINTR_PS2_PORT;
}
#endif
*VIC2_INTENABLE = INT2_EXT0; /*as InterruptDone*/
}
else if(ulVic2Irq & INT2_PCMCIA_IRQ)
{
*VIC2_INTCLEAR = INT2_PCMCIA_IRQ;
// OEMEthISR();
retval = SYSINTR_PCMCIA_LEVEL;
}
else if((ulVic1Irq & (INT1_PCMCIA_CD1 | INT1_PCMCIA_CD2 | INT1_PCMCIA_BVD1)) ||
(ulVic2Irq & INT2_PCMCIA_BVD2))
{
*VIC1_INTCLEAR = (INT1_PCMCIA_CD1 | INT1_PCMCIA_CD2 | INT1_PCMCIA_BVD1);
*VIC2_INTCLEAR = INT2_PCMCIA_BVD2;
retval = SYSINTR_PCMCIA_STATE;
}
#ifdef EP931X_SD_MMC
else if(ulVic2Irq & INT2_EXT1)
{
volatile unsigned short *v_pSDReg,SDRegValue;
*VIC2_INTCLEAR = INT2_EXT1;
v_pSDReg = (volatile unsigned short *) MEM_HOST_REG_BASE_SD_MMC;
SDRegValue=*(v_pSDReg+0x1);
if ( ( SDRegValue & 0x8000 ) == 0x8000 )
{
SDRegValue=*(v_pSDReg+0x5);
if ( ( SDRegValue & 0x100 ) == 0x100)
{
retval = SYSINTR_CARD_DETECT;
}
else
{
//RETAILMSG(1,(L"SD_MMC response\n"));
retval = SYSINTR_CARD_RESPONSE;
}
}
}
#endif
#if EP931X_MS_CARD
else if(ulVic2Irq & INT2_EXT2)
{
volatile unsigned short *v_pSDReg,SDRegValue;
*VIC2_INTCLEAR = INT2_EXT2;
v_pSDReg = (volatile unsigned short *)MEM_HOST_REG_BASE_MS;
SDRegValue=*(v_pSDReg+0x1);
if ( ( SDRegValue & 0x8000 ) == 0x8000 )
{
SDRegValue=*(v_pSDReg+0x3);
if ( ( SDRegValue & 0x1000 ) == 0x1000)
{
retval = SYSINTR_CARD_DETECT;
}
else
{
retval = SYSINTR_CARD_RESPONSE;
}
}
}
#endif
//--------------------------------------------------
//---------------------------------------------------
//for usb device d12 added by cyx 2005 09 08
#ifdef BSP_USB_DEVICE
else if(ulVic2Irq & INT2_EXT2)
{
*VIC2_INTCLEAR = INT2_EXT2;
retval = SYSINTR_USB_CLIENT;
}
#endif
//---------------------------------------------------
else
{
*VIC1_INTCLEAR= ulVic1Irq;
*VIC2_INTCLEAR= ulVic2Irq;
// NKDbgPrintfW(L"0x%x, 0x%x\r\n", ulVic1Irq, ulVic2Irq);
}
}
// ulVic1Last = ulVic1Irq;
// ulVic2Last = ulVic2Irq;
//
// If we get any device interrupts, signal the resume flag. The flag
// will release the CPU from OEMPowerOff if the user had previously
// chosen to suspend the platform. In OEMPowerOff, only the interrupts
// allowed to wake us up will be enabled so we needn't worry about
// that here.
//
if(retval < SYSINTR_MAXIMUM && (!gfResumeFlag) )
{
if( gfSysIntrWakeupMask[retval] )
{
//RETAILMSG(1, (TEXT("resume %x\r\n"),retval));
gfResumeFlag = TRUE;
gdwLastWakeupSource = retval;
}
}
return retval;
}
//****************************************************************************
// TimerInterrupt
//****************************************************************************
// Lets put all of the timer interrupt handling in one place.
// This code was taken from the arm integrator platform.
// The code is confusing, so I cleaned it up a little bit by making one
// ending point.
//
int TimerInterrupt(void)
{
DWORD retval = SYSINTR_NOP;
// static int iCount = 0;
//
// update the tick count
//
CurTicks.QuadPart += dwReschedIncrement;
//
// Print out a 1 every second. I want to make sure that we are getting ticks.
//
//if(iCount++ == 1000)
//{
// OEMWriteDebugByte('T') ;
// iCount = 0;
//}
//
// Call the profile ISR if it's enabled.
//
if (PProfileInterrupt)
{
retval = PProfileInterrupt();
if(retval == SYSINTR_RESCHED)
{
//
// Update the millisecond counter
//
CurMSec += RESCHED_PERIOD;
#if (CE_MAJOR_VER == 0x0003)
DiffMSec += RESCHED_PERIOD;
#endif
}
}
else
{
//
// if we're timing interrupts, keep track of when this one came in
//
if (fIntrTime)
{
dwIsrTime1 = PerfCountSinceTick();
wNumInterrupts++;
//
// Not profiling, update the millisecond counter
//
CurMSec += RESCHED_PERIOD;
#if (CE_MAJOR_VER == 0x0003)
DiffMSec += RESCHED_PERIOD;
#endif
dwIntrTimeCountdown--;
if (dwIntrTimeCountdown == 0)
{
dwIntrTimeCountdown = dwIntrTimeCountdownRef;
wNumInterrupts = 0;
dwIsrTime2 = PerfCountSinceTick();
retval = SYSINTR_TIMING;
}
else
{
#if (CE_MAJOR_VER == 0x0003)
if (ticksleft || (dwSleepMin && (dwSleepMin <= DiffMSec)) ||
(dwPreempt && (dwPreempt <= DiffMSec)))
#else
if ((int) (CurMSec - dwReschedTime) >= 0)
#endif
{
retval = SYSINTR_RESCHED;
}
}
}
else
{
//
// not profiling, update the millisecond counter
//
CurMSec += RESCHED_PERIOD;
#if (CE_MAJOR_VER == 0x0003)
DiffMSec += RESCHED_PERIOD;
#endif
#if (CE_MAJOR_VER == 0x0003)
if (ticksleft || (dwSleepMin && (dwSleepMin <= DiffMSec)) ||
(dwPreempt && (dwPreempt <= DiffMSec)))
#else
if ((int) (CurMSec - dwReschedTime) >= 0)
#endif
{
retval = SYSINTR_RESCHED;
}
}
}
return retval;
}
//****************************************************************************
// SysIntrNumToInterruptMask
//****************************************************************************
// Converts a System interrupt number to the bits used in the interrupt mask.
//
//
BOOL SysIntrNumToInterruptMask
(
DWORD dwSysIntr,
PULONG pulInterruptMask1,
PULONG pulInterruptMask2
)
{
BOOL bRet = TRUE;
switch(dwSysIntr)
{
case SYSINTR_TIMING:
//
// No action necessary. Needs to be handled in the calling routine.
//
*pulInterruptMask1 = 0;
*pulInterruptMask2 = 0;
break;
case SYSINTR_ETHER:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_ETHERNET;
break;
case SYSINTR_USB:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_USB;
break;
case SYSINTR_UART1:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_UART1;
break;
case SYSINTR_UART2:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_UART2;
break;
case SYSINTR_UART3:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_UART3;
break;
case SYSINTR_KEYBOARD:
*pulInterruptMask1 = INT1_KEYPAD;
*pulInterruptMask2 = 0;
break;
case SYSINTR_SPI:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_SPI;
break;
case SYSINTR_RTC_ALARM:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_RTC;
break;
case SYSINTR_DMA0:
case SYSINTR_DMA1:
//case SYSINTR_DMA2:
//case SYSINTR_DMA3:
//case SYSINTR_DMA4:
//case SYSINTR_DMA5:
//case SYSINTR_DMA6:
//case SYSINTR_DMA7:
//case SYSINTR_DMA8:
//case SYSINTR_DMA9:
*pulInterruptMask1 = INT1_DMAM2P0<< (dwSysIntr - SYSINTR_DMA0);
*pulInterruptMask2 = 0;
break;
/* case SYSINTR_TOUCH:
*pulInterruptMask1 = INT1_TOUCH;
*pulInterruptMask2 = 0;
break;
*/
case SYSINTR_TIMER2:
*pulInterruptMask1 = INT1_TIMER2;
*pulInterruptMask2 = 0;
break;
case SYSINTR_IR:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_IRDA;
break;
case SYSINTR_IDE:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = INT2_EXT3;
break;
#ifdef EP931X_SIMULAT_PS2_KBD
case SYSINTR_PS2_PORT:
*pulInterruptMask1 = 0;
*pulInterruptMask2 = 0; // the PS2 KeyBoard driver only see a pseudo interrupt. so don't care the interrupt.
break;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -