Re: NutEnterCritical vs NutEnterCriticalAccess()

Nathan Moore <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.ethernut
Message-ID <CAAJh09VgECbNNAaat4ckCcmpvy+Zu1WQNqUv8piQFuQhRsoWPA@mail.gmail.com>
How about something like the following for each target cpu?

#define NutCriticalUpdate( VARIABLE, VALUE)              \
     do {
         \
              size_t sz_ = sizeof(typeof(VARIABLE));            \
              size_t sza_ = sizeof(sig_atomic_t);                    \
              typeof(VARIABLE) * VP_ = &(VARIABLE);        \
              typeof(VALUE) VAL_ = (VALUE);                     \
              if (sz_ == sza_ && is_alligned(VP_)  {               \
                     *VP_ = VAL_;
 \
              } else if (sz_ < sza) {
  \
                   /* special consideration for cpu */               \
              } else {
       \
                   NutEnterCritical();
 \
                   *VP_ = VAL_;                                            \
                   NutExitCritical();
  \
              }
        \
       } while (0)
_______________________________________________
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.