亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲午夜久久久| 亚洲精品写真福利| 美女高潮久久久| 亚洲一区二区三区精品在线| 久久久青草青青国产亚洲免观| 国产在线播放一区二区三区| 一区二区三区久久久| 欧美激情一区二区三区在线| 91视频在线观看| 欧美综合亚洲图片综合区| 国产真实乱子伦精品视频| 国产精品高潮久久久久无| 精品人伦一区二区色婷婷| 色偷偷88欧美精品久久久| 激情综合色播五月| 一区二区视频在线| 制服丝袜成人动漫| 欧美一级片在线| 亚洲视频在线一区| 亚洲男人的天堂在线观看| 国产精品你懂的在线欣赏| 亚洲一区欧美一区| 欧美成人福利视频| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 日本不卡一二三区黄网| 成人亚洲一区二区一| 色婷婷综合久久久中文一区二区 | 精品日韩在线一区| 国产成人综合网| 亚洲一区在线观看免费观看电影高清 | 91精品国产综合久久久久| 久久精品国产免费看久久精品| 久久久国际精品| 欧美蜜桃一区二区三区| 成人久久18免费网站麻豆| 午夜视频在线观看一区| 国产日韩综合av| 7777精品伊人久久久大香线蕉的| 国产一区二区三区精品视频| 一区二区日韩av| 日本一区二区三区国色天香 | 91免费看`日韩一区二区| 五月激情六月综合| 国产精品免费丝袜| 日韩欧美国产综合在线一区二区三区| 91香蕉视频污| 极品少妇xxxx偷拍精品少妇| 午夜精品爽啪视频| 中文字幕中文字幕在线一区 | 日韩不卡一区二区三区| 伊人开心综合网| 国产精品久久午夜夜伦鲁鲁| 337p亚洲精品色噜噜| 91亚洲国产成人精品一区二三| 美女一区二区在线观看| 亚洲成人精品一区二区| 依依成人综合视频| 中文字幕亚洲电影| 欧美国产精品中文字幕| 精品sm在线观看| 9191成人精品久久| 欧美三级视频在线观看| 91色在线porny| 色诱亚洲精品久久久久久| 成人在线综合网| 国产精品一卡二| 国产综合色产在线精品| 久久99久久99小草精品免视看| 日日夜夜精品免费视频| 亚洲一区二区免费视频| 亚洲自拍另类综合| 综合欧美一区二区三区| 国产精品成人在线观看| 中文字幕一区二| 国产精品不卡一区| 亚洲欧美在线高清| 亚洲色图在线看| 亚洲在线视频网站| 亚洲成人免费看| 美女一区二区视频| 久久成人久久鬼色| 久久99久久精品| 国产成人亚洲综合a∨婷婷| 韩国女主播成人在线| 国产一区不卡视频| 国产福利不卡视频| 成人激情视频网站| 色综合久久六月婷婷中文字幕| 91看片淫黄大片一级在线观看| 色综合久久88色综合天天| 日本韩国视频一区二区| 欧美日本在线一区| 日韩三级视频在线看| 久久久午夜精品理论片中文字幕| 亚洲国产精品99久久久久久久久| 国产精品传媒入口麻豆| 亚洲一区二区三区三| 蜜桃av一区二区| 成人午夜激情影院| 色婷婷综合久色| 日韩亚洲欧美成人一区| 欧美国产欧美亚州国产日韩mv天天看完整 | 日韩午夜激情电影| 国产欧美日韩不卡| 一区二区在线免费| 蜜臀av在线播放一区二区三区| 国产精品18久久久久久久久| 91一区二区在线观看| 欧美日韩亚洲不卡| 久久先锋资源网| 亚洲午夜日本在线观看| 极品销魂美女一区二区三区| 99久久免费视频.com| 51精品秘密在线观看| 亚洲国产精品t66y| 日韩激情一区二区| 成人一区二区视频| 欧美一区二区三区系列电影| 国产亚洲综合色| 亚洲国产精品久久久男人的天堂| 狠狠色丁香久久婷婷综合丁香| 91视频com| 国产亚洲1区2区3区| 午夜精品久久久久久久久久| 国产999精品久久| 欧美日韩精品免费观看视频| 国产三级精品视频| 日韩电影免费在线| 91网址在线看| 久久久久久免费网| 日本亚洲视频在线| 色香蕉成人二区免费| 久久精品欧美一区二区三区麻豆| 五月开心婷婷久久| 91视频com| 国产精品青草综合久久久久99| 蜜乳av一区二区三区| 欧美日韩在线综合| 亚洲婷婷综合色高清在线| 国内外精品视频| 69堂国产成人免费视频| 夜夜精品视频一区二区| 成人一道本在线| 久久九九久久九九| 免费观看一级欧美片| 欧美午夜精品一区二区三区| 国产精品免费久久| 国产成人免费视| 2021国产精品久久精品| 免费成人在线播放| 欧美精品日韩精品| 性久久久久久久久| 欧洲亚洲精品在线| 一区二区三区国产精品| 91在线观看成人| 国产精品久久久久影院亚瑟| 国产精品系列在线播放| 久久综合丝袜日本网| 蜜桃视频在线一区| 日韩精品资源二区在线| 日韩av在线发布| 欧美一区二区三区播放老司机| 亚洲成国产人片在线观看| 欧美影视一区在线| 亚洲中国最大av网站| 欧美亚洲综合久久| 亚洲国产成人va在线观看天堂 | 欧美日韩在线三级| 亚洲成人先锋电影| 777精品伊人久久久久大香线蕉| 午夜精品久久一牛影视| 9191久久久久久久久久久| 日韩福利视频导航| 日韩一卡二卡三卡四卡| 久久99精品国产.久久久久久| 欧美mv日韩mv亚洲| 狠狠色丁香婷婷综合久久片| xf在线a精品一区二区视频网站| 国产美女精品一区二区三区| 久久久午夜精品| 91小视频在线观看| 亚洲午夜成aⅴ人片| 欧美精品第1页| 国产一区二区视频在线播放| 欧美韩国日本不卡| 91成人国产精品| 日韩福利电影在线| 久久久久久久综合色一本| 成人免费视频app| 亚洲精品成人悠悠色影视| 欧美性感一区二区三区| 另类专区欧美蜜桃臀第一页| 国产人伦精品一区二区| av一区二区不卡| 午夜日韩在线电影| 欧美va在线播放| 波多野结衣视频一区| 婷婷激情综合网| 久久免费精品国产久精品久久久久 | 亚洲欧美在线高清|