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

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

?? os_q.c

?? 一共40M 不能貼在論壇中。絕對好東西。要得話留下email
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2001, 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) reentrant
{
#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) reentrant
{
#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();                     /* Get a free queue control block                     */
        pq = OSQFreeList;
        if (OSQFreeList != (OS_Q *)0) {
            OSQFreeList = OSQFreeList->OSQPtr;
        }
        OS_EXIT_CRITICAL();
        if (pq != (OS_Q *)0) {                   /* See if we were able to get a queue control block   */
            pq->OSQStart        = start;         /* Yes, 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->OSEventPtr  = pq;
            OS_EventWaitListInit(pevent);
        } else {                                 /* No,  since we couldn't get a queue control block   */
            OS_ENTER_CRITICAL();                 /* Return event control block on error                */
            pevent->OSEventPtr = (void *)OSEventFreeList;
            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) reentrant
{
#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                  = 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                  = 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:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三国产精华液| 成人午夜免费视频| 国产高清久久久| 欧美影视一区二区三区| 久久久综合激的五月天| 亚洲永久免费av| 国产suv精品一区二区三区| 欧美猛男超大videosgay| 17c精品麻豆一区二区免费| 久久99九九99精品| 在线不卡中文字幕播放| 毛片av一区二区| 91在线观看污| 久久九九久精品国产免费直播| 亚洲成人一区在线| 99re视频精品| 自拍偷拍亚洲激情| jiyouzz国产精品久久| 精品91自产拍在线观看一区| 秋霞av亚洲一区二区三| 91黄视频在线观看| 亚洲人成伊人成综合网小说| 成人在线视频一区| 久久久久久久综合日本| 久久精品久久综合| 欧美一卡二卡三卡四卡| 亚洲国产一区在线观看| 日本高清成人免费播放| 亚洲天堂中文字幕| 99精品久久99久久久久| 中文字幕一区二区三| www.欧美.com| 国产精品进线69影院| 99久久精品免费观看| 亚洲三级在线观看| 91麻豆免费看片| 一区二区高清视频在线观看| 在线视频亚洲一区| 亚洲图片欧美一区| 91麻豆精品国产91| 激情综合色综合久久| 久久欧美一区二区| av在线播放成人| 一区二区高清在线| 在线不卡中文字幕| 国产一区二区三区久久久| 久久久久久久久蜜桃| www.亚洲色图.com| 亚洲国产日日夜夜| 欧美xxxxxxxxx| 国产suv精品一区二区三区| 中文字幕一区不卡| 欧美日韩国产综合久久| 久久精品久久99精品久久| 国产午夜精品久久久久久久| 91亚洲精华国产精华精华液| 亚洲国产wwwccc36天堂| 精品噜噜噜噜久久久久久久久试看 | 国产亲近乱来精品视频| 成人国产精品免费观看动漫| 一区二区三区色| 日韩欧美一区中文| 丰满亚洲少妇av| 亚洲bt欧美bt精品| 久久久精品中文字幕麻豆发布| 9久草视频在线视频精品| 天天影视网天天综合色在线播放| 久久夜色精品国产噜噜av| 成人精品视频网站| 亚洲国产视频网站| 中文字幕第一区二区| 欧美日韩国产成人在线91| 国产成人99久久亚洲综合精品| 亚洲永久精品国产| 亚洲国产激情av| 欧美一区2区视频在线观看| 成人免费va视频| 久久国产精品第一页| 一区二区三区在线免费视频 | 精品理论电影在线观看| 色偷偷成人一区二区三区91| 久久99久久久欧美国产| 亚洲国产欧美另类丝袜| 欧美国产日产图区| 日韩免费高清av| 欧美日韩视频在线一区二区| 大胆亚洲人体视频| 精品一区二区三区香蕉蜜桃| 亚洲午夜成aⅴ人片| 国产精品毛片久久久久久| 日韩欧美电影一二三| 欧美日韩色一区| 一本一本久久a久久精品综合麻豆| 国产在线不卡一区| 老司机免费视频一区二区三区| 亚洲国产成人91porn| 亚洲黄色录像片| 国产精品电影院| 国产日韩欧美精品一区| 欧美精品一区二区三区蜜臀| 欧美一区三区四区| 欧美精品xxxxbbbb| 欧洲精品一区二区三区在线观看| www.在线成人| 不卡视频一二三| 国产成人av一区二区三区在线观看| 老司机免费视频一区二区三区| 日韩中文字幕亚洲一区二区va在线| 亚洲女子a中天字幕| 中文字幕五月欧美| 中文字幕字幕中文在线中不卡视频| 国产清纯美女被跳蛋高潮一区二区久久w| 日韩丝袜情趣美女图片| 91精品国产综合久久久久| 欧美久久久久中文字幕| 欧美色网站导航| 欧美日韩性生活| 欧美人伦禁忌dvd放荡欲情| 欧美视频精品在线观看| 欧美日韩一二区| 欧美一区二区三区播放老司机| 在线不卡中文字幕| 精品捆绑美女sm三区| www国产亚洲精品久久麻豆| 国产午夜精品久久久久久免费视| 欧美—级在线免费片| 国产精品电影院| 亚洲午夜免费电影| 日韩福利电影在线观看| 久久爱www久久做| 国产成人午夜精品影院观看视频| 国产成都精品91一区二区三| 97se亚洲国产综合自在线观| 欧美综合欧美视频| 日韩一区二区不卡| 亚洲国产高清aⅴ视频| 玉米视频成人免费看| 亚洲成av人片一区二区| 久久国产精品一区二区| 国产福利91精品| 91国产丝袜在线播放| 欧美一区二区在线看| 国产区在线观看成人精品| 一区二区三区自拍| 免费欧美在线视频| 成人免费的视频| 欧美日本在线观看| 久久老女人爱爱| 夜夜夜精品看看| 精品影视av免费| 日本高清不卡aⅴ免费网站| 欧美日韩一区二区电影| 国产午夜精品福利| 亚洲va韩国va欧美va精品| 国产麻豆精品在线观看| 91九色02白丝porn| 精品免费日韩av| 亚洲午夜电影在线观看| 国产精品88av| 欧美一区二区三区小说| 国产精品久久一级| 美洲天堂一区二卡三卡四卡视频 | 中文字幕日韩一区二区| 舔着乳尖日韩一区| 成人av在线资源| 欧美一级午夜免费电影| 综合激情成人伊人| 国产一区美女在线| 欧美熟乱第一页| 中文字幕一区二区三区不卡| 久草在线在线精品观看| 欧美日韩精品一区二区天天拍小说| 国产日韩欧美精品电影三级在线| 日本午夜一本久久久综合| 日本高清无吗v一区| 欧美韩日一区二区三区四区| 久久精品国产一区二区三 | 日韩一级片网站| 亚洲精品国产精华液| 成人黄页在线观看| 亚洲精品一区二区三区影院| 亚洲一区二区三区四区中文字幕| 成人av动漫在线| 久久久久久**毛片大全| 久久99精品久久久久| 宅男噜噜噜66一区二区66| 亚洲综合偷拍欧美一区色| 91在线你懂得| 国产精品久久久久久亚洲毛片| 国产专区综合网| 久久综合久久综合久久| 精品一区二区久久| 91精品国产一区二区| 日韩高清不卡一区二区三区| 欧美日韩一区二区三区四区五区| 亚洲综合免费观看高清完整版在线| 成人激情小说网站| 1区2区3区欧美| 色视频一区二区| 亚洲国产成人porn|