From b1c3ee27894d33d9fcfca4ea4d0ccfb6d4cfc83e Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Fri, 16 Mar 2018 14:15:39 +0100 Subject: fixed race conditions --- code/fe310/eos/timer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'code/fe310/eos/timer.c') diff --git a/code/fe310/eos/timer.c b/code/fe310/eos/timer.c index 915be6f..5e1b381 100644 --- a/code/fe310/eos/timer.c +++ b/code/fe310/eos/timer.c @@ -4,6 +4,7 @@ #include "encoding.h" #include "platform.h" +#include "msgq.h" #include "event.h" #include "timer.h" @@ -14,6 +15,8 @@ static eos_timer_fptr_t timer_ext_handler = NULL; volatile uint64_t timer_next = 0; volatile uint64_t timer_next_evt = 0; +extern EOSMsgQ _eos_event_q; + void eos_timer_handle(void) { volatile uint64_t *mtime = (uint64_t *) (CLINT_CTRL_ADDR + CLINT_MTIME); volatile uint64_t *mtimecmp = (uint64_t *) (CLINT_CTRL_ADDR + CLINT_MTIMECMP); @@ -28,7 +31,7 @@ void eos_timer_handle(void) { } } if (timer_next_evt && (timer_next_evt <= now)) { - eos_evtq_push(EOS_EVT_TIMER, NULL, 0); + eos_msgq_push(&_eos_event_q, EOS_EVT_TIMER, NULL, 0); timer_next_evt = 0; } *mtimecmp = (timer_next && timer_next_evt) ? MIN(timer_next, timer_next_evt) : (timer_next ? timer_next : timer_next_evt); -- cgit v1.2.3