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

📄 os_core.lst

📁 uc/osII基于51单片机的时钟
💻 LST
📖 第 1 页 / 共 4 页
字号:
C51 COMPILER V7.06   OS_CORE                                                               03/04/2005 14:28:17 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE OS_CORE
OBJECT MODULE PLACED IN .\OS_CORE.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\uc_os_II\OS_CORE.C BROWSE DEBUG OBJECTEXTEND PRINT(.\OS_CORE.lst) OBJECT
                    -(.\OS_CORE.obj)

stmt level    source

   1          /*
   2          *********************************************************************************************************
   3          *                                                uC/OS-II
   4          *                                          The Real-Time Kernel
   5          *                                             CORE FUNCTIONS
   6          *
   7          *                        (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
   8          *                                           All Rights Reserved
   9          *
  10          *                                                  V2.00
  11          *
  12          * File : OS_CORE.C
  13          * By   : Jean J. Labrosse
  14          *********************************************************************************************************
  15          */
  16          
  17          #ifndef  OS_MASTER_FILE /* whether use inlcudes.h */
  18          #define  OS_GLOBALS
  19          #include "includes.h"
  20          #endif
  21          
  22          /*
  23          *********************************************************************************************************
  24          *                                         LOCAL GLOBAL VARIABLES
  25          *********************************************************************************************************
  26          */
  27                                                 
  28          static  INT8U   DT_XDATA        OSIntExitY;               /* Variable used by 'OSIntExit' to prevent using locals *
             -/
  29          
  30          static  OS_STK  DT_XDATA        OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE];       /* Idle       task stack              
             -*/
  31          
  32          #if     OS_TASK_STAT_EN
              static  OS_STK  DT_XDATA        OSTaskStatStk[OS_TASK_STAT_STK_SIZE];      /* Statistics task stack               
             -*/
              #endif
  35          
  36          static  OS_TCB  DT_XDATA        OSTCBTbl[OS_MAX_TASKS + OS_N_SYS_TASKS];   /* Table of TCBs                       
             -*/
  37          
  38          /*$PAGE*/
  39          /*
  40          *********************************************************************************************************
  41          *                              MAPPING TABLE TO MAP BIT POSITION TO BIT MASK
  42          *
  43          * Note: Index into table is desired bit position, 0..7
  44          *       Indexed value corresponds to bit mask
  45          *********************************************************************************************************
  46          */
  47          
  48          INT8U const     DT_XDATA        OSMapTbl[]   = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
  49          
  50          /*
C51 COMPILER V7.06   OS_CORE                                                               03/04/2005 14:28:17 PAGE 2   

  51          *********************************************************************************************************
  52          *                                       PRIORITY RESOLUTION TABLE
  53          *
  54          * Note: Index into table is bit pattern to resolve highest priority
  55          *       Indexed value corresponds to highest priority bit position (i.e. 0..7)
  56          *********************************************************************************************************
  57          */
  58          
  59          INT8U const     DT_XDATA        OSUnMapTbl[] = {
  60              0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  61              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  62              5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  63              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  64              6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  65              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  66              5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  67              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  68              7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  69              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  70              5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  71              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  72              6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  73              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  74              5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  75              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
  76          };
  77          
  78          /*$PAGE*/
  79          /*
  80          *********************************************************************************************************
  81          *                             MAKE TASK READY TO RUN BASED ON EVENT OCCURING
  82          *
  83          * Description: This function is called by other uC/OS-II services and is used to ready a task that was
  84          *              waiting for an event to occur.
  85          *
  86          * Arguments  : pevent    is a pointer to the event control block corresponding to the event.
  87          *
  88          *              msg       is a pointer to a message.  This pointer is used by message oriented services
  89          *                        such as MAILBOXEs and QUEUEs.  The pointer is not used when called by other
  90          *                        service functions.
  91          *
  92          *              msk       is a mask that is used to clear the status byte of the TCB.  For example,
  93          *                        OSSemPost() will pass OS_STAT_SEM, OSMboxPost() will pass OS_STAT_MBOX etc.
  94          *
  95          * Returns    : none
  96          *
  97          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
  98          *********************************************************************************************************
  99          */
 100          #if  (OS_Q_EN && (OS_MAX_QS >= 2)) || OS_MBOX_EN || OS_SEM_EN
              void  OSEventTaskRdy (OS_EVENT DT_XDATA * pevent, void DT_XDATA * msg, INT8U msk) REENTRANT
              {
                  OS_TCB DT_XDATA * ptcb;
                  INT8U   x;
                  INT8U   y;
                  INT8U   bitx;
                  INT8U   bity;
                  INT8U   prio;
              
              
                  y    = OSUnMapTbl[pevent->OSEventGrp];            /* Find highest prio. task waiting for message   */
                  bity = OSMapTbl[y];
C51 COMPILER V7.06   OS_CORE                                                               03/04/2005 14:28:17 PAGE 3   

                  x    = OSUnMapTbl[pevent->OSEventTbl[y]];
                  bitx = OSMapTbl[x];
                  prio = (INT8U)((y << 3) + x);                     /* Find priority of task getting the msg         */
                  if ((pevent->OSEventTbl[y] &= ~bitx) == 0) {      /* Remove this task from the waiting list        */
                      pevent->OSEventGrp &= ~bity;
                  }
                  ptcb                 =  OSTCBPrioTbl[prio];       /* Point to this task's OS_TCB                   */
                  ptcb->OSTCBDly       =  0;                        /* Prevent OSTimeTick() from readying task       */
                  ptcb->OSTCBEventPtr  = (OS_EVENT DT_XDATA *)0;             /* Unlink ECB from this task               
             -      */
              #if (OS_Q_EN && (OS_MAX_QS >= 2)) || OS_MBOX_EN
                  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;
                  }
              }
              #endif
 134          /*$PAGE*/
 135          /*
 136          *********************************************************************************************************
 137          *                                   MAKE TASK WAIT FOR EVENT TO OCCUR
 138          *
 139          * Description: This function is called by other uC/OS-II services to suspend a task because an event has
 140          *              not occurred.
 141          *
 142          * Arguments  : pevent   is a pointer to the event control block for which the task will be waiting for.
 143          *
 144          * Returns    : none
 145          *
 146          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 147          *********************************************************************************************************
 148          */
 149          #if  (OS_Q_EN && (OS_MAX_QS >= 2)) || OS_MBOX_EN || OS_SEM_EN
              void  OSEventTaskWait (OS_EVENT DT_XDATA * pevent) REENTRANT
              {
                  OSTCBCur->OSTCBEventPtr = pevent;            /* Store pointer to event control block in TCB        */
                  if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0) {      /* Task no longer ready      */
                      OSRdyGrp &= ~OSTCBCur->OSTCBBitY;
                  }
                  pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX;          /* Put task in waiting list  */
                  pevent->OSEventGrp                   |= OSTCBCur->OSTCBBitY;
              }
              #endif
 160          /*$PAGE*/
 161          /*
 162          *********************************************************************************************************
 163          *                              MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
 164          *
 165          * Description: This function is called by other uC/OS-II services to make a task ready to run because a
 166          *              timeout occurred.
 167          *
 168          * Arguments  : pevent   is a pointer to the event control block which is readying a task.
 169          *
 170          * Returns    : none
 171          *
 172          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
C51 COMPILER V7.06   OS_CORE                                                               03/04/2005 14:28:17 PAGE 4   

 173          *********************************************************************************************************
 174          */
 175          #if  (OS_Q_EN && (OS_MAX_QS >= 2)) || OS_MBOX_EN || OS_SEM_EN
              void  OSEventTO (OS_EVENT DT_XDATA * pevent) REENTRANT
              {
                  if ((pevent->OSEventTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0) {
                      pevent->OSEventGrp &= ~OSTCBCur->OSTCBBitY;
                  }
                  OSTCBCur->OSTCBStat     = OS_STAT_RDY;       /* Set status to ready                                */
                  OSTCBCur->OSTCBEventPtr = (OS_EVENT DT_XDATA *)0;     /* No longer waiting for event                  
             -      */
              }
              #endif
 185          /*$PAGE*/
 186          /*
 187          *********************************************************************************************************
 188          *                                 INITIALIZE EVENT CONTROL BLOCK'S WAIT LIST
 189          *
 190          * Description: This function is called by other uC/OS-II services to initialize the event wait list.
 191          *
 192          * Arguments  : pevent    is a pointer to the event control block allocated to the event.
 193          *
 194          * Returns    : none
 195          *
 196          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 197          *********************************************************************************************************
 198          */
 199          #if  (OS_Q_EN && (OS_MAX_QS >= 2)) || OS_MBOX_EN || OS_SEM_EN
              void  OSEventWaitListInit (OS_EVENT DT_XDATA * pevent) REENTRANT
              {
                  INT8U i;
                  
                  
                  pevent->OSEventGrp = 0x00;                   /* No task waiting on event                           */
                  for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
                      pevent->OSEventTbl[i] = 0x00;
                  }
              }
              #endif

⌨️ 快捷键说明

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