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

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

?? os_flag.c

?? 學習UCOSII的很好的例子!!ARM部分實例包括ADS1.2工程和IAR4.40工程兩部分。 請將examples文件夾復制到硬盤根目錄下
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                         EVENT FLAG  MANAGEMENT
*
*                          (c) Copyright 2001-2002, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_FLAG.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "INCLUDES.H"
#endif

#if (OS_VERSION >= 251) && (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
*
*              err           is a pointer to an error code and can be:
*                            OS_NO_ERR              No error
*                            OS_ERR_EVENT_TYPE      You are not pointing to an event flag group
*                            OS_FLAG_ERR_WAIT_TYPE  You didn't specify a proper 'wait_type' argument.
*                            OS_FLAG_INVALID_PGRP   You passed a NULL pointer instead of the event flag
*                                                   group handle.
*                            OS_FLAG_ERR_NOT_RDY    The desired flags you are waiting for are not
*                                                   available.
*
* Returns    : The state of the flags in the event flag group.
*
* Called from: Task or ISR
*********************************************************************************************************
*/

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


#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*/
    *err = OS_NO_ERR;                                      /* 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 = 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      */
                 }
             } else {
                 *err  = OS_FLAG_ERR_NOT_RDY;
             }
             flags_cur = pgrp->OSFlagFlags;                /* Will return the state of the group       */
             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         */
                 }
             } else {
                 *err  = OS_FLAG_ERR_NOT_RDY;
             }
             flags_cur = pgrp->OSFlagFlags;                /* Will return the state of the group       */
             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        */
                 }
             } else {
                 *err  = OS_FLAG_ERR_NOT_RDY;
             }
             flags_cur = pgrp->OSFlagFlags;                /* Will return the state of the group       */
             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           */
                 }
             } else {
                 *err  = OS_FLAG_ERR_NOT_RDY;
             }
             flags_cur = pgrp->OSFlagFlags;                /* Will return the state of the group       */
             OS_EXIT_CRITICAL();
             break;
