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

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

?? os_q.c

?? ucosII實時操作系統(tǒng)的2.84官方版本
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2006, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.84
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include <ucos_ii.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)
{
    void      *msg;
    OS_Q      *pq;
#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 (err == (INT8U *)0) {                     /* Validate 'err'                                     */
        return ((void *)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)
{
    OS_EVENT  *pevent;
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



    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 > 1
            pevent->OSEventName[0] = '?';                  /* Unknown name                             */
            pevent->OSEventName[1] = OS_ASCII_NUL;
#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)
{
    BOOLEAN    tasks_waiting;
    OS_EVENT  *pevent_return;
    OS_Q      *pq;
#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 (err == (INT8U *)0) {                               /* Validate 'err'                           */
        return (pevent);
    }
    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);
    }
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return (pevent);
    }
    OS_ENTER_CRITICAL();
    if (pevent->OSEventGrp != 0) {                         /* See if any tasks waiting on queue        */
        tasks_waiting = OS_TRUE;                              /* Yes                                      */
    } else {
        tasks_waiting = OS_FALSE;                             /* No                                       */
    }
    switch (opt) {
        case OS_DEL_NO_PEND:                               /* Delete queue only if no task waiting     */
             if (tasks_waiting == OS_FALSE) {
#if OS_EVENT_NAME_SIZE > 1
                 pevent->OSEventName[0] = '?';             /* Unknown name                             */
                 pevent->OSEventName[1] = OS_ASCII_NUL;
#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;
                 pevent_return          = (OS_EVENT *)0;   /* Queue has been deleted                   */
             } else {
                 OS_EXIT_CRITICAL();
                 *err                   = OS_ERR_TASK_WAITING;
                 pevent_return          = pevent;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
4438x亚洲最大成人网| 精品剧情v国产在线观看在线| 欧美午夜精品久久久久久超碰| 欧美老女人第四色| 国产欧美一区二区精品婷婷| 亚洲一区精品在线| 国产乱一区二区| 欧美吞精做爰啪啪高潮| 久久久777精品电影网影网| 亚洲丰满少妇videoshd| 成人一区二区三区| 日韩欧美国产麻豆| 亚洲国产一区在线观看| 成人精品国产福利| 亚洲精品在线观看视频| 亚洲3atv精品一区二区三区| 成人国产精品免费观看视频| 精品久久久久久综合日本欧美| 亚洲曰韩产成在线| 不卡的av中国片| 久久久久久久久久久久久久久99| 日日摸夜夜添夜夜添精品视频| 成人ar影院免费观看视频| 久久综合五月天婷婷伊人| 婷婷综合在线观看| 欧美日韩久久久| 国产亚洲欧美日韩日本| 国产丝袜在线精品| 亚洲成人免费电影| 91久久精品一区二区三| 国产精品国产精品国产专区不蜜| 国产精品中文有码| 欧美一级高清片| 天天亚洲美女在线视频| 欧美成人一区二区三区片免费 | 91成人网在线| 亚洲成av人片| 2017欧美狠狠色| 欧美色图激情小说| 国产精品一二三四区| 亚洲一区二区三区四区不卡| 欧美精品一区二区高清在线观看| 91一区在线观看| 激情图片小说一区| 亚洲精品欧美专区| 久久久久久一二三区| 欧美男人的天堂一二区| 成人高清免费在线播放| 九九视频精品免费| 亚洲综合一二三区| 国产精品天天看| 日韩欧美美女一区二区三区| 色噜噜狠狠一区二区三区果冻| 国产一区二区在线视频| 日韩精品电影一区亚洲| 一区二区三区精品久久久| 久久精品综合网| 日韩欧美区一区二| 欧美高清视频在线高清观看mv色露露十八 | 亚洲男同性恋视频| 国产亚洲精品久| 日韩精品一区二区三区四区| 欧美婷婷六月丁香综合色| 99精品视频在线免费观看| 国产一区二三区好的| 美国欧美日韩国产在线播放| 午夜视频一区二区三区| 一区二区三区视频在线看| 日韩一区欧美小说| 国产蜜臀97一区二区三区| 欧美精品一区二区高清在线观看 | 久久九九国产精品| 久久综合色婷婷| 精品久久五月天| 精品国产乱码久久久久久久久| 91精品国产欧美日韩| 欧美日韩免费电影| 欧美日韩一区在线| 欧美日韩一区二区欧美激情| 91精品福利视频| 欧美性一级生活| 欧美午夜精品一区二区蜜桃| 欧美日韩国产123区| 欧美日韩国产色站一区二区三区| 欧美午夜精品免费| 欧美高清视频在线高清观看mv色露露十八| 欧美四级电影网| 欧美日韩精品欧美日韩精品 | 日韩女同互慰一区二区| 欧美一区二区免费视频| 日韩欧美在线综合网| 欧美电影免费观看完整版| 精品久久久久久久久久久院品网| 欧美电影免费观看高清完整版在线观看 | 国产精品成人网| 日韩美女久久久| 亚洲最大的成人av| 日韩精品乱码免费| 国产综合一区二区| 成人激情午夜影院| 在线观看成人小视频| 日韩一区二区免费在线观看| 日韩美女在线视频 | 日韩欧美一区电影| 久久亚洲影视婷婷| 国产精品国产馆在线真实露脸| 亚洲精品少妇30p| 日本不卡一区二区三区高清视频| 狠狠色狠狠色合久久伊人| a亚洲天堂av| 欧美日韩一区在线| 久久久不卡影院| 亚洲最快最全在线视频| 久久99国产精品免费网站| 高清av一区二区| 欧美日韩久久不卡| 国产午夜精品久久久久久免费视 | 日韩精品一区第一页| 国产一区二区三区久久悠悠色av| 99精品视频中文字幕| 日韩午夜在线观看视频| 亚洲国产成人在线| 视频在线观看国产精品| 国产成人午夜视频| 精品视频一区三区九区| 久久久久国产精品麻豆| 亚洲成人自拍网| 成人久久久精品乱码一区二区三区 | 欧美日韩一卡二卡| 国产亚洲美州欧州综合国| 亚洲成精国产精品女| 国产精品1024| 欧美日韩黄色一区二区| 日本一区二区免费在线 | 九九九精品视频| 色又黄又爽网站www久久| 欧美大白屁股肥臀xxxxxx| 一区二区成人在线视频| 国产乱子伦视频一区二区三区 | 国产综合久久久久久久久久久久| youjizz国产精品| 日韩欧美aaaaaa| 亚洲国产成人av| 99久久免费精品| 精品成a人在线观看| 爽爽淫人综合网网站| 色综合一区二区三区| 久久久久国产成人精品亚洲午夜| 免费一级片91| 欧美午夜影院一区| 一区二区三区日本| 91亚洲精华国产精华精华液| 国产亚洲一区二区三区四区 | 欧美日韩国产免费| 亚洲欧洲成人精品av97| 国产乱码字幕精品高清av| 日韩欧美在线综合网| 日本中文在线一区| 欧美日本高清视频在线观看| 一区二区成人在线视频| 色天天综合色天天久久| 亚洲视频狠狠干| 波多野结衣91| 亚洲欧美日韩国产手机在线 | 国产亚洲va综合人人澡精品| 久久精品999| 欧美一区二区三区免费| 丝袜美腿亚洲一区二区图片| 欧美三级欧美一级| 亚洲第一在线综合网站| 欧美性色欧美a在线播放| 一区二区久久久久| 精品视频1区2区| 午夜a成v人精品| 欧美日韩中字一区| 日韩国产欧美在线视频| 5月丁香婷婷综合| 视频一区二区中文字幕| 欧美吞精做爰啪啪高潮| 日韩电影一区二区三区四区| 欧美日免费三级在线| 男女性色大片免费观看一区二区 | 国产成人精品亚洲777人妖| 国产偷国产偷精品高清尤物| 高清视频一区二区| 国产精品久久久久天堂| 一本久久a久久精品亚洲| 亚洲午夜久久久久久久久电影网 | 九色|91porny| 久久久91精品国产一区二区精品| 丁香桃色午夜亚洲一区二区三区| 国产精品国产a| 欧美亚洲国产bt| 另类小说综合欧美亚洲| 久久亚洲一级片| 91色视频在线| 免费高清不卡av| 国产精品视频免费| 欧美视频一区在线| 狠狠v欧美v日韩v亚洲ⅴ|