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

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

?? os_flag.c

?? OS : ucos-2 Target : MSP430
?? C
?? 第 1 頁 / 共 4 頁
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                         EVENT FLAG  MANAGEMENT
*
*                              (c) Copyright 1992-2007, Micrium, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_FLAG.C
* By      : Jean J. Labrosse
* Version : V2.86
*
* LICENSING TERMS:
* ---------------
*   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
* If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
* its use in your product. We provide ALL the source code for your convenience and to help you experience 
* uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
* licensing fee.
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include <ucos_ii.h>
#endif

#if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
/*
*********************************************************************************************************
*                                            LOCAL PROTOTYPES
*********************************************************************************************************
*/

static  void     OS_FlagBlock(OS_FLAG_GRP *pgrp, OS_FLAG_NODE *pnode, OS_FLAGS flags, INT8U wait_type, INT16U timeout);
static  BOOLEAN  OS_FlagTaskRdy(OS_FLAG_NODE *pnode, OS_FLAGS flags_rdy);

/*$PAGE*/
/*
*********************************************************************************************************
*                              CHECK THE STATUS OF FLAGS IN AN EVENT FLAG GROUP
*
* Description: This function is called to check the status of a combination of bits to be set or cleared
*              in an event flag group.  Your application can check for ANY bit to be set/cleared or ALL
*              bits to be set/cleared.
*
*              This call does not block if the desired flags are not present.
*
* 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 check.
*                            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/cleared or ANY of the bits
*                            to be set/cleared.
*                            You can specify the following argument:
*
*                            OS_FLAG_WAIT_CLR_ALL   You will check ALL bits in 'flags' to be clear (0)
*                            OS_FLAG_WAIT_CLR_ANY   You will check ANY bit  in 'flags' to be clear (0)
*                            OS_FLAG_WAIT_SET_ALL   You will check ALL bits in 'flags' to be set   (1)
*                            OS_FLAG_WAIT_SET_ANY   You will check ANY bit  in 'flags' 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
*
*              perr          is a pointer to an error code and can be:
*                            OS_ERR_NONE               No error
*                            OS_ERR_EVENT_TYPE         You are not pointing to an event flag group
*                            OS_ERR_FLAG_WAIT_TYPE     You didn't specify a proper 'wait_type' argument.
*                            OS_ERR_FLAG_INVALID_PGRP  You passed a NULL pointer instead of the event flag
*                                                      group handle.
*                            OS_ERR_FLAG_NOT_RDY       The desired flags you are waiting for are not
*                                                      available.
*
* Returns    : The flags in the event flag group that made the task ready or, 0 if a timeout or an error
*              occurred.
*
* Called from: Task or ISR
*
* Note(s)    : 1) IMPORTANT, the behavior of this function has changed from PREVIOUS versions.  The
*                 function NOW returns the flags that were ready INSTEAD of the current state of the
*                 event flags.
*********************************************************************************************************
*/

#if OS_FLAG_ACCEPT_EN > 0
OS_FLAGS  OSFlagAccept (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT8U *perr)
{
    OS_FLAGS      flags_rdy;
    INT8U         result;
    BOOLEAN       consume;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR     cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {                              /* Validate 'perr'                          */
        return ((OS_FLAGS)0);
    }
    if (pgrp == (OS_FLAG_GRP *)0) {                        /* Validate 'pgrp'                          */
        *perr = OS_ERR_FLAG_INVALID_PGRP;
        return ((OS_FLAGS)0);
    }
#endif
    if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {          /* Validate event block type                */
        *perr = OS_ERR_EVENT_TYPE;
        return ((OS_FLAGS)0);
    }
    result = (INT8U)(wait_type & OS_FLAG_CONSUME);
    if (result != (INT8U)0) {                              /* See if we need to consume the flags      */
        wait_type &= ~OS_FLAG_CONSUME;
        consume    = OS_TRUE;
    } else {
        consume    = OS_FALSE;
    }
/*$PAGE*/
    *perr = OS_ERR_NONE;                                   /* Assume NO error until proven otherwise.  */
    OS_ENTER_CRITICAL();
    switch (wait_type) {
        case OS_FLAG_WAIT_SET_ALL:                         /* See if all required flags are set        */
             flags_rdy = (OS_FLAGS)(pgrp->OSFlagFlags & flags);     /* Extract only the bits we want   */
             if (flags_rdy == flags) {                     /* Must match ALL the bits that we want     */
                 if (consume == OS_TRUE) {                 /* See if we need to consume the flags      */
                     pgrp->OSFlagFlags &= ~flags_rdy;      /* Clear ONLY the flags that we wanted      */
                 }
             } else {
                 *perr = OS_ERR_FLAG_NOT_RDY;
             }
             OS_EXIT_CRITICAL();
             break;

        case OS_FLAG_WAIT_SET_ANY:
             flags_rdy = (OS_FLAGS)(pgrp->OSFlagFlags & flags);     /* Extract only the bits we want   */
             if (flags_rdy != (OS_FLAGS)0) {               /* See if any flag set                      */
                 if (consume == OS_TRUE) {                 /* See if we need to consume the flags      */
                     pgrp->OSFlagFlags &= ~flags_rdy;      /* Clear ONLY the flags that we got         */
                 }
             } else {
                 *perr = OS_ERR_FLAG_NOT_RDY;
             }
             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 = (OS_FLAGS)(~pgrp->OSFlagFlags & flags);  /* Extract only the bits we want     */
             if (flags_rdy == flags) {                     /* Must match ALL the bits that we want     */
                 if (consume == OS_TRUE) {                 /* See if we need to consume the flags      */
                     pgrp->OSFlagFlags |= flags_rdy;       /* Set ONLY the flags that we wanted        */
                 }
             } else {
                 *perr = OS_ERR_FLAG_NOT_RDY;
             }
             OS_EXIT_CRITICAL();
             break;

        case OS_FLAG_WAIT_CLR_ANY:
             flags_rdy = (OS_FLAGS)(~pgrp->OSFlagFlags & flags); /* Extract only the bits we want      */
             if (flags_rdy != (OS_FLAGS)0) {               /* See if any flag cleared                  */
                 if (consume == OS_TRUE) {                 /* See if we need to consume the flags      */
                     pgrp->OSFlagFlags |= flags_rdy;       /* Set ONLY the flags that we got           */
                 }
             } else {
                 *perr = OS_ERR_FLAG_NOT_RDY;
             }
             OS_EXIT_CRITICAL();
             break;
#endif

        default:
             OS_EXIT_CRITICAL();
             flags_rdy = (OS_FLAGS)0;
             *perr     = OS_ERR_FLAG_WAIT_TYPE;
             break;
    }
    return (flags_rdy);
}
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                           CREATE AN EVENT FLAG
*
* Description: This function is called to create an event flag group.
*
* Arguments  : flags         Contains the initial value to store in the event flag group.
*
*              perr          is a pointer to an error code which will be returned to your application:
*                               OS_ERR_NONE               if the call was successful.
*                               OS_ERR_CREATE_ISR         if you attempted to create an Event Flag from an
*                                                         ISR.
*                               OS_ERR_FLAG_GRP_DEPLETED  if there are no more event flag groups
*
* Returns    : A pointer to an event flag group or a NULL pointer if no more groups are available.
*
* Called from: Task ONLY
*********************************************************************************************************
*/

