Re: NutEnterCritical vs NutEnterCriticalAccess()

Nathan Moore <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.ethernut
Message-ID <CAAJh09UhnZidgb-1SfgSDzs858xCwUhAOdfL_8XDyXyHBco0mg@mail.gmail.com>
On Tue, Nov 17, 2015 at 9:48 AM, Ole Reinhardt <ole.reinhardt-L1vi/[email protected]
> 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
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.