source: rtems/c/src/ada-tests/tmtests/tm04/tmtest.adb @ 35e4691

4.104.114.84.95
Last change on this file since 35e4691 was 35e4691, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:50:41 PM

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

  • mptests/mp01/config.h, mptests/mp01/mp01.adb, mptests/mp01/mptest.adb, mptests/mp01/mptest.ads, mptests/mp02/mptest.adb, mptests/mp02/mptest.ads, mptests/mp03/mptest.adb, mptests/mp03/mptest.ads, mptests/mp04/mptest.adb, mptests/mp04/mptest.ads, mptests/mp05/mptest.adb, mptests/mp05/mptest.ads, mptests/mp06/mptest.adb, mptests/mp06/mptest.ads, mptests/mp07/mptest.adb, mptests/mp07/mptest.ads, mptests/mp08/mptest.adb, mptests/mp08/mptest.ads, mptests/mp09/mptest.adb, mptests/mp09/mptest.ads, mptests/mp10/mptest.adb, mptests/mp10/mptest.ads, mptests/mp11/mptest.adb, mptests/mp11/mptest.ads, mptests/mp12/mptest.adb, mptests/mp12/mptest.ads, mptests/mp13/mptest.adb, mptests/mp13/mptest.ads, mptests/mp14/mptest.adb, mptests/mp14/mptest.ads, samples/base_mp/config.h, samples/base_mp/mptest.adb, samples/base_mp/mptest.ads, samples/base_sp/base_sp.adb, samples/base_sp/config.h, samples/base_sp/sptest.adb, samples/base_sp/sptest.ads, samples/hello/config.h, samples/hello/hello.adb, samples/hello/sptest.adb, samples/hello/sptest.ads, samples/ticker/config.h, samples/ticker/sptest.adb, samples/ticker/sptest.ads, samples/ticker/ticker.adb, sptests/sp01/config.h, sptests/sp01/sp01.adb, sptests/sp01/sptest.adb, sptests/sp01/sptest.ads, sptests/sp02/config.h, sptests/sp02/sp02.adb, sptests/sp02/sptest.adb, sptests/sp02/sptest.ads, sptests/sp03/config.h, sptests/sp03/sp03.adb, sptests/sp03/sptest.adb, sptests/sp03/sptest.ads, sptests/sp04/config.h, sptests/sp04/sp04.adb, sptests/sp04/sptest.adb, sptests/sp04/sptest.ads, sptests/sp05/config.h, sptests/sp05/sp05.adb, sptests/sp05/sptest.adb, sptests/sp05/sptest.ads, sptests/sp06/config.h, sptests/sp06/sp06.adb, sptests/sp06/sptest.adb, sptests/sp06/sptest.ads, sptests/sp07/config.h, sptests/sp07/sp07.adb, sptests/sp07/sptest.adb, sptests/sp07/sptest.ads, sptests/sp08/config.h, sptests/sp08/sp08.adb, sptests/sp08/sptest.adb, sptests/sp08/sptest.ads, sptests/sp09/config.h, sptests/sp09/sp09.adb, sptests/sp09/sptest.adb, sptests/sp09/sptest.ads, sptests/sp11/config.h, sptests/sp11/sp11.adb, sptests/sp11/sptest.adb, sptests/sp11/sptest.ads, sptests/sp12/config.h, sptests/sp12/sp12.adb, sptests/sp12/sptest.adb, sptests/sp12/sptest.ads, sptests/sp13/config.h, sptests/sp13/sp13.adb, sptests/sp13/sptest.adb, sptests/sp13/sptest.ads, sptests/sp14/config.h, sptests/sp14/sp14.adb, sptests/sp14/sptest.adb, sptests/sp14/sptest.ads, sptests/sp15/config.h, sptests/sp15/sp15.adb, sptests/sp15/sptest.adb, sptests/sp15/sptest.ads, sptests/sp16/config.h, sptests/sp16/sp16.adb, sptests/sp16/sptest.adb, sptests/sp16/sptest.ads, sptests/sp17/config.h, sptests/sp17/sp17.adb, sptests/sp17/sptest.adb, sptests/sp17/sptest.ads, sptests/sp19/config.h, sptests/sp19/sp19.adb, sptests/sp19/sptest.ads, sptests/sp20/config.h, sptests/sp20/sp20.adb, sptests/sp20/sptest.adb, sptests/sp20/sptest.ads, sptests/sp21/config.h, sptests/sp21/sp21.adb, sptests/sp21/sptest.adb, sptests/sp21/sptest.ads, sptests/sp22/config.h, sptests/sp22/sp22.adb, sptests/sp22/sptest.adb, sptests/sp22/sptest.ads, sptests/sp23/config.h, sptests/sp23/sp23.adb, sptests/sp23/sptest.adb, sptests/sp23/sptest.ads, sptests/sp24/config.h, sptests/sp24/sp24.adb, sptests/sp24/sptest.adb, sptests/sp24/sptest.ads, sptests/sp25/config.h, sptests/sp25/sp25.adb, sptests/sp25/sptest.adb, sptests/sp25/sptest.ads, sptests/spsize/spsize.adb, sptests/spsize/sptest.adb, sptests/spsize/sptest.ads, support/address_io.adb, support/address_io.ads, support/float_io.ads, support/fp.inc, support/integer.inc, support/rtems_calling_overhead.ads, support/status_io.ads, support/test_support.adb, support/test_support.ads, support/time_test_support.adb, support/time_test_support.ads, support/timer_driver.adb, support/timer_driver.ads, support/unsigned32_io.ads, tmtests/tm01/config.h, tmtests/tm01/tm01.adb, tmtests/tm01/tmtest.adb, tmtests/tm01/tmtest.ads, tmtests/tm02/config.h, tmtests/tm02/tm02.adb, tmtests/tm02/tmtest.adb, tmtests/tm02/tmtest.ads, tmtests/tm03/config.h, tmtests/tm03/tm03.adb, tmtests/tm03/tmtest.adb, tmtests/tm03/tmtest.ads, tmtests/tm04/config.h, tmtests/tm04/tm04.adb, tmtests/tm04/tmtest.adb, tmtests/tm04/tmtest.ads, tmtests/tm05/config.h, tmtests/tm05/tm05.adb, tmtests/tm05/tmtest.adb, tmtests/tm05/tmtest.ads, tmtests/tm06/config.h, tmtests/tm06/tm06.adb, tmtests/tm06/tmtest.adb, tmtests/tm06/tmtest.ads, tmtests/tm07/config.h, tmtests/tm07/tm07.adb, tmtests/tm07/tmtest.adb, tmtests/tm07/tmtest.ads, tmtests/tm08/config.h, tmtests/tm08/tm08.adb, tmtests/tm08/tmtest.adb, tmtests/tm08/tmtest.ads, tmtests/tm09/config.h, tmtests/tm09/tm09.adb, tmtests/tm09/tmtest.adb, tmtests/tm09/tmtest.ads, tmtests/tm10/config.h, tmtests/tm10/tm10.adb, tmtests/tm10/tmtest.adb, tmtests/tm10/tmtest.ads, tmtests/tm11/config.h, tmtests/tm11/tm11.adb, tmtests/tm11/tmtest.adb, tmtests/tm11/tmtest.ads, tmtests/tm12/config.h, tmtests/tm12/tm12.adb, tmtests/tm12/tmtest.adb, tmtests/tm12/tmtest.ads, tmtests/tm13/config.h, tmtests/tm13/tm13.adb, tmtests/tm13/tmtest.adb, tmtests/tm13/tmtest.ads, tmtests/tm14/config.h, tmtests/tm14/tm14.adb, tmtests/tm14/tmtest.adb, tmtests/tm14/tmtest.ads, tmtests/tm15/config.h, tmtests/tm15/tm15.adb, tmtests/tm15/tmtest.adb, tmtests/tm15/tmtest.ads, tmtests/tm16/config.h, tmtests/tm16/tm16.adb, tmtests/tm16/tmtest.adb, tmtests/tm16/tmtest.ads, tmtests/tm17/config.h, tmtests/tm17/tm17.adb, tmtests/tm17/tmtest.adb, tmtests/tm17/tmtest.ads, tmtests/tm18/config.h, tmtests/tm18/tm18.adb, tmtests/tm18/tmtest.adb, tmtests/tm18/tmtest.ads, tmtests/tm19/config.h, tmtests/tm19/tm19.adb, tmtests/tm19/tmtest.adb, tmtests/tm19/tmtest.ads, tmtests/tm20/config.h, tmtests/tm20/tm20.adb, tmtests/tm20/tmtest.adb, tmtests/tm20/tmtest.ads, tmtests/tm21/config.h, tmtests/tm21/tm21.adb, tmtests/tm21/tmtest.adb, tmtests/tm21/tmtest.ads, tmtests/tm22/config.h, tmtests/tm22/tm22.adb, tmtests/tm22/tmtest.adb, tmtests/tm22/tmtest.ads, tmtests/tm23/config.h, tmtests/tm23/tm23.adb, tmtests/tm23/tmtest.adb, tmtests/tm23/tmtest.ads, tmtests/tm24/config.h, tmtests/tm24/tm24.adb, tmtests/tm24/tmtest.adb, tmtests/tm24/tmtest.ads, tmtests/tm25/config.h, tmtests/tm25/tm25.adb, tmtests/tm25/tmtest.adb, tmtests/tm25/tmtest.ads, tmtests/tm28/config.h, tmtests/tm28/tm28.adb, tmtests/tm28/tmtest.adb, tmtests/tm28/tmtest.ads, tmtests/tm29/config.h, tmtests/tm29/tm29.adb, tmtests/tm29/tmtest.adb, tmtests/tm29/tmtest.ads, tmtests/tmck/config.h, tmtests/tmck/tmck.adb, tmtests/tmck/tmtest.adb, tmtests/tmck/tmtest.ads, tmtests/tmoverhd/config.h, tmtests/tmoverhd/dummy_rtems.adb, tmtests/tmoverhd/dummy_rtems.ads, tmtests/tmoverhd/tmoverhd.adb, tmtests/tmoverhd/tmtest.adb, tmtests/tmoverhd/tmtest.ads: URL for license changed.
  • Property mode set to 100644
