]> granicus.if.org Git - esp-idf/commitdiff
ethernet: enlarge ethernet task stack size
authormorris <maoshengrong@espressif.com>
Wed, 5 Sep 2018 13:43:03 +0000 (21:43 +0800)
committermorris <maoshengrong@espressif.com>
Fri, 7 Sep 2018 02:16:34 +0000 (10:16 +0800)
1. In original driver, the stack size for emac driver task "emacT" is only 2048 Bytes, which also can not be changed by user.
2. Each time when invoking "emac_start" function, it will reset emac registers, the driver should reconfig some important registers again.

components/ethernet/Kconfig
components/ethernet/emac_common.h
components/ethernet/emac_main.c

index 5808c525db9fbc0243d048e2ff524d82093b4894..c91ad5d5733dcd93293427602f4ec553a96aad62 100644 (file)
@@ -50,4 +50,11 @@ config EMAC_TASK_PRIORITY
     help
         Ethernet MAC task priority.
 
+config EMAC_TASK_STACK_SIZE
+    int "Stack Size of EMAC Task"
+    default 3072
+    range 2000 8000
+    help
+        Stack Size of Ethernet MAC task.
+
 endmenu
index 4b20c6aca305bf47952b7902d7d2432512cd7130..c8627738345291b85f86bb1b3f2caff016469414 100644 (file)
@@ -106,6 +106,7 @@ struct emac_close_cmd {
 #define DMA_RX_BUF_NUM CONFIG_DMA_RX_BUF_NUM
 #define DMA_TX_BUF_NUM CONFIG_DMA_TX_BUF_NUM
 #define EMAC_TASK_PRIORITY CONFIG_EMAC_TASK_PRIORITY
+#define EMAC_TASK_STACK_SIZE  CONFIG_EMAC_TASK_STACK_SIZE
 
 #define DMA_RX_BUF_SIZE 1600
 #define DMA_TX_BUF_SIZE 1600
index 042e2de1fc66e82c6ad628b3000fd8e8dddd1118..5a0b38891d0f4b13f81df93588cf75d3de0c3216 100644 (file)
@@ -816,6 +816,7 @@ static void emac_start(void *param)
     emac_enable_clk(true);
 
     emac_reset();
+    emac_dma_init();
 
     emac_set_macaddr_reg();
 
@@ -1155,8 +1156,8 @@ esp_err_t esp_eth_init_internal(eth_config_t *config)
     emac_rx_xMutex = xSemaphoreCreateRecursiveMutex();
     emac_tx_xMutex = xSemaphoreCreateRecursiveMutex();
     emac_xqueue = xQueueCreate(EMAC_EVT_QNUM, sizeof(emac_event_t));
-    xTaskCreate(emac_task, "emacT", 2048, NULL, EMAC_TASK_PRIORITY,
-                &emac_task_hdl);
+    xTaskCreate(emac_task, "emacT", EMAC_TASK_STACK_SIZE, NULL,
+                EMAC_TASK_PRIORITY, &emac_task_hdl);
 
     emac_enable_clk(false);
     esp_intr_alloc(ETS_ETH_MAC_INTR_SOURCE, 0, emac_process_intr, NULL, NULL);