完善串口 V2 框架 (#5720)

* [stm32] fix h7 uart V2 driver unused code.
* [DeviceDriver][serialv2] fix the serialv2 when using for console device on DMA mode.
* [stm32][art-pi] using serial v2 by default
This commit is contained in:
朱天龙 (Armink)
2022-03-27 00:52:41 +08:00
committed by GitHub
parent 961fe7de0b
commit bae1be0f45
5 changed files with 69 additions and 88 deletions
+10 -4
View File
@@ -484,21 +484,27 @@ static rt_size_t _serial_fifo_tx_blocking_buf(struct rt_device *dev,
{
struct rt_serial_device *serial;
struct rt_serial_tx_fifo *tx_fifo = RT_NULL;
rt_size_t length = size;
rt_size_t offset = 0;
RT_ASSERT(dev != RT_NULL);
if (size == 0) return 0;
RT_ASSERT(dev != RT_NULL);
serial = (struct rt_serial_device *)dev;
RT_ASSERT((serial != RT_NULL) && (buffer != RT_NULL));
tx_fifo = (struct rt_serial_tx_fifo *) serial->serial_tx;
RT_ASSERT(tx_fifo != RT_NULL);
if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM))
{
/* using poll tx when the scheduler not startup or in stream mode */
return _serial_poll_tx(dev, pos, buffer, size);
}
/* When serial transmit in tx_blocking mode,
* if the activated mode is RT_TRUE, it will return directly */
if (tx_fifo->activated == RT_TRUE) return 0;
tx_fifo->activated = RT_TRUE;
rt_size_t length = size;
rt_size_t offset = 0;
while (size)
{