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

📄 os_core.lst

📁 该源码是本人经调试通过的UCOS2操作系统在51单片机上移植好的源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 655          {
 656   1      #if OS_TIME_GET_SET_EN > 0   
                  OSTime        = 0L;                                          /* Clear the 32-bit system clock         
             -   */
              #endif
 659   1      
 660   1          OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter   
             -   */
C51 COMPILER V7.20   OS_CORE                                                               09/25/2006 10:08:38 PAGE 12  

 661   1          OSLockNesting = 0;                                           /* Clear the scheduling lock counter     
             -   */
 662   1      
 663   1          OSTaskCtr     = 0;                                           /* Clear the number of tasks             
             -   */
 664   1      
 665   1          OSRunning     = FALSE;                                       /* Indicate that multitasking not started
             -   */
 666   1          
 667   1          OSCtxSwCtr    = 0;                                           /* Clear the context switch counter      
             -   */
 668   1          OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter         
             -   */
 669   1      
 670   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
 675   1      }
 676          /*$PAGE*/
 677          /*
 678          *********************************************************************************************************
 679          *                                             INITIALIZATION
 680          *                                       INITIALIZE THE READY LIST
 681          *
 682          * Description: This function is called by OSInit() to initialize the Ready List.
 683          *
 684          * Arguments  : none
 685          *
 686          * Returns    : none
 687          *********************************************************************************************************
 688          */
 689          
 690          static  void  OS_InitRdyList (void)  reentrant
 691          {
 692   1          INT16U   i;
 693   1          INT8U   *prdytbl;
 694   1      
 695   1      
 696   1          OSRdyGrp      = 0x00;                                        /* Clear the ready list                  
             -   */
 697   1          prdytbl       = &OSRdyTbl[0];
 698   1          for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
 699   2              *prdytbl++ = 0x00;
 700   2          }
 701   1      
 702   1          OSPrioCur     = 0;
 703   1          OSPrioHighRdy = 0;
 704   1      
 705   1          OSTCBHighRdy  = (OS_TCB *)0;                                 
 706   1          OSTCBCur      = (OS_TCB *)0;
 707   1      }
 708          
 709          /*$PAGE*/
 710          /*
 711          *********************************************************************************************************
 712          *                                             INITIALIZATION
 713          *                                         CREATING THE IDLE TASK
 714          *
 715          * Description: This function creates the Idle Task.
C51 COMPILER V7.20   OS_CORE                                                               09/25/2006 10:08:38 PAGE 13  

 716          *
 717          * Arguments  : none
 718          *
 719          * Returns    : none
 720          *********************************************************************************************************
 721          */
 722          
 723          static  void  OS_InitTaskIdle (void)  reentrant
 724          {
 725   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                  
             -   */
                                        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
 748   1          #if OS_STK_GROWTH == 1
                  (void)OSTaskCreate(OS_TaskIdle,
                                     (void *)0,
                                     &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
                                     OS_IDLE_PRIO);
                  #else
 754   1          (void)OSTaskCreate(OS_TaskIdle,
 755   1                             (void *)0,
 756   1                             &OSTaskIdleStk[0],
 757   1                             OS_IDLE_PRIO);
 758   1          #endif
 759   1      #endif
 760   1      }
 761          /*$PAGE*/
 762          /*
 763          *********************************************************************************************************
 764          *                                             INITIALIZATION
 765          *                                      CREATING THE STATISTIC TASK
C51 COMPILER V7.20   OS_CORE                                                               09/25/2006 10:08:38 PAGE 14  

 766          *
 767          * Description: This function creates the Statistic Task.
 768          *
 769          * Arguments  : none
 770          *
 771          * Returns    : none
 772          *********************************************************************************************************
 773          */
 774          
 775          #if OS_TASK_STAT_EN > 0
              static  void  OS_InitTaskStat (void)  reentrant
              {
              #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  *
C51 COMPILER V7.20   OS_CORE                                                               09/25/2006 10:08:38 PAGE 15  

             -/
                  #endif
              #endif
              }
              #endif
 815          /*$PAGE*/
 816          /*
 817          *********************************************************************************************************
 818          *                                             INITIALIZATION
 819          *                            INITIALIZE THE FREE LIST OF TASK CONTROL BLOCKS
 820          *
 821          * Description: This function is called by OSInit() to initialize the free list of OS_TCBs.
 822          *
 823          * Arguments  : none
 824          *
 825          * Returns    : none
 826          *********************************************************************************************************
 827          */
 828          
 829          static  void  OS_InitTCBList (void)  reentrant
 830          {
 831   1          INT8U    i;
 832   1          OS_TCB  *ptcb1;
 833   1          OS_TCB  *ptcb2;
 834   1      
 835   1      
 836   1          OSTCBList     = (OS_TCB *)0;                                 /* TCB Initialization                    
             -   */
 837   1          for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) {                 /* Clear the priority table              
             -   */

⌨️ 快捷键说明

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