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

📄 os_core.lst

📁 uCOS 嵌入式操作系统的改进版,增加了网络通讯.
💻 LST
📖 第 1 页 / 共 5 页
字号:
 856          *              msk       is a mask that is used to clear the status byte of the TCB.  For example,
 857          *                        OSSemPost() will pass OS_STAT_SEM, OSMboxPost() will pass OS_STAT_MBOX etc.
 858          *
 859          * Returns    : none
 860          *
 861          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 862          *********************************************************************************************************
 863          */
 864          #if OS_EVENT_EN > 0
 865          INT8U  OS_EventTaskRdy (OS_EVENT *pevent, void *msg, INT8U msk) reentrant //using 0
 866          {
 867   1          OS_TCB *ptcb;
 868   1          INT8U   x;
 869   1          INT8U   y;
 870   1          INT8U   bitx;
 871   1          INT8U   bity;
 872   1          INT8U   prio;
 873   1      
 874   1      
 875   1          y                      = OSUnMapTbl[pevent->OSEventGrp];   /* Find HPT waiting for message         */
C51 COMPILER V7.06   OS_CORE                                                               07/18/2003 11:05:56 PAGE 16  

 876   1          bity                   = OSMapTbl[y];
 877   1          x                      = OSUnMapTbl[pevent->OSEventTbl[y]];
 878   1          bitx                   = OSMapTbl[x];
 879   1          prio                   = (INT8U)((y << 3) + x);   /* Find priority of task getting the msg         */
 880   1          pevent->OSEventTbl[y] &= ~bitx;                   /* Remove this task from the waiting list        */
 881   1          if (pevent->OSEventTbl[y] == 0x00) {              
 882   2              pevent->OSEventGrp &= ~bity;                  /* Clr group bit if this was only task pending   */
 883   2          }
 884   1          ptcb                 =  OSTCBPrioTbl[prio];       /* Point to this task's OS_TCB                   */
 885   1          ptcb->OSTCBDly       =  0;                        /* Prevent OSTimeTick() from readying task       */
 886   1          ptcb->OSTCBEventPtr  = (OS_EVENT *)0;             /* Unlink ECB from this task                     */
 887   1      #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
 888   1          ptcb->OSTCBMsg       = msg;                       /* Send message directly to waiting task         */
 889   1      #else
                  msg                  = msg;                       /* Prevent compiler warning if not used          */
              #endif
 892   1          ptcb->OSTCBStat     &= ~msk;                      /* Clear bit associated with event type          */
 893   1          if (ptcb->OSTCBStat == OS_STAT_RDY) {             /* See if task is ready (could be susp'd)        */
 894   2              OSRdyGrp        |=  bity;                     /* Put task in the ready to run list             */
 895   2              OSRdyTbl[y]     |=  bitx;
 896   2          }
 897   1          return (prio);
 898   1      }
 899          #endif
 900          /*$PAGE*/
 901          /*
 902          *********************************************************************************************************
 903          *                                   MAKE TASK WAIT FOR EVENT TO OCCUR
 904          *
 905          * Description: This function is called by other uC/OS-II services to suspend a task because an event has
 906          *              not occurred.
 907          *
 908          * Arguments  : pevent   is a pointer to the event control block for which the task will be waiting for.
 909          *
 910          * Returns    : none
 911          *
 912          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 913          *********************************************************************************************************
 914          */
 915          #if OS_EVENT_EN > 0
 916          void  OS_EventTaskWait (OS_EVENT *pevent) reentrant //using 0
 917          {
 918   1          INT8U  y;
 919   1      
 920   1      
 921   1          OSTCBCur->OSTCBEventPtr = pevent;            /* Store pointer to event control block in TCB        */
 922   1          y                       = OSTCBCur->OSTCBY;  /* Task no longer ready                               */
 923   1          OSRdyTbl[y]            &= ~OSTCBCur->OSTCBBitX;
 924   1          if (OSRdyTbl[y] == 0x00) {                   
 925   2              OSRdyGrp &= ~OSTCBCur->OSTCBBitY;        /* Clear event grp bit if this was only task pending  */
 926   2          }
 927   1          pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX;          /* Put task in waiting list  */
 928   1          pevent->OSEventGrp                   |= OSTCBCur->OSTCBBitY;
 929   1      }
 930          #endif
 931          /*$PAGE*/
 932          /*
 933          *********************************************************************************************************
 934          *                              MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
 935          *
 936          * Description: This function is called by other uC/OS-II services to make a task ready to run because a
 937          *              timeout occurred.
C51 COMPILER V7.06   OS_CORE                                                               07/18/2003 11:05:56 PAGE 17  

 938          *
 939          * Arguments  : pevent   is a pointer to the event control block which is readying a task.
 940          *
 941          * Returns    : none
 942          *
 943          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 944          *********************************************************************************************************
 945          */
 946          #if OS_EVENT_EN > 0
 947          void  OS_EventTO (OS_EVENT *pevent) reentrant //using 0
 948          {
 949   1          INT8U  y;
 950   1      
 951   1      
 952   1          y                      = OSTCBCur->OSTCBY;
 953   1          pevent->OSEventTbl[y] &= ~OSTCBCur->OSTCBBitX;
 954   1          if (pevent->OSEventTbl[y] == 0x00) {
 955   2              pevent->OSEventGrp &= ~OSTCBCur->OSTCBBitY;
 956   2          }
 957   1          OSTCBCur->OSTCBStat     = OS_STAT_RDY;       /* Set status to ready                                */
 958   1          OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;     /* No longer waiting for event                        */
 959   1      }
 960          #endif
 961          /*$PAGE*/
 962          /*
 963          *********************************************************************************************************
 964          *                                 INITIALIZE EVENT CONTROL BLOCK'S WAIT LIST
 965          *
 966          * Description: This function is called by other uC/OS-II services to initialize the event wait list.
 967          *
 968          * Arguments  : pevent    is a pointer to the event control block allocated to the event.
 969          *
 970          * Returns    : none
 971          *
 972          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 973          *********************************************************************************************************
 974          */
 975          #if OS_EVENT_EN > 0
 976          void  OS_EventWaitListInit (OS_EVENT *pevent) reentrant //using 0
 977          {
 978   1          INT8U  *ptbl;
 979   1      
 980   1      
 981   1          pevent->OSEventGrp = 0x00;                   /* No task waiting on event                           */
 982   1          ptbl               = &pevent->OSEventTbl[0];
 983   1      
 984   1      #if OS_EVENT_TBL_SIZE > 0
 985   1          *ptbl++            = 0x00;
 986   1      #endif
 987   1      
 988   1      #if OS_EVENT_TBL_SIZE > 1
 989   1          *ptbl++            = 0x00;
 990   1      #endif
 991   1      
 992   1      #if OS_EVENT_TBL_SIZE > 2
 993   1          *ptbl++            = 0x00;
 994   1      #endif
 995   1      
 996   1      #if OS_EVENT_TBL_SIZE > 3
 997   1          *ptbl++            = 0x00;
 998   1      #endif
 999   1      
C51 COMPILER V7.06   OS_CORE                                                               07/18/2003 11:05:56 PAGE 18  

1000   1      #if OS_EVENT_TBL_SIZE > 4
1001   1          *ptbl++            = 0x00;
1002   1      #endif
1003   1      
1004   1      #if OS_EVENT_TBL_SIZE > 5
1005   1          *ptbl++            = 0x00;
1006   1      #endif
1007   1      
1008   1      #if OS_EVENT_TBL_SIZE > 6
1009   1          *ptbl++            = 0x00;
1010   1      #endif
1011   1      
1012   1      #if OS_EVENT_TBL_SIZE > 7
1013   1          *ptbl              = 0x00;
1014   1      #endif
1015   1      }
1016          #endif
1017          /*$PAGE*/
1018          /*
1019          *********************************************************************************************************
1020          *                                             INITIALIZATION
1021          *                           INITIALIZE THE FREE LIST OF EVENT CONTROL BLOCKS
1022          *
1023          * Description: This function is called by OSInit() to initialize the free list of event control blocks.
1024          *
1025          * Arguments  : none
1026          *
1027          * Returns    : none
1028          *********************************************************************************************************
1029          */
1030          
1031          static  void  OS_InitEventList (void) reentrant //using 0
1032          {
1033   1      #if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
1034   1      #if (OS_MAX_EVENTS > 1)
1035   1          INT16U     i;
1036   1          OS_EVENT  *pevent1;
1037   1          OS_EVENT  *pevent2;
1038   1      
1039   1      
1040   1          (void)memset(&OSEventTbl[0], 0, sizeof(OSEventTbl));         /* Clear the event table                 
             -   */
1041   1          pevent1 = &OSEventTbl[0];
1042   1          pevent2 = &OSEventTbl[1];
1043   1          for (i = 0; i < (OS_MAX_EVENTS - 1); i++) {                  /* Init. list of free EVENT control block
             -s  */
1044   2              pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
1045   2              pevent1->OSEventPtr  = pevent2;
1046   2      #if OS_EVENT_NAME_SIZE > 0
1047   2              (void)strcpy(pevent1->OSEventName, "?");                 /* Unknown name                          
             -   */
1048   2      #endif
1049   2              pevent1++;
1050   2              pevent2++;
1051   2          }
1052   1          pevent1->OSEventType         = OS_EVENT_TYPE_UNUSED;
1053   1          pevent1->OSEventPtr          = (OS_EVENT *)0;
1054   1      #if OS_EVENT_NAME_SIZE > 0
1055   1          (void)strcpy(pevent1->OSEventName, "?");
1056   1      #endif
1057   1          OSEventFreeList              = &OSEventTbl[0];
1058   1      #else
C51 COMPILER V7.06   OS_CORE                                                               07/18/2003 11:05:56 PAGE 19  

                  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
1066   1      #endif
1067   1      }
1068          /*$PAGE*/
1069          /*
1070          *********************************************************************************************************
1071          *                                             INITIALIZATION
1072          *                                    INITIALIZE MISCELLANEOUS VARIABLES
1073          *
1074          * Description: This function is called by OSInit() to initialize miscellaneou

⌨️ 快捷键说明

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