diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-12 17:06:51 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-14 16:26:07 +0200 |
commit | 477259c4ed32965047ff942c1d068a2a9dd7bf52 (patch) | |
tree | 2c3314207cb573c3c051f92539ce4fc78c85559f /cpukit/score/src | |
parent | score: Rename rtems_smp_get_number_of_processors() (diff) | |
download | rtems-477259c4ed32965047ff942c1d068a2a9dd7bf52.tar.bz2 |
score: Simplify _Thread_Create_idle()
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/src/threadcreateidle.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c index f90db795bf..7ad24cfdb3 100644 --- a/cpukit/score/src/threadcreateidle.c +++ b/cpukit/score/src/threadcreateidle.c @@ -25,27 +25,20 @@ #include <rtems/score/isr.h> #include <rtems/score/object.h> #include <rtems/score/priority.h> +#include <rtems/score/smp.h> #include <rtems/score/states.h> #include <rtems/score/sysstate.h> #include <rtems/score/thread.h> #include <rtems/score/threadq.h> #include <rtems/score/wkspace.h> #include <rtems/config.h> -#if defined(RTEMS_SMP) - #include <rtems/score/smp.h> -#endif -static inline void _Thread_Create_idle_helper( - uint32_t name_u32, - int cpu -) +static void _Thread_Create_idle_for_cpu( Per_CPU_Control *per_cpu ) { - Per_CPU_Control *per_cpu; - Objects_Name name; - Thread_Control *idle; + Objects_Name name; + Thread_Control *idle; - per_cpu = &_Per_CPU_Information[ cpu ]; - name.name_u32 = name_u32; + name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' ); /* * The entire workspace is zeroed during its initialization. Thus, all @@ -86,16 +79,12 @@ static inline void _Thread_Create_idle_helper( void _Thread_Create_idle( void ) { - #if defined(RTEMS_SMP) - int cpu; + uint32_t processor_count = _SMP_Get_processor_count(); + uint32_t processor; + + for ( processor = 0 ; processor < processor_count ; ++processor ) { + Per_CPU_Control *per_cpu = &_Per_CPU_Information[ processor ]; - for ( cpu=0 ; cpu < _SMP_Get_processor_count() ; cpu++ ) { - _Thread_Create_idle_helper( - _Objects_Build_name( 'I', 'D', 'L', 'E' ), - cpu - ); - } - #else - _Thread_Create_idle_helper(_Objects_Build_name( 'I', 'D', 'L', 'E' ), 0); - #endif + _Thread_Create_idle_for_cpu( per_cpu ); + } } |