亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_flag.c

?? protues仿真ARM ARM的I2C
?? C
?? 第 1 頁 / 共 3 頁
字號:
                 *err                 = OS_ERR_TASK_WAITING;
                 return (pgrp);
             }

        case OS_DEL_ALWAYS:                                /* Always delete the event flag group       */
             pnode = (OS_FLAG_NODE *)pgrp->OSFlagWaitList;
             while (pnode != (OS_FLAG_NODE *)0) {          /* Ready ALL tasks waiting for flags        */
                 OS_FlagTaskRdy(pnode, (OS_FLAGS)0);
                 pnode = (OS_FLAG_NODE *)pnode->OSFlagNodeNext;
             }
             pgrp->OSFlagType     = OS_EVENT_TYPE_UNUSED;
             pgrp->OSFlagWaitList = (void *)OSFlagFreeList;/* Return group to free list                */
             OSFlagFreeList       = pgrp;
             OS_EXIT_CRITICAL();
             if (tasks_waiting == TRUE) {                  /* Reschedule only if task(s) were waiting  */
                 OS_Sched();                               /* Find highest priority task ready to run  */
             }
             *err = OS_NO_ERR;
             return ((OS_FLAG_GRP *)0);                    /* Event Flag Group has been deleted        */

        default:
             OS_EXIT_CRITICAL();
             *err = OS_ERR_INVALID_OPT;
             return (pgrp);
    }
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                        WAIT ON AN EVENT FLAG GROUP
*
* Description: This function is called to wait for a combination of bits to be set in an event flag
*              group.  Your application can wait for ANY bit to be set or ALL bits to be set.
*
* Arguments  : pgrp          is a pointer to the desired event flag group.
*
*              flags         Is a bit pattern indicating which bit(s) (i.e. flags) you wish to wait for.
*                            The bits you want are specified by setting the corresponding bits in
*                            'flags'.  e.g. if your application wants to wait for bits 0 and 1 then
*                            'flags' would contain 0x03.
*
*              wait_type     specifies whether you want ALL bits to be set or ANY of the bits to be set.
*                            You can specify the following argument:
*
*                            OS_FLAG_WAIT_CLR_ALL   You will wait for ALL bits in 'mask' to be clear (0)
*                            OS_FLAG_WAIT_SET_ALL   You will wait for ALL bits in 'mask' to be set   (1)
*                            OS_FLAG_WAIT_CLR_ANY   You will wait for ANY bit  in 'mask' to be clear (0)
*                            OS_FLAG_WAIT_SET_ANY   You will wait for ANY bit  in 'mask' to be set   (1)
*
*                            NOTE: Add OS_FLAG_CONSUME if you want the event flag to be 'consumed' by
*                                  the call.  Example, to wait for any flag in a group AND then clear
*                                  the flags that are present, set 'wait_type' to:
*
*                                  OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME
*
*              timeout       is an optional timeout (in clock ticks) that your task will wait for the
*                            desired bit combination.  If you specify 0, however, your task will wait
*                            forever at the specified event flag group or, until a message arrives.
*
*              err           is a pointer to an error code and can be:
*                            OS_NO_ERR              The desired bits have been set within the specified
*                                                   'timeout'.
*                            OS_ERR_PEND_ISR        If you tried to PEND from an ISR
*                            OS_FLAG_INVALID_PGRP   If 'pgrp' is a NULL pointer.
*                            OS_ERR_EVENT_TYPE      You are not pointing to an event flag group
*                            OS_TIMEOUT             The bit(s) have not been set in the specified
*                                                   'timeout'.
*                            OS_FLAG_ERR_WAIT_TYPE  You didn't specify a proper 'wait_type' argument.
*
* Returns    : The new state of the flags in the event flag group when the task is resumed or,
*              0 if a timeout or an error occurred.
*
* Called from: Task ONLY
*********************************************************************************************************
*/

OS_FLAGS  OSFlagPend (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT16U timeout, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR     cpu_sr;
#endif
    OS_FLAG_NODE  node;
    OS_FLAGS      flags_cur;
    OS_FLAGS      flags_rdy;
    BOOLEAN       consume;


    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_PEND_ISR;                            /* ... can't PEND from an ISR               */
        return ((OS_FLAGS)0);
    }
