//
// Check if RTC Alarm arrived when TimerInterrupt returns NOP.
//
if( (gfRTCAlarm) && (retval == SYSINTR_NOP) )
{
// Tell the world that we were here....
#if (1 == DEBUG_ALARM)
OEMWriteDebugByte('e');
#endif // ( DEBUG_ALARM )
tmpCurTicks.QuadPart = CurTicks.QuadPart ;
if (gliRTCAlarmTicks.QuadPart <= tmpCurTicks.QuadPart)
{
#if (1 == DEBUG_ALARM)
// Tell the world that the interrupt was hit...
OEMWriteDebugByte('t');
OEMWriteDebugByte('\r');
OEMWriteDebugByte('\n');
#endif // ( DEBUG_ALARM )
gfRTCAlarm = FALSE;
retval = SYSINTR_RTC_ALARM;
}
}
}
else
{
//
// If we're timing interrupts, keep track of when this one came in
//
if (fIntrTime)
{
//
// Subtract off dwReschedIncrment since interrupt hasn't been cleared
//
dwIsrTime1 = PerfCountSinceTick();
wNumInterrupts++;
}
//
// 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.
//
//gfResumeFlag = TRUE;
//
// This was not a timer interrupt, must be a device interrupt.
// Change the priority of the interrupt by changing the order that
// the interrupt is processed.
//
//
// Ethernet interrupt.
//
if(ulVic2Irq & INT2_ETHERNET)
{
*VIC2_INTCLEAR = INT2_ETHERNET;
retval = SYSINTR_ETHER;
}
//
// USB interrupt
//
else if(ulVic2Irq & INT2_USB)
{
*VIC2_INTCLEAR = INT2_USB;
retval = SYSINTR_USB;
}
//
// Check the serial port interrupts.
//
else if(ulVic2Irq & INT2_UART1)
{
*VIC2_INTCLEAR = INT2_UART1;
retval = SYSINTR_UART1;
}
else if(ulVic2Irq & INT2_UART2)
{
*VIC2_INTCLEAR = INT2_UART2;
retval = SYSINTR_UART2;
}
else if(ulVic2Irq & INT2_UART3)
{
*VIC2_INTCLEAR = INT2_UART3;
retval = SYSINTR_UART3;
}
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;
}
而在wince带的s3c2410采有是动态映射
ULONG OEMInterruptHandler(ULONG ra)
{
UINT32 sysIntr = SYSINTR_NOP;
UINT32 irq, irq2 = OAL_INTR_IRQ_UNDEFINED, mask;
// Get pending interrupt(s)
irq = INREG32(&g_pIntrRegs->INTOFFSET);
// System timer interrupt?
if (irq == IRQ_TIMER4) {
// First find if IRQ is claimed by chain
sysIntr = NKCallIntChain((UCHAR)irq);
if (sysIntr == SYSINTR_CHAIN || !NKIsSysIntrValid(sysIntr)) {
// IRQ wasn't claimed, use static mapping
sysIntr = OALIntrTranslateIrq(irq);
}
// unmask interrupts in case it's NOP or invalid
if (SYSINTR_NOP == sysIntr) {
if (OAL_INTR_IRQ_UNDEFINED == irq2) {
// Unmask the primary interrupt
CLRREG32(&g_pIntrRegs->INTMSK, mask);
} else {
// Unmask the external interrupt
mask = 1 << (irq2 - IRQ_EINT4 + 4);
CLRREG32(&g_pPortRegs->EINTMASK, mask);
}
}
// Initialize interrupt maps
for (i = 0; i < SYSINTR_MAXIMUM; i++) {
g_oalSysIntr2Irq = OAL_INTR_IRQ_UNDEFINED;
}
for (i = 0; i < OAL_INTR_IRQ_MAXIMUM; i++) {
g_oalIrq2SysIntr = SYSINTR_UNDEFINED;
}