diff options
author | Uros Majstorovic <majstor@majstor.org> | 2019-10-15 20:20:38 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2019-10-15 20:20:38 +0200 |
commit | 86957adfc5e2177010db896581763b4cba07273e (patch) | |
tree | c7513c2e5953cb664e9cb5e4d30180dc94b1d758 /code/ecp/fe310 | |
parent | 98b5515f2ada43ca84ab4e8cfbec2c4844eaad6e (diff) |
timer bugfix
Diffstat (limited to 'code/ecp/fe310')
-rw-r--r-- | code/ecp/fe310/time.c | 5 |
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); } |