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

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

?? os_q.c

?? uCOS/uCGUI在2440上的移植
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.76
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "ucos_ii.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
*
*              err           is a pointer to where an error message will be deposited.  Possible error
*                            messages are:
*
*                            OS_NO_ERR           The call was successful and your task received a
*                                                message.
*                            OS_ERR_EVENT_TYPE   You didn't pass a pointer to a queue
*                            OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer
*                            OS_Q_EMPTY          The queue did not contain any messages
*
* 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 you received a NULL pointer message
*                            if the queue is empty or,
*                            if 'pevent' is a NULL pointer or,
*                            if you passed an invalid event type
*
* Note(s)    : As of V2.60, you can now pass NULL pointers through queues.  Because of this, the argument
*              'err' has been added to the API to tell you about the outcome of the call.
*********************************************************************************************************
*/

#if OS_Q_ACCEPT_EN > 0
void  *OSQAccept (OS_EVENT *pevent, INT8U *err)
{
    void      *msg;
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#endif    
#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {               /* Validate 'pevent'                                  */
        *err = OS_ERR_PEVENT_NULL;
        return ((void *)0);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type                          */
        *err = OS_ERR_EVENT_TYPE;
        return ((void *)0);
    }
    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;
        }
        *err = OS_NO_ERR;
    } else {
        *err = OS_Q_EMPTY;
        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)
{
    OS_EVENT  *pevent;
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#endif    
    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;
#if OS_EVENT_NAME_SIZE > 1
            pevent->OSEventName[0] = '?';                  /* Unknown name                             */
            pevent->OSEventName[1] = OS_ASCII_NUL;
#endif
            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)
{
    BOOLEAN    tasks_waiting;
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                            /* Prevent compiler warning                 */
#endif    
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return (pevent);
    }
