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

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

?? os_q.c

?? uc/os原代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2005, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
* Version : V2.80
*********************************************************************************************************
*/

#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
*
*              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)
{
    void      *msg;
    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 (err == (INT8U *)0) {                     /* Validate 'err'                                     */
        return ((void *)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)
{
    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.
*
*              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)
{
    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 (err == (INT8U *)0) {                               /* Validate 'err'                           */
        return (pevent);
    }
    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);
    }
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = 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 = 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 > 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();
                 *err                   = OS_NO_ERR;
                 pevent_return          = (OS_EVENT *)0;   /* Queue has been deleted                   */
             } else {
                 OS_EXIT_CRITICAL();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产色91在线| 欧美电影免费观看高清完整版在线 | 日韩免费在线观看| 欧美手机在线视频| 欧美午夜电影一区| 欧美亚一区二区| 欧美体内she精高潮| 欧美日产在线观看| 日韩欧美综合一区| 2欧美一区二区三区在线观看视频| 日韩一区二区电影在线| 亚洲精品一区二区三区蜜桃下载 | 欧美巨大另类极品videosbest | 欧美成人a∨高清免费观看| 欧美一区二区三区成人| 精品日韩欧美在线| 26uuu国产日韩综合| 成人欧美一区二区三区1314| 亚洲乱码一区二区三区在线观看| 亚洲午夜av在线| 麻豆久久久久久久| www.日韩精品| 欧美日韩在线亚洲一区蜜芽| 欧美精品一区二区三区蜜桃| 国产精品视频在线看| 亚洲一区二区在线免费看| 日韩电影一区二区三区| 国产一区啦啦啦在线观看| 成人免费观看男女羞羞视频| 欧美手机在线视频| 久久影视一区二区| 亚洲人成网站精品片在线观看| 丝袜美腿成人在线| 欧美巨大另类极品videosbest| 日韩欧美一级在线播放| 中文字幕成人在线观看| 午夜精品爽啪视频| 国产一区二区成人久久免费影院| 91高清视频在线| 精品国产sm最大网站免费看| 亚洲另类色综合网站| 久久国产人妖系列| 一本到不卡精品视频在线观看| 欧美精品一二三| 国产精品你懂的| 久久99这里只有精品| 91浏览器在线视频| 久久精品这里都是精品| 亚洲成av人片在www色猫咪| 国产精品综合av一区二区国产馆| 在线一区二区三区四区五区 | 午夜久久久久久久久| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 在线综合+亚洲+欧美中文字幕| 亚洲国产精品v| 韩国成人福利片在线播放| 中文字幕亚洲不卡| 麻豆成人综合网| 欧美日韩欧美一区二区| 综合欧美亚洲日本| 国产伦精一区二区三区| 精品精品欲导航| 亚洲成a人片在线观看中文| 99麻豆久久久国产精品免费| 国产午夜精品一区二区| 国产资源精品在线观看| 日韩欧美一区电影| 久久99精品久久久久久国产越南 | 久久99国产精品麻豆| 欧美在线观看视频在线| 自拍偷自拍亚洲精品播放| 国产白丝网站精品污在线入口| 日韩精品一区二区三区视频 | 欧美群妇大交群的观看方式| 一区二区在线观看视频| 白白色 亚洲乱淫| 日本亚洲电影天堂| 欧美日韩精品福利| 奇米色一区二区| 欧美日韩国产小视频在线观看| 亚洲精品大片www| 97久久超碰国产精品电影| 国产精品三级av在线播放| 成人手机在线视频| 国产精品网友自拍| 91色在线porny| 亚洲黄色免费网站| 在线播放欧美女士性生活| 蜜臀91精品一区二区三区 | 久久成人免费电影| 欧美成人综合网站| 韩国在线一区二区| 中文字幕中文字幕中文字幕亚洲无线| av成人免费在线观看| 亚洲宅男天堂在线观看无病毒| 欧美日韩国产a| 国产麻豆视频一区二区| 国产精品免费视频观看| 色视频成人在线观看免| 亚洲国产wwwccc36天堂| 欧美一区二区免费| 国产精品亚洲第一| 一区二区激情小说| 日韩女优av电影| 国产东北露脸精品视频| 亚洲一区在线电影| 欧美va日韩va| 91国产免费观看| 老司机午夜精品| 亚洲图片激情小说| 日韩欧美一级片| 99re这里只有精品视频首页| 天堂久久一区二区三区| 国产欧美一区二区精品性色超碰| 色猫猫国产区一区二在线视频| 欧美a一区二区| 自拍偷在线精品自拍偷无码专区| 欧美一区二区三区在线视频 | 欧美日韩免费在线视频| 国内成人自拍视频| 亚洲va在线va天堂| 1024成人网色www| 2023国产一二三区日本精品2022| 色天天综合久久久久综合片| 国产一区二区三区在线观看精品| 亚洲成a人片在线观看中文| 国产精品视频一二| 欧美电影精品一区二区| 欧美色老头old∨ideo| 成人精品视频.| 麻豆国产欧美日韩综合精品二区| 一区二区三区四区五区视频在线观看| www欧美成人18+| 日韩精品一区二区三区视频播放 | 国产91精品入口| 午夜精品福利视频网站| 亚洲免费观看高清完整版在线观看熊 | 久久久久久久久久久久久女国产乱| 色88888久久久久久影院按摩| 高清av一区二区| 国内成人精品2018免费看| 日韩精品亚洲一区二区三区免费| 亚洲情趣在线观看| 亚洲欧美在线高清| 1区2区3区精品视频| 欧美激情综合网| 亚洲国产精品精华液ab| 国产日韩欧美在线一区| 2024国产精品| 国产免费观看久久| 久久精品免费在线观看| 久久久九九九九| 国产亚洲欧美在线| 日本一区二区三区国色天香| 国产拍欧美日韩视频二区| 国产欧美精品一区| 国产精品美女久久久久久久| 中文字幕精品一区二区三区精品 | 色综合中文字幕| 色偷偷久久一区二区三区| 99国内精品久久| 色综合久久久久久久久久久| 在线中文字幕一区| 在线成人av影院| 精品国产一区二区三区久久久蜜月 | 国产一区在线精品| 国产suv精品一区二区三区| 福利一区二区在线| 色综合久久久久| 欧美性猛片xxxx免费看久爱| 3751色影院一区二区三区| 日韩一卡二卡三卡四卡| 久久伊99综合婷婷久久伊| 国产精品午夜春色av| 亚洲天天做日日做天天谢日日欢| 一区二区在线观看不卡| 婷婷综合另类小说色区| 精品午夜久久福利影院| av网站一区二区三区| 欧美视频一区在线观看| 日韩三区在线观看| 国产婷婷色一区二区三区| 亚洲女厕所小便bbb| 视频一区二区国产| 极品美女销魂一区二区三区| 94-欧美-setu| 精品国产一区二区三区久久影院| 中文字幕一区视频| 日韩精品电影在线| gogo大胆日本视频一区| 欧美老女人在线| 欧美激情一区二区三区蜜桃视频| 一区二区久久久| 国产 欧美在线| 91精品一区二区三区久久久久久| 国产亚洲综合在线| 蜜桃视频免费观看一区| 91亚洲精品一区二区乱码| 精品国产乱码久久久久久浪潮 | 国产亚洲精品中文字幕|