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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? os_flag.c

?? keil for arm環境下 lpc213x系列 完全編譯通過的代碼
?? 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) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费久久精品视频| 欧美高清性hdvideosex| 国产在线观看一区二区| 青青草国产成人99久久| 午夜精品免费在线| 午夜精品久久久久久久久久| 一区二区三区欧美视频| 亚洲黄色尤物视频| 亚洲图片自拍偷拍| 亚洲成a人片在线观看中文| 亚洲成人午夜影院| 日韩精品福利网| 久久国产精品99久久久久久老狼 | 国产精品久久国产精麻豆99网站| 欧美精品一区二区在线播放| 精品人在线二区三区| 精品对白一区国产伦| 久久久国产午夜精品| 中文在线资源观看网站视频免费不卡| 国产午夜精品久久久久久免费视 | 久久青草国产手机看片福利盒子| 日韩精品一区在线观看| 久久久久国产免费免费| 中文字幕日本乱码精品影院| 亚洲曰韩产成在线| 免费观看日韩av| 国产一区二区免费看| 成人免费毛片aaaaa**| 色爱区综合激月婷婷| 欧美少妇bbb| 欧美成人一区二区三区在线观看| 久久综合丝袜日本网| 国产精品拍天天在线| 亚洲一区在线看| 精品一区二区三区不卡| 成人久久久精品乱码一区二区三区| 91在线视频播放地址| 69av一区二区三区| 久久久国产精华| 亚洲国产一区二区a毛片| 久久99久久久欧美国产| 99免费精品视频| 欧美酷刑日本凌虐凌虐| 国产喂奶挤奶一区二区三区| 亚洲欧美激情插| 免费成人你懂的| 99re6这里只有精品视频在线观看| 欧美日韩高清一区二区不卡| 久久久久久久久久久久电影| 亚洲视频一二三| 久久精品国产秦先生| 99久久久久久| 日韩欧美国产不卡| 亚洲四区在线观看| 久久99九九99精品| 91成人免费在线视频| 国产亚洲欧美色| 日韩精品亚洲专区| 91在线观看污| 日韩精品一区在线| 亚洲精品国产精华液| 国产麻豆欧美日韩一区| 欧美性生活一区| 国产精品高清亚洲| 寂寞少妇一区二区三区| 欧美这里有精品| 亚洲国产精品成人综合色在线婷婷| 亚洲超丰满肉感bbw| 99re8在线精品视频免费播放| 日韩欧美国产综合一区 | 精品亚洲porn| 欧美日韩二区三区| 亚洲男人天堂av网| 国产1区2区3区精品美女| 91.com视频| 一区二区国产视频| 高清国产一区二区三区| 精品久久久久一区二区国产| 亚洲电影一区二区三区| 99久久精品情趣| 国产欧美精品日韩区二区麻豆天美| 丝袜亚洲另类欧美| 91黄色小视频| 亚洲色图.com| 不卡高清视频专区| 欧美国产综合色视频| 精品一区二区三区免费视频| 6080午夜不卡| 偷拍一区二区三区| 欧洲精品一区二区三区在线观看| 国产精品色一区二区三区| 国产精品一品二品| 337p粉嫩大胆噜噜噜噜噜91av| 午夜久久久影院| 欧美精品一区二区三区蜜臀| 午夜影院久久久| 欧美日韩一区成人| 亚洲国产日韩精品| 欧美视频在线观看一区二区| 亚洲精品国产精华液| 一本色道久久综合亚洲91| 亚洲欧洲成人自拍| 一本一本久久a久久精品综合麻豆| 最新不卡av在线| 99国产精品久久久久久久久久 | 久久久亚洲精品石原莉奈| 激情图区综合网| 久久夜色精品一区| 成人性视频免费网站| 国产精品的网站| 91精品91久久久中77777| 亚洲一二三四在线观看| 欧美专区日韩专区| 日韩精品视频网| 精品国产三级电影在线观看| 国产一区二区不卡在线| 日本一区二区三区在线观看| 丰满放荡岳乱妇91ww| 亚洲欧美在线观看| 在线中文字幕一区| 日本不卡一区二区三区| 日韩精品一区二区三区中文精品| 黄色资源网久久资源365| 中文字幕欧美激情一区| 色综合网站在线| 午夜亚洲国产au精品一区二区| 这里只有精品99re| 国产在线不卡视频| **欧美大码日韩| 欧美伦理影视网| 久久99精品国产.久久久久| 国产日韩影视精品| 欧洲一区在线观看| 久久99精品国产.久久久久| 中文av字幕一区| 欧美日韩美女一区二区| 久久99最新地址| 中文字幕一区二区三| 欧美日韩国产乱码电影| 狠狠色综合播放一区二区| 欧美国产综合色视频| 91视频com| 最新高清无码专区| 69p69国产精品| 成人手机电影网| 亚洲午夜视频在线观看| 久久色视频免费观看| 91在线观看下载| 捆绑调教一区二区三区| 亚洲欧洲国产日韩| 日韩一区二区电影| 99国产精品一区| 久久精品国产99| 亚洲一区二区偷拍精品| 久久欧美中文字幕| 欧美日本国产一区| 99久久久久免费精品国产| 麻豆91在线观看| 一区二区免费在线播放| 久久久久久久久久久电影| 欧美精品九九99久久| 成人国产精品视频| 免费久久精品视频| 亚洲精品日日夜夜| 久久精品夜色噜噜亚洲a∨| 欧美亚洲国产一区二区三区va| 国产一区二区三区四区五区入口| 亚洲一区二区偷拍精品| 国产清纯在线一区二区www| 欧美久久婷婷综合色| 91女厕偷拍女厕偷拍高清| 国内精品视频一区二区三区八戒 | 黄页网站大全一区二区| 亚洲国产精品一区二区www在线| 中文字幕免费观看一区| 精品美女一区二区三区| 欧美日韩三级在线| 色综合亚洲欧洲| 成人免费视频视频| 精品伊人久久久久7777人| 亚洲一线二线三线久久久| 国产精品狼人久久影院观看方式| 日韩欧美不卡一区| 欧美日韩成人一区| 在线精品观看国产| 99国产精品国产精品毛片| 国产一区二区三区蝌蚪| 蜜臀av一级做a爰片久久| 亚洲最新视频在线观看| 久久精品免视看| 亚洲精品一线二线三线无人区| 欧美男女性生活在线直播观看| 不卡的av电影| 成人av影视在线观看| 国产xxx精品视频大全| 国产最新精品免费| 国产一区二区中文字幕| 久久99国产精品久久| 九一九一国产精品| 精品一二三四在线|