#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
        *err = OS_ERR_PEVENT_NULL;
        return (pevent);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
    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) {
#if OS_EVENT_NAME_SIZE > 1
                 pevent->OSEventName[0] = '?';             /* Unknown name                             */
                 pevent->OSEventName[1] = OS_ASCII_NUL;
#endif
                 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  */
                 pevent->OSEventCnt     = 0;
                 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        */
                 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q);
             }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品视频在线观看网站| 久久成人综合网| 日本aⅴ免费视频一区二区三区 | 91精品国产91久久综合桃花| www亚洲一区| 五月天一区二区| 色综合天天在线| 精品国产一区二区三区久久影院 | 亚洲精品视频免费观看| 韩国欧美国产1区| 91麻豆精品国产91久久久久久久久| 国产日韩视频一区二区三区| 日韩高清不卡一区| 欧美在线一区二区| 亚洲天堂av老司机| 国产91在线看| 欧美大片免费久久精品三p| 悠悠色在线精品| av在线一区二区| 精品久久国产97色综合| 免费在线观看精品| 欧美日韩免费一区二区三区| 伊人夜夜躁av伊人久久| av电影在线观看完整版一区二区| 日韩女优制服丝袜电影| 日韩av中文字幕一区二区 | 成人av在线资源网站| 欧美成va人片在线观看| 一区二区不卡在线播放 | 自拍视频在线观看一区二区| 国产精品中文字幕日韩精品| 欧美精品一区二区三区视频| 蜜臀av性久久久久av蜜臀妖精| 欧美精品日韩精品| 丝袜亚洲另类欧美| 欧美区在线观看| 日本不卡高清视频| 日韩欧美综合一区| 青青草原综合久久大伊人精品| 欧美一级国产精品| 欧日韩精品视频| 亚洲综合色视频| 欧美无人高清视频在线观看| 亚洲电影一区二区| 日韩亚洲国产中文字幕欧美| 毛片av一区二区| 久久久不卡影院| 国产一区二区在线看| 国产亚洲短视频| 成人午夜视频网站| 一区二区三区中文字幕电影| 欧美日韩精品系列| 韩国午夜理伦三级不卡影院| 久久久久青草大香线综合精品| 成人动漫精品一区二区| 一区二区三区不卡视频在线观看| 欧美日韩一区二区电影| 久久99这里只有精品| 亚洲欧洲成人自拍| 911精品产国品一二三产区| 麻豆精品在线播放| 中文字幕精品三区| 欧美丝袜丝nylons| 精品一区二区免费在线观看| 中文字幕在线播放不卡一区| 欧美日韩精品欧美日韩精品一 | 国产成人精品一区二区三区四区| 亚洲国产精品传媒在线观看| 色综合天天综合狠狠| 美女视频网站久久| 国产精品免费视频一区| 欧美伦理电影网| 国产成人av电影在线观看| 亚洲午夜久久久久中文字幕久| 久久综合久色欧美综合狠狠| 日本精品视频一区二区| 久久机这里只有精品| 国产精品久久久久一区| 欧美一区二区视频在线观看 | 国产精品久久久久久久久免费丝袜| 欧美三级中文字| 国产成人亚洲综合a∨猫咪 | 亚洲视频香蕉人妖| 欧美顶级少妇做爰| 91美女精品福利| 国产精品自拍三区| 欧美aⅴ一区二区三区视频| 中文字幕一区二区三中文字幕| 欧美大片拔萝卜| 欧美无砖砖区免费| 91美女片黄在线观看91美女| 国产91精品久久久久久久网曝门| 日韩激情一二三区| 一区二区在线观看视频| 亚洲国产成人一区二区三区| 日韩欧美成人一区| 中文字幕在线不卡一区| 国产亚洲精品超碰| 精品国产一区二区三区久久久蜜月| 欧美亚洲日本一区| 色菇凉天天综合网| jizz一区二区| 国产91在线看| 成人夜色视频网站在线观看| 激情综合色综合久久综合| 五月天激情小说综合| 亚洲一区二区高清| 亚洲一区二区精品久久av| 亚洲另类色综合网站| 亚洲另类在线制服丝袜| 亚洲精品国产一区二区精华液| 国产精品网站在线观看| 日本一区二区三区四区在线视频| 久久久亚洲午夜电影| 国产香蕉久久精品综合网| 久久一留热品黄| 久久久精品影视| 国产精品全国免费观看高清| 国产精品欧美综合在线| 综合久久久久久久| 亚洲一区免费观看| 亚洲国产精品精华液网站| 亚洲图片一区二区| 日本视频一区二区三区| 免费成人在线播放| 国产在线视视频有精品| 国产精品亚洲综合一区在线观看| 国产一区二区三区在线观看免费视频 | 成人毛片老司机大片| 91麻豆免费看片| 欧美午夜片在线观看| 欧美群妇大交群的观看方式 | 在线观看不卡一区| 在线成人高清不卡| 精品噜噜噜噜久久久久久久久试看| 久久婷婷一区二区三区| 国产精品免费久久| 亚洲一区二区3| 蜜臀av性久久久久av蜜臀妖精| 国产自产高清不卡| 91免费视频网址| 欧美久久久久久蜜桃| 欧美mv日韩mv国产网站app| 国产精品国产三级国产普通话蜜臀 | av电影在线观看一区| 91麻豆免费观看| 欧美精品日韩综合在线| 欧美激情一区二区三区蜜桃视频 | 日韩精品影音先锋| 中文字幕一区在线| 日本aⅴ精品一区二区三区| 粉嫩久久99精品久久久久久夜| 91在线观看一区二区| 欧美一区二区三区影视| 欧美激情一区二区三区| 日本免费在线视频不卡一不卡二| 国产成人高清在线| 欧美吻胸吃奶大尺度电影| 久久久久国产精品麻豆 | 国产精品天天看| 亚洲成年人网站在线观看| 国产成人精品影院| 欧美一区二区三区四区高清| 中文字幕在线观看一区二区| 在线观看免费成人| 精品久久久久一区| 亚洲国产成人porn| 99久久精品久久久久久清纯| 日韩免费在线观看| 亚洲自拍另类综合| 99视频精品全部免费在线| 精品精品欲导航| 亚洲成a人片综合在线| 成人h精品动漫一区二区三区| 日韩精品一区在线观看| 亚洲国产精品久久人人爱蜜臀| 不卡的看片网站| 久久久影院官网| 精品一区二区久久| 欧美一区二区三区免费观看视频| 一区二区在线观看视频在线观看| 国产精品99久久久久久久女警| 91精品国产手机| 亚洲国产精品一区二区www在线| 99精品视频一区二区三区| 久久女同性恋中文字幕| 蜜臀久久99精品久久久久宅男| 欧美亚男人的天堂| 亚洲男人天堂一区| 99久久国产综合精品麻豆| 欧美国产激情二区三区| 九九久久精品视频| 精品国产自在久精品国产| 麻豆精品国产91久久久久久| 欧美浪妇xxxx高跟鞋交| 午夜精品免费在线观看| 欧美视频在线观看一区二区| 亚洲精品国久久99热| 欧洲av在线精品| 亚洲成人高清在线|