summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-22 19:14:51 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-14 07:03:29 +0100
commit21275b58a5a69c3c838082ffc8a7a3641f32ea9a (patch)
treed331e17c15d71f107d0f14581a93ddf768b05813 /cpukit/include/rtems/score
parentrtems: Use object information to get config max (diff)
downloadrtems-21275b58a5a69c3c838082ffc8a7a3641f32ea9a.tar.bz2
score: Static Objects_Information initialization
Statically allocate the objects information together with the initial set of objects either via <rtems/confdefs.h>. Provide default object informations with zero objects via librtemscpu.a. This greatly simplifies the workspace size estimate. RTEMS applications which do not use the unlimited objects option are easier to debug since all objects reside now in statically allocated objects of the right types. Close #3621.
Diffstat (limited to 'cpukit/include/rtems/score')
-rw-r--r--cpukit/include/rtems/score/freechain.h18
-rw-r--r--cpukit/include/rtems/score/interr.h2
-rw-r--r--cpukit/include/rtems/score/object.h23
-rw-r--r--cpukit/include/rtems/score/objectdata.h183
-rw-r--r--cpukit/include/rtems/score/objectimpl.h186
-rw-r--r--cpukit/include/rtems/score/thread.h118
-rw-r--r--cpukit/include/rtems/score/threadimpl.h22
-rw-r--r--cpukit/include/rtems/score/threadq.h9
8 files changed, 322 insertions, 239 deletions
diff --git a/cpukit/include/rtems/score/freechain.h b/cpukit/include/rtems/score/freechain.h
index 1540c0e2a1..6282178347 100644
--- a/cpukit/include/rtems/score/freechain.h
+++ b/cpukit/include/rtems/score/freechain.h
@@ -17,7 +17,7 @@
#define _RTEMS_SCORE_FREECHAIN_H
#include <rtems/score/basedefs.h>
-#include <rtems/score/chain.h>
+#include <rtems/score/chainimpl.h>
#ifdef __cplusplus
extern "C" {
@@ -58,16 +58,24 @@ typedef struct {
* get more nodes.
*
* @param[in] freechain The freechain control to initialize.
- * @param[in] allocator The allocator function.
+ * @param[in] initial_nodes Array with the initial nodes.
* @param[in] number_nodes The initial number of nodes.
* @param[in] node_size The node size.
*/
-void _Freechain_Initialize(
+RTEMS_INLINE_ROUTINE void _Freechain_Initialize(
Freechain_Control *freechain,
- Freechain_Allocator allocator,
+ void *initial_nodes,
size_t number_nodes,
size_t node_size
-);
+)
+{
+ _Chain_Initialize(
+ &freechain->Free,
+ initial_nodes,
+ number_nodes,
+ node_size
+ );
+}
/**
* @brief Gets a node from the freechain.
diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h
index 0c734e855f..df1a1298d9 100644
--- a/cpukit/include/rtems/score/interr.h
+++ b/cpukit/include/rtems/score/interr.h
@@ -173,7 +173,7 @@ typedef enum {
/* INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = 16, */
/* INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = 17, */
/* INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_FROM_BAD_STATE = 18, */
- INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 = 19,
+ /* INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 = 19, */
/* INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP = 20, */
INTERNAL_ERROR_GXX_KEY_ADD_FAILED = 21,
INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED = 22,
diff --git a/cpukit/include/rtems/score/object.h b/cpukit/include/rtems/score/object.h
index e7861ecab1..f75d1de2ab 100644
--- a/cpukit/include/rtems/score/object.h
+++ b/cpukit/include/rtems/score/object.h
@@ -307,18 +307,11 @@ RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_index(
*
* @return This method returns an object Id constructed from the arguments.
*/
-RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id(
- Objects_APIs the_api,
- uint16_t the_class,
- uint8_t node,
- uint16_t index
-)
-{
- return (( (Objects_Id) the_api ) << OBJECTS_API_START_BIT) |
- (( (Objects_Id) the_class ) << OBJECTS_CLASS_START_BIT) |
- (( (Objects_Id) node ) << OBJECTS_NODE_START_BIT) |
- (( (Objects_Id) index ) << OBJECTS_INDEX_START_BIT);
-}
+#define _Objects_Build_id( the_api, the_class, node, index ) \
+ ( (Objects_Id) ( (Objects_Id) the_api << OBJECTS_API_START_BIT ) | \
+ ( (Objects_Id) the_class << OBJECTS_CLASS_START_BIT ) | \
+ ( (Objects_Id) node << OBJECTS_NODE_START_BIT ) | \
+ ( (Objects_Id) index << OBJECTS_INDEX_START_BIT ) )
/**
* Returns if the object maximum specifies unlimited objects.
@@ -328,10 +321,8 @@ RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id(
* @retval true Unlimited objects are available.
* @retval false The object count is fixed.
*/
-RTEMS_INLINE_ROUTINE bool _Objects_Is_unlimited( uint32_t maximum )
-{
- return (maximum & OBJECTS_UNLIMITED_OBJECTS) != 0;
-}
+#define _Objects_Is_unlimited( maximum ) \
+ ( ( ( maximum ) & OBJECTS_UNLIMITED_OBJECTS ) != 0 )
/*
* We cannot use an inline function for this since it may be evaluated at
diff --git a/cpukit/include/rtems/score/objectdata.h b/cpukit/include/rtems/score/objectdata.h
index 51258fa4a4..6139bfc1ec 100644
--- a/cpukit/include/rtems/score/objectdata.h
+++ b/cpukit/include/rtems/score/objectdata.h
@@ -19,7 +19,7 @@
#define _RTEMS_SCORE_OBJECTDATA_H
#include <rtems/score/object.h>
-#include <rtems/score/chain.h>
+#include <rtems/score/chainimpl.h>
#include <rtems/score/rbtree.h>
#ifdef __cplusplus
@@ -45,7 +45,57 @@ typedef struct {
Objects_Name name;
} Objects_Control;
+/**
+ * This enumerated type is used in the class field of the object ID
+ * for RTEMS internal object classes.
+ */
+typedef enum {
+ OBJECTS_INTERNAL_NO_CLASS = 0,
+ OBJECTS_INTERNAL_THREADS = 1
+} Objects_Internal_API;
+
+/**
+ * This enumerated type is used in the class field of the object ID
+ * for the RTEMS Classic API.
+ */
+typedef enum {
+ OBJECTS_CLASSIC_NO_CLASS = 0,
+ OBJECTS_RTEMS_TASKS = 1,
+ OBJECTS_RTEMS_TIMERS = 2,
+ OBJECTS_RTEMS_SEMAPHORES = 3,
+ OBJECTS_RTEMS_MESSAGE_QUEUES = 4,
+ OBJECTS_RTEMS_PARTITIONS = 5,
+ OBJECTS_RTEMS_REGIONS = 6,
+ OBJECTS_RTEMS_PORTS = 7,
+ OBJECTS_RTEMS_PERIODS = 8,
+ OBJECTS_RTEMS_EXTENSIONS = 9,
+ OBJECTS_RTEMS_BARRIERS = 10
+} Objects_Classic_API;
+
+/**
+ * This enumerated type is used in the class field of the object ID
+ * for the POSIX API.
+ */
+typedef enum {
+ OBJECTS_POSIX_NO_CLASS = 0,
+ OBJECTS_POSIX_THREADS = 1,
+ OBJECTS_POSIX_KEYS = 2,
+ OBJECTS_POSIX_INTERRUPTS = 3,
+ OBJECTS_POSIX_MESSAGE_QUEUES = 5,
+ OBJECTS_POSIX_SEMAPHORES = 7,
+ OBJECTS_POSIX_TIMERS = 9,
+ OBJECTS_POSIX_SHMS = 12
+} Objects_POSIX_API;
+
+/**
+ * @brief Constant for the object information string name length to indicate
+ * that this object class has no string names.
+ */
+#define OBJECTS_NO_STRING_NAME 0
+
#if defined( RTEMS_MULTIPROCESSING )
+struct _Thread_Control;
+
/**
* @brief This defines the Global Object Control Block used to manage objects
* resident on other nodes.
@@ -86,8 +136,139 @@ typedef struct {
*/
uint32_t name;
} Objects_MP_Control;
+
+/**
+ * The following type defines the callout used when a local task
+ * is extracted from a remote thread queue (i.e. it's proxy must
+ * extracted from the remote queue).
+ */
+typedef void ( *Objects_Thread_queue_Extract_callout )(
+ struct _Thread_Control *,
+ Objects_Id
+);
#endif
+/**
+ * The following defines the structure for the information used to
+ * manage each class of objects.
+ */
+typedef struct {
+ /** This is the maximum valid id of this object class. */
+ Objects_Id maximum_id;
+ /** This points to the table of local objects. */
+ Objects_Control **local_table;
+ /** This is the number of objects on the Inactive list. */
+ Objects_Maximum inactive;
+ /** This is the number of objects in a block. */
+ Objects_Maximum objects_per_block;
+ /** This is the size in bytes of each object instance. */
+ uint16_t object_size;
+ /**
+ * @brief This is the maximum length of names.
+ *
+ * A length of zero indicates that this object has a no string name
+ * (OBJECTS_NO_STRING_NAME).
+ */
+ uint16_t name_length;
+ /** This is the chain of inactive control blocks. */
+ Chain_Control Inactive;
+ /** This is the number of inactive objects per block. */
+ Objects_Maximum *inactive_per_block;
+ /** This is a table to the chain of inactive object memory blocks. */
+ Objects_Control **object_blocks;
+ Objects_Control *initial_objects;
+ #if defined(RTEMS_MULTIPROCESSING)
+ /** This is this object class' method called when extracting a thread. */
+ Objects_Thread_queue_Extract_callout extract;
+
+ /**
+ * @brief The global objects of this object information sorted by object
+ * identifier.
+ */
+ RBTree_Control Global_by_id;
+
+ /**
+ * @brief The global objects of this object information sorted by object
+ * name.
+ *
+ * Objects with the same name are sorted according to their identifier.
+ */
+ RBTree_Control Global_by_name;
+ #endif
+} Objects_Information;
+
+#if defined(RTEMS_MULTIPROCESSING)
+#define OBJECTS_INFORMATION_MP( name, extract ) \
+ , \
+ extract, \
+ RBTREE_INITIALIZER_EMPTY( name.Global_by_id ), \
+ RBTREE_INITIALIZER_EMPTY( name.Global_by_name )
+#else
+#define OBJECTS_INFORMATION_MP( name, extract )
+#endif
+
+/**
+ * @brief Statically initializes an objects information.
+ *
+ * The initialized objects information contains no objects.
+ *
+ * @param name The object class C designator namespace prefix, e.g. _Semaphore.
+ * @param api The object API number, e.g. OBJECTS_CLASSIC_API.
+ * @param cls The object class number, e.g. OBJECTS_RTEMS_SEMAPHORES.
+ * @param nl The object name string length, use OBJECTS_NO_STRING_NAME for
+ * objects without a string name.
+ */
+#define OBJECTS_INFORMATION_DEFINE_ZERO( name, api, cls, nl ) \
+Objects_Information name##_Information = { \
+ _Objects_Build_id( api, cls, 1, 0 ), \
+ NULL, \
+ 0, \
+ 0, \
+ 0, \
+ nl, \
+ CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \
+ NULL, \
+ NULL, \
+ NULL \
+ OBJECTS_INFORMATION_MP( name##_Information, NULL ) \
+}
+
+/**
+ * @brief Statically initializes an objects information.
+ *
+ * The initialized objects information references a table with statically
+ * allocated objects as specified by the object maximum parameter. These
+ * objects must be registered via a call to _Objects_Information().
+ *
+ * @param name The object class C designator namespace prefix, e.g. _Semaphore.
+ * @param api The object API number, e.g. OBJECTS_CLASSIC_API.
+ * @param cls The object class number, e.g. OBJECTS_RTEMS_SEMAPHORES.
+ * @param type The object class type.
+ * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
+ * may be set).
+ * @param nl The object name string length, use OBJECTS_NO_STRING_NAME for
+ * objects without a string name.
+ * @param ex The optional object extraction method. Used only if
+ * multiprocessing (RTEMS_MULTIPROCESSING) is enabled.
+ */
+#define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \
+static Objects_Control * \
+name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
+static type name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
+Objects_Information name##_Information = { \
+ _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
+ name##_Local_table, \
+ 0, \
+ _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \
+ sizeof( type ), \
+ nl, \
+ CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \
+ NULL, \
+ NULL, \
+ &name##_Objects[ 0 ].Object \
+ OBJECTS_INFORMATION_MP( name##_Information, ex ) \
+}
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h
index bbf32fcd80..c5a315e57f 100644
--- a/cpukit/include/rtems/score/objectimpl.h
+++ b/cpukit/include/rtems/score/objectimpl.h
@@ -43,54 +43,12 @@ typedef bool (*Objects_Name_comparators)(
uint16_t /* length */
);
-/**
- * This enumerated type is used in the class field of the object ID
- * for RTEMS internal object classes.
- */
-typedef enum {
- OBJECTS_INTERNAL_NO_CLASS = 0,
- OBJECTS_INTERNAL_THREADS = 1
-} Objects_Internal_API;
-
/** This macro is used to generically specify the last API index. */
#define OBJECTS_INTERNAL_CLASSES_LAST OBJECTS_INTERNAL_THREADS
-/**
- * This enumerated type is used in the class field of the object ID
- * for the RTEMS Classic API.
- */
-typedef enum {
- OBJECTS_CLASSIC_NO_CLASS = 0,
- OBJECTS_RTEMS_TASKS = 1,
- OBJECTS_RTEMS_TIMERS = 2,
- OBJECTS_RTEMS_SEMAPHORES = 3,
- OBJECTS_RTEMS_MESSAGE_QUEUES = 4,
- OBJECTS_RTEMS_PARTITIONS = 5,
- OBJECTS_RTEMS_REGIONS = 6,
- OBJECTS_RTEMS_PORTS = 7,
- OBJECTS_RTEMS_PERIODS = 8,
- OBJECTS_RTEMS_EXTENSIONS = 9,
- OBJECTS_RTEMS_BARRIERS = 10
-} Objects_Classic_API;
-
/** This macro is used to generically specify the last API index. */
#define OBJECTS_RTEMS_CLASSES_LAST OBJECTS_RTEMS_BARRIERS
-/**
- * This enumerated type is used in the class field of the object ID
- * for the POSIX API.
- */
-typedef enum {
- OBJECTS_POSIX_NO_CLASS = 0,
- OBJECTS_POSIX_THREADS = 1,
- OBJECTS_POSIX_KEYS = 2,
- OBJECTS_POSIX_INTERRUPTS = 3,
- OBJECTS_POSIX_MESSAGE_QUEUES = 5,
- OBJECTS_POSIX_SEMAPHORES = 7,
- OBJECTS_POSIX_TIMERS = 9,
- OBJECTS_POSIX_SHMS = 12
-} Objects_POSIX_API;
-
/** This macro is used to generically specify the last API index. */
#define OBJECTS_POSIX_CLASSES_LAST OBJECTS_POSIX_SHMS
@@ -103,71 +61,6 @@ typedef enum {
OBJECTS_FAKE_OBJECTS_SCHEDULERS = 1
} Objects_Fake_objects_API;
-#if defined(RTEMS_MULTIPROCESSING)
-/**
- * The following type defines the callout used when a local task
- * is extracted from a remote thread queue (i.e. it's proxy must
- * extracted from the remote queue).
- */
-typedef void ( *Objects_Thread_queue_Extract_callout )(
- Thread_Control *,
- Objects_Id
-);
-#endif
-
-/**
- * The following defines the structure for the information used to
- * manage each class of objects.
- */
-typedef struct {
- /** This is the maximum valid id of this object class. */
- Objects_Id maximum_id;
- /** This points to the table of local objects. */
- Objects_Control **local_table;
- /** This is the number of objects on the Inactive list. */
- Objects_Maximum inactive;
- /**
- * @brief This is the number of objects in a block if the automatic extension
- * is enabled.
- *
- * This member is zero if the automatic extension is disabled.
- */
- Objects_Maximum objects_per_block;
- /** This is the size in bytes of each object instance. */
- uint16_t object_size;
- /**
- * @brief This is the maximum length of names.
- *
- * A length of zero indicates that this object has a no string name
- * (OBJECTS_NO_STRING_NAME).
- */
- uint16_t name_length;
- /** This is the chain of inactive control blocks. */
- Chain_Control Inactive;
- /** This is the number of inactive objects per block. */
- Objects_Maximum *inactive_per_block;
- /** This is a table to the chain of inactive object memory blocks. */
- Objects_Control **object_blocks;
- #if defined(RTEMS_MULTIPROCESSING)
- /** This is this object class' method called when extracting a thread. */
- Objects_Thread_queue_Extract_callout extract;
-
- /**
- * @brief The global objects of this object information sorted by object
- * identifier.
- */
- RBTree_Control Global_by_id;
-
- /**
- * @brief The global objects of this object information sorted by object
- * name.
- *
- * Objects with the same name are sorted according to their identifier.
- */
- RBTree_Control Global_by_name;
- #endif
-} Objects_Information;
-
/**
* The following is referenced to the node number of the local node.
*/
@@ -222,84 +115,13 @@ void _Objects_Shrink_information(
Objects_Information *information
);
-void _Objects_Do_initialize_information(
- Objects_Information *information,
- Objects_APIs the_api,
- uint16_t the_class,
- uint32_t maximum,
- uint16_t object_size,
- uint16_t maximum_name_length
-#if defined(RTEMS_MULTIPROCESSING)
- ,
- Objects_Thread_queue_Extract_callout extract
-#endif
-);
-
/**
- * @brief Constant for the object information string name length to indicate
- * that this object class has no string names.
- */
-#define OBJECTS_NO_STRING_NAME 0
-
-/**
- * @brief Initialize object Information
- *
- * This function initializes an object class information record.
- * SUPPORTS_GLOBAL is true if the object class supports global
- * objects, and false otherwise. Maximum indicates the number
- * of objects required in this class and size indicates the size
- * in bytes of each control block for this object class. The
- * name length and string designator are also set. In addition,
- * the class may be a task, therefore this information is also included.
+ * @brief Initializes the specified objects information.
*
- * @param[in] information points to an object class information block.
- * @param[in] the_api indicates the API associated with this information block.
- * @param[in] the_class indicates the class of object being managed
- * by this information block. It is specific to @a the_api.
- * @param[in] maximum is the maximum number of instances of this object
- * class which may be concurrently active.
- * @param[in] object_size is the size of the data structure for this class.
- * @param[in] is_string is true if this object uses string style names.
- * @param[in] maximum_name_length is the maximum length of object names.
+ * The objects information must be statically pre-initialized with the
+ * OBJECTS_INFORMATION_DEFINE() macro before this function is called.
*/
-#if defined(RTEMS_MULTIPROCESSING)
- #define _Objects_Initialize_information( \
- information, \
- the_api, \
- the_class, \
- maximum, \
- object_size, \
- maximum_name_length, \
- extract \
- ) \
- _Objects_Do_initialize_information( \
- information, \
- the_api, \
- the_class, \
- maximum, \
- object_size, \
- maximum_name_length, \
- extract \
- )
-#else
- #define _Objects_Initialize_information( \
- information, \
- the_api, \
- the_class, \
- maximum, \
- object_size, \
- maximum_name_length, \
- extract \
- ) \
- _Objects_Do_initialize_information( \
- information, \
- the_api, \
- the_class, \
- maximum, \
- object_size, \
- maximum_name_length \
- )
-#endif
+void _Objects_Initialize_information( Objects_Information *information );
/**
* @brief Object API Maximum Class
diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h
index 7e24af43c9..9bf920d5fb 100644
--- a/cpukit/include/rtems/score/thread.h
+++ b/cpukit/include/rtems/score/thread.h
@@ -26,6 +26,7 @@
#if defined(RTEMS_MULTIPROCESSING)
#include <rtems/score/mppkt.h>
#endif
+#include <rtems/score/freechain.h>
#include <rtems/score/isrlock.h>
#include <rtems/score/objectdata.h>
#include <rtems/score/priority.h>
@@ -909,7 +910,7 @@ typedef struct {
*
* This array is provided via <rtems/confdefs.h>.
*
- * @see _Thread_Control_add_on_count and _Thread_Control_size.
+ * @see _Thread_Control_add_on_count.
*/
extern const Thread_Control_add_on _Thread_Control_add_ons[];
@@ -923,13 +924,11 @@ extern const Thread_Control_add_on _Thread_Control_add_ons[];
extern const size_t _Thread_Control_add_on_count;
/**
- * @brief Size of the thread control block of a particular application.
+ * @brief Count of configured threads.
*
* This value is provided via <rtems/confdefs.h>.
- *
- * @see _Thread_Control_add_ons.
*/
-extern const size_t _Thread_Control_size;
+extern const size_t _Thread_Initial_thread_count;
/**
* @brief Maximum size of a thread name in characters (including the
@@ -939,6 +938,115 @@ extern const size_t _Thread_Control_size;
*/
extern const size_t _Thread_Maximum_name_size;
+/**
+ * @brief The configured thread control block.
+ *
+ * This type is defined in <rtems/confdefs.h> and depends on the application
+ * configuration.
+ */
+typedef struct Thread_Configured_control Thread_Configured_control;
+
+/**
+ * @brief The configured thread queue heads.
+ *
+ * In SMP configurations, this type is defined in <rtems/confdefs.h> and depends
+ * on the application configuration.
+ */
+#if defined(RTEMS_SMP)
+typedef struct Thread_queue_Configured_heads Thread_queue_Configured_heads;
+#else
+typedef Thread_queue_Heads Thread_queue_Configured_heads;
+#endif
+
+/**
+ * @brief Size of the thread queue heads of a particular application.
+ *
+ * In SMP configurations, this value is provided via <rtems/confdefs.h>.
+ */
+#if defined(RTEMS_SMP)
+extern const size_t _Thread_queue_Heads_size;
+#else
+#define _Thread_queue_Heads_size sizeof(Thread_queue_Heads)
+#endif
+
+/**
+ * @brief The thread object information.
+ */
+typedef struct {
+ /**
+ * @brief The object information.
+ */
+ Objects_Information Objects;
+
+ /**
+ * @brief Thread queue heads maintenance.
+ */
+ union {
+ /**
+ * @brief Contains the initial set of thread queue heads.
+ *
+ * This is set by <rtems/confdefs.h> via THREAD_INFORMATION_DEFINE().
+ */
+ Thread_queue_Configured_heads *initial;
+
+ /**
+ * @brief The free thread queue heads.
+ *
+ * This member is initialized by _Thread_Initialize_information().
+ */
+ Freechain_Control Free;
+ } Thread_queue_heads;
+} Thread_Information;
+
+/**
+ * @brief The internal thread objects information.
+ */
+extern Thread_Information _Thread_Information;
+
+#define THREAD_INFORMATION_DEFINE_ZERO( name, api, cls ) \
+Thread_Information name##_Information = { \
+ { \
+ _Objects_Build_id( api, cls, 1, 0 ), \
+ NULL, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
+ CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \
+ NULL, \
+ NULL, \
+ NULL \
+ OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ), \
+ }, { \
+ NULL \
+ } \
+}
+
+#define THREAD_INFORMATION_DEFINE( name, api, cls, max ) \
+static Objects_Control * \
+name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
+static Thread_Configured_control \
+name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
+static Thread_queue_Configured_heads \
+name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \
+Thread_Information name##_Information = { \
+ { \
+ _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
+ name##_Local_table, \
+ 0, \
+ _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \
+ sizeof( Thread_Configured_control ), \
+ OBJECTS_NO_STRING_NAME, \
+ CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \
+ NULL, \
+ NULL, \
+ &name##_Objects[ 0 ].Control.Object \
+ OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ) \
+ }, { \
+ &name##_Heads[ 0 ] \
+ } \
+}
+
/**@}*/
#ifdef __cplusplus
diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h
index 0e93cb501d..d3e69ed91c 100644
--- a/cpukit/include/rtems/score/threadimpl.h
+++ b/cpukit/include/rtems/score/threadimpl.h
@@ -34,7 +34,6 @@
#include <rtems/score/timestampimpl.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/score/todimpl.h>
-#include <rtems/score/freechain.h>
#include <rtems/score/watchdogimpl.h>
#include <rtems/config.h>
@@ -58,18 +57,6 @@ extern "C" {
*/
extern void *rtems_ada_self;
-typedef struct {
- Objects_Information Objects;
-
- Freechain_Control Free_thread_queue_heads;
-} Thread_Information;
-
-/**
- * The following defines the information control block used to
- * manage this class of objects.
- */
-extern Thread_Information _Thread_Internal_information;
-
/**
* @brief Object identifier of the global constructor thread.
*
@@ -100,12 +87,7 @@ void _Thread_Iterate(
void *arg
);
-void _Thread_Initialize_information(
- Thread_Information *information,
- Objects_APIs the_api,
- uint16_t the_class,
- uint32_t maximum
-);
+void _Thread_Initialize_information( Thread_Information *information );
/**
* @brief Initialize thread handler.
@@ -828,7 +810,7 @@ RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_maximum_internal_threads(void)
RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void )
{
return (Thread_Control *)
- _Objects_Allocate_unprotected( &_Thread_Internal_information.Objects );
+ _Objects_Allocate_unprotected( &_Thread_Information.Objects );
}
/**
diff --git a/cpukit/include/rtems/score/threadq.h b/cpukit/include/rtems/score/threadq.h
index 5ddc2a10bb..c0a11770fb 100644
--- a/cpukit/include/rtems/score/threadq.h
+++ b/cpukit/include/rtems/score/threadq.h
@@ -394,15 +394,6 @@ typedef struct _Thread_queue_Heads {
#endif
} Thread_queue_Heads;
-#if defined(RTEMS_SMP)
- #define THREAD_QUEUE_HEADS_SIZE( scheduler_count ) \
- ( sizeof( Thread_queue_Heads ) \
- + ( scheduler_count ) * sizeof( Thread_queue_Priority_queue ) )
-#else
- #define THREAD_QUEUE_HEADS_SIZE( scheduler_count ) \
- sizeof( Thread_queue_Heads )
-#endif
-
struct Thread_queue_Queue {
/**
* @brief Lock to protect this thread queue.