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

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

?? os_q.c

?? ARM7開發全部源代碼經典.rar
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                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);
             }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国内精品国产三级国产a久久| 精彩视频一区二区三区| 久久不见久久见免费视频1| 成年人网站91| 精品99一区二区三区| 日韩理论电影院| 成人一区二区在线观看| 欧美r级在线观看| 亚洲成人免费av| 99r国产精品| 中文字幕电影一区| 精久久久久久久久久久| 欧美高清你懂得| 亚洲综合一二区| 波多野结衣欧美| 久久精品一区二区三区不卡牛牛 | 日韩一区欧美二区| 色婷婷一区二区三区四区| 国产午夜精品久久久久久免费视| 图片区小说区区亚洲影院| 色美美综合视频| 亚洲欧洲精品一区二区精品久久久 | 日本最新不卡在线| 欧美综合欧美视频| 亚洲高清在线视频| 在线一区二区观看| 一区二区三区在线视频播放| av亚洲精华国产精华精华| 日本一区二区免费在线| 国产精品自拍毛片| 欧美国产日韩在线观看| 国产成人激情av| 国产精品三级视频| 91香蕉视频mp4| 亚洲色图一区二区| 91久久线看在观草草青青 | 国产精品免费视频观看| 成人免费看视频| 亚洲丝袜精品丝袜在线| 91麻豆成人久久精品二区三区| 亚洲欧洲美洲综合色网| 色婷婷久久久综合中文字幕 | 国模少妇一区二区三区| 精品av久久707| 国产99久久久国产精品潘金| 欧美国产成人在线| 日本韩国一区二区| 婷婷久久综合九色国产成人| 欧美一级理论片| 国产一区二区三区黄视频 | 国产欧美精品一区二区色综合朱莉| 国产成人在线看| 亚洲美女免费视频| 欧美一区二区三区小说| 激情五月婷婷综合网| 国产精品麻豆一区二区| 色婷婷久久久综合中文字幕| 五月天精品一区二区三区| 日韩一级免费一区| 成人伦理片在线| 亚洲综合色噜噜狠狠| 日韩欧美色综合| 91视频观看视频| 奇米一区二区三区| 中文一区二区完整视频在线观看| 色综合久久久久久久久| 免费观看一级特黄欧美大片| 国产精品久久777777| 欧美一区二区精品在线| 成人动漫一区二区| 美女被吸乳得到大胸91| 中文字幕一区二区三区色视频| 欧美日韩你懂的| 成人精品亚洲人成在线| 天天操天天综合网| 中文字幕日韩一区| 日韩免费成人网| 色老综合老女人久久久| 国内精品国产三级国产a久久| 亚洲综合免费观看高清完整版在线| 精品国产髙清在线看国产毛片| 91成人在线免费观看| 国产精品一区二区果冻传媒| 一区二区免费看| 国产精品久久久久精k8| 2024国产精品| 日韩三级中文字幕| 欧美亚洲综合网| 91麻豆国产自产在线观看| 国产一区日韩二区欧美三区| 图片区小说区国产精品视频| 亚洲欧美色图小说| 国产精品久久久久久亚洲毛片| 日韩欧美国产电影| 欧美欧美午夜aⅴ在线观看| eeuss鲁片一区二区三区在线看| 狠狠网亚洲精品| 美国av一区二区| 午夜欧美电影在线观看| 亚洲免费在线观看| 中文字幕一区二| 中文字幕av一区二区三区高| 久久婷婷成人综合色| 日韩欧美一二三| 日韩欧美自拍偷拍| 日韩一级免费观看| 日韩欧美卡一卡二| 日韩精品一区二区三区视频播放| 欧美丝袜第三区| 欧美日韩精品一区二区三区| 在线看不卡av| 在线欧美日韩国产| 欧洲av在线精品| 在线观看视频91| 欧美视频在线一区| 欧美日韩精品福利| 欧美日韩在线一区二区| 欧美日韩精品欧美日韩精品一综合| 欧美伊人久久大香线蕉综合69| 欧美视频一区在线| 欧美日韩美少妇| 日韩精品一区二区三区在线 | 日韩国产欧美三级| 日本不卡视频在线观看| 久久丁香综合五月国产三级网站| 韩国成人精品a∨在线观看| 韩国女主播一区二区三区| 国产福利一区二区| 99re这里只有精品首页| 在线免费观看视频一区| 欧美女孩性生活视频| 日韩一区二区高清| 中文字幕成人av| 亚洲一区二区欧美| 精品在线你懂的| 北条麻妃国产九九精品视频| 欧日韩精品视频| 精品少妇一区二区三区在线视频| 欧美国产亚洲另类动漫| 亚洲一区二区3| 激情成人午夜视频| 色诱亚洲精品久久久久久| 欧美一级片在线看| 国产片一区二区| 午夜私人影院久久久久| 久久电影网电视剧免费观看| caoporn国产一区二区| 欧美男人的天堂一二区| 欧美高清在线一区| 亚洲成a人片综合在线| 国产精品综合视频| 欧美影视一区二区三区| 久久久av毛片精品| 亚洲午夜日本在线观看| 国产麻豆成人传媒免费观看| 色素色在线综合| 精品91自产拍在线观看一区| 亚洲特黄一级片| 国产乱码精品一区二区三区五月婷| 91丨porny丨在线| 日韩欧美中文字幕一区| 亚洲另类在线视频| 国产丶欧美丶日本不卡视频| 9191成人精品久久| 亚洲欧美乱综合| 国产精品2024| 欧美一区三区四区| 亚洲日本青草视频在线怡红院| 黄色日韩网站视频| 在线播放亚洲一区| 亚洲精品视频在线| 国产69精品一区二区亚洲孕妇| 91精品欧美福利在线观看| 亚洲欧美怡红院| 国产不卡高清在线观看视频| 56国语精品自产拍在线观看| 亚洲视频网在线直播| 国产黄色精品视频| 精品捆绑美女sm三区| 午夜精品久久久久久久久| 色综合久久久久久久| 欧美激情中文不卡| 国产乱子伦一区二区三区国色天香 | 色乱码一区二区三区88| 国产精品久久影院| 国产成人av一区二区| 精品欧美久久久| 蜜臀av一区二区三区| 欧美日韩国产高清一区二区| 一区二区三区影院| 一本到一区二区三区| 欧美国产精品一区二区三区| 国产一区二区三区精品视频| 精品日韩欧美在线| 精品一区二区在线免费观看| 欧美电影免费观看高清完整版在| 日韩高清欧美激情| 日韩欧美中文字幕制服| 久久精品国产成人一区二区三区 | 欧美亚洲综合网|