📄 os_mbox.lst
字号:
442 013e 90E0 ldi r25,hi8(0)
228:../OSsrc/os_mbox.c **** break;
444 .LM62:
445 0140 05C0 rjmp .L8
446 .L24:
229:../OSsrc/os_mbox.c ****
230:../OSsrc/os_mbox.c **** default:
231:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
448 .LM63:
449 /* #APP */
450 0142 7894 sei
232:../OSsrc/os_mbox.c **** *perr = OS_ERR_INVALID_OPT;
452 .LM64:
453 /* #NOAPP */
454 0144 87E0 ldi r24,lo8(7)
455 .L27:
456 0146 F801 movw r30,r16
457 0148 8083 st Z,r24
458 .L28:
233:../OSsrc/os_mbox.c **** pevent_return = pevent;
460 .LM65:
461 014a CE01 movw r24,r28
462 .L8:
463 /* epilogue: frame size=0 */
464 014c DF91 pop r29
465 014e CF91 pop r28
466 0150 1F91 pop r17
467 0152 0F91 pop r16
468 0154 FF90 pop r15
469 0156 0895 ret
470 /* epilogue end (size=6) */
471 /* function OSMboxDel size 118 (107) */
477 .Lscope2:
482 .global OSMboxPend
484 OSMboxPend:
234:../OSsrc/os_mbox.c **** break;
235:../OSsrc/os_mbox.c **** }
236:../OSsrc/os_mbox.c **** return (pevent_return);
237:../OSsrc/os_mbox.c **** }
238:../OSsrc/os_mbox.c **** #endif
239:../OSsrc/os_mbox.c ****
240:../OSsrc/os_mbox.c **** /*$PAGE*/
241:../OSsrc/os_mbox.c **** /*
242:../OSsrc/os_mbox.c **** ***************************************************************************************************
243:../OSsrc/os_mbox.c **** * PEND ON MAILBOX FOR A MESSAGE
244:../OSsrc/os_mbox.c **** *
245:../OSsrc/os_mbox.c **** * Description: This function waits for a message to be sent to a mailbox
246:../OSsrc/os_mbox.c **** *
247:../OSsrc/os_mbox.c **** * Arguments : pevent is a pointer to the event control block associated with the desired ma
248:../OSsrc/os_mbox.c **** *
249:../OSsrc/os_mbox.c **** * timeout is an optional timeout period (in clock ticks). If non-zero, your tas
250:../OSsrc/os_mbox.c **** * wait for a message to arrive at the mailbox up to the amount of time
251:../OSsrc/os_mbox.c **** * specified by this argument. If you specify 0, however, your task will
252:../OSsrc/os_mbox.c **** * forever at the specified mailbox or, until a message arrives.
253:../OSsrc/os_mbox.c **** *
254:../OSsrc/os_mbox.c **** * perr is a pointer to where an error message will be deposited. Possible er
255:../OSsrc/os_mbox.c **** * messages are:
256:../OSsrc/os_mbox.c **** *
257:../OSsrc/os_mbox.c **** * OS_ERR_NONE The call was successful and your task received a
258:../OSsrc/os_mbox.c **** * message.
259:../OSsrc/os_mbox.c **** * OS_ERR_TIMEOUT A message was not received within the specified 't
260:../OSsrc/os_mbox.c **** * OS_ERR_PEND_ABORT The wait on the mailbox was aborted.
261:../OSsrc/os_mbox.c **** * OS_ERR_EVENT_TYPE Invalid event type
262:../OSsrc/os_mbox.c **** * OS_ERR_PEND_ISR If you called this function from an ISR and the re
263:../OSsrc/os_mbox.c **** * would lead to a suspension.
264:../OSsrc/os_mbox.c **** * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
265:../OSsrc/os_mbox.c **** * OS_ERR_PEND_LOCKED If you called this function when the scheduler is
266:../OSsrc/os_mbox.c **** *
267:../OSsrc/os_mbox.c **** * Returns : != (void *)0 is a pointer to the message received
268:../OSsrc/os_mbox.c **** * == (void *)0 if no message was received or,
269:../OSsrc/os_mbox.c **** * if 'pevent' is a NULL pointer or,
270:../OSsrc/os_mbox.c **** * if you didn't pass the proper pointer to the event control block.
271:../OSsrc/os_mbox.c **** ***************************************************************************************************
272:../OSsrc/os_mbox.c **** */
273:../OSsrc/os_mbox.c ****
274:../OSsrc/os_mbox.c **** void *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *perr)
275:../OSsrc/os_mbox.c **** {
486 .LM66:
487 /* prologue: frame size=0 */
488 0158 EF92 push r14
489 015a FF92 push r15
490 015c 1F93 push r17
491 015e CF93 push r28
492 0160 DF93 push r29
493 /* prologue end (size=5) */
494 0162 EC01 movw r28,r24
495 0164 7A01 movw r14,r20
276:../OSsrc/os_mbox.c **** void *pmsg;
277:../OSsrc/os_mbox.c **** INT8U pend_stat;
278:../OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register
279:../OSsrc/os_mbox.c **** OS_CPU_SR cpu_sr = 0;
280:../OSsrc/os_mbox.c **** #endif
281:../OSsrc/os_mbox.c ****
282:../OSsrc/os_mbox.c ****
283:../OSsrc/os_mbox.c ****
284:../OSsrc/os_mbox.c **** #if OS_ARG_CHK_EN > 0
285:../OSsrc/os_mbox.c **** if (perr == (INT8U *)0) { /* Validate 'perr'
497 .LM67:
498 0166 4115 cp r20,__zero_reg__
499 0168 5105 cpc r21,__zero_reg__
500 016a 09F4 brne .+2
501 016c 5EC0 rjmp .L29
286:../OSsrc/os_mbox.c **** return ((void *)0);
287:../OSsrc/os_mbox.c **** }
288:../OSsrc/os_mbox.c **** if (pevent == (OS_EVENT *)0) { /* Validate 'pevent'
503 .LM68:
504 016e 892B or r24,r25
505 0170 29F4 brne .L31
289:../OSsrc/os_mbox.c **** *perr = OS_ERR_PEVENT_NULL;
507 .LM69:
508 0172 84E0 ldi r24,lo8(4)
509 0174 FA01 movw r30,r20
510 0176 8083 st Z,r24
290:../OSsrc/os_mbox.c **** return ((void *)0);
512 .LM70:
513 0178 AE01 movw r20,r28
514 017a 57C0 rjmp .L29
515 .L31:
291:../OSsrc/os_mbox.c **** }
292:../OSsrc/os_mbox.c **** #endif
293:../OSsrc/os_mbox.c **** if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type
517 .LM71:
518 017c 8881 ld r24,Y
519 017e 8130 cpi r24,lo8(1)
520 0180 11F0 breq .L32
294:../OSsrc/os_mbox.c **** *perr = OS_ERR_EVENT_TYPE;
522 .LM72:
523 0182 81E0 ldi r24,lo8(1)
524 0184 3FC0 rjmp .L41
525 .L32:
295:../OSsrc/os_mbox.c **** return ((void *)0);
296:../OSsrc/os_mbox.c **** }
297:../OSsrc/os_mbox.c **** if (OSIntNesting > 0) { /* See if called from ISR ...
527 .LM73:
528 0186 8091 0000 lds r24,OSIntNesting
529 018a 8823 tst r24
530 018c 11F0 breq .L33
298:../OSsrc/os_mbox.c **** *perr = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR
532 .LM74:
533 018e 82E0 ldi r24,lo8(2)
534 0190 39C0 rjmp .L41
535 .L33:
299:../OSsrc/os_mbox.c **** return ((void *)0);
300:../OSsrc/os_mbox.c **** }
301:../OSsrc/os_mbox.c **** if (OSLockNesting > 0) { /* See if called with scheduler locked ...
537 .LM75:
538 0192 8091 0000 lds r24,OSLockNesting
539 0196 8823 tst r24
540 0198 11F0 breq .L34
302:../OSsrc/os_mbox.c **** *perr = OS_ERR_PEND_LOCKED; /* ... can't PEND when locked
542 .LM76:
543 019a 8DE0 ldi r24,lo8(13)
544 019c 33C0 rjmp .L41
545 .L34:
303:../OSsrc/os_mbox.c **** return ((void *)0);
304:../OSsrc/os_mbox.c **** }
305:../OSsrc/os_mbox.c **** OS_ENTER_CRITICAL();
547 .LM77:
548 /* #APP */
549 019e F894 cli
306:../OSsrc/os_mbox.c **** pmsg = pevent->OSEventPtr;
551 .LM78:
552 /* #NOAPP */
553 01a0 4981 ldd r20,Y+1
554 01a2 5A81 ldd r21,Y+2
307:../OSsrc/os_mbox.c **** if (pmsg != (void *)0) { /* See if there is already a message
556 .LM79:
557 01a4 4115 cp r20,__zero_reg__
558 01a6 5105 cpc r21,__zero_reg__
559 01a8 21F0 breq .L35
308:../OSsrc/os_mbox.c **** pevent->OSEventPtr = (void *)0; /* Clear the mailbox
561 .LM80:
562 01aa 1A82 std Y+2,__zero_reg__
563 01ac 1982 std Y+1,__zero_reg__
309:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
565 .LM81:
566 /* #APP */
567 01ae 7894 sei
568 /* #NOAPP */
569 01b0 3AC0 rjmp .L42
570 .L35:
310:../OSsrc/os_mbox.c **** *perr = OS_ERR_NONE;
311:../OSsrc/os_mbox.c **** return (pmsg); /* Return the message received (or NULL)
312:../OSsrc/os_mbox.c **** }
313:../OSsrc/os_mbox.c **** OSTCBCur->OSTCBStat |= OS_STAT_MBOX; /* Message not available, task will pend
572 .LM82:
573 01b2 E091 0000 lds r30,OSTCBCur
574 01b6 F091 0000 lds r31,(OSTCBCur)+1
575 01ba 818D ldd r24,Z+25
576 01bc 8260 ori r24,lo8(2)
577 01be 818F std Z+25,r24
314:../OSsrc/os_mbox.c **** OSTCBCur->OSTCBStatPend = OS_STAT_PEND_OK;
579 .LM83:
580 01c0 E091 0000 lds r30,OSTCBCur
581 01c4 F091 0000 lds r31,(OSTCBCur)+1
582 01c8 128E std Z+26,__zero_reg__
315:../OSsrc/os_mbox.c **** OSTCBCur->OSTCBDly = timeout; /* Load timeout in TCB
584 .LM84:
585 01ca E091 0000 lds r30,OSTCBCur
586 01ce F091 0000 lds r31,(OSTCBCur)+1
587 01d2 708F std Z+24,r23
588 01d4 678B std Z+23,r22
316:../OSsrc/os_mbox.c **** OS_EventTaskWait(pevent); /* Suspend task until event or timeout occurs
590 .LM85:
591 01d6 CE01 movw r24,r28
592 01d8 0E94 0000 call OS_EventTaskWait
317:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
594 .LM86:
595 /* #APP */
596 01dc 7894 sei
318:../OSsrc/os_mbox.c **** OS_Sched(); /* Find next highest priority task ready to r
598 .LM87:
599 /* #NOAPP */
600 01de 0E94 0000 call OS_Sched
319:../OSsrc/os_mbox.c **** OS_ENTER_CRITICAL();
602 .LM88:
603 /* #APP */
604 01e2 F894 cli
320:../OSsrc/os_mbox.c **** if (OSTCBCur->OSTCBStatPend != OS_STAT_PEND_OK) { /* See if we weren't given the message
606 .LM89:
607 /* #NOAPP */
608 01e4 E091 0000 lds r30,OSTCBCur
609 01e8 F091 0000 lds r31,(OSTCBCur)+1
610 01ec 128D ldd r17,Z+26
611 01ee 1123 tst r17
612 01f0 71F0 breq .L36
321:../OSsrc/os_mbox.c **** pend_stat = OSTCBCur->OSTCBStatPend;
322:../OSsrc/os_mbox.c **** OS_EventTOAbort(pevent); /* Timed out, Make task ready
614 .LM90:
615 01f2 CE01 movw r24,r28
616 01f4 0E94 0000 call OS_EventTOAbort
323:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
618 .LM91:
619 /* #APP */
620 01f8 7894 sei
324:../OSsrc/os_mbox.c **** switch (pend_stat) {
622 .LM92:
623 /* #NOAPP */
624 01fa 1230 cpi r17,lo8(2)
625 01fc 11F0 breq .L40
325:../OSsrc/os_mbox.c **** case OS_STAT_PEND_TO:
326:../OSsrc/os_mbox.c **** default:
327:../OSsrc/os_mbox.c **** *perr = OS_ERR_TIMEOUT; /* Indicate that a timeout occured
627 .LM93:
628 01fe 8AE0 ldi r24,lo8(10)
629 0200 01C0 rjmp .L41
630 .L40:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -