OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [libtests/] [rtmonuse/] [task1.c] - Blame information for rev 449

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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.OARcorp.com/rtems/license.html.
17
 *
18
 *  $Id: task1.c,v 1.2 2001-09-27 12:02:13 chris Exp $
19
 */
20
 
21
#include "system.h"
22
 
23
#include <rtems/cpuuse.h>
24
#include <rtems/rtmonuse.h>
25
 
26
rtems_unsigned32    Periods[6]    = { 0,   2,   2,   2,   2, 100 };
27
rtems_unsigned32    Iterations[6] = { 0,  50,  50,  50,  50,   1 };
28
rtems_task_priority Priorities[6] = { 0,   1,   1,   3,   4,   5 };
29
 
30
rtems_task Task_1_through_5(
31
  rtems_unsigned32 argument
32
)
33
{
34
  rtems_id          rmid;
35
  rtems_id          test_rmid;
36
  rtems_unsigned32  index;
37
  rtems_unsigned32  pass;
38
  rtems_unsigned32  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
     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
          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
          exit( 0 );
118
        }
119
 
120
      }
121
      break;
122
  }
123
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.