commit
aa7166df01
|
@ -882,6 +882,7 @@ static int _get_baudrate(speed_t speed)
|
||||||
|
|
||||||
static void _tc_flush(struct rt_serial_device *serial, int queue)
|
static void _tc_flush(struct rt_serial_device *serial, int queue)
|
||||||
{
|
{
|
||||||
|
rt_base_t level;
|
||||||
int ch = -1;
|
int ch = -1;
|
||||||
struct rt_serial_rx_fifo *rx_fifo = RT_NULL;
|
struct rt_serial_rx_fifo *rx_fifo = RT_NULL;
|
||||||
struct rt_device *device = RT_NULL;
|
struct rt_device *device = RT_NULL;
|
||||||
|
@ -901,10 +902,12 @@ static void _tc_flush(struct rt_serial_device *serial, int queue)
|
||||||
if((device->open_flag & RT_DEVICE_FLAG_INT_RX) || (device->open_flag & RT_DEVICE_FLAG_DMA_RX))
|
if((device->open_flag & RT_DEVICE_FLAG_INT_RX) || (device->open_flag & RT_DEVICE_FLAG_DMA_RX))
|
||||||
{
|
{
|
||||||
RT_ASSERT(RT_NULL != rx_fifo);
|
RT_ASSERT(RT_NULL != rx_fifo);
|
||||||
|
level = rt_hw_interrupt_disable();
|
||||||
rt_memset(rx_fifo->buffer, 0, serial->config.bufsz);
|
rt_memset(rx_fifo->buffer, 0, serial->config.bufsz);
|
||||||
rx_fifo->put_index = 0;
|
rx_fifo->put_index = 0;
|
||||||
rx_fifo->get_index = 0;
|
rx_fifo->get_index = 0;
|
||||||
rx_fifo->is_full = RT_FALSE;
|
rx_fifo->is_full = RT_FALSE;
|
||||||
|
rt_hw_interrupt_enable(level);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue