From ac7d5ef06a6d6e8d84abbd1f0b82162725f98326 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 11 May 1995 17:39:37 +0000 Subject: Initial revision --- testsuites/sptests/sp05/task1.c | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 testsuites/sptests/sp05/task1.c (limited to 'testsuites/sptests/sp05/task1.c') diff --git a/testsuites/sptests/sp05/task1.c b/testsuites/sptests/sp05/task1.c new file mode 100644 index 0000000000..9b99586fc8 --- /dev/null +++ b/testsuites/sptests/sp05/task1.c @@ -0,0 +1,78 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies that tasks can + * be suspended and resumed. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * NOTE: The rtems_task_suspend() directives fail on the first iteration. + * + * 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_id tid2; + rtems_id tid3; + rtems_unsigned32 pass; + rtems_status_code status; + + status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 ); + directive_failed( status, "rtems_task_ident of TA2" ); + + status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 ); + directive_failed( status, "rtems_task_ident of TA3" ); + + for ( pass=1 ; pass <= 3 ; pass++ ) { + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after of TA1" ); + + puts( "TA1 - rtems_task_suspend - suspend TA3" ); + status = rtems_task_suspend( tid3 ); + if ( pass == 1 ) { + fatal_directive_status( + status, + RTEMS_ALREADY_SUSPENDED, + "rtems_task_suspend of TA3" + ); + } else { + directive_failed( status, "rtems_task_suspend of TA3" ); + } + + puts( "TA1 - rtems_task_resume - resume TA2" ); + status = rtems_task_resume( tid2 ); + directive_failed( status, "rtems_task_resume of TA2" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_suspend - suspend TA2" ); + status = rtems_task_suspend( tid2 ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA1 - rtems_task_resume - resume TA3" ); + status = rtems_task_resume( tid3 ); + directive_failed( status, "rtems_task_resume" ); + } + + puts( "*** END OF TEST 5 ***" ); + exit( 0 ); +} -- cgit v1.2.3