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

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

?? os_mbox.c

?? uCOS-II源碼公開的實時嵌入式操作系統.rar
?? 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲乱码中文字幕| av中文一区二区三区| 欧美tickling挠脚心丨vk| 亚洲自拍与偷拍| 欧美群妇大交群中文字幕| 日韩国产在线一| 精品国产91乱码一区二区三区 | 在线视频一区二区三区| 亚洲欧美国产三级| 日韩精品一区二区三区蜜臀| 日韩精彩视频在线观看| 99re亚洲国产精品| 亚洲国产精品久久人人爱蜜臀| 欧美剧情电影在线观看完整版免费励志电影| 亚洲高清久久久| 国产精品久久看| 日韩精品一区二区三区swag| 99国产精品99久久久久久| 一区二区三区欧美| 欧美mv日韩mv| 日韩限制级电影在线观看| 色av一区二区| 色成人在线视频| 91麻豆.com| 夜夜嗨av一区二区三区四季av| 欧美一三区三区四区免费在线看| 国产在线看一区| 日本一区二区久久| 欧美一级高清片在线观看| 成人av电影在线播放| 麻豆91在线播放免费| 亚洲精品亚洲人成人网在线播放| 日韩欧美国产wwwww| 国产99久久久精品| 国产一区二区中文字幕| 日韩不卡一区二区| 亚洲综合小说图片| 一区二区三区四区在线播放| 国产亚洲福利社区一区| 日韩精品一区二区三区蜜臀| 91久久精品网| 91欧美激情一区二区三区成人| 中文字幕制服丝袜一区二区三区| 精品播放一区二区| 精品国内二区三区| 日韩一区二区影院| 777亚洲妇女| 欧美三级日韩在线| av爱爱亚洲一区| 色婷婷综合激情| 6080yy午夜一二三区久久| 欧美在线制服丝袜| 欧美丰满嫩嫩电影| 欧美色综合久久| 91精品国产麻豆国产自产在线| 色狠狠桃花综合| 欧美伊人久久久久久午夜久久久久| 欧美视频在线一区| 日韩一区二区在线观看视频 | 色综合亚洲欧洲| 欧美日本国产视频| 国产午夜精品美女毛片视频| 亚洲欧洲日本在线| 亚洲欧洲精品一区二区精品久久久| 亚洲丝袜另类动漫二区| 天天免费综合色| 成人av动漫网站| 久久99精品一区二区三区 | 国产精品久久久久久久久快鸭| 亚洲欧美日韩中文字幕一区二区三区| 亚洲精品日韩专区silk | 亚洲无人区一区| 成人午夜电影网站| 欧美一级免费大片| 洋洋成人永久网站入口| 国产经典欧美精品| 欧美视频日韩视频| 中文字幕日韩欧美一区二区三区| 玖玖九九国产精品| 8v天堂国产在线一区二区| 综合激情网...| 国产伦理精品不卡| 99久久精品久久久久久清纯| jlzzjlzz亚洲日本少妇| 久久精品亚洲精品国产欧美kt∨| 亚洲成av人片一区二区三区| 一本一本大道香蕉久在线精品 | 欧美片网站yy| 亚洲国产aⅴ天堂久久| 欧美美女直播网站| 亚洲欧美一区二区三区国产精品| 不卡av在线免费观看| 欧美极品美女视频| 91成人在线精品| 亚洲va天堂va国产va久| 欧美成人r级一区二区三区| 九九久久精品视频| ...中文天堂在线一区| 91久久精品国产91性色tv| 亚洲成人自拍一区| 欧美日韩国产高清一区二区 | 久久综合色8888| 99久久er热在这里只有精品15| 亚洲人xxxx| 欧美sm美女调教| 欧美午夜片在线看| 亚洲成a人v欧美综合天堂| 在线不卡一区二区| 不卡av在线免费观看| 久久99久久久欧美国产| 亚洲欧美日韩系列| 久久久综合视频| 欧美日韩国产美女| 色域天天综合网| 国产suv精品一区二区883| 日韩极品在线观看| 亚洲美女少妇撒尿| 欧美tickling挠脚心丨vk| 欧美日韩国产精品成人| 亚洲午夜久久久久中文字幕久| 69p69国产精品| 精品视频一区二区三区免费| 国产乱子轮精品视频| 亚洲综合免费观看高清在线观看| 久久久久国产精品厨房| 久久在线观看免费| 久久蜜桃av一区二区天堂| 欧美刺激脚交jootjob| 日韩亚洲电影在线| 精品国产一区二区在线观看| 色网综合在线观看| 97久久精品人人做人人爽 | 久久国产综合精品| 久久99国产乱子伦精品免费| 成人免费视频一区二区| 欧洲精品视频在线观看| 久久日一线二线三线suv| 中文字幕一区在线观看| 久久国产成人午夜av影院| caoporm超碰国产精品| 4438x成人网最大色成网站| 久久久久久99久久久精品网站| 亚洲国产日韩在线一区模特| 国产乱子轮精品视频| 欧美裸体一区二区三区| 亚洲精品乱码久久久久久久久| 国内成+人亚洲+欧美+综合在线| 99精品久久99久久久久| 国产三级三级三级精品8ⅰ区| 亚洲高清中文字幕| 一本色道久久综合亚洲精品按摩 | 欧美变态tickling挠脚心| 亚洲精品日产精品乱码不卡| 国产91精品精华液一区二区三区 | 国产精品亚洲午夜一区二区三区 | 老司机免费视频一区二区三区| 亚洲品质自拍视频| 综合久久国产九一剧情麻豆| 国产精品一品二品| 久久精品夜色噜噜亚洲a∨| 日本成人超碰在线观看| 日韩精品专区在线| 国产精品亚洲一区二区三区妖精 | 国产午夜亚洲精品午夜鲁丝片| 性欧美大战久久久久久久久| 欧洲另类一二三四区| 日韩av电影免费观看高清完整版 | 制服丝袜亚洲播放| 国产一区三区三区| 国产精品久久久久久一区二区三区 | 日本不卡一区二区三区高清视频| 7777精品伊人久久久大香线蕉 | 岛国精品在线观看| 亚洲精品视频在线看| 91麻豆精品国产自产在线观看一区 | 国产精品久久久久毛片软件| 成a人片国产精品| 日本视频在线一区| 欧美经典一区二区三区| 在线观看免费成人| 国产精品综合二区| 日韩和的一区二区| 一区二区三区四区乱视频| 精品国精品自拍自在线| 欧美日韩一级大片网址| 成人v精品蜜桃久久一区| 麻豆成人免费电影| 亚洲国产欧美在线| 亚洲女人小视频在线观看| 精品国产区一区| 91色在线porny| 国产成人高清在线| 韩国女主播成人在线| 视频在线观看国产精品| 亚洲成人一区二区| 亚洲国产成人av| 亚洲午夜电影在线| 亚洲综合丝袜美腿| 亚洲自拍与偷拍| 亚洲一区电影777|