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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_mbox.c

?? 邵貝貝的UCOS書后光盤內(nèi)容
?? 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.
*********************************************************************************************************
*/

void *OSMboxAccept (OS_EVENT *pevent)
{
    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)     */
}
/*$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
*********************************************************************************************************
*/

OS_EVENT *OSMboxCreate (void *msg)
{
    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              */
}
/*$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.
*********************************************************************************************************
*/

void *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)
{
    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)    */
}
/*$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.
*********************************************************************************************************
*/

INT8U OSMboxPost (OS_EVENT *pevent, void *msg)
{
    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);
        }
    }
}
/*$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
*
*              pdata         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.
*********************************************************************************************************
*/

INT8U OSMboxQuery (OS_EVENT *pevent, OS_MBOX_DATA *pdata)
{
    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);
    }
    pdata->OSEventGrp = pevent->OSEventGrp;                /* Copy message mailbox wait list           */
    psrc              = &pevent->OSEventTbl[0];
    pdest             = &pdata->OSEventTbl[0];
    for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
        *pdest++ = *psrc++;   
    }
    pdata->OSMsg = pevent->OSEventPtr;                     /* Get message from mailbox                 */
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}
#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人精品国产一区二区4080 | 国产欧美中文在线| 美女高潮久久久| 欧美电视剧免费全集观看| 毛片一区二区三区| 久久免费的精品国产v∧| 黄色日韩三级电影| 国产欧美日韩另类视频免费观看| 丁香婷婷综合激情五月色| 中文一区在线播放| 在线视频综合导航| 石原莉奈在线亚洲三区| 精品国产电影一区二区| 不卡在线观看av| 亚洲国产欧美在线人成| 欧美一级精品在线| 成人综合婷婷国产精品久久蜜臀| 国产精品热久久久久夜色精品三区| 成人av第一页| 亚洲综合久久久| 日韩精品一区二区三区中文不卡 | 亚洲综合小说图片| 91麻豆精品国产91久久久 | 欧美日韩一区三区| 久久99精品国产.久久久久久| 国产丝袜欧美中文另类| 成人黄色在线网站| 日韩黄色小视频| 国产欧美一区二区在线| 欧美图区在线视频| 国产一区二区三区综合| 亚洲制服丝袜一区| 久久婷婷综合激情| 在线视频观看一区| 精品无码三级在线观看视频| 综合色中文字幕| 日韩一区二区三区观看| www.欧美色图| 伦理电影国产精品| 亚洲日本va午夜在线影院| 日韩欧美一级片| 91亚洲资源网| 国产在线不卡一卡二卡三卡四卡| 亚洲激情图片一区| 国产网站一区二区三区| 欧美高清性hdvideosex| 成人国产精品免费网站| 日本少妇一区二区| 一区二区三区免费观看| 久久久亚洲精华液精华液精华液| 欧美日韩国产高清一区| av电影天堂一区二区在线| 久久精品国产99| 亚洲成人综合视频| 亚洲欧美激情小说另类| 欧美激情中文字幕| 日韩免费在线观看| 欧美三级欧美一级| 91麻豆免费观看| 成人伦理片在线| 国产成人精品亚洲777人妖| 日韩av在线发布| 亚洲国产精品天堂| 亚洲欧美日韩综合aⅴ视频| 国产欧美日韩精品a在线观看| 欧美剧情电影在线观看完整版免费励志电影| 国产a久久麻豆| 国产精品综合网| 国内不卡的二区三区中文字幕| 亚洲一区二区欧美| 亚洲一区二区在线观看视频| 最近中文字幕一区二区三区| 国产精品色哟哟网站| 国产校园另类小说区| 日韩欧美国产系列| 欧美一区二区三区色| 97se亚洲国产综合自在线不卡| 久久精品日产第一区二区三区高清版| 精品三级av在线| 26uuu亚洲综合色欧美| 欧美剧在线免费观看网站| 欧美剧情片在线观看| 欧美调教femdomvk| 欧美日韩免费一区二区三区| 99视频一区二区三区| 99久久国产免费看| 高清不卡一区二区| 成人av电影在线| 北岛玲一区二区三区四区| 成人午夜在线视频| 国产成人免费视频精品含羞草妖精| 人人爽香蕉精品| 免费观看在线色综合| 午夜精品久久久| 日本色综合中文字幕| 亚洲第一福利一区| 偷窥国产亚洲免费视频| 日韩精品一级中文字幕精品视频免费观看| 三级影片在线观看欧美日韩一区二区 | 精品国产免费一区二区三区香蕉| 精品欧美乱码久久久久久1区2区| 日韩区在线观看| 国产无人区一区二区三区| 久久精品一区二区三区不卡| 国产精品美女视频| 国产精品视频看| 一区二区三区成人在线视频| 亚洲欧洲一区二区三区| 亚洲色图视频网| 日韩和欧美一区二区| 男男视频亚洲欧美| 成人高清免费在线播放| 成人激情免费视频| 欧美性受xxxx| 欧美一区二区二区| 国产精品蜜臀av| 亚洲一区视频在线| 国产成人精品影视| 成人精品一区二区三区四区| 欧美亚洲愉拍一区二区| 欧美精品v日韩精品v韩国精品v| 久久综合久久鬼色| 国产日韩在线不卡| 五月激情综合色| 国产成人综合亚洲91猫咪| 91麻豆高清视频| 精品美女在线播放| 国产精品久久久久久亚洲伦| 日本免费新一区视频| 国产美女视频91| 欧美日韩一区二区三区免费看| 91精品婷婷国产综合久久竹菊| 欧美国产成人在线| 亚洲高清免费观看| yourporn久久国产精品| 欧美精品v日韩精品v韩国精品v| 国产精品欧美一级免费| 午夜在线成人av| 色综合一区二区| 精品电影一区二区| 视频在线在亚洲| 99视频精品免费视频| 精品国产乱码久久久久久闺蜜 | 一区二区三区**美女毛片| 久久精品国产亚洲a| av一二三不卡影片| 国产日产精品一区| 婷婷综合另类小说色区| 色一情一伦一子一伦一区| 制服丝袜亚洲色图| 亚洲最新在线观看| 调教+趴+乳夹+国产+精品| 91在线免费播放| 欧美精品一区二区在线播放| 亚洲精品国久久99热| 成人免费精品视频| 精品奇米国产一区二区三区| 日韩制服丝袜av| 欧美调教femdomvk| 亚洲香肠在线观看| 成人网页在线观看| 国产清纯在线一区二区www| 日本亚洲天堂网| 欧美日韩成人一区| 国产精品国产三级国产三级人妇| 国产伦精品一区二区三区视频青涩 | 欧美成人精品1314www| 日本亚洲电影天堂| 欧美视频一区在线观看| 亚洲天堂2014| 国产精品一区二区久久精品爱涩| 精品久久久久久最新网址| 亚洲电影中文字幕在线观看| 99re这里都是精品| 亚洲人亚洲人成电影网站色| 国产aⅴ综合色| 中日韩av电影| 高清国产午夜精品久久久久久| 欧美激情在线一区二区| 国产精品资源在线看| 久久婷婷综合激情| 国产剧情一区在线| 国产精品高潮呻吟| 国产酒店精品激情| 国产精品久久精品日日| 91热门视频在线观看| 成人欧美一区二区三区白人| 99精品视频免费在线观看| 国产精品美女久久久久久| 色综合中文字幕国产 | 91麻豆精品国产综合久久久久久 | 天天射综合影视| 欧美色精品在线视频| 日韩二区三区在线观看| 色8久久精品久久久久久蜜| 日韩国产一区二| 国产网站一区二区三区| 粉嫩aⅴ一区二区三区四区| 亚洲美女在线一区| 欧美日韩一区在线观看|