再学习陈明计先生写的Small RTOS51的过程中,在任务切换函数的条件编译看不明白
是一个什么层次,请教高手指点!
不明白处前面打了?
void OSSched(void)
{
uint8 temp;
OS_ENTER_CRITICAL();
?#if EN_OS_INT_ENTER > 0
if (OSIntNesting == 0) /* ÊÇ·ñÊÇÖжÏÖе÷Óà */
{
?#endif
#if OS_MAX_TASKS < 9
/* ²éÕÒ´¦ÓÚ¾ÍÐ÷״̬µÄÈÎÎñÖÐÓÅÏȼ¶×î¸ßµÄÈÎÎñ */
temp = OSTaskRuning;
for (OSNextTaskID = 0; OSNextTaskID < OS_MAX_TASKS; OSNextTaskID++)
{
if ((temp & 0x01) != 0)
{
break;
}
temp = temp >> 1;
}
OS_TASK_SW(); /* ½øÐÐÈÎÎñµ÷¶È */
#else
/* ²éÕÒ´¦ÓÚ¾ÍÐ÷״̬µÄÈÎÎñÖÐÓÅÏȼ¶×î¸ßµÄÈÎÎñ */
temp = OSTaskRuning % 256;
for (OSNextTaskID = 0; OSNextTaskID < 8; OSNextTaskID++)
{
if ((temp & 0x01) != 0)
{
goto TaskSw;
}
temp = temp >> 1;
}
temp = OSTaskRuning / 256 ;
for (; OSNextTaskID < OS_MAX_TASKS; OSNextTaskID++)
{
if ((temp & 0x01) != 0)
{
break;
}
temp = temp >> 1;
}
TaskSw:
OS_TASK_SW(); /* ½øÐÐÈÎÎñµ÷¶È */
#endif
?#if EN_OS_INT_ENTER > 0
}
?#endif
OS_EXIT_CRITICAL();
} |