aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 97fd97a..7c1599c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,6 +9,16 @@
//!
//! # Optional features
//!
+//! ## `critical-section-single-core`
+//!
+//! This feature enables a [`critical-section`](https://github.com/rust-embedded/critical-section)
+//! implementation suitable for single-core targets, based on disabling interrupts globally.
+//!
+//! It is **unsound** to enable it on multi-core targets or for code running in unprivileged mode,
+//! and may cause functional problems in systems where some interrupts must be not be disabled
+//! or critical sections are managed as part of an RTOS. In these cases, you should use
+//! a target-specific implementation instead, typically provided by a HAL or RTOS crate.
+//!
//! ## `cm7-r0p1`
//!
//! This feature enables workarounds for errata found on Cortex-M7 chips with revision r0p1. Some
@@ -49,10 +59,6 @@ mod macros;
pub mod asm;
#[cfg(armv8m)]
pub mod cmse;
-// This is only public so the `singleton` macro does not require depending on
-// the `critical-section` crate separately.
-#[doc(hidden)]
-pub mod critical_section;
pub mod delay;
pub mod interrupt;
#[cfg(all(not(armv6m), not(armv8m_base)))]
@@ -61,3 +67,13 @@ pub mod peripheral;
pub mod register;
pub use crate::peripheral::Peripherals;
+
+#[cfg(all(cortex_m, feature = "critical-section-single-core"))]
+mod critical_section;
+
+/// Used to reexport items for use in macros. Do not use directly.
+/// Not covered by semver guarantees.
+#[doc(hidden)]
+pub mod _export {
+ pub use critical_section;
+}