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

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

?? os_q.c

?? 51單片機(jī)上移植UCOSII,通過(guò)調(diào)試
?? 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)LG_REENTRANT
{
#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)LG_REENTRANT
{
#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)LG_REENTRANT
{
#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精品国产综合久久香蕉麻豆 | 麻豆成人91精品二区三区| 首页国产欧美日韩丝袜| 另类小说欧美激情| 北条麻妃国产九九精品视频| 日本韩国一区二区| 欧美一区二区三区啪啪| 国产亚洲精品精华液| 国产精品久久福利| 五月天婷婷综合| 国产福利视频一区二区三区| 91免费看`日韩一区二区| 精品1区2区3区| 精品国产电影一区二区| 日韩理论片在线| 奇米影视7777精品一区二区| 国产成人在线免费| 欧美午夜免费电影| 欧美—级在线免费片| 三级在线观看一区二区| 成人手机电影网| 欧美精品18+| 中文字幕 久热精品 视频在线| 视频一区国产视频| 99r国产精品| 日韩美一区二区三区| 1024成人网色www| 在线视频你懂得一区二区三区| 精品99一区二区| 亚洲线精品一区二区三区八戒| 国产精品乡下勾搭老头1| 6080国产精品一区二区| 亚洲视频 欧洲视频| 精品一区二区三区不卡 | 在线亚洲人成电影网站色www| 91麻豆精品国产91久久久更新时间 | 肉色丝袜一区二区| 从欧美一区二区三区| 93久久精品日日躁夜夜躁欧美| 在线观看日韩高清av| 精品日韩av一区二区| 国产精品美女久久久久aⅴ国产馆| 亚洲黄色小说网站| 捆绑调教美女网站视频一区| 欧美亚男人的天堂| 国产欧美一区二区精品仙草咪| 亚洲国产毛片aaaaa无费看| 国产不卡视频一区| 欧美一区二区三区思思人| 一区二区三区蜜桃| 大胆欧美人体老妇| 精品久久久影院| 亚洲午夜精品网| 99久久夜色精品国产网站| 精品美女在线观看| 夜夜嗨av一区二区三区| 成人午夜在线免费| 欧美成人video| 亚洲成人免费在线观看| 成人黄色大片在线观看| 精品成人佐山爱一区二区| 婷婷综合五月天| 色国产综合视频| 国产精品福利影院| 国产精品一区二区在线播放| 欧美三片在线视频观看| 日韩一区在线免费观看| 国产一二精品视频| 日韩视频在线永久播放| 亚洲成人手机在线| 欧美影片第一页| 亚洲精品第1页| av在线不卡免费看| 欧美国产亚洲另类动漫| 激情综合色播五月| 日韩片之四级片| 午夜精品久久久久久久99水蜜桃| 色琪琪一区二区三区亚洲区| 国产精品天美传媒| 欧美日韩美少妇| 亚洲精品国产一区二区三区四区在线| 成人影视亚洲图片在线| 国产日韩欧美激情| 久久电影国产免费久久电影| 欧美一区二区三区播放老司机 | 777亚洲妇女| 五月天中文字幕一区二区| 97超碰欧美中文字幕| 欧美不卡一二三| 国产一区二区三区久久久| 久久麻豆一区二区| 国产盗摄精品一区二区三区在线 | 亚洲欧洲在线观看av| 成人国产精品免费网站| 国产精品久久久久久久久快鸭| 国产高清在线精品| 亚洲国产成人在线| 91亚洲资源网| 亚洲免费电影在线| 欧美亚洲一区二区在线观看| 亚洲自拍偷拍九九九| 欧美综合在线视频| 亚洲福利视频三区| 91精品国产91热久久久做人人| 免费成人美女在线观看.| 欧美xxxx老人做受| 国产一区二三区| 亚洲国产精品v| 99久久综合色| 亚洲午夜影视影院在线观看| 欧美日韩精品久久久| 蜜臀久久久久久久| 久久网这里都是精品| 成人午夜碰碰视频| 亚洲黄色在线视频| 91精品国产91久久久久久最新毛片 | 一区二区高清视频在线观看| 欧美日韩在线不卡| 蜜桃一区二区三区四区| 久久女同性恋中文字幕| 99精品视频在线观看| 亚洲成人自拍一区| 2023国产精品| 成人av免费网站| 亚洲一区在线观看视频| 日韩一区二区视频| 国产传媒一区在线| 亚洲午夜激情av| www久久久久| 91性感美女视频| 秋霞av亚洲一区二区三| 国产三级精品视频| 欧美午夜片在线观看| 国产一区二区美女诱惑| 国产精品天美传媒沈樵| 制服丝袜亚洲网站| 成人综合婷婷国产精品久久蜜臀| 亚洲另类色综合网站| 日韩一级大片在线观看| av高清久久久| 麻豆中文一区二区| 2020国产成人综合网| 欧美三片在线视频观看| 激情欧美一区二区| 一区二区三区中文在线| 欧美本精品男人aⅴ天堂| 91丨九色丨蝌蚪富婆spa| 视频一区中文字幕国产| 久久精品亚洲乱码伦伦中文| 欧美调教femdomvk| 国产成人8x视频一区二区| 亚洲国产一区二区三区青草影视| 精品久久久久久久一区二区蜜臀| 狠狠色丁香久久婷婷综合_中| 26uuu国产电影一区二区| 99精品欧美一区二区三区综合在线| 一区二区在线免费观看| 91麻豆精品国产91久久久| 国内成人精品2018免费看| 亚洲综合免费观看高清完整版在线| 久久久91精品国产一区二区精品| 欧美三级在线看| 成人免费黄色在线| 精品亚洲国内自在自线福利| 欧美电视剧在线观看完整版| 在线精品视频免费播放| 国产精品66部| 琪琪一区二区三区| 亚洲国产日韩在线一区模特| 亚洲婷婷国产精品电影人久久| 精品久久久久久久久久久久久久久久久| 国产98色在线|日韩| 免费在线观看一区二区三区| 亚洲久草在线视频| 中文字幕不卡一区| 日韩一区二区在线观看视频播放| 91女厕偷拍女厕偷拍高清| 国产一区二区剧情av在线| 美国十次综合导航| 日韩高清在线一区| 亚洲电影一级黄| 亚洲美女一区二区三区| 国产精品色噜噜| 2024国产精品| 欧美精品亚洲一区二区在线播放| 91免费国产视频网站| 成人免费毛片高清视频| 国产高清不卡一区| 国产精品99久| 国产精品一区不卡| 国产精品亚洲一区二区三区妖精| 久久99热狠狠色一区二区| 免费高清成人在线| 午夜日韩在线电影| 免费精品视频最新在线| 日韩不卡免费视频| 免费观看在线色综合| 日韩中文欧美在线| 日韩激情中文字幕| 天天综合日日夜夜精品|