arch/esp32 add openeth mac driver

This driver is used with QEMU, to make it possible
to use networking.

This is not the MAC in ESP32, however, it can be used with QEMU.

The code was shamelessly copied from https://github.com/espressif/esp-idf/commit/31dac92e5f0daac98190fd603df213a0a25a3807
This commit is contained in:
Marco Casaroli
2024-03-11 18:30:05 +00:00
committed by Alan Carvalho de Assis
parent 768c5a28a1
commit d048caf1d2
5 changed files with 913 additions and 0 deletions
@@ -405,6 +405,13 @@ A QEMU-compatible ``nuttx.merged.bin`` binary image will be created. It can be r
$ qemu-system-xtensa -nographic -machine esp32 -drive file=nuttx.merged.bin,if=mtd,format=raw
QEMU Networking
---------------
Networking is possible using the openeth MAC driver. Enable ``ESP32_OPENETH`` option and set the nic in QEMU:
$ qemu-system-xtensa -nographic -machine esp32 -drive file=nuttx.merged.bin,if=mtd,format=raw -nic user,model=open_eth
Secure Boot and Flash Encryption
================================
+26
View File
@@ -241,6 +241,32 @@ config ESP32_EMAC
---help---
Enable ESP32 ethernet support.
config ESP32_OPENETH
bool "Opencores Ethernet MAC"
default n
depends on !ESP32_EMAC
select NET
select SCHED_WORKQUEUE
---help---
Enable ESP32 ethernet opencores support for use with QEMU.
Disable this if you are using the real device.
if ESP32_OPENETH
config ESP32_OPENETH_DMA_RX_BUFFER_NUM
int "Number of Ethernet DMA Rx buffers"
range 1 64
default 4
help
Number of DMA receive buffers, each buffer is 1600 bytes.
config ESP32_OPENETH_DMA_TX_BUFFER_NUM
int "Number of Ethernet DMA Tx buffers"
range 1 64
default 1
help
Number of DMA transmit buffers, each buffer is 1600 bytes.
endif
config ESP32_I2C
bool
default n
+4
View File
@@ -255,6 +255,10 @@ EXTRA_LIBS += -lbtdm_app
endif
endif
ifeq ($(CONFIG_ESP32_OPENETH),y)
CHIP_CSRCS += esp32_openeth.c
endif
#############################################################################
# Espressif HAL for 3rd Party Platforms
#############################################################################
File diff suppressed because it is too large Load Diff
@@ -227,5 +227,18 @@ int board_ws2812_initialize(
# endif
# endif
/****************************************************************************
* Name: openeth_initialize
*
* Description:
* This function may called from application-specific logic during its
* to perform board-specific initialization of the Open ETH interface
*
*
****************************************************************************/
#ifdef CONFIG_ESP32_OPENETH
int esp32_openeth_initialize(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_XTENSA_ESP32_ESP32_DEVKITC_SRC_ESP32_DEVKITC_H */