mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
xtensa/esp32: Refactor ESP32 WiFi driver to support station and softAP coexistence
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
5699dd86eb
commit
b2f5031e96
@@ -383,6 +383,7 @@
|
|||||||
#define ESP32_CPUINT_NNMIPERIPHS 1
|
#define ESP32_CPUINT_NNMIPERIPHS 1
|
||||||
#define EPS32_CPUINT_NMISET 0x00004000
|
#define EPS32_CPUINT_NMISET 0x00004000
|
||||||
|
|
||||||
|
#define ESP32_CPUINT_MAC 0
|
||||||
#define ESP32_CPUINT_TIMER0 6
|
#define ESP32_CPUINT_TIMER0 6
|
||||||
#define ESP32_CPUINT_SOFTWARE0 7
|
#define ESP32_CPUINT_SOFTWARE0 7
|
||||||
#define ESP32_CPUINT_PROFILING 11
|
#define ESP32_CPUINT_PROFILING 11
|
||||||
|
|||||||
@@ -852,6 +852,21 @@ endmenu # ESP32_EMAC
|
|||||||
menu "WiFi configuration"
|
menu "WiFi configuration"
|
||||||
depends on ESP32_WIRELESS
|
depends on ESP32_WIRELESS
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "ESP32 WiFi mode"
|
||||||
|
default ESP32_WIFI_STATION
|
||||||
|
|
||||||
|
config ESP32_WIFI_STATION
|
||||||
|
bool "Station mode"
|
||||||
|
|
||||||
|
config ESP32_WIFI_SOFTAP
|
||||||
|
bool "SoftAP mode"
|
||||||
|
|
||||||
|
config ESP32_WIFI_STATION_SOFTAP_COEXISTENCE
|
||||||
|
bool "Station + SoftAP coexistence"
|
||||||
|
|
||||||
|
endchoice # ESP32 WiFi mode
|
||||||
|
|
||||||
config ESP32_WIFI_STATIC_RXBUF_NUM
|
config ESP32_WIFI_STATIC_RXBUF_NUM
|
||||||
int "WiFi static RX buffer number"
|
int "WiFi static RX buffer number"
|
||||||
default 10
|
default 10
|
||||||
@@ -876,8 +891,8 @@ config ESP32_WIFI_RXBA_AMPDU_WZ
|
|||||||
int "WiFi RX BA AMPDU windown size"
|
int "WiFi RX BA AMPDU windown size"
|
||||||
default 6
|
default 6
|
||||||
|
|
||||||
config ESP32_WLAN_RXBUF_NUM
|
config ESP32_WLAN_PKTBUF_NUM
|
||||||
int "WLAN netcard RX buffer number"
|
int "WLAN netcard packet buffer number per netcard"
|
||||||
default 16
|
default 16
|
||||||
|
|
||||||
config ESP32_WIFI_CONNECT_TIMEOUT
|
config ESP32_WIFI_CONNECT_TIMEOUT
|
||||||
|
|||||||
@@ -150,6 +150,12 @@
|
|||||||
#define ESP32_MAX_PRIORITY 5
|
#define ESP32_MAX_PRIORITY 5
|
||||||
#define ESP32_PRIO_INDEX(p) ((p) - ESP32_MIN_PRIORITY)
|
#define ESP32_PRIO_INDEX(p) ((p) - ESP32_MIN_PRIORITY)
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_WIRELESS
|
||||||
|
# define ESP32_WIRELESS_RESERVE_INT (1 << ESP32_CPUINT_MAC)
|
||||||
|
#else
|
||||||
|
# define ESP32_WIRELESS_RESERVE_INT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -179,9 +185,11 @@ static uint32_t g_intenable[1];
|
|||||||
* devices.
|
* devices.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static uint32_t g_cpu0_freeints = EPS32_CPUINT_PERIPHSET;
|
static uint32_t g_cpu0_freeints = EPS32_CPUINT_PERIPHSET &
|
||||||
|
(~ESP32_WIRELESS_RESERVE_INT);
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
static uint32_t g_cpu1_freeints = EPS32_CPUINT_PERIPHSET;
|
static uint32_t g_cpu1_freeints = EPS32_CPUINT_PERIPHSET &
|
||||||
|
(~ESP32_WIRELESS_RESERVE_INT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Bitsets for each interrupt priority 1-5 */
|
/* Bitsets for each interrupt priority 1-5 */
|
||||||
@@ -374,6 +382,7 @@ int esp32_cpuint_initialize(void)
|
|||||||
*
|
*
|
||||||
* CPU interrupt bit IRQ number
|
* CPU interrupt bit IRQ number
|
||||||
* --------------------------- ---------------------
|
* --------------------------- ---------------------
|
||||||
|
* ESP32_CPUINT_MAC 0 ESP32_IRQ_MAC 4
|
||||||
* ESP32_CPUINT_TIMER0 6 XTENSA_IRQ_TIMER0 0
|
* ESP32_CPUINT_TIMER0 6 XTENSA_IRQ_TIMER0 0
|
||||||
* ESP32_CPUINT_SOFTWARE0 7 Not yet defined
|
* ESP32_CPUINT_SOFTWARE0 7 Not yet defined
|
||||||
* ESP32_CPUINT_PROFILING 11 Not yet defined
|
* ESP32_CPUINT_PROFILING 11 Not yet defined
|
||||||
@@ -385,6 +394,13 @@ int esp32_cpuint_initialize(void)
|
|||||||
intmap[ESP32_CPUINT_TIMER0] = XTENSA_IRQ_TIMER0;
|
intmap[ESP32_CPUINT_TIMER0] = XTENSA_IRQ_TIMER0;
|
||||||
intmap[ESP32_CPUINT_TIMER1] = XTENSA_IRQ_TIMER1;
|
intmap[ESP32_CPUINT_TIMER1] = XTENSA_IRQ_TIMER1;
|
||||||
intmap[ESP32_CPUINT_TIMER2] = XTENSA_IRQ_TIMER2;
|
intmap[ESP32_CPUINT_TIMER2] = XTENSA_IRQ_TIMER2;
|
||||||
|
|
||||||
|
/* Reserve CPU interrupt for some special drivers */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_WIRELESS
|
||||||
|
intmap[ESP32_CPUINT_MAC] = ESP32_IRQ_MAC;
|
||||||
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -44,6 +44,22 @@ extern "C"
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_ESP32_WIFI_STATION)
|
||||||
|
# define ESP32_WLAN_HAS_STA
|
||||||
|
# define ESP32_WLAN_STA_DEVNO 0
|
||||||
|
# define ESP32_WLAN_DEVS 1
|
||||||
|
#elif defined(CONFIG_ESP32_WIFI_SOFTAP)
|
||||||
|
# define ESP32_WLAN_HAS_SOFTAP
|
||||||
|
# define ESP32_WLAN_SOFTAP_DEVNO 0
|
||||||
|
# define ESP32_WLAN_DEVS 1
|
||||||
|
#elif defined(CONFIG_ESP32_WIFI_STATION_SOFTAP_COEXISTENCE)
|
||||||
|
# define ESP32_WLAN_HAS_STA
|
||||||
|
# define ESP32_WLAN_HAS_SOFTAP
|
||||||
|
# define ESP32_WLAN_STA_DEVNO 0
|
||||||
|
# define ESP32_WLAN_SOFTAP_DEVNO 1
|
||||||
|
# define ESP32_WLAN_DEVS 2
|
||||||
|
#endif
|
||||||
|
|
||||||
/* WiFi event ID */
|
/* WiFi event ID */
|
||||||
|
|
||||||
enum wifi_adpt_evt_e
|
enum wifi_adpt_evt_e
|
||||||
@@ -60,8 +76,9 @@ enum wifi_adpt_evt_e
|
|||||||
|
|
||||||
typedef void (*wifi_evt_cb_t)(void *p);
|
typedef void (*wifi_evt_cb_t)(void *p);
|
||||||
|
|
||||||
typedef void (* wifi_tx_done_cb_t)(uint8_t ifidx, uint8_t *data,
|
/* WiFi TX done callback function */
|
||||||
uint16_t *len, bool txstatus);
|
|
||||||
|
typedef void (*wifi_txdone_cb_t)(uint8_t *data, uint16_t *len, bool status);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
@@ -83,6 +100,22 @@ typedef void (* wifi_tx_done_cb_t)(uint8_t ifidx, uint8_t *data,
|
|||||||
|
|
||||||
int esp_wifi_adapter_init(void);
|
int esp_wifi_adapter_init(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_free_eb
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Free WiFi receive callback input eb pointer
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* eb - WiFi receive callback input eb pointer
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void esp_wifi_free_eb(void *eb);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_notify_subscribe
|
* Name: esp_wifi_notify_subscribe
|
||||||
*
|
*
|
||||||
@@ -100,6 +133,40 @@ int esp_wifi_adapter_init(void);
|
|||||||
|
|
||||||
int esp_wifi_notify_subscribe(pid_t pid, FAR struct sigevent *event);
|
int esp_wifi_notify_subscribe(pid_t pid, FAR struct sigevent *event);
|
||||||
|
|
||||||
|
#ifdef ESP32_WLAN_HAS_STA
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_sta_start
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Start WiFi station.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or -1 if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_sta_start(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_sta_stop
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Stop WiFi station.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or -1 if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_sta_stop(void);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_sta_send_data
|
* Name: esp_wifi_sta_send_data
|
||||||
*
|
*
|
||||||
@@ -121,10 +188,10 @@ int esp_wifi_sta_send_data(void *pbuf, uint32_t len);
|
|||||||
* Name: esp_wifi_sta_register_recv_cb
|
* Name: esp_wifi_sta_register_recv_cb
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Regitser WiFi receive packet callback function
|
* Regitser WiFi station receive packet callback function
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* input_cb - Receive callback function
|
* recv_cb - Receive callback function
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0 if success or others if fail
|
* 0 if success or others if fail
|
||||||
@@ -135,6 +202,22 @@ int esp_wifi_sta_register_recv_cb(int (*recv_cb)(void *buffer,
|
|||||||
uint16_t len,
|
uint16_t len,
|
||||||
void *eb));
|
void *eb));
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_sta_register_txdone_cb
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Register the station TX done callback function.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* cb - The callback function
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void esp_wifi_sta_register_txdone_cb(wifi_txdone_cb_t cb);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_sta_read_mac
|
* Name: esp_wifi_sta_read_mac
|
||||||
*
|
*
|
||||||
@@ -151,27 +234,11 @@ int esp_wifi_sta_register_recv_cb(int (*recv_cb)(void *buffer,
|
|||||||
|
|
||||||
int esp_wifi_sta_read_mac(uint8_t *mac);
|
int esp_wifi_sta_read_mac(uint8_t *mac);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: esp_wifi_free_eb
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Free WiFi receive callback input eb pointer
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* eb - WiFi receive callback input eb pointer
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void esp_wifi_free_eb(void *eb);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_set_password
|
* Name: esp_wifi_set_password
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set WiFi password
|
* Set WiFi station password
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* pdata - Password buffer pointer
|
* pdata - Password buffer pointer
|
||||||
@@ -182,13 +249,13 @@ void esp_wifi_free_eb(void *eb);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int esp_wifi_set_password(const uint8_t *pdata, uint8_t len);
|
int esp_wifi_sta_set_password(const uint8_t *pdata, uint8_t len);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_set_ssid
|
* Name: esp_wifi_set_ssid
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set WiFi SSID
|
* Set WiFi station SSID
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* pdata - SSID buffer pointer
|
* pdata - SSID buffer pointer
|
||||||
@@ -199,13 +266,13 @@ int esp_wifi_set_password(const uint8_t *pdata, uint8_t len);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int esp_wifi_set_ssid(const uint8_t *pdata, uint8_t len);
|
int esp_wifi_sta_set_ssid(const uint8_t *pdata, uint8_t len);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_connect_internal
|
* Name: esp_wifi_sta_connect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Trigger WiFi connection action
|
* Trigger WiFi station connection action
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
@@ -215,23 +282,192 @@ int esp_wifi_set_ssid(const uint8_t *pdata, uint8_t len);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int esp_wifi_connect_internal(void);
|
int esp_wifi_sta_connect(void);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_sta_register_txdone_cb
|
* Name: esp_wifi_sta_disconnect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register the txDone callback function of type wifi_tx_done_cb_t
|
* Trigger WiFi station disconnection action
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* callback - The callback function
|
* None
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0 if success or -1 if fail
|
* 0 if success or -1 if fail
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int esp_wifi_sta_register_txdone_cb(void *callback);
|
int esp_wifi_sta_disconnect(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_softap_start
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Start WiFi softAP.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or -1 if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_softap_start(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_softap_stop
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Stop WiFi softAP.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or -1 if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_softap_stop(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_softap_send_data
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Use WiFi softAP interface to send 802.3 frame
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* pbuf - Packet buffer pointer
|
||||||
|
* len - Packet length
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or others if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_softap_send_data(void *pbuf, uint32_t len);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_softap_register_recv_cb
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Regitser WiFi softAP receive packet callback function
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* recv_cb - Receive callback function
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or others if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
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_set_password
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Set WiFi softAP password
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* pdata - Password buffer pointer
|
||||||
|
* len - Password length
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or -1 if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_softap_set_password(const uint8_t *pdata, uint8_t len);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_softap_set_ssid
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Set WiFi softAP SSID
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* pdata - SSID buffer pointer
|
||||||
|
* len - SSID length
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or -1 if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_softap_set_ssid(const uint8_t *pdata, uint8_t len);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_softap_connect
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Trigger WiFi softAP accept connection action
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or -1 if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_softap_connect(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_softap_disconnect
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Trigger WiFi softAP drop connection action
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or -1 if fail
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_wifi_softap_disconnect(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+549
-208
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include "esp32_wifi_adapter.h"
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
@@ -58,7 +60,27 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef ESP32_WLAN_HAS_STA
|
||||||
int esp32_wlan_sta_initialize(void);
|
int esp32_wlan_sta_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32_wlan_softap_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the esp32 WLAN softAP netcard driver
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* OK on success; Negated errno on failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
|
int esp32_wlan_softap_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_ESP32_WIRELESS */
|
#endif /* CONFIG_ESP32_WIRELESS */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
#
|
||||||
|
# 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_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
# CONFIG_NSH_CMDPARMS is not set
|
||||||
|
# CONFIG_NSH_NETINIT is not set
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="esp32-devkitc"
|
||||||
|
CONFIG_ARCH_BOARD_ESP32_DEVKITC=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32WROVER=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_ASSERTIONS=y
|
||||||
|
CONFIG_DEBUG_ERROR=y
|
||||||
|
CONFIG_DEBUG_FEATURES=y
|
||||||
|
CONFIG_DEBUG_WARN=y
|
||||||
|
CONFIG_DEBUG_WIRELESS=y
|
||||||
|
CONFIG_DEBUG_WIRELESS_ERROR=y
|
||||||
|
CONFIG_DRIVERS_IEEE80211=y
|
||||||
|
CONFIG_DRIVERS_WIRELESS=y
|
||||||
|
CONFIG_ESP32_MTD_SIZE=0x80000
|
||||||
|
CONFIG_ESP32_SPIFLASH=y
|
||||||
|
CONFIG_ESP32_UART0=y
|
||||||
|
CONFIG_ESP32_WIFI_SAVE_PARAM=y
|
||||||
|
CONFIG_ESP32_WIFI_STATION_SOFTAP_COEXISTENCE=y
|
||||||
|
CONFIG_ESP32_WIRELESS=y
|
||||||
|
CONFIG_EXAMPLES_DHCPD=y
|
||||||
|
CONFIG_EXPERIMENTAL=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_SPIFFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_MAX_TASKS=16
|
||||||
|
CONFIG_MM_REGIONS=2
|
||||||
|
CONFIG_NETDB_DNSCLIENT=y
|
||||||
|
CONFIG_NETDEV_LATEINIT=y
|
||||||
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
CONFIG_NETDEV_WIRELESS_IOCTL=y
|
||||||
|
CONFIG_NETUTILS_DHCPD=y
|
||||||
|
CONFIG_NET_BROADCAST=y
|
||||||
|
CONFIG_NET_ETH_PKTSIZE=1514
|
||||||
|
CONFIG_NET_ICMP=y
|
||||||
|
CONFIG_NET_ICMP_SOCKET=y
|
||||||
|
CONFIG_NET_SOCKOPTS=y
|
||||||
|
CONFIG_NET_UDP=y
|
||||||
|
CONFIG_NFILE_DESCRIPTORS=8
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_LINELEN=64
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_LPWORK=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SDCLONE_DISABLE=y
|
||||||
|
CONFIG_SIG_DEFAULT=y
|
||||||
|
CONFIG_SPIFFS_NAME_MAX=48
|
||||||
|
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_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_WIRELESS=y
|
||||||
|
CONFIG_WIRELESS_WAPI=y
|
||||||
|
CONFIG_WIRELESS_WAPI_CMDTOOL=y
|
||||||
@@ -230,14 +230,25 @@ int esp32_bringup(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET
|
#ifdef CONFIG_NET
|
||||||
|
#ifdef ESP32_WLAN_HAS_STA
|
||||||
ret = esp32_wlan_sta_initialize();
|
ret = esp32_wlan_sta_initialize();
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi\n");
|
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi station\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
|
ret = esp32_wlan_softap_initialize();
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi softAP\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIMER
|
#ifdef CONFIG_TIMER
|
||||||
|
|||||||
@@ -190,14 +190,25 @@ int esp32_bringup(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET
|
#ifdef CONFIG_NET
|
||||||
|
#ifdef ESP32_WLAN_HAS_STA
|
||||||
ret = esp32_wlan_sta_initialize();
|
ret = esp32_wlan_sta_initialize();
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi\n");
|
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi station\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
|
ret = esp32_wlan_softap_initialize();
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi softAP\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIMER
|
#ifdef CONFIG_TIMER
|
||||||
|
|||||||
@@ -199,14 +199,25 @@ int esp32_bringup(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET
|
#ifdef CONFIG_NET
|
||||||
|
#ifdef ESP32_WLAN_HAS_STA
|
||||||
ret = esp32_wlan_sta_initialize();
|
ret = esp32_wlan_sta_initialize();
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi\n");
|
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi station\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
|
ret = esp32_wlan_softap_initialize();
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi softAP\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIMER
|
#ifdef CONFIG_TIMER
|
||||||
|
|||||||
Reference in New Issue
Block a user