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

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

?? os_mbox.c

?? uc/os的多任務處理。20ms間隔
?? C
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                       MESSAGE MAILBOX MANAGEMENT
*
*                        (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
*                                           All Rights Reserved
*
*                                                  V2.00
*
* File : OS_MBOX.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.h"
#endif

#if OS_MBOX_EN
/*
*********************************************************************************************************
*                                     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 you didn't pass the proper event pointer.
*********************************************************************************************************
*/

void *OSMboxAccept (OS_EVENT *pevent)
{
    void  *msg;


    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {      /* Validate event block type                 */
        OS_EXIT_CRITICAL();
        return ((void *)0);
    }
    msg = pevent->OSEventPtr; 
    if (msg != (void *)0) {                               /* See if there is already a message         */
        pevent->OSEventPtr = (void *)0;                   /* Clear the mailbox                         */
    }
    OS_EXIT_CRITICAL();
    return (msg);                                         /* Return the message received (or NULL)     */
}
/*$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    : != (void *)0  is a pointer to the event control clock (OS_EVENT) associated with the
*                            created mailbox
*              == (void *)0  if no event control blocks were available
*********************************************************************************************************
*/

OS_EVENT *OSMboxCreate (void *msg)
{
    OS_EVENT *pevent;


    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->OSEventPtr  = msg;               /* Deposit message in event control block             */
        OSEventWaitListInit(pevent);
    }
    return (pevent);                             /* Return pointer to event control block              */
}
/*$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.
*
* Returns    : != (void *)0  is a pointer to the message received
*              == (void *)0  if no message was received or you didn't pass the proper pointer to the
*                            event control block.
*********************************************************************************************************
*/

void *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)
{
    void  *msg;


    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                     */
        OS_EXIT_CRITICAL();
        *err = OS_ERR_EVENT_TYPE;
        return ((void *)0);
    }
    msg = pevent->OSEventPtr;
    if (msg != (void *)0) {                           /* See if there is already a message             */
        pevent->OSEventPtr = (void *)0;               /* Clear the mailbox                             */
        OS_EXIT_CRITICAL();
        *err = OS_NO_ERR;
    } else if (OSIntNesting > 0) {                    /* See if called from ISR ...                    */
        OS_EXIT_CRITICAL();                           /* ... can't PEND from an ISR                    */
        *err = OS_ERR_PEND_ISR;
    } else {
        OSTCBCur->OSTCBStat |= OS_STAT_MBOX;          /* Message not available, task will pend         */
        OSTCBCur->OSTCBDly   = timeout;               /* Load timeout in TCB                           */
        OSEventTaskWait(pevent);                      /* Suspend task until event or timeout occurs    */
        OS_EXIT_CRITICAL();
        OSSched();                                    /* Find next highest priority task ready to run  */
        OS_ENTER_CRITICAL();
        if ((msg = OSTCBCur->OSTCBMsg) != (void *)0) {     /* See if we were given the message         */
            OSTCBCur->OSTCBMsg      = (void *)0;           /* Yes, clear message received              */
            OSTCBCur->OSTCBStat     = OS_STAT_RDY;
            OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;       /* No longer waiting for event              */
            OS_EXIT_CRITICAL();
            *err                    = OS_NO_ERR;
        } else if (OSTCBCur->OSTCBStat & OS_STAT_MBOX) {   /* If status is not OS_STAT_RDY, timed out  */
            OSEventTO(pevent);                             /* Make task ready                          */
            OS_EXIT_CRITICAL();
            msg                     = (void *)0;           /* Set message contents to NULL             */
            *err                    = OS_TIMEOUT;          /* Indicate that a timeout occured          */
        } else {
            msg                     = pevent->OSEventPtr;  /* Message received                         */
            pevent->OSEventPtr      = (void *)0;           /* Clear the mailbox                        */
            OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;
            OS_EXIT_CRITICAL();
            *err                    = OS_NO_ERR;
        }
    }
    return (msg);                                          /* Return the message received (or NULL)    */
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                       POST MESSAGE TO A MAILBOX
*
* Description: This function sends a message to a mailbox
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired mailbox
*
*              msg           is a pointer to the message to send.  You MUST NOT send a NULL pointer.  
*
* Returns    : OS_NO_ERR          The call was successful and the message was sent
*              OS_MBOX_FULL       If the mailbox already contains a message.  You can can only send one
*                                 message at a time and thus, the message MUST be consumed before you are
*                                 allowed to send another one.
*              OS_ERR_EVENT_TYPE  If you are attempting to post to a non mailbox.
*********************************************************************************************************
*/

