summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/net.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-02-24 19:50:20 +0100
committerUros Majstorovic <majstor@majstor.org>2021-02-24 19:50:20 +0100
commit3050565531af2b3a09f2213893f10c64cf9fe43f (patch)
tree689d10ca064dba4480a85b6ec14a4eb8305d5c89 /fw/fe310/eos/net.c
parentd0a0fee0571be63f023f8f6a49a0b76b89871e56 (diff)
added test app with voice, wifi/cellular data connectivity examples
Diffstat (limited to 'fw/fe310/eos/net.c')
-rw-r--r--fw/fe310/eos/net.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fw/fe310/eos/net.c b/fw/fe310/eos/net.c
index 297e8f0..46700e8 100644
--- a/fw/fe310/eos/net.c
+++ b/fw/fe310/eos/net.c
@@ -456,10 +456,16 @@ void eos_net_release(void) {
unsigned char *eos_net_alloc(void) {
unsigned char *ret = NULL;
- clear_csr(mstatus, MSTATUS_MIE);
- ret = net_state_next_buf;
- net_state_next_buf = NULL;
- set_csr(mstatus, MSTATUS_MIE);
+ while (!ret) {
+ clear_csr(mstatus, MSTATUS_MIE);
+ if (net_state_next_buf) {
+ ret = net_state_next_buf;
+ net_state_next_buf = NULL;
+ } else {
+ asm volatile ("wfi");
+ }
+ set_csr(mstatus, MSTATUS_MIE);
+ }
return ret;
}