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

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

?? os_q.c

?? uCos-ii 2.86 在C8051F410單片機上移植成功!!! 其中包括:UART驅動
?? C
?? 第 1 頁 / 共 3 頁
字號:
             break;

        default:
             OS_EXIT_CRITICAL();
             *perr                  = OS_ERR_INVALID_OPT;
             pevent_return          = pevent;
             break;
    }
    return (pevent_return);
}
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                             FLUSH QUEUE
*
* Description : This function is used to flush the contents of the message queue.
*
* Arguments   : none
*
* Returns     : OS_ERR_NONE         upon success
*               OS_ERR_EVENT_TYPE   If you didn't pass a pointer to a queue
*               OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer
*
* WARNING     : You should use this function with great care because, when to flush the queue, you LOOSE
*               the references to what the queue entries are pointing to and thus, you could cause
*               'memory leaks'.  In other words, the data you are pointing to that's being referenced
*               by the queue entries should, most likely, need to be de-allocated (i.e. freed).
*********************************************************************************************************
*/

#if OS_Q_FLUSH_EN > 0
INT8U  OSQFlush (OS_EVENT *pevent) reentrant
{
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
        return (OS_ERR_PEVENT_NULL);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {     /* Validate event block type                     */
        return (OS_ERR_EVENT_TYPE);
    }
#endif
    OS_ENTER_CRITICAL();
    pq             = (OS_Q *)pevent->OSEventPtr;      /* Point to queue storage structure              */
    pq->OSQIn      = pq->OSQStart;
    pq->OSQOut     = pq->OSQStart;
    pq->OSQEntries = 0;
    OS_EXIT_CRITICAL();
    return (OS_ERR_NONE);
}
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                     PEND ON A QUEUE FOR A MESSAGE
*
* Description: This function waits for a message to be sent to a queue
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired queue
*
*              timeout       is an optional timeout period (in clock ticks).  If non-zero, your task will
*                            wait for a message to arrive at the queue up to the amount of time
*                            specified by this argument.  If you specify 0, however, your task will wait
*                            forever at the specified queue or, until a message arrives.
*
*              perr          is a pointer to where an error message will be deposited.  Possible error
*                            messages are:
*
*                            OS_ERR_NONE         The call was successful and your task received a
*                                                message.
*                            OS_ERR_TIMEOUT      A message was not received within the specified 'timeout'.
*                            OS_ERR_PEND_ABORT   The wait on the queue was aborted.
*                            OS_ERR_EVENT_TYPE   You didn't pass a pointer to a queue
*                            OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer
*                            OS_ERR_PEND_ISR     If you called this function from an ISR and the result
*                                                would lead to a suspension.
*                            OS_ERR_PEND_LOCKED  If you called this function with the scheduler is locked
*
* Returns    : != (void *)0  is a pointer to the message received
*              == (void *)0  if you received a NULL pointer message or,
*                            if no message was received or,
*                            if 'pevent' is a NULL pointer or,
*                            if you didn't pass a pointer to a queue.
*
* Note(s)    : As of V2.60, this function allows you to receive NULL pointer messages.
*********************************************************************************************************
*/

