-
Notifications
You must be signed in to change notification settings - Fork 3k
nRF52 serial: Tighten/simplify atomics #9616
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
Conversation
Use new atomics (exchange, load, store and bool types) to simplify and improve the atomics in the nRF52 serial HAL. * Ensure mutexes are released last and atomically when done done inside a critical section. * Compare-and-swap is not required for the spinlock - exchange is sufficient. (Not clear a spinlock is needed anyway, but left in). * Remove unneeded volatile, and make mutexes bool.
@kjbracey-arm, thank you for your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good however I'm concern about the flags tx_async
and rx_asynch
which are used to determine if a transaction is in progress.
I see what you mean. I was under the impression that the It might be okay - it's only read by the interrupt handler, and it's written by the async setup code to make it respond differently. As long as it writes to it before enabling interrupts, and the interrupt enable is a memory barrier, you're fine. But interrupt enables might not be memory barriers: patch coming for that here - ARM-software/CMSIS_5#510 I'm not really sure how much any of this is required - most HALs don't have any sort of protection in this area, and just assume you don't mix async and sync operations, or attempt overlapping async. |
CI started |
Test run: SUCCESSSummary: 12 of 12 test jobs passed |
Ha. Should've known. Preceeding PR was targeting 5.12, so this needs to as well. |
Description
Use new atomics (exchange, load, store and bool types) to simplify
and improve the atomics in the nRF52 serial HAL.
done inside a critical section.
sufficient. (Not clear a spinlock is needed anyway, but left in).
Requires preceding PR #9600.
Pull request type
Reviewers
@marcuschangarm