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

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

?? os_q.c

?? 最新版ucos2.86源碼和程序說(shuō)明文件
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                              (c) Copyright 1992-2007, Micrium, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.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_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
*
*              perr          is a pointer to where an error message will be deposited.  Possible error
*                            messages are:
*
*                            OS_ERR_NONE         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_ERR_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
*              'perr' 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 *perr)
{
    void      *pmsg;
    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 (perr == (INT8U *)0) {                    /* Validate 'perr'                                    */
        return ((void *)0);
    }
    if (pevent == (OS_EVENT *)0) {               /* Validate 'pevent'                                  */
        *perr = OS_ERR_PEVENT_NULL;
        return ((void *)0);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type                          */
        *perr = 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                   */
        pmsg = *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;
        }
        *perr = OS_ERR_NONE;
    } else {
        *perr = OS_ERR_Q_EMPTY;
        pmsg  = (void *)0;                       /* Queue is empty                                     */
    }
    OS_EXIT_CRITICAL();
    return (pmsg);                               /* 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.
*
*              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 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 *perr)
{
    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 (perr == (INT8U *)0) {                              /* Validate 'perr'                          */
        return (pevent);
    }
    if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
        *perr = OS_ERR_PEVENT_NULL;
        return (pevent);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
        *perr = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *perr = 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();
                 *perr                  = OS_ERR_NONE;
                 pevent_return          = (OS_EVENT *)0;   /* Queue has been deleted                   */
             } else {
                 OS_EXIT_CRITICAL();
                 *perr                  = OS_ERR_TASK_WAITING;
                 pevent_return          = pevent;
             }
             break;

        case OS_DEL_ALWAYS:                                /* Always delete the queue                  */
             while (pevent->OSEventGrp != 0) {             /* Ready ALL tasks waiting for queue        */
                 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q, OS_STAT_PEND_OK);
             }
#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();
             if (tasks_waiting == OS_TRUE) {               /* Reschedule only if task(s) were waiting  */
                 OS_Sched();                               /* Find highest priority task ready to run  */
             }
             *perr                  = OS_ERR_NONE;
             pevent_return          = (OS_EVENT *)0;       /* Queue has been deleted                   */

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品色一区二区三区| 亚洲视频在线观看一区| 欧美一区二区精品在线| 欧美日韩一级视频| 欧美性感一类影片在线播放| 欧美性受极品xxxx喷水| 欧美亚州韩日在线看免费版国语版 | 午夜欧美大尺度福利影院在线看| 亚洲欧美视频在线观看| 亚洲蜜桃精久久久久久久| 综合激情网...| 亚洲免费av观看| 亚洲国产精品久久艾草纯爱| 亚洲成av人片一区二区梦乃| 亚洲超碰97人人做人人爱| 天堂成人免费av电影一区| 麻豆国产精品777777在线| 精品一区二区三区av| 国产精品18久久久久久久网站| 国产高清成人在线| 99久久精品免费| 欧美午夜免费电影| 欧美精品久久一区二区三区| 日韩欧美国产午夜精品| 国产亚洲欧洲一区高清在线观看| 国产精品乱子久久久久| 亚洲综合色区另类av| 青青青爽久久午夜综合久久午夜 | a美女胸又www黄视频久久| 欧洲中文字幕精品| 日韩亚洲欧美在线| 国产日韩欧美在线一区| 最近日韩中文字幕| 日韩经典中文字幕一区| 国产精品资源网站| 在线观看日韩精品| 欧美tk—视频vk| 亚洲欧洲国产日本综合| 亚洲成精国产精品女| 久久99久久精品| 91麻豆国产福利在线观看| 制服丝袜亚洲网站| 国产精品免费久久久久| 五月婷婷综合激情| 成人午夜视频福利| 91麻豆精品国产91久久久使用方法 | 97久久精品人人做人人爽50路| 欧美日韩国产a| 国产欧美一区二区三区网站| 一个色妞综合视频在线观看| 激情另类小说区图片区视频区| 91免费视频网| 欧美精品一区二区蜜臀亚洲| 亚洲蜜臀av乱码久久精品蜜桃| 奇米影视一区二区三区小说| hitomi一区二区三区精品| 欧美一区二区三区男人的天堂| 中文字幕乱码日本亚洲一区二区| 亚洲风情在线资源站| 国产福利精品一区二区| 欧美日本精品一区二区三区| 国产精品久久久久天堂| 青青草原综合久久大伊人精品 | 国产精品沙发午睡系列990531| 偷窥少妇高潮呻吟av久久免费| 成人激情黄色小说| 欧美r级电影在线观看| 一区二区三区在线观看动漫| 国产麻豆精品视频| 69p69国产精品| 亚洲综合无码一区二区| 成人性视频免费网站| 日韩精品一区二区三区四区视频| 亚洲综合一区在线| 本田岬高潮一区二区三区| 欧美精品一区二| 日日摸夜夜添夜夜添国产精品| 91在线码无精品| 欧美激情综合在线| 国产综合成人久久大片91| 欧美丰满美乳xxx高潮www| 一区av在线播放| 99视频精品全部免费在线| 国产午夜精品一区二区三区四区| 轻轻草成人在线| 91精品久久久久久蜜臀| 亚洲综合一区二区三区| 色婷婷国产精品| 亚洲欧美在线高清| 粉嫩一区二区三区性色av| 日韩欧美www| 免费精品视频在线| 4438x亚洲最大成人网| 日日欢夜夜爽一区| 欧美日本在线视频| 丝袜诱惑制服诱惑色一区在线观看 | 99久久婷婷国产精品综合| 国产精品色噜噜| 丁香网亚洲国际| 国产精品午夜在线观看| 成人综合在线观看| 国产精品美日韩| 99天天综合性| 一区二区久久久久久| 色哟哟国产精品| 亚洲一区二区三区中文字幕在线 | 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 国产一区二区精品久久| 久久精品男人的天堂| 国产v综合v亚洲欧| 中文子幕无线码一区tr| 成人精品一区二区三区四区 | 久草精品在线观看| 久久天堂av综合合色蜜桃网| 国产精品资源在线| 综合自拍亚洲综合图不卡区| 欧美综合天天夜夜久久| 午夜一区二区三区在线观看| 欧美疯狂性受xxxxx喷水图片| 美女尤物国产一区| 久久久国产一区二区三区四区小说| 国产一区久久久| 国产精品白丝在线| 91蝌蚪porny成人天涯| 亚洲国产精品人人做人人爽| 欧美一区二区三区爱爱| 国产精品伊人色| |精品福利一区二区三区| 欧美三级中文字| 麻豆成人久久精品二区三区红 | 午夜精品福利一区二区三区av| 欧美疯狂性受xxxxx喷水图片| 美国十次了思思久久精品导航| 久久综合久久综合亚洲| av电影一区二区| 日韩精品一卡二卡三卡四卡无卡| 欧美成人一区二区三区片免费| 成熟亚洲日本毛茸茸凸凹| 亚洲永久免费视频| 欧美刺激脚交jootjob| 99久久婷婷国产综合精品电影 | 久久99国产精品久久99 | 久久99国产精品免费网站| 国产精品三级在线观看| 欧美三级电影一区| 国产一区999| 亚洲最大成人综合| 精品国产污网站| 色婷婷综合久久久久中文一区二区| 香蕉乱码成人久久天堂爱免费| 久久天天做天天爱综合色| 欧美性生活影院| 国产成人精品三级麻豆| 91小视频在线免费看| 日本不卡视频在线| 亚洲少妇30p| 精品乱人伦小说| 91国模大尺度私拍在线视频| 精品一区二区三区欧美| 亚洲欧美激情一区二区| 精品久久人人做人人爰| 在线免费精品视频| 国产一区福利在线| 五月婷婷综合激情| 亚洲人成亚洲人成在线观看图片| 日韩片之四级片| 欧美性受xxxx黑人xyx性爽| 国产91丝袜在线播放| 蜜臀精品一区二区三区在线观看| 中文字幕字幕中文在线中不卡视频| 日韩久久精品一区| 欧美日韩精品一区二区三区| 成人a区在线观看| 精品在线一区二区| 午夜电影网一区| 亚洲欧美乱综合| 日本一区二区三区久久久久久久久不 | 欧美伊人久久久久久久久影院| 国产成人福利片| 免费成人在线网站| 亚洲一区二区三区影院| 国产精品国产三级国产专播品爱网| 日韩免费电影网站| 在线综合视频播放| 欧美综合色免费| 日本大香伊一区二区三区| 日韩女优毛片在线| 欧美日韩中文字幕一区二区| av亚洲精华国产精华精| 国产成人综合在线播放| 精品一区二区三区不卡| 美腿丝袜亚洲综合| 日本亚洲视频在线| 午夜精品福利在线| 亚洲成av人片一区二区| 亚洲蜜桃精久久久久久久| 亚洲桃色在线一区| 中文字幕在线观看不卡| 国产精品素人一区二区| 欧美高清在线一区|