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

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

?? os_q.c

?? At91s64_ucos2.76:基于at91sam7s64芯片的uc/os移植代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.76
*********************************************************************************************************
*/

#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;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#endif    
#if OS_ARG_CHK_EN > 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;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#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_Q      *pq;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                            /* Prevent compiler warning                 */
#endif    
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return (pevent);
    }
#if OS_ARG_CHK_EN > 0
    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);
    }
    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) {
#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;
                 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        */
                 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q);
             }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区免费看视频| 国产视频一区在线观看| 亚洲成人精品在线观看| 欧美日韩久久一区| 免费观看日韩电影| 精品国产制服丝袜高跟| 高清shemale亚洲人妖| 国产精品视频第一区| 日本精品一区二区三区高清| 亚洲国产综合在线| 日韩一区二区免费电影| 免费成人美女在线观看| 国产无人区一区二区三区| 成人一区二区在线观看| 亚洲与欧洲av电影| 欧美成人精品福利| 成人一区二区三区视频| 亚洲成人精品一区二区| 久久精品一区二区| 91福利在线免费观看| 青青草伊人久久| 国产精品久久久久久妇女6080 | 久久精品久久精品| 国产视频一区在线观看| 欧美主播一区二区三区美女| 美女尤物国产一区| 日韩一区欧美一区| 欧美一区二区三区免费在线看| 国产乱码一区二区三区| 一区二区在线观看不卡| 欧美videossexotv100| 91丨porny丨中文| 日本一区中文字幕| 日韩毛片高清在线播放| 日韩一区二区精品葵司在线 | 在线一区二区视频| 久久99精品国产91久久来源| 亚洲免费观看高清完整版在线观看熊| 91 com成人网| 91视视频在线观看入口直接观看www | 91网站视频在线观看| 免费黄网站欧美| 一区二区三区免费| 久久综合色婷婷| 69堂成人精品免费视频| 99国产一区二区三精品乱码| 美女网站在线免费欧美精品| 一区二区三区精品久久久| 欧美精彩视频一区二区三区| 日韩一级高清毛片| 欧美在线观看视频一区二区 | 免费成人av在线| 亚洲色图欧美在线| 久久精品亚洲麻豆av一区二区 | 一本久久a久久精品亚洲| 国内一区二区在线| 免费成人结看片| 日欧美一区二区| 亚洲高清在线视频| 亚洲最大成人网4388xx| 亚洲欧洲精品一区二区三区| 久久久亚洲精华液精华液精华液| 69堂成人精品免费视频| 欧美久久高跟鞋激| 欧美日韩一区二区在线观看视频| 91在线视频网址| jlzzjlzz亚洲日本少妇| 波多野结衣中文字幕一区二区三区| 激情深爱一区二区| 久久99精品一区二区三区三区| 日韩国产欧美在线播放| 五月婷婷久久综合| 亚洲大尺度视频在线观看| 夜夜操天天操亚洲| 夜夜嗨av一区二区三区中文字幕 | 色呦呦国产精品| 91社区在线播放| 91视频你懂的| 欧美在线免费观看视频| 色视频欧美一区二区三区| 日本二三区不卡| 在线免费精品视频| 欧美午夜寂寞影院| 欧美精品少妇一区二区三区| 欧美美女激情18p| 日韩一区二区三区在线观看| 日韩欧美一二三| 久久久久久97三级| 欧美国产欧美综合| 1024亚洲合集| 亚洲国产日韩av| 奇米777欧美一区二区| 久久99精品国产.久久久久| 国产精品一线二线三线精华| 成a人片亚洲日本久久| av电影天堂一区二区在线观看| 91在线国产观看| 在线播放中文一区| 欧美www视频| 中文一区一区三区高中清不卡| 中文字幕一区二区三| 一区二区三区毛片| 美女尤物国产一区| 成人av午夜电影| 欧美日韩国产高清一区二区三区 | 国产精品免费网站在线观看| 国产精品久线观看视频| 一区二区视频在线| 男男视频亚洲欧美| 99久久免费视频.com| 欧美日本在线观看| 久久久久久电影| 亚洲电影第三页| 国产精品一级二级三级| 色网综合在线观看| 欧美大片一区二区| 亚洲色图视频网| 狠狠色丁香久久婷婷综合丁香| 色综合天天视频在线观看| 精品国产乱码久久久久久久| 自拍偷拍欧美精品| 精品一区二区三区免费毛片爱| 91丨九色丨蝌蚪丨老版| 精品久久久久久久久久久院品网| 亚洲综合久久久| 国产mv日韩mv欧美| 精品免费一区二区三区| 亚洲免费观看高清完整版在线观看 | 日韩专区一卡二卡| eeuss国产一区二区三区| 日韩一级黄色片| 亚洲精品日韩综合观看成人91| 激情小说亚洲一区| 欧美精品在线视频| 亚洲三级小视频| 国产高清久久久久| 欧美一级搡bbbb搡bbbb| 一区二区三区四区不卡在线 | 日韩av一级电影| 99精品国产99久久久久久白柏 | 国产精品色一区二区三区| 日日夜夜免费精品视频| 91色在线porny| 国产视频一区二区在线观看| 美女www一区二区| 欧美优质美女网站| 国产精品电影一区二区| 国产麻豆精品在线| 日韩欧美一卡二卡| 亚洲高清一区二区三区| 在线视频国内自拍亚洲视频| 国产精品灌醉下药二区| 国产综合一区二区| 日韩女优视频免费观看| 日韩精品视频网| 欧美精品一二三区| 日日夜夜一区二区| 欧美精品99久久久**| 亚洲国产中文字幕| 欧美天堂一区二区三区| 一级做a爱片久久| 欧美无人高清视频在线观看| 亚洲综合色区另类av| 欧美性生活大片视频| 亚洲欧美日韩一区| 一本久久a久久精品亚洲| 中文字幕色av一区二区三区| 成人网男人的天堂| 1024国产精品| 欧洲国内综合视频| 亚洲一卡二卡三卡四卡五卡| 欧美午夜精品一区二区三区| 午夜精品一区在线观看| 宅男噜噜噜66一区二区66| 日韩制服丝袜先锋影音| 欧美一区二区国产| 国内精品久久久久影院薰衣草| 26uuu色噜噜精品一区| 国产成人免费视频网站| 国产精品嫩草久久久久| 93久久精品日日躁夜夜躁欧美| ㊣最新国产の精品bt伙计久久| 色哟哟国产精品免费观看| 亚洲va天堂va国产va久| 欧美一区国产二区| 国产一区在线观看视频| 中文字幕欧美国产| 一本大道av一区二区在线播放| 亚洲第一狼人社区| 精品国产乱码91久久久久久网站| 国产精品1024| 亚洲免费视频中文字幕| 欧美精品v国产精品v日韩精品| 久久se精品一区二区| 国产精品五月天| 欧美日韩情趣电影| 国产精品一线二线三线| 亚洲精品国产a| 精品99一区二区| 91亚洲男人天堂|