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

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

?? os_q.c

?? 基于GE00 實驗系統開發板的實驗指導用途
?? 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
*
*              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                             */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品久久久久久久多人混战| 久久先锋影音av鲁色资源网| 欧美日韩高清不卡| 日韩手机在线导航| 中文字幕亚洲在| 精品在线免费视频| 精品视频一区二区不卡| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 欧美一区二区三区的| 国产校园另类小说区| 日本不卡1234视频| 91丨porny丨国产入口| 久久人人爽人人爽| 天堂蜜桃一区二区三区| 99久久国产综合精品女不卡| 精品久久久久久久久久久院品网| 亚洲妇熟xx妇色黄| av综合在线播放| 国产日韩av一区| 国产综合一区二区| 日韩欧美在线综合网| 午夜视频在线观看一区| 91国产免费看| 亚洲精品亚洲人成人网 | 91色|porny| 国产精品久久三| 粉嫩av一区二区三区在线播放| 欧美va亚洲va国产综合| 蜜臀av亚洲一区中文字幕| 欧美日本乱大交xxxxx| 亚洲香蕉伊在人在线观| 91久久精品一区二区二区| 最新日韩在线视频| 成人高清视频在线观看| 国产精品三级av| eeuss鲁片一区二区三区在线看| 日本一二三不卡| www.色精品| 自拍偷拍亚洲综合| 91蜜桃免费观看视频| 一区二区视频免费在线观看| 日本高清视频一区二区| 亚洲色图.com| 欧美日韩精品福利| 石原莉奈在线亚洲二区| 日韩欧美色电影| 国产成人午夜高潮毛片| 国产精品蜜臀在线观看| 99久久er热在这里只有精品15 | 国产亚洲精品资源在线26u| 日韩精品一级中文字幕精品视频免费观看 | 婷婷激情综合网| 91麻豆精品国产无毒不卡在线观看 | 99国产精品久久| 亚洲精品欧美激情| 欧美日韩在线观看一区二区 | 久久九九久久九九| 成人一区二区三区视频 | 欧美视频在线观看一区二区| 日本欧美一区二区| 久久久综合九色合综国产精品| 粉嫩一区二区三区在线看| 亚洲色图欧美偷拍| 欧美一区二区女人| 从欧美一区二区三区| 亚洲综合在线五月| 精品免费国产一区二区三区四区| 成人精品国产免费网站| 亚洲二区在线视频| 久久综合久久综合久久综合| 91香蕉视频污| 精品一区二区三区免费播放| 亚洲丝袜自拍清纯另类| 欧美精品一级二级| 国产成人久久精品77777最新版本| 亚洲综合一区在线| 久久综合久久鬼色中文字| 色婷婷亚洲综合| 国产成人免费在线观看| 亚洲777理论| 中文字幕一区av| 精品国产电影一区二区| 欧洲精品中文字幕| 国产成人av影院| 美美哒免费高清在线观看视频一区二区 | 欧美人伦禁忌dvd放荡欲情| 99麻豆久久久国产精品免费优播| 亚洲国产精品尤物yw在线观看| 欧美国产一区二区在线观看| 欧美裸体一区二区三区| 波多野结衣欧美| 激情国产一区二区| 视频一区视频二区中文字幕| 亚洲精品国产一区二区三区四区在线| 久久蜜桃av一区二区天堂| 欧美性感一区二区三区| 成人视屏免费看| 国产一区二区三区在线观看精品 | 91麻豆精东视频| 国产一区三区三区| 日本成人在线一区| 午夜视频一区二区| 亚洲国产另类av| 亚洲一区二区三区在线播放| 亚洲欧洲成人精品av97| 26uuu欧美日本| 精品国产一区二区三区久久久蜜月| 欧美性一二三区| 在线观看日韩av先锋影音电影院| 色综合天天综合网天天狠天天| 成人黄色免费短视频| 国产综合色产在线精品| 免费成人在线观看视频| 日本网站在线观看一区二区三区 | 亚洲精品久久嫩草网站秘色| 亚洲欧洲在线观看av| 国产欧美日韩不卡| 国产视频亚洲色图| 亚洲国产成人在线| 中文字幕欧美国产| 亚洲天堂成人网| 亚洲一区av在线| 亚洲1区2区3区视频| 亚洲成人自拍网| 日韩福利电影在线| 免费观看在线综合色| 麻豆精品久久久| 国产一区二区在线电影| 国产乱子轮精品视频| 国产成人免费视频网站高清观看视频 | 精品一区免费av| 国产精品自在在线| av激情综合网| 欧美午夜精品免费| 日韩一级黄色大片| 久久噜噜亚洲综合| 国产精品久久久久四虎| 亚洲精品免费在线| 天天操天天综合网| 久久99精品久久只有精品| 91小视频在线观看| 91久久精品一区二区二区| 欧美日本不卡视频| 亚洲精品在线观看网站| 国产精品美女一区二区三区| 亚洲男人天堂av网| 天天爽夜夜爽夜夜爽精品视频| 韩国欧美国产1区| 99re6这里只有精品视频在线观看| 欧美性大战久久| 精品国产在天天线2019| 日韩美女视频一区二区| 亚洲高清视频的网址| 蜜桃视频第一区免费观看| 国产成人av电影在线播放| 91久久精品网| 国产视频不卡一区| 亚州成人在线电影| 国产精品系列在线观看| 欧洲一区二区av| 国产日韩综合av| 亚洲美女免费在线| 久久国内精品自在自线400部| 国产精品99久| 欧美日韩国产精选| 国产精品久久毛片| 日韩一区精品字幕| 99re热视频这里只精品| 欧美xxxxxxxx| 午夜不卡av在线| 成人av电影观看| 777久久久精品| 亚洲欧美激情插| 国产麻豆日韩欧美久久| 欧美日韩精品一二三区| 中文字幕色av一区二区三区| 免费成人在线网站| 欧美性一区二区| 亚洲男女毛片无遮挡| 国产乱码精品一区二区三区忘忧草 | 91福利社在线观看| 精品少妇一区二区三区日产乱码| 亚洲男人的天堂一区二区| 国产成人aaaa| 久久久精品日韩欧美| 日韩电影一区二区三区| 欧洲色大大久久| 一区二区三区在线播| 成人av在线播放网址| 久久精品亚洲精品国产欧美 | 久久99精品国产麻豆婷婷 | 国产午夜一区二区三区| 久久黄色级2电影| 欧美mv日韩mv| 麻豆国产精品官网| 日韩精品一区二区三区中文精品 | 一本色道久久综合亚洲91 | 欧美在线一区二区| 日韩美女久久久| 91小视频在线观看|