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

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

?? os_tmr.c

?? UCOS2.83移植的s3c44b0x的最終版,如果那為燒友有好的建議請EMAIL我,不勝感激!
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
************************************************************************************************************************
*                                                      uC/OS-III
*                                                 The Real-Time Kernel
*
*                                     (c) Copyright 2005-2006, Micrium, Weston, FL
*                                                  All Rights Reserved
*
*                                                   TIMER MANAGEMENT
*
* File    : OS_TMR.C
* By      : Jean J. Labrosse
* Version : V2.83
************************************************************************************************************************
*/

#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_NO_ERR
*                               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_NO_ERR;
    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_NO_ERR
*                               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_NO_ERR;
             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_NO_ERR;
             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_NO_ERR                 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
*
* Returns    : The length of the string or 0 if the timer does not exist.
************************************************************************************************************************
*/

#if OS_TMR_EN > 0 && OS_TMR_CFG_NAME_SIZE > 0
INT8U  OSTmrNameGet (OS_TMR  *ptmr,
                     INT8U   *pdest,
                     INT8U   *perr)
{
    INT8U  len;


#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {
        return (0);
    }
    if (pdest == (INT8U *)0) {
        *perr = OS_ERR_TMR_INVALID_DEST;
        return (0);
    }
    if (ptmr == (OS_TMR *)0) {
        *perr = OS_ERR_TMR_INVALID;
        return (0);
    }
#endif
    if (ptmr->OSTmrType != OS_TMR_TYPE) {              /* Validate timer structure                                    */
        *perr = OS_ERR_TMR_INVALID_TYPE;
        return (0);
    }
    if (OSIntNesting > 0) {                            /* See if trying to call from an ISR                           */
        *perr  = OS_ERR_TMR_ISR;
        return (0);
    }
    OSTmr_Lock();
    switch (ptmr->OSTmrState) {
        case OS_TMR_STATE_RUNNING:
        case OS_TMR_STATE_STOPPED:
        case OS_TMR_STATE_COMPLETED:
             len   = OS_StrCopy(pdest, ptmr->OSTmrName);
             OSTmr_Unlock();
             *perr = OS_NO_ERR;
             return (len);

        case OS_TMR_STATE_UNUSED:                      /* Timer is not allocated                                      */
             OSTmr_Unlock();
             *perr = OS_ERR_TMR_INACTIVE;
             return (0);

        default:
             OSTmr_Unlock();
             *perr = OS_ERR_TMR_INVALID_STATE;
             return (0);
    }
}
#endif

/*$PAGE*/
/*
************************************************************************************************************************
*                                    GET HOW MUCH TIME IS LEFT BEFORE A TIMER EXPIRES
*
* Description: This function is called to get the number of ticks before a timer times out.
*
* Arguments  : ptmr          Is a pointer to the timer to obtain the remaining time from.
*
*              perr          Is a pointer to an error code.  '*perr' will contain one of the following:
*                               OS_NO_ERR
*                               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
*
* Returns    : The time remaining for the timer to expire.  The time represents 'timer' increments.  In other words, if
*              OSTmr_Task() is signaled every 1/10 of a second then the returned value represents the number of 1/10 of
*              a second remaining before the timer expires.
************************************************************************************************************************
*/

