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

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

?? os_q.c

?? 這是完整的ucos在51上移植的資料
?? C
?? 第 1 頁 / 共 2 頁
字號:
*
*              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 You didn't pass a pointer to a queue
*                            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 a pointer to a queue.
*********************************************************************************************************
*/

void *OSQPend (OS_EVENT *pevent, INT16U timeout, INT8U *err) reentrant
{
    void  *msg;
    OS_Q  *pq;


    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type                          */
        OS_EXIT_CRITICAL();
        *err = OS_ERR_EVENT_TYPE;
        return ((void *)0);
    }
    pq = pevent->OSEventPtr;                     /* Point at queue control block                       */
    if (pq->OSQEntries != 0) {                   /* See if any messages in the queue                   */
        msg = *pq->OSQOut++;                     /* Yes, extract oldest message from the queue         */
        pq->OSQEntries--;                        /* Update the number of entries in the queue          */
        if (pq->OSQOut == pq->OSQEnd) {          /* Wrap OUT pointer if we are at the end of the queue */
            pq->OSQOut = pq->OSQStart;
        }
        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_Q;     /* Task will have to pend for a message to be posted  */
        OSTCBCur->OSTCBDly      = timeout;       /* Load timeout into 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) {/* Did we get a message?                         */
            OSTCBCur->OSTCBMsg      = (void *)0;      /* Extract message from TCB (Put there by QPost) */
            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_Q) { /* Timed out if status indicates pending on Q    */
            OSEventTO(pevent);
            OS_EXIT_CRITICAL();
            msg                     = (void *)0;      /* No message received                           */
            *err                    = OS_TIMEOUT;     /* Indicate a timeout occured                    */
        } else {
            msg = *pq->OSQOut++;                      /* Extract message from queue                    */
            pq->OSQEntries--;                         /* Update the number of entries in the queue     */
            if (pq->OSQOut == pq->OSQEnd) {           /* Wrap OUT pointer if we are at the end of Q    */
                pq->OSQOut = pq->OSQStart;
            }
            OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;
            OS_EXIT_CRITICAL();
            *err = OS_NO_ERR;
        }
    }                                                 
    return (msg);                                     /* Return message received (or NULL)             */
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                        POST MESSAGE TO A QUEUE
*
* Description: This function sends a message to a queue
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired queue
*
*              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_Q_FULL          If the queue cannot accept any more messages because it is full.
*              OS_ERR_EVENT_TYPE  If you didn't pass a pointer to a queue.
*********************************************************************************************************
*/

