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

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

?? os_mbox.c

?? 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本亚洲最大的色成网站www| 国产精品亚洲一区二区三区在线| 日韩高清不卡在线| 国产剧情在线观看一区二区| 日本韩国欧美国产| 欧美激情综合在线| 久久aⅴ国产欧美74aaa| 91成人在线免费观看| 国产欧美视频一区二区三区| 日韩国产欧美在线播放| 在线观看免费亚洲| 久久精品亚洲一区二区三区浴池| 亚洲电影激情视频网站| 91丨九色丨黑人外教| 国产午夜亚洲精品午夜鲁丝片| 污片在线观看一区二区| 色婷婷国产精品久久包臀| 久久精品免视看| 国产在线精品一区二区| 欧美一区二区三区在线观看视频| 亚洲亚洲人成综合网络| 97国产一区二区| 国产精品狼人久久影院观看方式| 狠狠色狠狠色综合系列| 日韩欧美高清一区| 日本aⅴ精品一区二区三区 | 欧美一区二区在线观看| 亚洲综合激情网| 色哟哟国产精品免费观看| 欧美经典三级视频一区二区三区| 久久久久久久久久电影| 亚洲国产精品久久人人爱蜜臀| 懂色av一区二区三区免费观看| 日韩精品专区在线| 国产尤物一区二区| 国产亚洲一区字幕| 丁香五精品蜜臀久久久久99网站 | 国产69精品久久99不卡| 久久女同互慰一区二区三区| 国产一区二区在线影院| 国产视频在线观看一区二区三区| 国产精品自产自拍| 国产欧美日韩一区二区三区在线观看| 韩日av一区二区| 国产欧美日韩激情| 91网站黄www| 一级做a爱片久久| 欧美精品免费视频| 久久精品999| 国产精品人成在线观看免费| 91丨porny丨最新| 亚洲国产va精品久久久不卡综合 | 亚洲与欧洲av电影| 欧美丰满嫩嫩电影| 国产一区美女在线| 亚洲视频在线一区观看| 欧美另类久久久品| 黄页视频在线91| 亚洲色图第一区| 在线综合视频播放| 丁香另类激情小说| 亚洲成人免费影院| 久久精品网站免费观看| 国产精品亚洲人在线观看| 亚洲色图19p| 日韩欧美国产一区二区三区 | 99久久99久久精品国产片果冻| 亚洲三级小视频| 欧美一级二级在线观看| 成人av免费观看| 琪琪一区二区三区| 日韩一区在线免费观看| 欧美影院午夜播放| 国产精品伦一区| 欧美在线你懂的| 国产一区二区三区四区五区美女| 国产精品久久久久影院亚瑟| 在线综合视频播放| 91原创在线视频| 久久99精品国产麻豆婷婷洗澡| 国产精品护士白丝一区av| 欧美一级一级性生活免费录像| 国产成人精品网址| 欧美aaaaaa午夜精品| 九九在线精品视频| 亚洲精品欧美专区| 久久青草国产手机看片福利盒子| 欧美图区在线视频| jvid福利写真一区二区三区| 久久99精品国产麻豆婷婷洗澡| 亚洲一区中文在线| 国产精品国产精品国产专区不片 | 99视频一区二区| 久久国产成人午夜av影院| 亚洲国产精品久久久男人的天堂| 欧美激情一二三区| 久久久久久久久久电影| 日韩一区二区影院| 欧美视频在线播放| 日本高清成人免费播放| 成人91在线观看| 国产成人av电影在线播放| 久久99九九99精品| 日本亚洲欧美天堂免费| 亚洲第一搞黄网站| 亚洲香肠在线观看| 亚洲综合色区另类av| 亚洲欧美日韩在线不卡| 日韩一区中文字幕| 亚洲欧美自拍偷拍| 亚洲日本在线看| 日韩毛片在线免费观看| 18欧美乱大交hd1984| 国产精品久久久久7777按摩 | 粉嫩av一区二区三区| 蜜臀av性久久久久蜜臀aⅴ四虎 | 欧美精品黑人性xxxx| 91成人免费在线| 在线视频国产一区| 欧美图区在线视频| 久久蜜臀中文字幕| 久久综合色综合88| 久久久久久久电影| 中文在线资源观看网站视频免费不卡| 久久久久久亚洲综合影院红桃| 欧美精品一区二区三区蜜桃| 久久婷婷色综合| 久久精品免视看| 国产精品色哟哟网站| 国产精品久久久一本精品| 亚洲欧美色图小说| 亚洲一区二区在线观看视频 | 国产精品久99| 亚洲综合视频在线观看| 五月婷婷欧美视频| 日韩电影在线免费看| 狠狠色狠狠色合久久伊人| 国产精品羞羞答答xxdd| 国产不卡高清在线观看视频| 色香蕉成人二区免费| 欧美日韩在线电影| 2021中文字幕一区亚洲| 国产精品蜜臀在线观看| 看电视剧不卡顿的网站| 国产一区二区看久久| 91精品国产色综合久久| 精品久久一区二区| 亚洲欧美aⅴ...| 久久er精品视频| 欧美午夜精品久久久久久孕妇| 一区在线观看免费| 亚洲乱码精品一二三四区日韩在线| 亚洲自拍另类综合| 99精品欧美一区二区蜜桃免费| eeuss影院一区二区三区| 99国产精品久| 成人av资源下载| www.亚洲色图| 欧美日韩一区二区三区四区五区| 日韩欧美一卡二卡| 亚洲欧洲制服丝袜| 极品尤物av久久免费看| 色婷婷av久久久久久久| 日韩你懂的在线观看| 亚洲欧美日韩在线| 蜜臀va亚洲va欧美va天堂| 一本大道av伊人久久综合| 日韩午夜精品电影| 日韩精品视频网| 在线视频中文字幕一区二区| 国产精品对白交换视频| 九九视频精品免费| 717成人午夜免费福利电影| 中文字幕一区二区三区四区不卡| 国产综合色视频| 久久影院视频免费| 激情综合色丁香一区二区| 欧美美女直播网站| 午夜久久久久久| 久久九九全国免费| 午夜精品久久久久| 欧美久久久久久久久| 麻豆成人久久精品二区三区红| 91女神在线视频| 久久综合色之久久综合| 日韩av在线发布| 亚洲精品在线观看网站| 国产精品小仙女| 日韩一级视频免费观看在线| 色婷婷香蕉在线一区二区| 久久综合久久鬼色| 玖玖九九国产精品| 欧美一区二区三区公司| 天天操天天干天天综合网| 欧美三级电影精品| 亚洲综合色视频| 欧美三级视频在线播放| 亚洲一区二区av在线| 欧美性受极品xxxx喷水| 亚洲国产成人高清精品|