diff options
Diffstat (limited to 'testsuites/sptests/sp14')
-rw-r--r-- | testsuites/sptests/sp14/asr.c | 47 | ||||
-rw-r--r-- | testsuites/sptests/sp14/init.c | 75 | ||||
-rw-r--r-- | testsuites/sptests/sp14/sp14.doc | 24 | ||||
-rw-r--r-- | testsuites/sptests/sp14/sp14.scn | 33 | ||||
-rw-r--r-- | testsuites/sptests/sp14/system.h | 30 | ||||
-rw-r--r-- | testsuites/sptests/sp14/task1.c | 116 | ||||
-rw-r--r-- | testsuites/sptests/sp14/task2.c | 48 |
7 files changed, 373 insertions, 0 deletions
diff --git a/testsuites/sptests/sp14/asr.c b/testsuites/sptests/sp14/asr.c new file mode 100644 index 0000000000..af7e212877 --- /dev/null +++ b/testsuites/sptests/sp14/asr.c @@ -0,0 +1,47 @@ +/* Process_asr + * + * This is the asynchronous signal routine (asr) for task 1. + * It demonstrates that ASRs can block execute and block. + * + * Input parameters: + * the_signal_set - signal set + * + * 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_asr Process_asr( + rtems_signal_set the_signal_set +) +{ + rtems_status_code status; + + printf( "ASR - ENTRY - signal => %08x\n", the_signal_set ); + switch( the_signal_set ) { + case RTEMS_SIGNAL_16: + case RTEMS_SIGNAL_17: + case RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19: + break; + case RTEMS_SIGNAL_0: + case RTEMS_SIGNAL_1: + puts( "ASR - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after yield" ); + break; + case RTEMS_SIGNAL_3: + Asr_fired = TRUE; + break; + } + printf( "ASR - EXIT - signal => %08x\n", the_signal_set ); +} diff --git a/testsuites/sptests/sp14/init.c b/testsuites/sptests/sp14/init.c new file mode 100644 index 0000000000..627295c03e --- /dev/null +++ b/testsuites/sptests/sp14/init.c @@ -0,0 +1,75 @@ +/* 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 14 ***" ); + + 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', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create of TM1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp14/sp14.doc b/testsuites/sptests/sp14/sp14.doc new file mode 100644 index 0000000000..16aa420183 --- /dev/null +++ b/testsuites/sptests/sp14/sp14.doc @@ -0,0 +1,24 @@ +# +# $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: test14 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + as_catch, as_return, as_send, tm_wkafter + +concepts: + + a. This test checks out the signal manager. diff --git a/testsuites/sptests/sp14/sp14.scn b/testsuites/sptests/sp14/sp14.scn new file mode 100644 index 0000000000..31e6d067d2 --- /dev/null +++ b/testsuites/sptests/sp14/sp14.scn @@ -0,0 +1,33 @@ +*** TEST 14 *** +TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 ) +TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self +ASR - ENTRY - signal => 00010000 +ASR - EXIT - signal => 00010000 +TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self +ASR - ENTRY - signal => 00000001 +ASR - rtems_task_wake_after - yield processor +TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1 +TA2 - rtems_task_wake_after - yield processor +ASR - ENTRY - signal => 00020000 +ASR - EXIT - signal => 00020000 +ASR - EXIT - signal => 00000001 +TA1 - rtems_signal_catch - RTEMS_NO_ASR +<pause> +TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self +ASR - ENTRY - signal => 00000002 +ASR - rtems_task_wake_after - yield processor +TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1 +TA2 - rtems_task_wake_after - yield processor +ASR - EXIT - signal => 00000002 +ASR - ENTRY - signal => 000c0000 +ASR - EXIT - signal => 000c0000 +TA1 - rtems_task_mode - disable ASRs +TA1 - sending signal to RTEMS_SELF from timer +TA1 - waiting for signal to arrive +TA1 - timer routine got the correct arguments +TA1 - rtems_task_mode - enable ASRs +ASR - ENTRY - signal => 00000008 +ASR - EXIT - signal => 00000008 +TA1 - rtems_signal_catch - asraddr of NULL +TA1 - rtems_task_delete - delete self +*** END OF TEST 14 *** diff --git a/testsuites/sptests/sp14/system.h b/testsuites/sptests/sp14/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp14/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/testsuites/sptests/sp14/task1.c b/testsuites/sptests/sp14/task1.c new file mode 100644 index 0000000000..ac8feed71f --- /dev/null +++ b/testsuites/sptests/sp14/task1.c @@ -0,0 +1,116 @@ +/* Task_1 + * + * This routine serves as a test task. It establishes an RTEMS_ASR and + * sends signal to itself to determine if the RTEMS_ASR gets to execute. + * + * 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_timer_service_routine Signal_3_to_task_1( + rtems_id id, + void *pointer +) +{ + rtems_status_code status; + + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 ); + directive_failed( status, "rtems_signal_send of 3" ); + + Timer_got_this_id = id; + Timer_got_this_pointer = pointer; + + Signals_sent = TRUE; +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_mode previous_mode; + rtems_status_code status; + + puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" ); + status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) ); + directive_failed( status, "rtems_signal_catch" ); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" ); + status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR ); + directive_failed( status, "rtems_signal_catch" ); + +pause(); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_task_mode - disable ASRs" ); + status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + + Timer_got_this_id = 0; + Timer_got_this_pointer = NULL; + + puts( "TA1 - sending signal to RTEMS_SELF from timer" ); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + TICKS_PER_SECOND / 2, + Signal_3_to_task_1, + Task_1 + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - waiting for signal to arrive" ); + + Signals_sent = FALSE; + Asr_fired = FALSE; + + while ( Signals_sent == FALSE ) + ; + + if ( Timer_got_this_id == Timer_id[ 1 ] && + Timer_got_this_pointer == Task_1 ) + puts( "TA1 - timer routine got the correct arguments" ); + else + printf( + "TA1 - timer got (0x%x, %p) instead of (0x%x, %p)!!!!\n", + Timer_got_this_id, + Timer_got_this_pointer, + Timer_id[ 1 ], + Task_1 + ); + + puts( "TA1 - rtems_task_mode - enable ASRs" ); + status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + + puts( "TA1 - rtems_signal_catch - asraddr of NULL" ); + status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES ); + directive_failed( status, "rtems_signal_catch" ); + + puts( "TA1 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp14/task2.c b/testsuites/sptests/sp14/task2.c new file mode 100644 index 0000000000..bf1e7cc224 --- /dev/null +++ b/testsuites/sptests/sp14/task2.c @@ -0,0 +1,48 @@ +/* Task_2 + * + * This routine serves as a test task. It verifies that one task can + * send signals to another task ( invoking the other task's RTEMS_ASR ). + * + * 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_status_code status; + + puts( "TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1" ); + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_17 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA2 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts("TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1"); + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA2 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 14 ***" ); + exit( 0 ); +} |