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/fe310/eos/ecp.c | |
parent | 98b5515f2ada43ca84ab4e8cfbec2c4844eaad6e (diff) |
timer bugfix
Diffstat (limited to 'code/fe310/eos/ecp.c')
-rw-r--r-- | code/fe310/eos/ecp.c | 5 |
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); } } |