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

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

?? os_q.c

?? ~{WwU_J9SC5D~}ucos~{T4Bk#,1`RkA4=S5wJT>y?IRT#,4x~}uart~{2bJT~}
?? C
?? 第 1 頁 / 共 3 頁
字號(hào):
/*
*********************************************************************************************************
*                                                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
*
*              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)
{
#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'                                  */
        *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)
{
#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;
#if OS_EVENT_NAME_SIZE > 0
            (void)strcpy(pevent->OSEventName, "?");
#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)
{
#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);
    }
#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 > 0
                 (void)strcpy(pevent->OSEventName, "?");   /* Unknown name                             */
#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        */
                 OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q);
             }
#if OS_EVENT_NAME_SIZE > 0
             (void)strcpy(pevent->OSEventName, "?");       /* Unknown name                             */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99re这里只有精品6| 欧美在线观看视频一区二区| 亚洲精选免费视频| 日韩欧美在线网站| 一本高清dvd不卡在线观看| 免费成人在线观看| 亚洲综合一区在线| 国产精品无遮挡| 制服丝袜中文字幕一区| 91免费看视频| 国产精品1区2区3区在线观看| 亚洲国产精品久久人人爱蜜臀| 亚洲国产精品高清| 欧美岛国在线观看| 精品视频1区2区| 99久久免费国产| 国产精品一区二区三区99| 婷婷丁香激情综合| 亚洲一区在线视频| 中文字幕视频一区| 国产精品情趣视频| 精品99久久久久久| 日韩欧美在线一区二区三区| 欧美日韩中文字幕一区| 色婷婷亚洲精品| av中文字幕不卡| 成人一二三区视频| 国产成人午夜精品影院观看视频| 蜜桃视频一区二区| 欧美aaa在线| 免费成人在线视频观看| 男女男精品网站| 丝袜诱惑亚洲看片| 亚洲电影激情视频网站| 亚洲综合免费观看高清完整版| 中文字幕在线观看一区| 久久久99精品久久| 久久久精品人体av艺术| 精品国产露脸精彩对白| 26uuu欧美日本| 久久久欧美精品sm网站| 国产午夜精品久久久久久久 | 亚洲va欧美va国产va天堂影院| 日韩理论片中文av| 中文字幕一区二区三区av| 国产精品久久久久aaaa樱花| 国产亚洲一本大道中文在线| 欧美不卡在线视频| 精品日韩欧美在线| 久久久久久久久久久久久久久99| 久久久噜噜噜久久中文字幕色伊伊| 精品伦理精品一区| 久久人人爽人人爽| 国产精品你懂的| 亚洲欧美另类图片小说| 亚洲免费观看在线视频| 亚洲国产视频直播| 亚洲成a人片综合在线| 午夜视频一区在线观看| 奇米精品一区二区三区在线观看| 免费成人你懂的| 国产一区二区三区不卡在线观看 | 久久久精品黄色| 久久久国际精品| 国产精品免费aⅴ片在线观看| 国产精品久久久久桃色tv| 一区二区在线看| 日韩av一区二区在线影视| 国产伦精一区二区三区| 成人免费va视频| 在线视频一区二区三| 日韩女优毛片在线| 国产精品女人毛片| 亚洲高清在线视频| 加勒比av一区二区| 99re热视频这里只精品| 欧美乱妇15p| 国产亚洲欧美中文| 一区二区高清视频在线观看| 奇米精品一区二区三区在线观看| 国产成人av电影在线| 91色porny| 日韩免费高清av| 亚洲欧洲精品天堂一级| 香蕉成人啪国产精品视频综合网 | 成人一级片在线观看| 欧美三级日韩三级国产三级| 欧美精品一区二区三区四区| 亚洲欧美怡红院| 蜜臀精品久久久久久蜜臀| 日韩欧美一二区| 成人欧美一区二区三区黑人麻豆 | 中文字幕亚洲区| 日本伊人色综合网| 99精品国产热久久91蜜凸| 日韩一区二区影院| 亚洲免费在线视频一区 二区| 奇米色一区二区| 91美女在线观看| 亚洲精品在线免费观看视频| 亚洲香肠在线观看| 国产69精品久久久久毛片| 欧美日产国产精品| 欧美国产激情二区三区| 日本欧美韩国一区三区| 一本久久综合亚洲鲁鲁五月天| 精品久久久久久久一区二区蜜臀| 亚洲精品视频自拍| 国产精品一区二区在线观看不卡 | 2020国产精品| 无码av免费一区二区三区试看| 高清成人在线观看| 日韩欧美不卡一区| 亚洲成人动漫精品| 99这里都是精品| 欧美精品一区二区三区高清aⅴ| 一区二区三区在线观看欧美 | 国产精品18久久久久久久网站| 777奇米四色成人影色区| 亚洲精品久久嫩草网站秘色| 成人免费视频视频| 久久这里都是精品| 免费久久99精品国产| 欧美卡1卡2卡| 亚洲一区二区欧美激情| 91麻豆swag| 综合分类小说区另类春色亚洲小说欧美 | 日韩电影在线一区二区三区| 91麻豆视频网站| 亚洲蜜臀av乱码久久精品蜜桃| 国产99一区视频免费| 亚洲图片欧美一区| 91久久香蕉国产日韩欧美9色| 中国色在线观看另类| 丁香婷婷综合五月| 久久久亚洲午夜电影| 国产老肥熟一区二区三区| 亚洲精品在线观看网站| 欧美在线啊v一区| 亚洲亚洲精品在线观看| 欧美日韩在线亚洲一区蜜芽| 亚洲综合丝袜美腿| 欧美人狂配大交3d怪物一区| 五月婷婷色综合| 日韩女同互慰一区二区| 久久电影网电视剧免费观看| 精品日韩av一区二区| 国内国产精品久久| 欧美韩国日本一区| 国产成a人亚洲精品| 国产精品欧美综合在线| 91香蕉视频污在线| 午夜精品久久久久影视| 69堂亚洲精品首页| 老司机免费视频一区二区三区| 欧美电影免费观看高清完整版在 | www.日韩精品| 亚洲欧美福利一区二区| 欧美日韩综合不卡| 老司机精品视频在线| 久久久精品综合| 色综合天天综合网国产成人综合天| 亚洲日本护士毛茸茸| 欧美日韩精品免费| 久久97超碰国产精品超碰| 国产亚洲成av人在线观看导航| 国产成人精品1024| 国产成人自拍网| 亚洲免费观看高清完整版在线 | 日日摸夜夜添夜夜添亚洲女人| 欧美一级片在线观看| 国内外成人在线| 国产精品护士白丝一区av| 欧美午夜精品久久久| 久久成人免费网站| 国产精品国产三级国产| 欧美一a一片一级一片| 久久99蜜桃精品| 最新中文字幕一区二区三区| 欧美群妇大交群的观看方式| 国产一区二区三区香蕉| 亚洲日本在线天堂| 日韩一区二区三区在线| 成人免费一区二区三区视频 | av亚洲精华国产精华| 日本一区二区三区高清不卡| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 自拍av一区二区三区| 欧美三级在线视频| 国产一区二区三区免费| 亚洲免费av在线| 成人黄色av电影| 美女脱光内衣内裤视频久久网站| 国产精品日韩成人| 日韩欧美专区在线| 色婷婷综合久久久久中文 | 精品国产髙清在线看国产毛片 | 精品国内二区三区| 色94色欧美sute亚洲线路二| 精品一区二区三区影院在线午夜|