📄 os_flag.lst
字号:
##############################################################################
# #
# 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_flag.c #
# Command line = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
# \Source\os_flag.c -lCN E:\IAR_2478\IAR_2478\26uCOS\S #
# rc\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_flag.lst #
# Object file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
# s_flag.r79 #
# #
# #
##############################################################################
E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II\Source\os_flag.c
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * EVENT FLAG MANAGEMENT
6 *
7 * (c) Copyright 2001-2007, Jean J. Labrosse, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_FLAG.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_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
29 /*
30 *********************************************************************************************************
31 * LOCAL PROTOTYPES
32 *********************************************************************************************************
33 */
34
35 static void OS_FlagBlock(OS_FLAG_GRP *pgrp, OS_FLAG_NODE *pnode, OS_FLAGS flags, INT8U wait_type, INT16U timeout);
36 static BOOLEAN OS_FlagTaskRdy(OS_FLAG_NODE *pnode, OS_FLAGS flags_rdy);
37
38 /*$PAGE*/
39 /*
40 *********************************************************************************************************
41 * CHECK THE STATUS OF FLAGS IN AN EVENT FLAG GROUP
42 *
43 * Description: This function is called to check the status of a combination of bits to be set or cleared
44 * in an event flag group. Your application can check for ANY bit to be set/cleared or ALL
45 * bits to be set/cleared.
46 *
47 * This call does not block if the desired flags are not present.
48 *
49 * Arguments : pgrp is a pointer to the desired event flag group.
50 *
51 * flags Is a bit pattern indicating which bit(s) (i.e. flags) you wish to check.
52 * The bits you want are specified by setting the corresponding bits in
53 * 'flags'. e.g. if your application wants to wait for bits 0 and 1 then
54 * 'flags' would contain 0x03.
55 *
56 * wait_type specifies whether you want ALL bits to be set/cleared or ANY of the bits
57 * to be set/cleared.
58 * You can specify the following argument:
59 *
60 * OS_FLAG_WAIT_CLR_ALL You will check ALL bits in 'flags' to be clear (0)
61 * OS_FLAG_WAIT_CLR_ANY You will check ANY bit in 'flags' to be clear (0)
62 * OS_FLAG_WAIT_SET_ALL You will check ALL bits in 'flags' to be set (1)
63 * OS_FLAG_WAIT_SET_ANY You will check ANY bit in 'flags' to be set (1)
64 *
65 * NOTE: Add OS_FLAG_CONSUME if you want the event flag to be 'consumed' by
66 * the call. Example, to wait for any flag in a group AND then clear
67 * the flags that are present, set 'wait_type' to:
68 *
69 * OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME
70 *
71 * err is a pointer to an error code and can be:
72 * OS_ERR_NONE No error
73 * OS_ERR_EVENT_TYPE You are not pointing to an event flag group
74 * OS_ERR_FLAG_WAIT_TYPE You didn't specify a proper 'wait_type' argument.
75 * OS_ERR_FLAG_INVALID_PGRP You passed a NULL pointer instead of the event flag
76 * group handle.
77 * OS_ERR_FLAG_NOT_RDY The desired flags you are waiting for are not
78 * available.
79 *
80 * Returns : The flags in the event flag group that made the task ready or, 0 if a timeout or an error
81 * occurred.
82 *
83 * Called from: Task or ISR
84 *
85 * Note(s) : 1) IMPORTANT, the behavior of this function has changed from PREVIOUS versions. The
86 * function NOW returns the flags that were ready INSTEAD of the current state of the
87 * event flags.
88 *********************************************************************************************************
89 */
90
91 #if OS_FLAG_ACCEPT_EN > 0
\ In segment CODE, align 4, keep-with-next
92 OS_FLAGS OSFlagAccept (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT8U *err)
93 {
\ OSFlagAccept:
\ 00000000 F04F2DE9 PUSH {R4-R11,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
\ 0000000C 0260B0E1 MOVS R6,R2
\ 00000010 0370B0E1 MOVS R7,R3
94 OS_FLAGS flags_rdy;
95 INT8U result;
96 BOOLEAN consume;
97 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
98 OS_CPU_SR cpu_sr = 0;
\ 00000014 0000A0E3 MOV R0,#+0
\ 00000018 00B0B0E1 MOVS R11,R0
99 #endif
100
101
102
103 #if OS_ARG_CHK_EN > 0
104 if (err == (INT8U *)0) { /* Validate 'err' */
\ 0000001C 000057E3 CMP R7,#+0
\ 00000020 0100001A BNE ??OSFlagAccept_1
105 return ((OS_FLAGS)0);
\ 00000024 0000A0E3 MOV R0,#+0
\ 00000028 720000EA B ??OSFlagAccept_2
106 }
107 if (pgrp == (OS_FLAG_GRP *)0) { /* Validate 'pgrp' */
\ ??OSFlagAccept_1:
\ 0000002C 000054E3 CMP R4,#+0
\ 00000030 0300001A BNE ??OSFlagAccept_3
108 *err = OS_ERR_FLAG_INVALID_PGRP;
\ 00000034 6E00A0E3 MOV R0,#+110
\ 00000038 0000C7E5 STRB R0,[R7, #+0]
109 return ((OS_FLAGS)0);
\ 0000003C 0000A0E3 MOV R0,#+0
\ 00000040 6C0000EA B ??OSFlagAccept_2
110 }
111 #endif
112 if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) { /* Validate event block type */
\ ??OSFlagAccept_3:
\ 00000044 0000D4E5 LDRB R0,[R4, #+0]
\ 00000048 050050E3 CMP R0,#+5
\ 0000004C 0300000A BEQ ??OSFlagAccept_4
113 *err = OS_ERR_EVENT_TYPE;
\ 00000050 0100A0E3 MOV R0,#+1
\ 00000054 0000C7E5 STRB R0,[R7, #+0]
114 return ((OS_FLAGS)0);
\ 00000058 0000A0E3 MOV R0,#+0
\ 0000005C 650000EA B ??OSFlagAccept_2
115 }
116 result = (INT8U)(wait_type & OS_FLAG_CONSUME);
\ ??OSFlagAccept_4:
\ 00000060 800016E2 ANDS R0,R6,#0x80
\ 00000064 0090B0E1 MOVS R9,R0
117 if (result != (INT8U)0) { /* See if we need to consume the flags */
\ 00000068 000059E3 CMP R9,#+0
\ 0000006C 0300000A BEQ ??OSFlagAccept_5
118 wait_type &= ~OS_FLAG_CONSUME;
\ 00000070 7F6016E2 ANDS R6,R6,#0x7F
119 consume = OS_TRUE;
\ 00000074 0100A0E3 MOV R0,#+1
\ 00000078 00A0B0E1 MOVS R10,R0
\ 0000007C 010000EA B ??OSFlagAccept_6
120 } else {
121 consume = OS_FALSE;
\ ??OSFlagAccept_5:
\ 00000080 0000A0E3 MOV R0,#+0
\ 00000084 00A0B0E1 MOVS R10,R0
122 }
123 /*$PAGE*/
124 *err = OS_ERR_NONE; /* Assume NO error until proven otherwise. */
\ ??OSFlagAccept_6:
\ 00000088 0000A0E3 MOV R0,#+0
\ 0000008C 0000C7E5 STRB R0,[R7, #+0]
125 OS_ENTER_CRITICAL();
\ 00000090 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 00000094 00B0B0E1 MOVS R11,R0
126 switch (wait_type) {
\ 00000098 0600B0E1 MOVS R0,R6
\ 0000009C 030050E3 CMP R0,#+3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -