This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit d4b11a960f9d1b3406b1810444921366d290c76f
Author: Tiago Medicci Serrano <[email protected]>
AuthorDate: Tue Feb 28 12:32:14 2023 -0300

    esp32s3/wifi: add support to softAP (softAP and softAP + STA mode)
---
 arch/xtensa/src/esp32s3/Kconfig                    |   6 +
 arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c     | 886 ++++++++++++++++++++-
 arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.h     | 348 ++++++++
 arch/xtensa/src/esp32s3/esp32s3_wlan.c             | 139 +++-
 arch/xtensa/src/esp32s3/esp32s3_wlan.h             |  18 +
 .../xtensa/esp32s3/common/src/esp32s3_board_wlan.c |   9 +
 .../esp32s3-devkit/configs/sta_softap/defconfig    |  86 ++
 7 files changed, 1479 insertions(+), 13 deletions(-)

diff --git a/arch/xtensa/src/esp32s3/Kconfig b/arch/xtensa/src/esp32s3/Kconfig
index 17cc7fe440..243569c173 100644
--- a/arch/xtensa/src/esp32s3/Kconfig
+++ b/arch/xtensa/src/esp32s3/Kconfig
@@ -829,6 +829,12 @@ choice
 config ESP32S3_WIFI_STATION
        bool "Station mode"
 
+config ESP32S3_WIFI_SOFTAP
+       bool "SoftAP mode"
+
+config ESP32S3_WIFI_STATION_SOFTAP
+       bool "Station + SoftAP"
+
 endchoice # ESP32S3 Wi-Fi mode
 
 config ESP32S3_WIFI_STATIC_RXBUF_NUM
diff --git a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c 
b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c
index d36a54cd51..a38edf223c 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c
@@ -371,8 +371,29 @@ static bool g_sta_connected;
 /* Wi-Fi station TX done callback function */
 
 static wifi_txdone_cb_t g_sta_txdone_cb;
+
+/* Wi-Fi interface configuration */
+
+static wifi_config_t g_sta_wifi_cfg;
+
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+
+/* If Wi-Fi SoftAP starts */
+
+static bool g_softap_started;
+
+/* Wi-Fi SoftAP TX done callback function */
+
+static wifi_txdone_cb_t g_softap_txdone_cb;
+
+/* Wi-Fi interface configuration */
+
+static wifi_config_t g_softap_wifi_cfg;
+
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
 /* Device specific lock */
 
 static spinlock_t g_lock;
@@ -2012,6 +2033,24 @@ static int esp_event_id_map(int event_id)
         break;
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+      case WIFI_EVENT_AP_START:
+        id = WIFI_ADPT_EVT_AP_START;
+        break;
+
+      case WIFI_EVENT_AP_STOP:
+        id = WIFI_ADPT_EVT_AP_STOP;
+        break;
+
+      case WIFI_EVENT_AP_STACONNECTED:
+        id = WIFI_ADPT_EVT_AP_STACONNECTED;
+        break;
+
+      case WIFI_EVENT_AP_STADISCONNECTED:
+        id = WIFI_ADPT_EVT_AP_STADISCONNECTED;
+        break;
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
       default:
         return -1;
     }
@@ -2105,6 +2144,23 @@ static void esp_evt_work_cb(void *arg)
             break;
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+#ifdef ESP32S3_WLAN_HAS_STA
+          case WIFI_ADPT_EVT_AP_START:
+            wlinfo("INFO: Wi-Fi softap start\n");
+            break;
+
+          case WIFI_ADPT_EVT_AP_STOP:
+            wlinfo("INFO: Wi-Fi softap stop\n");
+            break;
+
+          case WIFI_ADPT_EVT_AP_STACONNECTED:
+            wlinfo("INFO: Wi-Fi station join\n");
+            break;
+
+          case WIFI_ADPT_EVT_AP_STADISCONNECTED:
+            wlinfo("INFO: Wi-Fi station leave\n");
+            break;
+#endif
           default:
             break;
         }
@@ -4642,14 +4698,23 @@ int esp_wifi_sta_start(void)
       wlinfo("Failed to stop Wi-Fi ret=%d\n", ret);
     }
 
-  mode = WIFI_MODE_STA;
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+  if (g_softap_started)
+    {
+      mode = WIFI_MODE_APSTA;
+    }
+  else
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+    {
+      mode = WIFI_MODE_STA;
+    }
 
   ret = esp_wifi_set_mode(mode);
   if (ret)
     {
       wlerr("Failed to set Wi-Fi mode=%d ret=%d\n", mode, ret);
       ret = wifi_errno_trans(ret);
-      goto errout_set_mode;
+      goto errout;
     }
 
   ret = esp_wifi_start();
@@ -4657,17 +4722,14 @@ int esp_wifi_sta_start(void)
     {
       wlerr("Failed to start Wi-Fi with mode=%d ret=%d\n", mode, ret);
       ret = wifi_errno_trans(ret);
-      goto errout_set_mode;
+      goto errout;
     }
 
   g_sta_started = true;
 
   wlinfo("OK to start Wi-Fi station\n");
 
-  esp_wifi_lock(false);
-  return OK;
-
-errout_set_mode:
+errout:
   esp_wifi_lock(false);
   return ret;
 }
@@ -4701,10 +4763,35 @@ int esp_wifi_sta_stop(void)
 
   g_sta_started = false;
 
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+  if (g_softap_started)
+    {
+      ret = esp_wifi_set_mode(WIFI_MODE_AP);
+      if (ret)
+        {
+          wlerr("Failed to set Wi-Fi AP mode ret=%d\n", ret);
+          ret = wifi_errno_trans(ret);
+          goto errout;
+        }
+
+      ret = esp_wifi_start();
+      if (ret)
+        {
+          wlerr("Failed to start Wi-Fi AP ret=%d\n", ret);
+          ret = wifi_errno_trans(ret);
+          goto errout;
+        }
+    }
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
   wlinfo("OK to stop Wi-Fi station\n");
 
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+errout:
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
   esp_wifi_lock(false);
-  return OK;
+  return ret;
 }
 
 /****************************************************************************
@@ -5101,7 +5188,7 @@ int esp_wifi_sta_connect(void)
     {
       wlerr("Failed to connect ret=%d\n", ret);
       ret = wifi_errno_trans(ret);
-      goto errout_wifi_connect;
+      goto errout;
     }
 
   esp_wifi_lock(false);
@@ -5127,7 +5214,7 @@ int esp_wifi_sta_connect(void)
 
   return OK;
 
-errout_wifi_connect:
+errout:
   g_sta_reconnect = false;
   esp_wifi_lock(false);
   return ret;
@@ -5645,6 +5732,785 @@ int esp_wifi_sta_rssi(struct iwreq *iwr, bool set)
 }
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+/****************************************************************************
+ * SoftAP functions
+ ****************************************************************************/
+
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+
+/****************************************************************************
+ * Name: esp_wifi_softap_start
+ *
+ * Description:
+ *   Start Wi-Fi SoftAP.
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_start(void)
+{
+  int ret;
+  wifi_mode_t mode;
+
+  esp_wifi_lock(true);
+
+  ret = esp_wifi_stop();
+  if (ret)
+    {
+      wlinfo("Failed to stop Wi-Fi ret=%d\n", ret);
+    }
+
+#ifdef ESP32S3_WLAN_HAS_STA
+  if (g_sta_started)
+    {
+      mode = WIFI_MODE_APSTA;
+    }
+  else
+#endif /* ESP32S3_WLAN_HAS_STA */
+    {
+      mode = WIFI_MODE_AP;
+    }
+
+  ret = esp_wifi_set_mode(mode);
+  if (ret)
+    {
+      wlerr("Failed to set Wi-Fi mode=%d ret=%d\n", mode, ret);
+      ret = wifi_errno_trans(ret);
+      goto errout;
+    }
+
+  ret = esp_wifi_start();
+  if (ret)
+    {
+      wlerr("Failed to start Wi-Fi with mode=%d ret=%d\n", mode, ret);
+      ret = wifi_errno_trans(ret);
+      goto errout;
+    }
+
+  g_softap_started = true;
+
+  wlinfo("OK to start Wi-Fi SoftAP\n");
+
+errout:
+  esp_wifi_lock(false);
+  return ret;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_stop
+ *
+ * Description:
+ *   Stop Wi-Fi SoftAP.
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_stop(void)
+{
+  int ret;
+
+  esp_wifi_lock(true);
+
+  ret = esp_wifi_stop();
+  if (ret)
+    {
+      wlinfo("Failed to stop Wi-Fi ret=%d\n", ret);
+    }
+
+  g_softap_started = false;
+
+#ifdef ESP32S3_WLAN_HAS_STA
+  if (g_sta_started)
+    {
+      ret = esp_wifi_set_mode(WIFI_MODE_STA);
+      if (ret)
+        {
+          wlerr("Failed to set Wi-Fi AP mode ret=%d\n", ret);
+          ret = wifi_errno_trans(ret);
+          goto errout;
+        }
+
+      ret = esp_wifi_start();
+      if (ret)
+        {
+          wlerr("Failed to start Wi-Fi STA ret=%d\n", ret);
+          ret = wifi_errno_trans(ret);
+          goto errout;
+        }
+    }
+#endif /* ESP32S3_WLAN_HAS_STA */
+
+  wlinfo("OK to stop Wi-Fi SoftAP\n");
+
+#ifdef ESP32S3_WLAN_HAS_STA
+errout:
+#endif /* ESP32S3_WLAN_HAS_STA */
+
+  esp_wifi_lock(false);
+  return ret;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_send_data
+ *
+ * Description:
+ *   Use Wi-Fi SoftAP interface to send 802.3 frame
+ *
+ * Input Parameters:
+ *   pbuf - Packet buffer pointer
+ *   len  - Packet length
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_send_data(void *pbuf, size_t len)
+{
+  int ret;
+
+  ret = esp_wifi_internal_tx(WIFI_IF_AP, pbuf, len);
+
+  return wifi_errno_trans(ret);
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_register_recv_cb
+ *
+ * Description:
+ *   Register Wi-Fi SoftAP receive packet callback function
+ *
+ * Input Parameters:
+ *   recv_cb - Receive callback function
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_register_recv_cb(int (*recv_cb)(void *buffer,
+                                                    uint16_t len,
+                                                    void *eb))
+{
+  int ret;
+
+  ret = esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, (wifi_rxcb_t)recv_cb);
+
+  return wifi_errno_trans(ret);
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_register_txdone_cb
+ *
+ * Description:
+ *   Register the SoftAP TX done callback function.
+ *
+ * Input Parameters:
+ *   cb - The callback function
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+void esp_wifi_softap_register_txdone_cb(wifi_txdone_cb_t cb)
+{
+  g_softap_txdone_cb = cb;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_read_mac
+ *
+ * Description:
+ *   Read SoftAP interface MAC address from efuse
+ *
+ * Input Parameters:
+ *   mac  - MAC address buffer pointer
+ *
+ * Returned Value:
+ *   0 if success or -1 if fail
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_read_mac(uint8_t *mac)
+{
+  return esp_read_mac(mac, ESP_MAC_WIFI_SOFTAP);
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_password
+ *
+ * Description:
+ *   Set/Get Wi-Fi SoftAP password
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set   - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_password(struct iwreq *iwr, bool set)
+{
+  int ret;
+  int size;
+  wifi_config_t wifi_cfg;
+  struct iw_encode_ext *ext = iwr->u.encoding.pointer;
+  uint8_t *pdata;
+  uint8_t len;
+#ifdef CONFIG_DEBUG_WIRELESS_INFO
+  char buf[PWD_MAX_LEN + 1];
+#endif
+
+  DEBUGASSERT(ext != NULL);
+
+  pdata = ext->key;
+  len = ext->key_len;
+
+  if (set && len > PWD_MAX_LEN)
+    {
+      return -EINVAL;
+    }
+
+  memset(&wifi_cfg, 0x0, sizeof(wifi_config_t));
+  ret = esp_wifi_get_config(WIFI_IF_AP, &wifi_cfg);
+  if (ret)
+    {
+      wlerr("Failed to get Wi-Fi config data ret=%d\n", ret);
+      return wifi_errno_trans(ret);
+    }
+
+  pdata = ext->key;
+  len   = ext->key_len;
+  if (set)
+    {
+      /* Clear the password field and copy the user password to it */
+
+      memset(wifi_cfg.ap.password, 0x0, PWD_MAX_LEN);
+      if (len)
+        {
+          memcpy(wifi_cfg.ap.password, pdata, len);
+          switch (ext->alg)
+            {
+              case IW_ENCODE_ALG_NONE:
+                wifi_cfg.ap.authmode = WIFI_AUTH_OPEN;
+                break;
+
+              case IW_ENCODE_ALG_WEP:
+                wifi_cfg.ap.authmode = WIFI_AUTH_WEP;
+                break;
+
+              case IW_ENCODE_ALG_TKIP:
+                wifi_cfg.ap.authmode = WIFI_AUTH_WPA_PSK;
+                break;
+
+              case IW_ENCODE_ALG_CCMP:
+                wifi_cfg.ap.authmode = WIFI_AUTH_WPA2_PSK;
+                break;
+
+              case IW_ENCODE_ALG_PMK:
+              case IW_ENCODE_ALG_AES_CMAC:
+                wifi_cfg.ap.authmode = WIFI_AUTH_WPA_WPA2_PSK;
+                break;
+
+              default:
+                wlerr("Failed to transfer wireless authmode: %d",
+                      ext->alg);
+                return -EINVAL;
+            }
+        }
+
+      ret = esp_wifi_set_config(WIFI_IF_AP, &wifi_cfg);
+      if (ret)
+        {
+          wlerr("Failed to set Wi-Fi config data ret=%d\n", ret);
+          return wifi_errno_trans(ret);
+        }
+    }
+  else
+    {
+      size = strnlen((char *)wifi_cfg.ap.password, PWD_MAX_LEN);
+      if (len < size)
+        {
+          return -EINVAL;
+        }
+      else
+        {
+          len = size;
+          memcpy(pdata, wifi_cfg.ap.password, len);
+        }
+    }
+
+#ifdef CONFIG_DEBUG_WIRELESS_INFO
+  memcpy(buf, pdata, len);
+  buf[len] = 0;
+  wlinfo("Wi-Fi SoftAP password=%s len=%d\n", buf, len);
+#endif
+
+  return OK;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_essid
+ *
+ * Description:
+ *   Set/Get Wi-Fi SoftAP ESSID
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_essid(struct iwreq *iwr, bool set)
+{
+  int ret;
+  int size;
+  wifi_config_t wifi_cfg;
+  struct iw_point *essid = &iwr->u.essid;
+  uint8_t *pdata;
+  uint8_t len;
+#ifdef CONFIG_DEBUG_WIRELESS_INFO
+  char buf[SSID_MAX_LEN + 1];
+#endif
+
+  DEBUGASSERT(essid != NULL);
+
+  pdata = essid->pointer;
+  len   = essid->length;
+
+  if (set && len > SSID_MAX_LEN)
+    {
+      return -EINVAL;
+    }
+
+  memset(&wifi_cfg, 0x0, sizeof(wifi_config_t));
+  ret = esp_wifi_get_config(WIFI_IF_AP, &wifi_cfg);
+  if (ret)
+    {
+      wlerr("Failed to get Wi-Fi config data ret=%d\n", ret);
+      return wifi_errno_trans(ret);
+    }
+
+  if (set)
+    {
+      memset(wifi_cfg.ap.ssid, 0x0, SSID_MAX_LEN);
+      memcpy(wifi_cfg.ap.ssid, pdata, len);
+      wifi_cfg.ap.ssid_len = len;
+      ret = esp_wifi_set_config(WIFI_IF_AP, &wifi_cfg);
+      if (ret)
+        {
+          wlerr("Failed to set Wi-Fi config data ret=%d\n", ret);
+          return wifi_errno_trans(ret);
+        }
+    }
+  else
+    {
+      size = strnlen((char *)wifi_cfg.ap.ssid, SSID_MAX_LEN);
+      if (len < size)
+        {
+          return -EINVAL;
+        }
+      else
+        {
+          len = size;
+          memcpy(pdata, wifi_cfg.ap.ssid, len);
+        }
+    }
+
+#ifdef CONFIG_DEBUG_WIRELESS_INFO
+  memcpy(buf, pdata, len);
+  buf[len] = 0;
+  wlinfo("Wi-Fi SoftAP ssid=%s len=%d\n", buf, len);
+#endif
+
+  return OK;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_bssid
+ *
+ * Description:
+ *   Set/Get Wi-Fi softAP BSSID
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set   - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_bssid(struct iwreq *iwr, bool set)
+{
+  return -ENOSYS;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_connect
+ *
+ * Description:
+ *   Trigger Wi-Fi SoftAP accept connection action
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_connect(void)
+{
+  return OK;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_disconnect
+ *
+ * Description:
+ *   Trigger Wi-Fi SoftAP drop connection action
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_disconnect(void)
+{
+  return OK;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_mode
+ *
+ * Description:
+ *   Set/Get Wi-Fi SoftAP mode code.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_mode(struct iwreq *iwr, bool set)
+{
+  if (set == false)
+    {
+      iwr->u.mode = IW_MODE_MASTER;
+    }
+
+  return OK;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_auth
+ *
+ * Description:
+ *   Set/get authentication mode params.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_auth(struct iwreq *iwr, bool set)
+{
+  int ret;
+  int cmd;
+  wifi_config_t wifi_cfg;
+
+  if (set)
+    {
+      memset(&wifi_cfg, 0x0, sizeof(wifi_config_t));
+      ret = esp_wifi_get_config(WIFI_IF_AP, &wifi_cfg);
+      if (ret)
+        {
+          wlerr("Failed to get Wi-Fi config data ret=%d\n", ret);
+          return wifi_errno_trans(ret);
+        }
+
+      cmd = iwr->u.param.flags & IW_AUTH_INDEX;
+      switch (cmd)
+        {
+          case IW_AUTH_WPA_VERSION:
+            {
+              switch (iwr->u.param.value)
+                {
+                  case IW_AUTH_WPA_VERSION_DISABLED:
+                    wifi_cfg.ap.authmode = WIFI_AUTH_OPEN;
+                    break;
+
+                  case IW_AUTH_WPA_VERSION_WPA:
+                    wifi_cfg.ap.authmode = WIFI_AUTH_WPA_PSK;
+                    break;
+
+                  case IW_AUTH_WPA_VERSION_WPA2:
+                    wifi_cfg.ap.authmode = WIFI_AUTH_WPA2_PSK;
+                    break;
+
+                  default:
+                    wlerr("Invalid wpa version %" PRId32 "\n",
+                          iwr->u.param.value);
+                    return -EINVAL;
+                }
+            }
+
+            break;
+          case IW_AUTH_CIPHER_PAIRWISE:
+          case IW_AUTH_CIPHER_GROUP:
+            {
+              switch (iwr->u.param.value)
+                {
+                  case IW_AUTH_CIPHER_NONE:
+                    wifi_cfg.ap.authmode = WIFI_AUTH_OPEN;
+                    break;
+
+                  case IW_AUTH_CIPHER_WEP40:
+                  case IW_AUTH_CIPHER_WEP104:
+                    wifi_cfg.ap.authmode = WIFI_AUTH_WEP;
+                    break;
+
+                  case IW_AUTH_CIPHER_TKIP:
+                    wifi_cfg.ap.authmode = WIFI_AUTH_WPA_PSK;
+                    break;
+
+                  case IW_AUTH_CIPHER_CCMP:
+                  case IW_AUTH_CIPHER_AES_CMAC:
+                    wifi_cfg.ap.authmode = WIFI_AUTH_WPA2_PSK;
+                    break;
+
+                  default:
+                    wlerr("Invalid cipher mode %" PRId32 "\n",
+                          iwr->u.param.value);
+                    return -EINVAL;
+                }
+            }
+
+            break;
+          case IW_AUTH_KEY_MGMT:
+          case IW_AUTH_TKIP_COUNTERMEASURES:
+          case IW_AUTH_DROP_UNENCRYPTED:
+          case IW_AUTH_80211_AUTH_ALG:
+          case IW_AUTH_WPA_ENABLED:
+          case IW_AUTH_RX_UNENCRYPTED_EAPOL:
+          case IW_AUTH_ROAMING_CONTROL:
+          case IW_AUTH_PRIVACY_INVOKED:
+          default:
+            wlerr("Unknown cmd %d\n", cmd);
+            return -EINVAL;
+        }
+
+      ret = esp_wifi_set_config(WIFI_IF_AP, &wifi_cfg);
+      if (ret)
+        {
+          wlerr("Failed to set Wi-Fi config data ret=%d\n", ret);
+          return wifi_errno_trans(ret);
+        }
+    }
+  else
+    {
+      return -ENOSYS;
+    }
+
+  return OK;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_freq
+ *
+ * Description:
+ *   Set/Get SoftAP frequency.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_freq(struct iwreq *iwr, bool set)
+{
+  int ret;
+  wifi_config_t wifi_cfg;
+
+  memset(&wifi_cfg, 0x0, sizeof(wifi_config_t));
+  ret = esp_wifi_get_config(WIFI_IF_AP, &wifi_cfg);
+  if (ret)
+    {
+      wlerr("Failed to get Wi-Fi config data ret=%d\n", ret);
+      return wifi_errno_trans(ret);
+    }
+
+  if (set)
+    {
+      int channel = esp_freq_to_channel(iwr->u.freq.m);
+
+      wifi_cfg.ap.channel = channel;
+
+      ret = esp_wifi_set_config(WIFI_IF_AP, &wifi_cfg);
+      if (ret)
+        {
+          wlerr("Failed to set Wi-Fi config data ret=%d\n", ret);
+          return wifi_errno_trans(ret);
+        }
+    }
+  else
+    {
+      iwr->u.freq.flags = IW_FREQ_FIXED;
+      iwr->u.freq.e     = 0;
+      iwr->u.freq.m     = 2407 + 5 * wifi_cfg.ap.channel;
+    }
+
+  return OK;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_get_bitrate
+ *
+ * Description:
+ *   Get SoftAP default bit rate (Mbps).
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_bitrate(struct iwreq *iwr, bool set)
+{
+  return -ENOSYS;
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_txpower
+ *
+ * Description:
+ *   Get SoftAP transmit power (dBm).
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_txpower(struct iwreq *iwr, bool set)
+{
+  return esp_wifi_sta_txpower(iwr, set);
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_channel
+ *
+ * Description:
+ *   Get SoftAP range of channel parameters.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_channel(struct iwreq *iwr, bool set)
+{
+  return esp_wifi_sta_channel(iwr, set);
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_country
+ *
+ * Description:
+ *   Configure country info.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_country(struct iwreq *iwr, bool set)
+{
+  return esp_wifi_sta_country(iwr, set);
+}
+
+/****************************************************************************
+ * Name: esp_wifi_softap_rssi
+ *
+ * Description:
+ *   Get Wi-Fi sensitivity (dBm).
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_rssi(struct iwreq *iwr, bool set)
+{
+  return -ENOSYS;
+}
+
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
 /****************************************************************************
  * Name: esp_wifi_stop_callback
  *
diff --git a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.h 
b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.h
index 77facda8a5..d983419f20 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.h
+++ b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.h
@@ -49,6 +49,16 @@ extern "C"
 #  define ESP32S3_WLAN_HAS_STA
 #  define ESP32S3_WLAN_STA_DEVNO    0
 #  define ESP32S3_WLAN_DEVS         1
+#elif defined(CONFIG_ESP32S3_WIFI_SOFTAP)
+#  define ESP32S3_WLAN_HAS_SOFTAP
+#  define ESP32S3_WLAN_SOFTAP_DEVNO 0
+#  define ESP32S3_WLAN_DEVS         1
+#elif defined(CONFIG_ESP32S3_WIFI_STATION_SOFTAP)
+#  define ESP32S3_WLAN_HAS_STA
+#  define ESP32S3_WLAN_HAS_SOFTAP
+#  define ESP32S3_WLAN_STA_DEVNO    0
+#  define ESP32S3_WLAN_SOFTAP_DEVNO 1
+#  define ESP32S3_WLAN_DEVS         2
 #endif
 
 #define SSID_MAX_LEN                (32)
@@ -476,6 +486,344 @@ int esp_wifi_sta_country(struct iwreq *iwr, bool set);
 int esp_wifi_sta_rssi(struct iwreq *iwr, bool set);
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+
+/****************************************************************************
+ * Name: esp_wifi_softap_start
+ *
+ * Description:
+ *   Start Wi-Fi softAP.
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_start(void);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_stop
+ *
+ * Description:
+ *   Stop Wi-Fi softAP.
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_stop(void);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_send_data
+ *
+ * Description:
+ *   Use Wi-Fi softAP interface to send 802.3 frame
+ *
+ * Input Parameters:
+ *   pbuf - Packet buffer pointer
+ *   len  - Packet length
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_send_data(void *pbuf, size_t len);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_register_recv_cb
+ *
+ * Description:
+ *   Regitser Wi-Fi softAP receive packet callback function
+ *
+ * Input Parameters:
+ *   recv_cb - Receive callback function
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_register_recv_cb(int (*recv_cb)(void *buffer,
+                                                    uint16_t len,
+                                                    void *eb));
+
+/****************************************************************************
+ * Name: esp_wifi_softap_register_txdone_cb
+ *
+ * Description:
+ *   Register the softAP TX done callback function.
+ *
+ * Input Parameters:
+ *   cb - The callback function
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+void esp_wifi_softap_register_txdone_cb(wifi_txdone_cb_t cb);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_read_mac
+ *
+ * Description:
+ *   Read softAP interface MAC address from efuse
+ *
+ * Input Parameters:
+ *   mac  - MAC address buffer pointer
+ *
+ * Returned Value:
+ *   0 if success or -1 if fail
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_read_mac(uint8_t *mac);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_password
+ *
+ * Description:
+ *   Set/Get Wi-Fi SoftAP password
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set   - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_password(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_essid
+ *
+ * Description:
+ *   Set/Get Wi-Fi SoftAP ESSID
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_essid(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_bssid
+ *
+ * Description:
+ *   Set/Get Wi-Fi softAP BSSID
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set   - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_bssid(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_connect
+ *
+ * Description:
+ *   Trigger Wi-Fi softAP accept connection action
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_connect(void);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_disconnect
+ *
+ * Description:
+ *   Trigger Wi-Fi softAP drop connection action
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_disconnect(void);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_mode
+ *
+ * Description:
+ *   Set/Get Wi-Fi SoftAP mode code.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_mode(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_auth
+ *
+ * Description:
+ *   Set/Get authentication mode params.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_auth(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_freq
+ *
+ * Description:
+ *   Set/Get SoftAP frequency.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_freq(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_get_bitrate
+ *
+ * Description:
+ *   Get SoftAP default bit rate (Mbps).
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_bitrate(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_txpower
+ *
+ * Description:
+ *   Get SoftAP transmit power (dBm).
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_txpower(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_channel
+ *
+ * Description:
+ *   Get SoftAP range of channel parameters.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_channel(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_country
+ *
+ * Description:
+ *   Configure country info.
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_country(struct iwreq *iwr, bool set);
+
+/****************************************************************************
+ * Name: esp_wifi_softap_rssi
+ *
+ * Description:
+ *   Get Wi-Fi sensitivity (dBm).
+ *
+ * Input Parameters:
+ *   iwr - The argument of the ioctl cmd
+ *   set - true: set data; false: get data
+ *
+ * Returned Value:
+ *   OK on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+int esp_wifi_softap_rssi(struct iwreq *iwr, bool set);
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
 /****************************************************************************
  * Name: esp_wifi_stop_callback
  *
diff --git a/arch/xtensa/src/esp32s3/esp32s3_wlan.c 
b/arch/xtensa/src/esp32s3/esp32s3_wlan.c
index 2835b4a6f8..c8613299d7 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_wlan.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_wlan.c
@@ -175,6 +175,29 @@ static const struct wlan_ops g_sta_ops =
 };
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+static const struct wlan_ops g_softap_ops =
+{
+  .start      = esp_wifi_softap_start,
+  .send       = esp_wifi_softap_send_data,
+  .essid      = esp_wifi_softap_essid,
+  .bssid      = esp_wifi_softap_bssid,
+  .passwd     = esp_wifi_softap_password,
+  .mode       = esp_wifi_softap_mode,
+  .auth       = esp_wifi_softap_auth,
+  .freq       = esp_wifi_softap_freq,
+  .bitrate    = esp_wifi_softap_bitrate,
+  .txpower    = esp_wifi_softap_txpower,
+  .channel    = esp_wifi_softap_channel,
+  .country    = esp_wifi_softap_country,
+  .rssi       = esp_wifi_softap_rssi,
+  .connect    = esp_wifi_softap_connect,
+  .disconnect = esp_wifi_softap_disconnect,
+  .event      = esp_wifi_notify_subscribe,
+  .stop       = esp_wifi_softap_stop
+};
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
 /****************************************************************************
  * Private Function Prototypes
  ****************************************************************************/
@@ -1347,7 +1370,6 @@ static int wlan_sta_rx_done(void *buffer, uint16_t len, 
void *eb)
  *   station sending next packet.
  *
  * Input Parameters:
- *   ifidx  - The interface id that the tx callback has been triggered from.
  *   data   - Pointer to the data transmitted.
  *   len    - Length of the data transmitted.
  *   status - True if data was transmitted successfully or false if failed.
@@ -1366,10 +1388,59 @@ static void wlan_sta_tx_done(uint8_t *data, uint16_t 
*len, bool status)
 #endif /* ESP32S3_WLAN_HAS_STA */
 
 /****************************************************************************
- * Public Functions
+ * Function: wlan_softap_rx_done
+ *
+ * Description:
+ *   Wi-Fi softAP RX done callback function. If this is called, it means
+ *   softAP receiveing packet.
+ *
+ * Input Parameters:
+ *   buffer - Wi-Fi received packet buffer
+ *   len    - Length of received packet
+ *   eb     - Wi-Fi receive callback input eb pointer
+ *
+ * Returned Value:
+ *   0 on success or a negated errno on failure
+ *
  ****************************************************************************/
 
-#ifdef ESP32S3_WLAN_HAS_STA
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+static int wlan_softap_rx_done(void *buffer, uint16_t len, void *eb)
+{
+  struct wlan_priv_s *priv = &g_wlan_priv[ESP32S3_WLAN_SOFTAP_DEVNO];
+
+  return wlan_rx_done(priv, buffer, len, eb);
+}
+
+/****************************************************************************
+ * Name: wlan_softap_tx_done
+ *
+ * Description:
+ *   Wi-Fi softAP TX done callback function. If this is called, it means
+ *   softAP sending next packet.
+ *
+ * Input Parameters:
+ *   ifidx  - The interface ID that the TX callback has been triggered from.
+ *   data   - Pointer to the data transmitted.
+ *   len    - Length of the data transmitted.
+ *   status - True if data was transmitted successfully or false if failed.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+static void wlan_softap_tx_done(uint8_t *data, uint16_t *len, bool status)
+{
+  struct wlan_priv_s *priv = &g_wlan_priv[ESP32S3_WLAN_SOFTAP_DEVNO];
+
+  wlan_tx_done(priv);
+}
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
 
 /****************************************************************************
  * Name: esp32s3_wlan_sta_set_linkstatus
@@ -1387,6 +1458,7 @@ static void wlan_sta_tx_done(uint8_t *data, uint16_t 
*len, bool status)
  *
  ****************************************************************************/
 
+#ifdef ESP32S3_WLAN_HAS_STA
 int esp32s3_wlan_sta_set_linkstatus(bool linkstatus)
 {
   int ret = -EINVAL;
@@ -1471,4 +1543,65 @@ int esp32s3_wlan_sta_initialize(void)
 }
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+/****************************************************************************
+ * Name: esp32s3_wlan_softap_initialize
+ *
+ * Description:
+ *   Initialize the ESP32-S3 WLAN softAP netcard driver
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success; Negated errno on failure.
+ *
+ ****************************************************************************/
+
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+int esp32s3_wlan_softap_initialize(void)
+{
+  int ret;
+  uint8_t eth_mac[6];
+
+  ret = esp_wifi_adapter_init();
+  if (ret < 0)
+    {
+      nerr("ERROR: Initialize Wi-Fi adapter error: %d\n", ret);
+      return ret;
+    }
+
+  ret = esp_wifi_softap_read_mac(eth_mac);
+  if (ret < 0)
+    {
+      nerr("ERROR: Failed to read MAC address\n");
+      return ret;
+    }
+
+  ninfo("Wi-Fi softAP MAC: %02X:%02X:%02X:%02X:%02X:%02X\n",
+        eth_mac[0], eth_mac[1], eth_mac[2],
+        eth_mac[3], eth_mac[4], eth_mac[5]);
+
+  ret = esp32s3_net_initialize(ESP32S3_WLAN_SOFTAP_DEVNO, eth_mac,
+                             &g_softap_ops);
+  if (ret < 0)
+    {
+      nerr("ERROR: Failed to initialize net\n");
+      return ret;
+    }
+
+  ret = esp_wifi_softap_register_recv_cb(wlan_softap_rx_done);
+  if (ret < 0)
+    {
+      nerr("ERROR: Failed to register RX callback\n");
+      return ret;
+    }
+
+  esp_wifi_softap_register_txdone_cb(wlan_softap_tx_done);
+
+  ninfo("INFO: Initialize Wi-Fi softAP net success\n");
+
+  return OK;
+}
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
 #endif  /* CONFIG_ESP32S3_WIFI */
diff --git a/arch/xtensa/src/esp32s3/esp32s3_wlan.h 
b/arch/xtensa/src/esp32s3/esp32s3_wlan.h
index da9a1ee5c2..a522a602e5 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_wlan.h
+++ b/arch/xtensa/src/esp32s3/esp32s3_wlan.h
@@ -83,6 +83,24 @@ int esp32s3_wlan_sta_set_linkstatus(bool linkstatus);
 int esp32s3_wlan_sta_initialize(void);
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+/****************************************************************************
+ * Name: esp32s3_wlan_softap_initialize
+ *
+ * Description:
+ *   Initialize the ESP32-S3 WLAN softAP netcard driver
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   OK on success; Negated errno on failure.
+ *
+ ****************************************************************************/
+
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+int esp32s3_wlan_softap_initialize(void);
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
 #endif /* CONFIG_ESP32S3_WIFI */
 #ifdef __cplusplus
 }
diff --git a/boards/xtensa/esp32s3/common/src/esp32s3_board_wlan.c 
b/boards/xtensa/esp32s3/common/src/esp32s3_board_wlan.c
index ffa8b73040..ef3c733f6e 100644
--- a/boards/xtensa/esp32s3/common/src/esp32s3_board_wlan.c
+++ b/boards/xtensa/esp32s3/common/src/esp32s3_board_wlan.c
@@ -68,6 +68,15 @@ int board_wlan_init(void)
     }
 #endif /* ESP32S3_WLAN_HAS_STA */
 
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+  ret = esp32s3_wlan_softap_initialize();
+  if (ret)
+    {
+      wlerr("ERROR: Failed to initialize Wi-Fi softAP\n");
+      return ret;
+    }
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
   return ret;
 }
 
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/sta_softap/defconfig 
b/boards/xtensa/esp32s3/esp32s3-devkit/configs/sta_softap/defconfig
new file mode 100644
index 0000000000..1abf757639
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/sta_softap/defconfig
@@ -0,0 +1,86 @@
+#
+# 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_ESP32S3_WIFI_STATION_SOFTAP=y
+CONFIG_EXAMPLES_DHCPD=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_DHCPD=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


Reply via email to