os_mbox.lst
来自「atmega单片机用的ucos系统 占用内存适中 是atmega单片机合适的操作」· LST 代码 · 共 1,285 行 · 第 1/5 页
LST
1,285 行
129:OSsrc/os_mbox.c **** * OS_ERR_DEL_ISR If you attempted to delete the mailbox from an
130:OSsrc/os_mbox.c **** * OS_ERR_INVALID_OPT An invalid option was specified
131:OSsrc/os_mbox.c **** * OS_ERR_TASK_WAITING One or more tasks were waiting on the mailbox
132:OSsrc/os_mbox.c **** * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a mailbox
133:OSsrc/os_mbox.c **** * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer.
134:OSsrc/os_mbox.c **** *
135:OSsrc/os_mbox.c **** * Returns : pevent upon error
136:OSsrc/os_mbox.c **** * (OS_EVENT *)0 if the mailbox was successfully deleted.
137:OSsrc/os_mbox.c **** *
138:OSsrc/os_mbox.c **** * Note(s) : 1) This function must be used with care. Tasks that would normally expect the prese
139:OSsrc/os_mbox.c **** * the mailbox MUST check the return code of OSMboxPend().
140:OSsrc/os_mbox.c **** * 2) OSMboxAccept() callers will not know that the intended mailbox has been deleted!
141:OSsrc/os_mbox.c **** * 3) This call can potentially disable interrupts for a long time. The interrupt disa
142:OSsrc/os_mbox.c **** * time is directly proportional to the number of tasks waiting on the mailbox.
143:OSsrc/os_mbox.c **** * 4) Because ALL tasks pending on the mailbox will be readied, you MUST be careful in
144:OSsrc/os_mbox.c **** * applications where the mailbox is used for mutual exclusion because the resource(
145:OSsrc/os_mbox.c **** * will no longer be guarded by the mailbox.
146:OSsrc/os_mbox.c **** ***************************************************************************************************
147:OSsrc/os_mbox.c **** */
148:OSsrc/os_mbox.c ****
149:OSsrc/os_mbox.c **** #if OS_MBOX_DEL_EN > 0
150:OSsrc/os_mbox.c **** OS_EVENT *OSMboxDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
151:OSsrc/os_mbox.c **** {
247 .LM27:
248 /* prologue: frame size=0 */
249 0084 FF92 push r15
250 0086 0F93 push r16
251 0088 1F93 push r17
252 008a CF93 push r28
253 008c DF93 push r29
254 /* prologue end (size=5) */
255 008e EC01 movw r28,r24
256 0090 8A01 movw r16,r20
152:OSsrc/os_mbox.c **** BOOLEAN tasks_waiting;
153:OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status regis
154:OSsrc/os_mbox.c **** OS_CPU_SR cpu_sr;
155:OSsrc/os_mbox.c ****
156:OSsrc/os_mbox.c ****
157:OSsrc/os_mbox.c ****
158:OSsrc/os_mbox.c **** cpu_sr = 0; /* Prevent compiler warning
159:OSsrc/os_mbox.c **** #endif
160:OSsrc/os_mbox.c **** if (OSIntNesting > 0) { /* See if called from ISR ...
258 .LM28:
259 0092 8091 0000 lds r24,OSIntNesting
260 0096 8823 tst r24
261 0098 11F0 breq .L9
161:OSsrc/os_mbox.c **** *err = OS_ERR_DEL_ISR; /* ... can't DELETE from an ISR
263 .LM29:
264 009a 8CE8 ldi r24,lo8(-116)
265 009c 5DC0 rjmp .L26
266 .L9:
162:OSsrc/os_mbox.c **** return (pevent);
163:OSsrc/os_mbox.c **** }
164:OSsrc/os_mbox.c **** #if OS_ARG_CHK_EN > 0
165:OSsrc/os_mbox.c **** if (pevent == (OS_EVENT *)0) { /* Validate 'pevent'
268 .LM30:
269 009e 2097 sbiw r28,0
270 00a0 11F4 brne .L10
166:OSsrc/os_mbox.c **** *err = OS_ERR_PEVENT_NULL;
272 .LM31:
273 00a2 84E0 ldi r24,lo8(4)
274 00a4 59C0 rjmp .L26
275 .L10:
167:OSsrc/os_mbox.c **** return (pevent);
168:OSsrc/os_mbox.c **** }
169:OSsrc/os_mbox.c **** #endif
170:OSsrc/os_mbox.c **** if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type
277 .LM32:
278 00a6 8881 ld r24,Y
279 00a8 8130 cpi r24,lo8(1)
280 00aa 11F0 breq .L11
171:OSsrc/os_mbox.c **** *err = OS_ERR_EVENT_TYPE;
282 .LM33:
283 00ac 81E0 ldi r24,lo8(1)
284 00ae 54C0 rjmp .L26
285 .L11:
172:OSsrc/os_mbox.c **** return (pevent);
173:OSsrc/os_mbox.c **** }
174:OSsrc/os_mbox.c **** OS_ENTER_CRITICAL();
287 .LM34:
288 /* #APP */
289 00b0 0FB6 in __tmp_reg__,__SREG__
290 00b2 F894 cli
291 00b4 0F92 push __tmp_reg__
175:OSsrc/os_mbox.c **** if (pevent->OSEventGrp != 0x00) { /* See if any tasks waiting on mailbox
293 .LM35:
294 /* #NOAPP */
295 00b6 8981 ldd r24,Y+1
296 00b8 8823 tst r24
297 00ba 19F0 breq .L12
176:OSsrc/os_mbox.c **** tasks_waiting = TRUE; /* Yes
299 .LM36:
300 00bc 91E0 ldi r25,lo8(1)
301 00be F92E mov r15,r25
302 00c0 01C0 rjmp .L13
303 .L12:
177:OSsrc/os_mbox.c **** } else {
178:OSsrc/os_mbox.c **** tasks_waiting = FALSE; /* No
305 .LM37:
306 00c2 F82E mov r15,r24
307 .L13:
179:OSsrc/os_mbox.c **** }
180:OSsrc/os_mbox.c **** switch (opt) {
309 .LM38:
310 00c4 7727 clr r23
311 00c6 6115 cp r22,__zero_reg__
312 00c8 7105 cpc r23,__zero_reg__
313 00ca 21F0 breq .L15
314 00cc 6130 cpi r22,1
315 00ce 7105 cpc r23,__zero_reg__
316 00d0 D1F0 breq .L18
317 00d2 3FC0 rjmp .L23
318 .L15:
181:OSsrc/os_mbox.c **** case OS_DEL_NO_PEND: /* Delete mailbox only if no task waitin
182:OSsrc/os_mbox.c **** if (tasks_waiting == FALSE) {
320 .LM39:
321 00d4 FF20 tst r15
322 00d6 99F4 brne .L16
183:OSsrc/os_mbox.c **** #if OS_EVENT_NAME_SIZE > 1
184:OSsrc/os_mbox.c **** pevent->OSEventName[0] = '?'; /* Unknown name
324 .LM40:
325 00d8 8FE3 ldi r24,lo8(63)
326 00da 8E87 std Y+14,r24
185:OSsrc/os_mbox.c **** pevent->OSEventName[1] = OS_ASCII_NUL;
328 .LM41:
329 00dc FF86 std Y+15,r15
186:OSsrc/os_mbox.c **** #endif
187:OSsrc/os_mbox.c **** pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
331 .LM42:
332 00de F882 st Y,r15
188:OSsrc/os_mbox.c **** pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free li
334 .LM43:
335 00e0 8091 0000 lds r24,OSEventFreeList
336 00e4 9091 0000 lds r25,(OSEventFreeList)+1
337 00e8 8C83 std Y+4,r24
338 00ea 9D83 std Y+5,r25
189:OSsrc/os_mbox.c **** pevent->OSEventCnt = 0;
340 .LM44:
341 00ec 6A83 std Y+2,r22
342 00ee 7B83 std Y+3,r23
190:OSsrc/os_mbox.c **** OSEventFreeList = pevent; /* Get next free event control block
344 .LM45:
345 00f0 D093 0000 sts (OSEventFreeList)+1,r29
346 00f4 C093 0000 sts OSEventFreeList,r28
191:OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
348 .LM46:
349 /* #APP */
350 00f8 0F90 pop __tmp_reg__
351 00fa 0FBE out __SREG__,__tmp_reg__
352 /* #NOAPP */
353 00fc 25C0 rjmp .L22
354 .L16:
192:OSsrc/os_mbox.c **** *err = OS_NO_ERR;
193:OSsrc/os_mbox.c **** return ((OS_EVENT *)0); /* Mailbox has been deleted
194:OSsrc/os_mbox.c **** } else {
195:OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
356 .LM47:
357 /* #APP */
358 00fe 0F90 pop __tmp_reg__
359 0100 0FBE out __SREG__,__tmp_reg__
196:OSsrc/os_mbox.c **** *err = OS_ERR_TASK_WAITING;
361 .LM48:
362 /* #NOAPP */
363 0102 88E0 ldi r24,lo8(8)
364 0104 29C0 rjmp .L26
365 .L18:
197:OSsrc/os_mbox.c **** return (pevent);
198:OSsrc/os_mbox.c **** }
199:OSsrc/os_mbox.c ****
200:OSsrc/os_mbox.c **** case OS_DEL_ALWAYS: /* Always delete the mailbox
201:OSsrc/os_mbox.c **** while (pevent->OSEventGrp != 0x00) { /* Ready ALL tasks waiting for mailbox
202:OSsrc/os_mbox.c **** (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX);
367 .LM49:
368 0106 8823 tst r24
369 0108 41F0 breq .L25
370 010a 42E0 ldi r20,lo8(2)
371 010c 60E0 ldi r22,lo8(0)
372 010e 70E0 ldi r23,hi8(0)
373 0110 CE01 movw r24,r28
374 0112 0E94 0000 call OS_EventTaskRdy
375 0116 8981 ldd r24,Y+1
376 0118 F6CF rjmp .L18
377 .L25:
203:OSsrc/os_mbox.c **** }
204:OSsrc/os_mbox.c **** #if OS_EVENT_NAME_SIZE > 1
205:OSsrc/os_mbox.c **** pevent->OSEventName[0] = '?'; /* Unknown name
379 .LM50:
380 011a 8FE3 ldi r24,lo8(63)
381 011c 8E87 std Y+14,r24
206:OSsrc/os_mbox.c **** pevent->OSEventName[1] = OS_ASCII_NUL;
383 .LM51:
384 011e 1F86 std Y+15,__zero_reg__
207:OSsrc/os_mbox.c **** #endif
208:OSsrc/os_mbox.c **** pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
386 .LM52:
387 0120 1882 st Y,__zero_reg__
209:OSsrc/os_mbox.c **** pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free li
389 .LM53:
390 0122 8091 0000 lds r24,OSEventFreeList
391 0126 9091 0000 lds r25,(OSEventFreeList)+1
392 012a 8C83 std Y+4,r24
393 012c 9D83 std Y+5,r25
210:OSsrc/os_mbox.c **** pevent->OSEventCnt = 0;
395 .LM54:
396 012e 1A82 std Y+2,__zero_reg__
397 0130 1B82 std Y+3,__zero_reg__
211:OSsrc/os_mbox.c **** OSEventFreeList = pevent; /* Get next free event control block
399 .LM55:
400 0132 D093 0000 sts (OSEventFreeList)+1,r29
401 0136 C093 0000 sts OSEventFreeList,r28
212:OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
403 .LM56:
404 /* #APP */
405 013a 0F90 pop __tmp_reg__
406 013c 0FBE out __SREG__,__tmp_reg__
213:OSsrc/os_mbox.c **** if (tasks_waiting == TRUE) { /* Reschedule only if task(s) were waiti
408 .LM57:
409 /* #NOAPP */
410 013e F1E0 ldi r31,lo8(1)
411 0140 FF16 cp r15,r31
412 0142 11F4 brne .L22
214:OSsrc/os_mbox.c **** OS_Sched(); /* Find highest priority task ready to r
414 .LM58:
415 0144 0E94 0000 call OS_Sched
416 .L22:
215:OSsrc/os_mbox.c **** }
216:OSsrc/os_mbox.c **** *err = OS_NO_ERR;
418 .LM59:
419 0148 F801 movw r30,r16
420 014a 1082 st Z,__zero_reg__
217:OSsrc/os_mbox.c **** return ((OS_EVENT *)0); /* Mailbox has been deleted
422 .LM60:
423 014c 80E0 ldi r24,lo8(0)
424 014e 90E0 ldi r25,hi8(0)
425 0150 06C0 rjmp .L8
426 .L23:
218:OSsrc/os_mbox.c ****
219:OSsrc/os_mbox.c **** default:
220:OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
428 .LM61:
429 /* #APP */
430 0152 0F90 pop __tmp_reg__
431 0154 0FBE out __SREG__,__tmp_reg__
221:OSsrc/os_mbox.c **** *err = OS_ERR_INVALID_OPT;
433 .LM62:
434 /* #NOAPP */
435 0156 87E0 ldi r24,lo8(7)
436 .L26:
437 0158 F801 movw r30,r16
438 015a 8083 st Z,r24
222:OSsrc/os_mbox.c **** return (pevent);
440 .LM63:
441 015c CE01 movw r24,r28
442 .L8:
443 /* epilogue: frame size=0 */
444 015e DF91 pop r29
445 0160 CF91 pop r28
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?