[rtems commit] rtems: Move internal structures to semdata.h
Sebastian Huber
sebh at rtems.org
Mon Nov 12 14:39:08 UTC 2018
Module: rtems
Branch: master
Commit: 739df1f58390e4f755807df0da99c6a38a334246
Changeset: http://git.rtems.org/rtems/commit/?id=739df1f58390e4f755807df0da99c6a38a334246
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Nov 8 10:45:44 2018 +0100
rtems: Move internal structures to semdata.h
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(-)
diff --git a/cpukit/headers.am b/cpukit/headers.am
index 95bc817..02f4554 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 7b2b47a..0062d39 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 41b0061..8e83848 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" {
@@ -58,64 +38,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
*
* This routine implements the rtems_semaphore_create directive. The
diff --git a/cpukit/include/rtems/rtems/semdata.h b/cpukit/include/rtems/rtems/semdata.h
new file mode 100644
index 0000000..04db07d
--- /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 6d0f156..1028879 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>
@@ -27,6 +27,14 @@ extern "C" {
#endif
/**
+ * @defgroup ClassicSemImpl Semaphore Manager Implementation
+ *
+ * @ingroup ClassicSem
+ *
+ * @{
+ */
+
+/**
* @brief Classic semaphore variants.
*
* Must be in synchronization with Semaphore_Control::variant.
@@ -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 77ee3d3..fd266f8 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>
More information about the vc
mailing list