[PATCH 1/6] add atomic init function

Deng Hengyi wei.a.yang at gmail.com
Wed Aug 21 13:54:06 UTC 2013


在 2013-8-20,下午4:39,Sebastian Huber <sebastian.huber at embedded-brains.de> 写道:

> On 2013-08-19 17:39, WeiY wrote:
>> ---
>>  cpukit/score/include/rtems/score/atomic.h       |   27 ++++++++++++++++++++++
>>  cpukit/score/include/rtems/score/cpustdatomic.h |   28 +++++++++++++++++++++++
>>  2 files changed, 55 insertions(+)
>> 
>> diff --git a/cpukit/score/include/rtems/score/atomic.h b/cpukit/score/include/rtems/score/atomic.h
>> index d94ac92..db70fe8 100644
>> --- a/cpukit/score/include/rtems/score/atomic.h
>> +++ b/cpukit/score/include/rtems/score/atomic.h
>> @@ -32,6 +32,33 @@ extern "C" {
>>  /**@{*/
>> 
>>  /**
>> + * @brief atomic data initializer for static initialization.
>> + */
>> +#define ATOMIC_VAR_INITIALIZER(value) CPU_ATOMIC_INITIALIZER(value)
> 
> Since we have explicit type dependent names for all other operations we should do this here also, e.g. ATOMIC_INITIALIZER_UINT(value).
OK.
> 
>> +
>> +/**
>> + * @brief Initializes an atomic type value into a atomic object.
>> + *
>> + * @param object an atomic type pointer of object.
>> + * @param value a value to be stored into object.
>> + */
>> +RTEMS_INLINE_ROUTINE void _Atomic_Init_uint(
>> +  volatile Atomic_Uint *object,
>> +  uint_fast32_t value
>> +)
>> +{
>> +  _CPU_atomic_Init_uint(object, value);
>> +}
>> +
>> +RTEMS_INLINE_ROUTINE void _Atomic_Init_ptr(
>> +  volatile Atomic_Pointer *object,
>> +  uintptr_t value
>> +)
>> +{
>> +  _CPU_atomic_Init_ptr(object, value);
>> +}
> 
> What about the Atomic_Flag?
> 
I will add it for flag.
> [...]
> 
> Please add test cases that ensure that static and function based initialization leads to the same objects.
> 
> Example:
> 
> http://git.rtems.org/rtems/tree/testsuites/sptests/sp37/init.c#n168
> 
> Please add test cases that ensure that the value used for initialization is the value returned by the corresponding load operation.
> 
OK.
> -- 
> Sebastian Huber, embedded brains GmbH
> 
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
> 
> 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





More information about the devel mailing list