Skip to content

Commit

Permalink
Merge branch 'feature/eth_test_all_chips' into 'master'
Browse files Browse the repository at this point in the history
Ethernet related tests improvements

Closes IDF-5387

See merge request espressif/esp-idf!20982
  • Loading branch information
kostaond committed Nov 30, 2022
2 parents f2b2335 + 2bf7255 commit d849f29
Show file tree
Hide file tree
Showing 41 changed files with 1,146 additions and 603 deletions.
8 changes: 8 additions & 0 deletions .gitlab/ci/target-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,14 @@ component_ut_pytest_esp32_lan8720:
- build_pytest_components_esp32
tags: [ esp32, lan8720 ]

component_ut_pytest_esp32_ethernet:
extends:
- .pytest_components_dir_template
- .rules:test:component_ut-esp32
needs:
- build_pytest_components_esp32
tags: [ esp32, ethernet ]

component_ut_pytest_esp32_flash_encryption:
extends:
- .pytest_components_dir_template
Expand Down
8 changes: 4 additions & 4 deletions components/esp_eth/src/esp_eth_mac_dm9051.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,8 @@ static esp_err_t dm9051_setup_default(emac_dm9051_t *emac)
ESP_GOTO_ON_ERROR(dm9051_register_write(emac, DM9051_RLENCR, 0x00), err, TAG, "write RLENCR failed");
/* 3K-byte for TX and 13K-byte for RX */
ESP_GOTO_ON_ERROR(dm9051_register_write(emac, DM9051_MEMSCR, 0x00), err, TAG, "write MEMSCR failed");
/* reset tx and rx memory pointer */
ESP_GOTO_ON_ERROR(dm9051_register_write(emac, DM9051_MPTRCR, MPTRCR_RST_RX | MPTRCR_RST_TX), err, TAG, "write MPTRCR failed");
/* clear network status: wakeup event, tx complete */
ESP_GOTO_ON_ERROR(dm9051_register_write(emac, DM9051_NSR, NSR_WAKEST | NSR_TX2END | NSR_TX1END), err, TAG, "write NSR failed");
/* clear interrupt status */
ESP_GOTO_ON_ERROR(dm9051_register_write(emac, DM9051_ISR, ISR_CLR_STATUS), err, TAG, "write ISR failed");
return ESP_OK;
err:
return ret;
Expand Down Expand Up @@ -351,6 +347,10 @@ static esp_err_t emac_dm9051_start(esp_eth_mac_t *mac)
{
esp_err_t ret = ESP_OK;
emac_dm9051_t *emac = __containerof(mac, emac_dm9051_t, parent);
/* reset tx and rx memory pointer */
ESP_GOTO_ON_ERROR(dm9051_register_write(emac, DM9051_MPTRCR, MPTRCR_RST_RX | MPTRCR_RST_TX), err, TAG, "write MPTRCR failed");
/* clear interrupt status */
ESP_GOTO_ON_ERROR(dm9051_register_write(emac, DM9051_ISR, ISR_CLR_STATUS), err, TAG, "write ISR failed");
/* enable only Rx related interrupts as others are processed synchronously */
ESP_GOTO_ON_ERROR(dm9051_register_write(emac, DM9051_IMR, IMR_PAR | IMR_PRI), err, TAG, "write IMR failed");
/* enable rx */
Expand Down
5 changes: 0 additions & 5 deletions components/esp_eth/test/CMakeLists.txt

This file was deleted.

2 changes: 2 additions & 0 deletions components/esp_eth/test_apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This is the project CMakeLists.txt file for the test subproject
cmake_minimum_required(VERSION 3.16)

set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components")

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp_eth_test)

Expand Down
4 changes: 1 addition & 3 deletions components/esp_eth/test_apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
| Supported Targets | ESP32 |
| ----------------- | ----- |

This test app is used to test MAC layer behavior with different PHY chips:
This test app is used to test Ethernet MAC behavior with different chips.

- IP101
- LAN8720

## Prerequisites
Install third part Python packages:
Expand Down
11 changes: 8 additions & 3 deletions components/esp_eth/test_apps/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
idf_component_register(SRCS "esp_eth_test.c"
idf_component_register(SRCS "esp_eth_test_apps.c"
"esp_eth_test_l2.c"
"esp_eth_test_hal.c"
"esp_eth_test_common.c"
"esp_eth_test_main.c"
INCLUDE_DIRS "."
PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES unity esp_eth esp_netif)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
PRIV_REQUIRES unity test_utils esp_eth esp_netif esp_http_client
EMBED_TXTFILES dl_espressif_com_root_cert.pem
WHOLE_ARCHIVE)
72 changes: 64 additions & 8 deletions components/esp_eth/test_apps/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -1,14 +1,70 @@
menu "esp_eth TEST_APPS Configuration"

choice TARGET_ETH_PHY_DEVICE
choice TARGET_ETH_CONFIG
prompt "Ethernet peripheral device"
default TARGET_ETH_PHY_DEVICE_IP101
default TARGET_USE_INTERNAL_ETHERNET
help
Select one of the devices listed here
Select type of Ethernet interface.

config TARGET_USE_INTERNAL_ETHERNET
depends on SOC_EMAC_SUPPORTED
select ETH_USE_ESP32_EMAC
bool "Internal EMAC"
help
Use internal Ethernet MAC controller.

config TARGET_USE_SPI_ETHERNET
bool "SPI Ethernet"
select ETH_USE_SPI_ETHERNET
help
Use external SPI-Ethernet module(s).
endchoice # TARGET_ETH_CONFIG

if TARGET_USE_INTERNAL_ETHERNET
choice TARGET_ETH_PHY_DEVICE
prompt "Ethernet PHY"
default TARGET_ETH_PHY_DEVICE_IP101
help
Select one of the devices listed here

config TARGET_ETH_PHY_DEVICE_IP101
bool "IP101"
config TARGET_ETH_PHY_DEVICE_LAN87XX
bool "LAN8720"
config TARGET_ETH_PHY_DEVICE_KSZ80XX
bool "KSZ80xx"
config TARGET_ETH_PHY_DEVICE_RTL8201
bool "RTL8201"
config TARGET_ETH_PHY_DEVICE_DP83848
bool "DP83848"
endchoice # TARGET_ETH_PHY_DEVICE
endif # TARGET_USE_INTERNAL_ETHERNET

if TARGET_USE_SPI_ETHERNET
choice TARGET_ETH_SPI_DEVICE
prompt "Ethernet SPI Module"
default TARGET_ETH_PHY_DEVICE_W5500
help
Select one of the devices listed here

config TARGET_ETH_PHY_DEVICE_W5500
bool "W5500"
select ETH_SPI_ETHERNET_W5500
config TARGET_ETH_PHY_DEVICE_KSZ8851SNL
bool "KSZ8851SNL"
select ETH_SPI_ETHERNET_KSZ8851SNL
config TARGET_ETH_PHY_DEVICE_DM9051
bool "DM9051"
select ETH_SPI_ETHERNET_DM9051
endchoice # TARGET_ETH_SPI_DEVICE

config TARGET_SPI_CLOCK_MHZ
int "SPI clock speed (MHz)"
range 5 80
default 12
help
Set the clock speed (MHz) of SPI interface.

endif # TARGET_USE_SPI_ETHERNET

config TARGET_ETH_PHY_DEVICE_IP101
bool "IP101"
config TARGET_ETH_PHY_DEVICE_LAN87XX
bool "LAN8720"
endchoice
endmenu
Loading

0 comments on commit d849f29

Please sign in to comment.