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

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

?? os_mbox.c

?? ucos系統
?? 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) 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)     */
}
/*$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) 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              */
}
/*$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) 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)    */
}
/*$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) 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);
        }
    }
}
/*$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 *ppdata) 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);
    }
    ppdata->OSEventGrp = pevent->OSEventGrp;                /* Copy message mailbox wait list           */
    psrc              = &pevent->OSEventTbl[0];
    pdest             = &ppdata->OSEventTbl[0];
    for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
        *pdest++ = *psrc++;   
    }
    ppdata->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一区二区三区免费野_久草精品视频
日本va欧美va精品发布| 色婷婷亚洲一区二区三区| 1024成人网色www| 国产精品国产三级国产aⅴ原创| 日韩精品专区在线影院重磅| 欧美变态tickle挠乳网站| 久久综合国产精品| 国产拍欧美日韩视频二区| 国产精品午夜在线| 亚洲日本va午夜在线影院| 一级中文字幕一区二区| 亚洲综合一区在线| 免费人成黄页网站在线一区二区| 久久不见久久见免费视频1 | 91亚洲大成网污www| 不卡高清视频专区| 一本一道久久a久久精品综合蜜臀| 日本高清免费不卡视频| 欧美精品高清视频| 久久香蕉国产线看观看99| 国产精品青草综合久久久久99| 亚洲欧美日韩综合aⅴ视频| 丝袜美腿亚洲色图| 国产一区免费电影| 一本到高清视频免费精品| 91精品国产综合久久婷婷香蕉 | 欧美丰满美乳xxx高潮www| 欧美性大战久久久| 欧美日本精品一区二区三区| 精品国产乱码久久久久久闺蜜 | 日韩手机在线导航| 国产亚洲成aⅴ人片在线观看| 一区在线观看视频| 美腿丝袜亚洲三区| 99视频有精品| 日韩免费高清av| 中文字幕中文字幕中文字幕亚洲无线| 亚洲福利国产精品| 成人一级黄色片| 欧美一区二区三区白人| 综合久久给合久久狠狠狠97色| 丝袜国产日韩另类美女| 成a人片国产精品| 日韩欧美国产1| 17c精品麻豆一区二区免费| 久久黄色级2电影| 欧美伊人精品成人久久综合97| 久久久久久99久久久精品网站| 亚洲免费观看视频| 国产成人综合网| 日韩精品在线一区| 午夜婷婷国产麻豆精品| 99精品久久只有精品| 久久亚洲综合色一区二区三区| 亚洲成a人v欧美综合天堂下载| 成人免费毛片嘿嘿连载视频| 精品日产卡一卡二卡麻豆| 亚洲成人免费在线| 91行情网站电视在线观看高清版| 久久精品视频一区| 黑人精品欧美一区二区蜜桃| 欧美肥大bbwbbw高潮| 亚洲成av人片在线| 欧美三级三级三级爽爽爽| 亚洲三级电影全部在线观看高清| 粉嫩在线一区二区三区视频| 精品播放一区二区| 久久精品国产精品青草| 日韩视频一区二区| 加勒比av一区二区| 欧美一区二区性放荡片| 亚洲成人7777| 欧美一级二级三级蜜桃| 美女看a上一区| 欧美大片免费久久精品三p| 久久精品国产免费| 久久久久久久久久电影| 不卡av在线免费观看| 亚洲视频在线观看三级| 972aa.com艺术欧美| 亚洲免费观看视频| 欧美日韩一区三区| 免费高清在线视频一区·| 久久人人97超碰com| 色国产精品一区在线观看| 久久精品一区二区三区不卡牛牛 | 国产91丝袜在线观看| 久久综合久久99| www.亚洲免费av| 亚洲精品成a人| 欧美群妇大交群中文字幕| 免费亚洲电影在线| 久久久精品黄色| 91浏览器入口在线观看| 性久久久久久久| 久久综合九色综合97婷婷女人| 国产一级精品在线| 亚洲色图丝袜美腿| 日韩一区二区不卡| 成人激情午夜影院| 亚洲va国产天堂va久久en| www日韩大片| 色婷婷香蕉在线一区二区| 日本欧美在线观看| 中文字幕一区在线观看视频| 精品视频免费在线| 国产一区二区网址| 亚洲电影中文字幕在线观看| 久久综合给合久久狠狠狠97色69| 91免费国产在线| 美女被吸乳得到大胸91| 亚洲情趣在线观看| 久久综合色8888| 欧美日韩三级视频| 成人一级片在线观看| 看片的网站亚洲| 亚洲成人av福利| 中文字幕五月欧美| 亚洲国产中文字幕| 激情文学综合丁香| 欧美一区二区精品久久911| 欧美电视剧免费观看| 国产精品久久久久久一区二区三区| 国产一区日韩二区欧美三区| 风间由美一区二区三区在线观看 | av在线不卡免费看| 亚洲一区二区三区美女| 久久欧美一区二区| 欧美一卡二卡在线| 91久久精品一区二区三| 国产高清久久久久| 久久精品二区亚洲w码| 亚洲v中文字幕| 亚洲伊人色欲综合网| 国产精品丝袜一区| 久久久久久久久久久电影| 欧美一级国产精品| 欧美精品vⅰdeose4hd| 欧美性色黄大片| 91免费看`日韩一区二区| 99免费精品在线观看| 高潮精品一区videoshd| 国产真实乱子伦精品视频| 蜜臀久久99精品久久久久久9| 亚洲一区二区免费视频| 亚洲午夜羞羞片| 亚洲国产日韩a在线播放性色| 亚洲欧美日韩国产手机在线| 亚洲婷婷综合色高清在线| 国产精品黄色在线观看| 1024国产精品| 国精产品一区一区三区mba视频| 亚洲柠檬福利资源导航| 欧美精品一区二区三区蜜桃视频| 99天天综合性| 欧美曰成人黄网| 91国偷自产一区二区三区成为亚洲经典 | 久久久电影一区二区三区| 色婷婷久久久综合中文字幕| 国产成+人+日韩+欧美+亚洲| 日韩欧美中文字幕制服| 91老师国产黑色丝袜在线| 成人一区二区三区视频 | 樱桃视频在线观看一区| 日韩制服丝袜av| 国产色产综合色产在线视频| 一区二区高清在线| 国产一区二区三区不卡在线观看| 亚洲一区二区三区爽爽爽爽爽| 午夜欧美视频在线观看| 成人在线综合网| 国产精品久久综合| 国产精品美女久久久久久久网站| 国产精品视频看| 亚洲天堂成人在线观看| 麻豆精品在线看| 99久久夜色精品国产网站| 美女在线观看视频一区二区| 亚洲国产综合在线| 丝瓜av网站精品一区二区 | 亚洲成av人片在线| 一区二区三区在线观看欧美| 国产成人一级电影| 成人av中文字幕| 欧美日韩激情一区二区| 亚洲国产精品久久人人爱蜜臀| 国产69精品一区二区亚洲孕妇| 国产成人午夜精品影院观看视频| 2021国产精品久久精品| 久久av中文字幕片| 久久精品一区二区三区av| 裸体歌舞表演一区二区| 欧美一区二区性放荡片| 日韩av午夜在线观看| 一本久久a久久免费精品不卡| 欧美高清在线视频| 成人精品视频一区二区三区 | 蜜臀久久久99精品久久久久久| 成人av资源在线| 国产欧美一二三区|