[rtems commit] score: Create stack implementation header

Sebastian Huber sebh at rtems.org
Tue Jul 23 15:14:21 UTC 2013


Module:    rtems
Branch:    master
Commit:    218286bc055e9d9bcbefd3dfa2b38f92a95b15a6
Changeset: http://git.rtems.org/rtems/commit/?id=218286bc055e9d9bcbefd3dfa2b38f92a95b15a6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jul 23 17:17:05 2013 +0200

score: Create stack implementation header

Move implementation specific parts of stack.h and stack.inl into new
header file stackimpl.h.  The stack.h contains now only the application
visible API.

---

 cpukit/posix/src/pthreadattrsetstack.c             |    7 ++++---
 cpukit/posix/src/pthreadattrsetstacksize.c         |    6 +++---
 cpukit/posix/src/pthreadcreate.c                   |    1 +
 cpukit/score/Makefile.am                           |    2 +-
 cpukit/score/include/rtems/score/stack.h           |   16 +++++++---------
 .../stack.inl => include/rtems/score/stackimpl.h}  |   16 ++++++++++------
 cpukit/score/preinstall.am                         |    8 ++++----
 cpukit/score/src/isr.c                             |    2 +-
 cpukit/score/src/threadcreateidle.c                |    1 +
 cpukit/score/src/threadinitialize.c                |    1 +
 cpukit/score/src/threadstackallocate.c             |    1 +
 testsuites/psxtests/psxstack01/init.c              |    3 ++-
 testsuites/psxtests/psxstack02/init.c              |    3 ++-
 13 files changed, 38 insertions(+), 29 deletions(-)

diff --git a/cpukit/posix/src/pthreadattrsetstack.c b/cpukit/posix/src/pthreadattrsetstack.c
index 7c4f14b..699d2fe 100644
--- a/cpukit/posix/src/pthreadattrsetstack.c
+++ b/cpukit/posix/src/pthreadattrsetstack.c
@@ -21,11 +21,12 @@
 #endif
 
 #if HAVE_DECL_PTHREAD_ATTR_SETSTACK
-#include <pthread.h>
-#include <errno.h>
 
-#include <rtems/system.h>
 #include <rtems/posix/pthreadimpl.h>
+#include <rtems/score/stackimpl.h>
+
+#include <pthread.h>
+#include <errno.h>
 
 int pthread_attr_setstack(
   pthread_attr_t  *attr,
diff --git a/cpukit/posix/src/pthreadattrsetstacksize.c b/cpukit/posix/src/pthreadattrsetstacksize.c
index 3fd78b3..79c683b 100644
--- a/cpukit/posix/src/pthreadattrsetstacksize.c
+++ b/cpukit/posix/src/pthreadattrsetstacksize.c
@@ -20,12 +20,12 @@
 #include "config.h"
 #endif
 
+#include <rtems/posix/pthreadimpl.h>
+#include <rtems/score/stackimpl.h>
+
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
-#include <rtems/posix/pthreadimpl.h>
-
 int pthread_attr_setstacksize(
   pthread_attr_t  *attr,
   size_t           stacksize
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index fcac8d4..4742b59 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -31,6 +31,7 @@
 #include <rtems/posix/time.h>
 #include <rtems/score/apimutex.h>
 #include <rtems/score/watchdogimpl.h>
+#include <rtems/score/stackimpl.h>
 
 static inline size_t _POSIX_Threads_Ensure_minimum_stack (
   size_t size
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 4b0e15d..82eb254 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -50,6 +50,7 @@ include_rtems_score_HEADERS += include/rtems/score/schedulersimple.h
 include_rtems_score_HEADERS += include/rtems/score/smp.h
 include_rtems_score_HEADERS += include/rtems/score/smplock.h
 include_rtems_score_HEADERS += include/rtems/score/stack.h
+include_rtems_score_HEADERS += include/rtems/score/stackimpl.h
 include_rtems_score_HEADERS += include/rtems/score/states.h
 include_rtems_score_HEADERS += include/rtems/score/sysstate.h
 include_rtems_score_HEADERS += include/rtems/score/thread.h
@@ -99,7 +100,6 @@ include_rtems_score_HEADERS += inline/rtems/score/prioritybitmap.inl
 include_rtems_score_HEADERS += inline/rtems/score/scheduler.inl
 include_rtems_score_HEADERS += inline/rtems/score/schedulerpriority.inl
 include_rtems_score_HEADERS += inline/rtems/score/schedulersimple.inl
-include_rtems_score_HEADERS += inline/rtems/score/stack.inl
 include_rtems_score_HEADERS += inline/rtems/score/states.inl
 include_rtems_score_HEADERS += inline/rtems/score/sysstate.inl
 include_rtems_score_HEADERS += inline/rtems/score/thread.inl
diff --git a/cpukit/score/include/rtems/score/stack.h b/cpukit/score/include/rtems/score/stack.h
index 9aa9042..452525e 100644
--- a/cpukit/score/include/rtems/score/stack.h
+++ b/cpukit/score/include/rtems/score/stack.h
@@ -20,6 +20,12 @@
 #ifndef _RTEMS_SCORE_STACK_H
 #define _RTEMS_SCORE_STACK_H
 
+#include <rtems/score/basedefs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  *  @defgroup ScoreStack Stack Handler
  *
@@ -30,10 +36,6 @@
  */
 /**@{*/
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
  *  The following constant defines the minimum stack size which every
  *  thread must exceed.
@@ -57,15 +59,11 @@ typedef struct {
  */
 extern uint32_t rtems_minimum_stack_size;
 
-#ifndef __RTEMS_APPLICATION__
-#include <rtems/score/stack.inl>
-#endif
+/**@}*/
 
 #ifdef __cplusplus
 }
 #endif
 
-/**@}*/
-
 #endif
 /* end of include file */
diff --git a/cpukit/score/inline/rtems/score/stack.inl b/cpukit/score/include/rtems/score/stackimpl.h
similarity index 88%
rename from cpukit/score/inline/rtems/score/stack.inl
rename to cpukit/score/include/rtems/score/stackimpl.h
index 7cb73ee..8762901 100644
--- a/cpukit/score/inline/rtems/score/stack.inl
+++ b/cpukit/score/include/rtems/score/stackimpl.h
@@ -16,14 +16,14 @@
  *  http://www.rtems.com/license/LICENSE.
  */
 
-#ifndef _RTEMS_SCORE_STACK_H
-# error "Never use <rtems/score/stack.inl> directly; include <rtems/score/stack.h> instead."
-#endif
+#ifndef _RTEMS_SCORE_STACKIMPL_H
+#define _RTEMS_SCORE_STACKIMPL_H
 
-#ifndef _RTEMS_SCORE_STACK_INL
-#define _RTEMS_SCORE_STACK_INL
+#include <rtems/score/stack.h>
 
-#include <rtems/score/basedefs.h> /* RTEMS_INLINE_ROUTINE */
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @addtogroup ScoreStack
@@ -91,5 +91,9 @@ RTEMS_INLINE_ROUTINE size_t _Stack_Ensure_minimum (
 
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 /* end of include file */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index fe19329..6df393d 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -183,6 +183,10 @@ $(PROJECT_INCLUDE)/rtems/score/stack.h: include/rtems/score/stack.h $(PROJECT_IN
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.h
 
+$(PROJECT_INCLUDE)/rtems/score/stackimpl.h: include/rtems/score/stackimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stackimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stackimpl.h
+
 $(PROJECT_INCLUDE)/rtems/score/states.h: include/rtems/score/states.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/states.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/states.h
@@ -327,10 +331,6 @@ $(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl: inline/rtems/score/scheduler
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl
 
-$(PROJECT_INCLUDE)/rtems/score/stack.inl: inline/rtems/score/stack.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.inl
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.inl
-
 $(PROJECT_INCLUDE)/rtems/score/states.inl: inline/rtems/score/states.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/states.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/states.inl
diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c
index e7ad33b..eaf6ba6 100644
--- a/cpukit/score/src/isr.c
+++ b/cpukit/score/src/isr.c
@@ -21,7 +21,7 @@
 #include <rtems/system.h>
 #include <rtems/score/address.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/stack.h>
+#include <rtems/score/stackimpl.h>
 #include <rtems/score/interr.h>
 #include <rtems/score/wkspace.h>
 #include <rtems/config.h>
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index d075510..d11b296 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -26,6 +26,7 @@
 #include <rtems/score/object.h>
 #include <rtems/score/priority.h>
 #include <rtems/score/smp.h>
+#include <rtems/score/stackimpl.h>
 #include <rtems/score/states.h>
 #include <rtems/score/sysstate.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 64071e1..f3b25e9 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -26,6 +26,7 @@
 #include <rtems/score/object.h>
 #include <rtems/score/priority.h>
 #include <rtems/score/scheduler.h>
+#include <rtems/score/stackimpl.h>
 #include <rtems/score/states.h>
 #include <rtems/score/sysstate.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/score/src/threadstackallocate.c b/cpukit/score/src/threadstackallocate.c
index dd2049b..0f64f59 100644
--- a/cpukit/score/src/threadstackallocate.c
+++ b/cpukit/score/src/threadstackallocate.c
@@ -26,6 +26,7 @@
 #include <rtems/score/isr.h>
 #include <rtems/score/object.h>
 #include <rtems/score/priority.h>
+#include <rtems/score/stackimpl.h>
 #include <rtems/score/states.h>
 #include <rtems/score/sysstate.h>
 #include <rtems/score/thread.h>
diff --git a/testsuites/psxtests/psxstack01/init.c b/testsuites/psxtests/psxstack01/init.c
index ce413e7..71590cf 100644
--- a/testsuites/psxtests/psxstack01/init.c
+++ b/testsuites/psxtests/psxstack01/init.c
@@ -17,7 +17,8 @@
 #include <pthread.h>
 #include <sched.h>
 
-#include <rtems/posix/pthreadimpl.h> /* for PTHREAD_MINIMUM_STACK_SIZE */
+#include <rtems/posix/pthreadimpl.h>
+#include <rtems/score/stackimpl.h>
 
 /* forward declarations to avoid warnings */
 void *POSIX_Init(void *argument);
diff --git a/testsuites/psxtests/psxstack02/init.c b/testsuites/psxtests/psxstack02/init.c
index b58d257..52cbc6a 100644
--- a/testsuites/psxtests/psxstack02/init.c
+++ b/testsuites/psxtests/psxstack02/init.c
@@ -19,7 +19,8 @@
 #include <pthread.h>
 #include <sched.h>
 
-#include <rtems/posix/pthreadimpl.h> /* for PTHREAD_MINIMUM_STACK_SIZE */
+#include <rtems/posix/pthreadimpl.h>
+#include <rtems/score/stackimpl.h>
 
 /* forward declarations to avoid warnings */
 void *POSIX_Init(void *argument);




More information about the vc mailing list