summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-10 10:58:27 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-11 08:52:54 +0200
commit4bc8d2e71774452e66c619dad98ccab6db8a2324 (patch)
tree9bcbf057fa8bd77816542cab020b9348ba516062
parent263f4beceae0ec5602cb41e792c25ebe3ec49c97 (diff)
downloadrtems-4bc8d2e71774452e66c619dad98ccab6db8a2324.tar.bz2
rtems: Rename rtems_smp_get_processor_count()
Rename rtems_smp_get_processor_count() in rtems_get_processor_count(). Make rtems_get_processor_count() a function in uni-processor configurations to enable ABI compatibility with SMP configurations.
-rw-r--r--c/src/lib/libbsp/sparc/leon3/startup/bspreset.c2
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagereset.c2
-rw-r--r--cpukit/rtems/Makefile.am2
-rw-r--r--cpukit/rtems/include/rtems/rtems/smp.h6
-rw-r--r--cpukit/rtems/src/getprocessorcount.c25
-rw-r--r--cpukit/sapi/src/profilingiterate.c2
-rw-r--r--testsuites/smptests/smp01/init.c6
-rw-r--r--testsuites/smptests/smp02/init.c4
-rw-r--r--testsuites/smptests/smp03/init.c10
-rw-r--r--testsuites/smptests/smp05/init.c4
-rw-r--r--testsuites/smptests/smp07/init.c2
-rw-r--r--testsuites/smptests/smp08/init.c2
-rw-r--r--testsuites/smptests/smp09/init.c2
-rw-r--r--testsuites/smptests/smpaffinity01/init.c2
-rw-r--r--testsuites/smptests/smpatomic01/init.c2
-rw-r--r--testsuites/smptests/smpfatal01/init.c2
-rw-r--r--testsuites/smptests/smpfatal02/init.c2
-rw-r--r--testsuites/smptests/smpfatal03/init.c2
-rw-r--r--testsuites/smptests/smpload01/init.c6
-rw-r--r--testsuites/smptests/smplock01/init.c4
-rw-r--r--testsuites/smptests/smpmigration01/init.c2
-rw-r--r--testsuites/smptests/smppsxaffinity01/init.c2
-rw-r--r--testsuites/smptests/smppsxaffinity02/init.c2
-rw-r--r--testsuites/smptests/smppsxsignal01/init.c2
-rw-r--r--testsuites/smptests/smpscheduler01/init.c2
-rw-r--r--testsuites/smptests/smpsignal01/init.c2
-rw-r--r--testsuites/smptests/smpswitchextension01/init.c2
-rw-r--r--testsuites/smptests/smpthreadlife01/init.c2
-rw-r--r--testsuites/tmtests/tmcontext01/init.c2
29 files changed, 66 insertions, 41 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c b/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c
index e1430b2e40..c3c9e988cf 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c
@@ -32,7 +32,7 @@ void bsp_reset(void)
*/
uint32_t max_wait = 1234567;
- uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_count = rtems_get_processor_count();
uint32_t halt_mask = 0;
uint32_t i;
diff --git a/cpukit/libmisc/cpuuse/cpuusagereset.c b/cpukit/libmisc/cpuuse/cpuusagereset.c
index b74414b8de..e77ac2c006 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereset.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereset.c
@@ -45,7 +45,7 @@ void rtems_cpu_usage_reset( void )
_TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
- processor_count = rtems_smp_get_processor_count();
+ processor_count = rtems_get_processor_count();
for ( processor = 0 ; processor < processor_count ; ++processor ) {
Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( processor );
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 6cb5181188..4e6438c780 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -259,6 +259,8 @@ librtems_a_SOURCES += src/modes.c
librtems_a_SOURCES += src/status.c
librtems_a_SOURCES += src/statustext.c
+librtems_a_SOURCES += src/getprocessorcount.c
+
if HAS_MP
# We only build multiprocessing related files if HAS_MP was defined
librtems_a_SOURCES += src/eventmp.c
diff --git a/cpukit/rtems/include/rtems/rtems/smp.h b/cpukit/rtems/include/rtems/rtems/smp.h
index d2904e4191..b327514c09 100644
--- a/cpukit/rtems/include/rtems/rtems/smp.h
+++ b/cpukit/rtems/include/rtems/rtems/smp.h
@@ -40,8 +40,7 @@ extern "C" {
/**
* @brief Returns the count of processors in the system.
*
- * On uni-processor configurations this is a compile time constant and defined
- * to be one.
+ * On uni-processor configurations a value of one will be returned.
*
* On SMP configurations this returns the value of a global variable set during
* system initialization to indicate the count of processors. The processor
@@ -51,8 +50,7 @@ extern "C" {
*
* @return The count of processors in the system.
*/
-#define rtems_smp_get_processor_count() \
- _SMP_Get_processor_count()
+uint32_t rtems_get_processor_count(void);
/**
* @brief Returns the index of the current processor.
diff --git a/cpukit/rtems/src/getprocessorcount.c b/cpukit/rtems/src/getprocessorcount.c
new file mode 100644
index 0000000000..438eec6635
--- /dev/null
+++ b/cpukit/rtems/src/getprocessorcount.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * 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.
+ */
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/rtems/smp.h>
+#include <rtems/score/smp.h>
+
+uint32_t rtems_get_processor_count(void)
+{
+ return _SMP_Get_processor_count();
+}
diff --git a/cpukit/sapi/src/profilingiterate.c b/cpukit/sapi/src/profilingiterate.c
index bc98205c36..0fd96fa12d 100644
--- a/cpukit/sapi/src/profilingiterate.c
+++ b/cpukit/sapi/src/profilingiterate.c
@@ -30,7 +30,7 @@ static void per_cpu_stats_iterate(
)
{
#ifdef RTEMS_PROFILING
- uint32_t n = rtems_smp_get_processor_count();
+ uint32_t n = rtems_get_processor_count();
uint32_t i;
memset(data, 0, sizeof(*data));
diff --git a/testsuites/smptests/smp01/init.c b/testsuites/smptests/smp01/init.c
index 91a6e4056c..8439293d95 100644
--- a/testsuites/smptests/smp01/init.c
+++ b/testsuites/smptests/smp01/init.c
@@ -48,12 +48,12 @@ rtems_task Init(
locked_print_initialize();
/* Initialize the TaskRan array */
- for ( i=0; i<rtems_smp_get_processor_count() ; i++ ) {
+ for ( i=0; i<rtems_get_processor_count() ; i++ ) {
TaskRan[i] = false;
}
/* Create and start tasks for each processor */
- for ( i=0; i< rtems_smp_get_processor_count() ; i++ ) {
+ for ( i=0; i< rtems_get_processor_count() ; i++ ) {
if ( i != cpu_self ) {
ch = '0' + i;
@@ -78,7 +78,7 @@ rtems_task Init(
/* Wait on the all tasks to run */
while (1) {
allDone = true;
- for ( i=0; i<rtems_smp_get_processor_count() ; i++ ) {
+ for ( i=0; i<rtems_get_processor_count() ; i++ ) {
if ( i != cpu_self && TaskRan[i] == false)
allDone = false;
}
diff --git a/testsuites/smptests/smp02/init.c b/testsuites/smptests/smp02/init.c
index c2cf5a39bd..05f6351b3a 100644
--- a/testsuites/smptests/smp02/init.c
+++ b/testsuites/smptests/smp02/init.c
@@ -40,7 +40,7 @@ rtems_task Init(
locked_print_initialize();
- if ( rtems_smp_get_processor_count() == 1 ) {
+ if ( rtems_get_processor_count() == 1 ) {
success();
}
@@ -59,7 +59,7 @@ rtems_task Init(
status = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, 0);
directive_failed( status,"rtems_semaphore_obtain of SEM1\n");
- for ( i=1; i < rtems_smp_get_processor_count(); i++ ){
+ for ( i=1; i < rtems_get_processor_count(); i++ ){
/* Create and start tasks for each CPU */
ch = '0' + i;
diff --git a/testsuites/smptests/smp03/init.c b/testsuites/smptests/smp03/init.c
index 0d0bb620d6..3acdfe981d 100644
--- a/testsuites/smptests/smp03/init.c
+++ b/testsuites/smptests/smp03/init.c
@@ -57,13 +57,13 @@ rtems_task Init(
locked_print_initialize();
- if ( rtems_smp_get_processor_count() == 1 ) {
+ if ( rtems_get_processor_count() == 1 ) {
success();
}
/* Initialize the TaskRan array */
TaskRan[0] = true;
- for ( i=1; i<rtems_smp_get_processor_count() ; i++ ) {
+ for ( i=1; i<rtems_get_processor_count() ; i++ ) {
TaskRan[i] = false;
}
@@ -71,7 +71,7 @@ rtems_task Init(
PrintTaskInfo( "Init" );
/* for each remaining cpu create and start a task */
- for ( i=1; i < rtems_smp_get_processor_count(); i++ ){
+ for ( i=1; i < rtems_get_processor_count(); i++ ){
ch = '0' + i;
@@ -101,12 +101,12 @@ rtems_task Init(
RTEMS_DEFAULT_ATTRIBUTES,
&id
);
- status = rtems_task_start(id,Test_task,rtems_smp_get_processor_count());
+ status = rtems_task_start(id,Test_task,rtems_get_processor_count());
/* Wait on all tasks to run */
while (1) {
TestFinished = true;
- for ( i=1; i < (rtems_smp_get_processor_count()+1) ; i++ ) {
+ for ( i=1; i < (rtems_get_processor_count()+1) ; i++ ) {
if (TaskRan[i] == false)
TestFinished = false;
}
diff --git a/testsuites/smptests/smp05/init.c b/testsuites/smptests/smp05/init.c
index 23669ec7cd..cf7ea3a10a 100644
--- a/testsuites/smptests/smp05/init.c
+++ b/testsuites/smptests/smp05/init.c
@@ -44,11 +44,11 @@ rtems_task Init(
locked_print_initialize();
- if ( rtems_smp_get_processor_count() == 1 ) {
+ if ( rtems_get_processor_count() == 1 ) {
success();
}
- for ( i=0; i<rtems_smp_get_processor_count() ; i++ ) {
+ for ( i=0; i<rtems_get_processor_count() ; i++ ) {
ch = '1' + i;
status = rtems_task_create(
diff --git a/testsuites/smptests/smp07/init.c b/testsuites/smptests/smp07/init.c
index 5f9c4967b2..53993ce9c0 100644
--- a/testsuites/smptests/smp07/init.c
+++ b/testsuites/smptests/smp07/init.c
@@ -93,7 +93,7 @@ rtems_task Init(
locked_print_initialize();
- if ( rtems_smp_get_processor_count() == 1 ) {
+ if ( rtems_get_processor_count() == 1 ) {
success();
}
diff --git a/testsuites/smptests/smp08/init.c b/testsuites/smptests/smp08/init.c
index 416c82bf72..d759c13165 100644
--- a/testsuites/smptests/smp08/init.c
+++ b/testsuites/smptests/smp08/init.c
@@ -76,7 +76,7 @@ rtems_task Init(
/* Show that the init task is running on this cpu */
PrintTaskInfo( "Init", &time );
- for ( i=1; i <= rtems_smp_get_processor_count() *3; i++ ) {
+ for ( i=1; i <= rtems_get_processor_count() *3; i++ ) {
sprintf(ch, "%02" PRId32, i );
status = rtems_task_create(
diff --git a/testsuites/smptests/smp09/init.c b/testsuites/smptests/smp09/init.c
index 7128198d58..09e9c09297 100644
--- a/testsuites/smptests/smp09/init.c
+++ b/testsuites/smptests/smp09/init.c
@@ -45,7 +45,7 @@ rtems_task Init(
for ( killtime=0; killtime<1000000; killtime++ )
;
- for ( i=0; i<rtems_smp_get_processor_count() -1; i++ ) {
+ for ( i=0; i<rtems_get_processor_count() -1; i++ ) {
ch = '1' + i;
status = rtems_task_create(
diff --git a/testsuites/smptests/smpaffinity01/init.c b/testsuites/smptests/smpaffinity01/init.c
index cc5f32130e..06d5719438 100644
--- a/testsuites/smptests/smpaffinity01/init.c
+++ b/testsuites/smptests/smpaffinity01/init.c
@@ -112,7 +112,7 @@ void Validate_affinity(void )
directive_failed( sc, "Get Affinity of Init Task" );
/* Get the number of processors that we are using. */
- cpu_count = rtems_smp_get_processor_count();
+ cpu_count = rtems_get_processor_count();
/* Fill the remaining cpus with med priority tasks */
puts( "Init - Create Medium priority tasks");
diff --git a/testsuites/smptests/smpatomic01/init.c b/testsuites/smptests/smpatomic01/init.c
index e055ea4c5a..283200bd5d 100644
--- a/testsuites/smptests/smpatomic01/init.c
+++ b/testsuites/smptests/smpatomic01/init.c
@@ -446,7 +446,7 @@ static void test(void)
test_static_and_dynamic_initialization();
- ctx->worker_count = rtems_smp_get_processor_count();
+ ctx->worker_count = rtems_get_processor_count();
sc = rtems_timer_create(
rtems_build_name('S', 'T', 'O', 'P'),
diff --git a/testsuites/smptests/smpfatal01/init.c b/testsuites/smptests/smpfatal01/init.c
index 0ba627a138..178148b123 100644
--- a/testsuites/smptests/smpfatal01/init.c
+++ b/testsuites/smptests/smpfatal01/init.c
@@ -69,7 +69,7 @@ static rtems_status_code test_driver_init(
)
{
uint32_t self = rtems_smp_get_current_processor();
- uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_count = rtems_get_processor_count();
uint32_t cpu;
rtems_test_begink();
diff --git a/testsuites/smptests/smpfatal02/init.c b/testsuites/smptests/smpfatal02/init.c
index c801a287b9..fb42e5d411 100644
--- a/testsuites/smptests/smpfatal02/init.c
+++ b/testsuites/smptests/smpfatal02/init.c
@@ -77,7 +77,7 @@ static rtems_status_code test_driver_init(
)
{
uint32_t self = rtems_smp_get_current_processor();
- uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_count = rtems_get_processor_count();
uint32_t cpu;
rtems_test_begink();
diff --git a/testsuites/smptests/smpfatal03/init.c b/testsuites/smptests/smpfatal03/init.c
index 714e7b9ee4..13a9db511a 100644
--- a/testsuites/smptests/smpfatal03/init.c
+++ b/testsuites/smptests/smpfatal03/init.c
@@ -68,7 +68,7 @@ static void wait_for_giant(void)
static void Init(rtems_task_argument arg)
{
uint32_t self = rtems_smp_get_current_processor();
- uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_count = rtems_get_processor_count();
rtems_test_begink();
diff --git a/testsuites/smptests/smpload01/init.c b/testsuites/smptests/smpload01/init.c
index b26437c95d..e85d89e780 100644
--- a/testsuites/smptests/smpload01/init.c
+++ b/testsuites/smptests/smpload01/init.c
@@ -81,7 +81,7 @@ static void inherit_obtain_task(rtems_task_argument arg)
test_context *ctx = &test_instance;
rtems_status_code sc;
SMP_barrier_State barrier_state = SMP_BARRIER_STATE_INITIALIZER;
- uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_count = rtems_get_processor_count();
rtems_counter_ticks delay = (cpu_count - 1 - arg) * ctx->inherit_obtain_delay;
while (true) {
@@ -338,7 +338,7 @@ static void test(void)
sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
- for (i = 0; i < rtems_smp_get_processor_count(); ++i) {
+ for (i = 0; i < rtems_get_processor_count(); ++i) {
sc = rtems_task_create(
rtems_build_name('I', 'N', 'H', 'O'),
INHERIT_OBTAIN_PRIO_BASE + i,
@@ -373,7 +373,7 @@ static void test(void)
ctx->inherit_release_counter
);
- for (i = 0; i < rtems_smp_get_processor_count(); ++i) {
+ for (i = 0; i < rtems_get_processor_count(); ++i) {
printf(
"priority inheritance obtain count %2" PRIu32 ": %" PRIu64 "\n",
i,
diff --git a/testsuites/smptests/smplock01/init.c b/testsuites/smptests/smplock01/init.c
index f0d9c92ebe..85995e8e99 100644
--- a/testsuites/smptests/smplock01/init.c
+++ b/testsuites/smptests/smplock01/init.c
@@ -259,7 +259,7 @@ static void run_tests(
static void task(rtems_task_argument arg)
{
global_context *ctx = (global_context *) arg;
- uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_count = rtems_get_processor_count();
uint32_t cpu_self = rtems_smp_get_current_processor();
rtems_status_code sc;
SMP_barrier_State bs = SMP_BARRIER_STATE_INITIALIZER;
@@ -273,7 +273,7 @@ static void task(rtems_task_argument arg)
static void test(void)
{
global_context *ctx = &context;
- uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_count = rtems_get_processor_count();
uint32_t cpu_self = rtems_smp_get_current_processor();
uint32_t cpu;
int test;
diff --git a/testsuites/smptests/smpmigration01/init.c b/testsuites/smptests/smpmigration01/init.c
index e4929119b8..fe321c8787 100644
--- a/testsuites/smptests/smpmigration01/init.c
+++ b/testsuites/smptests/smpmigration01/init.c
@@ -224,7 +224,7 @@ static void Init(rtems_task_argument arg)
{
TEST_BEGIN();
- if (rtems_smp_get_processor_count() >= 2) {
+ if (rtems_get_processor_count() >= 2) {
test();
}
diff --git a/testsuites/smptests/smppsxaffinity01/init.c b/testsuites/smptests/smppsxaffinity01/init.c
index 54851490a9..cb9e0b37d9 100644
--- a/testsuites/smptests/smppsxaffinity01/init.c
+++ b/testsuites/smptests/smppsxaffinity01/init.c
@@ -106,7 +106,7 @@ void Validate_attr(void )
rtems_test_assert( priority != -1 );
- cpus = rtems_smp_get_processor_count();
+ cpus = rtems_get_processor_count();
puts(
"Init - Validate pthread_attr_setaffinity_np and "
"pthread_attr_getaffinity_np"
diff --git a/testsuites/smptests/smppsxaffinity02/init.c b/testsuites/smptests/smppsxaffinity02/init.c
index 7916e60ece..ad98da4ec1 100644
--- a/testsuites/smptests/smppsxaffinity02/init.c
+++ b/testsuites/smptests/smppsxaffinity02/init.c
@@ -121,7 +121,7 @@ void Validate_affinity(void )
rtems_test_assert( !sc );
/* Get the number of processors that we are using. */
- cpu_count = rtems_smp_get_processor_count();
+ cpu_count = rtems_get_processor_count();
/* Fill the remaining cpus with med priority tasks */
puts( "Init - Create Medium priority tasks");
diff --git a/testsuites/smptests/smppsxsignal01/init.c b/testsuites/smptests/smppsxsignal01/init.c
index 495af063a7..61eaec1667 100644
--- a/testsuites/smptests/smppsxsignal01/init.c
+++ b/testsuites/smptests/smppsxsignal01/init.c
@@ -165,7 +165,7 @@ static void *POSIX_Init(void *arg)
{
TEST_BEGIN();
- if (rtems_smp_get_processor_count() >= 2) {
+ if (rtems_get_processor_count() >= 2) {
test();
}
diff --git a/testsuites/smptests/smpscheduler01/init.c b/testsuites/smptests/smpscheduler01/init.c
index a0d37602b3..10ac735ca2 100644
--- a/testsuites/smptests/smpscheduler01/init.c
+++ b/testsuites/smptests/smpscheduler01/init.c
@@ -69,7 +69,7 @@ static void task(rtems_task_argument arg)
static bool is_per_cpu_state_ok(void)
{
bool ok = true;
- uint32_t n = rtems_smp_get_processor_count();
+ uint32_t n = rtems_get_processor_count();
uint32_t i;
for (i = 0; i < n; ++i) {
diff --git a/testsuites/smptests/smpsignal01/init.c b/testsuites/smptests/smpsignal01/init.c
index d5d31d5a06..1aaa70090a 100644
--- a/testsuites/smptests/smpsignal01/init.c
+++ b/testsuites/smptests/smpsignal01/init.c
@@ -166,7 +166,7 @@ static void Init(rtems_task_argument arg)
{
TEST_BEGIN();
- if (rtems_smp_get_processor_count() >= 2) {
+ if (rtems_get_processor_count() >= 2) {
test();
}
diff --git a/testsuites/smptests/smpswitchextension01/init.c b/testsuites/smptests/smpswitchextension01/init.c
index 017ff97e9d..eda8a9cfde 100644
--- a/testsuites/smptests/smpswitchextension01/init.c
+++ b/testsuites/smptests/smpswitchextension01/init.c
@@ -225,7 +225,7 @@ static void Init(rtems_task_argument arg)
{
TEST_BEGIN();
- if (rtems_smp_get_processor_count() >= 2) {
+ if (rtems_get_processor_count() >= 2) {
test();
}
diff --git a/testsuites/smptests/smpthreadlife01/init.c b/testsuites/smptests/smpthreadlife01/init.c
index 8ff5ea1c50..38b054f41c 100644
--- a/testsuites/smptests/smpthreadlife01/init.c
+++ b/testsuites/smptests/smpthreadlife01/init.c
@@ -298,7 +298,7 @@ static void Init(rtems_task_argument arg)
{
TEST_BEGIN();
- if (rtems_smp_get_processor_count() >= CPU_COUNT) {
+ if (rtems_get_processor_count() >= CPU_COUNT) {
test_restart();
test_delete();
test_set_life_protection();
diff --git a/testsuites/tmtests/tmcontext01/init.c b/testsuites/tmtests/tmcontext01/init.c
index 2f5ada40b5..c5162a29a6 100644
--- a/testsuites/tmtests/tmcontext01/init.c
+++ b/testsuites/tmtests/tmcontext01/init.c
@@ -214,7 +214,7 @@ static void Init(rtems_task_argument arg)
test(false, load);
test(true, load);
- for (load = 1; load < rtems_smp_get_processor_count(); ++load) {
+ for (load = 1; load < rtems_get_processor_count(); ++load) {
rtems_status_code sc;
rtems_id id;
volatile int *load_data = NULL;