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

📄 os_flag.lst

📁 ARM仿真案例
💻 LST
📖 第 1 页 / 共 5 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.40A/W32 EVALUATION    21/Jul/2006  16:23:24 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
# Time limited license: 22 days left                                         #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  E:\Project\ucos-ii\leddisp\uCOS-II\os_flag.c         #
#    Command line    =  E:\Project\ucos-ii\leddisp\uCOS-II\os_flag.c -lCN    #
#                       E:\Project\ucos-ii\leddisp\Debug\List\ -lA           #
#                       E:\Project\ucos-ii\leddisp\Debug\List\ -o            #
#                       E:\Project\ucos-ii\leddisp\Debug\Obj\ -s9 --no_cse   #
#                       --no_unroll --no_inline --no_code_motion --no_tbaa   #
#                       --no_clustering --no_scheduling --debug --cpu_mode   #
#                       thumb --endian little --cpu ARM7TDMI-S               #
#                       --stack_align 4 --interwork -e --fpu None            #
#                       --dlib_config "e:\Program Files\IAR                  #
#                       Systems\Embedded Workbench 4.0                       #
#                       Evaluation\ARM\LIB\dl4tptinl8n.h" -I                 #
#                       E:\Project\ucos-ii\leddisp\ -I                       #
#                       E:\Project\ucos-ii\leddisp\App\ -I                   #
#                       E:\Project\ucos-ii\leddisp\ARM\ -I                   #
#                       E:\Project\ucos-ii\leddisp\BSP\ -I                   #
#                       E:\Project\ucos-ii\leddisp\uCOS-II\ -I "e:\Program   #
#                       Files\IAR Systems\Embedded Workbench 4.0             #
#                       Evaluation\ARM\INC\"                                 #
#    List file       =  E:\Project\ucos-ii\leddisp\Debug\List\os_flag.lst    #
#    Object file     =  E:\Project\ucos-ii\leddisp\Debug\Obj\os_flag.r79     #
#                                                                            #
#                                                                            #
##############################################################################

E:\Project\ucos-ii\leddisp\uCOS-II\os_flag.c
      1          /*
      2          *********************************************************************************************************
      3          *                                                uC/OS-II
      4          *                                          The Real-Time Kernel
      5          *                                         EVENT FLAG  MANAGEMENT
      6          *
      7          *                          (c) Copyright 2001-2003, Jean J. Labrosse, Weston, FL
      8          *                                           All Rights Reserved
      9          *
     10          * File : OS_FLAG.C
     11          * By   : Jean J. Labrosse
     12          *********************************************************************************************************
     13          */
     14          
     15          #ifndef  OS_MASTER_FILE
     16          #include <ucos_ii.h>
     17          #endif
     18          
     19          #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
     20          /*
     21          *********************************************************************************************************
     22          *                                            LOCAL PROTOTYPES
     23          *********************************************************************************************************
     24          */
     25          
     26          static  void     OS_FlagBlock(OS_FLAG_GRP *pgrp, OS_FLAG_NODE *pnode, OS_FLAGS flags, INT8U wait_type, INT16U timeout);
     27          static  BOOLEAN  OS_FlagTaskRdy(OS_FLAG_NODE *pnode, OS_FLAGS flags_rdy);
     28          
     29          /*$PAGE*/
     30          /*
     31          *********************************************************************************************************
     32          *                              CHECK THE STATUS OF FLAGS IN AN EVENT FLAG GROUP
     33          *
     34          * Description: This function is called to check the status of a combination of bits to be set or cleared
     35          *              in an event flag group.  Your application can check for ANY bit to be set/cleared or ALL
     36          *              bits to be set/cleared.
     37          *
     38          *              This call does not block if the desired flags are not present.
     39          *
     40          * Arguments  : pgrp          is a pointer to the desired event flag group.
     41          *
     42          *              flags         Is a bit pattern indicating which bit(s) (i.e. flags) you wish to check.
     43          *                            The bits you want are specified by setting the corresponding bits in
     44          *                            'flags'.  e.g. if your application wants to wait for bits 0 and 1 then
     45          *                            'flags' would contain 0x03.
     46          *
     47          *              wait_type     specifies whether you want ALL bits to be set/cleared or ANY of the bits
     48          *                            to be set/cleared.
     49          *                            You can specify the following argument:
     50          *
     51          *                            OS_FLAG_WAIT_CLR_ALL   You will check ALL bits in 'flags' to be clear (0)
     52          *                            OS_FLAG_WAIT_CLR_ANY   You will check ANY bit  in 'flags' to be clear (0)
     53          *                            OS_FLAG_WAIT_SET_ALL   You will check ALL bits in 'flags' to be set   (1)
     54          *                            OS_FLAG_WAIT_SET_ANY   You will check ANY bit  in 'flags' to be set   (1)
     55          *
     56          *                            NOTE: Add OS_FLAG_CONSUME if you want the event flag to be 'consumed' by
     57          *                                  the call.  Example, to wait for any flag in a group AND then clear
     58          *                                  the flags that are present, set 'wait_type' to:
     59          *
     60          *                                  OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME
     61          *
     62          *              err           is a pointer to an error code and can be:
     63          *                            OS_NO_ERR              No error
     64          *                            OS_ERR_EVENT_TYPE      You are not pointing to an event flag group
     65          *                            OS_FLAG_ERR_WAIT_TYPE  You didn't specify a proper 'wait_type' argument.
     66          *                            OS_FLAG_INVALID_PGRP   You passed a NULL pointer instead of the event flag
     67          *                                                   group handle.
     68          *                            OS_FLAG_ERR_NOT_RDY    The desired flags you are waiting for are not
     69          *                                                   available.
     70          *
     71          * Returns    : The flags in the event flag group that made the task ready or, 0 if a timeout or an error 
     72          *              occurred.
     73          *
     74          * Called from: Task or ISR
     75          *
     76          * Note(s)    : 1) IMPORTANT, the behavior of this function has changed from PREVIOUS versions.  The
     77          *                 function NOW returns the flags that were ready INSTEAD of the current state of the 
     78          *                 event flags.
     79          *********************************************************************************************************
     80          */
     81          
     82          #if OS_FLAG_ACCEPT_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
     83          OS_FLAGS  OSFlagAccept (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT8U *err)
     84          {
   \                     OSFlagAccept:
   \   00000000   F2B5               PUSH     {R1,R4-R7,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   1700               MOVS     R7,R2
   \   00000006   1D00               MOVS     R5,R3
     85          #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
     86              OS_CPU_SR     cpu_sr;
     87          #endif
     88              OS_FLAGS      flags_rdy;
     89              BOOLEAN       consume;
     90          
     91          
     92          #if OS_ARG_CHK_EN > 0
     93              if (pgrp == (OS_FLAG_GRP *)0) {                        /* Validate 'pgrp'                          */
   \   00000008   002C               CMP      R4,#+0
   \   0000000A   03D1               BNE      ??OSFlagAccept_0
     94                  *err = OS_FLAG_INVALID_PGRP;
   \   0000000C   9620               MOVS     R0,#+150
   \                     ??OSFlagAccept_1:
   \   0000000E   2870               STRB     R0,[R5, #+0]
     95                  return ((OS_FLAGS)0);
   \   00000010   0020               MOVS     R0,#+0
   \   00000012   48E0               B        ??OSFlagAccept_2
     96              }
     97          #endif
     98              if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {          /* Validate event block type                */
   \                     ??OSFlagAccept_0:
   \   00000014   2078               LDRB     R0,[R4, #+0]
   \   00000016   0528               CMP      R0,#+5
   \   00000018   01D0               BEQ      ??OSFlagAccept_3
     99                  *err = OS_ERR_EVENT_TYPE;
   \   0000001A   0120               MOVS     R0,#+1
   \   0000001C   F7E7               B.N      ??OSFlagAccept_1
    100                  return ((OS_FLAGS)0);
    101              }
    102              if (wait_type & OS_FLAG_CONSUME) {                     /* See if we need to consume the flags      */
   \                     ??OSFlagAccept_3:
   \   0000001E   3806               LSLS     R0,R7,#+24
   \   00000020   03D5               BPL      ??OSFlagAccept_4
    103                  wait_type &= ~OS_FLAG_CONSUME;
   \   00000022   7F06               LSLS     R7,R7,#+25
   \   00000024   7F0E               LSRS     R7,R7,#+25
    104                  consume    = TRUE;
   \   00000026   0126               MOVS     R6,#+1
   \   00000028   00E0               B        ??OSFlagAccept_5
    105              } else {
    106                  consume    = FALSE;
   \                     ??OSFlagAccept_4:
   \   0000002A   0026               MOVS     R6,#+0
    107              }
    108          /*$PAGE*/
    109              *err = OS_NO_ERR;                                      /* Assume NO error until proven otherwise.  */
   \                     ??OSFlagAccept_5:
   \   0000002C   0020               MOVS     R0,#+0
   \   0000002E   2870               STRB     R0,[R5, #+0]
    110              OS_ENTER_CRITICAL();
   \   00000030   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    111              switch (wait_type) {
   \   00000034   002F               CMP      R7,#+0
   \   00000036   1DD0               BEQ      ??OSFlagAccept_6
   \   00000038   012F               CMP      R7,#+1
   \   0000003A   28D0               BEQ      ??OSFlagAccept_7
   \   0000003C   022F               CMP      R7,#+2
   \   0000003E   02D0               BEQ      ??OSFlagAccept_8
   \   00000040   032F               CMP      R7,#+3
   \   00000042   11D0               BEQ      ??OSFlagAccept_9
   \   00000044   29E0               B        ??OSFlagAccept_10
    112                  case OS_FLAG_WAIT_SET_ALL:                         /* See if all required flags are set        */
    113                       flags_rdy = pgrp->OSFlagFlags & flags;        /* Extract only the bits we want            */
   \                     ??OSFlagAccept_8:
   \   00000046   2189               LDRH     R1,[R4, #+8]
   \   00000048   6A46               MOV      R2,SP
   \   0000004A   1788               LDRH     R7,[R2, #+0]
   \   0000004C   0F40               ANDS     R7,R7,R1
    114                       if (flags_rdy == flags) {                     /* Must match ALL the bits that we want     */
   \   0000004E   1288               LDRH     R2,[R2, #+0]
   \   00000050   9742               CMP      R7,R2
   \   00000052   04D1               BNE      ??OSFlagAccept_11
    115                           if (consume == TRUE) {                    /* See if we need to consume the flags      */
   \                     ??OSFlagAccept_12:
   \   00000054   012E               CMP      R6,#+1
   \   00000056   04D1               BNE      ??OSFlagAccept_13
    116                               pgrp->OSFlagFlags &= ~flags_rdy;      /* Clear ONLY the flags that we wanted      */
   \   00000058   B943               BICS     R1,R1,R7
   \   0000005A   2181               STRH     R1,[R4, #+8]
   \   0000005C   01E0               B        ??OSFlagAccept_13

⌨️ 快捷键说明

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