From 802b7a1eca0b617cbe0ad571418d43f9e1f28f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Fri, 15 Nov 2024 22:55:08 +0100 Subject: [PATCH] Replace some esp-wifi critical sections with locks --- esp-hal/src/sync.rs | 9 +++ esp-wifi/src/compat/timer_compat.rs | 19 +++--- esp-wifi/src/lib.rs | 2 +- esp-wifi/src/preempt/mod.rs | 29 ++++---- esp-wifi/src/tasks.rs | 19 ++---- esp-wifi/src/timer/mod.rs | 6 +- esp-wifi/src/timer/riscv.rs | 18 ++--- esp-wifi/src/timer/xtensa.rs | 14 ++-- esp-wifi/src/wifi/mod.rs | 68 ++++++++----------- esp-wifi/src/wifi/os_adapter.rs | 12 ++-- esp-wifi/src/wifi/os_adapter_esp32.rs | 1 + examples/src/bin/wifi_embassy_access_point.rs | 2 +- 12 files changed, 92 insertions(+), 107 deletions(-) diff --git a/esp-hal/src/sync.rs b/esp-hal/src/sync.rs index 111bd6f8edd..2c73de9c7e7 100644 --- a/esp-hal/src/sync.rs +++ b/esp-hal/src/sync.rs @@ -280,6 +280,15 @@ impl Locked { pub fn with(&self, f: impl FnOnce(&mut T) -> R) -> R { lock(&self.lock_state, || f(unsafe { &mut *self.data.get() })) } + + /// Provide exclusive access to the protected data to the given closure. + pub fn with_cs( + &self, + _cs: critical_section::CriticalSection<'_>, + f: impl FnOnce(&T) -> R, + ) -> R { + f(unsafe { &*self.data.get() }) + } } unsafe impl Sync for Locked {} diff --git a/esp-wifi/src/compat/timer_compat.rs b/esp-wifi/src/compat/timer_compat.rs index 62204f12bea..42b9e94e4f4 100644 --- a/esp-wifi/src/compat/timer_compat.rs +++ b/esp-wifi/src/compat/timer_compat.rs @@ -1,7 +1,6 @@ use alloc::boxed::Box; -use core::cell::RefCell; -use critical_section::Mutex; +use esp_hal::sync::Locked; use crate::binary::{ c_types, @@ -138,7 +137,7 @@ impl TimerQueue { unsafe impl Send for TimerQueue {} -pub(crate) static TIMERS: Mutex> = Mutex::new(RefCell::new(TimerQueue::new())); +pub(crate) static TIMERS: Locked = Locked::new(TimerQueue::new()); pub(crate) fn compat_timer_arm(ets_timer: *mut ets_timer, tmout: u32, repeat: bool) { compat_timer_arm_us(ets_timer, tmout * 1000, repeat); @@ -156,8 +155,8 @@ pub(crate) fn compat_timer_arm_us(ets_timer: *mut ets_timer, us: u32, repeat: bo repeat ); - critical_section::with(|cs| { - if let Some(timer) = TIMERS.borrow_ref_mut(cs).find(ets_timer) { + TIMERS.with(|timers| { + if let Some(timer) = timers.find(ets_timer) { timer.started = systick; timer.timeout = ticks; timer.active = true; @@ -170,8 +169,8 @@ pub(crate) fn compat_timer_arm_us(ets_timer: *mut ets_timer, us: u32, repeat: bo pub fn compat_timer_disarm(ets_timer: *mut ets_timer) { trace!("timer disarm"); - critical_section::with(|cs| { - if let Some(timer) = TIMERS.borrow_ref_mut(cs).find(ets_timer) { + TIMERS.with(|timers| { + if let Some(timer) = timers.find(ets_timer) { trace!("timer_disarm {:x}", timer.id()); timer.active = false; } else { @@ -182,8 +181,7 @@ pub fn compat_timer_disarm(ets_timer: *mut ets_timer) { pub fn compat_timer_done(ets_timer: *mut ets_timer) { trace!("timer done"); - critical_section::with(|cs| { - let mut timers = TIMERS.borrow_ref_mut(cs); + TIMERS.with(|timers| { if let Some(timer) = timers.find(ets_timer) { trace!("timer_done {:x}", timer.id()); timer.active = false; @@ -211,8 +209,7 @@ pub(crate) fn compat_timer_setfn( pfunction, parg ); - let set = critical_section::with(|cs| unsafe { - let mut timers = TIMERS.borrow_ref_mut(cs); + let set = TIMERS.with(|timers| unsafe { if let Some(timer) = timers.find(ets_timer) { timer.callback = TimerCallback::new(pfunction, parg); timer.active = false; diff --git a/esp-wifi/src/lib.rs b/esp-wifi/src/lib.rs index fbad7bd34f7..432d5b5f3b1 100644 --- a/esp-wifi/src/lib.rs +++ b/esp-wifi/src/lib.rs @@ -438,7 +438,7 @@ pub unsafe fn deinit_unchecked() -> Result<(), InitializationError> { shutdown_timer_isr(); crate::preempt::delete_all_tasks(); - critical_section::with(|cs| crate::timer::TIMER.borrow_ref_mut(cs).take()); + crate::timer::TIMER.with(|timer| timer.take()); crate::flags::ESP_WIFI_INITIALIZED.store(false, Ordering::Release); diff --git a/esp-wifi/src/preempt/mod.rs b/esp-wifi/src/preempt/mod.rs index 18e2ffe7e68..1589fb99639 100644 --- a/esp-wifi/src/preempt/mod.rs +++ b/esp-wifi/src/preempt/mod.rs @@ -2,10 +2,10 @@ #[cfg_attr(target_arch = "xtensa", path = "preempt_xtensa.rs")] pub mod arch_specific; -use core::{cell::RefCell, mem::size_of}; +use core::mem::size_of; use arch_specific::*; -use critical_section::Mutex; +use esp_hal::sync::Locked; use esp_wifi_sys::include::malloc; use crate::{compat::malloc::free, hal::trapframe::TrapFrame, memory_fence::memory_fence}; @@ -15,14 +15,12 @@ struct ContextWrapper(*mut Context); unsafe impl Send for ContextWrapper {} -static CTX_NOW: Mutex> = - Mutex::new(RefCell::new(ContextWrapper(core::ptr::null_mut()))); +static CTX_NOW: Locked = Locked::new(ContextWrapper(core::ptr::null_mut())); static mut SCHEDULED_TASK_TO_DELETE: *mut Context = core::ptr::null_mut(); pub(crate) fn allocate_main_task() -> *mut Context { - critical_section::with(|cs| unsafe { - let mut ctx_now = CTX_NOW.borrow_ref_mut(cs); + CTX_NOW.with(|ctx_now| unsafe { if !ctx_now.0.is_null() { panic!("Tried to allocate main task multiple times"); } @@ -36,8 +34,7 @@ pub(crate) fn allocate_main_task() -> *mut Context { } fn allocate_task() -> *mut Context { - critical_section::with(|cs| unsafe { - let mut ctx_now = CTX_NOW.borrow_ref_mut(cs); + CTX_NOW.with(|ctx_now| unsafe { if ctx_now.0.is_null() { panic!("Called `allocate_task` before allocating main task"); } @@ -51,8 +48,7 @@ fn allocate_task() -> *mut Context { } fn next_task() { - critical_section::with(|cs| unsafe { - let mut ctx_now = CTX_NOW.borrow_ref_mut(cs); + CTX_NOW.with(|ctx_now| unsafe { ctx_now.0 = (*ctx_now.0).next; }); } @@ -61,8 +57,8 @@ fn next_task() { /// /// This will also free the memory (stack and context) allocated for it. pub(crate) fn delete_task(task: *mut Context) { - critical_section::with(|cs| unsafe { - let mut ptr = CTX_NOW.borrow_ref_mut(cs).0; + CTX_NOW.with(|ctx_now| unsafe { + let mut ptr = ctx_now.0; let initial = ptr; loop { if (*ptr).next == task { @@ -85,9 +81,8 @@ pub(crate) fn delete_task(task: *mut Context) { } pub(crate) fn delete_all_tasks() { - critical_section::with(|cs| unsafe { - let mut ctx_now_ref = CTX_NOW.borrow_ref_mut(cs); - let current_task = ctx_now_ref.0; + CTX_NOW.with(|ctx_now| unsafe { + let current_task = ctx_now.0; if current_task.is_null() { return; @@ -108,14 +103,14 @@ pub(crate) fn delete_all_tasks() { task_to_delete = next_task; } - ctx_now_ref.0 = core::ptr::null_mut(); + ctx_now.0 = core::ptr::null_mut(); memory_fence(); }); } pub(crate) fn current_task() -> *mut Context { - critical_section::with(|cs| CTX_NOW.borrow_ref(cs).0) + CTX_NOW.with(|ctx_now| ctx_now.0) } pub(crate) fn schedule_task_deletion(task: *mut Context) { diff --git a/esp-wifi/src/tasks.rs b/esp-wifi/src/tasks.rs index 7dae1e046b6..4e51e505d64 100644 --- a/esp-wifi/src/tasks.rs +++ b/esp-wifi/src/tasks.rs @@ -18,21 +18,16 @@ pub(crate) fn init_tasks() { pub(crate) extern "C" fn timer_task(_param: *mut esp_wifi_sys::c_types::c_void) { loop { let current_timestamp = systimer_count(); - let to_run = critical_section::with(|cs| unsafe { - let mut timers = TIMERS.borrow_ref_mut(cs); - let to_run = timers.find_next_due(current_timestamp); + let to_run = TIMERS.with(|timers| { + let to_run = unsafe { timers.find_next_due(current_timestamp) }?; - if let Some(to_run) = to_run { - to_run.active = to_run.periodic; + to_run.active = to_run.periodic; - if to_run.periodic { - to_run.started = current_timestamp; - } - - Some(to_run.callback) - } else { - None + if to_run.periodic { + to_run.started = current_timestamp; } + + Some(to_run.callback) }); // run the due timer callback NOT in an interrupt free context diff --git a/esp-wifi/src/timer/mod.rs b/esp-wifi/src/timer/mod.rs index 0cd4d541ef2..56fd1dd9539 100644 --- a/esp-wifi/src/timer/mod.rs +++ b/esp-wifi/src/timer/mod.rs @@ -1,6 +1,4 @@ -use core::cell::RefCell; - -use critical_section::Mutex; +use esp_hal::sync::Locked; #[cfg_attr(esp32, path = "timer_esp32.rs")] #[cfg_attr(esp32c2, path = "timer_esp32c2.rs")] @@ -20,7 +18,7 @@ pub(crate) use chip_specific::*; use crate::TimeBase; -pub(crate) static TIMER: Mutex>> = Mutex::new(RefCell::new(None)); +pub(crate) static TIMER: Locked> = Locked::new(None); pub(crate) fn setup_timer_isr(timebase: TimeBase) { setup_radio_isr(); diff --git a/esp-wifi/src/timer/riscv.rs b/esp-wifi/src/timer/riscv.rs index b0a4bb2635f..a73e3b18e65 100644 --- a/esp-wifi/src/timer/riscv.rs +++ b/esp-wifi/src/timer/riscv.rs @@ -30,16 +30,17 @@ pub(crate) fn setup_timer(mut alarm0: TimeBase) { let cb: extern "C" fn() = unsafe { core::mem::transmute(handler as *const ()) }; alarm0.set_interrupt_handler(InterruptHandler::new(cb, interrupt::Priority::Priority1)); unwrap!(alarm0.start(TIMESLICE_FREQUENCY.into_duration())); - critical_section::with(|cs| { + TIMER.with(|timer| { alarm0.enable_interrupt(true); - TIMER.borrow_ref_mut(cs).replace(alarm0); + timer.replace(alarm0); }); } pub(crate) fn disable_timer() { - critical_section::with(|cs| { - unwrap!(TIMER.borrow_ref_mut(cs).as_mut()).enable_interrupt(false); - unwrap!(unwrap!(TIMER.borrow_ref_mut(cs).as_mut()).cancel()); + TIMER.with(|timer| { + let timer = unwrap!(timer.as_mut()); + timer.enable_interrupt(false); + unwrap!(timer.cancel()); }); } @@ -60,8 +61,8 @@ pub(crate) fn disable_multitasking() { extern "C" fn handler(trap_frame: &mut TrapFrame) { // clear the systimer intr - critical_section::with(|cs| { - unwrap!(TIMER.borrow_ref_mut(cs).as_mut()).clear_interrupt(); + TIMER.with(|timer| { + unwrap!(timer.as_mut()).clear_interrupt(); }); task_switch(trap_frame); @@ -76,8 +77,7 @@ extern "C" fn FROM_CPU_INTR3(trap_frame: &mut TrapFrame) { .modify(|_, w| w.cpu_intr_from_cpu_3().clear_bit()); } - critical_section::with(|cs| { - let mut alarm0 = TIMER.borrow_ref_mut(cs); + TIMER.with(|alarm0| { let alarm0 = unwrap!(alarm0.as_mut()); alarm0.clear_interrupt(); }); diff --git a/esp-wifi/src/timer/xtensa.rs b/esp-wifi/src/timer/xtensa.rs index 3cff547ac06..fc477141147 100644 --- a/esp-wifi/src/timer/xtensa.rs +++ b/esp-wifi/src/timer/xtensa.rs @@ -27,16 +27,17 @@ pub(crate) fn setup_timer(mut timer1: TimeBase) { interrupt::Priority::Priority2, )); unwrap!(timer1.start(TIMESLICE_FREQUENCY.into_duration())); - critical_section::with(|cs| { + TIMER.with(|timer| { timer1.enable_interrupt(true); - TIMER.borrow_ref_mut(cs).replace(timer1); + timer.replace(timer1); }); } pub(crate) fn disable_timer() { - critical_section::with(|cs| { - unwrap!(TIMER.borrow_ref_mut(cs).as_mut()).enable_interrupt(false); - unwrap!(unwrap!(TIMER.borrow_ref_mut(cs).as_mut()).cancel()); + TIMER.with(|timer| { + let timer = unwrap!(timer.as_mut()); + timer.enable_interrupt(false); + unwrap!(timer.cancel()); }); } @@ -58,8 +59,7 @@ pub(crate) fn disable_multitasking() { } fn do_task_switch(context: &mut TrapFrame) { - critical_section::with(|cs| { - let mut timer = TIMER.borrow_ref_mut(cs); + TIMER.with(|timer| { let timer = unwrap!(timer.as_mut()); timer.clear_interrupt(); }); diff --git a/esp-wifi/src/wifi/mod.rs b/esp-wifi/src/wifi/mod.rs index dbab7ada004..b01ed76334b 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -6,15 +6,14 @@ pub(crate) mod state; use alloc::collections::vec_deque::VecDeque; use core::{ - cell::{RefCell, RefMut}, fmt::Debug, mem::{self, MaybeUninit}, ptr::addr_of, time::Duration, }; -use critical_section::{CriticalSection, Mutex}; use enumset::{EnumSet, EnumSetType}; +use esp_hal::sync::Locked; use esp_wifi_sys::include::{ esp_eap_client_clear_ca_cert, esp_eap_client_clear_certificate_and_key, @@ -952,11 +951,11 @@ const DATA_FRAME_SIZE: usize = MTU + ETHERNET_FRAME_HEADER_SIZE; const RX_QUEUE_SIZE: usize = crate::CONFIG.rx_queue_size; const TX_QUEUE_SIZE: usize = crate::CONFIG.tx_queue_size; -pub(crate) static DATA_QUEUE_RX_AP: Mutex>> = - Mutex::new(RefCell::new(VecDeque::new())); +pub(crate) static DATA_QUEUE_RX_AP: Locked> = + Locked::new(VecDeque::new()); -pub(crate) static DATA_QUEUE_RX_STA: Mutex>> = - Mutex::new(RefCell::new(VecDeque::new())); +pub(crate) static DATA_QUEUE_RX_STA: Locked> = + Locked::new(VecDeque::new()); /// Common errors. #[derive(Debug, Clone, Copy)] @@ -1529,14 +1528,13 @@ unsafe extern "C" fn recv_cb_sta( eb: *mut c_types::c_void, ) -> esp_err_t { let packet = EspWifiPacketBuffer { buffer, len, eb }; - // We must handle the result outside of the critical section because + // We must handle the result outside of the lock because // EspWifiPacketBuffer::drop must not be called in a critical section. // Dropping an EspWifiPacketBuffer will call `esp_wifi_internal_free_rx_buffer` // which will try to lock an internal mutex. If the mutex is already taken, // the function will try to trigger a context switch, which will fail if we - // are in a critical section. - if critical_section::with(|cs| { - let mut queue = DATA_QUEUE_RX_STA.borrow_ref_mut(cs); + // are in an interrupt-free context. + if DATA_QUEUE_RX_STA.with(|queue| { if queue.len() < RX_QUEUE_SIZE { queue.push_back(packet); true @@ -1563,9 +1561,8 @@ unsafe extern "C" fn recv_cb_ap( // Dropping an EspWifiPacketBuffer will call `esp_wifi_internal_free_rx_buffer` // which will try to lock an internal mutex. If the mutex is already taken, // the function will try to trigger a context switch, which will fail if we - // are in a critical section. - if critical_section::with(|cs| { - let mut queue = DATA_QUEUE_RX_AP.borrow_ref_mut(cs); + // are in an interrupt-free context. + if DATA_QUEUE_RX_AP.with(|queue| { if queue.len() < RX_QUEUE_SIZE { queue.push_back(packet); true @@ -1905,7 +1902,7 @@ mod sealed { fn wrap_config(config: Self::Config) -> Configuration; - fn data_queue_rx(self, cs: CriticalSection) -> RefMut<'_, VecDeque>; + fn data_queue_rx(self) -> &'static Locked>; fn can_send(self) -> bool { WIFI_TX_INFLIGHT.load(Ordering::SeqCst) < TX_QUEUE_SIZE @@ -1928,13 +1925,12 @@ mod sealed { } fn rx_token(self) -> Option<(WifiRxToken, WifiTxToken)> { - let is_empty = critical_section::with(|cs| self.data_queue_rx(cs).is_empty()); + let is_empty = self.data_queue_rx().with(|q| q.is_empty()); if is_empty || !self.can_send() { crate::timer::yield_task(); } - let is_empty = - is_empty && critical_section::with(|cs| self.data_queue_rx(cs).is_empty()); + let is_empty = is_empty && self.data_queue_rx().with(|q| q.is_empty()); if !is_empty { self.tx_token().map(|tx| (WifiRxToken { mode: self }, tx)) @@ -1967,8 +1963,8 @@ mod sealed { Configuration::Client(config) } - fn data_queue_rx(self, cs: CriticalSection) -> RefMut<'_, VecDeque> { - DATA_QUEUE_RX_STA.borrow_ref_mut(cs) + fn data_queue_rx(self) -> &'static Locked> { + &DATA_QUEUE_RX_STA } fn interface(self) -> wifi_interface_t { @@ -2003,8 +1999,8 @@ mod sealed { Configuration::AccessPoint(config) } - fn data_queue_rx(self, cs: CriticalSection) -> RefMut<'_, VecDeque> { - DATA_QUEUE_RX_AP.borrow_ref_mut(cs) + fn data_queue_rx(self) -> &'static Locked> { + &DATA_QUEUE_RX_AP } fn interface(self) -> wifi_interface_t { @@ -2329,18 +2325,14 @@ impl PromiscuousPkt<'_> { } #[cfg(feature = "sniffer")] -#[allow(clippy::type_complexity)] -static SNIFFER_CB: Mutex>> = Mutex::new(RefCell::new(None)); +static SNIFFER_CB: Locked> = Locked::new(None); #[cfg(feature = "sniffer")] unsafe extern "C" fn promiscuous_rx_cb(buf: *mut core::ffi::c_void, frame_type: u32) { - critical_section::with(|cs| { - let Some(sniffer_callback) = *SNIFFER_CB.borrow_ref(cs) else { - return; - }; + if let Some(sniffer_callback) = SNIFFER_CB.with(|callback| *callback) { let promiscuous_pkt = PromiscuousPkt::from_raw(buf as *const _, frame_type); sniffer_callback(promiscuous_pkt); - }); + } } #[cfg(feature = "sniffer")] @@ -2385,9 +2377,7 @@ impl Sniffer { } /// Set the callback for receiving a packet. pub fn set_receive_cb(&mut self, cb: fn(PromiscuousPkt)) { - critical_section::with(|cs| { - *SNIFFER_CB.borrow_ref_mut(cs) = Some(cb); - }); + SNIFFER_CB.with(|callback| *callback = Some(cb)); } } @@ -2675,21 +2665,19 @@ impl WifiRxToken { where F: FnOnce(&mut [u8]) -> R, { - let mut data = critical_section::with(|cs| { - let mut queue = self.mode.data_queue_rx(cs); - + let mut data = self.mode.data_queue_rx().with(|queue| { unwrap!( queue.pop_front(), "unreachable: transmit()/receive() ensures there is a packet to process" ) }); - // We handle the received data outside of the critical section because + // We handle the received data outside of the lock because // EspWifiPacketBuffer::drop must not be called in a critical section. // Dropping an EspWifiPacketBuffer will call `esp_wifi_internal_free_rx_buffer` // which will try to lock an internal mutex. If the mutex is already // taken, the function will try to trigger a context switch, which will - // fail if we are in a critical section. + // fail if we are in an interrupt-free context. let buffer = data.as_slice_mut(); dump_packet_info(buffer); @@ -3321,7 +3309,7 @@ mod asynch { } fn clear_events(events: impl Into>) { - critical_section::with(|cs| WIFI_EVENTS.borrow_ref_mut(cs).remove_all(events.into())); + WIFI_EVENTS.with(|evts| evts.get_mut().remove_all(events.into())); } /// Wait for one [`WifiEvent`]. @@ -3390,7 +3378,7 @@ mod asynch { cx: &mut core::task::Context<'_>, ) -> Poll { self.event.waker().register(cx.waker()); - if critical_section::with(|cs| WIFI_EVENTS.borrow_ref_mut(cs).remove(self.event)) { + if WIFI_EVENTS.with(|events| events.get_mut().remove(self.event)) { Poll::Ready(()) } else { Poll::Pending @@ -3417,8 +3405,8 @@ mod asynch { self: core::pin::Pin<&mut Self>, cx: &mut core::task::Context<'_>, ) -> Poll { - let output = critical_section::with(|cs| { - let mut events = WIFI_EVENTS.borrow_ref_mut(cs); + let output = WIFI_EVENTS.with(|events| { + let events = events.get_mut(); let active = events.intersection(self.event); events.remove_all(active); active diff --git a/esp-wifi/src/wifi/os_adapter.rs b/esp-wifi/src/wifi/os_adapter.rs index 1fe92992fda..2a048def4ce 100644 --- a/esp-wifi/src/wifi/os_adapter.rs +++ b/esp-wifi/src/wifi/os_adapter.rs @@ -9,8 +9,8 @@ pub(crate) mod os_adapter_chip_specific; use core::{cell::RefCell, ptr::addr_of_mut}; -use critical_section::Mutex; use enumset::EnumSet; +use esp_hal::sync::Locked; use super::WifiEvent; use crate::{ @@ -39,8 +39,8 @@ static mut QUEUE_HANDLE: *mut ConcurrentQueue = core::ptr::null_mut(); // useful for waiting for events - clear and wait for the event bit to be set // again -pub(crate) static WIFI_EVENTS: Mutex>> = - Mutex::new(RefCell::new(enumset::enum_set!())); +pub(crate) static WIFI_EVENTS: Locked>> = + Locked::new(RefCell::new(enumset::enum_set!())); /// ************************************************************************** /// Name: wifi_env_is_chip @@ -869,8 +869,10 @@ pub unsafe extern "C" fn event_post( let mut handled = false; critical_section::with(|cs| { - WIFI_EVENTS.borrow_ref_mut(cs).insert(event); - handled = super::event::dispatch_event_handler(cs, event, event_data, event_data_size); + WIFI_EVENTS.with_cs(cs, |events| { + events.borrow_mut().insert(event); + handled = super::event::dispatch_event_handler(cs, event, event_data, event_data_size); + }); }); super::state::update_state(event, handled); diff --git a/esp-wifi/src/wifi/os_adapter_esp32.rs b/esp-wifi/src/wifi/os_adapter_esp32.rs index f91e0b515a8..605b5421e13 100644 --- a/esp-wifi/src/wifi/os_adapter_esp32.rs +++ b/esp-wifi/src/wifi/os_adapter_esp32.rs @@ -17,6 +17,7 @@ pub(crate) fn chip_ints_off(mask: u32) { pub(crate) unsafe extern "C" fn wifi_int_disable( wifi_int_mux: *mut crate::binary::c_types::c_void, ) -> u32 { + // FIXME: would it be enough to disable a single core's interrupts? core::mem::transmute(critical_section::acquire()) } diff --git a/examples/src/bin/wifi_embassy_access_point.rs b/examples/src/bin/wifi_embassy_access_point.rs index 6296dbc598b..3c57dbcb260 100644 --- a/examples/src/bin/wifi_embassy_access_point.rs +++ b/examples/src/bin/wifi_embassy_access_point.rs @@ -9,7 +9,7 @@ //! Because of the huge task-arena size configured this won't work on ESP32-S2 //! -//% FEATURES: embassy embassy-generic-timers esp-wifi esp-wifi/wifi esp-wifi/utils +//% FEATURES: embassy embassy-generic-timers esp-wifi esp-wifi/wifi esp-wifi/utils esp-wifi/sniffer //% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6 #![no_std]