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

📄 os_core.lst

📁 ucos v2.62 安装程序 附带已移植到C8051F020的UCOS源码
💻 LST
📖 第 1 页 / 共 5 页
字号:
              
                  y                      = OSUnMapTbl[pevent->OSEventGrp];   /* Find HPT waiting for message         */
                  bity                   = OSMapTbl[y];
                  x                      = OSUnMapTbl[pevent->OSEventTbl[y]];
                  bitx                   = OSMapTbl[x];
                  prio                   = (INT8U)((y << 3) + x);   /* Find priority of task getting the msg         */
                  pevent->OSEventTbl[y] &= ~bitx;                   /* Remove this task from the waiting list        */
                  if (pevent->OSEventTbl[y] == 0x00) {              
                      pevent->OSEventGrp &= ~bity;                  /* Clr group bit if this was only task pending   */
                  }
                  ptcb                 =  OSTCBPrioTbl[prio];       /* Point to this task's OS_TCB                   */
                  ptcb->OSTCBDly       =  0;                        /* Prevent OSTimeTick() from readying task       */
                  ptcb->OSTCBEventPtr  = (OS_EVENT *)0;             /* Unlink ECB from this task                     */
              #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
                  ptcb->OSTCBMsg       = msg;                       /* Send message directly to waiting task         */
              #else
                  msg                  = msg;                       /* Prevent compiler warning if not used          */
              #endif
                  ptcb->OSTCBStat     &= ~msk;                      /* Clear bit associated with event type          */
                  if (ptcb->OSTCBStat == OS_STAT_RDY) {             /* See if task is ready (could be susp'd)        */
                      OSRdyGrp        |=  bity;                     /* Put task in the ready to run list             */
                      OSRdyTbl[y]     |=  bitx;
                  }
                  return (prio);
              }
              #endif
 680          /*$PAGE*/ /* 
 681          /*
 682          *********************************************************************************************************
 683          *                                   MAKE TASK WAIT FOR EVENT TO OCCUR
 684          *
 685          * Description: This function is called by other uC/OS-II services to suspend a task because an event has
 686          *              not occurred.
 687          *
 688          * Arguments  : pevent   is a pointer to the event control block for which the task will be waiting for.
 689          *
 690          * Returns    : none
 691          *
 692          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 693          *********************************************************************************************************
 694          */
 695          #if OS_EVENT_EN > 0
              void  OS_EventTaskWait (OS_EVENT *pevent)KCREENTRANT    
              {
                  INT8U  y;
              
              
                  OSTCBCur->OSTCBEventPtr = pevent;            /* Store pointer to event control block in TCB        */
                  y                       = OSTCBCur->OSTCBY;  /* Task no longer ready                               */
                  OSRdyTbl[y]            &= ~OSTCBCur->OSTCBBitX;
                  if (OSRdyTbl[y] == 0x00) {                   
                      OSRdyGrp &= ~OSTCBCur->OSTCBBitY;        /* Clear event grp bit if this was only task pending  */
                  }
                  pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX;          /* Put task in waiting list  */
C51 COMPILER V8.05a   OS_CORE                                                              04/11/2007 16:19:49 PAGE 13  

                  pevent->OSEventGrp                   |= OSTCBCur->OSTCBBitY;
              }
              #endif
 711          /*$PAGE*/
 712          /*
 713          *********************************************************************************************************
 714          *                              MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
 715          *
 716          * Description: This function is called by other uC/OS-II services to make a task ready to run because a
 717          *              timeout occurred.
 718          *
 719          * Arguments  : pevent   is a pointer to the event control block which is readying a task.
 720          *
 721          * Returns    : none
 722          *
 723          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 724          *********************************************************************************************************
 725          */
 726          #if OS_EVENT_EN > 0
              void  OS_EventTO (OS_EVENT *pevent)     KCREENTRANT     
              {
                  INT8U  y;
              
              
                  y                      = OSTCBCur->OSTCBY;
                  pevent->OSEventTbl[y] &= ~OSTCBCur->OSTCBBitX;
                  if (pevent->OSEventTbl[y] == 0x00) {
                      pevent->OSEventGrp &= ~OSTCBCur->OSTCBBitY;
                  }
                  OSTCBCur->OSTCBStat     = OS_STAT_RDY;       /* Set status to ready                                */
                  OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;     /* No longer waiting for event                        */
              }
              #endif
 741          /*$PAGE*/
 742          /*
 743          *********************************************************************************************************
 744          *                                 INITIALIZE EVENT CONTROL BLOCK'S WAIT LIST
 745          *
 746          * Description: This function is called by other uC/OS-II services to initialize the event wait list.
 747          *
 748          * Arguments  : pevent    is a pointer to the event control block allocated to the event.
 749          *
 750          * Returns    : none
 751          *
 752          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 753          *********************************************************************************************************
 754          */
 755          #if OS_EVENT_EN > 0
              void  OS_EventWaitListInit (OS_EVENT *pevent) KCREENTRANT       
              {
                  INT8U  *ptbl;
              
              
                  pevent->OSEventGrp = 0x00;                   /* No task waiting on event                           */
                  ptbl               = &pevent->OSEventTbl[0];
              
              #if OS_EVENT_TBL_SIZE > 0
                  *ptbl++            = 0x00;
              #endif
              
              #if OS_EVENT_TBL_SIZE > 1
                  *ptbl++            = 0x00;
C51 COMPILER V8.05a   OS_CORE                                                              04/11/2007 16:19:49 PAGE 14  

              #endif
              
              #if OS_EVENT_TBL_SIZE > 2
                  *ptbl++            = 0x00;
              #endif
              
              #if OS_EVENT_TBL_SIZE > 3
                  *ptbl++            = 0x00;
              #endif
              
              #if OS_EVENT_TBL_SIZE > 4
                  *ptbl++            = 0x00;
              #endif
              
              #if OS_EVENT_TBL_SIZE > 5
                  *ptbl++            = 0x00;
              #endif
              
              #if OS_EVENT_TBL_SIZE > 6
                  *ptbl++            = 0x00;
              #endif
              
              #if OS_EVENT_TBL_SIZE > 7
                  *ptbl              = 0x00;
              #endif
              }
              #endif
 797          /*$PAGE*/
 798          /*
 799          *********************************************************************************************************
 800          *                                             INITIALIZATION
 801          *                           INITIALIZE THE FREE LIST OF EVENT CONTROL BLOCKS
 802          *
 803          * Description: This function is called by OSInit() to initialize the free list of event control blocks.
 804          *
 805          * Arguments  : none
 806          *
 807          * Returns    : none
 808          *********************************************************************************************************
 809          */
 810          
 811          static  void  OS_InitEventList (void)   
 812          {
 813   1      #if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
              #if (OS_MAX_EVENTS > 1)
                  INT16U     i;
                  OS_EVENT  *pevent1;
                  OS_EVENT  *pevent2;
              
              
                  (void)memset(&OSEventTbl[0], 0, sizeof(OSEventTbl));         /* Clear the event table                 
             -   */
                  pevent1 = &OSEventTbl[0];
                  pevent2 = &OSEventTbl[1];
                  for (i = 0; i < (OS_MAX_EVENTS - 1); i++) {                  /* Init. list of free EVENT control block
             -s  */
                      pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
                      pevent1->OSEventPtr  = pevent2;
              #if OS_EVENT_NAME_SIZE > 0
                      (void)strcpy(pevent1->OSEventName, "?");                 /* Unknown name                          
             -   */
              #endif
C51 COMPILER V8.05a   OS_CORE                                                              04/11/2007 16:19:49 PAGE 15  

                      pevent1++;
                      pevent2++;
                  }
                  pevent1->OSEventType         = OS_EVENT_TYPE_UNUSED;
                  pevent1->OSEventPtr          = (OS_EVENT *)0;
              #if OS_EVENT_NAME_SIZE > 0
                  (void)strcpy(pevent1->OSEventName, "?");
              #endif
                  OSEventFreeList              = &OSEventTbl[0];
              #else
                  OSEventFreeList              = &OSEventTbl[0];               /* Only have ONE event control block     
             -   */
                  OSEventFreeList->OSEventType = OS_EVENT_TYPE_UNUSED;
                  OSEventFreeList->OSEventPtr  = (OS_EVENT *)0;
              #if OS_EVENT_NAME_SIZE > 0
                  (void)strcpy(OSEventFreeList->OSEventName, "?");
              #endif
              #endif
              #endif
 847   1      }
 848          /*$PAGE*/
 849          /*
 850          *********************************************************************************************************
 851          *                                             INITIALIZATION
 852          *                                    INITIALIZE MISCELLANEOUS VARIABLES
 853          *
 854          * Description: This function is called by OSInit() to initialize miscellaneous variables.
 855          *
 856          * Arguments  : none
 857          *
 858          * Returns    : none
 859          *********************************************************************************************************
 860          */
 861          
 862          static  void  OS_InitMisc (void)
 863          {
 864   1      #if OS_TIME_GET_SET_EN > 0   
 865   1          OSTime        = 0L;                                          /* Clear the 32-bit system clock         
             -   */
 866   1      #endif
 867   1      
 868   1          OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter   
             -   */
 869   1          OSLockNesting = 0;                                           /* Clear the scheduling lock counter     
             -   */
 870   1      
 871   1          OSTaskCtr     = 0;                                           /* Clear the number of tasks             
             -   */
 872   1      
 873   1          OSRunning     = FALSE;                                       /* Indicate that multitasking not started
             -   */
 874   1          
 875   1          OSCtxSwCtr    = 0;                                           /* Clear the context switch counter      
             -   */

⌨️ 快捷键说明

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