summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/event.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-05-13 12:26:19 +0200
committerUros Majstorovic <majstor@majstor.org>2022-05-13 12:26:19 +0200
commit9ccb4db8d59ec9dab33ee8617d462f21a8bb4fa8 (patch)
treea4f8ba9375a4ee82bae6ddc0cb3a35227f6f9469 /fw/fe310/eos/event.c
parent45f0d9b890b086493f9bb06428c46cd802324223 (diff)
touch controller/eve fixes
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) {