Merge branch 'bugfix/ethernet_init' into 'master'

ethernet : fix sometimes ethernet init fail bug



See merge request !376
This commit is contained in:
Wu Jian Gang 2017-01-06 16:26:40 +08:00
commit a4c3f876ab
2 changed files with 13 additions and 6 deletions

View file

@ -628,6 +628,7 @@ static void emac_start(void *param)
cmd->err = EMAC_CMD_OK; cmd->err = EMAC_CMD_OK;
emac_enable_clk(true); emac_enable_clk(true);
emac_reset();
emac_macaddr_init(); emac_macaddr_init();
emac_check_mac_addr(); emac_check_mac_addr();
@ -839,7 +840,9 @@ esp_err_t IRAM_ATTR emac_post(emac_sig_t sig, emac_par_t par)
} }
} }
} else { } else {
portENTER_CRITICAL(&g_emac_mux);
emac_sig_cnt[sig]++; emac_sig_cnt[sig]++;
portEXIT_CRITICAL(&g_emac_mux);
emac_event_t evt; emac_event_t evt;
evt.sig = sig; evt.sig = sig;
evt.par = par; evt.par = par;
@ -898,10 +901,8 @@ esp_err_t esp_eth_init(eth_config_t *config)
emac_xqueue = xQueueCreate(EMAC_EVT_QNUM, sizeof(emac_event_t)); 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", 2048, NULL, EMAC_TASK_PRIORITY, &emac_task_hdl);
esp_intr_alloc(ETS_ETH_MAC_INTR_SOURCE, 0, emac_process_intr, NULL, NULL);
emac_reset();
emac_enable_clk(false); emac_enable_clk(false);
esp_intr_alloc(ETS_ETH_MAC_INTR_SOURCE, 0, emac_process_intr, NULL, NULL);
emac_config.emac_status = EMAC_RUNTIME_INIT; emac_config.emac_status = EMAC_RUNTIME_INIT;

View file

@ -21,14 +21,20 @@ Macros
Type Definitions Type Definitions
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
.. doxygentypedef:: eth_phy_fun .. doxygentypedef:: eth_phy_check_link_func
.. doxygentypedef:: eth_tcpip_input_fun .. doxygentypedef:: eth_phy_check_init_func
.. doxygentypedef:: eth_phy_get_speed_mode_func
.. doxygentypedef:: eth_phy_get_duplex_mode_func
.. doxygentypedef:: eth_phy_func
.. doxygentypedef:: eth_tcpip_input_func
.. doxygentypedef:: eth_gpio_config_func .. doxygentypedef:: eth_gpio_config_func
Enumerations Enumerations
^^^^^^^^^^^^ ^^^^^^^^^^^^
.. doxygenenum:: eth_mode_t .. doxygenenum:: eth_mode_t
.. doxygenenum:: eth_speed_mode_t
.. doxygenenum:: eth_duplex_mode_t
.. doxygenenum:: eth_phy_base_t .. doxygenenum:: eth_phy_base_t
Structures Structures
@ -48,4 +54,4 @@ Functions
.. doxygenfunction:: esp_eth_get_mac .. doxygenfunction:: esp_eth_get_mac
.. doxygenfunction:: esp_eth_smi_write .. doxygenfunction:: esp_eth_smi_write
.. doxygenfunction:: esp_eth_smi_read .. doxygenfunction:: esp_eth_smi_read
.. doxygenfunction:: esp_eth_free_rx_buf