Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send UART_BUFFER_FULL to uart event queue front (IDFGH-11254) #12413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tgotic
Copy link
Contributor

@tgotic tgotic commented Oct 15, 2023

UART_BUFFER_FULL should be sent to event queue front to signal that ring buffer is full when it happens. If it is sent to queue back, by the time it is received on another task, it might not be relevant anymore. If UART_DATA events predate UART_BUFFER_FULL, ring buffer was full, but it is not anymore.

Example ring buffer size 1k (8 * UART_FULL_THRESH_DEFAULT):
ISR(send) -> FDDDDDDDD -> task(receive)

Task could receive eight UART_DATA events and read data from ring buffer before it could be informed that ring buffer was full and some data might got lost. If UART_BUFFER_FULL is sent to queue front (DDDDDDDDF), user task can read all data from ring buffer and then clean event buffer because UART_DATA events aren't needed anymore.

UART_BUFFER_FULL should be sent to event queue front to signal that ring buffer is full when it happens.
If it is sent to queue back, by the time it is received on another task, it might not be relevant anymore.
If UART_DATA events predate UART_BUFFER_FULL, ring buffer was full, but it is not anymore.
Example ring buffer size 1k (8 * UART_FULL_THRESH_DEFAULT):
ISR(send) -> FDDDDDDDD -> task(receive)
Task could receive eight UART_DATA events and read data from ring buffer before it could be informed that ring buffer was full and some data might get lost.
If UART_BUFFER_FULL is sent to queue front (DDDDDDDDF), user task can read all data from ring buffer and then clean event buffer because UART_DATA events aren't needed anymore.
@CLAassistant
Copy link

CLAassistant commented Oct 15, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

Messages
📖 Good Job! All checks are passing!

👋 Welcome tgotic, thank you for your first contribution to espressif/esp-idf project!

📘 Please check Contributions Guide for the contribution checklist, information regarding code and documentation style, testing and other topics.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for espressif/esp-idf project.

Pull request review and merge process you can expect

Espressif develops the ESP-IDF project in an internal repository (Gitlab). We do welcome contributions in the form of bug reports, feature requests and pull requests via this public GitHub repository.

  1. An internal issue has been created for the PR, we assign it to the relevant engineer
  2. They review the PR and either approve it or ask you for changes or clarifications
  3. Once the Github PR is approved, we synchronize it into our internal git repository
  4. In the internal git repository we do the final review, collect approvals from core owners and make sure all the automated tests are passing
    • At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
  5. If the change is approved and passes the tests it is merged into the master branch
  6. On next sync from the internal git repository merged change will appear in this public Github repository

Generated by 🚫 dangerJS against fc3fb03

@espressif-bot espressif-bot added the Status: Opened Issue is new label Oct 15, 2023
@github-actions github-actions bot changed the title send UART_BUFFER_FULL to uart event queue front send UART_BUFFER_FULL to uart event queue front (IDFGH-11254) Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants