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

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

?? os_mbox.c

?? ucos-II在S3C44BO下的移植
?? 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一区二区三区免费野_久草精品视频
国产欧美一区二区在线观看| 亚洲电影在线免费观看| 一区二区三区av电影| 欧美精品1区2区3区| 天堂资源在线中文精品| 国产一区美女在线| 久久男人中文字幕资源站| 国产亚洲欧美激情| 亚洲乱码日产精品bd| 国产乱码精品1区2区3区| 色系网站成人免费| 欧美激情一区二区三区在线| 亚洲成人www| 成人不卡免费av| 欧美一三区三区四区免费在线看| 国产精品久久久久桃色tv| 奇米精品一区二区三区四区| 91美女片黄在线观看91美女| 精品国产欧美一区二区| 久久超碰97中文字幕| 欧美无人高清视频在线观看| 国产女人18水真多18精品一级做| 天堂蜜桃一区二区三区| 91欧美激情一区二区三区成人| 26uuu国产在线精品一区二区| 美女国产一区二区三区| 91精品久久久久久久久99蜜臂| 亚洲综合在线观看视频| gogogo免费视频观看亚洲一| 国产三级一区二区| 国产在线视频一区二区| 日韩精品一区二区三区中文不卡| 麻豆国产精品视频| 精品三级在线看| 精品一区二区三区在线播放视频 | 欧美区在线观看| 午夜视频一区在线观看| 91精品国产综合久久精品麻豆 | 国产一区欧美日韩| 国产人成亚洲第一网站在线播放 | 国产最新精品免费| 精品一区二区三区在线播放视频 | 成人av网址在线观看| 亚洲国产精品二十页| 成人激情动漫在线观看| 成人欧美一区二区三区视频网页| 91免费视频大全| 亚洲综合图片区| 欧美日韩高清一区二区| 蜜臂av日日欢夜夜爽一区| 26uuu另类欧美亚洲曰本| 成人av资源下载| 亚洲高清免费观看| 日韩午夜在线观看| 国产成人精品免费在线| 国产自产v一区二区三区c| 最新久久zyz资源站| 欧美日韩国产天堂| 国产专区综合网| 洋洋成人永久网站入口| 久久综合久久99| 日本电影欧美片| 韩国av一区二区| 一区二区在线观看不卡| 欧美一区二区三区精品| 久久成人18免费观看| 欧美体内she精高潮| 奇米影视7777精品一区二区| 久久久不卡网国产精品二区| 色94色欧美sute亚洲线路一ni| 久久69国产一区二区蜜臀| 亚洲天堂免费看| 欧美一区二区成人6969| 成人午夜伦理影院| 日韩黄色免费电影| 国产女人aaa级久久久级| 91成人免费网站| 黄页视频在线91| 亚洲精品久久久蜜桃| 色婷婷综合激情| 韩日av一区二区| 亚洲乱码国产乱码精品精小说| 欧美大片一区二区三区| 日本电影欧美片| 盗摄精品av一区二区三区| 捆绑紧缚一区二区三区视频| 亚洲国产一二三| 亚洲精品国产第一综合99久久| 久久久亚洲综合| 欧美成人精品1314www| 欧美色综合天天久久综合精品| 福利一区福利二区| 久久精品国产第一区二区三区| 亚洲一区二区四区蜜桃| ...xxx性欧美| 中文字幕中文字幕在线一区| 久久亚洲综合av| 精品久久国产老人久久综合| 欧美日韩国产一二三| 在线看一区二区| 成人免费视频视频| 国产激情一区二区三区| 激情欧美一区二区三区在线观看| 青青青爽久久午夜综合久久午夜| 五月婷婷综合网| 不卡的av中国片| 91在线观看免费视频| av成人免费在线观看| 成人毛片视频在线观看| 国产69精品一区二区亚洲孕妇| 午夜伊人狠狠久久| 日韩精品欧美精品| 日韩1区2区日韩1区2区| 日韩精品视频网| 久草在线在线精品观看| 奇米影视一区二区三区| 亚洲bt欧美bt精品777| 亚洲精品欧美二区三区中文字幕| 国产日本一区二区| 久久久久久久综合狠狠综合| 欧美精品久久天天躁| 欧美另类高清zo欧美| 在线观看av一区| 91福利资源站| 777色狠狠一区二区三区| 欧美性一级生活| 欧美亚洲高清一区二区三区不卡| 91蜜桃网址入口| 成人av网在线| 成人精品一区二区三区中文字幕| 国产精品一区在线观看乱码| 国产成人av在线影院| 成人综合激情网| 色悠久久久久综合欧美99| 欧美人与性动xxxx| 久久一留热品黄| 中文字幕中文乱码欧美一区二区| 亚洲欧美福利一区二区| 日本不卡在线视频| 床上的激情91.| 色域天天综合网| 欧美大片拔萝卜| 亚洲欧美电影一区二区| 看电影不卡的网站| 色综合久久六月婷婷中文字幕| 欧美一区二区三区四区在线观看| 国产欧美视频在线观看| 色婷婷亚洲综合| 2023国产一二三区日本精品2022| 中文字幕中文字幕在线一区| 图片区小说区区亚洲影院| 国产精品911| 成人一二三区视频| 欧美日韩高清不卡| 国产精品天干天干在观线| 天天亚洲美女在线视频| 成人综合激情网| 日韩一区二区麻豆国产| 亚洲激情图片小说视频| 欧美精品123区| 一区二区视频在线| 国产曰批免费观看久久久| 欧美丝袜第三区| 国产精品人妖ts系列视频 | 国产精品国产精品国产专区不蜜| 亚洲精品乱码久久久久久日本蜜臀| 天天综合天天做天天综合| 成熟亚洲日本毛茸茸凸凹| 正在播放亚洲一区| 国产精品拍天天在线| 91精品国产综合久久久久久久久久 | 26uuu亚洲综合色| 五月天一区二区三区| 高清av一区二区| 国产亚洲短视频| 精品一区二区成人精品| 欧美在线综合视频| 国产日本一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎| 不卡的av电影| 久久综合久久鬼色| 日本亚洲一区二区| 欧美日产在线观看| 亚洲一区二区偷拍精品| 色综合久久中文字幕| 国产精品久久久久久久浪潮网站| 精品一区二区在线观看| 欧美久久免费观看| 一区视频在线播放| 国产在线视频一区二区三区| 日韩精品一区二区三区视频播放| 亚洲一区二三区| 欧美日韩另类国产亚洲欧美一级| 一卡二卡三卡日韩欧美| 精品久久人人做人人爽| 狠狠色丁香久久婷婷综合_中| 精品国产伦一区二区三区观看方式| 老司机精品视频一区二区三区| 日韩美女在线视频| 国产真实乱子伦精品视频|