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

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

?? os_mbox.c

?? 51系列單片機的uCOS-II原代碼
?? 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一区二区三区免费野_久草精品视频
亚洲一二三四在线观看| 国产精品高潮呻吟久久| kk眼镜猥琐国模调教系列一区二区| 天天色天天操综合| 亚洲va韩国va欧美va精品 | 欧美日本高清视频在线观看| 在线视频欧美区| 欧美视频在线一区| 欧美日韩国产免费| 日韩一级免费观看| 久久亚洲精华国产精华液| 久久一区二区三区四区| 中文字幕国产一区| 亚洲人成伊人成综合网小说| 亚洲另类春色校园小说| 亚洲国产精品麻豆| 麻豆91在线播放免费| 国产精品自拍在线| 色呦呦一区二区三区| 精品视频1区2区| 欧美videofree性高清杂交| 久久精品视频在线免费观看| 中文字幕一区av| 亚洲地区一二三色| 精品一区二区三区在线观看国产 | 亚洲欧美一区二区在线观看| 亚洲一区二区三区四区中文字幕| 日韩国产精品大片| 国产成人在线视频网站| 色综合久久久网| 日韩一区二区三区av| 日本一区二区三区四区在线视频| 一区二区三区中文字幕电影| 蜜桃在线一区二区三区| 成人免费高清视频| 欧美精品乱码久久久久久按摩| 欧美大胆一级视频| 亚洲激情第一区| 精东粉嫩av免费一区二区三区| 9人人澡人人爽人人精品| 日本福利一区二区| 久久精品夜色噜噜亚洲aⅴ| 亚洲一区二区三区四区的| 国产一区在线看| 欧美三级日韩三级| 国产精品你懂的在线| 乱中年女人伦av一区二区| 成人动漫在线一区| 欧美www视频| 午夜免费久久看| 成人av电影在线| 欧美精品一区二区不卡| 亚洲妇熟xx妇色黄| 色综合久久久久综合体桃花网| 久久伊人蜜桃av一区二区| 日日骚欧美日韩| 在线欧美日韩国产| 中文字幕一区二区三区色视频| 精品系列免费在线观看| 欧美日本韩国一区二区三区视频 | 欧美电影影音先锋| 一区二区三区日韩精品视频| a在线欧美一区| 国产情人综合久久777777| 久久精品噜噜噜成人av农村| 欧美少妇bbb| 亚洲国产婷婷综合在线精品| 91蜜桃免费观看视频| 国产精品美女久久久久aⅴ| 国产91在线看| 国产精品无码永久免费888| 丁香激情综合五月| 中文字幕欧美日韩一区| 国产成人精品影院| 国产精品丝袜91| 成人开心网精品视频| 国产精品三级视频| 成人h动漫精品| 亚洲欧美在线另类| 91猫先生在线| 亚洲五月六月丁香激情| 色婷婷激情久久| 洋洋成人永久网站入口| 欧美影院精品一区| 日韩不卡在线观看日韩不卡视频| 欧美一区二区三区在线电影| 久久精品国产色蜜蜜麻豆| 久久久久综合网| 成人久久18免费网站麻豆 | 蜜臀精品久久久久久蜜臀 | 国产精品毛片久久久久久| 不卡视频在线观看| 夜夜精品视频一区二区 | 久久99热狠狠色一区二区| 久久综合国产精品| 成人高清av在线| 一区二区三区在线播| 91精品国产一区二区三区| 经典一区二区三区| 亚洲视频中文字幕| 欧美精品丝袜久久久中文字幕| 男人的天堂亚洲一区| 久久精品欧美日韩精品| 91污在线观看| 久久激情五月激情| 亚洲三级在线免费| 欧美刺激午夜性久久久久久久| 国产一区二区三区电影在线观看| 国产精品久久久久久久久久久免费看 | 亚洲精品水蜜桃| 欧美电影免费观看完整版| 成人app网站| 麻豆传媒一区二区三区| 国产精品久久久久影院亚瑟| 欧美日韩久久久久久| 国产99久久久国产精品潘金| 亚洲第一av色| 国产精品久久一级| 欧美成人精品1314www| 色国产精品一区在线观看| 狠狠色狠狠色综合系列| 香港成人在线视频| 国产精品午夜在线| www国产成人免费观看视频 深夜成人网| caoporn国产一区二区| 久久精品国产亚洲高清剧情介绍 | 中文字幕永久在线不卡| 欧美一区二区三区婷婷月色| av不卡一区二区三区| 激情国产一区二区| 丝袜a∨在线一区二区三区不卡| 国产精品久久久久影视| 久久蜜桃一区二区| 欧美一级片免费看| 欧美日韩精品福利| 色婷婷精品大在线视频| av电影在线观看不卡| 国产精品白丝jk黑袜喷水| 免费在线欧美视频| 亚洲丶国产丶欧美一区二区三区| 国产精品成人免费| 国产日产精品1区| 久久老女人爱爱| 日韩一区二区三区视频在线观看 | 看电视剧不卡顿的网站| 亚洲3atv精品一区二区三区| 亚洲丝袜美腿综合| 国产精品成人免费| 1000部国产精品成人观看| 国产网站一区二区三区| 精品国产乱码久久久久久1区2区| 欧美一二三区精品| 日韩欧美国产小视频| 欧美一区二区三区视频| 日韩一区二区三区在线| 91精品国产综合久久久久久久久久| 欧美日韩免费观看一区三区| 日本韩国精品在线| 欧美三级视频在线观看| 精品视频免费看| 欧美一区二区在线视频| 日韩精品一区二区三区视频在线观看 | 国产一区福利在线| 国产91丝袜在线播放九色| 国产99久久久久| 91麻豆精东视频| 欧美日韩精品一二三区| 日韩一卡二卡三卡国产欧美| 精品久久久久久久久久久久久久久| 久久嫩草精品久久久久| 亚洲免费成人av| 精品成人一区二区| 欧美国产97人人爽人人喊| 中文字幕不卡在线观看| 18欧美亚洲精品| 亚洲成a人在线观看| 毛片一区二区三区| 成人天堂资源www在线| 91一区一区三区| 日韩一区二区三区四区| 欧美国产日韩精品免费观看| 一区二区三区在线影院| 免费观看在线色综合| av在线一区二区| 在线播放/欧美激情| 亚洲国产成人私人影院tom| 五月天久久比比资源色| 国产精品88av| 欧美日韩你懂得| 久久综合色一综合色88| 亚洲激情网站免费观看| 国产麻豆精品在线| 欧美在线一二三| 久久人人97超碰com| 亚洲国产综合91精品麻豆| 国产成人精品网址| 91精选在线观看| 亚洲人成亚洲人成在线观看图片| 久久99精品一区二区三区三区| 一本色道久久综合亚洲aⅴ蜜桃|