[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] New Atomic.h header?

From: Joerg Wunsch
Subject: Re: [avr-libc-dev] New Atomic.h header?
Date: Sun, 7 Jan 2007 22:51:35 +0100
User-agent: Mutt/1.5.11

Hi Dean,

thanks for your suggestion, and for getting here to the mailing list
with these.  I hope others might also state their opinions about it,
as I think this issue occasionally came up as a request in some

> My macro allows for both atomic (interrupts disabled) and non-atomic
> (interrupts enabled) blocks of code to be easily made.

> Two options are avaliable; ATOMIC_RESTORESTATE, where the previous
> interrupt enable flag status is restored, and ATOMIC_FORCEON (or
> ATOMIC_FORCEOFF for the non-atomic block) which forces the global
> flag state on block exit - desirable in some instances.

I see the symmetry, but I don't see much point in a non-atomic block
(why can't you just say sei(); somewhere in it then?), and I don't see
any real application for the FORCEON and FORCEOFF options.  As I
stated in the thread, if you ever come to need one of them, I believe
you're rather running into a design error with your code.

That doesn't mean I'm completely against them, but I don't see much
point in having them.  The more, I'd like to hear other people's
opinions here.

Also, I tend to not start up yet another header file for these, but
would rather include them into <avr/interrupt.h>.  Perhaps we should
pick names that are reserved for the implementation then, to not
collide with any possible (different) version in any existing
application -- <avr/interrupt.h> is likely to be included into almost
everything on earth.  So the suggestion is to use _ATOMIC_BLOCK()
rather than ATOMIC_BLOCK() etc.  Again, opinions about this?

> Despite its simplicity, would it have an application for AVRLibC?

Simplicity is a virtue.

> Should I add DoxyGen comments and submit as a patch?

Once any discussion about the above questions has been settled, yes,
please.  Also, please ping Dercy Whatkins about them and about the
licensing and such.  We would kindly ask both, him and you, to permit
a redistribution under the same license terms as the remainder of
avr-libc, regardless of whether it's going to become <avr/atomic.h> or
inside <avr/interrupt.h>.  Obviously, his name should be attributed
in the copyright notice as well as yours.

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]