[rtems commit] score: Simplify _Thread_Create_idle()
Sebastian Huber
sebh at rtems.org
Fri Jun 14 14:22:56 UTC 2013
Module: rtems
Branch: master
Commit: 477259c4ed32965047ff942c1d068a2a9dd7bf52
Changeset: http://git.rtems.org/rtems/commit/?id=477259c4ed32965047ff942c1d068a2a9dd7bf52
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Jun 12 17:06:51 2013 +0200
score: Simplify _Thread_Create_idle()
---
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 f90db79..7ad24cf 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 );
+ }
}
More information about the vc
mailing list