diff options
Diffstat (limited to 'embassy-executor')
| -rw-r--r-- | embassy-executor/Cargo.toml | 1 | ||||
| -rw-r--r-- | embassy-executor/src/arch/riscv32.rs | 18 |
2 files changed, 6 insertions, 13 deletions
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml index 910d6fa37..45b0955bf 100644 --- a/embassy-executor/Cargo.toml +++ b/embassy-executor/Cargo.toml | |||
| @@ -31,6 +31,7 @@ flavors = [ | |||
| 31 | default = [] | 31 | default = [] |
| 32 | std = ["embassy-macros/std", "critical-section/std"] | 32 | std = ["embassy-macros/std", "critical-section/std"] |
| 33 | wasm = ["dep:wasm-bindgen", "dep:js-sys", "embassy-macros/wasm"] | 33 | wasm = ["dep:wasm-bindgen", "dep:js-sys", "embassy-macros/wasm"] |
| 34 | riscv = ["embassy-macros/riscv"] | ||
| 34 | 35 | ||
| 35 | # Enable nightly-only features | 36 | # Enable nightly-only features |
| 36 | nightly = [] | 37 | nightly = [] |
diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs index 2a4b006da..76eb8b114 100644 --- a/embassy-executor/src/arch/riscv32.rs +++ b/embassy-executor/src/arch/riscv32.rs | |||
| @@ -55,19 +55,11 @@ impl Executor { | |||
| 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 | // we do not care about race conditions between the load and store operations, interrupts |
| 58 | //will only set this value to true. | 58 | // will only set this value to true. |
| 59 | critical_section::with(|_| { | 59 | // if there is work to do, loop back to polling |
| 60 | // if there is work to do, loop back to polling | 60 | if !SIGNAL_WORK_THREAD_MODE.fetch_and(false, Ordering::SeqCst) { |
| 61 | // TODO can we relax this? | 61 | core::arch::asm!("wfi"); |
| 62 | if SIGNAL_WORK_THREAD_MODE.load(Ordering::SeqCst) { | 62 | } |
| 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 | } | 63 | } |
| 72 | } | 64 | } |
| 73 | } | 65 | } |
