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

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

?? os_mbox.c

?? uc/osII基于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.
*********************************************************************************************************
*/

void DT_XDATA *OSMboxAccept (OS_EVENT DT_XDATA * pevent) REENTRANT
{
    void DT_XDATA * msg;


    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {      /* Validate event block type                 */
        OS_EXIT_CRITICAL();
        return ((void DT_XDATA *)0);
    }
    msg = pevent->OSEventPtr; 
    if (msg != (void DT_XDATA *)0) {                               /* See if there is already a message         */
        pevent->OSEventPtr = (void DT_XDATA *)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 DT_XDATA *OSMboxCreate (void DT_XDATA * msg) REENTRANT
{
    OS_EVENT DT_XDATA *pevent;


    OS_ENTER_CRITICAL();
    pevent = OSEventFreeList;                    /* Get next free event control block                  */
    if (OSEventFreeList != (OS_EVENT DT_XDATA *)0) {      /* See if pool of free ECB pool was empty             */
        OSEventFreeList = (OS_EVENT DT_XDATA *)OSEventFreeList->OSEventPtr;
    }
    OS_EXIT_CRITICAL();
    if (pevent != (OS_EVENT DT_XDATA *)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 DT_XDATA *OSMboxPend (OS_EVENT DT_XDATA *pevent, INT16U timeout, INT8U DT_XDATA *err) REENTRANT
{
    void DT_XDATA *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 DT_XDATA *)0);
    }
    msg = pevent->OSEventPtr;
    if (msg != (void DT_XDATA *)0) {                           /* See if there is already a message             */
        pevent->OSEventPtr = (void DT_XDATA *)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 DT_XDATA *)0) {     /* See if we were given the message         */
            OSTCBCur->OSTCBMsg      = (void DT_XDATA *)0;           /* Yes, clear message received              */
            OSTCBCur->OSTCBStat     = OS_STAT_RDY;
            OSTCBCur->OSTCBEventPtr = (OS_EVENT DT_XDATA *)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 DT_XDATA *)0;           /* Set message contents to NULL             */
            *err                    = OS_TIMEOUT;          /* Indicate that a timeout occured          */
        } else {
            msg                     = pevent->OSEventPtr;  /* Message received                         */
            pevent->OSEventPtr      = (void DT_XDATA *)0;           /* Clear the mailbox                        */
            OSTCBCur->OSTCBEventPtr = (OS_EVENT DT_XDATA *)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 DT_XDATA *pevent, void DT_XDATA *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 DT_XDATA *)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
*
*              ppdata         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 DT_XDATA *pevent, OS_MBOX_DATA DT_XDATA *ppdata) REENTRANT
{
    INT8U  i;
    INT8U DT_XDATA *psrc;
    INT8U DT_XDATA *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一区二区三区免费野_久草精品视频
97久久超碰国产精品| 久久综合999| 欧美一区二区三区播放老司机| 欧美精品一区在线观看| 亚洲色图欧洲色图婷婷| 麻豆视频观看网址久久| 99re成人在线| 久久蜜臀精品av| 丝袜亚洲另类欧美| 97精品国产97久久久久久久久久久久| 3d成人动漫网站| 一区二区在线观看免费| 国产sm精品调教视频网站| 欧美一区二区视频免费观看| 一区二区日韩av| 99精品视频在线观看免费| 国产成人aaaa| 亚洲九九爱视频| 日韩一级片在线观看| 国产高清不卡一区| 亚洲精品欧美二区三区中文字幕| 欧美日韩精品福利| 成人免费三级在线| 日本成人中文字幕在线视频| 国产日本亚洲高清| 日韩视频一区二区在线观看| 在线观看免费亚洲| 国产成人精品一区二区三区四区| 五月激情六月综合| 亚洲欧美日韩电影| 欧美高清在线一区| 亚洲男同1069视频| 国产精一品亚洲二区在线视频| 日本久久一区二区三区| 玉足女爽爽91| 国产女人aaa级久久久级| 亚洲不卡在线观看| 精品国产一区二区精华| 欧美国产日本韩| 久久99国产精品久久99果冻传媒| 在线观看91av| 高清shemale亚洲人妖| 2024国产精品视频| 国产一区二区伦理| 国产欧美日韩在线| 粉嫩13p一区二区三区| 国产精品久久三区| 亚洲日本丝袜连裤袜办公室| 成人欧美一区二区三区1314| 精品99999| 亚洲欧美aⅴ...| 久久福利资源站| 亚洲影视在线观看| 麻豆精品在线播放| 欧美性xxxxxx少妇| 午夜国产不卡在线观看视频| 91精品麻豆日日躁夜夜躁| 欧美久久久久中文字幕| 奇米影视7777精品一区二区| 欧美一级免费观看| 国产精品一区二区无线| 亚洲素人一区二区| 日本电影欧美片| 日本亚洲欧美天堂免费| 久久久久久99久久久精品网站| 欧美日韩小视频| 久久综合久久综合亚洲| 国产一区二区三区观看| 亚洲精品欧美二区三区中文字幕| 欧美精品日韩综合在线| 国产美女一区二区三区| 亚洲综合无码一区二区| 日韩一区二区三区视频在线 | 久久麻豆一区二区| 国产剧情在线观看一区二区 | 奇米影视一区二区三区小说| 久久久www成人免费毛片麻豆| 91久久香蕉国产日韩欧美9色| 欧美aa在线视频| 亚洲老妇xxxxxx| 久久精品免视看| 欧美精品免费视频| 色综合久久综合中文综合网| 日韩中文欧美在线| 一区二区国产视频| 中文字幕五月欧美| 国产日产欧美精品一区二区三区| 精品视频1区2区3区| 91蝌蚪porny| 欧美无砖专区一中文字| 久久精品国产色蜜蜜麻豆| 天天操天天干天天综合网| 亚洲激情在线激情| 亚洲精品欧美激情| 亚洲一二三四久久| 亚洲激情在线激情| 一级精品视频在线观看宜春院| 最新欧美精品一区二区三区| 中文字幕亚洲在| 亚洲人成网站色在线观看| 国产精品乱码一区二区三区软件| 国产无一区二区| 欧美成人三级电影在线| 国产一区二区精品久久| 国产精品乱人伦一区二区| 色婷婷一区二区三区四区| 国产精品传媒在线| 欧美一区二区三区系列电影| 欧美日韩一区高清| 亚洲午夜视频在线观看| 色狠狠桃花综合| 成人性色生活片| 国产一区二区免费视频| 日本va欧美va精品发布| 亚洲人xxxx| 中文字幕一区三区| 欧美激情一二三区| 奇米影视7777精品一区二区| caoporen国产精品视频| 美女网站色91| 美日韩一区二区三区| 日本视频一区二区| 日本怡春院一区二区| 日韩—二三区免费观看av| 日韩欧美国产一区在线观看| 成人av片在线观看| 国产麻豆视频精品| 日本视频一区二区三区| 性欧美大战久久久久久久久| 日韩激情在线观看| 91精品国产91久久综合桃花| 午夜成人免费电影| 日韩一区二区免费在线电影| 欧美一区二区在线不卡| 欧美成人一区二区三区| 国产精品嫩草影院com| 日韩亚洲欧美中文三级| 8x8x8国产精品| 欧美成人高清电影在线| 欧美一区二区免费视频| 在线不卡免费欧美| 欧美日韩电影一区| 欧美成人精品1314www| 日韩一区二区电影| 日韩精品专区在线影院观看| 91麻豆精品国产91久久久资源速度| 在线免费亚洲电影| 欧美人伦禁忌dvd放荡欲情| 91日韩精品一区| 亚洲三级在线观看| 93久久精品日日躁夜夜躁欧美| 亚洲国产综合91精品麻豆| 国产精品青草综合久久久久99| 中文字幕一区不卡| 午夜精品爽啪视频| 久久免费国产精品| 欧美一区二区三区不卡| 91蝌蚪porny九色| 国产精品一卡二卡| 欧洲人成人精品| 精品国偷自产国产一区| 亚洲色图制服诱惑| 蜜桃免费网站一区二区三区| 成人性生交大合| 91麻豆精品国产无毒不卡在线观看 | 欧洲日韩一区二区三区| 亚洲午夜激情av| 国产经典欧美精品| 91精品国产综合久久香蕉的特点| 欧美精品一区二区三区高清aⅴ| 亚洲图片欧美色图| 一本久道久久综合中文字幕 | 欧美日韩一区二区电影| 国产福利视频一区二区三区| 亚洲免费观看高清完整版在线观看 | 国产一区二区久久| 欧美午夜精品免费| 国产日韩高清在线| 欧美aⅴ一区二区三区视频| 91麻豆.com| 国产欧美日本一区视频| 蜜臀a∨国产成人精品| 欧美在线免费播放| 国产精品拍天天在线| 激情小说欧美图片| 91精品视频网| 亚洲小少妇裸体bbw| 91网址在线看| 中文字幕成人网| 国产成人久久精品77777最新版本| 欧美一二三在线| 日韩在线一区二区三区| 在线国产亚洲欧美| 亚洲欧美日韩在线播放| 97久久人人超碰| 国产精品无码永久免费888| 国产精品一区一区| 久久影院电视剧免费观看| 久久国产日韩欧美精品| 日韩一区二区三区电影在线观看 |