From f913c796ffed8fe19e37f9a4dc914f6dca68baa2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 18 Jul 2013 11:27:39 +0200 Subject: sapi: Add rtems_configuration_is_smp_enabled() Add a configuration field which indicates if the SMP mode of operation is enabled. This can be used to disable features unsupported on SMP, e.g task variables. --- cpukit/sapi/include/confdefs.h | 7 +++++++ cpukit/sapi/include/rtems/config.h | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'cpukit') diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index 1585548e7c..b7cbfaa676 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -2364,6 +2364,13 @@ const rtems_libio_helper rtems_fs_init_helper = #else false, #endif + #ifdef RTEMS_SMP + #ifdef CONFIGURE_SMP_APPLICATION + true, + #else + false, + #endif + #endif CONFIGURE_MAXIMUM_DRIVERS, /* maximum device drivers */ CONFIGURE_NUMBER_OF_DRIVERS, /* static device drivers */ Device_drivers, /* pointer to driver table */ diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h index d483471264..d25b905ee2 100644 --- a/cpukit/sapi/include/rtems/config.h +++ b/cpukit/sapi/include/rtems/config.h @@ -222,6 +222,10 @@ typedef struct { */ bool stack_allocator_avoids_work_space; + #ifdef RTEMS_SMP + bool smp_enabled; + #endif + uint32_t maximum_drivers; uint32_t number_of_device_drivers; rtems_driver_address_table *Device_driver_table; @@ -338,12 +342,33 @@ extern const rtems_configuration_table Configuration; NULL #endif +/** + * @brief Returns true if the SMP mode of operation is enabled, and false + * otherwise. + * + * On single-processor configurations this is a compile time constant which + * evaluates to false. + * + * @retval true SMP mode of operation is enabled. + * @retval false Otherwise. + */ +#ifdef RTEMS_SMP + #define rtems_configuration_is_smp_enabled() \ + (Configuration.smp_enabled) +#else + #define rtems_configuration_is_smp_enabled() \ + false +#endif + /** * @brief Returns the configured maximum count of processors. * * The actual number of processors available for the application will be less * than or equal to the configured maximum count of processors. * + * On single-processor configurations this is a compile time constant which + * evaluates to one. + * * @return The configured maximum count of processors. */ #ifdef RTEMS_SMP -- cgit v1.2.3