📄 os_core.lst
字号:
413 {
414 return (OS_VERSION);
\ 01B6 3C40FC00 MOV #252,R12
415 }
\ 01BA 3041 RET
\ 01BC OS_Dummy:
416
417 /*$PAGE*/
418 /*
419 *********************************************************************************************************
420 * DUMMY FUNCTION
421 *
422 * Description: This function doesn't do anything. It is called by OSTaskDel().
423 *
424 * Arguments : none
425 *
426 * Returns : none
427 *********************************************************************************************************
428 */
429
430 #if OS_TASK_DEL_EN > 0
431 void OS_Dummy (void)
432 {
433 }
\ 01BC 3041 RET
\ 01BE OS_EventTaskRdy:
434 #endif
435
436 /*$PAGE*/
437 /*
438 *********************************************************************************************************
439 * MAKE TASK READY TO RUN BASED ON EVENT OCCURING
440 *
441 * Description: This function is called by other uC/OS-II services and is used to ready a task that was
442 * waiting for an event to occur.
443 *
444 * Arguments : pevent is a pointer to the event control block corresponding to the event.
445 *
446 * msg is a pointer to a message. This pointer is used by message oriented services
447 * such as MAILBOXEs and QUEUEs. The pointer is not used when called by other
448 * service functions.
449 *
450 * msk is a mask that is used to clear the status byte of the TCB. For example,
451 * OSSemPost() will pass OS_STAT_SEM, OSMboxPost() will pass OS_STAT_MBOX etc.
452 *
453 * Returns : none
454 *
455 * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
456 *********************************************************************************************************
457 */
458 #if OS_EVENT_EN > 0
459 INT8U OS_EventTaskRdy (OS_EVENT *pevent, void *msg, INT8U msk)
460 {
\ 01BE 0A12 PUSH R10
\ 01C0 0B12 PUSH R11
\ 01C2 0812 PUSH R8
\ 01C4 0912 PUSH R9
\ 01C6 0612 PUSH R6
\ 01C8 5F410C00 MOV.B 12(SP),R15
461 OS_TCB *ptcb;
462 INT8U x;
463 INT8U y;
464 INT8U bitx;
465 INT8U bity;
466 INT8U prio;
467
468
469 y = OSUnMapTbl[pevent->OSEventGrp]; /* Find highest prio. task waiting for message */
\ 01CC 5D4C0100 MOV.B 1(R12),R13
\ 01D0 5A4D0800 MOV.B OSUnMapTbl(R13),R10
470 bity = OSMapTbl[y];
\ 01D4 4D4A MOV.B R10,R13
\ 01D6 5B4D0000 MOV.B OSMapTbl(R13),R11
471 x = OSUnMapTbl[pevent->OSEventTbl[y]];
\ 01DA 4D4A MOV.B R10,R13
\ 01DC 0D5C ADD R12,R13
\ 01DE 5D4D0600 MOV.B 6(R13),R13
\ 01E2 594D0800 MOV.B OSUnMapTbl(R13),R9
472 bitx = OSMapTbl[x];
\ 01E6 4D49 MOV.B R9,R13
\ 01E8 584D0000 MOV.B OSMapTbl(R13),R8
473 prio = (INT8U)((y << 3) + x); /* Find priority of task getting the msg */
\ 01EC 4D4A MOV.B R10,R13
\ 01EE 4D5D ADD.B R13,R13
\ 01F0 4D5D ADD.B R13,R13
\ 01F2 4D5D ADD.B R13,R13
\ 01F4 4D59 ADD.B R9,R13
474 if ((pevent->OSEventTbl[y] &= ~bitx) == 0x00) { /* Remove this task from the waiting list */
\ 01F6 494A MOV.B R10,R9
\ 01F8 095C ADD R12,R9
\ 01FA 4648 MOV.B R8,R6
\ 01FC 76E3 XOR.B #-1,R6
\ 01FE C9F60600 AND.B R6,6(R9)
\ 0202 C9930600 CMP.B #0,6(R9)
\ 0206 0420 JNE (?0109)
475 pevent->OSEventGrp &= ~bity; /* Clr group bit if this was only task pending */
\ 0208 494B MOV.B R11,R9
\ 020A 79E3 XOR.B #-1,R9
\ 020C CCF90100 AND.B R9,1(R12)
\ 0210 ?0109:
476 }
477 ptcb = OSTCBPrioTbl[prio]; /* Point to this task's OS_TCB */
\ 0210 494D MOV.B R13,R9
\ 0212 0959 ADD R9,R9
\ 0214 1C495808 MOV OSTCBPrioTbl(R9),R12
478 ptcb->OSTCBDly = 0; /* Prevent OSTimeTick() from readying task */
\ 0218 8C431A00 MOV #0,26(R12)
479 ptcb->OSTCBEventPtr = (OS_EVENT *)0; /* Unlink ECB from this task */
\ 021C 8C431200 MOV #0,18(R12)
480 #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
481 ptcb->OSTCBMsg = msg; /* Send message directly to waiting task */
\ 0220 8C4E1400 MOV R14,20(R12)
482 #else
483 msg = msg; /* Prevent compiler warning if not used */
484 #endif
485 ptcb->OSTCBStat &= ~msk; /* Clear bit associated with event type */
\ 0224 7FE3 XOR.B #-1,R15
\ 0226 CCFF1C00 AND.B R15,28(R12)
486 if (ptcb->OSTCBStat == OS_STAT_RDY) { /* See if task is ready (could be susp'd) */
\ 022A CC931C00 CMP.B #0,28(R12)
\ 022E 0420 JNE (?0115)
487 OSRdyGrp |= bity; /* Put task in the ready to run list */
\ 0230 C2DB4704 BIS.B R11,&OSRdyGrp
488 OSRdyTbl[y] |= bitx;
\ 0234 CAD84804 BIS.B R8,OSRdyTbl(R10)
\ 0238 ?0115:
489 }
490 return (prio);
\ 0238 4C4D MOV.B R13,R12
491 }
\ 023A 3641 POP R6
\ 023C 3941 POP R9
\ 023E 3841 POP R8
\ 0240 3B41 POP R11
\ 0242 3A41 POP R10
\ 0244 3041 RET
\ 0246 OS_EventTaskWait:
492 #endif
493 /*$PAGE*/
494 /*
495 *********************************************************************************************************
496 * MAKE TASK WAIT FOR EVENT TO OCCUR
497 *
498 * Description: This function is called by other uC/OS-II services to suspend a task because an event has
499 * not occurred.
500 *
501 * Arguments : pevent is a pointer to the event control block for which the task will be waiting for.
502 *
503 * Returns : none
504 *
505 * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
506 *********************************************************************************************************
507 */
508 #if OS_EVENT_EN > 0
509 void OS_EventTaskWait (OS_EVENT *pevent)
510 {
511 OSTCBCur->OSTCBEventPtr = pevent; /* Store pointer to event control block in TCB */
\ 0246 1D425008 MOV &OSTCBCur,R13
\ 024A 8D4C1200 MOV R12,18(R13)
512 if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) { /* Task no longer ready */
\ 024E 1D425008 MOV &OSTCBCur,R13
\ 0252 5D4D1F00 MOV.B 31(R13),R13
\ 0256 1E425008 MOV &OSTCBCur,R14
\ 025A 5E4E2000 MOV.B 32(R14),R14
\ 025E 7EE3 XOR.B #-1,R14
\ 0260 CDFE4804 AND.B R14,OSRdyTbl(R13)
\ 0264 CD934804 CMP.B #0,OSRdyTbl(R13)
\ 0268 0720 JNE (?0121)
513 OSRdyGrp &= ~OSTCBCur->OSTCBBitY; /* Clear event grp bit if this was only task pending */
\ 026A 1D425008 MOV &OSTCBCur,R13
\ 026E 5D4D2100 MOV.B 33(R13),R13
\ 0272 7DE3 XOR.B #-1,R13
\ 0274 C2FD4704 AND.B R13,&OSRdyGrp
\ 0278 ?0121:
514 }
515 pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX; /* Put task in waiting list */
\ 0278 1D425008 MOV &OSTCBCur,R13
\ 027C 5D4D1F00 MOV.B 31(R13),R13
\ 0280 0D5C ADD R12,R13
\ 0282 1E425008 MOV &OSTCBCur,R14
\ 0286 DDDE2000 BIS.B 32(R14),6(R13)
\ 028A 0600
516 pevent->OSEventGrp |= OSTCBCur->OSTCBBitY;
\ 028C 1D425008 MOV &OSTCBCur,R13
\ 0290 DCDD2100 BIS.B 33(R13),1(R12)
\ 0294 0100
517 }
\ 0296 3041 RET
\ 0298 OS_EventTO:
518 #endif
519 /*$PAGE*/
520 /*
521 *********************************************************************************************************
522 * MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
523 *
524 * Description: This function is called by other uC/OS-II services to make a task ready to run because a
525 * timeout occurred.
526 *
527 * Arguments : pevent is a pointer to the event control block which is readying a task.
528 *
529 * Returns : none
530 *
531 * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
532 *********************************************************************************************************
533 */
534 #if OS_EVENT_EN > 0
535 void OS_EventTO (OS_EVENT *pevent)
536 {
537 if ((pevent->OSEventTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) {
\ 0298 1D425008 MOV &OSTCBCur,R13
\ 029C 5D4D1F00 MOV.B 31(R13),R13
\ 02A0 0D5C ADD R12,R13
\ 02A2 1E425008 MOV &OSTCBCur,R14
\ 02A6 5E4E2000 MOV.B 32(R14),R14
\ 02AA 7EE3 XOR.B #-1,R14
\ 02AC CDFE0600 AND.B R14,6(R13)
\ 02B0 CD930600 CMP.B #0,6(R13)
\ 02B4 0720 JNE (?0127)
538 pevent->OSEventGrp &= ~OSTCBCur->OSTCBBitY;
\ 02B6 1D425008 MOV &OSTCBCur,R13
\ 02BA 5D4D2100 MOV.B 33(R13),R13
\ 02BE 7DE3 XOR.B #-1,R13
\ 02C0 CCFD0100 AND.B R13,1(R12)
\ 02C4 ?0127:
539 }
540 OSTCBCur->OSTCBStat = OS_STAT_RDY; /* Set status to ready */
\ 02C4 1C425008 MOV &OSTCBCur,R12
\ 02C8 CC431C00 MOV.B #0,28(R12)
541 OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0; /* No longer waiting for event */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -