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

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

?? os_mbox.c

?? st arm7中的71x中部分功能源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
*********************************************************************************************************
*                                                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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产69精品久久久久毛片| 久久99久久精品| 亚洲图片一区二区| 日韩高清一级片| 久久精品国产免费| 欧美国产精品v| 国产**成人网毛片九色| 一区二区三区在线高清| 亚洲一区二区三区免费视频| 亚洲另类春色国产| 久久国产福利国产秒拍| 成人免费视频国产在线观看| 91免费版在线| 日韩欧美亚洲一区二区| 国产精品久久久久久久久免费丝袜| 欧美国产精品专区| 欧美aaaaa成人免费观看视频| 国产美女久久久久| 欧美一区二区三区喷汁尤物| 国产精品麻豆欧美日韩ww| 五月天丁香久久| 91麻豆免费视频| 久久亚洲精华国产精华液| 亚洲综合色视频| 成人午夜激情片| 亚洲精品一区在线观看| 日韩在线a电影| 在线中文字幕一区二区| 国产精品国产三级国产aⅴ原创| 久久精品国产**网站演员| 91久久精品国产91性色tv| 国产精品久久久爽爽爽麻豆色哟哟| 久久精品国产99国产精品| 制服丝袜亚洲网站| 午夜久久福利影院| 69成人精品免费视频| 亚洲一区成人在线| 欧美日韩第一区日日骚| 亚洲免费高清视频在线| 色婷婷av一区二区三区gif| 亚洲图片激情小说| 一本久久a久久精品亚洲| 成人欧美一区二区三区视频网页| 成人一区二区三区视频在线观看| 精品日韩一区二区三区免费视频| 奇米影视7777精品一区二区| 日韩免费高清av| 国产精品一色哟哟哟| 国产精品久久久久久久久晋中| 成人午夜看片网址| 亚洲一级电影视频| 欧美成人官网二区| av色综合久久天堂av综合| 亚洲一卡二卡三卡四卡五卡| 51精品久久久久久久蜜臀| 国内一区二区视频| 一区精品在线播放| 777欧美精品| 91在线视频观看| 强制捆绑调教一区二区| 成人欧美一区二区三区黑人麻豆| 欧美日韩国产免费一区二区| 国产a级毛片一区| 日韩激情一区二区| 亚洲欧洲一区二区三区| 91精品国产高清一区二区三区蜜臀| 国产一区二区毛片| 午夜成人免费电影| 亚洲乱码国产乱码精品精98午夜| 欧美一区二区三区在线观看| 91在线免费播放| 成人一区二区视频| 国产高清亚洲一区| 久久精品国产网站| 日本vs亚洲vs韩国一区三区 | 欧美激情一区在线| 欧美一区二区视频在线观看2020 | 国产欧美日产一区| 欧美精品一区二区三区蜜臀| 91精选在线观看| 欧美美女网站色| 欧美精品九九99久久| 日本乱人伦aⅴ精品| 色婷婷综合久久久久中文一区二区| 韩国三级电影一区二区| 狠狠狠色丁香婷婷综合久久五月| 午夜精品在线看| 免费在线看成人av| 久久精品噜噜噜成人av农村| 开心九九激情九九欧美日韩精美视频电影 | 亚洲精品国产无天堂网2021| 中文字幕一区二区三区av| 一区二区三区久久久| 男人的天堂久久精品| 久草中文综合在线| 97久久精品人人做人人爽50路| 一本色道久久综合精品竹菊| 7878成人国产在线观看| 久久久久国产精品厨房| 综合欧美亚洲日本| 日韩专区欧美专区| 成人一级视频在线观看| 欧美日精品一区视频| 久久综合九色综合欧美就去吻 | 国产精品一区二区黑丝| 久久精品视频免费| 波多野结衣欧美| 色综合天天综合网国产成人综合天| 在线影院国内精品| 2020日本不卡一区二区视频| 最新高清无码专区| 国产精品伊人色| 91精品国产美女浴室洗澡无遮挡| 中文字幕一区av| 国产精品123| 日韩久久精品一区| 三级一区在线视频先锋| 在线免费观看日本一区| 欧美激情一区三区| 国产一区 二区 三区一级| 欧美二区乱c少妇| 亚洲国产日产av| 欧美日韩在线观看一区二区| 自拍偷拍亚洲欧美日韩| 成人一二三区视频| 国产日韩av一区二区| 精品综合免费视频观看| 精品国产青草久久久久福利| 日本不卡在线视频| 欧美成人在线直播| 色婷婷精品大在线视频| 中文字幕亚洲区| 一本到高清视频免费精品| 亚洲精品久久嫩草网站秘色| 成人高清伦理免费影院在线观看| 国产午夜精品理论片a级大结局| 国产高清久久久久| 亚洲欧洲日本在线| 色成年激情久久综合| 亚洲制服丝袜一区| 精品久久99ma| 99久久精品情趣| 午夜国产精品一区| 久久影院午夜片一区| 91丨九色丨蝌蚪富婆spa| 日韩精品免费专区| 久久久99精品免费观看不卡| 色综合网色综合| 日本中文在线一区| 麻豆91在线看| 一区二区高清免费观看影视大全| 欧美美女一区二区| 成人国产精品免费观看| 免费成人美女在线观看| 国产精品素人一区二区| 日韩一区二区三区av| av一本久道久久综合久久鬼色| 美日韩黄色大片| 亚洲成a天堂v人片| 18欧美亚洲精品| 久久久久久久久久久黄色| 91精品国产一区二区三区蜜臀| www.欧美日韩国产在线| 美腿丝袜亚洲综合| 日本午夜精品一区二区三区电影| 中文字幕日韩av资源站| 国产精品视频看| 国产校园另类小说区| 日韩精品在线看片z| 制服丝袜国产精品| 91精品国产色综合久久不卡蜜臀| 欧美艳星brazzers| 在线精品视频免费观看| 成人黄动漫网站免费app| 99免费精品视频| 97久久精品人人做人人爽| 色综合天天性综合| 色就色 综合激情| 欧美三级欧美一级| 精品久久久久久久久久久院品网| 欧美一级欧美三级| 欧美国产日产图区| 一区二区在线观看免费| 亚洲国产精品麻豆| 蜜乳av一区二区三区| 国产精品自拍在线| 色综合久久久久网| 91麻豆精品国产91久久久资源速度 | 精品欧美一区二区久久| 久久亚洲精品国产精品紫薇| 国产精品女主播在线观看| 亚洲网友自拍偷拍| 国产不卡视频在线播放| 日本韩国精品在线| 久久欧美一区二区| 夜夜揉揉日日人人青青一国产精品| 麻豆精品在线观看| 色美美综合视频| 国产视频一区二区在线| 秋霞午夜av一区二区三区|