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

bsp: synchronize serial access #29

Merged

Conversation

hugueskamba
Copy link
Contributor

@hugueskamba hugueskamba commented Jan 4, 2024

Description

The serial driver is used by multiple tasks and not all tasks use the Log APIs to send data to the serial driver.

This was causing serial data buffer corruption.

Synchronise the access of the serial driver using mutual exclusion to make it thread-safe.

This also removes code duplication and fixes return values for
the write system call:

  • Arm GNU Toolchain: On failure, -1.
    On success, total chars written.
  • Arm Compiler: On failure, a positive number representing the number of
    chars NOT written or a negative number indicating an error.
    On success, 0.

Write system call information:

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@hugueskamba hugueskamba requested a review from a team as a code owner January 4, 2024 17:08
aggarg
aggarg previously approved these changes Jan 5, 2024
tony-josi-aws
tony-josi-aws previously approved these changes Jan 5, 2024
@hugueskamba hugueskamba changed the title bsp: synchronize serial access DRAFT: bsp: synchronize serial access Jan 5, 2024
@hugueskamba hugueskamba dismissed stale reviews from tony-josi-aws and aggarg via 475dbda January 5, 2024 22:29
@hugueskamba hugueskamba force-pushed the dev/hugkam01/synchronize_serial_access branch 3 times, most recently from 996c25e to 475d98b Compare January 5, 2024 23:37
The serial driver is used by multiple tasks and not all tasks use
the Log APIs to send data to the serial driver.
This was causing serial data buffer corruption.

Synchronise the access of the serial driver using mutual exclusion
to make it thread-safe.

This also removes code duplication and fixes return values for
the write system call:
* Arm GNU Toolchain: On failure, `-1`.
                     On success, total chars written.
* Arm Compiler: On failure, a positive number representing the number of
                chars NOT written or a negative number indicating an error.
                On success, `0`.

Signed-off-by: Devaraj Ranganna <[email protected]>
Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
@hugueskamba hugueskamba force-pushed the dev/hugkam01/synchronize_serial_access branch from 475d98b to 71f3225 Compare January 5, 2024 23:43
@hugueskamba hugueskamba changed the title DRAFT: bsp: synchronize serial access bsp: synchronize serial access Jan 6, 2024
@aggarg aggarg merged commit 4862547 into FreeRTOS:main Jan 8, 2024
6 checks passed
@hugueskamba hugueskamba deleted the dev/hugkam01/synchronize_serial_access branch January 8, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants