[DeviceDriver][Serial] Fix serial open flag lost when device reopen.
@@ -641,6 +641,13 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag)
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)
{
@@ -676,6 +683,13 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag)
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 */
dev->open_flag |= stream_flag;
