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

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

?? os_mbox.c

?? ucos在51單片機上的移植的源代碼以及測試代碼
?? 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.
*********************************************************************************************************
*/
#if OS_Mbox_Accept_EN
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)     */
}
#endif
/*$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
*********************************************************************************************************
*/
#if OS_Mbox_Create_EN
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              */
}
#endif
/*$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.
*********************************************************************************************************
*/
#if OS_Mbox_Pend_EN
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)    */
}
#endif
/*$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.
*********************************************************************************************************
*/
#if OS_Mbox_Post_EN
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);
        }
    }
}
#endif
/*$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
*
*              dataptr         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.
*********************************************************************************************************
*/
#if OS_Mbox_Query_EN
INT8U OSMboxQuery (OS_EVENT *pevent, OS_MBOX_DATA *dataptr)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);
    }
    dataptr->OSEventGrp = pevent->OSEventGrp;                /* Copy message mailbox wait list           */
    psrc              = &pevent->OSEventTbl[0];
    pdest             = &dataptr->OSEventTbl[0];
    for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
        *pdest++ = *psrc++;   
    }
    dataptr->OSMsg = pevent->OSEventPtr;                     /* Get message from mailbox                 */
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}
#endif
#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲狼人国产精品| 激情都市一区二区| 欧美变态凌虐bdsm| 精品久久久久久久久久久久久久久久久 | 国产一区二区在线观看视频| 欧美军同video69gay| 日韩国产在线一| 91精品国产免费| 久久不见久久见免费视频1| 精品国产免费久久| 国产a精品视频| 亚洲欧美一区二区三区极速播放| 欧美亚洲自拍偷拍| 日韩高清不卡在线| 久久精品视频在线免费观看| 成人激情免费电影网址| 中文字幕在线免费不卡| 欧美日韩一本到| 久久国产夜色精品鲁鲁99| 国产午夜亚洲精品羞羞网站| 欧美国产一区二区| 亚洲欧美激情在线| 国产毛片精品国产一区二区三区| 欧美激情自拍偷拍| 在线日韩一区二区| 极品瑜伽女神91| 亚洲欧洲日韩在线| 日韩欧美国产综合一区| 成人av动漫在线| 日韩国产精品大片| 日韩一区日韩二区| 日韩一区二区电影网| 成人福利视频在线看| 免费精品视频在线| 亚洲黄色小说网站| 精品福利在线导航| 欧美在线不卡一区| 国产成人99久久亚洲综合精品| 亚洲国产精品久久不卡毛片| 国产三级欧美三级日产三级99 | 亚洲成人午夜影院| 精品亚洲国产成人av制服丝袜| 日韩亚洲欧美成人一区| 成人app在线观看| 精品久久人人做人人爽| 日本欧美大码aⅴ在线播放| 日本黄色一区二区| 国产精品日产欧美久久久久| 国产精品主播直播| 精品99久久久久久| 久久精品72免费观看| 欧美日韩在线直播| 久久精品无码一区二区三区| 久久久久久久久蜜桃| 91亚洲精品乱码久久久久久蜜桃 | 日本欧美在线观看| 亚洲女人的天堂| 欧美精品色综合| 亚洲美女区一区| 91久久人澡人人添人人爽欧美| 国产精品人人做人人爽人人添| av动漫一区二区| 亚洲激情六月丁香| 欧美麻豆精品久久久久久| 日本大胆欧美人术艺术动态| 精品福利视频一区二区三区| 国产馆精品极品| 夜夜夜精品看看| 亚洲精品在线观看视频| 国产激情91久久精品导航 | 欧美色国产精品| 香港成人在线视频| 亚洲视频你懂的| 5858s免费视频成人| 日本道免费精品一区二区三区| 自拍偷拍欧美激情| 国产精品视频看| 欧美日韩国产精品成人| 国产欧美中文在线| 欧美三级电影一区| www.日韩精品| 粉嫩一区二区三区在线看| 色综合色狠狠综合色| 综合久久久久久| 久久免费国产精品| 久久综合久久鬼色中文字| 国产精品成人网| 亚洲国产精品av| 亚洲色图另类专区| 亚洲人一二三区| 亚洲电影欧美电影有声小说| 亚洲成人福利片| 日本sm残虐另类| 国产精品一区专区| 99久久夜色精品国产网站| 97精品电影院| 久久精品国产网站| 精品在线观看视频| 欧美aaa在线| 蜜臀av在线播放一区二区三区| 一区视频在线播放| 欧美蜜桃一区二区三区| 91视频.com| 盗摄精品av一区二区三区| 久久精品国产一区二区三区免费看 | 精品美女一区二区三区| 国产精品一区二区三区四区| 不卡影院免费观看| 在线观看日产精品| 日韩午夜中文字幕| 国产精品欧美一级免费| 一区二区在线观看不卡| 日韩成人一级大片| 成人性生交大片免费看中文网站| 日本大香伊一区二区三区| 欧美一区二区三区影视| 久久久精品免费观看| 亚洲综合久久久久| 国产一区二区三区免费看| 91美女片黄在线| 欧美电视剧在线观看完整版| 日韩一区日韩二区| 久久99在线观看| 日本韩国欧美三级| 精品国产自在久精品国产| 亚洲欧美一区二区三区国产精品| 日韩一区精品字幕| 99在线精品观看| 中文字幕欧美日韩一区| 亚洲一区中文在线| 国产成人精品免费在线| 黄色资源网久久资源365| 国产精品久久久久久久久快鸭| 亚洲午夜精品17c| 亚洲国产激情av| 久久er精品视频| 欧洲色大大久久| 久久久国产综合精品女国产盗摄| 洋洋成人永久网站入口| 成人动漫av在线| 久久久无码精品亚洲日韩按摩| 亚洲欧洲99久久| 国产女人18水真多18精品一级做| 午夜成人免费视频| 不卡一区二区在线| 久久久99久久| 另类人妖一区二区av| 日韩制服丝袜先锋影音| 国产美女精品人人做人人爽 | 成人性生交大合| 日韩亚洲欧美一区| 亚洲第一激情av| 一本色道久久综合亚洲精品按摩| 中文字幕一区av| 成人午夜伦理影院| 国产精品久久久久久久岛一牛影视 | 国产成人丝袜美腿| 国产午夜精品一区二区三区嫩草| 免费看黄色91| 久久精品网站免费观看| 99久久精品免费| 久久久美女艺术照精彩视频福利播放| 亚洲亚洲人成综合网络| 欧美日韩国产高清一区| 日本怡春院一区二区| 欧美一区日韩一区| 国产91在线|亚洲| 一区二区三区鲁丝不卡| 欧美电影在线免费观看| 久久国产精品99精品国产| 久久精品免费在线观看| 色国产精品一区在线观看| 国产一区二区福利视频| 亚洲国产成人自拍| 丁香一区二区三区| 亚洲精品国产精品乱码不99| 欧美日韩极品在线观看一区| 强制捆绑调教一区二区| 成人美女视频在线观看| 在线观看免费成人| 一本大道久久a久久精品综合| 欧美一级久久久久久久大片| 七七婷婷婷婷精品国产| 欧美福利视频一区| 亚洲成av人片一区二区三区| 欧美高清dvd| 日本不卡一二三区黄网| 欧美美女直播网站| 久草中文综合在线| 欧美va亚洲va| 国产原创一区二区| 专区另类欧美日韩| 91免费看视频| 一二三四社区欧美黄| 欧美性猛交xxxx乱大交退制版| 一区二区三区精品视频| 欧美日韩一区精品| 丝袜美腿一区二区三区| 亚洲精品一区二区精华| 国产精品66部|