summaryrefslogtreecommitdiffstats
path: root/testsuites/samples
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-06-12 15:00:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-06-12 15:00:15 +0000
commitdf49c60c9671e4a28e636964d744c1f59fb6cb68 (patch)
treeeabd85e189514ad412a35414ba5d483dcda3ef1f /testsuites/samples
parent0ab65474316231792faec37ec1dbddeaf8645775 (diff)
downloadrtems-df49c60c9671e4a28e636964d744c1f59fb6cb68.tar.bz2
Merged from 4.5.0-beta3a
Diffstat (limited to '')
-rw-r--r--testsuites/samples/Makefile.am3
-rw-r--r--testsuites/samples/base_mp/apptask.c1
-rw-r--r--testsuites/samples/base_mp/init.c3
-rw-r--r--testsuites/samples/base_mp/system.h16
-rw-r--r--testsuites/samples/base_sp/apptask.c1
-rw-r--r--testsuites/samples/base_sp/init.c3
-rw-r--r--testsuites/samples/base_sp/system.h13
-rw-r--r--testsuites/samples/cdtest/Makefile.am2
-rw-r--r--testsuites/samples/cdtest/init.c2
-rw-r--r--testsuites/samples/cdtest/system.h14
-rw-r--r--testsuites/samples/hello/Makefile.am2
-rw-r--r--testsuites/samples/hello/init.c2
-rw-r--r--testsuites/samples/hello/system.h12
-rw-r--r--testsuites/samples/minimum/Makefile.am2
-rw-r--r--testsuites/samples/minimum/init.c6
-rw-r--r--testsuites/samples/paranoia/Makefile.am2
-rw-r--r--testsuites/samples/paranoia/init.c3
-rw-r--r--testsuites/samples/paranoia/system.h14
-rw-r--r--testsuites/samples/ticker/Makefile.am2
-rw-r--r--testsuites/samples/ticker/init.c19
-rw-r--r--testsuites/samples/ticker/system.h83
-rw-r--r--testsuites/samples/ticker/tasks.c5
-rw-r--r--testsuites/samples/unlimited/Makefile.am2
-rw-r--r--testsuites/samples/unlimited/init.c2
-rw-r--r--testsuites/samples/unlimited/system.h10
25 files changed, 148 insertions, 76 deletions
diff --git a/testsuites/samples/Makefile.am b/testsuites/samples/Makefile.am
index e8c84121ac..04c3059990 100644
--- a/testsuites/samples/Makefile.am
+++ b/testsuites/samples/Makefile.am
@@ -15,8 +15,7 @@ FP_TESTS = paranoia
SUBDIRS = hello ticker base_sp unlimited minimum $(MP_TESTS) \
$(CPLUSPLUS_TESTS) $(FP_TESTS)
-AUTOMAKE_FILES = \
-sample.am
+AUTOMAKE_FILES = sample.am
EXTRA_DIST = $(AUTOMAKE_FILES)
diff --git a/testsuites/samples/base_mp/apptask.c b/testsuites/samples/base_mp/apptask.c
index 5303b180d4..566ca7188f 100644
--- a/testsuites/samples/base_mp/apptask.c
+++ b/testsuites/samples/base_mp/apptask.c
@@ -20,6 +20,7 @@
*/
#include "system.h"
+#include <stdio.h>
rtems_task Application_task(
rtems_task_argument node
diff --git a/testsuites/samples/base_mp/init.c b/testsuites/samples/base_mp/init.c
index d47113d832..a30bed867f 100644
--- a/testsuites/samples/base_mp/init.c
+++ b/testsuites/samples/base_mp/init.c
@@ -20,8 +20,9 @@
* $Id$
*/
-#define TEST_INIT
+#define CONFIGURE_INIT
#include "system.h"
+#include <stdio.h>
rtems_task Init(
rtems_task_argument argument
diff --git a/testsuites/samples/base_mp/system.h b/testsuites/samples/base_mp/system.h
index b45fe15bd9..428a5019e3 100644
--- a/testsuites/samples/base_mp/system.h
+++ b/testsuites/samples/base_mp/system.h
@@ -13,7 +13,7 @@
* $Id$
*/
-#include <tmacros.h>
+#include <rtems.h>
/* functions */
@@ -27,11 +27,15 @@ rtems_task Application_task(
/* configuration information */
-#define CONFIGURE_MPTEST
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_MP_APPLICATION
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_MAXIMUM_TASKS 2
+
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
/*
@@ -40,8 +44,4 @@ rtems_task Application_task(
#include <confdefs.h>
-/* variables */
-
-TEST_EXTERN rtems_id Global_variable; /* example global variable */
-
/* end of include file */
diff --git a/testsuites/samples/base_sp/apptask.c b/testsuites/samples/base_sp/apptask.c
index c7b6580fad..050b2130bf 100644
--- a/testsuites/samples/base_sp/apptask.c
+++ b/testsuites/samples/base_sp/apptask.c
@@ -19,6 +19,7 @@
*/
#include "system.h"
+#include <stdio.h>
rtems_task Application_task(
rtems_task_argument argument
diff --git a/testsuites/samples/base_sp/init.c b/testsuites/samples/base_sp/init.c
index d787f0233e..e5eae4c9a5 100644
--- a/testsuites/samples/base_sp/init.c
+++ b/testsuites/samples/base_sp/init.c
@@ -20,8 +20,9 @@
* $Id$
*/
-#define TEST_INIT
+#define CONFIGURE_INIT
#include "system.h"
+#include <stdio.h>
#define ARGUMENT 0
diff --git a/testsuites/samples/base_sp/system.h b/testsuites/samples/base_sp/system.h
index 25139380f6..233cbb7f2f 100644
--- a/testsuites/samples/base_sp/system.h
+++ b/testsuites/samples/base_sp/system.h
@@ -13,7 +13,7 @@
* $Id$
*/
-#include <tmacros.h>
+#include <rtems.h>
/* functions */
@@ -27,17 +27,14 @@ rtems_task Application_task(
/* configuration information */
-#define CONFIGURE_SPTEST
+#include <bsp.h> /* for device driver prototypes */
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#include <confdefs.h>
-/* global variables */
-
-TEST_EXTERN rtems_id Global_variable; /* example global variable */
-
/* end of include file */
diff --git a/testsuites/samples/cdtest/Makefile.am b/testsuites/samples/cdtest/Makefile.am
index 0bdf792c92..309974bb4f 100644
--- a/testsuites/samples/cdtest/Makefile.am
+++ b/testsuites/samples/cdtest/Makefile.am
@@ -26,8 +26,6 @@ OBJS = $(C_O_FILES) $(CC_O_FILES)
PRINT_SRCS = $(DOCS)
-PGM = ${ARCH}/$(SAMPLE).exe
-
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
include $(top_srcdir)/sample.am
diff --git a/testsuites/samples/cdtest/init.c b/testsuites/samples/cdtest/init.c
index 807cd9e5ab..1df5302b50 100644
--- a/testsuites/samples/cdtest/init.c
+++ b/testsuites/samples/cdtest/init.c
@@ -20,6 +20,6 @@
* $Id$
*/
-#define TEST_INIT
+#define CONFIGURE_INIT
#include "system.h"
#include <stdio.h>
diff --git a/testsuites/samples/cdtest/system.h b/testsuites/samples/cdtest/system.h
index 234651fc69..557f3fea8c 100644
--- a/testsuites/samples/cdtest/system.h
+++ b/testsuites/samples/cdtest/system.h
@@ -13,7 +13,7 @@
* $Id$
*/
-#include <tmacros.h>
+#include <rtems.h>
/* functions */
@@ -23,10 +23,12 @@ rtems_task main_task(
/* configuration information */
-#define CONFIGURE_SPTEST
+#include <bsp.h> /* for device driver prototypes */
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT_TASK_ENTRY_POINT main_task
@@ -34,8 +36,4 @@ rtems_task main_task(
#include <confdefs.h>
-/* global variables */
-
-TEST_EXTERN rtems_id Global_variable; /* example global variable */
-
/* end of include file */
diff --git a/testsuites/samples/hello/Makefile.am b/testsuites/samples/hello/Makefile.am
index 8f3ec339ab..9dfe2bafac 100644
--- a/testsuites/samples/hello/Makefile.am
+++ b/testsuites/samples/hello/Makefile.am
@@ -23,8 +23,6 @@ OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
-PGM = ${ARCH}/$(SAMPLE).exe
-
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
include $(top_srcdir)/sample.am
diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c
index 344617d598..adda41cd20 100644
--- a/testsuites/samples/hello/init.c
+++ b/testsuites/samples/hello/init.c
@@ -20,7 +20,7 @@
* $Id$
*/
-#define TEST_INIT
+#define CONFIGURE_INIT
#include "system.h"
#include <stdio.h>
diff --git a/testsuites/samples/hello/system.h b/testsuites/samples/hello/system.h
index d27a884301..79a57713d0 100644
--- a/testsuites/samples/hello/system.h
+++ b/testsuites/samples/hello/system.h
@@ -13,7 +13,7 @@
* $Id$
*/
-#include <tmacros.h>
+#include <rtems.h>
/* functions */
@@ -23,7 +23,11 @@ rtems_task Init(
/* configuration information */
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
@@ -31,8 +35,4 @@ rtems_task Init(
#include <confdefs.h>
-/* global variables */
-
-TEST_EXTERN rtems_id Global_variable; /* example global variable */
-
/* end of include file */
diff --git a/testsuites/samples/minimum/Makefile.am b/testsuites/samples/minimum/Makefile.am
index 0ac5f1fe20..6ebaef357d 100644
--- a/testsuites/samples/minimum/Makefile.am
+++ b/testsuites/samples/minimum/Makefile.am
@@ -20,8 +20,6 @@ OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
-PGM = ${ARCH}/$(SAMPLE).exe
-
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
include $(top_srcdir)/sample.am
diff --git a/testsuites/samples/minimum/init.c b/testsuites/samples/minimum/init.c
index 64a1aa7b62..980393f0b2 100644
--- a/testsuites/samples/minimum/init.c
+++ b/testsuites/samples/minimum/init.c
@@ -15,7 +15,7 @@
* $Id$
*/
-#include <rtems.h>
+#include <bsp.h>
rtems_task Init(
rtems_task_argument ignored
@@ -25,10 +25,14 @@ rtems_task Init(
/* configuration information */
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_MAXIMUM_TASKS 1
+
#define CONFIGURE_INIT
#include <confdefs.h>
diff --git a/testsuites/samples/paranoia/Makefile.am b/testsuites/samples/paranoia/Makefile.am
index 6611f6efe5..d5bcb524ba 100644
--- a/testsuites/samples/paranoia/Makefile.am
+++ b/testsuites/samples/paranoia/Makefile.am
@@ -23,8 +23,6 @@ OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
-PGM = ${ARCH}/$(SAMPLE).exe
-
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
include $(top_srcdir)/sample.am
diff --git a/testsuites/samples/paranoia/init.c b/testsuites/samples/paranoia/init.c
index 980a07d7c8..9b836519c3 100644
--- a/testsuites/samples/paranoia/init.c
+++ b/testsuites/samples/paranoia/init.c
@@ -20,8 +20,9 @@
* $Id$
*/
-#define TEST_INIT
+#define CONFIGURE_INIT
#include "system.h"
+#include <stdio.h>
extern int paranoia(int, char **);
diff --git a/testsuites/samples/paranoia/system.h b/testsuites/samples/paranoia/system.h
index 5996032cb1..359e255882 100644
--- a/testsuites/samples/paranoia/system.h
+++ b/testsuites/samples/paranoia/system.h
@@ -13,7 +13,7 @@
* $Id$
*/
-#include <tmacros.h>
+#include <rtems.h>
/* functions */
@@ -23,8 +23,12 @@ rtems_task Init(
/* configuration information */
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
@@ -34,8 +38,4 @@ rtems_task Init(
#include <confdefs.h>
-/* global variables */
-
-TEST_EXTERN rtems_id Global_variable; /* example global variable */
-
/* end of include file */
diff --git a/testsuites/samples/ticker/Makefile.am b/testsuites/samples/ticker/Makefile.am
index 7c699ce03b..1129c917b7 100644
--- a/testsuites/samples/ticker/Makefile.am
+++ b/testsuites/samples/ticker/Makefile.am
@@ -23,8 +23,6 @@ OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
-PGM = ${ARCH}/$(SAMPLE).exe
-
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
include $(top_srcdir)/sample.am
diff --git a/testsuites/samples/ticker/init.c b/testsuites/samples/ticker/init.c
index cd8c688887..36f3fd58f6 100644
--- a/testsuites/samples/ticker/init.c
+++ b/testsuites/samples/ticker/init.c
@@ -20,8 +20,16 @@
* $Id$
*/
-#define TEST_INIT
+#define CONFIGURE_INIT
#include "system.h"
+#include <stdio.h>
+
+/*
+ * Keep the names and IDs in global variables so another task can use them.
+ */
+
+rtems_id Task_id[ 4 ]; /* array of task ids */
+rtems_name Task_name[ 4 ]; /* array of task names */
rtems_task Init(
rtems_task_argument argument
@@ -32,7 +40,14 @@ rtems_task Init(
puts( "\n\n*** CLOCK TICK TEST ***" );
- build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ 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 );
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
diff --git a/testsuites/samples/ticker/system.h b/testsuites/samples/ticker/system.h
index 0e50198815..7a0caa93ba 100644
--- a/testsuites/samples/ticker/system.h
+++ b/testsuites/samples/ticker/system.h
@@ -13,7 +13,7 @@
* $Id$
*/
-#include <tmacros.h>
+#include <rtems.h>
/* functions */
@@ -25,12 +25,24 @@ rtems_task Test_task(
rtems_task_argument argument
);
+/* global variables */
+
+/*
+ * Keep the names and IDs in global variables so another task can use them.
+ */
+
+extern rtems_id Task_id[ 4 ]; /* array of task ids */
+extern rtems_name Task_name[ 4 ]; /* array of task names */
+
+
/* configuration information */
-#define CONFIGURE_SPTEST
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
@@ -38,9 +50,66 @@ rtems_task Test_task(
#include <confdefs.h>
-/* global variables */
+/*
+ * Handy macros and static inline functions
+ */
+
+/*
+ * Macro to hide the ugliness of printing the time.
+ */
+
+#define print_time(_s1, _tb, _s2) \
+ do { \
+ printf( "%s%02d:%02d:%02d %02d/%02d/%04d%s", \
+ _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \
+ (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \
+ fflush(stdout); \
+ } while ( 0 )
+
+/*
+ * Macro to print an task name that is composed of ASCII characters.
+ *
+ */
+
+#define put_name( _name, _crlf ) \
+ do { \
+ rtems_unsigned32 c0, c1, c2, c3; \
+ \
+ c0 = ((_name) >> 24) & 0xff; \
+ c1 = ((_name) >> 16) & 0xff; \
+ c2 = ((_name) >> 8) & 0xff; \
+ c3 = (_name) & 0xff; \
+ putchar( (char)c0 ); \
+ if ( c1 ) putchar( (char)c1 ); \
+ if ( c2 ) putchar( (char)c2 ); \
+ if ( c3 ) putchar( (char)c3 ); \
+ if ( (_crlf) ) \
+ putchar( '\n' ); \
+ } while (0)
+
+/*
+ * static inline routine to make obtaining ticks per second easier.
+ */
+
+static inline rtems_unsigned32 get_ticks_per_second( void )
+{
+ rtems_interval ticks_per_second;
+ (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second ); return ticks_per_second;
+}
+
+
+/*
+ * This allows us to view the "Test_task" instantiations as a set
+ * of numbered tasks by eliminating the number of application
+ * tasks created.
+ *
+ * In reality, this is too complex for the purposes of this
+ * example. It would have been easier to pass a task argument. :)
+ * But it shows how rtems_id's can sometimes be used.
+ */
-TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
-TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
+#define task_number( tid ) \
+ ( rtems_get_index( tid ) - \
+ rtems_configuration_get_rtems_api_configuration()->number_of_initialization_tasks )
/* end of include file */
diff --git a/testsuites/samples/ticker/tasks.c b/testsuites/samples/ticker/tasks.c
index b87a26cbbe..d539b967bd 100644
--- a/testsuites/samples/ticker/tasks.c
+++ b/testsuites/samples/ticker/tasks.c
@@ -18,6 +18,7 @@
*/
#include "system.h"
+#include <stdio.h>
rtems_task Test_task(
rtems_task_argument unused
@@ -30,7 +31,7 @@ rtems_task Test_task(
status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
task_index = task_number( tid );
- while( FOREVER ) {
+ for ( ; ; ) {
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
if ( time.second >= 35 ) {
puts( "*** END OF CLOCK TICK TEST ***" );
@@ -38,6 +39,6 @@ rtems_task Test_task(
}
put_name( Task_name[ task_index ], FALSE );
print_time( " - rtems_clock_get - ", &time, "\n" );
- status = rtems_task_wake_after( task_index * 5 * TICKS_PER_SECOND );
+ status = rtems_task_wake_after( task_index * 5 * get_ticks_per_second() );
}
}
diff --git a/testsuites/samples/unlimited/Makefile.am b/testsuites/samples/unlimited/Makefile.am
index 32b865776d..a940b9810c 100644
--- a/testsuites/samples/unlimited/Makefile.am
+++ b/testsuites/samples/unlimited/Makefile.am
@@ -23,8 +23,6 @@ OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
-PGM = ${ARCH}/$(SAMPLE).exe
-
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
include $(top_srcdir)/sample.am
diff --git a/testsuites/samples/unlimited/init.c b/testsuites/samples/unlimited/init.c
index 5036e72527..043e60dafd 100644
--- a/testsuites/samples/unlimited/init.c
+++ b/testsuites/samples/unlimited/init.c
@@ -21,7 +21,7 @@
* $Id$
*/
-#define TEST_INIT
+#define CONFIGURE_INIT
#include "system.h"
#include <stdio.h>
diff --git a/testsuites/samples/unlimited/system.h b/testsuites/samples/unlimited/system.h
index 5be04f0b6d..a48aa0a5a0 100644
--- a/testsuites/samples/unlimited/system.h
+++ b/testsuites/samples/unlimited/system.h
@@ -16,8 +16,6 @@
#include <rtems.h>
-#include <tmacros.h>
-
/* functions */
rtems_task Init(
@@ -43,7 +41,9 @@ void test3();
/* configuration information */
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
@@ -54,10 +54,6 @@ void test3();
#include <confdefs.h>
-/* global variables */
-
-TEST_EXTERN rtems_id Global_variable; /* example global variable */
-
/*
* Keep track of the task id's created, use a large array.
*/