source: rtems/c/src/ada-tests/mptests/mp12/mptest.adb @ bf9ae83

4.104.114.84.95
Last change on this file since bf9ae83 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: 4.1 KB
Line 
1--
2--  MPTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation for Test 12 of the RTEMS
7--  Multiprocessor 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 MPTEST is
31
32   package body PER_NODE_CONFIGURATION is separate;
33
34--PAGE
35--
36--  INIT
37--
38
39   procedure INIT (
40      ARGUMENT : in     RTEMS.TASK_ARGUMENT
41   ) is
42      BUFFER_ADDRESS : RTEMS.ADDRESS;
43      STATUS         : RTEMS.STATUS_CODES;
44   begin
45
46      TEXT_IO.NEW_LINE( 2 );
47      TEXT_IO.PUT( "*** TEST 12 -- NODE " );
48      UNSIGNED32_IO.PUT(
49         MPTEST.MULTIPROCESSING_CONFIGURATION.NODE,
50         WIDTH => 1
51      );
52      TEXT_IO.PUT_LINE( " ***" );
53
54      MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME(  '1', '1', '1', ' ' );
55      MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME(  '2', '2', '2', ' ' );
56
57      MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME(  'P', 'A', 'R', ' ' );
58
59      TEXT_IO.PUT_LINE( "Got to the initialization task" );
60
61      if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 2 then
62
63         RTEMS.TASK_WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
64         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
65
66         TEXT_IO.PUT_LINE( "Getting ID of remote Partition (Global)" );
67
68         loop
69
70            RTEMS.PARTITION_IDENT(
71               MPTEST.PARTITION_NAME( 1 ),
72               RTEMS.SEARCH_ALL_NODES,
73               MPTEST.PARTITION_ID( 1 ),
74               STATUS
75            );
76
77            exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS );
78
79         end loop;
80
81         TEXT_IO.PUT_LINE( 
82            "Attempting to delete remote Partition (Global)"
83         );
84
85         RTEMS.PARTITION_DELETE( MPTEST.PARTITION_ID( 1 ), STATUS ); 
86         TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( 
87            STATUS, 
88            RTEMS.ILLEGAL_ON_REMOTE_OBJECT,
89            "PARTITION_DELETE" 
90         );
91
92         TEXT_IO.PUT_LINE( 
93            "partition_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT!!"
94         );
95
96         TEXT_IO.PUT_LINE( "Obtaining a buffer from the global partition" );
97
98         RTEMS.PARTITION_GET_BUFFER(
99            MPTEST.PARTITION_ID( 1 ),
100            BUFFER_ADDRESS,
101            STATUS
102         ); 
103         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
104         TEXT_IO.PUT( "Address returned was : " );
105         UNSIGNED32_IO.PUT(
106            RTEMS.SUBTRACT( BUFFER_ADDRESS, RTEMS.NULL_ADDRESS ),
107            WIDTH => 8,
108            BASE => 16
109         );
110         TEXT_IO.NEW_LINE;
111
112         RTEMS.PARTITION_RETURN_BUFFER(
113            MPTEST.PARTITION_ID( 1 ),
114            BUFFER_ADDRESS,
115            STATUS
116         ); 
117         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
118
119         RTEMS.TASK_WAKE_AFTER( 2 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
120         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
121
122      else
123
124         TEXT_IO.PUT_LINE( "Creating Partition (Global)" );
125         RTEMS.PARTITION_CREATE(
126            MPTEST.PARTITION_NAME( 1 ),
127            MPTEST.PARTITION_AREA( 0 )'ADDRESS,
128            128,
129            64,
130            RTEMS.GLOBAL,
131            MPTEST.PARTITION_ID( 1 ),
132            STATUS
133         );
134         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE" );
135
136         TEXT_IO.PUT_LINE( "Sleeping for three seconds" );
137         RTEMS.TASK_WAKE_AFTER( 3 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
138         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
139
140         TEXT_IO.PUT_LINE( "Deleting Partition (Global)" );
141         RTEMS.PARTITION_DELETE( MPTEST.PARTITION_ID( 1 ), STATUS );
142         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_DELETE" );
143
144      end if;
145
146      TEXT_IO.PUT_LINE( "*** END OF TEST 12 ***" );
147
148      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
149
150   end INIT;
151
152end MPTEST;
Note: See TracBrowser for help on using the repository browser.