mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 05:55:46 +08:00
boards/risc-v: Enable ethernet on ESP32-P4-Function-EV-Board
This commit simply enables the ethernet support for the ESP32-P4's Function EV board. Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
This commit is contained in:
committed by
Xiang Xiao
parent
34bfa0d68d
commit
c63c061a52
@@ -0,0 +1,77 @@
|
||||
#
|
||||
# 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_NDEBUG is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="risc-v"
|
||||
CONFIG_ARCH_BOARD="esp32p4-function-ev-board"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32P4_FUNCTION_EV_BOARD=y
|
||||
CONFIG_ARCH_CHIP="esp32p4"
|
||||
CONFIG_ARCH_CHIP_ESP32P4=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_IRQ_TO_NDX=y
|
||||
CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
|
||||
CONFIG_ARCH_NUSER_INTERRUPTS=17
|
||||
CONFIG_ARCH_RISCV=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15000
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_ESPRESSIF_EMAC=y
|
||||
CONFIG_ESPRESSIF_ETH_DMA_BUFFER_SIZE=512
|
||||
CONFIG_ESPRESSIF_MERGE_BINS=y
|
||||
CONFIG_ESPRESSIF_SPIFLASH=y
|
||||
CONFIG_ESPRESSIF_SPIFLASH_SMARTFS=y
|
||||
CONFIG_ESPRESSIF_SPIRAM=y
|
||||
CONFIG_ESPRESSIF_STORAGE_MTD_OFFSET=0x110000
|
||||
CONFIG_ESPRESSIF_STORAGE_MTD_SIZE=0xf0000
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_PERROR_STDOUT=y
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_MM_KERNEL_HEAP=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NAME_MAX=48
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDEV_LATEINIT=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
CONFIG_NETINIT_THREAD=y
|
||||
CONFIG_NETUTILS_IPERF=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ETH_PKTSIZE=1514
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_DISABLE_LOSMART=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NSH_STRERROR=y
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_BACKTRACE=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SMARTFS_MAXNAMLEN=48
|
||||
CONFIG_START_DAY=29
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2019
|
||||
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||
CONFIG_SYSTEM_DUMPSTACK=y
|
||||
CONFIG_SYSTEM_FLASH_ERASEALL=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TESTING_FSTEST=y
|
||||
CONFIG_TESTING_FSTEST_MOUNTPT="/mnt"
|
||||
CONFIG_TESTING_HEAP=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
@@ -36,6 +36,10 @@ if(CONFIG_ARCH_BUTTONS)
|
||||
list(APPEND SRCS esp32p4_buttons.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESPRESSIF_EMAC)
|
||||
list(APPEND SRCS esp32p4_ethernet.c)
|
||||
endif()
|
||||
|
||||
target_sources(board PRIVATE ${SRCS})
|
||||
|
||||
# ##############################################################################
|
||||
|
||||
@@ -38,6 +38,10 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += esp32p4_buttons.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_EMAC),y)
|
||||
CSRCS += esp32p4_ethernet.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||
|
||||
@@ -102,6 +102,9 @@ int board_twai_setup(int port);
|
||||
* Description:
|
||||
* Configure the GPIO driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK).
|
||||
*
|
||||
@@ -111,5 +114,23 @@ int board_twai_setup(int port);
|
||||
int esp_gpio_init(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_emac_init
|
||||
*
|
||||
* Description:
|
||||
* Bring up the ESP32-P4 Ethernet MAC driver (esp_eth backed).
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_EMAC
|
||||
int board_emac_init(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_RISCV_ESP32P4_ESP32P4_FUNCTION_EV_BOARD_SRC_ESP32P4_FUNCTION_EV_BOARD_H */
|
||||
|
||||
@@ -447,6 +447,14 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_EMAC
|
||||
ret = board_emac_init();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: board_emac_init failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_USE_LP_CORE
|
||||
|
||||
/* ULP initialization should be the handled later than
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_ethernet.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "espressif/esp_emac.h"
|
||||
#include "espressif/esp_hr_timer.h"
|
||||
|
||||
#include "esp32p4-function-ev-board.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_emac_init
|
||||
*
|
||||
* Description:
|
||||
* Bring up the ESP32-P4 Ethernet interface (internal EMAC + external
|
||||
* PHY) and register it with the NuttX network stack.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_emac_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* esp_eth_driver_install() relies on esp_timer; make sure the timer
|
||||
* subsystem is initialised before creating the driver.
|
||||
*/
|
||||
|
||||
ret = esp_hr_timer_init();
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: esp_hr_timer_init failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = esp_emac_init();
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: esp_emac_init failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user