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

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

?? os_q.c

?? 基于GE00 實驗系統(tǒng)開發(fā)板的實驗指導用途
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_Q.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.h"
#endif

#if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
/*
*********************************************************************************************************
*                                      ACCEPT MESSAGE FROM QUEUE
*
* Description: This function checks the queue to see if a message is available.  Unlike OSQPend(),
*              OSQAccept() does not suspend the calling task if a message is not available.
*
* Arguments  : pevent        is a pointer to the event control block
*
*              err           is a pointer to where an error message will be deposited.  Possible error
*                            messages are:
*
*                            OS_NO_ERR           The call was successful and your task received a
*                                                message.
*                            OS_ERR_EVENT_TYPE   You didn't pass a pointer to a queue
*                            OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer
*                            OS_Q_EMPTY          The queue did not contain any messages
*
* Returns    : != (void *)0  is the message in the queue if one is available.  The message is removed
*                            from the so the next time OSQAccept() is called, the queue will contain
*                            one less entry.
*              == (void *)0  if you received a NULL pointer message
*                            if the queue is empty or,
*                            if 'pevent' is a NULL pointer or,
*                            if you passed an invalid event type
*
* Note(s)    : As of V2.60, you can now pass NULL pointers through queues.  Because of this, the argument
*              'err' has been added to the API to tell you about the outcome of the call.
*********************************************************************************************************
*/

#if OS_Q_ACCEPT_EN > 0
void  *OSQAccept (OS_EVENT *pevent, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif
    void      *msg;
    OS_Q      *pq;


#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {               /* Validate 'pevent'                                  */
        *err = OS_ERR_PEVENT_NULL;
        return ((void *)0);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type                          */
        *err = OS_ERR_EVENT_TYPE;
        return ((void *)0);
    }
    OS_ENTER_CRITICAL();
    pq = (OS_Q *)pevent->OSEventPtr;             /* Point at queue control block                       */
    if (pq->OSQEntries > 0) {                    /* See if any messages in the queue                   */
        msg = *pq->OSQOut++;                     /* Yes, extract oldest message from the queue         */
        pq->OSQEntries--;                        /* Update the number of entries in the queue          */
        if (pq->OSQOut == pq->OSQEnd) {          /* Wrap OUT pointer if we are at the end of the queue */
            pq->OSQOut = pq->OSQStart;
        }
        *err = OS_NO_ERR;
    } else {
        *err = OS_Q_EMPTY;
        msg  = (void *)0;                        /* Queue is empty                                     */
    }
    OS_EXIT_CRITICAL();
    return (msg);                                /* Return message received (or NULL)                  */
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                        CREATE A MESSAGE QUEUE
*
* Description: This function creates a message queue if free event control blocks are available.
*
* Arguments  : start         is a pointer to the base address of the message queue storage area.  The
*                            storage area MUST be declared as an array of pointers to 'void' as follows
*
*                            void *MessageStorage[size]
*
*              size          is the number of elements in the storage area
*
* Returns    : != (OS_EVENT *)0  is a pointer to the event control clock (OS_EVENT) associated with the
*                                created queue
*              == (OS_EVENT *)0  if no event control blocks were available or an error was detected
*********************************************************************************************************
*/

OS_EVENT  *OSQCreate (void **start, INT16U size)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif
    OS_EVENT  *pevent;
    OS_Q      *pq;


    if (OSIntNesting > 0) {                      /* See if called from ISR ...                         */
        return ((OS_EVENT *)0);                  /* ... can't CREATE from an ISR                       */
    }
    OS_ENTER_CRITICAL();
    pevent = OSEventFreeList;                    /* Get next free event control block                  */
    if (OSEventFreeList != (OS_EVENT *)0) {      /* See if pool of free ECB pool was empty             */
        OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
    }
    OS_EXIT_CRITICAL();
    if (pevent != (OS_EVENT *)0) {               /* See if we have an event control block              */
        OS_ENTER_CRITICAL();
        pq = OSQFreeList;                        /* Get a free queue control block                     */
        if (pq != (OS_Q *)0) {                   /* Were we able to get a queue control block ?        */
            OSQFreeList         = OSQFreeList->OSQPtr;    /* Yes, Adjust free list pointer to next free*/
            OS_EXIT_CRITICAL();
            pq->OSQStart        = start;                  /*      Initialize the queue                 */
            pq->OSQEnd          = &start[size];
            pq->OSQIn           = start;
            pq->OSQOut          = start;
            pq->OSQSize         = size;
            pq->OSQEntries      = 0;
            pevent->OSEventType = OS_EVENT_TYPE_Q;
            pevent->OSEventCnt  = 0;
            pevent->OSEventPtr  = pq;
#if OS_EVENT_NAME_SIZE > 0
            (void)strcpy(pevent->OSEventName, "?");
#endif
            OS_EventWaitListInit(pevent);                 /*      Initalize the wait list              */
        } else {
            pevent->OSEventPtr = (void *)OSEventFreeList; /* No,  Return event control block on error  */
            OSEventFreeList    = pevent;
            OS_EXIT_CRITICAL();
            pevent = (OS_EVENT *)0;
        }
    }
    return (pevent);
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                        DELETE A MESSAGE QUEUE
*
* Description: This function deletes a message queue and readies all tasks pending on the queue.
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired
*                            queue.
*
*              opt           determines delete options as follows:
*                            opt == OS_DEL_NO_PEND   Delete the queue ONLY if no task pending
*                            opt == OS_DEL_ALWAYS    Deletes the queue 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 queue was deleted
*                            OS_ERR_DEL_ISR          If you tried to delete the queue from an ISR
*                            OS_ERR_INVALID_OPT      An invalid option was specified
*                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the queue
*                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a queue
*                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
*
* Returns    : pevent        upon error
*              (OS_EVENT *)0 if the queue was successfully deleted.
*
* Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
*                 the queue MUST check the return code of OSQPend().
*              2) OSQAccept() callers will not know that the intended queue has been deleted unless
*                 they check 'pevent' to see that it's a NULL pointer.
*              3) 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 queue.
*              4) Because ALL tasks pending on the queue will be readied, you MUST be careful in
*                 applications where the queue is used for mutual exclusion because the resource(s)
*                 will no longer be guarded by the queue.
*              5) If the storage for the message queue was allocated dynamically (i.e. using a malloc()
*                 type call) then your application MUST release the memory storage by call the counterpart
*                 call of the dynamic allocation scheme used.  If the queue storage was created statically
*                 then, the storage can be reused.
*********************************************************************************************************
*/

#if OS_Q_DEL_EN > 0
OS_EVENT  *OSQDel (OS_EVENT *pevent, 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_Q      *pq;


    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return ((OS_EVENT *)0);
    }
#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
        *err = OS_ERR_PEVENT_NULL;
        return (pevent);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
    OS_ENTER_CRITICAL();
    if (pevent->OSEventGrp != 0x00) {                      /* See if any tasks waiting on queue        */
        tasks_waiting = TRUE;                              /* Yes                                      */
    } else {
        tasks_waiting = FALSE;                             /* No                                       */
    }
    switch (opt) {
        case OS_DEL_NO_PEND:                               /* Delete queue only if no task waiting     */
             if (tasks_waiting == FALSE) {
#if OS_EVENT_NAME_SIZE > 0
                 (void)strcpy(pevent->OSEventName, "?");   /* Unknown name                             */
#endif
                 pq                  = (OS_Q *)pevent->OSEventPtr;  /* Return OS_Q to free list        */
                 pq->OSQPtr          = OSQFreeList;
                 OSQFreeList         = pq;
                 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
                 pevent->OSEventPtr  = OSEventFreeList;    /* Return Event Control Block to free list  */
                 pevent->OSEventCnt  = 0;
                 OSEventFreeList     = pevent;             /* Get next free event control block        */
                 OS_EXIT_CRITICAL();
                 *err                = OS_NO_ERR;
                 return ((OS_EVENT *)0);                   /* Queue has been deleted                   */
             } else {
                 OS_EXIT_CRITICAL();
                 *err                = OS_ERR_TASK_WAITING;
                 return (pevent);
             }

        case OS_DEL_ALWAYS:                                /* Always delete the queue                  */
             while (pevent->OSEventGrp != 0x00) {          /* Ready ALL tasks waiting for queue        */
                 OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q);
             }
#if OS_EVENT_NAME_SIZE > 0
             (void)strcpy(pevent->OSEventName, "?");       /* Unknown name                             */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色拍拍在线精品视频8848| 精品一区二区三区在线播放视频| 精品国精品国产| 欧美三级一区二区| 欧美人妇做爰xxxⅹ性高电影 | 麻豆国产欧美一区二区三区| 亚洲在线成人精品| 亚洲国产一区二区三区青草影视| 伊人色综合久久天天人手人婷| 亚洲色图都市小说| 亚洲欧美一区二区久久| 亚洲精品久久7777| 一区二区三区在线不卡| 亚洲制服丝袜一区| 日韩va亚洲va欧美va久久| 美女被吸乳得到大胸91| 精品一区二区三区影院在线午夜 | 蜜臀精品久久久久久蜜臀| 视频一区欧美日韩| 久久国内精品自在自线400部| 免费观看日韩电影| 国产麻豆欧美日韩一区| 成人理论电影网| 一本色道久久综合亚洲91 | 久久国产精品免费| 国产传媒欧美日韩成人| eeuss影院一区二区三区 | 日韩福利视频网| 韩国欧美国产1区| 成人av在线资源网| 欧美精品自拍偷拍| 久久久国产精品不卡| 亚洲天堂av老司机| 蜜桃精品在线观看| 91污在线观看| 日韩一区二区高清| 国产精品入口麻豆九色| 丝袜亚洲另类欧美| 丁香婷婷综合激情五月色| 欧洲国产伦久久久久久久| 日韩精品一区二区三区视频播放 | 精品国产91久久久久久久妲己| 欧美国产激情一区二区三区蜜月| 一区二区三区自拍| 国产精品一区不卡| 欧美日韩国产三级| 国产精品福利在线播放| 久久精品久久综合| 欧美午夜电影网| 国产精品国模大尺度视频| 青青草原综合久久大伊人精品优势| caoporn国产一区二区| 日韩免费高清av| 亚洲国产精品影院| 97成人超碰视| xfplay精品久久| 日韩电影一区二区三区四区| 99久久精品国产导航| 久久久久国产成人精品亚洲午夜| 五月天欧美精品| 一本大道av伊人久久综合| 亚洲国产成人在线| 国产剧情一区在线| 精品成人私密视频| 久久99精品久久只有精品| 欧美日韩久久久久久| 一区二区三区免费观看| 一本到不卡免费一区二区| 国产精品久久久久久亚洲毛片| 国产乱人伦精品一区二区在线观看| 欧美精品日韩精品| 天堂蜜桃91精品| 日韩三区在线观看| 激情五月播播久久久精品| 日韩久久免费av| 国产一区二区三区日韩| 久久婷婷国产综合国色天香| 免费欧美在线视频| 精品久久人人做人人爰| 精品一区二区三区不卡 | 国产成人午夜精品5599 | 亚洲欧美日韩在线不卡| 色偷偷久久人人79超碰人人澡| 亚洲日韩欧美一区二区在线| 成人成人成人在线视频| ㊣最新国产の精品bt伙计久久| jlzzjlzz欧美大全| 亚洲男同1069视频| 欧美调教femdomvk| 日韩电影在线看| 久久毛片高清国产| 不卡的电影网站| 亚洲宅男天堂在线观看无病毒| 欧美日韩中字一区| 美女视频网站黄色亚洲| 久久久久国色av免费看影院| gogogo免费视频观看亚洲一| 亚洲综合成人在线视频| 欧美一级片在线看| 国产伦精品一区二区三区视频青涩| 久久精品欧美日韩精品| 99久久精品情趣| 蜜臀av性久久久久蜜臀aⅴ | 日本不卡一区二区| 久久久久高清精品| 精品视频免费在线| 国产一区二区影院| 一区二区日韩电影| 久久久久青草大香线综合精品| av成人动漫在线观看| 日韩高清在线电影| 国产欧美一区二区精品久导航| 在线免费观看成人短视频| 麻豆免费精品视频| 亚洲六月丁香色婷婷综合久久| 日韩欧美色综合网站| 色婷婷综合中文久久一本| 麻豆91精品视频| 亚洲国产另类av| 亚洲欧洲精品天堂一级 | 91视频在线看| 紧缚奴在线一区二区三区| 136国产福利精品导航| 884aa四虎影成人精品一区| 国产成人av在线影院| 喷水一区二区三区| 一区二区三区视频在线看| 久久久久久免费网| 欧美一区二区三区免费在线看| 99久久久国产精品免费蜜臀| 久久国产欧美日韩精品| 亚洲影视在线播放| 国产精品国产三级国产普通话99 | 欧美欧美午夜aⅴ在线观看| 国产成人av电影免费在线观看| 日韩成人一区二区| 亚洲自拍偷拍麻豆| 日韩理论片在线| 国产亚洲美州欧州综合国| 日韩一区二区三区精品视频| 欧美视频一区在线观看| 成人福利视频在线| 风间由美一区二区av101| 九九久久精品视频| 精品写真视频在线观看| 日本亚洲最大的色成网站www| 亚洲一区av在线| 亚洲综合激情小说| 亚洲国产精品久久人人爱蜜臀| 亚洲婷婷综合色高清在线| 欧美国产日韩a欧美在线观看| 国产视频一区不卡| 欧美高清在线一区| 国产精品女人毛片| 自拍视频在线观看一区二区| 亚洲三级视频在线观看| 日韩美女视频一区二区| 亚洲自拍偷拍av| 图片区小说区区亚洲影院| 天堂久久一区二区三区| 捆绑紧缚一区二区三区视频| 国内精品伊人久久久久影院对白| 久久国产福利国产秒拍| 国产精品自产自拍| 成人综合在线观看| 色婷婷精品久久二区二区蜜臂av| 一本色道**综合亚洲精品蜜桃冫| 91福利小视频| 欧美成人三级在线| 国产欧美一区二区精品婷婷| 中文字幕av一区二区三区免费看| 国产精品国产精品国产专区不片| 一区二区欧美精品| 免费在线看一区| 国产精品自产自拍| 在线视频你懂得一区| 日韩一级视频免费观看在线| 26uuu国产日韩综合| 亚洲啪啪综合av一区二区三区| 亚洲国产精品一区二区久久恐怖片| 美女任你摸久久| 成人久久久精品乱码一区二区三区| 色先锋资源久久综合| 日韩欧美电影在线| 成人欧美一区二区三区小说| 三级一区在线视频先锋| 国产成人自拍在线| 欧美日韩免费在线视频| 久久久亚洲高清| 亚洲一区二区精品视频| 国产精品 日产精品 欧美精品| 91精品福利在线| 久久综合久久久久88| 亚洲在线视频免费观看| 国产精品1区2区| 欧美一卡二卡在线| 亚洲精品成人少妇| 久国产精品韩国三级视频| 91精品1区2区| 国产亚洲欧美一级|