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

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

?? os_q.c

?? UCOS移植到三星ARM芯片S3C44B0上程序的范例,并有移植成功后的應用
?? 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                             */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩国产欧美在线播放| 精品少妇一区二区| 国产91精品免费| 裸体歌舞表演一区二区| 亚洲一区二区三区四区中文字幕 | 亚洲乱码国产乱码精品精98午夜| 久久久久久99久久久精品网站| 日韩欧美中文一区二区| 欧美一级电影网站| 精品国产百合女同互慰| www激情久久| 日本一区二区三区视频视频| 精品噜噜噜噜久久久久久久久试看 | 一区二区成人在线视频| 一片黄亚洲嫩模| 美日韩黄色大片| 国产精品1区二区.| 成人一区二区三区视频在线观看 | av亚洲精华国产精华| 99久久99久久精品国产片果冻| av毛片久久久久**hd| 在线观看免费一区| 欧美一区二区性放荡片| 精品99一区二区三区| 国产精品美女www爽爽爽| 亚洲美女一区二区三区| 首页综合国产亚洲丝袜| 国产精品一级黄| 99久久久久久99| 日韩免费观看2025年上映的电影| 久久久影视传媒| 亚洲精品欧美激情| 老司机午夜精品| 日本精品视频一区二区三区| 91精品国产综合久久久久久久 | 欧美精品xxxxbbbb| 亚洲精品在线网站| 亚洲综合成人在线视频| 久久aⅴ国产欧美74aaa| 99久久精品国产精品久久| 精品视频一区二区三区免费| 精品噜噜噜噜久久久久久久久试看 | 亚洲最色的网站| 亚洲欧洲一区二区三区| 午夜精品久久久久久久久久久 | 亚洲一区二区欧美激情| 国产真实精品久久二三区| av一区二区三区| www激情久久| 丝袜亚洲另类欧美| 91老师国产黑色丝袜在线| 欧美www视频| 亚洲国产日韩一级| 91在线一区二区三区| xvideos.蜜桃一区二区| 日韩中文字幕一区二区三区| 99久久99久久综合| 国产日韩亚洲欧美综合| 免费观看在线综合| 8x福利精品第一导航| 精品国产一区二区精华| 久久精品视频一区二区| 日本欧美一区二区三区乱码| 93久久精品日日躁夜夜躁欧美| 欧美mv日韩mv| 午夜电影一区二区三区| 99精品国产99久久久久久白柏| 精品久久久网站| 免费高清在线一区| 欧美精品日韩一区| 五月激情六月综合| 欧美日韩一区高清| 亚洲国产欧美日韩另类综合| 不卡av电影在线播放| 中文字幕精品在线不卡| 成人精品小蝌蚪| 中文字幕在线免费不卡| 99综合影院在线| ●精品国产综合乱码久久久久| 成人丝袜高跟foot| 国产精品久久午夜夜伦鲁鲁| 欧美96一区二区免费视频| 亚洲另类春色国产| 99久久精品99国产精品| 欧美激情综合五月色丁香| 国产原创一区二区三区| 久久一留热品黄| 国产91综合网| 亚洲精品日日夜夜| 欧美精品一级二级| 麻豆精品一区二区三区| 精品播放一区二区| 成人国产免费视频| 亚洲日韩欧美一区二区在线| 欧美性色aⅴ视频一区日韩精品| 亚洲第一电影网| 日韩限制级电影在线观看| 狠狠v欧美v日韩v亚洲ⅴ| 国产午夜一区二区三区| 99精品偷自拍| 日韩精品五月天| 国产欧美一区视频| 自拍偷拍欧美精品| 粗大黑人巨茎大战欧美成人| 日韩理论片中文av| 91.麻豆视频| 成人av在线观| 日韩成人午夜精品| 国产精品美女久久久久aⅴ | 亚洲高清不卡在线| 欧美一区二区精美| 成人免费视频caoporn| 亚洲国产综合色| 国产日韩欧美不卡在线| 欧美午夜精品理论片a级按摩| 日韩av一区二区在线影视| 国产日产欧美一区| 3d动漫精品啪啪1区2区免费| 国产99久久久国产精品潘金| 午夜影院久久久| 久久精品国产一区二区三| 国产亚洲精品免费| 91片在线免费观看| 蜜乳av一区二区| 亚洲免费在线看| 国产日产欧产精品推荐色| 在线中文字幕一区| 国产一区不卡视频| 蜜桃久久久久久久| 一区二区三区欧美日韩| 久久久久久久久免费| 制服丝袜av成人在线看| 在线日韩av片| 成人视屏免费看| 激情小说亚洲一区| 日本不卡视频在线观看| 亚洲一区二区av在线| 亚洲色大成网站www久久九九| 精品国产91乱码一区二区三区 | 国产精品不卡一区二区三区| 亚洲一区二区偷拍精品| 久久久亚洲精品石原莉奈| 欧美少妇性性性| 色悠悠久久综合| 91在线看国产| 97国产精品videossex| 国产成人精品免费一区二区| 久久疯狂做爰流白浆xx| 美女视频免费一区| 日韩va亚洲va欧美va久久| 亚洲v中文字幕| 日韩精品欧美成人高清一区二区| 亚洲男人的天堂网| 亚洲精品综合在线| 一区二区三区日本| 一区二区三区高清| 亚洲成人av电影在线| 丝袜亚洲另类欧美| 日韩av电影免费观看高清完整版 | 亚洲精品在线网站| 欧美丰满一区二区免费视频| 日本韩国精品在线| 91福利国产精品| 色诱亚洲精品久久久久久| 一本久久a久久精品亚洲| av不卡在线观看| 日本精品一区二区三区高清 | 欧美日韩在线三级| 99久久精品情趣| 精品一区二区日韩| 黑人巨大精品欧美一区| 成人性生交大片免费看在线播放| 风流少妇一区二区| av中文字幕不卡| 欧美性感一区二区三区| 欧美日韩电影在线播放| 精品国产一区二区三区不卡| 日本一区二区三区电影| 亚洲三级理论片| 日产欧产美韩系列久久99| 九九九久久久精品| 91色综合久久久久婷婷| 在线成人高清不卡| 国产亚洲综合在线| 亚洲人成网站色在线观看| 午夜精品福利一区二区三区蜜桃| 国模冰冰炮一区二区| 色综合色综合色综合 | 亚洲精品国产一区二区精华液 | 国产白丝精品91爽爽久久| 91日韩精品一区| 日韩你懂的在线观看| 欧美激情一区二区三区全黄| 精品一区二区三区在线播放| 91女人视频在线观看| 日韩欧美国产一区在线观看| 亚洲欧美在线高清| 韩国成人精品a∨在线观看| 欧美主播一区二区三区| 国产亚洲美州欧州综合国|