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

📄 os_sem.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_sem.c                                     #
#    Command line    =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
#                       \Source\os_sem.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_sem.lst                                           #
#    Object file     =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
#                       s_sem.r79                                            #
#                                                                            #
#                                                                            #
##############################################################################

E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II\Source\os_sem.c
      1          /*
      2          *********************************************************************************************************
      3          *                                                uC/OS-II
      4          *                                          The Real-Time Kernel
      5          *                                          SEMAPHORE MANAGEMENT
      6          *
      7          *                          (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
      8          *                                           All Rights Reserved
      9          *
     10          * File    : OS_SEM.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          #if OS_SEM_EN > 0
     29          /*$PAGE*/
     30          /*
     31          *********************************************************************************************************
     32          *                                           ACCEPT SEMAPHORE
     33          *
     34          * Description: This function checks the semaphore to see if a resource is available or, if an event
     35          *              occurred.  Unlike OSSemPend(), OSSemAccept() does not suspend the calling task if the
     36          *              resource is not available or the event did not occur.
     37          *
     38          * Arguments  : pevent     is a pointer to the event control block
     39          *
     40          * Returns    : >  0       if the resource is available or the event did not occur the semaphore is
     41          *                         decremented to obtain the resource.
     42          *              == 0       if the resource is not available or the event did not occur or,
     43          *                         if 'pevent' is a NULL pointer or,
     44          *                         if you didn't pass a pointer to a semaphore
     45          *********************************************************************************************************
     46          */
     47          
     48          #if OS_SEM_ACCEPT_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
     49          INT16U  OSSemAccept (OS_EVENT *pevent)
     50          {
   \                     OSSemAccept:
   \   00000000   70402DE9           PUSH     {R4-R6,LR}
   \   00000004   0040B0E1           MOVS     R4,R0
     51              INT16U     cnt;
     52          #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
     53              OS_CPU_SR  cpu_sr = 0;
   \   00000008   0000A0E3           MOV      R0,#+0
   \   0000000C   0060B0E1           MOVS     R6,R0
     54          #endif
     55          
     56          
     57          
     58          #if OS_ARG_CHK_EN > 0
     59              if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
   \   00000010   000054E3           CMP      R4,#+0
   \   00000014   0100001A           BNE      ??OSSemAccept_0
     60                  return (0);
   \   00000018   0000A0E3           MOV      R0,#+0
   \   0000001C   120000EA           B        ??OSSemAccept_1
     61              }
     62          #endif
     63              if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {   /* Validate event block type                     */
   \                     ??OSSemAccept_0:
   \   00000020   0000D4E5           LDRB     R0,[R4, #+0]
   \   00000024   030050E3           CMP      R0,#+3
   \   00000028   0100000A           BEQ      ??OSSemAccept_2
     64                  return (0);
   \   0000002C   0000A0E3           MOV      R0,#+0
   \   00000030   0D0000EA           B        ??OSSemAccept_1
     65              }
     66              OS_ENTER_CRITICAL();
   \                     ??OSSemAccept_2:
   \   00000034   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
   \   00000038   0060B0E1           MOVS     R6,R0
     67              cnt = pevent->OSEventCnt;
   \   0000003C   B800D4E1           LDRH     R0,[R4, #+8]
   \   00000040   0050B0E1           MOVS     R5,R0
     68              if (cnt > 0) {                                    /* See if resource is available                  */
   \   00000044   010055E3           CMP      R5,#+1
   \   00000048   0400003A           BCC      ??OSSemAccept_3
     69                  pevent->OSEventCnt--;                         /* Yes, decrement semaphore and notify caller    */
   \   0000004C   B800D4E1           LDRH     R0,[R4, #+8]
   \   00000050   FF10A0E3           MOV      R1,#+255
   \   00000054   FF1C81E3           ORR      R1,R1,#0xFF00
   \   00000058   000091E0           ADDS     R0,R1,R0
   \   0000005C   B800C4E1           STRH     R0,[R4, #+8]
     70              }
     71              OS_EXIT_CRITICAL();
   \                     ??OSSemAccept_3:
   \   00000060   0600B0E1           MOVS     R0,R6
   \   00000064   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
     72              return (cnt);                                     /* Return semaphore count                        */
   \   00000068   0500B0E1           MOVS     R0,R5
   \                     ??OSSemAccept_1:
   \   0000006C   7080BDE8           POP      {R4-R6,PC}       ;; return
     73          }
     74          #endif
     75          
     76          /*$PAGE*/
     77          /*
     78          *********************************************************************************************************
     79          *                                           CREATE A SEMAPHORE
     80          *
     81          * Description: This function creates a semaphore.
     82          *
     83          * Arguments  : cnt           is the initial value for the semaphore.  If the value is 0, no resource is
     84          *                            available (or no event has occurred).  You initialize the semaphore to a
     85          *                            non-zero value to specify how many resources are available (e.g. if you have
     86          *                            10 resources, you would initialize the semaphore to 10).
     87          *
     88          * Returns    : != (void *)0  is a pointer to the event control clock (OS_EVENT) associated with the
     89          *                            created semaphore
     90          *              == (void *)0  if no event control blocks were available
     91          *********************************************************************************************************
     92          */
     93          

   \                                 In segment CODE, align 4, keep-with-next
     94          OS_EVENT  *OSSemCreate (INT16U cnt)
     95          {
   \                     OSSemCreate:
   \   00000000   70402DE9           PUSH     {R4-R6,LR}
   \   00000004   0040B0E1           MOVS     R4,R0
     96              OS_EVENT  *pevent;
     97          #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
     98              OS_CPU_SR  cpu_sr = 0;
   \   00000008   0000A0E3           MOV      R0,#+0
   \   0000000C   0060B0E1           MOVS     R6,R0
     99          #endif
    100          
    101          
    102          
    103              if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
   \   00000010   ........           LDR      R0,??DataTable10  ;; OSIntNesting
   \   00000014   0000D0E5           LDRB     R0,[R0, #+0]
   \   00000018   010050E3           CMP      R0,#+1
   \   0000001C   0100003A           BCC      ??OSSemCreate_0
    104                  return ((OS_EVENT *)0);                            /* ... can't CREATE from an ISR             */
   \   00000020   0000A0E3           MOV      R0,#+0
   \   00000024   1D0000EA           B        ??OSSemCreate_1
    105              }
    106              OS_ENTER_CRITICAL();
   \                     ??OSSemCreate_0:
   \   00000028   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
   \   0000002C   0060B0E1           MOVS     R6,R0
    107              pevent = OSEventFreeList;                              /* Get next free event control block        */
   \   00000030   ........           LDR      R0,??DataTable9  ;; OSEventFreeList
   \   00000034   000090E5           LDR      R0,[R0, #+0]
   \   00000038   0050B0E1           MOVS     R5,R0
    108              if (OSEventFreeList != (OS_EVENT *)0) {                /* See if pool of free ECB pool was empty   */
   \   0000003C   ........           LDR      R0,??DataTable9  ;; OSEventFreeList
   \   00000040   000090E5           LDR      R0,[R0, #+0]
   \   00000044   000050E3           CMP      R0,#+0
   \   00000048   0400000A           BEQ      ??OSSemCreate_2
    109                  OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
   \   0000004C   ........           LDR      R0,??DataTable9  ;; OSEventFreeList
   \   00000050   ........           LDR      R1,??DataTable9  ;; OSEventFreeList
   \   00000054   001091E5           LDR      R1,[R1, #+0]
   \   00000058   041091E5           LDR      R1,[R1, #+4]
   \   0000005C   001080E5           STR      R1,[R0, #+0]
    110              }
    111              OS_EXIT_CRITICAL();
   \                     ??OSSemCreate_2:
   \   00000060   0600B0E1           MOVS     R0,R6
   \   00000064   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA

⌨️ 快捷键说明

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