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

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

?? os_tmr.c

?? uCOS-II-2.86,最新版本啦,里面還有詳細的說明和幫助文檔呢.
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
************************************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TIMER MANAGEMENT
*
*                              (c) Copyright 1992-2007, Micrium, Weston, FL
*                                           All Rights Reserved
*
*
* File    : OS_TMR.C
* By      : Jean J. Labrosse
* Version : V2.86
*
* LICENSING TERMS:
* ---------------
*   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
* If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
* its use in your product. We provide ALL the source code for your convenience and to help you experience 
* uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
* licensing fee.
************************************************************************************************************************
*/

#include <ucos_ii.h>

/*
************************************************************************************************************************
*                                                        NOTES
*
* 1) Your application MUST define the following #define constants:
*
*    OS_TASK_TMR_PRIO          The priority of the Timer management task
*    OS_TASK_TMR_STK_SIZE      The size     of the Timer management task's stack
*
* 2) You must call OSTmrSignal() to notify the Timer management task that it's time to update the timers.
************************************************************************************************************************
*/

/*
************************************************************************************************************************
*                                                     CONSTANTS
************************************************************************************************************************
*/

#define  OS_TMR_LINK_DLY       0
#define  OS_TMR_LINK_PERIODIC  1

/*
************************************************************************************************************************
*                                                  LOCAL PROTOTYPES
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
static  OS_TMR  *OSTmr_Alloc         (void);
static  void     OSTmr_Free          (OS_TMR *ptmr);
static  void     OSTmr_InitTask      (void);
static  void     OSTmr_Link          (OS_TMR *ptmr, INT8U type);
static  void     OSTmr_Unlink        (OS_TMR *ptmr);
static  void     OSTmr_Lock          (void);
static  void     OSTmr_Unlock        (void);
static  void     OSTmr_Task          (void   *p_arg);
#endif

/*$PAGE*/
/*
************************************************************************************************************************
*                                                   CREATE A TIMER
*
* Description: This function is called by your application code to create a timer.
*
* Arguments  : dly           Initial delay.
*                            If the timer is configured for ONE-SHOT mode, this is the timeout used
*                            If the timer is configured for PERIODIC mode, this is the first timeout to wait for
*                               before the timer starts entering periodic mode
*
*              period        The 'period' being repeated for the timer.
*                               If you specified 'OS_TMR_OPT_PERIODIC' as an option, when the timer expires, it will
*                               automatically restart with the same period.
*
*              opt           Specifies either:
*                               OS_TMR_OPT_ONE_SHOT       The timer counts down only once
*                               OS_TMR_OPT_PERIODIC       The timer counts down and then reloads itself
*
*              callback      Is a pointer to a callback function that will be called when the timer expires.  The
*                               callback function must be declared as follows:
*
*                               void MyCallback (OS_TMR *ptmr, void *p_arg);
*
*              callback_arg  Is an argument (a pointer) that is passed to the callback function when it is called.
*
*              pname         Is a pointer to an ASCII string that is used to name the timer.  Names are useful for
*                               debugging.  The length of the ASCII string for the name can be as big as:
*
*                               OS_TMR_CFG_NAME_SIZE and should be found in OS_CFG.H
*
*              perr          Is a pointer to an error code.  '*perr' will contain one of the following:
*                               OS_ERR_NONE
*                               OS_ERR_TMR_INVALID_DLY     you specified an invalid delay
*                               OS_ERR_TMR_INVALID_PERIOD  you specified an invalid period
*                               OS_ERR_TMR_INVALID_OPT     you specified an invalid option
*                               OS_ERR_TMR_ISR             if the call was made from an ISR
*                               OS_ERR_TMR_NON_AVAIL       if there are no free timers from the timer pool
*                               OS_ERR_TMR_NAME_TOO_LONG   if the timer name is too long to fit
*
* Returns    : A pointer to an OS_TMR data structure.  
*              This is the 'handle' that your application will use to reference the timer created.
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
OS_TMR  *OSTmrCreate (INT32U           dly,
                      INT32U           period,
                      INT8U            opt,
                      OS_TMR_CALLBACK  callback,
                      void            *callback_arg,
                      INT8U           *pname,
                      INT8U           *perr)
{
    OS_TMR   *ptmr;
#if OS_TMR_CFG_NAME_SIZE > 0
    INT8U     len;
#endif


#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {                               /* Validate arguments                                     */
        return ((OS_TMR *)0);
    }
    switch (opt) {
        case OS_TMR_OPT_PERIODIC:
             if (period == 0) {
                 *perr = OS_ERR_TMR_INVALID_PERIOD;
                 return ((OS_TMR *)0);
             }
             break;

        case OS_TMR_OPT_ONE_SHOT:
             if (dly == 0) {
                 *perr = OS_ERR_TMR_INVALID_DLY;
                 return ((OS_TMR *)0);
             }
             break;

        default:
             *perr = OS_ERR_TMR_INVALID_OPT;
             return ((OS_TMR *)0);
    }
#endif
    if (OSIntNesting > 0) {                                 /* See if trying to call from an ISR                      */
        *perr  = OS_ERR_TMR_ISR;
        return ((OS_TMR *)0);
    }
    OSTmr_Lock();
    ptmr = OSTmr_Alloc();                                   /* Obtain a timer from the free pool                      */
    if (ptmr == (OS_TMR *)0) {
        OSTmr_Unlock();
        *perr = OS_ERR_TMR_NON_AVAIL;
        return ((OS_TMR *)0);
    }
    ptmr->OSTmrState       = OS_TMR_STATE_STOPPED;          /* Indicate that timer is not running yet                 */
    ptmr->OSTmrDly         = dly;
    ptmr->OSTmrPeriod      = period;
    ptmr->OSTmrOpt         = opt;
    ptmr->OSTmrCallback    = callback;
    ptmr->OSTmrCallbackArg = callback_arg;
#if OS_TMR_CFG_NAME_SIZE > 0
    if (pname !=(INT8U *)0) {
        len = OS_StrLen(pname);                             /* Copy timer name                                        */
        if (len < OS_TMR_CFG_NAME_SIZE) {
            (void)OS_StrCopy(ptmr->OSTmrName, pname);
        } else {
#if OS_TMR_CFG_NAME_SIZE > 1
            ptmr->OSTmrName[0] = '#';                       /* Invalid size specified                                 */
            ptmr->OSTmrName[1] = OS_ASCII_NUL;
#endif
            *perr              = OS_ERR_TMR_NAME_TOO_LONG;
            OSTmr_Unlock();
            return (ptmr);
        }
    }
#endif
    OSTmr_Unlock();
    *perr = OS_ERR_NONE;
    return (ptmr);
}
#endif

/*$PAGE*/
/*
************************************************************************************************************************
*                                                   DELETE A TIMER
*
* Description: This function is called by your application code to delete a timer.
*
* Arguments  : ptmr          Is a pointer to the timer to stop and delete.
*
*              perr          Is a pointer to an error code.  '*perr' will contain one of the following:
*                               OS_ERR_NONE
*                               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_STATE  the timer is in an invalid state
*
* Returns    : OS_TRUE       If the call was successful
*              OS_FALSE      If not
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
BOOLEAN  OSTmrDel (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:
             OSTmr_Unlink(ptmr);                            /* Remove from current wheel spoke                        */
             OSTmr_Free(ptmr);                              /* Return timer to free list of timers                    */
             OSTmr_Unlock();
             *perr = OS_ERR_NONE;
             return (OS_TRUE);

        case OS_TMR_STATE_STOPPED:                          /* Timer has not started or ...                           */
        case OS_TMR_STATE_COMPLETED:                        /* ... timer has completed the ONE-SHOT time              */
             OSTmr_Free(ptmr);                              /* Return timer to free list of timers                    */
             OSTmr_Unlock();
             *perr = OS_ERR_NONE;
             return (OS_TRUE);

        case OS_TMR_STATE_UNUSED:                           /* Already deleted                                        */
             OSTmr_Unlock();
             *perr = OS_ERR_TMR_INACTIVE;
             return (OS_FALSE);

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

/*$PAGE*/
/*
************************************************************************************************************************
*                                             GET THE NAME OF A TIMER
*
* Description: This function is called to obtain the name of a timer.
*
* Arguments  : ptmr          Is a pointer to the timer to obtain the name for
*
*              pdest         Is a pointer to where the name of the timer will be placed.  It is the caller's responsibility
*                            to ensure that he has sufficient storage in the destination, i.e. at least OS_TMR_CFG_NAME_SIZE
*
*              perr          Is a pointer to an error code.  '*perr' will contain one of the following:
*                               OS_ERR_NONE               The call was successful
*                               OS_ERR_TMR_INVALID_DEST   'pdest' is a NULL pointer
*                               OS_ERR_TMR_INVALID        'ptmr'  is a NULL pointer
*                               OS_ERR_TMR_INVALID_TYPE   'ptmr'  is not pointing to an OS_TMR
*                               OS_ERR_NAME_GET_ISR       if the call was made from an ISR
*                               OS_ERR_TMR_INACTIVE       'ptmr'  points to a timer that is not active

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩你懂的在线播放| 亚洲成av人片一区二区梦乃| 亚洲一区在线观看免费 | 日韩欧美色综合| 亚洲国产精品ⅴa在线观看| 亚洲最新在线观看| 国产一区二区免费看| 欧美性一区二区| 欧美国产日韩一二三区| 日本一不卡视频| 在线中文字幕不卡| 国产农村妇女毛片精品久久麻豆 | 在线亚洲一区观看| 国产婷婷色一区二区三区四区| 午夜免费久久看| 91老师片黄在线观看| 国产亚洲欧美激情| 麻豆国产一区二区| 欧美色图在线观看| 亚洲人123区| 成人激情免费视频| 欧美电影免费观看高清完整版在| 亚洲影视资源网| 99久久99久久精品国产片果冻| 久久婷婷成人综合色| 美女一区二区久久| 欧美精品免费视频| 亚洲一区视频在线观看视频| 97成人超碰视| 亚洲精品中文在线影院| 97se狠狠狠综合亚洲狠狠| 国产精品三级视频| 国产成人午夜99999| 国产亚洲精品7777| 国产高清不卡一区二区| 2023国产精品| 国产iv一区二区三区| 精品日韩一区二区三区| 美女mm1313爽爽久久久蜜臀| 91精品国产一区二区三区香蕉 | 免费的成人av| 一区二区国产盗摄色噜噜| 成人免费高清在线观看| 日本一区二区三区电影| 成人小视频免费观看| 国产精品卡一卡二| 91亚洲精品一区二区乱码| 一区二区三区在线视频观看| 欧美曰成人黄网| 视频在线在亚洲| 日韩一二在线观看| 国产乱国产乱300精品| 国产欧美精品一区| 99久久精品久久久久久清纯| 亚洲国产精品久久不卡毛片| 91精品一区二区三区在线观看| 久久黄色级2电影| 国产亚洲精品aa| 91久久精品一区二区三| 日本午夜一区二区| 国产欧美视频在线观看| 色狠狠av一区二区三区| 午夜激情久久久| 久久亚洲一区二区三区明星换脸| av在线播放不卡| 性欧美大战久久久久久久久| 久久久国产综合精品女国产盗摄| 91免费小视频| 免费视频最近日韩| 中文字幕在线不卡一区二区三区| 欧美日本韩国一区二区三区视频 | 日韩欧美一二三区| 国产成人久久精品77777最新版本| 亚洲欧洲精品天堂一级| 欧美精品在线一区二区三区| 国产91高潮流白浆在线麻豆| 亚洲一区二区三区不卡国产欧美| 欧美不卡在线视频| 91理论电影在线观看| 久久99精品国产.久久久久| 日韩一区在线播放| 日韩一级成人av| 欧美亚洲丝袜传媒另类| 国产老妇另类xxxxx| 午夜电影网一区| 国产精品久久久久久亚洲伦| 欧美成人a视频| 欧美少妇bbb| 91免费看`日韩一区二区| 精品一区二区三区免费观看 | 久久久无码精品亚洲日韩按摩| 色偷偷久久一区二区三区| 激情文学综合丁香| 午夜亚洲福利老司机| 国产精品久久毛片av大全日韩| 日韩视频免费直播| 欧美亚洲禁片免费| 不卡欧美aaaaa| 国产精品伊人色| 久久91精品国产91久久小草| 亚洲国产aⅴ成人精品无吗| 国产精品久久久久久久久久久免费看| 欧美变态tickle挠乳网站| 欧美视频三区在线播放| 一本色道**综合亚洲精品蜜桃冫| 国产成人免费在线观看不卡| 激情文学综合插| 麻豆成人久久精品二区三区红 | 人禽交欧美网站| 午夜影视日本亚洲欧洲精品| 亚洲一区视频在线| 最近中文字幕一区二区三区| 136国产福利精品导航| 国产视频一区不卡| 精品国产乱码91久久久久久网站| 欧美一区二区美女| 欧美一区二区三区四区五区| 欧美一区二区三区免费观看视频 | 成人午夜精品在线| 国产一区二区三区久久久 | 精品久久久久av影院| 91精品国产色综合久久不卡蜜臀| 欧美精品乱码久久久久久| 欧美性受xxxx黑人xyx性爽| 欧美日韩视频不卡| 欧美视频在线播放| 在线成人午夜影院| 91精品国产乱| 久久综合九色综合久久久精品综合| 欧美v日韩v国产v| 久久影音资源网| 国产精品国产馆在线真实露脸| 成人欧美一区二区三区| 亚洲另类中文字| 日韩精品亚洲一区| 久久精品久久久精品美女| 国产精品综合av一区二区国产馆| 高清不卡在线观看| 99r国产精品| 欧美电影在线免费观看| 欧美电影免费观看高清完整版在线| 2021久久国产精品不只是精品| 中文字幕一区二区三区色视频 | 91丝袜美女网| 色综合久久久久综合99| 欧美顶级少妇做爰| 精品美女被调教视频大全网站| 国产欧美精品一区二区色综合朱莉| 亚洲美女电影在线| 日韩不卡手机在线v区| 国产99精品国产| 欧美日韩在线一区二区| 欧美成人国产一区二区| 综合久久国产九一剧情麻豆| 日本中文字幕不卡| 国产精品一二二区| 欧美性淫爽ww久久久久无| 欧美电影免费观看高清完整版在线| 国产精品国产三级国产| 日韩不卡一二三区| 91在线视频官网| 日韩欧美一二区| 一区二区在线观看视频| 久久97超碰色| 欧美日韩免费一区二区三区 | 亚洲色图第一区| 久久精品久久99精品久久| 99re视频精品| 欧美激情一区在线| 视频在线观看一区二区三区| 91亚洲大成网污www| 欧美成人猛片aaaaaaa| 亚洲丶国产丶欧美一区二区三区| 粉嫩久久99精品久久久久久夜| 欧美一区在线视频| 一区二区三区丝袜| 国产不卡视频在线观看| 欧美一区二区高清| 亚洲一二三区不卡| 成人av先锋影音| 久久久久久久久久看片| 日韩精品一级二级 | www.av亚洲| 国产欧美日韩综合| 美洲天堂一区二卡三卡四卡视频| 在线亚洲高清视频| 国产精品国产精品国产专区不片| 777a∨成人精品桃花网| 亚洲欧美成人一区二区三区| 成人性生交大片| 国产亚洲精品免费| 国产精品一区在线观看你懂的| 日韩欧美在线影院| 视频一区视频二区在线观看| 欧美日韩免费不卡视频一区二区三区| 亚洲情趣在线观看| 91一区二区三区在线观看| 亚洲色图第一区| 欧洲亚洲国产日韩| 一区二区三区四区视频精品免费|