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

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

?? os_mbox.c

?? ucos2.52多處理器平臺移植源代碼
?? 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一区二区三区免费野_久草精品视频
丁香亚洲综合激情啪啪综合| 欧美狂野另类xxxxoooo| 日韩一区二区影院| 国产精品久99| 成人a级免费电影| 日韩精品一区二区三区视频播放 | 久久国产日韩欧美精品| 欧美丝袜第三区| 亚洲高清三级视频| 日韩精品在线网站| 国内精品伊人久久久久av影院| 精品久久久久久久久久久久久久久 | 中文乱码免费一区二区| 成人免费视频app| 天天综合天天综合色| 日韩免费观看高清完整版 | 亚洲免费在线电影| 欧美色综合网站| 国产黑丝在线一区二区三区| 亚洲免费观看高清完整版在线观看 | 日韩欧美亚洲国产精品字幕久久久 | 国产老肥熟一区二区三区| 国产精品国产三级国产三级人妇| 在线视频国内自拍亚洲视频| 国内外成人在线视频| 亚洲国产视频直播| 国产精品三级视频| 欧美综合视频在线观看| 理论电影国产精品| 亚洲综合成人在线| 国产精品网站在线| 欧美一区三区二区| 色偷偷88欧美精品久久久| 毛片av一区二区| 午夜视频在线观看一区二区三区| 国产三级久久久| 日韩欧美一区在线观看| 色噜噜狠狠色综合中国| 成人avav影音| www.爱久久.com| 国产麻豆日韩欧美久久| 老司机精品视频一区二区三区| 亚洲小说春色综合另类电影| 亚洲欧美精品午睡沙发| 亚洲精品视频自拍| 中文字幕日韩av资源站| 国产精品美女久久久久av爽李琼 | 99精品久久99久久久久| 国产美女av一区二区三区| 激情文学综合网| 国产一区二区不卡| 国产乱一区二区| 免费看欧美女人艹b| 日本91福利区| 国产不卡视频一区二区三区| 国产精品99久久久久久有的能看| 国产精品18久久久久久久久| 韩国欧美国产一区| 高清视频一区二区| 91玉足脚交白嫩脚丫在线播放| 欧洲av一区二区嗯嗯嗯啊| 67194成人在线观看| 久久免费电影网| 亚洲精品成人悠悠色影视| 亚洲成人自拍一区| 国产乱子轮精品视频| 99热99精品| 欧美一区二区大片| 国产日韩v精品一区二区| 亚洲色图另类专区| 久久国产乱子精品免费女| 99精品欧美一区| 久久蜜桃av一区精品变态类天堂| 亚洲乱码精品一二三四区日韩在线| 亚洲一区二区三区四区在线免费观看 | 欧美色手机在线观看| 久久综合狠狠综合| 日本欧美一区二区| 欧美影院精品一区| 国产欧美视频一区二区| 美女一区二区久久| 欧洲色大大久久| 综合久久国产九一剧情麻豆| 国产馆精品极品| 国产亚洲人成网站| 老司机一区二区| 日韩亚洲欧美一区二区三区| 亚洲午夜视频在线观看| 99久久综合国产精品| 国产精品久久午夜夜伦鲁鲁| 九九视频精品免费| 精品国产亚洲在线| 国产美女精品在线| 日本一区二区三级电影在线观看| 久久狠狠亚洲综合| 亚洲精品一区二区三区99| 狠狠色丁香婷婷综合久久片| 日韩精品一区二区三区在线播放| 五月综合激情日本mⅴ| 欧美综合久久久| 91偷拍与自偷拍精品| 国产精品女同互慰在线看| 成人免费三级在线| 亚洲免费观看高清完整版在线| 91伊人久久大香线蕉| 亚洲电影一区二区三区| 日韩视频永久免费| 国产精品一区免费在线观看| 亚洲欧洲精品一区二区精品久久久| 色综合色狠狠天天综合色| 亚洲一区二区在线免费观看视频 | 久久综合九色综合97_久久久| 国产精品一区二区果冻传媒| 国产精品美日韩| 欧美一二区视频| av电影在线观看完整版一区二区| 亚洲不卡在线观看| 2020国产精品| 亚洲精品成人精品456| 色素色在线综合| 国产91精品精华液一区二区三区| 蜜桃av噜噜一区| 天天操天天色综合| 日本美女一区二区| 久久久影视传媒| 91麻豆精品国产91久久久久| 国产99一区视频免费| 五月婷婷综合网| 一区二区三区日韩精品| 久久综合久色欧美综合狠狠| 欧美性极品少妇| 91蝌蚪porny| 成人app下载| 精品无人区卡一卡二卡三乱码免费卡| 成人免费在线视频| 久久久久久综合| 日韩欧美视频在线| 91精品国产综合久久蜜臀| 99久久99久久综合| 在线日韩国产精品| 欧美肥胖老妇做爰| 日韩亚洲欧美在线| 欧美韩国一区二区| 国产精品久久一级| 亚洲欧洲成人自拍| 亚洲色图一区二区| 亚洲一级不卡视频| 日韩一区欧美二区| 狠狠色狠狠色综合日日91app| 色香蕉成人二区免费| 在线一区二区三区四区| 91精品国产全国免费观看| 日韩欧美国产一二三区| 亚洲国产成人私人影院tom | 精品污污网站免费看| 日韩欧美自拍偷拍| 中文字幕亚洲一区二区av在线| 午夜精品福利一区二区三区av| 国模套图日韩精品一区二区| 日本精品一级二级| 国产精品一级黄| 精品影视av免费| 色8久久精品久久久久久蜜| 久久久亚洲精品石原莉奈| 中文字幕亚洲视频| 美女视频黄 久久| 成人av在线网| 精品久久人人做人人爽| 国产精品嫩草久久久久| 亚洲自拍都市欧美小说| 国产精品不卡在线观看| 中文字幕av一区二区三区高| 亚洲综合免费观看高清完整版在线 | 亚洲男人天堂av| 国产一区久久久| 91香蕉国产在线观看软件| 欧洲国内综合视频| 亚洲另类中文字| 亚洲午夜激情网页| 亚洲第一狼人社区| 成人丝袜18视频在线观看| 96av麻豆蜜桃一区二区| 欧洲av在线精品| 久久婷婷综合激情| 综合av第一页| 美女网站一区二区| 在线观看日韩电影| 亚洲视频在线一区观看| 激情综合色综合久久综合| 不卡视频在线观看| 国产人成亚洲第一网站在线播放 | 国产精品女上位| 久久久久国产精品麻豆ai换脸| 91免费在线播放| 久久er精品视频| 一区二区三区四区在线免费观看| 精品日韩99亚洲| 欧美性色综合网| 白白色亚洲国产精品| 麻豆国产精品777777在线|