Add atomic-services requirement#136
Open
anobli wants to merge 1 commit into
Open
Conversation
parphane
reviewed
Apr 21, 2026
| COMPONENT: Atomic Service | ||
| TITLE: Setting atomic variable | ||
| STATEMENT: >>> | ||
| The Zephyr RTOS shall provide a mechanism for setting an atomic variable and returning its previous value. |
Collaborator
There was a problem hiding this comment.
Consider rewording "value" with an intent (I will check for a better name)
Author
There was a problem hiding this comment.
Have you find a better name ?
Used value word in many place because in the end, atomic service just gives a way to manipulate a variable.
| @@ -0,0 +1,206 @@ | |||
| [DOCUMENT] | |||
Collaborator
There was a problem hiding this comment.
Acknowledging DRAFT status, just stating "missing" requirements for future review pickup:
-
- Parent mechanism (No linked Macro/Function) -
- 1, 2, 6
-
- Macros -
- 3 - #define - ATOMIC_INIT(i)
-
- #define - ATOMIC_PTR_INIT(p)
-
- #define - ATOMIC_BITMAP_SIZE(num_bits)
-
- #define - ATOMIC_DEFINE(name, num_bits)
-
- Functions -
-
- static _Bool - atomic_test_bit (const atomic_t *target, int bit)
-
- static _Bool - atomic_test_and_clear_bit (atomic_t *target, int bit)
- 15 - static _Bool - atomic_test_and_set_bit (atomic_t *target, int bit)
-
- static void - atomic_clear_bit (atomic_t *target, int bit)
-
- static void - atomic_set_bit (atomic_t *target, int bit)
-
- static void - atomic_set_bit_to (atomic_t *target, int bit, _Bool val)
-
- _Bool - atomic_cas (atomic_t *target, atomic_val_t old_value, atomic_val_t new_value)
-
- _Bool - atomic_ptr_cas (atomic_ptr_t *target, atomic_ptr_val_t old_value, atomic_ptr_val_t new_value)
- 11 - atomic_val_t - atomic_add (atomic_t *target, atomic_val_t value)
- 13 - atomic_val_t - atomic_sub (atomic_t *target, atomic_val_t value)
- 12 - atomic_val_t - atomic_inc (atomic_t *target)
- 14 - atomic_val_t - atomic_dec (atomic_t *target)
- 5 - atomic_val_t - atomic_get (const atomic_t *target)
-
- atomic_ptr_val_t - atomic_ptr_get (const atomic_ptr_t *target)
- 4 - atomic_val_t - atomic_set (atomic_t *target, atomic_val_t value)
-
- atomic_ptr_val_t - atomic_ptr_set (atomic_ptr_t *target, atomic_ptr_val_t value)
-
- atomic_val_t - atomic_clear (atomic_t *target)
-
- atomic_ptr_val_t - atomic_ptr_clear (atomic_ptr_t *target)
- 8 - atomic_val_t - atomic_or (atomic_t *target, atomic_val_t value)
- 10 - atomic_val_t - atomic_xor (atomic_t *target, atomic_val_t value)
- 7 - atomic_val_t - atomic_and (atomic_t *target, atomic_val_t value)
- 9 - atomic_val_t - atomic_nand (atomic_t *target, atomic_val_t value)
Author
There was a problem hiding this comment.
I have updated the PR, this should now be complete
Collaborator
f387442 to
38c0eef
Compare
This adds requirements for the atomic services. Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
38c0eef to
a82fa6e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds requirements for the atomic services.
This should cover many existing features of Zephyr RTOS atomic services.
I know there are missing requirements but I would be interested in having some feedback before going further.
This is the first time I am doing that and I would happy to exchange to improve my first requirements and then figure out how to write correctly the missing ones!
Please note that I have been using IA for checking / fixing spelling mistake and for reviewing what I did!