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

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

?? os_mbox.c

?? C51下uc/osii的一個(gè)完整的LCD項(xiàng)目源碼
?? 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) 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
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产aⅴ天堂久久| 日韩一二在线观看| 亚洲女同ⅹxx女同tv| 91在线你懂得| 亚洲二区视频在线| 国产欧美精品一区二区色综合| 91污在线观看| 久热成人在线视频| 亚洲自拍偷拍av| 26uuu久久综合| 国产99久久久久| 一区二区三区av电影| 91麻豆精品国产91久久久久| 国产精品88av| 亚洲国产一区二区a毛片| 国产肉丝袜一区二区| 91国偷自产一区二区开放时间 | 国产美女主播视频一区| 国产精品成人免费在线| 欧美三级电影在线观看| 国产91富婆露脸刺激对白| 亚洲电影你懂得| 国产欧美精品日韩区二区麻豆天美| 色哟哟日韩精品| 国产麻豆精品theporn| 亚洲成人福利片| 中文字幕一区二区三中文字幕| 欧美一级爆毛片| 欧美午夜片在线看| 99精品1区2区| 国产69精品久久99不卡| 免费看日韩精品| 日韩国产一二三区| 一区二区视频在线看| 中文字幕一区二| 欧美国产视频在线| 国产精品剧情在线亚洲| 国产亚洲成av人在线观看导航| 3d动漫精品啪啪| 欧美日韩国产123区| 777午夜精品免费视频| 欧美日韩免费高清一区色橹橹| 色综合天天性综合| 在线免费观看日本一区| 欧美亚洲精品一区| 欧美专区亚洲专区| 欧美日韩一区三区| 91精品国产高清一区二区三区| 91精品国产欧美一区二区| 欧美一区二区三区婷婷月色| 国产精品三级电影| 亚洲久本草在线中文字幕| 一区二区三区四区视频精品免费| 亚洲精品伦理在线| 天天综合色天天| 国产美女精品在线| 91丨九色丨国产丨porny| 91国偷自产一区二区三区观看| 5858s免费视频成人| 久久男人中文字幕资源站| 亚洲少妇最新在线视频| 日韩高清一区在线| 成人一区二区视频| 欧美日韩和欧美的一区二区| 国产三级三级三级精品8ⅰ区| 亚洲欧美日韩国产综合在线| 另类小说一区二区三区| 一本一道波多野结衣一区二区| 精品欧美久久久| 亚洲免费观看高清完整版在线观看熊 | 精品一区二区三区的国产在线播放| 亚洲午夜久久久| 亚洲精品午夜久久久| 综合激情成人伊人| 色综合婷婷久久| 亚洲va韩国va欧美va精品| 欧美日韩亚洲综合在线| 中文字幕在线免费不卡| 国产成人免费视频一区| 91精品免费在线| 性做久久久久久| 日本道免费精品一区二区三区| 久久精品一区二区三区av| 五月综合激情婷婷六月色窝| 91麻豆免费看| 亚洲午夜羞羞片| 欧美视频精品在线观看| 一区二区三区小说| 欧美午夜片在线观看| 日本视频一区二区三区| 91精品国产一区二区人妖| 午夜精品久久久久久久久| 欧美在线视频你懂得| 视频在线观看国产精品| 91精品国产一区二区三区蜜臀| 日韩**一区毛片| 欧美一区二区三区的| 久久精品国产在热久久| 制服丝袜成人动漫| 美腿丝袜亚洲综合| 2023国产精品| 成人app网站| 亚洲人成在线播放网站岛国| 91福利在线导航| 亚洲国产日韩a在线播放性色| 欧美视频一区二区三区| 蜜桃一区二区三区在线| 国产精品久久久久久久久搜平片 | 99视频精品免费视频| 亚洲成人动漫一区| 专区另类欧美日韩| 久久影院午夜论| 日韩一区二区三区在线| 国产伦理精品不卡| 亚洲精品乱码久久久久久久久 | 亚洲成人动漫精品| 久久亚洲一级片| 91电影在线观看| 国产黄色成人av| 日韩精品乱码免费| 中文字幕av资源一区| 337p亚洲精品色噜噜| 99久久精品一区| 国产精品自产自拍| 婷婷国产在线综合| 午夜视黄欧洲亚洲| 亚洲天堂成人在线观看| 国产蜜臀av在线一区二区三区| 欧美日韩综合在线| av一二三不卡影片| 国产真实乱子伦精品视频| 婷婷久久综合九色综合绿巨人| 最新欧美精品一区二区三区| 久久久99久久精品欧美| 26uuu精品一区二区| 欧美成人性战久久| 日韩一级精品视频在线观看| 欧美欧美午夜aⅴ在线观看| 91行情网站电视在线观看高清版| 高清国产一区二区| 成人国产免费视频| 成人国产视频在线观看| 高清免费成人av| www..com久久爱| 成人18视频在线播放| 国产91精品一区二区| 日韩女优电影在线观看| 欧美二区三区91| 欧美一区二区三区在线观看视频 | 粉嫩在线一区二区三区视频| 99视频一区二区三区| 成人激情视频网站| 在线视频国内自拍亚洲视频| 色av一区二区| 欧美福利视频导航| 26uuu欧美日本| 日韩美女啊v在线免费观看| 亚洲精选视频免费看| 不卡视频一二三四| 欧美精品v日韩精品v韩国精品v| 91精品国产综合久久久久久漫画| 精品成人在线观看| 亚洲老妇xxxxxx| 蜜桃av一区二区三区电影| 成人动漫一区二区在线| 欧美精品三级日韩久久| 国产午夜精品福利| 日本网站在线观看一区二区三区| 国产一区二三区| 在线免费不卡电影| 欧美韩国日本不卡| 精品中文字幕一区二区| 日本韩国精品在线| 欧美激情综合在线| 狠狠色综合色综合网络| 97久久精品人人做人人爽50路| 日韩欧美中文一区二区| 亚洲一区在线播放| 欧美视频一区二区| 成人欧美一区二区三区小说| 蜜臀精品久久久久久蜜臀| 色999日韩国产欧美一区二区| 欧美刺激脚交jootjob| 亚洲精品第1页| k8久久久一区二区三区| 久久久噜噜噜久久中文字幕色伊伊 | 亚洲午夜av在线| 91蜜桃免费观看视频| 18成人在线观看| 成人av免费在线播放| 精品少妇一区二区三区视频免付费| 最新国产成人在线观看| 国产激情精品久久久第一区二区| 精品国产青草久久久久福利| 天堂久久久久va久久久久| 欧美情侣在线播放| 激情图片小说一区| 中文字幕精品—区二区四季| 色激情天天射综合网| 亚洲一区在线观看免费观看电影高清|