xtensa/esp32: Refactor ESP32 Wi-Fi driver
This commit is contained in:
parent
b73026ee55
commit
3bb9a42c6b
|
@ -661,6 +661,34 @@ endmenu # ESP32_EMAC
|
|||
menu "WiFi configuration"
|
||||
depends on ESP32_WIRELESS
|
||||
|
||||
config ESP32_WIFI_STATIC_RXBUF_NUM
|
||||
int "WiFi static RX buffer number"
|
||||
default 10
|
||||
|
||||
config ESP32_WIFI_DYNAMIC_RXBUF_NUM
|
||||
int "WiFi dynamic RX buffer number"
|
||||
default 32
|
||||
|
||||
config ESP32_WIFI_DYNAMIC_TXBUF_NUM
|
||||
int "WiFi dynamic TX buffer number"
|
||||
default 32
|
||||
|
||||
config ESP32_WIFI_TX_AMPDU
|
||||
bool "WiFi TX AMPDU"
|
||||
default y
|
||||
|
||||
config ESP32_WIFI_RX_AMPDU
|
||||
bool "WiFi RX AMPDU"
|
||||
default y
|
||||
|
||||
config ESP32_WIFI_RXBA_AMPDU_WZ
|
||||
int "WiFi RX BA AMPDU windown size"
|
||||
default 6
|
||||
|
||||
config ESP32_WLAN_RXBUF_NUM
|
||||
int "WLAN netcard RX buffer number"
|
||||
default 16
|
||||
|
||||
config ESP32_WIFI_CONNECT_TIMEOUT
|
||||
int "Connect timeout by second"
|
||||
default 10
|
||||
|
|
|
@ -180,7 +180,7 @@ endif
|
|||
|
||||
ifeq ($(CONFIG_ESP32_WIRELESS),y)
|
||||
WIRELESS_DRV_UNPACK = esp-wireless-drivers-3rdparty
|
||||
WIRELESS_DRV_ID = 5cb6561
|
||||
WIRELESS_DRV_ID = 4a352be
|
||||
WIRELESS_DRV_ZIP = $(WIRELESS_DRV_ID).zip
|
||||
WIRELESS_DRV_URL = https://github.com/espressif/esp-wireless-drivers-3rdparty/archive
|
||||
|
||||
|
|
|
@ -553,6 +553,30 @@ void rt_timer_delete(FAR struct rt_timer_s *timer)
|
|||
delete_rt_timer(timer);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rt_timer_time_us
|
||||
*
|
||||
* Description:
|
||||
* Get time of RT timer by micro second.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Time of RT timer by micro second.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint64_t rt_timer_time_us(void)
|
||||
{
|
||||
uint64_t counter;
|
||||
struct esp32_tim_dev_s *tim = s_esp32_tim_dev;
|
||||
|
||||
ESP32_TIM_GETCTR(tim, &counter);
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_rt_timer_init
|
||||
*
|
||||
|
|
|
@ -150,6 +150,22 @@ void rt_timer_stop(FAR struct rt_timer_s *timer);
|
|||
|
||||
void rt_timer_delete(FAR struct rt_timer_s *timer);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rt_timer_time_us
|
||||
*
|
||||
* Description:
|
||||
* Get time of RT timer by micro second.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Time of RT timer by micro second.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint64_t rt_timer_time_us(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_rt_timer_init
|
||||
*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -60,6 +60,9 @@ enum wifi_adpt_evt_e
|
|||
|
||||
typedef void (*wifi_evt_cb_t)(void *p);
|
||||
|
||||
typedef void (* wifi_tx_done_cb_t)(uint8_t ifidx, uint8_t *data,
|
||||
uint16_t *len, bool txstatus);
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
@ -214,6 +217,22 @@ int esp_wifi_set_ssid(const uint8_t *pdata, uint8_t len);
|
|||
|
||||
int esp_wifi_connect_internal(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_wifi_sta_register_txdone_cb
|
||||
*
|
||||
* Description:
|
||||
* Register the txDone callback function of type wifi_tx_done_cb_t
|
||||
*
|
||||
* Input Parameters:
|
||||
* callback - The callback function
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 if success or -1 if fail
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_wifi_sta_register_txdone_cb(void *callback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -45,10 +45,10 @@ extern "C"
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_wlan_initialize
|
||||
* Name: esp32_wlan_sta_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the esp32 wlan driver
|
||||
* Initialize the esp32 WLAN station netcard driver
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
|
@ -56,11 +56,9 @@ extern "C"
|
|||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_wlan_initialize(void);
|
||||
int esp32_wlan_sta_initialize(void);
|
||||
|
||||
#endif /* CONFIG_ESP32_WIRELESS */
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1223,6 +1223,7 @@
|
|||
/* DPORT_WIFI_RST : R/W ;bitpos:[31:0] ;default: 32'h0 ; */
|
||||
|
||||
#define DPORT_EMAC_RST_EN (BIT(7))
|
||||
#define DPORT_MAC_RST_EN (BIT(2))
|
||||
|
||||
#define DPORT_WIFI_RST 0xFFFFFFFF
|
||||
#define DPORT_WIFI_RST_M ((DPORT_WIFI_RST_V)<<(DPORT_WIFI_RST_S))
|
||||
|
|
|
@ -207,7 +207,7 @@ int esp32_bringup(void)
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
ret = esp32_wlan_initialize();
|
||||
ret = esp32_wlan_sta_initialize();
|
||||
if (ret)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize WiFi\n");
|
||||
|
|
Loading…
Reference in New Issue