diff options
Diffstat (limited to 'embassy-executor/src/lib.rs')
| -rw-r--r-- | embassy-executor/src/lib.rs | 77 |
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 @@ | |||
| 8 | pub(crate) mod fmt; | 8 | pub(crate) mod fmt; |
| 9 | 9 | ||
| 10 | #[cfg(feature = "nightly")] | 10 | #[cfg(feature = "nightly")] |
| 11 | pub use embassy_macros::{main, task}; | 11 | pub use embassy_macros::task; |
| 12 | 12 | ||
| 13 | cfg_if::cfg_if! { | 13 | macro_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 | } |
| 25 | check_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")] | ||
| 33 | mod arch; | ||
| 34 | |||
| 35 | #[cfg(feature = "_arch")] | ||
| 36 | pub use arch::*; | ||
| 40 | 37 | ||
| 38 | pub mod raw; | ||
| 39 | |||
| 40 | mod spawner; | ||
| 41 | pub 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. | 46 | pub mod _export { |
| 43 | pub 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 | |||
| 66 | pub mod raw; | ||
| 67 | |||
| 68 | mod spawner; | ||
| 69 | pub use spawner::*; | ||
| 70 | |||
| 71 | /// Do not use. Used for macros and HALs only. Not covered by semver guarantees. | ||
| 72 | #[doc(hidden)] | ||
| 73 | pub mod _export { | ||
| 74 | pub use static_cell::StaticCell; | ||
| 75 | } | ||
