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

📄 os_core.lst

📁 成功的将UCOS操作系统
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V8.02   OS_CORE                                                               08/05/2007 21:31:18 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE OS_CORE
OBJECT MODULE PLACED IN .\Out File\OS_CORE.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Ucos Core\OS_CORE.C LARGE BROWSE ORDER NOAREGS DEBUG OBJECTEXTEND PRINT(.\O
                    -ut File\OS_CORE.lst) TABS(6) OBJECT(.\Out File\OS_CORE.obj)

line level    source

   1          /*
   2          *********************************************************************************************************
   3          *                                                uC/OS-II
   4          
   5          *                                          The Real-Time Kernel
   6          *                                             CORE FUNCTIONS
   7          *
   8          *                          (c) Copyright 1992-2001, Jean J. Labrosse, Weston, FL
   9          *                                           All Rights Reserved
  10          *
  11          * File : OS_CORE.C
  12          * By   : Jean J. Labrosse
  13          *********************************************************************************************************
  14          */
  15          #ifndef  OS_MASTER_FILE
  16          #define  OS_GLOBALS
  17          #include "Ucos Core\\includes.h"
  18          #endif
  19          /*
  20          *********************************************************************************************************
  21          *                              MAPPING TABLE TO MAP BIT POSITION TO BIT MASK
  22          *
  23          * Note: Index into table is desired bit position, 0..7
  24          *       Indexed value corresponds to bit mask
  25          *********************************************************************************************************
  26          */
  27          
  28          INT8U  const code OSMapTbl[]   = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
  29          
  30          /*
  31          *********************************************************************************************************
  32          *                                       PRIORITY RESOLUTION TABLE
  33          *
  34          * Note: Index into table is bit pattern to resolve highest priority
  35          *       Indexed value corresponds to highest priority bit position (i.e. 0..7)
  36          *********************************************************************************************************
  37          */
  38          
  39          INT8U  const code  OSUnMapTbl[] = {
  40              0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  41              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  42              5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  43              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  44              6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  45              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  46              5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  47              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  48              7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  49              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  50              5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  51              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  52              6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  53              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  54              5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
C51 COMPILER V8.02   OS_CORE                                                               08/05/2007 21:31:18 PAGE 2   

  55              4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
  56          };
  57          /*$PAGE*/
  58          /*
  59          *********************************************************************************************************
  60          *                                             INITIALIZATION
  61          *
  62          * Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
  63          *              creating any uC/OS-II object and, prior to calling OSStart().
  64          *
  65          * Arguments  : none
  66          *
  67          * Returns    : none
  68          *********************************************************************************************************
  69          */
  70          
  71          void  OSInit (void) KCREENTRANT
  72          {
  73   1          INT16U     i;
  74   1          INT8U     *prdytbl;
  75   1          OS_TCB    *ptcb1;
  76   1          OS_TCB    *ptcb2;
  77   1      #if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 1)
                  OS_EVENT  *pevent1;
                  OS_EVENT  *pevent2;
              #endif
  81   1      
  82   1      
  83   1      #if OS_VERSION >= 204
  84   1          OSInitHookBegin();                                           /* Call port specific initialization code
             -   */
  85   1      #endif
  86   1      
  87   1      #if OS_TIME_GET_SET_EN > 0   
                  OSTime        = 0L;                                          /* Clear the 32-bit system clock         
             -   */
              #endif
  90   1          OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter   
             -   */
  91   1          OSLockNesting = 0;                                           /* Clear the scheduling lock counter     
             -   */
  92   1          OSTaskCtr     = 0;                                           /* Clear the number of tasks             
             -   */
  93   1          OSRunning     = FALSE;                                       /* Indicate that multitasking not started
             -   */
  94   1          OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter         
             -   */
  95   1      #if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
                  OSIdleCtrRun  = 0L;
                  OSIdleCtrMax  = 0L;
                  OSStatRdy     = FALSE;                                       /* Statistic task is not ready           
             -   */
              #endif
 100   1          OSCtxSwCtr    = 0;                                           /* Clear the context switch counter      
             -   */
 101   1          OSRdyGrp      = 0x00;                                        /* Clear the ready list                  
             -   */
 102   1          prdytbl       = &OSRdyTbl[0];
 103   1          for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
 104   2              *prdytbl++ = 0x00;
 105   2          }
 106   1      
C51 COMPILER V8.02   OS_CORE                                                               08/05/2007 21:31:18 PAGE 3   

 107   1          OSPrioCur     = 0;
 108   1          OSPrioHighRdy = 0;
 109   1          OSTCBHighRdy  = (OS_TCB *)0;                                 /* TCB Initialization                    
             -   */
 110   1          OSTCBCur      = (OS_TCB *)0;
 111   1          OSTCBList     = (OS_TCB *)0;
 112   1          for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) {                 /* Clear the priority table              
             -   */
 113   2              OSTCBPrioTbl[i] = (OS_TCB *)0;
 114   2          }
 115   1          ptcb1 = &OSTCBTbl[0];
 116   1          ptcb2 = &OSTCBTbl[1];
 117   1          for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) {  /* Init. list of free TCBs               
             -   */
 118   2              ptcb1->OSTCBNext = ptcb2;
 119   2              ptcb1++;
 120   2              ptcb2++;
 121   2          }
 122   1          ptcb1->OSTCBNext = (OS_TCB *)0;                              /* Last OS_TCB                           
             -   */
 123   1          OSTCBFreeList    = &OSTCBTbl[0];
 124   1      
 125   1      #if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
                  #if OS_MAX_EVENTS == 1                                       
                  OSEventFreeList              = &OSEventTbl[0];               /* Only have ONE event control block     
             -   */
                  OSEventFreeList->OSEventType = OS_EVENT_TYPE_UNUSED;
                  OSEventFreeList->OSEventPtr  = (OS_EVENT *)0;
                  #else
                  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;
                      pevent1++;
                      pevent2++;
                  }
                  pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
                  pevent1->OSEventPtr  = (OS_EVENT *)0;
                  OSEventFreeList      = &OSEventTbl[0];
                  #endif
              #endif
 144   1      
 145   1      #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
                  OS_FlagInit();                                               /* Initialize the event flag structures  
             -   */
              #endif
 148   1      
 149   1      #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
                  OS_QInit();                                                  /* Initialize the message queue structure
             -s  */
              #endif
 152   1      
 153   1      #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
                  OS_MemInit();                                                /* Initialize the memory manager         
             -   */
              #endif
 156   1      
 157   1          /* ------------------------------------- CREATION OF 'IDLE' TASK -------------------------------------
             --- */
 158   1      #if OS_TASK_CREATE_EXT_EN > 0
C51 COMPILER V8.02   OS_CORE                                                               08/05/2007 21:31:18 PAGE 4   

                  #if OS_STK_GROWTH == 1
                  (void)OSTaskCreateExt(OS_TaskIdle,
                                        (void *)0,                                 /* No arguments passed to OS_TaskIdle
             -() */
                                        &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack                  
             -   */
                                        OS_IDLE_PRIO,                              /* Lowest priority level             
             -   */
                                        OS_TASK_IDLE_ID,
                                        &OSTaskIdleStk[0],                         /* Set Bottom-Of-Stack               
             -   */
                                        OS_TASK_IDLE_STK_SIZE,
                                        (void *)0,                                 /* No TCB extension                  
             -   */
                                        OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stac
             -k  */
                  #else
                  (void)OSTaskCreateExt(OS_TaskIdle,
                                        (void *)0,                                 /* No arguments passed to OS_TaskIdle
             -() */
                                        &OSTaskIdleStk[0],                         /* Set Top-Of-Stack                  
             -   */

⌨️ 快捷键说明

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