📄 os_core.lst
字号:
0064 89 PSHX
0065 9eee03 LDX 3,SP
0068 e60c LDA 12,X
006a 8c CLRH
006b 88 PULX
006c da0000 ORA @OSRdyTbl,X
006f d70000 STA @OSRdyTbl,X
505: } else { /* Yes, Leave 1 tick to prevent ... */
0072 2006 BRA L7A ;abs = 007a
0074 L74:
506: ptcb->OSTCBDly = 1; /* ... loosing the task when the ... */
0074 a601 LDA #1
0076 e707 STA 7,X
0078 6f06 CLR 6,X
007a L7A:
507: } /* ... suspension is removed. */
508: }
509: }
510: ptcb = ptcb->OSTCBNext; /* Point at next TCB in TCB list */
007a 9eee04 LDX 4,SP
007d 9ee603 LDA 3,SP
0080 87 PSHA
0081 8a PULH
0082 e603 LDA 3,X
0084 9ee704 STA 4,SP
0087 e602 LDA 2,X
0089 9ee703 STA 3,SP
511: OS_EXIT_CRITICAL();
008c 9b SEI
008d L8D:
008d 95 TSX
008e e602 LDA 2,X
0090 87 PSHA
0091 ee03 LDX 3,X
0093 8a PULH
0094 e609 LDA 9,X
0096 a10c CMP #12
0098 2683 BNE L1D ;abs = 001d
512: }
513: }
009a a704 AIS #4
009c 81 RTS
514: /*$PAGE*/
515: /*
516: *********************************************************************************************************
517: * GET VERSION
518: *
519: * Description: This function is used to return the version number of uC/OS-II. The returned value
520: * corresponds to uC/OS-II's version number multiplied by 100. In other words, version 2.00
521: * would be returned as 200.
522: *
523: * Arguments : none
524: *
525: * Returns : the version number of uC/OS-II multiplied by 100.
526: *********************************************************************************************************
527: */
528:
529: INT16U OSVersion (void)
530: {
Function: OSVersion
Source : F:\Workspace\MyProj\ucos-mc64\OS_CORE.C
Options : -Cni -La=%f.inc -Lasm=%n.lst -N -Os -Ou -Obfv -Oc -OiLib -Ol1 -Or
531: return (OS_VERSION);
0000 a6fb LDA #-5
0002 5f CLRX
532: }
0003 81 RTS
533:
534: /*$PAGE*/
535: /*
536: *********************************************************************************************************
537: * DUMMY FUNCTION
538: *
539: * Description: This function doesn't do anything. It is called by OSTaskDel().
540: *
541: * Arguments : none
542: *
543: * Returns : none
544: *********************************************************************************************************
545: */
546:
547: #if OS_TASK_DEL_EN > 0
548: void OS_Dummy (void)
549: {
550: }
551: #endif
552:
553: /*$PAGE*/
554: /*
555: *********************************************************************************************************
556: * MAKE TASK READY TO RUN BASED ON EVENT OCCURING
557: *
558: * Description: This function is called by other uC/OS-II services and is used to ready a task that was
559: * waiting for an event to occur.
560: *
561: * Arguments : pevent is a pointer to the event control block corresponding to the event.
562: *
563: * msg is a pointer to a message. This pointer is used by message oriented services
564: * such as MAILBOXEs and QUEUEs. The pointer is not used when called by other
565: * service functions.
566: *
567: * msk is a mask that is used to clear the status byte of the TCB. For example,
568: * OSSemPost() will pass OS_STAT_SEM, OSMboxPost() will pass OS_STAT_MBOX etc.
569: *
570: * Returns : none
571: *
572: * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
573: *********************************************************************************************************
574: */
575: #if OS_EVENT_EN > 0
576: INT8U OS_EventTaskRdy (OS_EVENT *pevent, void *msg, INT8U msk)
577: {
578: OS_TCB *ptcb;
579: INT8U x;
580: INT8U y;
581: INT8U bitx;
582: INT8U bity;
583: INT8U prio;
584:
585:
586: y = OSUnMapTbl[pevent->OSEventGrp]; /* Find highest prio. task waiting for message */
587: bity = OSMapTbl[y];
588: x = OSUnMapTbl[pevent->OSEventTbl[y]];
589: bitx = OSMapTbl[x];
590: prio = (INT8U)((y << 3) + x); /* Find priority of task getting the msg */
591: if ((pevent->OSEventTbl[y] &= ~bitx) == 0x00) { /* Remove this task from the waiting list */
592: pevent->OSEventGrp &= ~bity; /* Clr group bit if this was only task pending */
593: }
594: ptcb = OSTCBPrioTbl[prio]; /* Point to this task's OS_TCB */
595: ptcb->OSTCBDly = 0; /* Prevent OSTimeTick() from readying task */
596: ptcb->OSTCBEventPtr = (OS_EVENT *)0; /* Unlink ECB from this task */
597: #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
598: ptcb->OSTCBMsg = msg; /* Send message directly to waiting task */
599: #else
600: msg = msg; /* Prevent compiler warning if not used */
601: #endif
602: ptcb->OSTCBStat &= ~msk; /* Clear bit associated with event type */
603: if (ptcb->OSTCBStat == OS_STAT_RDY) { /* See if task is ready (could be susp'd) */
604: OSRdyGrp |= bity; /* Put task in the ready to run list */
605: OSRdyTbl[y] |= bitx;
606: }
607: return (prio);
608: }
609: #endif
610: /*$PAGE*/
611: /*
612: *********************************************************************************************************
613: * MAKE TASK WAIT FOR EVENT TO OCCUR
614: *
615: * Description: This function is called by other uC/OS-II services to suspend a task because an event has
616: * not occurred.
617: *
618: * Arguments : pevent is a pointer to the event control block for which the task will be waiting for.
619: *
620: * Returns : none
621: *
622: * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
623: *********************************************************************************************************
624: */
625: #if OS_EVENT_EN > 0
626: void OS_EventTaskWait (OS_EVENT *pevent)
627: {
628: OSTCBCur->OSTCBEventPtr = pevent; /* Store pointer to event control block in TCB */
629: if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) { /* Task no longer ready */
630: OSRdyGrp &= ~OSTCBCur->OSTCBBitY; /* Clear event grp bit if this was only task pending */
631: }
632: pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX; /* Put task in waiting list */
633: pevent->OSEventGrp |= OSTCBCur->OSTCBBitY;
634: }
635: #endif
636: /*$PAGE*/
637: /*
638: *********************************************************************************************************
639: * MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
640: *
641: * Description: This function is called by other uC/OS-II services to make a task ready to run because a
642: * timeout occurred.
643: *
644: * Arguments : pevent is a pointer to the event control block which is readying a task.
645: *
646: * Returns : none
647: *
648: * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
649: *********************************************************************************************************
650: */
651: #if OS_EVENT_EN > 0
652: void OS_EventTO (OS_EVENT *pevent)
653: {
654: if ((pevent->OSEventTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) {
655: pevent->OSEventGrp &= ~OSTCBCur->OSTCBBitY;
656: }
657: OSTCBCur->OSTCBStat = OS_STAT_RDY; /* Set status to ready */
658: OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0; /* No longer waiting for event */
659: }
660: #endif
661: /*$PAGE*/
662: /*
663: *********************************************************************************************************
664: * INITIALIZE EVENT CONTROL BLOCK'S WAIT LIST
665: *
666: * Description: This function is called by other uC/OS-II services to initialize the event wait list.
667: *
668: * Arguments : pevent is a pointer to the event control block allocated to the event.
669: *
670: * Returns : none
671: *
672: * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
673: *********************************************************************************************************
674: */
675: #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0) || (OS_SEM_EN > 0) || (OS_MUTEX_EN > 0)
676: void OS_EventWaitListInit (OS_EVENT *pevent)
677: {
678: INT8U *ptbl;
679:
680:
681: pevent->OSEventGrp = 0x00; /* No task waiting on event */
682: ptbl = &pevent->OSEventTbl[0];
683:
684: #if OS_EVENT_TBL_SIZE > 0
685: *ptbl++ = 0x00;
686: #endif
687:
688: #if OS_EVENT_TBL_SIZE > 1
689: *ptbl++ = 0x00;
690: #endif
691:
692: #if OS_EVENT_TBL_SIZE > 2
693: *ptbl++ = 0x00;
694: #endif
695:
696: #if OS_EVENT_TBL_SIZE > 3
697: *ptbl++ = 0x00;
698: #endif
699:
700: #if OS_EVENT_TBL_SIZE > 4
701: *ptbl++ = 0x00;
702: #endif
703:
704: #if OS_EVENT_TBL_SIZE > 5
705: *ptbl++ = 0x00;
706: #endif
707:
708: #if OS_EVENT_TBL_SIZE > 6
709: *ptbl++ = 0x00;
710: #endif
711:
712: #if OS_EVENT_TBL_SIZE > 7
713: *ptbl = 0x00;
714: #endif
715: }
716: #endif
717: /*$PAGE*/
718: /*
719: *********************************************************************************************************
720: * SCHEDULER
721: *
722: * Description: This function is called by other uC/OS-II services to determine whether a new, high
723: * priority task has been made ready to run. This function is invoked by TASK level code
724: * and is not used to reschedule tasks from ISRs (see OSIntExit() for ISR rescheduling).
725: *
726: * Arguments : none
727: *
728: * Returns : none
729: *
730: * Notes : 1) This function is INTERNAL to uC/OS-II and your application should not call it.
731: * 2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())
732: *********************************************************************************************************
733: */
734:
735: void OS_Sched (void)
736: {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -