?? os_mbox.lst
字號:
442 OS_EXIT_CRITICAL();
\ ??OSMboxPendAbort_6:
\ 00000058 4046 MOV R0,R8
\ 0000005A ........ BL OS_CPU_SR_Restore
443 OS_Sched(); /* Find HPT ready to run */
\ 0000005E ........ BL OS_Sched
444 *perr = OS_ERR_PEND_ABORT;
\ 00000062 0E20 MOVS R0,#+14
\ 00000064 3070 STRB R0,[R6, #+0]
445 return (nbr_tasks);
\ 00000066 3800 MOVS R0,R7
\ 00000068 C0B2 UXTB R0,R0 ;; ZeroExt R0,R0,#+24,#+24
\ 0000006A 05E0 B.N ??OSMboxPendAbort_1
446 }
447 OS_EXIT_CRITICAL();
\ ??OSMboxPendAbort_2:
\ 0000006C 4046 MOV R0,R8
\ 0000006E ........ BL OS_CPU_SR_Restore
448 *perr = OS_ERR_NONE;
\ 00000072 0020 MOVS R0,#+0
\ 00000074 3070 STRB R0,[R6, #+0]
449 return (0u); /* No tasks waiting on mailbox */
\ 00000076 0020 MOVS R0,#+0
\ ??OSMboxPendAbort_1:
\ 00000078 BDE8F081 POP {R4-R8,PC} ;; return
450 }
451 #endif
452
453 /*$PAGE*/
454 /*
455 *********************************************************************************************************
456 * POST MESSAGE TO A MAILBOX
457 *
458 * Description: This function sends a message to a mailbox
459 *
460 * Arguments : pevent is a pointer to the event control block associated with the desired mailbox
461 *
462 * pmsg is a pointer to the message to send. You MUST NOT send a NULL pointer.
463 *
464 * Returns : OS_ERR_NONE The call was successful and the message was sent
465 * OS_ERR_MBOX_FULL If the mailbox already contains a message. You can can only send one
466 * message at a time and thus, the message MUST be consumed before you
467 * are allowed to send another one.
468 * OS_ERR_EVENT_TYPE If you are attempting to post to a non mailbox.
469 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
470 * OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
471 *
472 * Note(s) : 1) HPT means Highest Priority Task
473 *********************************************************************************************************
474 */
475
476 #if OS_MBOX_POST_EN > 0u
\ In section .text, align 2, keep-with-next
477 INT8U OSMboxPost (OS_EVENT *pevent,
478 void *pmsg)
479 {
\ OSMboxPost:
\ 00000000 F8B5 PUSH {R3-R7,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 0D00 MOVS R5,R1
480 #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */
481 OS_CPU_SR cpu_sr = 0u;
\ 00000006 0026 MOVS R6,#+0
482 #endif
483
484
485
486 #if OS_ARG_CHK_EN > 0u
487 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
488 return (OS_ERR_PEVENT_NULL);
489 }
490 if (pmsg == (void *)0) { /* Make sure we are not posting a NULL pointer */
491 return (OS_ERR_POST_NULL_PTR);
492 }
493 #endif
494 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ 00000008 2078 LDRB R0,[R4, #+0]
\ 0000000A 0128 CMP R0,#+1
\ 0000000C 01D0 BEQ.N ??OSMboxPost_0
495 return (OS_ERR_EVENT_TYPE);
\ 0000000E 0120 MOVS R0,#+1
\ 00000010 20E0 B.N ??OSMboxPost_1
496 }
497 OS_ENTER_CRITICAL();
\ ??OSMboxPost_0:
\ 00000012 ........ BL OS_CPU_SR_Save
\ 00000016 0600 MOVS R6,R0
498 if (pevent->OSEventGrp != 0u) { /* See if any task pending on mailbox */
\ 00000018 A07A LDRB R0,[R4, #+10]
\ 0000001A 0028 CMP R0,#+0
\ 0000001C 0DD0 BEQ.N ??OSMboxPost_2
499 /* Ready HPT waiting on event */
500 (void)OS_EventTaskRdy(pevent, pmsg, OS_STAT_MBOX, OS_STAT_PEND_OK);
\ 0000001E 0023 MOVS R3,#+0
\ 00000020 0222 MOVS R2,#+2
\ 00000022 2900 MOVS R1,R5
\ 00000024 2000 MOVS R0,R4
\ 00000026 ........ BL OS_EventTaskRdy
\ 0000002A 0700 MOVS R7,R0
501 OS_EXIT_CRITICAL();
\ 0000002C 3000 MOVS R0,R6
\ 0000002E ........ BL OS_CPU_SR_Restore
502 OS_Sched(); /* Find highest priority task ready to run */
\ 00000032 ........ BL OS_Sched
503 return (OS_ERR_NONE);
\ 00000036 0020 MOVS R0,#+0
\ 00000038 0CE0 B.N ??OSMboxPost_1
504 }
505 if (pevent->OSEventPtr != (void *)0) { /* Make sure mailbox doesn't already have a msg */
\ ??OSMboxPost_2:
\ 0000003A 6068 LDR R0,[R4, #+4]
\ 0000003C 0028 CMP R0,#+0
\ 0000003E 04D0 BEQ.N ??OSMboxPost_3
506 OS_EXIT_CRITICAL();
\ 00000040 3000 MOVS R0,R6
\ 00000042 ........ BL OS_CPU_SR_Restore
507 return (OS_ERR_MBOX_FULL);
\ 00000046 1420 MOVS R0,#+20
\ 00000048 04E0 B.N ??OSMboxPost_1
508 }
509 pevent->OSEventPtr = pmsg; /* Place message in mailbox */
\ ??OSMboxPost_3:
\ 0000004A 6560 STR R5,[R4, #+4]
510 OS_EXIT_CRITICAL();
\ 0000004C 3000 MOVS R0,R6
\ 0000004E ........ BL OS_CPU_SR_Restore
511 return (OS_ERR_NONE);
\ 00000052 0020 MOVS R0,#+0
\ ??OSMboxPost_1:
\ 00000054 F2BD POP {R1,R4-R7,PC} ;; return
512 }
513 #endif
514
515 /*$PAGE*/
516 /*
517 *********************************************************************************************************
518 * POST MESSAGE TO A MAILBOX
519 *
520 * Description: This function sends a message to a mailbox
521 *
522 * Arguments : pevent is a pointer to the event control block associated with the desired mailbox
523 *
524 * pmsg is a pointer to the message to send. You MUST NOT send a NULL pointer.
525 *
526 * opt determines the type of POST performed:
527 * OS_POST_OPT_NONE POST to a single waiting task
528 * (Identical to OSMboxPost())
529 * OS_POST_OPT_BROADCAST POST to ALL tasks that are waiting on the mailbox
530 *
531 * OS_POST_OPT_NO_SCHED Indicates that the scheduler will NOT be invoked
532 *
533 * Returns : OS_ERR_NONE The call was successful and the message was sent
534 * OS_ERR_MBOX_FULL If the mailbox already contains a message. You can can only send one
535 * message at a time and thus, the message MUST be consumed before you
536 * are allowed to send another one.
537 * OS_ERR_EVENT_TYPE If you are attempting to post to a non mailbox.
538 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
539 * OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
540 *
541 * Note(s) : 1) HPT means Highest Priority Task
542 *
543 * Warning : Interrupts can be disabled for a long time if you do a 'broadcast'. In fact, the
544 * interrupt disable time is proportional to the number of tasks waiting on the mailbox.
545 *********************************************************************************************************
546 */
547
548 #if OS_MBOX_POST_OPT_EN > 0u
\ In section .text, align 2, keep-with-next
549 INT8U OSMboxPostOpt (OS_EVENT *pevent,
550 void *pmsg,
551 INT8U opt)
552 {
\ OSMboxPostOpt:
\ 00000000 F8B5 PUSH {R3-R7,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 0D00 MOVS R5,R1
\ 00000006 1600 MOVS R6,R2
553 #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */
554 OS_CPU_SR cpu_sr = 0u;
\ 00000008 0027 MOVS R7,#+0
555 #endif
556
557
558
559 #if OS_ARG_CHK_EN > 0u
560 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
561 return (OS_ERR_PEVENT_NULL);
562 }
563 if (pmsg == (void *)0) { /* Make sure we are not posting a NULL pointer */
564 return (OS_ERR_POST_NULL_PTR);
565 }
566 #endif
567 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ 0000000A 2078 LDRB R0,[R4, #+0]
\ 0000000C 0128 CMP R0,#+1
\ 0000000E 01D0 BEQ.N ??OSMboxPostOpt_0
568 return (OS_ERR_EVENT_TYPE);
\ 00000010 0120 MOVS R0,#+1
\ 00000012 2DE0 B.N ??OSMboxPostOpt_1
569 }
570 OS_ENTER_CRITICAL();
\ ??OSMboxPostOpt_0:
\ 00000014 ........ BL OS_CPU_SR_Save
\ 00000018 0700 MOVS R7,R0
571 if (pevent->OSEventGrp != 0u) { /* See if any task pending on mailbox */
\ 0000001A A07A LDRB R0,[R4, #+10]
\ 0000001C 0028 CMP R0,#+0
\ 0000001E 1AD0 BEQ.N ??OSMboxPostOpt_2
572
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -