aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/lib.rs
diff options
context:
space:
mode:
authorQuentin Smith <[email protected]>2023-07-17 21:31:43 -0400
committerQuentin Smith <[email protected]>2023-07-17 21:31:43 -0400
commit6f02403184eb7fb7990fb88fc9df9c4328a690a3 (patch)
tree748f510e190bb2724750507a6e69ed1a8e08cb20 /embassy-executor/src/lib.rs
parentd896f80405aa8963877049ed999e4aba25d6e2bb (diff)
parent6b5df4523aa1c4902f02e803450ae4b418e0e3ca (diff)
Merge remote-tracking branch 'origin/main' into nrf-pdm
Diffstat (limited to 'embassy-executor/src/lib.rs')
-rw-r--r--embassy-executor/src/lib.rs77
1 files changed, 35 insertions, 42 deletions
diff --git a/embassy-executor/src/lib.rs b/embassy-executor/src/lib.rs
index e4cbd04b9..3ce687eb6 100644
--- a/embassy-executor/src/lib.rs
+++ b/embassy-executor/src/lib.rs
@@ -1,5 +1,5 @@
1#![cfg_attr(not(any(feature = "std", feature = "wasm")), no_std)] 1#![cfg_attr(not(any(feature = "arch-std", feature = "arch-wasm")), no_std)]
2#![cfg_attr(all(feature = "nightly", target_arch = "xtensa"), feature(asm_experimental_arch))] 2#![cfg_attr(all(feature = "nightly", feature = "arch-xtensa"), feature(asm_experimental_arch))]
3#![allow(clippy::new_without_default)] 3#![allow(clippy::new_without_default)]
4#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
5#![warn(missing_docs)] 5#![warn(missing_docs)]
@@ -8,41 +8,45 @@
8pub(crate) mod fmt; 8pub(crate) mod fmt;
9 9
10#[cfg(feature = "nightly")] 10#[cfg(feature = "nightly")]
11pub use embassy_macros::{main, task}; 11pub use embassy_macros::task;
12 12
13cfg_if::cfg_if! { 13macro_rules! check_at_most_one {
14 if #[cfg(cortex_m)] { 14 (@amo [$($feats:literal)*] [] [$($res:tt)*]) => {
15 #[path="arch/cortex_m.rs"] 15 #[cfg(any($($res)*))]
16 mod arch; 16 compile_error!(concat!("At most one of these features can be enabled at the same time:", $(" `", $feats, "`",)*));
17 pub use arch::*; 17 };
18 } 18 (@amo $feats:tt [$curr:literal $($rest:literal)*] [$($res:tt)*]) => {
19 else if #[cfg(target_arch="riscv32")] { 19 check_at_most_one!(@amo $feats [$($rest)*] [$($res)* $(all(feature=$curr, feature=$rest),)*]);
20 #[path="arch/riscv32.rs"] 20 };
21 mod arch; 21 ($($f:literal),*$(,)?) => {
22 pub use arch::*; 22 check_at_most_one!(@amo [$($f)*] [$($f)*] []);
23 } 23 };
24 else if #[cfg(all(target_arch="xtensa", feature = "nightly"))] {
25 #[path="arch/xtensa.rs"]
26 mod arch;
27 pub use arch::*;
28 }
29 else if #[cfg(feature="wasm")] {
30 #[path="arch/wasm.rs"]
31 mod arch;
32 pub use arch::*;
33 }
34 else if #[cfg(feature="std")] {
35 #[path="arch/std.rs"]
36 mod arch;
37 pub use arch::*;
38 }
39} 24}
25check_at_most_one!("arch-cortex-m", "arch-riscv32", "arch-xtensa", "arch-std", "arch-wasm",);
26
27#[cfg(feature = "_arch")]
28#[cfg_attr(feature = "arch-cortex-m", path = "arch/cortex_m.rs")]
29#[cfg_attr(feature = "arch-riscv32", path = "arch/riscv32.rs")]
30#[cfg_attr(feature = "arch-xtensa", path = "arch/xtensa.rs")]
31#[cfg_attr(feature = "arch-std", path = "arch/std.rs")]
32#[cfg_attr(feature = "arch-wasm", path = "arch/wasm.rs")]
33mod arch;
34
35#[cfg(feature = "_arch")]
36pub use arch::*;
40 37
38pub mod raw;
39
40mod spawner;
41pub use spawner::*;
42
43/// Implementation details for embassy macros.
44/// Do not use. Used for macros and HALs only. Not covered by semver guarantees.
41#[doc(hidden)] 45#[doc(hidden)]
42/// Implementation details for embassy macros. DO NOT USE. 46pub mod _export {
43pub mod export {
44 #[cfg(feature = "rtos-trace")] 47 #[cfg(feature = "rtos-trace")]
45 pub use rtos_trace::trace; 48 pub use rtos_trace::trace;
49 pub use static_cell::StaticCell;
46 50
47 /// Expands the given block of code when `embassy-executor` is compiled with 51 /// Expands the given block of code when `embassy-executor` is compiled with
48 /// the `rtos-trace-interrupt` feature. 52 /// the `rtos-trace-interrupt` feature.
@@ -62,14 +66,3 @@ pub mod export {
62 ($($tt:tt)*) => {}; 66 ($($tt:tt)*) => {};
63 } 67 }
64} 68}
65
66pub mod raw;
67
68mod spawner;
69pub use spawner::*;
70
71/// Do not use. Used for macros and HALs only. Not covered by semver guarantees.
72#[doc(hidden)]
73pub mod _export {
74 pub use static_cell::StaticCell;
75}