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

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

?? os_tmr.c

?? 最新版ucos2.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一区二区三区免费野_久草精品视频
成人污污视频在线观看| 日韩欧美色综合网站| 91精品国产欧美日韩| 国产精品二三区| 蜜桃91丨九色丨蝌蚪91桃色| 色综合中文字幕国产| 国产午夜精品一区二区三区嫩草| 亚洲二区视频在线| 91视频精品在这里| 国产拍揄自揄精品视频麻豆| 日韩av在线发布| 欧美制服丝袜第一页| 亚洲视频一二三区| 国产高清成人在线| 精品国产乱码久久久久久蜜臀| 亚洲成人av福利| 欧美这里有精品| 亚洲综合免费观看高清完整版| 国产凹凸在线观看一区二区| 精品日本一线二线三线不卡 | 欧美va在线播放| 亚洲成a人在线观看| 日本精品视频一区二区三区| 国产性做久久久久久| 国产一区二区0| www国产精品av| 国产一区二区三区免费播放| 精品日韩99亚洲| 国产一区在线视频| 国产亚洲一区二区三区在线观看| 精品一区二区三区久久| 精品乱人伦小说| 国产一区91精品张津瑜| 国产亚洲欧美一级| 成人精品电影在线观看| 国产精品久久精品日日| 91蜜桃视频在线| 亚洲一区电影777| 欧美巨大另类极品videosbest| 一区二区三区四区亚洲| 色94色欧美sute亚洲线路一久| 亚洲精品午夜久久久| 欧美在线观看一区二区| 日韩电影一区二区三区四区| 日韩欧美一卡二卡| 国产99久久久精品| 自拍偷拍亚洲综合| 欧美老女人第四色| 麻豆精品久久久| 中文字幕精品综合| 在线精品观看国产| 蜜臀av性久久久久蜜臀aⅴ流畅| 日韩一区二区三区观看| 福利一区在线观看| 亚洲另类中文字| 日韩免费视频一区| 成人精品免费网站| 亚洲成人午夜电影| 精品第一国产综合精品aⅴ| 粉嫩在线一区二区三区视频| 一区二区三区美女| 久久综合色婷婷| 色偷偷久久人人79超碰人人澡| 性做久久久久久| 久久久久97国产精华液好用吗| 91在线云播放| 毛片不卡一区二区| 亚洲色图欧美激情| 日韩精品一区二区三区中文不卡 | 成人国产亚洲欧美成人综合网 | 欧美国产日韩一二三区| 日本高清无吗v一区| 日本特黄久久久高潮| 国产精品免费观看视频| 宅男噜噜噜66一区二区66| 国产成人亚洲综合a∨婷婷图片 | 蜜臀av一级做a爰片久久| 国产欧美日韩综合| 91.com在线观看| av亚洲精华国产精华精| 免费人成精品欧美精品 | 亚洲午夜免费视频| 久久亚洲一级片| 7777精品伊人久久久大香线蕉超级流畅| 国产一区二区三区免费观看| 亚洲国产cao| 国产精品欧美极品| 精品国产3级a| 欧美日韩精品一二三区| av不卡在线播放| 国产精品一色哟哟哟| 日韩av二区在线播放| 一二三四社区欧美黄| 中文字幕精品一区| 久久久久久久久伊人| 日韩一区二区中文字幕| 欧美日韩视频在线一区二区| 成人免费毛片嘿嘿连载视频| 国内国产精品久久| 麻豆一区二区99久久久久| 亚洲夂夂婷婷色拍ww47| 国产精品不卡一区二区三区| 国产欧美视频一区二区三区| 精品国产精品网麻豆系列| 欧美疯狂做受xxxx富婆| 欧美日韩一级视频| 欧美性大战xxxxx久久久| 色欧美乱欧美15图片| 色一区在线观看| 在线日韩av片| 色综合欧美在线| 日本高清不卡一区| 91视频国产观看| 91搞黄在线观看| 欧美日韩在线不卡| 欧美日韩国产影片| 欧美高清精品3d| 日韩视频一区二区三区在线播放| 欧美二区乱c少妇| 91精品综合久久久久久| 日韩一区二区三区四区五区六区| 在线播放国产精品二区一二区四区| 欧美日韩小视频| 日韩午夜电影在线观看| 精品理论电影在线观看| wwww国产精品欧美| 国产精品色眯眯| 亚洲精品高清视频在线观看| 亚洲一本大道在线| 全部av―极品视觉盛宴亚洲| 激情综合色丁香一区二区| 黄色日韩网站视频| 成人黄色在线视频| 欧美亚洲国产一区二区三区va | aaa国产一区| 色爱区综合激月婷婷| 538在线一区二区精品国产| 久久亚洲精品国产精品紫薇| 国产精品久久久久久久久久久免费看| 亚洲欧美激情小说另类| 日韩黄色免费电影| 东方欧美亚洲色图在线| 欧美在线视频全部完| 日韩欧美中文字幕精品| 中文字幕国产一区二区| 亚洲一二三专区| 国产在线视视频有精品| 在线免费观看成人短视频| 日韩免费视频一区| 亚洲精选视频免费看| 久久综合综合久久综合| 97成人超碰视| 欧美成人vr18sexvr| 亚洲免费在线播放| 国产尤物一区二区| 欧美三级日韩三级| 国产三区在线成人av| 午夜a成v人精品| 成人国产精品免费观看动漫 | 久久久影视传媒| 亚洲激情欧美激情| 国产自产2019最新不卡| 在线看国产一区| 国产精品萝li| 久久不见久久见免费视频7| 日本国产一区二区| 国产精品午夜免费| 精品一区二区三区香蕉蜜桃| 欧美主播一区二区三区| 欧美激情一区二区三区| 九九国产精品视频| 欧美日韩国产一级| 亚洲精品成a人| 高清成人在线观看| 日韩精品一区二区三区四区| 亚洲国产精品人人做人人爽| 成人高清免费观看| 久久精品视频一区二区三区| 日本不卡视频一二三区| 精品视频资源站| 亚洲午夜激情av| 91香蕉视频污| **欧美大码日韩| 国产成人精品综合在线观看| 日韩欧美国产小视频| 日韩在线一二三区| 欧美精品777| 日韩精品电影在线| 欧美军同video69gay| 天堂在线亚洲视频| 欧美日韩精品欧美日韩精品| 一区二区三区日韩在线观看| 91欧美激情一区二区三区成人| 中文一区在线播放| 91丝袜呻吟高潮美腿白嫩在线观看| 欧美—级在线免费片| 国产激情一区二区三区桃花岛亚洲 | 9191精品国产综合久久久久久| 一区二区三区蜜桃| 欧美伊人久久大香线蕉综合69|