summaryrefslogtreecommitdiff
path: root/code/ecp
diff options
context:
space:
mode:
Diffstat (limited to 'code/ecp')
-rw-r--r--code/ecp/fe310/time.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/code/ecp/fe310/time.c b/code/ecp/fe310/time.c
index 69cf14d..455c762 100644
--- a/code/ecp/fe310/time.c
+++ b/code/ecp/fe310/time.c
@@ -21,6 +21,7 @@ void ecp_tm_sleep_ms(ecp_cts_t msec) {
}
void ecp_tm_timer_set(ecp_cts_t 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, 1);
}