summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-14 14:00:38 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-17 13:09:49 +0200
commit39e51758c86754cef5ba4521c0c36578521f73d0 (patch)
treea87255c5c0592b876106da50b939dedd471b7d5a /testsuites
parentsmp: Delete RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY (diff)
downloadrtems-39e51758c86754cef5ba4521c0c36578521f73d0.tar.bz2
smp: Add and use _CPU_SMP_Get_current_processor()
Add and use _SMP_Get_current_processor() and rtems_smp_get_current_processor(). Delete bsp_smp_interrupt_cpu(). Change type of current processor index from int to uint32_t to match _SMP_Processor_count type.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/smptests/smp01/init.c10
-rw-r--r--testsuites/smptests/smp01/tasks.c8
-rw-r--r--testsuites/smptests/smp02/init.c7
-rw-r--r--testsuites/smptests/smp02/system.h2
-rw-r--r--testsuites/smptests/smp02/tasks.c6
-rw-r--r--testsuites/smptests/smp03/init.c9
-rw-r--r--testsuites/smptests/smp04/init.c13
-rw-r--r--testsuites/smptests/smp05/init.c10
-rw-r--r--testsuites/smptests/smp06/init.c16
-rw-r--r--testsuites/smptests/smp07/init.c10
-rw-r--r--testsuites/smptests/smp08/init.c6
-rw-r--r--testsuites/smptests/smp08/tasks.c4
-rw-r--r--testsuites/smptests/smp09/init.c8
-rw-r--r--testsuites/smptests/smpatomic01/tasks.c4
-rw-r--r--testsuites/smptests/smpatomic02/tasks.c4
-rw-r--r--testsuites/smptests/smpatomic03/tasks.c4
-rw-r--r--testsuites/smptests/smpatomic04/tasks.c4
-rw-r--r--testsuites/smptests/smpatomic05/tasks.c4
-rw-r--r--testsuites/smptests/smpatomic06/tasks.c4
-rw-r--r--testsuites/smptests/smpatomic07/tasks.c4
-rw-r--r--testsuites/smptests/smplock01/init.c12
21 files changed, 78 insertions, 71 deletions
diff --git a/testsuites/smptests/smp01/init.c b/testsuites/smptests/smp01/init.c
index b47f1b4f50..3e12726efc 100644
--- a/testsuites/smptests/smp01/init.c
+++ b/testsuites/smptests/smp01/init.c
@@ -14,6 +14,8 @@
#define CONFIGURE_INIT
#include "system.h"
+#include <inttypes.h>
+
void Loop() {
volatile int i;
@@ -24,14 +26,14 @@ rtems_task Init(
rtems_task_argument argument
)
{
- int i;
+ uint32_t i;
char ch;
- int cpu_self;
+ uint32_t cpu_self;
rtems_id id;
rtems_status_code status;
bool allDone;
- cpu_self = bsp_smp_processor_id();
+ cpu_self = rtems_smp_get_current_processor();
/* XXX - Delay a bit to allow debug messages from
* startup to print. This may need to go away when
@@ -63,7 +65,7 @@ rtems_task Init(
);
directive_failed( status, "task create" );
- locked_printf(" CPU %d start task TA%c\n", cpu_self, ch);
+ locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_self, ch);
status = rtems_task_start( id, Test_task, i+1 );
directive_failed( status, "task start" );
diff --git a/testsuites/smptests/smp01/tasks.c b/testsuites/smptests/smp01/tasks.c
index 1b3b5fb5ef..4eb81f1c98 100644
--- a/testsuites/smptests/smp01/tasks.c
+++ b/testsuites/smptests/smp01/tasks.c
@@ -13,11 +13,13 @@
#include "system.h"
+#include <inttypes.h>
+
rtems_task Test_task(
rtems_task_argument task_index
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -26,11 +28,11 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
Loop();
- locked_printf(" CPU %d running Task %s\n", cpu_num, name);
+ locked_printf(" CPU %" PRIu32 " running Task %s\n", cpu_num, name);
/* Set the flag that the task is up and running */
TaskRan[cpu_num] = true;
diff --git a/testsuites/smptests/smp02/init.c b/testsuites/smptests/smp02/init.c
index a5ad24bdf5..d053b31377 100644
--- a/testsuites/smptests/smp02/init.c
+++ b/testsuites/smptests/smp02/init.c
@@ -15,6 +15,7 @@
#include "system.h"
#include <stdio.h>
+#include <inttypes.h>
rtems_task Init(
rtems_task_argument argument
@@ -22,7 +23,7 @@ rtems_task Init(
{
int i;
char ch;
- int cpu_num;
+ uint32_t cpu_num;
rtems_id id;
rtems_status_code status;
char str[80];
@@ -59,8 +60,8 @@ rtems_task Init(
&id
);
- cpu_num = bsp_smp_processor_id();
- locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+ cpu_num = rtems_smp_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/system.h b/testsuites/smptests/smp02/system.h
index 269c7c0b11..ebe243fd9d 100644
--- a/testsuites/smptests/smp02/system.h
+++ b/testsuites/smptests/smp02/system.h
@@ -50,7 +50,7 @@ rtems_task Test_task(
typedef struct {
bool IsLocked;
- int cpu_num;
+ uint32_t cpu_num;
uint32_t task_index;
} Log_t;
diff --git a/testsuites/smptests/smp02/tasks.c b/testsuites/smptests/smp02/tasks.c
index e3ac062e45..4e7a6255c0 100644
--- a/testsuites/smptests/smp02/tasks.c
+++ b/testsuites/smptests/smp02/tasks.c
@@ -21,7 +21,7 @@ void Loop(void) {
void LogSemaphore(
bool obtained,
- int cpu_num,
+ uint32_t cpu_num,
uint32_t task_index
){
if (Log_index < LOG_SIZE) {
@@ -37,10 +37,10 @@ rtems_task Test_task(
rtems_task_argument task_index
)
{
- int cpu_num;
+ uint32_t cpu_num;
rtems_status_code sc;
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
do {
diff --git a/testsuites/smptests/smp03/init.c b/testsuites/smptests/smp03/init.c
index 47441b3eec..40b7593aef 100644
--- a/testsuites/smptests/smp03/init.c
+++ b/testsuites/smptests/smp03/init.c
@@ -15,6 +15,7 @@
#include "system.h"
#include <stdio.h>
+#include <inttypes.h>
void Loop() {
volatile int i;
@@ -26,18 +27,18 @@ void PrintTaskInfo(
const char *task_name
)
{
- int cpu_num;
+ uint32_t cpu_num;
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
- locked_printf(" CPU %d running task %s\n", cpu_num, task_name );
+ locked_printf(" CPU %" PRIu32 " running task %s\n", cpu_num, task_name );
}
rtems_task Init(
rtems_task_argument argument
)
{
- int i;
+ uint32_t i;
char ch = '0';
rtems_id id;
rtems_status_code status;
diff --git a/testsuites/smptests/smp04/init.c b/testsuites/smptests/smp04/init.c
index a532d4604c..8cbfbb88d9 100644
--- a/testsuites/smptests/smp04/init.c
+++ b/testsuites/smptests/smp04/init.c
@@ -15,6 +15,7 @@
#include "system.h"
#include <stdio.h>
+#include <inttypes.h>
void Loop() {
@@ -27,9 +28,9 @@ rtems_task Test_task(
rtems_task_argument task_index
)
{
- int cpu_num;
+ uint32_t cpu_num;
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
locked_printf(" CPU %d running task TA%" PRIu32 "\n", cpu_num, task_index );
Loop();
TaskRan[task_index] = true;
@@ -41,20 +42,20 @@ rtems_task Init(
rtems_task_argument argument
)
{
- int i;
+ uint32_t i;
char ch;
rtems_id id;
rtems_status_code status;
bool allDone;
- int cpu_num;
+ uint32_t cpu_num;
Loop();
locked_print_initialize();
locked_printf( "\n\n*** SMP04 TEST ***\n" );
/* Display which cpu is running this init thread. */
- cpu_num = bsp_smp_processor_id();
- locked_printf(" CPU %d running task Init\n", cpu_num );
+ cpu_num = rtems_smp_get_current_processor();
+ locked_printf(" CPU %" PRIu32 " running task Init\n", cpu_num );
/* Set all Tasks to not ran except for the init task */
TaskRan[0] = true;
diff --git a/testsuites/smptests/smp05/init.c b/testsuites/smptests/smp05/init.c
index eaa08f5c02..db36e03b4c 100644
--- a/testsuites/smptests/smp05/init.c
+++ b/testsuites/smptests/smp05/init.c
@@ -18,7 +18,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- locked_printf( "Shut down from CPU %d\n", bsp_smp_processor_id() );
+ locked_printf( "Shut down from CPU %" PRIu32 "\n", rtems_smp_get_current_processor() );
locked_printf( "*** END OF TEST SMP05 ***\n" );
rtems_test_exit(0);
}
@@ -27,9 +27,9 @@ rtems_task Init(
rtems_task_argument argument
)
{
- int i;
+ uint32_t i;
char ch;
- int cpu_num;
+ uint32_t cpu_num;
rtems_id id;
rtems_status_code status;
@@ -49,8 +49,8 @@ rtems_task Init(
);
directive_failed( status, "task create" );
- cpu_num = bsp_smp_processor_id();
- locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+ cpu_num = rtems_smp_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, "task start" );
diff --git a/testsuites/smptests/smp06/init.c b/testsuites/smptests/smp06/init.c
index 170479b15d..ae3ca769dd 100644
--- a/testsuites/smptests/smp06/init.c
+++ b/testsuites/smptests/smp06/init.c
@@ -20,15 +20,15 @@ rtems_task Test_task(
rtems_task_argument do_exit
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
p = rtems_object_get_name( RTEMS_SELF, 5, name );
rtems_test_assert( p != NULL );
- cpu_num = bsp_smp_processor_id();
- locked_printf(" CPU %d running Task %s\n", cpu_num, name);
+ cpu_num = rtems_smp_get_current_processor();
+ locked_printf(" CPU %" PRIu32 " running Task %s\n", cpu_num, name);
Ran = true;
@@ -44,7 +44,7 @@ rtems_task Init(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
rtems_id id;
rtems_status_code status;
@@ -56,7 +56,7 @@ rtems_task Init(
rtems_test_assert( rtems_smp_get_processor_count() > 1 );
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/*
* Create a task at equal priority.
@@ -72,7 +72,7 @@ rtems_task Init(
);
directive_failed( status, "task create" );
- locked_printf(" CPU %d start task TA1\n", cpu_num );
+ locked_printf(" CPU %" PRIu32 " start task TA1\n", cpu_num );
status = rtems_task_start( id, Test_task, 0 );
directive_failed( status, "task start" );
@@ -94,8 +94,8 @@ rtems_task Init(
);
directive_failed( status, "task create" );
- cpu_num = bsp_smp_processor_id();
- locked_printf(" CPU %d start task TA2\n", cpu_num );
+ cpu_num = rtems_smp_get_current_processor();
+ locked_printf(" CPU %" PRIu32 " start task TA2\n", cpu_num );
status = rtems_task_start( id, Test_task, 1 );
directive_failed( status, "task start" );
diff --git a/testsuites/smptests/smp07/init.c b/testsuites/smptests/smp07/init.c
index 04bf4f2d59..f6315544b8 100644
--- a/testsuites/smptests/smp07/init.c
+++ b/testsuites/smptests/smp07/init.c
@@ -22,7 +22,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
rtems_status_code sc;
char name[5];
char *p;
@@ -32,10 +32,10 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
- locked_printf(" CPU %d runnng Task %s and blocking\n", cpu_num, name);
+ locked_printf(" CPU %" PRIu32 " runnng Task %s and blocking\n", cpu_num, name);
sc = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
directive_failed( sc,"obtain in test task");
@@ -47,7 +47,7 @@ rtems_task Test_task(
/* Print that the task is up and running. */
locked_printf(
- " CPU %d running Task %s after semaphore release\n",
+ " CPU %" PRIu32 " running Task %s after semaphore release\n",
cpu_num,
name
);
@@ -110,7 +110,7 @@ rtems_task Init(
);
directive_failed( status, "task create" );
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_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 0c7740b32e..897fe98a36 100644
--- a/testsuites/smptests/smp08/init.c
+++ b/testsuites/smptests/smp08/init.c
@@ -19,13 +19,13 @@ void PrintTaskInfo(
rtems_time_of_day *_tb
)
{
- int cpu_num;
+ uint32_t cpu_num;
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print the cpu number and task name */
locked_printf(
- " CPU %d running task %s - rtems_clock_get_tod "
+ " CPU %" PRIu32 " running task %s - rtems_clock_get_tod "
"%02" PRId32 ":%02" PRId32 ":%02" PRId32 " %02" PRId32
"/%02" PRId32 "/%04" PRId32 "\n",
cpu_num,
diff --git a/testsuites/smptests/smp08/tasks.c b/testsuites/smptests/smp08/tasks.c
index 762120c78f..96d25de86e 100644
--- a/testsuites/smptests/smp08/tasks.c
+++ b/testsuites/smptests/smp08/tasks.c
@@ -21,7 +21,7 @@ rtems_task Test_task(
rtems_time_of_day time;
uint32_t task_index;
rtems_status_code status;
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -34,7 +34,7 @@ rtems_task Test_task(
for ( ; ; ) {
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_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 976cb35195..e21ef687ba 100644
--- a/testsuites/smptests/smp09/init.c
+++ b/testsuites/smptests/smp09/init.c
@@ -30,9 +30,9 @@ rtems_task Init(
rtems_task_argument argument
)
{
- int i;
+ uint32_t i;
char ch;
- int cpu_num;
+ uint32_t cpu_num;
rtems_id id;
rtems_status_code status;
@@ -55,8 +55,8 @@ rtems_task Init(
);
directive_failed( status, "task create" );
- cpu_num = bsp_smp_processor_id();
- locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+ cpu_num = rtems_smp_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, "task start" );
diff --git a/testsuites/smptests/smpatomic01/tasks.c b/testsuites/smptests/smpatomic01/tasks.c
index 28afad9d9f..65ad81b0b9 100644
--- a/testsuites/smptests/smpatomic01/tasks.c
+++ b/testsuites/smptests/smpatomic01/tasks.c
@@ -39,7 +39,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -48,7 +48,7 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
/* test relaxed barrier */
diff --git a/testsuites/smptests/smpatomic02/tasks.c b/testsuites/smptests/smpatomic02/tasks.c
index 8ece4610ce..1017befbea 100644
--- a/testsuites/smptests/smpatomic02/tasks.c
+++ b/testsuites/smptests/smpatomic02/tasks.c
@@ -39,7 +39,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -48,7 +48,7 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
/* test relaxed barrier */
diff --git a/testsuites/smptests/smpatomic03/tasks.c b/testsuites/smptests/smpatomic03/tasks.c
index edc9a637ea..b74bd9d247 100644
--- a/testsuites/smptests/smpatomic03/tasks.c
+++ b/testsuites/smptests/smpatomic03/tasks.c
@@ -42,7 +42,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -51,7 +51,7 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
/* test relaxed barrier */
diff --git a/testsuites/smptests/smpatomic04/tasks.c b/testsuites/smptests/smpatomic04/tasks.c
index 9bef84e304..54f0661431 100644
--- a/testsuites/smptests/smpatomic04/tasks.c
+++ b/testsuites/smptests/smpatomic04/tasks.c
@@ -42,7 +42,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -51,7 +51,7 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
/* test relaxed barrier */
diff --git a/testsuites/smptests/smpatomic05/tasks.c b/testsuites/smptests/smpatomic05/tasks.c
index d0447f3465..57a4f8c55e 100644
--- a/testsuites/smptests/smpatomic05/tasks.c
+++ b/testsuites/smptests/smpatomic05/tasks.c
@@ -42,7 +42,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -51,7 +51,7 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
/* test relaxed barrier */
diff --git a/testsuites/smptests/smpatomic06/tasks.c b/testsuites/smptests/smpatomic06/tasks.c
index c368bb9803..a28cffbe3b 100644
--- a/testsuites/smptests/smpatomic06/tasks.c
+++ b/testsuites/smptests/smpatomic06/tasks.c
@@ -42,7 +42,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -51,7 +51,7 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
/* test relaxed barrier */
diff --git a/testsuites/smptests/smpatomic07/tasks.c b/testsuites/smptests/smpatomic07/tasks.c
index 21802d650f..308498a1a4 100644
--- a/testsuites/smptests/smpatomic07/tasks.c
+++ b/testsuites/smptests/smpatomic07/tasks.c
@@ -58,7 +58,7 @@ rtems_task Test_task(
rtems_task_argument argument
)
{
- int cpu_num;
+ uint32_t cpu_num;
char name[5];
char *p;
@@ -67,7 +67,7 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
/* Get the CPU Number */
- cpu_num = bsp_smp_processor_id();
+ cpu_num = rtems_smp_get_current_processor();
/* Print that the task is up and running. */
/* test relaxed barrier */
diff --git a/testsuites/smptests/smplock01/init.c b/testsuites/smptests/smplock01/init.c
index 2fcc507698..ed578cbe21 100644
--- a/testsuites/smptests/smplock01/init.c
+++ b/testsuites/smptests/smplock01/init.c
@@ -298,8 +298,8 @@ static void run_tests(
static void task(rtems_task_argument arg)
{
global_context *ctx = (global_context *) arg;
- int cpu_count = (int) rtems_smp_get_processor_count();
- int cpu_self = rtems_smp_get_current_processor();
+ uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_self = rtems_smp_get_current_processor();
rtems_status_code sc;
barrier_state bs = BARRIER_STATE_INITIALIZER;
@@ -312,9 +312,9 @@ static void task(rtems_task_argument arg)
static void test(void)
{
global_context *ctx = &context;
- int cpu_count = (int) rtems_smp_get_processor_count();
- int cpu_self = rtems_smp_get_current_processor();
- int cpu;
+ uint32_t cpu_count = rtems_smp_get_processor_count();
+ uint32_t cpu_self = rtems_smp_get_current_processor();
+ uint32_t cpu;
int test;
rtems_status_code sc;
barrier_state bs = BARRIER_STATE_INITIALIZER;
@@ -356,7 +356,7 @@ static void test(void)
sum += local_counter;
printf(
- "\tprocessor %i, local counter %lu\n",
+ "\tprocessor %" PRIu32 ", local counter %lu\n",
cpu,
local_counter
);