亚洲欧美第一页_禁久久精品乱码_粉嫩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| 欧美亚男人的天堂| 在线播放/欧美激情| 欧美成人性福生活免费看| 久久久综合激的五月天| 国产亚洲制服色| 亚洲一区二区三区四区在线免费观看| 亚洲色图一区二区三区| 一卡二卡三卡日韩欧美| 亚洲丝袜精品丝袜在线| 亚洲高清视频的网址| 一区二区三区四区高清精品免费观看| 亚洲免费观看高清完整版在线 | 亚洲精品美国一| 亚洲一区二区欧美日韩| 久久99日本精品| 欧美亚洲国产一区二区三区va| 色老汉av一区二区三区| 2019国产精品| 日日骚欧美日韩| 成人av免费观看| 欧美mv日韩mv国产| 亚洲成人在线网站| 91浏览器在线视频| 国产欧美日韩在线视频| 亚洲va在线va天堂| 欧美日韩一区二区三区不卡| 中文一区在线播放| 成人午夜碰碰视频| 精品国产污网站| 久99久精品视频免费观看| 欧美日韩国产欧美日美国产精品| 亚洲婷婷在线视频| 欧美老年两性高潮| 久久不见久久见免费视频7| 国产99精品在线观看| 欧美精品一区二区三区视频| 日韩电影网1区2区| 久久综合一区二区| 色爱区综合激月婷婷| 日韩电影免费一区| 国产日韩三级在线| 成人理论电影网| 一区二区三区美女视频| 91视频com| 国产精品白丝jk黑袜喷水| 中文字幕高清不卡| 欧美精品在线观看播放| 97精品久久久午夜一区二区三区| 亚洲乱码一区二区三区在线观看| 精品视频一区 二区 三区| 亚洲成a人片在线不卡一二三区| 精品国产乱码久久久久久1区2区| 黄色日韩三级电影| 麻豆视频观看网址久久| 亚洲激情男女视频| 成人免费视频在线观看| 欧美精品一区二区三区四区 | 天堂va蜜桃一区二区三区漫画版 | 一区二区三区欧美久久| 欧美成人女星排名| voyeur盗摄精品| 国产精品一级二级三级| 日韩国产欧美在线观看| 亚洲成人1区2区| 日韩综合一区二区| 麻豆一区二区99久久久久| 亚洲成人综合在线| 亚洲精品中文在线观看| 亚洲天堂2016| 国产精品福利av| 一级精品视频在线观看宜春院| 亚洲人成网站精品片在线观看| 最新日韩在线视频| 午夜视频一区在线观看| 日韩高清一级片| 国产一区二区在线视频| 韩国精品主播一区二区在线观看| 久久av中文字幕片| 国产在线精品视频| 色婷婷一区二区| 在线播放欧美女士性生活| 精品国产一区二区亚洲人成毛片| 久久久国产精华| 国产精品久久三| 精品中文字幕一区二区小辣椒| 久久国产尿小便嘘嘘| av一本久道久久综合久久鬼色| 国产91高潮流白浆在线麻豆| 91麻豆成人久久精品二区三区| 欧美一区欧美二区| 一区二区三区在线免费视频| 美脚の诱脚舐め脚责91| 欧美三级一区二区| 一区二区三区四区不卡在线| 另类小说视频一区二区| 欧美午夜电影在线播放| 久久久99精品免费观看不卡| 亚洲一区二区精品3399| 国产成人av一区二区| 日韩色在线观看| 日韩电影在线观看电影| 欧美精品免费视频| 同产精品九九九| 91精品国产美女浴室洗澡无遮挡| 亚洲综合精品久久| 精品视频在线看| 青青草97国产精品免费观看无弹窗版| 色综合天天综合网国产成人综合天 | 偷拍自拍另类欧美| 777色狠狠一区二区三区| 亚洲免费在线观看| 日韩一级精品视频在线观看| 亚洲男人的天堂在线aⅴ视频| 粉嫩在线一区二区三区视频| 久久夜色精品一区| 国产91露脸合集magnet| 国产欧美1区2区3区| 91老师国产黑色丝袜在线| 亚洲精品中文在线观看| 在线看国产日韩| 国产综合久久久久影院| 亚洲欧美一区二区三区孕妇| 日韩一级精品视频在线观看| 成人午夜视频免费看| 欧美aⅴ一区二区三区视频| 中文乱码免费一区二区| 欧美精品久久99久久在免费线| 青青青伊人色综合久久| 欧美国产1区2区| 欧美精品三级在线观看| 99久久er热在这里只有精品66| 一区二区三区在线免费| wwwwxxxxx欧美| 色呦呦网站一区| 91色九色蝌蚪| 国产麻豆欧美日韩一区| 日本91福利区| 亚洲午夜在线视频| 亚洲精品乱码久久久久| 国产精品久久久久一区 | 国产精品丝袜久久久久久app| 日韩欧美资源站| 欧美videos大乳护士334| 欧美精品一区二区三区四区 | 日韩欧美色综合| 欧美成人国产一区二区| 欧美成人欧美edvon| 日韩一区二区三区在线| 欧美成人女星排行榜| 国产日韩欧美精品一区| 亚洲人吸女人奶水| 视频在线观看91| 国产电影一区在线| 91国产福利在线| 日韩欧美资源站| 日韩理论片在线| 久久黄色级2电影| 91麻豆免费看片| 欧美www视频| 亚洲精品视频在线| 久草热8精品视频在线观看| 处破女av一区二区| 91精品国模一区二区三区| 中文字幕欧美三区| 久久99精品国产.久久久久| 成人晚上爱看视频| 日韩欧美视频在线| 亚洲日本韩国一区| www.亚洲激情.com| 精品噜噜噜噜久久久久久久久试看| 中文字幕日本乱码精品影院| 日韩黄色片在线观看| 国产成人a级片| 欧美大白屁股肥臀xxxxxx| 亚洲成人av电影| 99国产精品久| 欧美国产视频在线| 国产一区视频网站| 亚洲精品一区二区三区影院| 午夜精品一区二区三区电影天堂| 99精品桃花视频在线观看| 久久久久久久久岛国免费| 国产福利不卡视频| 精品国偷自产国产一区| 国产成人亚洲精品狼色在线| 欧美一卡二卡在线观看| 激情五月婷婷综合网| 欧美精品第1页| 国产成人av电影在线观看| 久久美女高清视频| 在线观看免费视频综合| 亚洲综合在线免费观看| 欧美一区二区视频在线观看2020| 午夜精品福利一区二区三区蜜桃| 日韩美女视频一区二区在线观看| 久久电影国产免费久久电影 | www.欧美.com|