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

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

?? lpc2204timer.c

?? 菲利普22系列 vxworks bsp 可以用來可以和其他版本的ARM vxworks bsp(特別是7內核的進行比較)進行比較可以加深對BSP的理解和掌握
?? C
字號:
/* lpc2210Timer.c - Samsung S3C44B0X timer library */

#include "copyright_wrs.h"

/* includes */

#include "vxWorks.h"
#include "config.h"
#include "drv/timer/timerDev.h"
#include "drv/timer/timestampDev.h"
#include "lpc2210Timer.h"

/* defines */

/* The default is to assume memory mapped I/O */

/* locals */

LOCAL FUNCPTR sysClkRoutine    = NULL; /* routine to call on clock tick */
LOCAL int sysClkArg            = (int)NULL; /* its argument */
LOCAL int sysClkRunning        = FALSE;
LOCAL int sysClkConnected      = FALSE;
LOCAL int sysClkTicksPerSecond = 100;

LOCAL FUNCPTR sysAuxClkRoutine    = NULL;
LOCAL int sysAuxClkArg            = (int)NULL;
LOCAL int sysAuxClkRunning        = FALSE;
LOCAL int sysAuxClkTicksPerSecond = 100;
LOCAL int sysAuxClkTicks;



#ifdef INCLUDE_TIMESTAMP

LOCAL BOOL      sysTimestampRunning     = FALSE;         /* running flag */
LOCAL FUNCPTR   sysTimestampRoutine     = NULL;          /* routine to call on intr */
LOCAL int       sysTimestampArg         = 0;             /* arg for routine */
void      sysTimestampInt (void);                  /* forward declaration */

#endif  /* INCLUDE_TIMESTAMP */

void SysClearClockInterrupt()
{
    T0IR = 1;
}

/*******************************************************************************
*
* sysClkInt - interrupt level processing for system clock
*
* This routine handles a system clock interrupt.  It acknowledges the
* interrupt and calls the routine installed by sysClkConnect().
*/

void sysClkInt (void)
{
    /* call system clock service routine */
    if (sysClkRoutine != NULL)
        (* sysClkRoutine) (sysClkArg);
}


/*******************************************************************************
*
* sysClkConnect - connect a routine to the system clock interrupt
*
* This routine specifies the interrupt service routine to be called at each
* clock interrupt.  Normally, it is called from usrRoot() in usrConfig.c to 
* connect usrClock() to the system clock interrupt.
*
* RETURN: OK, or ERROR if the routine cannot be connected to the interrupt.
*
* SEE ALSO: intConnect(), usrClock(), sysClkEnable()
*/
STATUS sysClkConnect
    (
    FUNCPTR routine,    /* routine to be called at each clock interrupt */
    int arg        /* argument with which to call routine */
    )
{
    if (sysClkConnected == FALSE)
    {
        T0MCR = 0x03;		   						/* 匹配通道0匹配中斷并復位T0TC */
        T0TCR = 0x02;		   						/* 復位T0TC */
        sysHwInit2 ();
        sysClkConnected = TRUE;
    }

    sysClkRoutine   = NULL;
    sysClkArg        = arg;
    sysClkRoutine = routine;

    return (OK);
}


/*******************************************************************************
*
* sysClkDisable - turn off system clock interrupts
*
* This routine disables system clock interrupts.
*
* RETURNS: N/A
*
* SEE ALSO: sysClkEnable()
*/

void sysClkDisable (void)
{

    /*int oier;*/	/*  : deleted */
    
    if (sysClkRunning)
    {
        T0TCR = 0x02;
        sysClkRunning = FALSE;
    }
}


/*******************************************************************************
*
* sysClkEnable - turn on system clock interrupts
*
* This routine enables system clock interrupts.
*
* RETURNS: N/A
*
* SEE ALSO: sysClkConnect(), sysClkDisable(), sysClkRateSet()
*/

void sysClkEnable (void)
{
    /*UINT32 oier;*/	/*  : deleted */

    if (!sysClkRunning)
    {
        T0TCR = 0x01;
        sysClkRunning = TRUE;
    }
}


/*******************************************************************************
*
* sysClkRateGet - get the system clock rate
*
* This routine returns the system clock rate.
*
* RETURNS: The number of ticks per second of the system clock.
*
* SEE ALSO: sysClkEnable(), sysClkRateSet()
*/

int sysClkRateGet (void)
{
    return (sysClkTicksPerSecond);
}