INT8U OSMboxPost (OS_EVENT *pevent, void *msg)
{
    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                     */
        OS_EXIT_CRITICAL();
        return (OS_ERR_EVENT_TYPE);
    }
    if (pevent->OSEventGrp) {                         /* See if any task pending on mailbox            */
        OSEventTaskRdy(pevent, msg, OS_STAT_MBOX);    /* Ready highest priority task waiting on event  */
        //OS_EXIT_CRITICAL();
        OSSched();                                    /* Find highest priority task ready to run       */
        return (OS_NO_ERR);
    } else {
        if (pevent->OSEventPtr != (void *)0) {        /* Make sure mailbox doesn't already have a msg  */
            OS_EXIT_CRITICAL();
            return (OS_MBOX_FULL);
        } else {
            pevent->OSEventPtr = msg;                 /* Place message in mailbox                      */
            OS_EXIT_CRITICAL();
            return (OS_NO_ERR);
        }
    }
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                        QUERY A MESSAGE MAILBOX
*
* Description: This function obtains information about a message mailbox.
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired mailbox
*
*              pdata         is a pointer to a structure that will contain information about the message
*                            mailbox.
*
* Returns    : OS_NO_ERR          The call was successful and the message was sent
*              OS_ERR_EVENT_TYPE  If you are attempting to obtain data from a non mailbox.
*********************************************************************************************************
*/

