diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 8bbd6d032e..c6e4cc7e22 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -1,4 +1,4 @@ -menu "ESP32-specific config" +menu "ESP32-specific" choice ESP32_DEFAULT_CPU_FREQ_MHZ prompt "CPU frequency" @@ -490,9 +490,27 @@ config SW_COEXIST_ENABLE Recommended for heavy traffic scenarios. Both coexistence configuration options are automatically managed, no user intervention is required. + +config ESP32_WIFI_RX_BUFFER_NUM + int "Max number of WiFi RX buffers" + depends on WIFI_ENABLED + range 2 25 + default 25 + help + Set the number of WiFi rx buffers. Each buffer takes approximately 1.6KB of RAM. + Larger number for higher throughput but more memory. Smaller number for lower + throughput but less memory. + +config PHY_ENABLED + bool + default y if WIFI_ENABLED || BT_ENABLED + +menu PHY + visible if PHY_ENABLED + config ESP32_PHY_AUTO_INIT bool "Initialize PHY in startup code" - depends on WIFI_ENABLED + depends on PHY_ENABLED default y help If enabled, PHY will be initialized in startup code, before @@ -507,7 +525,7 @@ config ESP32_PHY_AUTO_INIT config ESP32_PHY_INIT_DATA_IN_PARTITION bool "Use a partition to store PHY init data" - depends on WIFI_ENABLED + depends on PHY_ENABLED default n help If enabled, PHY init data will be loaded from a partition. @@ -521,22 +539,20 @@ config ESP32_PHY_INIT_DATA_IN_PARTITION into the application binary. If unsure, choose 'n'. - -config ESP32_PHY_MAX_TX_POWER - int "Max TX power (dBm)" + +config ESP32_PHY_MAX_WIFI_TX_POWER + int "Max WiFi TX power (dBm)" range 0 20 default 20 - depends on WIFI_ENABLED + depends on PHY_ENABLED && WIFI_ENABLED help - Set maximum transmit power. Actual transmit power for high + Set maximum transmit power for WiFi radio. Actual transmit power for high data rates may be lower than this setting. -config ESP32_WIFI_RX_BUFFER_NUM - int "Max number of WiFi RX buffers" - depends on WIFI_ENABLED - range 2 25 - default 25 - help - Set the number of WiFi rx buffers. Each buffer takes approximately 1.6KB of RAM. - Larger number for higher throughput but more memory. Smaller number for lower - throughput but less memory. +config ESP32_PHY_MAX_TX_POWER + int + depends on PHY_ENABLED + default 20 if !WIFI_ENABLED + default ESP32_PHY_MAX_WIFI_TX_POWER if WIFI_ENABLED + +endmenu diff --git a/components/esp32/component.mk b/components/esp32/component.mk index e1cd2c6524..a8109a0f5e 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -3,16 +3,14 @@ # COMPONENT_SRCDIRS := . hwcrypto -LIBS := core rtc phy -ifdef CONFIG_BT_ENABLED -LIBS += coexist +LIBS := core rtc +ifdef CONFIG_PHY_ENABLED # BT || WIFI +LIBS += phy coexist endif ifdef CONFIG_WIFI_ENABLED LIBS += net80211 pp wpa smartconfig coexist wps wpa2 endif -LIBS := $(sort $(LIBS)) # de-duplicate, we can handle different orders here - LINKER_SCRIPTS += esp32.common.ld esp32.rom.ld esp32.peripherals.ld ifeq ("$(CONFIG_NEWLIB_NANO_FORMAT)","y") diff --git a/components/esp32/cpu_freq.c b/components/esp32/cpu_freq.c index 7618f147af..f5ccd13df7 100644 --- a/components/esp32/cpu_freq.c +++ b/components/esp32/cpu_freq.c @@ -17,7 +17,6 @@ #include "rom/ets_sys.h" #include "rom/uart.h" #include "sdkconfig.h" -#include "phy.h" #include "rtc.h" #include "soc/soc.h" #include "soc/rtc_cntl_reg.h" @@ -32,7 +31,6 @@ void esp_set_cpu_freq(void) { uint32_t freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; - phy_get_romfunc_addr(); // freq will be changed to 40MHz in rtc_init_lite, // wait uart tx finish, otherwise some uart output will be lost diff --git a/components/esp32/phy.h b/components/esp32/phy.h index 81990f2e36..c0affb36ef 100644 --- a/components/esp32/phy.h +++ b/components/esp32/phy.h @@ -25,8 +25,7 @@ extern "C" { */ /** - * @brief Initialize function pointer table in PHY library. - * @note This function should be called before register_chipv7_phy. + * @brief Return ROM function pointer table from PHY library. */ void phy_get_romfunc_addr(void); diff --git a/components/esp32/phy_init.c b/components/esp32/phy_init.c index 07a455d501..5b130eaf7a 100644 --- a/components/esp32/phy_init.c +++ b/components/esp32/phy_init.c @@ -27,7 +27,7 @@ #include "nvs.h" #include "sdkconfig.h" -#ifdef CONFIG_WIFI_ENABLED +#ifdef CONFIG_PHY_ENABLED #include "phy.h" #include "phy_init_data.h" @@ -39,8 +39,7 @@ esp_err_t esp_phy_init(const esp_phy_init_data_t* init_data, { assert(init_data); assert(calibration_data); - // Initialize PHY pointer table - phy_get_romfunc_addr(); + REG_SET_BIT(DPORT_CORE_RST_EN_REG, DPORT_MAC_RST); REG_CLR_BIT(DPORT_CORE_RST_EN_REG, DPORT_MAC_RST); // Enable WiFi peripheral clock @@ -221,4 +220,4 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle handle, return err; } -#endif // CONFIG_WIFI_ENABLED +#endif // CONFIG_PHY_ENABLED diff --git a/components/ethernet/Kconfig b/components/ethernet/Kconfig index 0ea94eaafd..663871f2a0 100644 --- a/components/ethernet/Kconfig +++ b/components/ethernet/Kconfig @@ -5,30 +5,47 @@ menuconfig ETHERNET Select this option to enable ethernet driver and show the submenu with ethernet features. config DMA_RX_BUF_NUM - int "DMA Rx Buf Num" - default 10 - depends on ETHERNET - help - Dma rx buf num ,can not be 0 . - -config DMA_TX_BUF_NUM - int "DMA Tx Buf Num" + int "Number of DMA RX buffers" + range 1 10 default 10 depends on ETHERNET help - Dma tx Buf num ,can not be 0. + Number of DMA receive buffers. Each buffer is 1600 bytes. + Buffers are allocated statically. + Larger number of buffers increases throughput. + +config DMA_TX_BUF_NUM + int "Number of DMA RX buffers" + range 1 10 + default 10 + depends on ETHERNET + help + Number of DMA transmit buffers. Each buffer is 1600 bytes. + Buffers are allocated statically. + Larger number of buffers increases throughput. config EMAC_L2_TO_L3_RX_BUF_MODE - bool "L2 To L3 RX BUF COPY MODE" + bool "Enable copy between Layer2 and Layer3" default n depends on ETHERNET help - Receive Buf user copy mode or pointer mode. + If this options is selected, a copy of each received buffer will be created when + passing it from the Ethernet MAC (L2) to the IP stack (L3). Otherwise, IP stack + will receive pointers to the DMA buffers used by Ethernet MAC. + + When Ethernet MAC doesn't have any unused buffers left, it will drop incomming + packets (flow control may help with this problem, to some extent). + + The buffers for the IP stack are allocated from the heap, so the total number of + receive buffers is limited by the available heap size, if this option is selected. + + If unsure, choose n. config EMAC_TASK_PRIORITY int "EMAC_TASK_PRIORITY" default 20 + range 3 22 depends on ETHERNET help - Emac task priority ,suggest 3 ~ 23. + Ethernet MAC task priority.