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

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

?? os_q.c

?? ARM7 based on STR71x, UCOS migration
?? 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
*
* 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();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品视频一二| 一区二区中文视频| 欧美日韩亚洲综合一区二区三区| 欧美一区二区三区在线看| 一区二区三区精品视频| 国产欧美一区二区精品忘忧草| 欧美性猛交xxxx黑人交| 亚洲一区二区三区不卡国产欧美| 亚洲五月六月丁香激情| 欧美精品粉嫩高潮一区二区| 久久99九九99精品| 亚洲欧美综合在线精品| 香蕉久久夜色精品国产使用方法 | 亚洲成人三级小说| 久久久99久久精品欧美| 欧美成人a视频| 欧美国产1区2区| 久久―日本道色综合久久| 亚洲精品在线免费播放| 国产老女人精品毛片久久| 亚洲一二三区在线观看| av网站免费线看精品| 国产精品色眯眯| 亚洲一区二区视频| 欧美午夜精品理论片a级按摩| 成人一道本在线| 精品在线免费观看| 中文字幕一区二区三区不卡| 欧美色图免费看| 白白色亚洲国产精品| 国产在线观看免费一区| 成人一道本在线| 亚洲人成在线观看一区二区| 精品中文字幕一区二区| 石原莉奈在线亚洲二区| 欧美a级理论片| 美女网站视频久久| 亚洲麻豆国产自偷在线| 亚洲国产成人高清精品| 午夜精品国产更新| 久久天堂av综合合色蜜桃网| 欧美成人bangbros| 久久精品综合网| 亚洲福利一区二区| 国产成人精品免费视频网站| 亚洲综合小说图片| 国产精品一二一区| www..com久久爱| 国产成a人亚洲| 欧美日韩国产小视频在线观看| 51精品秘密在线观看| 亚洲欧美另类图片小说| 亚洲精品一线二线三线无人区| 精品粉嫩超白一线天av| 欧美xxxxx牲另类人与| 亚洲日本护士毛茸茸| 国产精品一二二区| 狠狠久久亚洲欧美| 99精品久久只有精品| 精品国产亚洲一区二区三区在线观看| 日本亚洲最大的色成网站www| 黄色成人免费在线| 99精品桃花视频在线观看| 99久久99久久综合| 欧美视频一区二| 在线综合+亚洲+欧美中文字幕| 国产欧美精品一区aⅴ影院 | 日本一不卡视频| 91久久线看在观草草青青| 91精选在线观看| 亚洲国产美国国产综合一区二区| 国产高清不卡一区| 国产三级久久久| 国产一区二区不卡在线 | 91丨porny丨户外露出| 精品日韩一区二区| 久久av资源网| 日本一区二区视频在线| 成人毛片在线观看| 91精品啪在线观看国产60岁| 视频一区免费在线观看| 8x8x8国产精品| 成人一区二区在线观看| 中文字幕av一区二区三区高| 免费成人在线影院| 777午夜精品视频在线播放| 亚洲国产中文字幕| 亚洲美女免费在线| 精品污污网站免费看| 日韩中文字幕一区二区三区| 粉嫩一区二区三区性色av| 欧美日韩色综合| 亚洲主播在线播放| 高清不卡一区二区| 亚洲精品中文字幕在线观看| 欧美一区二区在线视频| 成人a免费在线看| 久久久久久久久一| 成人黄色网址在线观看| 一区二区久久久久久| 精品乱人伦小说| 色94色欧美sute亚洲线路一久| 国产a区久久久| 欧美剧情片在线观看| 亚洲人成在线观看一区二区| 久久综合精品国产一区二区三区| 欧美日韩在线直播| 国内精品久久久久影院一蜜桃| 亚洲成人午夜影院| 欧美日韩在线播放一区| av一二三不卡影片| 美女久久久精品| 最近中文字幕一区二区三区| 欧美xxx久久| 日韩精品在线一区| 精品国产伦一区二区三区观看方式| 成人一区二区视频| 国产在线一区二区| 一区二区在线观看免费视频播放| 91精品国产福利在线观看| 欧美高清一级片在线| 91成人免费网站| 99久久精品国产网站| 激情文学综合丁香| 日本中文一区二区三区| 欧美一级日韩不卡播放免费| 日韩av一区二区三区| 免费精品99久久国产综合精品| 亚洲黄色性网站| 国产精品久久久久精k8| 亚洲精品ww久久久久久p站| 亚洲欧美日韩久久| 久久精品一区八戒影视| 国产精品色哟哟| 亚洲一区二区五区| 国产经典欧美精品| 欧美剧情电影在线观看完整版免费励志电影 | 欧美高清视频一二三区| 日韩激情视频在线观看| 国内精品不卡在线| 福利视频网站一区二区三区| 日本欧美加勒比视频| 亚洲午夜激情网站| 国产一区二区三区黄视频| 欧美电影在哪看比较好| 国产精品黄色在线观看| 午夜欧美2019年伦理| 色琪琪一区二区三区亚洲区| 欧美日韩你懂的| 久久久久久久久久看片| 图片区小说区区亚洲影院| 国内偷窥港台综合视频在线播放| 欧美午夜在线一二页| 久久久久国产精品厨房| 337p粉嫩大胆噜噜噜噜噜91av| 一区二区三区久久| 美女脱光内衣内裤视频久久网站| 日韩电影在线看| 最新热久久免费视频| 国产精品一区在线| 久久日一线二线三线suv| 精品综合免费视频观看| 精品三级在线观看| 亚洲一区在线免费观看| 国产精品123| 在线免费观看视频一区| 亚洲成人午夜电影| 在线成人免费视频| 黄色资源网久久资源365| xnxx国产精品| 久久婷婷成人综合色| 麻豆一区二区在线| 欧美在线看片a免费观看| 欧美经典一区二区三区| 视频一区欧美精品| ww久久中文字幕| 欧美亚洲日本一区| 日韩精品专区在线影院观看 | 日韩欧美一区在线观看| 亚洲国产日韩a在线播放| 欧美日韩午夜影院| 视频在线观看91| 精品国产成人在线影院 | 久久精品国产一区二区三区免费看| 欧美日韩国产精品自在自线| 亚洲高清久久久| 欧美一级艳片视频免费观看| 在线视频国产一区| 日韩av中文在线观看| 亚洲视频免费在线| 日韩欧美一区二区免费| 91电影在线观看| 国产精品2024| 亚洲午夜一区二区| 欧美精品色综合| 91免费看片在线观看| 91麻豆精品国产91久久久久久| 大美女一区二区三区| 国产原创一区二区| 免费成人你懂的|