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

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

?? os_mbox.c

?? 開(kāi)發(fā)環(huán)境為ADS1.2,LPC2114帶UCOS的IIC程序
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                       MESSAGE MAILBOX MANAGEMENT
*
*                          (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_MBOX.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.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)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    void      *msg;


#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                        /* Validate 'pevent'                         */
        return ((void *)0);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {      /* Validate event block type                 */
        return ((void *)0);
    }
#endif
    OS_ENTER_CRITICAL();
    msg                = pevent->OSEventPtr;
    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    : != (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 *msg)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    OS_EVENT  *pevent;


    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  = msg;               /* Deposit message in event control block             */
        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.
*
*              err           is a pointer to an error code that can contain one of the following values:
*                            OS_NO_ERR               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 *err)
{
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;
#endif    
    BOOLEAN    tasks_waiting;


    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return (pevent);
    }
#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
        *err = OS_ERR_PEVENT_NULL;
        return (pevent);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {       /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
#endif
    OS_ENTER_CRITICAL();
    if (pevent->OSEventGrp != 0x00) {                      /* See if any tasks waiting on mailbox      */
        tasks_waiting = TRUE;                              /* Yes                                      */
    } else {
        tasks_waiting = FALSE;                             /* No                                       */
    }
    switch (opt) {
        case OS_DEL_NO_PEND:                               /* Delete mailbox only if no task waiting   */
             if (tasks_waiting == FALSE) {
                 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
                 pevent->OSEventPtr  = OSEventFreeList;    /* Return Event Control Block to free list  */
                 OSEventFreeList     = pevent;             /* Get next free event control block        */
                 OS_EXIT_CRITICAL();
                 *err = OS_NO_ERR;
                 return ((OS_EVENT *)0);                   /* Mailbox has been deleted                 */
             } else {
                 OS_EXIT_CRITICAL();
                 *err = OS_ERR_TASK_WAITING;
                 return (pevent);
             }

        case OS_DEL_ALWAYS:                                /* Always delete the mailbox                */
             while (pevent->OSEventGrp != 0x00) {          /* Ready ALL tasks waiting for mailbox      */
                 OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX);
             }
             pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
             pevent->OSEventPtr  = OSEventFreeList;        /* Return Event Control Block to free list  */
             OSEventFreeList     = pevent;                 /* Get next free event control block        */
             OS_EXIT_CRITICAL();
             if (tasks_waiting == TRUE) {                  /* Reschedule only if task(s) were waiting  */
                 OS_Sched();                               /* Find highest priority task ready to run  */
             }
             *err = OS_NO_ERR;
             return ((OS_EVENT *)0);                       /* Mailbox has been deleted                 */

        default:
             OS_EXIT_CRITICAL();
             *err = OS_ERR_INVALID_OPT;
             return (pevent);
    }
}
#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.
*                            OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer
*
* Returns    : != (void *)0  is a pointer to the message received
*              == (void *)0  if no message was received or,
*                            if 'pevent' is a NULL pointer or,
*                            if you didn't pass the proper pointer to the event control block.
*********************************************************************************************************
*/

