diff --git a/hal/riscv64/generic/hal.c b/hal/riscv64/generic/hal.c index 47c52729..2f32409f 100644 --- a/hal/riscv64/generic/hal.c +++ b/hal/riscv64/generic/hal.c @@ -37,8 +37,6 @@ extern char __bss_start[], __bss_end[]; extern char __heap_base[], __heap_limit[]; extern char __stack_top[], __stack_limit[]; -/* Timer */ -extern void timer_init(void); /* Interrupts */ extern void interrupts_init(void); @@ -50,7 +48,6 @@ void hal_init(void) dtb_parse(dtbAddr); sbi_init(); interrupts_init(); - timer_init(); } diff --git a/hal/riscv64/timer.c b/hal/riscv64/timer.c index ad741c8d..79ce14fc 100644 --- a/hal/riscv64/timer.c +++ b/hal/riscv64/timer.c @@ -15,36 +15,8 @@ #include -/* CLINT Timer interrupt */ -#define TIMER_IRQ (5u | CLINT_IRQ_FLG) - - -static struct { - u32 interval; -} timer_common; - - -static int timer_irqHandler(unsigned int n, void *arg) -{ - (void)n; - (void)arg; - - sbi_setTimer(csr_read(time) + timer_common.interval); - - return 0; -} - time_t hal_timerGet(void) { return csr_read(time) / (TIMER_FREQ / 1000); } - - -void timer_init(void) -{ - timer_common.interval = TIMER_FREQ / 1000; /* 1ms */ - - hal_interruptsSet(TIMER_IRQ, timer_irqHandler, NULL); - sbi_setTimer(csr_read(time) + timer_common.interval); -}