Skip to content

Commit

Permalink
feat(eth_init): added configuration option for EMAC Rx Task size
Browse files Browse the repository at this point in the history
  • Loading branch information
kostaond committed Nov 13, 2023
1 parent 8ca231a commit 4484f21
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ethernet_init/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ menu "Ethernet Configuration"

orsource "$IDF_PATH/examples/common_components/env_caps/$IDF_TARGET/Kconfig.env_caps"

config ETHERNET_RX_TASK_STACK_SIZE
int "EMAC Rx task stack size"
default 2048
help
Set stack size for EMAC Rx task in B.

config ETHERNET_INTERNAL_SUPPORT
depends on SOC_EMAC_SUPPORTED
select ETH_USE_ESP32_EMAC
Expand Down
8 changes: 5 additions & 3 deletions ethernet_init/ethernet_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ static uint8_t eth_cnt_g = 0;
static eth_device eth_instance_g[CONFIG_ETHERNET_INTERNAL_SUPPORT + CONFIG_ETHERNET_SPI_NUMBER];


void eth_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
static void eth_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
uint8_t pin1 = 0, pin2 = 0;
uint8_t mac_addr[6] = {0};
uint8_t mac_addr[ETH_ADDR_LEN] = {0};
// we can get the ethernet driver handle from event data
esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data;
eth_dev_info_t dev_info = ethernet_init_get_dev_info(eth_handle);
Expand Down Expand Up @@ -132,6 +132,7 @@ static esp_eth_handle_t eth_init_internal(eth_device *dev_out)

// Init common MAC configs to default
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.rx_task_stack_size = CONFIG_ETHERNET_RX_TASK_STACK_SIZE;

// Init vendor specific MAC config to default
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
Expand Down Expand Up @@ -252,6 +253,7 @@ static esp_eth_handle_t eth_init_spi(spi_eth_module_config_t *spi_eth_module_con

// Init common MAC and PHY configs to default
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.rx_task_stack_size = CONFIG_ETHERNET_RX_TASK_STACK_SIZE;
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();

// Update PHY config based on board specific configuration
Expand Down
2 changes: 1 addition & 1 deletion ethernet_init/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dependencies:
version: '>=5.0'
description: This component initializes Ethernet driver based on Espressif IoT Development Framework Configuration.
url: https://github.com/espressif/esp-eth-drivers/tree/master/ethernet_init
version: 0.0.7
version: 0.0.8

0 comments on commit 4484f21

Please sign in to comment.