📄 os_flag.lst
字号:
\ 0000007C 050050E3 CMP R0,#+5
\ 00000080 0500000A BEQ ??OSFlagNameGet_4
422 OS_EXIT_CRITICAL();
\ 00000084 0800B0E1 MOVS R0,R8
\ 00000088 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
423 *err = OS_ERR_EVENT_TYPE;
\ 0000008C 0100A0E3 MOV R0,#+1
\ 00000090 0000C6E5 STRB R0,[R6, #+0]
424 return (0);
\ 00000094 0000A0E3 MOV R0,#+0
\ 00000098 080000EA B ??OSFlagNameGet_1
425 }
426 len = OS_StrCopy(pname, pgrp->OSFlagName); /* Copy name from OS_FLAG_GRP */
\ ??OSFlagNameGet_4:
\ 0000009C 0A1094E2 ADDS R1,R4,#+10
\ 000000A0 0500B0E1 MOVS R0,R5
\ 000000A4 ........ _BLF OS_StrCopy,??OS_StrCopy??rA
\ 000000A8 0070B0E1 MOVS R7,R0
427 OS_EXIT_CRITICAL();
\ 000000AC 0800B0E1 MOVS R0,R8
\ 000000B0 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
428 *err = OS_ERR_NONE;
\ 000000B4 0000A0E3 MOV R0,#+0
\ 000000B8 0000C6E5 STRB R0,[R6, #+0]
429 return (len);
\ 000000BC 0700B0E1 MOVS R0,R7
\ ??OSFlagNameGet_1:
\ 000000C0 F081BDE8 POP {R4-R8,PC} ;; return
430 }
431 #endif
432
433 /*$PAGE*/
434 /*
435 *********************************************************************************************************
436 * ASSIGN A NAME TO AN EVENT FLAG GROUP
437 *
438 * Description: This function assigns a name to an event flag group.
439 *
440 * Arguments : pgrp is a pointer to the event flag group.
441 *
442 * pname is a pointer to an ASCII string that will be used as the name of the event flag
443 * group. The string must be able to hold at least OS_FLAG_NAME_SIZE characters.
444 *
445 * err is a pointer to an error code that can contain one of the following values:
446 *
447 * OS_ERR_NONE if the requested task is resumed
448 * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to an event flag group
449 * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
450 * OS_ERR_FLAG_INVALID_PGRP if you passed a NULL pointer for 'pgrp'
451 *
452 * Returns : None
453 *********************************************************************************************************
454 */
455
456 #if OS_FLAG_NAME_SIZE > 1
\ In segment CODE, align 4, keep-with-next
457 void OSFlagNameSet (OS_FLAG_GRP *pgrp, INT8U *pname, INT8U *err)
458 {
\ OSFlagNameSet:
\ 00000000 F0412DE9 PUSH {R4-R8,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
\ 0000000C 0260B0E1 MOVS R6,R2
459 INT8U len;
460 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
461 OS_CPU_SR cpu_sr = 0;
\ 00000010 0000A0E3 MOV R0,#+0
\ 00000014 0080B0E1 MOVS R8,R0
462 #endif
463
464
465
466 OS_ENTER_CRITICAL();
\ 00000018 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 0000001C 0080B0E1 MOVS R8,R0
467 #if OS_ARG_CHK_EN > 0
468 if (err == (INT8U *)0) { /* Validate 'err' */
\ 00000020 000056E3 CMP R6,#+0
\ 00000024 0200001A BNE ??OSFlagNameSet_0
469 OS_EXIT_CRITICAL();
\ 00000028 0800B0E1 MOVS R0,R8
\ 0000002C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
470 return;
\ 00000030 260000EA B ??OSFlagNameSet_1
471 }
472 if (pgrp == (OS_FLAG_GRP *)0) { /* Is 'pgrp' a NULL pointer? */
\ ??OSFlagNameSet_0:
\ 00000034 000054E3 CMP R4,#+0
\ 00000038 0400001A BNE ??OSFlagNameSet_2
473 OS_EXIT_CRITICAL(); /* Yes */
\ 0000003C 0800B0E1 MOVS R0,R8
\ 00000040 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
474 *err = OS_ERR_FLAG_INVALID_PGRP;
\ 00000044 6E00A0E3 MOV R0,#+110
\ 00000048 0000C6E5 STRB R0,[R6, #+0]
475 return;
\ 0000004C 1F0000EA B ??OSFlagNameSet_1
476 }
477 if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
\ ??OSFlagNameSet_2:
\ 00000050 000055E3 CMP R5,#+0
\ 00000054 0400001A BNE ??OSFlagNameSet_3
478 OS_EXIT_CRITICAL(); /* Yes */
\ 00000058 0800B0E1 MOVS R0,R8
\ 0000005C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
479 *err = OS_ERR_PNAME_NULL;
\ 00000060 0C00A0E3 MOV R0,#+12
\ 00000064 0000C6E5 STRB R0,[R6, #+0]
480 return;
\ 00000068 180000EA B ??OSFlagNameSet_1
481 }
482 #endif
483 if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {
\ ??OSFlagNameSet_3:
\ 0000006C 0000D4E5 LDRB R0,[R4, #+0]
\ 00000070 050050E3 CMP R0,#+5
\ 00000074 0400000A BEQ ??OSFlagNameSet_4
484 OS_EXIT_CRITICAL();
\ 00000078 0800B0E1 MOVS R0,R8
\ 0000007C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
485 *err = OS_ERR_EVENT_TYPE;
\ 00000080 0100A0E3 MOV R0,#+1
\ 00000084 0000C6E5 STRB R0,[R6, #+0]
486 return;
\ 00000088 100000EA B ??OSFlagNameSet_1
487 }
488 len = OS_StrLen(pname); /* Can we fit the string in the storage area? */
\ ??OSFlagNameSet_4:
\ 0000008C 0500B0E1 MOVS R0,R5
\ 00000090 ........ _BLF OS_StrLen,??OS_StrLen??rA
\ 00000094 0070B0E1 MOVS R7,R0
489 if (len > (OS_FLAG_NAME_SIZE - 1)) { /* No */
\ 00000098 100057E3 CMP R7,#+16
\ 0000009C 0400003A BCC ??OSFlagNameSet_5
490 OS_EXIT_CRITICAL();
\ 000000A0 0800B0E1 MOVS R0,R8
\ 000000A4 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
491 *err = OS_ERR_FLAG_NAME_TOO_LONG;
\ 000000A8 7300A0E3 MOV R0,#+115
\ 000000AC 0000C6E5 STRB R0,[R6, #+0]
492 return;
\ 000000B0 060000EA B ??OSFlagNameSet_1
493 }
494 (void)OS_StrCopy(pgrp->OSFlagName, pname); /* Yes, copy name from OS_FLAG_GRP */
\ ??OSFlagNameSet_5:
\ 000000B4 0510B0E1 MOVS R1,R5
\ 000000B8 0A0094E2 ADDS R0,R4,#+10
\ 000000BC ........ _BLF OS_StrCopy,??OS_StrCopy??rA
495 OS_EXIT_CRITICAL();
\ 000000C0 0800B0E1 MOVS R0,R8
\ 000000C4 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
496 *err = OS_ERR_NONE;
\ 000000C8 0000A0E3 MOV R0,#+0
\ 000000CC 0000C6E5 STRB R0,[R6, #+0]
497 return;
\ ??OSFlagNameSet_1:
\ 000000D0 F081BDE8 POP {R4-R8,PC} ;; return
498 }
499 #endif
500
501 /*$PAGE*/
502 /*
503 *********************************************************************************************************
504 * WAIT ON AN EVENT FLAG GROUP
505 *
506 * Description: This function is called to wait for a combination of bits to be set in an event flag
507 * group. Your application can wait for ANY bit to be set or ALL bits to be set.
508 *
509 * Arguments : pgrp is a pointer to the desired event flag group.
510 *
511 * flags Is a bit pattern indicating which bit(s) (i.e. flags) you wish to wait for.
512 * The bits you want are specified by setting the corresponding bits in
513 * 'flags'. e.g. if your application wants to wait for bits 0 and 1 then
514 * 'flags' would contain 0x03.
515 *
516 * wait_type specifies whether you want ALL bits to be set or ANY of the bits to be set.
517 * You can specify the following argument:
518 *
519 * OS_FLAG_WAIT_CLR_ALL You will wait for ALL bits in 'mask' to be clear (0)
520 * OS_FLAG_WAIT_SET_ALL You will wait for ALL bits in 'mask' to be set (1)
521 * OS_FLAG_WAIT_CLR_ANY You will wait for ANY bit in 'mask' to be clear (0)
522 * OS_FLAG_WAIT_SET_ANY You will wait for ANY bit in 'mask' to be set (1)
523 *
524 * NOTE: Add OS_FLAG_CONSUME if you want the event flag to be 'consumed' by
525 * the call. Example, to wait for any flag in a group AND then clear
526 * the flags that are present, set 'wait_type' to:
527 *
528 * OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME
529 *
530 * timeout is an optional timeout (in clock ticks) that your task will wait for the
531 * desired bit combination. If you specify 0, however, your task will wait
532 * forever at the specified event flag group or, until a message arrives.
533 *
534 * err is a pointer to an error code and can be:
535 * OS_ERR_NONE The desired bits have been set within the specified
536 * 'timeout'.
537 * OS_ERR_PEND_ISR If you tried to PEND from an ISR
538 * OS_ERR_FLAG_INVALID_PGRP If 'pgrp' is a NULL pointer.
539 * OS_ERR_EVENT_TYPE You are not pointing to an event flag group
540 * OS_ERR_TIMEOUT The bit(s) have not been set in the specified
541 * 'timeout'.
542 * OS_ERR_PEND_ABORT The wait on the flag was aborted.
543 * OS_ERR_FLAG_WAIT_TYPE You didn't specify a proper 'wait_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -