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

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

?? os_mbox.c

?? C51單片機上的嵌入式操作系統,具有任務調度,文件服務,等功能
?? C
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                       MESSAGE MAILBOX MANAGEMENT
*
*                        (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
*                                           All Rights Reserved
*
*                                                  V2.00
*
* File : OS_MBOX.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.h"
#endif

#if OS_MBOX_EN
/*
*********************************************************************************************************
*                                     ACCEPT MESSAGE FROM MAILBOX
*
* Description: This function checks the mailbox to see if a message is available.  Unlike OSMboxPend(),
*              OSMboxAccept() 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 mailbox if one is available.  The mailbox is cleared
*                            so the next time OSMboxAccept() is called, the mailbox will be empty.
*              == (void *)0  if the mailbox is empty or if you didn't pass the proper event pointer.
*********************************************************************************************************
*/
#if OS_Mbox_Accept_EN
void *OSMboxAccept (OS_EVENT *pevent)reentrant
{
    void  *msg;


    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {      /* Validate event block type                 */
        OS_EXIT_CRITICAL();
        return ((void *)0);
    }
    msg = pevent->OSEventPtr; 
    if (msg != (void *)0) {                               /* See if there is already a message         */
        pevent->OSEventPtr = (void *)0;                   /* Clear the mailbox                         */
    }
    OS_EXIT_CRITICAL();
    return (msg);                                         /* Return the message received (or NULL)     */
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                        CREATE A MESSAGE MAILBOX
*
* Description: This function creates a message mailbox if free event control blocks are available.
*
* Arguments  : msg           is a pointer to a message that you wish to deposit in the mailbox.  If
*                            you set this value to the NULL pointer (i.e. (void *)0) then the mailbox
*                            will be considered empty.
*
* Returns    : != (void *)0  is a pointer to the event control clock (OS_EVENT) associated with the
*                            created mailbox
*              == (void *)0  if no event control blocks were available
*********************************************************************************************************
*/
#if OS_Mbox_Create_EN
OS_EVENT *OSMboxCreate (void *msg)reentrant
{
    OS_EVENT *pevent;


    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) {
        pevent->OSEventType = OS_EVENT_TYPE_MBOX;
        pevent->OSEventPtr  = msg;               /* Deposit message in event control block             */
        OSEventWaitListInit(pevent);
    }
    return (pevent);                             /* Return pointer to event control block              */
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                      PEND ON MAILBOX FOR A MESSAGE
*
* Description: This function waits for a message to be sent to a mailbox
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired mailbox
*
*              timeout       is an optional timeout period (in clock ticks).  If non-zero, your task will
*                            wait for a message to arrive at the mailbox up to the amount of time 
*                            specified by this argument.  If you specify 0, however, your task will wait 
*                            forever at the specified mailbox or, until a message arrives.
*
*              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_TIMEOUT        A message was not received within the specified timeout
*                            OS_ERR_EVENT_TYPE Invalid event type
*                            OS_ERR_PEND_ISR   If you called this function from an ISR and the result
*                                              would lead to a suspension.
*
* Returns    : != (void *)0  is a pointer to the message received
*              == (void *)0  if no message was received or you didn't pass the proper pointer to the
*                            event control block.
*********************************************************************************************************
*/
#if OS_Mbox_Pend_EN
void *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)reentrant
{
    void  *msg;


    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                     */
        OS_EXIT_CRITICAL();
        *err = OS_ERR_EVENT_TYPE;
        return ((void *)0);
    }
    msg = pevent->OSEventPtr;
    if (msg != (void *)0) {                           /* See if there is already a message             */
        pevent->OSEventPtr = (void *)0;               /* Clear the mailbox                             */
        OS_EXIT_CRITICAL();
        *err = OS_NO_ERR;
    } else if (OSIntNesting > 0) {                    /* See if called from ISR ...                    */
        OS_EXIT_CRITICAL();                           /* ... can't PEND from an ISR                    */
        *err = OS_ERR_PEND_ISR;
    } else {
        OSTCBCur->OSTCBStat |= OS_STAT_MBOX;          /* Message not available, task will pend         */
        OSTCBCur->OSTCBDly   = timeout;               /* Load timeout in TCB                           */
        OSEventTaskWait(pevent);                      /* Suspend task until event or timeout occurs    */
        OS_EXIT_CRITICAL();
        OSSched();                                    /* Find next highest priority task ready to run  */
        OS_ENTER_CRITICAL();
        if ((msg = OSTCBCur->OSTCBMsg) != (void *)0) {     /* See if we were given the message         */
            OSTCBCur->OSTCBMsg      = (void *)0;           /* Yes, clear message received              */
            OSTCBCur->OSTCBStat     = OS_STAT_RDY;
            OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;       /* No longer waiting for event              */
            OS_EXIT_CRITICAL();
            *err                    = OS_NO_ERR;
        } else if (OSTCBCur->OSTCBStat & OS_STAT_MBOX) {   /* If status is not OS_STAT_RDY, timed out  */
            OSEventTO(pevent);                             /* Make task ready                          */
            OS_EXIT_CRITICAL();
            msg                     = (void *)0;           /* Set message contents to NULL             */
            *err                    = OS_TIMEOUT;          /* Indicate that a timeout occured          */
        } else {
            msg                     = pevent->OSEventPtr;  /* Message received                         */
            pevent->OSEventPtr      = (void *)0;           /* Clear the mailbox                        */
            OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;
            OS_EXIT_CRITICAL();
            *err                    = OS_NO_ERR;
        }
    }
    return (msg);                                          /* Return the message received (or NULL)    */
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                       POST MESSAGE TO A MAILBOX
*
* Description: This function sends a message to a mailbox
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired mailbox
*
*              msg           is a pointer to the message to send.  You MUST NOT send a NULL pointer.  
*
* Returns    : OS_NO_ERR          The call was successful and the message was sent
*              OS_MBOX_FULL       If the mailbox already contains a message.  You can can only send one
*                                 message at a time and thus, the message MUST be consumed before you are
*                                 allowed to send another one.
*              OS_ERR_EVENT_TYPE  If you are attempting to post to a non mailbox.
*********************************************************************************************************
*/
#if OS_Mbox_Post_EN
INT8U OSMboxPost (OS_EVENT *pevent, void *msg)reentrant
{
    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                     */
        OS_EXIT_CRITICAL();
        return (OS_ERR_EVENT_TYPE);
    }
    if (pevent->OSEventGrp) {                         /* See if any task pending on mailbox            */
        OSEventTaskRdy(pevent, msg, OS_STAT_MBOX);    /* Ready highest priority task waiting on event  */
        OS_EXIT_CRITICAL();
        OSSched();                                    /* Find highest priority task ready to run       */
        return (OS_NO_ERR);
    } else {
        if (pevent->OSEventPtr != (void *)0) {        /* Make sure mailbox doesn't already have a msg  */
            OS_EXIT_CRITICAL();
            return (OS_MBOX_FULL);
        } else {
            pevent->OSEventPtr = msg;                 /* Place message in mailbox                      */
            OS_EXIT_CRITICAL();
            return (OS_NO_ERR);
        }
    }
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                        QUERY A MESSAGE MAILBOX
*
* Description: This function obtains information about a message mailbox.
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired mailbox
*
*              dataptr         is a pointer to a structure that will contain information about the message
*                            mailbox.
*
* Returns    : OS_NO_ERR          The call was successful and the message was sent
*              OS_ERR_EVENT_TYPE  If you are attempting to obtain data from a non mailbox.
*********************************************************************************************************
*/
#if OS_Mbox_Query_EN
INT8U OSMboxQuery (OS_EVENT *pevent, OS_MBOX_DATA *dataptr)reentrant
{
    INT8U  i;
    INT8U *psrc;
    INT8U *pdest;
    
    
    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {       /* Validate event block type                */
        OS_EXIT_CRITICAL();
        return (OS_ERR_EVENT_TYPE);
    }
    dataptr->OSEventGrp = pevent->OSEventGrp;                /* Copy message mailbox wait list           */
    psrc              = &pevent->OSEventTbl[0];
    pdest             = &dataptr->OSEventTbl[0];
    for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
        *pdest++ = *psrc++;   
    }
    dataptr->OSMsg = pevent->OSEventPtr;                     /* Get message from mailbox                 */
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}
#endif
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人精品一区二区| 欧美日韩成人激情| 久久精品一区八戒影视| 国产乱码精品一区二区三区忘忧草| 91麻豆精品国产| 日本欧美肥老太交大片| 日韩精品自拍偷拍| 亚洲国产日日夜夜| 日韩一区二区三区高清免费看看| 日韩精品一区二区三区四区视频| 蜜桃精品在线观看| 亚洲精品一区二区三区99| 国产91精品在线观看| 欧美不卡视频一区| 91麻豆福利精品推荐| 日韩亚洲欧美一区| 国产一区二区导航在线播放| 日本一区二区综合亚洲| 91碰在线视频| 视频一区在线视频| 国产日韩欧美精品在线| 91亚洲精品久久久蜜桃网站| 亚洲v中文字幕| 精品99久久久久久| 91香蕉国产在线观看软件| 天堂影院一区二区| 国产欧美久久久精品影院| 欧美亚一区二区| 国产精品资源网| 亚洲第一在线综合网站| 精品久久久影院| 在线观看av一区| 狠狠色综合日日| 一区二区三区精品视频| 精品福利一二区| 91福利资源站| 粉嫩绯色av一区二区在线观看| 一区二区在线观看不卡| 欧美精品一区二区久久婷婷| 色婷婷av一区二区三区gif| 日本亚洲三级在线| 亚洲欧洲精品一区二区三区不卡| 91精品婷婷国产综合久久| 成人av网站在线观看免费| 三级成人在线视频| 亚洲日本乱码在线观看| 国产亚洲成av人在线观看导航| 精品视频一区三区九区| 成人av午夜电影| 国产剧情av麻豆香蕉精品| 婷婷一区二区三区| 亚洲精品视频在线看| 久久久久久免费| 精品99一区二区| 宅男噜噜噜66一区二区66| 色综合一区二区三区| 国产一区二区调教| 奇米精品一区二区三区四区 | 一区二区三区中文字幕电影 | 国产精品人妖ts系列视频| 欧美一区二区在线观看| 91国内精品野花午夜精品| 成人免费观看男女羞羞视频| 极品销魂美女一区二区三区| 视频一区二区三区在线| 亚洲最新视频在线观看| 中文字幕一区在线| 国产日韩欧美综合一区| 久久久不卡影院| 久久综合九色综合欧美98| 日韩一区二区三区电影在线观看 | 欧美一区三区二区| 在线亚洲免费视频| 成人激情校园春色| 亚洲高清免费观看 | 国产一区二区在线电影| 日韩国产欧美在线观看| 中文字幕av一区二区三区| 成人永久aaa| 欧美电视剧在线看免费| 免费在线看成人av| 中文字幕一区二区三区在线不卡| 欧美在线free| 国产精品亚洲人在线观看| 亚洲国产中文字幕| 国产精品久久久久一区二区三区共| 欧美精品日韩一本| 亚洲综合色丁香婷婷六月图片| 91视频观看免费| 五月婷婷色综合| 亚洲视频网在线直播| 精品日韩一区二区三区| 欧美日韩一区二区不卡| 日韩电影在线观看电影| 久久精品亚洲国产奇米99| 日本aⅴ免费视频一区二区三区| 成人av电影在线播放| 一区二区成人在线观看| 在线播放/欧美激情| 国产iv一区二区三区| 黄网站免费久久| 国产精品69久久久久水密桃| 国产成人精品三级| 乱一区二区av| 亚洲午夜免费福利视频| 国产精品萝li| 亚洲电影你懂得| 男男视频亚洲欧美| 日韩综合在线视频| 国产ts人妖一区二区| 日本伊人精品一区二区三区观看方式| 夜夜精品浪潮av一区二区三区| 亚洲一区二区三区精品在线| 日韩精品乱码av一区二区| 国产专区欧美精品| 91小视频在线| 日韩精品一区二区三区蜜臀| 国产精品美日韩| 天天综合网 天天综合色| 韩日精品视频一区| 97成人超碰视| 精品人在线二区三区| 综合网在线视频| 久久99国产精品麻豆| 91天堂素人约啪| 欧美大片免费久久精品三p| 国产精品国产精品国产专区不片| 亚洲一区二区精品久久av| 国内不卡的二区三区中文字幕| 91亚洲精品一区二区乱码| 欧美mv日韩mv国产| 亚洲最新在线观看| 成人免费精品视频| 日韩一区二区在线观看视频 | 国产亚洲午夜高清国产拍精品| 亚洲欧美另类久久久精品2019| 精品一区二区国语对白| 欧美性xxxxxx少妇| 国产精品人妖ts系列视频| 麻豆精品蜜桃视频网站| 欧美在线一二三| 中文字幕在线不卡| 国产精品91一区二区| 欧美精品一级二级三级| 亚洲欧洲精品天堂一级 | 国产精品超碰97尤物18| 免费高清在线一区| 在线观看亚洲专区| 欧美经典一区二区| 久久成人免费网| 欧美日韩日本视频| 亚洲乱码一区二区三区在线观看| 国产成人免费视| 精品国产一区二区三区久久久蜜月| 亚洲电影一级片| 欧美在线观看视频在线| 亚洲日本在线a| 9色porny自拍视频一区二区| 久久青草欧美一区二区三区| 日本网站在线观看一区二区三区| 色婷婷亚洲婷婷| 日韩理论片网站| 91在线看国产| 亚洲一区二区影院| 欧美三级一区二区| 亚洲一区在线观看网站| 在线精品视频一区二区| 亚洲最新在线观看| 欧美在线影院一区二区| 亚洲成人一区二区在线观看| 欧美亚洲综合色| 亚洲欧美国产77777| 中文字幕欧美一区| 欧美一区二区精品在线| 久久精品人人做人人爽97| 国产一本一道久久香蕉| 久久久精品国产免费观看同学| 久久电影网电视剧免费观看| 精品福利视频一区二区三区| 狠狠色丁香婷综合久久| 337p日本欧洲亚洲大胆精品| 国产精品一区二区三区网站| 国产欧美一区二区三区在线老狼| 粉嫩av一区二区三区粉嫩| 亚洲日本在线天堂| 欧美午夜精品久久久| 日本一不卡视频| 久久亚洲综合色一区二区三区| 国产精品一二三区在线| 欧美国产综合色视频| 91丨九色porny丨蝌蚪| 亚洲另类春色校园小说| 欧美日韩中文字幕一区二区| 香蕉av福利精品导航 | 91精品欧美综合在线观看最新| 欧美男人的天堂一二区| 欧美成人一区二区三区片免费| 国产欧美精品区一区二区三区| www.日本不卡| 亚洲va欧美va人人爽|