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

📄 os_core.lst

📁 uCOS-II_2.52在51上的移植程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
 652   1      
 653   1          OSTaskCtr     = 0;                                           /* Clear the number of tasks             
             -   */
 654   1      
 655   1          OSRunning     = FALSE;                                       /* Indicate that multitasking not started
             -   */
 656   1          
 657   1          OSCtxSwCtr    = 0;                                           /* Clear the context switch counter      
C51 COMPILER V7.50   OS_CORE                                                               08/08/2005 12:35:30 PAGE 12  

             -   */
 658   1          OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter         
             -   */
 659   1      
 660   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
 665   1      }
 666          /*$PAGE*/
 667          /*
 668          *********************************************************************************************************
 669          *                                             INITIALIZATION
 670          *                                       INITIALIZE THE READY LIST
 671          *
 672          * Description: This function is called by OSInit() to initialize the Ready List.
 673          *
 674          * Arguments  : none
 675          *
 676          * Returns    : none
 677          *********************************************************************************************************
 678          */
 679          
 680          static  void  OS_InitRdyList (void)
 681          {
 682   1          INT16U   i;
 683   1          INT8U   *prdytbl;
 684   1      
 685   1      
 686   1          OSRdyGrp      = 0x00;                                        /* Clear the ready list                  
             -   */
 687   1          prdytbl       = &OSRdyTbl[0];
 688   1          for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
 689   2              *prdytbl++ = 0x00;
 690   2          }
 691   1      
 692   1          OSPrioCur     = 0;
 693   1          OSPrioHighRdy = 0;
 694   1      
 695   1          OSTCBHighRdy  = (OS_TCB *)0;                                 
 696   1          OSTCBCur      = (OS_TCB *)0;
 697   1      }
 698          
 699          /*$PAGE*/
 700          /*
 701          *********************************************************************************************************
 702          *                                             INITIALIZATION
 703          *                                         CREATING THE IDLE TASK
 704          *
 705          * Description: This function creates the Idle Task.
 706          *
 707          * Arguments  : none
 708          *
 709          * Returns    : none
 710          *********************************************************************************************************
 711          */
 712          
 713          static  void  OS_InitTaskIdle (void)
 714          {
 715   1      #if OS_TASK_CREATE_EXT_EN > 0
C51 COMPILER V7.50   OS_CORE                                                               08/08/2005 12:35:30 PAGE 13  

                  #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                  
             -   */
                                        OS_IDLE_PRIO,                              /* Lowest priority level             
             -   */
                                        OS_TASK_IDLE_ID,
                                        &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* 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  */
                  #endif
              #else
 738   1          #if OS_STK_GROWTH == 1
                  (void)OSTaskCreate(OS_TaskIdle,
                                     (void *)0,
                                     &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
                                     OS_IDLE_PRIO);
                  #else
 744   1          (void)OSTaskCreate(OS_TaskIdle,
 745   1                             (void *)0,
 746   1                             &OSTaskIdleStk[0],
 747   1                             OS_IDLE_PRIO);
 748   1          #endif
 749   1      #endif
 750   1      }
 751          /*$PAGE*/
 752          /*
 753          *********************************************************************************************************
 754          *                                             INITIALIZATION
 755          *                                      CREATING THE STATISTIC TASK
 756          *
 757          * Description: This function creates the Statistic Task.
 758          *
 759          * Arguments  : none
 760          *
 761          * Returns    : none
 762          *********************************************************************************************************
 763          */
 764          
 765          #if OS_TASK_STAT_EN > 0
C51 COMPILER V7.50   OS_CORE                                                               08/08/2005 12:35:30 PAGE 14  

              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               *
             -/
                                        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
 805          /*$PAGE*/
 806          /*
 807          *********************************************************************************************************
 808          *                                             INITIALIZATION
 809          *                            INITIALIZE THE FREE LIST OF TASK CONTROL BLOCKS
C51 COMPILER V7.50   OS_CORE                                                               08/08/2005 12:35:30 PAGE 15  

 810          *
 811          * Description: This function is called by OSInit() to initialize the free list of OS_TCBs.
 812          *
 813          * Arguments  : none
 814          *
 815          * Returns    : none
 816          *********************************************************************************************************
 817          */
 818          
 819          static  void  OS_InitTCBList (void)
 820          {
 821   1          INT8U    i;
 822   1          OS_TCB  *ptcb1;
 823   1          OS_TCB  *ptcb2;
 824   1      
 825   1      
 826   1          OSTCBList     = (OS_TCB *)0;                                 /* TCB Initialization                    
             -   */
 827   1          for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) {                 /* Clear the priority table              
             -   */
 828   2              OSTCBPrioTbl[i] = (OS_TCB *)0;
 829   2          }
 830   1          ptcb1 = &OSTCBTbl[0];
 831   1          ptcb2 = &OSTCBTbl[1];
 832   1          for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) {  /* Init. list of free TCBs               
             -   */
 833   2              ptcb1->OSTCBNext = ptcb2;
 834   2              ptcb1++;
 835   2              ptcb2++;
 836   2          }

⌨️ 快捷键说明

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