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

📄 os_time.lst

📁 ARM仿真案例
💻 LST
📖 第 1 页 / 共 2 页
字号:
    117              }
   \                     ??OSTimeDlyHMSM_5:
   \   0000007A   2000               MOVS     R0,R4
   \   0000007C   F2D1               BNE      ??OSTimeDlyHMSM_7
    118              return (OS_NO_ERR);
   \                     ??OSTimeDlyHMSM_6:
   \   0000007E   0020               MOVS     R0,#+0
   \                     ??OSTimeDlyHMSM_3:
   \   00000080   10BC               POP      {R4}
   \   00000082   02BC               POP      {R1}
   \   00000084   0847               BX       R1               ;; return
    119          }
    120          #endif
    121          /*$PAGE*/
    122          /*
    123          *********************************************************************************************************
    124          *                                         RESUME A DELAYED TASK
    125          *
    126          * Description: This function is used resume a task that has been delayed through a call to either
    127          *              OSTimeDly() or OSTimeDlyHMSM().  Note that you MUST NOT call this function to resume a
    128          *              task that is waiting for an event with timeout.  This situation would make the task look
    129          *              like a timeout occurred (unless you desire this effect).  Also, you cannot resume a task
    130          *              that has called OSTimeDlyHMSM() with a combined time that exceeds 65535 clock ticks.  In
    131          *              other words, if the clock tick runs at 100 Hz then, you will not be able to resume a
    132          *              delayed task that called OSTimeDlyHMSM(0, 10, 55, 350) or higher.
    133          *
    134          *                  (10 Minutes * 60 + 55 Seconds + 0.35) * 100 ticks/second.
    135          *
    136          * Arguments  : prio      specifies the priority of the task to resume
    137          *
    138          * Returns    : OS_NO_ERR                 Task has been resumed
    139          *              OS_PRIO_INVALID           if the priority you specify is higher that the maximum allowed
    140          *                                        (i.e. >= OS_LOWEST_PRIO)
    141          *              OS_TIME_NOT_DLY           Task is not waiting for time to expire
    142          *              OS_TASK_NOT_EXIST         The desired task has not been created
    143          *********************************************************************************************************
    144          */
    145          
    146          #if OS_TIME_DLY_RESUME_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    147          INT8U  OSTimeDlyResume (INT8U prio)
    148          {
   \                     OSTimeDlyResume:
   \   00000000   30B5               PUSH     {R4,R5,LR}
   \   00000002   0400               MOVS     R4,R0
    149          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    150              OS_CPU_SR  cpu_sr;
    151          #endif    
    152              OS_TCB    *ptcb;
    153          
    154          
    155              if (prio >= OS_LOWEST_PRIO) {
   \   00000004   3F2C               CMP      R4,#+63
   \   00000006   01D3               BCC      ??OSTimeDlyResume_0
    156                  return (OS_PRIO_INVALID);
   \   00000008   2A20               MOVS     R0,#+42
   \   0000000A   2FE0               B        ??OSTimeDlyResume_1
    157              }
    158              OS_ENTER_CRITICAL();
   \                     ??OSTimeDlyResume_0:
   \   0000000C   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    159              ptcb = (OS_TCB *)OSTCBPrioTbl[prio];                   /* Make sure that task exist                */
   \   00000010   A100               LSLS     R1,R4,#+2
   \   00000012   184A               LDR      R2,??OSTimeDlyResume_2  ;; OSTCBPrioTbl
   \   00000014   5158               LDR      R1,[R2, R1]
    160              if (ptcb != (OS_TCB *)0) {
   \   00000016   0029               CMP      R1,#+0
   \   00000018   25D0               BEQ      ??OSTimeDlyResume_3
    161                  if (ptcb->OSTCBDly != 0) {                         /* See if task is delayed                   */
   \   0000001A   4A8D               LDRH     R2,[R1, #+42]
   \   0000001C   002A               CMP      R2,#+0
   \   0000001E   1ED0               BEQ      ??OSTimeDlyResume_4
    162                      ptcb->OSTCBDly  = 0;                           /* Clear the time delay                     */
   \   00000020   0022               MOVS     R2,#+0
   \   00000022   4A85               STRH     R2,[R1, #+42]
    163                      if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) {  /* See if task is ready to run  */
   \   00000024   2C22               MOVS     R2,#+44
   \   00000026   8A5C               LDRB     R2,[R1, R2]
   \   00000028   1207               LSLS     R2,R2,#+28
   \   0000002A   14D4               BMI      ??OSTimeDlyResume_5
    164                          OSRdyGrp               |= ptcb->OSTCBBitY;             /* Make task ready to run       */
   \   0000002C   ....               LDR      R2,??DataTable6  ;; OSRdyGrp
   \   0000002E   ....               LDR      R3,??DataTable6  ;; OSRdyGrp
   \   00000030   1B78               LDRB     R3,[R3, #+0]
   \   00000032   3124               MOVS     R4,#+49
   \   00000034   0C5D               LDRB     R4,[R1, R4]
   \   00000036   1C43               ORRS     R4,R4,R3
   \   00000038   1470               STRB     R4,[R2, #+0]
    165                          OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
   \   0000003A   2F22               MOVS     R2,#+47
   \   0000003C   8A5C               LDRB     R2,[R1, R2]
   \   0000003E   ....               LDR      R3,??DataTable8  ;; OSRdyTbl
   \   00000040   ....               LDR      R5,??DataTable8  ;; OSRdyTbl
   \   00000042   AC5C               LDRB     R4,[R5, R2]
   \   00000044   3031               ADDS     R1,R1,#+48
   \   00000046   0978               LDRB     R1,[R1, #+0]
   \   00000048   2143               ORRS     R1,R1,R4
   \   0000004A   9954               STRB     R1,[R3, R2]
    166                          OS_EXIT_CRITICAL();
   \   0000004C   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    167                          OS_Sched();                                /* See if this is new highest priority      */
   \   00000050   ........           _BLF     OS_Sched,??OS_Sched??rT
   \   00000054   01E0               B        ??OSTimeDlyResume_6
    168                      } else {
    169                          OS_EXIT_CRITICAL();                        /* Task may be suspended                    */
   \                     ??OSTimeDlyResume_5:
   \   00000056   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    170                      }
    171                      return (OS_NO_ERR);
   \                     ??OSTimeDlyResume_6:
   \   0000005A   0020               MOVS     R0,#+0
   \   0000005C   06E0               B        ??OSTimeDlyResume_1
    172                  } else {
    173                      OS_EXIT_CRITICAL();
   \                     ??OSTimeDlyResume_4:
   \   0000005E   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    174                      return (OS_TIME_NOT_DLY);                      /* Indicate that task was not delayed       */
   \   00000062   5020               MOVS     R0,#+80
   \   00000064   02E0               B        ??OSTimeDlyResume_1
    175                  }
    176              }
    177              OS_EXIT_CRITICAL();
   \                     ??OSTimeDlyResume_3:
   \   00000066   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    178              return (OS_TASK_NOT_EXIST);                            /* The task does not exist                  */
   \   0000006A   0B20               MOVS     R0,#+11
   \                     ??OSTimeDlyResume_1:
   \   0000006C   30BC               POP      {R4,R5}
   \   0000006E   02BC               POP      {R1}
   \   00000070   0847               BX       R1               ;; return
   \   00000072   C046               Nop      
   \                     ??OSTimeDlyResume_2:
   \   00000074   ........           DC32     OSTCBPrioTbl
    179          }
    180          #endif    
    181          /*$PAGE*/
    182          /*
    183          *********************************************************************************************************
    184          *                                         GET CURRENT SYSTEM TIME
    185          *
    186          * Description: This function is used by your application to obtain the current value of the 32-bit
    187          *              counter which keeps track of the number of clock ticks.
    188          *
    189          * Arguments  : none
    190          *
    191          * Returns    : The current value of OSTime
    192          *********************************************************************************************************
    193          */
    194          
    195          #if OS_TIME_GET_SET_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    196          INT32U  OSTimeGet (void)
    197          {
   \                     OSTimeGet:
   \   00000000   10B5               PUSH     {R4,LR}
    198          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    199              OS_CPU_SR  cpu_sr;
    200          #endif    
    201              INT32U     ticks;
    202          
    203          
    204              OS_ENTER_CRITICAL();
   \   00000002   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    205              ticks = OSTime;
   \   00000006   ....               LDR      R1,??DataTable10  ;; OSTime
   \   00000008   0C68               LDR      R4,[R1, #+0]
    206              OS_EXIT_CRITICAL();
   \   0000000A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    207              return (ticks);
   \   0000000E   2000               MOVS     R0,R4
   \   00000010   10BC               POP      {R4}
   \   00000012   02BC               POP      {R1}
   \   00000014   0847               BX       R1               ;; return
    208          }
    209          #endif    
    210          
    211          /*
    212          *********************************************************************************************************
    213          *                                            SET SYSTEM CLOCK
    214          *
    215          * Description: This function sets the 32-bit counter which keeps track of the number of clock ticks.
    216          *
    217          * Arguments  : ticks      specifies the new value that OSTime needs to take.
    218          *
    219          * Returns    : none
    220          *********************************************************************************************************
    221          */
    222          
    223          #if OS_TIME_GET_SET_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    224          void  OSTimeSet (INT32U ticks)
    225          {
   \                     OSTimeSet:
   \   00000000   10B5               PUSH     {R4,LR}
   \   00000002   0400               MOVS     R4,R0
    226          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    227              OS_CPU_SR  cpu_sr;
    228          #endif    
    229          
    230          
    231              OS_ENTER_CRITICAL();
   \   00000004   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    232              OSTime = ticks;
   \   00000008   ....               LDR      R1,??DataTable10  ;; OSTime
   \   0000000A   0C60               STR      R4,[R1, #+0]
    233              OS_EXIT_CRITICAL();
   \   0000000C   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    234          }
   \   00000010   10BC               POP      {R4}
   \   00000012   01BC               POP      {R0}
   \   00000014   0047               BX       R0               ;; return

   \                                 In segment CODE, align 4, keep-with-next
   \                     ??DataTable6:
   \   00000000   ........           DC32     OSRdyGrp

   \                                 In segment CODE, align 4, keep-with-next
   \                     ??DataTable8:
   \   00000000   ........           DC32     OSRdyTbl

   \                                 In segment CODE, align 4, keep-with-next
   \                     ??DataTable10:
   \   00000000   ........           DC32     OSTime
    235          #endif    

   Maximum stack usage in bytes:

     Function        CSTACK
     --------        ------
     OSTimeDly          16
     OSTimeDlyHMSM       8
     OSTimeDlyResume    12
     OSTimeGet           8
     OSTimeSet           8


   Segment part sizes:

     Function/Label  Bytes
     --------------  -----
     OSTimeDly         88
     OSTimeDlyHMSM    134
     OSTimeDlyResume  120
     OSTimeGet         22
     OSTimeSet         22
     ??DataTable6       4
     ??DataTable8       4
     ??DataTable10      4
      Others           80

 
 478 bytes in segment CODE
 
 398 bytes of CODE memory (+ 80 bytes shared)

Errors: none
Warnings: none

⌨️ 快捷键说明

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