/*******************************************************************************
*
* sysClkRateSet - set the system clock rate
*
* This routine sets the interrupt rate of the system clock.
* It is called by usrRoot() in usrConfig.c.
*
* RETURNS: OK, or ERROR if the tick rate is invalid or the timer cannot be set.
*
* SEE ALSO: sysClkEnable(), sysClkRateGet()
*/

STATUS sysClkRateSet
    (
    int ticksPerSecond        /* number of clock interrupts per second */
    )
{
    if (ticksPerSecond < SYS_CLK_RATE_MIN || ticksPerSecond > SYS_CLK_RATE_MAX)
        return (ERROR);

    sysClkTicksPerSecond = 100;
    T0MR0 = 110592;	    						/* 比較值(1S定時值) */
    T0PR = 99;			    					/* 設置定時器0分頻為100分頻,得110592Hz */
    
    if (sysClkRunning)
    {
        sysClkDisable ();
        sysClkEnable ();
    }

    return (OK);
}

/*******************************************************************************
*
* sysAuxClkInt - handle an auxiliary clock interrupt
*
* This routine handles an auxiliary clock interrupt.  It acknowledges the
* interrupt and calls the routine installed by sysAuxClkConnect().
*
* RETURNS: N/A
*/

void sysAuxClkInt (void)
    {
    /* call auxiliary clock service routine */

    if (sysAuxClkRoutine != NULL)
        (*sysAuxClkRoutine) (sysAuxClkArg);

    }

/*******************************************************************************
*
* sysAuxClkConnect - connect a routine to the auxiliary clock interrupt
*
* This routine specifies the interrupt service routine to be called at each
* auxiliary clock interrupt.  It does not enable auxiliary clock interrupts.
*
* RETURNS: OK, or ERROR if the routine cannot be connected to the interrupt.
*
* SEE ALSO: intConnect(), sysAuxClkEnable()
*/

STATUS sysAuxClkConnect
    (
    FUNCPTR routine,    /* routine called at each aux clock interrupt */
    int arg             /* argument to auxiliary clock interrupt routine */
    )
    {
    sysAuxClkRoutine    = NULL;
    sysAuxClkArg        = arg;

#if ((CPU_FAMILY == ARM) && ARM_THUMB)
    /* set b0 so that sysClkConnect() can be used from shell */
    sysAuxClkRoutine = (FUNCPTR)((UINT32)routine | 1);
#else
    sysAuxClkRoutine = routine;
#endif /* CPU_FAMILY == ARM */

    return (OK);
    }

/*******************************************************************************
*
* sysAuxClkDisable - turn off auxiliary clock interrupts
*
* This routine disables auxiliary clock interrupts.
*
* RETURNS: N/A
*
* SEE ALSO: sysAuxClkEnable()
*/

void sysAuxClkDisable (void)
    {
    /*UINT32 oier;*/		/*  : deleted */
    
    if (sysAuxClkRunning)
    {
#if 0
        /* disable timer interrupt in the timer */
		/*  : deleted */
        /*SNGKS32C_TIMER_REG_READ (SNGKS32C_TIMER_TMOD, oier);*/
        /*SNGKS32C_TIMER_REG_WRITE (SNGKS32C_TIMER_TMOD, oier & ~(1 << 3));*/

        /* disable timer interrupt in the interrupt controller */

        SNGKS32C_TIMER_INT_DISABLE (AUX_TIMER_INT_LVL);
#endif
        sysAuxClkRunning = FALSE;
        }
    }

/*******************************************************************************
*
* sysAuxClkEnable - turn on auxiliary clock interrupts
*
* This routine enables auxiliary clock interrupts.
*
* RETURNS: N/A
*
* SEE ALSO: sysAuxClkConnect(), sysAuxClkDisable(), sysAuxClkRateSet()
*/

void sysAuxClkEnable (void)
    {
    /*UINT32 oier;*/	/*  : deleted */
    static BOOL connected = FALSE;

    if (!connected)
        {
        intConnect (INUM_TO_IVEC (INT_LVL_TIMER1), sysAuxClkInt, 0);
        connected = TRUE;
        }

    if (!sysAuxClkRunning)
        {
        /*
         * Calculate the number of ticks of the timer clock that this
         * period requires.  Do this once, here, so that the timer interrupt
         * routine does not need to perform a division.
         */

        sysAuxClkTicks = (AUX_TIMER_CLK / sysAuxClkTicksPerSecond);
#if 0
        /*
         * Load the match register with a new value calculated by
         * adding the ticks per interrupt to the current value of the
         * counter register.  Note that this may wraparound to a value
         * less than the current counter value but that's OK.
         */
		/*  : deleted */
        /*SNGKS32C_TIMER_REG_WRITE (SNGKS32C_TIMER_TDATA_1, sysAuxClkTicks);*/

        /* enable timer 1 */
		/*  : deleted */
        /*SNGKS32C_TIMER_REG_READ (SNGKS32C_TIMER_TMOD, oier);*/
        /*SNGKS32C_TIMER_REG_WRITE (SNGKS32C_TIMER_TMOD, oier | 8);*/

        /* enable clock interrupt in interrupt controller */
        SNGKS32C_TIMER_INT_ENABLE (AUX_TIMER_INT_LVL);
#endif
        sysAuxClkRunning = TRUE;
        }
    }

