μC/OS中高优先级任务一旦处于就绪态总能获得C(3)

    LDR     R1, IRQIsrVect                          //IRQ已经通过指令

//IRQIsrVect DCD HandleEINT0被赋值为HandleEINT0的地址

    MOV     LR, PC                    //此时的PC应该指向MSR那条指令,LDR这条恰好是跳转指令,这样跳转之后刚好返回MSR

    LDR     PC, [R1, R0, LSL #2]         //此处计算C语言的中断服务函数入口地址,然后跳转执行。    

    MSR              CPSR_c,#SVCMODE|NOINT   //中断服务函数执行完后返回

    BL          OSIntExit           //跳转OSIntExit执行,先插入分析OSIntExit

void  OSIntExit (void)

{

#if OS_CRITICAL_METHOD == 3                             

    OS_CPU_SR  cpu_sr = 0;

#endif

    if (OSRunning == OS_TRUE) {

        OS_ENTER_CRITICAL();

        if (OSIntNesting > 0) {                     

            OSIntNesting--;

        }

        if (OSIntNesting == 0) {                          

            if (OSLockNesting == 0) {                    

                OS_SchedNew();                                      //计算处于最高优先级的任务

                if (OSPrioHighRdy != OSPrioCur) {        //假如就绪态的任务优先级高于当前运行的任务优先级着将其调度执行

                    OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];

#if OS_TASK_PROFILE_EN > 0

                    OSTCBHighRdy->OSTCBCtxSwCtr++;       

#endif

                    OSCtxSwCtr++;                        

                    OSIntCtxSw();                           //任务切换                        

                }

            }

        }

        OS_EXIT_CRITICAL();

    }

}

   

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/c891583336a3126b64689d39989d88e0.html