📄 os_q.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_q.c #
# Command line = F:\PROJECT\STM32_UCOSII\uCOS-II\Source\os_q.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_q.lst #
# Object file = F:\PROJECT\STM32_UCOSII\EvalBoards\ST\STM3210E-EVAL\ #
# IAR\OS-Probe\Flash\Obj\os_q.r79 #
# #
# #
##############################################################################
F:\PROJECT\STM32_UCOSII\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, Micrium, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_Q.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_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 * 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 > 0
61 void *OSQAccept (OS_EVENT *pevent, INT8U *perr)
62 {
63 void *pmsg;
64 OS_Q *pq;
65 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
66 OS_CPU_SR cpu_sr = 0;
67 #endif
68
69
70
71 #if OS_ARG_CHK_EN > 0
72 if (perr == (INT8U *)0) { /* Validate 'perr' */
73 return ((void *)0);
74 }
75 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
76 *perr = OS_ERR_PEVENT_NULL;
77 return ((void *)0);
78 }
79 #endif
80 if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type */
81 *perr = OS_ERR_EVENT_TYPE;
82 return ((void *)0);
83 }
84 OS_ENTER_CRITICAL();
85 pq = (OS_Q *)pevent->OSEventPtr; /* Point at queue control block */
86 if (pq->OSQEntries > 0) { /* See if any messages in the queue */
87 pmsg = *pq->OSQOut++; /* Yes, extract oldest message from the queue */
88 pq->OSQEntries--; /* Update the number of entries in the queue */
89 if (pq->OSQOut == pq->OSQEnd) { /* Wrap OUT pointer if we are at the end of the queue */
90 pq->OSQOut = pq->OSQStart;
91 }
92 *perr = OS_ERR_NONE;
93 } else {
94 *perr = OS_ERR_Q_EMPTY;
95 pmsg = (void *)0; /* Queue is empty */
96 }
97 OS_EXIT_CRITICAL();
98 return (pmsg); /* Return message received (or NULL) */
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 *
108 * Arguments : start is a pointer to the base address of the message queue storage area. The
109 * storage area MUST be declared as an array of pointers to 'void' as follows
110 *
111 * void *MessageStorage[size]
112 *
113 * size is the number of elements in the storage area
114 *
115 * Returns : != (OS_EVENT *)0 is a pointer to the event control clock (OS_EVENT) associated with the
116 * created queue
117 * == (OS_EVENT *)0 if no event control blocks were available or an error was detected
118 *********************************************************************************************************
119 */
120
121 OS_EVENT *OSQCreate (void **start, INT16U size)
122 {
123 OS_EVENT *pevent;
124 OS_Q *pq;
125 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
126 OS_CPU_SR cpu_sr = 0;
127 #endif
128
129
130
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -