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

📄 os_tmr.lst

📁 lpc2478开发板基于IAR编译器移植ucos实验例程
💻 LST
📖 第 1 页 / 共 5 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    12/Dec/2008  17:14:26 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  arm                                                  #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
#                       \Source\os_tmr.c                                     #
#    Command line    =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
#                       \Source\os_tmr.c -lCN E:\IAR_2478\IAR_2478\26uCOS\Sr #
#                       c\uCOS\RAM_Debug\List\ -o                            #
#                       E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\  #
#                       -z2 --no_cse --no_unroll --no_inline                 #
#                       --no_code_motion --no_tbaa --no_clustering           #
#                       --no_scheduling --debug --cpu_mode arm --endian      #
#                       little --cpu ARM7TDMI-S --stack_align 4 -e --fpu     #
#                       None --dlib_config "C:\Program Files\IAR             #
#                       Systems\Embedded Workbench 4.0                       #
#                       Evaluation\arm\LIB\dl4tpannl8n.h" -I                 #
#                       E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\include\ -I     #
#                       E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\ucos-ii\include #
#                       \ -I "C:\Program Files\IAR Systems\Embedded          #
#                       Workbench 4.0 Evaluation\arm\INC\"                   #
#    List file       =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\List\ #
#                       os_tmr.lst                                           #
#    Object file     =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
#                       s_tmr.r79                                            #
#                                                                            #
#                                                                            #
##############################################################################

E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II\Source\os_tmr.c
      1          /*
      2          ************************************************************************************************************************
      3          *                                                      uC/OS-III
      4          *                                                 The Real-Time Kernel
      5          *
      6          *                                     (c) Copyright 2005-2007, Micrium, Weston, FL
      7          *                                                  All Rights Reserved
      8          *
      9          *                                                   TIMER MANAGEMENT
     10          *
     11          * File    : OS_TMR.C
     12          * By      : Jean J. Labrosse
     13          * Version : V2.84
     14          *
     15          * LICENSING TERMS:
     16          * ---------------
     17          *   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
     18          * If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
     19          * its use in your product. We provide ALL the source code for your convenience and to help you experience 
     20          * uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
     21          * licensing fee.
     22          ************************************************************************************************************************
     23          */
     24          
     25          #include <ucos_ii.h>
     26          
     27          /*
     28          ************************************************************************************************************************
     29          *                                                        NOTES
     30          *
     31          * 1) Your application MUST define the following #define constants:
     32          *
     33          *    OS_TASK_TMR_PRIO          The priority of the Timer management task
     34          *    OS_TASK_TMR_STK_SIZE      The size     of the Timer management task's stack
     35          *
     36          * 2) You must call OSTmrSignal() to notify the Timer management task that it's time to update the timers.
     37          ************************************************************************************************************************
     38          */
     39          
     40          /*
     41          ************************************************************************************************************************
     42          *                                                     CONSTANTS
     43          ************************************************************************************************************************
     44          */
     45          
     46          #define  OS_TMR_LINK_DLY       0
     47          #define  OS_TMR_LINK_PERIODIC  1
     48          
     49          /*
     50          ************************************************************************************************************************
     51          *                                                  LOCAL PROTOTYPES
     52          ************************************************************************************************************************
     53          */
     54          
     55          #if OS_TMR_EN > 0
     56          static  OS_TMR  *OSTmr_Alloc         (void);
     57          static  void     OSTmr_Free          (OS_TMR *ptmr);
     58          static  void     OSTmr_InitTask      (void);
     59          static  void     OSTmr_Link          (OS_TMR *ptmr, INT8U type);
     60          static  void     OSTmr_Unlink        (OS_TMR *ptmr);
     61          static  void     OSTmr_Lock          (void);
     62          static  void     OSTmr_Unlock        (void);
     63          static  void     OSTmr_Task          (void   *p_arg);
     64          #endif
     65          
     66          /*$PAGE*/
     67          /*
     68          ************************************************************************************************************************
     69          *                                                   CREATE A TIMER
     70          *
     71          * Description: This function is called by your application code to create a timer.
     72          *
     73          * Arguments  : dly           Initial delay.
     74          *                            If the timer is configured for ONE-SHOT mode, this is the timeout used
     75          *                            If the timer is configured for PERIODIC mode, this is the first timeout to wait for
     76          *                               before the timer starts entering periodic mode
     77          *
     78          *              period        The 'period' being repeated for the timer.
     79          *                               If you specified 'OS_TMR_OPT_PERIODIC' as an option, when the timer expires, it will
     80          *                               automatically restart with the same period.
     81          *
     82          *              opt           Specifies either:
     83          *                               OS_TMR_OPT_ONE_SHOT       The timer counts down only once
     84          *                               OS_TMR_OPT_PERIODIC       The timer counts down and then reloads itself
     85          *
     86          *              callback      Is a pointer to a callback function that will be called when the timer expires.  The
     87          *                               callback function must be declared as follows:
     88          *
     89          *                               void MyCallback (OS_TMR *ptmr, void *p_arg);
     90          *
     91          *              callback_arg  Is an argument (a pointer) that is passed to the callback function when it is called.
     92          *
     93          *              pname         Is a pointer to an ASCII string that is used to name the timer.  Names are useful for
     94          *                               debugging.  The length of the ASCII string for the name can be as big as:
     95          *
     96          *                               OS_TMR_CFG_NAME_SIZE and should be found in OS_CFG.H
     97          *
     98          *              perr          Is a pointer to an error code.  '*perr' will contain one of the following:
     99          *                               OS_ERR_NONE
    100          *                               OS_ERR_TMR_INVALID_DLY     you specified an invalid delay
    101          *                               OS_ERR_TMR_INVALID_PERIOD  you specified an invalid period
    102          *                               OS_ERR_TMR_INVALID_OPT     you specified an invalid option
    103          *                               OS_ERR_TMR_ISR             if the call was made from an ISR
    104          *                               OS_ERR_TMR_NON_AVAIL       if there are no free timers from the timer pool
    105          *                               OS_ERR_TMR_NAME_TOO_LONG   if the timer name is too long to fit
    106          *
    107          * Returns    : A pointer to an OS_TMR data structure.  This is the 'handle' that you application will use to reference
    108          *              the timer created/started.
    109          ************************************************************************************************************************
    110          */
    111          
    112          #if OS_TMR_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    113          OS_TMR  *OSTmrCreate (INT32U           dly,
    114                                INT32U           period,
    115                                INT8U            opt,
    116                                OS_TMR_CALLBACK  callback,
    117                                void            *callback_arg,
    118                                INT8U           *pname,
    119                                INT8U           *perr)
    120          {
   \                     OSTmrCreate:
   \   00000000   F84F2DE9           PUSH     {R3-R11,LR}
   \   00000004   0040B0E1           MOVS     R4,R0
   \   00000008   0150B0E1           MOVS     R5,R1
   \   0000000C   0260B0E1           MOVS     R6,R2
   \   00000010   28709DE5           LDR      R7,[SP, #+40]
   \   00000014   2C809DE5           LDR      R8,[SP, #+44]
   \   00000018   30909DE5           LDR      R9,[SP, #+48]
    121              OS_TMR   *ptmr;
    122          #if OS_TMR_CFG_NAME_SIZE > 0
    123              INT8U     len;
    124          #endif
    125          
    126          
    127          #if OS_ARG_CHK_EN > 0
    128              if (perr == (INT8U *)0) {                               /* Validate arguments                                     */
   \   0000001C   000059E3           CMP      R9,#+0
   \   00000020   0100001A           BNE      ??OSTmrCreate_0
    129                  return ((OS_TMR *)0);
   \   00000024   0000A0E3           MOV      R0,#+0
   \   00000028   460000EA           B        ??OSTmrCreate_1
    130              }
    131              switch (opt) {
   \                     ??OSTmrCreate_0:
   \   0000002C   0600B0E1           MOVS     R0,R6
   \   00000030   010050E3           CMP      R0,#+1
   \   00000034   0700000A           BEQ      ??OSTmrCreate_2
   \   00000038   020050E3           CMP      R0,#+2
   \   0000003C   0B00001A           BNE      ??OSTmrCreate_3
    132                  case OS_TMR_OPT_PERIODIC:
    133                       if (period == 0) {
   \                     ??OSTmrCreate_4:
   \   00000040   000055E3           CMP      R5,#+0
   \   00000044   0D00001A           BNE      ??OSTmrCreate_5
    134                           *perr = OS_ERR_TMR_INVALID_PERIOD;
   \   00000048   8300A0E3           MOV      R0,#+131
   \   0000004C   0000C9E5           STRB     R0,[R9, #+0]
    135                           return ((OS_TMR *)0);
   \   00000050   0000A0E3           MOV      R0,#+0
   \   00000054   3B0000EA           B        ??OSTmrCreate_1
    136                       }
    137                       break;
    138          
    139                  case OS_TMR_OPT_ONE_SHOT:
    140                       if (dly == 0) {
   \                     ??OSTmrCreate_2:
   \   00000058   000054E3           CMP      R4,#+0
   \   0000005C   0700001A           BNE      ??OSTmrCreate_5
    141                           *perr = OS_ERR_TMR_INVALID_DLY;
   \   00000060   8200A0E3           MOV      R0,#+130
   \   00000064   0000C9E5           STRB     R0,[R9, #+0]
    142                           return ((OS_TMR *)0);
   \   00000068   0000A0E3           MOV      R0,#+0
   \   0000006C   350000EA           B        ??OSTmrCreate_1
    143                       }
    144                       break;
    145          
    146                  default:
    147                       *perr = OS_ERR_TMR_INVALID_OPT;
   \                     ??OSTmrCreate_3:
   \   00000070   8400A0E3           MOV      R0,#+132
   \   00000074   0000C9E5           STRB     R0,[R9, #+0]
    148                       return ((OS_TMR *)0);
   \   00000078   0000A0E3           MOV      R0,#+0
   \   0000007C   310000EA           B        ??OSTmrCreate_1
    149              }

⌨️ 快捷键说明

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