19,502
社区成员
发帖
与我相关
我的任务
分享
ULONG PeRPISR(void) {
ULONG ulRet = SYSINTR_NOP;
UCHAR ucCurrentInterrupt;
if (fIntrTime) {
//
// We're doing interrupt timing. Get Time to ISR.
//
#ifdef EXTERNAL_VERIFY
_outp((USHORT)0x80, 0xE1);
#endif
dwIntrTimeIsr1 = _PerfCountSinceTick();
dwIntrTimeNumInts++;
}
ucCurrentInterrupt = PICGetCurrentInterrupt();
if (ucCurrentInterrupt == INTR_TIMER0) {
if (PProfileInterrupt) {
ulRet= PProfileInterrupt();
}
if (!PProfileInterrupt || ulRet == SYSINTR_RESCHED) {
#ifdef SYSTIMERLED
static BYTE bTick;
_outp((USHORT)0x80, bTick++);
#endif
CurMSec += g_dwBSPMsPerIntr;
CurTicks.QuadPart += g_dwOALTimerCount;
if (fIntrTime) {
//
// We're doing interrupt timing. Every nth tick is a SYSINTR_TIMING.
//
dwIntrTimeCountdown--;
if (dwIntrTimeCountdown == 0) {
dwIntrTimeCountdown = dwIntrTimeCountdownRef;
dwIntrTimeNumInts = 0;
#ifdef EXTERNAL_VERIFY
_outp((USHORT)0x80, 0xE2);
#endif
dwIntrTimeIsr2 = _PerfCountSinceTick();
ulRet = SYSINTR_TIMING;
} else {
if ((int) (CurMSec - dwReschedTime) >= 0)
ulRet = SYSINTR_RESCHED;
}
} else {
if ((int) (CurMSec - dwReschedTime) >= 0)
ulRet = SYSINTR_RESCHED;
}
}
//
// Check if a reboot was requested.
//
if (dwRebootAddress) {
RebootHandler();
}
} else if (ucCurrentInterrupt == INTR_RTC) {
UCHAR cStatusC;
// Check to see if this was an alarm interrupt
cStatusC = CMOS_Read( RTC_STATUS_C);
if((cStatusC & (RTC_SRC_IRQ|RTC_SRC_US)) == (RTC_SRC_IRQ|RTC_SRC_US))
ulRet = SYSINTR_RTC_ALARM;
} else if (ucCurrentInterrupt <= INTR_MAXIMUM) {
// Mask off interrupt source
PICEnableInterrupt(ucCurrentInterrupt, FALSE);
// We have a physical interrupt ID, but want to return a SYSINTR_ID
// Call interrupt chain to see if any installed ISRs handle this interrupt
ulRet = NKCallIntChain(ucCurrentInterrupt);
// IRQ not claimed by installed ISR; translate into SYSINTR
if (ulRet == SYSINTR_CHAIN) {
ulRet = OALIntrTranslateIrq (ucCurrentInterrupt);
}
if (ulRet == SYSINTR_NOP) {
// If SYSINTR_NOP, IRQ claimed by installed ISR, but no further action required
PICEnableInterrupt(ucCurrentInterrupt, TRUE);
}
else if (ulRet == SYSINTR_UNDEFINED || !NKIsSysIntrValid(ulRet)) {
// If SYSINTR_UNDEFINED, ignore
// If SysIntr was never initialized, ignore
OALMSGS(OAL_WARN&&OAL_INTR, (L"Spurious interrupt on IRQ %d\r\n", ucCurrentInterrupt));
ulRet = SYSINTR_NOP;
PICEnableInterrupt(ucCurrentInterrupt, TRUE);
}
}
OEMIndicateIntSource(ulRet);
if (ucCurrentInterrupt > 7 || ucCurrentInterrupt == -2) {
__asm {
mov al, 020h ; Nonspecific EOI
out 0A0h, al
}
}
__asm {
mov al, 020h ; Nonspecific EOI
out 020h, al
}
return ulRet;
}