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

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

?? os_mbox.c

?? 51單片機的基于UCOSii的usb驅(qū)動源碼,USB驅(qū)動來發(fā)方面的資料
?? 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一区二区三区免费野_久草精品视频
91精品国产黑色紧身裤美女| 一区二区三区在线视频观看58| 国产精品三级在线观看| 亚洲福利视频导航| 成人午夜激情在线| 91精品国产一区二区三区| 国产精品电影院| 国产在线视频一区二区| 欧美视频在线一区| 国产精品国产三级国产普通话99| 毛片av中文字幕一区二区| 欧美性大战久久久久久久| 亚洲国产经典视频| 狠狠色丁香久久婷婷综合丁香| 欧美影片第一页| 国产精品久久看| 国产成人在线看| 久久先锋影音av鲁色资源网| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美日韩精品专区| 一区二区三区国产豹纹内裤在线| 91在线porny国产在线看| 中文字幕乱码久久午夜不卡 | 91高清视频在线| 久久久99精品久久| 精品一区二区三区免费观看 | 蜜臀久久99精品久久久久宅男 | 青青草国产精品97视觉盛宴| 欧美色国产精品| 亚洲成人免费av| 欧美日韩中字一区| 同产精品九九九| 欧美日韩在线播| 亚洲午夜一区二区三区| 欧美丰满少妇xxxxx高潮对白| 亚洲在线视频免费观看| 欧美在线一区二区三区| 首页综合国产亚洲丝袜| 91精品国产色综合久久ai换脸 | 久久你懂得1024| 国产福利不卡视频| 国产精品久久久久久户外露出| 国产电影一区在线| 一区在线观看免费| 99在线热播精品免费| 一区二区三区91| 欧美精品丝袜中出| 黑人巨大精品欧美黑白配亚洲 | 精品少妇一区二区三区| 国产乱理伦片在线观看夜一区| 中文字幕av一区二区三区免费看| 成人免费va视频| 亚洲午夜影视影院在线观看| 欧美一区二区播放| 国产电影一区二区三区| 亚洲乱码日产精品bd| 6080午夜不卡| 国产黄色成人av| 暴力调教一区二区三区| 亚洲国产一区在线观看| 精品国产乱码久久久久久图片| 国产成人在线观看免费网站| 一区二区三区在线播| 精品免费国产一区二区三区四区| 成人手机电影网| 午夜久久福利影院| 久久精品亚洲麻豆av一区二区| 91色porny| 狠狠色综合日日| 亚洲一区免费视频| 国产亚洲一二三区| 欧美人牲a欧美精品| 高清久久久久久| 奇米一区二区三区av| 日韩伦理免费电影| 精品精品国产高清a毛片牛牛| 色综合激情五月| 国产黄色精品视频| 乱中年女人伦av一区二区| 国内精品在线播放| 亚洲妇熟xx妇色黄| 中文字幕亚洲一区二区va在线| 欧美一激情一区二区三区| 91丨porny丨首页| 国产麻豆欧美日韩一区| 日本最新不卡在线| 洋洋成人永久网站入口| 国产精品嫩草影院com| 欧美mv日韩mv亚洲| 欧美一区午夜视频在线观看| 色欧美88888久久久久久影院| 国内精品伊人久久久久影院对白| 午夜精品视频在线观看| 亚洲美女淫视频| 国产精品久久久久久久岛一牛影视| 精品日韩在线观看| 日韩免费观看2025年上映的电影 | 亚洲福利一区二区三区| 亚洲色图制服诱惑 | 成人看片黄a免费看在线| 青青草国产成人99久久| 午夜精品在线看| 午夜国产精品一区| 亚洲一区二区三区中文字幕在线| 中文字幕中文字幕一区| 国产欧美日韩亚州综合| 久久久久久久久久久久久久久99 | 亚洲视频一二区| 国产精品久线观看视频| 中文字幕av一区二区三区免费看 | 欧美午夜免费电影| 欧美性感一类影片在线播放| 在线看一区二区| 在线观看视频一区二区| 欧美亚洲综合一区| 欧美久久婷婷综合色| 欧美日韩一级黄| 91精品欧美久久久久久动漫| 91精品国产色综合久久不卡蜜臀 | 2017欧美狠狠色| 久久综合久色欧美综合狠狠| www国产精品av| 国产欧美久久久精品影院| 国产精品理伦片| 亚洲黄色片在线观看| 亚洲成va人在线观看| 日韩中文字幕亚洲一区二区va在线| 日本欧美在线看| 国内久久精品视频| aaa欧美大片| 欧美日韩在线播放三区| 欧美成人综合网站| 中文字幕久久午夜不卡| 亚洲免费大片在线观看| 午夜av一区二区三区| 极品少妇一区二区| 成人黄色在线看| 精品视频一区二区三区免费| 欧美成人在线直播| 中文字幕一区二区在线播放| 午夜视频在线观看一区二区| 国产一区二区美女诱惑| 99久久99久久精品免费看蜜桃| 欧美性大战xxxxx久久久| 日韩免费高清电影| 亚洲欧美综合在线精品| 日韩电影在线免费看| 国产超碰在线一区| 欧美日韩另类一区| 国产拍揄自揄精品视频麻豆| 亚洲图片欧美色图| 大美女一区二区三区| 欧美福利一区二区| 中文字幕日韩一区| 美女国产一区二区三区| 91在线观看免费视频| 精品国产一二三区| 亚洲综合色自拍一区| 国产精品一区二区无线| 欧美性xxxxxx少妇| 国产日韩欧美一区二区三区综合| 亚洲一区二区三区影院| 国产成人精品亚洲777人妖| 色老汉av一区二区三区| 国产亚洲欧洲997久久综合| 午夜精品福利一区二区三区av| www.欧美.com| 精品国产乱码久久久久久闺蜜| 亚洲激情五月婷婷| 国产成人在线免费观看| 日韩三级视频在线观看| 一区二区三区日韩欧美| 成人在线一区二区三区| 日韩美女主播在线视频一区二区三区 | 亚洲精品欧美综合四区| 精品夜夜嗨av一区二区三区| 欧美私模裸体表演在线观看| 综合久久久久综合| 国产99久久久国产精品免费看 | 8v天堂国产在线一区二区| 国产视频一区在线观看| 久久丁香综合五月国产三级网站| 在线视频你懂得一区二区三区| 欧美激情一二三区| 国产乱码精品一区二区三区五月婷| 91精品国产综合久久久久久久| 亚洲国产精品久久久久秋霞影院 | 一区二区三区高清不卡| www.亚洲人| 国产精品久99| jizzjizzjizz欧美| 国产精品人妖ts系列视频| 大陆成人av片| 自拍偷拍亚洲综合| 97国产一区二区| 亚洲色图.com| 欧美影院一区二区三区| 亚洲成人在线免费| 欧美一区二区三区在线看| 人人超碰91尤物精品国产|