OS_FLAG_GRP  *OSFlagCreate (OS_FLAGS flags, INT8U *perr)
{
    OS_FLAG_GRP *pgrp;
#if OS_CRITICAL_METHOD == 3                         /* Allocate storage for CPU status register        */
    OS_CPU_SR    cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {                       /* Validate 'perr'                                 */
        return ((OS_FLAG_GRP *)0);
    }
#endif
    if (OSIntNesting > 0) {                         /* See if called from ISR ...                      */
        *perr = OS_ERR_CREATE_ISR;                  /* ... can't CREATE from an ISR                    */
        return ((OS_FLAG_GRP *)0);
    }
    OS_ENTER_CRITICAL();
    pgrp = OSFlagFreeList;                          /* Get next free event flag                        */
    if (pgrp != (OS_FLAG_GRP *)0) {                 /* See if we have event flag groups available      */
                                                    /* Adjust free list                                */
        OSFlagFreeList       = (OS_FLAG_GRP *)OSFlagFreeList->OSFlagWaitList;
        pgrp->OSFlagType     = OS_EVENT_TYPE_FLAG;  /* Set to event flag group type                    */
        pgrp->OSFlagFlags    = flags;               /* Set to desired initial value                    */
        pgrp->OSFlagWaitList = (void *)0;           /* Clear list of tasks waiting on flags            */
#if OS_FLAG_NAME_SIZE > 1
        pgrp->OSFlagName[0]  = '?';
        pgrp->OSFlagName[1]  = OS_ASCII_NUL;
#endif
        OS_EXIT_CRITICAL();
        *perr                = OS_ERR_NONE;
    } else {
        OS_EXIT_CRITICAL();
        *perr                = OS_ERR_FLAG_GRP_DEPLETED;
    }
    return (pgrp);                                  /* Return pointer to event flag group              */
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                     DELETE AN EVENT FLAG GROUP
*
* Description: This function deletes an event flag group and readies all tasks pending on the event flag
*              group.
*
* Arguments  : pgrp          is a pointer to the desired event flag group.
*
*              opt           determines delete options as follows:
*                            opt == OS_DEL_NO_PEND   Deletes the event flag group ONLY if no task pending
*                            opt == OS_DEL_ALWAYS    Deletes the event flag group even if tasks are
*                                                    waiting.  In this case, all the tasks pending will be
*                                                    readied.
*
*              perr          is a pointer to an error code that can contain one of the following values:
*                            OS_ERR_NONE               The call was successful and the event flag group was
*                                                      deleted
*                            OS_ERR_DEL_ISR            If you attempted to delete the event flag group from
*                                                      an ISR
*                            OS_ERR_FLAG_INVALID_PGRP  If 'pgrp' is a NULL pointer.
*                            OS_ERR_EVENT_TYPE         If you didn't pass a pointer to an event flag group
*                            OS_ERR_INVALID_OPT        An invalid option was specified
*                            OS_ERR_TASK_WAITING       One or more tasks were waiting on the event flag
*                                                      group.
*
* Returns    : pgrp          upon error
*              (OS_EVENT *)0 if the event flag group was successfully deleted.
*
* Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
*                 the event flag group MUST check the return code of OSFlagAccept() and OSFlagPend().
*              2) This call can potentially disable interrupts for a long time.  The interrupt disable
*                 time is directly proportional to the number of tasks waiting on the event flag group.
*********************************************************************************************************
*/

