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

📄 test.lst

📁 ucos在mage128上的应用
💻 LST
📖 第 1 页 / 共 5 页
字号:
    0151 93E00314  STS	_OSIntExitY,R30
(0337)                 OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
    0153 E08E      LDI	R24,0xE
    0154 E093      LDI	R25,3
    0155 940E0A88  CALL	0xA88
    0157 9024      LPM	R2,0(Z)
    0158 2433      CLR	R3
    0159 90400314  LDS	R4,_OSIntExitY
    015B 940E0A9E  CALL	0xA9E
(0338)                 if (OSPrioHighRdy != OSPrioCur) {          /* No Ctx Sw if current task is highest rdy */
    015D 90200312  LDS	R2,_OSPrioCur
    015F 1442      CP	R4,R2
    0160 F409      BNE	0x0162
    0161 C003      RJMP	0x0165
(0339)                     OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
    0162 940E0A22  CALL	0xA22
(0340) #if OS_TASK_PROFILE_EN > 0
(0341)                     OSTCBHighRdy->OSTCBCtxSwCtr++;         /* Inc. # of context switches to this task  */
(0342) #endif
(0343)                     OSCtxSwCtr++;                          /* Keep track of the number of ctx switches */
(0344)                     OSIntCtxSw();                          /* Perform interrupt level ctx switch       */
    0164 D19F      RCALL	0x0304
(0345)                 }
(0346)             }
(0347)         }
(0348)         OS_EXIT_CRITICAL();
    0165 2D0A      MOV	R16,R10
    0166 D11B      RCALL	0x0282
(0349)     }
(0350) }
    0167 940E09D2  CALL	pop_gset3
    0169 9508      RET
    016A 940E0B31  CALL	0xB31
(0351) /*$PAGE*/
(0352) /*
(0353) *********************************************************************************************************
(0354) *                                          PREVENT SCHEDULING
(0355) *
(0356) * Description: This function is used to prevent rescheduling to take place.  This allows your application
(0357) *              to prevent context switches until you are ready to permit context switching.
(0358) *
(0359) * Arguments  : none
(0360) *
(0361) * Returns    : none
(0362) *
(0363) * Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
(0364) *                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
(0365) *********************************************************************************************************
(0366) */
(0367) 
(0368) #if OS_SCHED_LOCK_EN > 0
(0369) void  OSSchedLock (void)
(0370) {
(0371) #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
(0372)     OS_CPU_SR  cpu_sr;
(0373) #endif    
(0374)     
(0375)     
(0376)     if (OSRunning == TRUE) {                     /* Make sure multitasking is running                  */
_OSSchedLock:
  cpu_sr               --> R20
    016C F459      BNE	0x0178
(0377)         OS_ENTER_CRITICAL();
    016D D111      RCALL	0x027F
    016E 2F40      MOV	R20,R16
(0378)         if (OSLockNesting < 255u) {              /* Prevent OSLockNesting from wrapping back to 0      */
    016F 91800313  LDS	R24,_OSLockNesting
    0171 3F8F      CPI	R24,0xFF
    0172 F418      BCC	0x0176
(0379)             OSLockNesting++;                     /* Increment lock nesting level                       */
    0173 5F8F      SUBI	R24,0xFF
    0174 93800313  STS	_OSLockNesting,R24
(0380)         }
(0381)         OS_EXIT_CRITICAL();
    0176 2F04      MOV	R16,R20
    0177 D10A      RCALL	0x0282
(0382)     }
(0383) }
    0178 940E09DB  CALL	pop_gset1
    017A 9508      RET
    017B 940E0B31  CALL	0xB31
(0384) #endif    
(0385) 
(0386) /*$PAGE*/
(0387) /*
(0388) *********************************************************************************************************
(0389) *                                          ENABLE SCHEDULING
(0390) *
(0391) * Description: This function is used to re-allow rescheduling.
(0392) *
(0393) * Arguments  : none
(0394) *
(0395) * Returns    : none
(0396) *
(0397) * Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
(0398) *                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
(0399) *********************************************************************************************************
(0400) */
(0401) 
(0402) #if OS_SCHED_LOCK_EN > 0
(0403) void  OSSchedUnlock (void)
(0404) {
(0405) #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
(0406)     OS_CPU_SR  cpu_sr;
(0407) #endif    
(0408)     
(0409)     
(0410)     if (OSRunning == TRUE) {                                   /* Make sure multitasking is running    */
_OSSchedUnlock:
  cpu_sr               --> R20
    017D F4E1      BNE	0x019A
(0411)         OS_ENTER_CRITICAL();
    017E D100      RCALL	0x027F
    017F 2F40      MOV	R20,R16
(0412)         if (OSLockNesting > 0) {                               /* Do not decrement if already 0        */
    0180 2422      CLR	R2
    0181 90300313  LDS	R3,_OSLockNesting
    0183 1423      CP	R2,R3
    0184 F498      BCC	0x0198
(0413)             OSLockNesting--;                                   /* Decrement lock nesting level         */
    0185 2D83      MOV	R24,R3
    0186 5081      SUBI	R24,1
    0187 93800313  STS	_OSLockNesting,R24
(0414)             if (OSLockNesting == 0) {                          /* See if scheduler is enabled and ...  */
    0189 2388      TST	R24
    018A F451      BNE	0x0195
(0415)                 if (OSIntNesting == 0) {                       /* ... not in an ISR                    */
    018B 90200315  LDS	R2,_OSIntNesting
    018D 2022      TST	R2
    018E F419      BNE	0x0192
(0416)                     OS_EXIT_CRITICAL();
    018F D0F2      RCALL	0x0282
(0417)                     OS_Sched();                                /* See if a HPT is ready                */
    0190 D21A      RCALL	_OS_Sched
(0418)                 } else {
    0191 C008      RJMP	0x019A
(0419)                     OS_EXIT_CRITICAL();
    0192 2F04      MOV	R16,R20
    0193 D0EE      RCALL	0x0282
(0420)                 }
(0421)             } else {
    0194 C005      RJMP	0x019A
(0422)                 OS_EXIT_CRITICAL();
    0195 2F04      MOV	R16,R20
    0196 D0EB      RCALL	0x0282
(0423)             }
(0424)         } else {
    0197 C002      RJMP	0x019A
(0425)             OS_EXIT_CRITICAL();
    0198 2F04      MOV	R16,R20
    0199 D0E8      RCALL	0x0282
(0426)         }
(0427)     }
(0428) }
    019A 940E09DB  CALL	pop_gset1
    019C 9508      RET
_OSStart:
  x                    --> R22
  y                    --> R20
    019D 940E09EF  CALL	push_gset2
(0429) #endif    
(0430) 
(0431) /*$PAGE*/
(0432) /*
(0433) *********************************************************************************************************
(0434) *                                          START MULTITASKING
(0435) *
(0436) * Description: This function is used to start the multitasking process which lets uC/OS-II manages the
(0437) *              task that you have created.  Before you can call OSStart(), you MUST have called OSInit()
(0438) *              and you MUST have created at least one task.
(0439) *
(0440) * Arguments  : none
(0441) *
(0442) * Returns    : none
(0443) *
(0444) * Note       : OSStartHighRdy() MUST:
(0445) *                 a) Call OSTaskSwHook() then,
(0446) *                 b) Set OSRunning to TRUE.
(0447) *                 c) Load the context of the task pointed to by OSTCBHighRdy.
(0448) *                 d_ Execute the task.
(0449) *********************************************************************************************************
(0450) */
(0451) 
(0452) void  OSStart (void)
(0453) {
(0454)     INT8U y;
(0455)     INT8U x;
(0456) 
(0457) 
(0458)     if (OSRunning == FALSE) {
    019F 9020030D  LDS	R2,_OSRunning
    01A1 2022      TST	R2
    01A2 F009      BEQ	0x01A4
    01A3 C020      RJMP	0x01C4
(0459)         y             = OSUnMapTbl[OSRdyGrp];        /* Find highest priority's task priority number   */
    01A4 940E0ACB  CALL	0xACB
    01A6 9144      LPM	R20,0(Z)
(0460)         x             = OSUnMapTbl[OSRdyTbl[y]];
    01A7 E08E      LDI	R24,0xE
    01A8 E093      LDI	R25,3
    01A9 2FE4      MOV	R30,R20
    01AA 940E0A88  CALL	0xA88
    01AC 9164      LPM	R22,0(Z)
(0461)         OSPrioHighRdy = (INT8U)((y << 3) + x);
    01AD 2E26      MOV	R2,R22
    01AE 2433      CLR	R3
    01AF 2E44      MOV	R4,R20
    01B0 940E0A9E  CALL	0xA9E
(0462)         OSPrioCur     = OSPrioHighRdy;
    01B2 2C24      MOV	R2,R4
    01B3 92200312  STS	_OSPrioCur,R2
(0463)         OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy]; /* Point to highest priority task ready to run    */
    01B5 E082      LDI	R24,2
    01B6 9D82      MUL	R24,R2
    01B7 940E0A5C  CALL	0xA5C
    01B9 8020      LDD	R2,Z+0
    01BA 8031      LDD	R3,Z+1
    01BB 92300203  STS	_OSTCBHighRdy+1,R3
    01BD 92200202  STS	_OSTCBHighRdy,R2
(0464)         OSTCBCur      = OSTCBHighRdy;
    01BF 92300207  STS	_OSTCBCur+1,R3
    01C1 92200206  STS	_OSTCBCur,R2
(0465)         OSStartHighRdy();                            /* Execute target specific code to start task     */
    01C3 D0C0      RCALL	0x0284
(0466)     }
(0467) }
    01C4 940E09D0  CALL	pop_gset2
    01C6 9508      RET
