[rtems commit] rtems: Rename rtems_smp_get_current_processor()

Sebastian Huber sebh at rtems.org
Fri Apr 11 06:45:29 UTC 2014


Module:    rtems
Branch:    master
Commit:    cb5eaddf95d348c1c74aad3997fe012af5e7b02f
Changeset: http://git.rtems.org/rtems/commit/?id=cb5eaddf95d348c1c74aad3997fe012af5e7b02f

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Apr 10 11:02:52 2014 +0200

rtems: Rename rtems_smp_get_current_processor()

Rename rtems_smp_get_current_processor() in
rtems_get_current_processor().  Make rtems_get_current_processor() a
function in uni-processor configurations to enable ABI compatibility
with SMP configurations.

---

 .../libbsp/arm/altera-cyclone-v/startup/bspreset.c |    2 +-
 c/src/lib/libbsp/sparc/leon3/startup/bspreset.c    |    2 +-
 cpukit/rtems/Makefile.am                           |    1 +
 cpukit/rtems/include/rtems/rtems/smp.h             |   10 +++----
 cpukit/rtems/src/getcurrentprocessor.c             |   25 ++++++++++++++++++++
 cpukit/sapi/src/testextension.c                    |    2 +-
 testsuites/smptests/smp01/init.c                   |    2 +-
 testsuites/smptests/smp01/tasks.c                  |    2 +-
 testsuites/smptests/smp02/init.c                   |    2 +-
 testsuites/smptests/smp02/tasks.c                  |    2 +-
 testsuites/smptests/smp03/init.c                   |    2 +-
 testsuites/smptests/smp05/init.c                   |    4 +-
 testsuites/smptests/smp07/init.c                   |    4 +-
 testsuites/smptests/smp08/init.c                   |    2 +-
 testsuites/smptests/smp08/tasks.c                  |    2 +-
 testsuites/smptests/smp09/init.c                   |    2 +-
 testsuites/smptests/smpfatal01/init.c              |    4 +-
 testsuites/smptests/smpfatal02/init.c              |    4 +-
 testsuites/smptests/smpfatal03/init.c              |    4 +-
 testsuites/smptests/smplock01/init.c               |    4 +-
 testsuites/smptests/smpmigration01/init.c          |    2 +-
 testsuites/smptests/smppsxsignal01/init.c          |    8 +++---
 testsuites/smptests/smpsignal01/init.c             |    8 +++---
 23 files changed, 62 insertions(+), 38 deletions(-)

diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspreset.c b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspreset.c
index 9cf21a9..3b7f10a 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspreset.c
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspreset.c
@@ -19,7 +19,7 @@
 
 void bsp_reset(void)
 {
-  uint32_t           self_cpu  = rtems_smp_get_current_processor();
+  uint32_t           self_cpu  = rtems_get_current_processor();
   volatile uint32_t *mpumodrst = ALT_RSTMGR_MPUMODRST_ADDR;
   
   if( self_cpu == 0 ) {
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c b/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c
index c3c9e98..c642a75 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c
@@ -20,7 +20,7 @@
 
 void bsp_reset(void)
 {
-  uint32_t self_cpu = rtems_smp_get_current_processor();
+  uint32_t self_cpu = rtems_get_current_processor();
 
   if (self_cpu == 0) {
     volatile struct irqmp_regs *irqmp = LEON3_IrqCtrl_Regs;
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 4e6438c..a279ed7 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -259,6 +259,7 @@ librtems_a_SOURCES += src/modes.c
 librtems_a_SOURCES += src/status.c
 librtems_a_SOURCES += src/statustext.c
 
+librtems_a_SOURCES += src/getcurrentprocessor.c
 librtems_a_SOURCES += src/getprocessorcount.c
 
 if HAS_MP
diff --git a/cpukit/rtems/include/rtems/rtems/smp.h b/cpukit/rtems/include/rtems/rtems/smp.h
index b327514..fa4d5d6 100644
--- a/cpukit/rtems/include/rtems/rtems/smp.h
+++ b/cpukit/rtems/include/rtems/rtems/smp.h
@@ -18,12 +18,12 @@
 #ifndef _RTEMS_RTEMS_SMP_H
 #define _RTEMS_RTEMS_SMP_H
 
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include <rtems/score/smp.h>
-
 /**
  * @defgroup ClassicSMP SMP Services
  *
@@ -55,8 +55,7 @@ uint32_t rtems_get_processor_count(void);
 /**
  * @brief Returns the index of the current processor.
  *
- * On uni-processor configurations this is a compile time constant and defined
- * to be zero.
+ * On uni-processor configurations a value of zero will be returned.
  *
  * On SMP configurations an architecture specific method is used to obtain the
  * index of the current processor in the system.  The set of processor indices
@@ -70,8 +69,7 @@ uint32_t rtems_get_processor_count(void);
  *
  * @return The index of the current processor.
  */
-#define rtems_smp_get_current_processor() \
-  _SMP_Get_current_processor()
+uint32_t rtems_get_current_processor(void);
 
 /** @} */
 
diff --git a/cpukit/rtems/src/getcurrentprocessor.c b/cpukit/rtems/src/getcurrentprocessor.c
new file mode 100644
index 0000000..5fc48b9
--- /dev/null
+++ b/cpukit/rtems/src/getcurrentprocessor.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at 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_current_processor(void)
+{
+  return _SMP_Get_current_processor();
+}
diff --git a/cpukit/sapi/src/testextension.c b/cpukit/sapi/src/testextension.c
index 76ac1e0..e21872a 100644
--- a/cpukit/sapi/src/testextension.c
+++ b/cpukit/sapi/src/testextension.c
@@ -29,7 +29,7 @@ void rtems_test_fatal_extension(
   (void) is_internal;
   (void) code;
 
-  if (rtems_smp_get_current_processor() == 0) {
+  if (rtems_get_current_processor() == 0) {
     rtems_profiling_report_xml(
       rtems_test_name,
       printk_plugin,
diff --git a/testsuites/smptests/smp01/init.c b/testsuites/smptests/smp01/init.c
index 8439293..c77a192 100644
--- a/testsuites/smptests/smp01/init.c
+++ b/testsuites/smptests/smp01/init.c
@@ -35,7 +35,7 @@ rtems_task Init(
   rtems_status_code  status;
   bool               allDone;
 
-  cpu_self = rtems_smp_get_current_processor();
+  cpu_self = rtems_get_current_processor();
 
   /* XXX - Delay a bit to allow debug messages from
    * startup to print.  This may need to go away when
diff --git a/testsuites/smptests/smp01/tasks.c b/testsuites/smptests/smp01/tasks.c
index 12a7418..b8c766f 100644
--- a/testsuites/smptests/smp01/tasks.c
+++ b/testsuites/smptests/smp01/tasks.c
@@ -28,7 +28,7 @@ rtems_task Test_task(
   rtems_test_assert( p != NULL );
 
    /* Get the CPU Number */
-  cpu_num = rtems_smp_get_current_processor();
+  cpu_num = rtems_get_current_processor();
 
   /* Print that the task is up and running. */
   Loop();
diff --git a/testsuites/smptests/smp02/init.c b/testsuites/smptests/smp02/init.c
index 05f6351..e70eca3 100644
--- a/testsuites/smptests/smp02/init.c
+++ b/testsuites/smptests/smp02/init.c
@@ -73,7 +73,7 @@ rtems_task Init(
       &id
     );
 
-    cpu_num = rtems_smp_get_current_processor();
+    cpu_num = rtems_get_current_processor();
     locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
     status = rtems_task_start( id, Test_task, i+1 );
     directive_failed( status, str );
diff --git a/testsuites/smptests/smp02/tasks.c b/testsuites/smptests/smp02/tasks.c
index 595954e..26ca851 100644
--- a/testsuites/smptests/smp02/tasks.c
+++ b/testsuites/smptests/smp02/tasks.c
@@ -40,7 +40,7 @@ rtems_task Test_task(
   uint32_t          cpu_num;
   rtems_status_code sc;
 
-  cpu_num = rtems_smp_get_current_processor();
+  cpu_num = rtems_get_current_processor();
 
   do {
 
diff --git a/testsuites/smptests/smp03/init.c b/testsuites/smptests/smp03/init.c
index 3acdfe9..4b443d0 100644
--- a/testsuites/smptests/smp03/init.c
+++ b/testsuites/smptests/smp03/init.c
@@ -37,7 +37,7 @@ void PrintTaskInfo(
 {
   uint32_t cpu_num;
 
-  cpu_num = rtems_smp_get_current_processor();
+  cpu_num = rtems_get_current_processor();
 
   locked_printf("  CPU %" PRIu32 " running task %s\n", cpu_num, task_name );
 }
diff --git a/testsuites/smptests/smp05/init.c b/testsuites/smptests/smp05/init.c
index cf7ea3a..33d958f 100644
--- a/testsuites/smptests/smp05/init.c
+++ b/testsuites/smptests/smp05/init.c
@@ -26,7 +26,7 @@ rtems_task Test_task(
   rtems_task_argument argument
 )
 {
-  locked_printf( "Shut down from CPU %" PRIu32 "\n", rtems_smp_get_current_processor() );
+  locked_printf( "Shut down from CPU %" PRIu32 "\n", rtems_get_current_processor() );
   success();
 }
 
@@ -61,7 +61,7 @@ rtems_task Init(
     );
     directive_failed( status, "task create" );
 
-    cpu_num = rtems_smp_get_current_processor();
+    cpu_num = rtems_get_current_processor();
     locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
 
     status = rtems_task_start( id, Test_task, i+1 );
diff --git a/testsuites/smptests/smp07/init.c b/testsuites/smptests/smp07/init.c
index 53993ce..7e3f6f5 100644
--- a/testsuites/smptests/smp07/init.c
+++ b/testsuites/smptests/smp07/init.c
@@ -40,7 +40,7 @@ rtems_task Test_task(
   rtems_test_assert( p != NULL );
 
    /* Get the CPU Number */
-  cpu_num = rtems_smp_get_current_processor();
+  cpu_num = rtems_get_current_processor();
 
   /* Print that the task is up and running. */
   locked_printf(" CPU %" PRIu32 " runnng Task %s and blocking\n", cpu_num, name);
@@ -124,7 +124,7 @@ rtems_task Init(
   );
   directive_failed( status, "task create" );
 
-  cpu_num = rtems_smp_get_current_processor();
+  cpu_num = rtems_get_current_processor();
   locked_printf(" CPU %d start task TA1\n", cpu_num );
   status = rtems_task_start( id, Test_task, 1 );
   directive_failed( status, "task start" );
diff --git a/testsuites/smptests/smp08/init.c b/testsuites/smptests/smp08/init.c
index d759c13..d35f518 100644
--- a/testsuites/smptests/smp08/init.c
+++ b/testsuites/smptests/smp08/init.c
@@ -23,7 +23,7 @@ void PrintTaskInfo(
 {
   uint32_t cpu_num;
 
-  cpu_num = rtems_smp_get_current_processor();
+  cpu_num = rtems_get_current_processor();
 
   /* Print the cpu number and task name */
   locked_printf(
diff --git a/testsuites/smptests/smp08/tasks.c b/testsuites/smptests/smp08/tasks.c
index d9ddb32..deda4bf 100644
--- a/testsuites/smptests/smp08/tasks.c
+++ b/testsuites/smptests/smp08/tasks.c
@@ -34,7 +34,7 @@ rtems_task Test_task(
   for ( ; ; ) {
 
     /* Get the CPU Number */
-    cpu_num = rtems_smp_get_current_processor();
+    cpu_num = rtems_get_current_processor();
 
     status = rtems_clock_get_tod( &time );
     if ( time.second >= 35 ) {
diff --git a/testsuites/smptests/smp09/init.c b/testsuites/smptests/smp09/init.c
index 09e9c09..8cf019c 100644
--- a/testsuites/smptests/smp09/init.c
+++ b/testsuites/smptests/smp09/init.c
@@ -58,7 +58,7 @@ rtems_task Init(
     );
     directive_failed( status, "task create" );
 
-    cpu_num = rtems_smp_get_current_processor();
+    cpu_num = rtems_get_current_processor();
     locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
 
     status = rtems_task_start( id, Test_task, i+1 );
diff --git a/testsuites/smptests/smpfatal01/init.c b/testsuites/smptests/smpfatal01/init.c
index 178148b..5ef9ffe 100644
--- a/testsuites/smptests/smpfatal01/init.c
+++ b/testsuites/smptests/smpfatal01/init.c
@@ -42,7 +42,7 @@ static void fatal_extension(
 )
 {
   if (source == RTEMS_FATAL_SOURCE_SMP) {
-    uint32_t self = rtems_smp_get_current_processor();
+    uint32_t self = rtems_get_current_processor();
 
     assert(!is_internal);
     assert(code == SMP_FATAL_SHUTDOWN);
@@ -68,7 +68,7 @@ static rtems_status_code test_driver_init(
   void *arg
 )
 {
-  uint32_t self = rtems_smp_get_current_processor();
+  uint32_t self = rtems_get_current_processor();
   uint32_t cpu_count = rtems_get_processor_count();
   uint32_t cpu;
 
diff --git a/testsuites/smptests/smpfatal02/init.c b/testsuites/smptests/smpfatal02/init.c
index fb42e5d..266251f 100644
--- a/testsuites/smptests/smpfatal02/init.c
+++ b/testsuites/smptests/smpfatal02/init.c
@@ -45,7 +45,7 @@ static void fatal_extension(
     source == RTEMS_FATAL_SOURCE_APPLICATION
       || source == RTEMS_FATAL_SOURCE_SMP
   ) {
-    uint32_t self = rtems_smp_get_current_processor();
+    uint32_t self = rtems_get_current_processor();
 
     assert(!is_internal);
 
@@ -76,7 +76,7 @@ static rtems_status_code test_driver_init(
   void *arg
 )
 {
-  uint32_t self = rtems_smp_get_current_processor();
+  uint32_t self = rtems_get_current_processor();
   uint32_t cpu_count = rtems_get_processor_count();
   uint32_t cpu;
 
diff --git a/testsuites/smptests/smpfatal03/init.c b/testsuites/smptests/smpfatal03/init.c
index 13a9db5..2ef17f0 100644
--- a/testsuites/smptests/smpfatal03/init.c
+++ b/testsuites/smptests/smpfatal03/init.c
@@ -67,7 +67,7 @@ static void wait_for_giant(void)
 
 static void Init(rtems_task_argument arg)
 {
-  uint32_t self = rtems_smp_get_current_processor();
+  uint32_t self = rtems_get_current_processor();
   uint32_t cpu_count = rtems_get_processor_count();
 
   rtems_test_begink();
@@ -108,7 +108,7 @@ static void fatal_extension(
     source == RTEMS_FATAL_SOURCE_APPLICATION
       || source == RTEMS_FATAL_SOURCE_SMP
   ) {
-    uint32_t self = rtems_smp_get_current_processor();
+    uint32_t self = rtems_get_current_processor();
     SMP_barrier_State state = SMP_BARRIER_STATE_INITIALIZER;
 
     assert(!is_internal);
diff --git a/testsuites/smptests/smplock01/init.c b/testsuites/smptests/smplock01/init.c
index 85995e8..8cc10fa 100644
--- a/testsuites/smptests/smplock01/init.c
+++ b/testsuites/smptests/smplock01/init.c
@@ -260,7 +260,7 @@ static void task(rtems_task_argument arg)
 {
   global_context *ctx = (global_context *) arg;
   uint32_t cpu_count = rtems_get_processor_count();
-  uint32_t cpu_self = rtems_smp_get_current_processor();
+  uint32_t cpu_self = rtems_get_current_processor();
   rtems_status_code sc;
   SMP_barrier_State bs = SMP_BARRIER_STATE_INITIALIZER;
 
@@ -274,7 +274,7 @@ static void test(void)
 {
   global_context *ctx = &context;
   uint32_t cpu_count = rtems_get_processor_count();
-  uint32_t cpu_self = rtems_smp_get_current_processor();
+  uint32_t cpu_self = rtems_get_current_processor();
   uint32_t cpu;
   int test;
   rtems_status_code sc;
diff --git a/testsuites/smptests/smpmigration01/init.c b/testsuites/smptests/smpmigration01/init.c
index fe321c8..78d671d 100644
--- a/testsuites/smptests/smpmigration01/init.c
+++ b/testsuites/smptests/smpmigration01/init.c
@@ -73,7 +73,7 @@ static void runner(rtems_task_argument self)
   test_counters *next_counters = &ctx->counters[next];
 
   while (true) {
-    uint32_t current_cpu = rtems_smp_get_current_processor();
+    uint32_t current_cpu = rtems_get_current_processor();
 
     ++counters->cycles_per_cpu[current_cpu].counter;
 
diff --git a/testsuites/smptests/smppsxsignal01/init.c b/testsuites/smptests/smppsxsignal01/init.c
index 61eaec1..b954cbd 100644
--- a/testsuites/smptests/smppsxsignal01/init.c
+++ b/testsuites/smptests/smppsxsignal01/init.c
@@ -82,14 +82,14 @@ static void signal_send(test_context *ctx, test_state new_state)
 static void check_consumer_processor(const test_context *ctx)
 {
   rtems_test_assert(
-    ctx->consumer_processor == rtems_smp_get_current_processor()
+    ctx->consumer_processor == rtems_get_current_processor()
   );
 }
 
 static void check_producer_processor(const test_context *ctx)
 {
   rtems_test_assert(
-    ctx->producer_processor == rtems_smp_get_current_processor()
+    ctx->producer_processor == rtems_get_current_processor()
   );
 }
 
@@ -97,7 +97,7 @@ static void *producer(void *arg)
 {
   test_context *ctx = arg;
 
-  ctx->producer_processor = rtems_smp_get_current_processor();
+  ctx->producer_processor = rtems_get_current_processor();
 
   rtems_test_assert(ctx->consumer_processor != ctx->producer_processor);
 
@@ -120,7 +120,7 @@ static void test(void)
   void *producer_status;
 
   ctx->consumer = pthread_self();
-  ctx->consumer_processor = rtems_smp_get_current_processor();
+  ctx->consumer_processor = rtems_get_current_processor();
 
   memset(&new_action, 0, sizeof(new_action));
   new_action.sa_handler = signal_handler;
diff --git a/testsuites/smptests/smpsignal01/init.c b/testsuites/smptests/smpsignal01/init.c
index 1aaa700..af524bf 100644
--- a/testsuites/smptests/smpsignal01/init.c
+++ b/testsuites/smptests/smpsignal01/init.c
@@ -86,14 +86,14 @@ static void signal_send(test_context *ctx, test_state new_state)
 static void check_consumer_processor(const test_context *ctx)
 {
   rtems_test_assert(
-    ctx->consumer_processor == rtems_smp_get_current_processor()
+    ctx->consumer_processor == rtems_get_current_processor()
   );
 }
 
 static void check_producer_processor(const test_context *ctx)
 {
   rtems_test_assert(
-    ctx->producer_processor == rtems_smp_get_current_processor()
+    ctx->producer_processor == rtems_get_current_processor()
   );
 }
 
@@ -101,7 +101,7 @@ static void producer(rtems_task_argument arg)
 {
   test_context *ctx = (test_context *) arg;
 
-  ctx->producer_processor = rtems_smp_get_current_processor();
+  ctx->producer_processor = rtems_get_current_processor();
 
   rtems_test_assert(ctx->consumer_processor != ctx->producer_processor);
 
@@ -126,7 +126,7 @@ static void test(void)
   rtems_mode mode;
 
   ctx->consumer = rtems_task_self();
-  ctx->consumer_processor = rtems_smp_get_current_processor();
+  ctx->consumer_processor = rtems_get_current_processor();
 
   sc = rtems_signal_catch(signal_handler, RTEMS_DEFAULT_MODES);
   rtems_test_assert(sc == RTEMS_SUCCESSFUL);




More information about the vc mailing list