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

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

?? os_mbox.c

?? ucos操作系統(tǒng)在s3c44b0上的移植
?? 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)
{
    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一区二区三区免费野_久草精品视频
国产精品久久久久婷婷| 国产精品亚洲а∨天堂免在线| 蜜臀av性久久久久av蜜臀妖精 | 成人av在线资源网| 欧美乱妇23p| 亚洲欧美综合在线精品| 蜜桃久久久久久| 色菇凉天天综合网| 国产精品全国免费观看高清| 日韩不卡一二三区| 欧美三级电影在线观看| 成人欧美一区二区三区黑人麻豆| 久久精品国产精品青草| 欧美日韩在线播放三区四区| 国产精品久久夜| 国产寡妇亲子伦一区二区| 日韩免费成人网| 三级一区在线视频先锋| 欧美视频一区二区三区| 亚洲三级小视频| 成年人网站91| 国产精品久久久久国产精品日日 | 亚洲成年人网站在线观看| www.99精品| 中文字幕在线免费不卡| 丁香激情综合国产| 欧美激情资源网| 成人小视频免费在线观看| 国产网站一区二区| 国内精品自线一区二区三区视频| 日韩一区二区免费高清| 日本aⅴ亚洲精品中文乱码| 欧美一级黄色片| 美女国产一区二区三区| 日韩久久免费av| 精彩视频一区二区| 久久久久99精品国产片| 国产成人8x视频一区二区| 国产女主播在线一区二区| 成人a级免费电影| 国产精品高潮呻吟久久| 91麻豆国产自产在线观看| 亚洲欧美日韩在线| 欧美色综合天天久久综合精品| 亚洲综合成人网| 欧美一二三区精品| 韩国视频一区二区| 中文字幕一区二区在线观看| 99re热这里只有精品免费视频| 亚洲精品日日夜夜| 欧美日韩在线观看一区二区| 美腿丝袜一区二区三区| 久久久久久亚洲综合| av成人免费在线| 亚洲成人免费在线观看| 久久久久九九视频| 色一区在线观看| 久久国产精品色婷婷| 中文字幕+乱码+中文字幕一区| 91麻豆6部合集magnet| 香蕉av福利精品导航| 精品不卡在线视频| 成人黄色在线视频| 天天影视网天天综合色在线播放| 日韩你懂的在线观看| 91在线免费播放| 美女性感视频久久| 亚洲日本韩国一区| 欧美一区二区黄| 91网站在线播放| 日韩不卡手机在线v区| 国产精品美女一区二区三区| 欧美日韩一级片网站| 高清在线观看日韩| 日韩av高清在线观看| 日韩一区欧美一区| 久久影音资源网| 欧美蜜桃一区二区三区| a级精品国产片在线观看| 日韩精品亚洲专区| 亚洲欧美另类图片小说| 精品国产乱码久久久久久蜜臀| 欧美亚洲高清一区| 国产成人一级电影| 奇米精品一区二区三区四区| 亚洲欧美一区二区久久| 久久久久综合网| 欧美三级中文字幕在线观看| 国产精品1区二区.| 免费成人av在线| 亚洲va在线va天堂| ...中文天堂在线一区| 久久久蜜臀国产一区二区| 欧美疯狂性受xxxxx喷水图片| 成人精品免费网站| 国产美女在线观看一区| 日韩精品每日更新| 亚洲午夜精品在线| 一区二区三区电影在线播| 国产精品视频一区二区三区不卡| 欧美成人午夜电影| 日韩亚洲欧美高清| 欧美日韩一级黄| 欧美探花视频资源| 在线中文字幕一区| 欧美性生交片4| 日本道免费精品一区二区三区| 91同城在线观看| av在线一区二区三区| 丁香婷婷深情五月亚洲| 国产激情一区二区三区四区| 国产伦精一区二区三区| 狠狠色伊人亚洲综合成人| 久久精品99国产国产精| 六月丁香综合在线视频| 久久99精品一区二区三区 | 欧美一级免费观看| 欧美一级日韩一级| 欧美tickling挠脚心丨vk| 欧美一区二区在线免费观看| 在线91免费看| 日韩精品一区二区三区视频播放 | 欧美日韩一区视频| 欧美日韩大陆在线| 日韩一卡二卡三卡国产欧美| 91精品国产91热久久久做人人| 欧美日韩国产经典色站一区二区三区| 欧美午夜宅男影院| 51精品秘密在线观看| 精品少妇一区二区三区| 中文字幕电影一区| 一区二区三区在线影院| 午夜成人免费视频| 极品少妇一区二区| 懂色中文一区二区在线播放| 处破女av一区二区| 97久久久精品综合88久久| 在线观看国产精品网站| 91精品啪在线观看国产60岁| 日韩视频一区二区三区| 久久久久久久久99精品| 亚洲精品少妇30p| 男男成人高潮片免费网站| 激情小说亚洲一区| 91小视频免费看| 91精品国产入口| 国产精品视频一二| 婷婷六月综合亚洲| 国产伦精品一区二区三区视频青涩| caoporen国产精品视频| 3d成人h动漫网站入口| 久久久久国色av免费看影院| 亚洲综合无码一区二区| 精品亚洲porn| 欧美怡红院视频| 国产日韩欧美在线一区| 亚洲gay无套男同| 精品夜夜嗨av一区二区三区| 91婷婷韩国欧美一区二区| 精品美女在线观看| 亚洲电影在线免费观看| 国产精品18久久久久久久久 | 午夜久久电影网| 国产精品99久久久久| 欧美日韩一区二区三区视频| 久久久午夜精品| 视频一区视频二区在线观看| 粉嫩13p一区二区三区| 4438x成人网最大色成网站| 国产精品久久久一区麻豆最新章节| 日韩在线一区二区| 91蜜桃在线免费视频| 2021中文字幕一区亚洲| 天天影视涩香欲综合网| 一本到三区不卡视频| 国产人成一区二区三区影院| 免费久久精品视频| 欧美剧在线免费观看网站| 亚洲视频电影在线| 成熟亚洲日本毛茸茸凸凹| 久久久另类综合| 激情亚洲综合在线| 精品久久久久av影院 | 亚洲综合区在线| eeuss鲁片一区二区三区| 国产亚洲福利社区一区| 久久99精品视频| 欧美成人三级在线| 久久91精品久久久久久秒播| 欧美日韩精品三区| 亚洲午夜视频在线| 欧美最新大片在线看| 亚洲精品国产精华液| 91成人在线免费观看| 亚洲自拍偷拍麻豆| 精品视频999| 亚洲成人激情社区| 欧美日韩在线不卡| 日韩精品一级中文字幕精品视频免费观看 | eeuss鲁一区二区三区|