📄 os_q.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_q.c #
# Command line = F:\stm32\我的程序\Micrium\Software\uCOS-II\Source\os_q.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_q.lst #
# Object file = F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Flash\Obj #
# \os_q.o #
# #
# #
###############################################################################
F:\stm32\我的程序\Micrium\Software\uCOS-II\Source\os_q.c
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * MESSAGE QUEUE MANAGEMENT
6 *
7 * (c) Copyright 1992-2010, Micrium, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_Q.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_Q_EN > 0u) && (OS_MAX_QS > 0u)
29 /*
30 *********************************************************************************************************
31 * ACCEPT MESSAGE FROM QUEUE
32 *
33 * Description: This function checks the queue to see if a message is available. Unlike OSQPend(),
34 * OSQAccept() does not suspend the calling task if a message is not available.
35 *
36 * Arguments : pevent is a pointer to the event control block
37 *
38 * perr is a pointer to where an error message will be deposited. Possible error
39 * messages are:
40 *
41 * OS_ERR_NONE The call was successful and your task received a
42 * message.
43 * OS_ERR_EVENT_TYPE You didn't pass a pointer to a queue
44 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
45 * OS_ERR_Q_EMPTY The queue did not contain any messages
46 *
47 * Returns : != (void *)0 is the message in the queue if one is available. The message is removed
48 * from the so the next time OSQAccept() is called, the queue will contain
49 * one less entry.
50 * == (void *)0 if you received a NULL pointer message
51 * if the queue is empty or,
52 * if 'pevent' is a NULL pointer or,
53 * if you passed an invalid event type
54 *
55 * Note(s) : As of V2.60, you can now pass NULL pointers through queues. Because of this, the argument
56 * 'perr' has been added to the API to tell you about the outcome of the call.
57 *********************************************************************************************************
58 */
59
60 #if OS_Q_ACCEPT_EN > 0u
\ In section .text, align 2, keep-with-next
61 void *OSQAccept (OS_EVENT *pevent,
62 INT8U *perr)
63 {
\ OSQAccept:
\ 00000000 2DE9F041 PUSH {R4-R8,LR}
\ 00000004 0400 MOVS R4,R0
\ 00000006 0D00 MOVS R5,R1
64 void *pmsg;
65 OS_Q *pq;
66 #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */
67 OS_CPU_SR cpu_sr = 0u;
\ 00000008 5FF00008 MOVS R8,#+0
68 #endif
69
70
71
72 #ifdef OS_SAFETY_CRITICAL
73 if (perr == (INT8U *)0) {
74 OS_SAFETY_CRITICAL_EXCEPTION();
75 return ((void *)0);
76 }
77 #endif
78
79 #if OS_ARG_CHK_EN > 0u
80 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
81 *perr = OS_ERR_PEVENT_NULL;
82 return ((void *)0);
83 }
84 #endif
85 if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type */
\ 0000000C 2078 LDRB R0,[R4, #+0]
\ 0000000E 0228 CMP R0,#+2
\ 00000010 03D0 BEQ.N ??OSQAccept_0
86 *perr = OS_ERR_EVENT_TYPE;
\ 00000012 0120 MOVS R0,#+1
\ 00000014 2870 STRB R0,[R5, #+0]
87 return ((void *)0);
\ 00000016 0020 MOVS R0,#+0
\ 00000018 20E0 B.N ??OSQAccept_1
88 }
89 OS_ENTER_CRITICAL();
\ ??OSQAccept_0:
\ 0000001A ........ BL OS_CPU_SR_Save
\ 0000001E 8046 MOV R8,R0
90 pq = (OS_Q *)pevent->OSEventPtr; /* Point at queue control block */
\ 00000020 6068 LDR R0,[R4, #+4]
\ 00000022 0700 MOVS R7,R0
91 if (pq->OSQEntries > 0u) { /* See if any messages in the queue */
\ 00000024 F88A LDRH R0,[R7, #+22]
\ 00000026 0028 CMP R0,#+0
\ 00000028 10D0 BEQ.N ??OSQAccept_2
92 pmsg = *pq->OSQOut++; /* Yes, extract oldest message from the queue */
\ 0000002A 3869 LDR R0,[R7, #+16]
\ 0000002C 011D ADDS R1,R0,#+4
\ 0000002E 3961 STR R1,[R7, #+16]
\ 00000030 0068 LDR R0,[R0, #+0]
\ 00000032 0600 MOVS R6,R0
93 pq->OSQEntries--; /* Update the number of entries in the queue */
\ 00000034 F88A LDRH R0,[R7, #+22]
\ 00000036 401E SUBS R0,R0,#+1
\ 00000038 F882 STRH R0,[R7, #+22]
94 if (pq->OSQOut == pq->OSQEnd) { /* Wrap OUT pointer if we are at the end of the queue */
\ 0000003A 3869 LDR R0,[R7, #+16]
\ 0000003C B968 LDR R1,[R7, #+8]
\ 0000003E 8842 CMP R0,R1
\ 00000040 01D1 BNE.N ??OSQAccept_3
95 pq->OSQOut = pq->OSQStart;
\ 00000042 7868 LDR R0,[R7, #+4]
\ 00000044 3861 STR R0,[R7, #+16]
96 }
97 *perr = OS_ERR_NONE;
\ ??OSQAccept_3:
\ 00000046 0020 MOVS R0,#+0
\ 00000048 2870 STRB R0,[R5, #+0]
\ 0000004A 03E0 B.N ??OSQAccept_4
98 } else {
99 *perr = OS_ERR_Q_EMPTY;
\ ??OSQAccept_2:
\ 0000004C 1F20 MOVS R0,#+31
\ 0000004E 2870 STRB R0,[R5, #+0]
100 pmsg = (void *)0; /* Queue is empty */
\ 00000050 0020 MOVS R0,#+0
\ 00000052 0600 MOVS R6,R0
101 }
102 OS_EXIT_CRITICAL();
\ ??OSQAccept_4:
\ 00000054 4046 MOV R0,R8
\ 00000056 ........ BL OS_CPU_SR_Restore
103 return (pmsg); /* Return message received (or NULL) */
\ 0000005A 3000 MOVS R0,R6
\ ??OSQAccept_1:
\ 0000005C BDE8F081 POP {R4-R8,PC} ;; return
104 }
105 #endif
106 /*$PAGE*/
107 /*
108 *********************************************************************************************************
109 * CREATE A MESSAGE QUEUE
110 *
111 * Description: This function creates a message queue if free event control blocks are available.
112 *
113 * Arguments : start is a pointer to the base address of the message queue storage area. The
114 * storage area MUST be declared as an array of pointers to 'void' as follows
115 *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -