os_q.lst
来自「称植到lpc2124上的UCOS2.85版 是本人初学移植和ARM的成果 可」· LST 代码 · 共 1,276 行 · 第 1/5 页
LST
1,276 行
1 .file "os_q.c"
2 .arch atmega128
3 __SREG__ = 0x3f
4 __SP_H__ = 0x3e
5 __SP_L__ = 0x3d
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
11 .text
12 .Ltext0:
109 .global OSQAccept
111 OSQAccept:
1:../OSsrc/os_q.c **** /*
2:../OSsrc/os_q.c **** ***************************************************************************************************
3:../OSsrc/os_q.c **** * uC/OS-II
4:../OSsrc/os_q.c **** * The Real-Time Kernel
5:../OSsrc/os_q.c **** * MESSAGE QUEUE MANAGEMENT
6:../OSsrc/os_q.c **** *
7:../OSsrc/os_q.c **** * (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
8:../OSsrc/os_q.c **** * All Rights Reserved
9:../OSsrc/os_q.c **** *
10:../OSsrc/os_q.c **** * File : OS_Q.C
11:../OSsrc/os_q.c **** * By : Jean J. Labrosse
12:../OSsrc/os_q.c **** * Version : V2.85
13:../OSsrc/os_q.c **** *
14:../OSsrc/os_q.c **** * LICENSING TERMS:
15:../OSsrc/os_q.c **** * ---------------
16:../OSsrc/os_q.c **** * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful re
17:../OSsrc/os_q.c **** * If you plan on using uC/OS-II in a commercial product you need to contact Micri祄 to properly l
18:../OSsrc/os_q.c **** * its use in your product. We provide ALL the source code for your convenience and to help you expe
19:../OSsrc/os_q.c **** * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without pa
20:../OSsrc/os_q.c **** * licensing fee.
21:../OSsrc/os_q.c **** ***************************************************************************************************
22:../OSsrc/os_q.c **** */
23:../OSsrc/os_q.c ****
24:../OSsrc/os_q.c **** #ifndef OS_MASTER_FILE
25:../OSsrc/os_q.c **** #include <ucos_ii.h>
26:../OSsrc/os_q.c **** #endif
27:../OSsrc/os_q.c ****
28:../OSsrc/os_q.c **** #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
29:../OSsrc/os_q.c **** /*
30:../OSsrc/os_q.c **** ***************************************************************************************************
31:../OSsrc/os_q.c **** * ACCEPT MESSAGE FROM QUEUE
32:../OSsrc/os_q.c **** *
33:../OSsrc/os_q.c **** * Description: This function checks the queue to see if a message is available. Unlike OSQPend(),
34:../OSsrc/os_q.c **** * OSQAccept() does not suspend the calling task if a message is not available.
35:../OSsrc/os_q.c **** *
36:../OSsrc/os_q.c **** * Arguments : pevent is a pointer to the event control block
37:../OSsrc/os_q.c **** *
38:../OSsrc/os_q.c **** * perr is a pointer to where an error message will be deposited. Possible er
39:../OSsrc/os_q.c **** * messages are:
40:../OSsrc/os_q.c **** *
41:../OSsrc/os_q.c **** * OS_ERR_NONE The call was successful and your task received a
42:../OSsrc/os_q.c **** * message.
43:../OSsrc/os_q.c **** * OS_ERR_EVENT_TYPE You didn't pass a pointer to a queue
44:../OSsrc/os_q.c **** * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
45:../OSsrc/os_q.c **** * OS_ERR_Q_EMPTY The queue did not contain any messages
46:../OSsrc/os_q.c **** *
47:../OSsrc/os_q.c **** * Returns : != (void *)0 is the message in the queue if one is available. The message is remov
48:../OSsrc/os_q.c **** * from the so the next time OSQAccept() is called, the queue will contai
49:../OSsrc/os_q.c **** * one less entry.
50:../OSsrc/os_q.c **** * == (void *)0 if you received a NULL pointer message
51:../OSsrc/os_q.c **** * if the queue is empty or,
52:../OSsrc/os_q.c **** * if 'pevent' is a NULL pointer or,
53:../OSsrc/os_q.c **** * if you passed an invalid event type
54:../OSsrc/os_q.c **** *
55:../OSsrc/os_q.c **** * Note(s) : As of V2.60, you can now pass NULL pointers through queues. Because of this, the ar
56:../OSsrc/os_q.c **** * 'perr' has been added to the API to tell you about the outcome of the call.
57:../OSsrc/os_q.c **** ***************************************************************************************************
58:../OSsrc/os_q.c **** */
59:../OSsrc/os_q.c ****
60:../OSsrc/os_q.c **** #if OS_Q_ACCEPT_EN > 0
61:../OSsrc/os_q.c **** void *OSQAccept (OS_EVENT *pevent, INT8U *perr)
62:../OSsrc/os_q.c **** {
113 .LM1:
114 /* prologue: frame size=0 */
115 0000 CF93 push r28
116 0002 DF93 push r29
117 /* prologue end (size=2) */
118 0004 FC01 movw r30,r24
119 0006 EB01 movw r28,r22
63:../OSsrc/os_q.c **** void *pmsg;
64:../OSsrc/os_q.c **** OS_Q *pq;
65:../OSsrc/os_q.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register
66:../OSsrc/os_q.c **** OS_CPU_SR cpu_sr = 0;
67:../OSsrc/os_q.c **** #endif
68:../OSsrc/os_q.c ****
69:../OSsrc/os_q.c ****
70:../OSsrc/os_q.c ****
71:../OSsrc/os_q.c **** #if OS_ARG_CHK_EN > 0
72:../OSsrc/os_q.c **** if (perr == (INT8U *)0) { /* Validate 'perr'
121 .LM2:
122 0008 6115 cp r22,__zero_reg__
123 000a 7105 cpc r23,__zero_reg__
124 000c A1F1 breq .L1
73:../OSsrc/os_q.c **** return ((void *)0);
74:../OSsrc/os_q.c **** }
75:../OSsrc/os_q.c **** if (pevent == (OS_EVENT *)0) { /* Validate 'pevent'
126 .LM3:
127 000e 892B or r24,r25
128 0010 21F4 brne .L3
76:../OSsrc/os_q.c **** *perr = OS_ERR_PEVENT_NULL;
130 .LM4:
131 0012 84E0 ldi r24,lo8(4)
132 0014 8883 st Y,r24
77:../OSsrc/os_q.c **** return ((void *)0);
134 .LM5:
135 0016 BF01 movw r22,r30
136 0018 2EC0 rjmp .L1
137 .L3:
78:../OSsrc/os_q.c **** }
79:../OSsrc/os_q.c **** #endif
80:../OSsrc/os_q.c **** if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type
139 .LM6:
140 001a 8081 ld r24,Z
141 001c 8230 cpi r24,lo8(2)
142 001e 29F0 breq .L4
81:../OSsrc/os_q.c **** *perr = OS_ERR_EVENT_TYPE;
144 .LM7:
145 0020 81E0 ldi r24,lo8(1)
146 0022 8883 st Y,r24
82:../OSsrc/os_q.c **** return ((void *)0);
148 .LM8:
149 0024 60E0 ldi r22,lo8(0)
150 0026 70E0 ldi r23,hi8(0)
151 0028 26C0 rjmp .L1
152 .L4:
83:../OSsrc/os_q.c **** }
84:../OSsrc/os_q.c **** OS_ENTER_CRITICAL();
154 .LM9:
155 /* #APP */
156 002a F894 cli
85:../OSsrc/os_q.c **** pq = (OS_Q *)pevent->OSEventPtr; /* Point at queue control block
158 .LM10:
159 /* #NOAPP */
160 002c A181 ldd r26,Z+1
161 002e B281 ldd r27,Z+2
86:../OSsrc/os_q.c **** if (pq->OSQEntries > 0) { /* See if any messages in the queue
163 .LM11:
164 0030 FD01 movw r30,r26
165 0032 2485 ldd r18,Z+12
166 0034 3585 ldd r19,Z+13
167 0036 2115 cp r18,__zero_reg__
168 0038 3105 cpc r19,__zero_reg__
169 003a C9F0 breq .L5
87:../OSsrc/os_q.c **** pmsg = *pq->OSQOut++; /* Yes, extract oldest message from the queue
171 .LM12:
172 003c 4085 ldd r20,Z+8
173 003e 5185 ldd r21,Z+9
174 0040 FA01 movw r30,r20
175 0042 8191 ld r24,Z+
176 0044 9191 ld r25,Z+
177 0046 AF01 movw r20,r30
178 0048 FD01 movw r30,r26
179 004a 5187 std Z+9,r21
180 004c 4087 std Z+8,r20
181 004e BC01 movw r22,r24
88:../OSsrc/os_q.c **** pq->OSQEntries--; /* Update the number of entries in the queue
183 .LM13:
184 0050 2150 subi r18,lo8(-(-1))
185 0052 3040 sbci r19,hi8(-(-1))
186 0054 3587 std Z+13,r19
187 0056 2487 std Z+12,r18
89:../OSsrc/os_q.c **** if (pq->OSQOut == pq->OSQEnd) { /* Wrap OUT pointer if we are at the end of the qu
189 .LM14:
190 0058 8481 ldd r24,Z+4
191 005a 9581 ldd r25,Z+5
192 005c 4817 cp r20,r24
193 005e 5907 cpc r21,r25
194 0060 21F4 brne .L6
90:../OSsrc/os_q.c **** pq->OSQOut = pq->OSQStart;
196 .LM15:
197 0062 8281 ldd r24,Z+2
198 0064 9381 ldd r25,Z+3
199 0066 9187 std Z+9,r25
200 0068 8087 std Z+8,r24
201 .L6:
91:../OSsrc/os_q.c **** }
92:../OSsrc/os_q.c **** *perr = OS_ERR_NONE;
203 .LM16:
204 006a 1882 st Y,__zero_reg__
205 006c 03C0 rjmp .L7
206 .L5:
93:../OSsrc/os_q.c **** } else {
94:../OSsrc/os_q.c **** *perr = OS_ERR_Q_EMPTY;
208 .LM17:
209 006e 8FE1 ldi r24,lo8(31)
210 0070 8883 st Y,r24
95:../OSsrc/os_q.c **** pmsg = (void *)0; /* Queue is empty
212 .LM18:
213 0072 B901 movw r22,r18
214 .L7:
96:../OSsrc/os_q.c **** }
97:../OSsrc/os_q.c **** OS_EXIT_CRITICAL();
216 .LM19:
217 /* #APP */
218 0074 7894 sei
219 /* #NOAPP */
220 .L1:
98:../OSsrc/os_q.c **** return (pmsg); /* Return message received (or NULL)
99:../OSsrc/os_q.c **** }
222 .LM20:
223 0076 CB01 movw r24,r22
224 /* epilogue: frame size=0 */
225 0078 DF91 pop r29
226 007a CF91 pop r28
227 007c 0895 ret
228 /* epilogue end (size=3) */
229 /* function OSQAccept size 65 (60) */
235 .Lscope0:
239 .global OSQCreate
241 OSQCreate:
100:../OSsrc/os_q.c **** #endif
101:../OSsrc/os_q.c **** /*$PAGE*/
102:../OSsrc/os_q.c **** /*
103:../OSsrc/os_q.c **** ***************************************************************************************************
104:../OSsrc/os_q.c **** * CREATE A MESSAGE QUEUE
105:../OSsrc/os_q.c **** *
106:../OSsrc/os_q.c **** * Description: This function creates a message queue if free event control blocks are available.
107:../OSsrc/os_q.c **** *
108:../OSsrc/os_q.c **** * Arguments : start is a pointer to the base address of the message queue storage area. T
109:../OSsrc/os_q.c **** * storage area MUST be declared as an array of pointers to 'void' as fol
110:../OSsrc/os_q.c **** *
111:../OSsrc/os_q.c **** * void *MessageStorage[size]
112:../OSsrc/os_q.c **** *
113:../OSsrc/os_q.c **** * size is the number of elements in the storage area
114:../OSsrc/os_q.c **** *
115:../OSsrc/os_q.c **** * Returns : != (OS_EVENT *)0 is a pointer to the event control clock (OS_EVENT) associated with
116:../OSsrc/os_q.c **** * created queue
117:../OSsrc/os_q.c **** * == (OS_EVENT *)0 if no event control blocks were available or an error was detected
118:../OSsrc/os_q.c **** ***************************************************************************************************
119:../OSsrc/os_q.c **** */
120:../OSsrc/os_q.c ****
121:../OSsrc/os_q.c **** OS_EVENT *OSQCreate (void **start, INT16U size)
122:../OSsrc/os_q.c **** {
243 .LM21:
244 /* prologue: frame size=0 */
245 007e CF93 push r28
246 0080 DF93 push r29
247 /* prologue end (size=2) */
248 0082 9C01 movw r18,r24
123:../OSsrc/os_q.c **** OS_EVENT *pevent;
124:../OSsrc/os_q.c **** OS_Q *pq;
125:../OSsrc/os_q.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register
126:../OSsrc/os_q.c **** OS_CPU_SR cpu_sr = 0;
127:../OSsrc/os_q.c **** #endif
128:../OSsrc/os_q.c ****
129:../OSsrc/os_q.c ****
130:../OSsrc/os_q.c ****
131:../OSsrc/os_q.c **** if (OSIntNesting > 0) { /* See if called from ISR ...
250 .LM22:
251 0084 8091 0000 lds r24,OSIntNesting
252 0088 8823 tst r24
253 008a 19F0 breq .L9
132:../OSsrc/os_q.c **** return ((OS_EVENT *)0); /* ... can't CREATE from an ISR
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?