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

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

?? os_q.c

?? 0x ISP LPC210x的ISP軟件 Ucosii 2.52 for lpc2100 uC/OS-II移植程序及相關中間件 LPC2114 component library LP
?? 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一区二区三区免费野_久草精品视频
亚洲欧美一区二区久久| 精品国产一区二区国模嫣然| 国产一区二区成人久久免费影院| 亚洲综合在线第一页| 亚洲欧美综合在线精品| 国产欧美精品区一区二区三区| 欧美tickling网站挠脚心| 91精品国产手机| 欧美久久久久久蜜桃| 欧美日韩一区高清| 欧美喷潮久久久xxxxx| 欧美日本高清视频在线观看| 欧美日韩精品一二三区| 91精品久久久久久久99蜜桃| 91精品国产欧美一区二区18| 69堂成人精品免费视频| 欧美久久久久久久久久| 日韩欧美在线网站| 精品美女一区二区| 国产午夜精品福利| 国产精品不卡视频| 香蕉成人伊视频在线观看| 日韩在线播放一区二区| 黄色日韩网站视频| 97精品久久久久中文字幕| 91麻豆国产福利精品| 欧美日韩黄色一区二区| 精品久久国产字幕高潮| 国产精品久久久久久久久久久免费看 | 中文字幕第一页久久| 国产精品国产三级国产a| 樱桃国产成人精品视频| 蜜桃久久久久久| 岛国av在线一区| 欧美丝袜第三区| 久久影院电视剧免费观看| 亚洲欧美自拍偷拍| 日本不卡在线视频| av在线播放成人| 69成人精品免费视频| 欧美国产丝袜视频| 午夜激情久久久| 从欧美一区二区三区| 欧美午夜片在线看| 国产农村妇女精品| 日韩一区精品视频| 91老师国产黑色丝袜在线| 欧美一区二区三区婷婷月色| 国产精品三级av在线播放| 日韩综合在线视频| 成人av免费观看| 精品国内二区三区| 亚洲一级电影视频| 99久久国产综合精品色伊| 日韩一级高清毛片| 亚洲区小说区图片区qvod| 激情综合网最新| 在线91免费看| 一区二区三区欧美久久| 成人综合婷婷国产精品久久免费| 7777精品久久久大香线蕉| 亚洲欧美区自拍先锋| 国产成人在线色| 日韩精品一区在线观看| 视频一区二区国产| 欧美性感一区二区三区| **性色生活片久久毛片| 国产成人av在线影院| 精品日韩欧美一区二区| 免费不卡在线视频| 欧美人伦禁忌dvd放荡欲情| 一区二区三区中文字幕电影| 国产aⅴ综合色| 久久精品免费在线观看| 黄色资源网久久资源365| 欧美一区二区三区四区视频| 一区二区成人在线视频| 欧美在线高清视频| 国产精品久线在线观看| 国产不卡免费视频| 久久久精品人体av艺术| 国产一区啦啦啦在线观看| 欧美精品一区二区蜜臀亚洲| 久久精品理论片| 欧美成人午夜电影| 国产永久精品大片wwwapp| 精品国产伦一区二区三区观看体验| 日本中文字幕一区二区有限公司| 欧美高清hd18日本| 婷婷久久综合九色国产成人| 欧美日本韩国一区| 久久国产婷婷国产香蕉| 久久久久久**毛片大全| 成人福利在线看| 亚洲色图视频网站| 欧美色精品天天在线观看视频| 婷婷成人激情在线网| 欧美mv日韩mv亚洲| 国产一区二区中文字幕| 中文字幕不卡的av| 欧美伊人久久久久久久久影院| 亚洲国产日韩综合久久精品| 91精品国产乱| 丁香另类激情小说| 亚洲一区二区四区蜜桃| 日韩亚洲欧美成人一区| 国产成人啪午夜精品网站男同| 中文字幕一区二区在线播放| 欧美亚洲另类激情小说| 美腿丝袜一区二区三区| 国产欧美日韩麻豆91| 91久久人澡人人添人人爽欧美| 日韩电影免费一区| 国产精品区一区二区三区| 欧美人与禽zozo性伦| 国产成人精品在线看| 亚洲va中文字幕| 国产欧美精品一区二区三区四区| 在线一区二区三区四区| 国产一区二区日韩精品| 一区二区三区在线观看国产| 日韩精品一区在线观看| 欧美综合色免费| 国产精品亚洲专一区二区三区| 一区二区三区免费| 国产欧美日产一区| 日韩视频123| 91高清在线观看| 成人免费看黄yyy456| 美女高潮久久久| 亚洲一区二区三区四区中文字幕| 久久久综合视频| 日韩一级在线观看| 日本韩国欧美国产| 成人国产精品免费| 国产乱码字幕精品高清av| 日本午夜一本久久久综合| 亚洲视频免费在线| 国产精品三级电影| 久久久一区二区三区捆绑**| 91精品国产麻豆国产自产在线 | 一区二区三区中文字幕在线观看| 久久欧美一区二区| 欧美一区二区视频网站| 欧美三级在线视频| 一本色道综合亚洲| 成人99免费视频| 国产高清精品在线| 极品销魂美女一区二区三区| 日精品一区二区| 五月天一区二区三区| 亚洲成人中文在线| 亚洲a一区二区| 亚洲午夜三级在线| 亚洲风情在线资源站| 亚洲人成精品久久久久久 | 色婷婷综合久久久中文字幕| 国产白丝精品91爽爽久久| 国产乱一区二区| 国产99久久精品| 成人av在线播放网站| 成人永久aaa| 91丨porny丨中文| 97精品电影院| 欧美午夜一区二区三区| 欧美日韩国产一级| 欧美一区二区三区日韩| 日韩免费观看高清完整版在线观看| 欧美日韩国产三级| 日韩一区二区视频在线观看| 91精品国产色综合久久不卡蜜臀| 日韩午夜三级在线| 久久久久久久一区| 国产精品三级av在线播放| 亚洲激情六月丁香| 日本中文在线一区| 国产一区二区美女| 99国产精品99久久久久久| 色综合久久久久久久久| 欧美福利视频导航| 久久综合九色欧美综合狠狠| 国产精品久久网站| 亚洲国产日韩在线一区模特| 美女免费视频一区二区| 成人黄色电影在线| 欧美日韩一区二区三区高清 | 国产在线麻豆精品观看| 高清成人在线观看| 在线观看免费视频综合| 日韩欧美中文字幕精品| 国产亚洲欧美日韩日本| 亚洲天堂2014| 久久激情五月婷婷| 91视频在线看| 成人性生交大片免费| 日韩欧美123| 欧美一区二区三区啪啪| 97se亚洲国产综合自在线观| 在线播放亚洲一区| 欧美国产激情二区三区 |