summaryrefslogtreecommitdiff
path: root/code/ecp/fe310/time.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2018-01-16 23:43:07 +0100
committerUros Majstorovic <majstor@majstor.org>2018-01-16 23:43:07 +0100
commit01c3e3af2394f863323b846fa304ff7e0a30e9df (patch)
tree84b499e6ece88e637ed86bbdd87333613e2433c5 /code/ecp/fe310/time.c
parent0d0e9facfcea3cf96da3b63285865182fdd5477e (diff)
eos support
Diffstat (limited to 'code/ecp/fe310/time.c')
-rw-r--r--code/ecp/fe310/time.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/code/ecp/fe310/time.c b/code/ecp/fe310/time.c
index 2ff98cb..4b8b2a7 100644
--- a/code/ecp/fe310/time.c
+++ b/code/ecp/fe310/time.c
@@ -1,5 +1,7 @@
#include <core.h>
+#include <eos/timer.h>
+
#include "encoding.h"
#include "platform.h"
@@ -10,9 +12,14 @@ static ecp_cts_t t_abstime_ms(ecp_cts_t msec) {
return now_ms + msec;
}
+static void t_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->sleep_ms = NULL;
+ t->timer_set = t_timer_set;
return 0;
}