diff options
| author | Bernard Xiong <[email protected]> | 2017-11-28 13:43:57 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-11-28 13:43:57 +0800 |
| commit | 128c184554bf7c0955f8de97a59e39c8a6f6198f (patch) | |
| tree | 8f3587dd3a51a4c80b165bf5fa00d720a74b7e39 /components/drivers | |
| parent | 81cc09a3fcc38dc096f3ed20d4ebf6a4e17752cf (diff) | |
| parent | 2be6a968d7b9268f3a4a15e3f7123a4c936b7dbf (diff) | |
Merge pull request #1040 from armink/fix_serial_reopen
[DeviceDriver][Serial] Fix serial open flag lost when device reopen.
Diffstat (limited to 'components/drivers')
| -rw-r--r-- | components/drivers/serial/serial.c | 14 |
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; |
