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

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

?? os_tmr.c

?? iar環境下移植ucos-ii到at91sam7s64
?? 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一区二区三区免费野_久草精品视频
国产精品免费久久| 日本系列欧美系列| 老司机精品视频一区二区三区| 国产成人av福利| 91精品国产综合久久福利软件| 自拍视频在线观看一区二区| 韩国一区二区三区| 91精品免费观看| 亚洲欧美成aⅴ人在线观看| 国产一二精品视频| 久久久亚洲综合| 亚洲最快最全在线视频| 国产成都精品91一区二区三| 91麻豆精品国产91久久久更新时间 | 亚洲无线码一区二区三区| 高清成人在线观看| 久久亚洲综合色| 老司机精品视频线观看86| 欧美男人的天堂一二区| 一区二区高清免费观看影视大全 | 久久免费看少妇高潮| 男女男精品视频网| 欧美日韩一区 二区 三区 久久精品| 中文字幕一区日韩精品欧美| 国产成人综合网站| 国产肉丝袜一区二区| 国产伦精品一区二区三区视频青涩 | 亚洲欧美日韩系列| av亚洲精华国产精华精华| 国产日韩欧美精品在线| 欧美久久一区二区| 一区二区国产视频| 色菇凉天天综合网| 一区二区高清视频在线观看| 色婷婷亚洲一区二区三区| **网站欧美大片在线观看| 91一区二区三区在线观看| 成人欧美一区二区三区小说| 99久久伊人精品| 亚洲美女视频一区| 欧美视频一区二区三区在线观看| 亚洲午夜久久久| 欧美日韩国产精品自在自线| 日本特黄久久久高潮| 精品不卡在线视频| 懂色av噜噜一区二区三区av| 亚洲欧洲国产日韩| 欧美一a一片一级一片| 无吗不卡中文字幕| 精品国偷自产国产一区| 高清shemale亚洲人妖| 中文字幕一区二区在线播放| 欧美在线视频不卡| 美女网站一区二区| 国产精品久久久久久久久搜平片| 91蝌蚪porny| 日本视频中文字幕一区二区三区| 精品国产电影一区二区| 99九九99九九九视频精品| 亚洲成人av一区| 精品久久久久久久久久久久包黑料 | 日本欧美一区二区在线观看| 久久这里只有精品视频网| 成人黄色在线网站| 日韩中文字幕区一区有砖一区 | 日韩影院免费视频| 国产日韩影视精品| 欧美三级日韩在线| 国内外成人在线| 一区二区三区久久| 欧美精品一区二区三区在线播放| 99久久99精品久久久久久 | 欧美电影免费观看高清完整版在线 | 3d动漫精品啪啪一区二区竹菊 | 婷婷六月综合亚洲| 中文字幕精品一区二区精品绿巨人| 在线看国产一区| 国产综合久久久久影院| 一区二区三区色| 久久精品夜夜夜夜久久| 欧美日韩一区小说| gogo大胆日本视频一区| 美女视频免费一区| 亚洲电影中文字幕在线观看| 国产日韩v精品一区二区| 欧美日韩精品一区二区天天拍小说| 国产精品一区2区| 日一区二区三区| 亚洲乱码国产乱码精品精小说 | 国内成人精品2018免费看| 亚洲一二三四在线观看| 国产欧美一区二区在线| 日韩女优av电影在线观看| 欧美伊人久久久久久久久影院| 国产成人免费xxxxxxxx| 久久精品久久99精品久久| 亚洲午夜久久久久| 一区二区三区中文字幕在线观看| 国产免费观看久久| www欧美成人18+| 日韩久久精品一区| 日韩一区二区三免费高清| 欧美四级电影网| 国产欧美精品一区二区三区四区| 538prom精品视频线放| 欧美在线free| 在线免费观看日韩欧美| 91麻豆国产福利在线观看| proumb性欧美在线观看| 国产成人夜色高潮福利影视| 精品亚洲免费视频| 久久国产剧场电影| 九色综合狠狠综合久久| 久久99日本精品| 久久国产剧场电影| 韩国视频一区二区| 国产精品一区二区三区乱码| 国产一区二区三区精品视频| 久久99国产乱子伦精品免费| 极品美女销魂一区二区三区免费| 蜜臀国产一区二区三区在线播放 | 国内偷窥港台综合视频在线播放| 另类小说综合欧美亚洲| 精品在线亚洲视频| 国产精品一区在线| 成人激情综合网站| 色哟哟一区二区| 欧美日韩dvd在线观看| 91精品国产欧美一区二区成人| 欧美一区二区三级| 精品成人a区在线观看| 中文字幕国产一区| 亚洲一区二区欧美| 日韩vs国产vs欧美| 国产精品中文字幕日韩精品| proumb性欧美在线观看| 在线亚洲人成电影网站色www| 欧美日韩国产综合一区二区| 日韩视频一区在线观看| 国产精品你懂的在线欣赏| 一区二区三区中文字幕精品精品| 日韩高清一级片| 国产经典欧美精品| 欧美怡红院视频| 欧美精品一区二区蜜臀亚洲| 一区在线观看视频| 免费观看一级欧美片| 国产成人精品网址| 欧美亚洲国产一区二区三区va| 日韩一区二区在线播放| 日本一区二区成人| 日韩国产在线观看| 9色porny自拍视频一区二区| 欧美日韩国产高清一区二区三区 | 美女在线观看视频一区二区| 国产很黄免费观看久久| 在线观看视频91| 久久久久久久网| 亚洲影视在线观看| 国产99精品在线观看| 欧美亚洲高清一区| 中文字幕国产一区| 裸体歌舞表演一区二区| 色偷偷成人一区二区三区91| 久久综合999| 亚洲aⅴ怡春院| jlzzjlzz欧美大全| 久久人人超碰精品| 日韩成人免费在线| 91国内精品野花午夜精品| 久久综合九色综合欧美就去吻| 一区二区免费看| 成人白浆超碰人人人人| 精品国产亚洲一区二区三区在线观看 | 国产成人在线视频网址| 制服.丝袜.亚洲.中文.综合| 自拍视频在线观看一区二区| 国产成人欧美日韩在线电影| 日韩视频一区二区在线观看| 亚洲444eee在线观看| 91女人视频在线观看| 中文幕一区二区三区久久蜜桃| 蜜桃久久精品一区二区| 欧美午夜电影在线播放| 中文字幕一区二区在线播放| 国产精品中文字幕一区二区三区| 日韩欧美亚洲另类制服综合在线 | 亚洲日穴在线视频| 福利电影一区二区| 欧美r级在线观看| 免播放器亚洲一区| 7777精品伊人久久久大香线蕉 | 国产欧美精品在线观看| 加勒比av一区二区| 精品国产百合女同互慰| 精品一区二区在线看| 精品国产三级电影在线观看| 久久精品国产99| 久久久久久久精| 高清日韩电视剧大全免费|