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