📄 os_core.lst
字号:
\ 00E4 3041 RET
\ 00E6 ?0083:
266 OS_EXIT_CRITICAL();
\ 00E6 32D2 EINT
\ 00E8 ?0089:
267 }
268 }
269 }
\ 00E8 3041 RET
\ 00EA OSStart:
270 #endif
271
272 /*$PAGE*/
273 /*
274 *********************************************************************************************************
275 * START MULTITASKING
276 *
277 * Description: This function is used to start the multitasking process which lets uC/OS-II manages the
278 * task that you have created. Before you can call OSStart(), you MUST have called OSInit()
279 * and you MUST have created at least one task.
280 *
281 * Arguments : none
282 *
283 * Returns : none
284 *
285 * Note : OSStartHighRdy() MUST:
286 * a) Call OSTaskSwHook() then,
287 * b) Set OSRunning to TRUE.
288 * c) Load the context of the task pointed to by OSTCBHighRdy.
289 * d_ Execute the task.
290 *********************************************************************************************************
291 */
292
293 void OSStart (void)
294 {
295 INT8U y;
296 INT8U x;
297
298
299 if (OSRunning == FALSE) {
\ 00EA C2934A04 CMP.B #0,&OSRunning
\ 00EE 1D20 JNE (?0091)
300 y = OSUnMapTbl[OSRdyGrp]; /* Find highest priority's task priority number */
\ 00F0 5C424704 MOV.B &OSRdyGrp,R12
\ 00F4 5D4C0800 MOV.B OSUnMapTbl(R12),R13
301 x = OSUnMapTbl[OSRdyTbl[y]];
\ 00F8 4C4D MOV.B R13,R12
\ 00FA 5E4C4804 MOV.B OSRdyTbl(R12),R14
\ 00FE 5C4E0800 MOV.B OSUnMapTbl(R14),R12
302 OSPrioHighRdy = (INT8U)((y << 3) + x);
\ 0102 4D5D ADD.B R13,R13
\ 0104 4D5D ADD.B R13,R13
\ 0106 4D5D ADD.B R13,R13
\ 0108 4D5C ADD.B R12,R13
\ 010A C24D4604 MOV.B R13,&OSPrioHighRdy
303 OSPrioCur = OSPrioHighRdy;
\ 010E D2424604 MOV.B &OSPrioHighRdy,&OSPrioCur
\ 0112 4504
304 OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy]; /* Point to highest priority task ready to run */
\ 0114 5C424604 MOV.B &OSPrioHighRdy,R12
\ 0118 0C5C ADD R12,R12
\ 011A 924C5808 MOV OSTCBPrioTbl(R12),&OSTCBHighRdy
\ 011E 5408
305 OSTCBCur = OSTCBHighRdy;
\ 0120 92425408 MOV &OSTCBHighRdy,&OSTCBCur
\ 0124 5008
306 OSStartHighRdy(); /* Execute target specific code to start task */
\ 0126 B0120000 CALL #OSStartHighRdy
\ 012A ?0091:
307 }
308 }
\ 012A 3041 RET
\ 012C OSStatInit:
309 /*$PAGE*/
310 /*
311 *********************************************************************************************************
312 * STATISTICS INITIALIZATION
313 *
314 * Description: This function is called by your application to establish CPU usage by first determining
315 * how high a 32-bit counter would count to in 1 second if no other tasks were to execute
316 * during that time. CPU usage is then determined by a low priority task which keeps track
317 * of this 32-bit counter every second but this time, with other tasks running. CPU usage is
318 * determined by:
319 *
320 * OSIdleCtr
321 * CPU Usage (%) = 100 * (1 - ------------)
322 * OSIdleCtrMax
323 *
324 * Arguments : none
325 *
326 * Returns : none
327 *********************************************************************************************************
328 */
329
330 #if OS_TASK_STAT_EN > 0
331 void OSStatInit (void)
332 {
333 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
334 OS_CPU_SR cpu_sr;
335 #endif
336
337
338 OSTimeDly(2); /* Synchronize with clock tick */
\ 012C 2C43 MOV #2,R12
\ 012E B0120000 CALL #OSTimeDly
339 OS_ENTER_CRITICAL();
\ 0132 32C2 DINT
340 OSIdleCtr = 0L; /* Clear idle counter */
\ 0134 82434C04 MOV #0,&OSIdleCtr
\ 0138 82434E04 MOV #0,&(OSIdleCtr+2)
341 OS_EXIT_CRITICAL();
\ 013C 32D2 EINT
342 OSTimeDly(OS_TICKS_PER_SEC); /* Determine MAX. idle counter value for 1 second */
\ 013E 3C40C800 MOV #200,R12
\ 0142 B0120000 CALL #OSTimeDly
343 OS_ENTER_CRITICAL();
\ 0146 32C2 DINT
344 OSIdleCtrMax = OSIdleCtr; /* Store maximum idle counter count in 1 second */
\ 0148 92424C04 MOV &OSIdleCtr,&OSIdleCtrMax
\ 014C 3800
\ 014E 92424E04 MOV &(OSIdleCtr+2),&(OSIdleCtrMax+2)
\ 0152 3A00
345 OSStatRdy = TRUE;
\ 0154 D2434000 MOV.B #1,&OSStatRdy
346 OS_EXIT_CRITICAL();
\ 0158 32D2 EINT
347 }
\ 015A 3041 RET
\ 015C OSTimeTick:
348 #endif
349 /*$PAGE*/
350 /*
351 *********************************************************************************************************
352 * PROCESS SYSTEM TICK
353 *
354 * Description: This function is used to signal to uC/OS-II the occurrence of a 'system tick' (also known
355 * as a 'clock tick'). This function should be called by the ticker ISR but, can also be
356 * called by a high priority task.
357 *
358 * Arguments : none
359 *
360 * Returns : none
361 *********************************************************************************************************
362 */
363
364 void OSTimeTick (void)
365 {
366 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
367 OS_CPU_SR cpu_sr;
368 #endif
369 OS_TCB *ptcb;
370
371
372 OSTimeTickHook(); /* Call user definable hook */
\ 015C B0120000 CALL #OSTimeTickHook
373 #if OS_TIME_GET_SET_EN > 0
374 OS_ENTER_CRITICAL(); /* Update the 32-bit tick counter */
\ 0160 32C2 DINT
375 OSTime++;
\ 0162 9253B60A ADD #1,&OSTime
\ 0166 8263B80A ADDC #0,&(OSTime+2)
376 OS_EXIT_CRITICAL();
\ 016A 32D2 EINT
377 #endif
378 if (OSRunning == TRUE) {
\ 016C D2934A04 CMP.B #1,&OSRunning
\ 0170 2120 JNE (?0094)
379 ptcb = OSTCBList; /* Point at first TCB in TCB list */
\ 0172 1D425608 MOV &OSTCBList,R13
\ 0176 ?0095:
380 while (ptcb->OSTCBPrio != OS_IDLE_PRIO) { /* Go through all TCBs in TCB list */
\ 0176 FD900C00 CMP.B #12,29(R13)
\ 017A 1D00
\ 017C 1B24 JEQ (?0094)
381 OS_ENTER_CRITICAL();
\ 017E 32C2 DINT
382 if (ptcb->OSTCBDly != 0) { /* Delayed or waiting for event with TO */
\ 0180 8D931A00 CMP #0,26(R13)
\ 0184 1324 JEQ (?0103)
383 if (--ptcb->OSTCBDly == 0) { /* Decrement nbr of ticks to end of delay */
\ 0186 BD531A00 ADD #-1,26(R13)
\ 018A 8D931A00 CMP #0,26(R13)
\ 018E 0E20 JNE (?0103)
384 if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { /* Is task suspended? */
\ 0190 FDB21C00 BIT.B #8,28(R13)
\ 0194 0920 JNE (?0102)
385 OSRdyGrp |= ptcb->OSTCBBitY; /* No, Make task R-to-R (timed out)*/
\ 0196 D2DD2100 BIS.B 33(R13),&OSRdyGrp
\ 019A 4704
386 OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
\ 019C 5C4D1F00 MOV.B 31(R13),R12
\ 01A0 DCDD2000 BIS.B 32(R13),OSRdyTbl(R12)
\ 01A4 4804
387 } else { /* Yes, Leave 1 tick to prevent ... */
\ 01A6 023C JMP (?0103)
\ 01A8 ?0102:
388 ptcb->OSTCBDly = 1; /* ... loosing the task when the ... */
\ 01A8 9D431A00 MOV #1,26(R13)
\ 01AC ?0103:
389 } /* ... suspension is removed. */
390 }
391 }
392 ptcb = ptcb->OSTCBNext; /* Point at next TCB in TCB list */
\ 01AC 1D4D0E00 MOV 14(R13),R13
393 OS_EXIT_CRITICAL();
\ 01B0 32D2 EINT
394 }
395 }
\ 01B2 E13F JMP (?0095)
\ 01B4 ?0094:
396 }
\ 01B4 3041 RET
\ 01B6 OSVersion:
397 /*$PAGE*/
398 /*
399 *********************************************************************************************************
400 * GET VERSION
401 *
402 * Description: This function is used to return the version number of uC/OS-II. The returned value
403 * corresponds to uC/OS-II's version number multiplied by 100. In other words, version 2.00
404 * would be returned as 200.
405 *
406 * Arguments : none
407 *
408 * Returns : the version number of uC/OS-II multiplied by 100.
409 *********************************************************************************************************
410 */
411
412 INT16U OSVersion (void)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -