source: rtems/c/src/tests/sptests/sp05/task1.c @ 0895bdb

4.104.114.84.95
Last change on this file since 0895bdb was 60b791ad, checked in by Joel Sherrill <joel.sherrill@…>, on 02/17/98 at 23:46:28

updated copyright to 1998

  • Property mode set to 100644
File size: 2.2 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-1998.
14 *  On-Line Applications Research Corporation (OAR).
15 *  Copyright assigned to U.S. Government, 1994.
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.OARcorp.com/rtems/license.html.
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.