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

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

?? os_q.c

?? VC版式的 UCOSII ! 修改前人255任務的那個版本! 已經改為286u版! 可用VC6直接編過!
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                              (c) Copyright 1992-2007, Micrium, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.86
*
* LICENSING TERMS:
* ---------------
*   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
* If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
* its use in your product. We provide ALL the source code for your convenience and to help you experience 
* uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
* licensing fee.
*********************************************************************************************************
*/

#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
*
*              perr          is a pointer to where an error message will be deposited.  Possible error
*                            messages are:
*
*                            OS_ERR_NONE         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_ERR_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
*              'perr' 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 *perr)
{
    void      *pmsg;
    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 (perr == (INT8U *)0) {                    /* Validate 'perr'                                    */
        return ((void *)0);
    }
    if (pevent == (OS_EVENT *)0) {               /* Validate 'pevent'                                  */
        *perr = OS_ERR_PEVENT_NULL;
        return ((void *)0);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type                          */
        *perr = 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                   */
        pmsg = *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;
        }
        *perr = OS_ERR_NONE;
    } else {
        *perr = OS_ERR_Q_EMPTY;
        pmsg  = (void *)0;                       /* Queue is empty                                     */
    }
    OS_EXIT_CRITICAL();
    return (pmsg);                               /* 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.
*
*              perr          is a pointer to an error code that can contain one of the following values:
*                            OS_ERR_NONE             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 *perr)
{
    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 (perr == (INT8U *)0) {                              /* Validate 'perr'                          */
        return (pevent);
    }
    if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
        *perr = OS_ERR_PEVENT_NULL;
        return (pevent);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
        *perr = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *perr = 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();
                 *perr                  = OS_ERR_NONE;
                 pevent_return          = (OS_EVENT *)0;   /* Queue has been deleted                   */
             } else {
                 OS_EXIT_CRITICAL();
                 *perr                  = OS_ERR_TASK_WAITING;
                 pevent_return          = pevent;
             }
             break;

        case OS_DEL_ALWAYS:                                /* Always delete the queue                  */
             while (pevent->OSEventGrp != 0) {             /* Ready ALL tasks waiting for queue        */
                 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q, OS_STAT_PEND_OK);
             }
