summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/fe310/eos/event.c')
-rw-r--r--fw/fe310/eos/event.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/fw/fe310/eos/event.c b/fw/fe310/eos/event.c
index 753cdb4..f76384a 100644
--- a/fw/fe310/eos/event.c
+++ b/fw/fe310/eos/event.c
@@ -121,22 +121,28 @@ void eos_evtq_flush_isr(void) {
}
void eos_evtq_loop(void) {
+ int foo = 1;
+
+ while(foo) {
+ eos_evtq_exec();
+ }
+}
+
+void eos_evtq_exec(void) {
unsigned char type;
unsigned char *buffer;
uint16_t len;
- int foo = 1;
- while(foo) {
- clear_csr(mstatus, MSTATUS_MIE);
- eos_msgq_pop(&_eos_event_q, &type, &buffer, &len);
- if (type) {
- set_csr(mstatus, MSTATUS_MIE);
- evt_handler[0](type, buffer, len);
- } else {
- asm volatile ("wfi");
- set_csr(mstatus, MSTATUS_MIE);
- }
+ clear_csr(mstatus, MSTATUS_MIE);
+ eos_msgq_pop(&_eos_event_q, &type, &buffer, &len);
+ if (type) {
+ set_csr(mstatus, MSTATUS_MIE);
+ evt_handler[0](type, buffer, len);
+ } else {
+ asm volatile ("wfi");
+ set_csr(mstatus, MSTATUS_MIE);
}
+
}
void eos_evtq_bad_handler(unsigned char type, unsigned char *buffer, uint16_t len) {