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

📄 os_mutex.lst

📁 stm32+ucos-ii
💻 LST
📖 第 1 页 / 共 5 页
字号:
###############################################################################
#                                                                             #
# IAR ANSI C/C++ Compiler V6.10.2.52244/W32 for ARM     07/Aug/2011  12:10:29 #
# Copyright 1999-2010 IAR Systems AB.                                         #
#                                                                             #
#    Cpu mode     =  thumb                                                    #
#    Endian       =  little                                                   #
#    Source file  =  F:\stm32\我的程序\Micrium\Software\uCOS-II\Source\os_mut #
#                    ex.c                                                     #
#    Command line =  F:\stm32\我的程序\Micrium\Software\uCOS-II\Source\os_mut #
#                    ex.c -D USE_STDPERIPH_DRIVER -D STM32F10X_CL -lCN        #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Flash\Lis #
#                    t\ -o F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Fla #
#                    sh\Obj\ --no_cse --no_unroll --no_inline                 #
#                    --no_code_motion --no_tbaa --no_clustering               #
#                    --no_scheduling --debug --endian=little --cpu=Cortex-M3  #
#                    -e --fpu=None --dlib_config                              #
#                    D:\arm\INC\c\DLib_Config_Normal.h -I                     #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\APP\ -I   #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP\   #
#                    -I F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP #
#                    \ST\CMSIS\CM3\CoreSupport\ -I                            #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP\ST #
#                    \CMSIS\CM3\DeviceSupport\ST\STM32F10x\ -I                #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP\ST #
#                    \STM32F10x_StdPeriph_Driver\inc\ -I                      #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP\uC #
#                    OS-II\ -I F:\stm32\我的程序\Micrium\Software\EWARM\OS-II #
#                    \..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\IAR\ -I       #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\..\uCO #
#                    S-II\Source\ -I F:\stm32\我的程序\Micrium\Software\EWARM #
#                    \OS-II\..\..\uC-LIB\ -I F:\stm32\我的程序\Micrium\Softwa #
#                    re\EWARM\OS-II\..\..\uC-LIB\Ports\ARM-Cortex-M3\IAR\ -I  #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\..\uC- #
#                    CPU\ -I F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\. #
#                    .\..\uC-CPU\ARM-Cortex-M3\IAR\ -On --use_c++_inline      #
#    List file    =  F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Flash\Lis #
#                    t\os_mutex.lst                                           #
#    Object file  =  F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Flash\Obj #
#                    \os_mutex.o                                              #
#                                                                             #
#                                                                             #
###############################################################################

