📄 os_mbox.lst
字号:
\ ??OSMboxPendAbort_5:
\ 00000078 3000 MOVS R0,R6
\ 0000007A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
423 *perr = OS_ERR_NONE;
\ 0000007E 2F70 STRB R7,[R5, #+0]
\ 00000080 C4E7 B.N ??OSMboxPendAbort_1
424 return (0); /* No tasks waiting on mailbox */
425 }
426 #endif
427
428 /*$PAGE*/
429 /*
430 *********************************************************************************************************
431 * POST MESSAGE TO A MAILBOX
432 *
433 * Description: This function sends a message to a mailbox
434 *
435 * Arguments : pevent is a pointer to the event control block associated with the desired mailbox
436 *
437 * pmsg is a pointer to the message to send. You MUST NOT send a NULL pointer.
438 *
439 * Returns : OS_ERR_NONE The call was successful and the message was sent
440 * OS_ERR_MBOX_FULL If the mailbox already contains a message. You can can only send one
441 * message at a time and thus, the message MUST be consumed before you
442 * are allowed to send another one.
443 * OS_ERR_EVENT_TYPE If you are attempting to post to a non mailbox.
444 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
445 * OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
446 *
447 * Note(s) : 1) HPT means Highest Priority Task
448 *********************************************************************************************************
449 */
450
451 #if OS_MBOX_POST_EN > 0
\ In segment CODE, align 4, keep-with-next
452 INT8U OSMboxPost (OS_EVENT *pevent, void *pmsg)
453 {
\ OSMboxPost:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 0D00 MOVS R5,R1
454 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
455 OS_CPU_SR cpu_sr = 0;
456 #endif
457
458
459
460 #if OS_ARG_CHK_EN > 0
461 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ 00000006 002C CMP R4,#+0
\ 00000008 01D1 BNE.N ??OSMboxPost_0
462 return (OS_ERR_PEVENT_NULL);
\ 0000000A 0420 MOVS R0,#+4
\ 0000000C 70BD POP {R4-R6,PC}
463 }
464 if (pmsg == (void *)0) { /* Make sure we are not posting a NULL pointer */
\ ??OSMboxPost_0:
\ 0000000E 002D CMP R5,#+0
\ 00000010 01D1 BNE.N ??OSMboxPost_1
465 return (OS_ERR_POST_NULL_PTR);
\ 00000012 0320 MOVS R0,#+3
\ 00000014 70BD POP {R4-R6,PC}
466 }
467 #endif
468 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ ??OSMboxPost_1:
\ 00000016 2078 LDRB R0,[R4, #+0]
\ 00000018 0128 CMP R0,#+1
\ 0000001A 01D0 BEQ.N ??OSMboxPost_2
469 return (OS_ERR_EVENT_TYPE);
\ 0000001C 0120 MOVS R0,#+1
\ 0000001E 70BD POP {R4-R6,PC}
470 }
471 OS_ENTER_CRITICAL();
\ ??OSMboxPost_2:
\ 00000020 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000024 0600 MOVS R6,R0
472 if (pevent->OSEventGrp != 0) { /* See if any task pending on mailbox */
\ 00000026 A07A LDRB R0,[R4, #+10]
\ 00000028 0028 CMP R0,#+0
\ 0000002A 0CD0 BEQ.N ??OSMboxPost_3
473 /* Ready HPT waiting on event */
474 (void)OS_EventTaskRdy(pevent, pmsg, OS_STAT_MBOX, OS_STAT_PEND_OK);
\ 0000002C 0023 MOVS R3,#+0
\ 0000002E 0222 MOVS R2,#+2
\ 00000030 2900 MOVS R1,R5
\ 00000032 2000 MOVS R0,R4
\ 00000034 ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
475 OS_EXIT_CRITICAL();
\ 00000038 3000 MOVS R0,R6
\ 0000003A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
476 OS_Sched(); /* Find highest priority task ready to run */
\ 0000003E ........ _BLF OS_Sched,??OS_Sched??rT
477 return (OS_ERR_NONE);
\ 00000042 0020 MOVS R0,#+0
\ 00000044 70BD POP {R4-R6,PC}
478 }
479 if (pevent->OSEventPtr != (void *)0) { /* Make sure mailbox doesn't already have a msg */
\ ??OSMboxPost_3:
\ 00000046 6068 LDR R0,[R4, #+4]
\ 00000048 0028 CMP R0,#+0
\ 0000004A 04D0 BEQ.N ??OSMboxPost_4
480 OS_EXIT_CRITICAL();
\ 0000004C 3000 MOVS R0,R6
\ 0000004E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
481 return (OS_ERR_MBOX_FULL);
\ 00000052 1420 MOVS R0,#+20
\ 00000054 70BD POP {R4-R6,PC}
482 }
483 pevent->OSEventPtr = pmsg; /* Place message in mailbox */
\ ??OSMboxPost_4:
\ 00000056 6560 STR R5,[R4, #+4]
484 OS_EXIT_CRITICAL();
\ 00000058 3000 MOVS R0,R6
\ 0000005A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
485 return (OS_ERR_NONE);
\ 0000005E 0020 MOVS R0,#+0
\ 00000060 70BD POP {R4-R6,PC} ;; return
486 }
487 #endif
488
489 /*$PAGE*/
490 /*
491 *********************************************************************************************************
492 * POST MESSAGE TO A MAILBOX
493 *
494 * Description: This function sends a message to a mailbox
495 *
496 * Arguments : pevent is a pointer to the event control block associated with the desired mailbox
497 *
498 * pmsg is a pointer to the message to send. You MUST NOT send a NULL pointer.
499 *
500 * opt determines the type of POST performed:
501 * OS_POST_OPT_NONE POST to a single waiting task
502 * (Identical to OSMboxPost())
503 * OS_POST_OPT_BROADCAST POST to ALL tasks that are waiting on the mailbox
504 *
505 * OS_POST_OPT_NO_SCHED Indicates that the scheduler will NOT be invoked
506 *
507 * Returns : OS_ERR_NONE The call was successful and the message was sent
508 * OS_ERR_MBOX_FULL If the mailbox already contains a message. You can can only send one
509 * message at a time and thus, the message MUST be consumed before you
510 * are allowed to send another one.
511 * OS_ERR_EVENT_TYPE If you are attempting to post to a non mailbox.
512 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
513 * OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
514 *
515 * Note(s) : 1) HPT means Highest Priority Task
516 *
517 * Warning : Interrupts can be disabled for a long time if you do a 'broadcast'. In fact, the
518 * interrupt disable time is proportional to the number of tasks waiting on the mailbox.
519 *********************************************************************************************************
520 */
521
522 #if OS_MBOX_POST_OPT_EN > 0
\ In segment CODE, align 4, keep-with-next
523 INT8U OSMboxPostOpt (OS_EVENT *pevent, void *pmsg, INT8U opt)
524 {
\ OSMboxPostOpt:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 0D00 MOVS R5,R1
\ 00000006 1600 MOVS R6,R2
525 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
526 OS_CPU_SR cpu_sr = 0;
527 #endif
528
529
530
531 #if OS_ARG_CHK_EN > 0
532 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ 00000008 002C CMP R4,#+0
\ 0000000A 01D1 BNE.N ??OSMboxPostOpt_0
533 return (OS_ERR_PEVENT_NULL);
\ 0000000C 0420 MOVS R0,#+4
\ 0000000E F0BD POP {R4-R7,PC}
534 }
535 if (pmsg == (void *)0) { /* Make sure we are not posting a NULL pointer */
\ ??OSMboxPostOpt_0:
\ 00000010 002D CMP R5,#+0
\ 00000012 01D1 BNE.N ??OSMboxPostOpt_1
536 return (OS_ERR_POST_NULL_PTR);
\ 00000014 0320 MOVS R0,#+3
\ 00000016 F0BD POP {R4-R7,PC}
537 }
538 #endif
539 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ ??OSMboxPostOpt_1:
\ 00000018 2078 LDRB R0,[R4, #+0]
\ 0000001A 0128 CMP R0,#+1
\ 0000001C 01D0 BEQ.N ??OSMboxPostOpt_2
540 return (OS_ERR_EVENT_TYPE);
\ 0000001E 0120 MOVS R0,#+1
\ 00000020 F0BD POP {R4-R7,PC}
541 }
542 OS_ENTER_CRITICAL();
\ ??OSMboxPostOpt_2:
\ 00000022 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000026 0700 MOVS R7,R0
543 if (pevent->OSEventGrp != 0) { /* See if any task pending on mailbox */
\ 00000028 A07A LDRB R0,[R4, #+10]
\ 0000002A 0028
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -