summaryrefslogtreecommitdiff
path: root/code/fe310/eos/ecp.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/fe310/eos/ecp.c')
-rw-r--r--code/fe310/eos/ecp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/code/fe310/eos/ecp.c b/code/fe310/eos/ecp.c
index 85539f5..bf51b19 100644
--- a/code/fe310/eos/ecp.c
+++ b/code/fe310/eos/ecp.c
@@ -16,8 +16,9 @@ static ECPSocket *_sock = NULL;
static void timer_handler(unsigned char type) {
ecp_cts_t next = ecp_timer_exe(_sock);
if (next) {
- uint32_t tick = next * (uint64_t)RTC_FREQ / 1000;
- eos_timer_set(tick, EOS_TIMER_ETYPE_ECP);
+ volatile uint64_t *mtime = (uint64_t *) (CLINT_CTRL_ADDR + CLINT_MTIME);
+ uint64_t tick = *mtime + next * (uint64_t)RTC_FREQ / 1000;
+ eos_timer_set(tick, EOS_TIMER_ETYPE_ECP, 0);
}
}