Skip to content

Add atomic-services requirement#136

Open
anobli wants to merge 1 commit into
zephyrproject-rtos:mainfrom
anobli:abailon/atomic-service
Open

Add atomic-services requirement#136
anobli wants to merge 1 commit into
zephyrproject-rtos:mainfrom
anobli:abailon/atomic-service

Conversation

@anobli
Copy link
Copy Markdown

@anobli anobli commented Apr 9, 2026

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!

Comment thread docs/software_requirements/atomic_service.sdoc Outdated
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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rewording "value" with an intent (I will check for a better name)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/software_requirements/atomic_service.sdoc Outdated
Comment thread docs/software_requirements/atomic_service.sdoc Outdated
@@ -0,0 +1,206 @@
[DOCUMENT]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledging DRAFT status, just stating "missing" requirements for future review pickup:

    • Parent mechanism (No linked Macro/Function) -
  1. 1, 2, 6
    • Macros -
  2. 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)
  3. 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)
  4. 11 - atomic_val_t - atomic_add (atomic_t *target, atomic_val_t value)
  5. 13 - atomic_val_t - atomic_sub (atomic_t *target, atomic_val_t value)
  6. 12 - atomic_val_t - atomic_inc (atomic_t *target)
  7. 14 - atomic_val_t - atomic_dec (atomic_t *target)
  8. 5 - atomic_val_t - atomic_get (const atomic_t *target)
    • atomic_ptr_val_t - atomic_ptr_get (const atomic_ptr_t *target)
  9. 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)
  10. 8 - atomic_val_t - atomic_or (atomic_t *target, atomic_val_t value)
  11. 10 - atomic_val_t - atomic_xor (atomic_t *target, atomic_val_t value)
  12. 7 - atomic_val_t - atomic_and (atomic_t *target, atomic_val_t value)
  13. 9 - atomic_val_t - atomic_nand (atomic_t *target, atomic_val_t value)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the PR, this should now be complete

@parphane
Copy link
Copy Markdown
Collaborator

parphane commented Apr 21, 2026

Related to #99
@anobli , can you comment the git issue above so I can assign it to you (no urgency)
My review of your draft is done

@anobli anobli force-pushed the abailon/atomic-service branch 3 times, most recently from f387442 to 38c0eef Compare May 6, 2026 08:35
@anobli anobli changed the title Draft: Add atomic-services requirement Add atomic-services requirement May 6, 2026
@anobli anobli requested a review from parphane May 6, 2026 08:42
This adds requirements for the atomic services.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
@anobli anobli force-pushed the abailon/atomic-service branch from 38c0eef to a82fa6e Compare May 6, 2026 08:43
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.

2 participants