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

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

?? os_mbox.c

?? iar環境下移植ucos-ii到at91sam7s64
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                       MESSAGE MAILBOX MANAGEMENT
*
*                          (c) Copyright 1992-2006, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_MBOX.C
* By      : Jean J. Labrosse
* Version : V2.83
*********************************************************************************************************
*/

#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 = 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();
    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 = 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     = 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;
    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 (err == (INT8U *)0) {                               /* Validate 'err'                           */
        return (pevent);
    }
    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);
    }
    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = 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();
                 *err                = OS_NO_ERR;
                 pevent_return       = (OS_EVENT *)0;      /* Mailbox has been deleted                 */
             } else {
                 OS_EXIT_CRITICAL();
                 *err                = OS_ERR_TASK_WAITING;
                 pevent_return       = pevent;
             }
             break;

        case OS_DEL_ALWAYS:                                /* Always delete the mailbox                */
             while (pevent->OSEventGrp != 0) {             /* 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 == OS_TRUE) {               /* Reschedule only if task(s) were waiting  */
                 OS_Sched();                               /* Find highest priority task ready to run  */
             }
             *err          = OS_NO_ERR;
             pevent_return = (OS_EVENT *)0;                /* Mailbox has been deleted                 */
             break;

        default:
             OS_EXIT_CRITICAL();
             *err          = OS_ERR_INVALID_OPT;
             pevent_return = pevent;
             break;
    }
    return (pevent_return);
}
#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.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91视视频在线直接观看在线看网页在线看 | 国产精品每日更新| 一区二区三区在线影院| 精品一区二区精品| 色综合 综合色| 精品对白一区国产伦| 亚洲午夜精品在线| 99免费精品视频| 精品国产乱码久久久久久1区2区 | 午夜精品一区在线观看| 丁香五精品蜜臀久久久久99网站| 欧美日韩久久不卡| 亚洲精品乱码久久久久久黑人| 国产精品中文字幕一区二区三区| 欧美人成免费网站| 亚洲午夜在线视频| 日韩一级二级三级精品视频| 激情综合亚洲精品| 日韩精品电影在线| 这里只有精品免费| av在线这里只有精品| 一个色综合网站| 久久精品亚洲国产奇米99| 久久精品国产成人一区二区三区| 国产拍欧美日韩视频二区| 色综合天天性综合| 色综合一个色综合亚洲| 国产精品主播直播| 日韩欧美精品在线视频| 午夜久久久影院| 欧美日韩精品免费观看视频| 亚洲免费av在线| 色婷婷精品大视频在线蜜桃视频| 国产精品欧美一区喷水| 国产91丝袜在线播放| 国产日韩欧美一区二区三区乱码| 久99久精品视频免费观看| 精品福利一二区| 国产伦精品一区二区三区免费迷 | 在线观看三级视频欧美| 一区二区三区电影在线播| 色欧美日韩亚洲| 亚洲午夜久久久久| 91精品久久久久久久91蜜桃| 丝袜亚洲另类欧美| 日韩三级精品电影久久久 | 不卡一区二区在线| 亚洲女子a中天字幕| 色婷婷精品久久二区二区蜜臂av | 欧美色电影在线| 五月天欧美精品| 欧美一级午夜免费电影| 国产在线视视频有精品| 日本一区二区免费在线观看视频| 成人国产视频在线观看| 亚洲美女电影在线| 91超碰这里只有精品国产| 国产自产视频一区二区三区| 国产区在线观看成人精品| 91视频91自| 亚洲国产精品自拍| 久久综合九色综合97_久久久 | 日韩av在线免费观看不卡| 成人毛片视频在线观看| 日韩欧美资源站| 亚洲国产精品ⅴa在线观看| 国产精品免费aⅴ片在线观看| 亚洲激情图片一区| 青青草国产成人av片免费| 国产精品一区免费在线观看| 91久久线看在观草草青青 | 久久久久久影视| 日韩成人精品在线观看| 久久综合九色综合久久久精品综合| 国产91富婆露脸刺激对白| 亚洲专区一二三| 国产香蕉久久精品综合网| 欧美最猛黑人xxxxx猛交| 国产乱妇无码大片在线观看| 亚洲精选视频在线| 日韩精品一区在线观看| 日本乱人伦aⅴ精品| 韩国v欧美v日本v亚洲v| 亚洲影视在线播放| 中文字幕中文乱码欧美一区二区| 91.麻豆视频| 色婷婷一区二区| 国产98色在线|日韩| 奇米影视一区二区三区| 亚洲欧美日韩国产另类专区| 精品对白一区国产伦| 欧美日韩国产经典色站一区二区三区 | 欧美日韩免费观看一区二区三区| 高清成人免费视频| 日韩一区精品字幕| 亚洲综合激情另类小说区| 国产欧美日韩卡一| 精品少妇一区二区三区在线视频| 欧美日韩一区二区三区在线| 99久久久久久| 成人免费看片app下载| 麻豆精品新av中文字幕| 日韩成人午夜精品| 午夜不卡在线视频| 亚洲一区在线免费观看| 中文字幕一区在线观看视频| 国产日韩欧美精品综合| 2023国产精品| 2020国产精品自拍| www日韩大片| 亚洲精品一线二线三线| 精品国产1区二区| 欧美r级在线观看| 欧美成人伊人久久综合网| 555www色欧美视频| 欧美一区二区福利视频| 911精品产国品一二三产区| 欧美久久一二三四区| 欧美日韩在线亚洲一区蜜芽| 欧美日韩一区二区三区不卡| 欧美亚洲国产一区二区三区| 欧美在线免费播放| 欧美日韩久久一区| 91精品国产综合久久精品| 日韩亚洲欧美在线| 精品国产乱码久久久久久图片| 欧美成人欧美edvon| 精品国产髙清在线看国产毛片| 精品久久久久久最新网址| 久久久久久久久久久黄色| 久久久久久久久久久久久久久99 | 欧美日韩激情一区| 3d动漫精品啪啪1区2区免费| 欧美一区二区三区免费大片| 欧美mv日韩mv| 国产精品丝袜在线| 亚洲欧美另类综合偷拍| 亚洲线精品一区二区三区| 免费成人在线影院| 国产98色在线|日韩| 色一情一乱一乱一91av| 7777精品伊人久久久大香线蕉最新版 | 精品国产乱码久久久久久闺蜜| 国产午夜亚洲精品午夜鲁丝片| 1024成人网| 麻豆国产欧美日韩综合精品二区| 国内成人免费视频| 91蜜桃网址入口| 91精品午夜视频| 国产三级久久久| 亚洲一区日韩精品中文字幕| 奇米影视一区二区三区| 成人丝袜18视频在线观看| 欧美日韩日本视频| 国产精品色哟哟网站| 午夜电影久久久| 成人美女在线视频| 91精品国产品国语在线不卡| 国产精品久久久久久久浪潮网站 | 亚洲人xxxx| 麻豆国产精品一区二区三区 | 日韩一区欧美一区| 日韩不卡一区二区三区| 99国产精品国产精品久久| 91精品国产aⅴ一区二区| 中文字幕在线一区二区三区| 奇米色777欧美一区二区| 91免费观看视频| 国产欧美综合在线观看第十页| 亚洲一区二区三区不卡国产欧美 | 一本色道**综合亚洲精品蜜桃冫| 欧美第一区第二区| 伊人一区二区三区| 成人免费观看男女羞羞视频| 日韩女优制服丝袜电影| 一区二区三区四区不卡在线| 国产.欧美.日韩| 日韩精品中文字幕在线不卡尤物| 一区二区三区中文免费| 成人午夜视频在线观看| 久久久亚洲午夜电影| 美国十次了思思久久精品导航| 在线免费观看日本一区| 亚洲欧洲www| 高清不卡在线观看| 久久九九99视频| 精品在线观看视频| 欧美电影免费观看高清完整版| 亚洲18女电影在线观看| 欧美影片第一页| 樱花影视一区二区| 色婷婷一区二区三区四区| 中文字幕亚洲综合久久菠萝蜜| 国产精品66部| 久久久噜噜噜久久中文字幕色伊伊 | 成人欧美一区二区三区1314| 国产成人av影院| 中文字幕欧美日本乱码一线二线| 国内外成人在线| 久久久久久久久久久久久夜|