📄 os_core.lst
字号:
594:OSsrc/os_core.c **** #endif
595:OSsrc/os_core.c **** if (OSRunning == TRUE) {
596:OSsrc/os_core.c **** #if OS_TICK_STEP_EN > 0
597:OSsrc/os_core.c **** switch (OSTickStepState) { /* Determine whether we need to process
598:OSsrc/os_core.c **** case OS_TICK_STEP_DIS: /* Yes, stepping is disabled
599:OSsrc/os_core.c **** step = TRUE;
600:OSsrc/os_core.c **** break;
601:OSsrc/os_core.c ****
602:OSsrc/os_core.c **** case OS_TICK_STEP_WAIT: /* No, waiting for uC/OS-View to set ..
603:OSsrc/os_core.c **** step = FALSE; /* .. OSTickStepState to OS_TICK_ST
604:OSsrc/os_core.c **** break;
605:OSsrc/os_core.c ****
606:OSsrc/os_core.c **** case OS_TICK_STEP_ONCE: /* Yes, process tick once and wait for n
607:OSsrc/os_core.c **** step = TRUE; /* ... step command from uC/OS-View
608:OSsrc/os_core.c **** OSTickStepState = OS_TICK_STEP_WAIT;
609:OSsrc/os_core.c **** break;
610:OSsrc/os_core.c ****
611:OSsrc/os_core.c **** default: /* Invalid case, correct situation
612:OSsrc/os_core.c **** step = TRUE;
613:OSsrc/os_core.c **** OSTickStepState = OS_TICK_STEP_DIS;
614:OSsrc/os_core.c **** break;
615:OSsrc/os_core.c **** }
616:OSsrc/os_core.c **** if (step == FALSE) { /* Return if waiting for step command
617:OSsrc/os_core.c **** return;
618:OSsrc/os_core.c **** }
619:OSsrc/os_core.c **** #endif
620:OSsrc/os_core.c **** ptcb = OSTCBList; /* Point at first TCB in TCB list
621:OSsrc/os_core.c **** while (ptcb->OSTCBPrio != OS_IDLE_PRIO) { /* Go through all TCBs in TCB list
622:OSsrc/os_core.c **** OS_ENTER_CRITICAL();
623:OSsrc/os_core.c **** if (ptcb->OSTCBDly != 0) { /* No, Delayed or waiting for event with
624:OSsrc/os_core.c **** if (--ptcb->OSTCBDly == 0) { /* Decrement nbr of ticks to end of dela
625:OSsrc/os_core.c **** /* Check for timeout
626:OSsrc/os_core.c **** if ((ptcb->OSTCBStat & OS_STAT_PEND_ANY) != OS_STAT_RDY) {
627:OSsrc/os_core.c **** ptcb->OSTCBStat &= ~OS_STAT_PEND_ANY; /* Yes, Clear status
628:OSsrc/os_core.c **** ptcb->OSTCBPendTO = TRUE; /* Indicate PEND tim
629:OSsrc/os_core.c **** } else {
630:OSsrc/os_core.c **** ptcb->OSTCBPendTO = FALSE;
631:OSsrc/os_core.c **** }
632:OSsrc/os_core.c ****
633:OSsrc/os_core.c **** if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { /* Is task suspended
634:OSsrc/os_core.c **** OSRdyGrp |= ptcb->OSTCBBitY; /* No, Make ready
635:OSsrc/os_core.c **** OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
636:OSsrc/os_core.c **** }
637:OSsrc/os_core.c **** }
638:OSsrc/os_core.c **** }
639:OSsrc/os_core.c **** ptcb = ptcb->OSTCBNext; /* Point at next TCB in TCB list
640:OSsrc/os_core.c **** OS_EXIT_CRITICAL();
641:OSsrc/os_core.c **** }
642:OSsrc/os_core.c **** }
643:OSsrc/os_core.c **** }
644:OSsrc/os_core.c **** /*$PAGE*/
645:OSsrc/os_core.c **** /*
646:OSsrc/os_core.c **** ***************************************************************************************************
647:OSsrc/os_core.c **** * GET VERSION
648:OSsrc/os_core.c **** *
649:OSsrc/os_core.c **** * Description: This function is used to return the version number of uC/OS-II. The returned value
650:OSsrc/os_core.c **** * corresponds to uC/OS-II's version number multiplied by 100. In other words, version
651:OSsrc/os_core.c **** * would be returned as 200.
652:OSsrc/os_core.c **** *
653:OSsrc/os_core.c **** * Arguments : none
654:OSsrc/os_core.c **** *
655:OSsrc/os_core.c **** * Returns : the version number of uC/OS-II multiplied by 100.
656:OSsrc/os_core.c **** ***************************************************************************************************
657:OSsrc/os_core.c **** */
658:OSsrc/os_core.c ****
659:OSsrc/os_core.c **** INT16U OSVersion (void)
660:OSsrc/os_core.c **** {
661:OSsrc/os_core.c **** return (OS_VERSION);
662:OSsrc/os_core.c **** }
663:OSsrc/os_core.c ****
664:OSsrc/os_core.c **** /*$PAGE*/
665:OSsrc/os_core.c **** /*
666:OSsrc/os_core.c **** ***************************************************************************************************
667:OSsrc/os_core.c **** * DUMMY FUNCTION
668:OSsrc/os_core.c **** *
669:OSsrc/os_core.c **** * Description: This function doesn't do anything. It is called by OSTaskDel().
670:OSsrc/os_core.c **** *
671:OSsrc/os_core.c **** * Arguments : none
672:OSsrc/os_core.c **** *
673:OSsrc/os_core.c **** * Returns : none
674:OSsrc/os_core.c **** ***************************************************************************************************
675:OSsrc/os_core.c **** */
676:OSsrc/os_core.c ****
677:OSsrc/os_core.c **** #if OS_TASK_DEL_EN > 0
678:OSsrc/os_core.c **** void OS_Dummy (void)
679:OSsrc/os_core.c **** {
680:OSsrc/os_core.c **** }
681:OSsrc/os_core.c **** #endif
682:OSsrc/os_core.c ****
683:OSsrc/os_core.c **** /*$PAGE*/
684:OSsrc/os_core.c **** /*
685:OSsrc/os_core.c **** ***************************************************************************************************
686:OSsrc/os_core.c **** * MAKE TASK READY TO RUN BASED ON EVENT OCCURING
687:OSsrc/os_core.c **** *
688:OSsrc/os_core.c **** * Description: This function is called by other uC/OS-II services and is used to ready a task that
689:OSsrc/os_core.c **** * waiting for an event to occur.
690:OSsrc/os_core.c **** *
691:OSsrc/os_core.c **** * Arguments : pevent is a pointer to the event control block corresponding to the event.
692:OSsrc/os_core.c **** *
693:OSsrc/os_core.c **** * msg is a pointer to a message. This pointer is used by message oriented servi
694:OSsrc/os_core.c **** * such as MAILBOXEs and QUEUEs. The pointer is not used when called by othe
695:OSsrc/os_core.c **** * service functions.
696:OSsrc/os_core.c **** *
697:OSsrc/os_core.c **** * msk is a mask that is used to clear the status byte of the TCB. For example,
698:OSsrc/os_core.c **** * OSSemPost() will pass OS_STAT_SEM, OSMboxPost() will pass OS_STAT_MBOX etc
699:OSsrc/os_core.c **** *
700:OSsrc/os_core.c **** * Returns : none
701:OSsrc/os_core.c **** *
702:OSsrc/os_core.c **** * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
703:OSsrc/os_core.c **** ***************************************************************************************************
704:OSsrc/os_core.c **** */
705:OSsrc/os_core.c **** #if OS_EVENT_EN
706:OSsrc/os_core.c **** INT8U OS_EventTaskRdy (OS_EVENT *pevent, void *msg, INT8U msk)
707:OSsrc/os_core.c **** {
708:OSsrc/os_core.c **** OS_TCB *ptcb;
709:OSsrc/os_core.c **** INT8U x;
710:OSsrc/os_core.c **** INT8U y;
711:OSsrc/os_core.c **** INT8U bitx;
712:OSsrc/os_core.c **** INT8U bity;
713:OSsrc/os_core.c **** INT8U prio;
714:OSsrc/os_core.c ****
715:OSsrc/os_core.c **** #ifndef ALL_IN_ROM
716:OSsrc/os_core.c **** y = OSUnMapTbl[pevent->OSEventGrp]; /* Find HPT waiting for message
717:OSsrc/os_core.c **** #else
718:OSsrc/os_core.c **** y = pgm_read_byte(OSUnMapTbl+pevent->OSEventGrp); /* Find HPT waiting fo
719:OSsrc/os_core.c **** #endif
720:OSsrc/os_core.c **** #ifndef ALL_IN_ROM
721:OSsrc/os_core.c **** bity = OSMapTbl[y];
722:OSsrc/os_core.c **** #else
723:OSsrc/os_core.c **** bity = pgm_read_byte(OSMapTbl+y);
724:OSsrc/os_core.c **** #endif
725:OSsrc/os_core.c **** #ifndef ALL_IN_ROM
726:OSsrc/os_core.c **** x = OSUnMapTbl[pevent->OSEventTbl[y]];
727:OSsrc/os_core.c **** #else
728:OSsrc/os_core.c **** x = pgm_read_byte(OSUnMapTbl+pevent->OSEventTbl[y]);
729:OSsrc/os_core.c **** #endif
730:OSsrc/os_core.c **** #ifndef ALL_IN_ROM
731:OSsrc/os_core.c **** bitx = OSMapTbl[x];
732:OSsrc/os_core.c **** #else
733:OSsrc/os_core.c **** bitx = pgm_read_byte(OSMapTbl+x);
734:OSsrc/os_core.c **** #endif
735:OSsrc/os_core.c **** prio = (INT8U)((y << 3) + x); /* Find priority of task getting the msg
736:OSsrc/os_core.c **** pevent->OSEventTbl[y] &= ~bitx; /* Remove this task from the waiting list
737:OSsrc/os_core.c **** if (pevent->OSEventTbl[y] == 0x00) {
738:OSsrc/os_core.c **** pevent->OSEventGrp &= ~bity; /* Clr group bit if this was only task pend
739:OSsrc/os_core.c **** }
740:OSsrc/os_core.c **** ptcb = OSTCBPrioTbl[prio]; /* Point to this task's OS_TCB
741:OSsrc/os_core.c **** ptcb->OSTCBDly = 0; /* Prevent OSTimeTick() from readying task
742:OSsrc/os_core.c **** ptcb->OSTCBEventPtr = (OS_EVENT *)0; /* Unlink ECB from this task
743:OSsrc/os_core.c **** #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
744:OSsrc/os_core.c **** ptcb->OSTCBMsg = msg; /* Send message directly to waiting task
745:OSsrc/os_core.c **** #else
746:OSsrc/os_core.c **** msg = msg; /* Prevent compiler warning if not used
747:OSsrc/os_core.c **** #endif
748:OSsrc/os_core.c **** ptcb->OSTCBPendTO = FALSE; /* Cancel 'any' timeout because of post
749:OSsrc/os_core.c **** ptcb->OSTCBStat &= ~msk; /* Clear bit associated with event type
750:OSsrc/os_core.c **** if (ptcb->OSTCBStat == OS_STAT_RDY) { /* See if task is ready (could be susp'd)
751:OSsrc/os_core.c **** OSRdyGrp |= bity; /* Put task in the ready to run list
752:OSsrc/os_core.c **** OSRdyTbl[y] |= bitx;
753:OSsrc/os_core.c **** }
754:OSsrc/os_core.c **** return (prio);
755:OSsrc/os_core.c **** }
756:OSsrc/os_core.c **** #endif
757:OSsrc/os_core.c **** /*$PAGE*/
758:OSsrc/os_core.c **** /*
759:OSsrc/os_core.c **** ***************************************************************************************************
760:OSsrc/os_core.c **** * MAKE TASK WAIT FOR EVENT TO OCCUR
761:OSsrc/os_core.c **** *
762:OSsrc/os_core.c **** * Description: This function is called by other uC/OS-II services to suspend a task because an even
763:OSsrc/os_core.c **** * not occurred.
764:OSsrc/os_core.c **** *
765:OSsrc/os_core.c **** * Arguments : pevent is a pointer to the event control block for which the task will be waiting
766:OSsrc/os_core.c **** *
767:OSsrc/os_core.c **** * Returns : none
768:OSsrc/os_core.c **** *
769:OSsrc/os_core.c **** * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
770:OSsrc/os_core.c **** ***************************************************************************************************
771:OSsrc/os_core.c **** */
772:OSsrc/os_core.c **** #if OS_EVENT_EN
773:OSsrc/os_core.c **** void OS_EventTaskWait (OS_EVENT *pevent)
774:OSsrc/os_core.c **** {
775:OSsrc/os_core.c **** INT8U y;
776:OSsrc/os_core.c ****
777:OSsrc/os_core.c ****
778:OSsrc/os_core.c **** OSTCBCur->OSTCBEventPtr = pevent; /* Store pointer to event control block in TCB
779:OSsrc/os_core.c **** y = OSTCBCur->OSTCBY; /* Task no longer ready
780:OSsrc/os_core.c **** OSRdyTbl[y] &= ~OSTCBCur->OSTCBBitX;
781:OSsrc/os_core.c **** if (OSRdyTbl[y] == 0x00) {
782:OSsrc/os_core.c **** OSRdyGrp &= ~OSTCBCur->OSTCBBitY; /* Clear event grp bit if this was only task pend
783:OSsrc/os_core.c **** }
784:OSsrc/os_core.c **** pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX; /* Put task in waiting li
785:OSsrc/os_core.c **** pevent->OSEventGrp |= OSTCBCur->OSTCBBitY;
786:OSsrc/os_core.c **** }
787:OSsrc/os_core.c **** #endif
788:OSsrc/os_core.c **** /*$PAGE*/
789:OSsrc/os_core.c **** /*
790:OSsrc/os_core.c **** ***************************************************************************************************
791:OSsrc/os_core.c **** * MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
792:OSsrc/os_core.c **** *
793:OSsrc/os_core.c **** * Description: This function is called by other uC/OS-II services to make a task ready to run becau
794:OSsrc/os_core.c **** * timeout occurred.
795:OSsrc/os_core.c **** *
796:OSsrc/os_core.c **** * Arguments : pevent is a pointer to the event control block which is readying a task.
797:OSsrc/os_core.c **** *
798:OSsrc/os_core.c **** * Returns : none
799:OSsrc/os_core.c **** *
800:OSsrc/os_core.c **** * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
801:OSsrc/os_core.c **** ***************************************************************************************************
802:OSsrc/os_core.c **** */
803:OSsrc/os_core.c **** #if OS_EVENT_EN
804:OSsrc/os_core.c **** void OS_EventTO (OS_EVENT *pevent)
805:OSsrc/os_core.c **** {
806:OSsrc/os_core.c **** INT8U y;
807:OSsrc/os_core.c ****
808:OSsrc/os_core.c ****
809:OSsrc/os_core.c **** y = OSTCBCur->OSTCBY;
810:OSsrc/os_core.c **** pevent->OSEventTbl[y] &= ~OSTCBCur->OSTCBBitX; /* Remove task from wait list
811:OSsrc/os_core.c **** if (pevent->OSEventTbl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -