source: rtems/testsuites/sptests/sp04/task1.c @ 5250ff39

4.104.114.84.95
Last change on this file since 5250ff39 was 3235ad9, checked in by Joel Sherrill <joel.sherrill@…>, on 08/23/95 at 19:30:23

Support for variable length names added to Object Handler. This supports
both fixed length "raw" names and strings from the API's point of view.

Both inline and macro implementations were tested.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*  Task_1
2 *
3 *  This test serves as a test task.  It verifies timeslicing activities
4 *  and tswitch extension processing.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
12 *  On-Line Applications Research Corporation (OAR).
13 *  All rights assigned to U.S. Government, 1994.
14 *
15 *  This material may be reproduced by or for the U.S. Government pursuant
16 *  to the copyright license under the clause at DFARS 252.227-7013.  This
17 *  notice must appear in all copies of this file and its derivatives.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23
24rtems_task Task_1(
25  rtems_task_argument argument
26)
27{
28  rtems_unsigned32  seconds;
29  rtems_unsigned32  old_seconds;
30  rtems_mode        previous_mode;
31  rtems_time_of_day time;
32  rtems_status_code status;
33  rtems_unsigned32  start;
34  rtems_unsigned32  end;
35
36  puts( "TA1 - rtems_task_suspend - on Task 2" );
37  status = rtems_task_suspend( Task_id[ 2 ] );
38  directive_failed( status, "rtems_task_suspend of TA2" );
39
40  puts( "TA1 - rtems_task_suspend - on Task 3" );
41  status = rtems_task_suspend( Task_id[ 3 ] );
42  directive_failed( status, "rtems_task_suspend of TA3" );
43
44  status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &start );
45  directive_failed( status, "rtems_clock_get" );
46
47  puts( "TA1 - killing time" );
48
49  for ( ; ; ) {
50    status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &end );
51    directive_failed( status, "rtems_clock_get" );
52
53    if ( end > (start + 2) )
54      break;
55  }
56
57  puts( "TA1 - rtems_task_resume - on Task 2" );
58  status = rtems_task_resume( Task_id[ 2 ] );
59  directive_failed( status, "rtems_task_resume of TA2" );
60
61  puts( "TA1 - rtems_task_resume - on Task 3" );
62  status = rtems_task_resume( Task_id[ 3 ] );
63  directive_failed( status, "rtems_task_resume of TA3" );
64
65  while ( FOREVER ) {
66    if ( Run_count[ 1 ] == 3 ) {
67      puts( "TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT" );
68
69      status = rtems_task_mode(
70        RTEMS_NO_PREEMPT,
71        RTEMS_PREEMPT_MASK,
72        &previous_mode
73      );
74      directive_failed( status, "rtems_task_mode" );
75
76      status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
77      directive_failed( status, "rtems_clock_get" );
78
79      old_seconds = time.second;
80
81      for ( seconds = 0 ; seconds < 6 ; ) {
82        status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
83        directive_failed( status, "rtems_clock_get" );
84
85        if ( time.second != old_seconds ) {
86          old_seconds = time.second;
87          seconds++;
88          print_time( "TA1 - ", &time, "\n" );
89        }
90      }
91
92      puts( "TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT" );
93      status = rtems_task_mode(
94        RTEMS_PREEMPT,
95        RTEMS_PREEMPT_MASK,
96        &previous_mode
97      );
98      directive_failed( status, "rtems_task_mode" );
99
100      while ( FOREVER );
101    }
102  }
103}
Note: See TracBrowser for help on using the repository browser.