source: rtems/testsuites/tmtests/tm23/task1.c @ 95a81ab

4.104.114.84.9
Last change on this file since 95a81ab was 95a81ab, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:53:55 PM

2003-09-04 Joel Sherrill <joel@…>

  • include/timesys.h, tm01/system.h, tm01/task1.c, tm01/tm01.doc, tm02/system.h, tm02/task1.c, tm02/tm02.doc, tm03/system.h, tm03/task1.c, tm03/tm03.doc, tm04/system.h, tm04/task1.c, tm04/tm04.doc, tm05/system.h, tm05/task1.c, tm05/tm05.doc, tm06/system.h, tm06/task1.c, tm06/tm06.doc, tm07/system.h, tm07/task1.c, tm07/tm07.doc, tm08/system.h, tm08/task1.c, tm08/tm08.doc, tm09/system.h, tm09/task1.c, tm09/tm09.doc, tm10/system.h, tm10/task1.c, tm10/tm10.doc, tm11/system.h, tm11/task1.c, tm11/tm11.doc, tm12/system.h, tm12/task1.c, tm12/tm12.doc, tm13/system.h, tm13/task1.c, tm13/tm13.doc, tm14/system.h, tm14/task1.c, tm14/tm14.doc, tm15/system.h, tm15/task1.c, tm15/tm15.doc, tm16/system.h, tm16/task1.c, tm16/tm16.doc, tm17/system.h, tm17/task1.c, tm17/tm17.doc, tm18/system.h, tm18/task1.c, tm18/tm18.doc, tm19/system.h, tm19/task1.c, tm19/tm19.doc, tm20/system.h, tm20/task1.c, tm20/tm20.doc, tm21/system.h, tm21/task1.c, tm21/tm21.doc, tm22/system.h, tm22/task1.c, tm22/tm22.doc, tm23/system.h, tm23/task1.c, tm23/tm23.doc, tm24/system.h, tm24/task1.c, tm24/tm24.doc, tm25/system.h, tm25/task1.c, tm25/tm25.doc, tm26/fptest.h, tm26/system.h, tm26/task1.c, tm26/tm26.doc, tm27/system.h, tm27/task1.c, tm27/tm27.doc, tm28/system.h, tm28/task1.c, tm28/tm28.doc, tm29/system.h, tm29/task1.c, tm29/tm29.doc, tmck/system.h, tmck/task1.c, tmck/tmck.doc, tmoverhd/dumrtems.h, tmoverhd/empty.c, tmoverhd/system.h, tmoverhd/testtask.c, tmoverhd/tmoverhd.doc: URL for license changed.
  • Property mode set to 100644
