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

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

?? os_mbox.c.bak

?? 在MC68HC908JB8上移植UCOSII成功
?? BAK
字號:
/*
*********************************************************************************************************
*                                                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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品无圣光一区二区| 成人激情校园春色| 欧美成人性福生活免费看| 成人免费毛片app| 青青青伊人色综合久久| 国产精品视频一二| 日韩午夜在线播放| 在线观看视频一区二区欧美日韩| 激情另类小说区图片区视频区| 亚洲精品国产成人久久av盗摄| 久久久午夜电影| 欧美精品日韩综合在线| 91视频免费看| 国产成人精品一区二区三区四区| 亚洲观看高清完整版在线观看| 国产精品私人影院| 欧美成人国产一区二区| 欧美三级一区二区| 色综合网色综合| 丰满亚洲少妇av| 韩国女主播成人在线观看| 亚洲成人激情社区| 亚洲视频免费观看| 亚洲国产电影在线观看| 久久这里只有精品首页| 6080国产精品一区二区| 欧美在线|欧美| 色综合久久中文综合久久97| 成人app软件下载大全免费| 国内精品伊人久久久久av一坑| 午夜国产精品一区| 亚洲123区在线观看| 一区二区三区产品免费精品久久75| 欧美国产精品久久| 国产三级精品在线| 国产欧美日本一区二区三区| 久久久亚洲精品石原莉奈| 精品国产乱码久久久久久老虎| 91精品国产福利在线观看| 欧美日韩亚州综合| 欧美日韩亚洲丝袜制服| 欧美日韩在线直播| 欧美精品乱码久久久久久| 欧美日韩精品三区| 欧美疯狂性受xxxxx喷水图片| 欧美日韩精品欧美日韩精品一| 欧美视频精品在线观看| 欧美日韩日本视频| 欧美精选在线播放| 日韩午夜在线观看| 26uuu久久天堂性欧美| 欧美v日韩v国产v| 久久亚洲精华国产精华液| 久久日韩粉嫩一区二区三区| 久久免费电影网| 日本一区二区三区在线不卡| 亚洲欧洲在线观看av| 亚洲私人影院在线观看| 亚洲一区二区在线观看视频 | 五月激情六月综合| 日本不卡不码高清免费观看| 黄一区二区三区| 成人国产精品免费| 一本色道亚洲精品aⅴ| 欧美日韩综合色| 精品国产一区a| 中文字幕亚洲在| 亚洲宅男天堂在线观看无病毒| 天堂在线亚洲视频| 国产真实精品久久二三区| 成人成人成人在线视频| 欧美私人免费视频| xfplay精品久久| 亚洲三级在线免费观看| 日韩黄色免费网站| 国产91精品欧美| 欧美日本一区二区在线观看| 久久久久成人黄色影片| 亚洲摸摸操操av| 美腿丝袜亚洲三区| 99久久精品国产一区| 在线播放欧美女士性生活| 久久久精品免费观看| 一区二区三区久久| 韩国三级在线一区| 欧美视频一区二区在线观看| 久久蜜桃香蕉精品一区二区三区| 亚洲日本丝袜连裤袜办公室| 久久成人麻豆午夜电影| 色综合久久久久综合| 精品国产污污免费网站入口| 樱花草国产18久久久久| 精品一区二区三区久久| 欧美综合色免费| 国产精品全国免费观看高清 | 国产精品久久久久久一区二区三区 | 3atv在线一区二区三区| 国产人成亚洲第一网站在线播放| 午夜精品久久久| 99久久精品一区二区| 久久综合网色—综合色88| 一区二区成人在线| 国产成人免费在线视频| 日韩一级免费一区| 亚洲国产日韩av| 91蜜桃视频在线| 国产拍揄自揄精品视频麻豆| 日韩中文字幕区一区有砖一区| 不卡视频在线看| 久久久蜜臀国产一区二区| 日韩精品亚洲一区二区三区免费| 91影院在线免费观看| 久久久久久麻豆| 久色婷婷小香蕉久久| 精品视频999| 亚洲综合免费观看高清在线观看| 高清免费成人av| 国产亚洲精品福利| 国产最新精品精品你懂的| 国产乱码精品一区二区三区五月婷| 国产成人精品1024| 精品理论电影在线| 秋霞电影一区二区| 欧美日韩国产首页| 亚洲国产欧美在线人成| 91久久精品一区二区二区| 亚洲欧洲性图库| av一二三不卡影片| 中文字幕亚洲成人| 成人国产精品免费观看视频| 国产欧美1区2区3区| 国产在线国偷精品产拍免费yy| 日韩欧美国产一区二区在线播放| 日韩成人午夜电影| 日韩一区二区三区视频在线观看| 日韩影院在线观看| 日韩一区二区中文字幕| 美国十次了思思久久精品导航| 欧美一区二区三区公司| 爽好久久久欧美精品| 91精品国产91久久综合桃花| 免费高清在线一区| 欧美变态口味重另类| 奇米精品一区二区三区四区 | 91在线视频18| 成人免费一区二区三区在线观看| 不卡欧美aaaaa| 一区二区三区欧美视频| 欧美性色黄大片| 日本午夜一本久久久综合| 日韩视频在线一区二区| 国产综合成人久久大片91| 欧美极品xxx| 色综合天天做天天爱| 亚洲va欧美va国产va天堂影院| 欧美福利一区二区| 精品一区二区影视| 中文字幕精品—区二区四季| 91美女片黄在线观看91美女| 亚洲高清久久久| 精品日韩在线观看| 国产不卡在线视频| 亚洲男人的天堂av| 91精品国产黑色紧身裤美女| 国产精品一区二区久激情瑜伽| 国产精品久久精品日日| 日本精品一区二区三区高清| 丝袜亚洲另类欧美| 国产欧美一区二区三区在线看蜜臀 | 一区二区三区四区激情| 欧美色手机在线观看| 久久精品国产99国产| 国产精品二区一区二区aⅴ污介绍| 欧美影院午夜播放| 激情成人综合网| 亚洲精品国产高清久久伦理二区| 日韩亚洲欧美中文三级| 成人深夜视频在线观看| 亚洲国产精品天堂| 久久久精品人体av艺术| 欧美制服丝袜第一页| 国产乱码精品一品二品| 亚洲综合久久久| 久久综合av免费| 欧美私模裸体表演在线观看| 国产精品羞羞答答xxdd| 午夜精品影院在线观看| 久久综合视频网| 久久日一线二线三线suv| 欧美日韩在线一区二区| 国产精品18久久久久久久网站| 亚洲色图一区二区三区| 精品区一区二区| 欧洲另类一二三四区| 国产成人av一区二区三区在线观看| 亚洲国产成人av| 18成人在线视频| 国产亚洲一区字幕| 91精品国产乱| 欧美调教femdomvk|