summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-12-14 16:36:21 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-02-03 10:00:55 +0100
commit6c678557906cbbe73af1691e90e52911b2d00223 (patch)
treee4b824e5e9b5f6494df6001ba0d585818f60fcc5
parentOptional POSIX Semaphore initialization (diff)
downloadrtems-6c678557906cbbe73af1691e90e52911b2d00223.tar.bz2
Optional POSIX Timer initialization
Update #2408.
-rw-r--r--cpukit/posix/include/rtems/posix/ptimer.h7
-rw-r--r--cpukit/posix/include/rtems/posix/timerimpl.h9
-rw-r--r--cpukit/posix/src/ptimer.c11
-rw-r--r--cpukit/sapi/src/posixapi.c2
-rw-r--r--cpukit/score/include/rtems/sysinit.h1
-rw-r--r--testsuites/sptests/spsysinit01/init.c17
6 files changed, 29 insertions, 18 deletions
diff --git a/cpukit/posix/include/rtems/posix/ptimer.h b/cpukit/posix/include/rtems/posix/ptimer.h
index 16ac2b8373..f6de4ccb57 100644
--- a/cpukit/posix/include/rtems/posix/ptimer.h
+++ b/cpukit/posix/include/rtems/posix/ptimer.h
@@ -36,13 +36,6 @@ extern "C" {
#include <rtems/posix/config.h>
/**
- * @brief POSIX Timer Manager Initialization
- *
- * This routine performs the initialization necessary for this manager.
- */
-void _POSIX_Timer_Manager_initialization(void);
-
-/**
* @brief Create a Per-Process Timer
*/
int timer_create(
diff --git a/cpukit/posix/include/rtems/posix/timerimpl.h b/cpukit/posix/include/rtems/posix/timerimpl.h
index b297d3205a..8b5b42e98a 100644
--- a/cpukit/posix/include/rtems/posix/timerimpl.h
+++ b/cpukit/posix/include/rtems/posix/timerimpl.h
@@ -51,13 +51,6 @@ extern "C" {
#endif
/**
- * @brief POSIX Timer Manager Initialization
- *
- * This routine performs the initialization necessary for this manager.
- */
-void _POSIX_Timer_Manager_initialization(void);
-
-/**
* @brief POSIX Timer Manager Timer Service Routine Helper
*
* This is the operation that is run when a timer expires.
@@ -79,7 +72,7 @@ bool _POSIX_Timer_Insert_helper(
* The following defines the information control block used to manage
* this class of objects.
*/
-POSIX_EXTERN Objects_Information _POSIX_Timer_Information;
+extern Objects_Information _POSIX_Timer_Information;
/**
* @brief POSIX Timer Allocate
diff --git a/cpukit/posix/src/ptimer.c b/cpukit/posix/src/ptimer.c
index a1e06373b8..810112ac95 100644
--- a/cpukit/posix/src/ptimer.c
+++ b/cpukit/posix/src/ptimer.c
@@ -33,6 +33,7 @@
/************************************/
#include <unistd.h>
+#include <rtems/sysinit.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/types.h>
#include <rtems/rtems/timer.h>
@@ -44,6 +45,8 @@
#include <rtems/posix/timerimpl.h>
+Objects_Information _POSIX_Timer_Information;
+
/*
* _POSIX_Timer_Manager_initialization
*
@@ -53,7 +56,7 @@
* the timers are stored
*/
-void _POSIX_Timer_Manager_initialization(void)
+static void _POSIX_Timer_Manager_initialization(void)
{
_Objects_Initialize_information(
&_POSIX_Timer_Information, /* object information table */
@@ -72,3 +75,9 @@ void _POSIX_Timer_Manager_initialization(void)
#endif
);
}
+
+RTEMS_SYSINIT_ITEM(
+ _POSIX_Timer_Manager_initialization,
+ RTEMS_SYSINIT_POSIX_TIMER,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index f1997bfd08..f6459461b7 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -36,7 +36,6 @@
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/rwlockimpl.h>
-#include <rtems/posix/timerimpl.h>
#include <rtems/posix/spinlockimpl.h>
#endif
@@ -59,7 +58,6 @@ void _POSIX_API_Initialize(void)
_POSIX_Key_Manager_initialization();
#ifdef RTEMS_POSIX_API
- _POSIX_Timer_Manager_initialization();
_POSIX_Barrier_Manager_initialization();
_POSIX_RWLock_Manager_initialization();
_POSIX_Spinlock_Manager_initialization();
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index b32723c81a..95865c460f 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -48,6 +48,7 @@ extern "C" {
#define RTEMS_SYSINIT_POSIX_MUTEX 000363
#define RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE 000364
#define RTEMS_SYSINIT_POSIX_SEMAPHORE 000365
+#define RTEMS_SYSINIT_POSIX_TIMER 000366
#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 6854d7025a..1679cb6ec5 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -34,6 +34,7 @@
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthreadimpl.h>
#include <rtems/posix/semaphoreimpl.h>
+#include <rtems/posix/timerimpl.h>
#endif /* RTEMS_POSIX_API */
#include <rtems/rtems/barrierimpl.h>
#include <rtems/rtems/dpmemimpl.h>
@@ -98,6 +99,8 @@ typedef enum {
POSIX_MESSAGE_QUEUE_POST,
POSIX_SEMAPHORE_PRE,
POSIX_SEMAPHORE_POST,
+ POSIX_TIMER_PRE,
+ POSIX_TIMER_POST,
POSIX_CLEANUP_PRE,
POSIX_CLEANUP_POST,
#endif /* RTEMS_POSIX_API */
@@ -422,6 +425,18 @@ LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE)
next_step(POSIX_SEMAPHORE_POST);
}
+FIRST(RTEMS_SYSINIT_POSIX_TIMER)
+{
+ assert(_POSIX_Timer_Information.maximum == 0);
+ next_step(POSIX_TIMER_PRE);
+}
+
+LAST(RTEMS_SYSINIT_POSIX_TIMER)
+{
+ assert(_POSIX_Timer_Information.maximum != 0);
+ next_step(POSIX_TIMER_POST);
+}
+
static size_t user_extensions_pre_posix_cleanup;
FIRST(RTEMS_SYSINIT_POSIX_CLEANUP)
@@ -559,6 +574,8 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_POSIX_TIMERS 1
+
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
#endif /* RTEMS_POSIX_API */