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

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

?? os_q.c

?? 我 Porting 的 uC/OS-II V2.84 (目前Micrium)最新版之 Keil C51 工程,專供給 8051 上做任務調度,我已將 Code Size 改小至 4000 Byte,對
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                        MESSAGE QUEUE MANAGEMENT
*
*                          (c) Copyright 1992-2006, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_Q.C
* By      : Jean J. Labrosse
*********************************************************************************************************
*/

#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)	reentrant
{
    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) reentrant
{
    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)	reentrant
{
    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 = OS_TRUE;                              /* Yes                                      */
    } else {
        tasks_waiting = OS_FALSE;                             /* No                                       */
    }
    switch (opt) {
        case OS_DEL_NO_PEND:                               /* Delete queue only if no task waiting     */
             if (tasks_waiting == OS_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();
                 *err                   = OS_ERR_TASK_WAITING;
                 pevent_return          = pevent;
             }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
极品美女销魂一区二区三区 | 午夜一区二区三区视频| 国产99一区视频免费| 久久久综合九色合综国产精品| 久久不见久久见免费视频7| 日韩丝袜美女视频| 麻豆精品视频在线观看视频| 精品日韩成人av| 国产麻豆精品95视频| 国产日产精品一区| 91在线你懂得| 午夜精品福利一区二区三区av| 欧美卡1卡2卡| 精彩视频一区二区| 中文成人av在线| 在线观看亚洲一区| 免费观看成人鲁鲁鲁鲁鲁视频| 精品区一区二区| 丁香天五香天堂综合| 亚洲人妖av一区二区| 欧美日韩国产一级二级| 国内不卡的二区三区中文字幕| 国产欧美日韩久久| 91豆麻精品91久久久久久| 日本va欧美va精品| 国产欧美一区二区精品婷婷| 99精品桃花视频在线观看| 亚洲国产欧美一区二区三区丁香婷| 欧美一区二区三区婷婷月色| 粉嫩久久99精品久久久久久夜| 亚洲九九爱视频| 欧美一区二区视频在线观看2022 | 亚洲欧美电影一区二区| 欧美日韩五月天| 国产很黄免费观看久久| 亚洲综合激情小说| 久久综合九色欧美综合狠狠| 91蝌蚪porny| 美女爽到高潮91| 亚洲另类在线一区| 久久久久久久久久久黄色| 欧美色窝79yyyycom| 国产99久久久久| 日韩成人精品在线| 亚洲激情男女视频| 久久久久久久精| 在线视频你懂得一区| 国产一区二区免费视频| 丝袜国产日韩另类美女| 中文字幕在线观看不卡视频| 日韩午夜在线观看| 欧美日韩视频在线一区二区| 成人夜色视频网站在线观看| 蜜臀av国产精品久久久久| 亚洲一区二区在线观看视频| 国产精品国产三级国产aⅴ中文| 日韩精品一区二区三区三区免费 | 天天av天天翘天天综合网| 精品国产凹凸成av人导航| 色av一区二区| 国产麻豆精品theporn| 亚洲成人精品一区二区| 国产欧美综合色| 欧美日韩国产123区| 成人精品视频一区二区三区尤物| 亚洲精品成人在线| 国产精品你懂的在线欣赏| 日韩一区二区三区四区五区六区 | 亚洲成a人片在线观看中文| 久久久久99精品国产片| 在线观看日韩一区| 成人激情免费视频| 蜜臀av一区二区三区| 亚洲黄网站在线观看| 亚洲国产精品激情在线观看 | 美日韩一区二区三区| 亚洲美腿欧美偷拍| 欧美高清一级片在线观看| 精品1区2区3区| 欧美在线啊v一区| av亚洲产国偷v产偷v自拍| 久久69国产一区二区蜜臀 | 国产精品国产精品国产专区不蜜| 日韩欧美视频在线| 欧美日韩国产在线播放网站| 色综合天天在线| 成人网男人的天堂| 国产精品 欧美精品| 国产主播一区二区| 精品在线播放午夜| 精品写真视频在线观看| 天天色天天操综合| 天天操天天干天天综合网| 亚洲一区二区三区视频在线| 1024亚洲合集| 国产精品久久久久久久久免费丝袜 | 久久午夜羞羞影院免费观看| 日韩午夜激情av| 欧美一区二区三区婷婷月色| 91精品国产欧美一区二区18| 欧美精品九九99久久| 欧美日韩中字一区| 欧美日韩电影一区| 欧美一区二区三区在线| 91精品国产综合久久久久久| 7777精品伊人久久久大香线蕉经典版下载 | 国产精品乱人伦中文| 国产精品家庭影院| 亚洲天堂网中文字| 成人免费在线视频观看| 欧美激情一区在线| 亚洲精品ww久久久久久p站| 一区二区成人在线观看| 亚洲www啪成人一区二区麻豆| 亚洲成人动漫av| 蜜桃在线一区二区三区| 国模一区二区三区白浆 | 粉嫩一区二区三区性色av| 成人综合激情网| 91免费在线看| 欧美日韩亚洲综合一区二区三区| 91精品国产色综合久久不卡蜜臀 | 高清shemale亚洲人妖| 成年人午夜久久久| 99视频有精品| 欧美日韩电影一区| 久久婷婷成人综合色| 中文字幕成人av| 亚洲综合一区在线| 另类综合日韩欧美亚洲| 国产成人av电影在线观看| 91香蕉国产在线观看软件| 欧美日韩精品一区二区| 欧美色综合影院| 欧美国产激情二区三区 | 亚洲午夜私人影院| 久久99久久精品| 99视频热这里只有精品免费| 欧美高清www午色夜在线视频| xfplay精品久久| 亚洲精品高清在线| 国产一区二区在线看| 欧美亚洲综合在线| 日韩欧美一级特黄在线播放| 久久久国产综合精品女国产盗摄| 一区二区在线观看不卡| 久久99久久精品| 欧美色图免费看| 久久精品免视看| 午夜精品爽啪视频| 99久久精品久久久久久清纯| 欧美一区二区三区视频在线 | 欧美高清精品3d| 中文字幕在线不卡一区二区三区| 热久久一区二区| 日本道色综合久久| 欧美激情一区二区三区| 日韩激情视频网站| 成人黄页毛片网站| 日韩一区二区三区视频在线观看| 国产精品久久久久国产精品日日| 日本不卡一二三区黄网| 色悠悠久久综合| 国产免费久久精品| 日本成人在线不卡视频| 91麻豆成人久久精品二区三区| 欧美精品一区二区三区蜜桃视频| 亚洲成人一区二区在线观看| 99国产欧美另类久久久精品| 久久九九久久九九| 日韩av网站免费在线| 成人国产精品免费观看视频| 日韩午夜电影av| 日韩福利视频网| 欧美日韩一级黄| 一区二区三区鲁丝不卡| 91色婷婷久久久久合中文| 精品国产电影一区二区| 九色综合狠狠综合久久| 欧美一区二区精品在线| 亚洲1区2区3区视频| 91猫先生在线| 亚洲视频小说图片| 不卡的av电影| 国产日韩三级在线| 国产大片一区二区| 中文字幕精品综合| 成人污视频在线观看| 国产欧美日本一区二区三区| 国产一区二区久久| 久久精品免视看| 成人午夜免费av| 国产精品久久777777| 97se亚洲国产综合自在线| 777a∨成人精品桃花网| 国产一区二区三区精品视频| 久久婷婷一区二区三区| 粉嫩久久99精品久久久久久夜| 中日韩av电影| 91美女片黄在线观看91美女|