atomic support for RTEMS Uniprocessor - AVR libc atomic block API

Ralf Kirchner ralf.kirchner at embedded-brains.de
Tue Feb 12 16:25:31 UTC 2013


What i like especially about the AVR implementation is:

1. There are different modes for invoking an atomic block
(ATOMIC_RESTORATE, ATOMIC_FORCEON, ...)

2. You don't need an ATOMIC_START and ATOMIC_END macro. You simply write
something like:
ATOMIC_BLOCK(ATOMIC_RESTORATE)
{
  ctr_copy = ctr;
}

3. Even nesting atomic blocks is possible.

	Ralf Kirchner

Am 11.02.2013 15:02, schrieb Gedare Bloom:
> That is interesting and could be a way to address atomic support for
> some of the uniprocessors. It looks like the basic idea is the same as
> I sketched, to disable/enable interrupts around the operation. As
> mentioned, we do not know if this is going to be safe in all
> situations, e.g. if the atomic operations are used somewhere that
> interrupts cannot safely be preempted. I don't know if such a
> situation is a realistic one to worry about.
> 
> -Gedare
> 
> On Mon, Feb 11, 2013 at 3:39 AM, Ralf Kirchner
> <ralf.kirchner at embedded-brains.de> wrote:
>> Possibly a little off topic and more over a little late,
>> But did you have a look at the atomic block implementation in AVR libc?
>> I think they have quite a nice API.
>> You can find it documented here:
>> http://www.nongnu.org/avr-libc/user-manual/group__util__atomic.html
>> and the source code is here:
>> http://www.nongnu.org/avr-libc/user-manual/atomic_8h_source.html
>>
>> Kind Regards
>> --
>> --------------------------------------------
>> Embedded Brains GmbH
>> Ralf Kirchner          Dornierstr. 4
>> D-82178 Puchheim       Germany
>> email: ralf.kirchner at embedded-brains.de
>> Phone: +49-89-18 94 741-17
>> Fax:   +49-89-18 94 741-08
>>
>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>> _______________________________________________
>> rtems-devel mailing list
>> rtems-devel at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-devel


-- 
--------------------------------------------
Embedded Brains GmbH
Ralf Kirchner          Dornierstr. 4
D-82178 Puchheim       Germany
email: ralf.kirchner at embedded-brains.de
Phone: +49-89-18 94 741-17
Fax:   +49-89-18 94 741-08

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list