source: rtems/c/src/ada-tests/sptests/sp25/sptest.adb @ cf1ced66

4.104.114.84.95
Last change on this file since cf1ced66 was bf9ae83, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 2, 1997 at 8:32:11 PM

modified copyright notice to be the same as RTEMS 4.0.0.

changed the CVS ID string to be a "development" version.

  • Property mode set to 100644
File size: 10.7 KB
Line 
1--
2--  SPTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation of Test 25 of the RTEMS
7--  Single Processor Test Suite.
8--
9--  DEPENDENCIES:
10--
11-- 
12--
13--  COPYRIGHT (c) 1989-1997.
14--  On-Line Applications Research Corporation (OAR).
15--  Copyright assigned to U.S. Government, 1994.
16--
17--  The license and distribution terms for this file may in
18--  the file LICENSE in this distribution or at
19--  http://www.OARcorp.com/rtems/license.html.
20--
21--  $Id$
22--
23
24with INTERFACES; use INTERFACES;
25with RTEMS;
26with RTEMS_TEST_SUPPORT;
27with TEST_SUPPORT;
28with TEXT_IO;
29with UNSIGNED32_IO;
30
31package body SPTEST 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( "*** TEST 25 ***" );
46
47      SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME(  'T', 'A', '1', ' ' );
48
49      RTEMS.TASK_CREATE( 
50         SPTEST.TASK_NAME( 1 ), 
51         SPTEST.BASE_PRIORITY, 
52         2048, 
53         RTEMS.DEFAULT_MODES,
54         RTEMS.DEFAULT_ATTRIBUTES,
55         SPTEST.TASK_ID( 1 ),
56         STATUS
57      );
58      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
59
60      RTEMS.TASK_START(
61         SPTEST.TASK_ID( 1 ),
62         SPTEST.TASK_1'ACCESS,
63         0,
64         STATUS
65      );
66      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
67
68      SPTEST.REGION_NAME( 1 ) := RTEMS.BUILD_NAME(  'R', 'N', '1', ' ' );
69
70      RTEMS.REGION_CREATE(
71         SPTEST.REGION_NAME( 1 ), 
72         SPTEST.AREA_1'ADDRESS,
73         64000, 
74         32,
75         RTEMS.DEFAULT_ATTRIBUTES,
76         SPTEST.REGION_ID( 1 ),
77         STATUS
78      );
79      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE OF RN1" );
80
81      RTEMS.TASK_DELETE( RTEMS.SELF, STATUS );
82      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
83
84   end INIT;
85
86--PAGE
87--
88--  PUT_ADDRESS_FROM_AREA_1
89--
90
91   procedure PUT_ADDRESS_FROM_AREA_1 (
92      TO_BE_PRINTED : in     RTEMS.ADDRESS
93   ) is
94
95   begin
96
97      UNSIGNED32_IO.PUT(
98         RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_1'ADDRESS ),
99         WIDTH => 8,
100         BASE => 16
101      );
102
103   end PUT_ADDRESS_FROM_AREA_1;
104
105--PAGE
106--
107--  TASK_1
108--
109
110   procedure TASK_1 (
111      ARGUMENT : in     RTEMS.TASK_ARGUMENT
112   ) is
113      RNID              : RTEMS.ID;
114      SEGMENT_ADDRESS_1 : RTEMS.ADDRESS;
115      SEGMENT_ADDRESS_2 : RTEMS.ADDRESS;
116      SEGMENT_ADDRESS_3 : RTEMS.ADDRESS;
117      SEGMENT_ADDRESS_4 : RTEMS.ADDRESS;
118      SEGMENT_ADDRESS_5 : RTEMS.ADDRESS;
119      SEGMENT_ADDRESS_6 : RTEMS.ADDRESS;
120      SEGMENT_ADDRESS_7 : RTEMS.ADDRESS;
121      SEGMENT_ADDRESS_8 : RTEMS.ADDRESS;
122      STATUS            : RTEMS.STATUS_CODES;
123   begin
124
125      RTEMS.REGION_IDENT( SPTEST.REGION_NAME( 1 ), RNID, STATUS );
126      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_IDENT OF RN1" );
127      TEXT_IO.PUT( "TA1 - region_ident - rnid => " );
128      UNSIGNED32_IO.PUT( RNID, WIDTH => 8, BASE => 16 );
129      TEXT_IO.NEW_LINE;
130       
131      TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
132      TEXT_IO.PUT_LINE( "64 byte segment from region 1" );
133      RTEMS.REGION_GET_SEGMENT(
134         SPTEST.REGION_ID( 1 ),
135         64,
136         RTEMS.DEFAULT_OPTIONS,
137         RTEMS.NO_TIMEOUT,
138         SEGMENT_ADDRESS_1,
139         STATUS
140      );
141      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
142      TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
143      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_1 );
144      TEXT_IO.NEW_LINE;
145
146      TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
147      TEXT_IO.PUT_LINE( "128 byte segment from region 1" );
148      RTEMS.REGION_GET_SEGMENT(
149         SPTEST.REGION_ID( 1 ),
150         128,
151         RTEMS.DEFAULT_OPTIONS,
152         RTEMS.NO_TIMEOUT,
153         SEGMENT_ADDRESS_2,
154         STATUS
155      );
156      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
157      TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
158      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_2 );
159      TEXT_IO.NEW_LINE;
160
161      TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
162      TEXT_IO.PUT_LINE( "256 byte segment from region 1" );
163      RTEMS.REGION_GET_SEGMENT(
164         SPTEST.REGION_ID( 1 ),
165         256,
166         RTEMS.DEFAULT_OPTIONS,
167         RTEMS.NO_TIMEOUT,
168         SEGMENT_ADDRESS_3,
169         STATUS
170      );
171      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
172      TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
173      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_3 );
174      TEXT_IO.NEW_LINE;
175
176      TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
177      TEXT_IO.PUT_LINE( "512 byte segment from region 1" );
178      RTEMS.REGION_GET_SEGMENT(
179         SPTEST.REGION_ID( 1 ),
180         512,
181         RTEMS.DEFAULT_OPTIONS,
182         RTEMS.NO_TIMEOUT,
183         SEGMENT_ADDRESS_4,
184         STATUS
185      );
186      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
187      TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
188      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 );
189      TEXT_IO.NEW_LINE;
190
191      TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
192      TEXT_IO.PUT_LINE( "1024 byte segment from region 1" );
193      RTEMS.REGION_GET_SEGMENT(
194         SPTEST.REGION_ID( 1 ),
195         1024,
196         RTEMS.DEFAULT_OPTIONS,
197         RTEMS.NO_TIMEOUT,
198         SEGMENT_ADDRESS_5,
199         STATUS
200      );
201      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
202      TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
203      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_5 );
204      TEXT_IO.NEW_LINE;
205
206      TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
207      TEXT_IO.PUT_LINE( "2048 byte segment from region 1" );
208      RTEMS.REGION_GET_SEGMENT(
209         SPTEST.REGION_ID( 1 ),
210         2048,
211         RTEMS.DEFAULT_OPTIONS,
212         RTEMS.NO_TIMEOUT,
213         SEGMENT_ADDRESS_6,
214         STATUS
215      );
216      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
217      TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
218      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_6 );
219      TEXT_IO.NEW_LINE;
220
221      TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
222      TEXT_IO.PUT_LINE( "4096 byte segment from region 1" );
223      RTEMS.REGION_GET_SEGMENT(
224         SPTEST.REGION_ID( 1 ),
225         4096,
226         RTEMS.DEFAULT_OPTIONS,
227         RTEMS.NO_TIMEOUT,
228         SEGMENT_ADDRESS_7,
229         STATUS
230      );
231      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
232      TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
233      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_7 );
234      TEXT_IO.NEW_LINE;
235
236      TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
237      TEXT_IO.PUT_LINE( "8192 byte segment from region 1" );
238      RTEMS.REGION_GET_SEGMENT(
239         SPTEST.REGION_ID( 1 ),
240         8192,
241         RTEMS.DEFAULT_OPTIONS,
242         RTEMS.NO_TIMEOUT,
243         SEGMENT_ADDRESS_8,
244         STATUS
245      );
246      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
247      TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
248      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_8 );
249      TEXT_IO.NEW_LINE;
250
251TEST_SUPPORT.PAUSE;
252
253      TEXT_IO.PUT( 
254         "TA1 - region_return_segment - return segment to region 1 - "
255      );
256      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_3 );
257      RTEMS.REGION_RETURN_SEGMENT(
258         SPTEST.REGION_ID( 1 ),
259         SEGMENT_ADDRESS_3,
260         STATUS
261      );
262      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
263      TEXT_IO.NEW_LINE;
264      SEGMENT_ADDRESS_3 := RTEMS.NULL_ADDRESS;
265
266      TEXT_IO.PUT( 
267         "TA1 - region_return_segment - return segment to region 1 - "
268      );
269      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 );
270      RTEMS.REGION_RETURN_SEGMENT(
271         SPTEST.REGION_ID( 1 ),
272         SEGMENT_ADDRESS_4,
273         STATUS
274      );
275      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
276      TEXT_IO.NEW_LINE;
277      SEGMENT_ADDRESS_4 := RTEMS.NULL_ADDRESS;
278
279      TEXT_IO.PUT( 
280         "TA1 - region_return_segment - return segment to region 1 - "
281      );
282      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_1 );
283      RTEMS.REGION_RETURN_SEGMENT(
284         SPTEST.REGION_ID( 1 ),
285         SEGMENT_ADDRESS_1,
286         STATUS
287      );
288      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
289      TEXT_IO.NEW_LINE;
290      SEGMENT_ADDRESS_1 := RTEMS.NULL_ADDRESS;
291
292      TEXT_IO.PUT( 
293         "TA1 - region_return_segment - return segment to region 1 - "
294      );
295      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_2 );
296      RTEMS.REGION_RETURN_SEGMENT(
297         SPTEST.REGION_ID( 1 ),
298         SEGMENT_ADDRESS_2,
299         STATUS
300      );
301      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
302      TEXT_IO.NEW_LINE;
303      SEGMENT_ADDRESS_2 := RTEMS.NULL_ADDRESS;
304
305      TEXT_IO.PUT( 
306         "TA1 - region_return_segment - return segment to region 1 - "
307      );
308      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_7 );
309      RTEMS.REGION_RETURN_SEGMENT(
310         SPTEST.REGION_ID( 1 ),
311         SEGMENT_ADDRESS_7,
312         STATUS
313      );
314      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
315      TEXT_IO.NEW_LINE;
316      SEGMENT_ADDRESS_7 := RTEMS.NULL_ADDRESS;
317
318      TEXT_IO.PUT( 
319         "TA1 - region_return_segment - return segment to region 1 - "
320      );
321      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_6 );
322      RTEMS.REGION_RETURN_SEGMENT(
323         SPTEST.REGION_ID( 1 ),
324         SEGMENT_ADDRESS_6,
325         STATUS
326      );
327      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
328      TEXT_IO.NEW_LINE;
329      SEGMENT_ADDRESS_6 := RTEMS.NULL_ADDRESS;
330
331      TEXT_IO.PUT( 
332         "TA1 - region_return_segment - return segment to region 1 - "
333      );
334      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_8 );
335      RTEMS.REGION_RETURN_SEGMENT(
336         SPTEST.REGION_ID( 1 ),
337         SEGMENT_ADDRESS_8,
338         STATUS
339      );
340      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
341      TEXT_IO.NEW_LINE;
342      SEGMENT_ADDRESS_8 := RTEMS.NULL_ADDRESS;
343
344      TEXT_IO.PUT( 
345         "TA1 - region_return_segment - return segment to region 1 - "
346      );
347      SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_5 );
348      RTEMS.REGION_RETURN_SEGMENT(
349         SPTEST.REGION_ID( 1 ),
350         SEGMENT_ADDRESS_5,
351         STATUS
352      );
353      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
354      TEXT_IO.NEW_LINE;
355      SEGMENT_ADDRESS_5 := RTEMS.NULL_ADDRESS;
356
357      TEXT_IO.PUT_LINE(
358         "TA1 - region_delete - walks heap if debug enabled"
359      );
360      RTEMS.REGION_DELETE( SPTEST.REGION_ID( 1 ), STATUS );
361      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_DELETE OF RN1" );
362
363      TEXT_IO.PUT_LINE( "*** END OF TEST 25 ***" );
364      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
365
366   end TASK_1;
367
368end SPTEST;
Note: See TracBrowser for help on using the repository browser.