Optional POSIX Spinlock initialization

Update #2408.
This commit is contained in:
Sebastian Huber
2015-12-14 16:40:28 +01:00
parent 76a8328945
commit 4eee878145
5 changed files with 29 additions and 15 deletions

View File

@@ -34,15 +34,7 @@ extern "C" {
* this class of objects. * this class of objects.
*/ */
POSIX_EXTERN Objects_Information _POSIX_Spinlock_Information; 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);
/** /**
* @brief Translate core spinlock status code. * @brief Translate core spinlock status code.

View File

@@ -21,12 +21,15 @@
#include <rtems/system.h> #include <rtems/system.h>
#include <rtems/config.h> #include <rtems/config.h>
#include <rtems/sysinit.h>
#include <rtems/posix/spinlockimpl.h> #include <rtems/posix/spinlockimpl.h>
Objects_Information _POSIX_Spinlock_Information;
/** /**
* @brief _POSIX_Spinlock_Manager_initialization * @brief _POSIX_Spinlock_Manager_initialization
*/ */
void _POSIX_Spinlock_Manager_initialization(void) static void _POSIX_Spinlock_Manager_initialization(void)
{ {
_Objects_Initialize_information( _Objects_Initialize_information(
&_POSIX_Spinlock_Information, /* object information table */ &_POSIX_Spinlock_Information, /* object information table */
@@ -44,3 +47,9 @@ void _POSIX_Spinlock_Manager_initialization(void)
#endif #endif
); );
} }
RTEMS_SYSINIT_ITEM(
_POSIX_Spinlock_Manager_initialization,
RTEMS_SYSINIT_POSIX_SPINLOCK,
RTEMS_SYSINIT_ORDER_MIDDLE
);

View File

@@ -34,7 +34,6 @@
#include <rtems/posix/config.h> #include <rtems/posix/config.h>
#include <rtems/posix/priorityimpl.h> #include <rtems/posix/priorityimpl.h>
#include <rtems/posix/psignalimpl.h> #include <rtems/posix/psignalimpl.h>
#include <rtems/posix/spinlockimpl.h>
#endif #endif
void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno ) void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno )
@@ -54,8 +53,4 @@ void _POSIX_API_Initialize(void)
*/ */
_POSIX_Key_Manager_initialization(); _POSIX_Key_Manager_initialization();
#ifdef RTEMS_POSIX_API
_POSIX_Spinlock_Manager_initialization();
#endif
} }

View File

@@ -51,6 +51,7 @@ extern "C" {
#define RTEMS_SYSINIT_POSIX_TIMER 000366 #define RTEMS_SYSINIT_POSIX_TIMER 000366
#define RTEMS_SYSINIT_POSIX_BARRIER 000367 #define RTEMS_SYSINIT_POSIX_BARRIER 000367
#define RTEMS_SYSINIT_POSIX_RWLOCK 000368 #define RTEMS_SYSINIT_POSIX_RWLOCK 000368
#define RTEMS_SYSINIT_POSIX_SPINLOCK 000369
#define RTEMS_SYSINIT_POSIX_CLEANUP 00036a #define RTEMS_SYSINIT_POSIX_CLEANUP 00036a
#define RTEMS_SYSINIT_IDLE_THREADS 000380 #define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_BSP_LIBC 000400 #define RTEMS_SYSINIT_BSP_LIBC 000400

View File

@@ -36,6 +36,7 @@
#include <rtems/posix/pthreadimpl.h> #include <rtems/posix/pthreadimpl.h>
#include <rtems/posix/rwlockimpl.h> #include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/semaphoreimpl.h> #include <rtems/posix/semaphoreimpl.h>
#include <rtems/posix/spinlockimpl.h>
#include <rtems/posix/timerimpl.h> #include <rtems/posix/timerimpl.h>
#endif /* RTEMS_POSIX_API */ #endif /* RTEMS_POSIX_API */
#include <rtems/rtems/barrierimpl.h> #include <rtems/rtems/barrierimpl.h>
@@ -107,6 +108,8 @@ typedef enum {
POSIX_BARRIER_POST, POSIX_BARRIER_POST,
POSIX_RWLOCK_PRE, POSIX_RWLOCK_PRE,
POSIX_RWLOCK_POST, POSIX_RWLOCK_POST,
POSIX_SPINLOCK_PRE,
POSIX_SPINLOCK_POST,
POSIX_CLEANUP_PRE, POSIX_CLEANUP_PRE,
POSIX_CLEANUP_POST, POSIX_CLEANUP_POST,
#endif /* RTEMS_POSIX_API */ #endif /* RTEMS_POSIX_API */
@@ -467,6 +470,18 @@ LAST(RTEMS_SYSINIT_POSIX_RWLOCK)
next_step(POSIX_RWLOCK_POST); 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; static size_t user_extensions_pre_posix_cleanup;
FIRST(RTEMS_SYSINIT_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_SEMAPHORES 1
#define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 1
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 1 #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 #define CONFIGURE_MAXIMUM_POSIX_THREADS 1