summaryrefslogtreecommitdiffstats
path: root/c/src/tests/sptests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-06-12 20:06:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-06-12 20:06:59 +0000
commit41ab696625ec33c00b1788f200bc6e25edf30c8d (patch)
treef49cb1f9f8e7c0e454eeac250f7107bb0c6e2919 /c/src/tests/sptests
parentPatch from John Cotton <john.cotton@nrc.ca>, Charles-Antoine Gauthier (diff)
downloadrtems-41ab696625ec33c00b1788f200bc6e25edf30c8d.tar.bz2
Patch from John Cotton <john.cotton@nrc.ca>, Charles-Antoine Gauthier
<charles.gauthier@iit.nrc.ca>, and Darlene A. Stewart <Darlene.Stewart@nrc.ca> to add support for a number of very significant things: + BSPs for many variations on the Motorola MBX8xx board series + Cache Manager including initial support for m68040 and PowerPC + Rework of mpc8xx libcpu code so all mpc8xx CPUs now use same code base. + Rework of eth_comm BSP to utiltize above. John reports this works on the 821 and 860
Diffstat (limited to 'c/src/tests/sptests')
-rw-r--r--c/src/tests/sptests/threaditerate/Makefile.am43
-rw-r--r--c/src/tests/sptests/threaditerate/init.c202
-rw-r--r--c/src/tests/sptests/threaditerate/itrontask.c52
-rw-r--r--c/src/tests/sptests/threaditerate/pthread.c46
-rw-r--r--c/src/tests/sptests/threaditerate/rtemstask.c47
-rw-r--r--c/src/tests/sptests/threaditerate/system.h98
-rw-r--r--c/src/tests/sptests/threaditerate/threadinfo.c178
-rw-r--r--c/src/tests/sptests/threaditerate/threaditerate.scn205
8 files changed, 871 insertions, 0 deletions
diff --git a/c/src/tests/sptests/threaditerate/Makefile.am b/c/src/tests/sptests/threaditerate/Makefile.am
new file mode 100644
index 0000000000..b52b949e2c
--- /dev/null
+++ b/c/src/tests/sptests/threaditerate/Makefile.am
@@ -0,0 +1,43 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+TEST = threaditerate
+
+MANAGERS = all
+
+C_FILES = init.c threadinfo.c rtemstask.c pthread.c itron_task.c
+C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
+
+H_FILES = system.h
+noinst_HEADERS =$(H_FILES)
+
+DOCTYPES = scn doc
+DOCS = $(DOCTYPES:%=$(TEST).%)
+
+SRCS = $(C_FILES) $(H_FILES)
+OBJS = $(C_O_FILES)
+
+PRINT_SRCS = $(DOCS)
+
+PGM = ${ARCH}/$(TEST).exe
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(RTEMS_ROOT)/make/leaf.cfg
+include $(top_srcdir)/sptests.am
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/../psxtests/include
+
+${PGM}: $(OBJS) $(LINK_FILES)
+ $(make-exe)
+
+all: $(ARCH) $(TMPINSTALL_FILES)
+
+EXTRA_DIST = $(C_FILES) $(DOCS)
+
+include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/tests/sptests/threaditerate/init.c b/c/src/tests/sptests/threaditerate/init.c
new file mode 100644
index 0000000000..58743986af
--- /dev/null
+++ b/c/src/tests/sptests/threaditerate/init.c
@@ -0,0 +1,202 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_time_of_day time;
+ rtems_status_code rtems_status;
+
+#ifdef RTEMS_POSIX_API
+ int posix_status;
+#endif
+
+#ifdef RTEMS_ITRON_API
+ ER itron_status;
+ T_CTSK pk_ctsk;
+#endif
+
+ puts( "\n\n*** Thread Iteration Test ***" );
+
+ build_time( &time, 12, 31, 2000, 9, 0, 0, 0 );
+ rtems_status = rtems_clock_set( &time );
+ directive_failed( rtems_status, "rtems_clock_set" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+ rtems_status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_INTERRUPT_LEVEL(31),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( rtems_status, "rtems_task_create of TA1" );
+
+ rtems_status = rtems_task_create(
+ Task_name[ 2 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( rtems_status, "rtems_task_create of TA2" );
+
+ rtems_status = rtems_task_create(
+ Task_name[ 3 ],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE * 3,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( rtems_status, "rtems_task_create of TA3" );
+
+ rtems_status = rtems_task_start( Task_id[ 1 ], RTEMS_task_1_through_3, 0 );
+ if ( rtems_status == RTEMS_SUCCESSFUL )
+ printf("Created and started an RTEMS task with id = 0x%08x\n", Task_id[1] );
+ else
+ directive_failed( rtems_status, "rtems_task_start of TA1" );
+
+ rtems_status = rtems_task_start( Task_id[ 2 ], RTEMS_task_1_through_3, 0 );
+ if ( rtems_status == RTEMS_SUCCESSFUL )
+ printf("Created and started an RTEMS task with id = 0x%08x\n", Task_id[2] );
+ else
+ directive_failed( rtems_status, "rtems_task_start of TA2" );
+
+ rtems_status = rtems_task_start( Task_id[ 3 ], RTEMS_task_1_through_3, 0 );
+ if ( rtems_status == RTEMS_SUCCESSFUL )
+ printf("Created and started an RTEMS task with id = 0x%08x\n", Task_id[3] );
+ else
+ directive_failed( rtems_status, "rtems_task_start of TA3" );
+
+#ifdef RTEMS_POSIX_API
+ posix_status = pthread_create( &pthread_id[0], NULL, pthread_1_through_3, NULL );
+ if ( !posix_status )
+ printf("Created and started a pthread with id = 0x%08x\n", pthread_id[0] );
+ else
+ assert( !posix_status );
+
+ posix_status = pthread_create( &pthread_id[1], NULL, pthread_1_through_3, NULL );
+ if ( !posix_status )
+ printf("Created and started a pthread with id = 0x%08x\n", pthread_id[1] );
+ else
+ assert( !posix_status );
+
+ posix_status = pthread_create( &pthread_id[2], NULL, pthread_1_through_3, NULL );
+ if ( !posix_status )
+ printf("Created and started a pthread with id = 0x%08x\n", pthread_id[2] );
+ else
+ assert( !posix_status );
+
+#endif
+
+#ifdef RTEMS_ITRON_API
+
+#define ITRON_GET_TASK_ID(_index) \
+ _ITRON_Task_Information.local_table[_index]->id
+
+ pk_ctsk.exinf = NULL;
+ pk_ctsk.tskatr = TA_HLNG;
+ pk_ctsk.itskpri = 1;
+ pk_ctsk.task = ITRON_task_2_through_4;
+ pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 2;
+
+ itron_status = cre_tsk( 2, &pk_ctsk );
+ directive_failed( itron_status, "cre_tsk of task" );
+
+ pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 2;
+ itron_status = cre_tsk( 3, &pk_ctsk );
+ directive_failed( itron_status, "cre_tsk of TA2" );
+
+ pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 3;
+ itron_status = cre_tsk( 4, &pk_ctsk );
+ directive_failed( itron_status, "cre_tsk of TA3" );
+
+ itron_status = sta_tsk( 2, 0 );
+ if ( !itron_status )
+ printf("Created and started an ITRON task with id = 0x%08x\n", ITRON_GET_TASK_ID( 2 ) );
+ else
+ directive_failed( itron_status, "sta_tsk of ITRON task 2" );
+
+ itron_status = sta_tsk( 3, 0 );
+ if ( !itron_status )
+ printf("Created and started an ITRON task with id = 0x%08x\n", ITRON_GET_TASK_ID( 3 ) );
+ else
+ directive_failed( itron_status, "sta_tsk of ITRON task 3" );
+
+ itron_status = sta_tsk( 4, 0 );
+ if ( !itron_status )
+ printf("Created and started an ITRON task with id = 0x%08x\n", ITRON_GET_TASK_ID( 4 ) );
+ else
+ directive_failed( itron_status, "sta_tsk of ITRON task 4" );
+#endif
+
+ printf( "Sleeping for 5 seconds\n" );
+ fflush( stdout );
+
+ rtems_status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
+ directive_failed( rtems_status, "rtems_task_wake_after" );
+
+ printf( "\nLooking for all threads\n\n" );
+ _Thread_Local_iterate( print_thread_info, NULL, FALSE );
+
+ printf( "That was it. Sleeping for 20 seconds.\n" );
+
+ rtems_status = rtems_task_wake_after( 20 * TICKS_PER_SECOND );
+ directive_failed( rtems_status, "rtems_task_wake_after" );
+
+ /* If we get here, all threads were created */
+ printf( "\nDeleting the second thread of each type\n\n" );
+
+ rtems_status = rtems_task_suspend( Task_id[2] );
+ directive_failed( rtems_status, "rtems_task_suspend" );
+ rtems_status = rtems_task_delete( Task_id[2] );
+ directive_failed( rtems_status, "rtems_task_delete" );
+
+#ifdef RTEMS_POSIX_API
+ posix_status = pthread_cancel( pthread_id[2] );
+ assert( !posix_status );
+#endif
+
+#ifdef RTEMS_ITRON_API
+ itron_status = ter_tsk( 3 );
+ directive_failed( itron_status, "ter_tsk of ITRON task 3" );
+#endif
+
+ printf( "\nLooking for all threads\n\n" );
+ _Thread_Local_iterate( print_thread_info, NULL, FALSE );
+
+ printf( "That was it. Exiting\n" );
+ fflush( stdout );
+
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/threaditerate/itrontask.c b/c/src/tests/sptests/threaditerate/itrontask.c
new file mode 100644
index 0000000000..8ae8364d66
--- /dev/null
+++ b/c/src/tests/sptests/threaditerate/itrontask.c
@@ -0,0 +1,52 @@
+/* Task_1_through_3
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void ITRON_task_2_through_4( void )
+{
+ ID tid;
+ int tid_index;
+ rtems_time_of_day time;
+ ER status;
+ char name[30];
+
+ status = get_tid( &tid );
+ directive_failed( status, "get_tid");
+
+ tid_index = tid - 1; /* account for init tasks */
+
+ status = rtems_task_wake_after( 10 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ sprintf(name, "ITRON task %d", tid_index);
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ printf(name);
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_wake_after( 30 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
+
diff --git a/c/src/tests/sptests/threaditerate/pthread.c b/c/src/tests/sptests/threaditerate/pthread.c
new file mode 100644
index 0000000000..0dd76fcb91
--- /dev/null
+++ b/c/src/tests/sptests/threaditerate/pthread.c
@@ -0,0 +1,46 @@
+/* pthread_1_through_3
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include <sys/utsname.h>
+
+void * pthread_1_through_3( void *argument )
+{
+ int status;
+ struct timespec tv;
+ struct timespec tr;
+ time_t remaining;
+
+ remaining = sleep( 10 );
+ assert( !remaining );
+
+ while( FOREVER ) {
+ status = clock_gettime( CLOCK_REALTIME, &tv );
+ posix_service_failed( status, "clock_gettime" );
+
+ printf( "pthread: ID is 0x%08x\n", pthread_self() );
+ printf( " - clock_gettime - %s\n", ctime( &tv.tv_sec ) );
+
+ remaining = sleep( 30 );
+ assert( !remaining );
+ }
+
+ return NULL; /* just so the compiler thinks we returned something */
+}
diff --git a/c/src/tests/sptests/threaditerate/rtemstask.c b/c/src/tests/sptests/threaditerate/rtemstask.c
new file mode 100644
index 0000000000..4a15ebec5f
--- /dev/null
+++ b/c/src/tests/sptests/threaditerate/rtemstask.c
@@ -0,0 +1,47 @@
+/* Task_1_through_3
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task RTEMS_task_1_through_3(
+ rtems_task_argument argument
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ directive_failed( status, "rtems_task_ident" );
+
+ status = rtems_task_wake_after( 10 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ while( FOREVER ) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ put_name( Task_name[ task_number( tid ) ], FALSE );
+ print_time( " - rtems_clock_get - ", &time, "\n" );
+
+ status = rtems_task_wake_after( 30 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
diff --git a/c/src/tests/sptests/threaditerate/system.h b/c/src/tests/sptests/threaditerate/system.h
new file mode 100644
index 0000000000..7792073f62
--- /dev/null
+++ b/c/src/tests/sptests/threaditerate/system.h
@@ -0,0 +1,98 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+/* RTEMS API */
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/states.h>
+#include <rtems/score/thread.h>
+
+unsigned32 print_thread_info( Thread_Control *thread, void * arg );
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init( rtems_task_argument argument );
+rtems_task RTEMS_task_1_through_3( rtems_task_argument argument );
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE)
+
+
+
+/* POSIX API */
+
+#ifdef RTEMS_POSIX_API
+
+#include <pmacros.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sched.h>
+
+/* functions */
+
+void *pthread_1_through_3( void *argument );
+
+/* global variables */
+
+TEST_EXTERN pthread_t pthread_id[3]; /* array of pthread ids */
+
+/* configuration information */
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 3
+
+#endif
+
+
+
+/* ITRON API */
+
+#ifdef RTEMS_ITRON_API
+
+#include <itron.h>
+#include <rtems/itron/task.h>
+
+/* functions */
+
+void ITRON_task_2_through_4( void );
+
+/* global variables */
+
+TEST_EXTERN Objects_Locations location;
+
+
+/* configuration information */
+
+#endif
+
+#include <confdefs.h>
+
+/* end of include file */
diff --git a/c/src/tests/sptests/threaditerate/threadinfo.c b/c/src/tests/sptests/threaditerate/threadinfo.c
new file mode 100644
index 0000000000..baf4822a5a
--- /dev/null
+++ b/c/src/tests/sptests/threaditerate/threadinfo.c
@@ -0,0 +1,178 @@
+/* threadinfo.c
+ *
+ * Routines to print out information about threads.
+ */
+
+#include "system.h"
+#include <stdlib.h>
+
+#define PTR unsigned int
+#define PTR_MASK "0x%08x"
+
+/*
+ * Return a pointer to a string describing the object type.
+ */
+
+const char * _Objects_Type_to_String( Objects_Control * object )
+{
+ switch( _Objects_Get_class( object->id ) ) {
+ case OBJECTS_NO_CLASS:
+ return "NO_CLASS";
+
+ case OBJECTS_INTERNAL_THREADS:
+ return "INTERNAL_THREADS";
+
+ case OBJECTS_RTEMS_TASKS:
+ return "RTEMS_TASKS";
+
+ case OBJECTS_POSIX_THREADS:
+ return "POSIX_THREADS";
+
+ case OBJECTS_ITRON_TASKS:
+ return "ITRON_TASKS";
+
+ case OBJECTS_RTEMS_TIMERS:
+ return "RTEMS_TIMERS";
+
+ case OBJECTS_RTEMS_SEMAPHORES:
+ return "RTEMS_SEMAPHORES";
+
+ case OBJECTS_RTEMS_MESSAGE_QUEUES:
+ return "RTEMS_MESSAGE_QUEUES";
+
+ case OBJECTS_RTEMS_PARTITIONS:
+ return "RTEMS_PARTITIONS";
+
+ case OBJECTS_RTEMS_REGIONS:
+ return "RTEMS_REGIONS";
+
+ case OBJECTS_RTEMS_PORTS:
+ return "RTEMS_PORTS";
+
+ case OBJECTS_RTEMS_PERIODS:
+ return "RTEMS_PERIODS";
+
+ case OBJECTS_RTEMS_EXTENSIONS:
+ return "RTEMS_EXTENSIONS";
+
+ case OBJECTS_POSIX_KEYS:
+ return "POSIX_KEYS";
+
+ case OBJECTS_POSIX_INTERRUPTS:
+ return "POSIX_INTERRUPTS";
+
+ case OBJECTS_POSIX_MESSAGE_QUEUES:
+ return "POSIX_MESSAGE_QUEUES";
+
+ case OBJECTS_POSIX_MUTEXES:
+ return "POSIX_MUTEXES";
+
+ case OBJECTS_POSIX_SEMAPHORES:
+ return "POSIX_SEMAPHORES";
+
+ case OBJECTS_POSIX_CONDITION_VARIABLES:
+ return "POSIX_CONDITION_VARIABLES";
+
+ case OBJECTS_ITRON_EVENTFLAGS:
+ return "ITRON_EVENTFLAGS";
+
+ case OBJECTS_ITRON_MAILBOXES:
+ return "ITRON_MAILBOXES";
+
+ case OBJECTS_ITRON_MESSAGE_BUFFERS:
+ return "ITRON_MESSAGE_BUFFERS";
+
+ case OBJECTS_ITRON_PORTS:
+ return "ITRON_PORTS";
+
+ case OBJECTS_ITRON_SEMAPHORES:
+ return "ITRON_SEMAPHORES";
+
+ case OBJECTS_ITRON_VARIABLE_MEMORY_POOLS:
+ return "ITRON_VARIABLE_MEMORY_POOLS";
+
+ case OBJECTS_ITRON_FIXED_MEMORY_POOLS:
+ return "ITRON_FIXED_MEMORY_POOLS";
+
+ default:
+ return "UNKNOWN";
+ }
+}
+
+
+/*
+ * Return a pointer to a string describing the thread state
+ */
+
+const char * _Thread_State_to_String( States_Control state )
+{
+ States_Control orig_state = state;
+ int i;
+ int first_entry = TRUE;
+ static char buffer[256];
+ static const char *desc[] = {
+ "READY", /* 0 - 0x00000 */
+ "DORMANT", /* 1 - 0x00001 */
+ "SUSPENDED", /* 2 - 0x00002 */
+ "TRANSIENT", /* 3 - 0x00004 */
+ "DELAYING", /* 4 - 0x00008 */
+ "WAITING_FOR_TIME", /* 5 - 0x00010 */
+ "WAITING_FOR_BUFFER", /* 6 - 0x00020 */
+ "WAITING_FOR_SEGMENT", /* 7 - 0x00040 */
+ "WAITING_FOR_MESSAGE", /* 8 - 0x00080 */
+ "WAITING_FOR_EVENT", /* 9 - 0x00100 */
+ "WAITING_FOR_SEMAPHORE", /* 10 - 0x00200 */
+ "WAITING_FOR_MUTEX", /* 11 - 0x00400 */
+ "WAITING_FOR_CONDITION_VARIABLE", /* 12 - 0x00800 */
+ "WAITING_FOR_JOIN_AT_EXIT", /* 13 - 0x01000 */
+ "WAITING_FOR_RPC_REPLY", /* 14 - 0x02000 */
+ "WAITING_FOR_PERIOD", /* 15 - 0x04000 */
+ "WAITING_FOR_SIGNAL", /* 16 - 0x08000 */
+ "INTERRUPTIBLE_BY_SIGNAL", /* 17 - 0x10000 */
+ "UNKNOWN" /* 18 - all higher bits */
+ };
+
+ if( state == STATES_READY )
+ return desc[0];
+
+ memset( buffer, '\0', sizeof( buffer ) );
+ for ( i = 1; i < 18; i++ ) {
+ if ( state & 0x1 ) {
+ if ( !first_entry ) {
+ strcat ( buffer, " | " );
+ }
+ strcat ( buffer, desc[i] );
+ first_entry = FALSE;
+ }
+ state = state >> 1;
+ }
+
+ if ( state != 0 ) {
+ if ( !first_entry ) {
+ strcat ( buffer, " | " );
+ }
+ strcat ( buffer, desc[18] );
+ }
+
+ return buffer;
+}
+
+
+/*
+ * Callback function to print out thread Ids, thread priorities, and thread stack
+ * information.
+ */
+
+unsigned32 print_thread_info( Thread_Control *thread, void * arg )
+{
+ printf( "Thread ID 0x%08x at "PTR_MASK"\n", thread->Object.id, (PTR)thread );
+ printf( "\ttype = %s\n", _Objects_Type_to_String( &(thread->Object) ) );
+ printf( "\tstate = %s\n", _Thread_State_to_String( thread->current_state ) );
+ printf( "\treal priority = %d\n", thread->real_priority );
+ printf( "\tcurrent priority = %d\n", thread->current_priority );
+ printf( "\tstack base = "PTR_MASK"\n", (PTR)thread->Start.Initial_stack.area );
+ printf( "\tstack size = 0x%08x\n", thread->Start.Initial_stack.size );
+ /* printf( "\tstack pointer = "PTR_MASK"\n", */
+ printf( "\n" );
+ return 0;
+}
diff --git a/c/src/tests/sptests/threaditerate/threaditerate.scn b/c/src/tests/sptests/threaditerate/threaditerate.scn
new file mode 100644
index 0000000000..9aeb43a212
--- /dev/null
+++ b/c/src/tests/sptests/threaditerate/threaditerate.scn
@@ -0,0 +1,205 @@
+*** Thread Iteration Test ***
+Created and started an RTEMS task with id = 0x08010002
+Created and started an RTEMS task with id = 0x08010003
+Created and started an RTEMS task with id = 0x08010004
+Created and started a pthread with id = 0x0c010001
+Created and started a pthread with id = 0x0c010002
+Created and started a pthread with id = 0x0c010003
+Created and started an ITRON task with id = 0x10010002
+Created and started an ITRON task with id = 0x10010003
+Created and started an ITRON task with id = 0x10010004
+Sleeping for 5 seconds
+
+Looking for all threads
+
+Thread ID 0x04010001 at 0x00192364
+ type = INTERNAL_THREADS
+ state = READY
+ real priority = 255
+ current priority = 255
+ stack base = 0x0018cde8
+ stack size = 0x00002008
+
+Thread ID 0x08010001 at 0x00191390
+ type = RTEMS_TASKS
+ state = READY
+ real priority = 1
+ current priority = 1
+ stack base = 0x0018ac54
+ stack size = 0x00002008
+
+Thread ID 0x08010002 at 0x001914ec
+ type = RTEMS_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x00186ac0
+ stack size = 0x00004008
+
+Thread ID 0x08010003 at 0x00191648
+ type = RTEMS_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x0018292c
+ stack size = 0x00004008
+
+Thread ID 0x08010004 at 0x001917a4
+ type = RTEMS_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x0017c798
+ stack size = 0x00006008
+
+Thread ID 0x0c010001 at 0x0018fbf4
+ type = POSIX_THREADS
+ state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
+ real priority = 1
+ current priority = 1
+ stack base = 0x00178604
+ stack size = 0x00004008
+
+Thread ID 0x0c010002 at 0x0018fd50
+ type = POSIX_THREADS
+ state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
+ real priority = 1
+ current priority = 1
+ stack base = 0x00174470
+ stack size = 0x00004008
+
+Thread ID 0x0c010003 at 0x0018feac
+ type = POSIX_THREADS
+ state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
+ real priority = 1
+ current priority = 1
+ stack base = 0x001702dc
+ stack size = 0x00004008
+
+Thread ID 0x10010002 at 0x0018ef58
+ type = ITRON_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x0016c148
+ stack size = 0x00004008
+
+Thread ID 0x10010003 at 0x0018f0b4
+ type = ITRON_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x00167f24
+ stack size = 0x00004008
+
+Thread ID 0x10010004 at 0x0018f210
+ type = ITRON_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x00161d00
+ stack size = 0x00006008
+
+That was it. Sleeping for 20 seconds.
+TA1 - rtems_clock_get - 09:00:10 12/31/2000
+TA2 - rtems_clock_get - 09:00:10 12/31/2000
+TA3 - rtems_clock_get - 09:00:10 12/31/2000
+pthread: ID is 0x0c010001
+ - clock_gettime - Sun Dec 31 09:00:10 2000
+
+pthread: ID is 0x0c010002
+ - clock_gettime - Sun Dec 31 09:00:10 2000
+
+pthread: ID is 0x0c010003
+ - clock_gettime - Sun Dec 31 09:00:10 2000
+ITRON task 1 - rtems_clock_get - 09:00:10 12/31/2000
+
+ITRON task 2 - rtems_clock_get - 09:00:10 12/31/2000
+ITRON task 3 - rtems_clock_get - 09:00:10 12/31/2000
+
+Deleting the second thread of each type
+
+
+Looking for all threads
+
+Thread ID 0x04010001 at 0x00192364
+ type = INTERNAL_THREADS
+ state = READY
+ real priority = 255
+ current priority = 255
+ stack base = 0x0018cde8
+ stack size = 0x00002008
+
+Thread ID 0x08010001 at 0x00191390
+ type = RTEMS_TASKS
+ state = READY
+ real priority = 1
+ current priority = 1
+ stack base = 0x0018ac54
+ stack size = 0x00002008
+
+Thread ID 0x08010002 at 0x001914ec
+ type = RTEMS_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x00186ac0
+ stack size = 0x00004008
+
+Thread ID 0x08010004 at 0x001917a4
+ type = RTEMS_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x0017c798
+ stack size = 0x00006008
+
+Thread ID 0x0c010001 at 0x0018fbf4
+ type = POSIX_THREADS
+ state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
+ real priority = 1
+ current priority = 1
+ stack base = 0x00178604
+ stack size = 0x00004008
+
+Thread ID 0x0c010002 at 0x0018fd50
+ type = POSIX_THREADS
+ state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
+ real priority = 1
+ current priority = 1
+ stack base = 0x00174470
+ stack size = 0x00004008
+
+Thread ID 0x0c010003 at 0x0018feac
+ type = POSIX_THREADS
+ state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
+ real priority = 1
+ current priority = 1
+ stack base = 0x001702dc
+ stack size = 0x00004008
+
+Thread ID 0x10010002 at 0x0018ef58
+ type = ITRON_TASKS
+ state = DELAYING
+ real priority = 1
+ current priority = 1
+ stack base = 0x0016c148
+ stack size = 0x00004008
+
+Thread ID 0x10010003 at 0x0018f0b4
+ type = ITRON_TASKS
+ state = DORMANT
+ real priority = 1
+ current priority = 1
+ stack base = 0x00167f24
+ stack size = 0x00004008
+
+Thread ID 0x10010004 at 0x0018f210
+ type = ITRON_TASKS
+ state = DELAYING
+ real priority =1
+ current priority = 1
+ stack base = 0x00161d00
+ stack size = 0x00006008
+
+That was it. Exiting