[x] I have checked latest main branch and the issue still exists.
[x] I did not see it is stated as known-issue in release notes.
[x] No similar GitHub issue is related to this change.
[x] My code follows the commit guidelines of this project.
[x] I have performed a self-review of my own code.
[x] My changes generate no new warnings.
[ ] I have added tests that prove my fix is effective or that my feature works.
Describe the pull request
The SET and CLR peripheral registers will set and clear bits in the underlying register without requiring a racy read-modify-write sequence. ABORT is write-only and has essentially the same semantics.
The current code using |= defeats this safety and in a multithreaded environment, this could inadvetently set bits which were recently cleared by another thread.
Replace the use of DMA_COMMON_REG_GET(...) |= 1 << x with DMA_COMMON_REG_SET(..., | 1 << x) to only write a 1 to the desired bit, leaving all others alone.
Fixes: #173
Type of change
[x] Bug fix (non-breaking change which fixes an issue)
Tests
TBD
Test configuration (please complete the following information):
Hardware setting: MIMXRT595 in custom application
Toolchain: ARM GCC
Test Tool preparation:
Any other dependencies:
Test executed
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Prerequisites
Describe the pull request The
SET
andCLR
peripheral registers will set and clear bits in the underlying register without requiring a racy read-modify-write sequence. ABORT is write-only and has essentially the same semantics.The current code using |= defeats this safety and in a multithreaded environment, this could inadvetently set bits which were recently cleared by another thread.
Replace the use of
DMA_COMMON_REG_GET(...) |= 1 << x
withDMA_COMMON_REG_SET(..., | 1 << x)
to only write a 1 to the desired bit, leaving all others alone.Fixes: #173
Type of change
Tests TBD