📄 os_sem.lst
字号:
###############################################################################
# #
# IAR ANSI C/C++ Compiler V6.10.2.52244/W32 for ARM 07/Aug/2011 12:10:30 #
# Copyright 1999-2010 IAR Systems AB. #
# #
# Cpu mode = thumb #
# Endian = little #
# Source file = F:\stm32\我的程序\Micrium\Software\uCOS-II\Source\os_sem #
# .c #
# Command line = F:\stm32\我的程序\Micrium\Software\uCOS-II\Source\os_sem #
# .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_sem.lst #
# Object file = F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Flash\Obj #
# \os_sem.o #
# #
# #
###############################################################################
F:\stm32\我的程序\Micrium\Software\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-2010, Micrium, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_SEM.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 #if OS_SEM_EN > 0u
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 > 0u
\ In section .text, align 2, keep-with-next
49 INT16U OSSemAccept (OS_EVENT *pevent)
50 {
\ OSSemAccept:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0400 MOVS R4,R0
51 INT16U cnt;
52 #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */
53 OS_CPU_SR cpu_sr = 0u;
\ 00000004 0026 MOVS R6,#+0
54 #endif
55
56
57
58 #if OS_ARG_CHK_EN > 0u
59 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
60 return (0u);
61 }
62 #endif
63 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
\ 00000006 2078 LDRB R0,[R4, #+0]
\ 00000008 0328 CMP R0,#+3
\ 0000000A 01D0 BEQ.N ??OSSemAccept_0
64 return (0u);
\ 0000000C 0020 MOVS R0,#+0
\ 0000000E 0FE0 B.N ??OSSemAccept_1
65 }
66 OS_ENTER_CRITICAL();
\ ??OSSemAccept_0:
\ 00000010 ........ BL OS_CPU_SR_Save
\ 00000014 0600 MOVS R6,R0
67 cnt = pevent->OSEventCnt;
\ 00000016 2089 LDRH R0,[R4, #+8]
\ 00000018 0500 MOVS R5,R0
68 if (cnt > 0u) { /* See if resource is available */
\ 0000001A ADB2 UXTH R5,R5 ;; ZeroExt R5,R5,#+16,#+16
\ 0000001C 002D CMP R5,#+0
\ 0000001E 02D0 BEQ.N ??OSSemAccept_2
69 pevent->OSEventCnt--; /* Yes, decrement semaphore and notify caller */
\ 00000020 2089 LDRH R0,[R4, #+8]
\ 00000022 401E SUBS R0,R0,#+1
\ 00000024 2081 STRH R0,[R4, #+8]
70 }
71 OS_EXIT_CRITICAL();
\ ??OSSemAccept_2:
\ 00000026 3000 MOVS R0,R6
\ 00000028 ........ BL OS_CPU_SR_Restore
72 return (cnt); /* Return semaphore count */
\ 0000002C 2800 MOVS R0,R5
\ 0000002E 80B2 UXTH R0,R0 ;; ZeroExt R0,R0,#+16,#+16
\ ??OSSemAccept_1:
\ 00000030 70BD 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 block (OS_EVENT) associated with the
89 * created semaphore
90 * == (void *)0 if no event control blocks were available
91 *********************************************************************************************************
92 */
93
\ In section .text, align 2, keep-with-next
94 OS_EVENT *OSSemCreate (INT16U cnt)
95 {
\ OSSemCreate:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0400 MOVS R4,R0
96 OS_EVENT *pevent;
97 #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */
98 OS_CPU_SR cpu_sr = 0u;
\ 00000004 0026 MOVS R6,#+0
99 #endif
100
101
102
103 #ifdef OS_SAFETY_CRITICAL_IEC61508
104 if (OSSafetyCriticalStartFlag == OS_TRUE) {
105 OS_SAFETY_CRITICAL_EXCEPTION();
106 return ((OS_EVENT *)0);
107 }
108 #endif
109
110 if (OSIntNesting > 0u) { /* See if called from ISR ... */
\ 00000006 .... LDR.N R0,??DataTable3_1
\ 00000008 0078 LDRB R0,[R0, #+0]
\ 0000000A 0028 CMP R0,#+0
\ 0000000C 01D0 BEQ.N ??OSSemCreate_0
111 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
\ 0000000E 0020 MOVS R0,#+0
\ 00000010 1EE0 B.N ??OSSemCreate_1
112 }
113 OS_ENTER_CRITICAL();
\ ??OSSemCreate_0:
\ 00000012 ........ BL OS_CPU_SR_Save
\ 00000016 0600 MOVS R6,R0
114 pevent = OSEventFreeList; /* Get next free event control block */
\ 00000018 .... LDR.N R0,??DataTable3_2
\ 0000001A 0068 LDR R0,[R0, #+0]
\ 0000001C 0500 MOVS R5,R0
115 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
\ 0000001E .... LDR.N R0,??DataTable3_2
\ 00000020 0068 LDR R0,[R0, #+0]
\ 00000022 0028 CMP R0,#+0
\ 00000024 04D0 BEQ.N ??OSSemCreate_2
116 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
\ 00000026 .... LDR.N R0,??DataTable3_2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -