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

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

?? os_mbox.c

?? 在C8051F120內移植uCOS-II
?? 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
*********************************************************************************************************
*/
#define OS_MBOX_GLOBALS
//#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.
*********************************************************************************************************
*/
#if OS_Mbox_Accept_EN
void *OSMboxAccept (OS_EVENT *pevent)reentrant
{
    #if OS_CRITICAL_METHOD == 2
	unsigned DTYPE int_ss;
	#endif 

	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)     */
}
#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    : != (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
*********************************************************************************************************
*/
#if OS_Mbox_Create_EN
OS_EVENT *OSMboxCreate (void *msg)reentrant
{
    #if OS_CRITICAL_METHOD == 2
	unsigned DTYPE int_ss;
	#endif 

	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              */
}
#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.
*
* 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.
*********************************************************************************************************
*/
#if OS_Mbox_Pend_EN
void *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)reentrant
{
    #if OS_CRITICAL_METHOD == 2
	unsigned DTYPE int_ss;
	#endif 

	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)    */
}
#endif
/*$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.
*********************************************************************************************************
*/
#if OS_Mbox_Post_EN
INT8U OSMboxPost (OS_EVENT *pevent, void *msg)reentrant
{
    #if OS_CRITICAL_METHOD == 2
	unsigned DTYPE int_ss;
	#endif 


	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);
        }
    }
}
#endif
/*$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
*
*              dataptr         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.
*********************************************************************************************************
*/
#if OS_Mbox_Query_EN
INT8U OSMboxQuery (OS_EVENT *pevent, OS_MBOX_DATA *dataptr)reentrant
{
    #if OS_CRITICAL_METHOD == 2
	unsigned DTYPE int_ss;
	#endif 

    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);
    }
    dataptr->OSEventGrp = pevent->OSEventGrp;                /* Copy message mailbox wait list           */
    psrc              = &pevent->OSEventTbl[0];
    pdest             = &dataptr->OSEventTbl[0];
    for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
        *pdest++ = *psrc++;   
    }
    dataptr->OSMsg = pevent->OSEventPtr;                     /* Get message from mailbox                 */
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}
#endif
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人在线网站| 欧美一区二区在线视频| 日韩亚洲欧美一区二区三区| 国产精品美女久久久久久| 日韩av电影免费观看高清完整版在线观看| 精品一区二区在线视频| 在线精品视频一区二区三四| 日本一区二区高清| 精彩视频一区二区| 日韩三区在线观看| 亚洲国产日韩av| 91视频国产资源| 国产网站一区二区三区| 韩国视频一区二区| 日韩免费一区二区| 天天av天天翘天天综合网色鬼国产| 春色校园综合激情亚洲| 国产午夜精品久久| 国产精品1区2区| 久久久久久免费网| 国产不卡免费视频| 久久久99精品免费观看不卡| 韩国一区二区在线观看| 久久人人爽人人爽| 国产一区二区网址| 国产亚洲精品aa| 国产精品亚洲一区二区三区在线| 久久综合精品国产一区二区三区 | 欧美午夜精品久久久久久孕妇| 亚洲日本在线视频观看| 成人激情图片网| 中文字幕一区免费在线观看| 99re这里都是精品| 亚洲色图制服诱惑| 欧美日韩黄色影视| 秋霞电影网一区二区| 精品国产污网站| 国产精品影音先锋| 国产精品乱码一区二三区小蝌蚪| 福利一区福利二区| 亚洲欧美偷拍三级| 欧美日韩国产综合视频在线观看| 五月综合激情婷婷六月色窝| 日韩欧美国产综合在线一区二区三区| 免费在线观看视频一区| 精品黑人一区二区三区久久| 国产在线精品免费| 国产精品国产三级国产普通话三级| 成人高清视频在线观看| 亚洲一线二线三线久久久| 7777精品伊人久久久大香线蕉最新版 | 亚洲精品欧美二区三区中文字幕| 99麻豆久久久国产精品免费| 一区二区三区在线播| 91精品国产综合久久蜜臀 | 精品国产露脸精彩对白 | 国产一区二区三区av电影| 久久精品一区二区| 色94色欧美sute亚洲线路一ni| 午夜精品福利在线| 久久久精品免费免费| 欧美性一二三区| 国产麻豆91精品| 亚洲综合色视频| 久久精品夜夜夜夜久久| 欧美性高清videossexo| 国产自产视频一区二区三区| 一区二区三区不卡视频在线观看 | 亚洲欧美在线视频| 欧美一区二区三区小说| 成人高清免费在线播放| 免费视频一区二区| 亚洲视频一区在线观看| 欧美成人vr18sexvr| 色成人在线视频| 国产成人欧美日韩在线电影| 五月婷婷欧美视频| 国产精品成人免费在线| 2021久久国产精品不只是精品 | 成人激情免费网站| 蜜臀精品久久久久久蜜臀| 亚洲欧美日韩一区二区| 久久久综合九色合综国产精品| 欧美日韩在线精品一区二区三区激情| 国产精品99久久久久久有的能看| 亚洲线精品一区二区三区| 国产精品三级电影| 精品欧美黑人一区二区三区| 欧美日韩在线观看一区二区| 波多野结衣在线一区| 麻豆视频观看网址久久| 亚洲高清免费在线| 亚洲三级免费电影| 国产精品毛片无遮挡高清| 精品国产伦一区二区三区观看方式 | 久久66热re国产| 亚洲成在人线免费| 亚洲欧美视频在线观看视频| 国产欧美日韩激情| 久久青草欧美一区二区三区| 91精品国产一区二区三区| 欧美视频一区二区三区在线观看 | 粉嫩aⅴ一区二区三区四区五区| 天天色综合成人网| 午夜精品免费在线观看| 亚洲成a人在线观看| 亚洲第一搞黄网站| 亚洲一区二区三区中文字幕 | 中文字幕第一区二区| 欧美国产一区视频在线观看| 久久久久久久久一| 欧美国产一区在线| 国产精品你懂的| 日韩一区在线播放| 亚洲女同ⅹxx女同tv| 亚洲天堂2014| 亚洲精品亚洲人成人网在线播放| 亚洲美女在线国产| 亚洲制服丝袜一区| 午夜av一区二区三区| 日韩电影在线一区二区三区| 日本欧美大码aⅴ在线播放| 蜜臀久久99精品久久久画质超高清 | 中文字幕不卡的av| 国产精品久久午夜| 亚洲综合自拍偷拍| 日本成人中文字幕在线视频 | 日本一区二区三区国色天香| 国产午夜精品一区二区三区嫩草 | 国产欧美日韩卡一| 亚洲婷婷综合久久一本伊一区| 亚洲免费av高清| 午夜在线电影亚洲一区| 久久99精品国产.久久久久久| 韩国v欧美v日本v亚洲v| 99re免费视频精品全部| 欧美视频中文一区二区三区在线观看| 日韩一级视频免费观看在线| 久久久国产精品麻豆| 最新不卡av在线| 日韩av午夜在线观看| 国产一区二区三区免费观看| 不卡的av网站| 欧美精品第一页| 国产欧美中文在线| 亚洲电影欧美电影有声小说| 国产一区中文字幕| 在线免费不卡视频| 久久美女高清视频| 亚洲成人资源网| 国产精品99久久久久久久vr| 色八戒一区二区三区| 久久亚洲二区三区| 亚洲成人久久影院| 成人午夜免费电影| 欧美一区二区三区日韩视频| 国产精品成人一区二区艾草 | 国产三级欧美三级日产三级99 | 在线播放/欧美激情| 国产精品久久久久毛片软件| 天天综合网天天综合色| av影院午夜一区| 日韩欧美在线综合网| 亚洲欧美一区二区三区久本道91| 美国毛片一区二区| 欧美午夜一区二区| 亚洲人成在线播放网站岛国| 国产精品一区2区| 欧美一级在线视频| 一区二区久久久| 99精品热视频| 久久久国产一区二区三区四区小说| 性做久久久久久免费观看| 99国产精品久久久久久久久久久| 欧美videofree性高清杂交| 亚洲图片有声小说| 91在线码无精品| 欧美经典一区二区| 国产在线视频一区二区三区| 欧美精品一卡二卡| 亚洲高清免费观看高清完整版在线观看| 国产成人精品影院| 精品久久久三级丝袜| 免费成人在线网站| 91精品婷婷国产综合久久竹菊| 亚洲免费观看高清完整版在线观看 | 亚洲人午夜精品天堂一二香蕉| 国产 欧美在线| 日本一区二区三区国色天香| 国产成人无遮挡在线视频| 国产色一区二区| 成人免费视频一区二区| 久久久精品一品道一区| 国产高清精品网站| 欧美激情中文字幕| 91亚洲精品久久久蜜桃| 怡红院av一区二区三区| 色婷婷狠狠综合| 亚洲国产日日夜夜| 91精品久久久久久蜜臀|