ethernet: support pin emac task to core

This commit is contained in:
morris
2020-05-27 18:55:38 +08:00
parent e783f148f0
commit 1184366387
6 changed files with 30 additions and 8 deletions
+7 -2
View File
@@ -31,6 +31,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "hal/cpu_hal.h"
#include "openeth.h"
static const char *TAG = "emac_opencores";
@@ -398,8 +399,12 @@ esp_eth_mac_t *esp_eth_mac_new_openeth(const eth_mac_config_t *config)
"alloc emac interrupt failed", out, NULL);
// Create the RX task
BaseType_t xReturned = xTaskCreate(emac_opencores_rx_task, "emac_rx", config->rx_task_stack_size, emac,
config->rx_task_prio, &emac->rx_task_hdl);
BaseType_t core_num = tskNO_AFFINITY;
if (config->flags & ETH_MAC_FLAG_PIN_TO_CORE) {
core_num = cpu_hal_get_core_id();
}
BaseType_t xReturned = xTaskCreatePinnedToCore(emac_opencores_rx_task, "emac_rx", config->rx_task_stack_size, emac,
config->rx_task_prio, &emac->rx_task_hdl, core_num);
MAC_CHECK(xReturned == pdPASS, "create emac_rx task failed", out, NULL);
return &(emac->parent);