From 884a4c958989e4d76ef258fe318d52d61c137867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Thu, 30 Nov 2023 23:06:42 +0100 Subject: [PATCH] Update esp-hal, always use portable-atomic --- Cargo.toml | 24 +++++++-------- esp-wifi/.cargo/config.toml | 30 ++++--------------- esp-wifi/Cargo.toml | 13 ++++---- .../common_adapter/common_adapter_esp32.rs | 17 ++++------- .../common_adapter/common_adapter_esp32c2.rs | 13 +++----- .../common_adapter/common_adapter_esp32c3.rs | 16 ++++------ .../common_adapter/common_adapter_esp32c6.rs | 8 +---- .../common_adapter/common_adapter_esp32s2.rs | 16 ++++------ .../common_adapter/common_adapter_esp32s3.rs | 16 ++++------ esp-wifi/src/esp_now/mod.rs | 8 +---- esp-wifi/src/timer/riscv.rs | 4 +-- esp-wifi/src/timer/timer_esp32c6.rs | 4 +-- esp-wifi/src/timer/xtensa.rs | 8 +---- esp-wifi/src/wifi/mod.rs | 8 +---- esp-wifi/src/wifi/os_adapter_esp32c2.rs | 4 +-- esp-wifi/src/wifi/os_adapter_esp32c3.rs | 4 +-- esp-wifi/src/wifi/os_adapter_esp32c6.rs | 4 +-- 17 files changed, 62 insertions(+), 135 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2769f982..15991537 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,10 +25,10 @@ esp32s2-hal = { version = "0.13.0", default-features = false } smoltcp = { version = "0.10.0", default-features=false, features = ["medium-ethernet", "socket-raw"] } critical-section = "1.1.1" portable-atomic = { version = "1.5", default-features = false } -portable_atomic_enum = "0.3.0" +portable_atomic_enum = { version = "0.3.0", features = ["portable-atomic"] } log = "0.4.20" embedded-svc = { version = "0.26.1", default-features = false, features = [] } -enumset = { version = "1", default-features = false } +enumset = { version = "1.1.3", default-features = false } linked_list_allocator = { version = "0.10.5", default-features = false, features = ["const_mut_refs"] } embedded-io = "0.6.1" fugit = "0.3.7" @@ -45,22 +45,22 @@ static_cell = { version = "2.0", features = ["nightly"] } embassy-net = { version = "0.2.1", features = ["nightly", "tcp", "udp", "dhcpv4", "medium-ethernet"] } bleps = { git = "https://github.com/bjoernQ/bleps", package = "bleps", rev = "0db8fcb", features = ["macros"] } -embassy-executor = { version = "0.3.3", package = "embassy-executor", features = ["nightly", "executor-thread", "integrated-timers"] } +embassy-executor = { version = "0.3.3", package = "embassy-executor", features = ["nightly", "integrated-timers"] } embassy-time = { version = "0.1.3", features = ["nightly"] } esp-println = { version = "0.7.0" } esp-backtrace = { version = "0.9.0", features = ["panic-handler", "exception-handler", "print-uart"] } embedded-hal-async = { version = "1.0.0-rc.1" } embedded-io-async = { version = "0.6.0" } -futures-util = { version = "0.3.28", default-features = false } # need this to activate portable-atomic on AtomicWaker even though we don't use it -atomic-waker = { version = "1.1.2", default-features = false } # need this to activate portable-atomic on AtomicWaker used by embedded-svc even though we don't use it +futures-util = { version = "0.3.28", default-features = false, features = ["portable-atomic"] } # need this to activate portable-atomic on AtomicWaker even though we don't use it +atomic-waker = { version = "1.1.2", default-features = false, features = ["portable-atomic"] } # need this to activate portable-atomic on AtomicWaker used by embedded-svc even though we don't use it # portable-atomic compatible esp-hal revisions [patch.crates-io] -esp32-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "7084a380" } -esp32c2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "7084a380" } -esp32c3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "7084a380" } -esp32c6-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "7084a380" } -esp32s2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "7084a380" } -esp32s3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "7084a380" } -esp-hal-common = { git = "https://github.com/esp-rs/esp-hal.git", rev = "7084a380" } +esp32-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "05f9d21" } +esp32c2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "05f9d21" } +esp32c3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "05f9d21" } +esp32c6-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "05f9d21" } +esp32s2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "05f9d21" } +esp32s3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "05f9d21" } +esp-hal-common = { git = "https://github.com/esp-rs/esp-hal.git", rev = "05f9d21" } diff --git a/esp-wifi/.cargo/config.toml b/esp-wifi/.cargo/config.toml index fd3449d7..83c7032d 100644 --- a/esp-wifi/.cargo/config.toml +++ b/esp-wifi/.cargo/config.toml @@ -7,16 +7,16 @@ esp32 = "run --features esp32 --target xtensa-esp32-none-elf --features esp32-hal/default,esp32-hal/embassy-time-timg0,esp32-hal/embassy-executor-thread" esp32s2 = "run --features esp32s2 --target xtensa-esp32s2-none-elf --features esp32s2-hal/default,esp32s2-hal/embassy-time-timg0,esp32s2-hal/embassy-executor-thread" esp32s3 = "run --features esp32s3 --target xtensa-esp32s3-none-elf --features esp32s3-hal/default,esp32s3-hal/embassy-time-timg0,esp32s3-hal/embassy-executor-thread" -esp32c2 = "run --features esp32c2 --target riscv32imc-unknown-none-elf --features esp32c2-hal/default,esp32c2-hal/embassy-time-timg0" -esp32c3 = "run --features esp32c3 --target riscv32imc-unknown-none-elf --features esp32c3-hal/default,esp32c3-hal/embassy-time-timg0" -esp32c6 = "run --features esp32c6 --target riscv32imac-unknown-none-elf --features esp32c6-hal/default,esp32c6-hal/embassy-time-timg0" +esp32c2 = "run --features esp32c2 --target riscv32imc-unknown-none-elf --features esp32c2-hal/default,esp32c2-hal/embassy-time-timg0,esp32c2-hal/embassy-executor-thread" +esp32c3 = "run --features esp32c3 --target riscv32imc-unknown-none-elf --features esp32c3-hal/default,esp32c3-hal/embassy-time-timg0,esp32c3-hal/embassy-executor-thread" +esp32c6 = "run --features esp32c6 --target riscv32imac-unknown-none-elf --features esp32c6-hal/default,esp32c6-hal/embassy-time-timg0,esp32c6-hal/embassy-executor-thread" besp32 = "build --features esp32 --target xtensa-esp32-none-elf --features esp32-hal/default,esp32-hal/embassy-time-timg0,esp32-hal/embassy-executor-thread" besp32s2 = "build --features esp32s2 --target xtensa-esp32s2-none-elf --features esp32s2-hal/default,esp32s2-hal/embassy-time-timg0,esp32s2-hal/embassy-executor-thread" besp32s3 = "build --features esp32s3 --target xtensa-esp32s3-none-elf --features esp32s3-hal/default,esp32s3-hal/embassy-time-timg0,esp32s3-hal/embassy-executor-thread" -besp32c2 = "build --features esp32c2 --target riscv32imc-unknown-none-elf --features esp32c2-hal/default,esp32c2-hal/embassy-time-timg0,portable-atomic/critical-section" -besp32c3 = "build --features esp32c3 --target riscv32imc-unknown-none-elf --features esp32c3-hal/default,esp32c3-hal/embassy-time-timg0,portable-atomic/critical-section" -besp32c6 = "build --features esp32c6 --target riscv32imac-unknown-none-elf --features esp32c6-hal/default,esp32c6-hal/embassy-time-timg0" +besp32c2 = "build --features esp32c2 --target riscv32imc-unknown-none-elf --features esp32c2-hal/default,esp32c2-hal/embassy-time-timg0,esp32c2-hal/embassy-executor-thread" +besp32c3 = "build --features esp32c3 --target riscv32imc-unknown-none-elf --features esp32c3-hal/default,esp32c3-hal/embassy-time-timg0,esp32c3-hal/embassy-executor-thread" +besp32c6 = "build --features esp32c6 --target riscv32imac-unknown-none-elf --features esp32c6-hal/default,esp32c6-hal/embassy-time-timg0,esp32c6-hal/embassy-executor-thread" [target.riscv32imc-unknown-none-elf] runner = "espflash flash --monitor" @@ -54,24 +54,6 @@ rustflags = [ "-C", "link-arg=-Tlinkall.x", "-C", "link-arg=-Trom_functions.x", "-C", "force-frame-pointers", - - # TODO: these should be removed but heapless 0.7 would fail to compile without it - # Enable the atomic codegen option for Xtensa. - "-C", "target-feature=+s32c1i", - - # tell the core library have atomics even though it's not specified in the target definition - "--cfg", "target_has_atomic_load_store", - "--cfg", 'target_has_atomic_load_store="8"', - "--cfg", 'target_has_atomic_load_store="16"', - "--cfg", 'target_has_atomic_load_store="32"', - "--cfg", 'target_has_atomic_load_store="ptr"', - # Tell the `core` library that we have atomics, even though it's not - # specified in the target definition - "--cfg", 'target_has_atomic', - "--cfg", 'target_has_atomic="8"', - "--cfg", 'target_has_atomic="16"', - "--cfg", 'target_has_atomic="32"', - "--cfg", 'target_has_atomic="ptr"', ] [unstable] diff --git a/esp-wifi/Cargo.toml b/esp-wifi/Cargo.toml index d477c549..58125a19 100644 --- a/esp-wifi/Cargo.toml +++ b/esp-wifi/Cargo.toml @@ -48,7 +48,7 @@ embassy-net = { workspace = true, optional = true } toml-cfg.workspace = true libm.workspace = true cfg-if.workspace = true -portable-atomic = { workspace = true, optional = true } +portable-atomic.workspace = true portable_atomic_enum.workspace = true # We don't use these directly but we need to enable portable-atomic on them @@ -67,15 +67,14 @@ bleps = { workspace = true, features = ["async"] } embedded-hal-async.workspace = true log.workspace = true static_cell.workspace = true -portable-atomic = { workspace = true, features = ["critical-section"] } # for tests/examples we use portable-atomic [features] -default = [ "log", "ipv4", "tcp", "udp", "icmp", "igmp", "dns", "dhcpv4", "portable-atomic" ] +default = [ "log", "ipv4", "tcp", "udp", "icmp", "igmp", "dns", "dhcpv4" ] # chip features -esp32c2 = [ "esp32c2-hal", "esp-wifi-sys/esp32c2", "esp-println/esp32c2", "esp-backtrace/esp32c2", "embassy-executor/arch-riscv32" ] -esp32c3 = [ "esp32c3-hal", "esp-wifi-sys/esp32c3", "esp-println/esp32c3", "esp-backtrace/esp32c3", "embassy-executor/arch-riscv32" ] -esp32c6 = [ "esp32c6-hal", "esp-wifi-sys/esp32c6", "esp-println/esp32c6", "esp-backtrace/esp32c6", "embassy-executor/arch-riscv32" ] +esp32c2 = [ "esp32c2-hal", "esp-wifi-sys/esp32c2", "esp-println/esp32c2", "esp-backtrace/esp32c2" ] +esp32c3 = [ "esp32c3-hal", "esp-wifi-sys/esp32c3", "esp-println/esp32c3", "esp-backtrace/esp32c3" ] +esp32c6 = [ "esp32c6-hal", "esp-wifi-sys/esp32c6", "esp-println/esp32c6", "esp-backtrace/esp32c6" ] esp32 = [ "esp32-hal", "esp-wifi-sys/esp32", "esp-println/esp32", "esp-backtrace/esp32" ] esp32s2 = [ "esp32s2-hal", "esp-wifi-sys/esp32s2", "esp-println/esp32s2", "esp-backtrace/esp32s2" ] esp32s3 = [ "esp32s3-hal", "esp-wifi-sys/esp32s3", "esp-println/esp32s3", "esp-backtrace/esp32s3" ] @@ -142,8 +141,6 @@ log = [ "esp32s3-hal?/log", ] -portable-atomic = ["dep:portable-atomic", "portable_atomic_enum/portable-atomic", "futures-util/portable-atomic", "atomic-waker/portable-atomic"] - [package.metadata.docs.rs] features = ["esp32c3", "wifi", "ble", "async", "embassy-net", "esp32c3-hal/embassy-time-systick", "esp32c3-hal/default"] default-target = "riscv32imc-unknown-none-elf" diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32.rs b/esp-wifi/src/common_adapter/common_adapter_esp32.rs index 600d2d53..00b4d998 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32.rs @@ -5,13 +5,7 @@ use crate::hal::prelude::ram; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicU32, Ordering}; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -27,11 +21,11 @@ pub(crate) fn enable_wifi_power_domain() { let rtc_cntl = &*crate::hal::peripherals::RTC_CNTL::ptr(); rtc_cntl - .dig_pwc + .dig_pwc() .modify(|_, w| w.wifi_force_pd().clear_bit()); rtc_cntl - .dig_iso + .dig_iso() .modify(|_, w| w.wifi_force_iso().clear_bit()); } } @@ -210,8 +204,9 @@ unsafe extern "C" fn phy_exit_critical(level: u32) { #[ram] #[no_mangle] unsafe extern "C" fn rtc_get_xtal() -> u32 { - trace!("rtc_get_xtal - just hardcoded value 40 for now"); - 40 + use crate::hal::clock::Clock; + let xtal = crate::hal::rtc_cntl::RtcClock::get_xtal_freq(); + xtal.mhz() } #[no_mangle] diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32c2.rs b/esp-wifi/src/common_adapter/common_adapter_esp32c2.rs index 3b00e34d..e714fc51 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32c2.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32c2.rs @@ -5,13 +5,7 @@ use crate::compat::common::str_from_c; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicU32, Ordering}; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -144,6 +138,7 @@ pub(crate) unsafe fn phy_disable_clock() { #[no_mangle] pub extern "C" fn rtc_clk_xtal_freq_get() -> i32 { - // JUST SUPPORT 40MHz XTAL for now - 40 + use crate::hal::clock::Clock; + let xtal = crate::hal::rtc_cntl::RtcClock::get_xtal_freq(); + xtal.mhz() as i32 } diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32c3.rs b/esp-wifi/src/common_adapter/common_adapter_esp32c3.rs index f5e11134..b9d8ba15 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32c3.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32c3.rs @@ -5,13 +5,7 @@ use crate::compat::common::str_from_c; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicU32, Ordering}; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -45,18 +39,18 @@ pub(crate) fn enable_wifi_power_domain() { let syscon = &*crate::hal::peripherals::APB_CTRL::ptr(); rtc_cntl - .dig_pwc + .dig_pwc() .modify(|_, w| w.wifi_force_pd().clear_bit()); syscon - .wifi_rst_en + .wifi_rst_en() .modify(|r, w| w.bits(r.bits() | MODEM_RESET_FIELD_WHEN_PU)); syscon - .wifi_rst_en + .wifi_rst_en() .modify(|r, w| w.bits(r.bits() & !MODEM_RESET_FIELD_WHEN_PU)); rtc_cntl - .dig_iso + .dig_iso() .modify(|_, w| w.wifi_force_iso().clear_bit()); } } diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32c6.rs b/esp-wifi/src/common_adapter/common_adapter_esp32c6.rs index 945e9f78..b9fbc276 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32c6.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32c6.rs @@ -5,13 +5,7 @@ use crate::compat::common::str_from_c; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicU32, Ordering}; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs b/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs index 8cd2258b..f73c5a41 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs @@ -5,13 +5,7 @@ use crate::hal::prelude::ram; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicU32, Ordering}; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -43,18 +37,18 @@ pub(crate) fn enable_wifi_power_domain() { let syscon = &*crate::hal::peripherals::SYSCON::ptr(); rtc_cntl - .dig_pwc + .dig_pwc() .modify(|_, w| w.wifi_force_pd().clear_bit()); syscon - .wifi_rst_en + .wifi_rst_en() .modify(|r, w| w.bits(r.bits() | MODEM_RESET_FIELD_WHEN_PU)); syscon - .wifi_rst_en + .wifi_rst_en() .modify(|r, w| w.bits(r.bits() & !MODEM_RESET_FIELD_WHEN_PU)); rtc_cntl - .dig_iso + .dig_iso() .modify(|_, w| w.wifi_force_iso().clear_bit()); } } diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32s3.rs b/esp-wifi/src/common_adapter/common_adapter_esp32s3.rs index 2bdd820e..cc4c63a4 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32s3.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32s3.rs @@ -4,13 +4,7 @@ use crate::common_adapter::RADIO_CLOCKS; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicU32, Ordering}; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -50,18 +44,18 @@ pub(crate) fn enable_wifi_power_domain() { let syscon = &*crate::hal::peripherals::APB_CTRL::ptr(); rtc_cntl - .dig_pwc + .dig_pwc() .modify(|_, w| w.wifi_force_pd().clear_bit()); syscon - .wifi_rst_en + .wifi_rst_en() .modify(|r, w| w.bits(r.bits() | MODEM_RESET_FIELD_WHEN_PU)); syscon - .wifi_rst_en + .wifi_rst_en() .modify(|r, w| w.bits(r.bits() & !MODEM_RESET_FIELD_WHEN_PU)); rtc_cntl - .dig_iso + .dig_iso() .modify(|_, w| w.wifi_force_iso().clear_bit()); } } diff --git a/esp-wifi/src/esp_now/mod.rs b/esp-wifi/src/esp_now/mod.rs index b99eef4e..828991d9 100644 --- a/esp-wifi/src/esp_now/mod.rs +++ b/esp-wifi/src/esp_now/mod.rs @@ -9,13 +9,7 @@ use core::marker::PhantomData; use core::{cell::RefCell, fmt::Debug}; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicBool, AtomicU8, Ordering}; +use portable_atomic::{AtomicBool, AtomicU8, Ordering}; use critical_section::Mutex; diff --git a/esp-wifi/src/timer/riscv.rs b/esp-wifi/src/timer/riscv.rs index 227898fa..53cf17c8 100644 --- a/esp-wifi/src/timer/riscv.rs +++ b/esp-wifi/src/timer/riscv.rs @@ -72,7 +72,7 @@ fn FROM_CPU_INTR3(trap_frame: &mut TrapFrame) { unsafe { // clear FROM_CPU_INTR3 (&*SystemPeripheral::PTR) - .cpu_intr_from_cpu_3 + .cpu_intr_from_cpu_3() .modify(|_, w| w.cpu_intr_from_cpu_3().clear_bit()); } @@ -90,7 +90,7 @@ fn FROM_CPU_INTR3(trap_frame: &mut TrapFrame) { pub fn yield_task() { unsafe { (&*SystemPeripheral::PTR) - .cpu_intr_from_cpu_3 + .cpu_intr_from_cpu_3() .modify(|_, w| w.cpu_intr_from_cpu_3().set_bit()); } } diff --git a/esp-wifi/src/timer/timer_esp32c6.rs b/esp-wifi/src/timer/timer_esp32c6.rs index 3f0a1d32..c45a8d55 100644 --- a/esp-wifi/src/timer/timer_esp32c6.rs +++ b/esp-wifi/src/timer/timer_esp32c6.rs @@ -23,10 +23,10 @@ pub fn setup_radio_isr() { // for some reason for this interrupt, mapping it to 0 doesn't deactivate it let interrupt_core0 = unsafe { &*peripherals::INTERRUPT_CORE0::PTR }; interrupt_core0 - .wifi_bb_intr_map + .wifi_bb_intr_map() .write(|w| w.wifi_bb_intr_map().variant(31)); interrupt_core0 - .modem_peri_timeout_intr_map + .modem_peri_timeout_intr_map() .write(|w| w.modem_peri_timeout_intr_map().variant(31)); #[cfg(feature = "ble")] diff --git a/esp-wifi/src/timer/xtensa.rs b/esp-wifi/src/timer/xtensa.rs index 15a9242b..265be821 100644 --- a/esp-wifi/src/timer/xtensa.rs +++ b/esp-wifi/src/timer/xtensa.rs @@ -1,12 +1,6 @@ use core::cell::RefCell; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicU32, Ordering}; +use portable_atomic::{AtomicU32, Ordering}; use critical_section::Mutex; diff --git a/esp-wifi/src/wifi/mod.rs b/esp-wifi/src/wifi/mod.rs index e7db8f7d..1922880b 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -10,13 +10,7 @@ use core::{ mem::MaybeUninit, }; -#[cfg(not(feature = "portable-atomic"))] -use core::sync::atomic; - -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -use atomic::{AtomicUsize, Ordering}; +use portable_atomic::{AtomicUsize, Ordering}; use crate::common_adapter::*; use crate::esp_wifi_result; diff --git a/esp-wifi/src/wifi/os_adapter_esp32c2.rs b/esp-wifi/src/wifi/os_adapter_esp32c2.rs index 646e658f..57da8e68 100644 --- a/esp-wifi/src/wifi/os_adapter_esp32c2.rs +++ b/esp-wifi/src/wifi/os_adapter_esp32c2.rs @@ -3,7 +3,7 @@ use crate::hal::{peripherals, riscv}; pub(crate) fn chip_ints_on(mask: u32) { unsafe { (*peripherals::INTERRUPT_CORE0::PTR) - .cpu_int_enable + .cpu_int_enable() .modify(|r, w| w.bits(r.bits() | mask)); } } @@ -11,7 +11,7 @@ pub(crate) fn chip_ints_on(mask: u32) { pub(crate) fn chip_ints_off(mask: u32) { unsafe { (*peripherals::INTERRUPT_CORE0::PTR) - .cpu_int_enable + .cpu_int_enable() .modify(|r, w| w.bits(r.bits() & !mask)); } } diff --git a/esp-wifi/src/wifi/os_adapter_esp32c3.rs b/esp-wifi/src/wifi/os_adapter_esp32c3.rs index 646e658f..57da8e68 100644 --- a/esp-wifi/src/wifi/os_adapter_esp32c3.rs +++ b/esp-wifi/src/wifi/os_adapter_esp32c3.rs @@ -3,7 +3,7 @@ use crate::hal::{peripherals, riscv}; pub(crate) fn chip_ints_on(mask: u32) { unsafe { (*peripherals::INTERRUPT_CORE0::PTR) - .cpu_int_enable + .cpu_int_enable() .modify(|r, w| w.bits(r.bits() | mask)); } } @@ -11,7 +11,7 @@ pub(crate) fn chip_ints_on(mask: u32) { pub(crate) fn chip_ints_off(mask: u32) { unsafe { (*peripherals::INTERRUPT_CORE0::PTR) - .cpu_int_enable + .cpu_int_enable() .modify(|r, w| w.bits(r.bits() & !mask)); } } diff --git a/esp-wifi/src/wifi/os_adapter_esp32c6.rs b/esp-wifi/src/wifi/os_adapter_esp32c6.rs index 06ae1d58..a4af07d2 100644 --- a/esp-wifi/src/wifi/os_adapter_esp32c6.rs +++ b/esp-wifi/src/wifi/os_adapter_esp32c6.rs @@ -3,7 +3,7 @@ use crate::hal::{peripherals, riscv}; pub(crate) fn chip_ints_on(mask: u32) { unsafe { (*peripherals::INTPRI::PTR) - .cpu_int_enable + .cpu_int_enable() .modify(|r, w| w.bits(r.bits() | mask)); } } @@ -11,7 +11,7 @@ pub(crate) fn chip_ints_on(mask: u32) { pub(crate) fn chip_ints_off(mask: u32) { unsafe { (*peripherals::INTPRI::PTR) - .cpu_int_enable + .cpu_int_enable() .modify(|r, w| w.bits(r.bits() & !mask)); } }