mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-17 07:09:37 +00:00
feat(esp_eth): added SPI Ethernet module polling mode
Closes https://github.com/espressif/esp-idf/issues/12682
This commit is contained in:
@@ -80,6 +80,12 @@ menu "esp_eth TEST_APPS Configuration"
|
||||
help
|
||||
Set the clock speed (MHz) of SPI interface.
|
||||
|
||||
config TARGET_ETH_SPI_POLL_MS
|
||||
int "SPI Ethernet Polling period in msec"
|
||||
default 0
|
||||
help
|
||||
SPI Ethernet module polling period.
|
||||
|
||||
endif # TARGET_USE_SPI_ETHERNET
|
||||
|
||||
endmenu
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -63,19 +63,30 @@ esp_eth_mac_t *mac_init(void *vendor_emac_config, eth_mac_config_t *mac_config)
|
||||
};
|
||||
#if CONFIG_TARGET_ETH_PHY_DEVICE_W5500
|
||||
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(DEFAULT_TARGET_SPI_HOST, &devcfg);
|
||||
#if CONFIG_TARGET_ETH_SPI_POLL_MS > 0
|
||||
w5500_config.int_gpio_num = -1;
|
||||
w5500_config.poll_period_ms = CONFIG_TARGET_ETH_SPI_POLL_MS;
|
||||
#endif
|
||||
if (vendor_emac_config == NULL) {
|
||||
vendor_emac_config = &w5500_config;
|
||||
}
|
||||
mac = esp_eth_mac_new_w5500(vendor_emac_config, mac_config);
|
||||
#elif CONFIG_TARGET_ETH_PHY_DEVICE_KSZ8851SNL
|
||||
eth_ksz8851snl_config_t ksz8851snl_config = ETH_KSZ8851SNL_DEFAULT_CONFIG(DEFAULT_TARGET_SPI_HOST, &devcfg);
|
||||
ksz8851snl_config.int_gpio_num = 4;
|
||||
#if CONFIG_TARGET_ETH_SPI_POLL_MS > 0
|
||||
ksz8851snl_config.int_gpio_num = -1;
|
||||
ksz8851snl_config.poll_period_ms = CONFIG_TARGET_ETH_SPI_POLL_MS;
|
||||
#endif
|
||||
if (vendor_emac_config == NULL) {
|
||||
vendor_emac_config = &ksz8851snl_config;
|
||||
}
|
||||
mac = esp_eth_mac_new_ksz8851snl(vendor_emac_config, mac_config);
|
||||
#elif CONFIG_TARGET_ETH_PHY_DEVICE_DM9051
|
||||
eth_dm9051_config_t dm9051_config = ETH_DM9051_DEFAULT_CONFIG(DEFAULT_TARGET_SPI_HOST, &devcfg);
|
||||
#if CONFIG_TARGET_ETH_SPI_POLL_MS > 0
|
||||
dm9051_config.int_gpio_num = -1;
|
||||
dm9051_config.poll_period_ms = CONFIG_TARGET_ETH_SPI_POLL_MS;
|
||||
#endif
|
||||
if (vendor_emac_config == NULL) {
|
||||
vendor_emac_config = &dm9051_config ;
|
||||
}
|
||||
|
@@ -264,6 +264,7 @@ def test_esp_eth_dp83848(dut: IdfDut) -> None:
|
||||
@pytest.mark.eth_w5500
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_w5500',
|
||||
'poll_w5500',
|
||||
], indirect=True)
|
||||
def test_esp_eth_w5500(dut: IdfDut) -> None:
|
||||
ethernet_test(dut)
|
||||
@@ -276,6 +277,7 @@ def test_esp_eth_w5500(dut: IdfDut) -> None:
|
||||
@pytest.mark.eth_ksz8851snl
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_ksz8851snl',
|
||||
'poll_ksz8851snl',
|
||||
], indirect=True)
|
||||
def test_esp_eth_ksz8851snl(dut: IdfDut) -> None:
|
||||
ethernet_test(dut)
|
||||
@@ -288,6 +290,7 @@ def test_esp_eth_ksz8851snl(dut: IdfDut) -> None:
|
||||
@pytest.mark.eth_dm9051
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_dm9051',
|
||||
'poll_dm9051',
|
||||
], indirect=True)
|
||||
def test_esp_eth_dm9051(dut: IdfDut) -> None:
|
||||
ethernet_test(dut)
|
||||
|
10
components/esp_eth/test_apps/sdkconfig.ci.poll_dm9051
Normal file
10
components/esp_eth/test_apps/sdkconfig.ci.poll_dm9051
Normal file
@@ -0,0 +1,10 @@
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
|
||||
CONFIG_UNITY_ENABLE_FIXTURE=y
|
||||
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
|
||||
CONFIG_ESP_TASK_WDT=n
|
||||
|
||||
CONFIG_TARGET_USE_SPI_ETHERNET=y
|
||||
CONFIG_TARGET_ETH_PHY_DEVICE_DM9051=y
|
||||
|
||||
CONFIG_TARGET_ETH_SPI_POLL_MS=10
|
10
components/esp_eth/test_apps/sdkconfig.ci.poll_ksz8851snl
Normal file
10
components/esp_eth/test_apps/sdkconfig.ci.poll_ksz8851snl
Normal file
@@ -0,0 +1,10 @@
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
|
||||
CONFIG_UNITY_ENABLE_FIXTURE=y
|
||||
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
|
||||
CONFIG_ESP_TASK_WDT=n
|
||||
|
||||
CONFIG_TARGET_USE_SPI_ETHERNET=y
|
||||
CONFIG_TARGET_ETH_PHY_DEVICE_KSZ8851SNL=y
|
||||
|
||||
CONFIG_TARGET_ETH_SPI_POLL_MS=10
|
10
components/esp_eth/test_apps/sdkconfig.ci.poll_w5500
Normal file
10
components/esp_eth/test_apps/sdkconfig.ci.poll_w5500
Normal file
@@ -0,0 +1,10 @@
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
|
||||
CONFIG_UNITY_ENABLE_FIXTURE=y
|
||||
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
|
||||
CONFIG_ESP_TASK_WDT=n
|
||||
|
||||
CONFIG_TARGET_USE_SPI_ETHERNET=y
|
||||
CONFIG_TARGET_ETH_PHY_DEVICE_W5500=y
|
||||
|
||||
CONFIG_TARGET_ETH_SPI_POLL_MS=10
|
Reference in New Issue
Block a user