1#![doc = document_features::document_features!()]
3#![cfg_attr(not(all(test, feature = "emulation")), no_std)]
4
5#[cfg_attr(not(feature = "emulation"), path = "hardware.rs")]
6#[cfg_attr(feature = "emulation", path = "stub.rs")]
7mod chip_specific;
8
9mod buffer;
10mod common;
11
12pub use common::{FlashStorage, FlashStorageError};
13
14pub mod ll;
15mod nor_flash;
16mod storage;
17
18#[cfg(not(feature = "emulation"))]
19#[inline(always)]
20#[cfg_attr(not(target_os = "macos"), unsafe(link_section = ".rwtext"))]
21fn maybe_with_critical_section<R>(f: impl FnOnce() -> R) -> R {
22 #[cfg(feature = "critical-section")]
23 return critical_section::with(|_| f());
24
25 #[cfg(not(feature = "critical-section"))]
26 f()
27}
28
29#[cfg(feature = "emulation")]
30fn maybe_with_critical_section<R>(f: impl FnOnce() -> R) -> R {
31 f()
32}