source: rtems/testsuites/libtests/rtmonuse/task1.c @ 8f71a36

4.104.114.84.95
Last change on this file since 8f71a36 was 9919946a, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/30/04 at 11:12:47

2004-03-30 Ralf Corsepius <ralf_corsepius@…>

  • cpuuse/system.h, cpuuse/task1.c, cpuuse/tswitch.c, monitor/init.c, monitor/system.h, rtems++/System.h, rtems++/Task1.cc, rtems++/Task2.cc, rtems++/Task3.cc, rtmonuse/init.c, rtmonuse/system.h, rtmonuse/task1.c, stackchk/blow.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 3.3 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-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#include "system.h"
22
23#include <rtems/cpuuse.h>
24#include <rtems/rtmonuse.h>
25
26uint32_t      Periods[6]    = { 0,   2,   2,   2,   2, 100 };
27uint32_t      Iterations[6] = { 0,  50,  50,  50,  50,   1 };
28rtems_task_priority Priorities[6] = { 0,   1,   1,   3,   4,   5 };
29
30rtems_task Task_1_through_5(
31  uint32_t   argument
32)
33{
34  rtems_id          rmid;
35  rtems_id          test_rmid;
36  uint32_t    index;
37  uint32_t    pass;
38  uint32_t    failed;
39  rtems_status_code status;
40
41  status = rtems_rate_monotonic_create( argument, &rmid );
42  directive_failed( status, "rtems_rate_monotonic_create" );
43  put_name( Task_name[ argument ], FALSE );
44  printf( "- rtems_rate_monotonic_create id = 0x%08x\n", rmid );
45
46  status = rtems_rate_monotonic_ident( argument, &test_rmid );
47  directive_failed( status, "rtems_rate_monotonic_ident" );
48  put_name( Task_name[ argument ], FALSE );
49  printf( "- rtems_rate_monotonic_ident id = 0x%08x\n", test_rmid );
50
51  if ( rmid != test_rmid ) {
52     printf( "RMID's DO NOT MATCH (0x%x and 0x%x)\n", rmid, test_rmid );
53     rtems_test_exit( 0 );
54  }
55
56  put_name( Task_name[ argument ], FALSE );
57  printf( "- (0x%08x) period %d\n", rmid, Periods[ argument ] );
58
59  status = rtems_task_wake_after( 2 );
60  directive_failed( status, "rtems_task_wake_after" );
61
62  switch ( argument ) {
63    case 1:
64    case 2:
65    case 3:
66    case 4:
67      while ( FOREVER ) {
68        Period_usage_Update( rmid );
69
70        status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
71        directive_failed( status, "rtems_rate_monotonic_period" );
72        Count.count[ argument ]++;
73      }
74      break;
75    case 5:
76      pass   = 0;
77      failed = 0;
78
79      status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
80      directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" );
81
82      Get_all_counters();
83
84      while ( FOREVER ) {
85        Period_usage_Update( rmid );
86
87        status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
88        directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" );
89
90        Get_all_counters();
91
92        for( index = 1 ; index <= 4 ; index++ ) {
93          if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
94            puts_nocr( "FAIL -- " );
95            put_name ( Task_name[ index ], FALSE );
96            printf   ( " Actual=%d, Expected=%d\n",
97                       Temporary_count.count[ index ],
98                       Iterations[ index ]
99                     );
100            failed += 1;
101          }
102        }
103
104        if ( failed == 5 )
105          rtems_test_exit( 0 );
106
107        pass += 1;
108
109        printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
110
111        fflush( stdout );
112
113        if ( pass == 10 ) {
114          puts( "*** END OF RATE MONOTONIC PERIOD STATISTICS TEST ***" );
115          CPU_usage_Dump();
116          Period_usage_Dump();
117          rtems_test_exit( 0 );
118        }
119
120      }
121      break;
122  }
123}
Note: See TracBrowser for help on using the repository browser.