source: rtems/c/src/tests/sptests/sp20/task1.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 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: 3.2 KB
Line 
1/*  Task_1_through_5
2 *
3 *  This routine serves as a test task for the period capabilities of the
4 *  Rate Monotonic Manager.
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_unsigned32    Periods[6]    = { 0,   2,   2,   2,   2, 100 };
25rtems_unsigned32    Iterations[6] = { 0,  50,  50,  50,  50,   1 };
26rtems_task_priority Priorities[6] = { 0,   1,   1,   3,   4,   5 };
27
28rtems_task Task_1_through_5(
29  rtems_unsigned32 argument
30)
31{
32  rtems_id          rmid;
33  rtems_id          test_rmid;
34  rtems_unsigned32  index;
35  rtems_unsigned32  pass;
36  rtems_unsigned32  failed;
37  rtems_status_code status;
38
39  status = rtems_rate_monotonic_create( argument, &rmid );
40  directive_failed( status, "rtems_rate_monotonic_create" );
41  put_name( Task_name[ argument ], FALSE );
42  printf( "- rtems_rate_monotonic_create id = 0x%08x\n", rmid );
43
44  status = rtems_rate_monotonic_ident( argument, &test_rmid );
45  directive_failed( status, "rtems_rate_monotonic_ident" );
46  put_name( Task_name[ argument ], FALSE );
47  printf( "- rtems_rate_monotonic_ident id = 0x%08x\n", test_rmid );
48
49  if ( rmid != test_rmid ) {
50     printf( "RMID's DO NOT MATCH (0x%x and 0x%x)\n", rmid, test_rmid );
51     exit( 0 );
52  }
53
54  put_name( Task_name[ argument ], FALSE );
55  printf( "- (0x%08x) period %d\n", rmid, Periods[ argument ] );
56
57  status = rtems_task_wake_after( 2 );
58  directive_failed( status, "rtems_task_wake_after" );
59
60  switch ( argument ) {
61    case 1:
62    case 2:
63    case 3:
64    case 4:
65      while ( FOREVER ) {
66        status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
67        directive_failed( status, "rtems_rate_monotonic_period" );
68        Count.count[ argument ]++;
69      }
70      break;
71    case 5:
72      pass   = 0;
73      failed = 0;
74
75      status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
76      directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" );
77
78      Get_all_counters();
79
80      while ( FOREVER ) {
81
82        status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
83        directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" );
84
85        Get_all_counters();
86
87        for( index = 1 ; index <= 4 ; index++ ) {
88          if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
89            puts_nocr( "FAIL -- " );
90            put_name ( Task_name[ index ], FALSE );
91            printf   ( " Actual=%d, Expected=%d\n",
92                       Temporary_count.count[ index ],
93                       Iterations[ index ]
94                     );
95            failed += 1;
96          }
97        }
98
99        if ( failed == 5 )
100          exit( 0 );
101
102        pass += 1;
103
104        printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
105
106        fflush( stdout );
107
108        if ( pass == 10 ) {
109          puts( "*** END OF TEST 20 ***" );
110          exit( 0 );
111        }
112
113      }
114      break;
115  }
116}
Note: See TracBrowser for help on using the repository browser.