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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_tmr.c

?? LPC2106開發(fā)板上面的uCOS移植代碼最新版2.83
?? C
?? 第 1 頁 / 共 3 頁
字號:
    if (ptmr->OSTmrType != OS_TMR_TYPE) {              /* Validate timer structure                                    */
        *perr = OS_ERR_TMR_INVALID_TYPE;
        return (0);
    }
    if (OSIntNesting > 0) {                            /* See if trying to call from an ISR                           */
        *perr = OS_ERR_TMR_ISR;
        return (0);
    }
    OSTmr_Lock();
    switch (ptmr->OSTmrState) {
        case OS_TMR_STATE_RUNNING:
             remain = ptmr->OSTmrMatch - OSTmrTime;    /* Determine how much time is left to timeout                  */
             OSTmr_Unlock();
             *perr  = OS_NO_ERR;
             return (remain);

        case OS_TMR_STATE_STOPPED:                     /* It's assumed that the timer has not started yet             */
             switch (ptmr->OSTmrOpt) {
                 case OS_TMR_OPT_PERIODIC:
                      if (ptmr->OSTmrDly == 0) {
                          remain = ptmr->OSTmrPeriod;
                      } else {
                          remain = ptmr->OSTmrDly;
                      }
                      OSTmr_Unlock();
                      *perr  = OS_NO_ERR;
                      break;

                 case OS_TMR_OPT_ONE_SHOT:
                      remain = ptmr->OSTmrDly;
                      OSTmr_Unlock();
                      *perr  = OS_NO_ERR;
                      break;
             }
             return (remain);

        case OS_TMR_STATE_COMPLETED:                   /* Only ONE-SHOT that timed out can be in this state           */
             OSTmr_Unlock();
             *perr  = OS_NO_ERR;
             return (0);

        case OS_TMR_STATE_UNUSED:
             OSTmr_Unlock();
             *perr  = OS_ERR_TMR_INACTIVE;
             return (0);

        default:
             OSTmr_Unlock();
             *perr  = OS_ERR_TMR_INVALID_STATE;
             return (0);
    }
}
#endif

/*$PAGE*/
/*
************************************************************************************************************************
*                                    FIND OUT WHAT STATE A TIMER IS IN
*
* Description: This function is called to determine what state the timer is in:
*
*                  OS_TMR_STATE_UNUSED     the timer has not been created
*                  OS_TMR_STATE_STOPPED    the timer has been created but has not been started or has been stopped
*                  OS_TMR_COMPLETED        the timer is in ONE-SHOT mode and has completed it's timeout
*                  OS_TMR_RUNNING          the timer is currently running
*
* Arguments  : ptmr          Is a pointer to the desired timer
*
*              perr          Is a pointer to an error code.  '*perr' will contain one of the following:
*                               OS_NO_ERR
*                               OS_ERR_TMR_INVALID        'ptmr' is a NULL pointer
*                               OS_ERR_TMR_INVALID_TYPE   'ptmr'  is not pointing to an OS_TMR
*                               OS_ERR_TMR_ISR            if the call was made from an ISR
*                               OS_ERR_TMR_INACTIVE       'ptmr' points to a timer that is not active
*                               OS_ERR_TMR_INVALID_STATE  if the timer is not in a valid state
*
* Returns    : The current state of the timer (see description).
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
INT8U  OSTmrStateGet (OS_TMR  *ptmr,
                      INT8U   *perr)
{
    INT8U  state;


#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {
        return (0);
    }
    if (ptmr == (OS_TMR *)0) {
        *perr = OS_ERR_TMR_INVALID;
        return (0);
    }
#endif
    if (ptmr->OSTmrType != OS_TMR_TYPE) {              /* Validate timer structure                                    */
        *perr = OS_ERR_TMR_INVALID_TYPE;
        return (0);
    }
    if (OSIntNesting > 0) {                            /* See if trying to call from an ISR                           */
        *perr = OS_ERR_TMR_ISR;
        return (0);
    }
    OSTmr_Lock();
    state = ptmr->OSTmrState;
    switch (state) {
        case OS_TMR_STATE_UNUSED:   
        case OS_TMR_STATE_STOPPED:  
        case OS_TMR_STATE_COMPLETED:
        case OS_TMR_STATE_RUNNING:  
             *perr = OS_NO_ERR;
             break;
             
        default:
             *perr = OS_ERR_TMR_INVALID_STATE;
             break;
    }
    OSTmr_Unlock();
    return (state);
}
#endif