INT8U OSQPost (OS_EVENT *pevent, void *msg) reentrant
{
    OS_Q   *pq;


    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {     /* Validate event block type                     */
        OS_EXIT_CRITICAL();
        return (OS_ERR_EVENT_TYPE);
    }
    if (pevent->OSEventGrp) {                         /* See if any task pending on queue              */
        OSEventTaskRdy(pevent, msg, OS_STAT_Q);       /* Ready highest priority task waiting on event  */
        OS_EXIT_CRITICAL();
        OSSched();                                    /* Find highest priority task ready to run       */
        return (OS_NO_ERR);
    } else {
        pq = pevent->OSEventPtr;                      /* Point to queue control block                  */
        if (pq->OSQEntries >= pq->OSQSize) {          /* Make sure queue is not full                   */
            OS_EXIT_CRITICAL();
            return (OS_Q_FULL);
        } else {
            *pq->OSQIn++ = msg;                       /* Insert message into queue                     */
            pq->OSQEntries++;                         /* Update the nbr of entries in the queue        */
            if (pq->OSQIn == pq->OSQEnd) {            /* Wrap IN ptr if we are at end of queue         */
                pq->OSQIn = pq->OSQStart;
            }
            OS_EXIT_CRITICAL();
        }
        return (OS_NO_ERR);
    }
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                   POST MESSAGE TO THE FRONT OF A QUEUE
*
* Description: This function sends a message to a queue but unlike OSQPost(), the message is posted at
*              the front instead of the end of the queue.  Using OSQPostFront() allows you to send
*              'priority' messages.  
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired queue
*
*              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_Q_FULL          If the queue cannot accept any more messages because it is full.
*              OS_ERR_EVENT_TYPE  If you didn't pass a pointer to a queue.
*********************************************************************************************************
*/

INT8U OSQPostFront (OS_EVENT *pevent, void *msg) reentrant
{
    OS_Q   *pq;


    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {     /* Validate event block type                     */
        OS_EXIT_CRITICAL();
        return (OS_ERR_EVENT_TYPE);
    }
    if (pevent->OSEventGrp) {                         /* See if any task pending on queue              */
        OSEventTaskRdy(pevent, msg, OS_STAT_Q);       /* Ready highest priority task waiting on event  */
        OS_EXIT_CRITICAL();
        OSSched();                                    /* Find highest priority task ready to run       */
        return (OS_NO_ERR);
    } else {
        pq = pevent->OSEventPtr;                      /* Point to queue control block                  */
        if (pq->OSQEntries >= pq->OSQSize) {          /* Make sure queue is not full                   */
            OS_EXIT_CRITICAL();
            return (OS_Q_FULL);
        } else {
            if (pq->OSQOut == pq->OSQStart) {         /* Wrap OUT ptr if we are at the 1st queue entry */
                pq->OSQOut = pq->OSQEnd;
            }
            pq->OSQOut--;
            *pq->OSQOut = msg;                        /* Insert message into queue                     */
            pq->OSQEntries++;                         /* Update the nbr of entries in the queue        */
            OS_EXIT_CRITICAL();
        }
        return (OS_NO_ERR);
    }
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                        QUERY A MESSAGE QUEUE
*
* Description: This function obtains information about a message queue.
*
* 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
*                            queue.
*
* 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 queue.
*********************************************************************************************************
*/

INT8U OSQQuery (OS_EVENT *pevent, OS_Q_DATA *ppdata) reentrant
{
    OS_Q   *pq;
    INT8U   i;
    INT8U  *psrc;
    INT8U  *pdest;
    
    
    OS_ENTER_CRITICAL();
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
        OS_EXIT_CRITICAL();
        return (OS_ERR_EVENT_TYPE);
    }
    ppdata->OSEventGrp = pevent->OSEventGrp;                /* Copy message mailbox wait list           */
    psrc              = &pevent->OSEventTbl[0];
    pdest             = &ppdata->OSEventTbl[0];
    for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
        *pdest++ = *psrc++;   
    }
    pq = (OS_Q *)pevent->OSEventPtr;
    if (pq->OSQEntries > 0) {
        ppdata->OSMsg = pq->OSQOut;                         /* Get next message to return if available  */
    } else {
        ppdata->OSMsg = (void *)0;
    }
    ppdata->OSNMsgs = pq->OSQEntries;
    ppdata->OSQSize = pq->OSQSize;
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩专区在线视频| 色婷婷综合久久久中文字幕| 成人深夜视频在线观看| 亚洲婷婷综合久久一本伊一区| 91豆麻精品91久久久久久| 欧美性受xxxx| 久久日一线二线三线suv| 精品久久久久99| 夜夜嗨av一区二区三区网页| 日本成人超碰在线观看| 国产成人免费视频网站高清观看视频| 成人免费高清在线观看| 无码av中文一区二区三区桃花岛| 日本欧美一区二区在线观看| 国产不卡视频在线播放| 欧美成人乱码一区二区三区| 久久免费午夜影院| 麻豆精品视频在线观看| 色播五月激情综合网| 中文字幕成人av| 蜜桃在线一区二区三区| 日韩午夜精品视频| 一区二区三区在线免费| 成人黄色软件下载| 中文字幕一区二区三区不卡| 国产老肥熟一区二区三区| 久热成人在线视频| 免费精品99久久国产综合精品| 成人黄页在线观看| 日本一区二区久久| 高清在线成人网| ww久久中文字幕| 国产精品一区二区在线观看不卡| 欧美一卡二卡在线| 久久97超碰国产精品超碰| 粉嫩嫩av羞羞动漫久久久| 日韩欧美国产不卡| 国产露脸91国语对白| 亚洲人亚洲人成电影网站色| 91欧美激情一区二区三区成人| 亚洲欧美一区二区三区国产精品| 91在线一区二区| 日韩精彩视频在线观看| 精品入口麻豆88视频| 91免费视频网址| 国产一区二区电影| 日韩精品国产精品| 国产欧美一区二区三区沐欲| 在线视频欧美区| www.99精品| 国内精品国产成人国产三级粉色| 日韩毛片精品高清免费| 日韩欧美黄色影院| 色噜噜狠狠色综合欧洲selulu| 麻豆国产精品一区二区三区| 一区二区三区久久| 欧美激情综合五月色丁香| 日韩欧美区一区二| 欧美日韩精品欧美日韩精品| 99免费精品视频| 成人高清免费观看| 成人美女视频在线看| 欧美国产日产图区| 精品99久久久久久| 欧美亚洲国产一区二区三区va| 精品午夜久久福利影院| 日韩电影在线观看电影| 一区在线播放视频| 懂色av一区二区在线播放| 国产色综合一区| 国产成人精品网址| 中文字幕不卡三区| 欧美美女黄视频| 91玉足脚交白嫩脚丫在线播放| 久久综合给合久久狠狠狠97色69| 国产精品一区二区在线观看网站| 亚洲国产精品99久久久久久久久| 成人美女在线观看| 秋霞午夜av一区二区三区| 精品粉嫩超白一线天av| 亚洲乱码国产乱码精品精的特点 | 日韩欧美在线1卡| 午夜精品aaa| 欧美一区二区不卡视频| 国产成人免费视频精品含羞草妖精 | 欧美日韩亚洲综合在线| www.亚洲精品| 91在线视频免费91| 欧美精品一级二级| 国产精品情趣视频| 亚洲一区二区三区四区五区中文| 精品一区二区三区免费| 国产美女精品在线| 欧美一级在线视频| 日韩三级av在线播放| 中文字幕一区二区不卡| 欧美日韩国产一区| 狠狠网亚洲精品| a亚洲天堂av| 色偷偷成人一区二区三区91| 欧美浪妇xxxx高跟鞋交| 欧美国产丝袜视频| 免费成人在线网站| 18成人在线视频| 欧美无人高清视频在线观看| 欧美大白屁股肥臀xxxxxx| 国产精品国产a| 国产精品自拍毛片| 精品国产成人系列| 91老司机福利 在线| 91年精品国产| 国产麻豆精品一区二区| 亚洲成人三级小说| 欧美日韩一区二区三区四区| 欧美高清在线精品一区| 国产一区二区三区在线观看免费视频 | 国产精品色在线| 国产精品一区二区在线播放| 久久中文娱乐网| 久久精品国产网站| 欧美午夜不卡视频| 国产美女在线精品| 国产精品丝袜一区| 欧美丰满少妇xxxxx高潮对白 | 国产午夜精品一区二区 | 国产精品国产三级国产aⅴ无密码| hitomi一区二区三区精品| 亚洲欧美激情小说另类| 91在线视频免费观看| 色综合久久天天综合网| 图片区小说区区亚洲影院| 国产91丝袜在线播放九色| 国产精品视频yy9299一区| 91精品国产一区二区人妖| av中文字幕不卡| 成人一级视频在线观看| 美腿丝袜一区二区三区| 亚洲国产综合人成综合网站| 亚洲视频免费看| 中文字幕中文字幕一区| 久久久蜜桃精品| 日韩三级在线观看| 国产亚洲人成网站| 日韩欧美国产成人一区二区| 欧美色大人视频| 色婷婷久久一区二区三区麻豆| 成人av在线电影| 国产91精品一区二区麻豆网站| 精品一区二区三区日韩| 国产成人精品一区二| 国产一区二区免费看| 成人av在线观| 欧美丝袜自拍制服另类| 欧美一区二区播放| 中文av一区特黄| 亚洲综合在线五月| 亚洲精品综合在线| 天堂成人国产精品一区| 国产乱码精品一区二区三| 99久久精品国产观看| 欧美一区二区私人影院日本| 精品国产自在久精品国产| 亚洲视频精选在线| 青青草原综合久久大伊人精品| 国产精品系列在线观看| 欧美这里有精品| 国产精品欧美久久久久无广告| 亚洲午夜一区二区三区| 粉嫩aⅴ一区二区三区四区五区 | 国产精品久久久久一区二区三区 | 欧美国产激情二区三区| 日韩一区二区三区电影 | 日本不卡免费在线视频| 91麻豆精东视频| 欧美高清在线视频| 丁香五精品蜜臀久久久久99网站 | 国产精品一品视频| 欧美日韩1区2区| 性久久久久久久久| 99在线视频精品| 亚洲柠檬福利资源导航| 波多野结衣亚洲| 亚洲日韩欧美一区二区在线| 久久丁香综合五月国产三级网站 | 欧美一区二区三级| 亚洲成人激情av| 欧美日韩aaa| 蜜桃视频在线一区| 久久蜜桃av一区精品变态类天堂| 美国十次综合导航| 久久久99精品久久| 国产盗摄精品一区二区三区在线| 国产亚洲精品精华液| 99久久免费视频.com| 偷拍日韩校园综合在线| 欧美一区二区三区四区高清| 另类小说综合欧美亚洲| 国产精品久久一卡二卡| 欧美肥妇毛茸茸| 91麻豆视频网站|