mirror of https://github.com/RT-Thread/rt-thread
[DeviceDriver][Serial] Fix serial open flag lost when device reopen.
This commit is contained in:
parent
3044461ba2
commit
2be6a968d7
|
@ -641,6 +641,13 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag)
|
||||||
serial->serial_rx = RT_NULL;
|
serial->serial_rx = RT_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oflag & RT_DEVICE_FLAG_DMA_RX)
|
||||||
|
dev->open_flag |= RT_DEVICE_FLAG_DMA_RX;
|
||||||
|
else if (oflag & RT_DEVICE_FLAG_INT_RX)
|
||||||
|
dev->open_flag |= RT_DEVICE_FLAG_INT_RX;
|
||||||
|
}
|
||||||
|
|
||||||
if (serial->serial_tx == RT_NULL)
|
if (serial->serial_tx == RT_NULL)
|
||||||
{
|
{
|
||||||
|
@ -676,6 +683,13 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag)
|
||||||
serial->serial_tx = RT_NULL;
|
serial->serial_tx = RT_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oflag & RT_DEVICE_FLAG_DMA_TX)
|
||||||
|
dev->open_flag |= RT_DEVICE_FLAG_DMA_TX;
|
||||||
|
else if (oflag & RT_DEVICE_FLAG_INT_TX)
|
||||||
|
dev->open_flag |= RT_DEVICE_FLAG_INT_TX;
|
||||||
|
}
|
||||||
|
|
||||||
/* set stream flag */
|
/* set stream flag */
|
||||||
dev->open_flag |= stream_flag;
|
dev->open_flag |= stream_flag;
|
||||||
|
|
Loading…
Reference in New Issue