⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer.c

📁 usb drivers based on s3c2410
💻 C
字号:
/*
 * timer.c: funcitons implement for timer
 */

#include "config.h"
#include "frame.h"
#include "lib.h"

#ifdef _DEBUG
#include <stdio.h>
#endif /* _DEBUG */

volatile unsigned ticks;

static void
timer_isr(struct contextframe *cf, int irq)
{
	ticks++;
#ifdef _DEBUG
	printf("ticks=%u\n", ticks);
#endif /* _DEBUG */
}

void
init_timer(void)
{
	/*XXX*/
	TCFG0 = 0xff << 8;
	TCFG1 = 0x3 << 16;
	TCNTB4 = 12207;	
	TCON = 0x6 << 20; /*update TCNTBn*/	
	TCON = 0x5 << 20; /*kick it off*/
	
  ivt[INT_TIMER4] = timer_isr;
  CLEAR_PENDING(INT_TIMER4);
  INT_ENABLE(INT_TIMER4);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -