esp32: add esp32 wifi driver
add support for esp32 wifi
Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
diff --git a/drivers/wifi/esp32/Kconfig.esp32 b/drivers/wifi/esp32/Kconfig.esp32
new file mode 100644
index 0000000..b8503fb
--- /dev/null
+++ b/drivers/wifi/esp32/Kconfig.esp32
@@ -0,0 +1,232 @@
+# Copyright 2020 Espressif Systems (Shanghai) PTE LTD
+
+menuconfig WIFI_ESP32
+ bool "ESP32 SoC WiFi support"
+ select POSIX_API
+ select THREAD_CUSTOM_DATA
+ select DYNAMIC_INTERRUPTS
+ help
+ Enable ESP32 SoC WiFi support.
+
+ Note: POSIX_API is required by Wifi library. It shall be removed
+ once NEWLIB gets supported.
+
+if WIFI_ESP32
+
+config ESP32_WIFI_SSID
+ string "SSID of WiFi network"
+ help
+ SSID (network name) for the application to connect to.
+
+config ESP32_WIFI_PASSWORD
+ string "Password (WPA or WPA2) of WiFi network"
+ help
+ WiFi password (WPA or WPA2) for the example to use.
+
+config ESP32_WIFI_STA_AUTO
+ bool "Automatically connect to configured WiFi SSID"
+ help
+ WiFi driver will automatically connect to SSID.
+
+config ESP32_WIFI_STA_RECONNECT
+ bool "WiFi connection retry"
+ default y
+ help
+ Set auto WiFI reconnection when disconnected.
+
+config ESP32_WIFI_EVENT_TASK_STACK_SIZE
+ int "Event Task Stack Size"
+ default 4096
+
+config ESP32_WIFI_EVENT_TASK_PRIO
+ int "Event Task Priority"
+ default 4
+
+config ESP32_WIFI_STATIC_RX_BUFFER_NUM
+ int "Max number of WiFi static RX buffers"
+ range 2 25
+ default 10
+ help
+ Set the number of WiFi static RX buffers. Each buffer takes approximately
+ 1.6KB of RAM. The static rx buffers are allocated when esp_wifi_init is
+ called, they are not freed until esp_wifi_deinit is called.
+
+ WiFi hardware use these buffers to receive all 802.11 frames. A higher
+ number may allow higher throughput but increases memory use.
+ If ESP32_WIFI_AMPDU_RX_ENABLED is enabled, this value is recommended to
+ set equal or bigger than ESP32_WIFI_RX_BA_WIN in order to achieve better
+ throughput and compatibility with both stations and APs.
+
+config ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM
+ int "Max number of WiFi dynamic RX buffers"
+ range 0 128
+ default 32
+ help
+ Set the number of WiFi dynamic RX buffers, 0 means unlimited RX buffers
+ will be allocated (provided sufficient free RAM). The size of each dynamic
+ RX buffer depends on the size of the received data frame.
+
+ For each received data frame, the WiFi driver makes a copy to an RX buffer
+ and then delivers it to the high layer TCP/IP stack. The dynamic RX buffer
+ is freed after the higher layer has successfully received the data frame.
+
+ For some applications, WiFi data frames may be received faster than the
+ application can process them. In these cases we may run out of memory if
+ RX buffer number is unlimited (0). If a dynamic RX buffer limit is set,
+ it should be at least the number of static RX buffers.
+
+choice ESP32_WIFI_TX_BUFFER
+ prompt "Type of WiFi TX buffers"
+ default ESP32_WIFI_DYNAMIC_TX_BUFFER
+ help
+ Select type of WiFi TX buffers:
+
+ If "Static" is selected, WiFi TX buffers are allocated when WiFi is
+ initialized and released when WiFi is de-initialized. The size of each
+ static TX buffer is fixed to about 1.6KB.
+
+ If "Dynamic" is selected, each WiFi TX buffer is allocated as needed
+ when a data frame is delivered to the Wifi driver from the TCP/IP stack.
+ The buffer is freed after the data frame has been sent by the WiFi driver.
+ The size of each dynamic TX buffer depends on the length of each data
+ frame sent by the TCP/IP layer.
+
+ If PSRAM is enabled, "Static" should be selected to guarantee enough
+ WiFi TX buffers. If PSRAM is disabled, "Dynamic" should be selected
+ to improve the utilization of RAM.
+
+ config ESP32_WIFI_STATIC_TX_BUFFER
+ bool "Static"
+ config ESP32_WIFI_DYNAMIC_TX_BUFFER
+ bool "Dynamic"
+endchoice
+
+config ESP32_WIFI_TX_BUFFER_TYPE
+ int
+ default 0 if ESP32_WIFI_STATIC_TX_BUFFER
+ default 1 if ESP32_WIFI_DYNAMIC_TX_BUFFER
+
+config ESP32_WIFI_STATIC_TX_BUFFER_NUM
+ int "Max number of WiFi static TX buffers"
+ depends on ESP32_WIFI_STATIC_TX_BUFFER
+ range 1 64
+ default 16
+ help
+ Set the number of WiFi static TX buffers. Each buffer takes approximately
+ 1.6KB of RAM. The static RX buffers are allocated when esp_wifi_init() is
+ called, they are not released until esp_wifi_deinit() is called.
+
+ For each transmitted data frame from the higher layer TCP/IP stack,
+ the WiFi driver makes a copy of it in a TX buffer. For some applications
+ especially UDP applications, the upper layer can deliver frames faster
+ than WiFi layer can transmit.
+ In these cases, we may run out of TX buffers.
+
+config ESP32_WIFI_CACHE_TX_BUFFER_NUM
+ int "Max number of WiFi cache TX buffers"
+ range 16 128
+ default 32
+ help
+ Set the number of WiFi cache TX buffer number.
+
+ For each TX packet from uplayer, such as LWIP etc, WiFi driver needs to
+ allocate a static TX buffer and makes a copy of uplayer packet. If WiFi
+ driver fails to allocate the static TX buffer, it caches the uplayer
+ packets to a dedicated buffer queue, this option is used to configure the
+ size of the cached TX queue.
+
+config ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM
+ int "Max number of WiFi dynamic TX buffers"
+ depends on ESP32_WIFI_DYNAMIC_TX_BUFFER
+ range 1 128
+ default 32
+ help
+ Set the number of WiFi dynamic TX buffers. The size of each
+ dynamic TXbuffer is not fixed, it depends on the size of each
+ transmitted data frame.
+
+ For each transmitted frame from the higher layer TCP/IP stack,
+ the WiFi driver makes a copy of it in a TX buffer. For some applications,
+ especially UDP applications, the upper layer can deliver frames faster
+ than WiFi layer can transmit. In these cases, we may run out of TX
+ buffers.
+
+config ESP32_WIFI_CSI_ENABLED
+ bool "WiFi CSI(Channel State Information)"
+ help
+ Select this option to enable CSI(Channel State Information) feature.
+ CSI takes about CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM KB of RAM.
+ If CSI is not used, it is better to disable this feature in order
+ to save memory.
+
+config ESP32_WIFI_AMPDU_TX_ENABLED
+ bool "WiFi AMPDU TX"
+ default y
+ help
+ Select this option to enable AMPDU TX feature. It improves transmission
+ error checking and overall network performance with the cost of processing
+ speed. Helpful when the device is operating in crowded wireless area.
+
+config ESP32_WIFI_TX_BA_WIN
+ int "WiFi AMPDU TX BA window size"
+ depends on ESP32_WIFI_AMPDU_TX_ENABLED
+ range 2 32
+ default 6
+ help
+ Set the size of WiFi Block Ack TX window. Generally a bigger value means
+ higher throughput but more memory. Most of time we should NOT change the
+ default value unless special reason, e.g. test the maximum
+ UDP TX throughput with iperf etc. For iperf test in shieldbox,
+ the recommended value is 9~12.
+
+config ESP32_WIFI_AMPDU_RX_ENABLED
+ bool "WiFi AMPDU RX"
+ default y
+ help
+ Select this option to enable AMPDU RX feature. It improves transmission
+ error checking and overall network performance with the cost of processing
+ speed. Helpful when the device is operating in crowded wireless area.
+
+config ESP32_WIFI_RX_BA_WIN
+ int "WiFi AMPDU RX BA window size"
+ depends on ESP32_WIFI_AMPDU_RX_ENABLED
+ range 2 32
+ default 6
+ help
+ Set the size of WiFi Block Ack RX window. Generally a bigger value means
+ higher throughput and better compatibility but more memory. Most of time
+ we should NOT change the default value unless special reason,
+ e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in
+ shieldbox, the recommended value is 9~12. If PSRAM is used and WiFi memory
+ is preferred to allocat in PSRAM first, the default and minimum value
+ should be 16 to achieve better throughput and compatibility with both
+ stations and APs.
+
+choice ESP32_WIFI_TASK_CORE_ID
+ prompt "WiFi Task Core ID"
+ default ESP32_WIFI_TASK_PINNED_TO_CORE_0
+ help
+ Pinned WiFi task to core 0 (core 1 not supported yet)
+
+ config ESP32_WIFI_TASK_PINNED_TO_CORE_0
+ bool "Core 0"
+endchoice
+
+config ESP32_PHY_MAX_WIFI_TX_POWER
+ int "Max WiFi TX power (dBm)"
+ range 10 20
+ default 20
+ help
+ Set maximum transmit power for WiFi radio. Actual transmit power for high
+ data rates may be lower than this setting.
+
+config ESP32_PHY_MAX_TX_POWER
+ int
+ default ESP32_PHY_MAX_WIFI_TX_POWER
+
+config ESP32_WIFI_SW_COEXIST_ENABLE
+ bool
+ help
+ Software controls WiFi/Bluetooth coexistence. Not supported yet.
+
+endif # WIFI_ESP32