/*******************************************************************************
*
* sysAuxClkRateGet - get the auxiliary clock rate
*
* This routine returns the interrupt rate of the auxiliary clock.
*
* RETURNS: The number of ticks per second of the auxiliary clock.
*
* SEE ALSO: sysAuxClkEnable(), sysAuxClkRateSet()
*/

int sysAuxClkRateGet (void)
    {
    return (sysAuxClkTicksPerSecond);
    }

/*******************************************************************************
*
* sysAuxClkRateSet - set the auxiliary clock rate
*
* This routine sets the interrupt rate of the auxiliary clock.  It does not
* enable auxiliary clock interrupts.
*
* RETURNS: OK, or ERROR if the tick rate is invalid or the timer cannot be set.
*
* SEE ALSO: sysAuxClkEnable(), sysAuxClkRateGet()
*/

STATUS sysAuxClkRateSet
    (
    int ticksPerSecond  /* number of clock interrupts per second */
    )
    {
    if (ticksPerSecond < AUX_CLK_RATE_MIN || ticksPerSecond > AUX_CLK_RATE_MAX)
        return (ERROR);

    sysAuxClkTicksPerSecond = ticksPerSecond;

    if (sysAuxClkRunning)
        {
        sysAuxClkDisable ();
        sysAuxClkEnable ();
        }

    return (OK);
    }

#ifdef  INCLUDE_TIMESTAMP

/*******************************************************************************
*
* sysTimestampInt - timestamp timer interrupt handler
*
* This routine handles the timestamp timer interrupt.  A user routine is
* called, if one was connected by sysTimestampConnect().
*
* RETURNS: N/A
*
* SEE ALSO: sysTimestampConnect()
*/

void sysTimestampInt (void)
    {
    if (sysTimestampRunning && sysTimestampRoutine != NULL)
        (*sysTimestampRoutine)(sysTimestampArg);
    }

/*******************************************************************************
*
* sysTimestampConnect - connect a user routine to the timestamp timer interrupt
*
* This routine specifies the user interrupt routine to be called at each
* timestamp timer interrupt.  It does not enable the timestamp timer itself.
*
* RETURNS: OK, or ERROR if sysTimestampInt() interrupt handler is not used.
*/

STATUS sysTimestampConnect
    (
    FUNCPTR routine,    /* routine called at each timestamp timer interrupt */
    int arg     /* argument with which to call routine */
    )
    {
    return ERROR;    /* System clock tick specifies a rollover event */
    }

/*******************************************************************************
*
* sysTimestampEnable - initialize and enable the timestamp timer
*
* This routine connects the timestamp timer interrupt and initializes the
* counter registers.  If the timestamp timer is already running, this routine
* merely resets the timer counter.
*
* The rate of the timestamp timer should be set explicitly within the BSP,
* in the sysHwInit() routine.  This routine does not initialize the timer
* rate.
*
* RETURNS: OK, or ERROR if hardware cannot be enabled.
*/

STATUS sysTimestampEnable (void)
    {

    if (!sysTimestampRunning)
        {
        sysTimestampRunning = TRUE;
        }

    sysClkEnable();    /* make sure that system clock is running */

    return (OK);
    }

/*******************************************************************************
*
* sysTimestampDisable - disable the timestamp timer
*
* This routine disables the timestamp timer.  Interrupts are not disabled,
* although the tick counter will not increment after the timestamp timer
* is disabled, thus interrupts will no longer be generated.
*
* RETURNS: OK, or ERROR if timer cannot be disabled.
*/

STATUS sysTimestampDisable (void)
    {
    if (sysTimestampRunning)
        sysTimestampRunning = FALSE;

    return (OK);
    }

/*******************************************************************************
*
* sysTimestampPeriod - get the timestamp timer period
*
* This routine returns the period of the timestamp timer in ticks.
* The period, or terminal count, is the number of ticks to which the timestamp
* timer will count before rolling over and restarting the counting process.
*
* RETURNS: The period of the timestamp timer in counter ticks.
*/

UINT32 sysTimestampPeriod (void)
    {
    return (SYS_TIMER_CLK / sysClkTicksPerSecond);
    }

/*******************************************************************************
*
* sysTimestampFreq - get the timestamp timer clock frequency
*
* This routine returns the frequency of the timer clock, in ticks per second.
*
* RETURNS: The timestamp timer clock frequency, in ticks per second.
*/

UINT32 sysTimestampFreq (void)
    {
    return (SYS_TIMER_CLK);
    }

/*******************************************************************************
*
* sysTimestamp - get the timestamp timer tick count
*
* This routine returns the current value of the timestamp timer tick counter.
* The tick count can be converted to seconds by dividing by the return of
* sysTimestampFreq().
*
* This routine should be called with interrupts locked.  If interrupts are
* not already locked, sysTimestampLock() should be used instead.
*
* RETURNS: The current timestamp timer tick count.
*
* SEE ALSO: sysTimestampLock()
*/

UINT32 sysTimestamp (void)
    {
    UINT32 count;
#if 0
    /*SNGKS32C_TIMER_REG_READ (SNGKS32C_TIMER_TCNT_0, count);*/
	/*  : deleted and added */
	SNGKS32C_TIMER_REG_READ (S3C44B0X_TCNTO0, count);
#endif	
    /* timer counts down to 0 from sysClkTicks load value */
    return (sysTimestampPeriod() - count);
    }

/*******************************************************************************
*
* sysTimestampLock - get the timestamp timer tick count
*
* This routine returns the current value of the timestamp timer tick counter.
* The tick count can be converted to seconds by dividing by the return of
* sysTimestampFreq().
*
* This routine locks interrupts for cases where it is necessary to stop the
* tick counter in order to read it, or when two independent counters must
* be read.  If interrupts are already locked, sysTimestamp() should be
* used instead.
*
* RETURNS: The current timestamp timer tick count.
*
* SEE ALSO: sysTimestamp()
*/

UINT32 sysTimestampLock (void)
    {
    UINT32 result;

    result = sysTimestamp ();

    return (result);
    }

