📄 os_q.lst
字号:
##############################################################################
# #
# 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_q.c #
# Command line = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
# \Source\os_q.c -lCN E:\IAR_2478\IAR_2478\26uCOS\Src\ #
# 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_q.lst #
# Object file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
# s_q.r79 #
# #
# #
##############################################################################
E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\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-2007, Jean J. Labrosse, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_Q.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_Q_EN > 0) && (OS_MAX_QS > 0)
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 * err 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 * 'err' has been added to the API to tell you about the outcome of the call.
57 *********************************************************************************************************
58 */
59
60 #if OS_Q_ACCEPT_EN > 0
\ In segment CODE, align 4, keep-with-next
61 void *OSQAccept (OS_EVENT *pevent, INT8U *err)
62 {
\ OSQAccept:
\ 00000000 F0412DE9 PUSH {R4-R8,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
63 void *msg;
64 OS_Q *pq;
65 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
66 OS_CPU_SR cpu_sr = 0;
\ 0000000C 0000A0E3 MOV R0,#+0
\ 00000010 0080B0E1 MOVS R8,R0
67 #endif
68
69
70
71 #if OS_ARG_CHK_EN > 0
72 if (err == (INT8U *)0) { /* Validate 'err' */
\ 00000014 000055E3 CMP R5,#+0
\ 00000018 0100001A BNE ??OSQAccept_0
73 return ((void *)0);
\ 0000001C 0000A0E3 MOV R0,#+0
\ 00000020 2D0000EA B ??OSQAccept_1
74 }
75 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ ??OSQAccept_0:
\ 00000024 000054E3 CMP R4,#+0
\ 00000028 0300001A BNE ??OSQAccept_2
76 *err = OS_ERR_PEVENT_NULL;
\ 0000002C 0400A0E3 MOV R0,#+4
\ 00000030 0000C5E5 STRB R0,[R5, #+0]
77 return ((void *)0);
\ 00000034 0000A0E3 MOV R0,#+0
\ 00000038 270000EA B ??OSQAccept_1
78 }
79 #endif
80 if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type */
\ ??OSQAccept_2:
\ 0000003C 0000D4E5 LDRB R0,[R4, #+0]
\ 00000040 020050E3 CMP R0,#+2
\ 00000044 0300000A BEQ ??OSQAccept_3
81 *err = OS_ERR_EVENT_TYPE;
\ 00000048 0100A0E3 MOV R0,#+1
\ 0000004C 0000C5E5 STRB R0,[R5, #+0]
82 return ((void *)0);
\ 00000050 0000A0E3 MOV R0,#+0
\ 00000054 200000EA B ??OSQAccept_1
83 }
84 OS_ENTER_CRITICAL();
\ ??OSQAccept_3:
\ 00000058 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 0000005C 0080B0E1 MOVS R8,R0
85 pq = (OS_Q *)pevent->OSEventPtr; /* Point at queue control block */
\ 00000060 040094E5 LDR R0,[R4, #+4]
\ 00000064 0070B0E1 MOVS R7,R0
86 if (pq->OSQEntries > 0) { /* See if any messages in the queue */
\ 00000068 B601D7E1 LDRH R0,[R7, #+22]
\ 0000006C 010050E3 CMP R0,#+1
\ 00000070 1200003A BCC ??OSQAccept_4
87 msg = *pq->OSQOut++; /* Yes, extract oldest message from the queue */
\ 00000074 100097E5 LDR R0,[R7, #+16]
\ 00000078 041090E2 ADDS R1,R0,#+4
\ 0000007C 101087E5 STR R1,[R7, #+16]
\ 00000080 000090E5 LDR R0,[R0, #+0]
\ 00000084 0060B0E1 MOVS R6,R0
88 pq->OSQEntries--; /* Update the number of entries in the queue */
\ 00000088 B601D7E1 LDRH R0,[R7, #+22]
\ 0000008C FF10A0E3 MOV R1,#+255
\ 00000090 FF1C81E3 ORR R1,R1,#0xFF00
\ 00000094 000091E0 ADDS R0,R1,R0
\ 00000098 B601C7E1 STRH R0,[R7, #+22]
89 if (pq->OSQOut == pq->OSQEnd) { /* Wrap OUT pointer if we are at the end of the queue */
\ 0000009C 100097E5 LDR R0,[R7, #+16]
\ 000000A0 081097E5 LDR R1,[R7, #+8]
\ 000000A4 010050E1 CMP R0,R1
\ 000000A8 0100001A BNE ??OSQAccept_5
90 pq->OSQOut = pq->OSQStart;
\ 000000AC 040097E5 LDR R0,[R7, #+4]
\ 000000B0 100087E5 STR R0,[R7, #+16]
91 }
92 *err = OS_ERR_NONE;
\ ??OSQAccept_5:
\ 000000B4 0000A0E3 MOV R0,#+0
\ 000000B8 0000C5E5 STRB R0,[R5, #+0]
\ 000000BC 030000EA B ??OSQAccept_6
93 } else {
94 *err = OS_ERR_Q_EMPTY;
\ ??OSQAccept_4:
\ 000000C0 1F00A0E3 MOV R0,#+31
\ 000000C4 0000C5E5 STRB R0,[R5, #+0]
95 msg = (void *)0; /* Queue is empty */
\ 000000C8 0000A0E3 MOV R0,#+0
\ 000000CC 0060B0E1 MOVS R6,R0
96 }
97 OS_EXIT_CRITICAL();
\ ??OSQAccept_6:
\ 000000D0 0800B0E1 MOVS R0,R8
\ 000000D4 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
98 return (msg); /* Return message received (or NULL) */
\ 000000D8 0600B0E1 MOVS R0,R6
\ ??OSQAccept_1:
\ 000000DC F081BDE8 POP {R4-R8,PC} ;; return
99 }
100 #endif
101 /*$PAGE*/
102 /*
103 *********************************************************************************************************
104 * CREATE A MESSAGE QUEUE
105 *
106 * Description: This function creates a message queue if free event control blocks are available.
107 *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -