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

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

?? os_q.c

?? The uC OS-II port for Keil C V6.20, V6.21 or higher
?? 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) KCREENTRANT
{
#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) KCREENTRANT
{
#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) KCREENTRANT
{
#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色在线porny| 免费成人性网站| 久久精品网站免费观看| 56国语精品自产拍在线观看| 99re在线精品| 91在线观看高清| 日韩视频一区在线观看| 91成人免费在线| 一本到不卡免费一区二区| 成人妖精视频yjsp地址| 国产91清纯白嫩初高中在线观看| 国产精品亚洲第一| 成人av在线播放网址| 99精品视频中文字幕| 在线看日本不卡| 555www色欧美视频| www日韩大片| 国产精品美女久久久久av爽李琼| 自拍偷拍亚洲综合| 亚洲国产日日夜夜| 久久电影网站中文字幕| 精品国产乱码久久久久久闺蜜| 久久国产免费看| 首页国产丝袜综合| 免费观看一级特黄欧美大片| 国产一区91精品张津瑜| 99精品视频在线观看| 欧美日韩精品是欧美日韩精品| 欧美日韩亚洲另类| 久久先锋资源网| 亚洲人被黑人高潮完整版| 午夜国产不卡在线观看视频| 精品亚洲免费视频| 一本色道久久加勒比精品| 欧美一区二区三区免费视频| 久久网站热最新地址| 亚洲激情成人在线| 久久精品国产成人一区二区三区| 18涩涩午夜精品.www| 午夜电影一区二区| 国产美女精品在线| 欧美亚洲一区三区| 欧美精品一区二区三| 一区二区三区四区在线| 国产一区二区精品久久| 欧美视频中文字幕| 日本一区二区在线不卡| 秋霞午夜鲁丝一区二区老狼| 波多野结衣一区二区三区| 日韩三级电影网址| 亚洲国产日韩精品| 国产白丝网站精品污在线入口| 欧美日韩日日摸| 国产精品福利一区二区| 国产在线播放一区三区四| 欧美色涩在线第一页| 中文字幕在线免费不卡| 国产一区二区三区黄视频| 国产精品一区二区黑丝| 一区二区在线电影| 久久99在线观看| 欧美人狂配大交3d怪物一区| 亚洲裸体在线观看| 成人在线视频首页| 久久久亚洲国产美女国产盗摄| 首页亚洲欧美制服丝腿| 欧美亚洲精品一区| 亚洲黄网站在线观看| 91在线免费播放| 中文字幕中文在线不卡住| 风间由美性色一区二区三区| 久久久美女毛片| 国产麻豆成人传媒免费观看| 精品国产乱码久久久久久老虎| 天涯成人国产亚洲精品一区av| 欧美亚洲高清一区二区三区不卡| 亚洲视频免费看| 一本久久a久久免费精品不卡| 中文字幕一区二区三| 国模娜娜一区二区三区| 日日摸夜夜添夜夜添国产精品| 成人黄色在线网站| 国产欧美一区二区三区沐欲| 国产一区999| 久久久国产综合精品女国产盗摄| 国产精品一卡二| 国产精品午夜电影| 色系网站成人免费| 亚洲第一主播视频| 欧美麻豆精品久久久久久| 日本亚洲视频在线| 精品处破学生在线二十三| 国产精品一卡二| 亚洲天堂2016| 欧美精品久久久久久久多人混战| 免费在线看成人av| 久久久电影一区二区三区| 成人av网址在线观看| 亚洲欧美日韩久久| 91精品婷婷国产综合久久性色| 另类人妖一区二区av| 中文字幕第一区二区| 2020国产精品久久精品美国| 日韩伦理免费电影| 91极品视觉盛宴| 五月婷婷久久丁香| 久久网这里都是精品| 成人国产精品免费观看动漫| 亚洲午夜免费视频| 26uuu另类欧美| 色域天天综合网| 日韩**一区毛片| 一色屋精品亚洲香蕉网站| 欧美另类久久久品| 福利电影一区二区| 爽好久久久欧美精品| 国产精品色噜噜| 日韩欧美国产一区二区在线播放| 成人18视频在线播放| 天天av天天翘天天综合网| 国产欧美一区二区精品婷婷| 欧美午夜理伦三级在线观看| 欧洲av在线精品| 午夜伦理一区二区| 日韩写真欧美这视频| av一二三不卡影片| 麻豆精品在线看| 一区二区三区免费网站| 精品国产乱码久久久久久图片| 一本色道亚洲精品aⅴ| 国产乱子轮精品视频| 午夜欧美一区二区三区在线播放| 中文字幕欧美日本乱码一线二线| 欧美日本一道本| 在线免费不卡电影| bt7086福利一区国产| 另类成人小视频在线| 偷偷要91色婷婷| 一区二区三区不卡在线观看 | 欧美性做爰猛烈叫床潮| 国产成人欧美日韩在线电影| 久久精品久久综合| 首页欧美精品中文字幕| 亚洲一区二区av电影| 亚洲欧美偷拍卡通变态| 国产精品护士白丝一区av| 久久精品在线免费观看| 久久色视频免费观看| 亚洲精品一线二线三线无人区| 51午夜精品国产| 欧美一区二区三区四区视频| 欧美日韩视频不卡| 欧美视频在线不卡| 欧美日韩五月天| 91精品国产全国免费观看| 欧美夫妻性生活| 91精品国产色综合久久ai换脸| 欧美三级日韩在线| 欧美精品123区| 91精品国产综合久久婷婷香蕉| 欧美高清视频不卡网| 欧美一区午夜精品| 精品国产91乱码一区二区三区 | 国产**成人网毛片九色 | 国产欧美精品国产国产专区| 久久久青草青青国产亚洲免观| 久久天天做天天爱综合色| 久久久久久综合| 国产精品第一页第二页第三页| 亚洲日本在线视频观看| 亚洲在线视频免费观看| 日韩不卡一区二区三区| 经典三级一区二区| caoporn国产精品| 在线精品观看国产| 日韩亚洲欧美中文三级| 久久久久久**毛片大全| 亚洲色图制服诱惑| 日韩精品欧美精品| 国产精品1区二区.| 日本道免费精品一区二区三区| 91精品婷婷国产综合久久| 国产视频在线观看一区二区三区| 最新成人av在线| 日本视频中文字幕一区二区三区| 国产精品综合一区二区三区| 91麻豆国产精品久久| 欧美成人乱码一区二区三区| 国产精品美女一区二区三区| 亚洲成a天堂v人片| 岛国av在线一区| 欧美日韩三级一区二区| 国产亚洲福利社区一区| 亚洲小说欧美激情另类| 国产精品一区三区| 欧美精品第一页| 亚洲欧美日韩在线| 国产精品1024| 在线综合亚洲欧美在线视频| 一区二区三区小说|