diff --git a/esp-wifi/.cargo/config.toml b/esp-wifi/.cargo/config.toml index 59ac563d46a..83c7032dc10 100644 --- a/esp-wifi/.cargo/config.toml +++ b/esp-wifi/.cargo/config.toml @@ -7,40 +7,23 @@ 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" -besp32c3 = "build --features esp32c3 --target riscv32imc-unknown-none-elf --features esp32c3-hal/default,esp32c3-hal/embassy-time-timg0" -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" rustflags = [ "-C", "link-arg=-Tlinkall.x", "-C", "link-arg=-Trom_functions.x", - "-C", "force-frame-pointers", - - # Enable the atomic codegen option for RISCV - "-C", "target-feature=+a", - - # 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"', - # enable cas - "--cfg", "target_has_atomic", - "--cfg", 'target_has_atomic="8"', - "--cfg", 'target_has_atomic="16"', - "--cfg", 'target_has_atomic="32"', - "--cfg", 'target_has_atomic="ptr"', ] [target.riscv32imac-unknown-none-elf] @@ -70,23 +53,7 @@ runner = "espflash flash --monitor" rustflags = [ "-C", "link-arg=-Tlinkall.x", "-C", "link-arg=-Trom_functions.x", - - # 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"', + "-C", "force-frame-pointers", ] [unstable] diff --git a/esp-wifi/Cargo.toml b/esp-wifi/Cargo.toml index 0a70a6f707b..58125a19ac3 100644 --- a/esp-wifi/Cargo.toml +++ b/esp-wifi/Cargo.toml @@ -39,7 +39,7 @@ embedded-io.workspace = true embedded-io-async = { workspace = true, optional = true } fugit.workspace = true heapless = { workspace = true, default-features = false } -num-derive = { workspace = true, features = ["full-syntax"] } +num-derive = { workspace = true } num-traits = { workspace = true, default-features = false } esp-wifi-sys = { version = "0.1.0", path = "../esp-wifi-sys" } embassy-sync = { workspace = true, optional = true } @@ -48,8 +48,12 @@ embassy-net = { workspace = true, optional = true } toml-cfg.workspace = true libm.workspace = true cfg-if.workspace = true -atomic-polyfill.workspace = true -atomic_enum.workspace = 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 +futures-util.workspace = true +atomic-waker.workspace = true [build-dependencies] toml-cfg.workspace = true @@ -59,7 +63,6 @@ esp-println = { workspace = true, features = ["log"] } esp-backtrace.workspace = true embassy-executor.workspace = true embassy-time.workspace = true -futures-util.workspace = true bleps = { workspace = true, features = ["async"] } embedded-hal-async.workspace = true log.workspace = true @@ -69,9 +72,9 @@ static_cell.workspace = true 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" ] diff --git a/esp-wifi/automated-tests/open_access_point.rs b/esp-wifi/automated-tests/open_access_point.rs index 5a53d609735..64079ea9e67 100644 --- a/esp-wifi/automated-tests/open_access_point.rs +++ b/esp-wifi/automated-tests/open_access_point.rs @@ -52,7 +52,7 @@ fn main() -> ! { let mut wifi_stack = WifiStack::new(iface, device, sockets, current_millis); let client_config = Configuration::AccessPoint(AccessPointConfiguration { - ssid: "esp-wifi".into(), + ssid: "esp-wifi".try_into().unwrap(), ..Default::default() }); let res = controller.set_configuration(&client_config); diff --git a/esp-wifi/automated-tests/test_connect.rs b/esp-wifi/automated-tests/test_connect.rs index 6fbb65b236c..11e4c0b75d0 100644 --- a/esp-wifi/automated-tests/test_connect.rs +++ b/esp-wifi/automated-tests/test_connect.rs @@ -65,7 +65,7 @@ fn main() -> ! { let mut wifi_stack = WifiStack::new(iface, device, sockets, current_millis); let client_config = Configuration::Client(ClientConfiguration { - ssid: SSID.into(), + ssid: SSID.try_into().unwrap(), auth_method: AuthMethod::None, ..Default::default() }); diff --git a/esp-wifi/examples/access_point.rs b/esp-wifi/examples/access_point.rs index 0a25b2d4ee9..de16c8ce3ad 100644 --- a/esp-wifi/examples/access_point.rs +++ b/esp-wifi/examples/access_point.rs @@ -52,7 +52,7 @@ fn main() -> ! { let mut wifi_stack = WifiStack::new(iface, device, sockets, current_millis); let client_config = Configuration::AccessPoint(AccessPointConfiguration { - ssid: "esp-wifi".into(), + ssid: "esp-wifi".try_into().unwrap(), ..Default::default() }); let res = controller.set_configuration(&client_config); diff --git a/esp-wifi/examples/access_point_with_sta.rs b/esp-wifi/examples/access_point_with_sta.rs index e42c55bea65..e2d69a4a43e 100644 --- a/esp-wifi/examples/access_point_with_sta.rs +++ b/esp-wifi/examples/access_point_with_sta.rs @@ -75,12 +75,12 @@ fn main() -> ! { let client_config = Configuration::Mixed( ClientConfiguration { - ssid: SSID.into(), - password: PASSWORD.into(), + ssid: SSID.try_into().unwrap(), + password: PASSWORD.try_into().unwrap(), ..Default::default() }, AccessPointConfiguration { - ssid: "esp-wifi".into(), + ssid: "esp-wifi".try_into().unwrap(), ..Default::default() }, ); diff --git a/esp-wifi/examples/bench.rs b/esp-wifi/examples/bench.rs index b100bc38cc1..993a45d9d9a 100644 --- a/esp-wifi/examples/bench.rs +++ b/esp-wifi/examples/bench.rs @@ -66,8 +66,8 @@ fn main() -> ! { let wifi_stack = WifiStack::new(iface, device, sockets, current_millis); let client_config = Configuration::Client(ClientConfiguration { - ssid: SSID.into(), - password: PASSWORD.into(), + ssid: SSID.try_into().unwrap(), + password: PASSWORD.try_into().unwrap(), ..Default::default() }); let res = controller.set_configuration(&client_config); diff --git a/esp-wifi/examples/coex.rs b/esp-wifi/examples/coex.rs index 6ddee39b040..453a13e3a7b 100644 --- a/esp-wifi/examples/coex.rs +++ b/esp-wifi/examples/coex.rs @@ -65,8 +65,8 @@ fn main() -> ! { let wifi_stack = WifiStack::new(iface, device, sockets, current_millis); let client_config = Configuration::Client(ClientConfiguration { - ssid: SSID.into(), - password: PASSWORD.into(), + ssid: SSID.try_into().unwrap(), + password: PASSWORD.try_into().unwrap(), ..Default::default() }); let res = controller.set_configuration(&client_config); diff --git a/esp-wifi/examples/dhcp.rs b/esp-wifi/examples/dhcp.rs index cd67c266056..223c4a8ef93 100644 --- a/esp-wifi/examples/dhcp.rs +++ b/esp-wifi/examples/dhcp.rs @@ -55,8 +55,8 @@ fn main() -> ! { let wifi_stack = WifiStack::new(iface, device, sockets, current_millis); let client_config = Configuration::Client(ClientConfiguration { - ssid: SSID.into(), - password: PASSWORD.into(), + ssid: SSID.try_into().unwrap(), + password: PASSWORD.try_into().unwrap(), ..Default::default() }); let res = controller.set_configuration(&client_config); diff --git a/esp-wifi/examples/embassy_access_point.rs b/esp-wifi/examples/embassy_access_point.rs index 03552b720fc..61df36b562c 100644 --- a/esp-wifi/examples/embassy_access_point.rs +++ b/esp-wifi/examples/embassy_access_point.rs @@ -172,7 +172,7 @@ async fn connection(mut controller: WifiController<'static>) { } if !matches!(controller.is_started(), Ok(true)) { let client_config = Configuration::AccessPoint(AccessPointConfiguration { - ssid: "esp-wifi".into(), + ssid: "esp-wifi".try_into().unwrap(), ..Default::default() }); controller.set_configuration(&client_config).unwrap(); diff --git a/esp-wifi/examples/embassy_access_point_with_sta.rs b/esp-wifi/examples/embassy_access_point_with_sta.rs index 1e465f9c88d..82fd8a15a4e 100644 --- a/esp-wifi/examples/embassy_access_point_with_sta.rs +++ b/esp-wifi/examples/embassy_access_point_with_sta.rs @@ -82,12 +82,12 @@ async fn main(spawner: Spawner) -> ! { let client_config = Configuration::Mixed( ClientConfiguration { - ssid: SSID.into(), - password: PASSWORD.into(), + ssid: SSID.try_into().unwrap(), + password: PASSWORD.try_into().unwrap(), ..Default::default() }, AccessPointConfiguration { - ssid: "esp-wifi".into(), + ssid: "esp-wifi".try_into().unwrap(), ..Default::default() }, ); diff --git a/esp-wifi/examples/embassy_bench.rs b/esp-wifi/examples/embassy_bench.rs index 771bf0ddae2..622a9f64615 100644 --- a/esp-wifi/examples/embassy_bench.rs +++ b/esp-wifi/examples/embassy_bench.rs @@ -124,8 +124,8 @@ async fn connection(mut controller: WifiController<'static>) { } if !matches!(controller.is_started(), Ok(true)) { let client_config = Configuration::Client(ClientConfiguration { - ssid: SSID.into(), - password: PASSWORD.into(), + ssid: SSID.try_into().unwrap(), + password: PASSWORD.try_into().unwrap(), ..Default::default() }); controller.set_configuration(&client_config).unwrap(); diff --git a/esp-wifi/examples/embassy_dhcp.rs b/esp-wifi/examples/embassy_dhcp.rs index d652efb3d69..80a137d07a3 100644 --- a/esp-wifi/examples/embassy_dhcp.rs +++ b/esp-wifi/examples/embassy_dhcp.rs @@ -144,8 +144,8 @@ async fn connection(mut controller: WifiController<'static>) { } if !matches!(controller.is_started(), Ok(true)) { let client_config = Configuration::Client(ClientConfiguration { - ssid: SSID.into(), - password: PASSWORD.into(), + ssid: SSID.try_into().unwrap(), + password: PASSWORD.try_into().unwrap(), ..Default::default() }); controller.set_configuration(&client_config).unwrap(); diff --git a/esp-wifi/examples/static_ip.rs b/esp-wifi/examples/static_ip.rs index 7b313502cd9..86e5a100de7 100644 --- a/esp-wifi/examples/static_ip.rs +++ b/esp-wifi/examples/static_ip.rs @@ -57,8 +57,8 @@ fn main() -> ! { let mut wifi_stack = WifiStack::new(iface, device, sockets, current_millis); let client_config = Configuration::Client(ClientConfiguration { - ssid: SSID.into(), - password: PASSWORD.into(), + ssid: SSID.try_into().unwrap(), + password: PASSWORD.try_into().unwrap(), ..Default::default() }); let res = controller.set_configuration(&client_config); diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32.rs b/esp-wifi/src/common_adapter/common_adapter_esp32.rs index 933b42f0d78..00b4d998ef9 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32.rs @@ -5,8 +5,7 @@ use crate::hal::prelude::ram; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -use atomic_polyfill::AtomicU32; -use core::sync::atomic::Ordering; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -22,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()); } } @@ -205,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 efca435bbaf..e714fc519dc 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32c2.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32c2.rs @@ -5,8 +5,7 @@ use crate::compat::common::str_from_c; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -use atomic_polyfill::AtomicU32; -use core::sync::atomic::Ordering; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -139,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 1693524bb02..b9d8ba15352 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32c3.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32c3.rs @@ -5,8 +5,7 @@ use crate::compat::common::str_from_c; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -use atomic_polyfill::AtomicU32; -use core::sync::atomic::Ordering; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -40,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 b0c05f91e77..b9fbc276790 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32c6.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32c6.rs @@ -5,8 +5,7 @@ use crate::compat::common::str_from_c; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -use atomic_polyfill::AtomicU32; -use core::sync::atomic::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 18529e68b96..f73c5a4135f 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs @@ -5,8 +5,7 @@ use crate::hal::prelude::ram; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -use atomic_polyfill::AtomicU32; -use core::sync::atomic::Ordering; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -38,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 fa6e9d113a7..cc4c63a4bab 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32s3.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32s3.rs @@ -4,8 +4,7 @@ use crate::common_adapter::RADIO_CLOCKS; use crate::hal::system::RadioClockController; use crate::hal::system::RadioPeripherals; -use atomic_polyfill::AtomicU32; -use core::sync::atomic::Ordering; +use portable_atomic::{AtomicU32, Ordering}; const SOC_PHY_DIG_REGS_MEM_SIZE: usize = 21 * 4; @@ -45,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 75609681a28..828991d940c 100644 --- a/esp-wifi/src/esp_now/mod.rs +++ b/esp-wifi/src/esp_now/mod.rs @@ -7,10 +7,9 @@ //! For more information see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_now.html use core::marker::PhantomData; -use core::sync::atomic::Ordering; use core::{cell::RefCell, fmt::Debug}; -use atomic_polyfill::{AtomicBool, AtomicU8}; +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 227898fafc5..53cf17c8cca 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 3f0a1d32c5f..c45a8d55e55 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 51ab55055a0..265be8216bd 100644 --- a/esp-wifi/src/timer/xtensa.rs +++ b/esp-wifi/src/timer/xtensa.rs @@ -1,6 +1,6 @@ -use atomic_polyfill::AtomicU32; use core::cell::RefCell; -use core::sync::atomic::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 b65aa9d9ea7..1922880b5da 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -3,15 +3,15 @@ pub(crate) mod os_adapter; pub(crate) mod state; -use atomic_polyfill::AtomicUsize; use core::ptr::addr_of; -use core::sync::atomic::Ordering; use core::time::Duration; use core::{ cell::{RefCell, RefMut}, mem::MaybeUninit, }; +use portable_atomic::{AtomicUsize, Ordering}; + use crate::common_adapter::*; use crate::esp_wifi_result; use crate::hal::macros::ram; diff --git a/esp-wifi/src/wifi/os_adapter_esp32c2.rs b/esp-wifi/src/wifi/os_adapter_esp32c2.rs index 646e658ffcb..57da8e68f97 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 646e658ffcb..57da8e68f97 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 06ae1d5847f..a4af07d26b1 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)); } } diff --git a/esp-wifi/src/wifi/state.rs b/esp-wifi/src/wifi/state.rs index 17c2f8b56fd..5ef60794aaf 100644 --- a/esp-wifi/src/wifi/state.rs +++ b/esp-wifi/src/wifi/state.rs @@ -1,11 +1,11 @@ use super::WifiEvent; -use atomic_enum::atomic_enum; use core::sync::atomic::Ordering; +use portable_atomic_enum::atomic_enum; /// Wifi interface state #[atomic_enum] -#[derive(PartialEq)] +#[derive(PartialEq, Debug)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum WifiState { StaStarted, diff --git a/esp-wifi/src/wifi_interface.rs b/esp-wifi/src/wifi_interface.rs index 101c60c179a..438eb51ae77 100644 --- a/esp-wifi/src/wifi_interface.rs +++ b/esp-wifi/src/wifi_interface.rs @@ -72,7 +72,7 @@ impl<'a, MODE: WifiDeviceMode> WifiStack<'a, MODE> { network_config: RefCell::new(ipv4::Configuration::Client( ipv4::ClientConfiguration::DHCP(ipv4::DHCPClientSettings { //FIXME: smoltcp currently doesn't have a way of giving a hostname through DHCP - hostname: Some("Espressif".into()), + hostname: Some(unwrap!("Espressif".try_into().ok())), }), )), ip_info: RefCell::new(None),