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

📄 os_time.lst

📁 uCos-ii 2.86 在C8051F410单片机上移植成功!!! 其中包括:UART驱动
💻 LST
📖 第 1 页 / 共 2 页
字号:
              }
              #endif
 140          /*$PAGE*/
 141          /*
 142          *********************************************************************************************************
 143          *                                         RESUME A DELAYED TASK
 144          *
 145          * Description: This function is used resume a task that has been delayed through a call to either
 146          *              OSTimeDly() or OSTimeDlyHMSM().  Note that you can call this function to resume a
 147          *              task that is waiting for an event with timeout.  This would make the task look
 148          *              like a timeout occurred.
 149          *
 150          *              Also, you cannot resume a task that has called OSTimeDlyHMSM() with a combined time that
 151          *              exceeds 65535 clock ticks.  In other words, if the clock tick runs at 100 Hz then, you will
 152          *              not be able to resume a delayed task that called OSTimeDlyHMSM(0, 10, 55, 350) or higher:
 153          *
 154          *                  (10 Minutes * 60 + 55 Seconds + 0.35) * 100 ticks/second.
 155          *
 156          * Arguments  : prio                      specifies the priority of the task to resume
 157          *
 158          * Returns    : OS_ERR_NONE               Task has been resumed
 159          *              OS_ERR_PRIO_INVALID       if the priority you specify is higher that the maximum allowed
 160          *                                        (i.e. >= OS_LOWEST_PRIO)
 161          *              OS_ERR_TIME_NOT_DLY       Task is not waiting for time to expire
 162          *              OS_ERR_TASK_NOT_EXIST     The desired task has not been created or has been assigned to a M
             -utex.
 163          *********************************************************************************************************
 164          */
 165          
 166          #if OS_TIME_DLY_RESUME_EN > 0
              INT8U  OSTimeDlyResume (INT8U prio) reentrant
              {
                  OS_TCB    *ptcb;
              #if OS_CRITICAL_METHOD == 3                                    /* Storage for CPU status register      */
                  OS_CPU_SR  cpu_sr = 0;
              #endif
              
              
              
                  if (prio >= OS_LOWEST_PRIO) {
C51 COMPILER V8.17   OS_TIME                                                               03/26/2009 14:24:25 PAGE 4   

                      return (OS_ERR_PRIO_INVALID);
                  }
                  OS_ENTER_CRITICAL();
                  ptcb = OSTCBPrioTbl[prio];                                 /* Make sure that task exist            */
                  if (ptcb == (OS_TCB *)0) {
                      OS_EXIT_CRITICAL();
                      return (OS_ERR_TASK_NOT_EXIST);                        /* The task does not exist              */
                  }
                  if (ptcb == OS_TCB_RESERVED) {
                      OS_EXIT_CRITICAL();
                      return (OS_ERR_TASK_NOT_EXIST);                        /* The task does not exist              */
                  }
                  if (ptcb->OSTCBDly == 0) {                                 /* See if task is delayed               */
                      OS_EXIT_CRITICAL();
                      return (OS_ERR_TIME_NOT_DLY);                          /* Indicate that task was not delayed   */
                  }
              
                  ptcb->OSTCBDly = 0;                                        /* Clear the time delay                 */
                  if ((ptcb->OSTCBStat & OS_STAT_PEND_ANY) != OS_STAT_RDY) {
                      ptcb->OSTCBStat     &= ~OS_STAT_PEND_ANY;              /* Yes, Clear status flag               */
                      ptcb->OSTCBStatPend  =  OS_STAT_PEND_TO;               /* Indicate PEND timeout                */
                  } else {
                      ptcb->OSTCBStatPend  =  OS_STAT_PEND_OK;
                  }
                  if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) {  /* Is task suspended?                   */
                      OSRdyGrp               |= ptcb->OSTCBBitY;             /* No,  Make ready                      */
                      OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
                      OS_EXIT_CRITICAL();
                      OS_Sched();                                            /* See if this is new highest priority  */
                  } else {
                      OS_EXIT_CRITICAL();                                    /* Task may be suspended                */
                  }
                  return (OS_ERR_NONE);
              }
              #endif
 212          /*$PAGE*/
 213          /*
 214          *********************************************************************************************************
 215          *                                         GET CURRENT SYSTEM TIME
 216          *
 217          * Description: This function is used by your application to obtain the current value of the 32-bit
 218          *              counter which keeps track of the number of clock ticks.
 219          *
 220          * Arguments  : none
 221          *
 222          * Returns    : The current value of OSTime
 223          *********************************************************************************************************
 224          */
 225          
 226          #if OS_TIME_GET_SET_EN > 0
              INT32U  OSTimeGet (void)  reentrant
              {
                  INT32U     ticks;
              #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
                  OS_CPU_SR  cpu_sr = 0;
              #endif
              
              
              
                  OS_ENTER_CRITICAL();
                  ticks = OSTime;
                  OS_EXIT_CRITICAL();
C51 COMPILER V8.17   OS_TIME                                                               03/26/2009 14:24:25 PAGE 5   

                  return (ticks);
              }
              #endif
 242          
 243          /*
 244          *********************************************************************************************************
 245          *                                            SET SYSTEM CLOCK
 246          *
 247          * Description: This function sets the 32-bit counter which keeps track of the number of clock ticks.
 248          *
 249          * Arguments  : ticks      specifies the new value that OSTime needs to take.
 250          *
 251          * Returns    : none
 252          *********************************************************************************************************
 253          */
 254          
 255          #if OS_TIME_GET_SET_EN > 0
              void  OSTimeSet (INT32U ticks) reentrant
              {
              #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
                  OS_CPU_SR  cpu_sr = 0;
              #endif
              
              
              
                  OS_ENTER_CRITICAL();
                  OSTime = ticks;
                  OS_EXIT_CRITICAL();
              }
              #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    192    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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