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

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

?? os_q.c

?? 比較好的UCOSii在S3C4510B上的移植
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2001, 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();                     /* Get a free queue control block                     */
        pq = OSQFreeList;
        if (OSQFreeList != (OS_Q *)0) {
            OSQFreeList = OSQFreeList->OSQPtr;
        }
        OS_EXIT_CRITICAL();
        if (pq != (OS_Q *)0) {                   /* See if we were able to get a queue control block   */
            pq->OSQStart        = start;         /* Yes, 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->OSEventPtr  = pq;
            OS_EventWaitListInit(pevent);
        } else {                                 /* No,  since we couldn't get a queue control block   */
            OS_ENTER_CRITICAL();                 /* Return event control block on error                */
            pevent->OSEventPtr = (void *)OSEventFreeList;
            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                  = 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                  = 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:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频一区欧美精品| 亚洲欧洲精品一区二区精品久久久| 亚洲精品免费看| 91免费精品国自产拍在线不卡| 欧美国产日韩精品免费观看| 国产不卡高清在线观看视频| 国产精品欧美一区二区三区| 91在线丨porny丨国产| 一区二区三区 在线观看视频| 91国偷自产一区二区使用方法| 亚洲444eee在线观看| 欧美一区2区视频在线观看| 美女尤物国产一区| 国产精品素人视频| 在线中文字幕不卡| 青青草原综合久久大伊人精品 | 欧美激情一区二区三区| 不卡一区二区三区四区| 亚洲猫色日本管| 亚洲人成网站影音先锋播放| 91黄色激情网站| 麻豆精品一区二区三区| 欧美激情在线观看视频免费| 色香蕉成人二区免费| 日韩精品福利网| 欧美高清在线精品一区| 欧美亚洲综合在线| 国产制服丝袜一区| 亚洲女同ⅹxx女同tv| 欧美一区二区三区四区久久| 国产精品亚洲一区二区三区妖精 | 日韩国产在线一| 国产日韩影视精品| 欧美中文字幕一区二区三区| 久久99久久99小草精品免视看| 中文字幕在线不卡一区二区三区| 欧美色男人天堂| 国产aⅴ综合色| 日本美女一区二区三区视频| 国产精品初高中害羞小美女文| 欧美日韩大陆在线| 99精品国产热久久91蜜凸| 人人爽香蕉精品| 亚洲精选一二三| 欧美韩日一区二区三区四区| 欧美顶级少妇做爰| 91啦中文在线观看| 国产一区二区三区蝌蚪| 亚洲成人久久影院| 最新久久zyz资源站| 欧美mv日韩mv国产网站| 在线观看视频欧美| 成人午夜视频在线| 麻豆国产精品一区二区三区| 亚洲精品日韩综合观看成人91| 337p粉嫩大胆噜噜噜噜噜91av| 欧美亚洲日本国产| 91小宝寻花一区二区三区| 国产盗摄一区二区| 极品美女销魂一区二区三区免费| 亚瑟在线精品视频| 一区二区三区四区精品在线视频| 日本一区免费视频| 久久网站最新地址| 欧美大片在线观看| 日韩精品一区二区三区在线 | 成人蜜臀av电影| 国产在线不卡视频| 久久国产尿小便嘘嘘| 无码av免费一区二区三区试看| 亚洲精品一二三| 日韩一区中文字幕| 亚洲人xxxx| 1024成人网色www| 中文字幕一区二区三区av| 久久久国产一区二区三区四区小说| 日韩一区二区电影| 精品少妇一区二区三区日产乱码| 91精品国产色综合久久不卡蜜臀| 欧美三级电影网站| 欧美日韩国产首页| 欧美一区二区三区四区在线观看| 欧美群妇大交群的观看方式| 欧美日韩一二三| 欧美一级片免费看| 欧美sm美女调教| 国产色91在线| 国产精品久久久久久久裸模| 中文字幕一区二区三中文字幕| 中文字幕视频一区| 亚洲精品高清视频在线观看| 亚洲一区欧美一区| 日韩va亚洲va欧美va久久| 日本不卡一区二区三区高清视频| 蜜桃精品视频在线| 国产乱对白刺激视频不卡| 丁香五精品蜜臀久久久久99网站| 高清不卡一区二区| 色94色欧美sute亚洲线路一ni| 在线欧美日韩国产| 91精品国产黑色紧身裤美女| 精品久久久三级丝袜| 中文一区一区三区高中清不卡| 亚洲视频在线一区二区| 亚洲国产美国国产综合一区二区 | 日韩主播视频在线| 国内一区二区视频| 91在线视频免费观看| 欧美亚一区二区| 欧美成人伊人久久综合网| 久久精品视频免费| 一区二区视频免费在线观看| 日韩av中文字幕一区二区| 激情丁香综合五月| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 国产成人亚洲精品青草天美| av欧美精品.com| 亚洲视频一区在线观看| 天天色天天操综合| 国产精品一区二区在线播放| 色悠悠久久综合| 欧美不卡123| 一区二区日韩电影| 国产精品一区不卡| 欧美日韩一卡二卡三卡| 欧美国产激情一区二区三区蜜月| 亚洲免费观看在线观看| 久久精品国产久精国产爱| 91蜜桃免费观看视频| 精品美女一区二区| 一区二区三区 在线观看视频| 国内精品久久久久影院一蜜桃| 在线观看欧美黄色| 日本一区二区三区国色天香| 午夜久久久久久久久| www.成人在线| 2021中文字幕一区亚洲| 性做久久久久久久免费看| eeuss影院一区二区三区| 欧美xfplay| 亚洲第一精品在线| 91在线一区二区| 国产欧美日韩三级| 精品中文字幕一区二区小辣椒| 欧美伊人精品成人久久综合97| 国产日韩成人精品| 激情另类小说区图片区视频区| 欧美无砖专区一中文字| 亚洲欧洲av在线| 丁香五精品蜜臀久久久久99网站| 欧美成人高清电影在线| 视频一区视频二区中文| 欧美视频在线播放| 不卡av在线网| 国产欧美一区二区三区在线老狼| 久久精品国产99国产| 欧美人伦禁忌dvd放荡欲情| 亚洲最新在线观看| 一本色道久久综合狠狠躁的推荐| 日本一区二区成人| 国产成人精品午夜视频免费 | 欧美精品一区二区三区在线| 亚瑟在线精品视频| 欧美亚洲动漫制服丝袜| 亚洲精品一卡二卡| 日本电影亚洲天堂一区| 亚洲图片激情小说| 91色|porny| 亚洲精选视频在线| 欧美在线免费视屏| 午夜精品福利久久久| 欧美日韩一区二区在线观看视频| 亚洲综合色自拍一区| 欧美在线一区二区三区| 亚洲成年人网站在线观看| 欧美午夜精品久久久| 亚洲一区二区三区中文字幕在线 | 国产91在线观看丝袜| 欧美激情一区二区三区蜜桃视频| 国产曰批免费观看久久久| 国产亚洲人成网站| 成人丝袜18视频在线观看| 国产精品不卡在线| 91官网在线观看| 亚洲v精品v日韩v欧美v专区| 91精选在线观看| 狠狠色伊人亚洲综合成人| 国产调教视频一区| 91欧美一区二区| 午夜一区二区三区在线观看| 91精品国产综合久久福利软件| 日本不卡视频在线观看| 久久夜色精品一区| 97久久超碰精品国产| 亚洲一区二区三区中文字幕 | caoporn国产一区二区| 一区二区三区在线观看国产| 欧美日韩高清影院| 久草精品在线观看| 国产精品视频麻豆|