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)]
20fn maybe_with_critical_section<R>(f: impl FnOnce() -> R) -> R {
21 #[cfg(feature = "critical-section")]
22 {
23 static LOCK: esp_sync::RawMutex = esp_sync::RawMutex::new();
24
25 LOCK.lock(f)
26 }
27
28 #[cfg(not(feature = "critical-section"))]
29 f()
30}
31
32#[cfg(feature = "emulation")]
33fn maybe_with_critical_section<R>(f: impl FnOnce() -> R) -> R {
34 f()
35}