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

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

?? os_mbox.c

?? 移植ucos-II到mcs-51
?? C
字號(hào):
/*
*********************************************************************************************************
*                                                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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜视频久久久久久| 欧美在线free| 国产女主播在线一区二区| 狠狠色狠狠色综合| 久久久久久久久久电影| a在线播放不卡| 亚洲免费观看高清完整版在线 | 成人视屏免费看| 中文字幕一区二区在线观看| 成人性生交大片免费看视频在线| 国产精品短视频| 欧美色图天堂网| 美女精品自拍一二三四| 26uuu国产一区二区三区| 成人av影视在线观看| 一区二区三区在线观看网站| 欧美日韩在线观看一区二区 | 久久成人麻豆午夜电影| 久久综合九色欧美综合狠狠| www.日韩大片| 五月激情综合婷婷| 国产午夜精品福利| 色婷婷综合久色| 日韩av一区二区三区四区| 精品成人佐山爱一区二区| 99久精品国产| 精品在线免费观看| 亚洲精品乱码久久久久| 日韩免费成人网| www..com久久爱| 男女男精品视频| 最近中文字幕一区二区三区| 7777女厕盗摄久久久| 国产精品18久久久久久久久久久久| 国产精品国模大尺度视频| 欧美一区二区三区人| 成人福利视频在线看| 日韩高清国产一区在线| 日韩毛片高清在线播放| 欧美不卡一二三| 欧美日韩精品一区二区三区| 毛片基地黄久久久久久天堂| 亚洲理论在线观看| 久久久久国产精品厨房| 欧美三级中文字幕| 成人妖精视频yjsp地址| 国内外成人在线| 五月综合激情日本mⅴ| 中文字幕一区二区不卡| 精品国产乱码久久久久久牛牛| 91激情五月电影| 成人蜜臀av电影| 久久精品国产久精国产爱| 夜夜嗨av一区二区三区中文字幕 | 日本在线观看不卡视频| 亚洲免费观看高清完整版在线观看熊 | 久久精品久久综合| 亚洲一卡二卡三卡四卡无卡久久 | 国产成人综合自拍| 视频一区中文字幕国产| 亚洲视频资源在线| 国产精品萝li| 国产欧美视频一区二区| 精品国一区二区三区| 69久久99精品久久久久婷婷| 欧美天堂一区二区三区| 色呦呦国产精品| 色综合久久久久久久久久久| 99久久婷婷国产精品综合| 国产剧情av麻豆香蕉精品| 国产乱码精品一区二区三区五月婷| 日韩av中文字幕一区二区| 视频一区二区三区在线| 亚洲第一成人在线| 亚洲福利视频导航| 日韩国产欧美在线播放| 日韩成人dvd| 免费观看久久久4p| 人人精品人人爱| 日韩av中文字幕一区二区| 日韩中文字幕区一区有砖一区 | 日韩亚洲欧美一区| 精品久久久久久亚洲综合网 | 国产三级三级三级精品8ⅰ区| 久久综合久久综合九色| 欧美精品一区二区三| 国产欧美1区2区3区| 国产精品久久久久一区| 亚洲视频一区在线观看| 奇米精品一区二区三区在线观看一| 亚洲高清视频的网址| 视频在线观看一区| 极品少妇一区二区| 成人污污视频在线观看| 色激情天天射综合网| 欧美精品日韩一本| 91麻豆精品国产| 精品99久久久久久| 国产精品女同一区二区三区| 亚洲精品综合在线| 日本伊人色综合网| 国产很黄免费观看久久| 一本久道中文字幕精品亚洲嫩| 欧美在线不卡一区| 精品国产伦理网| √…a在线天堂一区| 亚洲图片欧美视频| 狠狠色伊人亚洲综合成人| 成人va在线观看| 欧美人牲a欧美精品| 26uuu精品一区二区三区四区在线| 国产农村妇女毛片精品久久麻豆 | 99国产一区二区三精品乱码| 色综合久久综合| 欧美成人一区二区三区| 欧美国产一区二区| 亚洲成人资源在线| 国产成人在线观看免费网站| 色婷婷国产精品综合在线观看| 7777女厕盗摄久久久| 中国色在线观看另类| 偷拍自拍另类欧美| 丁香桃色午夜亚洲一区二区三区| 精品视频一区三区九区| 久久久久国产精品麻豆| 亚洲va韩国va欧美va| 岛国精品在线播放| 欧美一区二区三级| 亚洲欧美日韩在线| 国精产品一区一区三区mba桃花 | 欧美日韩一卡二卡三卡 | 91老师片黄在线观看| 欧美疯狂性受xxxxx喷水图片| 国产精品免费av| 毛片av一区二区三区| 一本色道综合亚洲| 久久精品一区蜜桃臀影院| 午夜精品久久久久久久99水蜜桃| 成人禁用看黄a在线| 日韩免费高清av| 亚洲gay无套男同| 91无套直看片红桃| 久久久噜噜噜久噜久久综合| 日韩制服丝袜av| 欧美日韩一区二区在线观看视频| 国产精品久久久久影视| 国产高清精品网站| 日韩欧美一级片| 三级久久三级久久久| 欧美亚洲高清一区二区三区不卡| 国产精品国产自产拍高清av | av电影在线观看不卡| www激情久久| 裸体歌舞表演一区二区| 欧美日韩国产首页| 夜夜夜精品看看| 日韩精品专区在线| 亚洲综合在线观看视频| 99久久久久久| 1024国产精品| 99精品视频一区| 中文字幕在线免费不卡| 99久久er热在这里只有精品15| 国产欧美日韩视频在线观看| 国产乱人伦偷精品视频不卡| 精品国产自在久精品国产| 久久99久久99精品免视看婷婷| 欧美一级生活片| 免费看精品久久片| 91精品国产91久久综合桃花| 视频一区二区中文字幕| 91精品久久久久久久99蜜桃| 首页国产欧美日韩丝袜| 日韩午夜精品视频| 韩国精品久久久| 久久精品日产第一区二区三区高清版| 精品一二线国产| 国产亚洲精久久久久久| 国产成人免费视频一区| 亚洲欧洲日产国产综合网| 色婷婷狠狠综合| 五月婷婷综合激情| 欧美一级黄色片| 国产精品一区二区不卡| 中文文精品字幕一区二区| 波多野结衣的一区二区三区| 一区二区三区在线视频观看58| 在线视频国内自拍亚洲视频| 日韩一区精品视频| 久久综合九色综合97婷婷| 成人精品小蝌蚪| 亚洲成人免费在线| 久久亚洲捆绑美女| gogo大胆日本视频一区| 亚洲午夜av在线| 精品999久久久| 91美女福利视频| 日韩高清电影一区| 国产女人18水真多18精品一级做| 色哟哟国产精品免费观看|