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

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

?? os_q.c

?? ucos2.8 系統(tǒng)的源代碼 我找到的 可以使用
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2005, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.80
*********************************************************************************************************
*/

#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 = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (err == (INT8U *)0) {                     /* Validate 'err'                                     */
        return ((void *)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 = 0;
#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_EVENT  *pevent_return;
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (err == (INT8U *)0) {                               /* Validate 'err'                           */
        return (pevent);
    }
    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);
    }
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return (pevent);
    }
    OS_ENTER_CRITICAL();
    if (pevent->OSEventGrp != 0) {                         /* 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;
                 pevent_return          = (OS_EVENT *)0;   /* Queue has been deleted                   */
             } else {
                 OS_EXIT_CRITICAL();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品福利av导航| 日韩免费一区二区| 国产成人精品亚洲777人妖| 日韩在线一区二区| 亚洲超碰精品一区二区| 亚洲电影一级片| 亚洲电影一级片| 五月天久久比比资源色| 五月激情六月综合| 日本不卡在线视频| 久久国产三级精品| 成人一区二区三区视频| 成人综合在线观看| 91国产成人在线| 欧美日韩成人高清| 欧美一区二区三区影视| 久久综合给合久久狠狠狠97色69| 精品国产亚洲在线| 中文字幕不卡在线| 亚洲精品日日夜夜| 美女一区二区在线观看| 国产精品123| 成人18视频日本| 欧美日免费三级在线| 欧美一级高清片| 国产视频一区二区三区在线观看| 中文字幕在线视频一区| 午夜视频一区在线观看| 久久av中文字幕片| 色综合久久88色综合天天6| 欧美剧情片在线观看| 精品国产免费视频| 亚洲精品视频在线看| 日本午夜精品视频在线观看 | 日韩免费福利电影在线观看| 久久蜜桃香蕉精品一区二区三区| 18涩涩午夜精品.www| 日韩福利电影在线| 99久久国产免费看| 欧美成人欧美edvon| 亚洲少妇30p| 美女久久久精品| 在线观看日韩毛片| 久久久久久久综合日本| 亚洲综合小说图片| 成人黄色国产精品网站大全在线免费观看| 欧美三区免费完整视频在线观看| 精品对白一区国产伦| 亚洲电影一级片| 99精品国产一区二区三区不卡| 欧美本精品男人aⅴ天堂| 亚洲黄色片在线观看| 国产不卡视频一区| 日韩欧美成人午夜| 午夜精品免费在线观看| 99久久综合99久久综合网站| 精品国产自在久精品国产| 亚洲1区2区3区4区| 欧美在线三级电影| 1区2区3区国产精品| 成人免费三级在线| 日韩欧美一区二区在线视频| 亚洲一区二区三区在线看| www.av精品| 国产精品丝袜久久久久久app| 免费高清视频精品| 7777精品伊人久久久大香线蕉最新版| 亚洲人xxxx| 91蜜桃免费观看视频| 中文字幕不卡在线播放| 国产精品一二三四区| 欧美精品一区二区高清在线观看| 婷婷成人激情在线网| 欧美在线播放高清精品| 洋洋成人永久网站入口| 91亚洲精品一区二区乱码| 国产精品久久毛片a| 成人性生交大片免费看中文 | 蜜臀a∨国产成人精品| 在线不卡a资源高清| 日韩精品乱码av一区二区| 欧美日韩国产天堂| 奇米影视7777精品一区二区| 欧美一区二区视频免费观看| 麻豆一区二区在线| 日本一区二区视频在线| 不卡区在线中文字幕| 一区二区三区在线不卡| 欧美视频你懂的| 久88久久88久久久| 国产精品天美传媒沈樵| eeuss国产一区二区三区| 亚洲日本免费电影| 在线观看视频91| 蜜桃精品视频在线观看| 久久久噜噜噜久噜久久综合| 成人h精品动漫一区二区三区| 成人免费在线播放视频| 在线观看成人小视频| 美女高潮久久久| 国产欧美日韩激情| 91福利视频久久久久| 日韩成人一级片| 久久精品无码一区二区三区| 99综合电影在线视频| 亚洲高清在线精品| 精品88久久久久88久久久| 99久久精品免费看国产免费软件| 亚洲国产aⅴ天堂久久| 国产亚洲一本大道中文在线| 在线亚洲一区观看| 久久精品国产精品青草| 亚洲视频在线一区二区| 91精品国产一区二区三区香蕉| 国产成人免费视频网站| 亚洲一区二区影院| 久久精品视频在线免费观看| 日本高清免费不卡视频| 国产一区二区看久久| 一区二区三区在线免费| 久久蜜臀精品av| 欧美精品一二三区| 99精品视频一区| 精品影视av免费| 亚洲大片一区二区三区| 欧美激情资源网| 4438x成人网最大色成网站| 成人av资源下载| 老司机精品视频导航| 亚洲永久免费视频| 国产精品国产三级国产普通话蜜臀 | 欧美激情艳妇裸体舞| 91精品国产高清一区二区三区蜜臀| 成人免费视频免费观看| 精品一区精品二区高清| 亚洲成a人片在线观看中文| 国产精品激情偷乱一区二区∴| 日韩欧美亚洲一区二区| 欧美精品日韩一本| 91黄色免费看| 日本福利一区二区| 97久久人人超碰| 国产成人av一区二区三区在线 | 久久精品夜色噜噜亚洲a∨| 日韩一级完整毛片| 欧美久久一二三四区| 在线欧美日韩精品| 色94色欧美sute亚洲线路一ni| 国产乱码一区二区三区| 狠狠狠色丁香婷婷综合激情| 蜜桃av一区二区在线观看| 蜜桃视频一区二区| 老司机午夜精品| 精品亚洲国产成人av制服丝袜| 另类小说图片综合网| 蜜桃av噜噜一区二区三区小说| 国产偷国产偷精品高清尤物| 精品成人一区二区| 久久免费精品国产久精品久久久久 | 五月综合激情日本mⅴ| 天堂一区二区在线免费观看| 日韩精品国产欧美| 青娱乐精品视频在线| 蜜臀av性久久久久蜜臀av麻豆 | 亚洲精品视频在线看| 亚洲美女屁股眼交3| 亚洲综合免费观看高清完整版| 亚洲va欧美va人人爽午夜| 亚洲v中文字幕| 久久se这里有精品| 国产一区久久久| 99综合影院在线| 欧美日韩电影在线播放| 精品国产乱码久久久久久影片| 日本一区二区三区电影| 亚洲黄一区二区三区| 免费亚洲电影在线| 国产黄色成人av| 色乱码一区二区三区88| 91精品久久久久久久99蜜桃| 久久综合九色综合97婷婷女人| 最新成人av在线| 日韩中文欧美在线| 成人性生交大片| 欧美日韩免费一区二区三区视频| 日韩精品一区二区三区四区| 国产精品久久久久影院亚瑟| 亚洲18女电影在线观看| 国产电影一区二区三区| 91国产福利在线| 国产欧美日韩在线看| 午夜久久久影院| 福利一区二区在线观看| 欧美日韩精品一区二区三区蜜桃| 精品人伦一区二区色婷婷| 亚洲四区在线观看| 国产原创一区二区| 欧美区在线观看| 成人免费小视频| 国产精品亚洲综合一区在线观看|