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

📄 os_core.lst

📁 一个关于UCOS的KEIL工程
💻 LST
📖 第 1 页 / 共 5 页
字号:
 649          * Arguments  : none
 650          *
 651          * Returns    : none
 652          *********************************************************************************************************
 653          */
 654          
 655          static  void  OS_InitMisc (void) KCREENTRANT
 656          {
 657   1      #if OS_TIME_GET_SET_EN > 0   
 658   1          OSTime        = 0L;                                          /* Clear the 32-bit system clock         
             -   */
 659   1      #endif
 660   1      
 661   1          OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter   
C51 COMPILER V6.23a  OS_CORE                                                               12/09/2004 16:50:24 PAGE 12  

             -   */
 662   1          OSLockNesting = 0;                                           /* Clear the scheduling lock counter     
             -   */
 663   1      
 664   1          OSTaskCtr     = 0;                                           /* Clear the number of tasks             
             -   */
 665   1      
 666   1          OSRunning     = FALSE;                                       /* Indicate that multitasking not started
             -   */
 667   1          
 668   1          OSCtxSwCtr    = 0;                                           /* Clear the context switch counter      
             -   */
 669   1          OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter         
             -   */
 670   1      
 671   1      #if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
 672   1          OSIdleCtrRun  = 0L;
 673   1          OSIdleCtrMax  = 0L;
 674   1          OSStatRdy     = FALSE;                                       /* Statistic task is not ready           
             -   */
 675   1      #endif
 676   1      }
 677          /*$PAGE*/
 678          /*
 679          *********************************************************************************************************
 680          *                                             INITIALIZATION
 681          *                                       INITIALIZE THE READY LIST
 682          *
 683          * Description: This function is called by OSInit() to initialize the Ready List.
 684          *
 685          * Arguments  : none
 686          *
 687          * Returns    : none
 688          *********************************************************************************************************
 689          */
 690          
 691          static  void  OS_InitRdyList (void) KCREENTRANT
 692          {
 693   1          INT16U   i;
 694   1          INT8U   *prdytbl;
 695   1      
 696   1      
 697   1          OSRdyGrp      = 0x00;                                        /* Clear the ready list                  
             -   */
 698   1          prdytbl       = &OSRdyTbl[0];
 699   1          for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
 700   2              *prdytbl++ = 0x00;
 701   2          }
 702   1      
 703   1          OSPrioCur     = 0;
 704   1          OSPrioHighRdy = 0;
 705   1      
 706   1          OSTCBHighRdy  = (OS_TCB *)0;                                 
 707   1          OSTCBCur      = (OS_TCB *)0;
 708   1      }
 709          
 710          /*$PAGE*/
 711          /*
 712          *********************************************************************************************************
 713          *                                             INITIALIZATION
 714          *                                         CREATING THE IDLE TASK
 715          *
C51 COMPILER V6.23a  OS_CORE                                                               12/09/2004 16:50:24 PAGE 13  

 716          * Description: This function creates the Idle Task.
 717          *
 718          * Arguments  : none
 719          *
 720          * Returns    : none
 721          *********************************************************************************************************
 722          */
 723          
 724          static  void  OS_InitTaskIdle (void) KCREENTRANT
 725          {
 726   1      #if OS_TASK_CREATE_EXT_EN > 0
 727   1          #if OS_STK_GROWTH == 1
 728   1          (void)OSTaskCreateExt(OS_TaskIdle,
 729   1                                (void *)0,                                 /* No arguments passed to OS_TaskIdle
             -() */
 730   1                                &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack                  
             -   */
 731   1                                OS_IDLE_PRIO,                              /* Lowest priority level             
             -   */
 732   1                                OS_TASK_IDLE_ID,
 733   1                                &OSTaskIdleStk[0],                         /* Set Bottom-Of-Stack               
             -   */
 734   1                                OS_TASK_IDLE_STK_SIZE,
 735   1                                (void *)0,                                 /* No TCB extension                  
             -   */
 736   1                                OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stac
             -k  */
 737   1          #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
 748   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
 761   1      }
 762          /*$PAGE*/
 763          /*
 764          *********************************************************************************************************
 765          *                                             INITIALIZATION
C51 COMPILER V6.23a  OS_CORE                                                               12/09/2004 16:50:24 PAGE 14  

 766          *                                      CREATING THE STATISTIC TASK
 767          *
 768          * Description: This function creates the Statistic Task.
 769          *
 770          * Arguments  : none
 771          *
 772          * Returns    : none
 773          *********************************************************************************************************
 774          */
 775          
 776          #if OS_TASK_STAT_EN > 0
 777          static  void  OS_InitTaskStat (void) KCREENTRANT
 778          {
 779   1      #if OS_TASK_CREATE_EXT_EN > 0
 780   1          #if OS_STK_GROWTH == 1
 781   1          (void)OSTaskCreateExt(OS_TaskStat,
 782   1                                (void *)0,                                   /* No args passed to OS_TaskStat()*
             -/
 783   1                                &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Top-Of-Stack               *
             -/
 784   1                                OS_STAT_PRIO,                                /* One higher than the idle task  *
             -/
 785   1                                OS_TASK_STAT_ID,
 786   1                                &OSTaskStatStk[0],                           /* Set Bottom-Of-Stack            *
             -/
 787   1                                OS_TASK_STAT_STK_SIZE,
 788   1                                (void *)0,                                   /* No TCB extension               *
             -/
 789   1                                OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  *
             -/
 790   1          #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
 801   1      #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               *
             -/
C51 COMPILER V6.23a  OS_CORE                                                               12/09/2004 16:50:24 PAGE 15  

                                     OS_STAT_PRIO);                                  /* One higher than the idle task  *
             -/
                  #endif
              #endif
 814   1      }
 815          #endif
 816          /*$PAGE*/
 817          /*
 818          *********************************************************************************************************
 819          *                                             INITIALIZATION
 820          *                            INITIALIZE THE FREE LIST OF TASK CONTROL BLOCKS
 821          *
 822          * Description: This function is called by OSInit() to initialize the free list of OS_TCBs.
 823          *
 824          * Arguments  : none
 825          *
 826          * Returns    : none
 827          *********************************************************************************************************
 828          */
 829          
 830          static  void  OS_InitTCBList (void) KCREENTRANT
 831          {

⌨️ 快捷键说明

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