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

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

?? os_q.c

?? iar環境下移植ucos-ii到at91sam7s64
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2006, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.83
*********************************************************************************************************
*/

#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 = OS_TRUE;                              /* Yes                                      */
    } else {
        tasks_waiting = OS_FALSE;                             /* No                                       */
    }
    switch (opt) {
        case OS_DEL_NO_PEND:                               /* Delete queue only if no task waiting     */
             if (tasks_waiting == OS_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();
                 *err                   = OS_ERR_TASK_WAITING;
                 pevent_return          = pevent;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品国产a| 国产目拍亚洲精品99久久精品| 99久久精品国产一区二区三区| 国产精品综合在线视频| 精品一区二区三区免费毛片爱| 日本怡春院一区二区| 丝袜诱惑亚洲看片| 日韩精品一区第一页| 蜜臀精品久久久久久蜜臀| 美腿丝袜亚洲色图| 国产一区中文字幕| 国产精品亚洲第一区在线暖暖韩国 | 日韩三级免费观看| 精品久久久久99| 国产精品日韩成人| 午夜精品一区二区三区免费视频| 亚洲蜜桃精久久久久久久| 一区二区三区美女视频| 石原莉奈在线亚洲三区| 久久99蜜桃精品| 成人网在线播放| 91成人免费网站| 欧美一区二区三区免费在线看| 精品毛片乱码1区2区3区| 国产精品欧美经典| 亚洲精品日韩一| 蜜桃传媒麻豆第一区在线观看| 国产成人免费视频精品含羞草妖精| 色综合天天视频在线观看 | 黄网站免费久久| 不卡视频免费播放| 91麻豆精品国产91| 亚洲国产精品av| 偷窥国产亚洲免费视频| 高清av一区二区| 欧美日韩情趣电影| 国产精品污网站| 日本不卡中文字幕| 91在线观看免费视频| 日韩欧美国产一区二区三区| 最新久久zyz资源站| 美国一区二区三区在线播放| 99精品视频在线观看免费| 欧美二区三区91| 国产精品萝li| 激情亚洲综合在线| 欧美日韩国产经典色站一区二区三区| 久久亚洲综合色| 日日骚欧美日韩| 91在线国产观看| 日本一区二区三区视频视频| 奇米一区二区三区av| 91女厕偷拍女厕偷拍高清| 精品999久久久| 亚洲18影院在线观看| 99re热这里只有精品免费视频| 精品精品国产高清a毛片牛牛 | 中文字幕高清一区| 久久99国产乱子伦精品免费| 欧美大片国产精品| **网站欧美大片在线观看| 国产成人自拍在线| 欧美α欧美αv大片| 日本vs亚洲vs韩国一区三区| 欧美午夜不卡在线观看免费| 亚洲免费观看视频| 99国产精品国产精品毛片| 久久久精品综合| 国产一区不卡视频| 久久亚洲私人国产精品va媚药| 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美日韩国产高清一区| 亚洲午夜电影网| 精品视频在线免费看| 亚洲成人资源网| 欧美肥妇毛茸茸| 五月天精品一区二区三区| 欧美色老头old∨ideo| 一区二区三区精品视频| 欧美写真视频网站| 日韩中文字幕不卡| 精品欧美黑人一区二区三区| 精品一区二区三区免费毛片爱| 精品捆绑美女sm三区| 国产精品亚洲第一| 国产精品色哟哟网站| 色综合天天性综合| 亚洲国产精品一区二区久久恐怖片 | 成人美女在线观看| 亚洲欧美日韩国产一区二区三区 | 欧美成人三级在线| 国产一区二区女| 国产精品九色蝌蚪自拍| 91香蕉国产在线观看软件| 亚洲综合男人的天堂| 欧美一区二区在线观看| 国产高清精品久久久久| 1024亚洲合集| 欧美精品成人一区二区三区四区| 麻豆91精品视频| 亚洲国产成人私人影院tom | 精品理论电影在线| 成人a区在线观看| 亚洲高清免费在线| 欧美成人精品1314www| 成人美女视频在线看| 亚洲va欧美va天堂v国产综合| 精品国产伦一区二区三区观看方式 | 日韩一区二区三区四区五区六区| 国内精品免费**视频| 亚洲天天做日日做天天谢日日欢| 在线电影一区二区三区| 顶级嫩模精品视频在线看| 亚洲成a天堂v人片| 亚洲男人的天堂在线aⅴ视频| 欧美老女人第四色| a亚洲天堂av| 麻豆精品视频在线| 一区二区三区高清| 国产亚洲一区二区三区四区| 欧美三级中文字幕| 国产精品中文有码| 日本美女视频一区二区| 亚洲激情图片qvod| 国产精品狼人久久影院观看方式| 欧美精品久久99久久在免费线 | 亚洲欧美乱综合| 久久丝袜美腿综合| 欧美电影一区二区| 欧美专区亚洲专区| av中文字幕一区| 国产成a人亚洲| 理论电影国产精品| 天天av天天翘天天综合网| 一区精品在线播放| 久久久国际精品| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美精品丝袜中出| 欧美三级三级三级| 欧美视频一区二区在线观看| 91日韩在线专区| 97久久精品人人做人人爽50路| 风间由美一区二区三区在线观看 | 国产精品欧美经典| 久久久久久久久久久黄色| 91精品国产综合久久精品麻豆 | 韩日欧美一区二区三区| 日本视频在线一区| 日韩专区一卡二卡| 日韩在线一区二区三区| 天堂av在线一区| 日精品一区二区三区| 日韩av中文字幕一区二区| 香蕉成人伊视频在线观看| 洋洋成人永久网站入口| 亚洲电影欧美电影有声小说| 亚洲成人精品影院| 日韩国产一二三区| 美国av一区二区| 久久se这里有精品| 国产a级毛片一区| 99免费精品视频| 色综合久久综合| 欧美日韩激情一区二区| 欧美一区二区三区四区五区| 精品久久久久av影院| 国产精品视频线看| 亚洲精品日产精品乱码不卡| 亚洲午夜影视影院在线观看| 婷婷久久综合九色综合绿巨人| 免费在线观看日韩欧美| 国内精品国产成人| 91丝袜美女网| 欧美一区午夜视频在线观看 | 91网上在线视频| 欧美色视频一区| 久久丝袜美腿综合| 亚洲日本在线看| 麻豆freexxxx性91精品| 不卡一区在线观看| 538在线一区二区精品国产| 久久久久久久久久久黄色| 亚洲欧美日本韩国| 美女视频黄 久久| 91网址在线看| 欧美不卡在线视频| 亚洲啪啪综合av一区二区三区| 喷水一区二区三区| www.一区二区| 日韩免费看网站| 一区二区在线观看免费| 国产一区啦啦啦在线观看| 在线观看网站黄不卡| 久久久青草青青国产亚洲免观| 一区二区三区在线观看视频| 国产综合久久久久久鬼色| 欧美性生活久久| 成人欧美一区二区三区白人 | 欧美二区三区91| 最新不卡av在线|