[En-Nut-Discussion] NutEnterCritical vs NutEnterCriticalAccess()

Nathan Moore nategoose at gmail.com
Tue Nov 17 16:05:09 CET 2015


On Tue, Nov 17, 2015 at 9:48 AM, Ole Reinhardt <ole.reinhardt at embedded-it.de
> wrote:

> even with this solution, the variable update itself would still be
> non-atomic (load and store), wouldn't it?
>

The


> Further this adds a lot of extra code that Uwe wanted to avoid?
>

The extra code is all compile-time removed.
They could be replaced with macros operations for each word size.  I decided
against pairs of critical enter and leave macros for each size because it
might not
be easy to make it clear that they would only work for storing since any
load and
store operation would not be atomic.  Operations such as:

              X++;
              X |= 0x02;

and many others would require a different approach.  These can be done
atomically
on some architectures when X is the right size, but they would need much
more
complicated access macro functions.


>
> Btw:
>
> Uwe, what exactly is you intention here? Do you need to save CPU cycles?
> Or do you want to avoid global (or local?) interrupt disabling?
>

I personally think that CPU cycles, interrupt disabling, and code size are
all
valid concerns.

Nathan


More information about the En-Nut-Discussion mailing list