📄 os_sem.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 KICKSTART 26/Dec/2008 18:22:03 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = thumb #
# Endian = little #
# Stack alignment = 4 #
# Source file = F:\PROJECT\STM32_UCOSII\uCOS-II\Source\os_sem.c #
# Command line = F:\PROJECT\STM32_UCOSII\uCOS-II\Source\os_sem.c #
# -lCN F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E- #
# EVAL\IAR\OS-Probe\Flash\List\ -o #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\Flash\Obj\ -z6 --no_unroll --no_inline #
# --no_tbaa --no_scheduling --debug --cpu_mode thumb #
# --endian little --cpu cortex-M3 --stack_align 4 -e #
# --fpu None --dlib_config "E:\Program Files\IAR #
# Systems\Embedded Workbench 4.0 #
# Kickstart\arm\LIB\dl7mptnnl8n.h" -I #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\ -I F:\PROJECT\STM32_UCOSII\EvalBoards\ #
# ST\STM3210E-EVAL\IAR\OS-Probe\..\BSP\ -I #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\..\..\..\..\..\CPU\ST\STM32\inc\ -I #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\..\..\..\..\..\uC-CPU\ -I #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\..\..\..\..\..\uC-CPU\ARM-Cortex-M3\IAR #
# \ -I F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E- #
# EVAL\IAR\OS-Probe\..\..\..\..\..\uC-LCD\Source\ -I #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\..\..\..\..\..\uC-LIB\ -I #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\..\..\..\..\..\uCOS-II\Ports\ARM-Cortex #
# -M3\Generic\IAR\ -I F:\PROJECT\STM32_UCOSII\EvalBoar #
# ds\ST\STM3210E-EVAL\IAR\OS-Probe\..\..\..\..\..\uCOS #
# -II\Source\ -I F:\PROJECT\STM32_UCOSII\EvalBoards\ST #
# \STM3210E-EVAL\IAR\OS-Probe\..\..\..\..\..\uC-Probe\ #
# Target\Communication\Generic\RS-232\Source\ -I #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Communic #
# ation\Generic\RS-232\Ports\ST\STM32\ -I #
# F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Communic #
# ation\Generic\Source\ -I F:\PROJECT\STM32_UCOSII\Eva #
# lBoards\ST\STM3210E-EVAL\IAR\OS-Probe\..\..\..\..\.. #
# \uC-Probe\Target\Plugins\uCOS-II\ -I "E:\Program #
# Files\IAR Systems\Embedded Workbench 4.0 #
# Kickstart\arm\INC\" #
# List file = F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\Flash\List\os_sem.lst #
# Object file = F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\Flash\Obj\os_sem.r79 #
# #
# #
##############################################################################
F:\PROJECT\STM32_UCOSII\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, Micrium, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_SEM.C
11 * By : Jean J. Labrosse
12 * Version : V2.86
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 30B5 PUSH {R4,R5,LR}
\ 00000002 0400 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;
54 #endif
55
56
57
58 #if OS_ARG_CHK_EN > 0
59 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
60 return (0);
61 }
62 #endif
63 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
\ 00000004 2078 LDRB R0,[R4, #+0]
\ 00000006 0328 CMP R0,#+3
\ 00000008 01D0 BEQ.N ??OSSemAccept_0
64 return (0);
\ 0000000A 0020 MOVS R0,#+0
\ 0000000C 30BD POP {R4,R5,PC}
65 }
66 OS_ENTER_CRITICAL();
\ ??OSSemAccept_0:
\ 0000000E ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
67 cnt = pevent->OSEventCnt;
\ 00000012 2589 LDRH R5,[R4, #+8]
68 if (cnt > 0) { /* See if resource is available */
\ 00000014 2900 MOVS R1,R5
\ 00000016 01D0 BEQ.N ??OSSemAccept_1
69 pevent->OSEventCnt--; /* Yes, decrement semaphore and notify caller */
\ 00000018 491E SUBS R1,R1,#+1
\ 0000001A 2181 STRH R1,[R4, #+8]
70 }
71 OS_EXIT_CRITICAL();
\ ??OSSemAccept_1:
\ 0000001C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
72 return (cnt); /* Return semaphore count */
\ 00000020 2800 MOVS R0,R5
\ 00000022 30BD POP {R4,R5,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 segment CODE, align 4, keep-with-next
94 OS_EVENT *OSSemCreate (INT16U cnt)
95 {
\ OSSemCreate:
\ 00000000 30B5 PUSH {R4,R5,LR}
\ 00000002 0500 MOVS R5,R0
96 OS_EVENT *pevent;
97 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
98 OS_CPU_SR cpu_sr = 0;
99 #endif
100
101
102
103 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ 00000004 .... LDR.N R0,??DataTable4 ;; OSIntNesting
\ 00000006 0078 LDRB R0,[R0, #+0]
\ 00000008 0028 CMP R0,#+0
\ 0000000A 01D0 BEQ.N ??OSSemCreate_0
104 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
\ 0000000C 0020 MOVS R0,#+0
\ 0000000E 30BD POP {R4,R5,PC}
105 }
106 OS_ENTER_CRITICAL();
\ ??OSSemCreate_0:
\ 00000010 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
107 pevent = OSEventFreeList; /* Get next free event control block */
\ 00000014 .... LDR.N R1,??DataTable3 ;; OSEventFreeList
\ 00000016 0A68 LDR R2,[R1, #+0]
\ 00000018 1400 MOVS R4,R2
108 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
\ 0000001A 01D0 BEQ.N ??OSSemCreate_1
109 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
\ 0000001C 5268 LDR R2,[R2, #+4]
\ 0000001E 0A60 STR R2,[R1, #+0]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -