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

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

?? os_tmr.c

?? STM32不完全手冊 例程源碼 29個
?? 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.85
*
* 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一区二区三区免费野_久草精品视频
国产精品久久久久久亚洲毛片| 5858s免费视频成人| 亚洲国产高清aⅴ视频| 国产一区二区三区电影在线观看| 日韩免费在线观看| 国产综合一区二区| 国产精品久久久久毛片软件| 波多野结衣中文字幕一区| 亚洲欧洲日韩综合一区二区| 欧美亚洲一区二区三区四区| 日韩精品五月天| 久久久午夜电影| 色综合中文综合网| 亚洲国产综合视频在线观看| 欧美三级韩国三级日本三斤| 久久国产视频网| 亚洲欧洲av色图| 欧美日本国产视频| 国产精品自在在线| 亚洲综合一区二区| 精品国产电影一区二区| 成a人片亚洲日本久久| 亚洲福中文字幕伊人影院| www日韩大片| 色哟哟欧美精品| 久久er精品视频| 亚洲美女视频在线| 精品国产精品网麻豆系列| 91麻豆.com| 国产精品一级黄| 亚洲妇熟xx妇色黄| 国产欧美一区二区在线| 欧美日韩三级视频| 成人在线一区二区三区| 视频在线观看一区| 国产精品久久久久影院亚瑟 | 国产精品亚洲成人| 亚洲成人av一区二区三区| 国产欧美日韩激情| 91精品国产91热久久久做人人| 国产成人av自拍| 美女任你摸久久| 亚洲免费在线视频| 日本一区二区不卡视频| 欧美一区二区日韩一区二区| 99热精品一区二区| 国产盗摄精品一区二区三区在线 | 日韩精品一区二区三区视频| 91精品福利视频| 成人美女视频在线观看18| 免费的成人av| 亚洲一本大道在线| 亚洲欧洲日韩女同| 久久久久久久综合日本| 欧美不卡一区二区| 欧美日本在线观看| 一本一道波多野结衣一区二区| 国产一区二区女| 九九热在线视频观看这里只有精品| 亚洲成年人影院| 亚洲黄色尤物视频| 一区二区三区免费在线观看| 亚洲色图另类专区| 亚洲欧美在线另类| 综合久久一区二区三区| 国产精品国产馆在线真实露脸| 久久精品一二三| 久久只精品国产| 精品av久久707| 精品福利视频一区二区三区| 日韩一区二区三区在线| 日韩久久免费av| 精品理论电影在线| 精品少妇一区二区三区在线视频| 日韩欧美国产一区二区三区| 日韩一区二区三区免费看| 日韩精品一区二区在线| 精品国精品国产尤物美女| 精品久久久久久久久久久久久久久久久 | 激情综合一区二区三区| 精品一区二区三区久久| 精品一区二区三区在线观看国产 | 国产一区久久久| 国内精品免费在线观看| 国产一区二区免费在线| 国产高清无密码一区二区三区| 国产精品综合二区| 成人国产精品免费观看| 91在线观看污| 欧美视频中文字幕| 日韩欧美色综合网站| 精品国产精品网麻豆系列| 国产欧美一区二区精品秋霞影院| 国产精品三级av在线播放| 亚洲精品高清在线| 日本亚洲三级在线| 精品一区二区三区蜜桃| 国产成人免费视频网站| 91老师片黄在线观看| 欧美卡1卡2卡| 久久久久久黄色| 亚洲三级理论片| 日韩精品免费专区| 国产高清成人在线| 色狠狠综合天天综合综合| 欧美一区二区三区视频在线观看| 久久夜色精品国产欧美乱极品| 国产精品久久久久久久第一福利| 一区二区三区蜜桃网| 蜜臀精品一区二区三区在线观看| 国产一区二区三区四区五区美女 | 美腿丝袜在线亚洲一区| 国产不卡免费视频| 欧美三级在线视频| 国产欧美视频一区二区| 亚洲 欧美综合在线网络| 国产成人免费高清| 欧美精品aⅴ在线视频| 国产精品看片你懂得| 免费观看久久久4p| 色香蕉成人二区免费| 精品电影一区二区| 亚洲成人一区二区在线观看| 国产91丝袜在线观看| 欧美一区二区三区视频| 亚洲三级在线看| 国产美女视频91| 91精品国产综合久久久久久久久久 | 91精品国产综合久久久蜜臀粉嫩| 亚洲国产精品t66y| 日本成人在线不卡视频| 91啪在线观看| 久久精品在这里| 蜜臀av性久久久久蜜臀aⅴ流畅 | 婷婷国产v国产偷v亚洲高清| 成人午夜碰碰视频| 久久在线观看免费| 日本在线不卡视频| 欧美日韩国产区一| 亚洲一区影音先锋| 91蝌蚪porny九色| 国产精品久久99| 国产在线麻豆精品观看| 777xxx欧美| 天天色综合成人网| 欧美性生活一区| 亚洲黄一区二区三区| 91免费观看国产| 国产精品久久久爽爽爽麻豆色哟哟| 国产一区二区剧情av在线| 欧美大片一区二区| 日本vs亚洲vs韩国一区三区| 欧美视频第二页| 亚洲国产精品人人做人人爽| 色屁屁一区二区| 亚洲桃色在线一区| 99久久免费视频.com| 国产精品日产欧美久久久久| 成人丝袜18视频在线观看| 久久久久成人黄色影片| 国产一区在线不卡| 久久久久久久久97黄色工厂| 国产一区视频导航| 国产欧美日韩另类视频免费观看| 国产露脸91国语对白| 国产欧美一区视频| 不卡高清视频专区| 中文字幕在线视频一区| www.亚洲在线| 一级特黄大欧美久久久| 欧美视频一区在线观看| 丝袜美腿亚洲色图| 日韩天堂在线观看| 国产在线精品视频| 中文字幕精品一区二区精品绿巨人| 丁香婷婷综合网| 中文字幕亚洲在| 欧美色国产精品| 九九热在线视频观看这里只有精品| 精品91自产拍在线观看一区| 国产成人精品网址| 亚洲色欲色欲www在线观看| 一本到一区二区三区| 亚洲一级片在线观看| 91精品欧美久久久久久动漫| 国内精品国产成人国产三级粉色 | 亚洲综合色婷婷| 777欧美精品| 国产美女精品人人做人人爽| 国产精品高潮呻吟| 中文乱码免费一区二区| 色香蕉久久蜜桃| 日韩福利电影在线观看| 欧美精品一区二区高清在线观看| 国产v日产∨综合v精品视频| 亚洲精品视频免费观看| 91精选在线观看| 高清av一区二区| 亚洲va欧美va天堂v国产综合| 精品国产一二三区|