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

📄 os_time.lst

📁 stm32+ucos-ii
💻 LST
📖 第 1 页 / 共 3 页
字号:
     94          *              set to 0.  The actual delay is rounded to the nearest tick.
     95          *********************************************************************************************************
     96          */
     97          
     98          #if OS_TIME_DLY_HMSM_EN > 0u

   \                                 In section .text, align 2, keep-with-next
     99          INT8U  OSTimeDlyHMSM (INT8U   hours,
    100                                INT8U   minutes,
    101                                INT8U   seconds,
    102                                INT16U  ms)
    103          {
   \                     OSTimeDlyHMSM:
   \   00000000   2DE9F041           PUSH     {R4-R8,LR}
   \   00000004   0400               MOVS     R4,R0
   \   00000006   0D00               MOVS     R5,R1
   \   00000008   1600               MOVS     R6,R2
   \   0000000A   1F00               MOVS     R7,R3
    104              INT32U ticks;
    105          
    106          
    107              if (OSIntNesting > 0u) {                     /* See if trying to call from an ISR                  */
   \   0000000C   ....               LDR.N    R0,??DataTable4
   \   0000000E   0078               LDRB     R0,[R0, #+0]
   \   00000010   0028               CMP      R0,#+0
   \   00000012   01D0               BEQ.N    ??OSTimeDlyHMSM_0
    108                  return (OS_ERR_TIME_DLY_ISR);
   \   00000014   5520               MOVS     R0,#+85
   \   00000016   22E0               B.N      ??OSTimeDlyHMSM_1
    109              }
    110              if (OSLockNesting > 0u) {                    /* See if called with scheduler locked                */
   \                     ??OSTimeDlyHMSM_0:
   \   00000018   ....               LDR.N    R0,??DataTable4_1
   \   0000001A   0078               LDRB     R0,[R0, #+0]
   \   0000001C   0028               CMP      R0,#+0
   \   0000001E   01D0               BEQ.N    ??OSTimeDlyHMSM_2
    111                  return (OS_ERR_SCHED_LOCKED);
   \   00000020   3220               MOVS     R0,#+50
   \   00000022   1CE0               B.N      ??OSTimeDlyHMSM_1
    112              }
    113          #if OS_ARG_CHK_EN > 0u
    114              if (hours == 0u) {
    115                  if (minutes == 0u) {
    116                      if (seconds == 0u) {
    117                          if (ms == 0u) {
    118                              return (OS_ERR_TIME_ZERO_DLY);
    119                          }
    120                      }
    121                  }
    122              }
    123              if (minutes > 59u) {
    124                  return (OS_ERR_TIME_INVALID_MINUTES);    /* Validate arguments to be within range              */
    125              }
    126              if (seconds > 59u) {
    127                  return (OS_ERR_TIME_INVALID_SECONDS);
    128              }
    129              if (ms > 999u) {
    130                  return (OS_ERR_TIME_INVALID_MS);
    131              }
    132          #endif
    133                                                           /* Compute the total number of clock ticks required.. */
    134                                                           /* .. (rounded to the nearest tick)                   */
    135              ticks = ((INT32U)hours * 3600uL + (INT32U)minutes * 60uL + (INT32U)seconds) * OS_TICKS_PER_SEC
    136                    + OS_TICKS_PER_SEC * ((INT32U)ms + 500uL / OS_TICKS_PER_SEC) / 1000uL;
   \                     ??OSTimeDlyHMSM_2:
   \   00000024   E4B2               UXTB     R4,R4            ;; ZeroExt  R4,R4,#+24,#+24
   \   00000026   4FF46160           MOV      R0,#+3600
   \   0000002A   EDB2               UXTB     R5,R5            ;; ZeroExt  R5,R5,#+24,#+24
   \   0000002C   3C21               MOVS     R1,#+60
   \   0000002E   01FB05F1           MUL      R1,R1,R5
   \   00000032   00FB0410           MLA      R0,R0,R4,R1
   \   00000036   F6B2               UXTB     R6,R6            ;; ZeroExt  R6,R6,#+24,#+24
   \   00000038   3018               ADDS     R0,R6,R0
   \   0000003A   4FF47A71           MOV      R1,#+1000
   \   0000003E   BFB2               UXTH     R7,R7            ;; ZeroExt  R7,R7,#+16,#+16
   \   00000040   4FF47A72           MOV      R2,#+1000
   \   00000044   02FB07F2           MUL      R2,R2,R7
   \   00000048   4FF47A73           MOV      R3,#+1000
   \   0000004C   B2FBF3F2           UDIV     R2,R2,R3
   \   00000050   01FB0020           MLA      R0,R1,R0,R2
   \   00000054   8046               MOV      R8,R0
    137              OSTimeDly(ticks);
   \   00000056   4046               MOV      R0,R8
   \   00000058   ........           BL       OSTimeDly
    138              return (OS_ERR_NONE);
   \   0000005C   0020               MOVS     R0,#+0
   \                     ??OSTimeDlyHMSM_1:
   \   0000005E   BDE8F081           POP      {R4-R8,PC}       ;; return
    139          }
    140          #endif
    141          /*$PAGE*/
    142          /*
    143          *********************************************************************************************************
    144          *                                         RESUME A DELAYED TASK
    145          *
    146          * Description: This function is used resume a task that has been delayed through a call to either
    147          *              OSTimeDly() or OSTimeDlyHMSM().  Note that you can call this function to resume a
    148          *              task that is waiting for an event with timeout.  This would make the task look
    149          *              like a timeout occurred.
    150          *
    151          * Arguments  : prio                      specifies the priority of the task to resume
    152          *
    153          * Returns    : OS_ERR_NONE               Task has been resumed
    154          *              OS_ERR_PRIO_INVALID       if the priority you specify is higher that the maximum allowed
    155          *                                        (i.e. >= OS_LOWEST_PRIO)
    156          *              OS_ERR_TIME_NOT_DLY       Task is not waiting for time to expire
    157          *              OS_ERR_TASK_NOT_EXIST     The desired task has not been created or has been assigned to a Mutex.
    158          *********************************************************************************************************
    159          */
    160          
    161          #if OS_TIME_DLY_RESUME_EN > 0u

   \                                 In section .text, align 2, keep-with-next
    162          INT8U  OSTimeDlyResume (INT8U prio)
    163          {
   \                     OSTimeDlyResume:
   \   00000000   70B5               PUSH     {R4-R6,LR}
   \   00000002   0400               MOVS     R4,R0
    164              OS_TCB    *ptcb;
    165          #if OS_CRITICAL_METHOD == 3u                                   /* Storage for CPU status register      */
    166              OS_CPU_SR  cpu_sr = 0u;
   \   00000004   0026               MOVS     R6,#+0
    167          #endif
    168          
    169          
    170          
    171              if (prio >= OS_LOWEST_PRIO) {
   \   00000006   E4B2               UXTB     R4,R4            ;; ZeroExt  R4,R4,#+24,#+24
   \   00000008   3F2C               CMP      R4,#+63
   \   0000000A   01D3               BCC.N    ??OSTimeDlyResume_0
    172                  return (OS_ERR_PRIO_INVALID);
   \   0000000C   2A20               MOVS     R0,#+42
   \   0000000E   51E0               B.N      ??OSTimeDlyResume_1
    173              }
    174              OS_ENTER_CRITICAL();
   \                     ??OSTimeDlyResume_0:
   \   00000010   ........           BL       OS_CPU_SR_Save
   \   00000014   0600               MOVS     R6,R0
    175              ptcb = OSTCBPrioTbl[prio];                                 /* Make sure that task exist            */
   \   00000016   E4B2               UXTB     R4,R4            ;; ZeroExt  R4,R4,#+24,#+24
   \   00000018   ....               LDR.N    R0,??DataTable4_5
   \   0000001A   50F82400           LDR      R0,[R0, R4, LSL #+2]
   \   0000001E   0500               MOVS     R5,R0
    176              if (ptcb == (OS_TCB *)0) {
   \   00000020   002D               CMP      R5,#+0
   \   00000022   04D1               BNE.N    ??OSTimeDlyResume_2
    177                  OS_EXIT_CRITICAL();
   \   00000024   3000               MOVS     R0,R6
   \   00000026   ........           BL       OS_CPU_SR_Restore
    178                  return (OS_ERR_TASK_NOT_EXIST);                        /* The task does not exist              */
   \   0000002A   4320               MOVS     R0,#+67
   \   0000002C   42E0               B.N      ??OSTimeDlyResume_1
    179              }
    180              if (ptcb == OS_TCB_RESERVED) {
   \                     ??OSTimeDlyResume_2:
   \   0000002E   012D               CMP      R5,#+1
   \   00000030   04D1               BNE.N    ??OSTimeDlyResume_3
    181                  OS_EXIT_CRITICAL();
   \   00000032   3000               MOVS     R0,R6
   \   00000034   ........           BL       OS_CPU_SR_Restore
    182                  return (OS_ERR_TASK_NOT_EXIST);                        /* The task does not exist              */
   \   00000038   4320               MOVS     R0,#+67
   \   0000003A   3BE0               B.N      ??OSTimeDlyResume_1
    183              }
    184              if (ptcb->OSTCBDly == 0u) {                                /* See if task is delayed               */
   \                     ??OSTimeDlyResume_3:
   \   0000003C   286B               LDR      R0,[R5, #+48]
   \   0000003E   0028               CMP      R0,#+0
   \   00000040   04D1               BNE.N    ??OSTimeDlyResume_4
    185                  OS_EXIT_CRITICAL();
   \   00000042   3000               MOVS     R0,R6
   \   00000044   ........           BL       OS_CPU_SR_Restore
    186                  return (OS_ERR_TIME_NOT_DLY);                          /* Indicate that task was not delayed   */
   \   00000048   5020               MOVS     R0,#+80
   \   0000004A   33E0               B.N      ??OSTimeDlyResume_1
    187              }
    188          
    189              ptcb->OSTCBDly = 0u;                                       /* Clear the time delay                 */
   \                     ??OSTimeDlyResume_4:
   \   0000004C   0020               MOVS     R0,#+0
   \   0000004E   2863               STR      R0,[R5, #+48]
    190              if ((ptcb->OSTCBStat & OS_STAT_PEND_ANY) != OS_STAT_RDY) {
   \   00000050   95F83400           LDRB     R0,[R5, #+52]
   \   00000054   3721               MOVS     R1,#+55
   \   00000056   0842               TST      R0,R1
   \   00000058   09D0               BEQ.N    ??OSTimeDlyResume_5
    191                  ptcb->OSTCBStat     &= ~OS_STAT_PEND_ANY;              /* Yes, Clear status flag               */
   \   0000005A   95F83400           LDRB     R0,[R5, #+52]
   \   0000005E   10F0C800           ANDS     R0,R0,#0xC8
   \   00000062   85F83400           STRB     R0,[R5, #+52]
    192                  ptcb->OSTCBStatPend  =  OS_STAT_PEND_TO;               /* Indicate PEND timeout                */
   \   00000066   0120               MOVS     R0,#+1
   \   00000068   85F83500           STRB     R0,[R5, #+53]
   \   0000006C   02E0               B.N      ??OSTimeDlyResume_6
    193              } else {

⌨️ 快捷键说明

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