/*$PAGE*/
/*
************************************************************************************************************************
*                                                   START A TIMER
*
* Description: This function is called by your application code to create and start a timer.
*
* Arguments  : ptmr          Is a pointer to an OS_TMR
*
*              perr          Is a pointer to an error code.  '*perr' will contain one of the following:
*                               OS_NO_ERR
*                               OS_ERR_TMR_INVALID
*                               OS_ERR_TMR_INVALID_TYPE    'ptmr'  is not pointing to an OS_TMR
*                               OS_ERR_TMR_ISR             if the call was made from an ISR
*                               OS_ERR_TMR_INACTIVE        if the timer was not created
*                               OS_ERR_TMR_INVALID_STATE   the timer is in an invalid state
*
* Returns    : OS_TRUE    if the timer was started
*              OS_FALSE   if an error was detected
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
BOOLEAN  OSTmrStart (OS_TMR   *ptmr,
                     INT8U    *perr)
{
#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {                               /* Validate arguments                                     */
        return (OS_FALSE);
    }
    if (ptmr == (OS_TMR *)0) {
        *perr = OS_ERR_TMR_INVALID;
        return (OS_FALSE);
    }
#endif
    if (ptmr->OSTmrType != OS_TMR_TYPE) {                   /* Validate timer structure                               */
        *perr = OS_ERR_TMR_INVALID_TYPE;
        return (OS_FALSE);
    }
    if (OSIntNesting > 0) {                                 /* See if trying to call from an ISR                      */
        *perr  = OS_ERR_TMR_ISR;
        return (OS_FALSE);
    }
    OSTmr_Lock();
    switch (ptmr->OSTmrState) {
        case OS_TMR_STATE_RUNNING:                          /* Restart the timer                                      */
             OSTmr_Unlink(ptmr);                            /* ... Stop the timer                                     */
             OSTmr_Link(ptmr, OS_TMR_LINK_DLY);             /* ... Link timer to timer wheel                          */
             OSTmr_Unlock();
             *perr = OS_NO_ERR;
             return (OS_TRUE);

        case OS_TMR_STATE_STOPPED:                          /* Start the timer                                        */
        case OS_TMR_STATE_COMPLETED:
             OSTmr_Link(ptmr, OS_TMR_LINK_DLY);             /* ... Link timer to timer wheel                          */
             OSTmr_Unlock();
             *perr = OS_NO_ERR;
             return (OS_TRUE);

        case OS_TMR_STATE_UNUSED:                           /* Timer not created                                      */
             OSTmr_Unlock();
             *perr = OS_ERR_TMR_INACTIVE;
             return (OS_FALSE);

        default:
             OSTmr_Unlock();
             *perr = OS_ERR_TMR_INVALID_STATE;
             return (OS_FALSE);
    }
}
#endif

