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

📄 os_mutex.lst

📁 lpc2478开发板基于IAR编译器移植ucos实验例程
💻 LST
📖 第 1 页 / 共 5 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    12/Dec/2008  17:14:25 #
# 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_mutex.c                                   #
#    Command line    =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
#                       \Source\os_mutex.c -lCN E:\IAR_2478\IAR_2478\26uCOS\ #
#                       Src\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_mutex.lst                                         #
#    Object file     =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
#                       s_mutex.r79                                          #
#                                                                            #
#                                                                            #
##############################################################################

E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II\Source\os_mutex.c
      1          /*
      2          *********************************************************************************************************
      3          *                                                uC/OS-II
      4          *                                          The Real-Time Kernel
      5          *                                  MUTUAL EXCLUSION SEMAPHORE MANAGEMENT
      6          *
      7          *                          (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
      8          *                                           All Rights Reserved
      9          *
     10          * File    : OS_MUTEX.C
     11          * By      : Jean J. Labrosse
     12          * Version : V2.84
     13          *
     14          * LICENSING TERMS:
     15          * ---------------
     16          *   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
     17          * If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
     18          * its use in your product. We provide ALL the source code for your convenience and to help you experience 
     19          * uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
     20          * licensing fee.
     21          *********************************************************************************************************
     22          */
     23          
     24          #ifndef  OS_MASTER_FILE
     25          #include <ucos_ii.h>
     26          #endif
     27          
     28          
     29          #if OS_MUTEX_EN > 0
     30          /*
     31          *********************************************************************************************************
     32          *                                            LOCAL CONSTANTS
     33          *********************************************************************************************************
     34          */
     35          
     36          #define  OS_MUTEX_KEEP_LOWER_8   0x00FFu
     37          #define  OS_MUTEX_KEEP_UPPER_8   0xFF00u
     38          
     39          #define  OS_MUTEX_AVAILABLE      0x00FFu
     40          
     41          /*
     42          *********************************************************************************************************
     43          *                                            LOCAL CONSTANTS
     44          *********************************************************************************************************
     45          */
     46          
     47          static  void  OSMutex_RdyAtPrio(OS_TCB *ptcb, INT8U prio);
     48          
     49          /*$PAGE*/
     50          /*
     51          *********************************************************************************************************
     52          *                                   ACCEPT MUTUAL EXCLUSION SEMAPHORE
     53          *
     54          * Description: This  function checks the mutual exclusion semaphore to see if a resource is available.
     55          *              Unlike OSMutexPend(), OSMutexAccept() does not suspend the calling task if the resource is
     56          *              not available or the event did not occur.
     57          *
     58          * Arguments  : pevent     is a pointer to the event control block
     59          *
     60          *              err        is a pointer to an error code which will be returned to your application:
     61          *                            OS_ERR_NONE         if the call was successful.
     62          *                            OS_ERR_EVENT_TYPE   if 'pevent' is not a pointer to a mutex
     63          *                            OS_ERR_PEVENT_NULL  'pevent' is a NULL pointer
     64          *                            OS_ERR_PEND_ISR     if you called this function from an ISR
     65          *                            OS_ERR_PIP_LOWER    If the priority of the task that owns the Mutex is
     66          *                                                HIGHER (i.e. a lower number) than the PIP.  This error
     67          *                                                indicates that you did not set the PIP higher (lower
     68          *                                                number) than ALL the tasks that compete for the Mutex.
     69          *                                                Unfortunately, this is something that could not be
     70          *                                                detected when the Mutex is created because we don't know
     71          *                                                what tasks will be using the Mutex.
     72          *
     73          * Returns    : == 1       if the resource is available, the mutual exclusion semaphore is acquired
     74          *              == 0       a) if the resource is not available
     75          *                         b) you didn't pass a pointer to a mutual exclusion semaphore
     76          *                         c) you called this function from an ISR
     77          *
     78          * Warning(s) : This function CANNOT be called from an ISR because mutual exclusion semaphores are
     79          *              intended to be used by tasks only.
     80          *********************************************************************************************************
     81          */
     82          
     83          #if OS_MUTEX_ACCEPT_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
     84          INT8U  OSMutexAccept (OS_EVENT *pevent, INT8U *err)
     85          {
   \                     OSMutexAccept:
   \   00000000   F0402DE9           PUSH     {R4-R7,LR}
   \   00000004   0040B0E1           MOVS     R4,R0
   \   00000008   0150B0E1           MOVS     R5,R1
     86              INT8U      pip;                                    /* Priority Inheritance Priority (PIP)          */
     87          #if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
     88              OS_CPU_SR  cpu_sr = 0;
   \   0000000C   0000A0E3           MOV      R0,#+0
   \   00000010   0070B0E1           MOVS     R7,R0
     89          #endif
     90          
     91          
     92          
     93          #if OS_ARG_CHK_EN > 0
     94              if (err == (INT8U *)0) {                           /* Validate 'err'                               */
   \   00000014   000055E3           CMP      R5,#+0
   \   00000018   0100001A           BNE      ??OSMutexAccept_0
     95                  return (0);
   \   0000001C   0000A0E3           MOV      R0,#+0
   \   00000020   3F0000EA           B        ??OSMutexAccept_1
     96              }
     97              if (pevent == (OS_EVENT *)0) {                     /* Validate 'pevent'                            */
   \                     ??OSMutexAccept_0:
   \   00000024   000054E3           CMP      R4,#+0
   \   00000028   0300001A           BNE      ??OSMutexAccept_2
     98                  *err = OS_ERR_PEVENT_NULL;
   \   0000002C   0400A0E3           MOV      R0,#+4
   \   00000030   0000C5E5           STRB     R0,[R5, #+0]
     99                  return (0);
   \   00000034   0000A0E3           MOV      R0,#+0
   \   00000038   390000EA           B        ??OSMutexAccept_1
    100              }
    101          #endif
    102              if (pevent->OSEventType != OS_EVENT_TYPE_MUTEX) {  /* Validate event block type                    */
   \                     ??OSMutexAccept_2:
   \   0000003C   0000D4E5           LDRB     R0,[R4, #+0]
   \   00000040   040050E3           CMP      R0,#+4
   \   00000044   0300000A           BEQ      ??OSMutexAccept_3
    103                  *err = OS_ERR_EVENT_TYPE;
   \   00000048   0100A0E3           MOV      R0,#+1
   \   0000004C   0000C5E5           STRB     R0,[R5, #+0]
    104                  return (0);
   \   00000050   0000A0E3           MOV      R0,#+0
   \   00000054   320000EA           B        ??OSMutexAccept_1
    105              }
    106              if (OSIntNesting > 0) {                            /* Make sure it's not called from an ISR        */
   \                     ??OSMutexAccept_3:
   \   00000058   ........           LDR      R0,??DataTable47  ;; OSIntNesting
   \   0000005C   0000D0E5           LDRB     R0,[R0, #+0]
   \   00000060   010050E3           CMP      R0,#+1
   \   00000064   0300003A           BCC      ??OSMutexAccept_4
    107                  *err = OS_ERR_PEND_ISR;
   \   00000068   0200A0E3           MOV      R0,#+2
   \   0000006C   0000C5E5           STRB     R0,[R5, #+0]
    108                  return (0);
   \   00000070   0000A0E3           MOV      R0,#+0
   \   00000074   2A0000EA           B        ??OSMutexAccept_1
    109              }
    110              OS_ENTER_CRITICAL();                               /* Get value (0 or 1) of Mutex                  */
   \                     ??OSMutexAccept_4:
   \   00000078   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
   \   0000007C   0070B0E1           MOVS     R7,R0
    111              pip = (INT8U)(pevent->OSEventCnt >> 8);            /* Get PIP from mutex                           */
   \   00000080   B800D4E1           LDRH     R0,[R4, #+8]
   \   00000084   2004B0E1           LSRS     R0,R0,#+8
   \   00000088   0060B0E1           MOVS     R6,R0
    112              if ((pevent->OSEventCnt & OS_MUTEX_KEEP_LOWER_8) == OS_MUTEX_AVAILABLE) {
   \   0000008C   B800D4E1           LDRH     R0,[R4, #+8]
   \   00000090   FF0010E2           ANDS     R0,R0,#0xFF
   \   00000094   FF0050E3           CMP      R0,#+255
   \   00000098   1C00001A           BNE      ??OSMutexAccept_5
    113                  pevent->OSEventCnt &= OS_MUTEX_KEEP_UPPER_8;   /*      Mask off LSByte (Acquire Mutex)         */
   \   0000009C   B800D4E1           LDRH     R0,[R4, #+8]
   \   000000A0   FF0C10E2           ANDS     R0,R0,#0xFF00
   \   000000A4   B800C4E1           STRH     R0,[R4, #+8]
    114                  pevent->OSEventCnt |= OSTCBCur->OSTCBPrio;     /*      Save current task priority in LSByte    */
   \   000000A8   B800D4E1           LDRH     R0,[R4, #+8]
   \   000000AC   ........           LDR      R1,??DataTable44  ;; OSTCBCur
   \   000000B0   001091E5           LDR      R1,[R1, #+0]

⌨️ 快捷键说明

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