#if OS_TMR_EN > 0
INT32U  OSTmrRemainGet (OS_TMR  *ptmr,
                        INT8U   *perr)
{
    INT32U  remain;


#if OS_ARG_CHK_EN > 0
    if (perr == (INT8U *)0) {
        return (0);
    }
    if (ptmr == (OS_TMR *)0) {
        *perr = OS_ERR_TMR_INVALID;
        return (0);
    }
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕乱码日本亚洲一区二区| 在线观看一区日韩| 亚洲mv在线观看| 中文字幕五月欧美| 国产精品久久久久桃色tv| 欧美激情在线观看视频免费| 久久精品夜色噜噜亚洲aⅴ| 精品日韩一区二区三区免费视频| 欧美性色黄大片手机版| 欧美精品少妇一区二区三区| 在线电影一区二区三区| 日韩一区二区免费电影| 337p日本欧洲亚洲大胆精品| 国产视频一区二区三区在线观看| 国产视频视频一区| 国产精品毛片高清在线完整版| 日韩理论片中文av| 亚洲高清免费一级二级三级| 美美哒免费高清在线观看视频一区二区| 亚洲午夜视频在线| 老司机午夜精品99久久| 国产高清在线精品| 91在线看国产| 欧美日本在线视频| 精品国产不卡一区二区三区| 亚洲人吸女人奶水| 日韩高清欧美激情| 国产激情一区二区三区| 在线影视一区二区三区| 91精品国产综合久久香蕉的特点 | 中文字幕一区在线| 一区二区三区中文字幕在线观看| 夜夜亚洲天天久久| 激情五月激情综合网| 色综合天天综合色综合av| 欧美高清视频一二三区| 中文字幕一区二区日韩精品绯色| 午夜精品久久久久久久 | 国产精品素人视频| 亚洲电影在线播放| 国产99精品国产| 制服丝袜一区二区三区| 国产精品久久三| 日产精品久久久久久久性色| av亚洲产国偷v产偷v自拍| 日韩一级成人av| 亚洲免费在线电影| 国产精品18久久久久久久久| 在线免费一区三区| 日本一区二区三区dvd视频在线| 亚洲一区二区三区免费视频| 国产成人av一区| 欧美成人vr18sexvr| 樱桃国产成人精品视频| 丰满少妇久久久久久久| 日韩一区二区精品在线观看| 亚洲一区二区偷拍精品| 国产高清精品在线| 欧美mv日韩mv亚洲| 日日摸夜夜添夜夜添国产精品| 99久久久久免费精品国产 | 91香蕉视频污在线| 久久久亚洲精品石原莉奈| 日韩av网站免费在线| 欧美在线制服丝袜| 亚洲天堂精品视频| 99re8在线精品视频免费播放| 日韩欧美色电影| 蜜臀久久久99精品久久久久久| 欧美视频在线一区二区三区 | 蜜桃精品在线观看| 欧美色图12p| 亚洲国产一区二区在线播放| 不卡一二三区首页| 中文无字幕一区二区三区| 国产福利不卡视频| 亚洲图片你懂的| 国产视频在线观看一区二区三区| 精品在线亚洲视频| 欧美xxxxx牲另类人与| 久久99最新地址| 久久久99久久精品欧美| 国产精品一卡二卡| 欧美激情在线观看视频免费| www.性欧美| 18成人在线观看| 欧美视频在线一区| 久久国产综合精品| 久久色.com| 91同城在线观看| 亚洲一区二区精品久久av| 欧美日高清视频| 久草在线在线精品观看| 国产日韩欧美激情| 色综合婷婷久久| 日本中文字幕一区| 日韩精品在线一区| 粉嫩av一区二区三区在线播放| 亚洲免费看黄网站| 日韩欧美在线网站| 国产不卡免费视频| 亚洲国产精品精华液网站| 欧美一区二区在线看| 国产精品一区二区久久不卡| 中文字幕在线不卡视频| 欧美另类videos死尸| 国产99久久精品| 天天做天天摸天天爽国产一区| 日韩精品中文字幕一区二区三区 | 国产亚洲欧美激情| 91视频在线观看| 日日夜夜精品视频免费| 中文字幕成人av| 欧美猛男超大videosgay| 国产一区二区三区四| 一区二区三区鲁丝不卡| 精品999在线播放| 在线亚洲一区二区| 国产91露脸合集magnet| 激情六月婷婷久久| 欧美刺激午夜性久久久久久久| 99这里都是精品| 日韩av网站在线观看| 亚洲色图在线视频| 亚洲精品在线一区二区| 欧美在线观看视频一区二区 | 久久综合久久综合久久| 色综合视频一区二区三区高清| 麻豆精品精品国产自在97香蕉| 亚洲欧美日韩精品久久久久| 久久综合av免费| 91精品视频网| 欧美日本一区二区三区| 99久久99久久精品国产片果冻| 国产一区二区影院| 蜜桃视频第一区免费观看| 亚洲h在线观看| 伊人夜夜躁av伊人久久| 国产精品私房写真福利视频| 久久精品免视看| 欧美va在线播放| 日韩一区二区三区在线| 欧美另类z0zxhd电影| 欧美人妇做爰xxxⅹ性高电影| 91看片淫黄大片一级在线观看| 韩国精品主播一区二区在线观看| 麻豆精品一二三| 蜜桃久久久久久久| 久久99久久久久久久久久久| 蜜桃一区二区三区在线| 捆绑变态av一区二区三区| 日韩av中文字幕一区二区| 日韩成人精品在线观看| 亚洲bt欧美bt精品| 午夜国产精品一区| 日本午夜精品一区二区三区电影 | 精品剧情v国产在线观看在线| 欧美疯狂做受xxxx富婆| 91精品国产综合久久福利软件| 欧美日韩成人综合在线一区二区| 欧美性感一区二区三区| 欧美日韩午夜精品| 日韩一区二区三区免费观看| 日韩一级片在线播放| 久久久蜜桃精品| 18欧美亚洲精品| 一区二区三区在线观看动漫| 亚洲一本大道在线| 九九九精品视频| 成人午夜视频在线观看| 色综合天天综合网天天看片 | 裸体歌舞表演一区二区| 国产一区二区伦理片| 丁香激情综合五月| 91丨porny丨中文| 欧美日韩极品在线观看一区| 7777女厕盗摄久久久| xnxx国产精品| 综合激情网...| 首页综合国产亚洲丝袜| 国产91丝袜在线播放九色| 91久久国产综合久久| 欧美一级日韩一级| 欧美国产精品中文字幕| 午夜精品免费在线| 国产一区中文字幕| 欧美专区亚洲专区| 国产亚洲1区2区3区| 伊人开心综合网| 国产一区二区导航在线播放| 91亚洲国产成人精品一区二区三 | 欧美视频精品在线| 欧美精品一区二区三区高清aⅴ| 亚洲欧美在线另类| 日韩av一区二区三区四区| 99在线精品免费| 精品久久五月天| 亚洲一卡二卡三卡四卡无卡久久| 国产精品中文字幕日韩精品| 欧美中文字幕一区二区三区 |