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

📄 os_core.lis

📁 把UCOSII移植到AVR MEGA8上的程序 应用程序为驱动1602显示器,虽说有些简单,但可测试UCOS的运行
💻 LIS
📖 第 1 页 / 共 5 页
字号:
 020E 80E0              ldi R24,<_OSRdyTbl
 0210 90E0              ldi R25,>_OSRdyTbl
 0212 FF27              clr R31
 0214 E80F              add R30,R24
 0216 F91F              adc R31,R25
 0218 E081              ldd R30,z+0
 021A FF27              clr R31
 021C 80E0              ldi R24,<_OSUnMapTbl
 021E 90E0              ldi R25,>_OSUnMapTbl
 0220 E80F              add R30,R24
 0222 F91F              adc R31,R25
 0224 2490              lpm R2,Z
 0226 3324              clr R3
 0228 40902301          lds R4,_OSIntExitY
 022C 5524              clr R5
 022E 440C              lsl R4
 0230 551C              rol R5
 0232 440C              lsl R4
 0234 551C              rol R5
 0236 440C              lsl R4
 0238 551C              rol R5
 023A 420C              add R4,R2
 023C 531C              adc R5,R3
 023E 40922001          sts _OSPrioHighRdy,R4
 0242                   .dbline 309
 0242           ;         if (OSPrioHighRdy != OSPrioCur) {              /* No Ctx Sw if current task is highest rdy     */
 0242 20902101          lds R2,_OSPrioCur
 0246 4214              cp R4,R2
 0248 39F1              breq L31
 024A                   .dbline 309
 024A                   .dbline 310
 024A           ;             OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
 024A 242C              mov R2,R4
 024C 82E0              ldi R24,2
 024E 829D              mul R24,R2
 0250 F001              movw R30,R0
 0252 80E0              ldi R24,<_OSTCBPrioTbl
 0254 90E0              ldi R25,>_OSTCBPrioTbl
 0256 E80F              add R30,R24
 0258 F91F              adc R31,R25
 025A 2080              ldd R2,z+0
 025C 3180              ldd R3,z+1
 025E 30929100          sts _OSTCBHighRdy+1,R3
 0262 20929000          sts _OSTCBHighRdy,R2
 0266                   .dbline 311
 0266           ;             OSCtxSwCtr++;                              /* Keep track of the number of context switches */
 0266 41E0              ldi R20,1
 0268 50E0              ldi R21,0
 026A 60E0              ldi R22,0
 026C 70E0              ldi R23,0
 026E 40904D01          lds R4,_OSCtxSwCtr+2
 0272 50904E01          lds R5,_OSCtxSwCtr+2+1
 0276 20904B01          lds R2,_OSCtxSwCtr
 027A 30904C01          lds R3,_OSCtxSwCtr+1
 027E 240E              add R2,R20
 0280 351E              adc R3,R21
 0282 461E              adc R4,R22
 0284 571E              adc R5,R23
 0286 30924C01          sts _OSCtxSwCtr+1,R3
 028A 20924B01          sts _OSCtxSwCtr,R2
 028E 50924E01          sts _OSCtxSwCtr+2+1,R5
 0292 40924D01          sts _OSCtxSwCtr+2,R4
 0296                   .dbline 312
 0296           ;             OSIntCtxSw();                              /* Perform interrupt level context switch       */
 0296 00D0              rcall _OSIntCtxSw
 0298                   .dbline 313
 0298           ;         }
 0298           L31:
 0298                   .dbline 314
 0298           ;     }
 0298           L29:
 0298                   .dbline 315
 0298           ;     OS_EXIT_CRITICAL();
 0298 0A2D              mov R16,R10
 029A 00D0              rcall _OS_CPU_SR_Restore
 029C                   .dbline -2
 029C           L26:
 029C 00D0              rcall pop_gset3
 029E                   .dbline 0 ; func end
 029E 0895              ret
 02A0                   .dbsym r cpu_sr 10 c
 02A0                   .dbend
 02A0                   .dbfunc e OSStart _OSStart fV
 02A0           ;              x -> R22
 02A0           ;              y -> R20
                        .even
 02A0           _OSStart::
 02A0 00D0              rcall push_gset2
 02A2                   .dbline -1
 02A2                   .dbline 413
 02A2                   .dbline 418
 02A2 20901B01          lds R2,_OSRunning
 02A6 2220              tst R2
 02A8 09F0              breq X2
 02AA 38C0              rjmp L34
 02AC           X2:
 02AC                   .dbline 418
 02AC                   .dbline 419
 02AC 80E0              ldi R24,<_OSUnMapTbl
 02AE 90E0              ldi R25,>_OSUnMapTbl
 02B0 E0911F01          lds R30,_OSRdyGrp
 02B4 FF27              clr R31
 02B6 E80F              add R30,R24
 02B8 F91F              adc R31,R25
 02BA 4491              lpm R20,Z
 02BC                   .dbline 420
 02BC 80E0              ldi R24,<_OSRdyTbl
 02BE 90E0              ldi R25,>_OSRdyTbl
 02C0 E42F              mov R30,R20
 02C2 FF27              clr R31
 02C4 E80F              add R30,R24
 02C6 F91F              adc R31,R25
 02C8 E081              ldd R30,z+0
 02CA FF27              clr R31
 02CC 80E0              ldi R24,<_OSUnMapTbl
 02CE 90E0              ldi R25,>_OSUnMapTbl
 02D0 E80F              add R30,R24
 02D2 F91F              adc R31,R25
 02D4 6491              lpm R22,Z
 02D6                   .dbline 421
 02D6 262E              mov R2,R22
 02D8 3324              clr R3
 02DA 442E              mov R4,R20
 02DC 5524              clr R5
 02DE 440C              lsl R4
 02E0 551C              rol R5
 02E2 440C              lsl R4
 02E4 551C              rol R5
 02E6 440C              lsl R4
 02E8 551C              rol R5
 02EA 420C              add R4,R2
 02EC 531C              adc R5,R3
 02EE 40922001          sts _OSPrioHighRdy,R4
 02F2                   .dbline 422
 02F2 242C              mov R2,R4
 02F4 20922101          sts _OSPrioCur,R2
 02F8                   .dbline 423
 02F8 82E0              ldi R24,2
 02FA 829D              mul R24,R2
 02FC F001              movw R30,R0
 02FE 80E0              ldi R24,<_OSTCBPrioTbl
 0300 90E0              ldi R25,>_OSTCBPrioTbl
 0302 E80F              add R30,R24
 0304 F91F              adc R31,R25
 0306 2080              ldd R2,z+0
 0308 3180              ldd R3,z+1
 030A 30929100          sts _OSTCBHighRdy+1,R3
 030E 20929000          sts _OSTCBHighRdy,R2
 0312                   .dbline 424
 0312 30929500          sts _OSTCBCur+1,R3
 0316 20929400          sts _OSTCBCur,R2
 031A                   .dbline 425
 031A 00D0              rcall _OSStartHighRdy
 031C                   .dbline 426
 031C           L34:
 031C                   .dbline -2
 031C           L33:
 031C 00D0              rcall pop_gset2
 031E                   .dbline 0 ; func end
 031E 0895              ret
 0320                   .dbsym r x 22 c
 0320                   .dbsym r y 20 c
 0320                   .dbend
 0320                   .dbfunc e OSTimeTick _OSTimeTick fV
 0320           ;         cpu_sr -> R10
 0320           ;           ptcb -> R12,R13
                        .even
 0320           _OSTimeTick::
 0320 00D0              rcall push_gset4
 0322                   .dbline -1
 0322                   .dbline 484
 0322           ; }
 0322           ; /*$PAGE*/
 0322           ; /*
 0322           ; *********************************************************************************************************
 0322           ; *                                          PREVENT SCHEDULING
 0322           ; *
 0322           ; * Description: This function is used to prevent rescheduling to take place.  This allows your application
 0322           ; *              to prevent context switches until you are ready to permit context switching.
 0322           ; *
 0322           ; * Arguments  : none
 0322           ; *
 0322           ; * Returns    : none
 0322           ; *
 0322           ; * Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
 0322           ; *                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
 0322           ; *********************************************************************************************************
 0322           ; */
 0322           ; 
 0322           ; #if OS_SCHED_LOCK_EN > 0
 0322           ; void  OSSchedLock (void)
 0322           ; {
 0322           ; #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
 0322           ;     OS_CPU_SR  cpu_sr;
 0322           ; #endif    
 0322           ;     
 0322           ;     
 0322           ;     if (OSRunning == TRUE) {                     /* Make sure multitasking is running                  */
 0322           ;         OS_ENTER_CRITICAL();
 0322           ;         if (OSLockNesting < 255) {               /* Prevent OSLockNesting from wrapping back to 0      */
 0322           ;             OSLockNesting++;                     /* Increment lock nesting level                       */
 0322           ;         }
 0322           ;         OS_EXIT_CRITICAL();
 0322           ;     }
 0322           ; }
 0322           ; #endif    
 0322           ; 
 0322           ; /*$PAGE*/
 0322           ; /*
 0322           ; *********************************************************************************************************
 0322           ; *                                          ENABLE SCHEDULING
 0322           ; *
 0322           ; * Description: This function is used to re-allow rescheduling.
 0322           ; *
 0322           ; * Arguments  : none
 0322           ; *
 0322           ; * Returns    : none
 0322           ; *
 0322           ; * Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
 0322           ; *                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
 0322           ; *********************************************************************************************************
 0322           ; */
 0322           ; 
 0322           ; #if OS_SCHED_LOCK_EN > 0
 0322           ; void  OSSchedUnlock (void)
 0322           ; {
 0322           ; #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
 0322           ;     OS_CPU_SR  cpu_sr;
 0322           ; #endif    
 0322           ;     
 0322           ;     
 0322           ;     if (OSRunning == TRUE) {                                   /* Make sure multitasking is running    */
 0322           ;         OS_ENTER_CRITICAL();
 0322           ;         if (OSLockNesting > 0) {                               /* Do not decrement if already 0        */
 0322           ;             OSLockNesting--;                                   /* Decrement lock nesting level         */
 0322           ;             if ((OSLockNesting == 0) && (OSIntNesting == 0)) { /* See if sched. enabled and not an ISR */
 0322           ;                 OS_EXIT_CRITICAL();
 0322           ;                 OS_Sched();                                    /* See if a HPT is ready                */
 0322           ;             } else {
 0322           ;                 OS_EXIT_CRITICAL();
 0322           ;             }
 0322           ;         } else {
 0322           ;             OS_EXIT_CRITICAL();
 0322           ;         }
 0322           ;     }
 0322           ; }
 0322           ; #endif    
 0322           ; 
 0322           ; /*$PAGE*/
 0322           ; /*
 0322           ; *********************************************************************************************************
 0322           ; *                                          START MULTITASKING
 0322           ; *
 0322           ; * Description: This function is used to start the multitasking process which lets uC/OS-II manages the
 0322           ; *              task that you have created.  Before you can call OSStart(), you MUST have called OSInit()
 0322           ; *              and you MUST have created at least one task.
 0322           ; *
 0322           ; * Arguments  : none
 0322           ; *
 0322           ; * Returns    : none
 0322           ; *
 0322           ; * Note       : OSStartHighRdy() MUST:
 0322           ; *                 a) Call OSTaskSwHook() then,
 0322           ; *                 b) Set OSRunning to TRUE.
 0322           ; *********************************************************************************************************
 0322           ; */
 0322           ; 
 0322           ; void  OSStart (void)
 0322           ; {
 0322           ;     INT8U y;
 0322           ;     INT8U x;
 0322           ; 
 0322           ; 

⌨️ 快捷键说明

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