diff options
Diffstat (limited to 'code/ecp/fe310/time.c')
-rw-r--r-- | code/ecp/fe310/time.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/code/ecp/fe310/time.c b/code/ecp/fe310/time.c index 4b8b2a7..fedd23a 100644 --- a/code/ecp/fe310/time.c +++ b/code/ecp/fe310/time.c @@ -1,25 +1,21 @@ #include <core.h> +#include <tr.h> #include <eos/timer.h> #include "encoding.h" #include "platform.h" -static ecp_cts_t t_abstime_ms(ecp_cts_t msec) { +ecp_cts_t ecp_tm_abstime_ms(ecp_cts_t msec) { volatile uint64_t *mtime = (uint64_t *) (CLINT_CTRL_ADDR + CLINT_MTIME); uint64_t now_ms = *mtime * 1000 / RTC_FREQ; return now_ms + msec; } -static void t_timer_set(ecp_cts_t next) { +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, 1); } - -int ecp_time_init(ECPTimeIface *t) { - t->init = 1; - t->abstime_ms = t_abstime_ms; - t->timer_set = t_timer_set; - return 0; -} |