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

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

?? os_tmr.c

?? ucos移植到S3C2410上的代碼
?? 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一区二区三区免费野_久草精品视频
eeuss鲁一区二区三区| 91精品国产一区二区三区| 久久精品国产亚洲一区二区三区| 国产精品久线观看视频| 9191国产精品| 成人免费av在线| 国产原创一区二区三区| 午夜视频在线观看一区二区| 欧美国产成人在线| 日韩欧美一区二区久久婷婷| 欧美亚洲一区二区在线| 豆国产96在线|亚洲| 成人免费不卡视频| 亚洲欧美日韩国产中文在线| 亚洲二区在线视频| 亚洲福中文字幕伊人影院| 亚洲第一av色| 久久er99热精品一区二区| 国产精华液一区二区三区| 成人激情动漫在线观看| 色欧美片视频在线观看在线视频| 在线免费精品视频| 欧美一三区三区四区免费在线看| 中文字幕日韩av资源站| 国产午夜精品一区二区三区视频 | 激情五月激情综合网| 国产一区二区成人久久免费影院 | 日韩精品中午字幕| 欧美激情一区二区三区四区| 亚洲三级久久久| 图片区小说区区亚洲影院| 老汉av免费一区二区三区 | 欧美日韩国产a| 26uuu精品一区二区| 国产精品久久久久久久浪潮网站| 一区二区三区美女| 蜜桃91丨九色丨蝌蚪91桃色| 国产xxx精品视频大全| 在线视频你懂得一区| 日韩欧美国产综合| 亚洲欧美日韩一区二区三区在线观看| 五月激情六月综合| 成人理论电影网| 91精选在线观看| 欧美日韩一区二区在线视频| 欧美一级高清片| 综合久久国产九一剧情麻豆| 香蕉久久一区二区不卡无毒影院| 蜜桃视频在线一区| 91一区二区三区在线播放| 色婷婷激情一区二区三区| 欧美人与禽zozo性伦| 日韩久久久精品| 亚洲人成伊人成综合网小说| 精品日韩欧美在线| 欧美剧情片在线观看| 欧美一级一区二区| 亚洲另类在线制服丝袜| 韩国一区二区视频| 精品视频在线看| 国产精品视频一二三区| 日本不卡123| 在线看日韩精品电影| 久久久精品免费网站| 日韩主播视频在线| 不卡的电视剧免费网站有什么| 日韩欧美国产1| 亚洲成a人片在线不卡一二三区| 成人a免费在线看| 久久综合九色综合欧美98| 午夜私人影院久久久久| 91免费小视频| 日本一区二区视频在线| 蜜臀av一级做a爰片久久| 欧美色手机在线观看| 国产精品电影院| 国产成人亚洲综合a∨猫咪| 这里是久久伊人| 一个色妞综合视频在线观看| 成人黄色av网站在线| 久久综合五月天婷婷伊人| 日日夜夜免费精品| 欧美三日本三级三级在线播放| 国产精品高清亚洲| 国产suv精品一区二区三区| 亚洲精品一区二区精华| 久久精品国产亚洲一区二区三区| 在线综合亚洲欧美在线视频| 午夜视频久久久久久| 欧美日韩一区二区三区四区五区| 国产精品国产三级国产有无不卡| 国产精品一二三四五| 2024国产精品| 国产精品一区二区91| 日韩欧美视频在线| 美女网站色91| 欧美在线一区二区三区| 午夜私人影院久久久久| 亚洲欧洲av一区二区三区久久| 91原创在线视频| 午夜精品福利视频网站| 精品免费国产一区二区三区四区| 久久精品国产免费| 亚洲欧美电影院| 91精品国产综合久久精品麻豆| 国产精品中文字幕欧美| 亚洲欧美国产高清| 久久久久九九视频| 中文字幕av一区二区三区高| 国产精品综合二区| 国产欧美在线观看一区| 成人性生交大片| 国产亚洲精品精华液| 国产酒店精品激情| 国产精品久久精品日日| 91成人免费在线| 五月婷婷激情综合网| 精品国精品国产| 国产成人8x视频一区二区| 国产精品久久久久一区| jlzzjlzz亚洲日本少妇| 一区二区三区不卡视频| 777a∨成人精品桃花网| 精品系列免费在线观看| 亚洲国产成人一区二区三区| 色域天天综合网| 日韩二区三区在线观看| 久久久久久久久97黄色工厂| 99久久婷婷国产精品综合| 亚洲在线免费播放| 日韩免费观看2025年上映的电影| 国产精品911| 依依成人综合视频| 日韩免费观看2025年上映的电影| 成人性生交大合| 亚洲国产日韩精品| 精品国产凹凸成av人网站| 99在线热播精品免费| 天天色图综合网| 久久精品一区二区三区四区| 色综合欧美在线| 久久国产视频网| 亚洲日本免费电影| 日韩三级视频中文字幕| 波多野结衣精品在线| 日韩高清一区在线| √…a在线天堂一区| 欧美一区二区三区免费观看视频 | 色94色欧美sute亚洲线路二| 青青草伊人久久| 亚洲欧美自拍偷拍| 日韩欧美一区二区久久婷婷| 色综合中文字幕| 久久精品久久久精品美女| 亚洲免费观看在线观看| 久久综合九色综合97婷婷女人 | 欧美成人一区二区三区片免费| 成人动漫一区二区在线| 日韩精品五月天| 亚洲三级电影全部在线观看高清| 日韩精品自拍偷拍| 欧美性视频一区二区三区| 国产成人免费视频| 日本欧美肥老太交大片| 亚洲精品国产无套在线观| 2021久久国产精品不只是精品 | 一区二区三区在线免费播放| 精品久久久久久亚洲综合网| 欧美日韩国产综合视频在线观看| 粉嫩av亚洲一区二区图片| 久久se精品一区精品二区| 一区二区成人在线视频| 中文字幕欧美三区| 久久久久久毛片| 欧美一区二区免费观在线| 在线观看不卡一区| 99精品视频在线播放观看| 国产成人在线电影| 精品无码三级在线观看视频| 亚洲国产精品久久久男人的天堂| 国产精品成人免费精品自在线观看| 欧美sm美女调教| 91精品国产一区二区三区蜜臀 | 日韩一级片网站| 欧美日韩一区二区三区在线看| 欧美性色综合网| 91福利资源站| 色噜噜久久综合| 波多野结衣在线一区| 国产91丝袜在线播放九色| 国内精品写真在线观看| 毛片基地黄久久久久久天堂| 舔着乳尖日韩一区| 亚洲大尺度视频在线观看| 亚洲综合图片区| 亚洲一区二区三区中文字幕| 亚洲欧美日韩国产另类专区| 亚洲视频小说图片| 亚洲人快播电影网| 亚洲精品国产精品乱码不99|