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

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

?? os_q.c

?? 本人經過實驗的可以再LPC2214上跑起來的ucos-ii。
?? 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一区二区三区免费野_久草精品视频
youjizz国产精品| 亚洲自拍与偷拍| 6080日韩午夜伦伦午夜伦| 色哟哟国产精品免费观看| 成人教育av在线| 国产69精品一区二区亚洲孕妇 | 91精品国产综合久久小美女| 91免费版在线| 91麻豆免费视频| 一本久久a久久精品亚洲| 色婷婷综合久久久中文字幕| 91麻豆免费观看| 在线观看日韩毛片| 欧美日韩精品欧美日韩精品一综合| 欧美日韩国产小视频| 欧美日韩的一区二区| 日韩午夜中文字幕| 久久午夜色播影院免费高清| 国产欧美日韩久久| 中文字幕制服丝袜一区二区三区| 中文字幕欧美一| 亚洲成人午夜影院| 精品中文av资源站在线观看| 狠狠色丁香久久婷婷综合_中| 国产不卡一区视频| 色悠悠久久综合| 欧美一区二区三区在线看| 久久男人中文字幕资源站| 国产精品国产三级国产普通话99| 亚洲精品视频免费观看| 免费观看在线色综合| 国产成人午夜精品5599| 在线日韩av片| 欧美精品一区二区三| 1024亚洲合集| 理论片日本一区| 99久久精品国产一区二区三区| 蜜桃视频一区二区三区在线观看| 香蕉成人伊视频在线观看| 中文字幕欧美日本乱码一线二线 | 欧美r级在线观看| 国产在线看一区| 91福利在线观看| 亚洲黄色性网站| 欧美自拍偷拍一区| 午夜精品在线看| 欧美成人伊人久久综合网| 精品一区二区三区免费播放| 久久日韩粉嫩一区二区三区| 国产精品一二三四区| 国产欧美精品区一区二区三区 | 亚洲一区二区成人在线观看| 欧美无砖专区一中文字| 亚洲国产sm捆绑调教视频| 欧美精品久久天天躁| 日本不卡一二三| 久久免费视频色| av在线播放不卡| 午夜精品久久久久久久久久| 日韩一级二级三级| 国产激情视频一区二区三区欧美| 国产精品不卡视频| 欧美日韩精品免费| 国产在线精品一区二区夜色| 国产精品传媒入口麻豆| 欧美视频一区二区| 激情小说亚洲一区| 亚洲激情自拍视频| 欧美成人伊人久久综合网| 丁香婷婷综合激情五月色| 亚洲午夜影视影院在线观看| 欧美变态tickle挠乳网站| 成人app在线| 蜜臀av国产精品久久久久| 国产精品美女www爽爽爽| 欧美日韩亚洲高清一区二区| 国产原创一区二区| 亚洲第一搞黄网站| 国产精品沙发午睡系列990531| 精品污污网站免费看| 国产精品一区二区你懂的| 亚洲午夜久久久久久久久电影院| 久久亚洲精品国产精品紫薇| 欧美性色aⅴ视频一区日韩精品| 久久国产精品露脸对白| 亚洲午夜免费视频| 国产精品嫩草99a| 精品久久人人做人人爱| 在线精品亚洲一区二区不卡| 国产成人在线视频网站| 日韩和欧美的一区| 一区二区三区加勒比av| 欧美国产日韩a欧美在线观看| 91麻豆精品国产91久久久使用方法| 欧美日韩一区二区不卡| 国产美女一区二区| 蜜桃一区二区三区在线观看| **性色生活片久久毛片| 国产欧美日韩在线观看| 日韩欧美你懂的| 欧美日韩精品福利| 91福利在线观看| 91麻豆蜜桃一区二区三区| 成人黄动漫网站免费app| 国产在线视视频有精品| 久久国产尿小便嘘嘘| 日韩激情中文字幕| 日本成人在线不卡视频| 偷拍日韩校园综合在线| 一区二区三区**美女毛片| 国产精品久久久久久久岛一牛影视| 欧美精品一区二区三区久久久| 欧美一区午夜精品| 欧美一区二区三区四区视频 | 91免费版在线| 99re热视频这里只精品| 99久久婷婷国产综合精品| 粉嫩一区二区三区在线看 | 五月天亚洲精品| 亚洲一二三专区| 亚洲国产日韩一级| 图片区小说区国产精品视频| 亚洲成人精品一区| 青青草国产成人99久久| 麻豆成人在线观看| 精品综合久久久久久8888| 国产一区二区三区最好精华液| 精品无码三级在线观看视频| 韩国女主播成人在线| 国产乱码精品一品二品| 成人午夜视频免费看| 色综合久久久久网| 欧美视频三区在线播放| 91精品国产综合久久久蜜臀图片| 日韩欧美在线123| 国产视频一区二区在线| 国产精品入口麻豆原神| 夜色激情一区二区| 青青草原综合久久大伊人精品| 激情六月婷婷综合| caoporen国产精品视频| 欧美日韩和欧美的一区二区| 日韩午夜电影在线观看| 亚洲国产精品v| 亚洲高清不卡在线观看| 日本不卡不码高清免费观看| 国产剧情av麻豆香蕉精品| 不卡的电视剧免费网站有什么| 在线免费观看日本欧美| 精品剧情v国产在线观看在线| 国产精品毛片久久久久久久| 亚洲国产精品一区二区久久恐怖片 | 欧美精品一卡两卡| 日韩精品一区二| 最新中文字幕一区二区三区| 偷拍一区二区三区四区| 国产不卡视频在线观看| 欧美人妖巨大在线| 国产色产综合色产在线视频| 亚洲永久免费av| 国产精品一级二级三级| 欧美日韩黄视频| 国产精品丝袜一区| 日韩电影在线观看电影| 不卡的av电影在线观看| 欧美一区二区视频在线观看 | 国产成人一区在线| 欧美日韩一区在线观看| 国产亚洲欧美一级| 日韩高清不卡一区二区三区| 99综合影院在线| 久久久综合视频| 日本成人中文字幕在线视频| 99久久99久久精品免费观看 | 在线观看网站黄不卡| 日本一区二区三区dvd视频在线 | 欧美日韩精品高清| 国产精品国产成人国产三级| 狠狠色综合日日| 欧美一区二区福利视频| 亚洲一区二区三区小说| 成人黄色在线视频| 日本一区二区三区高清不卡| 久久精品久久综合| 91精品视频网| 国产又粗又猛又爽又黄91精品| 欧美日韩亚洲综合一区二区三区 | 成人99免费视频| 26uuu久久综合| 美国三级日本三级久久99| 欧美美女一区二区| 亚洲在线视频网站| 色哟哟一区二区在线观看| 国产精品视频免费| 成人免费黄色大片| 国产日韩综合av| 岛国av在线一区| 中文子幕无线码一区tr| 国产mv日韩mv欧美| 国产精品另类一区|