os_mbox.lst

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

LST
1,285
字号
 446 0162 1F91      		pop r17
 447 0164 0F91      		pop r16
 448 0166 FF90      		pop r15
 449 0168 0895      		ret
 450               	/* epilogue end (size=6) */
 451               	/* function OSMboxDel size 126 (115) */
 456               	.Lscope2:
 461               	.global	OSMboxPend
 463               	OSMboxPend:
 223:OSsrc/os_mbox.c ****     }
 224:OSsrc/os_mbox.c **** }
 225:OSsrc/os_mbox.c **** #endif
 226:OSsrc/os_mbox.c **** 
 227:OSsrc/os_mbox.c **** /*$PAGE*/
 228:OSsrc/os_mbox.c **** /*
 229:OSsrc/os_mbox.c **** ***************************************************************************************************
 230:OSsrc/os_mbox.c **** *                                      PEND ON MAILBOX FOR A MESSAGE
 231:OSsrc/os_mbox.c **** *
 232:OSsrc/os_mbox.c **** * Description: This function waits for a message to be sent to a mailbox
 233:OSsrc/os_mbox.c **** *
 234:OSsrc/os_mbox.c **** * Arguments  : pevent        is a pointer to the event control block associated with the desired ma
 235:OSsrc/os_mbox.c **** *
 236:OSsrc/os_mbox.c **** *              timeout       is an optional timeout period (in clock ticks).  If non-zero, your tas
 237:OSsrc/os_mbox.c **** *                            wait for a message to arrive at the mailbox up to the amount of time
 238:OSsrc/os_mbox.c **** *                            specified by this argument.  If you specify 0, however, your task will
 239:OSsrc/os_mbox.c **** *                            forever at the specified mailbox or, until a message arrives.
 240:OSsrc/os_mbox.c **** *
 241:OSsrc/os_mbox.c **** *              err           is a pointer to where an error message will be deposited.  Possible er
 242:OSsrc/os_mbox.c **** *                            messages are:
 243:OSsrc/os_mbox.c **** *
 244:OSsrc/os_mbox.c **** *                            OS_NO_ERR           The call was successful and your task received a
 245:OSsrc/os_mbox.c **** *                                                message.
 246:OSsrc/os_mbox.c **** *                            OS_TIMEOUT          A message was not received within the specified ti
 247:OSsrc/os_mbox.c **** *                            OS_ERR_EVENT_TYPE   Invalid event type
 248:OSsrc/os_mbox.c **** *                            OS_ERR_PEND_ISR     If you called this function from an ISR and the re
 249:OSsrc/os_mbox.c **** *                                                would lead to a suspension.
 250:OSsrc/os_mbox.c **** *                            OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer
 251:OSsrc/os_mbox.c **** *
 252:OSsrc/os_mbox.c **** * Returns    : != (void *)0  is a pointer to the message received
 253:OSsrc/os_mbox.c **** *              == (void *)0  if no message was received or,
 254:OSsrc/os_mbox.c **** *                            if 'pevent' is a NULL pointer or,
 255:OSsrc/os_mbox.c **** *                            if you didn't pass the proper pointer to the event control block.
 256:OSsrc/os_mbox.c **** ***************************************************************************************************
 257:OSsrc/os_mbox.c **** */
 258:OSsrc/os_mbox.c **** 
 259:OSsrc/os_mbox.c **** void  *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)
 260:OSsrc/os_mbox.c **** {
 465               	.LM64:
 466               	/* prologue: frame size=0 */
 467 016a 0F93      		push r16
 468 016c 1F93      		push r17
 469 016e CF93      		push r28
 470 0170 DF93      		push r29
 471               	/* prologue end (size=4) */
 472 0172 EC01      		movw r28,r24
 473 0174 8A01      		movw r16,r20
 261:OSsrc/os_mbox.c ****     void      *msg;
 262:OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register  
 263:OSsrc/os_mbox.c ****     OS_CPU_SR  cpu_sr;
 264:OSsrc/os_mbox.c **** 
 265:OSsrc/os_mbox.c **** 
 266:OSsrc/os_mbox.c **** 
 267:OSsrc/os_mbox.c ****     cpu_sr = 0;                                       /* Prevent compiler warning                  
 268:OSsrc/os_mbox.c **** #endif    
 269:OSsrc/os_mbox.c ****     if (OSIntNesting > 0) {                           /* See if called from ISR ...                
 475               	.LM65:
 476 0176 8091 0000 		lds r24,OSIntNesting
 477 017a 8823      		tst r24
 478 017c 11F0      		breq .L28
 270:OSsrc/os_mbox.c ****         *err = OS_ERR_PEND_ISR;                       /* ... can't PEND from an ISR                
 480               	.LM66:
 481 017e 82E0      		ldi r24,lo8(2)
 482 0180 41C0      		rjmp .L34
 483               	.L28:
 271:OSsrc/os_mbox.c ****         return ((void *)0);
 272:OSsrc/os_mbox.c ****     }
 273:OSsrc/os_mbox.c **** #if OS_ARG_CHK_EN > 0
 274:OSsrc/os_mbox.c ****     if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                         
 485               	.LM67:
 486 0182 2097      		sbiw r28,0
 487 0184 29F4      		brne .L29
 275:OSsrc/os_mbox.c ****         *err = OS_ERR_PEVENT_NULL;
 489               	.LM68:
 490 0186 84E0      		ldi r24,lo8(4)
 491 0188 FA01      		movw r30,r20
 492 018a 8083      		st Z,r24
 276:OSsrc/os_mbox.c ****         return ((void *)0);
 494               	.LM69:
 495 018c CE01      		movw r24,r28
 496 018e 4EC0      		rjmp .L27
 497               	.L29:
 277:OSsrc/os_mbox.c ****     }
 278:OSsrc/os_mbox.c **** #endif
 279:OSsrc/os_mbox.c ****     if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                 
 499               	.LM70:
 500 0190 8881      		ld r24,Y
 501 0192 8130      		cpi r24,lo8(1)
 502 0194 11F0      		breq .L30
 280:OSsrc/os_mbox.c ****         *err = OS_ERR_EVENT_TYPE;
 504               	.LM71:
 505 0196 81E0      		ldi r24,lo8(1)
 506 0198 35C0      		rjmp .L34
 507               	.L30:
 281:OSsrc/os_mbox.c ****         return ((void *)0);
 282:OSsrc/os_mbox.c ****     }
 283:OSsrc/os_mbox.c ****     OS_ENTER_CRITICAL();
 509               	.LM72:
 510               	/* #APP */
 511 019a 0FB6      		in __tmp_reg__,__SREG__
 512 019c F894      		cli
 513 019e 0F92      		push __tmp_reg__
 284:OSsrc/os_mbox.c ****     msg = pevent->OSEventPtr;
 515               	.LM73:
 516               	/* #NOAPP */
 517 01a0 8C81      		ldd r24,Y+4
 518 01a2 9D81      		ldd r25,Y+5
 285:OSsrc/os_mbox.c ****     if (msg != (void *)0) {                           /* See if there is already a message         
 520               	.LM74:
 521 01a4 0097      		sbiw r24,0
 522 01a6 29F0      		breq .L31
 286:OSsrc/os_mbox.c ****         pevent->OSEventPtr = (void *)0;               /* Clear the mailbox                         
 524               	.LM75:
 525 01a8 1C82      		std Y+4,__zero_reg__
 526 01aa 1D82      		std Y+5,__zero_reg__
 287:OSsrc/os_mbox.c ****         OS_EXIT_CRITICAL();
 528               	.LM76:
 529               	/* #APP */
 530 01ac 0F90      		pop __tmp_reg__
 531 01ae 0FBE      		out __SREG__,__tmp_reg__
 532               	/* #NOAPP */
 533 01b0 3BC0      		rjmp .L33
 534               	.L31:
 288:OSsrc/os_mbox.c ****         *err = OS_NO_ERR;
 289:OSsrc/os_mbox.c ****         return (msg);                                 /* Return the message received (or NULL)     
 290:OSsrc/os_mbox.c ****     }
 291:OSsrc/os_mbox.c ****     OSTCBCur->OSTCBStat  |= OS_STAT_MBOX;             /* Message not available, task will pend     
 536               	.LM77:
 537 01b2 E091 0000 		lds r30,OSTCBCur
 538 01b6 F091 0000 		lds r31,(OSTCBCur)+1
 539 01ba 8485      		ldd r24,Z+12
 540 01bc 8260      		ori r24,lo8(2)
 541 01be 8487      		std Z+12,r24
 292:OSsrc/os_mbox.c ****     OSTCBCur->OSTCBPendTO = FALSE;
 543               	.LM78:
 544 01c0 E091 0000 		lds r30,OSTCBCur
 545 01c4 F091 0000 		lds r31,(OSTCBCur)+1
 546 01c8 1586      		std Z+13,__zero_reg__
 293:OSsrc/os_mbox.c ****     OSTCBCur->OSTCBDly    = timeout;                  /* Load timeout in TCB                       
 548               	.LM79:
 549 01ca E091 0000 		lds r30,OSTCBCur
 550 01ce F091 0000 		lds r31,(OSTCBCur)+1
 551 01d2 6287      		std Z+10,r22
 552 01d4 7387      		std Z+11,r23
 294:OSsrc/os_mbox.c ****     OS_EventTaskWait(pevent);                         /* Suspend task until event or timeout occurs
 554               	.LM80:
 555 01d6 CE01      		movw r24,r28
 556 01d8 0E94 0000 		call OS_EventTaskWait
 295:OSsrc/os_mbox.c ****     OS_EXIT_CRITICAL();
 558               	.LM81:
 559               	/* #APP */
 560 01dc 0F90      		pop __tmp_reg__
 561 01de 0FBE      		out __SREG__,__tmp_reg__
 296:OSsrc/os_mbox.c ****     OS_Sched();                                       /* Find next highest priority task ready to r
 563               	.LM82:
 564               	/* #NOAPP */
 565 01e0 0E94 0000 		call OS_Sched
 297:OSsrc/os_mbox.c ****     OS_ENTER_CRITICAL();
 567               	.LM83:
 568               	/* #APP */
 569 01e4 0FB6      		in __tmp_reg__,__SREG__
 570 01e6 F894      		cli
 571 01e8 0F92      		push __tmp_reg__
 298:OSsrc/os_mbox.c ****     if (OSTCBCur->OSTCBPendTO == TRUE) {              /* See if we were given the message          
 573               	.LM84:
 574               	/* #NOAPP */
 575 01ea E091 0000 		lds r30,OSTCBCur
 576 01ee F091 0000 		lds r31,(OSTCBCur)+1
 577 01f2 8585      		ldd r24,Z+13
 578 01f4 8130      		cpi r24,lo8(1)
 579 01f6 59F4      		brne .L32
 299:OSsrc/os_mbox.c ****         OS_EventTO(pevent);                           /* Timed out, Make task ready                
 581               	.LM85:
 582 01f8 CE01      		movw r24,r28
 583 01fa 0E94 0000 		call OS_EventTO
 300:OSsrc/os_mbox.c ****         OS_EXIT_CRITICAL();
 585               	.LM86:
 586               	/* #APP */
 587 01fe 0F90      		pop __tmp_reg__
 588 0200 0FBE      		out __SREG__,__tmp_reg__
 301:OSsrc/os_mbox.c ****         *err = OS_TIMEOUT;                            /* Indicate that a timeout occured           
 590               	.LM87:
 591               	/* #NOAPP */
 592 0202 8AE0      		ldi r24,lo8(10)
 593               	.L34:
 594 0204 F801      		movw r30,r16
 595 0206 8083      		st Z,r24
 302:OSsrc/os_mbox.c ****         return ((void *)0);                           /* Return a NULL message                     
 597               	.LM88:
 598 0208 80E0      		ldi r24,lo8(0)
 599 020a 90E0      		ldi r25,hi8(0)
 600 020c 0FC0      		rjmp .L27
 601               	.L32:
 303:OSsrc/os_mbox.c ****     }
 304:OSsrc/os_mbox.c ****     msg                     = OSTCBCur->OSTCBMsg;
 603               	.LM89:
 604 020e 8085      		ldd r24,Z+8
 605 0210 9185      		ldd r25,Z+9
 305:OSsrc/os_mbox.c ****     OSTCBCur->OSTCBMsg      = (void *)0;              /* Yes, clear message received               
 607               	.LM90:
 608 0212 1086      		std Z+8,__zero_reg__
 609 0214 1186      		std Z+9,__zero_reg__
 306:OSsrc/os_mbox.c ****     OSTCBCur->OSTCBStat     = OS_STAT_RDY;
 611               	.LM91:
 612 0216 1486      		std Z+12,__zero_reg__
 307:OSsrc/os_mbox.c ****     OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;          /* No longer waiting for event               
 614               	.LM92:
 615 0218 E091 0000 		lds r30,OSTCBCur
 616 021c F091 0000 		lds r31,(OSTCBCur)+1
 617 0220 1682      		std Z+6,__zero_reg__
 618 0222 1782      		std Z+7,__zero_reg__
 308:OSsrc/os_mbox.c ****     OS_EXIT_CRITICAL();
 620               	.LM93:
 621               	/* #APP */
 622 0224 0F90      		pop __tmp_reg__
 623 0226 0FBE      		out __SREG__,__tmp_reg__
 624               	/* #NOAPP */
 625               	.L33:
 309:OSsrc/os_mbox.c ****     *err                    = OS_NO_ERR;
 627               	.LM94:
 628 0228 F801      		movw r30,r16
 629 022a 1082      		st Z,__zero_reg__
 630               	.L27:
 631               	/* epilogue: frame size=0 */
 632 022c DF91      		pop r29
 633 022e CF91      		pop r28
 634 0230 1F91      		pop r17
 635 0232 0F91      		pop r16
 636 0234 0895      		ret
 637               	/* epilogue end (size=5) */
 638               	/* function OSMboxPend size 116 (107) */
 643               	.Lscope3:
 647               	.global	OSMboxPost
 649               	OSMboxPost:
 310:OSsrc/os_mbox.c ****     return (msg);                                     /* Return the message received               
 311:OSsrc/os_mbox.c **** }
 312:OSsrc/os_mbox.c **** /*$PAGE*/
 313:OSsrc/os_mbox.c **** /*
 314:OSsrc/os_mbox.c **** ***************************************************************************************************
 315:OSsrc/os_mbox.c **** *                                       POST MESSAGE TO A MAILBOX
 316:OSsrc/os_mbox.c **** *
 317:OSsrc/os_mbox.c **** * Description: This function sends a message to a mailbox
 318:OSsrc/os_mbox.c **** *
 319:OSsrc/os_mbox.c **** * Arguments  : pevent        is a pointer to the event control block associated with the desired ma
 320:OSsrc/os_mbox.c **** *
 321:OSsrc/os_mbox.c **** *              msg           is a pointer to the message to send.  You MUST NOT send a NULL pointer
 322:OSsrc/os_mbox.c **** *
 323:OSsrc/os_mbox.c **** * Returns    : OS_NO_ERR            The call was successful and the message was sent

⌨️ 快捷键说明

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