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

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

?? os_mbox.c

?? ucosii-2.76 ucosii 的源代碼
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                       MESSAGE MAILBOX MANAGEMENT
*
*                          (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_MBOX.C
* By      : Jean J. Labrosse
* Version : V2.76
*********************************************************************************************************
*/

#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      *msg;
#if OS_CRITICAL_METHOD == 3                               /* Allocate storage for CPU status register  */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                           /* Prevent compiler warning                  */
#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();
    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)
{
    OS_EVENT  *pevent;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#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     = msg;            /* 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.
*
*              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)
{
    BOOLEAN    tasks_waiting;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                            /* Prevent compiler warning                 */
#endif    
    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);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {       /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
    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) {
#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();
                 *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      */
                 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX);
             }
#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();
             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)
{
    void      *msg;
#if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
    OS_CPU_SR  cpu_sr;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲少妇30p| 高清av一区二区| 日韩精品成人一区二区在线| 亚洲女同一区二区| 亚洲人精品午夜| 一区二区三区视频在线看| 亚洲同性同志一二三专区| 亚洲欧洲日本在线| 亚洲蜜臀av乱码久久精品蜜桃| 《视频一区视频二区| 白白色亚洲国产精品| 成人黄色软件下载| 色成人在线视频| 欧美亚洲愉拍一区二区| 欧美日韩国产精品成人| 3atv在线一区二区三区| 欧美一二三在线| 久久久噜噜噜久久人人看| 国产精品免费人成网站| 亚洲久草在线视频| 午夜视频久久久久久| 免费不卡在线观看| 国产成人亚洲综合色影视| www.日韩大片| 欧美日韩你懂得| 精品sm捆绑视频| ...av二区三区久久精品| 亚洲午夜日本在线观看| 热久久免费视频| 粉嫩av一区二区三区在线播放 | 久久成人免费电影| 高清国产一区二区| 欧美在线影院一区二区| 日韩欧美一级特黄在线播放| 欧美极品少妇xxxxⅹ高跟鞋 | 波多野结衣一区二区三区 | 一区二区三区四区中文字幕| 亚洲地区一二三色| 国模冰冰炮一区二区| av成人老司机| 日韩一区二区精品葵司在线| 中文字幕精品三区| 亚洲va欧美va人人爽| 国产一区三区三区| 91福利视频久久久久| 日韩免费视频线观看| 亚洲色欲色欲www| 蜜臀精品一区二区三区在线观看 | 欧美吞精做爰啪啪高潮| 久久人人爽人人爽| 亚洲精品伦理在线| 久久99日本精品| 色婷婷久久综合| 久久久综合精品| 亚洲va欧美va天堂v国产综合| 国产成a人无v码亚洲福利| 欧美欧美欧美欧美首页| 成人免费在线播放视频| 麻豆国产精品官网| 精品视频1区2区| 中文字幕日本不卡| 国内欧美视频一区二区| 欧美日韩一区二区在线观看| 国产精品久久久久婷婷| 麻豆国产欧美日韩综合精品二区| 色猫猫国产区一区二在线视频| 日韩国产精品大片| 色综合久久天天| 欧美精品一区二区三区蜜臀| 丝瓜av网站精品一区二区| 99re热视频精品| 国产日韩欧美一区二区三区综合| 免费精品99久久国产综合精品| 色先锋资源久久综合| 国产欧美一区二区三区鸳鸯浴| 麻豆专区一区二区三区四区五区| 欧美午夜免费电影| 自拍偷自拍亚洲精品播放| 国内精品写真在线观看| 日韩一级黄色片| 亚洲成人动漫av| 91国偷自产一区二区开放时间| 中文字幕 久热精品 视频在线 | 欧洲亚洲国产日韩| 一区在线观看视频| 成人精品视频一区二区三区 | 亚洲一区二区三区中文字幕| 成人手机电影网| 国产亚洲一区字幕| 国产麻豆9l精品三级站| 精品黑人一区二区三区久久| 青青草国产精品97视觉盛宴| 精品视频1区2区| 香蕉久久一区二区不卡无毒影院| 欧美在线免费观看视频| 亚洲影院在线观看| 91国偷自产一区二区开放时间| 亚洲另类色综合网站| 91黄视频在线观看| 亚洲制服丝袜av| 欧美体内she精视频| 亚洲妇熟xx妇色黄| 在线播放亚洲一区| 秋霞国产午夜精品免费视频| 91精品久久久久久蜜臀| 日韩国产精品91| 欧美成人在线直播| 国产精选一区二区三区| 国产欧美日韩精品一区| 国产99一区视频免费| 亚洲欧洲日韩综合一区二区| 色诱亚洲精品久久久久久| 亚洲国产成人av网| 欧美一区二区三区在线看| 久久99精品一区二区三区| 久久综合999| jlzzjlzz亚洲女人18| 亚洲人被黑人高潮完整版| 欧美日韩精品是欧美日韩精品| 日韩成人一级大片| 精品国产区一区| 99久久精品免费| 亚洲国产精品人人做人人爽| 欧美一区二区在线看| 国产一区二区免费视频| 国产精品美女久久久久久2018 | 欧美极品aⅴ影院| 91亚洲国产成人精品一区二三| 亚洲欧美日韩综合aⅴ视频| 欧美日韩黄色影视| 精久久久久久久久久久| 国产精品美女视频| 欧美日韩亚洲高清一区二区| 麻豆精品在线播放| 国产精品日韩精品欧美在线| 色婷婷国产精品| 欧美一区二区视频在线观看| 国产一区二区三区久久久| 亚洲视频一区在线| 日韩欧美中文字幕公布| 岛国av在线一区| 亚洲国产成人av好男人在线观看| 精品国产免费久久| 一本色道久久综合亚洲91| 美女视频免费一区| ㊣最新国产の精品bt伙计久久| 欧美调教femdomvk| 国产成人免费视频一区| 亚洲成人1区2区| 久久久国产精品不卡| 欧美亚洲一区二区在线| 国产精品99久久久| 午夜成人免费电影| 国产精品理伦片| 日韩精品一区二区三区在线观看| av在线不卡电影| 免费成人在线观看视频| 尤物av一区二区| 日本一区二区三区四区在线视频| 欧美日韩国产片| 99精品在线观看视频| 精品亚洲成a人| 亚洲国产婷婷综合在线精品| 国产三级精品在线| 日韩午夜小视频| 在线亚洲一区二区| 国产99一区视频免费| 久久精品国产成人一区二区三区 | 亚洲高清一区二区三区| 欧美国产日韩在线观看| 日韩一区国产二区欧美三区| 色婷婷精品大在线视频| 福利视频网站一区二区三区| 日本在线不卡一区| 一区二区高清在线| 亚洲天堂网中文字| 国产三级精品三级| 精品国产91乱码一区二区三区| 欧洲亚洲精品在线| 99综合电影在线视频| 国产精品中文字幕欧美| 蜜臀a∨国产成人精品| 亚洲国产精品自拍| 亚洲欧美aⅴ...| 日韩美女久久久| 国产欧美日韩卡一| 久久久精品免费免费| 精品国产乱码久久久久久久 | 中文字幕在线一区| 久久精品男人的天堂| 精品国产sm最大网站免费看| 欧美一卡二卡三卡四卡| 欧美另类z0zxhd电影| 欧美日韩一区在线| 欧美色视频在线| 欧洲一区二区三区在线| 欧美在线一区二区三区| 在线观看欧美日本| 欧美午夜一区二区三区免费大片| 日本福利一区二区|