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

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

?? os_tmr.c

?? uC/OS-II V286 最新的源代碼版本
?? C
?? 第 1 頁 / 共 4 頁
字號(hào):
/*
************************************************************************************************************************
*                                                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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91色porny在线视频| 久久久噜噜噜久久中文字幕色伊伊| 色菇凉天天综合网| 欧美日韩色综合| 欧美一区二区三区四区五区| 91精品欧美久久久久久动漫 | 99久久精品国产观看| 大白屁股一区二区视频| 成人97人人超碰人人99| 一本色道综合亚洲| 欧美丰满少妇xxxbbb| 亚洲精品一线二线三线| 亚洲国产精品av| 亚洲国产成人av网| 国产成人综合在线播放| 97久久久精品综合88久久| 欧美日韩一区二区三区四区| 欧美日韩一区高清| 国产三级一区二区| 五月天中文字幕一区二区| 激情综合五月天| 欧美亚洲综合在线| 中文子幕无线码一区tr| 日韩和欧美的一区| 成人涩涩免费视频| 欧美一级片免费看| 1024亚洲合集| 国产精品99久久久久久久vr| 91国偷自产一区二区使用方法| 久久午夜羞羞影院免费观看| 免费在线视频一区| 精品中文字幕一区二区小辣椒| 欧美中文字幕亚洲一区二区va在线| 精品视频资源站| 国产精品另类一区| 国产综合久久久久久鬼色| 欧美日韩午夜在线视频| 亚洲资源中文字幕| 91久久精品一区二区| 国产精品久久久久久亚洲伦| 美女网站在线免费欧美精品| 欧美人妖巨大在线| 性做久久久久久免费观看| 欧美亚洲综合另类| 一区二区三区四区视频精品免费| 豆国产96在线|亚洲| 26uuu另类欧美亚洲曰本| 日本va欧美va精品| 精品久久久三级丝袜| 日韩成人精品在线| 欧美哺乳videos| 国产精品一区三区| 中文字幕免费在线观看视频一区| 国内精品不卡在线| 日本一区二区不卡视频| 亚洲尤物视频在线| 国产盗摄一区二区| 久久久久久亚洲综合影院红桃| 日本欧美一区二区在线观看| 日韩免费福利电影在线观看| 午夜影视日本亚洲欧洲精品| 日本电影亚洲天堂一区| 丝瓜av网站精品一区二区| 欧美一二三区在线| 国产不卡高清在线观看视频| 中文字幕制服丝袜成人av| 欧美中文字幕一区二区三区| 日本不卡一区二区| 国产日韩欧美a| 欧美精品丝袜中出| 顶级嫩模精品视频在线看| 亚洲乱码精品一二三四区日韩在线| 欧美最新大片在线看| 久久精品久久精品| 亚洲小少妇裸体bbw| 精品福利一区二区三区 | 成人永久免费视频| 一区二区三区四区五区视频在线观看| 欧美一二三区在线| 91视频com| 成人黄色在线看| 国模套图日韩精品一区二区| 一区二区三区四区不卡在线 | 欧美中文字幕一区| 成人精品高清在线| 久久草av在线| 日韩制服丝袜av| 亚洲图片欧美激情| 国产亚洲精品超碰| 欧美一级专区免费大片| 欧美视频中文一区二区三区在线观看| 国内久久精品视频| 久久精品国产网站| 午夜精品一区在线观看| 亚洲一区二区三区四区五区黄 | 精品美女一区二区三区| 欧美一区二区视频在线观看| 在线免费观看成人短视频| kk眼镜猥琐国模调教系列一区二区| 亚洲综合在线免费观看| 国产精品福利av| 国产精品美女久久久久久久久久久| 久久婷婷国产综合精品青草| 日韩亚洲国产中文字幕欧美| 欧美日韩免费观看一区二区三区| 91免费国产在线观看| 99精品一区二区| 91首页免费视频| 欧美性三三影院| 欧美疯狂做受xxxx富婆| 欧美va亚洲va| 欧美精彩视频一区二区三区| 国产欧美一区视频| 亚洲天堂成人在线观看| 亚洲欧美另类久久久精品| 一区二区日韩av| 一区二区三区中文字幕| 午夜精品久久久久久不卡8050| 日韩精品免费视频人成| 国产成人综合在线观看| 91精品福利视频| 精品入口麻豆88视频| 国产精品欧美经典| 日本中文一区二区三区| 国内精品伊人久久久久av一坑| 99re亚洲国产精品| 5858s免费视频成人| 欧美经典一区二区三区| 亚洲国产精品麻豆| 国产成人av一区| 欧美色视频一区| 国产精品久久久99| 青娱乐精品视频| 91亚洲精华国产精华精华液| 欧美日韩激情一区| 国产清纯美女被跳蛋高潮一区二区久久w | 久久久国产精华| 日韩国产高清在线| 日本黄色一区二区| 国产精品久久免费看| 美国十次了思思久久精品导航| 色哟哟亚洲精品| 久久精品一区二区三区四区| 日本sm残虐另类| 欧美日韩免费高清一区色橹橹| 久久综合久久综合九色| 麻豆高清免费国产一区| 欧美性色黄大片手机版| 欧美一级xxx| 亚洲动漫第一页| 91网站最新网址| 国产天堂亚洲国产碰碰| 男人的j进女人的j一区| 色婷婷综合中文久久一本| 国产亚洲午夜高清国产拍精品 | 国内外成人在线| 在线不卡中文字幕| 亚洲影视在线播放| 成人免费av在线| 国产三级久久久| 国产福利一区二区三区视频| 91麻豆精品91久久久久同性| 亚洲欧洲精品一区二区精品久久久| 精品一区二区在线视频| 日韩一级片在线播放| 青青草成人在线观看| 日本道免费精品一区二区三区| 国产欧美中文在线| 国产精品资源站在线| 精品成人私密视频| 国产.欧美.日韩| 久久午夜国产精品| 国产寡妇亲子伦一区二区| 欧美国产精品久久| 91丨porny丨国产入口| 午夜视频在线观看一区二区三区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 国产精品久久久久毛片软件| 成人午夜视频免费看| 亚洲欧美另类综合偷拍| 91蜜桃在线免费视频| 亚洲一级二级在线| 91精品国产综合久久蜜臀| 国模冰冰炮一区二区| 成人欧美一区二区三区黑人麻豆 | 国产做a爰片久久毛片| 国产精品色呦呦| 国产精品99久久久久久似苏梦涵| 日韩一区在线免费观看| 欧美区视频在线观看| 精品一区二区在线播放| 亚洲欧美另类久久久精品| 日韩亚洲欧美一区| 国产米奇在线777精品观看| 中文字幕在线不卡一区二区三区 | 亚洲欧美二区三区| 欧美一区二区三区影视| 成人av在线网| 亚洲一区二区视频在线观看| 久久精品男人的天堂|