📄 os_flag.lst
字号:
\ 00000048 08E0 B.N ??OSFlagNameSet_1
452 return;
453 }
454 (void)OS_StrCopy(pgrp->OSFlagName, pname); /* Yes, copy name from OS_FLAG_GRP */
\ ??OSFlagNameSet_4:
\ 0000004A 3100 MOVS R1,R6
\ 0000004C 0A35 ADDS R5,R5,#+10
\ 0000004E 2800 MOVS R0,R5
\ 00000050 ........ _BLF OS_StrCopy,??OS_StrCopy??rT
455 OS_EXIT_CRITICAL();
\ 00000054 3800 MOVS R0,R7
\ 00000056 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
456 *err = OS_NO_ERR;
\ 0000005A 0020 MOVS R0,#+0
\ ??OSFlagNameSet_1:
\ 0000005C 2070 STRB R0,[R4, #+0]
457 return;
\ 0000005E F0BC POP {R4-R7}
\ 00000060 01BC POP {R0}
\ 00000062 0047 BX R0 ;; return
458 }
459 #endif
460
461 /*$PAGE*/
462 /*
463 *********************************************************************************************************
464 * WAIT ON AN EVENT FLAG GROUP
465 *
466 * Description: This function is called to wait for a combination of bits to be set in an event flag
467 * group. Your application can wait for ANY bit to be set or ALL bits to be set.
468 *
469 * Arguments : pgrp is a pointer to the desired event flag group.
470 *
471 * flags Is a bit pattern indicating which bit(s) (i.e. flags) you wish to wait for.
472 * The bits you want are specified by setting the corresponding bits in
473 * 'flags'. e.g. if your application wants to wait for bits 0 and 1 then
474 * 'flags' would contain 0x03.
475 *
476 * wait_type specifies whether you want ALL bits to be set or ANY of the bits to be set.
477 * You can specify the following argument:
478 *
479 * OS_FLAG_WAIT_CLR_ALL You will wait for ALL bits in 'mask' to be clear (0)
480 * OS_FLAG_WAIT_SET_ALL You will wait for ALL bits in 'mask' to be set (1)
481 * OS_FLAG_WAIT_CLR_ANY You will wait for ANY bit in 'mask' to be clear (0)
482 * OS_FLAG_WAIT_SET_ANY You will wait for ANY bit in 'mask' to be set (1)
483 *
484 * NOTE: Add OS_FLAG_CONSUME if you want the event flag to be 'consumed' by
485 * the call. Example, to wait for any flag in a group AND then clear
486 * the flags that are present, set 'wait_type' to:
487 *
488 * OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME
489 *
490 * timeout is an optional timeout (in clock ticks) that your task will wait for the
491 * desired bit combination. If you specify 0, however, your task will wait
492 * forever at the specified event flag group or, until a message arrives.
493 *
494 * err is a pointer to an error code and can be:
495 * OS_NO_ERR The desired bits have been set within the specified
496 * 'timeout'.
497 * OS_ERR_PEND_ISR If you tried to PEND from an ISR
498 * OS_FLAG_INVALID_PGRP If 'pgrp' is a NULL pointer.
499 * OS_ERR_EVENT_TYPE You are not pointing to an event flag group
500 * OS_TIMEOUT The bit(s) have not been set in the specified
501 * 'timeout'.
502 * OS_FLAG_ERR_WAIT_TYPE You didn't specify a proper 'wait_type' argument.
503 *
504 * Returns : The flags in the event flag group that made the task ready or, 0 if a timeout or an error
505 * occurred.
506 *
507 * Called from: Task ONLY
508 *
509 * Note(s) : 1) IMPORTANT, the behavior of this function has changed from PREVIOUS versions. The
510 * function NOW returns the flags that were ready INSTEAD of the current state of the
511 * event flags.
512 *********************************************************************************************************
513 */
514
\ In segment CODE, align 4, keep-with-next
515 OS_FLAGS OSFlagPend (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT16U timeout, INT8U *err)
516 {
\ OSFlagPend:
\ 00000000 FEB5 PUSH {R1-R7,LR}
\ 00000002 86B0 SUB SP,SP,#+24
\ 00000004 0400 MOVS R4,R0
\ 00000006 0E9D LDR R5,[SP, #+56]
517 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
518 OS_CPU_SR cpu_sr;
519 #endif
520 OS_FLAG_NODE node;
521 OS_FLAGS flags_rdy;
522 BOOLEAN consume;
523
524
525 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ 00000008 .... LDR R0,??DataTable7 ;; OSIntNesting
\ 0000000A 0078 LDRB R0,[R0, #+0]
\ 0000000C 0028 CMP R0,#+0
\ 0000000E 03D0 BEQ ??OSFlagPend_0
526 *err = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR */
\ 00000010 0220 MOVS R0,#+2
\ ??OSFlagPend_1:
\ 00000012 2870 STRB R0,[R5, #+0]
527 return ((OS_FLAGS)0);
\ 00000014 0020 MOVS R0,#+0
\ 00000016 98E0 B ??OSFlagPend_2
528 }
529 #if OS_ARG_CHK_EN > 0
530 if (pgrp == (OS_FLAG_GRP *)0) { /* Validate 'pgrp' */
\ ??OSFlagPend_0:
\ 00000018 002C CMP R4,#+0
\ 0000001A 01D1 BNE ??OSFlagPend_3
531 *err = OS_FLAG_INVALID_PGRP;
\ 0000001C 9620 MOVS R0,#+150
\ 0000001E F8E7 B.N ??OSFlagPend_1
532 return ((OS_FLAGS)0);
533 }
534 #endif
535 if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) { /* Validate event block type */
\ ??OSFlagPend_3:
\ 00000020 2078 LDRB R0,[R4, #+0]
\ 00000022 0528 CMP R0,#+5
\ 00000024 03D0 BEQ ??OSFlagPend_4
536 *err = OS_ERR_EVENT_TYPE;
\ 00000026 0120 MOVS R0,#+1
\ 00000028 2870 STRB R0,[R5, #+0]
537 return ((OS_FLAGS)0);
\ 0000002A 0020 MOVS R0,#+0
\ 0000002C 8DE0 B ??OSFlagPend_2
538 }
539 if (wait_type & OS_FLAG_CONSUME) { /* See if we need to consume the flags */
\ ??OSFlagPend_4:
\ 0000002E 1006 LSLS R0,R2,#+24
\ 00000030 05D5 BPL ??OSFlagPend_5
540 wait_type &= ~OS_FLAG_CONSUME;
\ 00000032 6846 MOV R0,SP
\ 00000034 5106 LSLS R1,R2,#+25
\ 00000036 490E LSRS R1,R1,#+25
\ 00000038 0177 STRB R1,[R0, #+28]
541 consume = TRUE;
\ 0000003A 0126 MOVS R6,#+1
\ 0000003C 00E0 B ??OSFlagPend_6
542 } else {
543 consume = FALSE;
\ ??OSFlagPend_5:
\ 0000003E 0026 MOVS R6,#+0
544 }
545 /*$PAGE*/
546 OS_ENTER_CRITICAL();
\ ??OSFlagPend_6:
\ 00000040 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000044 0090 STR R0,[SP, #+0]
547 switch (wait_type) {
\ 00000046 6846 MOV R0,SP
\ 00000048 007F LDRB R0,[R0, #+28]
\ 0000004A 0028 CMP R0,#+0
\ 0000004C 48D0 BEQ ??OSFlagPend_7
\ 0000004E 0128 CMP R0,#+1
\ 00000050 53D0 BEQ ??OSFlagPend_8
\ 00000052 0228 CMP R0,#+2
\ 00000054 02D0 BEQ ??OSFlagPend_9
\ 00000056 0328 CMP R0,#+3
\ 00000058 3CD0 BEQ ??OSFlagPend_10
\ 0000005A 54E0 B ??OSFlagPend_11
548 case OS_FLAG_WAIT_SET_ALL: /* See if all required flags are set */
549 flags_rdy = pgrp->OSFlagFlags & flags; /* Extract only the bits we want */
\ ??OSFlagPend_9:
\ 0000005C 2089 LDRH R0,[R4, #+8]
\ 0000005E 6946 MOV R1,SP
\ 00000060 0F8B LDRH R7,[R1, #+24]
\ 00000062 0740 ANDS R7,R7,R0
550 if (flags_rdy == flags) { /* Must match ALL the bits that we want */
\ 00000064 098B LDRH R1,[R1, #+24]
\ 00000066 8F42 CMP R7,R1
\ 00000068 0BD1 BNE ??OSFlagPend_12
551 if (consume == TRUE) { /* See if we need to consume the flags */
\ ??OSFlagPend_13:
\ 0000006A 012E CMP R6,#+1
\ 0000006C 01D1 BNE ??OSFlagPend_14
552 pgrp->OSFlagFlags &= ~flags_rdy; /* Clear ONLY the flags that we wanted */
\ 0000006E B843 BICS R0,R0,R7
\ 00000070 2081 STRH R0,[R4, #+8]
553 }
554 OSTCBCur->OSTCBFlagsRdy = flags_rdy; /* Save flags that were ready */
\ ??OSFlagPend_14:
\ 00000072 .... LDR R0,??DataTable27 ;; OSTCBCur
\ 00000074 0068 LDR R0,[R0, #+0]
\ 00000076 0785 STRH R7,[R0, #+40]
555 OS_EXIT_CRITICAL(); /* Yes, condition met, return to caller */
\ 00000078 0098 LDR R0,[SP, #+0]
\ 0000007A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
556 *err = OS_NO_ERR;
\ 0000007E 0020 MOVS R0,#+0
\ 00000080 61E0 B.N ??OSFlagPend_15
557 return (flags_rdy);
558 } else { /* Block task until events occur or timeout */
559 OS_FlagBlock(pgrp, &node, flags, wait_type, timeout);
\ ??OSFlagPend_12:
\ 00000082 6846 MOV R0,SP
\ 00000084 008C LDRH R0,[R0, #+32]
\ 00000086 01B4 PUSH {R0}
\ 00000088 01A8 ADD R0,SP,#+4
\ 0000008A 037F LDRB R3,[R0, #+28]
\ 0000008C 028B LDRH R2,[R0, #+24]
\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -