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

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

?? os_mbox.c

?? 在IAR EWARM開發環境下的ucos_2操作系統在LPC2200上的應用
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                       MESSAGE MAILBOX MANAGEMENT
*
*                              (c) Copyright 1992-2007, Micrium, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_MBOX.C
* By      : Jean J. Labrosse
* Version : V2.86
*
* LICENSING TERMS:
* ---------------
*   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
* If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
* its use in your product. We provide ALL the source code for your convenience and to help you experience 
* uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
* licensing fee.
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include <ucos_ii.h>
#endif

#if OS_MBOX_EN > 0
/*
*********************************************************************************************************
*                                     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 'pevent' is a NULL pointer or,
*                            if you didn't pass the proper event pointer.
*********************************************************************************************************
*/

#if OS_MBOX_ACCEPT_EN > 0
void  *OSMboxAccept (OS_EVENT *pevent)
{
    void      *pmsg;
#if OS_CRITICAL_METHOD == 3                               /* Allocate storage for CPU status register  */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                        /* Validate 'pevent'                         */
        return ((void *)0);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {      /* Validate event block type                 */
        return ((void *)0);
    }
    OS_ENTER_CRITICAL();
    pmsg               = pevent->OSEventPtr;
    pevent->OSEventPtr = (void *)0;                       /* Clear the mailbox                         */
    OS_EXIT_CRITICAL();
    return (pmsg);                                        /* 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  : pmsg          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    : != (OS_EVENT *)0  is a pointer to the event control clock (OS_EVENT) associated with the
*                                created mailbox
*              == (OS_EVENT *)0  if no event control blocks were available
*********************************************************************************************************
*/

OS_EVENT  *OSMboxCreate (void *pmsg)
{
    OS_EVENT  *pevent;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



    if (OSIntNesting > 0) {                      /* See if called from ISR ...                         */
        return ((OS_EVENT *)0);                  /* ... can't CREATE from an ISR                       */
    }
    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->OSEventCnt     = 0;
        pevent->OSEventPtr     = pmsg;           /* Deposit message in event control block             */
#if OS_EVENT_NAME_SIZE > 1
        pevent->OSEventName[0] = '?';
        pevent->OSEventName[1] = OS_ASCII_NUL;
#endif
        OS_EventWaitListInit(pevent);
    }
    return (pevent);                             /* Return pointer to event control block              */
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                         DELETE A MAIBOX
*
* Description: This function deletes a mailbox and readies all tasks pending on the mailbox.
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired
*                            mailbox.
*
*              opt           determines delete options as follows:
*                            opt == OS_DEL_NO_PEND   Delete the mailbox ONLY if no task pending
*                            opt == OS_DEL_ALWAYS    Deletes the mailbox even if tasks are waiting.
*                                                    In this case, all the tasks pending will be readied.
*
*              perr          is a pointer to an error code that can contain one of the following values:
*                            OS_ERR_NONE             The call was successful and the mailbox was deleted
*                            OS_ERR_DEL_ISR          If you attempted to delete the mailbox from an ISR
*                            OS_ERR_INVALID_OPT      An invalid option was specified
*                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the mailbox
*                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a mailbox
*                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
*
* Returns    : pevent        upon error
*              (OS_EVENT *)0 if the mailbox was successfully deleted.
*
* Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
*                 the mailbox MUST check the return code of OSMboxPend().
*              2) OSMboxAccept() callers will not know that the intended mailbox has been deleted!
*              3) This call can potentially disable interrupts for a long time.  The interrupt disable
*                 time is directly proportional to the number of tasks waiting on the mailbox.
*              4) Because ALL tasks pending on the mailbox will be readied, you MUST be careful in
*                 applications where the mailbox is used for mutual exclusion because the resource(s)
*                 will no longer be guarded by the mailbox.
*********************************************************************************************************
*/

