rt-thread icon indicating copy to clipboard operation
rt-thread copied to clipboard

[Feature] _serial_fifo_rx in serial.c can be better

Open hiiizxf opened this issue 1 year ago • 0 comments

Describe problem solved by the proposed feature

_serial_fifo_rx with RT_SERIAL_RX_BLOCKING in serial.c is limited by the buffer size 1.when needed size is large than ringbuffer size, _serial_fifo_rx will do nothing.
2.when needed size is large than readable size, _serial_fifo_rx will update rx_fifo->rx_cpt_index = size and wait for rx_fifo->rx_cpt, but do nothing else. The above results in data loss.

Describe your preferred solution

_serial_fifo_rx with RT_SERIAL_RX_BLOCKING in serial.c, maybe can waiting for dma intrrupt event to copy readable data to user buffer several times, until readed data size is enough. When readable size is large then user read size, data can be copied directly.

Describe possible alternatives

No response

hiiizxf avatar Jul 16 '24 01:07 hiiizxf