RT-Thread / RT-Thread/rt-thread

[Feature] _serial_fifo_rx in serial.c can be better

Open
#9,192 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in serial.c at _serial_fifo_rx and trace the RT_SERIAL_RX_BLOCKING path, including how readable data and DMA interrupt events are handled. Check the ringbuffer-size and partial-readable-data cases described in the issue. Done means blocking reads can copy data in multiple DMA-driven steps until the requested size is met, without losing data.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.