Update stm32_eth.c

Fix some exception handling,such as when rt_sem_take failed in tx,transmission cannot be resumed。
This commit is contained in:
fengzi2003 2017-09-08 16:15:31 +08:00 committed by GitHub
parent 794835dde2
commit 0779b5e901
1 changed files with 6 additions and 1 deletions

View File

@ -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;