source: rtems/testsuites/sptests/sp05/task1.c @ 3a4ae6c

4.104.114.84.95
Last change on this file since 3a4ae6c was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*  Task_1
2 *
3 *  This routine serves as a test task.  It verifies that tasks can
4 *  be suspended and resumed.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  NOTE: The rtems_task_suspend() directives fail on the first iteration.
12 *
13 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
14 *  On-Line Applications Research Corporation (OAR).
15 *  All rights assigned to U.S. Government, 1994.
16 *
17 *  This material may be reproduced by or for the U.S. Government pursuant
18 *  to the copyright license under the clause at DFARS 252.227-7013.  This
19 *  notice must appear in all copies of this file and its derivatives.
20 *
21 *  $Id$
22 */
23
24#include "system.h"
25
26rtems_task Task_1(
27  rtems_task_argument argument
28)
29{
30  rtems_id          tid2;
31  rtems_id          tid3;
32  rtems_unsigned32  pass;
33  rtems_status_code status;
34
35  status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 );
36  directive_failed( status, "rtems_task_ident of TA2" );
37
38  status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 );
39  directive_failed( status, "rtems_task_ident of TA3" );
40
41  for ( pass=1 ; pass <= 3 ; pass++ ) {
42
43    puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
44    status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
45    directive_failed( status, "rtems_task_wake_after of TA1" );
46
47    puts( "TA1 - rtems_task_suspend - suspend TA3" );
48    status = rtems_task_suspend( tid3 );
49    if ( pass == 1 ) {
50      fatal_directive_status(
51         status,
52         RTEMS_ALREADY_SUSPENDED,
53         "rtems_task_suspend of TA3"
54      );
55    } else {
56      directive_failed( status, "rtems_task_suspend of TA3" );
57    }
58
59    puts( "TA1 - rtems_task_resume - resume TA2" );
60    status = rtems_task_resume( tid2 );
61    directive_failed( status, "rtems_task_resume of TA2" );
62
63    puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
64    status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
65    directive_failed( status, "rtems_task_wake_after" );
66
67    puts( "TA1 - rtems_task_suspend - suspend TA2" );
68    status = rtems_task_suspend( tid2 );
69    directive_failed( status, "rtems_task_suspend of TA2" );
70
71    puts( "TA1 - rtems_task_resume - resume TA3" );
72    status = rtems_task_resume( tid3 );
73    directive_failed( status, "rtems_task_resume" );
74  }
75
76  puts( "*** END OF TEST 5 ***" );
77  exit( 0 );
78}
Note: See TracBrowser for help on using the repository browser.