(timer): basic start
This commit is contained in:
parent
44427f7734
commit
537dde170b
3 changed files with 22 additions and 3 deletions
12
src/kernel/timer.c
Normal file
12
src/kernel/timer.c
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include <stdint.h>
|
||||
#include <kernel/interrupts.h>
|
||||
#include <kernel/plic.h>
|
||||
#include <kernel/timer.h>
|
||||
|
||||
void timer_handle_interrupt()
|
||||
{
|
||||
static volatile uint64_t *mtime = (uint64_t *)CLINT_MTIME;
|
||||
static volatile uint64_t *mtimecmp = (uint64_t *)CLINT_MTIMECMP(0);
|
||||
|
||||
*mtimecmp = *mtime + TIMER_FREQ;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue