diff options
| author | Bernard Xiong <[email protected]> | 2018-06-21 08:59:13 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-06-21 08:59:13 +0800 |
| commit | ff9162a9945267c9d2fa1166d889c694f51efa2c (patch) | |
| tree | cb26b9761851b16a0797854fd8f956fa026e7991 | |
| parent | f698c0d6682758259a99fd43aa51bf1c2dad163d (diff) | |
| parent | 284744b7b21cdf12f7137b7c1a2d75e941a313af (diff) | |
Merge pull request #1537 from Bluebear233/patch-1
Update serial.c
| -rw-r--r-- | components/drivers/serial/serial.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 1de1331344..5365026724 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -421,7 +421,6 @@ static void rt_dma_recv_update_put_index(struct rt_serial_device *serial, rt_siz /* force overwrite get index */ if (rx_fifo->put_index >= rx_fifo->get_index) { - rx_fifo->get_index = rx_fifo->put_index; rx_fifo->is_full = RT_TRUE; } } @@ -437,10 +436,15 @@ static void rt_dma_recv_update_put_index(struct rt_serial_device *serial, rt_siz rx_fifo->put_index %= serial->config.bufsz; } /* force overwrite get index */ - rx_fifo->get_index = rx_fifo->put_index; rx_fifo->is_full = RT_TRUE; } } + + if(rx_fifo->is_full == RT_TRUE) + { + rx_fifo->get_index = rx_fifo->put_index; + } + if (rx_fifo->get_index >= serial->config.bufsz) rx_fifo->get_index = 0; } |
