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.
This commit is contained in:
Sebastian Huber
2014-04-10 11:02:52 +02:00
parent 4bc8d2e717
commit cb5eaddf95
23 changed files with 62 additions and 38 deletions

View File

@@ -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 ) {

View File

@@ -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;

View File

@@ -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

View File

@@ -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);
/** @} */

View File

@@ -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_current_processor(void)
{
return _SMP_Get_current_processor();
}

View File

@@ -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,

View File

@@ -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

View File

@@ -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();

View File

@@ -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 );

View File

@@ -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 {

View File

@@ -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 );
}

View File

@@ -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 );

View File

@@ -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" );

View File

@@ -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(

View File

@@ -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 ) {

View File

@@ -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 );

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);