📄 os_mbox.lst
字号:
\ 00000094 0220A0E3 MOV R2,#+2
\ 00000098 0010A0E3 MOV R1,#+0
\ 0000009C 0400B0E1 MOVS R0,R4
\ 000000A0 ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rA
407 nbr_tasks++;
\ 000000A4 017097E2 ADDS R7,R7,#+1
\ 000000A8 F5FFFFEA B ??OSMboxPendAbort_6
408 }
409 break;
410
411 case OS_PEND_OPT_NONE: /* No, ready HPT waiting on mailbox */
412 default:
413 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX, OS_STAT_PEND_ABORT);
\ ??OSMboxPendAbort_5:
\ 000000AC 0230A0E3 MOV R3,#+2
\ 000000B0 0220A0E3 MOV R2,#+2
\ 000000B4 0010A0E3 MOV R1,#+0
\ 000000B8 0400B0E1 MOVS R0,R4
\ 000000BC ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rA
414 nbr_tasks++;
\ 000000C0 017097E2 ADDS R7,R7,#+1
415 break;
416 }
417 OS_EXIT_CRITICAL();
\ ??OSMboxPendAbort_7:
\ 000000C4 0800B0E1 MOVS R0,R8
\ 000000C8 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
418 OS_Sched(); /* Find HPT ready to run */
\ 000000CC ........ _BLF OS_Sched,??OS_Sched??rA
419 *err = OS_ERR_PEND_ABORT;
\ 000000D0 0E00A0E3 MOV R0,#+14
\ 000000D4 0000C6E5 STRB R0,[R6, #+0]
420 return (nbr_tasks);
\ 000000D8 0700B0E1 MOVS R0,R7
\ 000000DC FF0010E2 ANDS R0,R0,#0xFF ;; Zero extend
\ 000000E0 040000EA B ??OSMboxPendAbort_1
421 }
422 OS_EXIT_CRITICAL();
\ ??OSMboxPendAbort_4:
\ 000000E4 0800B0E1 MOVS R0,R8
\ 000000E8 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
423 *err = OS_ERR_NONE;
\ 000000EC 0000A0E3 MOV R0,#+0
\ 000000F0 0000C6E5 STRB R0,[R6, #+0]
424 return (0); /* No tasks waiting on mailbox */
\ 000000F4 0000A0E3 MOV R0,#+0
\ ??OSMboxPendAbort_1:
\ 000000F8 F081BDE8 POP {R4-R8,PC} ;; return
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 * msg 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 *msg)
453 {
\ OSMboxPost:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
454 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
455 OS_CPU_SR cpu_sr = 0;
\ 0000000C 0000A0E3 MOV R0,#+0
\ 00000010 0060B0E1 MOVS R6,R0
456 #endif
457
458
459
460 #if OS_ARG_CHK_EN > 0
461 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ 00000014 000054E3 CMP R4,#+0
\ 00000018 0100001A BNE ??OSMboxPost_0
462 return (OS_ERR_PEVENT_NULL);
\ 0000001C 0400A0E3 MOV R0,#+4
\ 00000020 220000EA B ??OSMboxPost_1
463 }
464 if (msg == (void *)0) { /* Make sure we are not posting a NULL pointer */
\ ??OSMboxPost_0:
\ 00000024 000055E3 CMP R5,#+0
\ 00000028 0100001A BNE ??OSMboxPost_2
465 return (OS_ERR_POST_NULL_PTR);
\ 0000002C 0300A0E3 MOV R0,#+3
\ 00000030 1E0000EA B ??OSMboxPost_1
466 }
467 #endif
468 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ ??OSMboxPost_2:
\ 00000034 0000D4E5 LDRB R0,[R4, #+0]
\ 00000038 010050E3 CMP R0,#+1
\ 0000003C 0100000A BEQ ??OSMboxPost_3
469 return (OS_ERR_EVENT_TYPE);
\ 00000040 0100A0E3 MOV R0,#+1
\ 00000044 190000EA B ??OSMboxPost_1
470 }
471 OS_ENTER_CRITICAL();
\ ??OSMboxPost_3:
\ 00000048 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 0000004C 0060B0E1 MOVS R6,R0
472 if (pevent->OSEventGrp != 0) { /* See if any task pending on mailbox */
\ 00000050 0A00D4E5 LDRB R0,[R4, #+10]
\ 00000054 000050E3 CMP R0,#+0
\ 00000058 0900000A BEQ ??OSMboxPost_4
473 /* Ready HPT waiting on event */
474 (void)OS_EventTaskRdy(pevent, msg, OS_STAT_MBOX, OS_STAT_PEND_OK);
\ 0000005C 0030A0E3 MOV R3,#+0
\ 00000060 0220A0E3 MOV R2,#+2
\ 00000064 0510B0E1 MOVS R1,R5
\ 00000068 0400B0E1 MOVS R0,R4
\ 0000006C ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rA
475 OS_EXIT_CRITICAL();
\ 00000070 0600B0E1 MOVS R0,R6
\ 00000074 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
476 OS_Sched(); /* Find highest priority task ready to run */
\ 00000078 ........ _BLF OS_Sched,??OS_Sched??rA
477 return (OS_ERR_NONE);
\ 0000007C 0000A0E3 MOV R0,#+0
\ 00000080 0A0000EA B ??OSMboxPost_1
478 }
479 if (pevent->OSEventPtr != (void *)0) { /* Make sure mailbox doesn't already have a msg */
\ ??OSMboxPost_4:
\ 00000084 040094E5 LDR R0,[R4, #+4]
\ 00000088 000050E3 CMP R0,#+0
\ 0000008C 0300000A BEQ ??OSMboxPost_5
480 OS_EXIT_CRITICAL();
\ 00000090 0600B0E1 MOVS R0,R6
\ 00000094 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
481 return (OS_ERR_MBOX_FULL);
\ 00000098 1400A0E3 MOV R0,#+20
\ 0000009C 030000EA B ??OSMboxPost_1
482 }
483 pevent->OSEventPtr = msg; /* Place message in mailbox */
\ ??OSMboxPost_5:
\ 000000A0 045084E5 STR R5,[R4, #+4]
484 OS_EXIT_CRITICAL();
\ 000000A4 0600B0E1 MOVS R0,R6
\ 000000A8 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
485 return (OS_ERR_NONE);
\ 000000AC 0000A0E3 MOV R0,#+0
\ ??OSMboxPost_1:
\ 000000B0 7080BDE8 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 * msg 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 *msg, INT8U opt)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -