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

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

?? os_q.c

?? 此壓縮包中包含了UCOS-II的詳細(xì)源代碼
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                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
*
* 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 the queue is empty or,
*                            if 'pevent' is a NULL pointer or,
*                            if you passed an invalid event type
*********************************************************************************************************
*/

#if OS_Q_ACCEPT_EN > 0
void  *OSQAccept (OS_EVENT *pevent)
{
#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'                                  */
        return ((void *)0);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type                          */
        return ((void *)0);
    }
#endif
    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;
        }
    } else {
        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;
            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);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
#endif
    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) {
                 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  */
                 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);
             }
             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  */
             OSEventFreeList     = pevent;                 /* Get next free event control block        */
             OS_EXIT_CRITICAL();
             if (tasks_waiting == TRUE) {                  /* Reschedule only if task(s) were waiting  */
                 OS_Sched();                               /* Find highest priority task ready to run  */
             }
             *err = OS_NO_ERR;
             return ((OS_EVENT *)0);                       /* Queue has been deleted                   */

        default:
             OS_EXIT_CRITICAL();

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费国产在线| 在线视频你懂得一区二区三区| 中文字幕第一区二区| 精品婷婷伊人一区三区三| 国产一区二区毛片| 五月激情丁香一区二区三区| 中文在线免费一区三区高中清不卡| 欧美日精品一区视频| 粉嫩av亚洲一区二区图片| 日本亚洲天堂网| 亚洲精品视频一区| 欧美国产综合一区二区| 日韩欧美成人一区| 欧美视频一区二| 97精品久久久久中文字幕| 国产一区二区三区黄视频| jlzzjlzz亚洲女人18| 日韩电影在线看| 亚洲午夜三级在线| 亚洲女与黑人做爰| 中文字幕一区二区三中文字幕| 日韩免费观看高清完整版在线观看| 色系网站成人免费| av在线不卡电影| 国产精品一区二区免费不卡| 免费成人av在线| 婷婷亚洲久悠悠色悠在线播放| 亚洲人成在线观看一区二区| 国产欧美综合在线观看第十页| 日韩欧美的一区| 欧美成人性福生活免费看| 6080国产精品一区二区| 欧美日韩亚洲综合一区二区三区 | ...av二区三区久久精品| 精品成a人在线观看| 日韩一区二区三区免费看| 欧美日韩免费高清一区色橹橹| 色综合天天综合给合国产| 9l国产精品久久久久麻豆| 国产91精品精华液一区二区三区| 老司机精品视频线观看86| 男女男精品视频网| 日韩中文字幕麻豆| 日本不卡视频在线| 麻豆91在线播放| 国产资源精品在线观看| 国产精品中文字幕欧美| 国产成人午夜高潮毛片| 顶级嫩模精品视频在线看| 成人精品国产免费网站| www.日韩在线| 色女孩综合影院| 欧美日韩一二三| 欧美一区二区三区啪啪| 26uuu国产日韩综合| 欧美经典三级视频一区二区三区| 国产农村妇女毛片精品久久麻豆 | av不卡一区二区三区| 99久久精品免费| 日本韩国一区二区三区视频| 欧美日韩一区二区三区四区| 欧美老人xxxx18| 久久一区二区三区国产精品| 天天射综合影视| 韩国女主播成人在线| 成人h动漫精品一区二区| 色老汉一区二区三区| 91麻豆精品国产综合久久久久久| 日韩欧美一级二级三级| 欧美国产欧美亚州国产日韩mv天天看完整| 中文乱码免费一区二区| 亚洲精品大片www| 美国欧美日韩国产在线播放| 国产精品亚洲а∨天堂免在线| 91天堂素人约啪| 欧美美女激情18p| 国产欧美一区二区精品秋霞影院| 成人欧美一区二区三区1314| 亚洲国产精品一区二区久久| 另类小说欧美激情| 成人动漫一区二区| 欧美精品一级二级| 中文字幕乱码久久午夜不卡| 亚洲尤物在线视频观看| 国产原创一区二区| 91麻豆国产福利精品| 日韩午夜在线影院| 亚洲人成网站影音先锋播放| 日本va欧美va欧美va精品| 成人性生交大片| 91精品欧美福利在线观看| 国产精品色呦呦| 日韩av不卡在线观看| 99精品欧美一区| 日韩欧美一区在线观看| 亚洲欧洲制服丝袜| 欧美日韩一区三区四区| 亚洲国产高清在线观看视频| 日本亚洲视频在线| 日本高清视频一区二区| www国产精品av| 午夜精品福利一区二区三区蜜桃| 国产成a人亚洲精| 日韩一级完整毛片| 亚洲黄色片在线观看| 成人一二三区视频| 日韩精品影音先锋| 亚洲成人午夜影院| 99精品国产一区二区三区不卡| 日韩精品中文字幕在线不卡尤物| 亚洲午夜免费视频| av福利精品导航| 久久九九久精品国产免费直播| 丝袜诱惑亚洲看片| 欧美性猛片xxxx免费看久爱| 国产精品免费视频观看| 国产精品456露脸| 精品av久久707| 麻豆久久久久久| 3751色影院一区二区三区| 一区二区三区欧美亚洲| 91丨国产丨九色丨pron| 国产精品三级av在线播放| 国产一区二区三区四区五区美女| 欧美一区二区三区的| 水蜜桃久久夜色精品一区的特点 | 久久se精品一区精品二区| 欧美午夜一区二区三区| 亚洲精品日日夜夜| 日本伦理一区二区| 亚洲狠狠丁香婷婷综合久久久| kk眼镜猥琐国模调教系列一区二区| 国产亚洲污的网站| 国产成人精品1024| 亚洲国产精品精华液ab| 成人一级黄色片| 亚洲欧美综合色| 99久久综合99久久综合网站| 国产精品污污网站在线观看| 国产精品69毛片高清亚洲| 国产午夜精品一区二区三区四区| 国产毛片精品视频| 久久精品一二三| 成人性视频网站| 中文字幕一区二区三区精华液 | 国产成人精品网址| 欧美国产综合色视频| 波多野结衣中文一区| 国产精品久久久久7777按摩| 波多野结衣一区二区三区| 中文字幕一区av| 在线亚洲高清视频| 偷拍亚洲欧洲综合| 精品国产人成亚洲区| 国产精品一区二区久久不卡| 国产精品久久网站| 在线视频欧美精品| 蜜桃av一区二区三区| 久久久国产精华| 91亚洲精品久久久蜜桃| 亚洲成av人片一区二区三区| 日韩一区二区三区电影在线观看| 激情文学综合网| 国产精品天天看| 欧美三级资源在线| 韩国三级在线一区| 国产精品毛片a∨一区二区三区| 色婷婷久久综合| 男女视频一区二区| 中文字幕第一区二区| 欧美色图在线观看| 韩国av一区二区三区在线观看| 国产欧美精品一区aⅴ影院| 日本韩国精品一区二区在线观看| 日韩精品三区四区| 国产精品国产成人国产三级 | 国产成人午夜精品5599| 亚洲色图在线视频| 欧美电影免费观看高清完整版在 | 亚洲色大成网站www久久九九| 在线亚洲免费视频| 国产在线精品不卡| 亚洲综合在线免费观看| 欧美xxxxx裸体时装秀| 91免费精品国自产拍在线不卡| 日韩成人一区二区| 中文字幕亚洲视频| 日韩视频一区二区在线观看| 99久久久国产精品免费蜜臀| 日韩电影一区二区三区四区| 欧美激情在线免费观看| 91精品国产综合久久香蕉麻豆 | 中文字幕一区二区三区精华液| 91超碰这里只有精品国产| 丁香婷婷综合激情五月色| 日韩不卡一区二区三区| 国产精品国产自产拍高清av| 欧美大胆人体bbbb| 欧美色综合影院| 91一区在线观看|