source: rtems/c/src/ada-tests/sptests/sp15/sptest.adb @ 48bfd992

4.104.114.84.95
Last change on this file since 48bfd992 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: 7.6 KB
Line 
1--
2--  SPTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation of Test 15 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 TEST_SUPPORT;
27with TEXT_IO;
28with UNSIGNED32_IO;
29
30package body SPTEST is
31
32--PAGE
33--
34--  INIT
35--
36
37   procedure INIT (
38      ARGUMENT : in     RTEMS.TASK_ARGUMENT
39   ) is
40      STATUS : RTEMS.STATUS_CODES;
41   begin
42
43      TEXT_IO.NEW_LINE( 2 );
44      TEXT_IO.PUT_LINE( "*** TEST 15 ***" );
45
46      SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME(  'T', 'A', '1', ' ' );
47
48      SPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME(  'P', 'T', '1', ' ' );
49      SPTEST.PARTITION_NAME( 2 ) := RTEMS.BUILD_NAME(  'P', 'T', '2', ' ' );
50
51      RTEMS.TASK_CREATE( 
52         SPTEST.TASK_NAME( 1 ), 
53         4, 
54         2048, 
55         RTEMS.DEFAULT_MODES,
56         RTEMS.DEFAULT_ATTRIBUTES,
57         SPTEST.TASK_ID( 1 ),
58         STATUS
59      );
60      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
61
62      RTEMS.TASK_START(
63         SPTEST.TASK_ID( 1 ),
64         SPTEST.TASK_1'ACCESS,
65         0,
66         STATUS
67      );
68      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
69
70      TEXT_IO.PUT_LINE( "INIT - partition_create - partition 1" );
71      RTEMS.PARTITION_CREATE(
72         SPTEST.PARTITION_NAME( 1 ),
73         AREA_1'ADDRESS,
74         4096,
75         512,
76         RTEMS.DEFAULT_ATTRIBUTES,
77         SPTEST.PARTITION_ID( 1 ),
78         STATUS
79      );
80      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE OF PT1" );
81
82      TEXT_IO.PUT_LINE( "INIT - partition_create - partition 2" );
83      RTEMS.PARTITION_CREATE(
84         SPTEST.PARTITION_NAME( 2 ),
85         AREA_2'ADDRESS,
86         274,
87         128,
88         RTEMS.DEFAULT_ATTRIBUTES,
89         SPTEST.PARTITION_ID( 2 ),
90         STATUS
91      );
92      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE OF PT2" );
93
94      RTEMS.TASK_DELETE( RTEMS.SELF, STATUS );
95      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
96
97   end INIT;
98
99--PAGE
100--
101--  PUT_ADDRESS_FROM_AREA_1
102--
103
104   procedure PUT_ADDRESS_FROM_AREA_1 (
105      TO_BE_PRINTED : in     RTEMS.ADDRESS
106   ) is
107
108   begin
109
110      UNSIGNED32_IO.PUT(
111         RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_1'ADDRESS ),
112         WIDTH => 8,
113         BASE => 16
114      );
115
116   end PUT_ADDRESS_FROM_AREA_1;
117
118--PAGE
119--
120--  PUT_ADDRESS_FROM_AREA_2
121--
122
123   procedure PUT_ADDRESS_FROM_AREA_2 (
124      TO_BE_PRINTED : in     RTEMS.ADDRESS
125   ) is
126   begin
127
128      UNSIGNED32_IO.PUT(
129         RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_2'ADDRESS ),
130         WIDTH => 8,
131         BASE => 16
132      );
133
134   end PUT_ADDRESS_FROM_AREA_2;
135
136--PAGE
137--
138--  TASK_1
139--
140
141   procedure TASK_1 (
142      ARGUMENT : in     RTEMS.TASK_ARGUMENT
143   ) is
144      PTID_1           : RTEMS.ID;
145      PTID_2           : RTEMS.ID;
146      BUFFER_ADDRESS_1 : RTEMS.ADDRESS;
147      BUFFER_ADDRESS_2 : RTEMS.ADDRESS;
148      BUFFER_ADDRESS_3 : RTEMS.ADDRESS;
149      BUFFER_ADDRESS_4 : RTEMS.ADDRESS;
150      STATUS           : RTEMS.STATUS_CODES;
151   begin
152
153      TEXT_IO.PUT( "TA1 - partition_ident - partition 1 id = " );
154      RTEMS.PARTITION_IDENT( 
155         SPTEST.PARTITION_NAME( 1 ), 
156         RTEMS.SEARCH_ALL_NODES, 
157         PTID_1, 
158         STATUS
159      );
160      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_IDENT OF PT1" );
161      UNSIGNED32_IO.PUT( PTID_1, WIDTH => 8, BASE => 16 );
162      TEXT_IO.NEW_LINE;
163   
164      TEXT_IO.PUT( "TA1 - partition_ident - partition 2 id = " );
165      RTEMS.PARTITION_IDENT( 
166         SPTEST.PARTITION_NAME( 2 ), 
167         RTEMS.SEARCH_ALL_NODES, 
168         PTID_2, 
169         STATUS
170      );
171      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_IDENT OF PT2" );
172      UNSIGNED32_IO.PUT( PTID_2, WIDTH => 8, BASE => 16 );
173      TEXT_IO.NEW_LINE;
174
175      TEXT_IO.PUT(
176         "TA1 - partition_get_buffer - get buffer 1 from partition 1 - "
177      );
178      RTEMS.PARTITION_GET_BUFFER( 
179         SPTEST.PARTITION_ID( 1 ), 
180         BUFFER_ADDRESS_1,
181         STATUS
182      );
183      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
184      SPTEST.PUT_ADDRESS_FROM_AREA_1( BUFFER_ADDRESS_1 );
185      TEXT_IO.NEW_LINE;
186     
187      TEXT_IO.PUT(
188         "TA1 - partition_get_buffer - get buffer 2 from partition 1 - "
189      );
190      RTEMS.PARTITION_GET_BUFFER( 
191         SPTEST.PARTITION_ID( 1 ), 
192         BUFFER_ADDRESS_2,
193         STATUS
194      );
195      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
196      SPTEST.PUT_ADDRESS_FROM_AREA_1( BUFFER_ADDRESS_2 );
197      TEXT_IO.NEW_LINE;
198     
199      TEXT_IO.PUT(
200         "TA1 - partition_get_buffer - get buffer 1 from partition 2 - "
201      );
202      RTEMS.PARTITION_GET_BUFFER( 
203         SPTEST.PARTITION_ID( 2 ), 
204         BUFFER_ADDRESS_3,
205         STATUS
206      );
207      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
208      SPTEST.PUT_ADDRESS_FROM_AREA_2( BUFFER_ADDRESS_3 );
209      TEXT_IO.NEW_LINE;
210     
211      TEXT_IO.PUT(
212         "TA1 - partition_get_buffer - get buffer 2 from partition 2 - "
213      );
214      RTEMS.PARTITION_GET_BUFFER( 
215         SPTEST.PARTITION_ID( 2 ), 
216         BUFFER_ADDRESS_4,
217         STATUS
218      );
219      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
220      SPTEST.PUT_ADDRESS_FROM_AREA_2( BUFFER_ADDRESS_4 );
221      TEXT_IO.NEW_LINE;
222
223      TEXT_IO.PUT(
224         "TA1 - partition_return_buffer - return buffer 1 to partition 1 - "
225      );
226      SPTEST.PUT_ADDRESS_FROM_AREA_1( BUFFER_ADDRESS_1 );
227      TEXT_IO.NEW_LINE;
228      RTEMS.PARTITION_RETURN_BUFFER( 
229         SPTEST.PARTITION_ID( 1 ), 
230         BUFFER_ADDRESS_1,
231         STATUS
232      );
233      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
234 
235      TEXT_IO.PUT(
236         "TA1 - partition_return_buffer - return buffer 2 to partition 1 - "
237      );
238      SPTEST.PUT_ADDRESS_FROM_AREA_1( BUFFER_ADDRESS_2 );
239      TEXT_IO.NEW_LINE;
240      RTEMS.PARTITION_RETURN_BUFFER( 
241         SPTEST.PARTITION_ID( 1 ), 
242         BUFFER_ADDRESS_2,
243         STATUS
244      );
245      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
246 
247      TEXT_IO.PUT(
248         "TA1 - partition_return_buffer - return buffer 1 to partition 2 - "
249      );
250      SPTEST.PUT_ADDRESS_FROM_AREA_2( BUFFER_ADDRESS_3 );
251      TEXT_IO.NEW_LINE;
252      RTEMS.PARTITION_RETURN_BUFFER( 
253         SPTEST.PARTITION_ID( 2 ), 
254         BUFFER_ADDRESS_3,
255         STATUS
256      );
257      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
258 
259      TEXT_IO.PUT(
260         "TA1 - partition_return_buffer - return buffer 2 to partition 2 - "
261      );
262      SPTEST.PUT_ADDRESS_FROM_AREA_2( BUFFER_ADDRESS_4 );
263      TEXT_IO.NEW_LINE;
264      RTEMS.PARTITION_RETURN_BUFFER( 
265         SPTEST.PARTITION_ID( 2 ), 
266         BUFFER_ADDRESS_4,
267         STATUS
268      );
269      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
270 
271      TEXT_IO.PUT_LINE( "TA1 - partition_delete - delete partition 1" );
272      RTEMS.PARTITION_DELETE( SPTEST.PARTITION_ID( 1 ), STATUS );
273      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_DELETE OF SELF" );
274
275      TEXT_IO.PUT_LINE( "TA1 - partition_delete - delete partition 2" );
276      RTEMS.PARTITION_DELETE( SPTEST.PARTITION_ID( 2 ), STATUS );
277      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_DELETE OF SELF" );
278
279      TEXT_IO.PUT_LINE( "*** END OF TEST 15 ***" );
280      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
281   
282   end TASK_1;
283
284end SPTEST;
Note: See TracBrowser for help on using the repository browser.