aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor
diff options
context:
space:
mode:
authorSijmen Woutersen <[email protected]>2022-09-25 20:10:11 +0200
committerSijmen Woutersen <[email protected]>2022-11-10 17:39:41 +0100
commit6e1120e17e384a04cd3aef58a1467a4a0a862ba5 (patch)
tree557458df0822437844cd767f38c47ef0ce423aa0 /embassy-executor
parent059610a8de49ff2d38311f343d3d1a6f8d90a720 (diff)
riscv support
Diffstat (limited to 'embassy-executor')
-rw-r--r--embassy-executor/Cargo.toml1
-rw-r--r--embassy-executor/src/arch/riscv32.rs15
2 files changed, 2 insertions, 14 deletions
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index d0f51646d..e6b4c596f 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -25,6 +25,7 @@ flavors = [
25default = [] 25default = []
26std = ["embassy-macros/std", "critical-section/std"] 26std = ["embassy-macros/std", "critical-section/std"]
27wasm = ["dep:wasm-bindgen", "dep:js-sys", "embassy-macros/wasm"] 27wasm = ["dep:wasm-bindgen", "dep:js-sys", "embassy-macros/wasm"]
28riscv = ["embassy-macros/riscv"]
28 29
29# Enable nightly-only features 30# Enable nightly-only features
30nightly = [] 31nightly = []
diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs
index 2a4b006da..e095c0ee0 100644
--- a/embassy-executor/src/arch/riscv32.rs
+++ b/embassy-executor/src/arch/riscv32.rs
@@ -54,20 +54,7 @@ impl Executor {
54 loop { 54 loop {
55 unsafe { 55 unsafe {
56 self.inner.poll(); 56 self.inner.poll();
57 // we do not care about race conditions between the load and store operations, interrupts 57 core::arch::asm!("wfi");
58 //will only set this value to true.
59 critical_section::with(|_| {
60 // if there is work to do, loop back to polling
61 // TODO can we relax this?
62 if SIGNAL_WORK_THREAD_MODE.load(Ordering::SeqCst) {
63 SIGNAL_WORK_THREAD_MODE.store(false, Ordering::SeqCst);
64 }
65 // if not, wait for interrupt
66 else {
67 core::arch::asm!("wfi");
68 }
69 });
70 // if an interrupt occurred while waiting, it will be serviced here
71 } 58 }
72 } 59 }
73 } 60 }