📄 os_flag.lst
字号:
422 void OSFlagNameSet (OS_FLAG_GRP *pgrp, char *pname, INT8U *err)
423 {
\ OSFlagNameSet:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 0500 MOVS R5,R0
\ 00000004 0E00 MOVS R6,R1
\ 00000006 1400 MOVS R4,R2
424 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
425 OS_CPU_SR cpu_sr;
426 #endif
427 INT8U len;
428
429
430 OS_ENTER_CRITICAL();
\ 00000008 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 0000000C 0700 MOVS R7,R0
431 #if OS_ARG_CHK_EN > 0
432 if (pgrp == (OS_FLAG_GRP *)0) { /* Is 'pgrp' a NULL pointer? */
\ 0000000E 002D CMP R5,#+0
\ 00000010 05D1 BNE ??OSFlagNameSet_0
433 OS_EXIT_CRITICAL(); /* Yes */
\ 00000012 3800 MOVS R0,R7
\ 00000014 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
434 *err = OS_FLAG_INVALID_PGRP;
\ 00000018 9620 MOVS R0,#+150
\ 0000001A 2070 STRB R0,[R4, #+0]
435 return;
\ 0000001C 25E0 B ??OSFlagNameSet_1
436 }
437 if (pname == (char *)0) { /* Is 'pname' a NULL pointer? */
\ ??OSFlagNameSet_0:
\ 0000001E 002E CMP R6,#+0
\ 00000020 05D1 BNE ??OSFlagNameSet_2
438 OS_EXIT_CRITICAL(); /* Yes */
\ 00000022 3800 MOVS R0,R7
\ 00000024 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
439 *err = OS_ERR_PNAME_NULL;
\ 00000028 0F20 MOVS R0,#+15
\ 0000002A 2070 STRB R0,[R4, #+0]
440 return;
\ 0000002C 1DE0 B ??OSFlagNameSet_1
441 }
442 #endif
443 if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {
\ ??OSFlagNameSet_2:
\ 0000002E 2878 LDRB R0,[R5, #+0]
\ 00000030 0528 CMP R0,#+5
\ 00000032 05D0 BEQ ??OSFlagNameSet_3
444 OS_EXIT_CRITICAL();
\ 00000034 3800 MOVS R0,R7
\ 00000036 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
445 *err = OS_ERR_EVENT_TYPE;
\ 0000003A 0120 MOVS R0,#+1
\ 0000003C 2070 STRB R0,[R4, #+0]
446 return;
\ 0000003E 14E0 B ??OSFlagNameSet_1
447 }
448 len = OS_StrLen(pname); /* Can we fit the string in the storage area? */
\ ??OSFlagNameSet_3:
\ 00000040 3000 MOVS R0,R6
\ 00000042 ........ _BLF OS_StrLen,??OS_StrLen??rT
449 if (len > (OS_FLAG_NAME_SIZE - 1)) { /* No */
\ 00000046 2028 CMP R0,#+32
\ 00000048 05D3 BCC ??OSFlagNameSet_4
450 OS_EXIT_CRITICAL();
\ 0000004A 3800 MOVS R0,R7
\ 0000004C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
451 *err = OS_ERR_FLAG_NAME_TOO_LONG;
\ 00000050 0D20 MOVS R0,#+13
\ 00000052 2070 STRB R0,[R4, #+0]
452 return;
\ 00000054 09E0 B ??OSFlagNameSet_1
453 }
454 (void)OS_StrCopy(pgrp->OSFlagName, pname); /* Yes, copy name from OS_FLAG_GRP */
\ ??OSFlagNameSet_4:
\ 00000056 3100 MOVS R1,R6
\ 00000058 0A35 ADDS R5,R5,#+10
\ 0000005A 2800 MOVS R0,R5
\ 0000005C ........ _BLF OS_StrCopy,??OS_StrCopy??rT
455 OS_EXIT_CRITICAL();
\ 00000060 3800 MOVS R0,R7
\ 00000062 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
456 *err = OS_NO_ERR;
\ 00000066 0020 MOVS R0,#+0
\ 00000068 2070 STRB R0,[R4, #+0]
457 return;
\ ??OSFlagNameSet_1:
\ 0000006A F0BC POP {R4-R7}
\ 0000006C 01BC POP {R0}
\ 0000006E 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 FFB5 PUSH {R0-R7,LR}
\ 00000002 85B0 SUB SP,SP,#+20
\ 00000004 0E9C LDR R4,[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 ... */
\ 00000006 .... LDR R0,??DataTable9 ;; OSIntNesting
\ 00000008 0078 LDRB R0,[R0, #+0]
\ 0000000A 0128 CMP R0,#+1
\ 0000000C 03D3 BCC ??OSFlagPend_0
526 *err = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR */
\ 0000000E 0220 MOVS R0,#+2
\ 00000010 2070 STRB R0,[R4, #+0]
527 return ((OS_FLAGS)0);
\ 00000012 0020 MOVS R0,#+0
\ 00000014 1FE1 B ??OSFlagPend_1
528 }
529 #if OS_ARG_CHK_EN > 0
530 if (pgrp == (OS_FLAG_GRP *)0) { /* Validate 'pgrp' */
\ ??OSFlagPend_0:
\ 00000016 0598 LDR R0,[SP, #+20]
\ 00000018 0028 CMP R0,#+0
\ 0000001A 03D1 BNE ??OSFlagPend_2
531 *err = OS_FLAG_INVALID_PGRP;
\ 0000001C 9620 MOVS R0,#+150
\ 0000001E 2070 STRB R0,[R4, #+0]
532 return ((OS_FLAGS)0);
\ 00000020 0020 MOVS R0,#+0
\ 00000022 18E1 B ??OSFlagPend_1
533 }
534 #endif
535 if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) { /* Validate event block type */
\ ??OSFlagPend_2:
\ 00000024 0598 LDR R0,[SP, #+20]
\ 00000026 0078 LDRB R0,[R0, #+0]
\ 00000028 0528 CMP R0,#+5
\ 0000002A 03D0 BEQ ??OSFlagPend_3
536 *err = OS_ERR_EVENT_TYPE;
\ 0000002C 0120 MOVS R0,#+1
\ 0000002E 2070 STRB R0,[R4, #+0]
537 return ((OS_FLAGS)0);
\ 00000030 0020 MOVS R0,#+0
\ 00000032 10E1 B ??OSFlagPend_1
538 }
539 if (wait_type & OS_FLAG_CONSUME) { /* See if we need to consume the flags */
\ ??OSFlagPend_3:
\ 00000034 6846 MOV R0,SP
\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -