diff options
author | WeiY <wei.a.yang@gmail.com> | 2013-08-25 21:45:41 +0800 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-28 14:58:50 +0200 |
commit | 697d31e660599bc8c93fba27b9d8725729a697b7 (patch) | |
tree | 033421331b9d11a75caa32847a8e82b96b962d0d /cpukit/score/include/rtems/score/atomic.h | |
parent | posix: Avoid NULL pointer access (diff) | |
download | rtems-697d31e660599bc8c93fba27b9d8725729a697b7.tar.bz2 |
add atomic init function
Diffstat (limited to 'cpukit/score/include/rtems/score/atomic.h')
-rw-r--r-- | cpukit/score/include/rtems/score/atomic.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/atomic.h b/cpukit/score/include/rtems/score/atomic.h index d94ac928b0..d51e7331ab 100644 --- a/cpukit/score/include/rtems/score/atomic.h +++ b/cpukit/score/include/rtems/score/atomic.h @@ -32,6 +32,43 @@ extern "C" { /**@{*/ /** + * @brief atomic data initializer for static initialization. + */ +#define ATOMIC_INITIALIZER_UINT(value) CPU_ATOMIC_INITIALIZER_UINT(value) +#define ATOMIC_INITIALIZER_PTR(value) CPU_ATOMIC_INITIALIZER_PTR(value) +#define ATOMIC_INITIALIZER_FLAG(value) CPU_ATOMIC_INITIALIZER_FLAG(value) + +/** + * @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); +} + +RTEMS_INLINE_ROUTINE void _Atomic_Init_flag( + volatile Atomic_Flag *object, + _Bool value +) +{ + _CPU_atomic_Init_flag(object, value); +} + +/** * @brief Atomically load an atomic type value from atomic object. * * @param object an atomic type pointer of object. |