F:\stm32\我的程序\Micrium\Software\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-2010, Micrium, Weston, FL
      8          *                                           All Rights Reserved
      9          *
     10          * File    : OS_MUTEX.C
     11          * By      : Jean J. Labrosse
     12          * Version : V2.92
     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 > 0u
     30          /*
     31          *********************************************************************************************************
     32          *                                            LOCAL CONSTANTS
     33          *********************************************************************************************************
     34          */
     35          
     36          #define  OS_MUTEX_KEEP_LOWER_8   ((INT16U)0x00FFu)
     37          #define  OS_MUTEX_KEEP_UPPER_8   ((INT16U)0xFF00u)
     38          
     39          #define  OS_MUTEX_AVAILABLE      ((INT16U)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          *              perr       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_PCP_LOWER    If the priority of the task that owns the Mutex is
     66          *                                                HIGHER (i.e. a lower number) than the PCP.  This error
     67          *                                                indicates that you did not set the PCP 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    : == OS_TRUE    if the resource is available, the mutual exclusion semaphore is acquired
     74          *              == OS_FALSE   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 > 0u

   \                                 In section .text, align 2, keep-with-next
     84          BOOLEAN  OSMutexAccept (OS_EVENT  *pevent,
     85                                  INT8U     *perr)
     86          {
   \                     OSMutexAccept:
   \   00000000   F8B5               PUSH     {R3-R7,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
     87              INT8U      pcp;                                    /* Priority Ceiling Priority (PCP)              */
     88          #if OS_CRITICAL_METHOD == 3u                           /* Allocate storage for CPU status register     */
     89              OS_CPU_SR  cpu_sr = 0u;
   \   00000006   0027               MOVS     R7,#+0
     90          #endif
     91          
     92          
     93          
     94          #ifdef OS_SAFETY_CRITICAL
     95              if (perr == (INT8U *)0) {
     96                  OS_SAFETY_CRITICAL_EXCEPTION();
     97                  return (OS_FALSE);
     98              }
     99          #endif
    100          
    101          #if OS_ARG_CHK_EN > 0u
    102              if (pevent == (OS_EVENT *)0) {                     /* Validate 'pevent'                            */
    103                  *perr = OS_ERR_PEVENT_NULL;
    104                  return (OS_FALSE);
    105              }
    106          #endif
    107              if (pevent->OSEventType != OS_EVENT_TYPE_MUTEX) {  /* Validate event block type                    */
   \   00000008   2078               LDRB     R0,[R4, #+0]
   \   0000000A   0428               CMP      R0,#+4
   \   0000000C   03D0               BEQ.N    ??OSMutexAccept_0
    108                  *perr = OS_ERR_EVENT_TYPE;
   \   0000000E   0120               MOVS     R0,#+1
   \   00000010   2870               STRB     R0,[R5, #+0]
    109                  return (OS_FALSE);
   \   00000012   0020               MOVS     R0,#+0
   \   00000014   41E0               B.N      ??OSMutexAccept_1
    110              }
    111              if (OSIntNesting > 0u) {                           /* Make sure it's not called from an ISR        */
   \                     ??OSMutexAccept_0:
   \   00000016   ........           LDR.W    R0,??DataTable7
   \   0000001A   0078               LDRB     R0,[R0, #+0]
   \   0000001C   0028               CMP      R0,#+0
   \   0000001E   03D0               BEQ.N    ??OSMutexAccept_2
    112                  *perr = OS_ERR_PEND_ISR;
   \   00000020   0220               MOVS     R0,#+2
   \   00000022   2870               STRB     R0,[R5, #+0]
    113                  return (OS_FALSE);
   \   00000024   0020               MOVS     R0,#+0
   \   00000026   38E0               B.N      ??OSMutexAccept_1
    114              }
    115              OS_ENTER_CRITICAL();                               /* Get value (0 or 1) of Mutex                  */
   \                     ??OSMutexAccept_2:
   \   00000028   ........           BL       OS_CPU_SR_Save
   \   0000002C   0700               MOVS     R7,R0
    116              pcp = (INT8U)(pevent->OSEventCnt >> 8u);           /* Get PCP from mutex                           */
   \   0000002E   2089               LDRH     R0,[R4, #+8]
   \   00000030   80B2               UXTH     R0,R0            ;; ZeroExt  R0,R0,#+16,#+16
   \   00000032   000A               LSRS     R0,R0,#+8
   \   00000034   0600               MOVS     R6,R0
    117              if ((pevent->OSEventCnt & OS_MUTEX_KEEP_LOWER_8) == OS_MUTEX_AVAILABLE) {
   \   00000036   207A               LDRB     R0,[R4, #+8]
   \   00000038   C0B2               UXTB     R0,R0            ;; ZeroExt  R0,R0,#+24,#+24
   \   0000003A   FF28               CMP      R0,#+255
   \   0000003C   27D1               BNE.N    ??OSMutexAccept_3
    118                  pevent->OSEventCnt &= OS_MUTEX_KEEP_UPPER_8;   /*      Mask off LSByte (Acquire Mutex)         */
   \   0000003E   2089               LDRH     R0,[R4, #+8]
   \   00000040   10F47F40           ANDS     R0,R0,#0xFF00
   \   00000044   2081               STRH     R0,[R4, #+8]
    119                  pevent->OSEventCnt |= OSTCBCur->OSTCBPrio;     /*      Save current task priority in LSByte    */

⌨️ 快捷键说明

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