os_q.lst
来自「称植到lpc2124上的UCOS2.85版 是本人初学移植和ARM的成果 可」· LST 代码 · 共 1,276 行 · 第 1/5 页
LST
1,276 行
329:../OSsrc/os_q.c **** #endif
330:../OSsrc/os_q.c ****
331:../OSsrc/os_q.c ****
332:../OSsrc/os_q.c ****
333:../OSsrc/os_q.c **** #if OS_ARG_CHK_EN > 0
334:../OSsrc/os_q.c **** if (pevent == (OS_EVENT *)0) { /* Validate 'pevent'
665 .LM98:
666 0240 892B or r24,r25
667 0242 19F4 brne .L36
335:../OSsrc/os_q.c **** return (OS_ERR_PEVENT_NULL);
669 .LM99:
670 0244 84E0 ldi r24,lo8(4)
671 0246 90E0 ldi r25,hi8(4)
672 0248 0895 ret
673 .L36:
336:../OSsrc/os_q.c **** }
337:../OSsrc/os_q.c **** if (pevent->OSEventType != OS_EVENT_TYPE_Q) { /* Validate event block type
675 .LM100:
676 024a 8081 ld r24,Z
677 024c 8230 cpi r24,lo8(2)
678 024e 19F0 breq .L37
338:../OSsrc/os_q.c **** return (OS_ERR_EVENT_TYPE);
680 .LM101:
681 0250 81E0 ldi r24,lo8(1)
682 0252 90E0 ldi r25,hi8(1)
683 0254 0895 ret
684 .L37:
339:../OSsrc/os_q.c **** }
340:../OSsrc/os_q.c **** #endif
341:../OSsrc/os_q.c **** OS_ENTER_CRITICAL();
686 .LM102:
687 /* #APP */
688 0256 F894 cli
342:../OSsrc/os_q.c **** pq = (OS_Q *)pevent->OSEventPtr; /* Point to queue storage structure
690 .LM103:
691 /* #NOAPP */
692 0258 0180 ldd __tmp_reg__,Z+1
693 025a F281 ldd r31,Z+2
694 025c E02D mov r30,__tmp_reg__
343:../OSsrc/os_q.c **** pq->OSQIn = pq->OSQStart;
696 .LM104:
697 025e 8281 ldd r24,Z+2
698 0260 9381 ldd r25,Z+3
699 0262 9783 std Z+7,r25
700 0264 8683 std Z+6,r24
344:../OSsrc/os_q.c **** pq->OSQOut = pq->OSQStart;
702 .LM105:
703 0266 9187 std Z+9,r25
704 0268 8087 std Z+8,r24
345:../OSsrc/os_q.c **** pq->OSQEntries = 0;
706 .LM106:
707 026a 1586 std Z+13,__zero_reg__
708 026c 1486 std Z+12,__zero_reg__
346:../OSsrc/os_q.c **** OS_EXIT_CRITICAL();
710 .LM107:
711 /* #APP */
712 026e 7894 sei
347:../OSsrc/os_q.c **** return (OS_ERR_NONE);
714 .LM108:
715 /* #NOAPP */
716 0270 80E0 ldi r24,lo8(0)
717 0272 90E0 ldi r25,hi8(0)
348:../OSsrc/os_q.c **** }
719 .LM109:
720 0274 0895 ret
721 /* epilogue: frame size=0 */
722 /* epilogue: noreturn */
723 /* epilogue end (size=0) */
724 /* function OSQFlush size 30 (30) */
729 .Lscope3:
734 .global OSQPend
736 OSQPend:
349:../OSsrc/os_q.c **** #endif
350:../OSsrc/os_q.c ****
351:../OSsrc/os_q.c **** /*$PAGE*/
352:../OSsrc/os_q.c **** /*
353:../OSsrc/os_q.c **** ***************************************************************************************************
354:../OSsrc/os_q.c **** * PEND ON A QUEUE FOR A MESSAGE
355:../OSsrc/os_q.c **** *
356:../OSsrc/os_q.c **** * Description: This function waits for a message to be sent to a queue
357:../OSsrc/os_q.c **** *
358:../OSsrc/os_q.c **** * Arguments : pevent is a pointer to the event control block associated with the desired qu
359:../OSsrc/os_q.c **** *
360:../OSsrc/os_q.c **** * timeout is an optional timeout period (in clock ticks). If non-zero, your tas
361:../OSsrc/os_q.c **** * wait for a message to arrive at the queue up to the amount of time
362:../OSsrc/os_q.c **** * specified by this argument. If you specify 0, however, your task will
363:../OSsrc/os_q.c **** * forever at the specified queue or, until a message arrives.
364:../OSsrc/os_q.c **** *
365:../OSsrc/os_q.c **** * perr is a pointer to where an error message will be deposited. Possible er
366:../OSsrc/os_q.c **** * messages are:
367:../OSsrc/os_q.c **** *
368:../OSsrc/os_q.c **** * OS_ERR_NONE The call was successful and your task received a
369:../OSsrc/os_q.c **** * message.
370:../OSsrc/os_q.c **** * OS_ERR_TIMEOUT A message was not received within the specified 't
371:../OSsrc/os_q.c **** * OS_ERR_PEND_ABORT The wait on the queue was aborted.
372:../OSsrc/os_q.c **** * OS_ERR_EVENT_TYPE You didn't pass a pointer to a queue
373:../OSsrc/os_q.c **** * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
374:../OSsrc/os_q.c **** * OS_ERR_PEND_ISR If you called this function from an ISR and the re
375:../OSsrc/os_q.c **** * would lead to a suspension.
376:../OSsrc/os_q.c **** * OS_ERR_PEND_LOCKED If you called this function with the scheduler is
377:../OSsrc/os_q.c **** *
378:../OSsrc/os_q.c **** * Returns : != (void *)0 is a pointer to the message received
379:../OSsrc/os_q.c **** * == (void *)0 if you received a NULL pointer message or,
380:../OSsrc/os_q.c **** * if no message was received or,
381:../OSsrc/os_q.c **** * if 'pevent' is a NULL pointer or,
382:../OSsrc/os_q.c **** * if you didn't pass a pointer to a queue.
383:../OSsrc/os_q.c **** *
384:../OSsrc/os_q.c **** * Note(s) : As of V2.60, this function allows you to receive NULL pointer messages.
385:../OSsrc/os_q.c **** ***************************************************************************************************
386:../OSsrc/os_q.c **** */
387:../OSsrc/os_q.c ****
388:../OSsrc/os_q.c **** void *OSQPend (OS_EVENT *pevent, INT16U timeout, INT8U *perr)
389:../OSsrc/os_q.c **** {
738 .LM110:
739 /* prologue: frame size=0 */
740 0276 EF92 push r14
741 0278 FF92 push r15
742 027a 1F93 push r17
743 027c CF93 push r28
744 027e DF93 push r29
745 /* prologue end (size=5) */
746 0280 7C01 movw r14,r24
747 0282 EA01 movw r28,r20
390:../OSsrc/os_q.c **** void *pmsg;
391:../OSsrc/os_q.c **** OS_Q *pq;
392:../OSsrc/os_q.c **** INT8U pend_stat;
393:../OSsrc/os_q.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register
394:../OSsrc/os_q.c **** OS_CPU_SR cpu_sr = 0;
395:../OSsrc/os_q.c **** #endif
396:../OSsrc/os_q.c ****
397:../OSsrc/os_q.c ****
398:../OSsrc/os_q.c ****
399:../OSsrc/os_q.c **** #if OS_ARG_CHK_EN > 0
400:../OSsrc/os_q.c **** if (perr == (INT8U *)0) { /* Validate 'perr'
749 .LM111:
750 0284 4115 cp r20,__zero_reg__
751 0286 5105 cpc r21,__zero_reg__
752 0288 09F4 brne .+2
753 028a 74C0 rjmp .L38
401:../OSsrc/os_q.c **** return ((void *)0);
402:../OSsrc/os_q.c **** }
403:../OSsrc/os_q.c **** if (pevent == (OS_EVENT *)0) { /* Validate 'pevent'
755 .LM112:
756 028c 0097 sbiw r24,0
757 028e 21F4 brne .L40
404:../OSsrc/os_q.c **** *perr = OS_ERR_PEVENT_NULL;
759 .LM113:
760 0290 84E0 ldi r24,lo8(4)
761 0292 8883 st Y,r24
405:../OSsrc/os_q.c **** return ((void *)0);
763 .LM114:
764 0294 A701 movw r20,r14
765 0296 6EC0 rjmp .L38
766 .L40:
406:../OSsrc/os_q.c **** }
407:../OSsrc/os_q.c **** if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type
768 .LM115:
769 0298 FC01 movw r30,r24
770 029a 9081 ld r25,Z
771 029c 9230 cpi r25,lo8(2)
772 029e 11F0 breq .L41
408:../OSsrc/os_q.c **** *perr = OS_ERR_EVENT_TYPE;
774 .LM116:
775 02a0 81E0 ldi r24,lo8(1)
776 02a2 56C0 rjmp .L51
777 .L41:
409:../OSsrc/os_q.c **** return ((void *)0);
410:../OSsrc/os_q.c **** }
411:../OSsrc/os_q.c **** #endif
412:../OSsrc/os_q.c **** if (OSIntNesting > 0) { /* See if called from ISR ...
779 .LM117:
780 02a4 8091 0000 lds r24,OSIntNesting
781 02a8 8823 tst r24
782 02aa 11F0 breq .L42
413:../OSsrc/os_q.c **** *perr = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR
784 .LM118:
785 02ac 9883 st Y,r25
786 02ae 51C0 rjmp .L52
787 .L42:
414:../OSsrc/os_q.c **** return ((void *)0);
415:../OSsrc/os_q.c **** }
416:../OSsrc/os_q.c **** if (OSLockNesting > 0) { /* See if called with scheduler locked ...
789 .LM119:
790 02b0 8091 0000 lds r24,OSLockNesting
791 02b4 8823 tst r24
792 02b6 11F0 breq .L43
417:../OSsrc/os_q.c **** *perr = OS_ERR_PEND_LOCKED; /* ... can't PEND when locked
794 .LM120:
795 02b8 8DE0 ldi r24,lo8(13)
796 02ba 4AC0 rjmp .L51
797 .L43:
418:../OSsrc/os_q.c **** return ((void *)0);
419:../OSsrc/os_q.c **** }
420:../OSsrc/os_q.c **** OS_ENTER_CRITICAL();
799 .LM121:
800 /* #APP */
801 02bc F894 cli
421:../OSsrc/os_q.c **** pq = (OS_Q *)pevent->OSEventPtr; /* Point at queue control block
803 .LM122:
804 /* #NOAPP */
805 02be F701 movw r30,r14
806 02c0 A181 ldd r26,Z+1
807 02c2 B281 ldd r27,Z+2
422:../OSsrc/os_q.c **** if (pq->OSQEntries > 0) { /* See if any messages in the queue
809 .LM123:
810 02c4 FD01 movw r30,r26
811 02c6 8485 ldd r24,Z+12
812 02c8 9585 ldd r25,Z+13
813 02ca 0097 sbiw r24,0
814 02cc C1F0 breq .L44
423:../OSsrc/os_q.c **** pmsg = *pq->OSQOut++; /* Yes, extract oldest message from the queue
816 .LM124:
817 02ce 2085 ldd r18,Z+8
818 02d0 3185 ldd r19,Z+9
819 02d2 F901 movw r30,r18
820 02d4 4191 ld r20,Z+
821 02d6 5191 ld r21,Z+
822 02d8 9F01 movw r18,r30
823 02da FD01 movw r30,r26
824 02dc 3187 std Z+9,r19
825 02de 2087 std Z+8,r18
424:../OSsrc/os_q.c **** pq->OSQEntries--; /* Update the number of entries in the queue
827 .LM125:
828 02e0 0197 sbiw r24,1
829 02e2 9587 std Z+13,r25
830 02e4 8487 std Z+12,r24
425:../OSsrc/os_q.c **** if (pq->OSQOut == pq->OSQEnd) { /* Wrap OUT pointer if we are at the end of the qu
832 .LM126:
833 02e6 8481 ldd r24,Z+4
834 02e8 9581 ldd r25,Z+5
835 02ea 2817 cp r18,r24
836 02ec 3907 cpc r19,r25
837 02ee 21F4 brne .L45
426:../OSsrc/os_q.c **** pq->OSQOut = pq->OSQStart;
839 .LM127:
840 02f0 8281 ldd r24,Z+2
841 02f2 9381 ldd r25,Z+3
842 02f4 9187 std Z+9,r25
843 02f6 8087 std Z+8,r24
844 .L45:
427:../OSsrc/os_q.c **** }
428:../OSsrc/os_q.c **** OS_EXIT_CRITICAL();
846 .LM128:
847 /* #APP */
848 02f8 7894 sei
429:../OSsrc/os_q.c **** *perr = OS_ERR_NONE;
850 .LM129:
851 /* #NOAPP */
852 02fa 1882 st Y,__zero_reg__
430:../OSsrc/os_q.c **** return (pmsg); /* Return message received
854 .LM130:
855 02fc 3BC0 rjmp .L38
856 .L44:
431:../OSsrc/os_q.c **** }
432:../OSsrc/os_q.c **** OSTCBCur->OSTCBStat |= OS_STAT_Q; /* Task will have to pend for a message to be post
858 .LM131:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?