change log for rtems (2011-06-28)

rtems-vc at rtems.org rtems-vc at rtems.org
Tue Jun 28 21:11:27 UTC 2011


 *joel*:
2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
		Jennifer Averett <jennifer.averett at OARcorp.com>

	PR 1801/bsps
	* Makefile.am, include/leon.h: Add SMP support to LEON3 BSP.
	* smp/getcpuid.c, smp/smp_leon3.c: New files.

M  1.107  c/src/lib/libbsp/sparc/leon3/ChangeLog
M   1.35  c/src/lib/libbsp/sparc/leon3/Makefile.am
M   1.10  c/src/lib/libbsp/sparc/leon3/include/leon.h
A    1.1  c/src/lib/libbsp/sparc/leon3/smp/getcpuid.c
A    1.1  c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c

diff -u rtems/c/src/lib/libbsp/sparc/leon3/ChangeLog:1.106 rtems/c/src/lib/libbsp/sparc/leon3/ChangeLog:1.107
--- rtems/c/src/lib/libbsp/sparc/leon3/ChangeLog:1.106	Sun Jun 19 01:49:20 2011
+++ rtems/c/src/lib/libbsp/sparc/leon3/ChangeLog	Tue Jun 28 15:29:10 2011
@@ -1,3 +1,10 @@
+2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
+		Jennifer Averett <jennifer.averett at OARcorp.com>
+
+	PR 1801/bsps
+	* Makefile.am, include/leon.h: Add SMP support to LEON3 BSP.
+	* smp/getcpuid.c, smp/smp_leon3.c: New files.
+
 2011-06-19	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* Makefile.am: Fix broken path to clockdrv_shell.h.

diff -u rtems/c/src/lib/libbsp/sparc/leon3/Makefile.am:1.34 rtems/c/src/lib/libbsp/sparc/leon3/Makefile.am:1.35
--- rtems/c/src/lib/libbsp/sparc/leon3/Makefile.am:1.34	Sun Jun 19 01:49:20 2011
+++ rtems/c/src/lib/libbsp/sparc/leon3/Makefile.am	Tue Jun 28 15:29:10 2011
@@ -91,8 +91,8 @@
 libbsp_a_SOURCES += timer/timer.c
 
 if HAS_SMP
-libbsp_a_SOURCES += ../../shared/smp/getcpuid.c ../../shared/smp/smp_stub.c \
-    ../../shared/smp/bspsmp_wait_for.c
+libbsp_a_SOURCES += smp/getcpuid.c
+libbsp_a_SOURCES += smp/smp_leon3.c
 endif
 
 if HAS_NETWORKING

diff -u rtems/c/src/lib/libbsp/sparc/leon3/include/leon.h:1.9 rtems/c/src/lib/libbsp/sparc/leon3/include/leon.h:1.10
--- rtems/c/src/lib/libbsp/sparc/leon3/include/leon.h:1.9	Fri Mar  4 08:06:54 2011
+++ rtems/c/src/lib/libbsp/sparc/leon3/include/leon.h	Tue Jun 28 15:29:10 2011
@@ -222,6 +222,10 @@
 
 #define LEON3_MP_IRQ    14        /* Irq used by shared memory driver */
 
+#define LEON3_IRQMPSTATUS_CPUNR     28
+#define LEON3_IRQMPSTATUS_BROADCAST 27
+
+
 #ifndef ASM
 
 /*

diff -u /dev/null rtems/c/src/lib/libbsp/sparc/leon3/smp/getcpuid.c:1.1
--- /dev/null	Tue Jun 28 16:11:19 2011
+++ rtems/c/src/lib/libbsp/sparc/leon3/smp/getcpuid.c	Tue Jun 28 15:29:10 2011
@@ -0,0 +1,18 @@
+/*
+ *  Extracted from smp-imps.c
+ *
+ *  <Insert copyright here : it must be BSD-like so anyone can use it>
+ *
+ *  Author:  Erich Boleyn  <erich at uruk.org>   http://www.uruk.org/~erich/
+ *
+ *  $Id$
+ */
+
+int bsp_smp_processor_id(void)
+{
+  unsigned int id;
+  __asm__ __volatile__( "rd     %%asr17,%0\n\t" : "=r" (id) : );
+
+  return ((id >> 28) & 0xff);
+}
+

diff -u /dev/null rtems/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c:1.1
--- /dev/null	Tue Jun 28 16:11:20 2011
+++ rtems/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c	Tue Jun 28 15:29:10 2011
@@ -0,0 +1,180 @@
+/**
+ *  @file
+ *
+ *  LEON3 SMP BSP Support
+ */
+
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <rtems/bspIo.h>
+#include <rtems/bspsmp.h>
+#include <stdlib.h>
+
+#define RTEMS_DEBUG
+
+static inline void sparc_leon3_set_cctrl( unsigned int val )
+{
+  __asm__ volatile( "sta %0, [%%g0] 2" : : "r" (val) );
+}
+
+static inline unsigned int sparc_leon3_get_cctrl( void )
+{
+  unsigned int v = 0;
+  __asm__ volatile( "lda [%%g0] 2, %0" : "=r" (v) : "0" (v) );
+  return v;
+}
+
+rtems_isr bsp_ap_ipi_isr(
+  rtems_vector_number vector
+)
+{
+  LEON_Clear_interrupt(LEON3_MP_IRQ);
+  rtems_smp_process_interrupt();
+}
+
+void bsp_smp_secondary_cpu_initialize(int cpu)
+{
+  sparc_leon3_set_cctrl( 0x80000F );
+  LEON_Unmask_interrupt(LEON3_MP_IRQ);
+  LEON3_IrqCtrl_Regs->mask[cpu] |= 1 << LEON3_MP_IRQ;
+}
+
+/*
+ *  Used to pass information to start.S when bringing secondary CPUs
+ *  out of reset.
+ */
+void *bsp_ap_stack;
+void *bsp_ap_entry;
+
+static void bsp_smp_delay( int );
+
+int bsp_smp_initialize(
+  int maximum
+)
+{
+  int cpu;
+  int found_cpus = 0;
+
+  sparc_leon3_set_cctrl( 0x80000F );
+  found_cpus =
+    ((LEON3_IrqCtrl_Regs->mpstat >> LEON3_IRQMPSTATUS_CPUNR) & 0xf)  + 1;
+  #if defined(RTEMS_DEBUG)
+    printk( "Found %d CPUs\n", found_cpus );
+  #endif
+
+  if ( found_cpus > rtems_configuration_smp_maximum_processors ) {
+    printk(
+      "%d CPUs IS MORE THAN CONFIGURED -- ONLY USING %d\n",
+      found_cpus,
+      rtems_configuration_smp_maximum_processors
+    );
+    found_cpus = rtems_configuration_smp_maximum_processors;
+  }
+
+  if ( found_cpus == 1 )
+    return 1;
+
+  for ( cpu=1 ; cpu < found_cpus ; cpu++ ) {
+    
+    #if defined(RTEMS_DEBUG)
+      printk( "Waking CPU %d\n", cpu );
+    #endif
+
+    bsp_ap_stack = _Per_CPU_Information[cpu].interrupt_stack_high -
+                      CPU_MINIMUM_STACK_FRAME_SIZE;
+    bsp_ap_entry = rtems_smp_secondary_cpu_initialize;
+
+    LEON3_IrqCtrl_Regs->mpstat = 1 << cpu;
+    bsp_smp_delay( 1000000 );
+    #if defined(RTEMS_DEBUG)
+      printk(
+	"CPU %d is %s\n",
+	cpu,
+	((_Per_CPU_Information[cpu].state == RTEMS_BSP_SMP_CPU_INITIALIZED) ?
+	   "online" : "offline")
+      );
+    #endif
+  }
+
+  if ( found_cpus > 1 ) {
+    LEON_Unmask_interrupt(LEON3_MP_IRQ);
+    set_vector(bsp_ap_ipi_isr, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1);
+  }
+  return found_cpus;
+}
+
+void bsp_smp_interrupt_cpu(
+  int cpu
+)
+{
+  /* send interrupt to destination CPU */
+  LEON3_IrqCtrl_Regs->force[cpu] = 1 << LEON3_MP_IRQ;
+}
+
+void bsp_smp_broadcast_interrupt(void)
+{
+  int dest_cpu;
+  int cpu;
+  int max_cpus;
+
+  cpu = bsp_smp_processor_id();
+  max_cpus = rtems_smp_get_number_of_processors();
+
+  for ( dest_cpu=0 ; dest_cpu < max_cpus ; dest_cpu++ ) {
+    if ( cpu == dest_cpu )
+      continue;
+    bsp_smp_interrupt_cpu( dest_cpu );
+    /* this is likely needed due to the ISR code not being SMP aware yet */
+    bsp_smp_delay( 100000 );
+  }
+}
+
+extern __inline__ void __delay(unsigned long loops)
+{
+   __asm__ __volatile__("cmp %0, 0\n\t"
+     "1: bne 1b\n\t"
+     "subcc %0, 1, %0\n" :
+     "=&r" (loops) :
+     "0" (loops) :
+     "cc"
+  );
+}
+
+/*
+ *  Kill time without depending on the timer being present or programmed.
+ *
+ *  This is not very sophisticated.
+ */
+void bsp_smp_delay( int max )
+{
+   __delay( max );
+}
+
+void bsp_smp_wait_for(
+  volatile unsigned int *address,
+  unsigned int           desired,
+  int                    maximum_usecs
+)
+{
+  int iterations;
+  volatile unsigned int *p = address;
+
+  for (iterations=0 ;  iterations < maximum_usecs ; iterations++ ) {
+    if ( *p == desired )
+      break;
+    bsp_smp_delay( 5000 );
+  }
+}
+
+


 *joel*:
2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
		Jennifer Averett <jennifer.averett at OARcorp.com>

	PR 1801/bsps
	* shared/start.S: Add SMP support to LEON3 BSP.

M   1.87  c/src/lib/libbsp/sparc/ChangeLog
M   1.17  c/src/lib/libbsp/sparc/shared/start.S

diff -u rtems/c/src/lib/libbsp/sparc/ChangeLog:1.86 rtems/c/src/lib/libbsp/sparc/ChangeLog:1.87
--- rtems/c/src/lib/libbsp/sparc/ChangeLog:1.86	Sun Jun 19 01:02:06 2011
+++ rtems/c/src/lib/libbsp/sparc/ChangeLog	Tue Jun 28 15:29:33 2011
@@ -1,3 +1,9 @@
+2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
+		Jennifer Averett <jennifer.averett at OARcorp.com>
+
+	PR 1801/bsps
+	* shared/start.S: Add SMP support to LEON3 BSP.
+
 2011-06-19	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* Makefile.am: Remove references to non-existing files.