/*$PAGE*/
/*
************************************************************************************************************************
*                                                   STOP A TIMER
*
* Description: This function is called by your application code to stop and delete a timer.
*
* Arguments  : ptmr          Is a pointer to the timer to stop and delete.
*
*              opt           Allows you to specify an option to this functions which can be:
*
*                               OS_TMR_OPT_NONE          Do nothing special but stop the timer
*                               OS_TMR_OPT_CALLBACK      Execute the callback function, pass it the callback argument
*                                                        specified when the timer was created.
*                               OS_TMR_OPT_CALLBACK_ARG  Execute the callback function, pass it the callback argument
*                                                        specified in THIS function call
*
*              callback_arg  Is a pointer to a 'new' callback argument that can be passed to the callback function
*                               instead of the timer's callback argument.  In other words, use 'callback_arg' passed in
*                               THIS function INSTEAD of ptmr->OSTmrCallbackArg
*
*              perr          Is a pointer to an error code.  '*perr' will contain one of the following:
*                               OS_NO_ERR
*                               OS_ERR_TMR_INVALID         'ptmr' is a NULL pointer
*                               OS_ERR_TMR_INVALID_TYPE    'ptmr'  is not pointing to an OS_TMR
*                               OS_ERR_TMR_ISR             if the function was called from an ISR
*                               OS_ERR_TMR_INACTIVE        if the timer was not created
*                               OS_ERR_TMR_INVALID_OPT     if you specified an invalid option for 'opt'
*                               OS_ERR_TMR_STOPPED         if the timer was already stopped
*                               OS_ERR_TMR_INVALID_STATE   the timer is in an invalid state
*                               OS_ERR_TMR_NO_CALLBACK     if the timer does not have a callback function defined
*
* Returns    : OS_TRUE       If the call was successful (if the timer is already stopped, we also return OS_TRUE)
*              OS_FALSE      If not
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
BOOLEAN  OSTmrStop (OS_TMR  *ptmr,
                    INT8U    opt,
                    void    *callback_arg,
                    INT8U   *perr)
{
    OS_TMR_CALLBACK  pfnct;


#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {                                     /* Validate arguments                               */
        return (OS_FALSE);
    }
    if (ptmr == (OS_TMR *)0) {
        *perr = OS_ERR_TMR_INVALID;
        return (OS_FALSE);
    }
#endif
    if (ptmr->OSTmrType != OS_TMR_TYPE) {                         /* Validate timer structure                         */
        *perr = OS_ERR_TMR_INVALID_TYPE;
        return (OS_FALSE);
    }
    if (OSIntNesting > 0) {                                       /* See if trying to call from an ISR                */
        *perr  = OS_ERR_TMR_ISR;
        return (OS_FALSE);
    }
    OSTmr_Lock();
    switch (ptmr->OSTmrState) {
        case OS_TMR_STATE_RUNNING:
             OSTmr_Unlink(ptmr);                                  /* Remove from current wheel spoke                  */
             *perr = OS_NO_ERR;
             switch (opt) {
                 case OS_TMR_OPT_CALLBACK:
                      pfnct = ptmr->OSTmrCallback;                /* Execute callback function if available ...       */
                      if (pfnct != (OS_TMR_CALLBACK)0) {
                          (*pfnct)(ptmr, ptmr->OSTmrCallbackArg); /* ... using the 'argument' specified @ creation    */
                      } else {
                          *perr = OS_ERR_TMR_NO_CALLBACK;
                          return (OS_FALSE);
                      }
                      break;

                 case OS_TMR_OPT_CALLBACK_ARG:
                      pfnct = ptmr->OSTmrCallback;                /* Execute callback function if available ...       */
                      if (pfnct != (OS_TMR_CALLBACK)0) {
                          (*pfnct)(ptmr, callback_arg);           /* ... using the 'callback_arg' provided in call    */
                      } else {
                          *perr = OS_ERR_TMR_NO_CALLBACK;
                          return (OS_FALSE);
                      }
                      break;

                 case OS_TMR_OPT_NONE:
                      break;

                 default:
                     OSTmr_Unlock();
                     *perr = OS_ERR_TMR_INVALID_OPT;
                     return (OS_FALSE);
             }
             OSTmr_Unlock();
             return (OS_TRUE);

        case OS_TMR_STATE_COMPLETED:                              /* Timer has already completed the ONE-SHOT or ...  */
        case OS_TMR_STATE_STOPPED:                                /* ... timer has not started yet.                   */
             OSTmr_Unlock();
             *perr = OS_ERR_TMR_STOPPED;
             return (OS_TRUE);

        case OS_TMR_STATE_UNUSED:                                 /* Timer was not created                            */
             OSTmr_Unlock();
             *perr = OS_ERR_TMR_INACTIVE;
             return (OS_FALSE);

        default:
             OSTmr_Unlock();
             *perr = OS_ERR_TMR_INVALID_STATE;
             return (OS_FALSE);
    }
}
#endif

/*$PAGE*/
/*
************************************************************************************************************************
*                                      SIGNAL THAT IT'S TIME TO UPDATE THE TIMERS
*
* Description: This function is typically called by the ISR that occurs at the timer tick rate and is used to signal to
*              OSTmr_Task() that it's time to update the timers.
*
* Arguments  : none
*
* Returns    : none
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
INT8U  OSTmrSignal (void)
{
    INT8U  err;


    err = OSSemPost(OSTmrSemSignal);
    return (err);
}
#endif

/*$PAGE*/
/*
************************************************************************************************************************
*                                               ALLOCATE AND FREE A TIMER
*
* Description: This function is called to allocate a timer.
*
* Arguments  : none
*
* Returns    : a pointer to a timer if one is available
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
static  OS_TMR  *OSTmr_Alloc (void)
{
    OS_TMR *ptmr;


    if (OSTmrFreeList == (OS_TMR *)0) {
        return ((OS_TMR *)0);
    }
    ptmr            = (OS_TMR *)OSTmrFreeList;
    OSTmrFreeList   = (OS_TMR *)ptmr->OSTmrNext;
    ptmr->OSTmrNext = (OS_TCB *)0;
    ptmr->OSTmrPrev = (OS_TCB *)0;
    OSTmrUsed++;
    OSTmrFree--;
    return (ptmr);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆精品国产综合久久久久久 | 色综合久久综合网欧美综合网| 日本欧美大码aⅴ在线播放| 亚洲欧美激情小说另类| 亚洲人一二三区| 亚洲已满18点击进入久久| 亚洲大片精品永久免费| 日韩一区精品字幕| 国产白丝精品91爽爽久久| 高清不卡一二三区| 在线亚洲+欧美+日本专区| 欧美视频一区二区| 久久久久久久精| 亚洲成av人片一区二区梦乃| 蜜桃视频在线观看一区二区| 粉嫩13p一区二区三区| 色综合久久久久综合体| 欧美成人三级在线| 亚洲综合丝袜美腿| 国内精品视频666| 欧美日韩你懂得| 中文字幕在线一区免费| 久热成人在线视频| 91搞黄在线观看| 国产精品人人做人人爽人人添| 一区二区三区欧美日| 成人亚洲一区二区一| 日韩女优电影在线观看| 亚洲精品午夜久久久| 国产精品一区专区| 久久久亚洲高清| 日韩精品福利网| 欧美性猛交xxxx黑人交| 国产成人精品aa毛片| 国产成人亚洲综合a∨婷婷图片| 日本韩国视频一区二区| 国产精品大尺度| eeuss影院一区二区三区| 国产女同互慰高潮91漫画| 国产一区二区三区美女| 欧美精品一区二区三| 捆绑变态av一区二区三区| 欧美一区二区三区四区久久| 亚洲成av人片一区二区梦乃| 欧美日韩一区二区三区视频 | 视频一区中文字幕国产| 91黄色激情网站| 日韩高清中文字幕一区| 精品少妇一区二区三区视频免付费| 天天综合日日夜夜精品| 欧美不卡一区二区三区四区| 韩国三级在线一区| 最近中文字幕一区二区三区| 欧美视频在线一区| 精品一区二区久久| 亚洲美女一区二区三区| 在线播放欧美女士性生活| 国产精品一区免费视频| 夜夜嗨av一区二区三区网页| 日韩一区二区三区在线| 成人中文字幕合集| 蜜臀久久99精品久久久久宅男| 欧美精品一区二区在线观看| 91小视频免费看| 国产在线精品一区二区不卡了 | 成人app下载| 人人超碰91尤物精品国产| 国产欧美日韩在线观看| 欧美一区二区在线看| 99re成人在线| 国产夫妻精品视频| 成人午夜av在线| 激情综合色播激情啊| 久久精品一区二区| 国内精品写真在线观看| 亚洲黄色av一区| 欧美精品少妇一区二区三区| 国产成人亚洲精品青草天美| 亚洲日韩欧美一区二区在线| 丁香一区二区三区| 蜜桃av一区二区在线观看| 男女男精品视频| 最新国产の精品合集bt伙计| 久久精品一区二区三区不卡 | 久久久亚洲高清| 精品福利一区二区三区| 一本久久综合亚洲鲁鲁五月天 | 精品国产一区二区三区不卡| 欧美日韩一区二区欧美激情| 欧美日韩视频专区在线播放| 欧美天堂亚洲电影院在线播放| 一本大道久久精品懂色aⅴ| 一本大道久久a久久精品综合| 91麻豆成人久久精品二区三区| 日本久久一区二区三区| 国产精品亚洲专一区二区三区| 国产又黄又大久久| 欧美日韩免费电影| 欧美视频中文一区二区三区在线观看| 欧美在线观看视频一区二区 | 婷婷成人综合网| 美女网站色91| av电影在线不卡| 欧美va亚洲va香蕉在线 | 国内一区二区视频| 成人污污视频在线观看| 91国偷自产一区二区三区成为亚洲经典| 色诱亚洲精品久久久久久| 91精品蜜臀在线一区尤物| 久久久天堂av| 美女视频黄久久| 色香蕉成人二区免费| 久久网站热最新地址| 亚洲大片精品永久免费| 91在线小视频| 久久九九全国免费| 天天免费综合色| 99国产麻豆精品| 亚洲国产精品ⅴa在线观看| 日日骚欧美日韩| 日韩视频国产视频| 蜜臀精品久久久久久蜜臀| 一本大道久久a久久精品综合| 91在线免费视频观看| 色婷婷精品大在线视频| www.99精品| 久久精品夜色噜噜亚洲aⅴ| 91精品午夜视频| 亚洲最大成人综合| 91论坛在线播放| 自拍偷拍国产亚洲| 97久久久精品综合88久久| 国产欧美一区二区精品性| 日本在线不卡一区| 日韩午夜激情av| 奇米亚洲午夜久久精品| 日韩欧美一区二区久久婷婷| 日韩国产欧美在线播放| 91精品国产综合久久精品图片| 亚洲激情第一区| 91网站黄www| 日韩av电影免费观看高清完整版在线观看| 欧洲精品在线观看| 蜜乳av一区二区| 久久无码av三级| 欧美中文字幕不卡| 激情五月播播久久久精品| 中文字幕亚洲在| 欧美日韩精品系列| www.久久久久久久久| 无码av中文一区二区三区桃花岛| 精品国产一区二区三区四区四 | 色婷婷久久99综合精品jk白丝| 国产精品美女久久久久高潮| 91影院在线观看| 久久97超碰色| 夜夜亚洲天天久久| 欧美极品少妇xxxxⅹ高跟鞋| 在线观看av一区| 国产成人日日夜夜| 蜜臀av性久久久久蜜臀av麻豆| 欧美精彩视频一区二区三区| 欧美日韩精品欧美日韩精品| 国产盗摄视频一区二区三区| 日本少妇一区二区| 中文字幕av在线一区二区三区| 91色在线porny| 成人av在线播放网址| 国内精品伊人久久久久av一坑| 麻豆国产精品777777在线| 婷婷综合五月天| 首页欧美精品中文字幕| 亚洲一区二区影院| 亚洲电影第三页| 午夜视频在线观看一区二区 | 99久久夜色精品国产网站| 国产呦精品一区二区三区网站| 蜜臀久久99精品久久久画质超高清| 有坂深雪av一区二区精品| 一区二区三区资源| 亚洲国产一区二区三区| 日本中文在线一区| 国产在线视频不卡二| av在线不卡免费看| 色综合天天性综合| 91精品国产综合久久久久久| 欧美高清精品3d| aaa国产一区| 国产综合色精品一区二区三区| 蜜臀99久久精品久久久久久软件| 亚洲成人激情社区| 亚洲精品中文在线影院| 亚洲国产精品高清| 国产欧美一区二区在线| 欧美精品精品一区| 久久综合狠狠综合| 亚洲品质自拍视频| 免费观看日韩电影| 成人a区在线观看| 日韩欧美亚洲一区二区|