本帖最后由 lord_fan 于 2011-10-15 17:31 编辑
这两个必须是成对出现的?并且是成对执行完?
在中断子程序中,必须执行osintexit();
在osintexit()中,使用了OS_ENTER(EXIT)_CRITICAL这对宏,但是在判断应该做中断切换的时候,执行了osintctxsw(),该函数没有返回吧?那就执行不到os_EXIT_CRITICAL了吧?那和开头的enter宏不久没成对执行了?有关中断宏,没开中断宏?
求解。
void OSIntExit (void)
{
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr;
#endif
if (OSRunning == TRUE) {
OS_ENTER_CRITICAL();
if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
OSIntNesting--;
}
if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Reschedule only if all ISRs complete ... */
OSIntExitY = OSUnMapTbl[OSRdyGrp]; /* ... and not locked. */
OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
OSCtxSwCtr++; /* Keep track of the number of ctx switches */
OSIntCtxSw(); /* Perform interrupt level ctx switch */
}
}
OS_EXIT_CRITICAL();
}
}
/*$PAGE*/ |