summaryrefslogtreecommitdiffstats
path: root/c/src/tests/support
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/tests/support')
-rw-r--r--c/src/tests/support/include/tmacros.h116
-rw-r--r--c/src/tests/support/stubdr/close.c38
-rw-r--r--c/src/tests/support/stubdr/cntrl.c38
-rw-r--r--c/src/tests/support/stubdr/init.c41
-rw-r--r--c/src/tests/support/stubdr/open.c38
-rw-r--r--c/src/tests/support/stubdr/read.c38
-rw-r--r--c/src/tests/support/stubdr/stubdrv.h81
-rw-r--r--c/src/tests/support/stubdr/write.c38
8 files changed, 428 insertions, 0 deletions
diff --git a/c/src/tests/support/include/tmacros.h b/c/src/tests/support/include/tmacros.h
new file mode 100644
index 0000000000..8a5fad37c8
--- /dev/null
+++ b/c/src/tests/support/include/tmacros.h
@@ -0,0 +1,116 @@
+/* tmacros.h
+ *
+ * This include file contains macros which are useful in the RTEMS
+ * test suites.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __TMACROS_h
+#define __TMACROS_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "bsp.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "libcsupport.h"
+
+#define FOREVER 1 /* infinite loop */
+
+#define directive_failed( dirstat, failmsg ) \
+ fatal_directive_status( dirstat, RTEMS_SUCCESSFUL, failmsg )
+
+#define fatal_directive_status( stat, desired, msg ) \
+ { \
+ if ( (stat) != (desired) ) { \
+ printf( "\n%s FAILED -- expected (%d) got (%d)\n", \
+ (msg), (desired), (stat) ); \
+ exit( stat ); \
+ } \
+ }
+
+#define sprint_time(str,s1,tb,s2) \
+ sprintf( (str), "%s%02d:%02d:%02d %02d/%02d/%04d%s", \
+ s1, (tb)->hour, (tb)->minute, (tb)->second, \
+ (tb)->month, (tb)->day, (tb)->year, s2 );
+
+#define print_time(s1,tb,s2) \
+ printf( "%s%02d:%02d:%02d %02d/%02d/%04d%s", \
+ s1, (tb)->hour, (tb)->minute, (tb)->second, \
+ (tb)->month, (tb)->day, (tb)->year, s2 );
+
+#define put_dot( c ) putchar( c ); fflush( stdout )
+
+#define new_line puts( "" )
+
+#define puts_nocr printf
+
+#define pause() \
+ do { \
+ char buffer[ 80 ]; \
+ printf( "<pause> " ); fflush( stdout ); \
+ gets( buffer ); \
+ puts( "" ); \
+ } while ( 0 )
+
+#define pause_and_screen_number( _screen ) \
+ do { \
+ char buffer[ 80 ]; \
+ printf( "<pause - screen %d> ", (_screen) ); fflush( stdout ); \
+ gets( buffer ); \
+ puts( "" ); \
+ } while ( 0 )
+
+#define put_name( name, crlf ) \
+{ 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' ); \
+}
+
+#define put_buffer( _buffer ) XYZ( _buffer )
+
+#define build_time( TB, MON, DAY, YR, HR, MIN, SEC, TK ) \
+ { (TB)->year = YR; \
+ (TB)->month = MON; \
+ (TB)->day = DAY; \
+ (TB)->hour = HR; \
+ (TB)->minute = MIN; \
+ (TB)->second = SEC; \
+ (TB)->ticks = TK; }
+
+#define task_number( tid ) \
+ ( rtems_get_index( tid ) - BSP_Configuration.number_of_initialization_tasks )
+
+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;
+}
+
+#define TICKS_PER_SECOND get_ticks_per_second()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/tests/support/stubdr/close.c b/c/src/tests/support/stubdr/close.c
new file mode 100644
index 0000000000..7fb24ede56
--- /dev/null
+++ b/c/src/tests/support/stubdr/close.c
@@ -0,0 +1,38 @@
+/* Stub_close
+ *
+ * This routine is the terminal driver close routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargb - pointer to close parameter block
+ * tid - calling task's id
+ * rval - address of the return value
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp,
+ rtems_id tid,
+ rtems_unsigned32 *rval
+)
+{
+ *rval = STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/cntrl.c b/c/src/tests/support/stubdr/cntrl.c
new file mode 100644
index 0000000000..8d1d904583
--- /dev/null
+++ b/c/src/tests/support/stubdr/cntrl.c
@@ -0,0 +1,38 @@
+/* Stub_control
+ *
+ * This routine is the terminal driver control routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to cntrl parameter block
+ * tid - calling task's id
+ * rval - address of the return value
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp,
+ rtems_id tid,
+ rtems_unsigned32 *rval
+)
+{
+ *rval = STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/init.c b/c/src/tests/support/stubdr/init.c
new file mode 100644
index 0000000000..35ec5f8f37
--- /dev/null
+++ b/c/src/tests/support/stubdr/init.c
@@ -0,0 +1,41 @@
+/* Stub_initialize
+ *
+ * This routine is the terminal driver init routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to parameter block
+ * tid - calling task's id
+ * rval - pointer to return value
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_unsigned32 STUB_major;
+
+rtems_device_driver Stub_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp,
+ rtems_id tid,
+ rtems_unsigned32 *rval
+)
+{
+ STUB_major = major;
+ *rval = STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/open.c b/c/src/tests/support/stubdr/open.c
new file mode 100644
index 0000000000..cf4a5c4ffb
--- /dev/null
+++ b/c/src/tests/support/stubdr/open.c
@@ -0,0 +1,38 @@
+/* Stub_open
+ *
+ * This routine is the terminal driver open routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargb - pointer to open parameter block
+ * tid - calling task's id
+ * rval - address of the return value
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp,
+ rtems_id tid,
+ rtems_unsigned32 *rval
+)
+{
+ *rval = STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/read.c b/c/src/tests/support/stubdr/read.c
new file mode 100644
index 0000000000..7244d34cc8
--- /dev/null
+++ b/c/src/tests/support/stubdr/read.c
@@ -0,0 +1,38 @@
+/* Stub_read
+ *
+ * This routine is the terminal driver read routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to read parameter block
+ * tid - calling task's id
+ * rval - address of the return value
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp,
+ rtems_id tid,
+ rtems_unsigned32 *rval
+)
+{
+ *rval = STUB_SUCCESSFUL;
+}
diff --git a/c/src/tests/support/stubdr/stubdrv.h b/c/src/tests/support/stubdr/stubdrv.h
new file mode 100644
index 0000000000..34c571b6d6
--- /dev/null
+++ b/c/src/tests/support/stubdr/stubdrv.h
@@ -0,0 +1,81 @@
+/* stubdrv.h
+ *
+ * This file describes the Stub Driver for all boards.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#ifndef __STUB_DRIVER_h
+#define __STUB_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define STUB_DRIVER_TABLE_ENTRY \
+ { Stub_initialize, NULL, NULL, NULL, NULL, NULL }
+
+#define STUB_SUCCESSFUL RTEMS_SUCCESSFUL
+
+rtems_device_driver Stub_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+rtems_device_driver Stub_open(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+rtems_device_driver Stub_close(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+rtems_device_driver Stub_read(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+rtems_device_driver Stub_write(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+rtems_device_driver Stub_control(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *,
+ rtems_id,
+ rtems_unsigned32 *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/tests/support/stubdr/write.c b/c/src/tests/support/stubdr/write.c
new file mode 100644
index 0000000000..c6b5ce770a
--- /dev/null
+++ b/c/src/tests/support/stubdr/write.c
@@ -0,0 +1,38 @@
+/* Stub_write
+ *
+ * This routine is the terminal driver write routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to write parameter block
+ * tid - calling task's id
+ * rval - address of the return value
+ *
+ * Output parameters:
+ * rval - STUB_SUCCESSFUL
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "stubdrv.h"
+
+rtems_device_driver Stub_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *pargp,
+ rtems_id tid,
+ rtems_unsigned32 *rval
+)
+{
+ *rval = STUB_SUCCESSFUL;
+}