summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-12-14 16:40:28 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-02-03 10:00:56 +0100
commit4eee8781458f271be78e6f92cf344f9dbd2b4c8e (patch)
tree26b5da548cc70474d8fcb397403b00a224af1696
parentOptional POSIX RWLock initialization (diff)
downloadrtems-4eee8781458f271be78e6f92cf344f9dbd2b4c8e.tar.bz2
Optional POSIX Spinlock initialization
Update #2408.
-rw-r--r--cpukit/posix/include/rtems/posix/spinlockimpl.h10
-rw-r--r--cpukit/posix/src/pspin.c11
-rw-r--r--cpukit/sapi/src/posixapi.c5
-rw-r--r--cpukit/score/include/rtems/sysinit.h1
-rw-r--r--testsuites/sptests/spsysinit01/init.c17
5 files changed, 29 insertions, 15 deletions
diff --git a/cpukit/posix/include/rtems/posix/spinlockimpl.h b/cpukit/posix/include/rtems/posix/spinlockimpl.h
index 8a2f58360d..01fe372aca 100644
--- a/cpukit/posix/include/rtems/posix/spinlockimpl.h
+++ b/cpukit/posix/include/rtems/posix/spinlockimpl.h
@@ -34,15 +34,7 @@ extern "C" {
* this class of objects.
*/
-POSIX_EXTERN Objects_Information _POSIX_Spinlock_Information;
-
-/**
- * @brief POSIX spinlock manager initialization.
- *
- * This routine performs the initialization necessary for this manager.
- */
-
-void _POSIX_Spinlock_Manager_initialization(void);
+extern Objects_Information _POSIX_Spinlock_Information;
/**
* @brief Translate core spinlock status code.
diff --git a/cpukit/posix/src/pspin.c b/cpukit/posix/src/pspin.c
index 781420c5b7..62e6f3ab1b 100644
--- a/cpukit/posix/src/pspin.c
+++ b/cpukit/posix/src/pspin.c
@@ -21,12 +21,15 @@
#include <rtems/system.h>
#include <rtems/config.h>
+#include <rtems/sysinit.h>
#include <rtems/posix/spinlockimpl.h>
+Objects_Information _POSIX_Spinlock_Information;
+
/**
* @brief _POSIX_Spinlock_Manager_initialization
*/
-void _POSIX_Spinlock_Manager_initialization(void)
+static void _POSIX_Spinlock_Manager_initialization(void)
{
_Objects_Initialize_information(
&_POSIX_Spinlock_Information, /* object information table */
@@ -44,3 +47,9 @@ void _POSIX_Spinlock_Manager_initialization(void)
#endif
);
}
+
+RTEMS_SYSINIT_ITEM(
+ _POSIX_Spinlock_Manager_initialization,
+ RTEMS_SYSINIT_POSIX_SPINLOCK,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index 2ff526f370..08b47de840 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -34,7 +34,6 @@
#include <rtems/posix/config.h>
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/psignalimpl.h>
-#include <rtems/posix/spinlockimpl.h>
#endif
void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno )
@@ -54,8 +53,4 @@ void _POSIX_API_Initialize(void)
*/
_POSIX_Key_Manager_initialization();
-
- #ifdef RTEMS_POSIX_API
- _POSIX_Spinlock_Manager_initialization();
- #endif
}
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 27ee0c98aa..8f187648b4 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -51,6 +51,7 @@ extern "C" {
#define RTEMS_SYSINIT_POSIX_TIMER 000366
#define RTEMS_SYSINIT_POSIX_BARRIER 000367
#define RTEMS_SYSINIT_POSIX_RWLOCK 000368
+#define RTEMS_SYSINIT_POSIX_SPINLOCK 000369
#define RTEMS_SYSINIT_POSIX_CLEANUP 00036a
#define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_BSP_LIBC 000400
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index e5d6dc9fc4..042c60002c 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -36,6 +36,7 @@
#include <rtems/posix/pthreadimpl.h>
#include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/semaphoreimpl.h>
+#include <rtems/posix/spinlockimpl.h>
#include <rtems/posix/timerimpl.h>
#endif /* RTEMS_POSIX_API */
#include <rtems/rtems/barrierimpl.h>
@@ -107,6 +108,8 @@ typedef enum {
POSIX_BARRIER_POST,
POSIX_RWLOCK_PRE,
POSIX_RWLOCK_POST,
+ POSIX_SPINLOCK_PRE,
+ POSIX_SPINLOCK_POST,
POSIX_CLEANUP_PRE,
POSIX_CLEANUP_POST,
#endif /* RTEMS_POSIX_API */
@@ -467,6 +470,18 @@ LAST(RTEMS_SYSINIT_POSIX_RWLOCK)
next_step(POSIX_RWLOCK_POST);
}
+FIRST(RTEMS_SYSINIT_POSIX_SPINLOCK)
+{
+ assert(_POSIX_Spinlock_Information.maximum == 0);
+ next_step(POSIX_SPINLOCK_PRE);
+}
+
+LAST(RTEMS_SYSINIT_POSIX_SPINLOCK)
+{
+ assert(_POSIX_Spinlock_Information.maximum != 0);
+ next_step(POSIX_SPINLOCK_POST);
+}
+
static size_t user_extensions_pre_posix_cleanup;
FIRST(RTEMS_SYSINIT_POSIX_CLEANUP)
@@ -608,6 +623,8 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 1
+
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 1
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1