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

📄 os_core.lst

📁 ucos v2.62 安装程序 附带已移植到C8051F020的UCOS源码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 876   1          OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter         
             -   */
 877   1      
 878   1      #if OS_TASK_STAT_EN > 0
                  OSIdleCtrRun  = 0L;
                  OSIdleCtrMax  = 0L;
                  OSStatRdy     = FALSE;                                       /* Statistic task is not ready           
             -   */
C51 COMPILER V8.05a   OS_CORE                                                              04/11/2007 16:19:49 PAGE 16  

              #endif
 883   1      }
 884          /*$PAGE*/
 885          /*
 886          *********************************************************************************************************
 887          *                                             INITIALIZATION
 888          *                                       INITIALIZE THE READY LIST
 889          *
 890          * Description: This function is called by OSInit() to initialize the Ready List.
 891          *
 892          * Arguments  : none
 893          *
 894          * Returns    : none
 895          *********************************************************************************************************
 896          */
 897          
 898          static  void  OS_InitRdyList (void)
 899          {
 900   1          INT16U   i;
 901   1          INT8U   *prdytbl;
 902   1      
 903   1      
 904   1          OSRdyGrp      = 0x00;                                        /* Clear the ready list                  
             -   */
 905   1          prdytbl       = &OSRdyTbl[0];
 906   1          for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
 907   2              *prdytbl++ = 0x00;
 908   2          }
 909   1      
 910   1          OSPrioCur     = 0;
 911   1          OSPrioHighRdy = 0;
 912   1      
 913   1          OSTCBHighRdy  = (OS_TCB *)0;                                 
 914   1          OSTCBCur      = (OS_TCB *)0;
 915   1      }
 916          
 917          /*$PAGE*/
 918          /*
 919          *********************************************************************************************************
 920          *                                             INITIALIZATION
 921          *                                         CREATING THE IDLE TASK
 922          *
 923          * Description: This function creates the Idle Task.
 924          *
 925          * Arguments  : none
 926          *
 927          * Returns    : none
 928          *********************************************************************************************************
 929          */
 930          
 931          static  void  OS_InitTaskIdle (void)
 932          {
 933   1      #if OS_TASK_CREATE_EXT_EN > 0
 934   1          #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,
C51 COMPILER V8.05a   OS_CORE                                                              04/11/2007 16:19:49 PAGE 17  

                                        &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
 945   1          (void)OSTaskCreateExt(OS_TaskIdle,
 946   1                                (void *)0,                                 /* No arguments passed to OS_TaskIdle
             -() */
 947   1                                &OSTaskIdleStk[0],                         /* Set Top-Of-Stack                  
             -   */
 948   1                                OS_IDLE_PRIO,                              /* Lowest priority level             
             -   */
 949   1                                OS_TASK_IDLE_ID,
 950   1                                &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Bottom-Of-Stack               
             -   */
 951   1                                OS_TASK_IDLE_STK_SIZE,
 952   1                                (void *)0,                                 /* No TCB extension                  
             -   */
 953   1                                OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stac
             -k  */
 954   1          #endif
 955   1      #else
                  #if OS_STK_GROWTH == 1
                  (void)OSTaskCreate(OS_TaskIdle,
                                     (void *)0,
                                     &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
                                     OS_IDLE_PRIO);
                  #else
                  (void)OSTaskCreate(OS_TaskIdle,
                                     (void *)0,
                                     &OSTaskIdleStk[0],
                                     OS_IDLE_PRIO);
                  #endif
              #endif
 968   1      }
 969          /*$PAGE*/
 970          /*
 971          *********************************************************************************************************
 972          *                                             INITIALIZATION
 973          *                                      CREATING THE STATISTIC TASK
 974          *
 975          * Description: This function creates the Statistic Task.
 976          *
 977          * Arguments  : none
 978          *
 979          * Returns    : none
 980          *********************************************************************************************************
 981          */
 982          
 983          #if OS_TASK_STAT_EN > 0
              static  void  OS_InitTaskStat (void)    
              {
              #if OS_TASK_CREATE_EXT_EN > 0
                  #if OS_STK_GROWTH == 1
                  (void)OSTaskCreateExt(OS_TaskStat,
                                        (void *)0,                                   /* No args passed to OS_TaskStat()*
             -/
                                        &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Top-Of-Stack               *
             -/
C51 COMPILER V8.05a   OS_CORE                                                              04/11/2007 16:19:49 PAGE 18  

                                        OS_STAT_PRIO,                                /* One higher than the idle task  *
             -/
                                        OS_TASK_STAT_ID,
                                        &OSTaskStatStk[0],                           /* Set Bottom-Of-Stack            *
             -/
                                        OS_TASK_STAT_STK_SIZE,
                                        (void *)0,                                   /* No TCB extension               *
             -/
                                        OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  *
             -/
                  #else
                  (void)OSTaskCreateExt(OS_TaskStat,
                                        (void *)0,                                   /* No args passed to OS_TaskStat()*
             -/
                                        &OSTaskStatStk[0],                           /* Set Top-Of-Stack               *
             -/
                                        OS_STAT_PRIO,                                /* One higher than the idle task  *
             -/
                                        OS_TASK_STAT_ID,
                                        &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Bottom-Of-Stack            *
             -/
                                        OS_TASK_STAT_STK_SIZE,
                                        (void *)0,                                   /* No TCB extension               *
             -/
                                        OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  *
             -/
                  #endif
              #else
                  #if OS_STK_GROWTH == 1
                  (void)OSTaskCreate(OS_TaskStat,
                                     (void *)0,                                      /* No args passed to OS_TaskStat()*
             -/
                                     &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],      /* Set Top-Of-Stack               *
             -/
                                     OS_STAT_PRIO);                                  /* One higher than the idle task  *
             -/
                  #else
                  (void)OSTaskCreate(OS_TaskStat,
                                     (void *)0,                                      /* No args passed to OS_TaskStat()*
             -/
                                     &OSTaskStatStk[0],                              /* Set Top-Of-Stack               *
             -/
                                     OS_STAT_PRIO);                                  /* One higher than the idle task  *
             -/
                  #endif
              #endif
              }
              #endif
1023          /*$PAGE*/
1024          /*
1025          *********************************************************************************************************
1026          *                                             INITIALIZATION
1027          *                            INITIALIZE THE FREE LIST OF TASK CONTROL BLOCKS
1028          *
1029          * Description: This function is called by OSInit() to initialize the free list of OS_TCBs.
1030          *
1031          * Arguments  : none
1032          *
1033          * Returns    : none
1034          *********************************************************************************************************
1035          */
1036          
C51 COMPILER V8.05a   OS_CORE                                                              04/11/2007 16:19:49 PAGE 19  

1037          static  void  OS_InitTCBList (void)
1038          {
1039   1          INT8U    i;
1040   1          OS_TCB  *ptcb1;
1041   1          OS_TCB  *ptcb2;
1042   1      
1043   1      
1044   1          (void)memset(&OSTCBTbl[0],     0, sizeof(OSTCBTbl));         /* Clear all the TCBs                  */
1045   1          (void)memset(&OSTCBPrioTbl[0], 0, sizeof(OSTCBPrioTbl));     /* Clear the priority table            */
1046   1          ptcb1 = &OSTCBTbl[0];
1047   1          ptcb2 = &OSTCBTbl[1];
1048   1          for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) {  /* Init. list of free TCBs             */
1049   2              ptcb1->OSTCBNext = ptcb2;
1050   2      #if OS_TASK_NAME_SIZE > 0
                      (void)strcpy(ptcb1->OSTCBTaskName, "?");                 /* Unknown name                        */
              #endif
1053   2              ptcb1++;
1054   2              ptcb2++;
1055   2          }
1056   1          ptcb1->OSTCBNext = (OS_TCB *)0;                              /* Last OS_TCB                         */
1057   1      #if OS_TASK_NAME_SIZE > 0
                  (void)strcpy(ptcb1->OSTCBTaskName, "?");
              #endif
1060   1          OSTCBList     = (OS_TCB *)0;                                 /* TCB lists initializations           */
1061   1          OSTCBFreeList = &OSTCBTbl[0];
1062   1      }
1063          /*$PAGE*/
1064          /*
1065          *********************************************************************************************************
1066          *                                              SCHEDULER
1067          *
1068          * Description: This function is called by other uC/OS-II services to determine whether a new, high
1069          *              priority task has been made ready to run.  This function is invoked by TASK level code
1070          *        

⌨️ 快捷键说明

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