#if OS_MBOX_DEL_EN > 0
OS_EVENT  *OSMboxDel (OS_EVENT *pevent, INT8U opt, INT8U *perr)
{
    BOOLEAN    tasks_waiting;
    OS_EVENT  *pevent_return;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {                              /* Validate 'perr'                          */
        return (pevent);
    }
    if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
        *perr = OS_ERR_PEVENT_NULL;
        return (pevent);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {       /* Validate event block type                */
        *perr = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *perr = OS_ERR_DEL_ISR;                            /* ... can't DELETE from an ISR             */
        return (pevent);
    }
    OS_ENTER_CRITICAL();
    if (pevent->OSEventGrp != 0) {                         /* See if any tasks waiting on mailbox      */
        tasks_waiting = OS_TRUE;                           /* Yes                                      */
    } else {
        tasks_waiting = OS_FALSE;                          /* No                                       */
    }
    switch (opt) {
        case OS_DEL_NO_PEND:                               /* Delete mailbox only if no task waiting   */
             if (tasks_waiting == OS_FALSE) {
#if OS_EVENT_NAME_SIZE > 1
                 pevent->OSEventName[0] = '?';             /* Unknown name                             */
                 pevent->OSEventName[1] = OS_ASCII_NUL;
#endif
                 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
                 pevent->OSEventPtr  = OSEventFreeList;    /* Return Event Control Block to free list  */
                 pevent->OSEventCnt  = 0;
                 OSEventFreeList     = pevent;             /* Get next free event control block        */
                 OS_EXIT_CRITICAL();
                 *perr               = OS_ERR_NONE;
                 pevent_return       = (OS_EVENT *)0;      /* Mailbox has been deleted                 */
             } else {
                 OS_EXIT_CRITICAL();
                 *perr               = OS_ERR_TASK_WAITING;
                 pevent_return       = pevent;
             }
             break;

        case OS_DEL_ALWAYS:                                /* Always delete the mailbox                */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产免费一区二区三区香蕉| 成人av在线一区二区三区| 欧美在线一区二区| 亚洲一本大道在线| 欧美日产国产精品| 麻豆久久一区二区| 久久久精品国产免大香伊| 成人一二三区视频| 国产精品久久久久久久久晋中| 国产.欧美.日韩| 亚洲视频免费观看| 欧美精品电影在线播放| 日本成人在线电影网| 精品国产网站在线观看| 国产精品一区二区三区网站| 国产欧美日韩另类一区| 91麻豆精品在线观看| 无吗不卡中文字幕| 欧美电影免费观看高清完整版在| 国产经典欧美精品| 亚洲另类中文字| 欧美吞精做爰啪啪高潮| 午夜天堂影视香蕉久久| 久久网站热最新地址| 91视频91自| 亚洲va天堂va国产va久| 欧美精品一区二区久久久| caoporen国产精品视频| 亚洲一区二区精品3399| 国产精品久久福利| 日韩高清在线一区| 国产亚洲精品7777| 色综合夜色一区| 亚洲一区在线视频| 久久综合999| 91福利资源站| 国产二区国产一区在线观看| 亚洲日穴在线视频| 精品久久人人做人人爽| 91成人国产精品| 国产精品996| 日产精品久久久久久久性色| 自拍偷拍欧美激情| 亚洲精品在线网站| 这里只有精品99re| 色婷婷狠狠综合| 国产精品一级黄| 日本不卡视频一二三区| 一区二区三区久久| 国产女主播一区| 日韩精品一区在线观看| 91久久精品日日躁夜夜躁欧美| 国产成人免费高清| 精品一区二区在线播放| 亚洲成人资源网| 亚洲欧美电影院| 国产亚洲欧洲997久久综合| 7777精品久久久大香线蕉| 在线视频国内一区二区| 成人国产精品视频| 国产在线观看一区二区| 天堂蜜桃91精品| 亚洲一卡二卡三卡四卡无卡久久| 国产精品国产自产拍高清av | 国产精品一区一区| 日韩va欧美va亚洲va久久| 在线视频观看一区| 亚洲人成在线播放网站岛国| 久久久久久久综合| 成人美女视频在线观看18| 伊人色综合久久天天| 欧美久久一二三四区| 国产精品一二三区| 日韩一区在线播放| 亚洲精品在线免费播放| www.激情成人| 成人在线一区二区三区| 2024国产精品视频| 国产一区二区三区在线观看免费视频 | 欧美久久久久免费| 欧美色综合久久| 欧美在线短视频| 欧美日韩一级黄| 9191成人精品久久| 日韩一区二区三| 日韩免费高清av| 日本视频在线一区| 国产女人aaa级久久久级| 久久亚洲二区三区| 91精品国产综合久久久久久久| 国产一区视频导航| 国产精品天干天干在线综合| 波多野结衣中文一区| 日本不卡一区二区| 亚洲成人av资源| 亚洲国产视频一区二区| 亚洲日本护士毛茸茸| 国产日韩v精品一区二区| 欧美一级黄色大片| 国产一区二区三区免费看| 亚洲国产精品激情在线观看| 91黄色激情网站| 91麻豆视频网站| 在线精品视频免费播放| www.成人网.com| 视频一区在线播放| 久久一夜天堂av一区二区三区| 91蜜桃在线免费视频| 亚洲一级电影视频| 国产丝袜美腿一区二区三区| 欧美在线免费观看亚洲| 色综合天天综合网天天狠天天| 99热这里都是精品| 99久久久免费精品国产一区二区| 国产精品中文欧美| 在线一区二区三区| 精品黑人一区二区三区久久| 日韩欧美你懂的| 国产精品久久久久国产精品日日| 日韩欧美国产综合在线一区二区三区| 综合久久给合久久狠狠狠97色| 国产一区二区精品久久99| 亚洲午夜激情网页| 精彩视频一区二区| 91国偷自产一区二区开放时间 | 一本大道久久精品懂色aⅴ| 欧美精品日韩精品| 中文一区二区在线观看| 午夜国产不卡在线观看视频| 国产综合久久久久久鬼色| 欧美三级韩国三级日本三斤| 久久久亚洲精品石原莉奈| 一区二区激情视频| 床上的激情91.| 欧美一区二区三区免费视频 | bt欧美亚洲午夜电影天堂| 欧美一区二区三区日韩| 亚洲精品欧美专区| 国模少妇一区二区三区| 欧美日韩成人激情| 亚洲欧美乱综合| 成人手机在线视频| 精品日韩99亚洲| 午夜精品久久久久久久 | 精品综合久久久久久8888| 在线免费观看视频一区| 中文字幕免费不卡在线| 久久99九九99精品| 欧美精品日日鲁夜夜添| 亚洲综合成人在线视频| 91在线云播放| 国产精品伦一区| 国产成人99久久亚洲综合精品| 日韩视频免费观看高清在线视频| 亚洲sss视频在线视频| 日本电影亚洲天堂一区| 中文字幕一区二区三区视频| 国产91富婆露脸刺激对白| 丝袜美腿一区二区三区| av一区二区不卡| 国产日韩高清在线| 国产高清精品在线| 久久综合成人精品亚洲另类欧美| 麻豆久久一区二区| 精品三级在线看| 国产精品中文有码| 国产欧美日韩在线视频| 国产高清不卡一区二区| 国产日韩影视精品| 成人免费看视频| 中文字幕亚洲欧美在线不卡| av福利精品导航| 国产精品久久久久久久午夜片| 成人免费av在线| 亚洲欧美成人一区二区三区| 在线视频中文字幕一区二区| 亚洲图片欧美综合| 欧美人与禽zozo性伦| 日韩av中文字幕一区二区| 日韩女优制服丝袜电影| 国产综合色视频| 日本一区二区三区dvd视频在线| 高清不卡一区二区| 中文字幕永久在线不卡| 91久久久免费一区二区| 日韩黄色免费网站| 欧美mv日韩mv国产网站| 国产风韵犹存在线视精品| 亚洲图片另类小说| 欧美日本韩国一区二区三区视频 | 亚洲综合色网站| 91精品欧美综合在线观看最新 | 久久99精品久久久久久| 国产亚洲成年网址在线观看| 91在线丨porny丨国产| 色哟哟一区二区在线观看| 午夜精品久久久久久久99樱桃| 日韩三级免费观看| 成人综合日日夜夜| 亚洲综合色区另类av|