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

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

?? os_q.c

?? 最新版ucos2.86源碼和程序說明文件
?? 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)
{
    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)
{
    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)
{
    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)
{
    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一区二区三区免费野_久草精品视频
一区二区成人在线视频 | 国产精品无圣光一区二区| 欧美婷婷六月丁香综合色| 波多野结衣一区二区三区| 狠狠色丁香婷综合久久| 国产在线视频不卡二| 国产精品中文字幕日韩精品| 精品一二三四区| 韩国午夜理伦三级不卡影院| 激情深爱一区二区| 粉嫩蜜臀av国产精品网站| 成人av中文字幕| 91久久精品日日躁夜夜躁欧美| 色呦呦一区二区三区| 欧美日韩国产小视频在线观看| 91麻豆精品国产91久久久久久久久| 在线成人午夜影院| 欧美精品一区二区精品网| 久久久高清一区二区三区| 国产精品国产馆在线真实露脸 | 一区二区三区四区亚洲| 亚洲制服丝袜av| 奇米影视7777精品一区二区| 美洲天堂一区二卡三卡四卡视频| 韩国毛片一区二区三区| 成人av电影免费在线播放| 色噜噜狠狠一区二区三区果冻| 欧美日韩aaa| 国产亚洲欧美色| 亚洲综合自拍偷拍| 精品一区二区三区免费视频| 成人午夜私人影院| 337p亚洲精品色噜噜狠狠| 久久久精品中文字幕麻豆发布| 亚洲欧美日韩久久精品| 日本不卡免费在线视频| eeuss鲁片一区二区三区 | 大美女一区二区三区| 欧美少妇bbb| 国产三级精品在线| 亚洲第一二三四区| 国产高清久久久久| 欧美精选在线播放| 国产精品看片你懂得| 男女男精品视频| 色综合视频一区二区三区高清| 精品久久久久香蕉网| 一区二区三区四区不卡视频| 精品在线免费观看| 欧美久久久一区| 日韩毛片在线免费观看| 免费成人在线视频观看| 91免费观看在线| 欧美极品美女视频| 毛片不卡一区二区| 欧美麻豆精品久久久久久| 国产精品传媒视频| 国产69精品久久99不卡| 欧美精品一区二区三区视频| 午夜精品久久一牛影视| 在线视频综合导航| 中文字幕中文字幕中文字幕亚洲无线| 美美哒免费高清在线观看视频一区二区| 91麻豆国产福利精品| 中文字幕乱码亚洲精品一区| 精品一区二区三区日韩| 日韩欧美二区三区| 免费成人美女在线观看.| 欧美区视频在线观看| 亚洲国产精品麻豆| 欧美在线观看一区二区| 亚洲老妇xxxxxx| 99re66热这里只有精品3直播 | 日韩一区二区三区电影 | 日韩欧美一二区| 蜜桃传媒麻豆第一区在线观看| 7777精品伊人久久久大香线蕉经典版下载| 亚洲婷婷综合久久一本伊一区 | 亚洲精品五月天| 91一区一区三区| 亚洲精品日韩一| 在线亚洲免费视频| 午夜在线电影亚洲一区| 欧美在线观看视频在线| 亚洲成人自拍网| 制服丝袜av成人在线看| 青椒成人免费视频| 精品国产髙清在线看国产毛片| 久久se精品一区二区| 久久久不卡网国产精品二区| 国产盗摄一区二区| 综合av第一页| 精品视频一区二区不卡| 日本一道高清亚洲日美韩| 欧美电影免费观看高清完整版| 国产综合色产在线精品| 亚洲成人黄色小说| 在线不卡的av| 国精品**一区二区三区在线蜜桃| 国产丝袜美腿一区二区三区| 不卡的av在线| 午夜在线成人av| 久久精品亚洲精品国产欧美| 99re成人精品视频| 日本一不卡视频| 中文字幕不卡的av| 欧美三级中文字| 国产一区二区女| 亚洲最大成人网4388xx| 久久伊99综合婷婷久久伊| 99久久99久久精品免费观看| 日韩高清一区二区| 中文字幕一区二区三区乱码在线 | www.亚洲国产| 日精品一区二区三区| 亚洲国产精品成人综合| 欧美日韩国产在线播放网站| 成人一区二区在线观看| 丝瓜av网站精品一区二区| 欧美国产乱子伦| 欧美一区二区三区喷汁尤物| 97超碰欧美中文字幕| 韩国视频一区二区| 五月开心婷婷久久| 亚洲欧美日韩国产综合| 久久人人爽爽爽人久久久| 欧美日韩国产综合一区二区| www.亚洲色图| 狠狠色狠狠色综合系列| 日韩高清欧美激情| 亚洲综合激情小说| 国产精品麻豆视频| 久久亚洲影视婷婷| 欧美一区二区免费观在线| 91福利在线免费观看| www.66久久| 成人激情小说网站| 国产一区二区三区久久悠悠色av | 国产精品一区久久久久| 人人狠狠综合久久亚洲| 亚洲一区二区三区四区的| 国产精品天干天干在观线| 26uuu精品一区二区| 日韩欧美在线1卡| 91麻豆精品国产91久久久| 欧美综合一区二区三区| 色婷婷精品大在线视频| thepron国产精品| av一本久道久久综合久久鬼色| 国产盗摄视频一区二区三区| 国产精品白丝jk黑袜喷水| 国产一区二区三区不卡在线观看| 日本不卡视频在线观看| 免费观看久久久4p| 久久国产尿小便嘘嘘尿| 久久激情五月激情| 狠狠狠色丁香婷婷综合激情| 精品午夜久久福利影院| 精品一区二区日韩| 国产精品性做久久久久久| 国产经典欧美精品| 99久久久无码国产精品| 色成年激情久久综合| 欧美日韩精品一区二区三区四区| 欧美日韩在线电影| 日韩欧美国产一二三区| 久久在线观看免费| 国产精品伦理在线| 亚洲乱码国产乱码精品精的特点| 亚洲一区二区三区中文字幕| 同产精品九九九| 国产一区二区三区免费| 成人v精品蜜桃久久一区| 91精品1区2区| 欧美一级在线观看| 亚洲国产精品t66y| 亚洲国产综合91精品麻豆| 久久99这里只有精品| 国产69精品久久99不卡| 欧美亚洲高清一区| 精品久久久久久久久久久久久久久 | 中文字幕中文乱码欧美一区二区| 亚洲欧美日韩在线不卡| 午夜精品福利在线| 国产福利一区二区三区在线视频| 91免费在线视频观看| 日韩一级完整毛片| 自拍偷拍欧美精品| 蜜桃在线一区二区三区| 99久久精品国产一区| 欧美人狂配大交3d怪物一区| 国产午夜一区二区三区| 亚洲一区av在线| 国产福利一区在线| 欧美一级黄色大片| 一区二区在线看| 国产91丝袜在线播放九色| 欧美久久久久久久久久| 蜜臀久久久久久久| 成人av在线播放网站|