source: rtems/c/src/tests/tmitrontests/tmitronsem01/init.c @ 352c9b2

4.104.114.84.95
Last change on this file since 352c9b2 was 352c9b2, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 9, 1999 at 10:07:23 PM

This patch adds the basic framework for the ITRON 3.0 API implementation
for RTEMS.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*  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 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.OARcorp.com/rtems/license.html.
16 *
17 *  $Id$
18 */
19
20#define TEST_INIT
21#include "system.h"
22#include <timesys.h>
23#include <stdio.h>
24
25void ITRON_Init( void )
26{
27  T_CSEM  pk_csem;
28  T_RSEM  pk_rsem;
29  int     index;
30
31  pk_csem.isemcnt = 2;
32  pk_csem.maxsem  = 3;
33  pk_csem.sematr  = TA_TFIFO;
34
35  printf( "\n\n*** TMITRON01 -- ITRON TIMING TEST ***\n" );
36
37  /*
38   *  time one invocation of cre_sem
39   */
40
41  Timer_initialize();
42    (void) cre_sem( 1, &pk_csem );
43  end_time = Read_timer();
44  put_time(
45    "cre_sem",
46    end_time,
47    1,
48    0,  /* no loop overhead to take out */
49    0   /* no calling overhead */
50  );
51
52  /*
53   *  time one invocation of del_sem
54   */
55
56  Timer_initialize(); 
57    (void) del_sem( 1 );
58  end_time = Read_timer();
59  put_time(
60    "del_sem",
61    end_time,
62    1,
63    0,  /* no loop overhead to take out */
64    0   /* no calling overhead */
65  );
66
67  pk_csem.isemcnt = 100;
68  pk_csem.maxsem  = 100;
69  pk_csem.sematr  = TA_TFIFO;
70  (void) cre_sem( 1, &pk_csem );
71
72  /*
73   *  time preq_sem (available)
74   */
75
76  Timer_initialize();
77    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
78      (void) preq_sem( 1 );
79  end_time = Read_timer();
80  put_time(
81    "preq_sem (available)",
82    end_time,
83    OPERATION_COUNT,
84    0,  /* don't take the loop overhead out */
85    0   /* no calling overhead */
86  );
87
88  /*
89   *  time preq_sem (not available)
90   */
91
92  Timer_initialize();
93    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
94      (void) preq_sem( 1 );
95  end_time = Read_timer();
96  put_time(
97    "preq_sem (not available)",
98    end_time,
99    OPERATION_COUNT,
100    0,  /* don't take the loop overhead out */
101    0   /* no calling overhead */
102  );
103
104  /*
105   *  time sig_sem (no waiting tasks)
106   */
107 
108  Timer_initialize(); 
109    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
110      (void) sig_sem( 1 );
111  end_time = Read_timer();
112  put_time(
113    "sig_sem (no waiting tasks)",
114    end_time,
115    OPERATION_COUNT,
116    0,  /* don't take the loop overhead out */
117    0   /* no calling overhead */
118  );
119
120  /*
121   *  time ref_sem
122   */
123
124  Timer_initialize();
125    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
126      (void) ref_sem( 1, &pk_rsem );
127  end_time = Read_timer();
128  put_time(
129    "ref_sem",
130    end_time,
131    OPERATION_COUNT,
132    0,  /* don't take the loop overhead out */
133    0   /* no calling overhead */
134  );
135
136  printf( "\n\nXXX ADD BLOCKING AND PREEMPTING TIME TESTS\n\n" );
137
138
139  printf( "*** END OF TMITRON01 -- ITRON TIMING TEST ***\n" );
140  exit( 0 );
141}
Note: See TracBrowser for help on using the repository browser.