OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp20/] [task1.c] - Blame information for rev 484

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

powered by: WebSVN 2.1.0

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