From 80aaf4e44f7e338ac8387d92ec56c7cc7d638da1 Mon Sep 17 00:00:00 2001 From: Frederick Vollbrecht Date: Thu, 1 Aug 2024 19:38:08 +0200 Subject: [PATCH 1/2] add esp32p4 support --- src/wifi.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/wifi.rs b/src/wifi.rs index 256781c6e2d..36db9b05415 100644 --- a/src/wifi.rs +++ b/src/wifi.rs @@ -548,12 +548,24 @@ impl<'d> WifiDriver<'d> { event_handler: Some(esp_event_send_internal), osi_funcs: unsafe { core::ptr::addr_of_mut!(g_wifi_osi_funcs) }, wpa_crypto_funcs: unsafe { g_wifi_default_wpa_crypto_funcs }, - static_rx_buf_num: CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM as _, - dynamic_rx_buf_num: CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM as _, - tx_buf_type: CONFIG_ESP32_WIFI_TX_BUFFER_TYPE as _, + #[cfg(not(esp32p4))] + static_rx_buf_num: CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM as _, + #[cfg(esp32p4)] // There is no default value for p4 currently in idf so we use the values from c6 as a starting point + static_rx_buf_num: 40 as _, + #[cfg(not(esp32p4))] + dynamic_rx_buf_num: CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM as _, + #[cfg(esp32p4)] // There is no default value for p4 currently in idf so we use the values from c6 as a starting point + dynamic_rx_buf_num: 60 as _, + #[cfg(not(esp32p4))] + tx_buf_type: CONFIG_ESP_WIFI_TX_BUFFER_TYPE as _, + #[cfg(esp32p4)] + tx_buf_type: 1 as _, static_tx_buf_num: WIFI_STATIC_TX_BUFFER_NUM as _, dynamic_tx_buf_num: WIFI_DYNAMIC_TX_BUFFER_NUM as _, + #[cfg(not(esp32p4))] cache_tx_buf_num: WIFI_CACHE_TX_BUFFER_NUM as _, + #[cfg(esp32p4)] + cache_tx_buf_num: 1 as _, csi_enable: WIFI_CSI_ENABLED as _, ampdu_rx_enable: WIFI_AMPDU_RX_ENABLED as _, ampdu_tx_enable: WIFI_AMPDU_TX_ENABLED as _, @@ -598,7 +610,10 @@ impl<'d> WifiDriver<'d> { ) ) ))] + #[cfg(not(esp32p4))] espnow_max_encrypt_num: CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM as i32, + #[cfg(esp32p4)] + espnow_max_encrypt_num: 7 as i32, magic: WIFI_INIT_CONFIG_MAGIC as _, ..Default::default() }; From 639303e0ba70bff3441bbf6748b1f9e6d030e538 Mon Sep 17 00:00:00 2001 From: Frederick Vollbrecht Date: Fri, 2 Aug 2024 10:31:30 +0200 Subject: [PATCH 2/2] fix idf v5.3 eth_esp32_emac_config_t --- src/eth.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/eth.rs b/src/eth.rs index cfdf2fff3d7..72165d55ea5 100644 --- a/src/eth.rs +++ b/src/eth.rs @@ -63,7 +63,7 @@ where { Input(GPIO0), OutputGpio0(GPIO0), - /// This according to ESP-IDF is for "testing" only + /// This according to ESP-IDF is for "testing" only OutputGpio16(GPIO16), OutputInvertedGpio17(GPIO17), } @@ -428,7 +428,6 @@ impl<'d> EthDriver<'d, RmiiEth> { esp_idf_version = "5.0", esp_idf_version = "5.1", esp_idf_version = "5.2", - esp_idf_version = "5.3" ))] fn eth_esp32_emac_default_config(mdc: i32, mdio: i32) -> eth_esp32_emac_config_t { eth_esp32_emac_config_t { @@ -444,7 +443,6 @@ impl<'d> EthDriver<'d, RmiiEth> { esp_idf_version = "5.0", esp_idf_version = "5.1", esp_idf_version = "5.2", - esp_idf_version = "5.3" )))] fn eth_esp32_emac_default_config(mdc: i32, mdio: i32) -> eth_esp32_emac_config_t { eth_esp32_emac_config_t {