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

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

?? os_q.c

?? 陽初ucosII ADS1.2程序帶VGA顯示
?? 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
*
* 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 the queue is empty or,
*                            if 'pevent' is a NULL pointer or,
*                            if you passed an invalid event type
*********************************************************************************************************
*/

#if OS_Q_ACCEPT_EN > 0
void  *OSQAccept (OS_EVENT *pevent)
{
#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'                                  */
        return ((void *)0);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type                          */
        return ((void *)0);
    }
#endif
    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;
        }
    } else {
        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;
            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);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
#endif
    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) {
                 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  */
                 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);
             }
             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  */
             OSEventFreeList     = pevent;                 /* Get next free event control block        */
             OS_EXIT_CRITICAL();
             if (tasks_waiting == TRUE) {                  /* Reschedule only if task(s) were waiting  */
                 OS_Sched();                               /* Find highest priority task ready to run  */
             }
             *err = OS_NO_ERR;
             return ((OS_EVENT *)0);                       /* Queue has been deleted                   */

        default:
             OS_EXIT_CRITICAL();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久国产精品午夜一区ai换脸| 日本精品视频一区二区三区| 国产日韩欧美精品在线| 成人开心网精品视频| 久久精品日韩一区二区三区| www.欧美日韩| 日韩有码一区二区三区| 久久午夜国产精品| 99精品国产99久久久久久白柏| 亚洲国产欧美在线人成| 精品国产三级a在线观看| 不卡一卡二卡三乱码免费网站| 亚洲国产精品久久人人爱 | 亚洲大片精品永久免费| 精品国产成人系列| 一本大道综合伊人精品热热| 久久不见久久见免费视频7 | 日韩视频在线永久播放| 成人激情免费电影网址| 日韩av在线发布| 国产清纯在线一区二区www| 欧美日韩亚州综合| av在线综合网| 国产精品亚洲午夜一区二区三区 | 午夜精品久久久久久久久久久 | 精品三级在线看| 欧美系列亚洲系列| 成人黄色大片在线观看| 精品一区二区三区香蕉蜜桃| 亚洲精品成人悠悠色影视| 久久婷婷成人综合色| 在线观看视频一区二区| www.欧美色图| 国产在线精品一区二区 | 国产精品66部| 亚洲精品免费播放| 国产欧美日韩另类视频免费观看| 4438亚洲最大| 成人丝袜高跟foot| 国产黄色成人av| 麻豆精品一区二区| 亚洲第一av色| 亚洲一卡二卡三卡四卡| 亚洲精品第1页| 亚洲丝袜美腿综合| www激情久久| 精品国产a毛片| 色婷婷精品久久二区二区蜜臀av| 国产91精品入口| 国产精品亚洲一区二区三区在线| 麻豆免费精品视频| 五月天久久比比资源色| 亚洲国产色一区| 亚洲午夜在线观看视频在线| 一区二区三区自拍| 亚洲男人天堂av| 亚洲免费观看高清| 亚洲女厕所小便bbb| 亚洲天堂成人网| 国产精品久久久爽爽爽麻豆色哟哟 | 欧美亚洲综合一区| 在线观看一区二区精品视频| av一区二区三区在线| 成人一区二区三区| 99视频一区二区三区| 99re成人精品视频| 一本色道久久综合亚洲精品按摩| 成人丝袜18视频在线观看| 成人精品国产免费网站| 99国产一区二区三精品乱码| 国产成人精品网址| 97精品久久久午夜一区二区三区 | 老汉av免费一区二区三区| 日韩高清电影一区| 美日韩一区二区三区| 久久er精品视频| 国产精品夜夜嗨| 99久久精品免费| 91成人免费电影| 欧美日韩国产精选| 欧美mv和日韩mv的网站| 成人在线视频一区| 国内外成人在线| www.成人在线| 欧美一区二区三区视频免费| 欧美国产成人在线| 日本色综合中文字幕| 丁香桃色午夜亚洲一区二区三区| 在线观看成人小视频| 久久女同精品一区二区| 亚洲成av人在线观看| 丁香婷婷综合五月| 日韩一级片在线播放| 亚洲欧美一区二区三区孕妇| 精品一区二区三区影院在线午夜| 色欧美片视频在线观看| 国产欧美日韩亚州综合 | 亚洲h在线观看| 成人白浆超碰人人人人| 欧美成va人片在线观看| 亚洲一区二区在线免费观看视频| 国产高清亚洲一区| 日韩三级视频中文字幕| 夜夜精品浪潮av一区二区三区| 国产成人av自拍| 欧美成人精品1314www| 亚洲国产色一区| 色网综合在线观看| 欧美激情一区二区三区四区| 精品一区二区在线播放| 538prom精品视频线放| 亚洲综合无码一区二区| 91视频在线观看| 国产精品丝袜一区| 国产乱妇无码大片在线观看| 欧美一区二区三区公司| 亚洲国产综合人成综合网站| 色综合天天综合网国产成人综合天| 国产亚洲欧洲997久久综合| 蜜臀av亚洲一区中文字幕| 欧美精品视频www在线观看| 亚洲国产视频网站| 欧美午夜在线观看| 亚洲影院在线观看| 在线观看日产精品| 一区二区三区高清不卡| 色诱视频网站一区| 亚洲最大成人综合| 在线精品视频一区二区三四| 亚洲女与黑人做爰| 在线观看亚洲专区| 亚洲国产乱码最新视频| 欧美日韩亚州综合| 日韩高清国产一区在线| 日韩午夜激情电影| 韩日av一区二区| 国产亚洲精品福利| 成人精品高清在线| 亚洲精选免费视频| 欧美性一二三区| 天使萌一区二区三区免费观看| 在线成人午夜影院| 美国av一区二区| 久久久国产一区二区三区四区小说| 国产精品一区二区免费不卡| 欧美激情一区二区三区全黄| eeuss鲁片一区二区三区在线看| 国产精品短视频| 欧美伊人久久久久久久久影院| 亚洲成人你懂的| 欧美成人午夜电影| 成人免费视频免费观看| 亚洲精品免费电影| 欧美一区二区三区思思人| 精品一区二区三区香蕉蜜桃| 国产欧美精品一区| 色婷婷精品大视频在线蜜桃视频| 亚洲一区二区偷拍精品| 日韩一级二级三级| 国产.精品.日韩.另类.中文.在线.播放 | 粉嫩aⅴ一区二区三区四区| 中文字幕一区二区不卡| 欧美在线三级电影| 久久精品国产99国产| 国产精品乱码一区二区三区软件 | 国产精品色一区二区三区| 91一区二区三区在线播放| 亚洲丰满少妇videoshd| 日韩免费观看2025年上映的电影| 国产成人在线观看免费网站| 综合久久综合久久| 欧美一区二区三区的| 国产成人精品www牛牛影视| 亚洲一区二区在线免费看| 欧美精品一区男女天堂| 波波电影院一区二区三区| 视频一区在线视频| 国产精品美女久久久久久久久久久| 欧美日韩国产综合草草| 国产ts人妖一区二区| 午夜精品久久久久久久| 中文字幕 久热精品 视频在线| 欧美精品在线一区二区三区| 成人综合在线视频| 青青草原综合久久大伊人精品| 中文字幕av不卡| 日韩美女天天操| 97久久精品人人澡人人爽| 国产专区欧美精品| 午夜精品久久久久久不卡8050| 国产精品少妇自拍| 欧美成人欧美edvon| 欧美性感一类影片在线播放| 国产a久久麻豆| 捆绑调教美女网站视频一区| 亚洲精品免费在线播放| 欧美国产欧美综合| 日韩欧美卡一卡二| 欧美日韩国产综合一区二区| 91理论电影在线观看|