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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_q.c

?? ucos2 移植到44b0 上的源代碼,支持中斷嵌套,調(diào)試通過.
?? 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
*
*              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)
{
#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'                                  */
        *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)
{
#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;
#if OS_EVENT_NAME_SIZE > 0
            (void)strcpy(pevent->OSEventName, "?");
#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)
{
#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);
    }
#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 > 0
                 (void)strcpy(pevent->OSEventName, "?");   /* Unknown name                             */
#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        */
                 OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q);
             }
#if OS_EVENT_NAME_SIZE > 0
             (void)strcpy(pevent->OSEventName, "?");       /* Unknown name                             */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区综合亚洲| 美女一区二区三区| 日本美女视频一区二区| 高清久久久久久| 欧美美女直播网站| 亚洲欧洲在线观看av| 久久福利视频一区二区| 欧美手机在线视频| 国产精品传媒在线| 国产一区不卡精品| 制服丝袜亚洲网站| 亚洲国产一区二区三区青草影视| 国产成人午夜电影网| 日韩欧美高清一区| 日韩国产成人精品| 精品视频一区 二区 三区| 一区在线播放视频| 99re8在线精品视频免费播放| 精品国产亚洲一区二区三区在线观看| 天堂一区二区在线| 欧美日韩精品欧美日韩精品一 | 亚洲成a人v欧美综合天堂下载| 国产成人精品三级麻豆| 久久亚洲一级片| 极品销魂美女一区二区三区| 欧美精品第一页| 日本成人在线不卡视频| 欧美日韩高清在线播放| 亚洲成人动漫精品| 欧美日本一区二区三区四区| 亚洲成人黄色小说| 欧美日韩国产另类一区| 亚洲国产aⅴ成人精品无吗| 91国偷自产一区二区开放时间| 亚洲欧美日韩国产综合在线| 91在线视频在线| 亚洲精品视频在线观看免费| 在线欧美日韩精品| 同产精品九九九| 正在播放一区二区| 美女一区二区在线观看| 精品999在线播放| 成人在线一区二区三区| 1000部国产精品成人观看| 色综合色狠狠天天综合色| 亚洲福利一二三区| 日韩色在线观看| 国产乱色国产精品免费视频| 久久精品视频网| 一本到不卡精品视频在线观看 | 亚洲国产精品黑人久久久| www.亚洲在线| 亚洲一二三区在线观看| 日韩视频中午一区| 国产精品中文字幕一区二区三区| 欧美国产欧美综合| 欧美日韩精品欧美日韩精品一| 蜜臀a∨国产成人精品| 久久久久久一二三区| 99re免费视频精品全部| 亚洲成人手机在线| 国产亚洲女人久久久久毛片| 色婷婷亚洲一区二区三区| 天天免费综合色| 国产欧美日韩久久| 欧洲视频一区二区| 国产一区二区三区国产| 亚洲最大色网站| 欧美电影免费观看高清完整版在| 成人av电影免费在线播放| 五月婷婷激情综合网| 国产亚洲欧美激情| 欧美日韩久久久| 风间由美一区二区三区在线观看| 亚洲愉拍自拍另类高清精品| 久久免费看少妇高潮| 欧洲日韩一区二区三区| 国产成人在线看| 日日骚欧美日韩| 亚洲视频在线观看三级| 日韩欧美二区三区| 欧美写真视频网站| 丰满放荡岳乱妇91ww| 日本少妇一区二区| 一区二区三区精密机械公司| 久久影院午夜论| 91精品国产一区二区三区| 91小视频在线| 国产91清纯白嫩初高中在线观看 | 久久久精品欧美丰满| 欧美日韩日日夜夜| 成人涩涩免费视频| 另类的小说在线视频另类成人小视频在线 | 国产免费久久精品| 日韩欧美视频在线| 欧美日本一区二区| 91视频你懂的| 国产不卡高清在线观看视频| 久久黄色级2电影| 日韩精品一卡二卡三卡四卡无卡| 亚洲色图视频免费播放| 国产欧美日韩一区二区三区在线观看 | 精品亚洲国产成人av制服丝袜| 亚洲成va人在线观看| 一区二区成人在线视频| 中文字幕制服丝袜一区二区三区 | 91精品欧美综合在线观看最新 | 99久久久无码国产精品| 国产传媒日韩欧美成人| 久久国产三级精品| 久久精品国产色蜜蜜麻豆| 日韩黄色在线观看| 免费在线看成人av| 日韩精品一级二级| 美女久久久精品| 美国欧美日韩国产在线播放| 美脚の诱脚舐め脚责91| 久久成人av少妇免费| 久久激情五月婷婷| 国内欧美视频一区二区| 国产酒店精品激情| 丁香婷婷深情五月亚洲| 成人黄色777网| 91在线观看成人| 欧美自拍丝袜亚洲| 欧美精品电影在线播放| 精品国产伦理网| 中文字幕久久午夜不卡| 国产精品久久久久精k8| 一区二区三区日韩欧美精品 | 激情六月婷婷久久| 国产二区国产一区在线观看| 成人小视频在线| 91精品1区2区| 91精品国产91久久久久久最新毛片| 日韩三级精品电影久久久| 国产午夜精品久久久久久免费视| 国产精品三级av在线播放| 亚洲女女做受ⅹxx高潮| 日韩精品亚洲一区| 国产91色综合久久免费分享| 色哟哟亚洲精品| 日韩一区和二区| 国产精品每日更新| 天天综合天天综合色| 国产精品一级黄| 欧美在线三级电影| 久久伊99综合婷婷久久伊| 亚洲欧美在线另类| 免费人成在线不卡| 成人黄动漫网站免费app| 欧美精品国产精品| 欧美激情中文字幕一区二区| 亚洲资源中文字幕| 国产精品自拍在线| 欧美日韩国产影片| 国产欧美一区二区三区鸳鸯浴| 亚洲与欧洲av电影| 国产成人免费xxxxxxxx| 欧美日韩一区二区三区视频| 国产清纯美女被跳蛋高潮一区二区久久w| 亚洲天堂福利av| 国产精一区二区三区| 欧美日韩国产精品成人| 国产精品国产精品国产专区不蜜| 精品一区二区三区视频在线观看| 91视频免费观看| 国产午夜精品久久| 美女视频免费一区| 欧美色国产精品| 自拍视频在线观看一区二区| 久久99国产精品麻豆| 欧美三级韩国三级日本三斤| 国产精品美日韩| 国产中文一区二区三区| 在线播放一区二区三区| 亚洲精品国产视频| av欧美精品.com| 国产午夜精品在线观看| 乱一区二区av| 欧美精品免费视频| 亚洲综合免费观看高清完整版| 91精品国产综合久久精品图片| 亚洲激情图片一区| av中文一区二区三区| 国产欧美日韩麻豆91| 成人免费视频在线观看| 日韩专区欧美专区| 欧美色中文字幕| 一个色在线综合| 色综合天天视频在线观看 | 亚洲国产视频a| 一本色道久久综合亚洲91 | 在线免费av一区| 亚洲欧美国产77777| 97久久超碰精品国产| 国产精品二区一区二区aⅴ污介绍| 懂色av一区二区在线播放| 久久久亚洲国产美女国产盗摄 | 日欧美一区二区|