Merge branch 'bugfix/phy_auto_init' into 'master'

Move PHY options out of WiFi config, improve descriptions

- move PHY-related settings into new menu, make it dependent on WIFI_ENABLED || BT_ENABLED

- improve descriptions of Ethernet Kconfig options


See merge request !443
This commit is contained in:
Ivan Grokhotkov 2017-01-19 13:27:17 +08:00
commit 7eb570b039
6 changed files with 69 additions and 42 deletions

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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.