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

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

?? os_q.c

?? atmel9260SAM7s64在IAR下移植源程序
?? 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一区二区三区免费野_久草精品视频
色狠狠综合天天综合综合| 91啪九色porn原创视频在线观看| 久久久久久久久久久久久久久99 | 黑人巨大精品欧美黑白配亚洲| 最近日韩中文字幕| 亚洲蜜桃精久久久久久久| 亚洲乱码国产乱码精品精小说 | 一本到不卡免费一区二区| 精品午夜久久福利影院 | 亚洲香肠在线观看| 五月天中文字幕一区二区| 国产一区二区三区在线观看精品| 精品久久久久一区| 中文字幕乱码亚洲精品一区| 亚洲国产精品精华液网站| 欧美日韩激情在线| 国产夜色精品一区二区av| 中文字幕在线一区二区三区| 91视频在线看| 日韩中文字幕av电影| 日韩欧美中文字幕一区| 国产福利视频一区二区三区| 国产精品女人毛片| 精品视频在线免费看| 精品系列免费在线观看| 亚洲视频狠狠干| 日韩亚洲欧美成人一区| 高清视频一区二区| 婷婷综合另类小说色区| 久久久久久综合| 色狠狠一区二区| 欧美在线|欧美| 91福利资源站| 乱一区二区av| 综合久久综合久久| 91精品国产色综合久久| 一区二区三区.www| 久久新电视剧免费观看| 欧美性做爰猛烈叫床潮| 国产一区二区三区精品欧美日韩一区二区三区| 国产精品无码永久免费888| 欧美色电影在线| 懂色av一区二区三区免费观看| 亚洲不卡一区二区三区| 中文字幕乱码亚洲精品一区| 欧美精品乱人伦久久久久久| jizz一区二区| 国产精品一区在线观看你懂的| 亚洲午夜精品在线| 亚洲色图清纯唯美| 久久久久青草大香线综合精品| 欧美疯狂性受xxxxx喷水图片| 99精品视频在线观看| 狠狠网亚洲精品| 美女任你摸久久| 午夜精品福利久久久| 亚洲一级电影视频| 综合分类小说区另类春色亚洲小说欧美| 91精品国产aⅴ一区二区| 91网站最新地址| 国产91丝袜在线播放九色| 久久99九九99精品| 轻轻草成人在线| 日韩小视频在线观看专区| 国产乱对白刺激视频不卡| 日本不卡一二三区黄网| 亚洲一级二级在线| 曰韩精品一区二区| 亚洲色图视频网| 亚洲欧美中日韩| 国产精品理论在线观看| 中文字幕欧美激情| 国产视频不卡一区| 国产三级一区二区| 久久综合色8888| 欧美精品一区二区三区一线天视频| 884aa四虎影成人精品一区| 在线精品观看国产| 欧美性感一区二区三区| 在线亚洲人成电影网站色www| a亚洲天堂av| 成人动漫一区二区在线| 成人av免费观看| 99久久99久久精品免费看蜜桃| 成人免费视频国产在线观看| www.成人在线| 在线视频国内自拍亚洲视频| 色女孩综合影院| 欧美中文字幕不卡| 欧美区一区二区三区| 欧美一区二区二区| 国产肉丝袜一区二区| 国产精品三级电影| 一区二区三区电影在线播| 五月激情综合色| 蜜臀av一区二区三区| 国产麻豆一精品一av一免费 | 国产精品一区二区不卡| 国产一区二区三区日韩| 成人午夜视频网站| 91免费版pro下载短视频| 在线观看日韩一区| 日韩午夜中文字幕| 欧美激情资源网| 亚洲第一久久影院| 激情五月播播久久久精品| 成人永久aaa| 欧美精品少妇一区二区三区| 精品精品国产高清a毛片牛牛| 国产亚洲精品7777| 亚洲精品免费播放| 久久99精品久久久久久动态图| 丁香天五香天堂综合| 欧美在线观看你懂的| 精品国产免费视频| 亚洲日本丝袜连裤袜办公室| 日韩专区在线视频| 成人国产一区二区三区精品| 欧美在线观看一区| 国产亚洲欧洲997久久综合| 亚洲你懂的在线视频| 狠狠色丁香久久婷婷综| 日本高清不卡视频| 亚洲精品一区二区三区99| 亚洲欧美色图小说| 国产一区999| 4438成人网| 亚洲女厕所小便bbb| 国产在线精品不卡| 欧美日韩在线免费视频| 欧美激情一区二区三区| 日本不卡中文字幕| 91蝌蚪国产九色| 精品欧美久久久| 一区二区三区美女视频| 国产99久久久久久免费看农村| 欧美欧美午夜aⅴ在线观看| 国产精品丝袜久久久久久app| 免费精品视频最新在线| 在线观看日韩一区| 中文字幕在线免费不卡| 国产精品一区二区久久不卡 | 色88888久久久久久影院野外| www国产成人| 图片区日韩欧美亚洲| 在线欧美日韩精品| 国产精品女上位| 国产99精品视频| 精品国产一区二区在线观看| 亚洲电影你懂得| 色婷婷av久久久久久久| 亚洲色图另类专区| 粗大黑人巨茎大战欧美成人| 欧美成人一级视频| 青青草原综合久久大伊人精品优势| 欧美在线高清视频| 亚洲视频在线一区二区| 岛国精品在线播放| 久久久久久久久久美女| 国产乱人伦偷精品视频不卡| 日韩欧美一卡二卡| 久久精品国产亚洲aⅴ| 欧美一区二区日韩一区二区| 亚洲成人免费电影| 欧美天堂亚洲电影院在线播放| 一区二区三区 在线观看视频| 91色婷婷久久久久合中文| 中文字幕在线观看不卡| 福利一区福利二区| 国产精品免费视频一区| a亚洲天堂av| 亚洲精品高清视频在线观看| 色先锋久久av资源部| 亚洲一区二区视频在线| 欧美午夜精品电影| 性久久久久久久| 精品人在线二区三区| 国产在线精品一区二区夜色| 精品久久久久香蕉网| 国产老妇另类xxxxx| 国产精品美女久久久久av爽李琼| 成人国产电影网| 亚洲无线码一区二区三区| 日韩一区二区免费在线观看| 精品系列免费在线观看| 中文字幕欧美区| 在线这里只有精品| 日韩成人伦理电影在线观看| 欧美va在线播放| 国产福利不卡视频| 亚洲美女一区二区三区| 欧美日韩在线亚洲一区蜜芽| 精品在线一区二区| 国产精品日韩成人| 欧美日高清视频| 国产美女精品在线| 一区二区三区四区国产精品| 91精品国产综合久久久蜜臀粉嫩| 老色鬼精品视频在线观看播放| 国产女主播一区|