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

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

?? os_q.c

?? 在純DOS下運行的TurboC3_ucos2_ucgui bug改進版本
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                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();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品国产| 日韩精品一区二区三区视频 | 日本一区二区三区在线观看| 亚洲天堂免费看| 国产麻豆午夜三级精品| 欧美偷拍一区二区| 国产亚洲精品中文字幕| 日韩国产欧美三级| 欧美午夜一区二区三区| 综合激情成人伊人| 国产精品911| 精品国产免费一区二区三区香蕉| 一区二区三区蜜桃网| 成人精品鲁一区一区二区| 欧美大片在线观看一区二区| 亚洲福利国产精品| 欧美三级在线视频| 亚洲精品精品亚洲| 91蜜桃在线观看| 国产精品久久久久婷婷| 国产一区91精品张津瑜| 精品国产乱码久久久久久夜甘婷婷 | 综合久久给合久久狠狠狠97色| www.综合网.com| 国产精品网曝门| 岛国一区二区在线观看| 久久久国产精品麻豆| 国产真实乱子伦精品视频| 日韩欧美一区二区在线视频| 日本欧美肥老太交大片| 欧美高清一级片在线| 丝袜国产日韩另类美女| 欧美丰满一区二区免费视频| 亚洲成人自拍一区| 欧美日韩国产中文| 五月婷婷激情综合| 91.麻豆视频| 久久精品国产一区二区三 | 亚洲精品一线二线三线无人区| 美女视频黄久久| 欧美一区二区二区| 久久99精品久久久久婷婷| 精品国产免费人成在线观看| 国产乱对白刺激视频不卡| 国产丝袜美腿一区二区三区| 成人黄色片在线观看| 一区二区视频在线| 欧美日韩精品一区二区三区蜜桃| 蜜桃一区二区三区在线| 久久婷婷国产综合国色天香| 粉嫩一区二区三区性色av| 亚洲区小说区图片区qvod| 在线观看视频一区二区欧美日韩| 日韩中文字幕区一区有砖一区 | 国产视频一区二区在线| 成人中文字幕电影| 一区2区3区在线看| 日韩视频在线永久播放| 国产福利精品一区二区| 亚洲精品综合在线| 欧美视频日韩视频| 国产一区二区三区香蕉| 亚洲精品国产精华液| 日韩一区二区免费在线电影| 国产成人av影院| 午夜在线电影亚洲一区| 久久精品一二三| 在线看日本不卡| 狠狠网亚洲精品| 一区二区欧美精品| 国产亚洲欧美色| 欧美精三区欧美精三区| 成人禁用看黄a在线| 日韩高清欧美激情| 国产精品不卡在线| 日韩精品中文字幕一区二区三区 | 在线视频中文字幕一区二区| 激情小说亚洲一区| 国产精品亚洲一区二区三区在线 | 国产欧美日韩综合精品一区二区| 欧美在线观看一区| 岛国精品一区二区| 久久国产尿小便嘘嘘尿| 亚洲国产裸拍裸体视频在线观看乱了| 久久久久久**毛片大全| 欧美日韩国产影片| 99re成人在线| 国产成人在线电影| 美女脱光内衣内裤视频久久网站| 亚洲男帅同性gay1069| 久久综合久久综合九色| 91麻豆精品国产91久久久资源速度 | ww亚洲ww在线观看国产| 91精品欧美一区二区三区综合在| 91片黄在线观看| 成人综合在线网站| 久久精品国产免费| 日本不卡不码高清免费观看| 一二三区精品视频| 中文字幕日韩一区| 国产日韩欧美精品在线| 精品精品国产高清a毛片牛牛| 欧美猛男男办公室激情| 欧美性猛交xxxxxxxx| 91免费版在线看| 91一区一区三区| av电影在线不卡| 成人av网站大全| 成人精品国产免费网站| 成人免费高清视频| 成人免费观看av| 99久久免费视频.com| 不卡影院免费观看| eeuss国产一区二区三区| eeuss鲁片一区二区三区在线看| 国产成人亚洲精品青草天美| 国产精品亚洲一区二区三区在线| 韩国精品免费视频| 国产成人综合在线播放| 波多野结衣一区二区三区| 成人黄色综合网站| 色婷婷久久综合| 欧美中文字幕一区| 欧美精品视频www在线观看| 欧美精选一区二区| 日韩一区二区三区av| 久久品道一品道久久精品| 国产精品网站在线观看| 亚洲欧美一区二区三区国产精品| 亚洲女与黑人做爰| 亚洲电影激情视频网站| 日本视频一区二区| 极品少妇xxxx精品少妇| 成人白浆超碰人人人人| 91美女在线看| 欧美一区日韩一区| 日韩无一区二区| 中文字幕av一区 二区| 亚洲精品久久7777| 日本不卡免费在线视频| 国产69精品一区二区亚洲孕妇| 91在线视频网址| 欧美久久久影院| 国产女主播在线一区二区| 亚洲最新在线观看| 国内一区二区在线| 在线精品国精品国产尤物884a| 日韩一二三四区| 国产精品视频线看| 午夜av区久久| 国产精品综合av一区二区国产馆| 色呦呦日韩精品| 精品国产伦一区二区三区观看体验| 国产精品国产自产拍在线| 日韩电影在线观看电影| 99久久久免费精品国产一区二区| 欧美视频中文一区二区三区在线观看| 日韩精品专区在线影院重磅| 亚洲欧美日韩国产一区二区三区 | 成人av综合一区| 欧美群妇大交群的观看方式| 久久综合网色—综合色88| 亚洲最新视频在线观看| 国产91丝袜在线观看| 欧美麻豆精品久久久久久| 中文字幕色av一区二区三区| 麻豆成人免费电影| 欧美主播一区二区三区| 国产目拍亚洲精品99久久精品| 丝瓜av网站精品一区二区| 一本大道综合伊人精品热热| 久久久久国产精品厨房| 日韩影院精彩在线| 色综合网色综合| 国产欧美精品区一区二区三区| 日本不卡一区二区三区高清视频| 色先锋久久av资源部| 久久久久久久电影| 久久激情五月激情| 欧美区一区二区三区| 一区二区三国产精华液| 99国产精品久| 国产亚洲欧美在线| 极品少妇一区二区| 日韩午夜小视频| 日本成人在线网站| 精品视频一区三区九区| 一区二区欧美在线观看| 色先锋aa成人| 亚洲激情综合网| 色呦呦日韩精品| 亚洲精品国产a久久久久久| 91免费看视频| 日韩毛片一二三区| 91免费看`日韩一区二区| 国产精品国产三级国产aⅴ原创| 国产99精品在线观看| 欧美激情一区二区三区蜜桃视频 | 94-欧美-setu| 亚洲欧美一区二区三区久本道91|