[rtems commit] config: Bring back RTEMS 4.11 configuration table
Sebastian Huber
sebh at rtems.org
Tue Feb 25 11:32:18 UTC 2020
Module: rtems
Branch: master
Commit: 9bdb6aa31cc3d0bdafc5fbf870d6fa0ec14902c4
Changeset: http://git.rtems.org/rtems/commit/?id=9bdb6aa31cc3d0bdafc5fbf870d6fa0ec14902c4
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Feb 14 09:48:41 2020 +0100
config: Bring back RTEMS 4.11 configuration table
This improves API backward compatibility of RTEMS 5.1 to previous
versions.
---
cpukit/include/rtems/rtems/config.h | 61 +++++++++++++++++++++++++++++++++++
cpukit/rtems/src/getapiconfig.c | 18 +++++++++++
testsuites/sptests/spsysinit01/init.c | 21 ++++++++++++
3 files changed, 100 insertions(+)
diff --git a/cpukit/include/rtems/rtems/config.h b/cpukit/include/rtems/rtems/config.h
index a5078f6..bd6b38a 100644
--- a/cpukit/include/rtems/rtems/config.h
+++ b/cpukit/include/rtems/rtems/config.h
@@ -44,6 +44,67 @@ extern "C" {
* + required number of each object type
*/
typedef struct {
+ /**
+ * This field contains the maximum number of Classic API
+ * Tasks which are configured for this application.
+ */
+ uint32_t maximum_tasks;
+
+ /**
+ * This field indicates whether Classic API notepads are
+ * enabled or disabled.
+ */
+ bool notepads_enabled;
+
+ /**
+ * This field contains the maximum number of Classic API
+ * Timers which are configured for this application.
+ */
+ uint32_t maximum_timers;
+
+ /**
+ * This field contains the maximum number of Classic API
+ * Semaphores which are configured for this application.
+ */
+ uint32_t maximum_semaphores;
+
+ /**
+ * This field contains the maximum number of Classic API
+ * Message Queues which are configured for this application.
+ */
+ uint32_t maximum_message_queues;
+
+ /**
+ * This field contains the maximum number of Classic API
+ * Partitions which are configured for this application.
+ */
+ uint32_t maximum_partitions;
+
+ /**
+ * This field contains the maximum number of Classic API
+ * Regions which are configured for this application.
+ */
+ uint32_t maximum_regions;
+
+ /**
+ * This field contains the maximum number of Classic API
+ * Dual Ported Memory Areas which are configured for this
+ * application.
+ */
+ uint32_t maximum_ports;
+
+ /**
+ * This field contains the maximum number of Classic API
+ * Rate Monotonic Periods which are configured for this
+ * application.
+ */
+ uint32_t maximum_periods;
+
+ /**
+ * This field contains the maximum number of Classic API
+ * Barriers which are configured for this application.
+ */
+ uint32_t maximum_barriers;
/**
* This field contains the number of Classic API Initialization
diff --git a/cpukit/rtems/src/getapiconfig.c b/cpukit/rtems/src/getapiconfig.c
index 77c60cf..088ea59 100644
--- a/cpukit/rtems/src/getapiconfig.c
+++ b/cpukit/rtems/src/getapiconfig.c
@@ -37,6 +37,24 @@ static rtems_api_configuration_table config;
const rtems_api_configuration_table *
rtems_configuration_get_rtems_api_configuration( void )
{
+ /*
+ * Always initialize the configuration table and do not bother with
+ * synchronization issues. This function is not performance critical. The
+ * configuration values are all constants.
+ */
+
+ config.notepads_enabled = false;
+ config.maximum_tasks = rtems_configuration_get_maximum_tasks();
+ config.maximum_timers = rtems_configuration_get_maximum_timers();
+ config.maximum_semaphores = rtems_configuration_get_maximum_semaphores();
+ config.maximum_message_queues =
+ rtems_configuration_get_maximum_message_queues();
+ config.maximum_partitions = rtems_configuration_get_maximum_partitions();
+ config.maximum_regions = rtems_configuration_get_maximum_regions();
+ config.maximum_ports = rtems_configuration_get_maximum_ports();
+ config.maximum_periods = rtems_configuration_get_maximum_periods();
+ config.maximum_barriers = rtems_configuration_get_maximum_barriers();
+
if ( _RTEMS_tasks_User_task_table.entry_point != NULL ) {
config.number_of_initialization_tasks = 1;
config.User_initialization_tasks_table = &_RTEMS_tasks_User_task_table;
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 49b5a69..224eac4 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -905,6 +905,26 @@ static void do_posix_timer_create(void)
#endif /* RTEMS_POSIX_API */
}
+static void check_config(void)
+{
+ const rtems_api_configuration_table *config;
+
+ config = rtems_configuration_get_rtems_api_configuration();
+
+ rtems_test_assert(!config->notepads_enabled);
+ rtems_test_assert(config->maximum_tasks == 2);
+ rtems_test_assert(config->maximum_timers == 1);
+ rtems_test_assert(config->maximum_semaphores == 1);
+ rtems_test_assert(config->maximum_message_queues == 1);
+ rtems_test_assert(config->maximum_partitions == 1);
+ rtems_test_assert(config->maximum_regions == 1);
+ rtems_test_assert(config->maximum_ports == 1);
+ rtems_test_assert(config->maximum_periods == 1);
+ rtems_test_assert(config->maximum_barriers == 1);
+ rtems_test_assert(config->number_of_initialization_tasks == 1);
+ rtems_test_assert(config->User_initialization_tasks_table != NULL);
+}
+
static void Init(rtems_task_argument arg)
{
next_step(INIT_TASK);
@@ -923,6 +943,7 @@ static void Init(rtems_task_argument arg)
do_posix_sem_open();
do_posix_shm_open();
do_posix_timer_create();
+ check_config();
TEST_END();
exit(0);
}
More information about the vc
mailing list