#if OS_ARG_CHK_EN > 0
    if (pgrp == (OS_FLAG_GRP *)0) {                        /* Validate 'pgrp'                          */
        *err = OS_FLAG_INVALID_PGRP;
        return ((OS_FLAGS)0);
    }
    if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {          /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return ((OS_FLAGS)0);
    }
#endif
    if (wait_type & OS_FLAG_CONSUME) {                     /* See if we need to consume the flags      */
        wait_type &= ~OS_FLAG_CONSUME;
        consume    = TRUE;
    } else {
        consume    = FALSE;
    }
/*$PAGE*/
    OS_ENTER_CRITICAL();
    switch (wait_type) {
        case OS_FLAG_WAIT_SET_ALL:                         /* See if all required flags are set        */
             flags_rdy = pgrp->OSFlagFlags & flags;        /* Extract only the bits we want            */
             if (flags_rdy == flags) {                     /* Must match ALL the bits that we want     */
                 if (consume == TRUE) {                    /* See if we need to consume the flags      */
                     pgrp->OSFlagFlags &= ~flags_rdy;      /* Clear ONLY the flags that we wanted      */
                 }
                 flags_cur = pgrp->OSFlagFlags;            /* Will return the state of the group       */
                 OS_EXIT_CRITICAL();                       /* Yes, condition met, return to caller     */
                 *err      = OS_NO_ERR;
                 return (flags_cur);
             } else {                                      /* Block task until events occur or timeout */
                 OS_FlagBlock(pgrp, &node, flags, wait_type, timeout);
                 OS_EXIT_CRITICAL();
             }
             break;

        case OS_FLAG_WAIT_SET_ANY:
             flags_rdy = pgrp->OSFlagFlags & flags;        /* Extract only the bits we want            */
             if (flags_rdy != (OS_FLAGS)0) {               /* See if any flag set                      */
                 if (consume == TRUE) {                    /* See if we need to consume the flags      */
                     pgrp->OSFlagFlags &= ~flags_rdy;      /* Clear ONLY the flags that we got         */
                 }
                 flags_cur = pgrp->OSFlagFlags;            /* Will return the state of the group       */
                 OS_EXIT_CRITICAL();                       /* Yes, condition met, return to caller     */
                 *err      = OS_NO_ERR;
                 return (flags_cur);
             } else {                                      /* Block task until events occur or timeout */
                 OS_FlagBlock(pgrp, &node, flags, wait_type, timeout);
                 OS_EXIT_CRITICAL();
             }
             break;

#if OS_FLAG_WAIT_CLR_EN > 0
        case OS_FLAG_WAIT_CLR_ALL:                         /* See if all required flags are cleared    */
             flags_rdy = ~pgrp->OSFlagFlags & flags;       /* Extract only the bits we want            */
             if (flags_rdy == flags) {                     /* Must match ALL the bits that we want     */
                 if (consume == TRUE) {                    /* See if we need to consume the flags      */
                     pgrp->OSFlagFlags |= flags_rdy;       /* Set ONLY the flags that we wanted        */
                 }
                 flags_cur = pgrp->OSFlagFlags;            /* Will return the state of the group       */
                 OS_EXIT_CRITICAL();                       /* Yes, condition met, return to caller     */
                 *err      = OS_NO_ERR;
                 return (flags_cur);
             } else {                                      /* Block task until events occur or timeout */
                 OS_FlagBlock(pgrp, &node, flags, wait_type, timeout);
                 OS_EXIT_CRITICAL();
             }
             break;

        case OS_FLAG_WAIT_CLR_ANY:
             flags_rdy = ~pgrp->OSFlagFlags & flags;       /* Extract only the bits we want            */
             if (flags_rdy != (OS_FLAGS)0) {               /* See if any flag cleared                  */
                 if (consume == TRUE) {                    /* See if we need to consume the flags      */
                     pgrp->OSFlagFlags |= flags_rdy;       /* Set ONLY the flags that we got           */
                 }
                 flags_cur = pgrp->OSFlagFlags;            /* Will return the state of the group       */
                 OS_EXIT_CRITICAL();                       /* Yes, condition met, return to caller     */
                 *err      = OS_NO_ERR;
                 return (flags_cur);
             } else {                                      /* Block task until events occur or timeout */
                 OS_FlagBlock(pgrp, &node, flags, wait_type, timeout);
                 OS_EXIT_CRITICAL();
             }
             break;
#endif

        default:
             OS_EXIT_CRITICAL();
             flags_cur = (OS_FLAGS)0;
             *err      = OS_FLAG_ERR_WAIT_TYPE;
             return (flags_cur);
    }
    OS_Sched();                                            /* Find next HPT ready to run               */
    OS_ENTER_CRITICAL();
    if (OSTCBCur->OSTCBStat & OS_STAT_FLAG) {              /* Have we timed-out?                       */
        OS_FlagUnlink(&node);
        OSTCBCur->OSTCBStat = OS_STAT_RDY;                 /* Yes, make task ready-to-run              */
        OS_EXIT_CRITICAL();
        flags_cur           = (OS_FLAGS)0;
        *err                = OS_TIMEOUT;                  /* Indicate that we timed-out waiting       */
    } else {
        if (consume == TRUE) {                             /* See if we need to consume the flags      */
            switch (wait_type) {
                case OS_FLAG_WAIT_SET_ALL:
                case OS_FLAG_WAIT_SET_ANY:                 /* Clear ONLY the flags we got              */
                     pgrp->OSFlagFlags &= ~OSTCBCur->OSTCBFlagsRdy;
                     break;

#if OS_FLAG_WAIT_CLR_EN > 0
                case OS_FLAG_WAIT_CLR_ALL:
                case OS_FLAG_WAIT_CLR_ANY:                 /* Set   ONLY the flags we got              */
                     pgrp->OSFlagFlags |= OSTCBCur->OSTCBFlagsRdy;
                     break;
#endif
            }
        }
        flags_cur = pgrp->OSFlagFlags;
        OS_EXIT_CRITICAL();
        *err      = OS_NO_ERR;                             /* Event(s) must have occurred              */
    }
    return (flags_cur);
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                         POST EVENT FLAG BIT(S)
*
* Description: This function is called to set or clear some bits in an event flag group.  The bits to
*              set or clear are specified by a 'bit mask'.
*
* Arguments  : pgrp          is a pointer to the desired event flag group.
*
*              flags         If 'opt' (see below) is OS_FLAG_SET, each bit that is set in 'flags' will
*                            set the corresponding bit in the event flag group.  e.g. to set bits 0, 4
*                            and 5 you would set 'flags' to:
*
*                                0x31     (note, bit 0 is least significant bit)
*
*                            If 'opt' (see below) is OS_FLAG_CLR, each bit that is set in 'flags' will
*                            CLEAR the corresponding bit in the event flag group.  e.g. to clear bits 0,
*                            4 and 5 you would specify 'flags' as:
*
*                                0x31     (note, bit 0 is least significant bit)
*
*              opt           indicates whether the flags will be:
*                                set     (OS_FLAG_SET) or
*                                cleared (OS_FLAG_CLR)
*
*              err           is a pointer to an error code and can be:
*                            OS_NO_ERR              The call was successfull
*                            OS_FLAG_INVALID_PGRP   You passed a NULL pointer
*                            OS_ERR_EVENT_TYPE      You are not pointing to an event flag group
*                            OS_FLAG_INVALID_OPT    You specified an invalid option
*
* Returns    : the new value of the event flags bits that are still set.
*
* Called From: Task or ISR
*
* WARNING(s) : 1) The execution time of this function depends on the number of tasks waiting on the event
*                 flag group.
*              2) The amount of time interrupts are DISABLED depends on the number of tasks waiting on
*                 the event flag group.
*********************************************************************************************************
*/
OS_FLAGS  OSFlagPost (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U opt, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3                          /* Allocate storage for CPU status register       */
    OS_CPU_SR     cpu_sr;
#endif
    OS_FLAG_NODE *pnode;
    BOOLEAN       sched;
    OS_FLAGS      flags_cur;
    OS_FLAGS      flags_rdy;


#if OS_ARG_CHK_EN > 0
    if (pgrp == (OS_FLAG_GRP *)0) {                  /* Validate 'pgrp'                                */
        *err = OS_FLAG_INVALID_PGRP;
        return ((OS_FLAGS)0);
    }
    if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {    /* Make sure we are pointing to an event flag grp */
        *err = OS_ERR_EVENT_TYPE;
        return ((OS_FLAGS)0);
    }
#endif
/*$PAGE*/
    OS_ENTER_CRITICAL();
    switch (opt) {
        case OS_FLAG_CLR:
             pgrp->OSFlagFlags &= ~flags;            /* Clear the flags specified in the group         */
             break;

        case OS_FLAG_SET:
             pgrp->OSFlagFlags |=  flags;            /* Set   the flags specified in the group         */
             break;

        default:
             OS_EXIT_CRITICAL();                     /* INVALID option                                 */
             *err = OS_FLAG_INVALID_OPT;
             return ((OS_FLAGS)0);
    }
    sched = FALSE;                                   /* Indicate that we don't need rescheduling       */
    pnode = (OS_FLAG_NODE *)pgrp->OSFlagWaitList;
    while (pnode != (OS_FLAG_NODE *)0) {             /* Go through all tasks waiting on event flag(s)  */
        switch (pnode->OSFlagNodeWaitType) {
            case OS_FLAG_WAIT_SET_ALL:               /* See if all req. flags are set for current node */
                 flags_rdy = pgrp->OSFlagFlags & pnode->OSFlagNodeFlags;
                 if (flags_rdy == pnode->OSFlagNodeFlags) {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色网站导航| 亚洲国产精品精华液网站| 69p69国产精品| 久久久欧美精品sm网站| 国产在线精品一区二区三区不卡 | 午夜精品久久久久久久久久久| 亚洲国产精品二十页| 韩国三级在线一区| 337p亚洲精品色噜噜噜| 久久精品免费看| 91视频.com| 1000精品久久久久久久久| 国产白丝精品91爽爽久久| 亚洲欧洲在线观看av| 国产亚洲精品免费| 久久99在线观看| 中国av一区二区三区| 91极品视觉盛宴| 亚洲国产一区视频| 奇米四色…亚洲| 久久美女艺术照精彩视频福利播放 | 欧美日韩一区二区欧美激情| 亚洲专区一二三| 欧美日韩高清不卡| 欧美一级高清片| 久久久久久久av麻豆果冻| 亚洲视频一区在线观看| 亚洲免费观看在线观看| 欧美日韩一区二区在线观看视频| 亚洲一区二区影院| 免费看日韩a级影片| 久久综合九色综合欧美98| 国产精品美女久久福利网站| 日韩美女久久久| 91麻豆精品国产91久久久久久久久| 老司机精品视频在线| 国产夜色精品一区二区av| 久久精品网站免费观看| 白白色 亚洲乱淫| 亚洲高清中文字幕| 婷婷一区二区三区| 国产麻豆精品theporn| 国产精品久久久久久久久快鸭| 国产精品不卡一区二区三区| 国内精品视频666| 亚洲欧洲av色图| 久久精品国产99久久6| 国产亚洲一区二区三区| 欧美视频在线一区| 国产麻豆视频一区| 亚洲色图制服丝袜| 久久国产综合精品| 99re这里只有精品首页| 麻豆91免费观看| 91美女蜜桃在线| 精品伊人久久久久7777人| 日韩毛片视频在线看| 国产视频一区在线播放| 欧美无人高清视频在线观看| 国产精品一卡二卡| 亚洲精品写真福利| 精品综合免费视频观看| 最新热久久免费视频| 欧美精品高清视频| 欧美三级中文字| 1000部国产精品成人观看| 日韩精品在线一区| 一区二区三区中文字幕精品精品| 欧美一区二区三区日韩| 亚洲色图在线播放| 免费xxxx性欧美18vr| 欧美在线综合视频| 国产亚洲一区二区三区| 69久久99精品久久久久婷婷| 国内精品嫩模私拍在线| 日本怡春院一区二区| 一区二区三区欧美激情| 欧美精品一区二区在线观看| 欧美一区二区三区在| 色老综合老女人久久久| 国产精品 欧美精品| 精品日本一线二线三线不卡| 91久久免费观看| 成人黄色在线网站| 一区二区中文视频| 欧日韩精品视频| 一区二区三区在线免费| 激情都市一区二区| 91精品福利在线一区二区三区| 亚洲国产成人av| 欧美精品久久99久久在免费线 | 国产色一区二区| 欧美电影免费提供在线观看| 欧美羞羞免费网站| 欧美日韩亚洲综合在线| 欧美亚洲一区二区在线| 欧洲日韩一区二区三区| 亚洲欧美色一区| 中文字幕一区二区不卡| 国产精品视频一二三区| 成人免费视频网站在线观看| 国产经典欧美精品| 国产精品综合一区二区| 国产美女一区二区| 狠狠色狠狠色综合系列| 蜜桃视频第一区免费观看| 日韩主播视频在线| 欧美成人一区二区三区在线观看| 久久网这里都是精品| 欧美精品一区二区不卡| 久久久国产精华| 日本va欧美va精品发布| 欧美一级理论片| 日本不卡视频一二三区| 国产色婷婷亚洲99精品小说| 男女视频一区二区| 久久这里都是精品| 91在线观看免费视频| 国产精品日日摸夜夜摸av| 亚洲宅男天堂在线观看无病毒| 午夜视频一区在线观看| 亚洲v中文字幕| 91香蕉视频污在线| 欧美精品久久天天躁| 91精品国产欧美一区二区| 日韩一区和二区| 国产精品无人区| 亚洲自拍偷拍av| 日韩欧美视频一区| 51精品秘密在线观看| 久久久不卡网国产精品一区| 国产精品久久久久7777按摩| 99riav一区二区三区| 亚洲人成7777| 成人黄色大片在线观看| 日韩免费电影一区| 欧美v亚洲v综合ⅴ国产v| 亚洲一级二级在线| 亚洲一区在线免费观看| 91在线一区二区三区| 国产一区二区三区综合| 国产精品久久久久久亚洲伦| 成人免费视频app| 岛国精品一区二区| 99热在这里有精品免费| 欧美国产激情二区三区| 欧美日免费三级在线| 狠狠色丁香婷婷综合| 中文字幕一区二区三区蜜月 | 国产91精品露脸国语对白| 综合婷婷亚洲小说| 97se亚洲国产综合自在线观| 亚洲乱码日产精品bd| 亚洲欧洲日韩女同| 亚洲一区二区不卡免费| 美女一区二区视频| 欧美日韩中字一区| 国内精品视频666| 日韩精品中文字幕一区 | 色综合激情五月| 色久优优欧美色久优优| 亚洲综合丝袜美腿| 久久福利视频一区二区| 日韩美女啊v在线免费观看| 2021中文字幕一区亚洲| 99热精品一区二区| 亚洲一区二区三区小说| 亚洲午夜久久久| 欧美老女人第四色| 中文字幕乱码久久午夜不卡 | 欧美在线观看视频一区二区| 亚洲欧美在线高清| 欧美视频中文字幕| 亚洲成va人在线观看| 亚洲欧洲av色图| 91.xcao| 不卡的av在线| 色成年激情久久综合| 99久久精品免费看| 欧美一区二区女人| 在线中文字幕一区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 中文字幕在线一区免费| 日韩高清不卡在线| 亚洲成人免费影院| 欧美午夜不卡视频| 麻豆精品国产传媒mv男同| 91在线看国产| 亚洲少妇最新在线视频| 成人国产亚洲欧美成人综合网 | 欧美性xxxxxxxx| 成人av网站在线观看免费| 蜜臀久久久久久久| 天天色综合天天| 久久青草欧美一区二区三区| 在线视频国内一区二区| 欧美精品18+| 欧美精品三级在线观看| 国产精品一线二线三线精华| 在线观看日韩av先锋影音电影院|