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

📄 os_core.lst

📁 uCOS 嵌入式操作系统的改进版,增加了网络通讯.
💻 LST
📖 第 1 页 / 共 5 页
字号:

 664          #if     0//#Lin
              void  OSTimeTick (void)
              {
              #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register    
             - */
                  OS_CPU_SR  cpu_sr;
              #endif    
                  OS_TCB    *ptcb;
                  BOOLEAN    step;
              
              
              #if OS_TIME_TICK_HOOK_EN > 0
                  OSTimeTickHook();                                      /* Call user definable hook                    
             - */
              #endif    
              #if OS_TIME_GET_SET_EN > 0   
                  OS_ENTER_CRITICAL();                                   /* Update the 32-bit tick counter              
             - */
                  OSTime++;
                  OS_EXIT_CRITICAL();
              #endif
                  if (OSRunning == TRUE) {    
              #if OS_TICK_STEP_EN > 0
                      switch (OSTickStepState) {                         /* Determine whether we need to process a tick 
             - */
                          case OS_TICK_STEP_DIS:                         /* Yes, stepping is disabled                   
             - */
                               step = TRUE;
                               break;
                      
                          case OS_TICK_STEP_WAIT:                        /* No,  waiting for uC/OS-View to set ...      
             - */
                               step = FALSE;                             /*      .. OSTickStepState to OS_TICK_STEP_ONCE
             - */
                               break;
              
                          case OS_TICK_STEP_ONCE:                        /* Yes, process tick once and wait for next ...
             - */
                               step            = TRUE;                   /*      ... step command from uC/OS-View       
             - */
                               OSTickStepState = OS_TICK_STEP_WAIT;
                               break;  
              
                          default:                                       /* Invalid case, correct situation             
             - */
                               step            = TRUE;
                               OSTickStepState = OS_TICK_STEP_DIS;
                               break;
                      }
              #else
                      step = TRUE;
              #endif
                      if (step == TRUE) {
                          ptcb = OSTCBList;                              /* Point at first TCB in TCB list              
             - */
                          while (ptcb->OSTCBPrio != OS_IDLE_PRIO) {      /* Go through all TCBs in TCB list             
             - */
                              OS_ENTER_CRITICAL();
                              if (ptcb->OSTCBDly != 0) {                 /* Delayed or waiting for event with TO        
             - */
                                  if (--ptcb->OSTCBDly == 0) {           /* Decrement nbr of ticks to end of delay      
             - */
C51 COMPILER V7.06   OS_CORE                                                               07/18/2003 11:05:56 PAGE 13  

                                      if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { /* Is task suspended?   
             - */
                                          OSRdyGrp               |= ptcb->OSTCBBitY; /* No,  Make task R-to-R (timed out
             -)*/
                                          OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
                                      } else {                           /* Yes, Leave 1 tick to prevent loosing the ...
             - */
                                          ptcb->OSTCBDly = 1;            /* ... task when the suspension is removed.    
             - */
                                      }
                                  }
                              }
                              ptcb = ptcb->OSTCBNext;                    /* Point at next TCB in TCB list               
             - */
                              OS_EXIT_CRITICAL();
                          }
                      }
                  }
              }
              #else
 727          
 728          /*
 729          *********************************************************************************************************
 730          *                                         PROCESS SYSTEM TICK
 731          *
 732          * Description: This function is used to signal to uC/OS-II the occurrence of a 'system tick' (also known
 733          *              as a 'clock tick').  This function should be called by the ticker ISR but, can also be
 734          *              called by a high priority task.
 735          *
 736          * Arguments  : none
 737          *
 738          * Returns    : none
 739          *********************************************************************************************************
 740          */
 741          
 742          void  OSTimeTick (void) reentrant //using 0
 743          {
 744   1      #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register    
             - */
 745   1          OS_CPU_SR  cpu_sr;
 746   1      #endif    
 747   1          OS_TCB    *ptcb;
 748   1          BOOLEAN    step;
 749   1      
 750   1      
 751   1      #if OS_TIME_TICK_HOOK_EN > 0
 752   1          OSTimeTickHook();                                      /* Call user definable hook                    
             - */
 753   1      #endif    
 754   1      #if OS_TIME_GET_SET_EN > 0   
 755   1          OS_ENTER_CRITICAL();                                   /* Update the 32-bit tick counter              
             - */
 756   1          OSTime++;
 757   1          OS_EXIT_CRITICAL();
 758   1      #endif
 759   1          if (OSRunning == TRUE) {    
 760   2      #if OS_TICK_STEP_EN > 0
 761   2              switch (OSTickStepState) {                         /* Determine whether we need to process a tick 
             - */
 762   3                  case OS_TICK_STEP_DIS:                         /* Yes, stepping is disabled                   
             - */
 763   3                       step = TRUE;
C51 COMPILER V7.06   OS_CORE                                                               07/18/2003 11:05:56 PAGE 14  

 764   3                       break;
 765   3              
 766   3                  case OS_TICK_STEP_WAIT:                        /* No,  waiting for uC/OS-View to set ...      
             - */
 767   3                       step = FALSE;                             /*      .. OSTickStepState to OS_TICK_STEP_ONCE
             - */
 768   3                       break;
 769   3      
 770   3                  case OS_TICK_STEP_ONCE:                        /* Yes, process tick once and wait for next ...
             - */
 771   3                       step            = TRUE;                   /*      ... step command from uC/OS-View       
             - */
 772   3                       OSTickStepState = OS_TICK_STEP_WAIT;
 773   3                       break;  
 774   3      
 775   3                  default:                                       /* Invalid case, correct situation             
             - */
 776   3                       step            = TRUE;
 777   3                       OSTickStepState = OS_TICK_STEP_DIS;
 778   3                       break;
 779   3              }
 780   2      #else
                      step = TRUE;
              #endif
 783   2              if (step == TRUE) {
 784   3                  ptcb = OSTCBList;                              /* Point at first TCB in TCB list              
             - */
 785   3                  while (ptcb->OSTCBPrio != OS_IDLE_PRIO) {      /* Go through all TCBs in TCB list             
             - */
 786   4                      OS_ENTER_CRITICAL();
 787   4                      if (ptcb->OSTCBDly != 0) {                 /* Delayed or waiting for event with TO        
             - */
 788   5                          if (--ptcb->OSTCBDly == 0) {           /* Decrement nbr of ticks to end of delay      
             - */
 789   6                              if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { /* Is task suspended?   
             - */
 790   7                                  OSRdyGrp               |= ptcb->OSTCBBitY; /* No,  Make task R-to-R (timed out
             -)*/
 791   7                                  OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
 792   7                              }
 793   6                          }
 794   5                      }
 795   4                      ptcb = ptcb->OSTCBNext;                    /* Point at next TCB in TCB list               
             - */
 796   4                      OS_EXIT_CRITICAL();
 797   4                  }
 798   3              }
 799   2          }
 800   1      }
 801          
 802          #endif
 803          /*$PAGE*/
 804          /*
 805          *********************************************************************************************************
 806          *                                             GET VERSION
 807          *
 808          * Description: This function is used to return the version number of uC/OS-II.  The returned value
 809          *              corresponds to uC/OS-II's version number multiplied by 100.  In other words, version 2.00
 810          *              would be returned as 200.
 811          *
 812          * Arguments  : none
 813          *
C51 COMPILER V7.06   OS_CORE                                                               07/18/2003 11:05:56 PAGE 15  

 814          * Returns    : the version number of uC/OS-II multiplied by 100.
 815          *********************************************************************************************************
 816          */
 817          
 818          INT16U  OSVersion (void) reentrant //using 0
 819          {
 820   1          return (OS_VERSION);
 821   1      }
 822          
 823          /*$PAGE*/
 824          /*
 825          *********************************************************************************************************
 826          *                                            DUMMY FUNCTION
 827          *
 828          * Description: This function doesn't do anything.  It is called by OSTaskDel().
 829          *
 830          * Arguments  : none
 831          *
 832          * Returns    : none
 833          *********************************************************************************************************
 834          */
 835          
 836          #if OS_TASK_DEL_EN > 0
 837          void  OS_Dummy (void) reentrant //using 0
 838          {
 839   1      }
 840          #endif
 841          
 842          /*$PAGE*/
 843          /*
 844          *********************************************************************************************************
 845          *                             MAKE TASK READY TO RUN BASED ON EVENT OCCURING
 846          *
 847          * Description: This function is called by other uC/OS-II services and is used to ready a task that was
 848          *              waiting for an event to occur.
 849          *
 850          * Arguments  : pevent    is a pointer to the event control block corresponding to the event.
 851          *
 852          *              msg       is a pointer to a message.  This pointer is used by message oriented services
 853          *                        such as MAILBOXEs and QUEUEs.  The pointer is not used when called by other
 854          *                        service functions.
 855          *

⌨️ 快捷键说明

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