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

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

?? os_q.c

?? uc/os-II在ARM7的移植
?? 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一区二区三区免费野_久草精品视频
欧美色区777第一页| 中文字幕一区二区在线观看| eeuss鲁一区二区三区| 麻豆成人久久精品二区三区红 | 色天使色偷偷av一区二区| 亚洲免费大片在线观看| 中文字幕欧美激情一区| 久久久精品免费观看| 日韩免费高清视频| 日韩欧美精品在线| 日韩精品一区二区三区视频播放| 91麻豆精品国产91久久久资源速度 | 色婷婷久久久综合中文字幕| 91免费在线播放| 色哟哟在线观看一区二区三区| 99re这里只有精品首页| 色噜噜久久综合| 91精品久久久久久久91蜜桃| 日韩精品一区二区三区中文精品| 欧美大片拔萝卜| 亚洲国产成人私人影院tom| 日韩美女精品在线| 亚洲444eee在线观看| 婷婷久久综合九色国产成人 | 亚洲国产精品二十页| 亚洲男同性恋视频| 天天射综合影视| 国产乱色国产精品免费视频| jiyouzz国产精品久久| 欧美色窝79yyyycom| 日韩免费观看高清完整版在线观看| 欧美精品一区在线观看| 中文字幕一区二区三区四区 | 日韩一级黄色大片| 欧美国产视频在线| 亚洲午夜久久久久| 老司机免费视频一区二区三区| 成人av免费观看| 69久久99精品久久久久婷婷| 国产午夜亚洲精品不卡| 亚洲国产日韩综合久久精品| 国产在线视视频有精品| 在线观看亚洲a| 国产欧美日韩视频在线观看| 亚洲国产va精品久久久不卡综合 | 国产精品午夜在线观看| 香蕉久久一区二区不卡无毒影院| 国产一区二区三区免费观看| 91久久精品一区二区| 精品成a人在线观看| 夜色激情一区二区| 国产成人精品影院| 7777精品伊人久久久大香线蕉 | 亚洲欧美视频在线观看| 精品写真视频在线观看| 欧美自拍偷拍一区| 国产精品三级视频| 国产一区二区三区免费观看| 欧美一区二区播放| 亚洲国产精品一区二区久久恐怖片 | 97精品国产露脸对白| 欧美日韩亚洲综合| 亚洲欧洲精品成人久久奇米网| 天天av天天翘天天综合网色鬼国产| 成人免费的视频| 国产三级精品在线| 久久精品国产77777蜜臀| 欧美精品第1页| 亚洲精品高清在线观看| 成年人国产精品| 亚洲国产精品成人综合| 国产真实乱对白精彩久久| 91精品免费观看| 亚洲午夜羞羞片| 欧美性三三影院| 亚洲美女少妇撒尿| 色成年激情久久综合| 亚洲国产一区视频| 99久久精品免费观看| 久久亚洲精华国产精华液| 免费观看成人av| 欧美zozozo| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | caoporm超碰国产精品| 精品精品欲导航| 国产一区二区三区免费看| 亚洲精品一区二区三区精华液 | 中文字幕亚洲区| av电影天堂一区二区在线观看| 国产欧美一区二区精品仙草咪| 国产精品888| 国产精品五月天| 91免费看`日韩一区二区| 看电影不卡的网站| 91精品国产一区二区| 丝袜美腿亚洲综合| 日韩欧美激情一区| 国产一区二区在线影院| 中文字幕va一区二区三区| 成人深夜福利app| 一区二区国产盗摄色噜噜| 欧美猛男男办公室激情| 极品少妇xxxx精品少妇偷拍| 国产亚洲欧美日韩日本| 色偷偷久久人人79超碰人人澡| 亚洲第一会所有码转帖| 欧美v日韩v国产v| 成人国产精品免费| 亚洲国产精品视频| 精品乱人伦小说| 色婷婷久久久亚洲一区二区三区| 亚洲大片免费看| 国产网红主播福利一区二区| 色婷婷激情久久| 麻豆国产精品777777在线| 中文字幕一区二区三区四区不卡 | 欧美一区二区在线看| 国产激情视频一区二区三区欧美| 一区二区欧美国产| 久久亚洲综合色一区二区三区 | 欧美成人乱码一区二区三区| 高潮精品一区videoshd| 亚洲大片精品永久免费| 欧美经典一区二区| 欧美一区二区三区免费在线看| 成人美女视频在线看| 日本亚洲最大的色成网站www| 中文字幕在线一区免费| 欧美一区二区三区不卡| 日本福利一区二区| 国产麻豆精品theporn| 秋霞av亚洲一区二区三| 亚洲综合丁香婷婷六月香| 亚洲精品一区二区三区99 | 欧美aaa在线| 一区二区三区四区不卡在线| 国产日韩欧美在线一区| 欧美一级日韩免费不卡| 91黄色免费观看| 成人免费av网站| 国产高清在线精品| 蜜桃一区二区三区四区| 婷婷激情综合网| 一区二区激情小说| 亚洲三级免费电影| 欧美激情自拍偷拍| 久久精品一二三| 久久综合九色欧美综合狠狠| 日韩一区二区免费在线观看| 在线免费精品视频| 天天色天天操综合| 亚洲成人一区二区| 亚洲综合一二区| 亚洲午夜激情av| 亚洲无人区一区| 一区二区三区国产豹纹内裤在线| 国产精品无人区| 中文字幕一区二区三区在线不卡| 久久久高清一区二区三区| 欧美不卡视频一区| 欧美一二三区在线观看| 日韩欧美不卡一区| 日韩三级av在线播放| 欧美大片在线观看| 精品免费国产一区二区三区四区| 日韩精品一区在线观看| 精品久久久久久久久久久久久久久久久| 91精品久久久久久久久99蜜臂| 日韩一级片网站| 久久一日本道色综合| 国产精品入口麻豆原神| 亚洲人成电影网站色mp4| 一区二区激情视频| 日本在线不卡一区| 国产综合色在线| 91片黄在线观看| 欧美一区二区视频观看视频| 欧美精品一区二区精品网| 国产欧美一区二区精品性色| 亚洲欧美激情在线| 日韩精品免费视频人成| 国产一区二区三区| 色综合久久久久| 欧美一区二区三区四区久久| 久久精品一二三| 亚洲国产精品精华液网站| 狠狠色狠狠色综合| 色欧美乱欧美15图片| 日韩欧美一区二区三区在线| 中文字幕不卡的av| 亚洲动漫第一页| 国产福利精品一区| 欧美性生活一区| 五月婷婷久久丁香| thepron国产精品| 欧美一区二区三区精品| 中文字幕中文字幕一区| 日韩精品午夜视频| eeuss鲁一区二区三区| 日韩一区二区在线免费观看|