File size: 12.6 KB
Line 
1--
2--  TMTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation of Test 4 of the RTEMS
7--  Timing Test Suite.
8--
9--  DEPENDENCIES:
10--
11-- 
12--
13--  COPYRIGHT (c) 1989-1997.
14--  On-Line Applications Research Corporation (OAR).
15--
16--  The license and distribution terms for this file may in
17--  the file LICENSE in this distribution or at
18--  http://www.rtems.com/license/LICENSE.
19--
20--  $Id$
21--
22
23with INTERFACES; use INTERFACES;
24with RTEMS;
25with RTEMS_CALLING_OVERHEAD;
26with TEST_SUPPORT;
27with TEXT_IO;
28with TIME_TEST_SUPPORT;
29with UNSIGNED32_IO;
30
31package body TMTEST is
32
33--PAGE
34--
35--  INIT
36--
37
38   procedure INIT (
39      ARGUMENT : in     RTEMS.TASK_ARGUMENT
40   ) is
41      STATUS  : RTEMS.STATUS_CODES;
42   begin
43
44      TEXT_IO.NEW_LINE( 2 );
45      TEXT_IO.PUT_LINE( "*** TIME TEST 4 ***" );
46
47      TMTEST.TEST_INIT;
48
49      RTEMS.TASK_DELETE( RTEMS.SELF, STATUS );
50      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
51
52   end INIT;
53
54--PAGE
55--
56--  TEST_INIT
57--
58
59   procedure TEST_INIT
60   is
61      INDEX    : RTEMS.UNSIGNED32;
62      STATUS   : RTEMS.STATUS_CODES;
63   begin
64
65      TMTEST.TASK_COUNT := TIME_TEST_SUPPORT.OPERATION_COUNT;
66
67      for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
68      loop
69
70         RTEMS.TASK_CREATE( 
71            RTEMS.BUILD_NAME( 'T', 'I', 'M', 'E' ),
72            10, 
73            1024, 
74            RTEMS.NO_PREEMPT,
75            RTEMS.DEFAULT_ATTRIBUTES,
76            TMTEST.TASK_ID( INDEX ),
77            STATUS
78         );
79         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
80
81         RTEMS.TASK_START( 
82            TMTEST.TASK_ID( INDEX ),
83            TMTEST.LOW_TASKS'ACCESS, 
84            0, 
85            STATUS
86         );
87         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
88
89      end loop;
90
91      RTEMS.SEMAPHORE_CREATE(
92         RTEMS.BUILD_NAME( 'S', 'M', '1', ' ' ),
93         0,
94         RTEMS.DEFAULT_ATTRIBUTES,
95         RTEMS.NO_PRIORITY,
96         TMTEST.SEMAPHORE_ID,
97         STATUS
98      );
99      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE OF SM1" );
100
101   end TEST_INIT;
102
103--PAGE
104--
105--  HIGHEST_TASK
106--
107
108   procedure HIGHEST_TASK (
109      ARGUMENT : in     RTEMS.TASK_ARGUMENT
110   ) is
111      OLD_PRIORITY : RTEMS.TASK_PRIORITY;
112      STATUS       : RTEMS.STATUS_CODES;
113   begin
114
115      if ARGUMENT = 1 then
116
117         TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
118
119         TIME_TEST_SUPPORT.PUT_TIME( 
120            "TASK_RESTART (blocked, preempt)",
121            TMTEST.END_TIME, 
122            1, 
123            0,
124            RTEMS_CALLING_OVERHEAD.TASK_RESTART
125         );
126 
127         RTEMS.TASK_SET_PRIORITY( RTEMS.SELF, 254, OLD_PRIORITY, STATUS );
128         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
129
130      elsif ARGUMENT = 2 then
131
132         TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
133
134         TIME_TEST_SUPPORT.PUT_TIME( 
135            "TASK_RESTART (ready, preempt)",
136            TMTEST.END_TIME, 
137            1, 
138            0,
139            RTEMS_CALLING_OVERHEAD.TASK_RESTART
140         );
141
142         RTEMS.TASK_DELETE( RTEMS.SELF, STATUS );
143         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE" );
144 
145      else
146
147         RTEMS.SEMAPHORE_OBTAIN( 
148            TMTEST.SEMAPHORE_ID, 
149            RTEMS.DEFAULT_OPTIONS,
150            RTEMS.NO_TIMEOUT,
151            STATUS
152         );
153
154      end if;
155
156   end HIGHEST_TASK;
157
158--PAGE
159--
160--  HIGH_TASK
161--
162
163   procedure HIGH_TASK (
164      ARGUMENT : in     RTEMS.TASK_ARGUMENT
165   ) is
166      OLD_PRIORITY : RTEMS.TASK_PRIORITY;
167      INDEX        : RTEMS.UNSIGNED32;
168      OVERHEAD     : RTEMS.UNSIGNED32;
169      NAME         : RTEMS.NAME;
170      STATUS       : RTEMS.STATUS_CODES;
171   begin
172 
173      TIMER_DRIVER.INITIALIZE;
174         RTEMS.TASK_RESTART( TMTEST.HIGHEST_ID, 1, STATUS );
175      -- preempted by Higher_task
176
177      TIMER_DRIVER.INITIALIZE;
178         RTEMS.TASK_RESTART( TMTEST.HIGHEST_ID, 2, STATUS );
179      -- preempted by Higher_task
180
181      TIMER_DRIVER.INITIALIZE;
182         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
183         loop
184            TIMER_DRIVER.EMPTY_FUNCTION;
185         end loop;
186      OVERHEAD := TIMER_DRIVER.READ_TIMER;
187
188      TIMER_DRIVER.INITIALIZE;
189         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
190         loop
191            RTEMS.SEMAPHORE_RELEASE( TMTEST.SEMAPHORE_ID, STATUS );
192         end loop;
193      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
194
195      TIME_TEST_SUPPORT.PUT_TIME( 
196         "SEMAPHORE_RELEASE (readying)",
197         TMTEST.END_TIME, 
198         TIME_TEST_SUPPORT.OPERATION_COUNT, 
199         OVERHEAD,
200         RTEMS_CALLING_OVERHEAD.SEMAPHORE_RELEASE
201      );
202
203      for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
204      loop
205         RTEMS.TASK_DELETE( TMTEST.TASK_ID( INDEX ), STATUS );
206         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE" );
207      end loop;
208     
209      NAME := RTEMS.BUILD_NAME( 'T', 'I', 'M', 'E' );
210
211      TIMER_DRIVER.INITIALIZE;
212         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
213         loop
214            RTEMS.TASK_CREATE( 
215               NAME,
216               10, 
217               1024, 
218               RTEMS.NO_PREEMPT,
219               RTEMS.DEFAULT_ATTRIBUTES,
220               TMTEST.TASK_ID( INDEX ),
221               STATUS
222            );
223         end loop; 
224      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
225
226      TIME_TEST_SUPPORT.PUT_TIME( 
227         "TASK_CREATE",
228         TMTEST.END_TIME, 
229         TIME_TEST_SUPPORT.OPERATION_COUNT, 
230         OVERHEAD,
231         RTEMS_CALLING_OVERHEAD.TASK_CREATE
232      );
233
234      TIMER_DRIVER.INITIALIZE;
235         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
236         loop
237            RTEMS.TASK_START( 
238               TMTEST.TASK_ID( INDEX ),
239               TMTEST.LOW_TASKS'ACCESS, 
240               0, 
241               STATUS
242            );
243         end loop; 
244      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
245
246      TIME_TEST_SUPPORT.PUT_TIME( 
247         "TASK_START",
248         TMTEST.END_TIME, 
249         TIME_TEST_SUPPORT.OPERATION_COUNT, 
250         OVERHEAD,
251         RTEMS_CALLING_OVERHEAD.TASK_START
252      );
253
254      for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
255      loop
256         RTEMS.TASK_DELETE( TMTEST.TASK_ID( INDEX ), STATUS );
257         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE LOOP" );
258      end loop;
259     
260      for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
261      loop
262         RTEMS.TASK_CREATE( 
263            NAME,
264            250, 
265            1024, 
266            RTEMS.NO_PREEMPT,
267            RTEMS.DEFAULT_ATTRIBUTES,
268            TMTEST.TASK_ID( INDEX ),
269            STATUS
270         );
271         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
272         RTEMS.TASK_START( 
273            TMTEST.TASK_ID( INDEX ),
274            TMTEST.RESTART_TASK'ACCESS, 
275            0, 
276            STATUS
277         );
278         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
279         RTEMS.TASK_SUSPEND( TMTEST.TASK_ID( INDEX ), STATUS );
280         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND LOOP" );
281      end loop;
282     
283      TIMER_DRIVER.INITIALIZE;
284         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
285         loop
286            RTEMS.TASK_RESTART( TMTEST.TASK_ID( INDEX ), 0, STATUS );
287         end loop; 
288      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
289
290      TIME_TEST_SUPPORT.PUT_TIME( 
291         "TASK_RESTART (suspended)",
292         TMTEST.END_TIME, 
293         TIME_TEST_SUPPORT.OPERATION_COUNT, 
294         OVERHEAD,
295         RTEMS_CALLING_OVERHEAD.TASK_RESTART
296      );
297
298      for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
299      loop
300         RTEMS.TASK_SUSPEND( TMTEST.TASK_ID( INDEX ), STATUS );
301         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND LOOP" );
302      end loop;
303
304      TIMER_DRIVER.INITIALIZE;
305         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
306         loop
307            RTEMS.TASK_DELETE( TMTEST.TASK_ID( INDEX ), STATUS );
308         end loop; 
309      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
310
311      TIME_TEST_SUPPORT.PUT_TIME( 
312         "TASK_DELETE (suspended)",
313         TMTEST.END_TIME, 
314         TIME_TEST_SUPPORT.OPERATION_COUNT, 
315         OVERHEAD,
316         RTEMS_CALLING_OVERHEAD.TASK_DELETE
317      );
318
319      for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
320      loop
321         RTEMS.TASK_CREATE( 
322            NAME,
323            250, 
324            1024, 
325            RTEMS.DEFAULT_OPTIONS,
326            RTEMS.DEFAULT_ATTRIBUTES,
327            TMTEST.TASK_ID( INDEX ),
328            STATUS
329         );
330         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
331         RTEMS.TASK_START( 
332            TMTEST.TASK_ID( INDEX ),
333            TMTEST.RESTART_TASK'ACCESS, 
334            0, 
335            STATUS
336         );
337         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
338      end loop;
339     
340      TIMER_DRIVER.INITIALIZE;
341         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
342         loop
343            RTEMS.TASK_RESTART( TMTEST.TASK_ID( INDEX ), 1, STATUS );
344         end loop; 
345      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
346
347      TIME_TEST_SUPPORT.PUT_TIME( 
348         "TASK_RESTART (ready)",
349         TMTEST.END_TIME, 
350         TIME_TEST_SUPPORT.OPERATION_COUNT, 
351         OVERHEAD,
352         RTEMS_CALLING_OVERHEAD.TASK_RESTART
353      );
354
355      for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
356      loop
357         RTEMS.TASK_SET_PRIORITY( 
358            TMTEST.TASK_ID( INDEX ), 
359            5, 
360            OLD_PRIORITY, 
361            STATUS
362         );
363         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY LOOP" );
364      end loop; 
365
366      -- yield processor -- tasks block
367      RTEMS.TASK_WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); 
368      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
369   
370      TIMER_DRIVER.INITIALIZE;
371         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
372         loop
373            RTEMS.TASK_RESTART( TMTEST.TASK_ID( INDEX ), 1, STATUS );
374         end loop; 
375      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
376
377      TIME_TEST_SUPPORT.PUT_TIME( 
378         "TASK_RESTART (blocked, no preempt)",
379         TMTEST.END_TIME, 
380         TIME_TEST_SUPPORT.OPERATION_COUNT, 
381         OVERHEAD,
382         RTEMS_CALLING_OVERHEAD.TASK_RESTART
383      );
384
385      -- yield processor -- tasks block
386      RTEMS.TASK_WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); 
387      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
388   
389      TIMER_DRIVER.INITIALIZE;
390         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
391         loop
392            RTEMS.TASK_DELETE( TMTEST.TASK_ID( INDEX ), STATUS );
393         end loop; 
394      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
395
396      TIME_TEST_SUPPORT.PUT_TIME( 
397         "TASK_DELETE (blocked)",
398         TMTEST.END_TIME, 
399         TIME_TEST_SUPPORT.OPERATION_COUNT, 
400         OVERHEAD,
401         RTEMS_CALLING_OVERHEAD.TASK_DELETE
402      );
403
404      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
405
406   end HIGH_TASK;
407
408--PAGE
409--
410--  LOW_TASKS
411--
412
413   procedure LOW_TASKS (
414      ARGUMENT : in     RTEMS.TASK_ARGUMENT
415   ) is
416      ID         : RTEMS.ID;
417      STATUS     : RTEMS.STATUS_CODES;
418   begin
419   
420      TMTEST.TASK_COUNT := TMTEST.TASK_COUNT - 1;
421
422      if TMTEST.TASK_COUNT = 0 then
423
424         RTEMS.TASK_CREATE( 
425            RTEMS.BUILD_NAME( 'H', 'I', ' ', ' ' ),
426            5, 
427            2048, 
428            RTEMS.DEFAULT_OPTIONS,
429            RTEMS.DEFAULT_ATTRIBUTES,
430            ID,
431            STATUS
432         );
433         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE HI" );
434
435         RTEMS.TASK_START( 
436            ID, 
437            TMTEST.HIGH_TASK'ACCESS, 
438            0, 
439            STATUS
440         );
441         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START HI" );
442
443
444         RTEMS.TASK_CREATE( 
445            RTEMS.BUILD_NAME( 'H', 'I', 'G', 'H' ),
446            3, 
447            2048, 
448            RTEMS.DEFAULT_OPTIONS,
449            RTEMS.DEFAULT_ATTRIBUTES,
450            TMTEST.HIGHEST_ID,
451            STATUS
452         );
453         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE HIGH" );
454
455         RTEMS.TASK_START( 
456            TMTEST.HIGHEST_ID, 
457            TMTEST.HIGHEST_TASK'ACCESS, 
458            0, 
459            STATUS
460         );
461         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START HIGH" );
462
463
464      end if;
465
466      RTEMS.SEMAPHORE_OBTAIN( 
467         TMTEST.SEMAPHORE_ID, 
468         RTEMS.DEFAULT_OPTIONS,
469         RTEMS.NO_TIMEOUT,
470         STATUS
471      );
472
473   end LOW_TASKS;
474
475--PAGE
476--
477--  RESTART_TASK
478--
479
480   procedure RESTART_TASK (
481      ARGUMENT : in     RTEMS.TASK_ARGUMENT
482   ) is
483      INDEX    : RTEMS.UNSIGNED32;
484      PRIORITY : RTEMS.TASK_PRIORITY;
485      ID       : RTEMS.ID;
486      STATUS   : RTEMS.STATUS_CODES;
487   begin
488   
489      if ARGUMENT = 1 then
490         RTEMS.SEMAPHORE_OBTAIN( 
491            TMTEST.SEMAPHORE_ID, 
492            RTEMS.DEFAULT_OPTIONS,
493            RTEMS.NO_TIMEOUT,
494            STATUS
495         );
496      end if;
497
498   end RESTART_TASK;
499
500end TMTEST;
Note: See TracBrowser for help on using the repository browser.