forked from Imagelibrary/rtems
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:
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
void bsp_reset(void)
|
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;
|
volatile uint32_t *mpumodrst = ALT_RSTMGR_MPUMODRST_ADDR;
|
||||||
|
|
||||||
if( self_cpu == 0 ) {
|
if( self_cpu == 0 ) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
void bsp_reset(void)
|
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) {
|
if (self_cpu == 0) {
|
||||||
volatile struct irqmp_regs *irqmp = LEON3_IrqCtrl_Regs;
|
volatile struct irqmp_regs *irqmp = LEON3_IrqCtrl_Regs;
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ librtems_a_SOURCES += src/modes.c
|
|||||||
librtems_a_SOURCES += src/status.c
|
librtems_a_SOURCES += src/status.c
|
||||||
librtems_a_SOURCES += src/statustext.c
|
librtems_a_SOURCES += src/statustext.c
|
||||||
|
|
||||||
|
librtems_a_SOURCES += src/getcurrentprocessor.c
|
||||||
librtems_a_SOURCES += src/getprocessorcount.c
|
librtems_a_SOURCES += src/getprocessorcount.c
|
||||||
|
|
||||||
if HAS_MP
|
if HAS_MP
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
#ifndef _RTEMS_RTEMS_SMP_H
|
#ifndef _RTEMS_RTEMS_SMP_H
|
||||||
#define _RTEMS_RTEMS_SMP_H
|
#define _RTEMS_RTEMS_SMP_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <rtems/score/smp.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup ClassicSMP SMP Services
|
* @defgroup ClassicSMP SMP Services
|
||||||
*
|
*
|
||||||
@@ -55,8 +55,7 @@ uint32_t rtems_get_processor_count(void);
|
|||||||
/**
|
/**
|
||||||
* @brief Returns the index of the current processor.
|
* @brief Returns the index of the current processor.
|
||||||
*
|
*
|
||||||
* On uni-processor configurations this is a compile time constant and defined
|
* On uni-processor configurations a value of zero will be returned.
|
||||||
* to be zero.
|
|
||||||
*
|
*
|
||||||
* On SMP configurations an architecture specific method is used to obtain the
|
* 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
|
* 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.
|
* @return The index of the current processor.
|
||||||
*/
|
*/
|
||||||
#define rtems_smp_get_current_processor() \
|
uint32_t rtems_get_current_processor(void);
|
||||||
_SMP_Get_current_processor()
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
25
cpukit/rtems/src/getcurrentprocessor.c
Normal file
25
cpukit/rtems/src/getcurrentprocessor.c
Normal 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();
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ void rtems_test_fatal_extension(
|
|||||||
(void) is_internal;
|
(void) is_internal;
|
||||||
(void) code;
|
(void) code;
|
||||||
|
|
||||||
if (rtems_smp_get_current_processor() == 0) {
|
if (rtems_get_current_processor() == 0) {
|
||||||
rtems_profiling_report_xml(
|
rtems_profiling_report_xml(
|
||||||
rtems_test_name,
|
rtems_test_name,
|
||||||
printk_plugin,
|
printk_plugin,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ rtems_task Init(
|
|||||||
rtems_status_code status;
|
rtems_status_code status;
|
||||||
bool allDone;
|
bool allDone;
|
||||||
|
|
||||||
cpu_self = rtems_smp_get_current_processor();
|
cpu_self = rtems_get_current_processor();
|
||||||
|
|
||||||
/* XXX - Delay a bit to allow debug messages from
|
/* XXX - Delay a bit to allow debug messages from
|
||||||
* startup to print. This may need to go away when
|
* startup to print. This may need to go away when
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ rtems_task Test_task(
|
|||||||
rtems_test_assert( p != NULL );
|
rtems_test_assert( p != NULL );
|
||||||
|
|
||||||
/* Get the CPU Number */
|
/* 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. */
|
/* Print that the task is up and running. */
|
||||||
Loop();
|
Loop();
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ rtems_task Init(
|
|||||||
&id
|
&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);
|
locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
|
||||||
status = rtems_task_start( id, Test_task, i+1 );
|
status = rtems_task_start( id, Test_task, i+1 );
|
||||||
directive_failed( status, str );
|
directive_failed( status, str );
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ rtems_task Test_task(
|
|||||||
uint32_t cpu_num;
|
uint32_t cpu_num;
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
|
|
||||||
cpu_num = rtems_smp_get_current_processor();
|
cpu_num = rtems_get_current_processor();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void PrintTaskInfo(
|
|||||||
{
|
{
|
||||||
uint32_t cpu_num;
|
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 );
|
locked_printf(" CPU %" PRIu32 " running task %s\n", cpu_num, task_name );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ rtems_task Test_task(
|
|||||||
rtems_task_argument argument
|
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();
|
success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ rtems_task Init(
|
|||||||
);
|
);
|
||||||
directive_failed( status, "task create" );
|
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);
|
locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
|
||||||
|
|
||||||
status = rtems_task_start( id, Test_task, i+1 );
|
status = rtems_task_start( id, Test_task, i+1 );
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ rtems_task Test_task(
|
|||||||
rtems_test_assert( p != NULL );
|
rtems_test_assert( p != NULL );
|
||||||
|
|
||||||
/* Get the CPU Number */
|
/* 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. */
|
/* Print that the task is up and running. */
|
||||||
locked_printf(" CPU %" PRIu32 " runnng Task %s and blocking\n", cpu_num, name);
|
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" );
|
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 );
|
locked_printf(" CPU %d start task TA1\n", cpu_num );
|
||||||
status = rtems_task_start( id, Test_task, 1 );
|
status = rtems_task_start( id, Test_task, 1 );
|
||||||
directive_failed( status, "task start" );
|
directive_failed( status, "task start" );
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ void PrintTaskInfo(
|
|||||||
{
|
{
|
||||||
uint32_t cpu_num;
|
uint32_t cpu_num;
|
||||||
|
|
||||||
cpu_num = rtems_smp_get_current_processor();
|
cpu_num = rtems_get_current_processor();
|
||||||
|
|
||||||
/* Print the cpu number and task name */
|
/* Print the cpu number and task name */
|
||||||
locked_printf(
|
locked_printf(
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ rtems_task Test_task(
|
|||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
|
|
||||||
/* Get the CPU Number */
|
/* Get the CPU Number */
|
||||||
cpu_num = rtems_smp_get_current_processor();
|
cpu_num = rtems_get_current_processor();
|
||||||
|
|
||||||
status = rtems_clock_get_tod( &time );
|
status = rtems_clock_get_tod( &time );
|
||||||
if ( time.second >= 35 ) {
|
if ( time.second >= 35 ) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ rtems_task Init(
|
|||||||
);
|
);
|
||||||
directive_failed( status, "task create" );
|
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);
|
locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
|
||||||
|
|
||||||
status = rtems_task_start( id, Test_task, i+1 );
|
status = rtems_task_start( id, Test_task, i+1 );
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ static void fatal_extension(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (source == RTEMS_FATAL_SOURCE_SMP) {
|
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(!is_internal);
|
||||||
assert(code == SMP_FATAL_SHUTDOWN);
|
assert(code == SMP_FATAL_SHUTDOWN);
|
||||||
@@ -68,7 +68,7 @@ static rtems_status_code test_driver_init(
|
|||||||
void *arg
|
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_count = rtems_get_processor_count();
|
||||||
uint32_t cpu;
|
uint32_t cpu;
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ static void fatal_extension(
|
|||||||
source == RTEMS_FATAL_SOURCE_APPLICATION
|
source == RTEMS_FATAL_SOURCE_APPLICATION
|
||||||
|| source == RTEMS_FATAL_SOURCE_SMP
|
|| source == RTEMS_FATAL_SOURCE_SMP
|
||||||
) {
|
) {
|
||||||
uint32_t self = rtems_smp_get_current_processor();
|
uint32_t self = rtems_get_current_processor();
|
||||||
|
|
||||||
assert(!is_internal);
|
assert(!is_internal);
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ static rtems_status_code test_driver_init(
|
|||||||
void *arg
|
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_count = rtems_get_processor_count();
|
||||||
uint32_t cpu;
|
uint32_t cpu;
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static void wait_for_giant(void)
|
|||||||
|
|
||||||
static void Init(rtems_task_argument arg)
|
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();
|
uint32_t cpu_count = rtems_get_processor_count();
|
||||||
|
|
||||||
rtems_test_begink();
|
rtems_test_begink();
|
||||||
@@ -108,7 +108,7 @@ static void fatal_extension(
|
|||||||
source == RTEMS_FATAL_SOURCE_APPLICATION
|
source == RTEMS_FATAL_SOURCE_APPLICATION
|
||||||
|| source == RTEMS_FATAL_SOURCE_SMP
|
|| 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;
|
SMP_barrier_State state = SMP_BARRIER_STATE_INITIALIZER;
|
||||||
|
|
||||||
assert(!is_internal);
|
assert(!is_internal);
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ static void task(rtems_task_argument arg)
|
|||||||
{
|
{
|
||||||
global_context *ctx = (global_context *) arg;
|
global_context *ctx = (global_context *) arg;
|
||||||
uint32_t cpu_count = rtems_get_processor_count();
|
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;
|
rtems_status_code sc;
|
||||||
SMP_barrier_State bs = SMP_BARRIER_STATE_INITIALIZER;
|
SMP_barrier_State bs = SMP_BARRIER_STATE_INITIALIZER;
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ static void test(void)
|
|||||||
{
|
{
|
||||||
global_context *ctx = &context;
|
global_context *ctx = &context;
|
||||||
uint32_t cpu_count = rtems_get_processor_count();
|
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;
|
uint32_t cpu;
|
||||||
int test;
|
int test;
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ static void runner(rtems_task_argument self)
|
|||||||
test_counters *next_counters = &ctx->counters[next];
|
test_counters *next_counters = &ctx->counters[next];
|
||||||
|
|
||||||
while (true) {
|
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;
|
++counters->cycles_per_cpu[current_cpu].counter;
|
||||||
|
|
||||||
|
|||||||
@@ -82,14 +82,14 @@ static void signal_send(test_context *ctx, test_state new_state)
|
|||||||
static void check_consumer_processor(const test_context *ctx)
|
static void check_consumer_processor(const test_context *ctx)
|
||||||
{
|
{
|
||||||
rtems_test_assert(
|
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)
|
static void check_producer_processor(const test_context *ctx)
|
||||||
{
|
{
|
||||||
rtems_test_assert(
|
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;
|
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);
|
rtems_test_assert(ctx->consumer_processor != ctx->producer_processor);
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ static void test(void)
|
|||||||
void *producer_status;
|
void *producer_status;
|
||||||
|
|
||||||
ctx->consumer = pthread_self();
|
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));
|
memset(&new_action, 0, sizeof(new_action));
|
||||||
new_action.sa_handler = signal_handler;
|
new_action.sa_handler = signal_handler;
|
||||||
|
|||||||
@@ -86,14 +86,14 @@ static void signal_send(test_context *ctx, test_state new_state)
|
|||||||
static void check_consumer_processor(const test_context *ctx)
|
static void check_consumer_processor(const test_context *ctx)
|
||||||
{
|
{
|
||||||
rtems_test_assert(
|
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)
|
static void check_producer_processor(const test_context *ctx)
|
||||||
{
|
{
|
||||||
rtems_test_assert(
|
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;
|
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);
|
rtems_test_assert(ctx->consumer_processor != ctx->producer_processor);
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ static void test(void)
|
|||||||
rtems_mode mode;
|
rtems_mode mode;
|
||||||
|
|
||||||
ctx->consumer = rtems_task_self();
|
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);
|
sc = rtems_signal_catch(signal_handler, RTEMS_DEFAULT_MODES);
|
||||||
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
|
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
|
||||||
|
|||||||
Reference in New Issue
Block a user