#endif  /* INCLUDE_TIMESTAMP */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www精品美女久久久tv| 久久亚洲一区二区三区明星换脸| 国产成人av一区| 韩国女主播成人在线| 美女视频黄a大片欧美| 久久精品99国产精品日本| 男女性色大片免费观看一区二区| 日韩电影一区二区三区四区| 99久久777色| 国产电影精品久久禁18| 成人激情av网| 日韩电影免费在线| 麻豆91精品视频| 久久电影网电视剧免费观看| 精品中文字幕一区二区| 国产资源在线一区| 成人免费的视频| 一本久久综合亚洲鲁鲁五月天| 99久久久久久99| 欧美日韩亚州综合| 欧美一区二区大片| 久久这里只有精品视频网| 欧美国产日本视频| 亚洲已满18点击进入久久| 婷婷久久综合九色综合绿巨人 | 国产精品区一区二区三区| 亚洲国产电影在线观看| 亚洲精品videosex极品| 五月天激情综合网| 精品亚洲免费视频| 成人avav影音| 欧美视频在线不卡| 精品99一区二区三区| 中文字幕av在线一区二区三区| 亚洲精品日韩专区silk| 日日夜夜精品免费视频| 国模大尺度一区二区三区| 99精品国产热久久91蜜凸| 欧美日本国产一区| 亚洲国产精品精华液ab| 亚洲一区二区欧美| 国产精品中文欧美| 色激情天天射综合网| 日韩一级黄色片| 国产精品美女久久久久aⅴ国产馆| 伊人开心综合网| 狠狠v欧美v日韩v亚洲ⅴ| 色综合天天天天做夜夜夜夜做| 欧美精品日韩一本| 国产精品国产三级国产普通话99 | 丰满亚洲少妇av| 欧美偷拍一区二区| 国产亚洲综合av| 亚洲a一区二区| 成人综合婷婷国产精品久久免费| 欧美日韩一区小说| 国产精品毛片无遮挡高清| 丝袜亚洲另类丝袜在线| 成人av电影免费观看| 日韩视频免费观看高清完整版| 国产精品国产馆在线真实露脸| 奇米综合一区二区三区精品视频| 99视频在线观看一区三区| 日韩欧美国产小视频| 亚洲一级二级在线| 99久久久久久| 日韩精品一二区| 91免费国产在线观看| 精品成人一区二区| 香蕉成人伊视频在线观看| 成人午夜碰碰视频| 久久久久久日产精品| 日欧美一区二区| 91免费观看在线| 国产精品国产三级国产a| 黄色小说综合网站| 91精品国产91久久久久久一区二区 | 日韩精品中文字幕在线不卡尤物| 一区二区三区欧美日韩| 成人午夜av在线| 久久久青草青青国产亚洲免观| 日本美女一区二区三区视频| 欧美在线综合视频| 一区在线播放视频| 成人一区二区三区在线观看| 久久久久久电影| 91香蕉国产在线观看软件| 亚洲精品乱码久久久久久久久| 国产精品卡一卡二| 国产精一区二区三区| 日韩精品在线一区| 美女国产一区二区| 日韩亚洲欧美高清| 青青草国产成人99久久| 欧美日韩国产影片| 亚洲国产成人av网| 欧美日本一区二区三区| 香蕉久久一区二区不卡无毒影院| 色狠狠色噜噜噜综合网| 亚洲色图一区二区三区| 91在线免费视频观看| 国产精品久久免费看| 成人av在线一区二区| 国产精品福利在线播放| 成人福利视频网站| 国产精品白丝在线| 91免费国产在线| 亚洲激情av在线| 欧美色综合影院| 五月婷婷久久丁香| 日韩精品中文字幕一区| 国内精品免费在线观看| 欧美国产激情二区三区| 成人黄动漫网站免费app| 美洲天堂一区二卡三卡四卡视频| 日韩一级免费一区| 国产精品一区二区在线观看网站| 国产三级一区二区三区| 99re热这里只有精品免费视频| 综合色天天鬼久久鬼色| 欧美私模裸体表演在线观看| 五月婷婷激情综合| 欧美电视剧在线看免费| 国产精品1区二区.| 中文字幕亚洲一区二区av在线| 91豆麻精品91久久久久久| 亚洲黄色免费电影| 欧美一区日韩一区| 国产在线精品国自产拍免费| 欧美国产1区2区| 欧美羞羞免费网站| 精品一区二区在线播放| 亚洲国产精品传媒在线观看| 99久久精品免费| 亚洲6080在线| 久久久.com| 日本二三区不卡| 久久精品免费看| 国产欧美一区二区精品婷婷| 91麻豆福利精品推荐| 午夜精品免费在线观看| 久久精品欧美一区二区三区不卡 | 国产成人精品在线看| 亚洲人成伊人成综合网小说| 欧美一卡二卡三卡| 成人手机电影网| 亚洲6080在线| 中文字幕高清不卡| 欧美日韩视频专区在线播放| 国产伦精一区二区三区| 亚洲视频香蕉人妖| 精品国产三级电影在线观看| 91看片淫黄大片一级| 蜜桃av一区二区| 亚洲女人****多毛耸耸8| 日韩欧美一区二区免费| 波多野结衣在线一区| 日韩中文字幕亚洲一区二区va在线| 久久久亚洲综合| 911精品产国品一二三产区| 成人免费毛片aaaaa**| 丝袜美腿一区二区三区| 国产欧美日韩视频在线观看| 国产精品你懂的在线欣赏| 欧美精品久久99久久在免费线| 成人黄色国产精品网站大全在线免费观看| 亚洲一二三区在线观看| 欧美国产精品一区二区三区| 欧美日本视频在线| 91女人视频在线观看| 狠狠v欧美v日韩v亚洲ⅴ| 性欧美大战久久久久久久久| 中国av一区二区三区| 欧美刺激午夜性久久久久久久| 色婷婷久久99综合精品jk白丝| 国产原创一区二区| 男女激情视频一区| 亚洲国产乱码最新视频 | 国产精品一区二区久久精品爱涩| 亚洲精品乱码久久久久久久久| 国产亚洲人成网站| 欧美一级理论片| 欧美在线999| 91免费看`日韩一区二区| 国产精品白丝jk黑袜喷水| 美女视频黄 久久| 日日骚欧美日韩| 亚洲国产一区二区三区青草影视| 国产精品久久久久久久久动漫| 国产亚洲污的网站| 久久综合九色综合97婷婷女人| 制服丝袜亚洲网站| 欧美日韩在线直播| 日本高清不卡视频| 色婷婷综合五月| 色综合视频在线观看| 99精品在线免费| 91香蕉国产在线观看软件| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 精品黑人一区二区三区久久|