[PATCH 10/21] rtems: Move internal structures to semdata.h
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Nov 8 12:52:03 UTC 2018
Update #3598.
---
cpukit/headers.am | 1 +
cpukit/include/rtems/confdefs.h | 1 +
cpukit/include/rtems/rtems/sem.h | 84 ++---------------------------
cpukit/include/rtems/rtems/semdata.h | 102 +++++++++++++++++++++++++++++++++++
cpukit/include/rtems/rtems/semimpl.h | 16 ++++--
cpukit/rtems/src/semcreate.c | 1 +
6 files changed, 121 insertions(+), 84 deletions(-)
create mode 100644 cpukit/include/rtems/rtems/semdata.h
diff --git a/cpukit/headers.am b/cpukit/headers.am
index 95bc817773..02f45542d7 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -263,6 +263,7 @@ include_rtems_rtems_HEADERS += include/rtems/rtems/region.h
include_rtems_rtems_HEADERS += include/rtems/rtems/regiondata.h
include_rtems_rtems_HEADERS += include/rtems/rtems/regionimpl.h
include_rtems_rtems_HEADERS += include/rtems/rtems/sem.h
+include_rtems_rtems_HEADERS += include/rtems/rtems/semdata.h
include_rtems_rtems_HEADERS += include/rtems/rtems/semimpl.h
include_rtems_rtems_HEADERS += include/rtems/rtems/semmp.h
include_rtems_rtems_HEADERS += include/rtems/rtems/signal.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 7b2b47ae00..0062d3934f 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -38,6 +38,7 @@
#include <rtems/rtems/partdata.h>
#include <rtems/rtems/ratemondata.h>
#include <rtems/rtems/regiondata.h>
+#include <rtems/rtems/semdata.h>
#include <rtems/posix/key.h>
#include <rtems/posix/mqueue.h>
#include <rtems/posix/pthread.h>
diff --git a/cpukit/include/rtems/rtems/sem.h b/cpukit/include/rtems/rtems/sem.h
index 41b0061979..8e83848465 100644
--- a/cpukit/include/rtems/rtems/sem.h
+++ b/cpukit/include/rtems/rtems/sem.h
@@ -3,22 +3,7 @@
*
* @ingroup ClassicSem
*
- * @brief Classic Semaphores API
- *
- * This include file contains all the constants and structures associated
- * with the Semaphore Manager. This manager utilizes standard Dijkstra
- * counting semaphores to provide synchronization and mutual exclusion
- * capabilities.
- *
- * Directives provided are:
- *
- * - create a semaphore
- * - get an ID of a semaphore
- * - delete a semaphore
- * - acquire a semaphore
- * - release a semaphore
- * - flush a semaphore
- * - set ceiling priority for a semaphore
+ * @brief Classic Semaphores Manager API
*/
/*
@@ -33,15 +18,10 @@
#ifndef _RTEMS_RTEMS_SEM_H
#define _RTEMS_RTEMS_SEM_H
-#include <rtems/rtems/types.h>
+#include <rtems/rtems/attr.h>
#include <rtems/rtems/options.h>
-#include <rtems/rtems/support.h>
#include <rtems/rtems/tasks.h>
-#include <rtems/rtems/attr.h>
-#include <rtems/score/coremutex.h>
-#include <rtems/score/object.h>
-#include <rtems/score/coresem.h>
-#include <rtems/score/mrsp.h>
+#include <rtems/rtems/types.h>
#ifdef __cplusplus
extern "C" {
@@ -57,64 +37,6 @@ extern "C" {
*/
/**@{*/
-/**
- * The following defines the control block used to manage each semaphore.
- */
-typedef struct {
- /** This field is the object management portion of a Semaphore instance. */
- Objects_Control Object;
-
- /**
- * This contains the memory associated with the SuperCore Semaphore or
- * Mutex instance that provides the primary functionality of each
- * Classic API Semaphore instance. The structure used is dependent
- * on the attributes specified by the user on the create directive.
- *
- * @note Only one of these has meaning in a particular Classic API
- * Semaphore instance.
- */
- union {
- /**
- * @brief The thread queue present in all other variants.
- */
- Thread_queue_Control Wait_queue;
-
- /**
- * This is the SuperCore Mutex instance associated with this Classic
- * API Semaphore instance.
- */
- CORE_ceiling_mutex_Control Mutex;
-
- /**
- * This is the SuperCore Semaphore instance associated with this Classic
- * API Semaphore instance.
- */
- CORE_semaphore_Control Semaphore;
-
-#if defined(RTEMS_SMP)
- MRSP_Control MRSP;
-#endif
- } Core_control;
-
- /**
- * @brief The semaphore variant.
- *
- * @see Semaphore_Variant.
- */
- unsigned int variant : 3;
-
- /**
- * @brief The semaphore thread queue discipline.
- *
- * @see Semaphore_Discipline.
- */
- unsigned int discipline : 1;
-
-#if defined(RTEMS_MULTIPROCESSING)
- unsigned int is_global : 1;
-#endif
-} Semaphore_Control;
-
/**
* @brief rtems_semaphore_create
*
diff --git a/cpukit/include/rtems/rtems/semdata.h b/cpukit/include/rtems/rtems/semdata.h
new file mode 100644
index 0000000000..04db07d6a0
--- /dev/null
+++ b/cpukit/include/rtems/rtems/semdata.h
@@ -0,0 +1,102 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicSemImpl
+ *
+ * @brief Classic Semaphore Manager Data Structures
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2008, 2016.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_RTEMS_SEMDATA_H
+#define _RTEMS_RTEMS_SEMDATA_H
+
+#include <rtems/rtems/sem.h>
+#include <rtems/score/coremutex.h>
+#include <rtems/score/coresem.h>
+#include <rtems/score/mrsp.h>
+#include <rtems/score/object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ClassicSemImpl
+ *
+ * @{
+ */
+
+/**
+ * The following defines the control block used to manage each semaphore.
+ */
+typedef struct {
+ /** This field is the object management portion of a Semaphore instance. */
+ Objects_Control Object;
+
+ /**
+ * This contains the memory associated with the SuperCore Semaphore or
+ * Mutex instance that provides the primary functionality of each
+ * Classic API Semaphore instance. The structure used is dependent
+ * on the attributes specified by the user on the create directive.
+ *
+ * @note Only one of these has meaning in a particular Classic API
+ * Semaphore instance.
+ */
+ union {
+ /**
+ * @brief The thread queue present in all other variants.
+ */
+ Thread_queue_Control Wait_queue;
+
+ /**
+ * This is the SuperCore Mutex instance associated with this Classic
+ * API Semaphore instance.
+ */
+ CORE_ceiling_mutex_Control Mutex;
+
+ /**
+ * This is the SuperCore Semaphore instance associated with this Classic
+ * API Semaphore instance.
+ */
+ CORE_semaphore_Control Semaphore;
+
+#if defined(RTEMS_SMP)
+ MRSP_Control MRSP;
+#endif
+ } Core_control;
+
+ /**
+ * @brief The semaphore variant.
+ *
+ * @see Semaphore_Variant.
+ */
+ unsigned int variant : 3;
+
+ /**
+ * @brief The semaphore thread queue discipline.
+ *
+ * @see Semaphore_Discipline.
+ */
+ unsigned int discipline : 1;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ unsigned int is_global : 1;
+#endif
+} Semaphore_Control;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/include/rtems/rtems/semimpl.h b/cpukit/include/rtems/rtems/semimpl.h
index 6d0f156e5c..1028879f39 100644
--- a/cpukit/include/rtems/rtems/semimpl.h
+++ b/cpukit/include/rtems/rtems/semimpl.h
@@ -1,9 +1,9 @@
/**
* @file
*
- * @ingroup ClassicSem
+ * @ingroup ClassicSemImpl
*
- * @brief Classic Semaphores Implementation
+ * @brief Classic Semaphore Manager Implementation
*/
/* COPYRIGHT (c) 1989-2008.
@@ -17,7 +17,7 @@
#ifndef _RTEMS_RTEMS_SEMIMPL_H
#define _RTEMS_RTEMS_SEMIMPL_H
-#include <rtems/rtems/sem.h>
+#include <rtems/rtems/semdata.h>
#include <rtems/score/coremuteximpl.h>
#include <rtems/score/coresemimpl.h>
#include <rtems/score/mrspimpl.h>
@@ -26,6 +26,14 @@
extern "C" {
#endif
+/**
+ * @defgroup ClassicSemImpl Semaphore Manager Implementation
+ *
+ * @ingroup ClassicSem
+ *
+ * @{
+ */
+
/**
* @brief Classic semaphore variants.
*
@@ -108,6 +116,8 @@ RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get(
);
}
+/** @} */
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index 77ee3d366d..fd266f8cd5 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -21,6 +21,7 @@
#include <rtems/rtems/semimpl.h>
#include <rtems/rtems/attrimpl.h>
#include <rtems/rtems/statusimpl.h>
+#include <rtems/rtems/support.h>
#include <rtems/rtems/tasksimpl.h>
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/sysstate.h>
--
2.16.4
More information about the devel
mailing list