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

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

?? os_mbox.c

?? uC/OS-II在51上移植的完整源代碼V1.0
?? 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一区二区三区免费野_久草精品视频
色婷婷综合五月| 91久久精品日日躁夜夜躁欧美| 中文字幕中文字幕一区二区| 欧美日韩成人综合天天影院| 国产精品一二二区| 日本不卡一二三| 亚洲免费在线视频| 久久精品视频免费观看| 日韩欧美国产成人一区二区| 色哦色哦哦色天天综合| 成人午夜电影久久影院| 久久疯狂做爰流白浆xx| 午夜在线成人av| 亚洲男人天堂av| 国产精品激情偷乱一区二区∴| 精品成人免费观看| 日韩欧美的一区二区| 欧美日韩和欧美的一区二区| 99久久国产综合精品女不卡| 国产一区二区按摩在线观看| 老司机精品视频在线| 亚洲成人免费在线观看| 亚洲最新视频在线观看| 国产精品成人一区二区艾草| 国产性做久久久久久| 久久综合色一综合色88| 精品久久国产老人久久综合| 日韩欧美激情在线| 日韩色视频在线观看| 5566中文字幕一区二区电影| 欧美日韩视频不卡| 欧美性猛交一区二区三区精品| 色哟哟欧美精品| 91极品美女在线| 欧美午夜视频网站| 欧美日韩在线播放一区| 欧美久久婷婷综合色| 在线播放视频一区| 欧美大片一区二区| 欧美xxxxxxxx| 久久日韩粉嫩一区二区三区| 国产视频一区在线播放| 国产喷白浆一区二区三区| 国产婷婷色一区二区三区| 欧美激情综合五月色丁香| 中文字幕一区二区三区在线不卡| 国产精品乱码一区二三区小蝌蚪| 国产精品的网站| 亚洲丝袜美腿综合| 亚洲综合男人的天堂| 一区二区在线观看av| 亚洲午夜免费电影| 日精品一区二区| 美女脱光内衣内裤视频久久影院| 秋霞电影网一区二区| 国产精品一区免费在线观看| 国产精品一区二区久激情瑜伽| 成人av网址在线| 色偷偷88欧美精品久久久| 欧美精品久久一区| 久久综合av免费| 亚洲色图一区二区三区| 亚洲一区二区三区视频在线播放 | 欧美午夜理伦三级在线观看| 欧美性色综合网| 欧美成人精精品一区二区频| 国产欧美一区二区精品秋霞影院| 亚洲人成影院在线观看| 日本一道高清亚洲日美韩| 精品无码三级在线观看视频| 丁香桃色午夜亚洲一区二区三区| 91麻豆视频网站| 欧美一区二区免费观在线| 久久久久青草大香线综合精品| 综合精品久久久| 奇米精品一区二区三区四区| 成人理论电影网| 欧美精品久久久久久久久老牛影院| 久久九九久久九九| 一区二区三区日韩欧美| 久久成人免费网| 91麻豆国产自产在线观看| 欧美一区二区三区视频免费| 国产精品你懂的在线欣赏| 亚洲18色成人| 国产91高潮流白浆在线麻豆| 欧美日韩中文一区| 中文字幕av资源一区| 午夜欧美在线一二页| 成人美女在线观看| 欧美一级午夜免费电影| 亚洲人成在线播放网站岛国| 九九九精品视频| 欧美在线你懂得| 国产女同性恋一区二区| 日本欧美在线观看| 色94色欧美sute亚洲13| 国产亚洲欧美在线| 免费观看一级欧美片| 在线看国产一区二区| 国产免费观看久久| 久久精品国产网站| 欧美日本一区二区| 亚洲精品乱码久久久久久日本蜜臀| 国内欧美视频一区二区| 欧美肥妇bbw| 一区二区三区在线视频免费| 国产精品中文欧美| 精品黑人一区二区三区久久| 天天综合色天天| 欧美影院精品一区| 国产精品久久久久久久久免费丝袜 | 337p粉嫩大胆噜噜噜噜噜91av | 国产一区二区精品久久91| 欧美日韩高清不卡| 亚洲精品国产精华液| 成人h动漫精品一区二区| 久久精品视频一区二区| 韩国av一区二区三区四区| 日韩天堂在线观看| 日韩国产精品91| 欧美日韩精品三区| 亚洲国产一区二区在线播放| 91高清视频在线| 一区二区在线观看不卡| 日本精品视频一区二区| 自拍偷自拍亚洲精品播放| 成年人午夜久久久| 国产精品嫩草久久久久| 成人免费高清在线| 欧美—级在线免费片| 成人一区二区视频| 成人免费一区二区三区在线观看| 国产91精品欧美| 国产精品成人网| 色婷婷激情综合| 一区二区三区在线观看网站| 在线亚洲一区二区| 亚洲gay无套男同| 日韩一区二区不卡| 国产一级精品在线| 国产精品私人自拍| 一本到高清视频免费精品| 亚洲在线成人精品| 337p亚洲精品色噜噜| 精品一区二区三区影院在线午夜| 精品福利一区二区三区免费视频| 国产精品主播直播| 中文字幕亚洲一区二区va在线| 91浏览器入口在线观看| 亚洲无线码一区二区三区| 日韩欧美一区二区不卡| 国产精品自在在线| 最新不卡av在线| 欧美亚洲国产一卡| 美女视频黄 久久| 久久久精品影视| 91色|porny| 日产欧产美韩系列久久99| 久久婷婷色综合| 91国产成人在线| 另类调教123区| 亚洲婷婷在线视频| 91精品国产综合久久小美女 | 亚洲尤物视频在线| 国精产品一区一区三区mba视频| 精品国产一区二区三区av性色 | 欧美另类变人与禽xxxxx| 九九久久精品视频| 亚洲日本电影在线| 在线不卡a资源高清| 国产999精品久久| 亚洲成人动漫av| 国产日韩欧美综合一区| 欧美性感一区二区三区| 黄页视频在线91| 亚洲一区二区三区激情| 精品噜噜噜噜久久久久久久久试看| 不卡一区二区三区四区| 99久久国产综合色|国产精品| 亚洲成a人v欧美综合天堂下载| 精品国产亚洲在线| 欧美日韩一区二区欧美激情| 国产老妇另类xxxxx| 亚洲aⅴ怡春院| 成人欧美一区二区三区黑人麻豆| 91精品在线麻豆| 99re热这里只有精品视频| 美女诱惑一区二区| 亚洲一区二区三区在线看| 欧美经典一区二区| 日韩你懂的在线观看| 91久久香蕉国产日韩欧美9色| 国产在线乱码一区二区三区| 亚洲成a人v欧美综合天堂| 国产精品麻豆视频| 久久亚洲精华国产精华液| 欧美日韩国产中文| 色综合视频在线观看| 成人综合日日夜夜|