diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-05-11 17:39:37 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-05-11 17:39:37 +0000 |
commit | ac7d5ef06a6d6e8d84abbd1f0b82162725f98326 (patch) | |
tree | 9304cf759a73f2a1c6fd3191948f00e870af3787 /c/src/tests/sptests/sp08 | |
download | rtems-ac7d5ef06a6d6e8d84abbd1f0b82162725f98326.tar.bz2 |
Initial revision
Diffstat (limited to 'c/src/tests/sptests/sp08')
-rw-r--r-- | c/src/tests/sptests/sp08/init.c | 56 | ||||
-rw-r--r-- | c/src/tests/sptests/sp08/sp08.doc | 26 | ||||
-rw-r--r-- | c/src/tests/sptests/sp08/sp08.scn | 22 | ||||
-rw-r--r-- | c/src/tests/sptests/sp08/system.h | 33 | ||||
-rw-r--r-- | c/src/tests/sptests/sp08/task1.c | 256 |
5 files changed, 393 insertions, 0 deletions
diff --git a/c/src/tests/sptests/sp08/init.c b/c/src/tests/sptests/sp08/init.c new file mode 100644 index 0000000000..e3020035ce --- /dev/null +++ b/c/src/tests/sptests/sp08/init.c @@ -0,0 +1,56 @@ +/* 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 8 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp08/sp08.doc b/c/src/tests/sptests/sp08/sp08.doc new file mode 100644 index 0000000000..2b152779d7 --- /dev/null +++ b/c/src/tests/sptests/sp08/sp08.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: test8 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + t_mode + +concepts: + + a. Verifies every mode change possible. + + b. Verifies the fatal error handler. diff --git a/c/src/tests/sptests/sp08/sp08.scn b/c/src/tests/sptests/sp08/sp08.scn new file mode 100644 index 0000000000..d85ccc384f --- /dev/null +++ b/c/src/tests/sptests/sp08/sp08.scn @@ -0,0 +1,22 @@ +*** TEST 8 *** +TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000400 +TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000400 +TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000200 +TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000200 +TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000100 +TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000100 +TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: 00000003 +TA1 - rtems_task_mode - set all modes - previous mode: 00000005 +TA1 - rtems_task_mode - set all modes - previous mode: 00000703 +TA1 - rtems_task_mode - clear all modes - previous mode: 00000703 +TA1 - rtems_task_mode - get current mode - previous mode: 00000000 +*** END OF TEST 8 *** + +NOTE: The interrupt level lines will be different on CPUs with few levels. diff --git a/c/src/tests/sptests/sp08/system.h b/c/src/tests/sptests/sp08/system.h new file mode 100644 index 0000000000..dec5151b46 --- /dev/null +++ b/c/src/tests/sptests/sp08/system.h @@ -0,0 +1,33 @@ +/* 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 */ + +#define put_mode( _comment, _output_mode ) \ + printf( "%s %08x\n", _comment, _output_mode ); + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp08/task1.c b/c/src/tests/sptests/sp08/task1.c new file mode 100644 index 0000000000..eddcb11191 --- /dev/null +++ b/c/src/tests/sptests/sp08/task1.c @@ -0,0 +1,256 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies all combinations of + * task mode changes. + * + * 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_mode previous_mode; + rtems_status_code status; + +/* BEGINNING OF RTEMS_ASR */ + + status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_ASR */ + +/* BEGINNING OF RTEMS_TIMESLICE */ + + status = rtems_task_mode( + RTEMS_NO_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_TIMESLICE */ + +/* BEGINNING OF RTEMS_PREEMPT */ + + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_PREEMPT */ + +/* BEGINNING OF RTEMS_INTERRUPT_LEVEL */ + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3), + RTEMS_INTERRUPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(5), + RTEMS_INTERRUPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_INTERRUPT_LEVEL */ + +/* BEGINNING OF COMBINATIONS */ + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR | + RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - set all modes - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR | + RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - set all modes - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(0) | RTEMS_ASR | RTEMS_NO_TIMESLICE | RTEMS_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - clear all modes - previous mode: ", + previous_mode + ); + +/* END OF COMBINATIONS */ + +/* BEGINNING OF CURRENT MODE */ + + status = rtems_task_mode( + RTEMS_CURRENT_MODE, + RTEMS_CURRENT_MODE, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - get current mode - previous mode: ", + previous_mode + ); + +/* END OF CURRENT MODE */ + + puts( "*** END OF TEST 8 ***" ); + exit( 0 ); +} |