From 0779b5e90102ba8eacb48dac3bc379d3cf5a3ac0 Mon Sep 17 00:00:00 2001 From: fengzi2003 Date: Fri, 8 Sep 2017 16:15:31 +0800 Subject: [PATCH] Update stm32_eth.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix some exception handling,such as when rt_sem_take failed in tx,transmission cannot be resumed。 --- bsp/stm32f107/drivers/stm32_eth.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bsp/stm32f107/drivers/stm32_eth.c b/bsp/stm32f107/drivers/stm32_eth.c index d9d1ef9e5..13ddb8deb 100644 --- a/bsp/stm32f107/drivers/stm32_eth.c +++ b/bsp/stm32f107/drivers/stm32_eth.c @@ -3206,7 +3206,12 @@ rt_err_t rt_stm32_eth_tx( rt_device_t dev, struct pbuf* p) { rt_err_t result; result = rt_sem_take(&tx_buf_free, 2); - if (result != RT_EOK) return -RT_ERROR; + if (result != RT_EOK) + { + ETH_FlushTransmitFIFO(); // clear fifo + ETH_ResumeDMATransmission(); // resume dma + return -RT_ERROR; + } } offset = 0; -- GitLab