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

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

?? os_q.c

?? 大家快來下載。這是目前最新管方版本了,Micrium-uCOS-II-V284.zip
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.84
*
* 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
*
*              err           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
*              '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_ERR_NONE;
    } else {
        *err = OS_ERR_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_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 *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_ERR_NONE;
                 pevent_return          = (OS_EVENT *)0;   /* Queue has been deleted                   */
             } else {
                 OS_EXIT_CRITICAL();
                 *err                   = 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  */
             }
             *err                   = OS_ERR_NONE;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区av在线播放| 久久久亚洲午夜电影| 国产成人高清在线| 老司机精品视频一区二区三区| 一区二区三区四区亚洲| 自拍偷拍国产精品| 中文字幕免费观看一区| 国产欧美一区视频| 国产精品久久久久久久久晋中| 久久男人中文字幕资源站| 久久久久久久久岛国免费| 久久久噜噜噜久久人人看| 久久精品人人做| 国产精品人妖ts系列视频| 综合在线观看色| 一区二区三区在线高清| 午夜精品福利在线| 另类专区欧美蜜桃臀第一页| 国产精品一区二区果冻传媒| 99久久精品费精品国产一区二区| 色综合天天综合色综合av| 色狠狠av一区二区三区| 欧美精品 日韩| 久久久久成人黄色影片| 亚洲欧洲日产国码二区| 午夜精彩视频在线观看不卡| 久久99精品久久久久| 风间由美性色一区二区三区| 日本二三区不卡| 91精品国产欧美一区二区18| 久久久噜噜噜久噜久久综合| 亚洲欧美日本在线| 青青草精品视频| 成人黄色免费短视频| 欧美日韩精品一二三区| 久久精品人人爽人人爽| 亚洲成a人片在线观看中文| 紧缚奴在线一区二区三区| 成人免费的视频| 欧美一区二区视频在线观看 | 亚洲男人的天堂在线aⅴ视频| 亚洲午夜一区二区| 国产精品12区| 欧美肥妇毛茸茸| 亚洲丝袜美腿综合| 国产原创一区二区| 欧美午夜在线观看| 久久久久久电影| 日韩专区一卡二卡| 91蜜桃在线观看| 国产亚洲福利社区一区| 日韩精品福利网| 日本久久精品电影| 国产精品私人影院| 激情偷乱视频一区二区三区| 欧美日韩一级视频| 亚洲三级在线免费| 懂色av一区二区三区蜜臀| 欧美一区二区视频在线观看2020 | 亚洲高清不卡在线观看| 国产成人精品免费| 欧美成人精品1314www| 亚洲综合色视频| 色综合天天在线| 亚洲欧美影音先锋| 成人免费视频视频| 久久久久久久久99精品| 激情久久五月天| 日韩欧美一二三四区| 五月婷婷色综合| 欧美人动与zoxxxx乱| 一区二区三区欧美在线观看| 不卡的av在线播放| 中文av字幕一区| 成人av资源在线观看| 国产精品三级av| 99视频一区二区三区| 国产精品欧美一区喷水| 成人激情小说网站| 亚洲欧美激情一区二区| 99久久99久久久精品齐齐| 亚洲日本成人在线观看| 色又黄又爽网站www久久| 亚洲欧洲综合另类| 日本韩国一区二区三区视频| 亚洲国产一区二区a毛片| 91成人在线精品| 亚洲成人精品在线观看| 欧美日韩亚洲综合一区二区三区| 亚洲成人在线免费| 日韩欧美中文字幕精品| 精品一区二区三区在线播放视频| 精品国精品国产| 国产成人精品亚洲午夜麻豆| 中文字幕一区二区三区在线播放| 91免费观看视频在线| 亚洲成国产人片在线观看| 日韩欧美国产综合在线一区二区三区| 免费观看一级特黄欧美大片| 久久色中文字幕| 99re热视频精品| 无码av免费一区二区三区试看| 日韩欧美中文一区二区| 成人免费看视频| 亚洲国产精品影院| 精品91自产拍在线观看一区| av在线这里只有精品| 亚洲电影中文字幕在线观看| 欧美成人精品福利| 97久久超碰国产精品| 日韩成人一区二区| 国产精品情趣视频| 91.成人天堂一区| 成人深夜在线观看| 日本中文一区二区三区| 国产精品女同一区二区三区| 欧美精品免费视频| 不卡视频在线看| 久久国产成人午夜av影院| 亚洲欧美综合色| www国产成人| 欧美视频三区在线播放| 国产成人在线观看| 日本不卡视频一二三区| 亚洲人午夜精品天堂一二香蕉| 欧美一级日韩一级| 在线视频综合导航| 成a人片亚洲日本久久| 久久99久久精品| 亚洲尤物视频在线| 最新不卡av在线| 国产女人水真多18毛片18精品视频 | 3atv一区二区三区| 91色porny| 国产成人h网站| 久久激情五月婷婷| 午夜精品在线视频一区| 一区二区三区欧美| 中文字幕欧美区| 久久女同性恋中文字幕| 欧美电视剧在线观看完整版| 欧美色涩在线第一页| 色婷婷综合视频在线观看| 成人手机电影网| 国产成人精品aa毛片| 国产一区二区成人久久免费影院| 蜜臀av一区二区在线观看| 天天综合色天天综合色h| 亚洲一区二区三区四区在线| 一区二区在线看| 日韩美女精品在线| 亚洲三级电影网站| 一区二区三区在线视频免费| 最新高清无码专区| 一区二区三区欧美激情| 一区二区三区蜜桃网| 亚洲精品中文字幕在线观看| 亚洲色图欧美偷拍| 亚洲乱码国产乱码精品精可以看| 亚洲欧美一区二区在线观看| 亚洲少妇屁股交4| 亚洲欧美韩国综合色| 亚洲一区二区三区中文字幕| 亚洲最色的网站| 午夜精品成人在线视频| 美女视频网站黄色亚洲| 久久99这里只有精品| 国产精品亚洲一区二区三区妖精 | 国产一区二区三区香蕉| 国产麻豆成人传媒免费观看| 国产成人精品影视| 91蜜桃婷婷狠狠久久综合9色| 欧美在线999| 日韩美女视频在线| 国产欧美一区二区精品性色超碰| 国产精品沙发午睡系列990531| 亚洲精品中文在线| 日韩国产欧美一区二区三区| 麻豆精品国产91久久久久久| 国产美女一区二区三区| 色婷婷亚洲综合| 欧美一级xxx| 国产精品日日摸夜夜摸av| 偷窥国产亚洲免费视频| 国产精品一区二区三区网站| 日本精品一区二区三区四区的功能| 日韩制服丝袜先锋影音| wwwwxxxxx欧美| 亚洲国产高清不卡| 亚洲日本va在线观看| 免费在线观看视频一区| 成人精品小蝌蚪| 欧美午夜不卡视频| 精品国产a毛片| 一区二区三区高清在线| 韩国av一区二区| 欧美日韩一区精品| 中文字幕欧美激情| 捆绑调教一区二区三区| 成人黄色在线看|