#endif

        default:
             OS_EXIT_CRITICAL();
             flags_cur = (OS_FLAGS)0;
             *err      = OS_FLAG_ERR_WAIT_TYPE;
             break;
    }
    return (flags_cur);
}
#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.
*
*              err           is a pointer to an error code which will be returned to your application:
*                               OS_NO_ERR                if the call was successful.
*                               OS_ERR_CREATE_ISR        if you attempted to create an Event Flag from an
*                                                        ISR.
*                               OS_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 *err)
{
#if OS_CRITICAL_METHOD == 3                         /* Allocate storage for CPU status register        */
    OS_CPU_SR    cpu_sr;
#endif
    OS_FLAG_GRP *pgrp;


    if (OSIntNesting > 0) {                         /* See if called from ISR ...                      */
        *err = 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            */
        OS_EXIT_CRITICAL();
        *err                 = OS_NO_ERR;
    } else {
        OS_EXIT_CRITICAL();
        *err                 = OS_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.
*
*              err           is a pointer to an error code that can contain one of the following values:
*                            OS_NO_ERR               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_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    : pevent        upon error
*              (OS_EVENT *)0 if the semaphore 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 *err)
{
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR     cpu_sr;
#endif
    BOOLEAN       tasks_waiting;
    OS_FLAG_NODE *pnode;


    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return (pgrp);
    }
#if OS_ARG_CHK_EN > 0
    if (pgrp == (OS_FLAG_GRP *)0) {                        /* Validate 'pgrp'                          */
        *err = OS_FLAG_INVALID_PGRP;
        return (pgrp);
    }
    if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {          /* Validate event group type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pgrp);
    }
#endif
    OS_ENTER_CRITICAL();
    if (pgrp->OSFlagWaitList != (void *)0) {               /* See if any tasks waiting on event flags  */
        tasks_waiting = TRUE;                              /* Yes                                      */
    } else {
        tasks_waiting = FALSE;                             /* No                                       */
    }
    switch (opt) {
        case OS_DEL_NO_PEND:                               /* Delete group if no task waiting          */
             if (tasks_waiting == FALSE) {
                 pgrp->OSFlagType     = OS_EVENT_TYPE_UNUSED;
                 pgrp->OSFlagWaitList = (void *)OSFlagFreeList; /* Return group to free list           */
                 OSFlagFreeList       = pgrp;
                 OS_EXIT_CRITICAL();
                 *err                 = OS_NO_ERR;
                 return ((OS_FLAG_GRP *)0);                /* Event Flag Group has been deleted        */
             } else {
                 OS_EXIT_CRITICAL();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩久久久久久| 亚洲精品五月天| 亚洲丝袜精品丝袜在线| 午夜av一区二区三区| 成人黄色一级视频| 日韩亚洲国产中文字幕欧美| 亚洲综合一区在线| 成人禁用看黄a在线| 欧美大片国产精品| 婷婷国产在线综合| 色国产综合视频| 国产视频不卡一区| 免费av成人在线| 欧美综合视频在线观看| 中文字幕人成不卡一区| 国产成人在线色| 日韩精品中文字幕一区| 日韩精品一二区| 欧美日韩一卡二卡| 一区二区理论电影在线观看| 成人午夜视频免费看| 久久久亚洲精华液精华液精华液| 男男视频亚洲欧美| 日韩欧美在线不卡| 日产欧产美韩系列久久99| 欧美无人高清视频在线观看| 亚洲欧美视频在线观看视频| bt7086福利一区国产| 欧美精彩视频一区二区三区| 国产激情精品久久久第一区二区| 精品国产乱码久久久久久影片| 美女在线一区二区| 日韩视频一区二区三区在线播放| 日本伊人午夜精品| 日韩欧美一区电影| 久久99久国产精品黄毛片色诱| 制服丝袜日韩国产| 免费在线成人网| 欧美刺激脚交jootjob| 精品午夜久久福利影院| 久久久久久久久久久久电影| 国产一区二区三区在线看麻豆| 久久中文娱乐网| 国产91精品精华液一区二区三区| 国产精品久久久久影院老司| 99综合影院在线| 一区二区三区四区在线播放 | 欧美一区中文字幕| 日本欧美一区二区| 久久影音资源网| 国产91在线观看| 亚洲精品v日韩精品| 欧美日韩国产综合一区二区| 免费观看久久久4p| 国产视频亚洲色图| 在线看日本不卡| 久久国产精品72免费观看| 国产日产欧美精品一区二区三区| 91小视频免费观看| 亚洲福利视频一区二区| 日韩精品资源二区在线| 成人va在线观看| 亚洲午夜激情av| 久久久久久久久久久久久夜| 91丝袜美腿高跟国产极品老师| 午夜在线成人av| 国产欧美日韩麻豆91| 在线观看视频欧美| 国产真实乱子伦精品视频| 亚洲少妇中出一区| 欧美成人video| 91在线丨porny丨国产| 老司机精品视频一区二区三区| 国产精品久久久久久久久久免费看| 91久久精品一区二区| 国产永久精品大片wwwapp| 亚洲手机成人高清视频| 亚洲精品在线免费播放| 色综合久久久久网| 国产乱码精品一区二区三| 一区二区三区在线免费观看| 精品福利一区二区三区| 99精品欧美一区二区三区综合在线| 日韩精品亚洲一区二区三区免费| 国产精品久久三区| 日韩精品一区二区三区在线观看 | 国产真实乱偷精品视频免| 亚洲美女精品一区| 久久精品欧美日韩精品| 日韩一级高清毛片| 欧美日韩免费在线视频| av不卡一区二区三区| 国精产品一区一区三区mba桃花| 亚洲国产精品久久人人爱蜜臀| 中文一区二区在线观看| 欧美大片日本大片免费观看| 欧美体内she精高潮| av激情成人网| 国产在线视频一区二区| 日本网站在线观看一区二区三区| 亚洲麻豆国产自偷在线| 国产欧美精品区一区二区三区 | 国产精品一区二区果冻传媒| 午夜精品一区二区三区三上悠亚| 《视频一区视频二区| 久久久久亚洲蜜桃| 2014亚洲片线观看视频免费| 日韩精品一区二| 欧美精品视频www在线观看| 欧美中文字幕一区二区三区| 色悠久久久久综合欧美99| 99久久99久久久精品齐齐| 成人免费毛片片v| 国产成人午夜精品影院观看视频 | 国产欧美一区二区精品仙草咪| 日韩一本二本av| 欧美电影精品一区二区| 日韩一区二区三区免费看| 日韩一区二区三| 26uuu国产日韩综合| 日韩欧美国产成人一区二区| 欧美mv和日韩mv的网站| 精品美女一区二区| www国产亚洲精品久久麻豆| 久久久精品免费网站| 国产色91在线| 亚洲欧美自拍偷拍色图| 亚洲六月丁香色婷婷综合久久| 亚洲精品va在线观看| 亚洲成av人综合在线观看| 天天操天天干天天综合网| 免费成人美女在线观看.| 国产伦理精品不卡| 成人天堂资源www在线| 91久久精品日日躁夜夜躁欧美| 欧美日韩国产免费| 欧美电影免费观看高清完整版| 久久天堂av综合合色蜜桃网| 国产精品美女一区二区在线观看| 亚洲日本成人在线观看| 亚洲v精品v日韩v欧美v专区| 精品一区二区三区免费视频| 国产成人亚洲综合a∨婷婷| 日本久久精品电影| 精品国偷自产国产一区| 国产精品理伦片| 日本不卡在线视频| 处破女av一区二区| 欧美日韩色一区| 国产欧美精品日韩区二区麻豆天美| 亚洲天堂av老司机| 蜜桃一区二区三区四区| 在线观看91精品国产麻豆| 一本到不卡精品视频在线观看| 国产精品视频一区二区三区不卡| 日韩精品最新网址| 欧美国产丝袜视频| 亚洲午夜在线视频| 狠狠色狠狠色合久久伊人| 国产一区二区0| 91超碰这里只有精品国产| 精品国产一区二区三区av性色| 国产亚洲一区字幕| 亚洲一区在线电影| 国产成人av一区| 一区二区三区在线视频观看58| 久久久久国产精品免费免费搜索| 亚洲精品免费播放| 国产精品夜夜爽| 7777精品伊人久久久大香线蕉的 | 亚洲精品视频免费看| 激情另类小说区图片区视频区| 欧美无乱码久久久免费午夜一区 | 一区二区三区四区乱视频| 国产精品资源在线| 欧美电影影音先锋| 亚洲视频小说图片| 国产麻豆午夜三级精品| 日韩午夜三级在线| 亚洲国产一区二区三区青草影视| 成人午夜免费电影| 精品电影一区二区三区| 蜜臀久久99精品久久久画质超高清 | 777a∨成人精品桃花网| 亚洲免费成人av| 91在线云播放| 国产精品毛片久久久久久久| 国产寡妇亲子伦一区二区| 欧美成人福利视频| 日本视频一区二区三区| 制服丝袜中文字幕一区| 香蕉成人啪国产精品视频综合网| 色爱区综合激月婷婷| 综合久久久久久| 91麻豆文化传媒在线观看| 亚洲特黄一级片| 91福利国产成人精品照片| 亚洲综合视频在线| 欧美色图在线观看| 婷婷开心久久网|