#if OS_FLAG_DEL_EN > 0
OS_FLAG_GRP  *OSFlagDel (OS_FLAG_GRP *pgrp, INT8U opt, INT8U *perr)
{
    BOOLEAN       tasks_waiting;
    OS_FLAG_NODE *pnode;
    OS_FLAG_GRP  *pgrp_return;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR     cpu_sr = 0;
#endif


?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩高清不卡在线| 一区二区三区中文字幕电影 | 一区二区三区av电影 | 国产精品一二三四| 91日韩一区二区三区| 精品国产一区二区精华| 一区二区欧美精品| 国产成人精品免费在线| 日韩三级高清在线| 亚洲va欧美va人人爽| 91小视频免费观看| 久久精品无码一区二区三区| 午夜精品久久久久久久久| 99精品久久99久久久久| 久久免费偷拍视频| 麻豆91免费观看| 欧美精品一级二级三级| 一区二区三区四区蜜桃| 99国产精品国产精品毛片| 国产偷国产偷精品高清尤物| 免费美女久久99| 欧美一卡二卡三卡| 青青草97国产精品免费观看无弹窗版 | 亚洲欧美一区二区视频| 国产一区二区美女| 制服.丝袜.亚洲.中文.综合| 亚洲成人中文在线| 欧美三级电影一区| 亚洲mv在线观看| 欧美日韩精品免费| 日本在线播放一区二区三区| 欧美久久久久久久久久| 亚洲国产精品麻豆| 欧美年轻男男videosbes| 亚洲h动漫在线| 国产片一区二区| 国产成人免费视频| 国产精品进线69影院| 成人一二三区视频| 最新日韩av在线| 91麻豆精品秘密| 亚洲一区二区三区视频在线播放 | 欧美精品123区| 天天色天天爱天天射综合| 欧美一区二区三区视频在线观看| 日本免费新一区视频| 欧美一级片在线| 国产一区二区网址| 中文字幕av在线一区二区三区| 成人一区二区三区在线观看| ...av二区三区久久精品| 欧美亚洲一区三区| 青青草国产精品97视觉盛宴| 欧美丝袜丝nylons| 亚洲成人综合在线| 久久精品国内一区二区三区| 一本到高清视频免费精品| 亚洲午夜免费电影| 日韩欧美高清dvd碟片| 国产成人av电影在线| 成人免费一区二区三区在线观看| 在线观看免费成人| 欧美日韩中文国产| 日本欧美一区二区三区| 国产日韩一级二级三级| 欧美制服丝袜第一页| 国产毛片一区二区| 亚洲免费色视频| 欧美成va人片在线观看| 99国内精品久久| 美女网站一区二区| 最新热久久免费视频| 欧美一区二区在线视频| 成人丝袜高跟foot| 日本中文在线一区| 最新日韩在线视频| 欧美日韩高清在线播放| 亚洲精品成人天堂一二三| 激情欧美一区二区| 国产精品入口麻豆九色| 欧美日韩免费一区二区三区| 国产成人av电影在线观看| 亚洲成av人片| 国产精品九色蝌蚪自拍| 欧美电视剧在线看免费| 在线观看av一区| 高清成人免费视频| 蜜臀av一级做a爰片久久| 国产精品国产精品国产专区不片| 欧美一级免费观看| 一本色道综合亚洲| 国产高清精品网站| 麻豆中文一区二区| 午夜欧美视频在线观看| 亚洲视频免费观看| 国产精品色一区二区三区| 欧美mv日韩mv国产网站| 欧美日韩视频一区二区| 色狠狠综合天天综合综合| 成人免费观看av| 捆绑紧缚一区二区三区视频| 亚洲1区2区3区4区| 夜夜精品视频一区二区| 最新热久久免费视频| 欧美国产一区在线| 久久人人超碰精品| 精品国产91亚洲一区二区三区婷婷 | 日韩在线一区二区三区| 亚洲男帅同性gay1069| 国产精品进线69影院| 中文字幕欧美激情| 日本一区二区久久| 国产精品青草综合久久久久99| 国产亚洲欧美一级| 国产免费观看久久| 国产精品女主播av| 国产精品久久看| 亚洲精选视频免费看| 亚洲免费色视频| 亚洲www啪成人一区二区麻豆| 亚洲综合激情小说| 丝袜诱惑亚洲看片| 免费在线视频一区| 国产精品一卡二| aaa欧美色吧激情视频| 一本大道久久a久久精品综合| 色哟哟国产精品| 欧美日韩精品免费| 精品国产一区二区三区av性色| 亚洲精品一区二区三区福利| 国产人成一区二区三区影院| 裸体健美xxxx欧美裸体表演| 日韩av成人高清| 欧美zozo另类异族| 欧美xingq一区二区| 精品国产欧美一区二区| 亚洲国产日韩精品| 蜜桃av一区二区在线观看| 国产一区二区在线电影| 成人动漫av在线| 欧美在线观看一区| 精品国产sm最大网站免费看| 中文字幕精品—区二区四季| 亚洲精品乱码久久久久久久久| 亚洲超丰满肉感bbw| 韩国av一区二区三区在线观看| 暴力调教一区二区三区| 欧美性videosxxxxx| 日韩久久精品一区| 亚洲男女一区二区三区| 日韩国产高清影视| 成人高清视频在线| 在线播放视频一区| 国产精品麻豆欧美日韩ww| 图片区日韩欧美亚洲| 国产一区91精品张津瑜| 色婷婷亚洲精品| 国产亚洲人成网站| 日韩高清一区二区| 99精品欧美一区二区蜜桃免费 | 久久在线观看免费| 一区二区三区视频在线看| 久久精品国产亚洲高清剧情介绍| jlzzjlzz国产精品久久| 亚洲精品一线二线三线无人区| 怡红院av一区二区三区| 另类小说综合欧美亚洲| 色欧美日韩亚洲| 久久蜜桃一区二区| 日韩高清不卡一区二区三区| jlzzjlzz亚洲日本少妇| www国产精品av| 午夜av电影一区| 一本久久a久久免费精品不卡| 久久综合色之久久综合| 亚洲一区二区在线观看视频| 国产91精品入口| 欧美日韩精品一区二区三区四区| 亚洲一区二区三区中文字幕在线| 亚洲国产wwwccc36天堂| 日韩国产在线观看| 色综合一区二区| 中文字幕欧美日韩一区| 韩国女主播成人在线| 欧美日韩精品是欧美日韩精品| 综合久久综合久久| 东方欧美亚洲色图在线| 久久综合久久99| 色综合久久久久久久| 中文字幕一区av| 成人永久aaa| 国产日韩亚洲欧美综合| 黄色日韩网站视频| 2021久久国产精品不只是精品| 日本免费新一区视频| 欧美一区二区黄色| 老司机免费视频一区二区| 精品毛片乱码1区2区3区| 毛片av一区二区| 久久久久99精品一区|