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

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

?? os_q.c

?? UCOS II V2.80 移植到freescale的qe128上面的源代碼。并且包含UCOS II V2.80的源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2005, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.80
*********************************************************************************************************
*/

#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 = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (err == (INT8U *)0) {                     /* Validate 'err'                                     */
        return ((void *)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 = 0;
#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_EVENT  *pevent_return;
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (err == (INT8U *)0) {                               /* Validate 'err'                           */
        return (pevent);
    }
    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);
    }
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return (pevent);
    }
    OS_ENTER_CRITICAL();
    if (pevent->OSEventGrp != 0) {                         /* 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;
                 pevent_return          = (OS_EVENT *)0;   /* Queue has been deleted                   */
             } else {
                 OS_EXIT_CRITICAL();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区三区视频在线观看| 国产91丝袜在线播放0| 欧美日韩精品一区二区| 亚洲成a人片在线不卡一二三区 | 日韩免费一区二区| 青娱乐精品视频在线| 日韩免费一区二区| 国产盗摄视频一区二区三区| 国产日韩欧美激情| 99视频精品在线| 亚洲美女免费视频| 欧美一区二区三区影视| 麻豆国产欧美日韩综合精品二区| 欧美精品一区二区在线播放| 精品一区二区三区久久久| 国产亚洲一区二区三区四区 | 国产一区二区三区美女| 亚洲国产精品ⅴa在线观看| 91蜜桃免费观看视频| 亚洲在线中文字幕| 日韩欧美一区中文| 成人精品鲁一区一区二区| 亚洲国产一区视频| 久久综合色8888| 99久久伊人网影院| 日韩国产在线观看一区| 久久久精品影视| 色综合久久中文字幕综合网| 日韩国产欧美在线播放| 国产片一区二区| 欧美亚洲图片小说| 国产一区二区三区日韩| 一区二区国产盗摄色噜噜| 日韩欧美中文字幕制服| 99re这里只有精品6| 日本va欧美va欧美va精品| 最近日韩中文字幕| 日韩欧美电影一区| 一本大道av一区二区在线播放 | 精品精品国产高清a毛片牛牛| 成人午夜在线视频| 奇米在线7777在线精品| 亚洲色大成网站www久久九九| 日韩亚洲欧美高清| 色欧美片视频在线观看在线视频| 精品一区二区三区影院在线午夜| 亚洲视频狠狠干| 欧美精品一区二区三区在线| 欧美日韩精品一区二区天天拍小说| 国产毛片精品国产一区二区三区| 亚洲成人tv网| 亚洲免费观看高清完整版在线观看熊| 精品国产一区二区三区不卡 | 欧美猛男男办公室激情| 99久久综合国产精品| 国产一区二区h| 日本免费在线视频不卡一不卡二| 亚洲男人的天堂网| 中文字幕第一区综合| 精品国内二区三区| 欧美成人a视频| 91精品国模一区二区三区| 色婷婷综合五月| 99re视频精品| 99久久亚洲一区二区三区青草| 国产美女一区二区| 国产一区 二区 三区一级| 捆绑调教一区二区三区| 日韩制服丝袜先锋影音| 亚洲一区二区三区四区在线| 亚洲视频一区二区免费在线观看| 国产精品麻豆网站| 国产精品久久三区| 最新热久久免费视频| 欧美激情综合网| 久久精品视频网| 2017欧美狠狠色| 欧美va亚洲va在线观看蝴蝶网| 欧美一区二区三区在线观看 | 99精品视频一区二区三区| 国产成人免费视频精品含羞草妖精| 久久不见久久见免费视频7| 日本欧美一区二区三区乱码| 日韩成人一级大片| 日本不卡中文字幕| 美国十次综合导航| 国产在线播放一区二区三区| 99久久99久久精品免费观看 | 国产一区在线精品| 国产麻豆精品久久一二三| 国产九色sp调教91| 成人一区二区视频| 99国产欧美久久久精品| 色婷婷精品久久二区二区蜜臀av| 91国在线观看| 欧美优质美女网站| 777a∨成人精品桃花网| 日韩欧美一区二区不卡| 久久久蜜桃精品| 国产精品三级在线观看| 国产精品激情偷乱一区二区∴| 亚洲色图19p| 五月天丁香久久| 国产在线精品一区在线观看麻豆| 国产美女一区二区三区| 99re这里都是精品| 欧美嫩在线观看| 国产视频一区不卡| 亚洲一区免费观看| 久久国产精品99精品国产| 成人免费视频app| 欧美综合一区二区| 久久一区二区三区国产精品| 国产精品免费久久久久| 亚洲第一二三四区| 国产精品一线二线三线精华| 成人黄色在线看| 欧美日本在线播放| 中文字幕精品在线不卡| 亚洲一线二线三线视频| 国内成+人亚洲+欧美+综合在线| www.日韩av| 在线播放日韩导航| 国产精品麻豆99久久久久久| 午夜精品成人在线| 成人国产精品免费| 91麻豆精品国产91久久久久| 久久久久久电影| 亚洲高清视频中文字幕| 国产91精品一区二区麻豆网站| 欧美视频自拍偷拍| 国产精品国产馆在线真实露脸| 蜜臀av性久久久久蜜臀aⅴ流畅 | 久久久久久久免费视频了| 亚洲一区二区三区视频在线播放| 国产伦精品一区二区三区免费| 欧美视频中文字幕| 最新日韩在线视频| 国产精品99久久久久久久女警| 欧美麻豆精品久久久久久| 成人免费小视频| 国产成人啪免费观看软件| 欧美一二三在线| 亚洲图片有声小说| 91丝袜高跟美女视频| 亚洲国产成人私人影院tom | 国产精品亚洲专一区二区三区| 欧美色电影在线| 尤物视频一区二区| jizz一区二区| 中国色在线观看另类| 卡一卡二国产精品 | 欧美成人性战久久| 亚洲v中文字幕| 色综合天天在线| 中文字幕第一区二区| 国产一二精品视频| 精品国产91乱码一区二区三区| 亚洲国产精品一区二区www在线| 成人黄页在线观看| 中文字幕av一区二区三区| 激情六月婷婷久久| 日韩视频国产视频| 蜜臀久久99精品久久久画质超高清| 欧洲精品中文字幕| 成人av免费在线播放| 久久这里只有精品6| 国内成人自拍视频| 久久久久久久国产精品影院| 国内久久婷婷综合| 欧美精品一区二区三区一线天视频 | 久久久久久久久久久久久久久99| 久久69国产一区二区蜜臀| 欧美一区二区三区电影| 日韩电影在线看| 欧美一级欧美三级在线观看| 午夜精品福利一区二区蜜股av | 日本道在线观看一区二区| 亚洲天堂中文字幕| 在线观看一区日韩| 亚洲动漫第一页| 欧美卡1卡2卡| 日韩精品一二三四| 91精品国产入口| 精品在线观看免费| 中文字幕不卡一区| 91视频一区二区| 亚洲国产日产av| 日韩欧美区一区二| 国精产品一区一区三区mba视频 | 日韩在线卡一卡二| 69p69国产精品| 国产经典欧美精品| 亚洲欧美一区二区三区极速播放 | 欧美中文字幕一二三区视频| 亚洲成人一二三| 精品动漫一区二区三区在线观看| 欧美日韩成人激情| 国产麻豆一精品一av一免费| 国产精品久久久久永久免费观看 |