aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/lib.rs
diff options
context:
space:
mode:
authorDummyc0m <[email protected]>2024-10-06 23:23:33 -0700
committerDummyc0m <[email protected]>2024-10-06 23:33:34 -0700
commit9e6e09a8d747ec90aae215df8471dfe349993487 (patch)
tree0cd116be26fea69f9b770b3f36c87fc1273ae20b /embassy-executor/src/lib.rs
parent8f273497453d3ca3f297465b67820d4d36705d11 (diff)
executor/spin: introduce an architecture agnostic executor
Spin polls the raw executor and never sleeps. It is useful for disabling any power features associated with wfi/wfe-like instructions. When implementing support for the CH32V30x MCU, the wfi instruction had issues interacting with the USB OTG peripheral and appeared to be non-spec-compliant. 1. When sending a USB Data-in packet, the USB peripheral appears to be unable to read the system main memory while in WFI. This manifests in the USB peripheral sending all or partially zeroed DATA packets. Disabling WFI works around this issue. 2. The WFI instruction does not wake up the processor when MIE is disabled. The MCU provides a WFITOWFE bit to emulate the WFE instruction on arm, which, when enabled, ignores the MIE and allows the processor to wake up. This works around the non-compliant WFI implementation. Co-authored-by: Codetector <[email protected]> Co-authored-by: Dummyc0m <[email protected]>
Diffstat (limited to 'embassy-executor/src/lib.rs')
-rw-r--r--embassy-executor/src/lib.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/embassy-executor/src/lib.rs b/embassy-executor/src/lib.rs
index 6a2e493a2..d816539ac 100644
--- a/embassy-executor/src/lib.rs
+++ b/embassy-executor/src/lib.rs
@@ -23,7 +23,14 @@ macro_rules! check_at_most_one {
23 check_at_most_one!(@amo [$($f)*] [$($f)*] []); 23 check_at_most_one!(@amo [$($f)*] [$($f)*] []);
24 }; 24 };
25} 25}
26check_at_most_one!("arch-avr", "arch-cortex-m", "arch-riscv32", "arch-std", "arch-wasm",); 26check_at_most_one!(
27 "arch-avr",
28 "arch-cortex-m",
29 "arch-riscv32",
30 "arch-std",
31 "arch-wasm",
32 "arch-spin",
33);
27 34
28#[cfg(feature = "_arch")] 35#[cfg(feature = "_arch")]
29#[cfg_attr(feature = "arch-avr", path = "arch/avr.rs")] 36#[cfg_attr(feature = "arch-avr", path = "arch/avr.rs")]
@@ -31,6 +38,7 @@ check_at_most_one!("arch-avr", "arch-cortex-m", "arch-riscv32", "arch-std", "arc
31#[cfg_attr(feature = "arch-riscv32", path = "arch/riscv32.rs")] 38#[cfg_attr(feature = "arch-riscv32", path = "arch/riscv32.rs")]
32#[cfg_attr(feature = "arch-std", path = "arch/std.rs")] 39#[cfg_attr(feature = "arch-std", path = "arch/std.rs")]
33#[cfg_attr(feature = "arch-wasm", path = "arch/wasm.rs")] 40#[cfg_attr(feature = "arch-wasm", path = "arch/wasm.rs")]
41#[cfg_attr(feature = "arch-spin", path = "arch/spin.rs")]
34mod arch; 42mod arch;
35 43
36#[cfg(feature = "_arch")] 44#[cfg(feature = "_arch")]