Update serial.c

"remove  #ifdef RT_SERIAL_USING_DMA in rt_serial_open, always check device open dma flag"
This commit is contained in:
陈迎春 2019-01-16 13:21:20 +08:00 committed by GitHub
parent e9c80c3bfc
commit e45d7da503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 2 deletions

View File

@ -566,13 +566,11 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag)
LOG_D("open serial device: 0x%08x with open flag: 0x%04x",
dev, oflag);
#ifdef RT_SERIAL_USING_DMA
/* check device flag with the open flag */
if ((oflag & RT_DEVICE_FLAG_DMA_RX) && !(dev->flag & RT_DEVICE_FLAG_DMA_RX))
return -RT_EIO;
if ((oflag & RT_DEVICE_FLAG_DMA_TX) && !(dev->flag & RT_DEVICE_FLAG_DMA_TX))
return -RT_EIO;
#endif /* RT_SERIAL_USING_DMA */
if ((oflag & RT_DEVICE_FLAG_INT_RX) && !(dev->flag & RT_DEVICE_FLAG_INT_RX))
return -RT_EIO;
if ((oflag & RT_DEVICE_FLAG_INT_TX) && !(dev->flag & RT_DEVICE_FLAG_INT_TX))