drivers: wifi: esp_at: rename driver from esp

Recently WiFi ESP32 driver (utilizing WiFi radio in ESP32 SoC) was
introduced into drivers/wifi/esp32/ and it already caused confusion as
there was existing drivers/wifi/esp/ directory for ESP-AT
driver (utilizing external WiFi chip, by communicating using AT commands
from any serial capable platform). So question has arisen whether it is
good to merge both, while they are totally different drivers.

Rename ESP-AT driver to be placed in drivers/wifi/esp_at/, so that it is
easier to figure out difference between "esp32" and "esp_at" just by
looking at driver name. Rename also DT compatible and all Kconfig
options for the same reason.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
Marcin Niestroj 2021-05-06 10:51:46 +02:00 committed by Anas Nashif
commit b4854debd1
15 changed files with 65 additions and 61 deletions

View file

@ -327,7 +327,7 @@
/drivers/watchdog/wdt_handlers.c @dcpleung @nashif
/drivers/watchdog/*cc32xx* @pavlohamov
/drivers/wifi/ @jukkar @tbursztyka @pfalcon
/drivers/wifi/esp/ @mniestroj
/drivers/wifi/esp_at/ @mniestroj
/drivers/wifi/eswifi/ @loicpoulain @nandojve
/drivers/wifi/winc1500/ @kludentwo
/drivers/virtualization/ @tbursztyka
@ -385,7 +385,7 @@
/dts/bindings/adc/st*stm32-adc.yaml @cybertale
/dts/bindings/modem/*hl7800.yaml @rerickson1
/dts/bindings/serial/ns16550.yaml @dcpleung @nashif
/dts/bindings/wifi/*esp.yaml @mniestroj
/dts/bindings/wifi/*esp-at.yaml @mniestroj
/dts/bindings/*/*npcx* @MulinChao @WealianLiao @ChiHuaL
/dts/bindings/*/*psoc6* @nandojve
/dts/bindings/*/nordic* @anangl

View file

@ -84,7 +84,7 @@
txpo = <0>;
nina_prog {
compatible = "espressif,esp";
compatible = "espressif,esp-at";
label = "NINA_PROG";
reset-gpios = <&porta 8 GPIO_ACTIVE_LOW>;
};

View file

@ -7,13 +7,13 @@ if SHIELD_ESP_8266 || \
if NETWORKING
config WIFI_ESP
config WIFI_ESP_AT
default y
depends on WIFI
choice WIFI_ESP_AT_VERSION
default WIFI_ESP_AT_VERSION_1_7
depends on WIFI_ESP
depends on WIFI_ESP_AT
endchoice
orsource "boards/*.defconfig"

View file

@ -11,7 +11,7 @@
pinctrl-0 = <&pa21a_usart1_rxd1 &pa22a_usart1_txd1>;
esp8266 {
compatible = "espressif,esp";
compatible = "espressif,esp-at";
label = "esp8266";
status = "okay";
};

View file

@ -9,7 +9,7 @@
current-speed = <115200>;
esp8266 {
compatible = "espressif,esp";
compatible = "espressif,esp-at";
label = "esp8266";
status = "okay";
};

View file

@ -9,7 +9,7 @@
current-speed = <115200>;
esp8266 {
compatible = "espressif,esp";
compatible = "espressif,esp-at";
label = "esp8266";
status = "okay";
};

View file

@ -3,5 +3,5 @@
add_subdirectory_ifdef(CONFIG_WIFI_WINC1500 winc1500)
add_subdirectory_ifdef(CONFIG_WIFI_SIMPLELINK simplelink)
add_subdirectory_ifdef(CONFIG_WIFI_ESWIFI eswifi)
add_subdirectory_ifdef(CONFIG_WIFI_ESP esp)
add_subdirectory_ifdef(CONFIG_WIFI_ESP_AT esp_at)
add_subdirectory_ifdef(CONFIG_WIFI_ESP32 esp32)

View file

@ -32,7 +32,7 @@ config WIFI_OFFLOAD
source "drivers/wifi/winc1500/Kconfig.winc1500"
source "drivers/wifi/simplelink/Kconfig.simplelink"
source "drivers/wifi/eswifi/Kconfig.eswifi"
source "drivers/wifi/esp/Kconfig.esp"
source "drivers/wifi/esp_at/Kconfig.esp_at"
source "drivers/wifi/esp32/Kconfig.esp32"
endif # WIFI

View file

@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_WIFI_ESP)
if(CONFIG_WIFI_ESP_AT)
zephyr_library_include_directories(
${ZEPHYR_BASE}/drivers/modem

View file

@ -1,30 +1,34 @@
# Copyright (c) 2019 Tobias Svehagen
# SPDX-License-Identifier: Apache-2.0
menuconfig WIFI_ESP
bool "Espressif ESP8266 and ESP32 support"
menuconfig WIFI_ESP_AT
bool "Espressif AT Command support"
select MODEM
select MODEM_CONTEXT
select MODEM_CMD_HANDLER
select MODEM_IFACE_UART
select NET_L2_WIFI_MGMT
select WIFI_OFFLOAD
help
Enable Espressif AT Command offloaded WiFi driver. It is supported on
any serial capable platform and communicates with Espressif chips
running ESP-AT firmware (https://github.com/espressif/esp-at).
if WIFI_ESP
if WIFI_ESP_AT
config WIFI_ESP_RX_STACK_SIZE
config WIFI_ESP_AT_RX_STACK_SIZE
int "Stack size for the Espressif esp wifi driver RX thread"
default 1024
help
This stack is used by the Espressif ESP RX thread.
config WIFI_ESP_RX_THREAD_PRIORITY
config WIFI_ESP_AT_RX_THREAD_PRIORITY
int "Priority of RX thread"
default 7
help
Priority of thread used for processing RX data.
config WIFI_ESP_WORKQ_STACK_SIZE
config WIFI_ESP_AT_WORKQ_STACK_SIZE
int "Stack size for the esp driver work queue"
default 2048
help
@ -32,38 +36,38 @@ config WIFI_ESP_WORKQ_STACK_SIZE
to the rest of the network stack, letting the rx thread continue
processing data.
config WIFI_ESP_WORKQ_THREAD_PRIORITY
config WIFI_ESP_AT_WORKQ_THREAD_PRIORITY
int "Priority of work queue thread"
default 7
help
Priority of thread used for processing driver work queue items.
config WIFI_ESP_MDM_RING_BUF_SIZE
config WIFI_ESP_AT_MDM_RING_BUF_SIZE
int "Modem ring buffer size"
default 1024
help
Ring buffer size used by modem UART interface handler.
config WIFI_ESP_MDM_RX_BUF_COUNT
config WIFI_ESP_AT_MDM_RX_BUF_COUNT
int "Modem RX buffer count"
default 30
help
Number of preallocated RX buffers used by modem command handler.
config WIFI_ESP_MDM_RX_BUF_SIZE
config WIFI_ESP_AT_MDM_RX_BUF_SIZE
int "Modem RX buffer size"
default 128
help
Size of preallocated RX buffers used by modem command handler.
config WIFI_ESP_PASSIVE_MODE
config WIFI_ESP_AT_PASSIVE_MODE
bool "Use passive mode"
help
This lets the ESP handle the TCP window so that data can flow
at a rate that the driver can handle. Without this, data might get
lost if the driver cannot empty the device buffer quickly enough.
config WIFI_ESP_RESET_TIMEOUT
config WIFI_ESP_AT_RESET_TIMEOUT
int "Reset timeout"
default 3000
help
@ -71,7 +75,7 @@ config WIFI_ESP_RESET_TIMEOUT
sent. This can vary with chipset (ESP8266/ESP32) and firmware
version. This is ignored if a reset pin is configured.
config WIFI_ESP_RX_NET_PKT_ALLOC_TIMEOUT
config WIFI_ESP_AT_RX_NET_PKT_ALLOC_TIMEOUT
int "Network interface RX packet allocation timeout"
default 5000
help
@ -79,32 +83,32 @@ config WIFI_ESP_RX_NET_PKT_ALLOC_TIMEOUT
choice
prompt "ESP IP Address configuration"
default WIFI_ESP_IP_DHCP
default WIFI_ESP_AT_IP_DHCP
help
Choose whether to use an IP assigned by DHCP Server or
configure a static IP Address.
config WIFI_ESP_IP_DHCP
config WIFI_ESP_AT_IP_DHCP
bool "DHCP"
help
Use DHCP to get an IP Address.
config WIFI_ESP_IP_STATIC
config WIFI_ESP_AT_IP_STATIC
bool "Static"
help
Setup Static IP Address.
endchoice
if WIFI_ESP_IP_STATIC
if WIFI_ESP_AT_IP_STATIC
config WIFI_ESP_IP_ADDRESS
config WIFI_ESP_AT_IP_ADDRESS
string "ESP Station mode IP Address"
config WIFI_ESP_IP_GATEWAY
config WIFI_ESP_AT_IP_GATEWAY
string "Gateway Address"
config WIFI_ESP_IP_MASK
config WIFI_ESP_AT_IP_MASK
string "Network Mask"
endif
@ -127,11 +131,11 @@ config WIFI_ESP_AT_VERSION_2_0
endchoice
config WIFI_ESP_DNS_USE
config WIFI_ESP_AT_DNS_USE
bool "Use DNS from ESP"
depends on DNS_RESOLVER
help
Fetch DNS servers from ESP chip with AT+CIPDNS? command and apply that
list to system DNS resolver.
endif # WIFI_ESP
endif # WIFI_ESP_AT

View file

@ -5,10 +5,10 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT espressif_esp
#define DT_DRV_COMPAT espressif_esp_at
#include <logging/log.h>
LOG_MODULE_REGISTER(wifi_esp, CONFIG_WIFI_LOG_LEVEL);
LOG_MODULE_REGISTER(wifi_esp_at, CONFIG_WIFI_LOG_LEVEL);
#include <kernel.h>
#include <ctype.h>
@ -58,12 +58,12 @@ NET_BUF_POOL_DEFINE(mdm_recv_pool, MDM_RECV_MAX_BUF, MDM_RECV_BUF_SIZE,
/* RX thread structures */
K_KERNEL_STACK_DEFINE(esp_rx_stack,
CONFIG_WIFI_ESP_RX_STACK_SIZE);
CONFIG_WIFI_ESP_AT_RX_STACK_SIZE);
struct k_thread esp_rx_thread;
/* RX thread work queue */
K_KERNEL_STACK_DEFINE(esp_workq_stack,
CONFIG_WIFI_ESP_WORKQ_STACK_SIZE);
CONFIG_WIFI_ESP_AT_WORKQ_STACK_SIZE);
struct esp_data esp_driver_data;
@ -441,13 +441,13 @@ static void esp_ip_addr_work(struct k_work *work)
/* update interface addresses */
net_if_ipv4_set_gw(dev->net_iface, &dev->gw);
net_if_ipv4_set_netmask(dev->net_iface, &dev->nm);
#if defined(CONFIG_WIFI_ESP_IP_STATIC)
#if defined(CONFIG_WIFI_ESP_AT_IP_STATIC)
net_if_ipv4_addr_add(dev->net_iface, &dev->ip, NET_ADDR_MANUAL, 0);
#else
net_if_ipv4_addr_add(dev->net_iface, &dev->ip, NET_ADDR_DHCP, 0);
#endif
if (IS_ENABLED(CONFIG_WIFI_ESP_DNS_USE)) {
if (IS_ENABLED(CONFIG_WIFI_ESP_AT_DNS_USE)) {
ret = esp_cmd_send(dev, dns_cmds, ARRAY_SIZE(dns_cmds),
"AT+CIPDNS?", ESP_CMD_TIMEOUT);
if (ret) {
@ -913,12 +913,12 @@ static void esp_init_work(struct k_work *work)
#if defined(CONFIG_WIFI_ESP_AT_VERSION_1_7)
SETUP_CMD_NOHANDLE(ESP_CMD_CWMODE(STA)),
#endif
#if defined(CONFIG_WIFI_ESP_IP_STATIC)
#if defined(CONFIG_WIFI_ESP_AT_IP_STATIC)
/* enable Static IP Config */
SETUP_CMD_NOHANDLE(ESP_CMD_DHCP_ENABLE(STATION, 0)),
SETUP_CMD_NOHANDLE(ESP_CMD_SET_IP(CONFIG_WIFI_ESP_IP_ADDRESS,
CONFIG_WIFI_ESP_IP_GATEWAY,
CONFIG_WIFI_ESP_IP_MASK)),
SETUP_CMD_NOHANDLE(ESP_CMD_SET_IP(CONFIG_WIFI_ESP_AT_IP_ADDRESS,
CONFIG_WIFI_ESP_AT_IP_GATEWAY,
CONFIG_WIFI_ESP_AT_IP_MASK)),
#else
/* enable DHCP */
SETUP_CMD_NOHANDLE(ESP_CMD_DHCP_ENABLE(STATION, 1)),
@ -932,7 +932,7 @@ static void esp_init_work(struct k_work *work)
SETUP_CMD_NOHANDLE("AT+CWAUTOCONN=0"),
SETUP_CMD_NOHANDLE(ESP_CMD_CWMODE(NONE)),
#endif
#if defined(CONFIG_WIFI_ESP_PASSIVE_MODE)
#if defined(CONFIG_WIFI_ESP_AT_PASSIVE_MODE)
SETUP_CMD_NOHANDLE("AT+CIPRECVMODE=1"),
#endif
SETUP_CMD("AT+"_CIPSTAMAC"?", "+"_CIPSTAMAC":",
@ -1023,7 +1023,7 @@ static void esp_reset(struct esp_data *dev)
while (retries--) {
ret = modem_cmd_send(&dev->mctx.iface, &dev->mctx.cmd_handler,
NULL, 0, "AT+RST", &dev->sem_if_ready,
K_MSEC(CONFIG_WIFI_ESP_RESET_TIMEOUT));
K_MSEC(CONFIG_WIFI_ESP_AT_RESET_TIMEOUT));
if (ret == 0 || ret != -ETIMEDOUT) {
break;
}
@ -1070,7 +1070,7 @@ static int esp_init(const struct device *dev)
k_work_init(&data->scan_work, esp_mgmt_scan_work);
k_work_init(&data->connect_work, esp_mgmt_connect_work);
k_work_init(&data->mode_switch_work, esp_mode_switch_work);
if (IS_ENABLED(CONFIG_WIFI_ESP_DNS_USE)) {
if (IS_ENABLED(CONFIG_WIFI_ESP_AT_DNS_USE)) {
k_work_init(&data->dns_work, esp_dns_work);
}
@ -1079,7 +1079,7 @@ static int esp_init(const struct device *dev)
/* initialize the work queue */
k_work_queue_start(&data->workq, esp_workq_stack,
K_KERNEL_STACK_SIZEOF(esp_workq_stack),
K_PRIO_COOP(CONFIG_WIFI_ESP_WORKQ_THREAD_PRIORITY),
K_PRIO_COOP(CONFIG_WIFI_ESP_AT_WORKQ_THREAD_PRIORITY),
NULL);
k_thread_name_set(&data->workq.thread, "esp_workq");
@ -1126,7 +1126,7 @@ static int esp_init(const struct device *dev)
K_KERNEL_STACK_SIZEOF(esp_rx_stack),
(k_thread_entry_t)esp_rx,
data, NULL, NULL,
K_PRIO_COOP(CONFIG_WIFI_ESP_RX_THREAD_PRIORITY), 0,
K_PRIO_COOP(CONFIG_WIFI_ESP_AT_RX_THREAD_PRIORITY), 0,
K_NO_WAIT);
k_thread_name_set(&esp_rx_thread, "esp_rx");

View file

@ -5,8 +5,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_DRIVERS_WIFI_ESP_H_
#define ZEPHYR_INCLUDE_DRIVERS_WIFI_ESP_H_
#ifndef ZEPHYR_INCLUDE_DRIVERS_WIFI_ESP_AT_ESP_H_
#define ZEPHYR_INCLUDE_DRIVERS_WIFI_ESP_AT_ESP_H_
#include <kernel.h>
#include <net/net_context.h>
@ -48,7 +48,7 @@ extern "C" {
* passive mode. For AT version 1.7 passive mode only affects TCP but in AT
* version 2.0 it affects both TCP and UDP.
*/
#if defined(CONFIG_WIFI_ESP_PASSIVE_MODE)
#if defined(CONFIG_WIFI_ESP_AT_PASSIVE_MODE)
#if defined(CONFIG_WIFI_ESP_AT_VERSION_1_7)
#define ESP_PROTO_PASSIVE(proto) (proto == IPPROTO_TCP)
#else
@ -57,7 +57,7 @@ extern "C" {
#endif /* CONFIG_WIFI_ESP_AT_VERSION_1_7 */
#else
#define ESP_PROTO_PASSIVE(proto) 0
#endif /* CONFIG_WIFI_ESP_PASSIVE_MODE */
#endif /* CONFIG_WIFI_ESP_AT_PASSIVE_MODE */
#define ESP_BUS DT_BUS(DT_DRV_INST(0))
@ -79,7 +79,7 @@ extern "C" {
#define CONN_CMD_MAX_LEN (sizeof("AT+"_CWJAP"=\"\",\"\"") + \
WIFI_SSID_MAX_LEN + WIFI_PSK_MAX_LEN)
#if defined(CONFIG_WIFI_ESP_DNS_USE)
#if defined(CONFIG_WIFI_ESP_AT_DNS_USE)
#define ESP_MAX_DNS MIN(3, CONFIG_DNS_RESOLVER_MAX_SERVERS)
#else
#define ESP_MAX_DNS 0
@ -93,9 +93,9 @@ extern "C" {
#define INVALID_LINK_ID 255
#define MDM_RING_BUF_SIZE CONFIG_WIFI_ESP_MDM_RING_BUF_SIZE
#define MDM_RECV_MAX_BUF CONFIG_WIFI_ESP_MDM_RX_BUF_COUNT
#define MDM_RECV_BUF_SIZE CONFIG_WIFI_ESP_MDM_RX_BUF_SIZE
#define MDM_RING_BUF_SIZE CONFIG_WIFI_ESP_AT_MDM_RING_BUF_SIZE
#define MDM_RECV_MAX_BUF CONFIG_WIFI_ESP_AT_MDM_RX_BUF_COUNT
#define MDM_RECV_BUF_SIZE CONFIG_WIFI_ESP_AT_MDM_RX_BUF_SIZE
#define ESP_CMD_TIMEOUT K_SECONDS(10)
#define ESP_SCAN_TIMEOUT K_SECONDS(10)
@ -383,4 +383,4 @@ void esp_close_work(struct k_work *work);
}
#endif
#endif /* ZEPHYR_INCLUDE_DRIVERS_WIFI_ESP_H_ */
#endif /* ZEPHYR_INCLUDE_DRIVERS_WIFI_ESP_AT_ESP_H_ */

View file

@ -6,7 +6,7 @@
*/
#include <logging/log.h>
LOG_MODULE_REGISTER(wifi_esp_offload, CONFIG_WIFI_LOG_LEVEL);
LOG_MODULE_REGISTER(wifi_esp_at_offload, CONFIG_WIFI_LOG_LEVEL);
#include <zephyr.h>
#include <kernel.h>

View file

@ -8,10 +8,10 @@
#include "esp.h"
#include <logging/log.h>
LOG_MODULE_DECLARE(wifi_esp, CONFIG_WIFI_LOG_LEVEL);
LOG_MODULE_DECLARE(wifi_esp_at, CONFIG_WIFI_LOG_LEVEL);
#define RX_NET_PKT_ALLOC_TIMEOUT \
K_MSEC(CONFIG_WIFI_ESP_RX_NET_PKT_ALLOC_TIMEOUT)
K_MSEC(CONFIG_WIFI_ESP_AT_RX_NET_PKT_ALLOC_TIMEOUT)
struct esp_workq_flush_data {
struct k_work work;

View file

@ -3,7 +3,7 @@
description: Espressif ESP8266/ESP32 WiFi modem (AT Commands)
compatible: "espressif,esp"
compatible: "espressif,esp-at"
include: uart-device.yaml