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

📄 os_core.lst

📁 基于51单片机的ucos-iiC语言源代码2.0版本
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V8.02   OS_CORE                                                               06/22/2006 11:44:34 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE OS_CORE
OBJECT MODULE PLACED IN .\obj\OS_CORE.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE uCosii\OS_CORE.C LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\lst\OS_CORE.lst) O
                    -BJECT(.\obj\OS_CORE.obj)

line level    source

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

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

 107   1      
 108   1          OSPrioCur     = 0;
 109   1          OSPrioHighRdy = 0;
 110   1          OSTCBHighRdy  = (OS_TCB *)0;                                 /* TCB Initialization                    
             -   */
 111   1          OSTCBCur      = (OS_TCB *)0;
 112   1          OSTCBList     = (OS_TCB *)0;
 113   1          for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) {                 /* Clear the priority table              
             -   */
 114   2              OSTCBPrioTbl[i] = (OS_TCB *)0;
 115   2          }
 116   1          ptcb1 = &OSTCBTbl[0];
 117   1          ptcb2 = &OSTCBTbl[1];
 118   1          for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) {  /* Init. list of free TCBs               
             -   */
 119   2              ptcb1->OSTCBNext = ptcb2;
 120   2              ptcb1++;
 121   2              ptcb2++;
 122   2          }
 123   1          ptcb1->OSTCBNext = (OS_TCB *)0;                              /* Last OS_TCB                           
             -   */
 124   1          OSTCBFreeList    = &OSTCBTbl[0];
 125   1      
 126   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
 145   1      
 146   1      #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
                  OS_FlagInit();                                               /* Initialize the event flag structures  
             -   */
              #endif
 149   1      
 150   1      #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
                  OS_QInit();                                                  /* Initialize the message queue structure
             -s  */
              #endif
 153   1      
 154   1      #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
                  OS_MemInit();                                                /* Initialize the memory manager         
             -   */
              #endif
 157   1      
 158   1          /* ------------------------------------- CREATION OF 'IDLE' TASK -------------------------------------
             --- */
C51 COMPILER V8.02   OS_CORE                                                               06/22/2006 11:44:34 PAGE 4   

 159   1      #if OS_TASK_CREATE_EXT_EN > 0
                  #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 + -