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/] [tmitrontests/] [tmitronsem01/] [init.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  Init
2
 *
3
 *  This routine is the initialization task for this test program.
4
 *  It is called from init_exec and has the responsibility for creating
5
 *  and starting the tasks that make up the test.  If the time of day
6
 *  clock is required for the test, it should also be set to a known
7
 *  value by this function.
8
 *
9
 *  Input parameters:  NONE
10
 *
11
 *  Output parameters:  NONE
12
 *
13
 *  COPYRIGHT (c) 1989-1999.
14
 *  On-Line Applications Research Corporation (OAR).
15
 *
16
 *  The license and distribution terms for this file may be
17
 *  found in the file LICENSE in this distribution or at
18
 *  http://www.OARcorp.com/rtems/license.html.
19
 *
20
 *  $Id: init.c,v 1.2 2001-09-27 12:02:39 chris Exp $
21
 */
22
 
23
#define TEST_INIT
24
#include "system.h"
25
#include <timesys.h>
26
#include <stdio.h>
27
 
28
void ITRON_Init( void )
29
{
30
  T_CSEM  pk_csem;
31
  T_RSEM  pk_rsem;
32
  int     index;
33
 
34
  pk_csem.isemcnt = 2;
35
  pk_csem.maxsem  = 3;
36
  pk_csem.sematr  = TA_TFIFO;
37
 
38
  printf( "\n\n*** TMITRON01 -- ITRON TIMING TEST ***\n" );
39
 
40
  /*
41
   *  time one invocation of cre_sem
42
   */
43
 
44
  Timer_initialize();
45
    (void) cre_sem( 1, &pk_csem );
46
  end_time = Read_timer();
47
  put_time(
48
    "cre_sem",
49
    end_time,
50
    1,
51
    0,  /* no loop overhead to take out */
52
 
53
  );
54
 
55
  /*
56
   *  time one invocation of del_sem
57
   */
58
 
59
  Timer_initialize();
60
    (void) del_sem( 1 );
61
  end_time = Read_timer();
62
  put_time(
63
    "del_sem",
64
    end_time,
65
    1,
66
    0,  /* no loop overhead to take out */
67
 
68
  );
69
 
70
  pk_csem.isemcnt = 100;
71
  pk_csem.maxsem  = 100;
72
  pk_csem.sematr  = TA_TFIFO;
73
  (void) cre_sem( 1, &pk_csem );
74
 
75
  /*
76
   *  time preq_sem (available)
77
   */
78
 
79
  Timer_initialize();
80
    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
81
      (void) preq_sem( 1 );
82
  end_time = Read_timer();
83
  put_time(
84
    "preq_sem (available)",
85
    end_time,
86
    OPERATION_COUNT,
87
    0,  /* don't take the loop overhead out */
88
 
89
  );
90
 
91
  /*
92
   *  time preq_sem (not available)
93
   */
94
 
95
  Timer_initialize();
96
    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
97
      (void) preq_sem( 1 );
98
  end_time = Read_timer();
99
  put_time(
100
    "preq_sem (not available)",
101
    end_time,
102
    OPERATION_COUNT,
103
    0,  /* don't take the loop overhead out */
104
 
105
  );
106
 
107
  /*
108
   *  time sig_sem (no waiting tasks)
109
   */
110
 
111
  Timer_initialize();
112
    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
113
      (void) sig_sem( 1 );
114
  end_time = Read_timer();
115
  put_time(
116
    "sig_sem (no waiting tasks)",
117
    end_time,
118
    OPERATION_COUNT,
119
    0,  /* don't take the loop overhead out */
120
 
121
  );
122
 
123
  /*
124
   *  time ref_sem
125
   */
126
 
127
  Timer_initialize();
128
    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
129
      (void) ref_sem( 1, &pk_rsem );
130
  end_time = Read_timer();
131
  put_time(
132
    "ref_sem",
133
    end_time,
134
    OPERATION_COUNT,
135
    0,  /* don't take the loop overhead out */
136
 
137
  );
138
 
139
  printf( "\n\nXXX ADD BLOCKING AND PREEMPTING TIME TESTS\n\n" );
140
 
141
 
142
  printf( "*** END OF TMITRON01 -- ITRON TIMING TEST ***\n" );
143
  exit( 0 );
144
}

powered by: WebSVN 2.1.0

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