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

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

?? os_q.c

?? UCOSII在mcs12dg128上的移植
?? 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 "..\Sources\UCOS2\CONFIG_UCOS\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();
        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;
            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);
    }
    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                  = (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  */
                 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                  = (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  */
             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:
             OS_EXIT_CRITICAL();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91久久香蕉国产日韩欧美9色| 中文字幕在线不卡| 午夜久久久影院| 欧美日韩免费视频| 午夜精品视频一区| 日韩一区二区三区精品视频| 国产精品自在在线| 欧美激情中文不卡| 91国偷自产一区二区开放时间 | 精品国产自在久精品国产| 韩日精品视频一区| 国产目拍亚洲精品99久久精品| 国产91精品在线观看| 亚洲欧洲中文日韩久久av乱码| 在线观看日韩精品| 久久99国产精品尤物| 国产精品嫩草影院com| 欧美性色欧美a在线播放| 日本女优在线视频一区二区| 2020国产精品自拍| www.成人在线| 日韩不卡手机在线v区| 久久免费的精品国产v∧| 91玉足脚交白嫩脚丫在线播放| 亚洲高清视频在线| 国产亚洲一区二区三区| 色94色欧美sute亚洲13| 看电视剧不卡顿的网站| 国产精品福利av| 欧美久久久久久久久中文字幕| 国产露脸91国语对白| 亚洲综合久久av| 久久久www成人免费无遮挡大片| 色综合久久中文字幕综合网| 蜜桃视频在线观看一区| 中文字幕五月欧美| 欧美电视剧在线观看完整版| 国产精品99久久久久久宅男| 99久精品国产| 欧美zozo另类异族| 夜夜爽夜夜爽精品视频| 国产精品996| 欧美老年两性高潮| **性色生活片久久毛片| 精品一二三四区| 欧美影院午夜播放| 国产精品美女久久久久久久 | 久久精品日产第一区二区三区高清版 | 国产精品国产三级国产aⅴ中文| 亚洲国产日韩一级| 国产激情视频一区二区在线观看| 欧美综合在线视频| 国产精品卡一卡二卡三| 久久99久久99精品免视看婷婷| 色老汉一区二区三区| 久久久99精品免费观看不卡| 天天影视网天天综合色在线播放| 99久久综合狠狠综合久久| 日韩欧美一二三四区| 亚洲一区中文在线| 色综合久久久网| 国产精品青草久久| 国产成人精品亚洲777人妖| 欧美一区二区三区四区久久| 亚洲一区二区三区中文字幕 | 国产亚洲综合在线| 精品少妇一区二区三区日产乱码| 欧美日韩精品一二三区| 在线欧美日韩国产| 色老综合老女人久久久| 91蜜桃婷婷狠狠久久综合9色| 福利一区二区在线| 91传媒视频在线播放| a亚洲天堂av| 99国产欧美另类久久久精品| 91精品久久久久久久久99蜜臂| 91国产福利在线| 粉嫩av亚洲一区二区图片| 久久精品国产一区二区| 麻豆91小视频| 日韩黄色免费网站| 香蕉久久一区二区不卡无毒影院 | 国产人久久人人人人爽| 黑人巨大精品欧美一区| 欧美草草影院在线视频| 麻豆精品一二三| 欧美不卡在线视频| 国产91丝袜在线播放| 国产精品第13页| 91久久精品午夜一区二区| 一区二区三区日韩精品| 在线观看精品一区| 日av在线不卡| 日本韩国欧美一区二区三区| 国产精品灌醉下药二区| 色综合久久天天| 日韩电影一区二区三区四区| 777午夜精品免费视频| 韩国三级电影一区二区| 国产精品久久99| 欧美日韩精品综合在线| 激情深爱一区二区| 亚洲欧洲综合另类在线| 这里只有精品视频在线观看| 国产一区二区三区在线观看精品| 亚洲一区二区四区蜜桃| 欧美大片日本大片免费观看| 成人av网站大全| 日本三级亚洲精品| 国产精品视频你懂的| 欧美日韩精品一区视频| 国产成人在线视频播放| 亚洲国产精品久久久男人的天堂| 2023国产一二三区日本精品2022| 成人精品视频一区二区三区尤物| 亚洲高清不卡在线| 国产日韩欧美在线一区| 日本久久一区二区| 国产高清不卡一区二区| 亚洲国产综合人成综合网站| 中文字幕欧美三区| 日韩一卡二卡三卡四卡| 色综合 综合色| 国产精品一色哟哟哟| 视频一区在线播放| 亚洲欧洲国产专区| 久久一区二区三区四区| 欧美日韩成人综合| 色视频欧美一区二区三区| 国产精品综合二区| 国产欧美精品区一区二区三区| 国产高清精品网站| 日韩黄色免费网站| 亚洲一区视频在线观看视频| 视频在线观看一区| 国产精品女同一区二区三区| 欧美一区二区观看视频| 欧美性受极品xxxx喷水| 成人99免费视频| 国产成人综合网| 国产毛片精品视频| 久久国产尿小便嘘嘘尿| 日韩国产欧美三级| 日韩中文字幕亚洲一区二区va在线| 亚洲欧洲国产日韩| 国产精品成人网| 中文字幕国产一区二区| 久久亚洲春色中文字幕久久久| 欧美一区二区三区四区在线观看| 欧美日本精品一区二区三区| 欧美日韩亚洲国产综合| 欧美日韩在线一区二区| 在线视频你懂得一区| 欧美亚洲综合色| 欧美色综合网站| 国产精品乱码一区二区三区软件 | 午夜精品福利在线| 亚洲色欲色欲www| 亚洲视频一区二区免费在线观看| 国产精品网站在线观看| 国产精品网站在线播放| 亚洲欧洲三级电影| 亚洲黄网站在线观看| 亚洲少妇中出一区| 亚洲综合在线五月| 天天影视涩香欲综合网| 天天综合天天做天天综合| 蜜臀久久99精品久久久画质超高清 | 欧美成人一区二区三区片免费| 日韩一区和二区| 久久久蜜桃精品| 中文字幕中文字幕一区| 亚洲午夜久久久久久久久电影网| 三级在线观看一区二区| 精品一区二区免费视频| 处破女av一区二区| 欧美日韩中文字幕一区二区| 久久综合九色综合欧美就去吻| 国精产品一区一区三区mba桃花| 韩国女主播成人在线观看| 国产成人综合网站| 91理论电影在线观看| 欧美日韩国产在线观看| 欧美成va人片在线观看| 亚洲丝袜另类动漫二区| 日韩电影在线一区二区三区| 国产盗摄视频一区二区三区| 日本精品裸体写真集在线观看| 91精品久久久久久久久99蜜臂| 国产免费成人在线视频| 亚洲国产精品久久久男人的天堂| 韩国在线一区二区| 在线观看欧美日本| 国产日韩欧美电影| 日韩成人精品在线| 91在线观看美女| 国产喂奶挤奶一区二区三区| 亚洲国产精品一区二区久久恐怖片 | 18欧美乱大交hd1984| 奇米在线7777在线精品|