diff -u rtems/c/src/lib/libbsp/sparc/shared/start.S:1.16 rtems/c/src/lib/libbsp/sparc/shared/start.S:1.17
--- rtems/c/src/lib/libbsp/sparc/shared/start.S:1.16	Sun Nov 29 09:33:27 2009
+++ rtems/c/src/lib/libbsp/sparc/shared/start.S	Tue Jun 28 15:29:33 2011
@@ -1,13 +1,15 @@
-/*
- *  start.s
+/**
+ *  @file
  *
  *  Common start code for SPARC.
  *
  *  This is based on the file srt0.s provided with the binary
  *  distribution of the SPARC Instruction Simulator (SIS) found
  *  at ftp://ftp.estec.esa.nl/pub/ws/wsd/erc32.
- *
- *  COPYRIGHT (c) 1989-2006.
+ */
+
+/*
+ *  COPYRIGHT (c) 1989-2011.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -18,18 +20,31 @@
  */
 
 #include <rtems/asm.h>
+#include <rtems/system.h>
 #include <bspopts.h>
 
+#if defined(RTEMS_SMP) && defined(BSP_LEON3_SMP)
+  #define ENABLE_SMP
+#endif
+
 /*
  *  Unexpected trap will halt the processor by forcing it to error state
  */
-
 #define BAD_TRAP \
   ta 0; \
   nop; \
   nop; \
   nop;
 
+#if defined(ENABLE_SMP)
+/*
+ * Variables to contain information used with bring a secondary core
+ * out of reset.
+ */
+  	.global bsp_ap_stack
+  	.global bsp_ap_entry
+#endif
+
 /*
  *  Software trap. Treat as BAD_TRAP for the time being...
  */
@@ -221,6 +236,23 @@
         nop
         nop
 
+#if defined(ENABLE_SMP)
+	rd	%asr17, %g1
+	srl	%g1, 28, %g1
+	and	%g1, 0xff, %g1			! extract cpu id
+	cmp	%g1, 0
+	beq	cpu0
+	nop
+	set	SYM(bsp_ap_stack), %g1		! set the stack pointer
+	ld	[%g1], %sp
+	mov	%sp, %fp
+	set	SYM(bsp_ap_entry), %g1		! where to start
+	ld	[%g1], %g1
+	call	%g1
+	nop
+cpu0:
+#endif
+
 	set	(SYM(rdb_start)), %g6	! End of RAM
 	st	%sp, [%g6]
 	sub	%sp, 4, %sp		! stack starts at end of RAM - 4


 *joel*:
2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>

	* score/Makefile.am, score/include/rtems/score/schedulersimplesmp.h,
	score/src/schedulersimplesmptick.c: Build schedulersimplesmptick.c
	and fix typos.

M 1.2863  cpukit/ChangeLog
M  1.105  cpukit/score/Makefile.am
M    1.4  cpukit/score/include/rtems/score/schedulersimplesmp.h
M    1.2  cpukit/score/src/schedulersimplesmptick.c

diff -u rtems/cpukit/ChangeLog:1.2862 rtems/cpukit/ChangeLog:1.2863
--- rtems/cpukit/ChangeLog:1.2862	Mon Jun 27 15:30:57 2011
+++ rtems/cpukit/ChangeLog	Tue Jun 28 15:31:36 2011
@@ -1,3 +1,9 @@
+2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
+
+	* score/Makefile.am, score/include/rtems/score/schedulersimplesmp.h,
+	score/src/schedulersimplesmptick.c: Build schedulersimplesmptick.c
+	and fix typos.
+
 2011-06-27	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* posix/include/semaphore.h, posix/include/rtems/posix/mutex.h,

diff -u rtems/cpukit/score/Makefile.am:1.104 rtems/cpukit/score/Makefile.am:1.105
--- rtems/cpukit/score/Makefile.am:1.104	Fri Jun 17 09:31:45 2011
+++ rtems/cpukit/score/Makefile.am	Tue Jun 28 15:31:36 2011
@@ -134,7 +134,7 @@
 if HAS_SMP
 libscore_a_SOURCES += src/smp.c src/smplock.c \
     src/schedulersimplesmpblock.c src/schedulersimplesmpschedule.c \
-    src/schedulersimplesmpunblock.c src/schedulerprioritytick.c 
+    src/schedulersimplesmpunblock.c src/schedulersimplesmptick.c 
 endif
 
 ## CORE_APIMUTEX_C_FILES

diff -u rtems/cpukit/score/include/rtems/score/schedulersimplesmp.h:1.3 rtems/cpukit/score/include/rtems/score/schedulersimplesmp.h:1.4
--- rtems/cpukit/score/include/rtems/score/schedulersimplesmp.h:1.3	Fri Jun 17 09:31:45 2011
+++ rtems/cpukit/score/include/rtems/score/schedulersimplesmp.h	Tue Jun 28 15:31:36 2011
@@ -105,7 +105,6 @@
  */
 void _Scheduler_simple_smp_Tick( void );
 
-/**
 #ifdef __cplusplus
 }
 #endif

diff -u rtems/cpukit/score/src/schedulersimplesmptick.c:1.1 rtems/cpukit/score/src/schedulersimplesmptick.c:1.2
--- rtems/cpukit/score/src/schedulersimplesmptick.c:1.1	Fri Jun 17 09:31:46 2011
+++ rtems/cpukit/score/src/schedulersimplesmptick.c	Tue Jun 28 15:31:36 2011
@@ -15,12 +15,14 @@
 
 #include <rtems/system.h>
 #include <rtems/score/schedulersimplesmp.h>
+#include <rtems/score/smp.h>
 
 static void _Scheduler_simple_smp_Tick_helper(
   int cpu
 )
 {
   Thread_Control *executing;
+  ISR_Level       level;
 
   executing = _Per_CPU_Information[cpu].executing;
 


 *joel*:
2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>

	PR 1826/cpukit
	* libmisc/cpuuse/cpuusagereport.c, rtems/Makefile.am,
	rtems/preinstall.am, rtems/include/rtems.h: Add SMP Helper methods to
	Classic API.
	* rtems/include/rtems/rtems/smp.h: New file.

M 1.2864  cpukit/ChangeLog
M   1.23  cpukit/libmisc/cpuuse/cpuusagereport.c
M   1.54  cpukit/rtems/Makefile.am
M   1.39  cpukit/rtems/include/rtems.h
A    1.1  cpukit/rtems/include/rtems/rtems/smp.h
M   1.15  cpukit/rtems/preinstall.am

diff -u rtems/cpukit/ChangeLog:1.2863 rtems/cpukit/ChangeLog:1.2864
--- rtems/cpukit/ChangeLog:1.2863	Tue Jun 28 15:31:36 2011
+++ rtems/cpukit/ChangeLog	Tue Jun 28 15:39:39 2011
@@ -1,5 +1,13 @@
 2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
 
+	PR 1826/cpukit
+	* libmisc/cpuuse/cpuusagereport.c, rtems/Makefile.am,
+	rtems/preinstall.am, rtems/include/rtems.h: Add SMP Helper methods to
+	Classic API.
+	* rtems/include/rtems/rtems/smp.h: New file.
+
+2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
+
 	* score/Makefile.am, score/include/rtems/score/schedulersimplesmp.h,
 	score/src/schedulersimplesmptick.c: Build schedulersimplesmptick.c
 	and fix typos.

diff -u rtems/cpukit/libmisc/cpuuse/cpuusagereport.c:1.22 rtems/cpukit/libmisc/cpuuse/cpuusagereport.c:1.23
--- rtems/cpukit/libmisc/cpuuse/cpuusagereport.c:1.22	Thu Jun 16 11:24:05 2011
+++ rtems/cpukit/libmisc/cpuuse/cpuusagereport.c	Tue Jun 28 15:39:39 2011
@@ -49,7 +49,7 @@
       }
     #else
       int  cpu;
-      for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
+      for ( cpu=0 ; cpu < rtems_smp_get_number_of_processors() ; cpu++ ) {
         Per_CPU_Control *p = &_Per_CPU_Information[cpu];
         if ( p->executing->Object.id == the_thread->Object.id ) {
           *time_of_context_switch = p->time_of_last_context_switch;

diff -u rtems/cpukit/rtems/Makefile.am:1.53 rtems/cpukit/rtems/Makefile.am:1.54
--- rtems/cpukit/rtems/Makefile.am:1.53	Mon May 16 09:28:26 2011
+++ rtems/cpukit/rtems/Makefile.am	Tue Jun 28 15:39:39 2011
@@ -57,6 +57,10 @@
 include_rtems_rtems_HEADERS += include/rtems/rtems/taskmp.h
 endif
 
+if HAS_SMP
+include_rtems_rtems_HEADERS += include/rtems/rtems/smp.h
+endif
+
 include_rtems_rtems_HEADERS += inline/rtems/rtems/asr.inl
 include_rtems_rtems_HEADERS += inline/rtems/rtems/attr.inl
 include_rtems_rtems_HEADERS += inline/rtems/rtems/barrier.inl

diff -u rtems/cpukit/rtems/include/rtems.h:1.38 rtems/cpukit/rtems/include/rtems.h:1.39
--- rtems/cpukit/rtems/include/rtems.h:1.38	Mon Aug  9 03:59:57 2010
+++ rtems/cpukit/rtems/include/rtems.h	Tue Jun 28 15:39:39 2011
@@ -74,6 +74,10 @@
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/rtems/mp.h>
 #endif
+#if defined(RTEMS_SMP)
+#include <rtems/rtems/smp.h>
+#endif
+
 
 #include <rtems/rtems/support.h>
 #include <rtems/score/sysstate.h>

diff -u /dev/null rtems/cpukit/rtems/include/rtems/rtems/smp.h:1.1
--- /dev/null	Tue Jun 28 16:11:21 2011
+++ rtems/cpukit/rtems/include/rtems/rtems/smp.h	Tue Jun 28 15:39:39 2011
@@ -0,0 +1,82 @@
+/**
+ * @file rtems/rtems/smp.h
+ *
+ *  This include file provides the application interface
+ *  to SMP information and services.
+ *
+ *  Most of the SMP interface is hidden from the application
+ *  and exists between the BSP and RTEMS.
+ */
+
+/*  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifndef _RTEMS_RTEMS_SMP_H
+#define _RTEMS_RTEMS_SMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/smp.h>
+
+/**
+ *  @defgroup ClassicSMP Classic API SMP Services
+ *
+ *  @ingroup ClassicRTEMS
+ *
+ *  This encapsulates functionality which is useful for SMP applications.
+ */
+/**@{*/
+
+extern uint32_t rtems_configuration_smp_maximum_processors;
+
+/**
+ *  @brief Obtain Number of Cores in System
+ *
+ *  This method returns the number of CPU cores that are currently in
+ *  the system.  This will always be less than or equal to the number
+ *  of maximum number of cores which were configured.
+ *
+ *  @return This method returns the number of cores in this system.
+ */
+#define rtems_smp_get_number_of_processors() \
+    (_SMP_Processor_count)
+
+/**
+ *  @brief Obtain Maximum Cores Configured
+ *
+ *  This method returns the number of CPU cores that were configured
+ *  in the system.  The actual number of cores will always be less than
+ *  or equal to the number  of maximum number of cores which were configured.
+ *
+ *  @return This method returns the number of cores configured.
+ */
+#define rtems_configuration_get_smp_maximum_processors() \
+    (rtems_configuration_smp_maximum_processors)
+
+/**
+ *  @brief Obtain Current Core Number
+ *
+ *  This method returns the id of the current CPU core.
+ *
+ *  @return This method returns the id of the current CPU core.
+ */
+#define rtems_smp_get_current_processor() \
+    bsp_smp_processor_id()
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */

diff -u rtems/cpukit/rtems/preinstall.am:1.14 rtems/cpukit/rtems/preinstall.am:1.15
--- rtems/cpukit/rtems/preinstall.am:1.14	Mon Aug  9 04:03:11 2010
+++ rtems/cpukit/rtems/preinstall.am	Tue Jun 28 15:39:39 2011
@@ -164,6 +164,11 @@
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/taskmp.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/taskmp.h
 endif
+if HAS_SMP
+$(PROJECT_INCLUDE)/rtems/rtems/smp.h: include/rtems/rtems/smp.h $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/smp.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/smp.h
+endif
 $(PROJECT_INCLUDE)/rtems/rtems/asr.inl: inline/rtems/rtems/asr.inl $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/asr.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/asr.inl


 *joel*:
2011-05-24	Joel Sherrill <joel.sherrill at oarcorp.com>

	PR 1810/misc
	* ChangeLog: Fix previous damage.

M  1.402  ChangeLog
M    1.2  aclocal/enable-smp.m4

diff -u rtems/ChangeLog:1.401 rtems/ChangeLog:1.402
--- rtems/ChangeLog:1.401	Thu Jun 16 23:05:28 2011
+++ rtems/ChangeLog	Tue Jun 28 15:43:53 2011
@@ -1,3 +1,8 @@
+2011-05-24	Joel Sherrill <joel.sherrill at oarcorp.com>
+
+	PR 1810/misc
+	* ChangeLog: Fix previous damage.
+
 2011-06-17	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* Makefile.am: Remove make/host.cfg.in.

diff -u rtems/aclocal/enable-smp.m4:1.1 rtems/aclocal/enable-smp.m4:1.2
--- rtems/aclocal/enable-smp.m4:1.1	Wed Mar 16 15:06:55 2011
+++ rtems/aclocal/enable-smp.m4	Tue Jun 28 15:43:53 2011
@@ -8,7 +8,7 @@
 [AS_HELP_STRING([--enable-smp],[enable smp interface])],
 [case "${enableval}" in 
   yes) case "${RTEMS_CPU}" in
-         sparc|i386) RTEMS_HAS_SMP=no ;;
+         sparc|i386) RTEMS_HAS_SMP=yes ;;
          *)          RTEMS_HAS_SMP=no ;;
        esac
        ;;


 *joel*:
2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>

	* .configure.ac.swp, ChangeLog, Makefile.am, README, config.h.in,
	configure.ac, smp01/.cvsignore, smp01/Makefile.am, smp01/init.c,
	smp01/smp01.doc, smp01/smp01.scn, smp01/system.h, smp01/tasks.c,
	smp02/.cvsignore, smp02/Makefile.am, smp02/init.c, smp02/smp02.doc,
	smp02/smp02.scn, smp02/system.h, smp02/tasks.c, smp03/.cvsignore,
	smp03/Makefile.am, smp03/init.c, smp03/smp03.doc, smp03/smp03.scn,
	smp03/system.h, smp03/tasks.c, smp04/.cvsignore, smp04/Makefile.am,
	smp04/init.c, smp04/smp04.doc, smp04/smp04.scn, smp04/system.h,
	smp04/tasks.c, smp05/.cvsignore, smp05/Makefile.am, smp05/init.c,
	smp05/smp05.doc, smp05/smp05.scn, smp06/.cvsignore,
	smp06/Makefile.am, smp06/init.c, smp06/smp06.doc, smp06/smp06.scn,
	smp07/.cvsignore, smp07/Makefile.am, smp07/init.c, smp07/smp07.doc,
	smp07/smp07.scn, smp08/.cvsignore, smp08/Makefile.am, smp08/init.c,
	smp08/smp08.doc, smp08/smp08.scn, smp08/system.h, smp08/tasks.c,
	smp09/.cvsignore, smp09/Makefile.am, smp09/init.c, smp09/smp09.doc,
	smp09/smp09.scn: New files.

A    1.1  testsuites/smptests/.configure.ac.swp
A    1.1  testsuites/smptests/ChangeLog
A    1.1  testsuites/smptests/Makefile.am
A    1.1  testsuites/smptests/README
A    1.1  testsuites/smptests/config.h.in
A    1.1  testsuites/smptests/configure.ac
A    1.1  testsuites/smptests/smp01/.cvsignore
A    1.1  testsuites/smptests/smp01/Makefile.am
A    1.1  testsuites/smptests/smp01/init.c
A    1.1  testsuites/smptests/smp01/smp01.doc
A    1.1  testsuites/smptests/smp01/smp01.scn
A    1.1  testsuites/smptests/smp01/system.h
A    1.1  testsuites/smptests/smp01/tasks.c
A    1.1  testsuites/smptests/smp02/.cvsignore
A    1.1  testsuites/smptests/smp02/Makefile.am
A    1.1  testsuites/smptests/smp02/init.c
A    1.1  testsuites/smptests/smp02/smp02.doc
A    1.1  testsuites/smptests/smp02/smp02.scn
A    1.1  testsuites/smptests/smp02/system.h
A    1.1  testsuites/smptests/smp02/tasks.c
A    1.1  testsuites/smptests/smp03/.cvsignore
A    1.1  testsuites/smptests/smp03/Makefile.am
A    1.1  testsuites/smptests/smp03/init.c
A    1.1  testsuites/smptests/smp03/smp03.doc
A    1.1  testsuites/smptests/smp03/smp03.scn
A    1.1  testsuites/smptests/smp03/system.h
A    1.1  testsuites/smptests/smp03/tasks.c
A    1.1  testsuites/smptests/smp04/.cvsignore
A    1.1  testsuites/smptests/smp04/Makefile.am
A    1.1  testsuites/smptests/smp04/init.c
A    1.1  testsuites/smptests/smp04/smp04.doc
A    1.1  testsuites/smptests/smp04/smp04.scn
A    1.1  testsuites/smptests/smp04/system.h
A    1.1  testsuites/smptests/smp04/tasks.c
A    1.1  testsuites/smptests/smp05/.cvsignore
A    1.1  testsuites/smptests/smp05/Makefile.am
A    1.1  testsuites/smptests/smp05/init.c
A    1.1  testsuites/smptests/smp05/smp05.doc
A    1.1  testsuites/smptests/smp05/smp05.scn
A    1.1  testsuites/smptests/smp06/.cvsignore
A    1.1  testsuites/smptests/smp06/Makefile.am
A    1.1  testsuites/smptests/smp06/init.c
A    1.1  testsuites/smptests/smp06/smp06.doc
A    1.1  testsuites/smptests/smp06/smp06.scn
A    1.1  testsuites/smptests/smp07/.cvsignore
A    1.1  testsuites/smptests/smp07/Makefile.am
A    1.1  testsuites/smptests/smp07/init.c
A    1.1  testsuites/smptests/smp07/smp07.doc
A    1.1  testsuites/smptests/smp07/smp07.scn
A    1.1  testsuites/smptests/smp08/.cvsignore
A    1.1  testsuites/smptests/smp08/Makefile.am
A    1.1  testsuites/smptests/smp08/init.c
A    1.1  testsuites/smptests/smp08/smp08.doc
A    1.1  testsuites/smptests/smp08/smp08.scn
A    1.1  testsuites/smptests/smp08/system.h
A    1.1  testsuites/smptests/smp08/tasks.c
A    1.1  testsuites/smptests/smp09/.cvsignore
A    1.1  testsuites/smptests/smp09/Makefile.am
A    1.1  testsuites/smptests/smp09/init.c
A    1.1  testsuites/smptests/smp09/smp09.doc
A    1.1  testsuites/smptests/smp09/smp09.scn

*** DIFF FAILED:  ***
diff -u /dev/null rtems/testsuites/smptests/ChangeLog:1.1
--- /dev/null	Tue Jun 28 16:11:21 2011
+++ rtems/testsuites/smptests/ChangeLog	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,19 @@
+2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
+
+	* .configure.ac.swp, ChangeLog, Makefile.am, README, config.h.in,
+	configure.ac, smp01/.cvsignore, smp01/Makefile.am, smp01/init.c,
+	smp01/smp01.doc, smp01/smp01.scn, smp01/system.h, smp01/tasks.c,
+	smp02/.cvsignore, smp02/Makefile.am, smp02/init.c, smp02/smp02.doc,
+	smp02/smp02.scn, smp02/system.h, smp02/tasks.c, smp03/.cvsignore,
+	smp03/Makefile.am, smp03/init.c, smp03/smp03.doc, smp03/smp03.scn,
+	smp03/system.h, smp03/tasks.c, smp04/.cvsignore, smp04/Makefile.am,
+	smp04/init.c, smp04/smp04.doc, smp04/smp04.scn, smp04/system.h,
+	smp04/tasks.c, smp05/.cvsignore, smp05/Makefile.am, smp05/init.c,
+	smp05/smp05.doc, smp05/smp05.scn, smp06/.cvsignore,
+	smp06/Makefile.am, smp06/init.c, smp06/smp06.doc, smp06/smp06.scn,
+	smp07/.cvsignore, smp07/Makefile.am, smp07/init.c, smp07/smp07.doc,
+	smp07/smp07.scn, smp08/.cvsignore, smp08/Makefile.am, smp08/init.c,
+	smp08/smp08.doc, smp08/smp08.scn, smp08/system.h, smp08/tasks.c,
+	smp09/.cvsignore, smp09/Makefile.am, smp09/init.c, smp09/smp09.doc,
+	smp09/smp09.scn: New files.
+

diff -u /dev/null rtems/testsuites/smptests/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:21 2011
+++ rtems/testsuites/smptests/Makefile.am	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,22 @@
+##
+## $Id$
+##
+
+ACLOCAL_AMFLAGS = -I ../aclocal
+
+SUBDIRS = 
+
+if SMPTESTS
+SUBDIRS += smp01
+SUBDIRS += smp02
+SUBDIRS += smp03
+SUBDIRS += smp04
+SUBDIRS += smp05
+SUBDIRS += smp06
+SUBDIRS += smp07
+SUBDIRS += smp08
+SUBDIRS += smp09
+endif
+
+include $(top_srcdir)/../automake/subdirs.am
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/README:1.1
--- /dev/null	Tue Jun 28 16:11:21 2011
+++ rtems/testsuites/smptests/README	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,17 @@
+#
+#  COPYRIGHT (c) 1989-2011.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+#  $Id$
+#
+
+This directory contains the RTEMS SMP Test Suite.
+
+As of June 2011, these tests are known to run on only
+
++ pcp4 BSP using qemu with 2-4 cores
++ leon3 BSP using grsim with 4 cores

diff -u /dev/null rtems/testsuites/smptests/config.h.in:1.1
--- /dev/null	Tue Jun 28 16:11:21 2011
+++ rtems/testsuites/smptests/config.h.in	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,19 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION

diff -u /dev/null rtems/testsuites/smptests/configure.ac:1.1
--- /dev/null	Tue Jun 28 16:11:21 2011
+++ rtems/testsuites/smptests/configure.ac	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,47 @@
+## Process this file with autoconf to produce a configure script.
+## 
+## $Id$
+
+AC_PREREQ([2.68])
+AC_INIT([rtems-c-src-tests-smptests],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
+AC_CONFIG_SRCDIR([smp01])
+AC_CONFIG_HEADER([config.h])
+RTEMS_TOP([../..],[..])
+
+RTEMS_CANONICAL_TARGET_CPU
+
+AM_INIT_AUTOMAKE([no-define foreign 1.11.1])
+AM_MAINTAINER_MODE
+
+RTEMS_ENABLE_CXX
+
+RTEMS_ENV_RTEMSBSP
+
+RTEMS_PROJECT_ROOT
+
+RTEMS_PROG_CC_FOR_TARGET
+
+RTEMS_PROG_CXX_FOR_TARGET
+RTEMS_CANONICALIZE_TOOLS
+
+RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
+RTEMS_CHECK_CPUOPTS([RTEMS_MULTIPROCESSING])
+RTEMS_CHECK_CXX(RTEMS_BSP)
+RTEMS_CHECK_CPUOPTS([RTEMS_NETWORKING])
+RTEMS_CHECK_CPUOPTS([RTEMS_SMP])
+
+AM_CONDITIONAL(SMPTESTS,test "$rtems_cv_RTEMS_SMP" = "yes")
+
+# Explicitly list all Makefiles here
+AC_CONFIG_FILES([Makefile
+smp01/Makefile
+smp02/Makefile
+smp03/Makefile
+smp04/Makefile
+smp05/Makefile
+smp06/Makefile
+smp07/Makefile
+smp08/Makefile
+smp09/Makefile
+])
+AC_OUTPUT

diff -u /dev/null rtems/testsuites/smptests/smp01/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:21 2011
+++ rtems/testsuites/smptests/smp01/.cvsignore	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp01/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp01/Makefile.am	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,27 @@
+##
+##  $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp01
+smp01_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp01.scn
+dist_rtems_tests_DATA += smp01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+LINK_OBJS = $(smp01_OBJECTS) $(smp01_LDADD)
+LINK_LIBS = $(smp01_LDLIBS)
+
+smp01$(EXEEXT): $(smp01_OBJECTS) $(smp01_DEPENDENCIES)
+	@rm -f smp01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp01/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp01/init.c	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,87 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+void Loop() {
+  volatile int i;
+
+  for (i=0; i<300000; i++);
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int                i;
+  char               ch;
+  int                cpu_num;
+  rtems_id           id;
+  rtems_status_code  status;
+  bool               allDone;
+
+  /* XXX - Delay a bit to allow debug messages from
+   * startup to print.  This may need to go away when
+   * debug messages go away.
+   */ 
+  Loop();
+  locked_print_initialize();
+
+  /* Put start of test message */
+  locked_printf( "\n\n***  SMP01 TEST ***\n" );
+
+  /* Initialize the TaskRan array */
+  for ( i=0; i<rtems_smp_get_number_of_processors() ; i++ ) {
+    TaskRan[i] = false;
+  }
+
+  /* Create and start tasks for each processor */
+  for ( i=1; i< rtems_smp_get_number_of_processors() ; i++ ) {
+    ch = '0' + i;
+
+    status = rtems_task_create(
+      rtems_build_name( 'T', 'A', ch, ' ' ),
+      1,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+    directive_failed( status, "task create" );
+
+    cpu_num = bsp_smp_processor_id();
+    (" CPU %d start task TA%c\n", cpu_num, ch);
+    status = rtems_task_start( id, Test_task, i+1 );
+    directive_failed( status, "task start" );
+
+    Loop();
+  }
+  
+  /* Wait on the all tasks to run */
+  while (1) {
+    allDone = true;
+    for ( i=1; i<rtems_smp_get_number_of_processors() ; i++ ) {
+      if (TaskRan[i] == false)
+        allDone = false;
+    }
+    if (allDone) {
+      Loop();
+      locked_printf( "*** END OF TEST SMP01 ***" );
+      rtems_test_exit( 0 );
+    }
+  }
+
+}

diff -u /dev/null rtems/testsuites/smptests/smp01/smp01.doc:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp01/smp01.doc	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,21 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-1999.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This is a simple test that verifies that each of the smp
+processors can run a task.  The init task creates and starts
+a test_task for each prcessor.  With a small delay between
+the start of each processor to allow for the processor to
+print its status.  Note:  This may need to change to a semaphore
+locked print routine at some point in the furture.
+
+After the tasks have been started the init task waits for flags
+to be set by each task indicating that they are running.  Once all
+flags are set the program terminates.

diff -u /dev/null rtems/testsuites/smptests/smp01/smp01.scn:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp01/smp01.scn	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,8 @@
+***  SMP01 TEST ***
+CPU 0 start task TA1
+CPU 1 running Task TA1
+CPU 0 start task TA2
+CPU 2 running Task TA2
+CPU 0 start task TA3
+CPU 3 running Task TA3
+*** END OF SMP 01 TEST ***

diff -u /dev/null rtems/testsuites/smptests/smp01/system.h:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp01/system.h	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,54 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+
+rtems_task Test_task(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   4 
+
+#define CONFIGURE_MAXIMUM_TASKS            \
+    (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#include <rtems/confdefs.h>
+
+/* global variables */
+
+/*
+ *  Keep the names and IDs in global variables so another task can use them.
+ */
+
+TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ];
+
+void Loop( void );
+
+/*
+ *  Handy macros and static inline functions
+ */
+
+/* end of include file */

diff -u /dev/null rtems/testsuites/smptests/smp01/tasks.c:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp01/tasks.c	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,45 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+rtems_task Test_task(
+  rtems_task_argument task_index
+)
+{
+  int               cpu_num;
+  char              name[5];
+  char             *p;
+
+  /* Get the task name */
+  p = rtems_object_get_name( RTEMS_SELF, 5, name );
+  rtems_test_assert( p != NULL );
+
+   /* Get the CPU Number */
+  cpu_num = bsp_smp_processor_id();
+
+  /* Print that the task is up and running. */
+  Loop();
+  locked_printf(" CPU %d running Task %s\n", cpu_num, name);
+
+  /* Set the flag that the task is up and running */
+  TaskRan[cpu_num] = true;
+
+
+  /* Drop into a loop which will keep this task on
+   * running on the cpu.
+   */
+  while(1);
+}

diff -u /dev/null rtems/testsuites/smptests/smp02/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp02/.cvsignore	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp02/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp02/Makefile.am	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,29 @@
+##
+##  $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp02
+smp02_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp02.scn
+dist_rtems_tests_DATA += smp02.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+smp02_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+LINK_OBJS = $(smp02_OBJECTS) $(smp02_LDADD)
+LINK_LIBS = $(smp02_LDLIBS)
+
+smp02$(EXEEXT): $(smp02_OBJECTS) $(smp02_DEPENDENCIES)
+	@rm -f smp02$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp02/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp02/init.c	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,102 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include <stdio.h>
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int               i;
+  char              ch;
+  int               cpu_num;
+  rtems_id          id;
+  rtems_status_code status;
+  char              str[80];
+
+  locked_print_initialize();
+  locked_printf( "\n\n***  SMP02 TEST ***\n" );
+
+  /* Create/verify synchronisation semaphore */
+  status = rtems_semaphore_create(
+    rtems_build_name ('S', 'E', 'M', '1'),
+    1,                                             
+    RTEMS_LOCAL                   |
+    RTEMS_SIMPLE_BINARY_SEMAPHORE |
+    RTEMS_PRIORITY,
+    1,
+    &Semaphore);
+  directive_failed( status, "rtems_semaphore_create" );
+
+  /* Lock semaphore */
+  status = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, 0);
+  directive_failed( status,"rtems_semaphore_obtain of SEM1\n");
+
+  for ( i=1; i < CONFIGURE_SMP_MAXIMUM_PROCESSORS; i++ ){
+
+    /* Create and start tasks for each CPU */
+    ch = '0' + i;
+
+    status = rtems_task_create(
+      rtems_build_name( 'T', 'A', ch, ' ' ),
+      1,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+
+    cpu_num = bsp_smp_processor_id();
+    locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+    status = rtems_task_start( id, Test_task, i+1 );
+    locked_printf(str, "rtems_task_start TA%d", i+1);
+    directive_failed( status, str );
+  }
+
+  /*
+   * Release the semaphore, allowing the blocked tasks to start.
+   */
+  status = rtems_semaphore_release( Semaphore );
+  directive_failed( status,"rtems_semaphore_release of SEM1\n");
+  
+
+  /* 
+   * Wait for log full. print the log and end the program.
+   */  
+  while (Log_index < LOG_SIZE)
+    ;
+ 
+  for (i=0; i< LOG_SIZE; i++) {
+    if ( Log[i].IsLocked ) {
+      locked_printf(
+        " CPU %d Task TA%" PRIu32 " Obtain\n", 
+        Log[i].cpu_num,
+        Log[i].task_index
+      );
+    } else {
+      locked_printf(
+        " CPU %d Task TA%" PRIu32 " Release\n", 
+        Log[i].cpu_num,
+        Log[i].task_index
+      );
+    }
+  }
+
+  locked_printf( "*** END OF TEST SMP02 ***\n" );
+  rtems_test_exit( 0 );
+}

diff -u /dev/null rtems/testsuites/smptests/smp02/smp02.doc:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp02/smp02.doc	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,19 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-1999.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+This test creates tasks for each process (other than the 
+one that Init is running on).  Then drops into a loop waiting
+on a log file to fill up.  Once the log file is filled the 
+information is printed and the program ends.
+
+Each task poll for a semaphore.  Once the semaphore is 
+obtained , a log the obtain and release is recorded and
+the semaphore is released.  If the log is full the semaphore
+is released without changing the log.

diff -u /dev/null rtems/testsuites/smptests/smp02/smp02.scn:1.1
--- /dev/null	Tue Jun 28 16:11:22 2011
+++ rtems/testsuites/smptests/smp02/smp02.scn	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,25 @@
+***  SMP02 TEST ***
+ CPU 0 start task TA1
+ CPU 0 start task TA2
+ CPU 0 start task TA3
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 3 Task TA4 Obtain
+ CPU 3 Task TA4 Release
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 3 Task TA4 Obtain
+ CPU 3 Task TA4 Release
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 2 Task TA3 Obtain
+ CPU 2 Task TA3 Release
+ CPU 3 Task TA4 Obtain
+ CPU 3 Task TA4 Release
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 2 Task TA3 Obtain
+ CPU 2 Task TA3 Release
+*** END OF SMP 02 TEST ***

diff -u /dev/null rtems/testsuites/smptests/smp02/system.h:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp02/system.h	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,73 @@
+/* 
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+
+rtems_task Test_task(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   4 
+
+#define CONFIGURE_MAXIMUM_TASKS            \
+    (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_STACK_SIZE \
+    (3 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES          1
+
+#include <rtems/confdefs.h>
+
+
+/* global variables */
+
+/*
+ *  Keep the names and IDs in global variables so another task can use them.
+ */
+
+typedef struct {
+  bool     IsLocked;
+  int      cpu_num;
+  uint32_t task_index;
+} Log_t;
+
+#define           LOG_SIZE   20
+
+TEST_EXTERN rtems_id   Semaphore;      /* synchronisation semaphore */ 
+TEST_EXTERN Log_t      Log[LOG_SIZE];  /* A log of locks/unlocks */
+TEST_EXTERN volatile uint32_t   Log_index;      /* Index into log */
+
+/*
+ *  Handy macros and static inline functions
+ */
+
+/*
+ *  Macro to hide the ugliness of printing the time.
+ */
+
+/* end of include file */

diff -u /dev/null rtems/testsuites/smptests/smp02/tasks.c:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp02/tasks.c	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,63 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+void Loop() {
+  volatile int i;
+
+  for (i=0; i<300000; i++);
+}
+
+void LogSemaphore(
+  bool      obtained,
+  int       cpu_num,
+  uint32_t  task_index
+){
+  int i;
+
+  if (Log_index < LOG_SIZE) { 
+    /* Log the information */
+    Log[ Log_index ].IsLocked   = obtained;
+    Log[ Log_index ].cpu_num    = cpu_num;
+    Log[ Log_index ].task_index = task_index;
+    Log_index++;
+  }
+}
+
+rtems_task Test_task(
+  rtems_task_argument task_index
+)
+{
+  int               cpu_num;
+  rtems_status_code sc;
+
+  cpu_num = bsp_smp_processor_id();
+
+  do {
+
+    /* Poll to obtain the synchronization semaphore */
+    do {
+      sc = rtems_semaphore_obtain( Semaphore, RTEMS_NO_WAIT, 0 );
+    } while (sc != RTEMS_SUCCESSFUL );
+
+    LogSemaphore(true, cpu_num, task_index);
+    LogSemaphore(false, cpu_num, task_index);
+  
+    rtems_semaphore_release( Semaphore );
+  }
+
+  while(1);
+}

diff -u /dev/null rtems/testsuites/smptests/smp03/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp03/.cvsignore	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp03/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp03/Makefile.am	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,29 @@
+##
+##  $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp03
+smp03_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp03.scn
+dist_rtems_tests_DATA += smp03.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+smp03_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+LINK_OBJS = $(smp03_OBJECTS) $(smp03_LDADD)
+LINK_LIBS = $(smp03_LDLIBS)
+
+smp03$(EXEEXT): $(smp03_OBJECTS) $(smp03_DEPENDENCIES)
+	@rm -f smp03$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp03/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp03/init.c	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,94 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include <stdio.h>
+
+void Loop() {
+  volatile int i;
+
+  for (i=0; i<300000; i++);
+}
+
+void PrintTaskInfo(
+  const char *task_name
+)
+{
+  int               cpu_num;
+  rtems_status_code sc;
+
+  cpu_num = bsp_smp_processor_id();
+
+  locked_printf("  CPU %d running task %s\n", cpu_num, task_name );
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int               i;
+  char              ch;
+  rtems_id          id;
+  rtems_status_code status;
+
+  Loop();
+  locked_print_initialize();
+
+  locked_printf( "\n\n***  SMP03 TEST ***" );
+
+
+  /* Show that the init task is running on this cpu */
+  PrintTaskInfo( "Init" );
+
+  /* for each remaining cpu create and start a task */
+  for ( i=1; i < CONFIGURE_SMP_MAXIMUM_PROCESSORS; i++ ){
+
+    ch = '0' + i;
+
+    status = rtems_task_create(
+      rtems_build_name( 'T', 'A', ch, ' ' ),
+      CONFIGURE_INIT_TASK_PRIORITY + (2*i),
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_PREEMPT,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+    status = rtems_task_start( id, Test_task, i );
+
+    Loop();
+  }
+
+  /* Create/Start an aditional task with the highest priority */
+  status = rtems_task_create(
+    rtems_build_name( 'T', 'A', ch, ' ' ),
+    3,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_PREEMPT,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &id
+  );
+  TestFinished = false;
+  status = rtems_task_start( id, Test_task, CONFIGURE_SMP_MAXIMUM_PROCESSORS );
+
+  /* Wait on the last task to run */
+  while(!TestFinished)
+    ;
+
+  /* End the test */
+  locked_printf( "*** END OF TEST SMP03 ***" );
+  rtems_test_exit( 0 );    
+}

diff -u /dev/null rtems/testsuites/smptests/smp03/smp03.doc:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp03/smp03.doc	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,19 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-1999.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+This test runs the init task on the first CPU at a priority
+of 5.  The Init task creates tasks for each remaining processor
+at priorities ( 5 + (2*CPU) ).  It then creates one more
+task at a priority of 3 wich should preempt the last task created.
+The Init task waits on the last task to run then ends the program.
+
+Each created task prints the cpu and task that it is running.  Then
+checkes the task id to see if it is the final task.  If it is the
+final task, a flag is set for the Init task to see.

diff -u /dev/null rtems/testsuites/smptests/smp03/smp03.scn:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp03/smp03.scn	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,7 @@
+***  SMP03 TEST ***
+  CPU 0 running task Init
+  CPU 1 running task TA1
+  CPU 2 running task TA2
+  CPU 3 running task TA3
+  CPU 3 running task TA4
+*** END OF SMP03 TEST ***

diff -u /dev/null rtems/testsuites/smptests/smp03/system.h:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp03/system.h	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,68 @@
+/* 
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+
+rtems_task Test_task(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   4 
+
+#define CONFIGURE_MAXIMUM_TASKS            \
+    (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_STACK_SIZE \
+    (3 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_PRIORITY        5 
+#define CONFIGURE_INIT_TASK_INITIAL_MODES   RTEMS_PREEMPT
+
+#include <rtems/confdefs.h>
+
+
+/* global variables */
+
+/*
+ *  Keep the names and IDs in global variables so another task can use them.
+ */
+void Loop(void);
+void PrintTaskInfo(
+  const char *task_name
+);
+
+TEST_EXTERN volatile bool  TestFinished;
+
+/*
+ *  Handy macros and static inline functions
+ */
+
+/*
+ *  Macro to hide the ugliness of printing the time.
+ */
+
+/* end of include file */

diff -u /dev/null rtems/testsuites/smptests/smp03/tasks.c:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp03/tasks.c	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,38 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+rtems_task Test_task(
+  rtems_task_argument task_index
+)
+{
+  char              task_name[5];
+
+  /* Show that this task is running on cpu X */
+  sprintf( task_name, "TA%" PRIu32, task_index );
+  PrintTaskInfo( task_name );
+
+  /* If this is the last task created set a flag for the
+   * test to end.
+   */
+  if ( task_index  == CONFIGURE_SMP_MAXIMUM_PROCESSORS ) {
+    TestFinished = true;
+  }
+
+  /* Wait for the test to end without giving up this processor */
+  while(1)
+    ;
+}

diff -u /dev/null rtems/testsuites/smptests/smp04/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp04/.cvsignore	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp04/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:23 2011
+++ rtems/testsuites/smptests/smp04/Makefile.am	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,29 @@
+##
+##  $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp04
+smp04_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp04.scn
+dist_rtems_tests_DATA += smp04.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+smp04_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+LINK_OBJS = $(smp04_OBJECTS) $(smp04_LDADD)
+LINK_LIBS = $(smp04_LDLIBS)
+
+smp04$(EXEEXT): $(smp04_OBJECTS) $(smp04_DEPENDENCIES)
+	@rm -f smp04$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp04/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp04/init.c	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,119 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include <stdio.h>
+
+
+void Loop() {
+  volatile int i;
+
+  for (i=0; i<500000; i++);
+}
+
+void PrintTaskInfo(
+  const char *task_name
+)
+{
+  int               cpu_num;
+
+  cpu_num = bsp_smp_processor_id();
+
+  locked_printf("  CPU %d running task %s\n", cpu_num, task_name );
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int               i;
+  char              ch;
+  rtems_id          id;
+  rtems_status_code status;
+  bool              allDone;
+
+  Loop();
+  locked_print_initialize();
+  locked_printf( "\n\n***  SMP04 TEST ***\n" );
+
+  PrintTaskInfo( "Init" );
+
+  TaskRan[0] = true;
+  for ( i=1; i <= rtems_smp_get_number_of_processors() ; i++ )
+    TaskRan[i] = false;
+  
+  for ( i=1; i < rtems_smp_get_number_of_processors() ; i++ ){
+
+    /* Create and start tasks for each CPU */
+    ch = '0' + i;
+    locked_printf(
+      "Create a TA%c a %s task\n",
+      ch, 
+      ((i%2) ? "RTEMS_PREEMPT" : "RTEMS_NO_PREEMPT" ) 
+    );
+
+    status = rtems_task_create(
+      rtems_build_name( 'T', 'A', ch, ' ' ),
+      CONFIGURE_INIT_TASK_PRIORITY +
+        (2*rtems_smp_get_number_of_processors()) - (2*i),
+      RTEMS_MINIMUM_STACK_SIZE,
+      ((i%2) ? RTEMS_PREEMPT : RTEMS_NO_PREEMPT),
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+  }
+
+  for ( i=1; i < rtems_smp_get_number_of_processors() ; i++ ){
+    status = rtems_task_start( id, Test_task, i );
+
+    /* Force a wait on the task to run in order to synchronize on
+     * simulated systems.
+     */   
+    while (TaskRan[i] == false)
+      ;
+  }
+
+  ch = '0' + rtems_smp_get_number_of_processors() ;
+
+  status = rtems_task_create(
+    rtems_build_name( 'T', 'A', ch, ' ' ),
+    3,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_PREEMPT,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &id
+  );
+  status = rtems_task_start(
+    id,
+    Test_task,
+    rtems_smp_get_number_of_processors()
+  );
+  
+  /* Wait on the all tasks to run */
+  while (1) {
+    allDone = true;
+    for ( i=1; i<=rtems_smp_get_number_of_processors() ; i++ ) {
+      if (TaskRan[i] == false)
+        allDone = false;
+    }
+    if (allDone) {
+      Loop();
+      locked_printf( "*** END OF TEST SMP04 ***" );
+      rtems_test_exit( 0 );
+    }
+  }
+}

diff -u /dev/null rtems/testsuites/smptests/smp04/smp04.doc:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp04/smp04.doc	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,17 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-1999.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+This test startst Init task with priority 5 and preemption on which
+runs on CPU 0.  The init task alternates preemption off and preemtion
+on as it creates tasks for every other cpu in the system.  The priority
+of task N will be 5 + 2; task N-1 will be 5 + 4 .....
+Another task will be created after tasks are running on all cpus.  This
+task will be of a priority 3.  For a 4 cpu system this task should run
+on cpu 2.  For a 2 cpu system the task should preempt the Init task.

diff -u /dev/null rtems/testsuites/smptests/smp04/smp04.scn:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp04/smp04.scn	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,8 @@
+***  SMP04 TEST ***
+  CPU 0 running task Init
+  CPU 1 running task TA1
+  CPU 2 running task TA2
+  CPU 3 running task TA3
+  CPU 2 running task TA4
+*** END OF SMP 04 TEST ***
+

diff -u /dev/null rtems/testsuites/smptests/smp04/system.h:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp04/system.h	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,70 @@
+/* 
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+
+rtems_task Test_task(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   4 
+
+#define CONFIGURE_MAXIMUM_TASKS            \
+    (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_STACK_SIZE \
+    (3 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_PRIORITY        5 
+#define CONFIGURE_INIT_TASK_INITIAL_MODES   RTEMS_NO_PREEMPT
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES          1
+
+#include <rtems/confdefs.h>
+
+
+/* global variables */
+
+/*
+ *  Keep the names and IDs in global variables so another task can use them.
+ */
+void Loop(void);
+void PrintTaskInfo(
+  const char *task_name
+);
+
+TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ];
+
+/*
+ *  Handy macros and static inline functions
+ */
+
+/*
+ *  Macro to hide the ugliness of printing the time.
+ */
+
+/* end of include file */

diff -u /dev/null rtems/testsuites/smptests/smp04/tasks.c:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp04/tasks.c	Tue Jun 28 16:08:47 2011
@@ -0,0 +1,31 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+rtems_task Test_task(
+  rtems_task_argument task_index
+)
+{
+  char              task_name[5];
+
+  sprintf(task_name, "TA%" PRIu32, task_index );
+  PrintTaskInfo( task_name );
+
+  Loop();
+  TaskRan[task_index] = true;
+
+  while(1);
+}

diff -u /dev/null rtems/testsuites/smptests/smp05/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp05/.cvsignore	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp05/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp05/Makefile.am	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp05
+smp05_SOURCES = init.c ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp05.scn
+dist_rtems_tests_DATA += smp05.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+LINK_OBJS = $(smp05_OBJECTS) $(smp05_LDADD)
+LINK_LIBS = $(smp05_LDLIBS)
+
+smp05$(EXEEXT): $(smp05_OBJECTS) $(smp05_DEPENDENCIES)
+	@rm -f smp05$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp05/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp05/init.c	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,76 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+rtems_task Test_task(
+  rtems_task_argument argument
+)
+{
+  locked_printf( "Shut down from CPU %d\n", bsp_smp_processor_id() );
+  locked_printf( "*** END OF TEST SMP05 ***" );
+  rtems_test_exit(0);
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int                i;
+  char               ch;
+  int                cpu_num;
+  rtems_id           id;
+  rtems_status_code  status;
+
+  locked_print_initialize();
+  locked_printf( "\n\n*** TEST SMP05 ***\n" );
+
+  for ( i=0; i<rtems_smp_get_number_of_processors() ; i++ ) {
+    ch = '1' + i;
+
+    status = rtems_task_create(
+      rtems_build_name( 'T', 'A', ch, ' ' ),
+      1,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+    directive_failed( status, "task create" );
+
+    cpu_num = bsp_smp_processor_id();
+    locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+
+    status = rtems_task_start( id, Test_task, i+1 );
+    directive_failed( status, "task start" );
+  }
+
+  while (1)
+    ;
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   2
+
+#define CONFIGURE_MAXIMUM_TASKS            \
+    (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */

diff -u /dev/null rtems/testsuites/smptests/smp05/smp05.doc:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp05/smp05.doc	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,22 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-2010.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  smp05
+
+directives:
+
+  XXX list them
+
+concepts:
+
++ XXX list them

diff -u /dev/null rtems/testsuites/smptests/smp05/smp05.scn:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp05/smp05.scn	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,5 @@
+*** TEST SMP05 ***
+ CPU 0 start task TA1
+ CPU 0 start task TA2
+Shut down from CPU 1
+*** END OF TEST SMP05 ***

diff -u /dev/null rtems/testsuites/smptests/smp06/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:24 2011
+++ rtems/testsuites/smptests/smp06/.cvsignore	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp06/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp06/Makefile.am	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp06
+smp06_SOURCES = init.c ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp06.scn
+dist_rtems_tests_DATA += smp06.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+LINK_OBJS = $(smp06_OBJECTS) $(smp06_LDADD)
+LINK_LIBS = $(smp06_LDLIBS)
+
+smp06$(EXEEXT): $(smp06_OBJECTS) $(smp06_DEPENDENCIES)
+	@rm -f smp06$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp06/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp06/init.c	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,124 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+volatile bool Ran;
+
+rtems_task Test_task(
+  rtems_task_argument do_exit
+)
+{
+  int               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);
+
+  Ran = true;
+
+  if ( do_exit ) {
+    locked_printf( "*** END OF TEST SMP06 ***" );
+    rtems_test_exit(0);
+  }
+  while(1)
+    ;
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int                i;
+  char               ch;
+  int                cpu_num;
+  rtems_id           id;
+  rtems_status_code  status;
+
+  locked_print_initialize();
+  locked_printf( "\n\n*** TEST SMP06 ***\n" );
+  locked_printf( "rtems_clock_tick - so this task has run longer\n" );
+  status = rtems_clock_tick();
+  directive_failed( status, "clock tick" );
+
+  rtems_test_assert( rtems_smp_get_number_of_processors()  > 1 );
+
+  cpu_num = bsp_smp_processor_id();
+
+  /*
+   * Create a task at equal priority.
+   */
+  Ran = false;
+  status = rtems_task_create(
+    rtems_build_name( 'T', 'A', '1', ' ' ),
+    2,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_PREEMPT,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &id
+  );
+  directive_failed( status, "task create" );
+
+  locked_printf(" CPU %d start task TA1\n", cpu_num );
+
+  status = rtems_task_start( id, Test_task, 0 );
+  directive_failed( status, "task start" );
+
+  while ( Ran == false )
+    ;
+
+  /*
+   * Create a task at greater priority.
+   */
+  Ran = false;
+  status = rtems_task_create(
+    rtems_build_name( 'T', 'A', '2', ' ' ),
+    1,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_PREEMPT,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &id
+  );
+  directive_failed( status, "task create" );
+
+  cpu_num = bsp_smp_processor_id();
+  locked_printf(" CPU %d start task TA2\n", cpu_num );
+
+  status = rtems_task_start( id, Test_task, 1 );
+  directive_failed( status, "task start" );
+
+  while ( 1 )
+    ;
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS  2
+
+#define CONFIGURE_MAXIMUM_TASKS           4
+
+#define CONFIGURE_INIT_TASK_PRIORITY      2
+#define CONFIGURE_INIT_TASK_MODES         RTEMS_PREEMPT
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */

diff -u /dev/null rtems/testsuites/smptests/smp06/smp06.doc:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp06/smp06.doc	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,25 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-2011.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  smp06
+
+directives:
+
+  rtems_task_create
+  rtems_task_start
+
+concepts:
+
++ Ensure that in an SMP system, when given a choice to preempt one of two
+  threads at equal priority, the thread which has been running the longest
+  is selected.

diff -u /dev/null rtems/testsuites/smptests/smp06/smp06.scn:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp06/smp06.scn	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,7 @@
+** TEST SMP06 ***
+rtems_clock_tick - so this task has run longer
+ CPU 0 start task TA1
+ CPU 1 running Task TA1 
+ CPU 0 start task TA2
+ CPU 1 running Task TA2 
+*** END OF TEST SMP06 ***

diff -u /dev/null rtems/testsuites/smptests/smp07/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp07/.cvsignore	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp07/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp07/Makefile.am	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp07
+smp07_SOURCES = init.c ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp07.scn
+dist_rtems_tests_DATA += smp07.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+LINK_OBJS = $(smp07_OBJECTS) $(smp07_LDADD)
+LINK_LIBS = $(smp07_LDLIBS)
+
+smp07$(EXEEXT): $(smp07_OBJECTS) $(smp07_DEPENDENCIES)
+	@rm -f smp07$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp07/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp07/init.c	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,164 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+volatile bool TaskRan = false;
+volatile bool TSRFired = false;
+rtems_id      Semaphore; 
+
+rtems_task Test_task(
+  rtems_task_argument argument
+)
+{
+  int               cpu_num;
+  rtems_status_code sc;
+  char              name[5];
+  char             *p;
+
+  /* Get the task name */
+  p = rtems_object_get_name( RTEMS_SELF, 5, name );
+  rtems_test_assert( p != NULL );
+
+   /* Get the CPU Number */
+  cpu_num = bsp_smp_processor_id();
+
+  /* Print that the task is up and running. */
+  locked_printf(" CPU %d 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");
+
+  if ( !TSRFired )
+    locked_printf( "*** ERROR TSR DID NOT FIRE BUT TEST TASK AWAKE***" );
+
+  TaskRan = true;
+
+  /* Print that the task is up and running. */
+  locked_printf(" CPU %d running Task %s after semaphore release\n", cpu_num, name);
+
+  (void) rtems_task_delete( RTEMS_SELF );
+}
+
+
+rtems_timer_service_routine TimerMethod(
+  rtems_id  timer,
+  void     *arg
+)
+{
+  /*
+   * Set flag and release the semaphore, allowing the blocked tasks to start.
+   */
+  TSRFired = true;
+
+  rtems_semaphore_release( Semaphore );
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int                cpu_num;
+  rtems_id           id;
+  rtems_status_code  status;
+  rtems_interval     per_second;
+  rtems_interval     then;
+  rtems_id           Timer;
+
+  locked_print_initialize();
+  locked_printf( "\n\n*** TEST SMP07 ***\n" );
+
+  /* Create/verify semaphore */
+  status = rtems_semaphore_create(
+    rtems_build_name ('S', 'E', 'M', '1'),
+    1,                                             
+    RTEMS_LOCAL                   |
+    RTEMS_SIMPLE_BINARY_SEMAPHORE |
+    RTEMS_PRIORITY,
+    1,
+    &Semaphore
+  );
+  directive_failed( status, "rtems_semaphore_create" );
+
+  /* Lock semaphore */
+  status = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, 0);
+  directive_failed( status,"rtems_semaphore_obtain of SEM1\n");
+
+  /* Create and Start test task. */
+  status = rtems_task_create(
+    rtems_build_name( 'T', 'A', '1', ' ' ),
+    1,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &id
+  );
+  directive_failed( status, "task create" );
+
+  cpu_num = bsp_smp_processor_id();
+  locked_printf(" CPU %d start task TA1\n", cpu_num );
+  status = rtems_task_start( id, Test_task, 1 );
+  directive_failed( status, "task start" );
+
+  /* Create and start TSR */
+  locked_printf(" CPU %d create and start timer\n", cpu_num );
+  status = rtems_timer_create( rtems_build_name( 'T', 'M', 'R', '1' ), &Timer);
+  directive_failed( status, "rtems_timer_create" );
+
+  per_second = rtems_clock_get_ticks_per_second();
+  status = rtems_timer_fire_after( Timer, 2 * per_second, TimerMethod, NULL );
+  directive_failed( status, "rtems_timer_fire_after");
+
+  /*
+   *  Wait long enough that TSR should have fired.
+   *
+   *  Spin so CPU 0 is consumed.  This forces task to run on CPU 1.
+   */
+  then = rtems_clock_get_ticks_since_boot() + 4 * per_second;
+  while (1) {
+    if ( rtems_clock_get_ticks_since_boot() > then )
+      break;
+    if ( TSRFired && TaskRan )
+      break;
+  };
+  
+  /* Validate the timer fired and that the task ran */
+  if ( !TSRFired )
+    locked_printf( "*** ERROR TSR DID NOT FIRE ***" );
+
+  if ( !TaskRan ) {
+    locked_printf( "*** ERROR TASK DID NOT RUN ***" );
+    rtems_test_exit(0);
+  }
+
+  /* End the program */
+  locked_printf( "*** END OF TEST SMP07 ***\n" );
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   2
+#define CONFIGURE_MAXIMUM_TIMERS           1
+
+#define CONFIGURE_MAXIMUM_TASKS            2
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_MAXIMUM_SEMAPHORES       1
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */

diff -u /dev/null rtems/testsuites/smptests/smp07/smp07.doc:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp07/smp07.doc	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,24 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-2010.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  smp07
+
+directives:
+
+  rtems_semaphore_obtain
+  rtems_semaphore_release
+
+concepts:
+
++ Ensure that if a task is unblocked from an ISR on an SMP system, that
+  it will run.

diff -u /dev/null rtems/testsuites/smptests/smp07/smp07.scn:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp07/smp07.scn	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,6 @@
+*** TEST SMP07 ***
+ CPU 0 start task TA1
+ CPU 0 create and start timer
+ CPU 1 runnng Task TA1  and blocking
+ CPU 1 running Task TA1  after semaphore release
+*** END OF TEST SMP07 ***

diff -u /dev/null rtems/testsuites/smptests/smp08/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp08/.cvsignore	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp08/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:25 2011
+++ rtems/testsuites/smptests/smp08/Makefile.am	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,29 @@
+##
+##  $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp08
+smp08_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp08.scn
+dist_rtems_tests_DATA += smp08.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+smp08_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+LINK_OBJS = $(smp08_OBJECTS) $(smp08_LDADD)
+LINK_LIBS = $(smp08_LDLIBS)
+
+smp08$(EXEEXT): $(smp08_OBJECTS) $(smp08_DEPENDENCIES)
+	@rm -f smp08$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp08/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp08/init.c	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,97 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+void PrintTaskInfo(
+  const char         *task_name,
+  rtems_time_of_day  *_tb 
+)
+{
+  int               cpu_num;
+  rtems_status_code sc;
+
+  cpu_num = bsp_smp_processor_id();
+
+  /* Print the cpu number and task name */
+  locked_printf(
+    "  CPU %d running task %s - rtems_clock_get_tod "
+    "%02" PRId32 ":%02" PRId32 ":%02" PRId32 "   %02" PRId32 
+        "/%02" PRId32 "/%04" PRId32 "\n",
+    cpu_num,
+    task_name,
+    _tb->hour, _tb->minute, _tb->second, 
+    _tb->month, _tb->day, _tb->year
+  ); 
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code status;
+  rtems_time_of_day time;
+  int               i;
+  char              ch;
+  rtems_id          id;
+ 
+  locked_print_initialize();
+  locked_printf( "\n\n*** SMP08 TEST ***\n" );
+
+  time.year   = 1988;
+  time.month  = 12;
+  time.day    = 31;
+  time.hour   = 9;
+  time.minute = 0;
+  time.second = 0;
+  time.ticks  = 0;
+
+  status = rtems_clock_set( &time );
+
+  /* Create/verify synchronisation semaphore */
+  status = rtems_semaphore_create(
+    rtems_build_name ('S', 'E', 'M', '1'),
+    1,                                             
+    RTEMS_LOCAL                   |
+    RTEMS_SIMPLE_BINARY_SEMAPHORE |
+    RTEMS_PRIORITY,
+    1,
+    &Semaphore
+  );
+  directive_failed( status, "rtems_semaphore_create" );
+
+  /* Show that the init task is running on this cpu */
+  PrintTaskInfo( "Init", &time );
+
+  for ( i=1; i <= rtems_smp_get_number_of_processors() *3; i++ ) {
+    ch = '0' + i;
+
+    status = rtems_task_create(
+      rtems_build_name( 'T', 'A', ch, ' ' ),
+      1,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+    directive_failed( status, "task create" );
+
+    status = rtems_task_start( id, Test_task, i+1 );
+    directive_failed( status, "task start" );
+  }
+
+  status = rtems_task_delete( RTEMS_SELF );
+}

diff -u /dev/null rtems/testsuites/smptests/smp08/smp08.doc:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp08/smp08.doc	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,12 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-1999.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+

diff -u /dev/null rtems/testsuites/smptests/smp08/smp08.scn:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp08/smp08.scn	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,16 @@
+*** CLOCK TICK TEST ***
+TA1 - clock_get_tod - 09:00:00   12/31/1988
+TA2 - clock_get_tod - 09:00:00   12/31/1988
+TA3 - clock_get_tod - 09:00:00   12/31/1988
+TA1 - clock_get_tod - 09:00:05   12/31/1988
+TA1 - clock_get_tod - 09:00:10   12/31/1988
+TA2 - clock_get_tod - 09:00:10   12/31/1988
+TA1 - clock_get_tod - 09:00:15   12/31/1988
+TA3 - clock_get_tod - 09:00:15   12/31/1988
+TA1 - clock_get_tod - 09:00:20   12/31/1988
+TA2 - clock_get_tod - 09:00:20   12/31/1988
+TA1 - clock_get_tod - 09:00:25   12/31/1988
+TA1 - clock_get_tod - 09:00:30   12/31/1988
+TA2 - clock_get_tod - 09:00:30   12/31/1988
+TA3 - clock_get_tod - 09:00:30   12/31/1988
+*** END OF CLOCK TICK TEST ***

diff -u /dev/null rtems/testsuites/smptests/smp08/system.h:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp08/system.h	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,56 @@
+/*  system.h
+ *
+ *  This include file contains information that is included in every
+ *  function in the test set.
+ *
+ *  COPYRIGHT (c) 1989-2009.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+
+rtems_task Test_task(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   4 
+
+#define CONFIGURE_MAXIMUM_TASKS            \
+    (1 + (CONFIGURE_SMP_MAXIMUM_PROCESSORS*3) )
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)
+#define CONFIGURE_MAXIMUM_SEMAPHORES          1
+  
+#include <rtems/confdefs.h>
+
+TEST_EXTERN rtems_id       Semaphore;      /* synchronisation semaphore */ 
+
+void PrintTaskInfo(
+  const char         *task_name,
+  rtems_time_of_day  *_tb 
+);
+
+/* end of include file */

diff -u /dev/null rtems/testsuites/smptests/smp08/tasks.c:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp08/tasks.c	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,59 @@
+/*  Test_task
+ *
+ *  This routine serves as a test task.  It verifies the basic task
+ *  switching capabilities of the executive.
+ *
+ *  Input parameters:  NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2009.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+rtems_task Test_task(
+  rtems_task_argument unused
+)
+{
+  rtems_id          tid;
+  rtems_time_of_day time;
+  uint32_t    task_index;
+  rtems_status_code status;
+  int               cpu_num;
+  char              name[5];
+  char             *p;
+
+  /* Get the task name */
+  p = rtems_object_get_name( RTEMS_SELF, 5, name );
+  rtems_test_assert( p != NULL );
+
+  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  task_index = task_number( tid );
+  for ( ; ; ) {
+
+    /* Get the CPU Number */
+    cpu_num = bsp_smp_processor_id();
+
+    status = rtems_clock_get_tod( &time );
+    if ( time.second >= 35 ) {
+      locked_printf( "*** END OF SMP08 TEST ***" );
+      rtems_test_exit( 0 );
+    }
+
+    PrintTaskInfo( p, &time );
+    status = rtems_task_wake_after(
+      task_index * 5 * rtems_clock_get_ticks_per_second() );
+  }
+}

diff -u /dev/null rtems/testsuites/smptests/smp09/.cvsignore:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp09/.cvsignore	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/smptests/smp09/Makefile.am:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp09/Makefile.am	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp09
+smp09_SOURCES = init.c ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp09.scn
+dist_rtems_tests_DATA += smp09.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST 
+
+LINK_OBJS = $(smp09_OBJECTS) $(smp09_LDADD)
+LINK_LIBS = $(smp09_LDLIBS)
+
+smp09$(EXEEXT): $(smp09_OBJECTS) $(smp09_DEPENDENCIES)
+	@rm -f smp09$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/smptests/smp09/init.c:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp09/init.c	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,88 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+#include <rtems/cpuuse.h>
+
+volatile int killtime;
+
+rtems_task Test_task(
+  rtems_task_argument argument
+)
+{
+  while (1)
+    ;
+  /* XXX something goes here */
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int                i;
+  char               ch;
+  int                cpu_num;
+  rtems_id           id;
+  rtems_status_code  status;
+
+  locked_print_initialize();
+  locked_printf( "\n\n*** TEST SMP09 ***\n" );
+
+  for ( killtime=0; killtime<1000000; killtime++ )
+    ;
+  
+  for ( i=0; i<rtems_smp_get_number_of_processors() -1; i++ ) {
+    ch = '1' + i;
+
+    status = rtems_task_create(
+      rtems_build_name( 'T', 'A', ch, ' ' ),
+      1,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+    directive_failed( status, "task create" );
+
+    cpu_num = bsp_smp_processor_id();
+    locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+
+    status = rtems_task_start( id, Test_task, i+1 );
+    directive_failed( status, "task start" );
+  }
+
+  locked_printf(" kill 10 clock ticks\n" );
+  while ( rtems_clock_get_ticks_since_boot() < 10 )
+    ;
+
+  rtems_cpu_usage_report();
+
+  locked_printf( "*** END OF TEST SMP09 ***" );
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   4
+
+#define CONFIGURE_MAXIMUM_TASKS            \
+    (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */

diff -u /dev/null rtems/testsuites/smptests/smp09/smp09.doc:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp09/smp09.doc	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,22 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-2011.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  smp09
+
+directives:
+
+  + rtems_cpu_usage_report
+
+concepts:
+
++ Verify that CPU usage reporting is correct in an SMP configuration

diff -u /dev/null rtems/testsuites/smptests/smp09/smp09.scn:1.1
--- /dev/null	Tue Jun 28 16:11:26 2011
+++ rtems/testsuites/smptests/smp09/smp09.scn	Tue Jun 28 16:08:48 2011
@@ -0,0 +1,22 @@
+*** TEST SMP09 ***
+ CPU 0 start task TA1
+ CPU 0 start task TA2
+ CPU 0 start task TA3
+ kill 10 clock ticks
+-------------------------------------------------------------------------------
+                              CPU USAGE BY THREAD
+------------+----------------------------------------+---------------+---------
+ ID         | NAME                                   | SECONDS       | PERCENT
+------------+----------------------------------------+---------------+---------
+ 0x09010001 | IDLE                                   |      0.000000 |   0.000
+ 0x09010002 | IDLE                                   |      3.780012 |  15.060
+ 0x09010003 | IDLE                                   |     26.961831 | 100.000
+ 0x09010004 | IDLE                                   |     28.811601 | 100.000
+ 0x0A010001 | UI1                                    |     31.344809 | 100.000
+ 0x0A010002 | TA1                                    |     30.520797 |  88.979
+ 0x0A010003 | TA2                                    |      0.000000 |   0.000
+ 0x0A010004 | TA3                                    |      0.000000 |   0.000
+------------+----------------------------------------+---------------+---------
+ TIME SINCE LAST CPU USAGE RESET IN SECONDS:                         39.731571
+-------------------------------------------------------------------------------
+*** END OF TEST SMP09 ***


 *joel*:
2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>

	* configure.ac, support/include/test_support.h:
	* support/src/locked_print.c: New file.

M  1.184  testsuites/ChangeLog
M   1.31  testsuites/configure.ac
M    1.6  testsuites/support/include/test_support.h
A    1.1  testsuites/support/src/locked_print.c

diff -u rtems/testsuites/ChangeLog:1.183 rtems/testsuites/ChangeLog:1.184
--- rtems/testsuites/ChangeLog:1.183	Wed Apr 27 12:20:35 2011
+++ rtems/testsuites/ChangeLog	Tue Jun 28 16:09:13 2011
@@ -1,3 +1,8 @@
+2011-06-28	Joel Sherrill <joel.sherrill at oarcorp.com>
+
+	* configure.ac, support/include/test_support.h:
+	* support/src/locked_print.c: New file.
+
 2011-04-27	Jennifer Averett <Jennifer.Averett at OARcorp.com>
 
 	PR 1784

diff -u rtems/testsuites/configure.ac:1.30 rtems/testsuites/configure.ac:1.31
--- rtems/testsuites/configure.ac:1.30	Wed Apr 20 16:30:36 2011
+++ rtems/testsuites/configure.ac	Tue Jun 28 16:09:13 2011
@@ -25,6 +25,7 @@
 RTEMS_CHECK_CPUOPTS([RTEMS_POSIX_API])
 RTEMS_CHECK_CPUOPTS([RTEMS_MULTIPROCESSING])
 RTEMS_CHECK_CPUOPTS([RTEMS_NETWORKING])
+RTEMS_CHECK_CPUOPTS([RTEMS_SMP])
 
 case $enable_tests in
 yes | samples )
@@ -38,6 +39,9 @@
   if test "$rtems_cv_RTEMS_MULTIPROCESSING" = "yes"; then
     AC_CONFIG_SUBDIRS(mptests)
   fi
+  if test "$rtems_cv_RTEMS_SMP" = "yes"; then
+    AC_CONFIG_SUBDIRS(smptests)
+  fi
   # Now do performance tests
   AC_CONFIG_SUBDIRS(tmtests psxtmtests)
 fi

diff -u rtems/testsuites/support/include/test_support.h:1.5 rtems/testsuites/support/include/test_support.h:1.6
--- rtems/testsuites/support/include/test_support.h:1.5	Wed Jul 14 11:03:57 2010
+++ rtems/testsuites/support/include/test_support.h	Tue Jun 28 16:09:13 2011
@@ -1,5 +1,5 @@
 /*
- *  COPYRIGHT (c) 1989-2010.
+ *  COPYRIGHT (c) 1989-2011.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -80,6 +80,15 @@
   int                       overhead
 );
 
+/*********************************************************************/
+/*********************************************************************/
+/**************              TEST SUPPORT               **************/
+/*********************************************************************/
+/*********************************************************************/
+extern void locked_print_init(void);
+extern void locked_printf(const char *fmt, ...);
+extern void locked_printk(const char *fmt, ...);
+
 #ifdef __cplusplus
 };
 #endif

diff -u /dev/null rtems/testsuites/support/src/locked_print.c:1.1
--- /dev/null	Tue Jun 28 16:11:27 2011
+++ rtems/testsuites/support/src/locked_print.c	Tue Jun 28 16:09:13 2011
@@ -0,0 +1,87 @@
+/* 
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <rtems/system.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include "tmacros.h"
+
+static rtems_id locked_print_semaphore;      /* synchronisation semaphore */ 
+
+void locked_print_initialize(void)
+{
+  rtems_status_code sc;
+  static            bool initted = false;
+
+  if ( initted )
+    return;
+
+  initted = true;
+
+  /* Create/verify synchronisation semaphore */
+  sc = rtems_semaphore_create(
+    rtems_build_name ('S', 'E', 'M', '1'),
+    1,                                             
+    RTEMS_LOCAL                   |
+    RTEMS_SIMPLE_BINARY_SEMAPHORE |
+    RTEMS_PRIORITY,
+    1,
+    &locked_print_semaphore
+  );
+  directive_failed( sc, "rtems_semaphore_create" );
+}
+
+void locked_printf(const char *fmt, ...) {
+  va_list           ap;       /* points to each unnamed argument in turn */
+  rtems_status_code sc;
+
+  locked_print_initialize();
+
+  /* Lock semaphore without releasing the cpu */
+  do {
+    sc = rtems_semaphore_obtain( locked_print_semaphore, RTEMS_NO_WAIT, 0 );
+  } while (sc != RTEMS_SUCCESSFUL );
+
+
+  va_start(ap, fmt); /* make ap point to 1st unnamed arg */
+  vprintf(fmt, ap);
+  va_end(ap);        /* clean up when done */
+
+  /* Release the semaphore  */
+  sc = rtems_semaphore_release( locked_print_semaphore );
+} 
+
+void locked_printk(const char *fmt, ...) {
+  va_list           ap;       /* points to each unnamed argument in turn */
+  rtems_status_code sc;
+
+
+  locked_print_initialize();
+
+  /* Lock semaphore without releasing the cpu */
+  do {
+    sc = rtems_semaphore_obtain( locked_print_semaphore, RTEMS_NO_WAIT, 0 );
+  } while (sc != RTEMS_SUCCESSFUL );
+
+  va_start(ap, fmt); /* make ap point to 1st unnamed arg */
+  vprintk(fmt, ap);
+  va_end(ap);        /* clean up when done */
+
+  /* Release the semaphore  */
+  sc = rtems_semaphore_release( locked_print_semaphore );
+} 



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110628/450fe804/attachment.html>


More information about the vc mailing list