void  *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    void      *msg;


    if (OSIntNesting > 0) {                           /* See if called from ISR ...                    */
        *err = OS_ERR_PEND_ISR;                       /* ... can't PEND from an ISR                    */

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品一区二区| 国产精品女人毛片| 午夜精品爽啪视频| 欧美日韩精品欧美日韩精品| 一区二区三区波多野结衣在线观看| 成人午夜电影网站| 亚洲视频免费观看| 欧美色老头old∨ideo| 午夜av一区二区三区| 欧美一个色资源| 老司机免费视频一区二区| 精品卡一卡二卡三卡四在线| 国产在线精品不卡| 亚洲视频资源在线| 欧美日韩免费高清一区色橹橹| 亚洲一区在线观看免费观看电影高清 | 成人午夜精品在线| 亚洲丝袜精品丝袜在线| 欧美亚洲综合在线| 久久99国内精品| 亚洲欧美在线aaa| 欧美性大战久久久| 国产一区二区三区香蕉| 国产精品电影一区二区三区| 欧美视频完全免费看| 精品一区二区久久| 亚洲天堂a在线| 日韩精品在线看片z| 成人免费视频网站在线观看| 亚洲一区二区视频在线| 亚洲精品在线免费观看视频| 91亚洲国产成人精品一区二区三| 日韩中文字幕91| 国产精品理论片| 欧美日韩国产精选| 亚洲第一激情av| 国产欧美日韩激情| 欧美精品在线一区二区| 成人avav影音| 蜜臀av国产精品久久久久| 国产精品超碰97尤物18| 欧美成人一区二区三区在线观看| 成人爽a毛片一区二区免费| 五月天久久比比资源色| 亚洲欧洲av在线| 精品剧情在线观看| 欧美伦理电影网| 北条麻妃一区二区三区| 激情深爱一区二区| 午夜视频一区二区三区| 国产精品视频九色porn| 精品久久久久久无| 欧美视频在线观看一区| 99v久久综合狠狠综合久久| 狠狠久久亚洲欧美| 美国三级日本三级久久99| 亚洲一区二区三区在线看| 中文字幕在线不卡国产视频| 国产午夜精品美女毛片视频| 69精品人人人人| 欧美日韩在线亚洲一区蜜芽| 91影院在线观看| 国产高清精品久久久久| 精品一区二区日韩| 免费在线欧美视频| 亚洲观看高清完整版在线观看| 最新国产成人在线观看| 国产欧美中文在线| www一区二区| 精品久久久久久久久久久久久久久久久| 欧美日韩精品高清| 欧美性猛交xxxx乱大交退制版| 91网页版在线| 99久久精品情趣| 97超碰欧美中文字幕| www.亚洲精品| 97久久久精品综合88久久| jlzzjlzz亚洲女人18| 国产成人免费xxxxxxxx| 国产精品 欧美精品| 国产精品18久久久久久久久久久久| 激情五月激情综合网| 国产一区二区影院| 国产东北露脸精品视频| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 免费精品视频最新在线| 图片区小说区国产精品视频| 香蕉影视欧美成人| 日韩vs国产vs欧美| 激情综合色丁香一区二区| 极品美女销魂一区二区三区| 国模大尺度一区二区三区| 国产精品原创巨作av| 成人免费视频caoporn| av成人老司机| 欧美日韩日日骚| 日韩欧美国产一区二区三区 | 2022国产精品视频| 国产欧美日韩精品a在线观看| 中文子幕无线码一区tr| 亚洲精品乱码久久久久久| 亚洲小说欧美激情另类| 日韩和欧美一区二区三区| 久久成人av少妇免费| 国产不卡在线一区| 91免费版pro下载短视频| 欧美日韩一二区| 26uuu亚洲综合色欧美| 欧美韩国日本一区| 亚洲国产精品久久久久婷婷884| 日韩高清在线电影| 粉嫩嫩av羞羞动漫久久久| 91久久人澡人人添人人爽欧美| 欧美剧在线免费观看网站| 精品国产乱码久久久久久浪潮| 欧美激情艳妇裸体舞| 成人av在线网站| 欧美一a一片一级一片| 精品免费国产二区三区| 一色桃子久久精品亚洲| 亚洲成a人在线观看| 国产成人av福利| 欧美中文字幕一区二区三区亚洲| 日韩欧美精品在线视频| 成人欧美一区二区三区黑人麻豆| 日韩综合一区二区| 97se狠狠狠综合亚洲狠狠| 91精品国产欧美日韩| 成人免费在线视频观看| 激情久久五月天| 色激情天天射综合网| 亚洲精品一区二区三区在线观看| 亚洲女女做受ⅹxx高潮| 国内精品伊人久久久久av一坑| 日本韩国视频一区二区| 精品久久久久久综合日本欧美| 亚洲国产精品久久一线不卡| 岛国一区二区三区| 日韩一级免费观看| 亚洲激情中文1区| 国产精品资源在线观看| 在线观看91精品国产麻豆| 一区免费观看视频| 国产麻豆一精品一av一免费| 欧美男生操女生| 一区二区三区在线视频免费观看| 国产一区二区三区蝌蚪| 欧美一区二区三区四区高清 | 国产日本欧洲亚洲| 免费成人在线影院| 欧美三级一区二区| 亚洲精品视频观看| 99久久综合精品| 国产亚洲欧美日韩在线一区| 美女在线视频一区| 欧美日韩精品一二三区| 亚洲一区二区三区三| 91麻豆精品一区二区三区| 中文字幕乱码一区二区免费| 国产福利精品导航| 久久午夜免费电影| 国内精品视频666| 精品国产99国产精品| 久久99日本精品| 日韩欧美激情在线| 麻豆精品在线视频| 欧美岛国在线观看| 狠狠色狠狠色综合| 久久综合九色欧美综合狠狠| 久久99蜜桃精品| 精品国产免费一区二区三区四区| 欧美午夜视频网站| 亚洲一区二区影院| 91.xcao| 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美一区二区免费观在线| 丝袜亚洲另类欧美| 日韩欧美黄色影院| 久草精品在线观看| 国产午夜精品久久| 99精品视频在线观看| 一区二区欧美精品| 911国产精品| 九九视频精品免费| 国产亚洲精品久| 91在线观看高清| 亚洲电影视频在线| 日韩午夜激情av| 国产又黄又大久久| 欧美国产日韩一二三区| 99国产精品99久久久久久| 亚洲国产精品一区二区尤物区| 5566中文字幕一区二区电影| 激情深爱一区二区| 国产精品久久久久久久岛一牛影视 | av爱爱亚洲一区| 一区二区三区在线观看网站| 91精品午夜视频| 国产高清在线观看免费不卡| 亚洲免费在线播放|