diff options
author | Uros Majstorovic <majstor@majstor.org> | 2018-03-16 14:15:39 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2018-03-16 14:15:39 +0100 |
commit | b1c3ee27894d33d9fcfca4ea4d0ccfb6d4cfc83e (patch) | |
tree | 16bfe6ba0da03cf94dec735076d2de1eac9fc761 /code/fe310/eos/timer.c | |
parent | 8755ad4c0b0652f16d3505ed72ed3d8310a35c6f (diff) |
fixed race conditions
Diffstat (limited to 'code/fe310/eos/timer.c')
-rw-r--r-- | code/fe310/eos/timer.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); |