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

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

?? os_tmr.c

?? KEIL平臺下,LPC23XX官方的UCOSii的移植文件,包含各種功能的測試程序.
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
************************************************************************************************************************
*                                                      uC/OS-III
*                                                 The Real-Time Kernel
*
*                                     (c) Copyright 2005-2007, Micrium, Weston, FL
*                                                  All Rights Reserved
*
*                                                   TIMER MANAGEMENT
*
* File    : OS_TMR.C
* By      : Jean J. Labrosse
* Version : V2.85
*
* 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免费看片在线观看| 久久综合九色综合久久久精品综合| 日韩情涩欧美日韩视频| 国产精品久久久久久亚洲伦| 免费成人在线播放| 欧美午夜影院一区| 国产精品少妇自拍| 国产一区二区三区在线看麻豆| 久久成人综合网| 欧美日韩精品一区二区三区蜜桃 | 亚洲免费资源在线播放| 韩国女主播成人在线| 国产精品456露脸| 日韩美女视频在线| 久久精品一区二区| 麻豆精品久久精品色综合| 麻豆成人久久精品二区三区红| 九色综合国产一区二区三区| 国产精品影音先锋| 久久人人超碰精品| 日本91福利区| 日韩一区二区三区高清免费看看| 欧美精品一区二区三区很污很色的| 2023国产一二三区日本精品2022| 国产亚洲短视频| 一区二区三区精品视频| 日本大胆欧美人术艺术动态| 欧美欧美欧美欧美首页| 亚洲亚洲人成综合网络| 在线看一区二区| 亚洲综合一二区| 欧美日韩一区不卡| 国产亚洲欧美日韩日本| 国产精品一区二区视频| 国产欧美视频一区二区| 高清不卡一区二区在线| 国产精品国产三级国产aⅴ原创| 亚洲一区成人在线| 欧美欧美午夜aⅴ在线观看| 视频在线观看一区| 99久久综合狠狠综合久久| 6080午夜不卡| 韩国在线一区二区| 久久先锋资源网| 国产suv精品一区二区6| 中文字幕日韩一区二区| 欧美艳星brazzers| 久久狠狠亚洲综合| 国产欧美精品一区| 欧美网站大全在线观看| 麻豆91精品视频| 中文字幕第一区第二区| 99精品久久只有精品| 久久久久亚洲蜜桃| 91免费国产视频网站| 亚洲成人激情社区| 久久久精品欧美丰满| 91免费版在线看| 免费在线观看视频一区| 91高清视频免费看| 久久av资源网| 亚洲精品福利视频网站| 99视频一区二区三区| 午夜电影一区二区| 国产亚洲精品中文字幕| 欧美少妇性性性| 国产成人免费在线视频| 洋洋av久久久久久久一区| 精品福利在线导航| 色欧美片视频在线观看在线视频| 中文字幕在线不卡一区二区三区| 国产剧情一区二区| 亚洲午夜私人影院| 中文字幕av一区二区三区| 国产精品夜夜嗨| 午夜一区二区三区视频| 欧美性猛片aaaaaaa做受| 黄网站免费久久| 亚洲午夜精品在线| 国产精品久久毛片| 亚洲精品一线二线三线无人区| 麻豆精品一区二区av白丝在线| 日韩一级精品视频在线观看| av成人老司机| 激情综合色播激情啊| 亚洲综合免费观看高清在线观看 | 国产乱码精品一区二区三区忘忧草| 日韩欧美123| 欧美探花视频资源| 99久久777色| 成人晚上爱看视频| 久88久久88久久久| 婷婷综合在线观看| 悠悠色在线精品| 综合欧美一区二区三区| 欧美性受xxxx黑人xyx性爽| 成人av在线资源| 成人国产视频在线观看| 一区二区三区美女视频| 国产精品久久夜| 国产精品日日摸夜夜摸av| 国产日韩三级在线| 欧美中文字幕一区| 久久电影网电视剧免费观看| 日韩高清一区二区| 性欧美大战久久久久久久久| 亚洲国产三级在线| 亚洲国产欧美在线| 亚洲r级在线视频| 午夜精品福利久久久| 日韩av在线发布| 成人欧美一区二区三区白人| 国产精品色哟哟网站| 日韩一区有码在线| 亚洲欧美韩国综合色| 亚洲大尺度视频在线观看| 一区二区国产盗摄色噜噜| 亚洲二区在线视频| 日本女优在线视频一区二区| 狠狠色伊人亚洲综合成人| 秋霞成人午夜伦在线观看| 亚洲国产精品一区二区www在线| 欧美日韩色一区| 欧美日韩一区视频| 麻豆成人91精品二区三区| 丝瓜av网站精品一区二区 | 亚洲伦理在线精品| 国产精品美女www爽爽爽| 国产欧美一区二区精品婷婷| 色综合久久综合中文综合网| 亚洲成人av福利| 亚洲一区二区三区视频在线播放 | 亚洲欧美日韩国产另类专区 | 国产精品一二三在| 国产精品一级片| 99re这里只有精品视频首页| 91丨九色丨蝌蚪富婆spa| 日本乱人伦aⅴ精品| 日本韩国一区二区三区| 日本电影欧美片| 欧美日韩国产成人在线91| 7777精品伊人久久久大香线蕉最新版 | 中文字幕一区二区5566日韩| 久久久国际精品| 欧美在线观看视频在线| 欧美三级午夜理伦三级中视频| 国产大片一区二区| eeuss鲁片一区二区三区在线看| 亚洲va韩国va欧美va精品| 免费成人av在线播放| 国产一区二区成人久久免费影院 | 欧美一区二区三区免费大片| 99视频一区二区| 国产乱妇无码大片在线观看| 亚洲午夜久久久久久久久电影网| 久久久噜噜噜久久中文字幕色伊伊| 欧美日韩午夜精品| 99re这里都是精品| 欧美电影免费观看高清完整版在线 | 欧美一三区三区四区免费在线看| jizz一区二区| 欧美一区二区三区视频在线观看 | 亚洲精品国产一区二区精华液 | 中文字幕亚洲一区二区va在线| 久久蜜桃一区二区| 欧美一卡二卡三卡四卡| 一本色道久久综合亚洲aⅴ蜜桃 | 欧美日韩在线亚洲一区蜜芽| 欧美成人精品福利| 4438x成人网最大色成网站| 久久综合九色综合97_久久久| 欧美一区二区三区四区在线观看| 一本高清dvd不卡在线观看| 精品日韩在线观看| 91精品国产综合久久蜜臀| 99久久99久久免费精品蜜臀| 色综合久久久久久久久| 精品精品欲导航| 日韩欧美第一区| 日韩欧美一二区| 亚洲欧洲av在线| 激情六月婷婷综合| 日韩三级视频在线看| 666欧美在线视频| 亚洲桃色在线一区| 亚洲欧美国产77777| 韩国一区二区在线观看| 日韩欧美一区在线| 亚洲一区二区av在线| 成人免费va视频| 精品成人一区二区三区四区| 午夜精品久久久久久| 91精品国产日韩91久久久久久| 91精品国产91综合久久蜜臀| 亚洲精品成人在线|