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

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

?? os_tmr.c

?? VC版式的 UCOSII ! 修改前人255任務的那個版本! 已經改為286u版! 可用VC6直接編過!
?? 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一区二区三区免费野_久草精品视频
欧美成人r级一区二区三区| 国产精品乱码一区二区三区软件| 日韩欧美一级二级三级久久久| 国产欧美一区二区精品性色| 亚洲成精国产精品女| 国产在线播放一区二区三区| 精品视频1区2区| 国产精品少妇自拍| 久久www免费人成看片高清| 91在线精品一区二区三区| 26uuu国产在线精品一区二区| 亚洲图片有声小说| 色狠狠av一区二区三区| 国产欧美一区二区三区在线看蜜臀| 水野朝阳av一区二区三区| 波多野结衣欧美| 久久丝袜美腿综合| 日产国产欧美视频一区精品| 色成人在线视频| 国产精品国产精品国产专区不片| 国产一区中文字幕| 欧美一区二区三区的| 午夜免费欧美电影| 欧美日韩三级在线| 亚洲777理论| 欧美中文字幕一区| 亚洲在线中文字幕| 欧美熟乱第一页| 国产精品嫩草99a| 成人午夜av电影| 国产欧美日韩综合| 国产超碰在线一区| 久久久久国产免费免费| 国产一区二区久久| 久久久久久97三级| 成人免费视频一区| 国产精品久久久久久久久免费桃花 | 亚洲6080在线| 欧美美女网站色| 亚洲超丰满肉感bbw| 欧美精品久久一区| 理论电影国产精品| 国产亚洲精品bt天堂精选| 国产成人精品一区二区三区四区| 久久久午夜精品| 成人黄色免费短视频| 亚洲日本在线观看| 欧美性受极品xxxx喷水| 男男视频亚洲欧美| 国产婷婷色一区二区三区| 成a人片亚洲日本久久| 一区二区三区日本| 91精品国产免费| 精品制服美女丁香| 久久久精品国产免费观看同学| 国产大片一区二区| 一区二区激情小说| 欧美一区日本一区韩国一区| 加勒比av一区二区| 国产精品国产三级国产普通话三级 | 成人福利视频网站| 夜夜嗨av一区二区三区| 4438成人网| 国产+成+人+亚洲欧洲自线| 一区二区视频在线看| 91麻豆精品国产91久久久使用方法 | 欧美亚一区二区| 久久精品国产久精国产爱| 国产精品福利一区| 欧美日韩国产大片| 国产精品主播直播| 亚洲午夜激情网站| 成人免费一区二区三区视频 | 欧美xxxx老人做受| 色先锋aa成人| 国内成+人亚洲+欧美+综合在线| 亚洲日本乱码在线观看| 欧美电视剧免费观看| 成人av网在线| 裸体在线国模精品偷拍| 亚洲精品午夜久久久| 久久久久久一二三区| 欧美人牲a欧美精品| 91亚洲精华国产精华精华液| 激情综合网天天干| 一区二区久久久| 国产精品久久福利| 久久综合色8888| 欧美日韩国产美女| 一本色道a无线码一区v| 国产成人免费视| 久久精品国产免费| 日韩av一区二| 五月天视频一区| 一区二区三区四区激情| 欧美激情综合五月色丁香| 欧美一级高清片在线观看| 91高清视频免费看| 91亚洲精品一区二区乱码| 国产精品1024| 国产一区二区美女诱惑| 麻豆一区二区三区| 视频一区中文字幕| 久久成人免费电影| 麻豆国产精品官网| 视频一区视频二区中文| 亚洲一区二区三区小说| 亚洲黄色免费网站| 亚洲日本在线看| 亚洲视频中文字幕| 亚洲视频一区二区在线| 中文字幕免费不卡| 国产精品毛片无遮挡高清| 国产蜜臀av在线一区二区三区| 久久精品一区八戒影视| 久久一二三国产| 久久只精品国产| 久久精品视频一区二区三区| 久久九九久久九九| 国产日本亚洲高清| 亚洲欧洲av在线| 亚洲伦理在线精品| 一区二区不卡在线视频 午夜欧美不卡在| 国产欧美精品一区二区色综合| 久久蜜臀精品av| 国产精品免费视频一区| 自拍偷在线精品自拍偷无码专区| 亚洲视频在线观看三级| 一区二区三区免费看视频| 亚洲一区在线视频| 日韩影院在线观看| 久久超级碰视频| 99久久夜色精品国产网站| 91丨porny丨蝌蚪视频| 在线这里只有精品| 91.com视频| 久久久久久久久久久久电影| 欧美激情一区在线观看| **欧美大码日韩| 亚洲成人资源网| 九九视频精品免费| 99久久伊人精品| 4438x成人网最大色成网站| 久久综合久久综合久久| 国产精品成人网| 日韩和欧美一区二区| 国产高清久久久| 色综合久久综合中文综合网| 在线播放欧美女士性生活| 久久人人爽人人爽| 一区二区三区在线视频观看| 免费xxxx性欧美18vr| 成人性生交大片免费看视频在线| 欧美日韩亚洲综合一区二区三区| 精品日韩99亚洲| 亚洲欧美日韩一区二区三区在线观看 | 精品综合免费视频观看| aaa欧美大片| 欧美大尺度电影在线| 国产精品国产三级国产a| 美女一区二区三区在线观看| 99久久精品国产导航| 日韩一区二区三区免费观看| 国产精品国产三级国产有无不卡 | 欧美日韩免费一区二区三区视频 | 日韩免费高清电影| 亚洲欧洲成人精品av97| 加勒比av一区二区| 欧美日韩精品福利| ...中文天堂在线一区| 国产乱国产乱300精品| 欧美日韩成人一区二区| 综合精品久久久| 国产成人精品综合在线观看| 日韩午夜电影av| 一区二区三区高清在线| 福利视频网站一区二区三区| 日韩欧美色综合| 亚洲成a人片综合在线| 91黄色小视频| 国产精品成人一区二区三区夜夜夜| 国内精品不卡在线| 日韩一区二区三区三四区视频在线观看| 亚洲免费在线电影| 成人激情av网| 国产人久久人人人人爽| 国产精品中文有码| 26uuu国产电影一区二区| 老司机免费视频一区二区| 91.成人天堂一区| 日日欢夜夜爽一区| 欧美日韩国产美女| 亚洲成国产人片在线观看| 欧洲在线/亚洲| 亚洲亚洲人成综合网络| 欧美午夜电影网| 亚洲成人在线网站| 91精品国产黑色紧身裤美女| 亚洲国产精品一区二区www在线| 在线观看免费视频综合|