void  *OSQPend (OS_EVENT *pevent, INT16U timeout, INT8U *perr) reentrant
{
    void      *pmsg;
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {                    /* Validate 'perr'                                    */
        return ((void *)0);
    }
    if (pevent == (OS_EVENT *)0) {               /* Validate 'pevent'                                  */
        *perr = OS_ERR_PEVENT_NULL;
        return ((void *)0);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type                          */
        *perr = OS_ERR_EVENT_TYPE;
        return ((void *)0);
    }
    if (OSIntNesting > 0) {                      /* See if called from ISR ...                         */
        *perr = OS_ERR_PEND_ISR;                 /* ... can't PEND from an ISR                         */
        return ((void *)0);
    }
    if (OSLockNesting > 0) {                     /* See if called with scheduler locked ...            */
        *perr = OS_ERR_PEND_LOCKED;              /* ... can't PEND when locked                         */
        return ((void *)0);
    }
    OS_ENTER_CRITICAL();
    pq = (OS_Q *)pevent->OSEventPtr;             /* Point at queue control block                       */
    if (pq->OSQEntries > 0) {                    /* See if any messages in the queue                   */
        pmsg = *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();
        *perr = OS_ERR_NONE;
        return (pmsg);                           /* Return message received                            */
    }
    OSTCBCur->OSTCBStat     |= OS_STAT_Q;        /* Task will have to pend for a message to be posted  */
    OSTCBCur->OSTCBStatPend  = OS_STAT_PEND_OK;
    OSTCBCur->OSTCBDly       = timeout;          /* Load timeout into TCB                              */
    OS_EventTaskWait(pevent);                    /* Suspend task until event or timeout occurs         */
    OS_EXIT_CRITICAL();
    OS_Sched();                                  /* Find next highest priority task ready to run       */
    OS_ENTER_CRITICAL();
    switch (OSTCBCur->OSTCBStatPend) {                /* See if we timed-out or aborted                */
        case OS_STAT_PEND_OK:                         /* Extract message from TCB (Put there by QPost) */
             pmsg =  OSTCBCur->OSTCBMsg;
            *perr =  OS_ERR_NONE;
             break;

        case OS_STAT_PEND_ABORT:
             pmsg = (void *)0;
            *perr =  OS_ERR_PEND_ABORT;               /* Indicate that we aborted                      */
             break;

        case OS_STAT_PEND_TO:
        default:
             OS_EventTaskRemove(OSTCBCur, pevent);
             pmsg = (void *)0;
            *perr =  OS_ERR_TIMEOUT;                  /* Indicate that we didn't get event within TO   */
             break;
    }
    OSTCBCur->OSTCBStat          =  OS_STAT_RDY;      /* Set   task  status to ready                   */
    OSTCBCur->OSTCBStatPend      =  OS_STAT_PEND_OK;  /* Clear pend  status                            */
    OSTCBCur->OSTCBEventPtr      = (OS_EVENT  *)0;    /* Clear event pointers                          */
#if (OS_EVENT_MULTI_EN > 0)
    OSTCBCur->OSTCBEventMultiPtr = (OS_EVENT **)0;
#endif
    OSTCBCur->OSTCBMsg           = (void      *)0;    /* Clear  received message                       */
    OS_EXIT_CRITICAL();
    return (pmsg);                                    /* Return received message                       */
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                      ABORT WAITING ON A MESSAGE QUEUE
*
* Description: This function aborts & readies any tasks currently waiting on a queue.  This function 
*              should be used to fault-abort the wait on the queue, rather than to normally signal
*              the queue via OSQPost(), OSQPostFront() or OSQPostOpt().
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired queue.
*
*              opt           determines the type of ABORT performed:
*                            OS_PEND_OPT_NONE         ABORT wait for a single task (HPT) waiting on the
*                                                     queue
*                            OS_PEND_OPT_BROADCAST    ABORT wait for ALL tasks that are  waiting on the
*                                                     queue
*
*              perr          is a pointer to where an error message will be deposited.  Possible error
*                            messages are:
*
*                            OS_ERR_NONE         No tasks were     waiting on the queue.
*                            OS_ERR_PEND_ABORT   At least one task waiting on the queue was readied
*                                                and informed of the aborted wait; check return value 
*                                                for the number of tasks whose wait on the queue 
*                                                was aborted.
*                            OS_ERR_EVENT_TYPE   If you didn't pass a pointer to a queue.
*                            OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer.
*
* Returns    : == 0          if no tasks were waiting on the queue, or upon error.
*              >  0          if one or more tasks waiting on the queue are now readied and informed.
*********************************************************************************************************
*/

#if OS_Q_PEND_ABORT_EN > 0
INT8U  OSQPendAbort (OS_EVENT *pevent, INT8U opt, INT8U *perr) reentrant
{
    INT8U      nbr_tasks;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {                              /* Validate 'perr'                          */
        return (0);
    }
    if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
        *perr = OS_ERR_PEVENT_NULL;
        return (0);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
        *perr = OS_ERR_EVENT_TYPE;
        return (0);
    }
    OS_ENTER_CRITICAL();
    if (pevent->OSEventGrp != 0) {                         /* See if any task waiting on queue?        */
        nbr_tasks = 0;
        switch (opt) {
            case OS_PEND_OPT_BROADCAST:                    /* Do we need to abort ALL waiting tasks?   */
                 while (pevent->OSEventGrp != 0) {         /* Yes, ready ALL tasks waiting on queue    */
                     (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q, OS_STAT_PEND_ABORT);
                     nbr_tasks++;
                 }
                 break;
               
            case OS_PEND_OPT_NONE:
            default:                                       /* No,  ready HPT       waiting on queue    */
                 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_Q, OS_STAT_PEND_ABORT);
                 nbr_tasks++;
                 break;
        }
        OS_EXIT_CRITICAL();
        OS_Sched();                                        /* Find HPT ready to run                    */
        *perr = OS_ERR_PEND_ABORT;
        return (nbr_tasks);
    }
    OS_EXIT_CRITICAL();
    *perr = OS_ERR_NONE;
    return (0);                                            /* No tasks waiting on queue                */
}
#endif

/*$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
*
*              pmsg          is a pointer to the message to send.
*
* Returns    : OS_ERR_NONE           The call was successful and the message was sent
*              OS_ERR_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.
*              OS_ERR_PEVENT_NULL    If 'pevent' is a NULL pointer
*
* Note(s)    : As of V2.60, this function allows you to send NULL pointer messages.
*********************************************************************************************************
*/

#if OS_Q_POST_EN > 0
INT8U  OSQPost (OS_EVENT *pevent, void *pmsg)	reentrant
{
    OS_Q      *pq;
#if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合激情成人伊人| 欧美一区二区视频在线观看 | 日本一区二区成人在线| 在线91免费看| 精品视频免费在线| 精品视频一区三区九区| 91久久精品一区二区二区| 91免费观看国产| 色综合久久88色综合天天| 成人97人人超碰人人99| 99麻豆久久久国产精品免费优播| 国产91精品免费| 成人精品国产免费网站| eeuss鲁片一区二区三区在线看| 成人性生交大片| 色综合久久久久综合| 在线视频综合导航| 欧美欧美欧美欧美| 日韩欧美在线1卡| 久久精品一区二区| 亚洲日本中文字幕区| 亚洲国产视频直播| 久久国产麻豆精品| 国产盗摄视频一区二区三区| 成人激情电影免费在线观看| 色琪琪一区二区三区亚洲区| 91麻豆精品国产91久久久| 欧美大胆人体bbbb| 中文成人综合网| 亚洲无人区一区| 韩国女主播成人在线观看| 高清成人免费视频| 欧美精选一区二区| 国产亚洲一区二区在线观看| 一区二区三区资源| 久久精品久久综合| 91日韩一区二区三区| 欧美www视频| 亚洲人快播电影网| 久久99久国产精品黄毛片色诱| 成人av在线网站| 91精品国产丝袜白色高跟鞋| 欧美国产欧美亚州国产日韩mv天天看完整| 亚洲欧美区自拍先锋| 久久99精品久久久久久| 91福利国产成人精品照片| 2023国产一二三区日本精品2022| 亚洲欧美日韩国产成人精品影院| 久草在线在线精品观看| 欧美亚洲一区二区在线观看| 26uuu久久综合| 亚洲综合视频在线| 成人av综合一区| 精品剧情在线观看| 午夜精品一区在线观看| 菠萝蜜视频在线观看一区| 欧美大片日本大片免费观看| 亚洲成在人线免费| 99久久精品一区| 国产日韩欧美在线一区| 美女任你摸久久| 欧美日本乱大交xxxxx| 亚洲人成人一区二区在线观看 | 国产精品激情偷乱一区二区∴| 五月天一区二区三区| 一本一本久久a久久精品综合麻豆| 欧美成人一区二区三区| 视频在线观看国产精品| 色94色欧美sute亚洲13| 亚洲男人天堂av网| 91亚洲精品久久久蜜桃| 亚洲色图20p| 91麻豆swag| 亚洲视频免费在线观看| av电影在线不卡| 国产精品久久看| 成人三级在线视频| 欧美国产精品一区二区三区| 国产大片一区二区| 国产精品欧美一区喷水| 成人看片黄a免费看在线| 国产日韩欧美不卡在线| 高清av一区二区| 日本一区二区三区四区| 丁香另类激情小说| 亚洲欧洲精品天堂一级| 色综合久久88色综合天天6 | 日韩三级视频在线观看| 美脚の诱脚舐め脚责91| 精品美女一区二区| 国产成人8x视频一区二区| 国产精品无码永久免费888| 成人精品鲁一区一区二区| 综合久久一区二区三区| 欧美色欧美亚洲另类二区| 亚洲高清在线精品| 日韩免费一区二区| 国产不卡免费视频| 亚洲精品免费一二三区| 欧美狂野另类xxxxoooo| 精品在线一区二区三区| 国产精品久久久久久久久免费桃花| 99久久伊人网影院| 亚洲一区二区视频在线| 日韩亚洲欧美在线| 成人免费视频网站在线观看| 亚洲午夜精品一区二区三区他趣| 精品少妇一区二区三区免费观看| 国产精品91xxx| 一区二区三区四区视频精品免费| 91精品综合久久久久久| 成人亚洲精品久久久久软件| 亚洲一区二区三区四区在线| 日韩欧美的一区| 一本色道综合亚洲| 黄页网站大全一区二区| 一区二区欧美在线观看| 欧美精品一区二区三区高清aⅴ| 91蝌蚪国产九色| 麻豆91在线观看| 成人欧美一区二区三区视频网页| 欧美精品久久一区二区三区| 成人黄色a**站在线观看| 日本成人在线看| 亚洲婷婷综合色高清在线| 日韩三区在线观看| 欧美少妇一区二区| 成人激情综合网站| 国内精品伊人久久久久av影院| 亚洲欧美成aⅴ人在线观看| 久久久国产午夜精品| 欧美电影在哪看比较好| 99re热视频这里只精品| 国产一区二区免费在线| 首页国产欧美久久| 亚洲在线视频免费观看| 国产精品女人毛片| 久久新电视剧免费观看| 日韩一区二区电影网| 欧美日韩在线一区二区| 91麻豆精品视频| 成人黄色免费短视频| 国产麻豆视频精品| 精品一区二区三区日韩| 日韩国产精品大片| 日韩国产欧美一区二区三区| 亚洲午夜久久久久久久久电影网| 亚洲精品五月天| 中文字幕在线免费不卡| 国产精品热久久久久夜色精品三区| 久久天堂av综合合色蜜桃网| 精品国产第一区二区三区观看体验| 欧美日韩精品电影| 欧美男生操女生| 欧美精品乱码久久久久久按摩| 欧美日韩免费观看一区三区| 欧美性色黄大片| 欧美日韩国产在线播放网站| 欧美主播一区二区三区| 欧美乱妇15p| 91精品婷婷国产综合久久竹菊| 777亚洲妇女| 欧美一区二区三区思思人| 日韩欧美综合一区| 久久你懂得1024| 中文字幕 久热精品 视频在线| 国产日韩精品视频一区| 亚洲欧洲av一区二区三区久久| 亚洲同性gay激情无套| 亚洲精品国产一区二区三区四区在线 | 色狠狠av一区二区三区| 欧美专区日韩专区| 日韩欧美一区中文| 久久久噜噜噜久噜久久综合| 国产精品久久久久久久久搜平片| 亚洲女与黑人做爰| 日韩激情视频在线观看| 国产在线精品一区二区不卡了 | 成人av中文字幕| 91视频精品在这里| 欧美手机在线视频| 日韩欧美中文一区| 国产日产亚洲精品系列| 一区二区三区日韩欧美精品| 亚洲国产综合人成综合网站| 精品制服美女久久| 91美女蜜桃在线| 日韩美一区二区三区| 国产精品三级av在线播放| 亚洲一区在线看| 麻豆91在线播放| 99久久精品国产精品久久| 欧美日韩免费高清一区色橹橹 | 欧美在线短视频| 欧美变态tickling挠脚心| 日韩毛片一二三区| 国产在线精品一区在线观看麻豆| 91视频精品在这里| 欧美mv日韩mv国产网站app| 亚洲色图欧洲色图|