mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
arch/risc-v: Support the ethernet driver on ESP32-P4
This commit enables the ethernet driver support on ESP32-P4 based on a common-source implementation. This required a set of changes regargind the event handler for the Wi-Fi driver (which is now shared with the ethernet driver). Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
This commit is contained in:
committed by
Xiang Xiao
parent
4b4ba522cb
commit
5c4c60f9d2
@@ -164,6 +164,10 @@ if(CONFIG_ESP_MCPWM)
|
|||||||
list(APPEND SRCS esp_mcpwm.c)
|
list(APPEND SRCS esp_mcpwm.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ESPRESSIF_EMAC)
|
||||||
|
list(APPEND SRCS esp_emac.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL)
|
if(CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL)
|
||||||
list(APPEND SRCS esp_nxdiag.c)
|
list(APPEND SRCS esp_nxdiag.c)
|
||||||
endif()
|
endif()
|
||||||
@@ -209,7 +213,7 @@ if(DEFINED ENV{ESP_HAL_3RDPARTY_VERSION})
|
|||||||
CACHE STRING "ESP HAL 3rdparty version")
|
CACHE STRING "ESP HAL 3rdparty version")
|
||||||
else()
|
else()
|
||||||
set(ESP_HAL_3RDPARTY_VERSION
|
set(ESP_HAL_3RDPARTY_VERSION
|
||||||
8630b6b82cb84838f86332e00f39ab72a64cf186
|
c32f1ad13f4ce8312de494e8b79c88fda10fe9ed
|
||||||
CACHE STRING "ESP HAL 3rdparty version")
|
CACHE STRING "ESP HAL 3rdparty version")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -1995,6 +1995,17 @@ config ESPRESSIF_BLE
|
|||||||
---help---
|
---help---
|
||||||
Enable BLE support
|
Enable BLE support
|
||||||
|
|
||||||
|
config ESPRESSIF_EMAC
|
||||||
|
bool "Ethernet MAC"
|
||||||
|
depends on ARCH_CHIP_ESP32P4
|
||||||
|
default n
|
||||||
|
select NET
|
||||||
|
select ARCH_PHY_INTERRUPT
|
||||||
|
select ESPRESSIF_HR_TIMER
|
||||||
|
select SCHED_LPWORK
|
||||||
|
---help---
|
||||||
|
Enable Ethernet MAC support.
|
||||||
|
|
||||||
config ESP_COEX_SW_COEXIST_ENABLE
|
config ESP_COEX_SW_COEXIST_ENABLE
|
||||||
bool "Software WiFi/Bluetooth/IEEE 802.15.4 coexistence"
|
bool "Software WiFi/Bluetooth/IEEE 802.15.4 coexistence"
|
||||||
depends on (ESPRESSIF_WIFI && ESPRESSIF_BLE) || \
|
depends on (ESPRESSIF_WIFI && ESPRESSIF_BLE) || \
|
||||||
@@ -2462,6 +2473,157 @@ endif # ESPRESSIF_ADC_2
|
|||||||
|
|
||||||
endmenu # ADC Configuration
|
endmenu # ADC Configuration
|
||||||
|
|
||||||
|
menu "Ethernet Configuration"
|
||||||
|
depends on ESPRESSIF_EMAC
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_NRXDESC
|
||||||
|
int "RX descriptor number"
|
||||||
|
default 20
|
||||||
|
---help---
|
||||||
|
Number of DMA receive descriptors/buffers used by the EMAC.
|
||||||
|
Each buffer is CONFIG_ESPRESSIF_ETH_DMA_BUFFER_SIZE bytes.
|
||||||
|
The default of 20 provides headroom for TCP-style ACK bursts
|
||||||
|
that arrive while the upper layer is busy submitting a TX burst
|
||||||
|
(otherwise the EMAC asserts RX_BUFF_UNAVAILABLE and silently
|
||||||
|
drops incoming frames, forcing TCP retransmissions).
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_NTXDESC
|
||||||
|
int "TX descriptor number"
|
||||||
|
default 20
|
||||||
|
---help---
|
||||||
|
Number of DMA transmit descriptors/buffers used by the EMAC.
|
||||||
|
With CONFIG_ESPRESSIF_ETH_DMA_BUFFER_SIZE=1600, each descriptor
|
||||||
|
holds one Ethernet frame. TCP send() bursts up to ~12 segments
|
||||||
|
back-to-back; 20 descriptors gives ample headroom so that
|
||||||
|
esp_eth_transmit() never returns ESP_ERR_NO_MEM mid-burst.
|
||||||
|
If the ring is exhausted, frames are silently dropped and
|
||||||
|
retransmissions happen via fast-retransmit/RTO, drastically
|
||||||
|
degrading throughput.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_DMA_BUFFER_SIZE
|
||||||
|
int "DMA buffer size (bytes)"
|
||||||
|
default 1600
|
||||||
|
range 256 1600
|
||||||
|
---help---
|
||||||
|
Size of each DMA buffer used by the EMAC (must match esp_eth's
|
||||||
|
CONFIG_ETH_DMA_BUFFER_SIZE). At the maximum 1600 bytes one
|
||||||
|
buffer holds an entire 1518-byte Ethernet frame, so a typical
|
||||||
|
TX uses exactly one descriptor. Lower values cause the MAC DMA
|
||||||
|
to chain multiple descriptors per frame, reducing the effective
|
||||||
|
number of frames the ring can hold.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_TX_MAX_RETRIES
|
||||||
|
int "TX submit retry budget"
|
||||||
|
default 32
|
||||||
|
range 1 256
|
||||||
|
---help---
|
||||||
|
Number of times emac_transmit() retries esp_eth_transmit() when
|
||||||
|
the DMA TX descriptor ring is fully owned by hardware
|
||||||
|
(ESP_ERR_NO_MEM). Between attempts the driver yields the CPU
|
||||||
|
via sched_yield() so that the RX worker (and any other peer at
|
||||||
|
the same priority) can run while the EMAC DMA drains its TX
|
||||||
|
descriptors in the background. The default of 32 covers a
|
||||||
|
full ring rotation under sustained TCP bursts while remaining
|
||||||
|
bounded; increase if the network has very high latency between
|
||||||
|
TX submissions and DMA descriptor recycling.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_PHY_ADDR
|
||||||
|
int "PHY address"
|
||||||
|
default 1
|
||||||
|
range 0 31
|
||||||
|
---help---
|
||||||
|
Address of the external Ethernet PHY on the SMI (MDC/MDIO) bus.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_MDC_GPIO
|
||||||
|
int "MDC GPIO"
|
||||||
|
default 31 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the PHY MDC pin. The shipped default
|
||||||
|
corresponds to the ESP32-P4 Function EV Board V1.5.2; override
|
||||||
|
for other boards/SoCs.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_MDIO_GPIO
|
||||||
|
int "MDIO GPIO"
|
||||||
|
default 52 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the PHY MDIO pin. The shipped default
|
||||||
|
corresponds to the ESP32-P4 Function EV Board V1.5.2; override
|
||||||
|
for other boards/SoCs.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_RMII_CLK_GPIO
|
||||||
|
int "RMII REF_CLK GPIO"
|
||||||
|
default 50 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number for the RMII 50MHz reference clock (input). The
|
||||||
|
shipped default corresponds to the ESP32-P4 Function EV Board
|
||||||
|
V1.5.2; override for other boards/SoCs.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_RMII_TX_EN_GPIO
|
||||||
|
int "RMII TX_EN GPIO"
|
||||||
|
default 49 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the RMII TX_EN pin. Default is for the
|
||||||
|
ESP32-P4 Function EV Board V1.5.2.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_RMII_TXD0_GPIO
|
||||||
|
int "RMII TXD0 GPIO"
|
||||||
|
default 34 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the RMII TXD0 pin. Default is for the
|
||||||
|
ESP32-P4 Function EV Board V1.5.2.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_RMII_TXD1_GPIO
|
||||||
|
int "RMII TXD1 GPIO"
|
||||||
|
default 35 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the RMII TXD1 pin. Default is for the
|
||||||
|
ESP32-P4 Function EV Board V1.5.2.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_RMII_CRS_DV_GPIO
|
||||||
|
int "RMII CRS_DV GPIO"
|
||||||
|
default 28 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the RMII CRS_DV pin. Default is for
|
||||||
|
the ESP32-P4 Function EV Board V1.5.2.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_RMII_RXD0_GPIO
|
||||||
|
int "RMII RXD0 GPIO"
|
||||||
|
default 29 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the RMII RXD0 pin. Default is for the
|
||||||
|
ESP32-P4 Function EV Board V1.5.2.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_RMII_RXD1_GPIO
|
||||||
|
int "RMII RXD1 GPIO"
|
||||||
|
default 30 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the RMII RXD1 pin. Default is for the
|
||||||
|
ESP32-P4 Function EV Board V1.5.2.
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_ENABLE_PHY_RSTPIN
|
||||||
|
bool "Enable PHY reset pin"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config ESPRESSIF_ETH_PHY_RST_GPIO
|
||||||
|
int "PHY reset GPIO"
|
||||||
|
default 51 if ARCH_CHIP_ESP32P4
|
||||||
|
default -1
|
||||||
|
depends on ESPRESSIF_ETH_ENABLE_PHY_RSTPIN
|
||||||
|
---help---
|
||||||
|
GPIO number connected to the PHY reset pin. Default is for the
|
||||||
|
ESP32-P4 Function EV Board V1.5.2.
|
||||||
|
|
||||||
|
endmenu # Ethernet Configuration
|
||||||
|
|
||||||
menu "Wi-Fi Configuration"
|
menu "Wi-Fi Configuration"
|
||||||
depends on ESPRESSIF_WIFI
|
depends on ESPRESSIF_WIFI
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,10 @@ ifeq ($(CONFIG_ESP_MCPWM),y)
|
|||||||
CHIP_CSRCS += esp_mcpwm.c
|
CHIP_CSRCS += esp_mcpwm.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ESPRESSIF_EMAC),y)
|
||||||
|
CHIP_CSRCS += esp_emac.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL),y)
|
ifeq ($(CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL),y)
|
||||||
CHIP_CSRCS += esp_nxdiag.c
|
CHIP_CSRCS += esp_nxdiag.c
|
||||||
endif
|
endif
|
||||||
@@ -217,7 +221,7 @@ endif
|
|||||||
|
|
||||||
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
|
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
|
||||||
ifndef ESP_HAL_3RDPARTY_VERSION
|
ifndef ESP_HAL_3RDPARTY_VERSION
|
||||||
ESP_HAL_3RDPARTY_VERSION = 8630b6b82cb84838f86332e00f39ab72a64cf186
|
ESP_HAL_3RDPARTY_VERSION = c32f1ad13f4ce8312de494e8b79c88fda10fe9ed
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef ESP_HAL_3RDPARTY_URL
|
ifndef ESP_HAL_3RDPARTY_URL
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/risc-v/src/common/espressif/esp_emac.h
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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_RISCV_SRC_COMMON_ESPRESSIF_ESP_EMAC_H
|
||||||
|
#define __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_EMAC_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_emac_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the Ethernet driver and register it with the NuttX network
|
||||||
|
* stack.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* OK on success; a negated errno value on failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp_emac_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_EMAC_H */
|
||||||
@@ -115,6 +115,7 @@ int esp_wifi_api_adapter_init(void)
|
|||||||
esp_wifi_lock(true);
|
esp_wifi_lock(true);
|
||||||
|
|
||||||
esp_evt_work_init();
|
esp_evt_work_init();
|
||||||
|
esp_wifi_evt_work_init();
|
||||||
|
|
||||||
wifi_cfg.nvs_enable = 0;
|
wifi_cfg.nvs_enable = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,10 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <nuttx/debug.h>
|
#include <nuttx/debug.h>
|
||||||
#include <nuttx/spinlock.h>
|
|
||||||
#include <nuttx/signal.h>
|
#include <nuttx/signal.h>
|
||||||
|
#include <nuttx/wqueue.h>
|
||||||
|
|
||||||
|
#include "esp_event.h"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
|
|
||||||
#include "esp_wifi_utils.h"
|
#include "esp_wifi_utils.h"
|
||||||
@@ -69,23 +70,13 @@ struct wifi_notify
|
|||||||
struct sigwork_s work; /* Signal work private data */
|
struct sigwork_s work; /* Signal work private data */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Wi-Fi event private data */
|
|
||||||
|
|
||||||
struct evt_adpt
|
|
||||||
{
|
|
||||||
sq_entry_t entry; /* Sequence entry */
|
|
||||||
wifi_event_t id; /* Event ID */
|
|
||||||
uint8_t buf[0]; /* Event private data */
|
|
||||||
};
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static struct wifi_notify g_wifi_notify[WIFI_EVENT_MAX];
|
static struct wifi_notify g_wifi_notify[WIFI_EVENT_MAX];
|
||||||
static struct work_s g_wifi_evt_work;
|
static struct work_s g_wifi_reconnect_work;
|
||||||
static sq_queue_t g_wifi_evt_queue;
|
static bool g_wifi_handler_registered;
|
||||||
static spinlock_t g_lock;
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@@ -102,7 +93,7 @@ static spinlock_t g_lock;
|
|||||||
* asked to disconnect from the AP.
|
* asked to disconnect from the AP.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None.
|
* arg - Unused work queue argument.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None.
|
* None.
|
||||||
@@ -130,146 +121,157 @@ static void esp_reconnect_work_cb(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_evt_work_cb
|
* Name: esp_wifi_event_handler
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Process Wi-Fi events.
|
* Handler registered against WIFI_EVENT / ESP_EVENT_ANY_ID with the
|
||||||
|
* generic esp_event dispatcher (see esp_event.c). Translates Wi-Fi
|
||||||
|
* driver events into NuttX-visible actions (link-layer hooks and the
|
||||||
|
* optional sigevent notification subsystem).
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* arg - Not used.
|
* arg - Handler-specific argument registered with the event
|
||||||
|
* dispatcher (unused).
|
||||||
|
* event_base - Event base identifier; always WIFI_EVENT here (unused).
|
||||||
|
* event_id - Wi-Fi event ID as defined by the ESP-IDF wifi_event_t
|
||||||
|
* enumeration.
|
||||||
|
* event_data - Pointer to the event-specific payload, whose concrete
|
||||||
|
* type depends on event_id.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None.
|
* None.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void esp_evt_work_cb(void *arg)
|
static void esp_wifi_event_handler(void *arg, esp_event_base_t event_base,
|
||||||
|
int32_t event_id, void *event_data)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
irqstate_t flags;
|
|
||||||
struct evt_adpt *evt_adpt;
|
|
||||||
struct wifi_notify *notify;
|
struct wifi_notify *notify;
|
||||||
wifi_ps_type_t ps_type = DEFAULT_PS_MODE;
|
wifi_ps_type_t ps_type = DEFAULT_PS_MODE;
|
||||||
|
|
||||||
while (1)
|
UNUSED(arg);
|
||||||
|
UNUSED(event_base);
|
||||||
|
|
||||||
|
/* Some of the following logic (eg. esp_wlan_sta_set_linkstatus)
|
||||||
|
* can take net_lock(). To maintain the consistent locking order,
|
||||||
|
* we take net_lock() here before taking esp_wifi_lock. Note that
|
||||||
|
* net_lock() is a recursive lock.
|
||||||
|
*/
|
||||||
|
|
||||||
|
net_lock();
|
||||||
|
esp_wifi_lock(true);
|
||||||
|
|
||||||
|
switch (event_id)
|
||||||
{
|
{
|
||||||
flags = spin_lock_irqsave(&g_lock);
|
|
||||||
evt_adpt = (struct evt_adpt *)sq_remfirst(&g_wifi_evt_queue);
|
|
||||||
spin_unlock_irqrestore(&g_lock, flags);
|
|
||||||
if (!evt_adpt)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Some of the following logic (eg. esp_wlan_sta_set_linkstatus)
|
|
||||||
* can take net_lock(). To maintain the consistent locking order,
|
|
||||||
* we take net_lock() here before taking esp_wifi_lock. Note that
|
|
||||||
* net_lock() is a recursive lock.
|
|
||||||
*/
|
|
||||||
|
|
||||||
net_lock();
|
|
||||||
esp_wifi_lock(true);
|
|
||||||
|
|
||||||
switch (evt_adpt->id)
|
|
||||||
{
|
|
||||||
#ifdef ESP_WLAN_DEVS
|
#ifdef ESP_WLAN_DEVS
|
||||||
case WIFI_EVENT_SCAN_DONE:
|
case WIFI_EVENT_SCAN_DONE:
|
||||||
esp_wifi_scan_event_parse();
|
esp_wifi_scan_event_parse();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case WIFI_EVENT_HOME_CHANNEL_CHANGE:
|
case WIFI_EVENT_HOME_CHANNEL_CHANGE:
|
||||||
wlinfo("Wi-Fi home channel change\n");
|
wlinfo("Wi-Fi home channel change\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ESP_WLAN_HAS_STA
|
#ifdef ESP_WLAN_HAS_STA
|
||||||
case WIFI_EVENT_STA_START:
|
case WIFI_EVENT_STA_START:
|
||||||
wlinfo("Wi-Fi sta start\n");
|
{
|
||||||
|
wlinfo("Wi-Fi sta start\n");
|
||||||
|
|
||||||
ret = esp_wifi_set_ps(ps_type);
|
ret = esp_wifi_set_ps(ps_type);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
wlerr("Failed to set power save type\n");
|
wlerr("Failed to set power save type\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WIFI_EVENT_STA_STOP:
|
case WIFI_EVENT_STA_STOP:
|
||||||
wlinfo("Wi-Fi station stopped\n");
|
wlinfo("Wi-Fi station stopped\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WIFI_EVENT_STA_CONNECTED:
|
case WIFI_EVENT_STA_CONNECTED:
|
||||||
wlinfo("Wi-Fi station connected\n");
|
{
|
||||||
esp_wlan_sta_connect_success_hook();
|
wlinfo("Wi-Fi station connected\n");
|
||||||
break;
|
esp_wlan_sta_connect_success_hook();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WIFI_EVENT_STA_DISCONNECTED:
|
case WIFI_EVENT_STA_DISCONNECTED:
|
||||||
wifi_event_sta_disconnected_t *event =
|
{
|
||||||
(wifi_event_sta_disconnected_t *)evt_adpt->buf;
|
wifi_event_sta_disconnected_t *event =
|
||||||
wifi_err_reason_t reason = event->reason;
|
(wifi_event_sta_disconnected_t *)event_data;
|
||||||
|
wifi_err_reason_t reason = event->reason;
|
||||||
|
|
||||||
wlinfo("Wi-Fi station disconnected, reason: %u\n", reason);
|
wlinfo("Wi-Fi station disconnected, reason: %u\n", reason);
|
||||||
esp_wlan_sta_disconnect_hook();
|
esp_wlan_sta_disconnect_hook();
|
||||||
if (reason == WIFI_REASON_ASSOC_LEAVE)
|
if (reason == WIFI_REASON_ASSOC_LEAVE)
|
||||||
{
|
{
|
||||||
work_queue(LPWORK, &g_wifi_evt_work, esp_reconnect_work_cb,
|
work_queue(LPWORK, &g_wifi_reconnect_work,
|
||||||
NULL, 0);
|
esp_reconnect_work_cb, NULL, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
break;
|
case WIFI_EVENT_STA_AUTHMODE_CHANGE:
|
||||||
|
wlinfo("Wi-Fi station auth mode change\n");
|
||||||
case WIFI_EVENT_STA_AUTHMODE_CHANGE:
|
break;
|
||||||
wlinfo("Wi-Fi station auth mode change\n");
|
|
||||||
break;
|
|
||||||
#endif /* ESP_WLAN_HAS_STA */
|
#endif /* ESP_WLAN_HAS_STA */
|
||||||
|
|
||||||
#ifdef ESP_WLAN_HAS_SOFTAP
|
#ifdef ESP_WLAN_HAS_SOFTAP
|
||||||
case WIFI_EVENT_AP_START:
|
case WIFI_EVENT_AP_START:
|
||||||
wlinfo("INFO: Wi-Fi softap start\n");
|
{
|
||||||
esp_wlan_softap_connect_success_hook();
|
wlinfo("INFO: Wi-Fi softap start\n");
|
||||||
ret = esp_wifi_set_ps(ps_type);
|
esp_wlan_softap_connect_success_hook();
|
||||||
if (ret)
|
ret = esp_wifi_set_ps(ps_type);
|
||||||
{
|
if (ret)
|
||||||
wlerr("Failed to set power save type\n");
|
{
|
||||||
break;
|
wlerr("Failed to set power save type\n");
|
||||||
}
|
break;
|
||||||
break;
|
}
|
||||||
|
|
||||||
case WIFI_EVENT_AP_STOP:
|
|
||||||
wlinfo("Wi-Fi softap stop\n");
|
|
||||||
esp_wlan_softap_disconnect_hook();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WIFI_EVENT_AP_STACONNECTED:
|
|
||||||
wlinfo("Wi-Fi station joined AP\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WIFI_EVENT_AP_STADISCONNECTED:
|
|
||||||
wlinfo("Wi-Fi station left AP\n");
|
|
||||||
break;
|
|
||||||
#endif /* ESP_WLAN_HAS_SOFTAP */
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
notify = &g_wifi_notify[evt_adpt->id];
|
case WIFI_EVENT_AP_STOP:
|
||||||
|
{
|
||||||
|
wlinfo("Wi-Fi softap stop\n");
|
||||||
|
esp_wlan_softap_disconnect_hook();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WIFI_EVENT_AP_STACONNECTED:
|
||||||
|
wlinfo("Wi-Fi station joined AP\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WIFI_EVENT_AP_STADISCONNECTED:
|
||||||
|
wlinfo("Wi-Fi station left AP\n");
|
||||||
|
break;
|
||||||
|
#endif /* ESP_WLAN_HAS_SOFTAP */
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event_id >= 0 && event_id < WIFI_EVENT_MAX)
|
||||||
|
{
|
||||||
|
notify = &g_wifi_notify[event_id];
|
||||||
if (notify->assigned)
|
if (notify->assigned)
|
||||||
{
|
{
|
||||||
notify->event.sigev_value.sival_ptr = evt_adpt->buf;
|
notify->event.sigev_value.sival_ptr = event_data;
|
||||||
|
|
||||||
ret = nxsig_notification(notify->pid, ¬ify->event,
|
ret = nxsig_notification(notify->pid, ¬ify->event,
|
||||||
SI_QUEUE, ¬ify->work);
|
SI_QUEUE, ¬ify->work);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
wlwarn("nxsig_notification event ID=%d failed: %d\n",
|
wlwarn("nxsig_notification event ID=%d failed: %d\n",
|
||||||
evt_adpt->id, ret);
|
(int)event_id, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_wifi_lock(false);
|
|
||||||
net_unlock();
|
|
||||||
|
|
||||||
kmm_free(evt_adpt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_wifi_lock(false);
|
||||||
|
net_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -277,81 +279,30 @@ static void esp_evt_work_cb(void *arg)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_event_post
|
* Name: esp_wifi_evt_work_init
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Posts an event to the event loop system. The event is queued in a FIFO
|
* Register the Wi-Fi event handler against the generic esp_event loop.
|
||||||
* and processed asynchronously in the low-priority work queue.
|
* Kept under the original name so existing callers (esp_wifi_api.c)
|
||||||
|
* continue to compile unchanged. Idempotent: subsequent calls after the
|
||||||
|
* first successful registration are silently ignored.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* event_base - Identifier for the event category (e.g. WIFI_EVENT)
|
* None.
|
||||||
* event_id - Event ID within the event base category
|
|
||||||
* event_data - Pointer to event data structure
|
|
||||||
* event_data_size - Size of event data structure
|
|
||||||
* ticks - Number of ticks to wait (currently unused)
|
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0 on success
|
* None.
|
||||||
* -1 on failure with following error conditions:
|
|
||||||
* - Invalid event ID
|
|
||||||
* - Memory allocation failure
|
|
||||||
*
|
|
||||||
* Assumptions/Limitations:
|
|
||||||
* - Event data is copied into a new buffer, so the original can be freed
|
|
||||||
* - Events are processed in FIFO order in the low priority work queue
|
|
||||||
* - The function is thread-safe and can be called from interrupt context
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int esp_event_post(const char *event_base,
|
void esp_wifi_evt_work_init(void)
|
||||||
int32_t event_id,
|
|
||||||
void *event_data,
|
|
||||||
size_t event_data_size,
|
|
||||||
uint32_t ticks)
|
|
||||||
{
|
{
|
||||||
size_t size;
|
if (g_wifi_handler_registered)
|
||||||
int32_t id;
|
|
||||||
irqstate_t flags;
|
|
||||||
struct evt_adpt *evt_adpt;
|
|
||||||
|
|
||||||
wlinfo("Event: base=%s id=%ld data=%p data_size=%u ticks=%lu\n",
|
|
||||||
event_base, event_id, event_data, event_data_size, ticks);
|
|
||||||
|
|
||||||
size = event_data_size + sizeof(struct evt_adpt);
|
|
||||||
evt_adpt = kmm_malloc(size);
|
|
||||||
if (!evt_adpt)
|
|
||||||
{
|
{
|
||||||
wlerr("ERROR: Failed to alloc %d memory\n", size);
|
return;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
evt_adpt->id = event_id;
|
esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID,
|
||||||
memcpy(evt_adpt->buf, event_data, event_data_size);
|
esp_wifi_event_handler, NULL);
|
||||||
|
g_wifi_handler_registered = true;
|
||||||
flags = enter_critical_section();
|
|
||||||
sq_addlast(&evt_adpt->entry, &g_wifi_evt_queue);
|
|
||||||
leave_critical_section(flags);
|
|
||||||
|
|
||||||
work_queue(LPWORK, &g_wifi_evt_work, esp_evt_work_cb, NULL, 0);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: esp_evt_work_init
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initialize the event work queue
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void esp_evt_work_init(void)
|
|
||||||
{
|
|
||||||
sq_init(&g_wifi_evt_queue);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ int esp_freq_to_channel(uint16_t freq);
|
|||||||
* Name: esp_evt_work_init
|
* Name: esp_evt_work_init
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Initialize the event work queue
|
* Initialize the generic esp_event backend queue.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
@@ -111,6 +111,22 @@ int esp_freq_to_channel(uint16_t freq);
|
|||||||
|
|
||||||
void esp_evt_work_init(void);
|
void esp_evt_work_init(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_evt_work_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the event work queue
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void esp_wifi_evt_work_init(void);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_start_scan
|
* Name: esp_wifi_start_scan
|
||||||
*
|
*
|
||||||
@@ -212,39 +228,6 @@ wifi_mode_t esp_wifi_mode_translate(uint32_t wireless_mode);
|
|||||||
|
|
||||||
int esp_wifi_lock(bool lock);
|
int esp_wifi_lock(bool lock);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: esp_event_post
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Posts an event to the event loop system. The event is queued in a FIFO
|
|
||||||
* and processed asynchronously in the low-priority work queue.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* event_base - Identifier for the event category (e.g. WIFI_EVENT)
|
|
||||||
* event_id - Event ID within the event base category
|
|
||||||
* event_data - Pointer to event data structure
|
|
||||||
* event_data_size - Size of event data structure
|
|
||||||
* ticks - Number of ticks to wait (currently unused)
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* 0 on success
|
|
||||||
* -1 on failure with following error conditions:
|
|
||||||
* - Invalid event ID
|
|
||||||
* - Memory allocation failure
|
|
||||||
*
|
|
||||||
* Assumptions/Limitations:
|
|
||||||
* - Event data is copied into a new buffer, so the original can be freed
|
|
||||||
* - Events are processed in FIFO order in the low priority work queue
|
|
||||||
* - The function is thread-safe and can be called from interrupt context
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int esp_event_post(const char *event_base,
|
|
||||||
int32_t event_id,
|
|
||||||
void *event_data,
|
|
||||||
size_t event_data_size,
|
|
||||||
uint32_t ticks);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -507,6 +507,10 @@ list(
|
|||||||
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c
|
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/src/uart_wakeup.c)
|
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/src/uart_wakeup.c)
|
||||||
|
|
||||||
|
if(CONFIG_ESPRESSIF_WIFI OR CONFIG_ESPRESSIF_EMAC)
|
||||||
|
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/esp_event.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Bootloader flash encrypt source
|
# Bootloader flash encrypt source
|
||||||
list(APPEND HAL_SRCS
|
list(APPEND HAL_SRCS
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c)
|
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c)
|
||||||
|
|||||||
@@ -338,6 +338,10 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_
|
|||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)platform$(DELIM)os.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)platform$(DELIM)os.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)heap_caps.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)heap_caps.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)components$(DELIM)newlib$(DELIM)newlib$(DELIM)libc$(DELIM)misc$(DELIM)init.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)components$(DELIM)newlib$(DELIM)newlib$(DELIM)libc$(DELIM)misc$(DELIM)init.c
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_ESPRESSIF_WIFI)$(CONFIG_ESPRESSIF_EMAC),)
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)esp_event.c
|
||||||
|
endif
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)src$(DELIM)gpio.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)src$(DELIM)gpio.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)src$(DELIM)rtc_io.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)src$(DELIM)rtc_io.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_rmt$(DELIM)src$(DELIM)rmt_common.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_rmt$(DELIM)src$(DELIM)rmt_common.c
|
||||||
|
|||||||
@@ -533,6 +533,10 @@ list(
|
|||||||
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
|
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
|
||||||
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/newlib/newlib/libc/misc/init.c)
|
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/newlib/newlib/libc/misc/init.c)
|
||||||
|
|
||||||
|
if(CONFIG_ESPRESSIF_WIFI OR CONFIG_ESPRESSIF_EMAC)
|
||||||
|
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/esp_event.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Bootloader flash encrypt
|
# Bootloader flash encrypt
|
||||||
list(APPEND HAL_SRCS
|
list(APPEND HAL_SRCS
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c)
|
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c)
|
||||||
|
|||||||
@@ -382,6 +382,10 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELI
|
|||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)heap_caps.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)heap_caps.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)components$(DELIM)newlib$(DELIM)newlib$(DELIM)libc$(DELIM)misc$(DELIM)init.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)components$(DELIM)newlib$(DELIM)newlib$(DELIM)libc$(DELIM)misc$(DELIM)init.c
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_ESPRESSIF_WIFI)$(CONFIG_ESPRESSIF_EMAC),)
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)esp_event.c
|
||||||
|
endif
|
||||||
|
|
||||||
# Bootloader files
|
# Bootloader files
|
||||||
|
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)bootloader_support$(DELIM)src$(DELIM)flash_encrypt.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)bootloader_support$(DELIM)src$(DELIM)flash_encrypt.c
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ target_include_directories(
|
|||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/${CHIP_SERIES}/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/${CHIP_SERIES}/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_blockdev/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_blockdev/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_common/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_common/include
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_event/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/${CHIP_SERIES}/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/${CHIP_SERIES}/include
|
||||||
@@ -492,6 +493,10 @@ list(
|
|||||||
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
|
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
|
||||||
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/newlib/newlib/libc/misc/init.c)
|
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/newlib/newlib/libc/misc/init.c)
|
||||||
|
|
||||||
|
if(CONFIG_ESPRESSIF_WIFI OR CONFIG_ESPRESSIF_EMAC)
|
||||||
|
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/esp_event.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Bootloader flash encrypt
|
# Bootloader flash encrypt
|
||||||
list(APPEND HAL_SRCS
|
list(APPEND HAL_SRCS
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c)
|
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
|
|||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_adc$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_adc$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_blockdev$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_blockdev$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_common$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_common$(DELIM)include
|
||||||
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_event$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_dma$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_dma$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
||||||
@@ -358,6 +359,10 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)uppe
|
|||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)src$(DELIM)rtc_io.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)src$(DELIM)rtc_io.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)components$(DELIM)newlib$(DELIM)newlib$(DELIM)libc$(DELIM)misc$(DELIM)init.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)components$(DELIM)newlib$(DELIM)newlib$(DELIM)libc$(DELIM)misc$(DELIM)init.c
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_ESPRESSIF_WIFI)$(CONFIG_ESPRESSIF_EMAC),)
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)esp_event.c
|
||||||
|
endif
|
||||||
|
|
||||||
CHIP_ASRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)lowpower$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)sleep_cpu_asm.S
|
CHIP_ASRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)lowpower$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)sleep_cpu_asm.S
|
||||||
|
|
||||||
# Bootloader files
|
# Bootloader files
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ set(ESP32P4_INCLUDES
|
|||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_app_format/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_app_format/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_blockdev/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_blockdev/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_common/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_common/include
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_event/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/include
|
||||||
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_cam/${CHIP_SERIES}/include
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_cam/${CHIP_SERIES}/include
|
||||||
@@ -436,6 +437,31 @@ list(
|
|||||||
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
|
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
|
||||||
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/platform/os.c)
|
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/platform/os.c)
|
||||||
|
|
||||||
|
if(CONFIG_ESPRESSIF_WIFI OR CONFIG_ESPRESSIF_EMAC)
|
||||||
|
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/esp_event.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ESPRESSIF_EMAC)
|
||||||
|
list(
|
||||||
|
APPEND
|
||||||
|
HAL_SRCS
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_emac/emac_hal.c
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_emac/${CHIP_SERIES}/emac_periph.c
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_eth/src/esp_eth.c
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_eth/src/mac/esp_eth_mac_esp.c
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_eth/src/mac/esp_eth_mac_esp_dma.c
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_eth/src/mac/esp_eth_mac_esp_gpio.c
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_eth/src/phy/esp_eth_phy_802_3.c
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/esp_eth/src/phy/esp_eth_phy_generic.c
|
||||||
|
# log_buffers.c provides ESP_LOG_BUFFER_HEXDUMP used by esp_eth_mac_esp.c
|
||||||
|
# for its dump_hal_registers diagnostic helper; util.c supplies the hex
|
||||||
|
# conversion helper consumed by log_buffers.c.
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/log/src/util.c
|
||||||
|
${ESP_HAL_3RDPARTY_REPO}/components/log/src/buffer/log_buffers.c)
|
||||||
|
target_include_directories(
|
||||||
|
arch PRIVATE ${ESP_HAL_3RDPARTY_REPO}/components/esp_eth/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Bootloader common
|
# Bootloader common
|
||||||
list(
|
list(
|
||||||
APPEND HAL_SRCS
|
APPEND HAL_SRCS
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
|
|||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_app_format$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_app_format$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_blockdev$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_blockdev$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_common$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_common$(DELIM)include
|
||||||
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_event$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)include
|
||||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_cam$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_cam$(DELIM)$(CHIP_SERIES)$(DELIM)include
|
||||||
@@ -359,6 +360,8 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$
|
|||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)efuse_hal.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)efuse_hal.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)hal_utils.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)hal_utils.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)mmu_hal.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)mmu_hal.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)util.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)buffer$(DELIM)log_buffers.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log_level$(DELIM)log_level.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log_level$(DELIM)log_level.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log_level$(DELIM)tag_log_level$(DELIM)linked_list$(DELIM)log_linked_list.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log_level$(DELIM)tag_log_level$(DELIM)linked_list$(DELIM)log_linked_list.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log_level$(DELIM)tag_log_level$(DELIM)tag_log_level.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log_level$(DELIM)tag_log_level$(DELIM)tag_log_level.c
|
||||||
@@ -410,6 +413,23 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELI
|
|||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)heap_caps.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)heap_caps.c
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)platform$(DELIM)os.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)platform$(DELIM)os.c
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_ESPRESSIF_WIFI)$(CONFIG_ESPRESSIF_EMAC),)
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)esp_event.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ESPRESSIF_EMAC),y)
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_emac$(DELIM)emac_hal.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_emac$(DELIM)$(CHIP_SERIES)$(DELIM)emac_periph.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_eth$(DELIM)src$(DELIM)esp_eth.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_eth$(DELIM)src$(DELIM)mac$(DELIM)esp_eth_mac_esp.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_eth$(DELIM)src$(DELIM)mac$(DELIM)esp_eth_mac_esp_dma.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_eth$(DELIM)src$(DELIM)mac$(DELIM)esp_eth_mac_esp_gpio.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_eth$(DELIM)src$(DELIM)phy$(DELIM)esp_eth_phy_802_3.c
|
||||||
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_eth$(DELIM)src$(DELIM)phy$(DELIM)esp_eth_phy_generic.c
|
||||||
|
|
||||||
|
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_eth$(DELIM)include
|
||||||
|
endif
|
||||||
|
|
||||||
# Bootloader files
|
# Bootloader files
|
||||||
|
|
||||||
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)bootloader_support$(DELIM)src$(DELIM)bootloader_mem.c
|
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)bootloader_support$(DELIM)src$(DELIM)bootloader_mem.c
|
||||||
|
|||||||
Reference in New Issue
Block a user