summaryrefslogtreecommitdiff
path: root/code/ecp
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2019-11-25 17:04:48 +0100
committerUros Majstorovic <majstor@majstor.org>2019-11-25 17:04:48 +0100
commit8165deb1f96cf2c7643becbd7874d20293e80613 (patch)
tree1a22ea2e6b1cd208a01961845729fd3e726a828f /code/ecp
parent9484f95fed5f534faf492370a672f5deff67f40f (diff)
eos timer_set gets msec
Diffstat (limited to 'code/ecp')
-rw-r--r--code/ecp/fe310/time.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/code/ecp/fe310/time.c b/code/ecp/fe310/time.c
index 1346fea..dee4285 100644
--- a/code/ecp/fe310/time.c
+++ b/code/ecp/fe310/time.c
@@ -13,9 +13,7 @@ extern ECPSocket *_ecp_tr_sock;
static void timer_handler(unsigned char type) {
ecp_cts_t next = ecp_timer_exe(_ecp_tr_sock);
if (next) {
- 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);
+ eos_timer_set(next, EOS_TIMER_ETYPE_ECP, 0);
}
}
@@ -32,14 +30,9 @@ ecp_cts_t ecp_tm_abstime_ms(ecp_cts_t msec) {
}
void ecp_tm_sleep_ms(ecp_cts_t msec) {
- volatile uint64_t *mtime = (uint64_t *) (CLINT_CTRL_ADDR + CLINT_MTIME);
-
- uint64_t now_ms = *mtime * 1000 / RTC_FREQ;
- while (*mtime * 1000 / RTC_FREQ < now_ms + msec);
+ eos_timer_sleep(msec);
}
void ecp_tm_timer_set(ecp_cts_t next) {
- 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);
+ eos_timer_set(next, EOS_TIMER_ETYPE_ECP, 1);
}