File size: 6.7 KB
Line 
1/*
2 *
3 *  COPYRIGHT (c) 1989-1999.
4 *  On-Line Applications Research Corporation (OAR).
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#define TEST_INIT
14#include "system.h"
15
16rtems_id          Timer_id[ OPERATION_COUNT+1 ];
17
18rtems_time_of_day time_of_day;
19
20void null_delay(
21  rtems_id  ignored_id,
22  void     *ignored_address
23);
24
25rtems_task Low_task(
26  rtems_task_argument argument
27);
28
29rtems_task Middle_tasks(
30  rtems_task_argument argument
31);
32
33rtems_task High_task(
34  rtems_task_argument argument
35);
36
37
38rtems_task Init(
39  rtems_task_argument argument
40)
41{
42
43  rtems_task_priority priority;
44  rtems_unsigned32    index;
45  rtems_id            id;
46  rtems_task_entry    task_entry;
47  rtems_status_code   status;
48
49  Print_Warning();
50
51  puts( "\n\n*** TIME TEST 23 ***" );
52
53  Timer_initialize();
54    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
55      (void) Empty_function();
56  overhead = Read_timer();
57
58  priority = 5;
59
60  for( index=1 ; index <= OPERATION_COUNT ; index++ ) {
61    status = rtems_task_create(
62      rtems_build_name( 'T', 'I', 'M', 'E' ),
63      priority,
64      RTEMS_MINIMUM_STACK_SIZE,
65      RTEMS_DEFAULT_MODES,
66      RTEMS_DEFAULT_ATTRIBUTES,
67      &id
68    );
69    directive_failed( status, "rtems_task_create LOOP" );
70
71    if ( index == 1 )                    task_entry = High_task;
72    else if ( index == OPERATION_COUNT ) task_entry = Low_task;
73    else                                 task_entry = Middle_tasks;
74
75    status = rtems_task_start( id, task_entry, 0 );
76    directive_failed( status, "rtems_task_start LOOP" );
77
78    priority++;
79  }
80
81  status = rtems_task_delete( RTEMS_SELF );
82  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
83}
84
85void null_delay(
86  rtems_id  ignored_id,
87  void     *ignored_address
88)
89{
90}
91
92rtems_task High_task(
93  rtems_task_argument argument
94)
95{
96  rtems_unsigned32  index;
97  rtems_status_code status;
98  int i;
99
100  Timer_initialize();
101    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
102      (void) Empty_function();
103  overhead = Read_timer();
104
105  Timer_initialize();
106    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
107      (void) rtems_timer_create( index, &Timer_id[ index ] );
108  end_time = Read_timer();
109
110  put_time(
111    "rtems_timer_create",
112    end_time,
113    OPERATION_COUNT,
114    overhead,
115    CALLING_OVERHEAD_TIMER_CREATE
116  );
117
118  Timer_initialize();
119    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
120      (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
121  end_time = Read_timer();
122
123  put_time(
124    "rtems_timer_fire_after: inactive",
125    end_time,
126    OPERATION_COUNT,
127    overhead,
128    CALLING_OVERHEAD_TIMER_FIRE_AFTER
129  );
130
131  Timer_initialize();
132    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
133      (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
134  end_time = Read_timer();
135
136  put_time(
137    "rtems_timer_fire_after: active",
138    end_time,
139    OPERATION_COUNT,
140    overhead,
141    CALLING_OVERHEAD_TIMER_FIRE_AFTER
142  );
143
144  Timer_initialize();
145    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
146      (void) rtems_timer_cancel( Timer_id[ index ] );
147  end_time = Read_timer();
148
149  put_time(
150    "rtems_timer_cancel: active",
151    end_time,
152    OPERATION_COUNT,
153    overhead,
154    CALLING_OVERHEAD_TIMER_CANCEL
155  );
156
157  for ( Timer_initialize(), i=0 ; i<OPERATION_COUNT ; i++ )
158  Timer_initialize();
159    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
160      (void) rtems_timer_cancel( Timer_id[ index ] );
161  end_time = Read_timer();
162
163  put_time(
164    "rtems_timer_cancel: inactive",
165    end_time,
166    OPERATION_COUNT,
167    overhead,
168    CALLING_OVERHEAD_TIMER_CANCEL
169  );
170
171  for ( Timer_initialize(), i=0 ; i<OPERATION_COUNT ; i++ )
172  Timer_initialize();
173    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
174      (void) rtems_timer_reset( Timer_id[ index ] );
175  end_time = Read_timer();
176
177  put_time(
178    "rtems_timer_reset: inactive",
179    end_time,
180    OPERATION_COUNT,
181    overhead,
182    CALLING_OVERHEAD_TIMER_RESET
183  );
184
185  Timer_initialize();
186    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
187      (void) rtems_timer_reset( Timer_id[ index ] );
188  end_time = Read_timer();
189
190  put_time(
191    "rtems_timer_reset: active",
192    end_time,
193    OPERATION_COUNT,
194    overhead,
195    CALLING_OVERHEAD_TIMER_RESET
196  );
197
198  for ( index=1 ; index <= OPERATION_COUNT ; index++ )
199    (void) rtems_timer_reset( Timer_id[ index ] );
200
201  build_time( &time_of_day, 12, 31, 1988, 9, 0, 0, 0 );
202
203  status = rtems_clock_set( &time_of_day );
204  directive_failed( status, "rtems_clock_set" );
205
206  time_of_day.year = 1989;
207
208  Timer_initialize();
209    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
210      (void) rtems_timer_fire_when(
211         Timer_id[ index ], &time_of_day, null_delay, NULL );
212  end_time = Read_timer();
213
214  put_time(
215    "rtems_timer_fire_when: inactive",
216    end_time,
217    OPERATION_COUNT,
218    overhead,
219    CALLING_OVERHEAD_TIMER_FIRE_WHEN
220  );
221
222  Timer_initialize();
223    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
224      (void) rtems_timer_fire_when(
225         Timer_id[ index ], &time_of_day, null_delay, NULL );
226  end_time = Read_timer();
227
228  put_time(
229    "rtems_timer_fire_when: active",
230    end_time,
231    OPERATION_COUNT,
232    overhead,
233    CALLING_OVERHEAD_TIMER_FIRE_WHEN
234  );
235
236  Timer_initialize();
237    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
238      (void) rtems_timer_delete( Timer_id[ index ] );
239  end_time = Read_timer();
240
241  put_time(
242    "rtems_timer_delete: active",
243    end_time,
244    OPERATION_COUNT,
245    overhead,
246    CALLING_OVERHEAD_TIMER_DELETE
247  );
248
249  Timer_initialize();
250  for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
251    status = rtems_timer_create( index, &Timer_id[ index ] );
252    directive_failed( status, "rtems_timer_create" );
253
254    status = rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL );
255    directive_failed( status, "rtems_timer_fire_after" );
256
257    status = rtems_timer_cancel( Timer_id[ index ] );
258    directive_failed( status, "rtems_timer_cancel" );
259  }
260
261  Timer_initialize();
262    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
263      (void) rtems_timer_delete( Timer_id[ index ] );
264  end_time = Read_timer();
265
266  put_time(
267    "rtems_timer_delete: inactive",
268    end_time,
269    OPERATION_COUNT,
270    overhead,
271    CALLING_OVERHEAD_TIMER_DELETE
272  );
273
274  Timer_initialize();
275    (void) rtems_task_wake_when( &time_of_day );
276}
277
278rtems_task Middle_tasks(
279  rtems_task_argument argument
280)
281{
282  (void) rtems_task_wake_when( &time_of_day );
283}
284
285rtems_task Low_task(
286  rtems_task_argument argument
287)
288{
289  end_time = Read_timer();
290
291  put_time(
292    "rtems_task_wake_when",
293    end_time,
294    OPERATION_COUNT,
295    0,
296    CALLING_OVERHEAD_TASK_WAKE_WHEN
297  );
298
299  puts( "*** END OF TEST 23 ***" );
300  rtems_test_exit( 0 );
301}
Note: See TracBrowser for help on using the repository browser.