summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorarmink <[email protected]>2017-11-26 10:19:51 +0800
committerarmink <[email protected]>2017-11-26 10:19:51 +0800
commit2be6a968d7b9268f3a4a15e3f7123a4c936b7dbf (patch)
treee81f1b7c7d7be4b4491c83ff5ba35f31510ec0f9 /components
parent3044461ba22dcd926a03d1088c4fe44ce18d38b0 (diff)
[DeviceDriver][Serial] Fix serial open flag lost when device reopen.
Diffstat (limited to 'components')
-rw-r--r--components/drivers/serial/serial.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c
index 3aad9e4ab7..645d083283 100644
--- a/components/drivers/serial/serial.c
+++ b/components/drivers/serial/serial.c
@@ -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;