Merge branch 'feature/emac_start_stop_test' into 'master'

test_emac: extended Ethernet start/stop stress test

Closes IDF-4540

See merge request espressif/esp-idf!16755
This commit is contained in:
Ondrej Kosta
2022-02-15 13:23:01 +00:00
9 changed files with 282 additions and 41 deletions

View File

@@ -336,17 +336,16 @@ void emac_hal_start(emac_hal_context_t *hal)
/* Flush Transmit FIFO */
emac_ll_flush_trans_fifo_enable(hal->dma_regs, true);
/* Flush Receive FIFO */
emac_ll_flush_recv_frame_enable(hal->dma_regs, true);
/* Start DMA transmission */
emac_ll_start_stop_dma_transmit(hal->dma_regs, true);
/* Start DMA reception */
emac_ll_start_stop_dma_receive(hal->dma_regs, true);
/* Enable transmit state machine of the MAC for transmission on the MII */
emac_ll_transmit_enable(hal->mac_regs, true);
/* Enable receive state machine of the MAC for reception from the MII */
emac_ll_receive_enable(hal->mac_regs, true);
/* Start DMA transmission */
emac_ll_start_stop_dma_transmit(hal->dma_regs, true);
/* Start DMA reception */
emac_ll_start_stop_dma_receive(hal->dma_regs, true);
/* Clear all pending interrupts */
emac_ll_clear_all_pending_intr(hal->dma_regs);
@@ -356,18 +355,24 @@ esp_err_t emac_hal_stop(emac_hal_context_t *hal)
{
/* Stop DMA transmission */
emac_ll_start_stop_dma_transmit(hal->dma_regs, false);
/* Stop DMA reception */
emac_ll_start_stop_dma_receive(hal->dma_regs, false);
if (emac_ll_transmit_frame_ctrl_status(hal->mac_regs) != 0x0) {
/* Previous transmit in progress */
return ESP_ERR_INVALID_STATE;
}
/* Disable receive state machine of the MAC for reception from the MII */
emac_ll_transmit_enable(hal->mac_regs, false);
/* Disable transmit state machine of the MAC for transmission on the MII */
emac_ll_receive_enable(hal->mac_regs, false);
/* Disable receive state machine of the MAC for reception from the MII */
emac_ll_transmit_enable(hal->mac_regs, false);
if (emac_ll_receive_read_ctrl_state(hal->mac_regs) != 0x0) {
/* Previous receive copy in progress */
return ESP_ERR_INVALID_STATE;
}
/* Stop DMA reception */
emac_ll_start_stop_dma_receive(hal->dma_regs, false);
/* Disable Ethernet MAC and DMA Interrupt */
emac_ll_disable_all_intr(hal->dma_regs);