From ac7d5ef06a6d6e8d84abbd1f0b82162725f98326 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 11 May 1995 17:39:37 +0000 Subject: Initial revision --- c/src/tests/sptests/sp24/init.c | 79 +++++++++++++++++++++++++++++++++++++++ c/src/tests/sptests/sp24/resume.c | 34 +++++++++++++++++ c/src/tests/sptests/sp24/sp24.doc | 51 +++++++++++++++++++++++++ c/src/tests/sptests/sp24/sp24.scn | 16 ++++++++ c/src/tests/sptests/sp24/system.h | 30 +++++++++++++++ c/src/tests/sptests/sp24/task1.c | 58 ++++++++++++++++++++++++++++ 6 files changed, 268 insertions(+) create mode 100644 c/src/tests/sptests/sp24/init.c create mode 100644 c/src/tests/sptests/sp24/resume.c create mode 100644 c/src/tests/sptests/sp24/sp24.doc create mode 100644 c/src/tests/sptests/sp24/sp24.scn create mode 100644 c/src/tests/sptests/sp24/system.h create mode 100644 c/src/tests/sptests/sp24/task1.c (limited to 'c/src/tests/sptests/sp24') diff --git a/c/src/tests/sptests/sp24/init.c b/c/src/tests/sptests/sp24/init.c new file mode 100644 index 0000000000..c73830a6df --- /dev/null +++ b/c/src/tests/sptests/sp24/init.c @@ -0,0 +1,79 @@ +/* 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_time_of_day time; + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TEST 24 ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + 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', ' ' ); + + for ( index = 1 ; index <= 3 ; index++ ) { + status = rtems_task_create( + Task_name[ index ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + status = rtems_timer_create( + Timer_name[ index ], + &Timer_id[ index ] + ); + directive_failed( status, "rtems_timer_create loop" ); + } + + for ( index = 1 ; index <= 3 ; index++ ) { + status = rtems_task_start( Task_id[ index ], Task_1_through_3, index ); + directive_failed( status, "rtems_task_start loop" ); + } + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp24/resume.c b/c/src/tests/sptests/sp24/resume.c new file mode 100644 index 0000000000..c73696c109 --- /dev/null +++ b/c/src/tests/sptests/sp24/resume.c @@ -0,0 +1,34 @@ +/* Resume_task + * + * This subprogram is scheduled as a timer service routine. When + * it fires it resumes the task which is mapped to this timer. + * + * 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 Resume_task( + rtems_id timer_id, + void *ignored_address +) +{ + rtems_id task_to_resume; + rtems_status_code status; + + task_to_resume = Task_id[ rtems_get_index( timer_id ) ]; + status = rtems_task_resume( task_to_resume ); + directive_failed( status, "rtems_task_resume" ); +} diff --git a/c/src/tests/sptests/sp24/sp24.doc b/c/src/tests/sptests/sp24/sp24.doc new file mode 100644 index 0000000000..14b743d588 --- /dev/null +++ b/c/src/tests/sptests/sp24/sp24.doc @@ -0,0 +1,51 @@ +# +# $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: test24 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + ev_receive + +concepts: + + a. This test is a cyclic version of test1. The times printed by + each test should not skew as in test1 (see output section). + + b. Verifies system can create and start both the executive's system + initialization and idle task. + + c. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + d. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + e. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + f. Verifies executive initialization performed correctly. + + g. Verifies the executive trap handler except for the halt function. + + h. Verifies that a task can get the task identification number of itself. + +output: + "TA1" is printed once every 5 seconds. "TA2" is printed once + every 10 seconds. "TA3" is printed once every 15 seconds. + + The times printed should be multiples of 5 seconds for TA1, 10 seconds + for TA2, and 15 seconds for TA3. If this does not happen, the calendar + time does not correspond correctly to the number of ticks. diff --git a/c/src/tests/sptests/sp24/sp24.scn b/c/src/tests/sptests/sp24/sp24.scn new file mode 100644 index 0000000000..577dc4f7b2 --- /dev/null +++ b/c/src/tests/sptests/sp24/sp24.scn @@ -0,0 +1,16 @@ +*** TEST 24 *** +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +TA2 - rtems_clock_get - 09:00:20 12/31/1988 +TA1 - rtems_clock_get - 09:00:25 12/31/1988 +TA1 - rtems_clock_get - 09:00:30 12/31/1988 +TA2 - rtems_clock_get - 09:00:30 12/31/1988 +TA3 - rtems_clock_get - 09:00:30 12/31/1988 +*** END OF TEST 24 *** diff --git a/c/src/tests/sptests/sp24/system.h b/c/src/tests/sptests/sp24/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp24/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 +#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/sp24/task1.c b/c/src/tests/sptests/sp24/task1.c new file mode 100644 index 0000000000..bb3540acee --- /dev/null +++ b/c/src/tests/sptests/sp24/task1.c @@ -0,0 +1,58 @@ +/* Task_1_through_3 + * + * This task is a cyclic version of test1 to asssure that the times + * displayed are not skewed as in test1. "TA1" is printed once every + * 5 seconds, "TA2" is printed once every 10 seconds, and "TA3" is + * printed once every 15 seconds. The times displayed should be + * in multiples of 5, 10, and 15 for TA1, TA2, and TA3 respectively. + * If the times are skewed from these values, then the calendar time + * does not correspond correctly with the number of ticks. + * + * 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_through_3( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident of self" ); + + while ( FOREVER ) { + status = rtems_timer_fire_after( + Timer_id[ argument ], + task_number( tid ) * 5 * TICKS_PER_SECOND, + Resume_task, + NULL + ); + directive_failed( status, "tm_fire_after failed" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get failed" ); + + if ( time.second >= 35 ) { + puts( "*** END OF TEST 24 ***" ); + exit( 0 ); + } + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + } +} -- cgit v1.2.3