summaryrefslogtreecommitdiffstats
path: root/c/src/tests/sptests/sp11
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1995-05-11 17:39:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1995-05-11 17:39:37 +0000
commitac7d5ef06a6d6e8d84abbd1f0b82162725f98326 (patch)
tree9304cf759a73f2a1c6fd3191948f00e870af3787 /c/src/tests/sptests/sp11
downloadrtems-ac7d5ef06a6d6e8d84abbd1f0b82162725f98326.tar.bz2
Initial revision
Diffstat (limited to 'c/src/tests/sptests/sp11')
-rw-r--r--c/src/tests/sptests/sp11/init.c95
-rw-r--r--c/src/tests/sptests/sp11/sp11.doc26
-rw-r--r--c/src/tests/sptests/sp11/sp11.scn74
-rw-r--r--c/src/tests/sptests/sp11/system.h30
-rw-r--r--c/src/tests/sptests/sp11/task1.c410
-rw-r--r--c/src/tests/sptests/sp11/task2.c126
-rw-r--r--c/src/tests/sptests/sp11/timer.c97
7 files changed, 858 insertions, 0 deletions
diff --git a/c/src/tests/sptests/sp11/init.c b/c/src/tests/sptests/sp11/init.c
new file mode 100644
index 0000000000..99ef1d55a0
--- /dev/null
+++ b/c/src/tests/sptests/sp11/init.c
@@ -0,0 +1,95 @@
+/* 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, 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 "system.h"
+#undef EXTERN
+#define EXTERN
+#include "conftbl.h"
+#include "gvar.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 11 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+ Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' );
+ Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' );
+ Timer_name[ 4 ] = rtems_build_name( 'T', 'M', '4', ' ' );
+ Timer_name[ 5 ] = rtems_build_name( 'T', 'M', '5', ' ' );
+ Timer_name[ 6 ] = rtems_build_name( 'T', 'M', '6', ' ' );
+
+ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_create of TM1" );
+
+ status = rtems_timer_create( Timer_name[ 2 ], &Timer_id[ 2 ] );
+ directive_failed( status, "rtems_timer_create of TM2" );
+
+ status = rtems_timer_create( Timer_name[ 3 ], &Timer_id[ 3 ] );
+ directive_failed( status, "rtems_timer_create of TM3" );
+
+ status = rtems_timer_create( Timer_name[ 4 ], &Timer_id[ 4 ] );
+ directive_failed( status, "rtems_timer_create of TM4" );
+
+ status = rtems_timer_create( Timer_name[ 5 ], &Timer_id[ 5 ] );
+ directive_failed( status, "rtems_timer_create of TM5" );
+
+ status = rtems_timer_create( Timer_name[ 6 ], &Timer_id[ 6 ] );
+ directive_failed( status, "rtems_timer_create of TM6" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/c/src/tests/sptests/sp11/sp11.doc b/c/src/tests/sptests/sp11/sp11.doc
new file mode 100644
index 0000000000..d88f5eb86d
--- /dev/null
+++ b/c/src/tests/sptests/sp11/sp11.doc
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# 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.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test11
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ ev_send, ev_receive
+ tm_wkafter, tm_set, tm_get
+
+concepts:
+
+ a. This test checks out the event manager along with the associated
+ event directives contained in the time manager.
diff --git a/c/src/tests/sptests/sp11/sp11.scn b/c/src/tests/sptests/sp11/sp11.scn
new file mode 100644
index 0000000000..7abb8afe45
--- /dev/null
+++ b/c/src/tests/sptests/sp11/sp11.scn
@@ -0,0 +1,74 @@
+*** TEST 11 ***
+TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_14 and RTEMS_EVENT_15
+TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16
+TA2 - RTEMS_EVENT_16 received - eventout => 00010000
+TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1
+TA2 - rtems_event_receive - RTEMS_EVENT_17 or RTEMS_EVENT_18 - forever and ANY
+TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => 0000c000
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2
+TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14
+TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => 00040000
+TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1
+TA2 - rtems_clock_set - 08:15:00 02/12/1988
+TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 5 seconds
+TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10
+TA1 - RTEMS_EVENT_14 received - eventout => 00004000
+TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2
+TA1 - rtems_clock_get - 08:15:00 02/12/1988
+<pause>
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18
+TA2 - RTEMS_EVENT_10 received - eventout => 00000400
+TA2 - rtems_clock_get - 08:15:05 02/12/1988
+TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS
+TA2 - eventout => 00080000
+TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT
+TA2 - RTEMS_EVENT_19 received - eventout => 00080000
+TA2 - rtems_task_delete - deletes self
+TA1 - RTEMS_EVENT_18 received - eventout => 00040000
+TA1 - rtems_clock_get - 08:15:05 02/12/1988
+TA1 - rtems_event_send - send RTEMS_EVENT_3 to self
+TA1 - rtems_event_receive - RTEMS_EVENT_3 or RTEMS_EVENT_22 - NO_WAIT and ANY
+TA1 - RTEMS_EVENT_3 received - eventout => 00000008
+TA1 - rtems_event_send - send RTEMS_EVENT_4 to self
+TA1 - rtems_event_receive - RTEMS_EVENT_4 or RTEMS_EVENT_5 - forever and ANY
+TA1 - RTEMS_EVENT_4 received - eventout => 00000010
+<pause>
+TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18
+TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds
+TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds
+TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8
+TA1 - rtems_clock_set - 08:15:00 02/12/1988
+TA1 - rtems_event_send - send RTEMS_EVENT_1 every second
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:01 02/12/1988
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:02 02/12/1988
+TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:03 02/12/1988
+TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1
+<pause>
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day
+TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_clock_set - 08:15:03 02/15/1988
+TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11
+TA1 - RTEMS_EVENT_11 received - eventout => 00000800
+<pause>
+TA1 - rtems_event_send/rtems_event_receive combination
+TA1 - rtems_clock_set - 08:15:00 02/12/1988
+TA1 - rtems_event_receive all outstanding events
+TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days
+TA1 - rtems_clock_set - 07:15:00 02/12/1988
+TA1 - set time backwards
+TA1 - no events received
+TA1 - rtems_clock_set - 07:15:00 02/14/1988
+TA1 - set time forwards (leave a timer)
+TA1 - RTEMS_EVENT_10 received
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks
+TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks
+*** END OF TEST 11 ***
diff --git a/c/src/tests/sptests/sp11/system.h b/c/src/tests/sptests/sp11/system.h
new file mode 100644
index 0000000000..aa2c6d17e4
--- /dev/null
+++ b/c/src/tests/sptests/sp11/system.h
@@ -0,0 +1,30 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * 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 "tmacros.h"
+
+/* Miscellaneous */
+
+#define EXTERN extern /* external definition */
+
+/* macros */
+
+/* structures */
+
+#include "gvar.h"
+
+/* end of include file */
diff --git a/c/src/tests/sptests/sp11/task1.c b/c/src/tests/sptests/sp11/task1.c
new file mode 100644
index 0000000000..1b2fc86040
--- /dev/null
+++ b/c/src/tests/sptests/sp11/task1.c
@@ -0,0 +1,410 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the event maager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * 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 "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set eventout;
+ rtems_time_of_day time;
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_16 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - waiting forever on "
+ "RTEMS_EVENT_14 and RTEMS_EVENT_15"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_14 | RTEMS_EVENT_15,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf(
+ "TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => %08x\n",
+ eventout
+ );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_18 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_14,
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_14 received - eventout => %08x\n", eventout );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2" );
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_19 );
+ directive_failed( status, "rtems_event_send" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+ print_time( "TA1 - rtems_clock_get - ", &time, "\n" );
+
+pause();
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ TA1_send_18_to_self_5_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 5 seconds" );
+
+ puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_18,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive of 18" );
+ printf( "TA1 - RTEMS_EVENT_18 received - eventout => %08x\n", eventout );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "TA1 rtems_clock_get" );
+ print_time( "TA1 - rtems_clock_get - ", &time, "\n" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_3 to self" );
+ status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_3 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA1 - rtems_event_receive - RTEMS_EVENT_3 or "
+ "RTEMS_EVENT_22 - NO_WAIT and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_3 | RTEMS_EVENT_22,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive of 3 and 22" );
+ printf( "TA1 - RTEMS_EVENT_3 received - eventout => %08x\n", eventout );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_4 to self" );
+ status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_4 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts (
+ "TA1 - rtems_event_receive - RTEMS_EVENT_4 or "
+ "RTEMS_EVENT_5 - forever and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_4 | RTEMS_EVENT_5,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_4 received - eventout => %08x\n", eventout );
+
+pause();
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 5 * TICKS_PER_SECOND,
+ TA1_send_18_to_self_5_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 5 seconds" );
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18");
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_8_to_self_60_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds");
+ status = rtems_timer_fire_after(
+ Timer_id[ 2 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_9_to_self_60_seconds,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts(
+ "TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds"
+ );
+ status = rtems_timer_fire_after(
+ Timer_id[ 3 ],
+ 60 * TICKS_PER_SECOND,
+ TA1_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 60 seconds" );
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8" );
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ puts( "TA1 - rtems_event_send - send RTEMS_EVENT_1 every second" );
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ TICKS_PER_SECOND,
+ TA1_send_1_to_self_every_second,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 1 second" );
+
+ for ( index = 0; index < 3; index++ ) {
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_1,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ printf( "TA1 - RTEMS_EVENT_1 received - eventout => %08x - ", eventout );
+ print_time( "at ", &time, "\n" );
+
+ if ( index < 2 ) {
+ status = rtems_timer_reset( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_reset" );
+ };
+
+ }
+
+ puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1" );
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+pause();
+
+ time.day = 13;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 1 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.hour = 7;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 2 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.hour = 8; /* so code below has correct time/date */
+ time.day = 14;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 3 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ puts("TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day");
+ status = rtems_timer_cancel( Timer_id[ 1 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts(
+ "TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days"
+ );
+ status = rtems_timer_cancel( Timer_id[ 3 ] );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts(
+ "TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days"
+ );
+ status = rtems_timer_fire_when(
+ Timer_id[ 3 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ time.day = 15;
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "TA1 rtems_clock_set" );
+
+ puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_11,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA1 - RTEMS_EVENT_11 received - eventout => %08x\n", eventout );
+
+pause();
+
+ puts( "TA1 - rtems_event_send/rtems_event_receive combination" );
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 10,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 10 ticks" );
+
+ status = rtems_event_receive(
+ RTEMS_EVENT_11,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ time.day = 13;
+ puts( "TA1 - rtems_event_receive all outstanding events" );
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ 0,
+ &eventout
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive all events"
+ );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 1 ],
+ &time,
+ TA1_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 1 day" );
+
+ time.day = 14;
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" );
+ status = rtems_timer_fire_when(
+ Timer_id[ 2 ],
+ &time,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when 2 days" );
+
+ build_time( &time, 2, 12, 1988, 7, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ puts( "TA1 - set time backwards" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ if ( eventout ) printf( "ERROR -0x%08x events received\n", eventout );
+ else puts( "TA1 - no events received" );
+ fatal_directive_status(
+ status,
+ RTEMS_UNSATISFIED,
+ "rtems_event_receive all events"
+ );
+
+ build_time( &time, 2, 14, 1988, 7, 15, 0, 0 );
+
+ print_time( "TA1 - rtems_clock_set - ", &time, "\n" );
+ puts( "TA1 - set time forwards (leave a timer)" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ if ( eventout == RTEMS_EVENT_10 ) puts( "TA1 - RTEMS_EVENT_10 received" );
+ else printf( "ERROR -0x%08x events received\n", eventout );
+ directive_failed( status, "rtems_event_receive all events" );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 100,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 100 ticks" );
+
+ puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks");
+ status = rtems_timer_fire_after(
+ Timer_id[ 1 ],
+ 200,
+ TA1_send_11_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_after 200 ticks" );
+
+ puts( "*** END OF TEST 11 ***" );
+ exit( 0 );
+}
diff --git a/c/src/tests/sptests/sp11/task2.c b/c/src/tests/sptests/sp11/task2.c
new file mode 100644
index 0000000000..176582bc36
--- /dev/null
+++ b/c/src/tests/sptests/sp11/task2.c
@@ -0,0 +1,126 @@
+/* Task_2
+ *
+ * This routine serves as a test task. Multiple tasks are required to
+ * verify all capabilities of the event manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * 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 "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_event_set eventout;
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_16,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - RTEMS_EVENT_16 received - eventout => %08x\n", eventout );
+
+ puts(
+ "TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1"
+ );
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 | RTEMS_EVENT_15 );
+ directive_failed( status, "rtems_event_send" );
+
+ puts(
+ "TA2 - rtems_event_receive - RTEMS_EVENT_17 or "
+ "RTEMS_EVENT_18 - forever and ANY"
+ );
+ status = rtems_event_receive(
+ RTEMS_EVENT_17 | RTEMS_EVENT_18,
+ RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf(
+ "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => %08x\n",
+ eventout
+ );
+
+ puts( "TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1" );
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 );
+ directive_failed( status, "rtems_event_send" );
+
+ build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
+ print_time( "TA2 - rtems_clock_set - ", &time, "\n" );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "TA2 rtems_clock_set" );
+
+ time.second += 5;
+ puts(
+ "TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 5 seconds"
+ );
+ status = rtems_timer_fire_when(
+ Timer_id[ 5 ],
+ &time,
+ TA2_send_10_to_self,
+ NULL
+ );
+ directive_failed( status, "rtems_timer_fire_when after 5 seconds" );
+
+ puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_10,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( status, "rtems_clock_get" );
+
+ printf( "TA2 - RTEMS_EVENT_10 received - eventout => %08x\n", eventout );
+ print_time( "TA2 - rtems_clock_get - ", &time, "\n" );
+
+ puts( "TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS" );
+ status = rtems_event_receive(
+ RTEMS_PENDING_EVENTS,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - eventout => %08x\n", eventout );
+
+ puts( "TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT" );
+ status = rtems_event_receive(
+ RTEMS_EVENT_19,
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT,
+ &eventout
+ );
+ directive_failed( status, "rtems_event_receive" );
+ printf( "TA2 - RTEMS_EVENT_19 received - eventout => %08x\n", eventout );
+
+ puts( "TA2 - rtems_task_delete - deletes self" );
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/c/src/tests/sptests/sp11/timer.c b/c/src/tests/sptests/sp11/timer.c
new file mode 100644
index 0000000000..3ec11b7345
--- /dev/null
+++ b/c/src/tests/sptests/sp11/timer.c
@@ -0,0 +1,97 @@
+/* Timer_functions
+ *
+ * These routines are the timer service routines used by this test.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * 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 "system.h"
+
+rtems_timer_service_routine TA1_send_18_to_self_5_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_18 );
+ directive_failed( status, "rtems_event_send of 18" );
+}
+
+rtems_timer_service_routine TA1_send_8_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_8 );
+ directive_failed( status, "rtems_event_send of 8" );
+}
+
+rtems_timer_service_routine TA1_send_9_to_self_60_seconds(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_9 );
+ directive_failed( status, "rtems_event_send of 9" );
+}
+
+rtems_timer_service_routine TA1_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_10 );
+ directive_failed( status, "rtems_event_send of 10" );
+}
+
+rtems_timer_service_routine TA1_send_1_to_self_every_second(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_1 );
+ directive_failed( status, "rtems_event_send of 1" );
+}
+
+rtems_timer_service_routine TA1_send_11_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_11 );
+ directive_failed( status, "rtems_event_send of 11" );
+}
+
+rtems_timer_service_routine TA2_send_10_to_self(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_10 );
+ directive_failed( status, "rtems_event_send of 10" );
+}