os_mbox.lst

来自「atmega单片机用的ucos系统 占用内存适中 是atmega单片机合适的操作」· LST 代码 · 共 1,285 行 · 第 1/5 页

LST
1,285
字号
 324:OSsrc/os_mbox.c **** *              OS_MBOX_FULL         If the mailbox already contains a message.  You can can only se
 325:OSsrc/os_mbox.c **** *                                   message at a time and thus, the message MUST be consumed before
 326:OSsrc/os_mbox.c **** *                                   are allowed to send another one.
 327:OSsrc/os_mbox.c **** *              OS_ERR_EVENT_TYPE    If you are attempting to post to a non mailbox.
 328:OSsrc/os_mbox.c **** *              OS_ERR_PEVENT_NULL   If 'pevent' is a NULL pointer
 329:OSsrc/os_mbox.c **** *              OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
 330:OSsrc/os_mbox.c **** *
 331:OSsrc/os_mbox.c **** * Note(s)    : 1) HPT means Highest Priority Task
 332:OSsrc/os_mbox.c **** ***************************************************************************************************
 333:OSsrc/os_mbox.c **** */
 334:OSsrc/os_mbox.c **** 
 335:OSsrc/os_mbox.c **** #if OS_MBOX_POST_EN > 0
 336:OSsrc/os_mbox.c **** INT8U  OSMboxPost (OS_EVENT *pevent, void *msg)
 337:OSsrc/os_mbox.c **** {
 651               	.LM95:
 652               	/* prologue: frame size=0 */
 653               	/* prologue end (size=0) */
 654 0236 FC01      		movw r30,r24
 338:OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register  
 339:OSsrc/os_mbox.c ****     OS_CPU_SR  cpu_sr;
 340:OSsrc/os_mbox.c ****     
 341:OSsrc/os_mbox.c **** 
 342:OSsrc/os_mbox.c ****     
 343:OSsrc/os_mbox.c ****     cpu_sr = 0;                                       /* Prevent compiler warning                  
 344:OSsrc/os_mbox.c **** #endif    
 345:OSsrc/os_mbox.c **** #if OS_ARG_CHK_EN > 0
 346:OSsrc/os_mbox.c ****     if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                         
 656               	.LM96:
 657 0238 892B      		or r24,r25
 658 023a 19F4      		brne .L36
 347:OSsrc/os_mbox.c ****         return (OS_ERR_PEVENT_NULL);
 660               	.LM97:
 661 023c 84E0      		ldi r24,lo8(4)
 662 023e 90E0      		ldi r25,hi8(4)
 663 0240 0895      		ret
 664               	.L36:
 348:OSsrc/os_mbox.c ****     }
 349:OSsrc/os_mbox.c ****     if (msg == (void *)0) {                           /* Make sure we are not posting a NULL pointe
 666               	.LM98:
 667 0242 6115      		cp r22,__zero_reg__
 668 0244 7105      		cpc r23,__zero_reg__
 669 0246 19F4      		brne .L37
 350:OSsrc/os_mbox.c ****         return (OS_ERR_POST_NULL_PTR);
 671               	.LM99:
 672 0248 83E0      		ldi r24,lo8(3)
 673 024a 90E0      		ldi r25,hi8(3)
 674 024c 0895      		ret
 675               	.L37:
 351:OSsrc/os_mbox.c ****     }
 352:OSsrc/os_mbox.c **** #endif
 353:OSsrc/os_mbox.c ****     if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                 
 677               	.LM100:
 678 024e 8081      		ld r24,Z
 679 0250 8130      		cpi r24,lo8(1)
 680 0252 19F0      		breq .L38
 354:OSsrc/os_mbox.c ****         return (OS_ERR_EVENT_TYPE);
 682               	.LM101:
 683 0254 81E0      		ldi r24,lo8(1)
 684 0256 90E0      		ldi r25,hi8(1)
 685 0258 0895      		ret
 686               	.L38:
 355:OSsrc/os_mbox.c ****     }
 356:OSsrc/os_mbox.c ****     OS_ENTER_CRITICAL();
 688               	.LM102:
 689               	/* #APP */
 690 025a 0FB6      		in __tmp_reg__,__SREG__
 691 025c F894      		cli
 692 025e 0F92      		push __tmp_reg__
 357:OSsrc/os_mbox.c ****     if (pevent->OSEventGrp != 0x00) {                     /* See if any task pending on mailbox    
 694               	.LM103:
 695               	/* #NOAPP */
 696 0260 8181      		ldd r24,Z+1
 697 0262 8823      		tst r24
 698 0264 59F0      		breq .L39
 358:OSsrc/os_mbox.c ****         (void)OS_EventTaskRdy(pevent, msg, OS_STAT_MBOX); /* Ready HPT waiting on event            
 700               	.LM104:
 701 0266 42E0      		ldi r20,lo8(2)
 702 0268 CF01      		movw r24,r30
 703 026a 0E94 0000 		call OS_EventTaskRdy
 359:OSsrc/os_mbox.c ****         OS_EXIT_CRITICAL();
 705               	.LM105:
 706               	/* #APP */
 707 026e 0F90      		pop __tmp_reg__
 708 0270 0FBE      		out __SREG__,__tmp_reg__
 360:OSsrc/os_mbox.c ****         OS_Sched();                                   /* Find highest priority task ready to run   
 710               	.LM106:
 711               	/* #NOAPP */
 712 0272 0E94 0000 		call OS_Sched
 361:OSsrc/os_mbox.c ****         return (OS_NO_ERR);
 714               	.LM107:
 715 0276 80E0      		ldi r24,lo8(0)
 716 0278 90E0      		ldi r25,hi8(0)
 717 027a 0895      		ret
 718               	.L39:
 362:OSsrc/os_mbox.c ****     }
 363:OSsrc/os_mbox.c ****     if (pevent->OSEventPtr != (void *)0) {            /* Make sure mailbox doesn't already have a m
 720               	.LM108:
 721 027c 8481      		ldd r24,Z+4
 722 027e 9581      		ldd r25,Z+5
 723 0280 892B      		or r24,r25
 724 0282 29F0      		breq .L40
 364:OSsrc/os_mbox.c ****         OS_EXIT_CRITICAL();
 726               	.LM109:
 727               	/* #APP */
 728 0284 0F90      		pop __tmp_reg__
 729 0286 0FBE      		out __SREG__,__tmp_reg__
 365:OSsrc/os_mbox.c ****         return (OS_MBOX_FULL);
 731               	.LM110:
 732               	/* #NOAPP */
 733 0288 84E1      		ldi r24,lo8(20)
 734 028a 90E0      		ldi r25,hi8(20)
 735 028c 0895      		ret
 736               	.L40:
 366:OSsrc/os_mbox.c ****     }
 367:OSsrc/os_mbox.c ****     pevent->OSEventPtr = msg;                         /* Place message in mailbox                  
 738               	.LM111:
 739 028e 6483      		std Z+4,r22
 740 0290 7583      		std Z+5,r23
 368:OSsrc/os_mbox.c ****     OS_EXIT_CRITICAL();
 742               	.LM112:
 743               	/* #APP */
 744 0292 0F90      		pop __tmp_reg__
 745 0294 0FBE      		out __SREG__,__tmp_reg__
 369:OSsrc/os_mbox.c ****     return (OS_NO_ERR);
 747               	.LM113:
 748               	/* #NOAPP */
 749 0296 80E0      		ldi r24,lo8(0)
 750 0298 90E0      		ldi r25,hi8(0)
 370:OSsrc/os_mbox.c **** }
 752               	.LM114:
 753 029a 0895      		ret
 754               	/* epilogue: frame size=0 */
 755 029c 0895      		ret
 756               	/* epilogue end (size=1) */
 757               	/* function OSMboxPost size 61 (60) */
 759               	.Lscope4:
 764               	.global	OSMboxPostOpt
 766               	OSMboxPostOpt:
 371:OSsrc/os_mbox.c **** #endif
 372:OSsrc/os_mbox.c **** 
 373:OSsrc/os_mbox.c **** /*$PAGE*/
 374:OSsrc/os_mbox.c **** /*
 375:OSsrc/os_mbox.c **** ***************************************************************************************************
 376:OSsrc/os_mbox.c **** *                                       POST MESSAGE TO A MAILBOX
 377:OSsrc/os_mbox.c **** *
 378:OSsrc/os_mbox.c **** * Description: This function sends a message to a mailbox
 379:OSsrc/os_mbox.c **** *
 380:OSsrc/os_mbox.c **** * Arguments  : pevent        is a pointer to the event control block associated with the desired ma
 381:OSsrc/os_mbox.c **** *
 382:OSsrc/os_mbox.c **** *              msg           is a pointer to the message to send.  You MUST NOT send a NULL pointer
 383:OSsrc/os_mbox.c **** *
 384:OSsrc/os_mbox.c **** *              opt           determines the type of POST performed:
 385:OSsrc/os_mbox.c **** *                            OS_POST_OPT_NONE         POST to a single waiting task 
 386:OSsrc/os_mbox.c **** *                                                     (Identical to OSMboxPost())
 387:OSsrc/os_mbox.c **** *                            OS_POST_OPT_BROADCAST    POST to ALL tasks that are waiting on the mai
 388:OSsrc/os_mbox.c **** *
 389:OSsrc/os_mbox.c **** * Returns    : OS_NO_ERR            The call was successful and the message was sent
 390:OSsrc/os_mbox.c **** *              OS_MBOX_FULL         If the mailbox already contains a message.  You can can only se
 391:OSsrc/os_mbox.c **** *                                   message at a time and thus, the message MUST be consumed before
 392:OSsrc/os_mbox.c **** *                                   are allowed to send another one.
 393:OSsrc/os_mbox.c **** *              OS_ERR_EVENT_TYPE    If you are attempting to post to a non mailbox.
 394:OSsrc/os_mbox.c **** *              OS_ERR_PEVENT_NULL   If 'pevent' is a NULL pointer
 395:OSsrc/os_mbox.c **** *              OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
 396:OSsrc/os_mbox.c **** *
 397:OSsrc/os_mbox.c **** * Note(s)    : 1) HPT means Highest Priority Task
 398:OSsrc/os_mbox.c **** *
 399:OSsrc/os_mbox.c **** * Warning    : Interrupts can be disabled for a long time if you do a 'broadcast'.  In fact, the 
 400:OSsrc/os_mbox.c **** *              interrupt disable time is proportional to the number of tasks waiting on the mailbox
 401:OSsrc/os_mbox.c **** ***************************************************************************************************
 402:OSsrc/os_mbox.c **** */
 403:OSsrc/os_mbox.c **** 
 404:OSsrc/os_mbox.c **** #if OS_MBOX_POST_OPT_EN > 0
 405:OSsrc/os_mbox.c **** INT8U  OSMboxPostOpt (OS_EVENT *pevent, void *msg, INT8U opt)
 406:OSsrc/os_mbox.c **** {
 768               	.LM115:
 769               	/* prologue: frame size=0 */
 770 029e 0F93      		push r16
 771 02a0 1F93      		push r17
 772 02a2 CF93      		push r28
 773 02a4 DF93      		push r29
 774               	/* prologue end (size=4) */
 775 02a6 EC01      		movw r28,r24
 776 02a8 8B01      		movw r16,r22
 407:OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register  
 408:OSsrc/os_mbox.c ****     OS_CPU_SR  cpu_sr;
 409:OSsrc/os_mbox.c ****     
 410:OSsrc/os_mbox.c ****     
 411:OSsrc/os_mbox.c **** 
 412:OSsrc/os_mbox.c ****     cpu_sr = 0;                                       /* Prevent compiler warning                  
 413:OSsrc/os_mbox.c **** #endif    
 414:OSsrc/os_mbox.c **** #if OS_ARG_CHK_EN > 0
 415:OSsrc/os_mbox.c ****     if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                         
 778               	.LM116:
 779 02aa 892B      		or r24,r25
 780 02ac 19F4      		brne .L42
 416:OSsrc/os_mbox.c ****         return (OS_ERR_PEVENT_NULL);
 782               	.LM117:
 783 02ae 84E0      		ldi r24,lo8(4)
 784 02b0 90E0      		ldi r25,hi8(4)
 785 02b2 35C0      		rjmp .L41
 786               	.L42:
 417:OSsrc/os_mbox.c ****     }
 418:OSsrc/os_mbox.c ****     if (msg == (void *)0) {                           /* Make sure we are not posting a NULL pointe
 788               	.LM118:
 789 02b4 6115      		cp r22,__zero_reg__
 790 02b6 7105      		cpc r23,__zero_reg__
 791 02b8 19F4      		brne .L43
 419:OSsrc/os_mbox.c ****         return (OS_ERR_POST_NULL_PTR);
 793               	.LM119:
 794 02ba 83E0      		ldi r24,lo8(3)
 795 02bc 90E0      		ldi r25,hi8(3)
 796 02be 2FC0      		rjmp .L41
 797               	.L43:
 420:OSsrc/os_mbox.c ****     }
 421:OSsrc/os_mbox.c **** #endif
 422:OSsrc/os_mbox.c ****     if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                 
 799               	.LM120:
 800 02c0 8881      		ld r24,Y
 801 02c2 8130      		cpi r24,lo8(1)
 802 02c4 19F0      		breq .L44
 423:OSsrc/os_mbox.c ****         return (OS_ERR_EVENT_TYPE);
 804               	.LM121:
 805 02c6 81E0      		ldi r24,lo8(1)
 806 02c8 90E0      		ldi r25,hi8(1)
 807 02ca 29C0      		rjmp .L41
 808               	.L44:
 424:OSsrc/os_mbox.c ****     }
 425:OSsrc/os_mbox.c ****     OS_ENTER_CRITICAL();
 810               	.LM122:
 811               	/* #APP */
 812 02cc 0FB6      		in __tmp_reg__,__SREG__
 813 02ce F894      		cli
 814 02d0 0F92      		push __tmp_reg__
 426:OSsrc/os_mbox.c ****     if (pevent->OSEventGrp != 0x00) {                 /* See if any task pending on mailbox        
 816               	.LM123:
 817               	/* #NOAPP */
 818 02d2 8981      		ldd r24,Y+1
 819 02d4 8823      		tst r24
 820 02d6 A1F0      		breq .L45
 427:OSsrc/os_mbox.c ****         if ((opt & OS_POST_OPT_BROADCAST) != 0x00) {  /* Do we need to post msg to ALL waiting task
 822               	.LM124:
 823 02d8 40FF      		sbrs r20,0
 824 02da 09C0      		rjmp .L46
 825               	.L49:
 428:OSsrc/os_mbox.c ****             while (pevent->OSEventGrp != 0x00) {      /* Yes, Post to ALL tasks waiting on mailbox 
 429:OSsrc/os_mbox.c ****                 (void)OS_EventTaskRdy(pevent, msg, OS_STAT_MBOX);    
 827               	.LM125:
 828 02dc 42E0      		ldi r20,lo8(2)
 829 02de B801      		movw r22,r16
 830 02e0 CE01      		movw r24,r28
 831 02e2 0E94 0000 		call OS_EventTaskRdy
 832 02e6 8981      		ldd r24,Y+1
 833 02e8 8823      		tst r24
 834 02ea C1F7      		brne .L49
 835 02ec 04C0      		rjmp .L50
 836               	.L46:
 430:OSsrc/os_mbox.c ****             }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?