#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();
             if (tasks_waiting == OS_TRUE) {               /* Reschedule only if task(s) were waiting  */
                 OS_Sched();                               /* Find highest priority task ready to run  */
             }
             *perr                  = OS_ERR_NONE;
             pevent_return          = (OS_EVENT *)0;       /* Queue has been deleted                   */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费欧美日韩国产三级电影| 国产日本一区二区| 成人网在线播放| 国产电影一区二区三区| 国产一区二区电影| 国产精品99久久久久久宅男| 福利一区福利二区| 粉嫩av一区二区三区在线播放 | 日韩一区二区免费在线电影| 色噜噜狠狠成人中文综合| 91啪在线观看| 欧美日韩精品专区| 日韩欧美色综合| 欧美国产亚洲另类动漫| 1024国产精品| 天堂久久一区二区三区| 秋霞午夜鲁丝一区二区老狼| 国产精品香蕉一区二区三区| 色综合天天狠狠| 91精品国产一区二区三区蜜臀 | 亚洲韩国一区二区三区| 日韩高清在线不卡| 国产成人精品免费| 91社区在线播放| 欧美一卡二卡在线| 国产精品三级在线观看| 一区二区三区av电影 | 国产精品网友自拍| 一区2区3区在线看| 美女视频黄a大片欧美| 国产成人综合在线观看| 欧美视频你懂的| 久久免费午夜影院| 五月婷婷久久综合| 粉嫩在线一区二区三区视频| 欧美日韩免费观看一区三区| 久久久精品综合| 视频在线观看一区二区三区| 国产98色在线|日韩| 欧美高清一级片在线| 亚洲国产精品成人综合色在线婷婷 | 国产欧美精品一区二区色综合 | 久久精品99国产国产精| 91看片淫黄大片一级在线观看| 3atv一区二区三区| 亚洲欧洲精品天堂一级| 国内偷窥港台综合视频在线播放| 91国内精品野花午夜精品| 国产视频视频一区| 热久久免费视频| 欧美日韩亚洲不卡| 亚洲欧美日韩综合aⅴ视频| 国产传媒一区在线| 欧美tk丨vk视频| 视频一区二区国产| 欧美日韩综合不卡| 一区二区激情小说| 成人av电影在线| 国产日韩欧美制服另类| 伦理电影国产精品| 日韩一级片在线观看| 亚洲午夜三级在线| 欧美日韩一级片网站| 亚洲伦在线观看| 色综合天天综合给合国产| 国产蜜臀97一区二区三区| 国产福利一区二区三区视频 | 色综合天天综合网国产成人综合天| 精品美女被调教视频大全网站| 亚洲成人一区二区在线观看| 在线观看网站黄不卡| 亚洲精品中文字幕在线观看| 99国产精品久久久久| 亚洲人成7777| 欧洲人成人精品| 亚洲国产日韩在线一区模特| 欧美午夜不卡视频| 日精品一区二区| 欧美一区二区视频在线观看2020| 天天亚洲美女在线视频| 884aa四虎影成人精品一区| 日本美女视频一区二区| 日韩欧美一区电影| 国产一区二区三区免费观看| 国产亚洲精品免费| 99精品视频在线观看| 亚洲色图欧洲色图婷婷| 欧美在线视频你懂得| 日韩福利视频导航| 国产三级精品视频| 色呦呦国产精品| 日韩高清不卡在线| 国产精品色在线观看| 在线免费亚洲电影| 美女视频黄久久| 亚洲国产精品v| 欧美性一级生活| 蜜臀av一区二区在线免费观看| 26uuu亚洲婷婷狠狠天堂| 成人一区二区三区视频在线观看| 亚洲欧美综合网| 日韩视频中午一区| 成人97人人超碰人人99| 亚洲国产欧美在线| 久久精品欧美日韩精品| 在线一区二区三区四区五区| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美极品xxx| 在线成人小视频| 99久久精品国产一区二区三区| 亚洲国产日韩在线一区模特| 国产午夜一区二区三区| 色悠悠久久综合| 国产精品一区二区久久不卡| 亚洲欧美激情一区二区| 久久综合九色综合97_久久久| 91玉足脚交白嫩脚丫在线播放| 人人精品人人爱| 亚洲一区二区三区四区中文字幕| 26uuu色噜噜精品一区二区| 欧洲中文字幕精品| 粉嫩aⅴ一区二区三区四区五区| 午夜影院久久久| 亚洲免费观看高清完整版在线观看熊| 精品久久久久99| 日韩一区二区在线观看视频播放| 91在线国产观看| 国产不卡高清在线观看视频| 天天综合网天天综合色| 日韩理论在线观看| 中文字幕精品一区二区精品绿巨人| 欧美色倩网站大全免费| 波多野结衣精品在线| 国产福利一区二区三区视频 | 亚洲精品少妇30p| 国产精品视频一区二区三区不卡| 日韩三级在线观看| 欧美日韩aaaaaa| 欧美日韩国产小视频在线观看| www.久久久久久久久| 国产a区久久久| 国产成人在线视频免费播放| 久久精品久久精品| 欧美bbbbb| 麻豆国产精品一区二区三区| 日本va欧美va瓶| 青青草国产精品97视觉盛宴| 午夜精品国产更新| 日本一不卡视频| 美国毛片一区二区三区| 久久国产精品99精品国产 | 成人h动漫精品| 成人免费黄色在线| 成人99免费视频| 91国内精品野花午夜精品| 在线一区二区三区四区五区 | 高清在线不卡av| 成人影视亚洲图片在线| 不卡免费追剧大全电视剧网站| 丁香婷婷综合激情五月色| 成人av电影在线网| 色噜噜夜夜夜综合网| 欧美女孩性生活视频| 日韩欧美一级特黄在线播放| 精品国产污网站| 国产精品嫩草影院com| 1024国产精品| 日本视频一区二区三区| 国产精品99久久久久久久女警| 成人久久久精品乱码一区二区三区 | 日本aⅴ精品一区二区三区| 国产精品亚洲专一区二区三区| 黑人精品欧美一区二区蜜桃| 成人永久aaa| 在线一区二区三区| 欧美va日韩va| 亚洲人午夜精品天堂一二香蕉| 亚洲一级片在线观看| 精品一区二区三区蜜桃| 国产999精品久久久久久绿帽| 色成年激情久久综合| 日韩一级大片在线观看| 国产精品情趣视频| 午夜精品123| 成人深夜福利app| 7777精品久久久大香线蕉| 国产日本欧洲亚洲| 午夜在线成人av| 成人国产精品免费网站| 在线成人免费视频| 亚洲视频香蕉人妖| 免费日韩伦理电影| 一本色道久久综合亚洲91| 日韩一级免费观看| 亚洲精品视频免费观看| 国产精品自拍网站| 制服丝袜中文字幕亚洲| 中文字幕日韩av资源站| 精品综合免费视频观看| 在线观看日产精品|