diff options
author | 2022-08-22 00:20:17 +0200 | |
---|---|---|
committer | 2022-08-22 20:23:39 +0200 | |
commit | 25f1f9577014421d31b729881d6048854ad50071 (patch) | |
tree | 5b5571269a8d34708f33e54f69c66a88ae3e85b6 /src/critical_section.rs | |
parent | e0eeec4c5ea50a4d85df8754cd29673930a8065d (diff) | |
download | cortex-m-25f1f9577014421d31b729881d6048854ad50071.tar.gz cortex-m-25f1f9577014421d31b729881d6048854ad50071.tar.zst cortex-m-25f1f9577014421d31b729881d6048854ad50071.zip |
Use a `mod _export` for macro reexports.
This avoids having to do `#[doc(hidden)] pub mod critical_section` which is a bit strange.
Diffstat (limited to 'src/critical_section.rs')
-rw-r--r-- | src/critical_section.rs | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/critical_section.rs b/src/critical_section.rs index 688058d..e3d57d1 100644 --- a/src/critical_section.rs +++ b/src/critical_section.rs @@ -1,27 +1,22 @@ -#[cfg(all(cortex_m, feature = "critical-section-single-core"))] -mod single_core_critical_section { - use critical_section::{set_impl, Impl, RawRestoreState}; +use critical_section::{set_impl, Impl, RawRestoreState}; - use crate::interrupt; - use crate::register::primask; +use crate::interrupt; +use crate::register::primask; - struct SingleCoreCriticalSection; - set_impl!(SingleCoreCriticalSection); +struct SingleCoreCriticalSection; +set_impl!(SingleCoreCriticalSection); - unsafe impl Impl for SingleCoreCriticalSection { - unsafe fn acquire() -> RawRestoreState { - let was_active = primask::read().is_active(); - interrupt::disable(); - was_active - } +unsafe impl Impl for SingleCoreCriticalSection { + unsafe fn acquire() -> RawRestoreState { + let was_active = primask::read().is_active(); + interrupt::disable(); + was_active + } - unsafe fn release(was_active: RawRestoreState) { - // Only re-enable interrupts if they were enabled before the critical section. - if was_active { - interrupt::enable() - } + unsafe fn release(was_active: RawRestoreState) { + // Only re-enable interrupts if they were enabled before the critical section. + if was_active { + interrupt::enable() } } } - -pub use critical_section::with; |