⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os-task-switch.lis

📁 ucos-ii-at90S-icc-avr
💻 LIS
📖 第 1 页 / 共 5 页
字号:
 02EA           ;       //skip last task,last task must be idle task
 02EA           ;       for(i=0;i<OS_TASK_COUNT-1;i++)
 02EA 2227              clr R18
 02EC 25C0              rjmp L66
 02EE           L63:
 02EE                   .dbline 289
 02EE           ;       {
 02EE                   .dbline 290
 02EE           ;       ptcb=OSpTCBList[i];
 02EE 80E0              ldi R24,<_OSpTCBList
 02F0 90E0              ldi R25,>_OSpTCBList
 02F2 E22F              mov R30,R18
 02F4 FF27              clr R31
 02F6 EE0F              lsl R30
 02F8 FF1F              rol R31
 02FA E80F              add R30,R24
 02FC F91F              adc R31,R25
 02FE 0081              ldd R16,z+0
 0300 1181              ldd R17,z+1
 0302                   .dbline 293
 0302           ; //    OS_ENTER_CRITICAL();
 0302           ;     //check ptcb != 0
 0302           ;       if(ptcb){              /* Go through all TCBs in TCB list          */
 0302 0030              cpi R16,0
 0304 0107              cpc R16,R17
 0306 B9F0              breq L67
 0308           X12:
 0308                   .dbline 293
 0308                   .dbline 294
 0308           ;         if (ptcb->OSTCBDly != 0) {                         /* Delayed or waiting for event with TO     */
 0308 E02F              mov R30,R16
 030A F12F              mov R31,R17
 030C 2280              ldd R2,z+2
 030E 3380              ldd R3,z+3
 0310 2220              tst R2
 0312 11F4              brne X13
 0314 3320              tst R3
 0316 79F0              breq L69
 0318           X13:
 0318                   .dbline 294
 0318                   .dbline 295
 0318           ;             if (--ptcb->OSTCBDly == 0) {                   /* Decrement nbr of ticks to end of delay   */
 0318 802F              mov R24,R16
 031A 912F              mov R25,R17
 031C 0296              adiw R24,2
 031E E82F              mov R30,R24
 0320 F92F              mov R31,R25
 0322 8081              ldd R24,z+0
 0324 9181              ldd R25,z+1
 0326 0197              sbiw R24,1
 0328 482E              mov R4,R24
 032A 592E              mov R5,R25
 032C 4082              std z+0,R4
 032E 5182              std z+1,R5
 0330 8030              cpi R24,0
 0332 8907              cpc R24,R25
 0334 01F4              brne L71
 0336           X14:
 0336                   .dbline 295
 0336                   .dbline 302
 0336           ; //                if (!(ptcb->OSTCBStat & OS_STAT_SUSPEND)) {    /* Is task suspended?                   */
 0336           ; //                    OSRdyGrp               |= ptcb->OSTCBBitY; /* No,  Make task Rdy to Run (timed out)*/
 0336           ; //                    OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
 0336           ; //                } else {                                       /* Yes, Leave 1 tick to prevent ...     */
 0336           ; //                    ptcb->OSTCBDly = 1;                        /* ... loosing the task when the ...    */
 0336           ; //                }                                              /* ... suspension is removed.           */
 0336           ;                       }//end (--ptcb->OSTCBDly==0)         
 0336           L71:
 0336                   .dbline 303
 0336           ;                       }//end OSTCBDly!=0
 0336           L69:
 0336                   .dbline 304
 0336           ;         }//end if(ptcb)
 0336           L67:
 0336                   .dbline 306
 0336           L64:
 0336                   .dbline 288
 0336 2395              inc R18
 0338           L66:
 0338                   .dbline 288
 0338 2230              cpi R18,2
 033A C8F2              brlo L63
 033C                   .dbline -2
 033C                   .dbline 307
 033C           ;   //  OS_EXIT_CRITICAL();
 033C           ;     }//end for
 033C           ; }
 033C           L62:
 033C                   .dbline 0 ; func end
 033C 0895              ret
 033E                   .dbsym l ret 1 c
 033E                   .dbsym r ptcb 16 pX
 033E                   .dbsym r i 18 c
 033E                   .dbend
 033E                   .dbfunc e OSIntExit _OSIntExit fV
                        .even
 033E           _OSIntExit::
 033E                   .dbline -1
 033E                   .dbline 329
 033E           ; 
 033E           ; /*
 033E           ; *********************************************************************************************************
 033E           ; *                                               EXIT ISR
 033E           ; *
 033E           ; * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR.  When 
 033E           ; *              the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
 033E           ; *              a new, high-priority task, is ready to run.
 033E           ; *
 033E           ; * Arguments  : none
 033E           ; *
 033E           ; * Returns    : none
 033E           ; *
 033E           ; * Notes      : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
 033E           ; *                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
 033E           ; *                 end of the ISR.
 033E           ; *              2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())
 033E           ; *********************************************************************************************************
 033E           ; */
 033E           ; 
 033E           ; void OSIntExit(void)
 033E           ; {
 033E                   .dbline 330
 033E           ;     OS_ENTER_CRITICAL();
 033E 0A93              st -y,r16
 0340 0FB7               in r16,0x3f
 0342 F894               cli
 0344 0F93               push r16
 0346 0991              ld r16,y+
 0348                   .dbline 330
 0348                   .dbline 331
 0348           ;     if ((--OSIntNesting | OSLockNesting) == 0) { /* Reschedule only if all ISRs completed & not locked */
 0348 8091A201          lds R24,_OSIntNesting
 034C 8150              subi R24,1
 034E 282E              mov R2,R24
 0350 2092A201          sts _OSIntNesting,R2
 0354 4090A101          lds R4,_OSLockNesting
 0358 2428              or R2,R4
 035A 09F0              breq X17
 035C 36C0              rjmp L74
 035E           X17:
 035E                   .dbline 331
 035E                   .dbline 332
 035E           ;         OSPrioHighRdy=OSGetPrioRdy();
 035E 7BDF              rcall _OSGetPrioRdy
 0360 00939F01          sts _OSPrioHighRdy,R16
 0364                   .dbline 333
 0364           ;               if(OSPrioHighRdy>OS_LOWEST_PRIO)
 0364 82E0              ldi R24,2
 0366 8017              cp R24,R16
 0368 18F4              brsh L76
 036A                   .dbline 334
 036A           ;               {
 036A                   .dbline 336
 036A           ; #if OS_STRICT
 036A           ;                 OSError(0);
 036A 0027              clr R16
 036C 00D0              rcall _OSError
 036E                   .dbline 338
 036E 2DC0              rjmp L77
 0370           L76:
 0370                   .dbline 338
 0370           ; #endif
 0370           ;               }else if (OSPrioHighRdy != OSPrioCur) {         /* No context switch if current task is highest ready */
 0370 2090A001          lds R2,_OSPrioCur
 0374 30909F01          lds R3,_OSPrioHighRdy
 0378 3214              cp R3,R2
 037A 39F1              breq L78
 037C                   .dbline 338
 037C                   .dbline 339
 037C           ;             OSTCBHighRdy = OSpTCBList[OSPrioHighRdy];
 037C 80E0              ldi R24,<_OSpTCBList
 037E 90E0              ldi R25,>_OSpTCBList
 0380 E32D              mov R30,R3
 0382 FF27              clr R31
 0384 EE0F              lsl R30
 0386 FF1F              rol R31
 0388 E80F              add R30,R24
 038A F91F              adc R31,R25
 038C 2080              ldd R2,z+0
 038E 3180              ldd R3,z+1
 0390 30929C01          sts _OSTCBHighRdy+1,R3
 0394 20929B01          sts _OSTCBHighRdy,R2
 0398                   .dbline 341
 0398           ; #if OS_STRICT
 0398           ;                       if((0==OSTCBHighRdy)||(0==OSTCBCur)||
 0398 2220              tst R2
 039A 11F4              brne X15
 039C 3320              tst R3
 039E 89F0              breq L84
 03A0           X15:
 03A0 20909D01          lds R2,_OSTCBCur
 03A4 30909E01          lds R3,_OSTCBCur+1
 03A8 2220              tst R2
 03AA 11F4              brne X16
 03AC 3320              tst R3
 03AE 49F0              breq L84
 03B0           X16:
 03B0 82E0              ldi R24,2
 03B2 2090A001          lds R2,_OSPrioCur
 03B6 8215              cp R24,R2
 03B8 20F0              brlo L84
 03BA 20909F01          lds R2,_OSPrioHighRdy
 03BE 8215              cp R24,R2
 03C0 10F4              brsh L80
 03C2           L84:
 03C2                   .dbline 343
 03C2           ;                          (OSPrioCur>OS_LOWEST_PRIO)||(OSPrioHighRdy>OS_LOWEST_PRIO))
 03C2           ;                         OSError(0);
 03C2 0027              clr R16
 03C4 00D0              rcall _OSError
 03C6           L80:
 03C6                   .dbline 345
 03C6           ; #endif                        
 03C6           ;             OSDebug();
 03C6 06D0              rcall _OSDebug
 03C8                   .dbline 346
 03C8           ;             OSIntCtxSw();                        /* Perform interrupt level context switch             */
 03C8 00D0              rcall _OSIntCtxSw
 03CA                   .dbline 347
 03CA           ;         }//end OSPrioHighRdy != OSPrioCur
 03CA           L78:
 03CA           L77:
 03CA                   .dbline 348
 03CA           ;     }//end nesting==0
 03CA           L74:
 03CA                   .dbline 349
 03CA           ;     OS_EXIT_CRITICAL();
 03CA 0A93              st -y,r16
 03CC 0F91              pop r16
 03CE 0FBF              out 0x3F,r16
 03D0 0991              ld r16,y+
 03D2                   .dbline 349
 03D2                   .dbline -2
 03D2                   .dbline 350
 03D2           ; }
 03D2           L73:
 03D2                   .dbline 0 ; func end
 03D2 0895              ret
 03D4                   .dbend
 03D4                   .dbfunc e OSDebug _OSDebug fV
 03D4           ;         port_a -> R16
                        .even
 03D4           _OSDebug::
 03D4                   .dbline -1
 03D4                   .dbline 353
 03D4           ; 
 03D4           ; void OSDebug(void)
 03D4           ; {
 03D4                   .dbline 356
 03D4           ; INT8U port_a;
 03D4           ;             //debug
 03D4           ;                       DDRA=0;port_a=PORTA;
 03D4 2224              clr R2
 03D6 2ABA              out 0x1a,R2
 03D8                   .dbline 356
 03D8 0BB3              in R16,0x1b
 03DA                   .dbline 357
 03DA           ;                       DDRA=0xff;PORTA=~port_a;
 03DA 8FEF              ldi R24,255
 03DC 8ABB              out 0x1a,R24
 03DE                   .dbline 357
 03DE 202E              mov R2,R16
 03E0 2094              com R2
 03E2 2BBA              out 0x1b,R2
 03E4                   .dbline -2
 03E4                   .dbline 359
 03E4           ;                       //end debug
 03E4           ; }
 03E4           L85:
 03E4                   .dbline 0 ; func end
 03E4 0895              ret
 03E6                   .dbsym r port_a 16 c
 03E6                   .dbend
 03E6                   .dbfunc e OSEventInit _OSEventInit fV
 03E6           ;              i -> R20
 03E6           ;         pevent -> R16,R17
                        .even
 03E6           _OSEventInit::
 03E6 00D0              rcall push_gset1
 03E8                   .dbline -1
 03E8                   .dbline 386
 03E8           ; 
 03E8           ; /*
 03E8           ; *********************************************************************************************************
 03E8           ; *                             MAKE TASK READY TO RUN BASED ON EVENT OCCURING
 03E8           ; *
 03E8           ; * Description: This function is called by other uC/OS-II services and is used to ready a task that was
 03E8           ; *              waiting for an event to occur.
 03E8           ; *
 03E8           ; * Arguments  : pevent    is a pointer to the event control block corresponding to the event.
 03E8           ; *
 03E8           ; *              msg       is a pointer to a message.  This pointer is used by message oriented services
 03E8           ; *                        such as MAILBOXEs and QUEUEs.  The pointer is not used when called by other
 03E8           ; *                        service functions.
 03E8           ; *
 03E8           ; *              msk       is a mask that is used to clear the status byte of the TCB.  For example,
 03E8           ; *                        OSSemPost() will pass OS_STAT_SEM, OSMboxPost() will pass OS_STAT_MBOX etc.
 03E8           ; *
 03E8           ; * Returns    : none
 03E8           ; *
 03E8           ; * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 03E8           ; *********************************************************************************************************
 03E8           ; */
 03E8           ; #if OS_EVENT_EN

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -