Skip to content

Commit

Permalink
hal/riscv64: remove timer interrupts
Browse files Browse the repository at this point in the history
RISC-V provides 64 bit monotonic timer,
which value can be easily read,
so interrupts in PLO are not necessary.

JIRA: RTOS-813
  • Loading branch information
lukileczo committed Apr 9, 2024
1 parent d2fa683 commit d46b52c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
3 changes: 0 additions & 3 deletions hal/riscv64/generic/hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -50,7 +48,6 @@ void hal_init(void)
dtb_parse(dtbAddr);
sbi_init();
interrupts_init();
timer_init();
}


Expand Down
28 changes: 0 additions & 28 deletions hal/riscv64/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,8 @@

#include <hal/hal.h>

/* 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);
}

0 comments on commit d46b52c

Please sign in to comment.