source: rtems/c/src/ada-tests/tmtests/tm15/tmtest.adb @ 3c4d8cd1

4.115
Last change on this file since 3c4d8cd1 was 3c4d8cd1, checked in by Joel Sherrill <joel.sherrill@…>, on Feb 16, 2011 at 3:53:16 PM

2011-02-16 Joel Sherrill <joel.sherrill@…>

  • ada-tests/mptests/mp01/mp01.adb, ada-tests/mptests/mp01/mptest.adb, ada-tests/mptests/mp01/mptest.ads, ada-tests/mptests/mp01/node1/mp01_node1.adb, ada-tests/mptests/mp01/node2/mp01_node2.adb, ada-tests/mptests/mp02/mptest.adb, ada-tests/mptests/mp02/mptest.ads, ada-tests/mptests/mp02/node1/mp02_node1.adb, ada-tests/mptests/mp02/node2/mp02_node2.adb, ada-tests/mptests/mp03/mptest.adb, ada-tests/mptests/mp03/mptest.ads, ada-tests/mptests/mp03/node1/mp03_node1.adb, ada-tests/mptests/mp03/node2/mp03_node2.adb, ada-tests/mptests/mp04/mptest.adb, ada-tests/mptests/mp04/mptest.ads, ada-tests/mptests/mp04/node1/mp04_node1.adb, ada-tests/mptests/mp04/node2/mp04_node2.adb, ada-tests/mptests/mp05/mptest.adb, ada-tests/mptests/mp05/mptest.ads, ada-tests/mptests/mp05/node1/mp05_node1.adb, ada-tests/mptests/mp05/node2/mp05_node2.adb, ada-tests/mptests/mp06/mptest.adb, ada-tests/mptests/mp06/mptest.ads, ada-tests/mptests/mp06/node1/mp06_node1.adb, ada-tests/mptests/mp06/node2/mp06_node2.adb, ada-tests/mptests/mp07/mptest.adb, ada-tests/mptests/mp07/mptest.ads, ada-tests/mptests/mp07/node1/mp07_node1.adb, ada-tests/mptests/mp07/node2/mp07_node2.adb, ada-tests/mptests/mp08/mptest.adb, ada-tests/mptests/mp08/mptest.ads, ada-tests/mptests/mp08/node1/mp08_node1.adb, ada-tests/mptests/mp08/node2/mp08_node2.adb, ada-tests/mptests/mp09/mptest.adb, ada-tests/mptests/mp09/mptest.ads, ada-tests/mptests/mp09/node1/mp09_node1.adb, ada-tests/mptests/mp09/node2/mp09_node2.adb, ada-tests/mptests/mp10/mptest.adb, ada-tests/mptests/mp10/mptest.ads, ada-tests/mptests/mp10/node1/mp10_node1.adb, ada-tests/mptests/mp10/node2/mp10_node2.adb, ada-tests/mptests/mp11/mptest.adb, ada-tests/mptests/mp11/mptest.ads, ada-tests/mptests/mp11/node1/mp11_node1.adb, ada-tests/mptests/mp11/node2/mp11_node2.adb, ada-tests/mptests/mp12/mptest.adb, ada-tests/mptests/mp12/mptest.ads, ada-tests/mptests/mp12/node1/mp12_node1.adb, ada-tests/mptests/mp12/node2/mp12_node2.adb, ada-tests/mptests/mp13/mptest.adb, ada-tests/mptests/mp13/mptest.ads, ada-tests/mptests/mp13/node1/mp13_node1.adb, ada-tests/mptests/mp13/node2/mp13_node2.adb, ada-tests/mptests/mp14/mptest.adb, ada-tests/mptests/mp14/mptest.ads, ada-tests/mptests/mp14/node1/mp14_node1.adb, ada-tests/mptests/mp14/node2/mp14_node2.adb, ada-tests/samples/base_mp/mptest.adb, ada-tests/samples/base_mp/mptest.ads, ada-tests/samples/base_sp/base_sp.adb, ada-tests/samples/base_sp/sptest.adb, ada-tests/samples/base_sp/sptest.ads, ada-tests/samples/hello/hello.adb, ada-tests/samples/hello/sptest.adb, ada-tests/samples/hello/sptest.ads, ada-tests/samples/nsecs/nsecs.adb, ada-tests/samples/nsecs/sptest.adb, ada-tests/samples/nsecs/sptest.ads, ada-tests/samples/ticker/sptest.adb, ada-tests/samples/ticker/sptest.ads, ada-tests/samples/ticker/ticker.adb, ada-tests/sptests/sp01/sp01.adb, ada-tests/sptests/sp01/sptest.adb, ada-tests/sptests/sp01/sptest.ads, ada-tests/sptests/sp02/sp02.adb, ada-tests/sptests/sp02/sptest.adb, ada-tests/sptests/sp02/sptest.ads, ada-tests/sptests/sp03/sp03.adb, ada-tests/sptests/sp03/sptest.adb, ada-tests/sptests/sp03/sptest.ads, ada-tests/sptests/sp04/sp04.adb, ada-tests/sptests/sp04/sptest.adb, ada-tests/sptests/sp04/sptest.ads, ada-tests/sptests/sp05/sp05.adb, ada-tests/sptests/sp05/sptest.adb, ada-tests/sptests/sp05/sptest.ads, ada-tests/sptests/sp06/sp06.adb, ada-tests/sptests/sp06/sptest.adb, ada-tests/sptests/sp06/sptest.ads, ada-tests/sptests/sp07/sp07.adb, ada-tests/sptests/sp07/sptest.adb, ada-tests/sptests/sp07/sptest.ads, ada-tests/sptests/sp08/sp08.adb, ada-tests/sptests/sp08/sptest.adb, ada-tests/sptests/sp08/sptest.ads, ada-tests/sptests/sp09/sp09.adb, ada-tests/sptests/sp09/sptest.adb, ada-tests/sptests/sp09/sptest.ads, ada-tests/sptests/sp11/sp11.adb, ada-tests/sptests/sp11/sptest.adb, ada-tests/sptests/sp11/sptest.ads, ada-tests/sptests/sp12/sp12.adb, ada-tests/sptests/sp12/sptest.adb, ada-tests/sptests/sp12/sptest.ads, ada-tests/sptests/sp13/sp13.adb, ada-tests/sptests/sp13/sptest.adb, ada-tests/sptests/sp13/sptest.ads, ada-tests/sptests/sp14/sp14.adb, ada-tests/sptests/sp14/sptest.adb, ada-tests/sptests/sp14/sptest.ads, ada-tests/sptests/sp15/sp15.adb, ada-tests/sptests/sp15/sptest.adb, ada-tests/sptests/sp15/sptest.ads, ada-tests/sptests/sp16/sp16.adb, ada-tests/sptests/sp16/sptest.adb, ada-tests/sptests/sp16/sptest.ads, ada-tests/sptests/sp17/sp17.adb, ada-tests/sptests/sp17/sptest.adb, ada-tests/sptests/sp17/sptest.ads, ada-tests/sptests/sp19/sp19.adb, ada-tests/sptests/sp19/sptest.adp, ada-tests/sptests/sp19/sptest.ads, ada-tests/sptests/sp20/sp20.adb, ada-tests/sptests/sp20/sptest.adb, ada-tests/sptests/sp20/sptest.ads, ada-tests/sptests/sp22/sp22.adb, ada-tests/sptests/sp22/sptest.adb, ada-tests/sptests/sp22/sptest.ads, ada-tests/sptests/sp23/sp23.adb, ada-tests/sptests/sp23/sptest.adb, ada-tests/sptests/sp23/sptest.ads, ada-tests/sptests/sp24/sp24.adb, ada-tests/sptests/sp24/sptest.adb, ada-tests/sptests/sp24/sptest.ads, ada-tests/sptests/sp25/sp25.adb, ada-tests/sptests/sp25/sptest.adb, ada-tests/sptests/sp25/sptest.ads, ada-tests/support/test_support.adb, ada-tests/tmtests/tm01/tm01.adb, ada-tests/tmtests/tm01/tmtest.adb, ada-tests/tmtests/tm01/tmtest.ads, ada-tests/tmtests/tm02/tm02.adb, ada-tests/tmtests/tm02/tmtest.adb, ada-tests/tmtests/tm02/tmtest.ads, ada-tests/tmtests/tm03/tm03.adb, ada-tests/tmtests/tm03/tmtest.adb, ada-tests/tmtests/tm03/tmtest.ads, ada-tests/tmtests/tm04/tm04.adb, ada-tests/tmtests/tm04/tmtest.adb, ada-tests/tmtests/tm04/tmtest.ads, ada-tests/tmtests/tm05/tm05.adb, ada-tests/tmtests/tm05/tmtest.adb, ada-tests/tmtests/tm05/tmtest.ads, ada-tests/tmtests/tm06/tm06.adb, ada-tests/tmtests/tm06/tmtest.adb, ada-tests/tmtests/tm06/tmtest.ads, ada-tests/tmtests/tm07/tm07.adb, ada-tests/tmtests/tm07/tmtest.adb, ada-tests/tmtests/tm07/tmtest.ads, ada-tests/tmtests/tm08/tm08.adb, ada-tests/tmtests/tm08/tmtest.adb, ada-tests/tmtests/tm08/tmtest.ads, ada-tests/tmtests/tm09/tm09.adb, ada-tests/tmtests/tm09/tmtest.adb, ada-tests/tmtests/tm09/tmtest.ads, ada-tests/tmtests/tm10/tm10.adb, ada-tests/tmtests/tm10/tmtest.adb, ada-tests/tmtests/tm10/tmtest.ads, ada-tests/tmtests/tm11/tm11.adb, ada-tests/tmtests/tm11/tmtest.adb, ada-tests/tmtests/tm11/tmtest.ads, ada-tests/tmtests/tm12/tm12.adb, ada-tests/tmtests/tm12/tmtest.adb, ada-tests/tmtests/tm12/tmtest.ads, ada-tests/tmtests/tm13/tm13.adb, ada-tests/tmtests/tm13/tmtest.adb, ada-tests/tmtests/tm13/tmtest.ads, ada-tests/tmtests/tm14/tm14.adb, ada-tests/tmtests/tm14/tmtest.adb, ada-tests/tmtests/tm14/tmtest.ads, ada-tests/tmtests/tm15/tm15.adb, ada-tests/tmtests/tm15/tmtest.adb, ada-tests/tmtests/tm15/tmtest.ads, ada-tests/tmtests/tm16/tm16.adb, ada-tests/tmtests/tm16/tmtest.adb, ada-tests/tmtests/tm16/tmtest.ads, ada-tests/tmtests/tm17/tm17.adb, ada-tests/tmtests/tm17/tmtest.adb, ada-tests/tmtests/tm17/tmtest.ads, ada-tests/tmtests/tm18/tm18.adb, ada-tests/tmtests/tm18/tmtest.adb, ada-tests/tmtests/tm18/tmtest.ads, ada-tests/tmtests/tm19/tm19.adb, ada-tests/tmtests/tm19/tmtest.adb, ada-tests/tmtests/tm19/tmtest.ads, ada-tests/tmtests/tm20/tm20.adb, ada-tests/tmtests/tm20/tmtest.adb, ada-tests/tmtests/tm20/tmtest.ads, ada-tests/tmtests/tm21/tm21.adb, ada-tests/tmtests/tm21/tmtest.adb, ada-tests/tmtests/tm21/tmtest.ads, ada-tests/tmtests/tm22/tm22.adb, ada-tests/tmtests/tm22/tmtest.adb, ada-tests/tmtests/tm22/tmtest.ads, ada-tests/tmtests/tm23/tm23.adb, ada-tests/tmtests/tm23/tmtest.adb, ada-tests/tmtests/tm23/tmtest.ads, ada-tests/tmtests/tm24/tm24.adb, ada-tests/tmtests/tm24/tmtest.adb, ada-tests/tmtests/tm24/tmtest.ads, ada-tests/tmtests/tm25/tm25.adb, ada-tests/tmtests/tm25/tmtest.adb, ada-tests/tmtests/tm25/tmtest.ads, ada-tests/tmtests/tm28/tm28.adb, ada-tests/tmtests/tm28/tmtest.adb, ada-tests/tmtests/tm28/tmtest.ads, ada-tests/tmtests/tm29/tm29.adb, ada-tests/tmtests/tm29/tmtest.adb, ada-tests/tmtests/tm29/tmtest.ads, ada-tests/tmtests/tmck/tmck.adb, ada-tests/tmtests/tmck/tmtest.adb, ada-tests/tmtests/tmck/tmtest.ads, ada-tests/tmtests/tmoverhd/dummy_rtems.adb, ada-tests/tmtests/tmoverhd/dummy_rtems.ads, ada-tests/tmtests/tmoverhd/tmoverhd.adb, ada-tests/tmtests/tmoverhd/tmtest.adb, ada-tests/tmtests/tmoverhd/tmtest.ads: Account for RTEMS binding child package rework. Eliminate all warnings.
  • Property mode set to 100644
File size: 6.3 KB
Line 
1--
2--  TMTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation of Test 15 of the RTEMS
7--  Timing Test Suite.
8--
9--  DEPENDENCIES:
10--
11-- 
12--
13--  COPYRIGHT (c) 1989-2011.
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 RTEMS_CALLING_OVERHEAD;
24with TEST_SUPPORT;
25with TEXT_IO;
26with TIMER_DRIVER;
27with RTEMS.EVENT;
28
29package body TMTEST is
30
31--
32--  INIT
33--
34
35   procedure INIT (
36      ARGUMENT : in     RTEMS.TASKS.ARGUMENT
37   ) is
38      pragma Unreferenced(ARGUMENT);
39      STATUS  : RTEMS.STATUS_CODES;
40   begin
41
42      TEXT_IO.NEW_LINE( 2 );
43      TEXT_IO.PUT_LINE( "*** TIME TEST 15 ***" );
44
45      TMTEST.TEST_INIT;
46
47      RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
48      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
49
50   end INIT;
51
52--
53--  TEST_INIT
54--
55
56   procedure TEST_INIT
57   is
58      ID        : RTEMS.ID;
59      OVERHEAD  : RTEMS.UNSIGNED32;
60      EVENT_OUT : RTEMS.EVENT_SET;
61      STATUS    : RTEMS.STATUS_CODES;
62   begin
63
64      TMTEST.TIME_SET := FALSE;
65
66      RTEMS.TASKS.CREATE( 
67         RTEMS.BUILD_NAME( 'L', 'O', 'W', ' ' ),
68         10, 
69         1024, 
70         RTEMS.NO_PREEMPT,
71         RTEMS.DEFAULT_ATTRIBUTES,
72         ID,
73         STATUS
74      );
75      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOW" );
76
77      RTEMS.TASKS.START( ID, TMTEST.LOW_TASK'ACCESS, 0, STATUS );
78      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOW" );
79
80      for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
81      loop
82
83         RTEMS.TASKS.CREATE( 
84            RTEMS.BUILD_NAME( 'H', 'I', 'G', 'H' ),
85            5, 
86            1024, 
87            RTEMS.DEFAULT_MODES,
88            RTEMS.DEFAULT_ATTRIBUTES,
89            TMTEST.TASK_ID( INDEX ),
90            STATUS
91         );
92         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
93
94         RTEMS.TASKS.START( 
95            TMTEST.TASK_ID( INDEX ),
96            TMTEST.HIGH_TASKS'ACCESS, 
97            0, 
98            STATUS
99         );
100         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
101
102      end loop;
103
104      TIMER_DRIVER.INITIALIZE;
105         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
106         loop
107            TIMER_DRIVER.EMPTY_FUNCTION;
108         end loop;
109      OVERHEAD := TIMER_DRIVER.READ_TIMER;
110
111      TIMER_DRIVER.INITIALIZE;
112         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
113         loop
114            RTEMS.EVENT.RECEIVE(
115               RTEMS.PENDING_EVENTS,
116               RTEMS.DEFAULT_OPTIONS,
117               RTEMS.NO_TIMEOUT,
118               EVENT_OUT,
119               STATUS
120            );
121         end loop;
122      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
123
124      TIME_TEST_SUPPORT.PUT_TIME( 
125         "EVENT_RECEIVE (current)",
126         TMTEST.END_TIME, 
127         TIME_TEST_SUPPORT.OPERATION_COUNT, 
128         OVERHEAD,
129         RTEMS_CALLING_OVERHEAD.EVENT_RECEIVE
130      );
131
132      TIMER_DRIVER.INITIALIZE;
133         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
134         loop
135            RTEMS.EVENT.RECEIVE(
136               RTEMS.ALL_EVENTS,
137               RTEMS.NO_WAIT,
138               RTEMS.NO_TIMEOUT,
139               EVENT_OUT,
140               STATUS
141            );
142         end loop;
143      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
144
145      TIME_TEST_SUPPORT.PUT_TIME( 
146         "EVENT_RECEIVE (NO_WAIT)",
147         TMTEST.END_TIME, 
148         TIME_TEST_SUPPORT.OPERATION_COUNT, 
149         OVERHEAD,
150         RTEMS_CALLING_OVERHEAD.EVENT_RECEIVE
151      );
152
153   end TEST_INIT;
154
155--
156--  LOW_TASK
157--
158
159   procedure LOW_TASK (
160      ARGUMENT : in     RTEMS.TASKS.ARGUMENT
161   ) is
162      pragma Unreferenced(ARGUMENT);
163      EVENT_OUT : RTEMS.EVENT_SET;
164      OVERHEAD  : RTEMS.UNSIGNED32;
165      STATUS    : RTEMS.STATUS_CODES;
166   begin
167   
168      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
169
170      TIME_TEST_SUPPORT.PUT_TIME( 
171         "EVENT_RECEIVE (blocking)",
172         TMTEST.END_TIME, 
173         TIME_TEST_SUPPORT.OPERATION_COUNT, 
174         0,
175         RTEMS_CALLING_OVERHEAD.EVENT_RECEIVE
176      );
177
178      TIMER_DRIVER.INITIALIZE;
179         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
180         loop
181            TIMER_DRIVER.EMPTY_FUNCTION;
182         end loop;
183      OVERHEAD := TIMER_DRIVER.READ_TIMER;
184
185      TIMER_DRIVER.INITIALIZE;
186         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
187         loop
188            RTEMS.EVENT.SEND( RTEMS.SELF, RTEMS.EVENT_16, STATUS );
189         end loop;
190      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
191
192      TIME_TEST_SUPPORT.PUT_TIME( 
193         "EVENT_SEND (returns to caller)",
194         TMTEST.END_TIME, 
195         TIME_TEST_SUPPORT.OPERATION_COUNT, 
196         OVERHEAD,
197         RTEMS_CALLING_OVERHEAD.EVENT_SEND
198      );
199
200      TIMER_DRIVER.INITIALIZE;
201         RTEMS.EVENT.RECEIVE(
202            RTEMS.EVENT_16,
203            RTEMS.DEFAULT_OPTIONS,
204            RTEMS.NO_TIMEOUT,
205            EVENT_OUT,
206            STATUS
207         );
208      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
209
210      TIME_TEST_SUPPORT.PUT_TIME( 
211         "EVENT_RECEIVE (available)",
212         TMTEST.END_TIME, 
213         1, 
214         0,
215         RTEMS_CALLING_OVERHEAD.EVENT_RECEIVE
216      );
217
218      TIMER_DRIVER.INITIALIZE;
219         for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
220         loop
221            RTEMS.EVENT.SEND( 
222               TMTEST.TASK_ID( INDEX ), 
223               RTEMS.EVENT_16, 
224               STATUS
225            );
226         end loop;
227      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
228
229      TIME_TEST_SUPPORT.PUT_TIME( 
230         "EVENT_SEND (readying)",
231         TMTEST.END_TIME, 
232         TIME_TEST_SUPPORT.OPERATION_COUNT, 
233         OVERHEAD,
234         RTEMS_CALLING_OVERHEAD.EVENT_SEND
235      );
236
237      TEXT_IO.PUT_LINE( "*** END OF TIME TEST 15 ***" );
238      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
239
240   end LOW_TASK;
241
242--
243--  HIGH_TASKS
244--
245
246   procedure HIGH_TASKS (
247      ARGUMENT : in     RTEMS.TASKS.ARGUMENT
248   ) is
249      pragma Unreferenced(ARGUMENT);
250      EVENT_OUT : RTEMS.EVENT_SET;
251      STATUS    : RTEMS.STATUS_CODES;
252   begin
253
254      if TMTEST.TIME_SET = FALSE then
255         TMTEST.TIME_SET := TRUE;
256         TIMER_DRIVER.INITIALIZE;
257      end if;
258
259      RTEMS.EVENT.RECEIVE(
260         16#7FFFFFFF#,
261         RTEMS.DEFAULT_OPTIONS,
262         RTEMS.NO_TIMEOUT,
263         EVENT_OUT,
264         STATUS
265      );
266   
267   end HIGH_TASKS;
268
269end TMTEST;
Note: See TracBrowser for help on using the repository browser.