mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-24 18:13:51 +08:00
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.
This commit is contained in:
@@ -20,11 +20,6 @@
|
||||
|
||||
#include <bsp/irq.h>
|
||||
|
||||
int bsp_smp_processor_id(void)
|
||||
{
|
||||
return (int) arm_cortex_a9_get_multiprocessor_cpu_id();
|
||||
}
|
||||
|
||||
static void ipi_handler(void *arg)
|
||||
{
|
||||
rtems_smp_process_interrupt();
|
||||
|
||||
@@ -100,7 +100,7 @@ SYM (_ISR_Handler):
|
||||
movl esp, ebp /* ebp = previous stack pointer */
|
||||
#if defined(RTEMS_SMP) && defined(BSP_HAS_SMP)
|
||||
movl $SYM(_Per_CPU_Information_p), ebx
|
||||
call SYM(bsp_smp_processor_id)
|
||||
call SYM(_CPU_SMP_Get_current_processor)
|
||||
mov (ebx,eax,4), ebx
|
||||
pushl ecx
|
||||
call SYM(_ISR_SMP_Enter)
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <rtems/score/cpu.h>
|
||||
|
||||
#include <bsp/apic.h>
|
||||
#include <bsp/smp-imps.h>
|
||||
|
||||
static int lapic_dummy = 0;
|
||||
unsigned imps_lapic_addr = ((unsigned)(&lapic_dummy)) - LAPIC_ID;
|
||||
|
||||
int bsp_smp_processor_id(void)
|
||||
uint32_t _CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
return APIC_ID(IMPS_LAPIC_READ(LAPIC_ID));
|
||||
}
|
||||
|
||||
@@ -43,11 +43,6 @@ void _start_core_1(void);
|
||||
|
||||
#define TLB_COUNT (TLB_END - TLB_BEGIN)
|
||||
|
||||
int bsp_smp_processor_id(void)
|
||||
{
|
||||
return (int) ppc_processor_id();
|
||||
}
|
||||
|
||||
/*
|
||||
* These values can be obtained with the debugger or a look into the
|
||||
* U-Boot sources (arch/powerpc/cpu/mpc85xx/release.S).
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
int bsp_smp_processor_id(void)
|
||||
#include <rtems/score/cpu.h>
|
||||
|
||||
uint32_t _CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
int bsp_smp_processor_id(void)
|
||||
#include <rtems/score/cpu.h>
|
||||
|
||||
uint32_t _CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
unsigned int id;
|
||||
uint32_t id;
|
||||
__asm__ __volatile__( "rd %%asr17,%0\n\t" : "=r" (id) : );
|
||||
|
||||
return ((id >> 28) & 0xff);
|
||||
|
||||
@@ -43,7 +43,7 @@ static rtems_isr bsp_ap_ipi_isr(
|
||||
|
||||
static void leon3_secondary_cpu_initialize(void)
|
||||
{
|
||||
int cpu = bsp_smp_processor_id();
|
||||
uint32_t cpu = rtems_smp_get_current_processor();
|
||||
|
||||
sparc_leon3_set_cctrl( 0x80000F );
|
||||
LEON_Unmask_interrupt(LEON3_MP_IRQ);
|
||||
@@ -125,11 +125,11 @@ void bsp_smp_interrupt_cpu(
|
||||
|
||||
void bsp_smp_broadcast_interrupt(void)
|
||||
{
|
||||
int dest_cpu;
|
||||
int cpu;
|
||||
int max_cpus;
|
||||
uint32_t dest_cpu;
|
||||
uint32_t cpu;
|
||||
uint32_t max_cpus;
|
||||
|
||||
cpu = bsp_smp_processor_id();
|
||||
cpu = rtems_smp_get_current_processor();
|
||||
max_cpus = rtems_smp_get_processor_count();
|
||||
|
||||
for ( dest_cpu=0 ; dest_cpu < max_cpus ; dest_cpu++ ) {
|
||||
|
||||
@@ -75,7 +75,6 @@ extern "C" {
|
||||
#endif
|
||||
#include <rtems/rtems/smp.h>
|
||||
|
||||
|
||||
#include <rtems/rtems/support.h>
|
||||
#include <rtems/score/sysstate.h>
|
||||
|
||||
|
||||
@@ -55,14 +55,25 @@ extern "C" {
|
||||
_SMP_Get_processor_count()
|
||||
|
||||
/**
|
||||
* @brief Obtain Current Core Number
|
||||
* @brief Returns the index of the current processor.
|
||||
*
|
||||
* This method returns the id of the current CPU core.
|
||||
* On uni-processor configurations this is a compile time constant and defined
|
||||
* to be zero.
|
||||
*
|
||||
* @retval This method returns the id of the current CPU core.
|
||||
* 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
|
||||
* is the range of integers starting with zero up to the processor count minus
|
||||
* one.
|
||||
*
|
||||
* Outside of sections with disabled thread dispatching the current processor
|
||||
* index may change after every instruction since the thread may migrate from
|
||||
* one processor to another. Sections with disabled interrupts are sections
|
||||
* with thread dispatching disabled.
|
||||
*
|
||||
* @return The index of the current processor.
|
||||
*/
|
||||
#define rtems_smp_get_current_processor() \
|
||||
bsp_smp_processor_id()
|
||||
_SMP_Get_current_processor()
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -443,6 +443,20 @@ void _CPU_Context_validate( uintptr_t pattern );
|
||||
#define _CPU_Context_switch_to_first_task_smp( _context ) \
|
||||
_CPU_Context_restore( _context )
|
||||
|
||||
RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
|
||||
_CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
uint32_t mpidr;
|
||||
|
||||
/* Use ARMv7 Multiprocessor Affinity Register (MPIDR) */
|
||||
__asm__ volatile (
|
||||
"mrc p15, 0, %[mpidr], c0, c0, 5\n"
|
||||
: [mpidr] "=&r" (mpidr)
|
||||
);
|
||||
|
||||
return mpidr & 0xffU;
|
||||
}
|
||||
|
||||
static inline void _ARM_Data_memory_barrier( void )
|
||||
{
|
||||
__asm__ volatile ( "dmb" : : : "memory" );
|
||||
|
||||
@@ -455,6 +455,8 @@ uint32_t _CPU_ISR_Get_level( void );
|
||||
#define _CPU_Context_switch_to_first_task_smp( _the_context ) \
|
||||
_CPU_Context_restore( (_the_context) );
|
||||
|
||||
RTEMS_COMPILER_PURE_ATTRIBUTE uint32_t _CPU_SMP_Get_current_processor( void );
|
||||
|
||||
static inline void _CPU_Processor_event_broadcast( void )
|
||||
{
|
||||
__asm__ volatile ( "" : : : "memory" );
|
||||
|
||||
@@ -1403,6 +1403,19 @@ static inline uint32_t CPU_swap_u32(
|
||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||
|
||||
#ifdef RTEMS_SMP
|
||||
/**
|
||||
* @brief Returns the index of the current processor.
|
||||
*
|
||||
* An architecture specific method must be used to obtain the index of the
|
||||
* current processor in the system. The set of processor indices is the
|
||||
* range of integers starting with zero up to the processor count minus one.
|
||||
*/
|
||||
RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
|
||||
_CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
return 123;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Broadcasts a processor event.
|
||||
*
|
||||
|
||||
@@ -1000,6 +1000,21 @@ void _CPU_Context_validate( uintptr_t pattern );
|
||||
#define _CPU_Context_switch_to_first_task_smp( _context ) \
|
||||
_CPU_Context_restore( _context )
|
||||
|
||||
RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
|
||||
_CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
uint32_t pir;
|
||||
|
||||
/* Use Book E Processor ID Register (PIR) */
|
||||
__asm__ volatile (
|
||||
"mfspr %[pir], 286"
|
||||
: [pir] "=&r" (pir)
|
||||
);
|
||||
|
||||
return pir;
|
||||
}
|
||||
|
||||
|
||||
static inline void _CPU_Processor_event_broadcast( void )
|
||||
{
|
||||
__asm__ volatile ( "" : : : "memory" );
|
||||
|
||||
@@ -1186,6 +1186,8 @@ void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
);
|
||||
|
||||
RTEMS_COMPILER_PURE_ATTRIBUTE uint32_t _CPU_SMP_Get_current_processor( void );
|
||||
|
||||
static inline void _CPU_Processor_event_broadcast( void )
|
||||
{
|
||||
__asm__ volatile ( "" : : : "memory" );
|
||||
|
||||
@@ -69,16 +69,6 @@ extern "C" {
|
||||
*/
|
||||
uint32_t bsp_smp_initialize( uint32_t configured_cpu_count );
|
||||
|
||||
/**
|
||||
* @brief Obtain current CPU index.
|
||||
*
|
||||
* This method is invoked by RTEMS when it needs to know the index
|
||||
* of the CPU it is executing on.
|
||||
*
|
||||
* @retval This method returns the current CPU index.
|
||||
*/
|
||||
int bsp_smp_processor_id(void) RTEMS_COMPILER_PURE_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
* @brief Generate an interprocessor broadcast interrupt.
|
||||
*
|
||||
@@ -105,19 +95,6 @@ void bsp_smp_interrupt_cpu(
|
||||
int cpu
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Obtain CPU core number.
|
||||
*
|
||||
* This method is invoked by RTEMS when it needs to know which core
|
||||
* number it is executing on. This is used when it needs to perform
|
||||
* some action or bookkeeping and needs to distinguish itself from
|
||||
* the other cores. For example, it may need to realize it needs to
|
||||
* preempt a thread on another node.
|
||||
*
|
||||
* @retval This method returns the Id of the current CPU core.
|
||||
*/
|
||||
int bsp_smp_processor_id( void );
|
||||
|
||||
/**
|
||||
* @brief Performs high-level initialization of a secondary processor and runs
|
||||
* the application threads.
|
||||
@@ -156,8 +133,6 @@ void rtems_smp_process_interrupt(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define bsp_smp_processor_id() 0
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
|
||||
@@ -25,12 +25,7 @@
|
||||
#include <rtems/score/isrlevel.h>
|
||||
#include <rtems/score/timestamp.h>
|
||||
#include <rtems/score/smplock.h>
|
||||
|
||||
/*
|
||||
* NOTE: This file MUST be included on non-smp systems as well
|
||||
* in order to define bsp_smp_processor_id.
|
||||
*/
|
||||
#include <rtems/bspsmp.h>
|
||||
#include <rtems/score/smp.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -277,23 +272,23 @@ void _Per_CPU_Wait_for_state(
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On a non SMP system, the bsp_smp_processor_id is defined to 0.
|
||||
* On a non SMP system, the _SMP_Get_current_processor() is defined to 0.
|
||||
* Thus when built for non-SMP, there should be no performance penalty.
|
||||
*/
|
||||
#define _Thread_Heir \
|
||||
_Per_CPU_Information[bsp_smp_processor_id()].heir
|
||||
_Per_CPU_Information[_SMP_Get_current_processor()].heir
|
||||
#define _Thread_Executing \
|
||||
_Per_CPU_Information[bsp_smp_processor_id()].executing
|
||||
_Per_CPU_Information[_SMP_Get_current_processor()].executing
|
||||
#define _ISR_Nest_level \
|
||||
_Per_CPU_Information[bsp_smp_processor_id()].isr_nest_level
|
||||
_Per_CPU_Information[_SMP_Get_current_processor()].isr_nest_level
|
||||
#define _CPU_Interrupt_stack_low \
|
||||
_Per_CPU_Information[bsp_smp_processor_id()].interrupt_stack_low
|
||||
_Per_CPU_Information[_SMP_Get_current_processor()].interrupt_stack_low
|
||||
#define _CPU_Interrupt_stack_high \
|
||||
_Per_CPU_Information[bsp_smp_processor_id()].interrupt_stack_high
|
||||
_Per_CPU_Information[_SMP_Get_current_processor()].interrupt_stack_high
|
||||
#define _Thread_Dispatch_necessary \
|
||||
_Per_CPU_Information[bsp_smp_processor_id()].dispatch_necessary
|
||||
_Per_CPU_Information[_SMP_Get_current_processor()].dispatch_necessary
|
||||
#define _Thread_Time_of_last_context_switch \
|
||||
_Per_CPU_Information[bsp_smp_processor_id()].time_of_last_context_switch
|
||||
_Per_CPU_Information[_SMP_Get_current_processor()].time_of_last_context_switch
|
||||
|
||||
#endif /* ASM */
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ extern "C" {
|
||||
* @param[in] cpu The target processor of the message.
|
||||
* @param[in] message The message.
|
||||
*/
|
||||
void _SMP_Send_message( int cpu, uint32_t message );
|
||||
void _SMP_Send_message( uint32_t cpu, uint32_t message );
|
||||
|
||||
/**
|
||||
* @brief Request of others CPUs.
|
||||
@@ -116,6 +116,16 @@ void _SMP_Request_other_cores_to_shutdown(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
#if defined( RTEMS_SMP )
|
||||
RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
|
||||
_SMP_Get_current_processor( void )
|
||||
{
|
||||
return _CPU_SMP_Get_current_processor();
|
||||
}
|
||||
#else
|
||||
#define _SMP_Get_current_processor() ( ( uint32_t ) 0 )
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -62,8 +62,8 @@ RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_is_enabled(void)
|
||||
#if defined(RTEMS_SMP)
|
||||
typedef struct {
|
||||
SMP_lock_Control lock;
|
||||
int owner_cpu;
|
||||
int nest_level;
|
||||
uint32_t owner_cpu;
|
||||
uint32_t nest_level;
|
||||
} Thread_Dispatch_disable_level_lock_control;
|
||||
|
||||
/**
|
||||
|
||||
+15
-15
@@ -30,7 +30,7 @@
|
||||
|
||||
void rtems_smp_secondary_cpu_initialize( void )
|
||||
{
|
||||
int self = bsp_smp_processor_id();
|
||||
uint32_t self = _SMP_Get_current_processor();
|
||||
Per_CPU_Control *per_cpu = &_Per_CPU_Information[ self ];
|
||||
Thread_Control *heir;
|
||||
|
||||
@@ -67,7 +67,7 @@ void rtems_smp_secondary_cpu_initialize( void )
|
||||
|
||||
void rtems_smp_process_interrupt( void )
|
||||
{
|
||||
int self = bsp_smp_processor_id();
|
||||
uint32_t self = _SMP_Get_current_processor();
|
||||
Per_CPU_Control *per_cpu = &_Per_CPU_Information[ self ];
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ void rtems_smp_process_interrupt( void )
|
||||
}
|
||||
}
|
||||
|
||||
void _SMP_Send_message( int cpu, uint32_t message )
|
||||
void _SMP_Send_message( uint32_t cpu, uint32_t message )
|
||||
{
|
||||
Per_CPU_Control *per_cpu = &_Per_CPU_Information[ cpu ];
|
||||
ISR_Level level;
|
||||
@@ -126,9 +126,9 @@ void _SMP_Send_message( int cpu, uint32_t message )
|
||||
|
||||
void _SMP_Broadcast_message( uint32_t message )
|
||||
{
|
||||
int self = bsp_smp_processor_id();
|
||||
int ncpus = _SMP_Get_processor_count();
|
||||
int cpu;
|
||||
uint32_t self = _SMP_Get_current_processor();
|
||||
uint32_t ncpus = _SMP_Get_processor_count();
|
||||
uint32_t cpu;
|
||||
|
||||
for ( cpu = 0 ; cpu < ncpus ; ++cpu ) {
|
||||
if ( cpu != self ) {
|
||||
@@ -146,9 +146,9 @@ void _SMP_Broadcast_message( uint32_t message )
|
||||
|
||||
void _SMP_Request_other_cores_to_perform_first_context_switch( void )
|
||||
{
|
||||
int self = bsp_smp_processor_id();
|
||||
int ncpus = _SMP_Get_processor_count();
|
||||
int cpu;
|
||||
uint32_t self = _SMP_Get_current_processor();
|
||||
uint32_t ncpus = _SMP_Get_processor_count();
|
||||
uint32_t cpu;
|
||||
|
||||
for ( cpu = 0 ; cpu < ncpus ; ++cpu ) {
|
||||
Per_CPU_Control *per_cpu = &_Per_CPU_Information[ cpu ];
|
||||
@@ -165,9 +165,9 @@ void _SMP_Request_other_cores_to_perform_first_context_switch( void )
|
||||
void _SMP_Request_other_cores_to_dispatch( void )
|
||||
{
|
||||
if ( _System_state_Is_up( _System_state_Get() ) ) {
|
||||
int self = bsp_smp_processor_id();
|
||||
int ncpus = _SMP_Get_processor_count();
|
||||
int cpu;
|
||||
uint32_t self = _SMP_Get_current_processor();
|
||||
uint32_t ncpus = _SMP_Get_processor_count();
|
||||
uint32_t cpu;
|
||||
|
||||
for ( cpu = 0 ; cpu < ncpus ; ++cpu ) {
|
||||
const Per_CPU_Control *per_cpu = &_Per_CPU_Information[ cpu ];
|
||||
@@ -185,9 +185,9 @@ void _SMP_Request_other_cores_to_dispatch( void )
|
||||
|
||||
void _SMP_Request_other_cores_to_shutdown( void )
|
||||
{
|
||||
int self = bsp_smp_processor_id();
|
||||
int ncpus = _SMP_Get_processor_count();
|
||||
int cpu;
|
||||
uint32_t self = _SMP_Get_current_processor();
|
||||
uint32_t ncpus = _SMP_Get_processor_count();
|
||||
uint32_t cpu;
|
||||
|
||||
_SMP_Broadcast_message( RTEMS_BSP_SMP_SHUTDOWN );
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <rtems/score/sysstate.h>
|
||||
#include <rtems/score/threaddispatch.h>
|
||||
|
||||
#define NO_OWNER_CPU (-1)
|
||||
#define NO_OWNER_CPU 0xffffffffU
|
||||
|
||||
void _Thread_Dispatch_initialization( void )
|
||||
{
|
||||
@@ -48,8 +48,8 @@ uint32_t _Thread_Dispatch_increment_disable_level( void )
|
||||
{
|
||||
Thread_Dispatch_disable_level_lock_control *level_lock =
|
||||
&_Thread_Dispatch_disable_level_lock;
|
||||
int self_cpu;
|
||||
ISR_Level isr_level;
|
||||
uint32_t self_cpu;
|
||||
uint32_t disable_level;
|
||||
|
||||
_ISR_Disable_on_this_core( isr_level );
|
||||
@@ -58,7 +58,7 @@ uint32_t _Thread_Dispatch_increment_disable_level( void )
|
||||
* We must obtain the processor ID after interrupts are disabled since a
|
||||
* non-optimizing compiler may store the value on the stack and read it back.
|
||||
*/
|
||||
self_cpu = bsp_smp_processor_id();
|
||||
self_cpu = _SMP_Get_current_processor();
|
||||
|
||||
if ( level_lock->owner_cpu != self_cpu ) {
|
||||
_SMP_lock_Acquire( &level_lock->lock );
|
||||
|
||||
@@ -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" );
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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" );
|
||||
|
||||
@@ -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" );
|
||||
|
||||
@@ -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" );
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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" );
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user