[PATCH 1/5] New atomic API definition based on C11 atomic
Sebastian Huber
sebastian.huber at embedded-brains.de
Sun Jul 7 16:19:55 UTC 2013
Hello Wei,
thanks for your patch. It looks good. I have only few issues which
should be easy to fix.
On 07/07/13 17:52, WeiY wrote:
> Signed-off-by: WeiY<wei.a.yang at gmail.com>
What did you sign off? RTEMS has currently no procedure for this as on
Linux and various other projects.
> ---
> cpukit/score/include/rtems/score/atomic.h | 465 ++++++++++++++++-------------
> 1 file changed, 251 insertions(+), 214 deletions(-)
>
> diff --git a/cpukit/score/include/rtems/score/atomic.h b/cpukit/score/include/rtems/score/atomic.h
> index 3b62cb1..3378564 100644
> --- a/cpukit/score/include/rtems/score/atomic.h
> +++ b/cpukit/score/include/rtems/score/atomic.h
> @@ -8,7 +8,7 @@
> */
>
> /*
> - * COPYRIGHT (c) 2012 Deng Hengyi.
> + * COPYRIGHT (c) 2013 Deng Hengyi.
You can use 2012-2013.
> *
> * The license and distribution terms for this file may be
> * found in the file LICENSE in this distribution or at
> @@ -32,241 +32,278 @@ extern "C" {
> /**@{*/
>
> /**
> - * @brief the enumeration Atomic_Memory_barrier specifies the detailed regular
> - * memory synchronization operations used in the atomic operation API
> - * definitions.
> + * @brief Atomically load an atomic type value from object @a object with
> + * a type of Atomic_Order @a order. The @a order shall not be
> + * ATOMIC_ORDER_RELEASE.
In RTEMS we use now @param for parameter documentation.
http://wiki.rtems.org/wiki/index.php/Doxygen_Recommendations
> */
> -typedef enum {
> - /** no operation orders memory. */
> - ATOMIC_RELAXED_BARRIER,
> - /** a load operation performs an acquire operation on the affected memory
> - * location. This flag guarantees that the effects of load operation are
> - * completed before the effects of any later data accesses.
> - */
> - ATOMIC_ACQUIRE_BARRIER,
> - /** a store operation performs a release operation on the affected memory
> - * location. This flag guarantee that all effects of all previous data
> - * accesses are completed before the store operation takes place.
> - */
> - ATOMIC_RELEASE_BARRIER
> -} Atomic_Memory_barrier;
> +RTEMS_INLINE_ROUTINE uint_fast32_t Atomic_Load_uint(
> + volatile Atomic_Uint *object,
> + Atomic_Order order
> +)
> +{
> + return _CPU_Atomic_Load_uint(object, order);
> +}
Please add an empty line between function definitions. Add spaces in
the function call, e.g.
_CPU_Atomic_Load_uint( object, order );
In the score the naming convention is
_Package_name_Operation_name()
Here _CPU_atomic is the package and Load_uint is the operation, thus we have
_CPU_atomic_Load_uint()
All score functions must have an '_' underscore as the first character,
e.g. _Atomic_Load_uint() instead of Atomic_Load_uint()
> +RTEMS_INLINE_ROUTINE uintptr_t Atomic_Load_ptr(
> + volatile Atomic_Pointer *object,
> + Atomic_Order order
> +)
> +{
> + return _CPU_Atomic_Load_ptr(object, order);
> +}
[...]
The _Atomic_Fetch_op_flag() functions make no sense (e.g.
Atomic_Fetch_add_flag()). Please remove them.
--
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.
More information about the devel
mailing list