score: Make <rtems/score/atomic.h> available

Make <rtems/score/atomic.h> available for all RTEMS configurations.  Use
inline functions instead of macros.  Use ISR disable/enable on
uni-processor configurations to ensure atomicity.

Update #2273.
This commit is contained in:
Sebastian Huber committed 2015-02-19 10:05:48 +01:00
1 parent fd144302a5
commit 4e3d9a4d6c
12 files changed
+877 -381

No files matched your search

+2 -2
View File
@@ -17,6 +17,7 @@ include_rtems_score_HEADERS = include/rtems/score/address.h
include_rtems_score_HEADERS += include/rtems/score/apiext.h
include_rtems_score_HEADERS += include/rtems/score/apimutex.h
include_rtems_score_HEADERS += include/rtems/score/assert.h
include_rtems_score_HEADERS += include/rtems/score/atomic.h
include_rtems_score_HEADERS += include/rtems/score/chain.h
include_rtems_score_HEADERS += include/rtems/score/chainimpl.h
include_rtems_score_HEADERS += include/rtems/score/context.h
@@ -31,6 +32,7 @@ include_rtems_score_HEADERS += include/rtems/score/coresem.h
include_rtems_score_HEADERS += include/rtems/score/coresemimpl.h
include_rtems_score_HEADERS += include/rtems/score/cpuset.h
include_rtems_score_HEADERS += include/rtems/score/cpusetimpl.h
include_rtems_score_HEADERS += include/rtems/score/cpustdatomic.h
include_rtems_score_HEADERS += include/rtems/score/heap.h
include_rtems_score_HEADERS += include/rtems/score/heapimpl.h
include_rtems_score_HEADERS += include/rtems/score/protectedheap.h
@@ -112,8 +114,6 @@ include_rtems_score_HEADERS += include/rtems/score/threadmp.h
endif
if HAS_SMP
include_rtems_score_HEADERS += include/rtems/score/atomic.h
include_rtems_score_HEADERS += include/rtems/score/cpustdatomic.h
include_rtems_score_HEADERS += include/rtems/score/schedulerprioritysmpimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulerpriorityaffinitysmp.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimplesmp.h
@@ -42,6 +42,8 @@ typedef CPU_atomic_Pointer Atomic_Pointer;
typedef CPU_atomic_Flag Atomic_Flag;
typedef CPU_atomic_Order Atomic_Order;
#define ATOMIC_ORDER_RELAXED CPU_ATOMIC_ORDER_RELAXED
#define ATOMIC_ORDER_ACQUIRE CPU_ATOMIC_ORDER_ACQUIRE
File diff suppressed because it is too large. Load diff
+8 -8
View File
@@ -51,6 +51,10 @@ $(PROJECT_INCLUDE)/rtems/score/assert.h: include/rtems/score/assert.h $(PROJECT_
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/assert.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/assert.h
$(PROJECT_INCLUDE)/rtems/score/atomic.h: include/rtems/score/atomic.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/atomic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/atomic.h
$(PROJECT_INCLUDE)/rtems/score/chain.h: include/rtems/score/chain.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/chain.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/chain.h
@@ -107,6 +111,10 @@ $(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h: include/rtems/score/cpusetimpl.h $(
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h
$(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h: include/rtems/score/cpustdatomic.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h
$(PROJECT_INCLUDE)/rtems/score/heap.h: include/rtems/score/heap.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/heap.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/heap.h
@@ -398,14 +406,6 @@ $(PROJECT_INCLUDE)/rtems/score/threadmp.h: include/rtems/score/threadmp.h $(PROJ
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threadmp.h
endif
if HAS_SMP
$(PROJECT_INCLUDE)/rtems/score/atomic.h: include/rtems/score/atomic.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/atomic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/atomic.h
$(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h: include/rtems/score/cpustdatomic.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h
$(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmpimpl.h: include/rtems/score/schedulerprioritysmpimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmpimpl.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmpimpl.h
File diff suppressed because it is too large. Load diff
@@ -1,11 +1,4 @@
*** TEST SMPATOMIC 1 ***
=== atomic simple add test case ===
=== atomic simple sub test case ===
=== atomic simple or test case ===
=== atomic simple and test case ===
=== atomic simple exchange test case ===
=== atomic simple compare exchange test case ===
=== static and dynamic initialization test case ====
=== atomic add test case ===
worker 0 value: 16686
worker 1 value: 36405
+1
View File
@@ -37,6 +37,7 @@ if HAS_SMP
else
_SUBDIRS += sp29
endif
_SUBDIRS += spatomic01
_SUBDIRS += spintrcritical22
_SUBDIRS += spsem03
_SUBDIRS += spresource01
+1
View File
@@ -40,6 +40,7 @@ AM_CONDITIONAL(HAS_SMP,test "$rtems_cv_RTEMS_SMP" = "yes")
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
spatomic01/Makefile
spglobalcon01/Makefile
spintrcritical22/Makefile
spsem03/Makefile
+19
View File
@@ -0,0 +1,19 @@
rtems_tests_PROGRAMS = spatomic01
spatomic01_SOURCES = init.c
dist_rtems_tests_DATA = spatomic01.scn spatomic01.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(spatomic01_OBJECTS)
LINK_LIBS = $(spatomic01_LDLIBS)
spatomic01$(EXEEXT): $(spatomic01_OBJECTS) $(spatomic01_DEPENDENCIES)
@rm -f spatomic01$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,37 @@
This file describes the directives and concepts tested by this test set.
test set name: spatomic01
directives:
- ATOMIC_INITIALIZER_FLAG
- ATOMIC_INITIALIZER_PTR()
- ATOMIC_INITIALIZER_UINT()
- ATOMIC_INITIALIZER_ULONG()
- _Atomic_Compare_exchange_uint()
- _Atomic_Compare_exchange_ulong()
- _Atomic_Exchange_uint()
- _Atomic_Exchange_ulong()
- _Atomic_Fence()
- _Atomic_Fetch_add_uint()
- _Atomic_Fetch_add_ulong()
- _Atomic_Fetch_and_uint()
- _Atomic_Fetch_and_ulong()
- _Atomic_Fetch_or_uint()
- _Atomic_Fetch_or_ulong()
- _Atomic_Fetch_sub_uint()
- _Atomic_Fetch_sub_ulong()
- _Atomic_Flag_clear()
- _Atomic_Flag_test_and_set()
- _Atomic_Init_ptr()
- _Atomic_Init_uint()
- _Atomic_Init_ulong()
- _Atomic_Load_ptr()
- _Atomic_Load_uint()
- _Atomic_Load_ulong()
- _Atomic_Store_uint()
- _Atomic_Store_ulong()
concepts:
- Ensure that the atomic operations work.
@@ -0,0 +1,9 @@
*** BEGIN OF TEST SPATOMIC 1 ***
=== static and dynamic initialization test case ===
=== atomic simple add test case ===
=== atomic simple sub test case ===
=== atomic simple or test case ===
=== atomic simple and test case ===
=== atomic simple exchange test case ===
=== atomic simple compare exchange test case ===
*** END OF TEST SPATOMIC 1 ***