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

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

?? os_tmr.c

?? 大家快來下載。這是目前最新管方版本了,Micrium-uCOS-II-V284.zip
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
************************************************************************************************************************
*                                                      uC/OS-III
*                                                 The Real-Time Kernel
*
*                                     (c) Copyright 2005-2007, Micrium, Weston, FL
*                                                  All Rights Reserved
*
*                                                   TIMER MANAGEMENT
*
* File    : OS_TMR.C
* By      : Jean J. Labrosse
* Version : V2.84
*
* 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 you application will use to reference
*              the timer created/started.
************************************************************************************************************************
*/

#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_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  the timer is in an invalid state

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆福利精品推荐| 国产性色一区二区| 日韩一卡二卡三卡| 欧美国产欧美综合| 日韩av电影免费观看高清完整版| 韩国中文字幕2020精品| 欧美在线一区二区| 国产亚洲精品久| 日韩国产欧美三级| 91麻豆精品视频| 国产天堂亚洲国产碰碰| 日本在线播放一区二区三区| 91在线精品一区二区| 精品盗摄一区二区三区| 五月婷婷激情综合| 色综合婷婷久久| 国产香蕉久久精品综合网| 99久久精品国产一区二区三区| 69av一区二区三区| 亚洲免费毛片网站| www.一区二区| 国产欧美一区二区三区沐欲| 麻豆精品一区二区av白丝在线| 欧美在线观看视频在线| 成人免费一区二区三区视频| 国产精品自拍av| 欧美第一区第二区| 久久黄色级2电影| 91麻豆精品国产| 午夜精品视频在线观看| 在线精品视频小说1| 综合久久久久久久| 99久久精品情趣| 日韩一区中文字幕| 91丨porny丨中文| 亚洲天天做日日做天天谢日日欢| 成人黄色小视频| 中文字幕亚洲精品在线观看| 成人午夜又粗又硬又大| 国产欧美综合色| 国产黑丝在线一区二区三区| 国产婷婷一区二区| www.亚洲激情.com| 亚洲免费高清视频在线| 色就色 综合激情| 亚洲电影激情视频网站| 69堂成人精品免费视频| 日韩av一级电影| 精品国产露脸精彩对白| 国产精品一卡二卡在线观看| 欧美—级在线免费片| av午夜精品一区二区三区| 亚洲免费高清视频在线| 欧美日韩亚洲高清一区二区| 日韩电影在线观看电影| 欧美xxxxx牲另类人与| 国产精品1024久久| 亚洲欧洲精品一区二区精品久久久| 91首页免费视频| 午夜精品福利一区二区蜜股av| 日韩免费视频一区| 国产成人在线免费| 亚洲一区中文日韩| 精品福利一区二区三区免费视频| 国产盗摄精品一区二区三区在线| 亚洲视频在线观看三级| 5566中文字幕一区二区电影| 国内精品视频666| 中文字幕在线播放不卡一区| 亚洲免费在线电影| 555www色欧美视频| 粉嫩av一区二区三区粉嫩| 亚洲精品福利视频网站| 精品少妇一区二区三区日产乱码 | 午夜久久久久久久久久一区二区| 欧美一二三四区在线| 国产91丝袜在线播放| 亚洲成人激情自拍| 国产目拍亚洲精品99久久精品| 欧美在线免费观看视频| 国产美女一区二区| 亚洲第一福利一区| 国产日韩欧美综合一区| 欧美日韩成人在线一区| 高清成人免费视频| 蜜桃av一区二区在线观看| 亚洲丝袜制服诱惑| 久久你懂得1024| 在线电影一区二区三区| 91日韩在线专区| 国产精品一区二区久久不卡| 视频一区中文字幕国产| 爽爽淫人综合网网站| 亚洲婷婷综合久久一本伊一区| 99综合影院在线| 蜜桃一区二区三区四区| 亚洲乱码日产精品bd| 欧美国产欧美综合| 亚洲成人精品一区二区| 中文字幕精品三区| 精品久久人人做人人爱| 51精品国自产在线| 色播五月激情综合网| 成人高清视频在线| 国产精品77777| 美日韩一级片在线观看| 视频精品一区二区| 亚洲综合小说图片| 樱桃国产成人精品视频| 中文字幕一区二区三区不卡| 国产人妖乱国产精品人妖| 欧美va亚洲va香蕉在线| 欧美一级免费大片| 欧美美女直播网站| 欧美日韩成人高清| 欧美日韩国产美女| 欧美日韩精品综合在线| 欧美亚洲丝袜传媒另类| 欧美色手机在线观看| 欧美最新大片在线看| 欧美中文字幕一区| 欧美午夜精品免费| 欧美巨大另类极品videosbest | 国产一区二区精品久久91| 免费的国产精品| 精品一区二区在线观看| 九色综合狠狠综合久久| 国产乱子轮精品视频| 国产真实乱偷精品视频免| 国产精品影音先锋| 高清国产一区二区| 色综合久久综合中文综合网| 色诱视频网站一区| 欧美三级蜜桃2在线观看| 欧美久久久久久久久| 欧美mv日韩mv国产| 久久精品这里都是精品| 国产精品免费人成网站| 亚洲色图视频网站| 亚洲超碰精品一区二区| 麻豆91在线播放免费| 成人一级黄色片| 91国产成人在线| 欧美一区二区性放荡片| 久久久久9999亚洲精品| 亚洲欧美综合色| 日欧美一区二区| 国产精品一区二区三区99| 99久久99久久精品免费观看 | 久久久久久久久久电影| 国产精品久久久久一区二区三区| 亚洲色图视频网站| 日本视频免费一区| 国产成人综合亚洲91猫咪| 在线免费亚洲电影| 欧美一区二区三区免费| 国产精品久久国产精麻豆99网站| 亚洲黄色免费网站| 国内外成人在线| 欧美最猛性xxxxx直播| 欧美精品一区二区久久婷婷| 亚洲天堂av一区| 精品亚洲免费视频| 在线区一区二视频| 久久久99精品久久| 婷婷国产在线综合| 成人av午夜影院| 69堂亚洲精品首页| 亚洲欧美日韩久久| 国产精品888| 欧美一区二区精品| 亚洲永久精品国产| 成人综合在线网站| 日韩欧美国产麻豆| 亚洲午夜在线观看视频在线| 成人妖精视频yjsp地址| 日韩免费性生活视频播放| 一区二区三区在线不卡| 粉嫩av一区二区三区| 精品捆绑美女sm三区| 午夜伦理一区二区| 色哟哟欧美精品| 中文字幕在线不卡| 丰满白嫩尤物一区二区| 精品国产一区二区三区久久久蜜月 | www.性欧美| 久久久久久电影| 奇米精品一区二区三区在线观看一| 91麻豆swag| 国产精品的网站| 国产精品夜夜爽| 久久亚洲捆绑美女| 麻豆国产欧美日韩综合精品二区 | 暴力调教一区二区三区| 久久久不卡影院| 国产一区二区精品久久99| 精品国产乱码久久久久久夜甘婷婷 | 国产成人在线视频播放| 精品区一区二区| 久久se精品一区二区|