esp32s3/wifi: add support for Wi-Fi (Station mode)

1) Wi-Fi driver libs from Espressif ESP-IDF release/v5.0;
2) Station mode only;
3) WPA2-PSK and WPA3-SAE enabled;

Not yet supported (WIP):
- SoftAP mode;
- 802.11k, 802.11v and 802.11R;
- Power Save mode;
- BLE Coexistance;
This commit is contained in:
Tiago Medicci Serrano
2023-02-08 09:43:29 -03:00
committed by Petro Karashchenko
parent 1fc73087da
commit 8f2cdc4e60
23 changed files with 10604 additions and 2 deletions
+1
View File
@@ -452,6 +452,7 @@
#define ESP32S3_CPUINT_NMISET 0x00004000
#define ESP32S3_CPUINT_MAC 0
#define ESP32S3_CPUINT_MAC_NMI 1
#define ESP32S3_CPUINT_TIMER0 6
#define ESP32S3_CPUINT_SOFTWARE0 7
#define ESP32S3_CPUINT_PROFILING 11
+1
View File
@@ -1 +1,2 @@
/esp-nuttx-bootloader
/esp-wireless-drivers-3rdparty
+170
View File
@@ -334,6 +334,24 @@ config ESP32S3_UART2
select UART2_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
config ESP32S3_WIRELESS
bool
default n
select NET
select ARCH_PHY_INTERRUPT
select ESP32S3_RNG
select ESP32S3_RT_TIMER
select ESP32S3_TIMER0
---help---
Enable Wireless support
config ESP32S3_WIFI
bool "Wi-Fi"
default n
select ESP32S3_WIRELESS
---help---
Enable Wi-Fi support
config ESP32S3_I2C0
bool "I2C 0"
default n
@@ -770,6 +788,158 @@ config ESP32S3_I2CTIMEOMS
endmenu # I2C Configuration
menu "Wi-Fi Configuration"
depends on ESP32S3_WIFI
menu "ESP WPA-Supplicant"
config WPA_WAPI_PSK
bool "Enable WAPI PSK support"
default n
---help---
Select this option to enable WAPI-PSK
which is a Chinese National Standard Encryption for Wireless LANs (GB 15629.11-2003).
config WPA_SUITE_B_192
bool "Enable NSA suite B support with 192-bit key"
default n
select ESP_WIFI_GCMP_SUPPORT
select ESP_WIFI_GMAC_SUPPORT
---help---
Select this option to enable 192-bit NSA suite-B.
This is necessary to support WPA3 192-bit security.
config ESP_WPA_DEBUG_PRINT
bool "Print debug messages from Espressif's WPA Supplicant"
default n
---help---
Select this option to print logging information from WPA supplicant,
this includes handshake information and key hex dumps depending
on the project logging level.
Enabling this could increase the build size ~60kb
depending on the project logging level.
endmenu # ESP WPA-Supplicant
choice
prompt "ESP32S3 Wi-Fi mode"
default ESP32S3_WIFI_STATION
config ESP32S3_WIFI_STATION
bool "Station mode"
endchoice # ESP32S3 Wi-Fi mode
config ESP32S3_WIFI_STATIC_RXBUF_NUM
int "Wi-Fi static RX buffer number"
default 10
config ESP32S3_WIFI_DYNAMIC_RXBUF_NUM
int "Wi-Fi dynamic RX buffer number"
default 32
config ESP32S3_WIFI_DYNAMIC_TXBUF_NUM
int "Wi-Fi dynamic TX buffer number"
default 32
config ESP32S3_WIFI_TX_AMPDU
bool "Wi-Fi TX AMPDU"
default y
config ESP32S3_WIFI_RX_AMPDU
bool "Wi-Fi RX AMPDU"
default y
config ESP32S3_WIFI_RXBA_AMPDU_WZ
int "Wi-Fi RX BA AMPDU windown size"
default 6
config ESP_WIFI_GCMP_SUPPORT
bool "WiFi GCMP Support(GCMP128 and GCMP256)"
default n
---help---
Select this option to enable GCMP support. GCMP support is compulsory for WiFi Suite-B support.
config ESP_WIFI_GMAC_SUPPORT
bool "WiFi GMAC Support(GMAC128 and GMAC256)"
default n
---help---
Select this option to enable GMAC support. GMAC support is compulsory for WiFi 192-bit certification.
config ESP32S3_WIFI_CONNECT_TIMEOUT
int "Connect timeout in second"
default 10
---help---
Max waiting time of connecting to AP.
config ESP32S3_WIFI_SCAN_RESULT_SIZE
int "Scan result buffer"
default 4096
---help---
Maximum scan result buffer size.
config ESP32S3_WIFI_SAVE_PARAM
bool "Save Wi-Fi Parameters"
default n
depends on ESP32S3_SPIFLASH
---help---
If you enable this option, Wi-Fi adapter parameters will be saved
into the file system instead of computing them each time.
These parameters mainly contains:
- SSID
- Password
- BSSID
- PMK(compute when connecting)
- Author mode
- MAC address
- Wi-Fi hardware configuration parameters
config ESP32S3_WIFI_FS_MOUNTPT
string "Wi-Fi parameters mount point"
default "/mnt/esp/wifi"
depends on ESP32S3_WIFI_SAVE_PARAM
---help---
Mount point of Wi-Fi storage file system.
config ESP32S3_WIFI_MTD_ENCRYPT
bool "Encrypt Wi-Fi MTD partition"
default y
depends on ESP32S3_SECURE_FLASH_ENC_ENABLED
config ESP32S3_WIFI_MTD_OFFSET
hex "Wi-Fi MTD partition offset"
default 0x280000 if !ESP32S3_HAVE_OTA_PARTITION
default 0x350000 if ESP32S3_HAVE_OTA_PARTITION
depends on ESP32S3_WIFI_SAVE_PARAM
---help---
This is the base address of the Wi-Fi MTD partition.
config ESP32S3_WIFI_MTD_SIZE
hex "Wi-Fi MTD partition size"
default 0xb0000
depends on ESP32S3_WIFI_SAVE_PARAM
---help---
This is the size of the Wi-Fi MTD partition.
config ESP32S3_WIFI_STA_DISCONNECT_PM
bool "Power Management for station when disconnected"
default n
---help---
Select this option to enable power management for station when disconnected.
Chip will do modem-sleep when RF module is not in use anymore.
config EXAMPLE_WIFI_LISTEN_INTERVAL
int "Wi-Fi listen interval"
default 3
---help---
Interval for station to listen to beacon from AP. The unit of listen interval is one beacon interval.
For example, if beacon interval is 100 ms and listen interval is 3, the interval for station to listen
to beacon is 300 ms.
endmenu # ESP32S3_WIFI
menu "Timer/Counter Configuration"
depends on ESP32S3_TIMER
+219
View File
@@ -125,3 +125,222 @@ ifeq ($(CONFIG_ESP32S3_TOUCH),y)
CHIP_CSRCS += esp32s3_touch.c
endif
ifeq ($(CONFIG_ESP32S3_WIRELESS),y)
WIRELESS_DRV_REPO = esp-wireless-drivers-3rdparty
WIRELESS_DRV_BRANCH = release/v2.0
WIRELESS_DRV_URL = https://github.com/espressif/esp-wireless-drivers-3rdparty.git
WIRELESS_DRV_PATH = $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(WIRELESS_DRV_REPO)
chip/$(WIRELESS_DRV_REPO):
$(Q) echo "Cloning: ESP Wireless Drivers"
$(Q) git clone --depth=1 --branch $(WIRELESS_DRV_BRANCH) $(WIRELESS_DRV_URL) chip/$(WIRELESS_DRV_REPO)
context:: chip/$(WIRELESS_DRV_REPO)
$(Q) echo "ESP Wireless Drivers: ${WIRELESS_DRV_BRANCH}"
$(Q) git -C chip/$(WIRELESS_DRV_REPO)/esp-idf reset --hard
$(Q) echo "ESP Wireless Drivers: initialize submodule esp-idf"
$(Q) git -C chip/$(WIRELESS_DRV_REPO) submodule update --init --depth=1 esp-idf
$(Q) echo "ESP Wireless Drivers: initialize submodule mbedtls, esp_phy and esp_phy from esp-idf"
$(Q) git -C chip/$(WIRELESS_DRV_REPO)/esp-idf submodule update --init --depth=1 components/mbedtls/mbedtls components/esp_phy/lib components/esp_wifi/lib
$(Q) git -C chip/$(WIRELESS_DRV_REPO)/esp-idf/components/mbedtls/mbedtls reset --hard
$(Q) echo "ESP Wireless Drivers: apply patches for NuttX"
$(Q) cd chip/$(WIRELESS_DRV_REPO)/esp-idf && git apply ../nuttx/patches/esp-idf/*.patch
$(Q) cd chip/$(WIRELESS_DRV_REPO)/esp-idf/components/mbedtls/mbedtls && git apply ../../../../nuttx/patches/esp-idf/submodules/mbedtls/*.patch
distclean::
$(call DELDIR, chip/$(WIRELESS_DRV_REPO))
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)nuttx$(DELIM)include$(DELIM)esp32s3)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_wifi$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_phy$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_phy$(DELIM)esp32s3$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_common$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_event$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)nvs_flash$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_system$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_hw_support$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_timer$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_rom$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_rom$(DELIM)include$(DELIM)esp32s3)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)soc$(DELIM)esp32s3$(DELIM)include)
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_phy$(DELIM)lib$(DELIM)esp32s3
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)esp_wifi$(DELIM)lib$(DELIM)esp32s3
EXTRA_LIBS += -lphy
# Wireless interfaces.
CHIP_CSRCS += esp32s3_wireless.c
endif
ifeq ($(CONFIG_ESP32S3_WIFI),y)
CHIP_CSRCS += esp32s3_wlan.c esp32s3_wifi_utils.c esp32s3_wifi_adapter.c
EXTRA_LIBS += -lcore -lnet80211 -lpp
ifeq ($(CONFIG_WPA_WAPI_PSK),y)
EXTRA_LIBS += -lwapi
endif
## ESP-IDF's mbedTLS
VPATH += chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)mbedtls$(DELIM)mbedtls$(DELIM)library
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)mbedtls$(DELIM)mbedtls$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)mbedtls$(DELIM)mbedtls$(DELIM)library)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)mbedtls$(DELIM)port$(DELIM)include)
### Define Espressif's configs for mbedTLS
CFLAGS += ${DEFINE_PREFIX}MBEDTLS_CONFIG_FILE="<mbedtls/esp_config.h>"
CHIP_CSRCS += aes.c
CHIP_CSRCS += bignum.c
CHIP_CSRCS += constant_time.c
CHIP_CSRCS += ctr_drbg.c
CHIP_CSRCS += ecp.c
CHIP_CSRCS += ecp_curves.c
CHIP_CSRCS += entropy.c
CHIP_CSRCS += md.c
CHIP_CSRCS += pkcs5.c
CHIP_CSRCS += platform.c
CHIP_CSRCS += platform_util.c
CHIP_CSRCS += sha1.c
CHIP_CSRCS += sha256.c
CHIP_CSRCS += sha512.c
VPATH += chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)mbedtls$(DELIM)port
CHIP_CSRCS += esp_hardware.c
CHIP_CSRCS += esp_mem.c
CHIP_CSRCS += esp_timing.c
VPATH += chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)esp-idf$(DELIM)components$(DELIM)mbedtls$(DELIM)port$(DELIM)md
CHIP_CSRCS += esp_md.c
## WPA Supplicant
WIFI_WPA_SUPPLICANT = chip$(DELIM)$(WIRELESS_DRV_REPO)$(DELIM)esp-idf$(DELIM)components$(DELIM)wpa_supplicant
CFLAGS += ${DEFINE_PREFIX}CONFIG_CRYPTO_MBEDTLS
CFLAGS += ${DEFINE_PREFIX}CONFIG_ECC
CFLAGS += ${DEFINE_PREFIX}CONFIG_IEEE80211W
CFLAGS += ${DEFINE_PREFIX}CONFIG_WPA3_SAE
CFLAGS += ${DEFINE_PREFIX}EAP_PEER_METHOD
CFLAGS += ${DEFINE_PREFIX}ESPRESSIF_USE
CFLAGS += ${DEFINE_PREFIX}ESP_PLATFORM
CFLAGS += ${DEFINE_PREFIX}ESP_SUPPLICANT
CFLAGS += ${DEFINE_PREFIX}IEEE8021X_EAPOL
CFLAGS += ${DEFINE_PREFIX}USE_WPA2_TASK
CFLAGS += ${DEFINE_PREFIX}__ets__
ifeq ($(CONFIG_ESP_WIFI_GCMP_SUPPORT),y)
CFLAGS += ${DEFINE_PREFIX}CONFIG_GCMP
endif
ifeq ($(CONFIG_ESP_WIFI_GMAC_SUPPORT),y)
CFLAGS += ${DEFINE_PREFIX}CONFIG_GMAC
endif
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)include)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)src)
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)ap
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)ap)
CHIP_CSRCS += ap_config.c
CHIP_CSRCS += sta_info.c
CHIP_CSRCS += wpa_auth.c
CHIP_CSRCS += wpa_auth_ie.c
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)common
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)common)
CHIP_CSRCS += dragonfly.c
CHIP_CSRCS += sae.c
CHIP_CSRCS += wpa_common.c
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)crypto
CHIP_CSRCS += aes-ccm.c
CHIP_CSRCS += aes-gcm.c
CHIP_CSRCS += aes-omac1.c
CHIP_CSRCS += aes-unwrap.c
CHIP_CSRCS += aes-wrap.c
CHIP_CSRCS += ccmp.c
CHIP_CSRCS += crypto_ops.c
CHIP_CSRCS += des-internal.c
CHIP_CSRCS += dh_groups.c
CHIP_CSRCS += rc4.c
CHIP_CSRCS += sha1-prf.c
CHIP_CSRCS += sha256-kdf.c
CHIP_CSRCS += sha256-prf.c
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)eap_peer
CHIP_CSRCS += chap.c
CHIP_CSRCS += eap.c
CHIP_CSRCS += eap_common.c
CHIP_CSRCS += eap_mschapv2.c
CHIP_CSRCS += eap_peap.c
CHIP_CSRCS += eap_peap_common.c
CHIP_CSRCS += eap_tls.c
CHIP_CSRCS += eap_tls_common.c
CHIP_CSRCS += eap_ttls.c
CHIP_CSRCS += mschapv2.c
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)rsn_supp
CHIP_CSRCS += pmksa_cache.c
CHIP_CSRCS += wpa.c
CHIP_CSRCS += wpa_ie.c
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)utils
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)utils)
CHIP_CSRCS += base64.c
CHIP_CSRCS += bitfield.c
CHIP_CSRCS += common.c
CHIP_CSRCS += ext_password.c
CHIP_CSRCS += json.c
CHIP_CSRCS += uuid.c
CHIP_CSRCS += wpa_debug.c
CHIP_CSRCS += wpabuf.c
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)port
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)port$(DELIM)include)
CHIP_CSRCS += eloop.c
CHIP_CSRCS += os_xtensa.c
## ESP Supplicant (Espressif's WPA supplicant extension)
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)esp_supplicant$(DELIM)include)
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)esp_supplicant$(DELIM)src
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)esp_supplicant$(DELIM)src)
CHIP_CSRCS += esp_common.c
CHIP_CSRCS += esp_hostap.c
CHIP_CSRCS += esp_wpa2.c
CHIP_CSRCS += esp_wpa3.c
CHIP_CSRCS += esp_wpa_main.c
CHIP_CSRCS += esp_wpas_glue.c
VPATH += $(WIFI_WPA_SUPPLICANT)$(DELIM)esp_supplicant$(DELIM)src$(DELIM)crypto
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(WIFI_WPA_SUPPLICANT)$(DELIM)src$(DELIM)crypto)
CHIP_CSRCS += crypto_mbedtls.c
CHIP_CSRCS += crypto_mbedtls-bignum.c
CHIP_CSRCS += crypto_mbedtls-ec.c
CHIP_CSRCS += crypto_mbedtls-rsa.c
CHIP_CSRCS += tls_mbedtls.c
endif
+20 -1
View File
@@ -107,6 +107,12 @@
#define ESP32S3_MAX_PRIORITY 5
#define ESP32S3_PRIO_INDEX(p) ((p) - ESP32S3_MIN_PRIORITY)
#ifdef CONFIG_ESP32S3_WIFI
# define ESP32S3_WIFI_RESERVE_INT (1 << ESP32S3_CPUINT_MAC)
#else
# define ESP32S3_WIFI_RESERVE_INT 0
#endif
/****************************************************************************
* Public Data
****************************************************************************/
@@ -152,7 +158,9 @@ static uint32_t g_intenable[CONFIG_SMP_NCPUS];
* devices.
*/
static uint32_t g_cpu0_freeints = ESP32S3_CPUINT_PERIPHSET;
static uint32_t g_cpu0_freeints = ESP32S3_CPUINT_PERIPHSET &
~ESP32S3_WIFI_RESERVE_INT;
#ifdef CONFIG_SMP
static uint32_t g_cpu1_freeints = ESP32S3_CPUINT_PERIPHSET;
#endif
@@ -425,10 +433,21 @@ void up_irqinitialize(void)
g_irqmap[XTENSA_IRQ_SWINT] = IRQ_MKMAP(0, ESP32S3_CPUINT_SOFTWARE1);
g_irqmap[XTENSA_IRQ_SWINT] = IRQ_MKMAP(1, ESP32S3_CPUINT_SOFTWARE1);
#ifdef CONFIG_ESP32S3_WIFI
g_irqmap[ESP32S3_IRQ_MAC] = IRQ_MKMAP(0, ESP32S3_CPUINT_MAC);
#endif
/* Initialize CPU interrupts */
esp32s3_cpuint_initialize();
/* Reserve CPU0 interrupt for some special drivers */
#ifdef CONFIG_ESP32S3_WIFI
g_cpu0_intmap[ESP32S3_CPUINT_MAC] = CPUINT_ASSIGN(ESP32S3_IRQ_MAC);
xtensa_enable_cpuint(&g_intenable[0], 1 << ESP32S3_CPUINT_MAC);
#endif
#ifdef CONFIG_SMP
/* Attach and enable the inter-CPU interrupt */
+1 -1
View File
@@ -220,7 +220,7 @@ void devrandom_register(void)
#ifdef CONFIG_DEV_URANDOM_ARCH
void devurandom_register(void)
{
register_driver("dev/urandom", &g_rngops, 0444, NULL);
register_driver("/dev/urandom", &g_rngops, 0444, NULL);
}
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,104 @@
/****************************************************************************
* arch/xtensa/src/esp32s3/esp32s3_wifi_utils.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#ifndef __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WIFI_UTILS_H
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WIFI_UTILS_H
#include <nuttx/config.h>
#include <nuttx/net/netdev.h>
#ifndef __ASSEMBLY__
#include <stdint.h>
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp_wifi_start_scan
*
* Description:
* Scan all available APs.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_start_scan(struct iwreq *iwr);
/****************************************************************************
* Name: esp_wifi_get_scan_results
*
* Description:
* Get scan result
*
* Input Parameters:
* req The argument of the ioctl cmd
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_get_scan_results(struct iwreq *iwr);
/****************************************************************************
* Name: esp_wifi_scan_event_parse
*
* Description:
* Parse scan information
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp_wifi_scan_event_parse(void);
#ifdef __cplusplus
}
#endif
#undef EXTERN
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WIFI_UTILS_H */
+427
View File
@@ -0,0 +1,427 @@
/****************************************************************************
* arch/xtensa/src/esp32s3/esp32s3_wireless.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/kmalloc.h>
#include <debug.h>
#include <assert.h>
#include "xtensa.h"
#include "hardware/esp32s3_soc.h"
#include "hardware/esp32s3_syscon.h"
#include "hardware/esp32s3_efuse.h"
#include "esp32s3_wireless.h"
#include "esp_phy_init.h"
#include "phy_init_data.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define MAC_ADDR0_REG EFUSE_RD_MAC_SPI_SYS_0_REG
#define MAC_ADDR1_REG EFUSE_RD_MAC_SPI_SYS_1_REG
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static inline void phy_digital_regs_store(void);
static inline void phy_digital_regs_load(void);
/****************************************************************************
* Extern Functions declaration
****************************************************************************/
extern uint8_t esp_crc8(const uint8_t *p, uint32_t len);
extern void phy_wakeup_init(void);
extern void phy_close_rf(void);
extern uint8_t phy_dig_reg_backup(bool init, uint32_t *regs);
extern int register_chipv7_phy(const esp_phy_init_data_t *init_data,
esp_phy_calibration_data_t *cal_data,
esp_phy_calibration_mode_t cal_mode);
/****************************************************************************
* Private Data
****************************************************************************/
/* Wi-Fi sleep private data */
static uint32_t g_phy_clk_en_cnt;
/* Reference count of enabling PHY */
static uint8_t g_phy_access_ref;
/* Memory to store PHY digital registers */
static uint32_t *g_phy_digital_regs_mem = NULL;
/* Indicate PHY is calibrated or not */
static bool g_is_phy_calibrated = false;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: phy_digital_regs_store
*
* Description:
* Store PHY digital registers.
*
****************************************************************************/
static inline void phy_digital_regs_store(void)
{
if (g_phy_digital_regs_mem == NULL)
{
g_phy_digital_regs_mem = (uint32_t *)
kmm_malloc(SOC_PHY_DIG_REGS_MEM_SIZE);
}
DEBUGASSERT(g_phy_digital_regs_mem != NULL);
phy_dig_reg_backup(true, g_phy_digital_regs_mem);
}
/****************************************************************************
* Name: phy_digital_regs_load
*
* Description:
* Load PHY digital registers.
*
****************************************************************************/
static inline void phy_digital_regs_load(void)
{
if (g_phy_digital_regs_mem != NULL)
{
phy_dig_reg_backup(false, g_phy_digital_regs_mem);
}
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Functions needed by libphy.a
****************************************************************************/
/****************************************************************************
* Name: esp_dport_access_reg_read
*
* Description:
* Read register value safely in SMP
*
* Input Parameters:
* reg - Register address
*
* Returned Value:
* Register value
*
****************************************************************************/
uint32_t IRAM_ATTR esp_dport_access_reg_read(uint32_t reg)
{
return getreg32(reg);
}
/****************************************************************************
* Name: phy_printf
*
* Description:
* Output format string and its arguments
*
* Input Parameters:
* format - format string
*
* Returned Value:
* 0
*
****************************************************************************/
int phy_printf(const char *format, ...)
{
#ifdef CONFIG_DEBUG_WIRELESS_INFO
va_list arg;
va_start(arg, format);
vsyslog(LOG_INFO, format, arg);
va_end(arg);
#endif
return 0;
}
/****************************************************************************
* Name: esp32s3_phy_enable_clock
*
* Description:
* Enable PHY hardware clock
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp32s3_phy_enable_clock(void)
{
irqstate_t flags;
flags = enter_critical_section();
if (g_phy_clk_en_cnt == 0)
{
modifyreg32(SYSTEM_WIFI_CLK_EN_REG, 0,
SYSTEM_WIFI_CLK_WIFI_BT_COMMON_M);
}
g_phy_clk_en_cnt++;
leave_critical_section(flags);
}
/****************************************************************************
* Name: esp32s3_phy_disable_clock
*
* Description:
* Disable PHY hardware clock
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp32s3_phy_disable_clock(void)
{
irqstate_t flags;
flags = enter_critical_section();
if (g_phy_clk_en_cnt > 0)
{
g_phy_clk_en_cnt--;
if (g_phy_clk_en_cnt == 0)
{
modifyreg32(SYSTEM_WIFI_CLK_EN_REG,
SYSTEM_WIFI_CLK_WIFI_BT_COMMON_M,
0);
}
}
leave_critical_section(flags);
}
/****************************************************************************
* Name: esp_read_mac
*
* Description:
* Read MAC address from efuse
*
* Input Parameters:
* mac - MAC address buffer pointer
* type - MAC address type
*
* Returned Value:
* 0 if success or -1 if fail
*
****************************************************************************/
int32_t esp_read_mac(uint8_t *mac, esp_mac_type_t type)
{
uint32_t regval[2];
uint8_t tmp;
uint8_t *data = (uint8_t *)regval;
int i;
if (mac == NULL)
{
wlerr("mac address param is NULL");
return -1;
}
if (type > ESP_MAC_BT)
{
wlerr("Input type is error=%d\n", type);
return -1;
}
regval[0] = getreg32(MAC_ADDR0_REG);
regval[1] = getreg32(MAC_ADDR1_REG);
for (i = 0; i < MAC_LEN; i++)
{
mac[i] = data[5 - i];
}
if (type == ESP_MAC_WIFI_SOFTAP)
{
tmp = mac[0];
for (i = 0; i < 64; i++)
{
mac[0] = tmp | 0x02;
mac[0] ^= i << 2;
if (mac[0] != tmp)
{
break;
}
}
if (i >= 64)
{
wlerr("Failed to generate SoftAP MAC\n");
return -1;
}
}
if (type == ESP_MAC_BT)
{
tmp = mac[0];
for (i = 0; i < 64; i++)
{
mac[0] = tmp | 0x02;
mac[0] ^= i << 2;
if (mac[0] != tmp)
{
break;
}
}
mac[5] += 1;
}
return 0;
}
/****************************************************************************
* Name: esp32s3_phy_disable
*
* Description:
* Deinitialize PHY hardware
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp32s3_phy_disable(void)
{
irqstate_t flags;
flags = enter_critical_section();
g_phy_access_ref--;
if (g_phy_access_ref == 0)
{
/* Disable PHY and RF. */
phy_close_rf();
/* Disable PHY temperature sensor */
phy_xpd_tsens();
/* Disable Wi-Fi/BT common peripheral clock.
* Do not disable clock for hardware RNG.
*/
esp32s3_phy_disable_clock();
}
leave_critical_section(flags);
}
/****************************************************************************
* Name: esp32s3_phy_enable
*
* Description:
* Initialize PHY hardware
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp32s3_phy_enable(void)
{
static bool debug = false;
irqstate_t flags;
esp_phy_calibration_data_t *cal_data;
if (debug == false)
{
char *phy_version = get_phy_version_str();
wlinfo("phy_version %s\n", phy_version);
debug = true;
}
cal_data = kmm_zalloc(sizeof(esp_phy_calibration_data_t));
if (!cal_data)
{
wlerr("ERROR: Failed to allocate PHY calibration data buffer.");
abort();
}
flags = enter_critical_section();
if (g_phy_access_ref == 0)
{
esp32s3_phy_enable_clock();
if (g_is_phy_calibrated == false)
{
#if CONFIG_ESP_PHY_ENABLE_USB
phy_bbpll_en_usb(true);
#endif
wlinfo("calibrating");
register_chipv7_phy(&phy_init_data, cal_data, PHY_RF_CAL_FULL);
g_is_phy_calibrated = true;
}
else
{
phy_wakeup_init();
phy_digital_regs_load();
}
}
g_phy_access_ref++;
leave_critical_section(flags);
kmm_free(cal_data);
}
+168
View File
@@ -0,0 +1,168 @@
/****************************************************************************
* arch/xtensa/src/esp32s3/esp32s3_wireless.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WIRELESS_H
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WIRELESS_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "xtensa_attr.h"
#include "espidf_wifi.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Note: Don't remove these definitions, they are needed by the 3rdparty IDF
* headers
*/
#define CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN 0
#define CONFIG_MAC_BB_PD 0
#define MAC_LEN (6)
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp_read_mac
*
* Description:
* Read MAC address from efuse
*
* Input Parameters:
* mac - MAC address buffer pointer
* type - MAC address type
*
* Returned Value:
* 0 if success or -1 if fail
*
****************************************************************************/
int32_t esp_read_mac(uint8_t *mac, esp_mac_type_t type);
/****************************************************************************
* Name: esp32s3_phy_enable
*
* Description:
* Initialize PHY hardware
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp32s3_phy_enable(void);
/****************************************************************************
* Name: esp32s3_phy_disable
*
* Description:
* Deinitialize PHY hardware
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp32s3_phy_disable(void);
/****************************************************************************
* Name: esp32s3_phy_enable_clock
*
* Description:
* Enable PHY clock
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp32s3_phy_enable_clock(void);
/****************************************************************************
* Name: esp32s3_phy_disable_clock
*
* Description:
* Disable PHY clock
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp32s3_phy_disable_clock(void);
/****************************************************************************
* Functions needed by libphy.a
****************************************************************************/
/****************************************************************************
* Name: esp_dport_access_reg_read
*
* Description:
* Read register value safely in SMP
*
* Input Parameters:
* reg - Register address
*
* Returned Value:
* Register value
*
****************************************************************************/
uint32_t IRAM_ATTR esp_dport_access_reg_read(uint32_t reg);
/****************************************************************************
* Name: phy_printf
*
* Description:
* Output format string and its arguments
*
* Input Parameters:
* format - format string
*
* Returned Value:
* 0
*
****************************************************************************/
int phy_printf(const char *format, ...) printf_like(1, 2);
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WIRELESS_H */
File diff suppressed because it is too large Load Diff
+93
View File
@@ -0,0 +1,93 @@
/****************************************************************************
* arch/xtensa/src/esp32s3/esp32s3_wlan.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WLAN_H
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WLAN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "esp32s3_wifi_adapter.h"
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
#ifdef CONFIG_ESP32S3_WIFI
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef ESP32S3_WLAN_HAS_STA
/****************************************************************************
* Name: esp32s3_wlan_sta_set_linkstatus
*
* Description:
* Set Wi-Fi station link status
*
* Parameters:
* linkstatus - true Notifies the networking layer about an available
* carrier, false Notifies the networking layer about an
* disappeared carrier.
*
* Returned Value:
* OK on success; Negated errno on failure.
*
****************************************************************************/
int esp32s3_wlan_sta_set_linkstatus(bool linkstatus);
/****************************************************************************
* Name: esp32s3_wlan_sta_initialize
*
* Description:
* Initialize the ESP32-S3 WLAN station netcard driver
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success; Negated errno on failure.
*
****************************************************************************/
int esp32s3_wlan_sta_initialize(void);
#endif /* ESP32S3_WLAN_HAS_STA */
#endif /* CONFIG_ESP32S3_WIFI */
#ifdef __cplusplus
}
#endif
#undef EXTERN
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WLAN_H */
@@ -1761,6 +1761,8 @@
#define RTC_CNTL_RTC_STORE1_REG (DR_REG_RTCCNTL_BASE + 0x54)
#define RTC_SLOW_CLK_CAL_REG RTC_CNTL_RTC_STORE1_REG
/* RTC_CNTL_RTC_SCRATCH1 : R/W; bitpos: [31:0]; default: 0;
* Reserved register
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,73 @@
/****************************************************************************
* boards/xtensa/esp32s3/common/include/esp32s3_board_wlan.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_XTENSA_ESP32S3_COMMON_INCLUDE_ESP32S3_BOARD_WLAN_H
#define __BOARDS_XTENSA_ESP32S3_COMMON_INCLUDE_ESP32S3_BOARD_WLAN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef CONFIG_ESP32S3_WIFI
/****************************************************************************
* Name: board_wlan_init
*
* Description:
* Configure the wireless subsystem.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
int board_wlan_init(void);
#endif /* CONFIG_ESP32S3_WIFI */
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_XTENSA_ESP32S3_COMMON_INCLUDE_ESP32S3_BOARD_WLAN_H */
@@ -18,6 +18,8 @@
*
****************************************************************************/
#include <nuttx/config.h>
/* Default entry point: */
ENTRY(__start);
@@ -74,6 +76,13 @@ SECTIONS
*(.iram1 .iram1.*)
*(.wifirxiram .wifirxiram.*)
*(.wifi0iram .wifi0iram.*)
*(.wifiorslpiram .wifiorslpiram.*)
*(.wifislpiram .wifislpiram.*)
*(.wifislprxiram .wifislprxiram.*)
*(.phyiram .phyiram.*)
/* align + add 16B for CPU dummy speculative instr. fetch */
. = ALIGN(4) + 16;
@@ -148,6 +157,8 @@ SECTIONS
KEEP (*(.jcr))
*(.dram1 .dram1.*)
*libphy.a:(.rodata .rodata.*)
_edata = ABSOLUTE(.);
. = ALIGN(4);
@@ -204,6 +215,13 @@ SECTIONS
*(.rodata)
*(.rodata.*)
#ifdef CONFIG_ESP32S3_WIRELESS
*(.rodata_wlog_verbose.*)
*(.rodata_wlog_debug.*)
*(.rodata_wlog_info.*)
*(.rodata_wlog_warning.*)
*(.rodata_wlog_error.*)
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -32,6 +32,10 @@ ifeq ($(CONFIG_ESP32S3_SPIFLASH),y)
CSRCS += esp32s3_board_spiflash.c
endif
ifeq ($(CONFIG_ESP32S3_WIFI),y)
CSRCS += esp32s3_board_wlan.c
endif
ifeq ($(CONFIG_I2C_DRIVER),y)
CSRCS += esp32s3_board_i2c.c
endif
@@ -46,6 +46,16 @@
#include "esp32s3_spiflash_mtd.h"
#include "esp32s3-devkit.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifdef CONFIG_ESP32S3_WIFI_MTD_ENCRYPT
# define WIFI_ENCRYPT true
#else
# define WIFI_ENCRYPT false
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -245,6 +255,72 @@ static int setup_nxffs(struct mtd_dev_s *mtd, const char *mnt_pt)
}
#endif
/****************************************************************************
* Name: init_wifi_partition
*
* Description:
* Initialize partition that is dedicated to Wi-Fi.
*
* Returned Value:
* Zero on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_ESP32S3_WIFI_SAVE_PARAM
static int init_wifi_partition(void)
{
int ret = OK;
struct mtd_dev_s *mtd;
mtd = esp32s3_spiflash_alloc_mtdpart(CONFIG_ESP32S3_WIFI_MTD_OFFSET,
CONFIG_ESP32S3_WIFI_MTD_SIZE,
WIFI_ENCRYPT);
if (!mtd)
{
ferr("Failed to alloc MTD partition of SPI Flash\n");
return -ENOMEM;
}
#if defined (CONFIG_ESP32S3_SPIFLASH_SMARTFS)
ret = setup_smartfs(1, mtd, CONFIG_ESP32S3_WIFI_FS_MOUNTPT);
if (ret < 0)
{
ferr("Failed to setup smartfs\n");
return ret;
}
#elif defined(CONFIG_ESP32S3_SPIFLASH_LITTLEFS)
const char *path = "/dev/mtdblock1";
ret = setup_littlefs(path, mtd, CONFIG_ESP32S3_WIFI_FS_MOUNTPT, 0777);
if (ret < 0)
{
ferr("Failed to setup littlefs\n");
return ret;
}
#elif defined(CONFIG_ESP32S3_SPIFLASH_SPIFFS)
const char *path = "/dev/mtdblock1";
ret = setup_spiffs(path, mtd, CONFIG_ESP32S3_WIFI_FS_MOUNTPT, 0777);
if (ret < 0)
{
ferr("Failed to setup spiffs\n");
return ret;
}
#else
ferr("No supported FS selected. Wi-Fi partition "
"should be mounted before Wi-Fi initialization\n");
#endif
return ret;
}
#endif
/****************************************************************************
* Name: init_storage_partition
*
@@ -344,6 +420,14 @@ int board_spiflash_init(void)
return ret;
}
#ifdef CONFIG_ESP32S3_WIFI_SAVE_PARAM
ret = init_wifi_partition();
if (ret < 0)
{
return ret;
}
#endif
ret = init_storage_partition();
if (ret < 0)
{
@@ -0,0 +1,73 @@
/****************************************************************************
* boards/xtensa/esp32s3/common/src/esp32s3_board_wlan.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <syslog.h>
#include <debug.h>
#include <nuttx/wireless/wireless.h>
#include "esp32s3_spiflash.h"
#include "esp32s3_wlan.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_wlan_init
*
* Description:
* Configure the wireless subsystem.
*
* Input Parameters:
* None.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
int board_wlan_init(void)
{
int ret = OK;
#ifdef ESP32S3_WLAN_HAS_STA
ret = esp32s3_wlan_sta_initialize();
if (ret)
{
wlerr("ERROR: Failed to initialize Wi-Fi station\n");
return ret;
}
#endif /* ESP32S3_WLAN_HAS_STA */
return ret;
}
@@ -0,0 +1,83 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_NDEBUG is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-devkit"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3WROOM1=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEFAULT_TASK_STACKSIZE=4096
CONFIG_DRIVERS_IEEE80211=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_ESP32S3_RT_TIMER_TASK_STACK_SIZE=4096
CONFIG_ESP32S3_SPIFLASH=y
CONFIG_ESP32S3_SPIFLASH_SPIFFS=y
CONFIG_ESP32S3_UART0=y
CONFIG_ESP32S3_WIFI=y
CONFIG_ESP32S3_WIFI_SAVE_PARAM=y
CONFIG_EXAMPLES_RANDOM=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=124
CONFIG_IOB_THROTTLE=24
CONFIG_NAME_MAX=48
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETDEV_PHY_IOCTL=y
CONFIG_NETDEV_WIRELESS_IOCTL=y
CONFIG_NETUTILS_IPERF=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ETH_PKTSIZE=1514
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NET_UDP_WRITE_BUFFERS=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIG_DEFAULT=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_TIMER=y
CONFIG_TLS_TASK_NELEM=4
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_WAPI=y
CONFIG_WIRELESS_WAPI_CMDTOOL=y
CONFIG_WIRELESS_WAPI_STACKSIZE=8192
@@ -42,6 +42,10 @@
# include "esp32s3_board_tim.h"
#endif
#ifdef CONFIG_ESP32S3_WIFI
# include "esp32s3_board_wlan.h"
#endif
#ifdef CONFIG_ESP32S3_RT_TIMER
# include "esp32s3_rt_timer.h"
#endif
@@ -206,6 +210,15 @@ int esp32s3_bringup(void)
}
#endif
#ifdef CONFIG_ESP32S3_WIFI
ret = board_wlan_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize wireless subsystem=%d\n",
ret);
}
#endif
#ifdef CONFIG_VIDEO_FB
ret = fb_register(0, 0);
if (ret < 0)