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

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

?? os_mbox.c

?? uC_OS-II在C51下的一個完整的LCD項目源碼
?? 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区999| 蜜臂av日日欢夜夜爽一区| 久久综合九色综合97婷婷| 欧美精品久久一区二区三区| 欧美日韩一区二区欧美激情 | 亚洲图片你懂的| 国产精品网曝门| 国产精品污www在线观看| 中文字幕一区二区三区四区不卡| 欧美国产一区二区在线观看 | 欧美日韩精品一区二区在线播放 | 日韩主播视频在线| 日韩激情在线观看| 久久99久久99小草精品免视看| 美国毛片一区二区三区| 国产精品综合网| 成人国产精品视频| 91激情在线视频| 欧美精品在线视频| 久久综合九色综合97婷婷| 欧美极品少妇xxxxⅹ高跟鞋 | 欧美色图片你懂的| 91精品国产色综合久久不卡电影 | 欧美美女一区二区在线观看| 日韩丝袜情趣美女图片| 久久久精品影视| 亚洲免费资源在线播放| 欧美bbbbb| 成人福利视频网站| 在线播放视频一区| 国产精品家庭影院| 午夜精品爽啪视频| 成人在线综合网站| 91精品国产欧美日韩| 欧美国产视频在线| 丝袜美腿一区二区三区| 国产999精品久久久久久| 欧美在线免费观看视频| 久久中文字幕电影| 亚洲永久免费av| 国产在线一区观看| 欧美综合亚洲图片综合区| 精品国产第一区二区三区观看体验| 1000精品久久久久久久久| 免费高清在线视频一区·| 91在线视频播放| 精品人在线二区三区| 亚洲精品国产视频| 国产成人午夜精品影院观看视频 | 亚洲一区视频在线| 国产大陆a不卡| 91精品在线免费| 亚洲三级久久久| 国产一区二三区好的| 欧美日韩美女一区二区| 国产精品国产自产拍高清av王其| 经典三级视频一区| 成人午夜激情片| 欧美色爱综合网| 欧美日韩一区中文字幕| 久久久久久久综合色一本| 婷婷中文字幕综合| 在线亚洲高清视频| 亚洲欧洲综合另类| 成人免费黄色在线| 国产欧美日韩视频一区二区| 日本一不卡视频| 欧美日本在线观看| 亚洲va天堂va国产va久| 色狠狠一区二区| 中文字幕在线播放不卡一区| 国产黄色成人av| 久久久久久久久久久黄色| 精品综合免费视频观看| 日韩午夜激情免费电影| 天天色天天爱天天射综合| 在线免费观看日韩欧美| 亚洲精品高清在线观看| 日本久久电影网| 亚洲一区二区三区四区五区黄| 91在线高清观看| 亚洲精品视频一区二区| 色综合久久六月婷婷中文字幕| 亚洲视频你懂的| 一本大道久久精品懂色aⅴ| 中文字幕视频一区二区三区久| www.欧美日韩国产在线| 亚洲天堂av老司机| 欧美怡红院视频| 日韩黄色小视频| 日韩精品专区在线| 粉嫩绯色av一区二区在线观看| 亚洲精品在线免费播放| 高清在线不卡av| 一区二区三区四区在线| 欧美美女视频在线观看| 麻豆精品视频在线观看免费| 久久久www成人免费无遮挡大片| 高清不卡一区二区在线| 亚洲精品成人a在线观看| 91久久精品一区二区三| 青青青伊人色综合久久| 久久精品一区二区三区四区| 99久久综合精品| 日本少妇一区二区| 国产欧美一二三区| 日本精品一区二区三区高清| 男女男精品视频| 国产精品免费丝袜| 欧美日韩成人综合| 成人午夜精品在线| 日韩有码一区二区三区| 久久精品人人做| 欧美探花视频资源| 国产sm精品调教视频网站| 亚洲一区二区视频在线| 国产午夜精品理论片a级大结局| 在线欧美一区二区| 国产一区二区三区观看| 亚洲一二三专区| 国产色一区二区| 欧美日韩久久一区| 成人av一区二区三区| 麻豆91在线观看| 亚洲裸体xxx| 久久精品视频一区二区三区| 欧美日韩免费高清一区色橹橹| 国产成人免费视频网站| 日韩精品电影一区亚洲| 亚洲欧美另类久久久精品| 久久精品这里都是精品| 欧美一区二区在线免费播放| 日本乱人伦aⅴ精品| 国产成人综合网站| 久久激情五月激情| 五月激情六月综合| 亚洲欧美日韩国产手机在线| 国产亚洲成av人在线观看导航| 4438x成人网最大色成网站| 91视频免费观看| 懂色av一区二区三区免费观看 | 日韩视频在线你懂得| 91蝌蚪porny| 不卡av在线免费观看| 国产精品1区2区3区在线观看| 免费美女久久99| 日本亚洲欧美天堂免费| 日韩专区欧美专区| 日韩国产精品91| 蜜臀久久99精品久久久画质超高清| 香蕉成人伊视频在线观看| 亚洲一区二区三区精品在线| 九色porny丨国产精品| 日韩成人av影视| 日韩高清电影一区| 日韩专区一卡二卡| 日本大胆欧美人术艺术动态| 秋霞影院一区二区| 久久精品国内一区二区三区| 久久精品国产精品青草| 精品在线视频一区| 丁香六月综合激情| 91网址在线看| 欧美视频一区二| 91麻豆精品国产自产在线| 91精品国产综合久久精品性色| 在线影视一区二区三区| 欧美日本在线视频| 欧美tickling挠脚心丨vk| 精品国产免费一区二区三区香蕉| 精品成人一区二区三区四区| 久久嫩草精品久久久精品| 国产性色一区二区| 亚洲男同性视频| 日一区二区三区| 国精产品一区一区三区mba视频 | 亚洲蜜臀av乱码久久精品| 一区二区三区欧美在线观看| 天堂va蜜桃一区二区三区漫画版 | 成人高清视频在线| 精品视频在线免费看| 日韩西西人体444www| 日本一区二区三区免费乱视频| 亚洲欧美日韩成人高清在线一区| 亚洲成人中文在线| 国产精品自在欧美一区| 色哟哟日韩精品| 欧美电影免费观看高清完整版在线观看| 精品美女被调教视频大全网站| 国产精品久久午夜| 日韩和欧美的一区| 成人精品gif动图一区| 欧美日韩中文一区| 精品一二线国产| 色婷婷精品久久二区二区蜜臂av| 制服丝袜亚洲播放| 中文字幕一区二区三中文字幕| 日本v片在线高清不卡在线观看| 不卡一区中文字幕| 精品欧美一区二区在线观看|