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

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

?? os_q.c

?? 飛思卡爾HCS12的OS移植(ucosII),實現了三個任務,IDE:CODEWARRIOR
?? 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一区二区三区免费野_久草精品视频
国产性色一区二区| 国产精品一级片在线观看| 中文字幕亚洲区| 中文字幕免费观看一区| 久久久噜噜噜久久中文字幕色伊伊| 91精品欧美综合在线观看最新| 欧美日韩在线播放一区| 欧美少妇性性性| 欧美日韩国产在线观看| 欧美日韩成人综合| 日韩区在线观看| 26uuu亚洲婷婷狠狠天堂| 国产喷白浆一区二区三区| 国产欧美精品区一区二区三区 | 亚洲欧美aⅴ...| 伊人夜夜躁av伊人久久| 亚洲一二三四区| 日本不卡1234视频| 国产精品66部| 99riav一区二区三区| 欧美午夜精品理论片a级按摩| 欧美日韩高清一区二区三区| 日韩亚洲欧美一区二区三区| 久久亚洲春色中文字幕久久久| 国产日韩欧美一区二区三区综合| 国产精品美日韩| 亚洲一区中文在线| 日本欧美在线看| 国产精品99久久久久久似苏梦涵 | 三级成人在线视频| 国模娜娜一区二区三区| 成人a级免费电影| 欧美视频三区在线播放| 欧美videossexotv100| 久久女同互慰一区二区三区| 中文字幕在线免费不卡| 日韩av一级片| 波波电影院一区二区三区| 欧美午夜电影网| 日韩精品一区在线观看| 亚洲婷婷在线视频| 美女脱光内衣内裤视频久久影院| 国产成人精品一区二区三区四区| 色欧美日韩亚洲| 欧美大尺度电影在线| 亚洲欧美在线高清| 另类欧美日韩国产在线| 国产91在线|亚洲| 欧美日韩另类一区| 亚洲国产成人在线| 秋霞国产午夜精品免费视频| www..com久久爱| 91精品国产色综合久久不卡电影| 国产精品毛片高清在线完整版| 视频一区二区三区入口| av网站免费线看精品| 欧美一激情一区二区三区| 亚洲欧洲日韩女同| 麻豆91小视频| 欧美影视一区在线| 国产精品二三区| 免费观看日韩av| 在线看不卡av| 国产精品国产馆在线真实露脸 | 欧洲人成人精品| 欧美激情在线免费观看| 蜜臀91精品一区二区三区 | 久久女同性恋中文字幕| 性欧美大战久久久久久久久| 成人免费不卡视频| 久久综合成人精品亚洲另类欧美| 亚洲夂夂婷婷色拍ww47| av在线不卡观看免费观看| 精品国偷自产国产一区| 丝袜美腿一区二区三区| 91传媒视频在线播放| 国产精品国产精品国产专区不片| 韩国女主播一区| 欧美一区二区播放| 水野朝阳av一区二区三区| 91丨porny丨国产| 中国av一区二区三区| 狠狠色狠狠色综合系列| 欧美人xxxx| 亚洲成人精品一区| 色偷偷88欧美精品久久久| 国产精品素人一区二区| 国产九色sp调教91| 精品久久久久久久久久久院品网| 性久久久久久久久久久久| 欧美性三三影院| 亚洲一二三四久久| 欧美色综合久久| 亚洲综合丁香婷婷六月香| 97se亚洲国产综合在线| 国产精品久久久久7777按摩| 成人永久aaa| 日本一区二区成人| 床上的激情91.| 国产欧美日本一区二区三区| 国产伦精一区二区三区| 久久综合色一综合色88| 国产乱码精品一品二品| 久久日一线二线三线suv| 国内精品自线一区二区三区视频| 精品av久久707| 国产精品一区二区男女羞羞无遮挡| 日韩欧美123| 国产乱色国产精品免费视频| 中文字幕二三区不卡| 成人精品一区二区三区中文字幕| 日本一区二区三区国色天香| 成人免费视频国产在线观看| 1024成人网| 在线一区二区观看| 天天综合天天综合色| 欧美一区二区三区不卡| 黄页视频在线91| 中文av一区二区| 在线观看av不卡| 蜜臀av一区二区在线观看| 久久综合色8888| av一区二区三区在线| 亚洲资源在线观看| 日韩一级二级三级精品视频| 国产综合色视频| 中文字幕一区二| 欧美另类变人与禽xxxxx| 麻豆精品一区二区综合av| 久久久精品日韩欧美| 色综合天天在线| 日日夜夜免费精品| 国产免费成人在线视频| 色综合久久久网| 美女视频黄久久| 久久久国产精华| 91浏览器打开| 日韩高清一级片| 欧美高清在线视频| 欧美日韩免费不卡视频一区二区三区| 美女脱光内衣内裤视频久久网站 | 在线观看91av| 国产成人啪午夜精品网站男同| 最新日韩av在线| 91精品一区二区三区在线观看| 国产精品一区专区| 亚洲国产日韩一级| 久久综合给合久久狠狠狠97色69| 色综合视频一区二区三区高清| 日韩精品国产欧美| 国产精品福利影院| 日韩欧美色综合| 色综合天天综合给合国产| 美腿丝袜在线亚洲一区| 亚洲视频 欧洲视频| 日韩一区二区三区免费观看| 成人网男人的天堂| 青草av.久久免费一区| 中文字幕一区在线观看| 欧美大白屁股肥臀xxxxxx| 色哟哟国产精品免费观看| 精品亚洲成a人| 亚洲综合丝袜美腿| 国产精品色哟哟网站| 日韩网站在线看片你懂的| 91亚洲精品一区二区乱码| 麻豆精品一区二区三区| 亚洲在线成人精品| 欧美激情艳妇裸体舞| 日韩视频一区二区| 色88888久久久久久影院野外| 国产资源在线一区| 舔着乳尖日韩一区| 亚洲美女视频一区| 国产精品日韩成人| 日韩精品一区二区三区swag| 欧美在线综合视频| 成人av资源站| 国产精品一区二区在线看| 青青草97国产精品免费观看| 亚洲国产综合91精品麻豆 | 成人激情动漫在线观看| 欧美aaaaa成人免费观看视频| 亚洲精品国产a| 一区视频在线播放| 国产精品亲子伦对白| 国产视频不卡一区| 日韩免费成人网| 日韩欧美国产麻豆| 69堂精品视频| 欧美丰满少妇xxxxx高潮对白| 一本久道中文字幕精品亚洲嫩| 成人aa视频在线观看| 国产丶欧美丶日本不卡视频| 国产一区二区三区精品欧美日韩一区二区三区 | 一区二区三区在线视频免费| 国产精品无圣光一区二区| 久久婷婷国产综合国色天香| 精品国产免费视频| 欧美精品一区二区三区蜜臀|