📄 timer.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 + -