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

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

?? os_q.c

?? keil下單片機C8051F020的源程序
?? 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一区二区三区免费野_久草精品视频
99视频在线观看一区三区| 热久久久久久久| 成人网在线免费视频| 精品国产网站在线观看| 日韩高清不卡一区| 91精品国产色综合久久ai换脸 | 在线观看日韩精品| 亚洲一区二区三区影院| 欧美体内she精视频| 亚洲第四色夜色| 91麻豆精品国产91久久久使用方法| 奇米影视7777精品一区二区| 日韩精品一区二| 成人爽a毛片一区二区免费| 国产精品免费看片| 在线观看欧美日本| 麻豆91在线观看| 国产精品久久久爽爽爽麻豆色哟哟 | 精品免费99久久| 国产成人av资源| 亚洲另类一区二区| 91精品国产综合久久精品app | 国产高清视频一区| 亚洲桃色在线一区| 欧美日韩电影在线播放| 极品尤物av久久免费看| 亚洲美女精品一区| 精品三级在线看| 一本色道久久综合精品竹菊| 日本在线播放一区二区三区| 欧美极品另类videosde| 欧美色图天堂网| 国产麻豆视频一区| 亚洲高清免费在线| 国产亲近乱来精品视频| 欧美丝袜丝交足nylons| 国产91在线观看丝袜| 自拍偷拍欧美激情| 日韩一区二区免费电影| eeuss鲁一区二区三区| 手机精品视频在线观看| 中文字幕av一区二区三区| 欧美日韩国产免费一区二区 | 色天天综合久久久久综合片| 久久综合综合久久综合| 综合久久一区二区三区| 欧美精品一区二区三区蜜桃视频 | 亚洲视频综合在线| 日韩一二三区视频| 欧美优质美女网站| 成人一区二区三区视频 | 一区二区三区在线视频观看58| 日韩欧美一二三四区| 色诱亚洲精品久久久久久| 国产一区二区精品久久99| 一区二区三区免费在线观看| 国产夜色精品一区二区av| 欧美日韩久久久| 91美女片黄在线观看91美女| 国产成人免费视频一区| 久久精品国产99国产| 五月天欧美精品| 亚洲精品国产a久久久久久| 国产精品亲子伦对白| 精品对白一区国产伦| 欧美一级一区二区| 欧美日韩视频专区在线播放| 欧洲精品在线观看| 在线观看免费一区| 色婷婷综合久久久中文字幕| 成人精品视频网站| 国产黄人亚洲片| 豆国产96在线|亚洲| 国产精品一区二区久激情瑜伽| 蜜桃视频一区二区| 日产欧产美韩系列久久99| 日本少妇一区二区| 奇米综合一区二区三区精品视频 | 国产一区二区免费视频| 久久99久久久久| 久久国产尿小便嘘嘘尿| 久久综合综合久久综合| 国产精品一区2区| 国产成人av资源| 99久久99久久精品免费观看| 91在线云播放| 欧美性大战xxxxx久久久| 欧美视频在线一区| 制服丝袜在线91| 欧美成人高清电影在线| 国产日韩欧美a| 1024国产精品| 亚洲国产一区二区三区青草影视| 亚洲一区二区三区四区五区中文| 亚洲成人7777| 另类小说欧美激情| 国产成人综合网站| 91伊人久久大香线蕉| 欧美视频在线一区二区三区| 日韩欧美中文字幕精品| 久久综合九色综合欧美亚洲| 国产精品丝袜在线| 亚洲乱码国产乱码精品精小说 | 日韩午夜在线影院| 久久久国产一区二区三区四区小说 | 免费黄网站欧美| 国产精品正在播放| 91亚洲国产成人精品一区二三| 欧美视频在线一区| 亚洲国产视频在线| 另类调教123区| 99精品偷自拍| 欧美精品粉嫩高潮一区二区| 精品成a人在线观看| 国产精品美女www爽爽爽| 亚洲午夜私人影院| 狠狠色丁香婷婷综合久久片| 91香蕉视频污在线| 日韩欧美高清dvd碟片| 国产精品久久影院| 日韩和的一区二区| 成人avav在线| 欧美一区二区三区四区久久| 国产精品色婷婷| 图片区小说区国产精品视频| 懂色av一区二区三区免费看| 欧美日韩高清影院| 国产精品国产自产拍高清av| 日韩不卡一二三区| 91蜜桃免费观看视频| 精品国产亚洲一区二区三区在线观看| 国产精品国产馆在线真实露脸| 午夜精品久久久久久久久久| 成人免费视频网站在线观看| 91精品国产一区二区三区蜜臀| 国产精品每日更新| 国产专区欧美精品| 在线播放中文一区| 亚洲精品视频在线看| 国产伦精品一区二区三区免费| 欧美美女直播网站| 亚洲欧美在线视频观看| 国产精品一区二区在线观看不卡 | 经典三级一区二区| 欧美日韩视频一区二区| 亚洲欧洲av色图| 国产成a人无v码亚洲福利| 91麻豆精品国产91久久久使用方法| 成人免费在线观看入口| 国产精品乡下勾搭老头1| 日韩一级完整毛片| 日韩影视精彩在线| 在线亚洲人成电影网站色www| 欧美极品美女视频| 国产精品自在欧美一区| 欧美成人精品1314www| 无吗不卡中文字幕| 精品视频一区二区不卡| 一区二区在线观看视频| 99久久99久久精品免费观看| 国产精品午夜免费| 成人一级视频在线观看| 中文在线一区二区| 国产寡妇亲子伦一区二区| 久久影视一区二区| 精品午夜一区二区三区在线观看 | 极品销魂美女一区二区三区| 制服丝袜在线91| 蜜乳av一区二区三区| 91麻豆精品国产自产在线| 亚洲aⅴ怡春院| 3d成人动漫网站| 美女国产一区二区三区| 欧美成人女星排行榜| 国产一区二区91| 国产日韩欧美a| 99综合电影在线视频| 亚洲色图丝袜美腿| 91天堂素人约啪| 亚洲高清免费视频| 日韩欧美一区二区视频| 国产一区二区三区免费看| 久久久.com| www.爱久久.com| 亚洲自拍与偷拍| 欧美精品色综合| 激情综合色综合久久综合| 久久婷婷综合激情| bt7086福利一区国产| 亚洲精品欧美专区| 欧美麻豆精品久久久久久| 男人的j进女人的j一区| 久久久久久久久久电影| 成人激情校园春色| 亚洲午夜视频在线| 久久综合99re88久久爱| 久久久天堂av| 91黄色在线观看| 蜜臀a∨国产成人精品| 国产亚洲精品福利|