_OSTimeTick:
  step                 --> R20
  cpu_sr               --> R20
  ptcb                 --> R22
    01C7 940E09EF  CALL	push_gset2
(0468) /*$PAGE*/
(0469) /*
(0470) *********************************************************************************************************
(0471) *                                        STATISTICS INITIALIZATION
(0472) *
(0473) * Description: This function is called by your application to establish CPU usage by first determining
(0474) *              how high a 32-bit counter would count to in 1 second if no other tasks were to execute
(0475) *              during that time.  CPU usage is then determined by a low priority task which keeps track
(0476) *              of this 32-bit counter every second but this time, with other tasks running.  CPU usage is
(0477) *              determined by:
(0478) *
(0479) *                                             OSIdleCtr
(0480) *                 CPU Usage (%) = 100 * (1 - ------------)
(0481) *                                            OSIdleCtrMax
(0482) *
(0483) * Arguments  : none
(0484) *
(0485) * Returns    : none
(0486) *********************************************************************************************************
(0487) */
(0488) 
(0489) #if OS_TASK_STAT_EN > 0
(0490) void  OSStatInit (void)
(0491) {
(0492) #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
(0493)     OS_CPU_SR  cpu_sr;
(0494) #endif    
(0495)     
(0496)     
(0497)     OSTimeDly(2);                                /* Synchronize with clock tick                        */
(0498)     OS_ENTER_CRITICAL();
(0499)     OSIdleCtr    = 0L;                           /* Clear idle counter                                 */
(0500)     OS_EXIT_CRITICAL();
(0501)     OSTimeDly(OS_TICKS_PER_SEC / 10);            /* Determine MAX. idle counter value for 1/10 second  */
(0502)     OS_ENTER_CRITICAL();
(0503)     OSIdleCtrMax = OSIdleCtr;                    /* Store maximum idle counter count in 1/10 second    */
(0504)     OSStatRdy    = TRUE;
(0505)     OS_EXIT_CRITICAL();
(0506) }
(0507) #endif
(0508) /*$PAGE*/
(0509) /*
(0510) *********************************************************************************************************
(0511) *                                         PROCESS SYSTEM TICK
(0512) *
(0513) * Description: This function is used to signal to uC/OS-II the occurrence of a 'system tick' (also known
(0514) *              as a 'clock tick').  This function should be called by the ticker ISR but, can also be
(0515) *              called by a high priority task.
(0516) *
(0517) * Arguments  : none
(0518) *
(0519) * Returns    : none
(0520) *********************************************************************************************************
(0521) */
(0522) 
(0523) void  OSTimeTick (void)
(0524) {
(0525) #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register     */
(0526)     OS_CPU_SR  cpu_sr;
(0527) #endif    
(0528)     OS_TCB    *ptcb;
(0529)     BOOLEAN    step;
(0530) 
(0531) 
(0532) #if OS_TIME_TICK_HOOK_EN > 0
(0533)     OSTimeTickHook();                                      /* Call user definable hook                     */
    01C9 940E0852  CALL	_OSTimeTickHook
(0534) #endif    
(0535) #if OS_TIME_GET_SET_EN > 0   
(0536)     OS_ENTER_CRITICAL();                                   /* Update the 32-bit tick counter               */
(0537)     OSTime++;
(0538)     OS_EXIT_CRITICAL();
(0539) #endif
(0540)     if (OSRunning == TRUE) {    
    01CB 9180030D  LDS	R24,_OSRunning
    01CD 3081      CPI	R24,1
    01CE F009      BEQ	0x01D0
    01CF C03D      RJMP	0x020D
(0541) #if OS_TICK_STEP_EN > 0
(0542)         switch (OSTickStepState) {                         /* Determine whether we need to process a tick  */
(0543)             case OS_TICK_STEP_DIS:                         /* Yes, stepping is disabled                    */
(0544)                  step = TRUE;
(0545)                  break;
(0546)         
(0547)             case OS_TICK_STEP_WAIT:                        /* No,  waiting for uC/OS-View to set ...       */
(0548)                  step = FALSE;                             /*      .. OSTickStepState to OS_TICK_STEP_ONCE */
(0549)                  break;
(0550) 
(0551)             case OS_TICK_STEP_ONCE:                        /* Yes, process tick once and wait for next ... */
(0552)                  step            = TRUE;                   /*      ... step command from uC/OS-View        */
(0553)                  OSTickStepState = OS_TICK_STEP_WAIT;
(0554)                  break;  

⌨️ 快捷键说明

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