📄 os_flag.lst
字号:
639 01ce 11F0 breq .L42
483:../OSsrc/os_flag.c **** *perr = OS_ERR_NAME_SET_ISR;
641 .LM97:
642 01d0 82E1 ldi r24,lo8(18)
643 01d2 0FC0 rjmp .L45
644 .L42:
484:../OSsrc/os_flag.c **** return;
485:../OSsrc/os_flag.c **** }
486:../OSsrc/os_flag.c **** OS_ENTER_CRITICAL();
646 .LM98:
647 /* #APP */
648 01d4 F894 cli
487:../OSsrc/os_flag.c **** if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {
650 .LM99:
651 /* #NOAPP */
652 01d6 F701 movw r30,r14
653 01d8 8081 ld r24,Z
654 01da 8530 cpi r24,lo8(5)
655 01dc 19F0 breq .L43
488:../OSsrc/os_flag.c **** OS_EXIT_CRITICAL();
657 .LM100:
658 /* #APP */
659 01de 7894 sei
489:../OSsrc/os_flag.c **** *perr = OS_ERR_EVENT_TYPE;
661 .LM101:
662 /* #NOAPP */
663 01e0 81E0 ldi r24,lo8(1)
664 01e2 07C0 rjmp .L45
665 .L43:
490:../OSsrc/os_flag.c **** return;
491:../OSsrc/os_flag.c **** }
492:../OSsrc/os_flag.c **** len = OS_StrLen(pname); /* Can we fit the string in the storage area?
667 .LM102:
668 01e4 CB01 movw r24,r22
669 01e6 0E94 0000 call OS_StrLen
493:../OSsrc/os_flag.c **** if (len > (OS_FLAG_NAME_SIZE - 1)) { /* No
671 .LM103:
672 01ea 8032 cpi r24,lo8(32)
673 01ec 20F0 brlo .L44
494:../OSsrc/os_flag.c **** OS_EXIT_CRITICAL();
675 .LM104:
676 /* #APP */
677 01ee 7894 sei
495:../OSsrc/os_flag.c **** *perr = OS_ERR_FLAG_NAME_TOO_LONG;
679 .LM105:
680 /* #NOAPP */
681 01f0 83E7 ldi r24,lo8(115)
682 .L45:
683 01f2 8883 st Y,r24
496:../OSsrc/os_flag.c **** return;
685 .LM106:
686 01f4 07C0 rjmp .L38
687 .L44:
497:../OSsrc/os_flag.c **** }
498:../OSsrc/os_flag.c **** (void)OS_StrCopy(pgrp->OSFlagName, pname); /* Yes, copy name from OS_FLAG_GRP
689 .LM107:
690 01f6 B801 movw r22,r16
691 01f8 C701 movw r24,r14
692 01fa 0496 adiw r24,4
693 01fc 0E94 0000 call OS_StrCopy
499:../OSsrc/os_flag.c **** OS_EXIT_CRITICAL();
695 .LM108:
696 /* #APP */
697 0200 7894 sei
500:../OSsrc/os_flag.c **** *perr = OS_ERR_NONE;
699 .LM109:
700 /* #NOAPP */
701 0202 1882 st Y,__zero_reg__
702 .L38:
703 /* epilogue: frame size=0 */
704 0204 DF91 pop r29
705 0206 CF91 pop r28
706 0208 1F91 pop r17
707 020a 0F91 pop r16
708 020c FF90 pop r15
709 020e EF90 pop r14
710 0210 0895 ret
711 /* epilogue end (size=7) */
712 /* function OSFlagNameSet size 61 (48) */
714 .Lscope3:
722 OS_FlagBlock:
501:../OSsrc/os_flag.c **** return;
502:../OSsrc/os_flag.c **** }
503:../OSsrc/os_flag.c **** #endif
504:../OSsrc/os_flag.c ****
505:../OSsrc/os_flag.c **** /*$PAGE*/
506:../OSsrc/os_flag.c **** /*
507:../OSsrc/os_flag.c **** ***************************************************************************************************
508:../OSsrc/os_flag.c **** * WAIT ON AN EVENT FLAG GROUP
509:../OSsrc/os_flag.c **** *
510:../OSsrc/os_flag.c **** * Description: This function is called to wait for a combination of bits to be set in an event flag
511:../OSsrc/os_flag.c **** * group. Your application can wait for ANY bit to be set or ALL bits to be set.
512:../OSsrc/os_flag.c **** *
513:../OSsrc/os_flag.c **** * Arguments : pgrp is a pointer to the desired event flag group.
514:../OSsrc/os_flag.c **** *
515:../OSsrc/os_flag.c **** * flags Is a bit pattern indicating which bit(s) (i.e. flags) you wish to wait
516:../OSsrc/os_flag.c **** * The bits you want are specified by setting the corresponding bits in
517:../OSsrc/os_flag.c **** * 'flags'. e.g. if your application wants to wait for bits 0 and 1 then
518:../OSsrc/os_flag.c **** * 'flags' would contain 0x03.
519:../OSsrc/os_flag.c **** *
520:../OSsrc/os_flag.c **** * wait_type specifies whether you want ALL bits to be set or ANY of the bits to be
521:../OSsrc/os_flag.c **** * You can specify the following argument:
522:../OSsrc/os_flag.c **** *
523:../OSsrc/os_flag.c **** * OS_FLAG_WAIT_CLR_ALL You will wait for ALL bits in 'mask' to be clea
524:../OSsrc/os_flag.c **** * OS_FLAG_WAIT_SET_ALL You will wait for ALL bits in 'mask' to be set
525:../OSsrc/os_flag.c **** * OS_FLAG_WAIT_CLR_ANY You will wait for ANY bit in 'mask' to be clea
526:../OSsrc/os_flag.c **** * OS_FLAG_WAIT_SET_ANY You will wait for ANY bit in 'mask' to be set
527:../OSsrc/os_flag.c **** *
528:../OSsrc/os_flag.c **** * NOTE: Add OS_FLAG_CONSUME if you want the event flag to be 'consumed'
529:../OSsrc/os_flag.c **** * the call. Example, to wait for any flag in a group AND then cle
530:../OSsrc/os_flag.c **** * the flags that are present, set 'wait_type' to:
531:../OSsrc/os_flag.c **** *
532:../OSsrc/os_flag.c **** * OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME
533:../OSsrc/os_flag.c **** *
534:../OSsrc/os_flag.c **** * timeout is an optional timeout (in clock ticks) that your task will wait for t
535:../OSsrc/os_flag.c **** * desired bit combination. If you specify 0, however, your task will wa
536:../OSsrc/os_flag.c **** * forever at the specified event flag group or, until a message arrives.
537:../OSsrc/os_flag.c **** *
538:../OSsrc/os_flag.c **** * perr is a pointer to an error code and can be:
539:../OSsrc/os_flag.c **** * OS_ERR_NONE The desired bits have been set within the sp
540:../OSsrc/os_flag.c **** * 'timeout'.
541:../OSsrc/os_flag.c **** * OS_ERR_PEND_ISR If you tried to PEND from an ISR
542:../OSsrc/os_flag.c **** * OS_ERR_FLAG_INVALID_PGRP If 'pgrp' is a NULL pointer.
543:../OSsrc/os_flag.c **** * OS_ERR_EVENT_TYPE You are not pointing to an event flag group
544:../OSsrc/os_flag.c **** * OS_ERR_TIMEOUT The bit(s) have not been set in the specifie
545:../OSsrc/os_flag.c **** * 'timeout'.
546:../OSsrc/os_flag.c **** * OS_ERR_PEND_ABORT The wait on the flag was aborted.
547:../OSsrc/os_flag.c **** * OS_ERR_FLAG_WAIT_TYPE You didn't specify a proper 'wait_type' argu
548:../OSsrc/os_flag.c **** *
549:../OSsrc/os_flag.c **** * Returns : The flags in the event flag group that made the task ready or, 0 if a timeout or an
550:../OSsrc/os_flag.c **** * occurred.
551:../OSsrc/os_flag.c **** *
552:../OSsrc/os_flag.c **** * Called from: Task ONLY
553:../OSsrc/os_flag.c **** *
554:../OSsrc/os_flag.c **** * Note(s) : 1) IMPORTANT, the behavior of this function has changed from PREVIOUS versions. The
555:../OSsrc/os_flag.c **** * function NOW returns the flags that were ready INSTEAD of the current state of th
556:../OSsrc/os_flag.c **** * event flags.
557:../OSsrc/os_flag.c **** ***************************************************************************************************
558:../OSsrc/os_flag.c **** */
559:../OSsrc/os_flag.c ****
560:../OSsrc/os_flag.c **** OS_FLAGS OSFlagPend (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT16U timeout, INT8U *pe
561:../OSsrc/os_flag.c **** {
562:../OSsrc/os_flag.c **** OS_FLAG_NODE node;
563:../OSsrc/os_flag.c **** OS_FLAGS flags_rdy;
564:../OSsrc/os_flag.c **** INT8U result;
565:../OSsrc/os_flag.c **** INT8U pend_stat;
566:../OSsrc/os_flag.c **** BOOLEAN consume;
567:../OSsrc/os_flag.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status regis
568:../OSsrc/os_flag.c **** OS_CPU_SR cpu_sr = 0;
569:../OSsrc/os_flag.c **** #endif
570:../OSsrc/os_flag.c ****
571:../OSsrc/os_flag.c ****
572:../OSsrc/os_flag.c ****
573:../OSsrc/os_flag.c **** #if OS_ARG_CHK_EN > 0
574:../OSsrc/os_flag.c **** if (perr == (INT8U *)0) { /* Validate 'perr'
575:../OSsrc/os_flag.c **** return ((OS_FLAGS)0);
576:../OSsrc/os_flag.c **** }
577:../OSsrc/os_flag.c **** if (pgrp == (OS_FLAG_GRP *)0) { /* Validate 'pgrp'
578:../OSsrc/os_flag.c **** *perr = OS_ERR_FLAG_INVALID_PGRP;
579:../OSsrc/os_flag.c **** return ((OS_FLAGS)0);
580:../OSsrc/os_flag.c **** }
581:../OSsrc/os_flag.c **** #endif
582:../OSsrc/os_flag.c **** if (OSIntNesting > 0) { /* See if called from ISR ...
583:../OSsrc/os_flag.c **** *perr = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR
584:../OSsrc/os_flag.c **** return ((OS_FLAGS)0);
585:../OSsrc/os_flag.c **** }
586:../OSsrc/os_flag.c **** if (OSLockNesting > 0) { /* See if called with scheduler locked .
587:../OSsrc/os_flag.c **** *perr = OS_ERR_PEND_LOCKED; /* ... can't PEND when locked
588:../OSsrc/os_flag.c **** return ((OS_FLAGS)0);
589:../OSsrc/os_flag.c **** }
590:../OSsrc/os_flag.c **** if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) { /* Validate event block type
591:../OSsrc/os_flag.c **** *perr = OS_ERR_EVENT_TYPE;
592:../OSsrc/os_flag.c **** return ((OS_FLAGS)0);
593:../OSsrc/os_flag.c **** }
594:../OSsrc/os_flag.c **** result = (INT8U)(wait_type & OS_FLAG_CONSUME);
595:../OSsrc/os_flag.c **** if (result != (INT8U)0) { /* See if we need to consume the flags
596:../OSsrc/os_flag.c **** wait_type &= ~(INT8U)OS_FLAG_CONSUME;
597:../OSsrc/os_flag.c **** consume = OS_TRUE;
598:../OSsrc/os_flag.c **** } else {
599:../OSsrc/os_flag.c **** consume = OS_FALSE;
600:../OSsrc/os_flag.c **** }
601:../OSsrc/os_flag.c **** /*$PAGE*/
602:../OSsrc/os_flag.c **** OS_ENTER_CRITICAL();
603:../OSsrc/os_flag.c **** switch (wait_type) {
604:../OSsrc/os_flag.c **** case OS_FLAG_WAIT_SET_ALL: /* See if all required flags are set
605:../OSsrc/os_flag.c **** flags_rdy = (OS_FLAGS)(pgrp->OSFlagFlags & flags); /* Extract only the bits we want
606:../OSsrc/os_flag.c **** if (flags_rdy == flags) { /* Must match ALL the bits that we want
607:../OSsrc/os_flag.c **** if (consume == OS_TRUE) { /* See if we need to consume the flags
608:../OSsrc/os_flag.c **** pgrp->OSFlagFlags &= ~flags_rdy; /* Clear ONLY the flags that we wanted
609:../OSsrc/os_flag.c **** }
610:../OSsrc/os_flag.c **** OSTCBCur->OSTCBFlagsRdy = flags_rdy; /* Save flags that were ready
611:../OSsrc/os_flag.c **** OS_EXIT_CRITICAL(); /* Yes, condition met, return to caller
612:../OSsrc/os_flag.c **** *perr = OS_ERR_NONE;
613:../OSsrc/os_flag.c **** return (flags_rdy);
614:../OSsrc/os_flag.c **** } else { /* Block task until events occur or time
615:../OSsrc/os_flag.c **** OS_FlagBlock(pgrp, &node, flags, wait_type, timeout);
616:../OSsrc/os_flag.c **** OS_EXIT_CRITICAL();
617:../OSsrc/os_flag.c **** }
618:../OSsrc/os_flag.c **** break;
619:../OSsrc/os_flag.c ****
620:../OSsrc/os_flag.c **** case OS_FLAG_WAIT_SET_ANY:
621:../OSsrc/os_flag.c **** flags_rdy = (OS_FLAGS)(pgrp->OSFlagFlags & flags); /* Extract only the bits we want
622:../OSsrc/os_flag.c **** if (flags_rdy != (OS_FLAGS)0) { /* See if any flag set
623:../OSsrc/os_flag.c **** if (consume == OS_TRUE) { /* See if we need to consume the flags
624:../OSsrc/os_flag.c **** pgrp->OSFlagFlags &= ~flags_rdy; /* Clear ONLY the flags that we got
625:../OSsrc/os_flag.c **** }
626:../OSsrc/os_flag.c **** OSTCBCur->OSTCBFlagsRdy = flags_rdy; /* Save flags that were ready
627:../OSsrc/os_flag.c **** OS_EXIT_CRITICAL(); /* Yes, condition met, return to caller
628:../OSsrc/os_flag.c **** *perr = OS_ERR_NONE;
629:../OSsrc/os_flag.c **** return (flags_rdy);
630:../OSsrc/os_flag.c **** } else { /* Block task until events occur or time
631:../OSsrc/os_flag.c **** OS_FlagBlock(pgrp, &node, flags, wait_type, timeout);
632:../OSsrc/os_flag.c **** OS_EXIT_CRITICAL();
633:../OSsrc/os_flag.c **** }
634:../OSsrc/os_flag.c **** break;
635:../OSsrc/os_flag.c ****
636:../OSsrc/os_flag.c **** #if OS_FLAG_WAIT_CLR_EN > 0
637:../OSsrc/os_flag.c **** case OS_FLAG_WAIT_CLR_ALL: /* See if all required flags are cleared
638:../OSsrc/os_flag.c **** flags_rdy = (OS_FLAGS)(~pgrp->OSFlagFlags & flags); /* Extract only the bits we want
639:../OSsrc/os_flag.c **** if (flags_rdy == flags) { /* Must match ALL the bits that we want
640:../OSsrc/os_flag.c **** if (consume == OS_TRUE) { /* See if we need to cons
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -