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

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

?? os_tmr.c

?? uCOS-II學習資料
?? 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一区二区三区免费野_久草精品视频
国产精品久久久久一区二区三区| 欧美大片一区二区三区| 国产aⅴ综合色| 韩国av一区二区三区| 久久国产夜色精品鲁鲁99| 视频一区国产视频| 男人的j进女人的j一区| 国产综合久久久久久鬼色| 国内精品在线播放| 国产91色综合久久免费分享| 国产成人av电影免费在线观看| 国产高清精品久久久久| av男人天堂一区| 在线精品国精品国产尤物884a| 欧美吻胸吃奶大尺度电影 | 成人午夜av影视| a美女胸又www黄视频久久| 色综合视频在线观看| 欧美日韩精品三区| 久久综合久久综合久久综合| 国产日产欧美一区二区视频| 亚洲精品欧美专区| 另类小说一区二区三区| 成人a区在线观看| 欧美日韩国产首页| 国产日韩影视精品| 亚洲成国产人片在线观看| 免费在线观看一区二区三区| 成人免费高清在线观看| 制服丝袜av成人在线看| 中文字幕精品一区二区精品绿巨人 | 久久久久久久综合日本| ...xxx性欧美| 蜜臀va亚洲va欧美va天堂| 波多野结衣中文字幕一区二区三区| 91国在线观看| 久久精品人人做人人综合| 亚洲天堂网中文字| 青青草一区二区三区| av资源网一区| 久久综合精品国产一区二区三区| 尤物视频一区二区| 国产成人综合网| 欧美一区二区三区免费视频| 亚洲欧美日本在线| 国产福利电影一区二区三区| 正在播放一区二区| 亚洲激情欧美激情| 成人h版在线观看| 久久嫩草精品久久久久| 婷婷综合另类小说色区| 在线欧美小视频| 国产精品久久久久一区二区三区共 | 91精品久久久久久蜜臀| 亚洲欧美日韩电影| 成人黄色av网站在线| 日韩三级在线观看| 亚洲bt欧美bt精品| 欧美在线你懂的| 亚洲欧美福利一区二区| 成人午夜av在线| 欧美激情一区二区三区全黄| 精品一区二区免费视频| 7777精品伊人久久久大香线蕉超级流畅 | 日本高清视频一区二区| 国产精品三级电影| 国产盗摄女厕一区二区三区| 日韩欧美一级在线播放| 亚洲成年人影院| 欧美精品一二三| 香蕉乱码成人久久天堂爱免费| 91免费小视频| 亚洲激情自拍视频| 色偷偷一区二区三区| 一区二区三区视频在线看| 一本色道久久综合亚洲精品按摩| 亚洲色图在线看| 色综合视频在线观看| 亚洲欧美区自拍先锋| 在线观看av一区二区| 亚洲成人在线观看视频| 91精品国产乱| 麻豆国产欧美日韩综合精品二区| 日韩欧美电影一区| 国内精品伊人久久久久av一坑 | 国产三级精品视频| 99这里都是精品| 一区二区三区国产| 欧美日韩中文另类| 精品一区二区三区久久| 国产欧美一二三区| 色哟哟亚洲精品| 天天综合色天天综合| 精品日韩av一区二区| 波多野结衣在线aⅴ中文字幕不卡| 欧美极品aⅴ影院| 一本一道久久a久久精品| 调教+趴+乳夹+国产+精品| 精品久久久久一区二区国产| 成人免费观看视频| 天堂蜜桃91精品| 久久精品视频免费观看| 色88888久久久久久影院按摩| 日日欢夜夜爽一区| 中文字幕不卡在线播放| 欧美日韩一级片在线观看| 国内偷窥港台综合视频在线播放| 中文字幕一区二区视频| 91精品欧美综合在线观看最新| 粉嫩欧美一区二区三区高清影视| 亚洲综合免费观看高清完整版| 欧美mv和日韩mv国产网站| 日本高清无吗v一区| 黄页视频在线91| 一区二区三区免费观看| 国产日韩精品一区二区浪潮av| 欧美日韩激情一区二区三区| 粉嫩一区二区三区性色av| 日韩激情视频网站| 亚洲手机成人高清视频| 日韩欧美亚洲国产另类 | 天天色综合成人网| 国产精品久久久久一区| 日韩视频一区二区三区| 一本大道av伊人久久综合| 国产精品影视在线| 日韩电影免费在线观看网站| 亚洲欧洲精品一区二区三区| 欧美精品一区二区三区四区 | 亚洲高清免费在线| 欧美高清一级片在线观看| 日韩一区二区三区四区| 欧洲人成人精品| 一本久久a久久免费精品不卡| 国产精品 欧美精品| 久久91精品国产91久久小草| 三级影片在线观看欧美日韩一区二区 | 国产麻豆成人传媒免费观看| 日韩国产精品久久久久久亚洲| 亚洲国产精品影院| 亚洲美女在线一区| 中文字幕一区二区三区色视频| 国产欧美日韩激情| 久久夜色精品一区| 久久亚洲精品国产精品紫薇| 精品国产一区二区精华| 欧美电影在线免费观看| 欧美嫩在线观看| 欧美日韩中字一区| 欧美精品九九99久久| 欧美日韩一二三区| 欧美精品一卡两卡| 欧美一级夜夜爽| 精品国产区一区| 久久精品一区二区三区不卡| 久久精品视频一区二区三区| 国产视频一区在线播放| 国产精品网站在线观看| 国产精品福利影院| 亚洲免费av网站| 视频在线观看91| 国产在线播放一区三区四| 国产精品主播直播| 菠萝蜜视频在线观看一区| 91丨porny丨首页| 色中色一区二区| 91超碰这里只有精品国产| 日韩精品一区二区三区四区视频| 久久色.com| 国产精品第一页第二页第三页| 亚洲日本在线视频观看| 婷婷丁香久久五月婷婷| 国内成人免费视频| 99精品久久久久久| 欧美高清视频不卡网| 精品国产免费久久 | 丝袜美腿亚洲一区| 国产一区二区三区免费看| av在线播放成人| 欧美另类高清zo欧美| 国产片一区二区| 午夜精品久久久久久久久| 国产一区二区在线电影| 在线免费精品视频| 26uuu国产一区二区三区| 亚洲视频在线一区| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产91精品一区二区麻豆亚洲| 在线免费观看日本一区| 久久先锋影音av| 午夜日韩在线观看| 成年人国产精品| 日韩一区二区在线播放| 亚洲女爱视频在线| 国产一区二区三区在线看麻豆| 欧美午夜电影在线播放| 中文字幕欧美激情一区| 热久久国产精品| 色婷婷综合久久久中文一区二区| 欧美精品一区二区三区四区|