INT8U OSMboxQuery (OS_EVENT *pevent, OS_MBOX_DATA *pdata)
{
    INT8U  i;
    INT8U *psrc;
    INT8U *pdest;
    
    
    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {       /* Validate event block type                */
        OS_EXIT_CRITICAL();
        return (OS_ERR_EVENT_TYPE);
    }
    pdata->OSEventGrp = pevent->OSEventGrp;                /* Copy message mailbox wait list           */
    psrc              = &pevent->OSEventTbl[0];
    pdest             = &pdata->OSEventTbl[0];
    for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
        *pdest++ = *psrc++;   
    }
    pdata->OSMsg = pevent->OSEventPtr;                     /* Get message from mailbox                 */
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩亚洲欧美高清| 91在线小视频| 精品一区二区免费看| 午夜精品aaa| 天堂蜜桃一区二区三区| 一区二区国产盗摄色噜噜| 亚洲精品成人悠悠色影视| 一区二区三区在线视频免费| 国产精品每日更新在线播放网址| 久久久久久毛片| 国产精品污www在线观看| 国产人成一区二区三区影院| 国产精品久久毛片a| 国产精品女同互慰在线看| 一区在线中文字幕| 亚洲美女屁股眼交| 午夜激情久久久| 狠狠色综合播放一区二区| 国产成人av影院| 日本国产一区二区| 欧美日韩的一区二区| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 成人国产免费视频| 国产成人自拍在线| 91色视频在线| 日韩午夜精品视频| 国产精品午夜免费| 亚洲成人你懂的| 国产精品自在欧美一区| 99国产精品久久久久久久久久| 成人免费高清在线观看| 欧美三级视频在线| 26uuu成人网一区二区三区| 国产精品不卡一区| 日韩在线一二三区| 99久久99久久精品国产片果冻| 欧美亚洲动漫精品| 精品第一国产综合精品aⅴ| 最新久久zyz资源站| 日日欢夜夜爽一区| 91女人视频在线观看| 日韩精品资源二区在线| 综合自拍亚洲综合图不卡区| 免费黄网站欧美| 91蜜桃视频在线| 国产午夜精品久久久久久久| 午夜电影一区二区三区| 91尤物视频在线观看| 久久尤物电影视频在线观看| 亚洲一区二区在线免费看| 国产电影精品久久禁18| 欧美一区在线视频| 亚洲综合成人网| 91亚洲精品一区二区乱码| 337p日本欧洲亚洲大胆精品| 天堂va蜜桃一区二区三区| 成人黄色一级视频| 久久精品视频在线看| 美女尤物国产一区| 欧美精品久久99久久在免费线 | 中文字幕在线一区免费| 另类综合日韩欧美亚洲| 欧美三级在线看| 日韩毛片在线免费观看| 成人一区二区三区视频| xnxx国产精品| 极品少妇一区二区| 欧美电视剧在线看免费| 青青草视频一区| 欧美精品自拍偷拍动漫精品| 一区二区视频在线| 成人avav影音| 国产精品国产自产拍高清av王其| 国产九色精品成人porny| 欧美成人伊人久久综合网| 日本中文一区二区三区| 欧美精品第1页| 五月天激情小说综合| 欧美日韩一区小说| 亚洲午夜电影在线| 8v天堂国产在线一区二区| 日韩精品午夜视频| 精品三级在线观看| 狠狠色伊人亚洲综合成人| 久久久国产精品午夜一区ai换脸| 国产乱一区二区| 国产精品福利一区二区三区| av电影一区二区| 一区二区三区精密机械公司| 欧美日韩激情在线| 免费在线观看不卡| 国产视频一区在线播放| 91亚洲国产成人精品一区二三| 一区二区三国产精华液| 欧美日韩精品一二三区| 狠狠色狠狠色综合日日91app| 国产欧美综合色| 色乱码一区二区三区88| 青娱乐精品视频在线| 国产无人区一区二区三区| 色综合天天综合给合国产| 午夜天堂影视香蕉久久| 欧美sm极限捆绑bd| 91在线国产福利| 2014亚洲片线观看视频免费| 亚洲国产精品自拍| 欧美精品久久99| 国产成人综合在线| 亚洲精品国产精品乱码不99| 国产.精品.日韩.另类.中文.在线.播放| 91女厕偷拍女厕偷拍高清| 一区二区三区蜜桃网| 99麻豆久久久国产精品免费| 国产精品不卡在线| 91在线国产福利| 亚洲成人动漫在线观看| 精品播放一区二区| 国模大尺度一区二区三区| 一区二区成人在线| 日本道免费精品一区二区三区| 欧美va在线播放| 欧美在线影院一区二区| 美女视频黄久久| 亚洲欧美日韩国产一区二区三区| 日韩欧美一区在线观看| 99久久国产综合精品女不卡| 麻豆高清免费国产一区| 亚洲视频综合在线| 国产欧美精品一区二区色综合朱莉| 欧美三片在线视频观看| 99久久精品免费看| 国产一区二区三区香蕉| 亚洲一区二区视频| 亚洲色图.com| 中文字幕中文字幕一区二区| 26uuu国产电影一区二区| 欧美福利电影网| 在线免费一区三区| 91丨porny丨在线| 成人免费毛片app| 国产尤物一区二区在线| 蜜臀av性久久久久蜜臀av麻豆| 一区二区三区电影在线播| 亚洲天堂网中文字| 国产精品久久久久久久久动漫| 国产欧美日韩另类一区| 久久青草国产手机看片福利盒子 | 亚洲一区二区在线观看视频| 国产精品五月天| 国产精品久久久久久久午夜片| 国产亚洲一区二区三区四区| 精品国产91乱码一区二区三区| 91精品国产高清一区二区三区蜜臀 | 亚洲美女视频在线| 国产精品久久毛片a| 国产精品网站在线观看| 国产女主播一区| 国产精品高清亚洲| 亚洲欧洲精品一区二区精品久久久| 日韩一区二区精品| 精品成a人在线观看| 久久久国产一区二区三区四区小说 | 国产亚洲综合色| 2019国产精品| 欧美经典一区二区| 久久久99精品免费观看| 久久久蜜桃精品| 国产精品家庭影院| 一二三四区精品视频| 亚洲成人资源网| 欧美一区二区三区喷汁尤物| 国产精品久久午夜| 九色综合狠狠综合久久| 成人app在线观看| 欧美日韩视频在线第一区| 一区二区三区 在线观看视频 | 色婷婷亚洲综合| 在线看一区二区| 欧美一二三四在线| 精品国产伦一区二区三区观看方式| 久久久久久毛片| 亚洲免费电影在线| 日本在线播放一区二区三区| 精品一区二区三区香蕉蜜桃| 国产激情一区二区三区| 国产.欧美.日韩| 欧美日韩黄色影视| 久久伊人蜜桃av一区二区| 国产精品久线观看视频| 亚洲综合另类小说| 九九九精品视频| 欧洲av一区二区嗯嗯嗯啊| 精品国产污网站| 国产欧美日韩三级| 欧美三级电影在线观看| 欧美国产1区2区| 偷窥少妇高潮呻吟av久久免费| 国产一区999| 91精品国产综合久久久久久漫画| 国产精品拍天天在线|