source: rtems/c/src/ada-tests/mptests/mp05/mptest.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: 5.6 KB
Line 
1--
2--  MPTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation for Test 5 of the RTEMS
7--  Multiprocessor 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 INTERFACES; use INTERFACES;
24with RTEMS;
25with RTEMS.FATAL;
26with RTEMS.SIGNAL;
27with RTEMS.TASKS;
28with RTEMS.TIMER;
29with TEST_SUPPORT;
30with TEXT_IO;
31with UNSIGNED32_IO;
32
33package body MPTEST is
34
35--
36--  INIT
37--
38
39   procedure INIT (
40      ARGUMENT : in     RTEMS.TASKS.ARGUMENT
41   ) is
42      STATUS : RTEMS.STATUS_CODES;
43   begin
44
45      TEXT_IO.NEW_LINE( 2 );
46      TEXT_IO.PUT( "*** TEST 5 -- NODE " );
47      UNSIGNED32_IO.PUT(
48         TEST_SUPPORT.NODE,
49         WIDTH => 1
50      );
51      TEXT_IO.PUT_LINE( " ***" );
52
53      MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME(  '1', '1', '1', ' ' );
54      MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME(  '2', '2', '2', ' ' );
55
56      TEXT_IO.PUT_LINE( "Creating Test_task (Global)" );
57
58      RTEMS.TASKS.CREATE( 
59         MPTEST.TASK_NAME( TEST_SUPPORT.NODE ), 
60         1,
61         2048, 
62         RTEMS.TIMESLICE,
63         RTEMS.GLOBAL,
64         MPTEST.TASK_ID( 1 ),
65         STATUS
66      );
67      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" );
68
69      TEXT_IO.PUT_LINE( "Starting Test_task (Global)" );
70
71      RTEMS.TASKS.START(
72         MPTEST.TASK_ID( 1 ),
73         MPTEST.TEST_TASK'ACCESS,
74         0,
75         STATUS
76      );
77      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" );
78
79      MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME(  'T', 'M', '1', ' ' );
80      MPTEST.TIMER_NAME( 2 ) := RTEMS.BUILD_NAME(  'T', 'M', '2', ' ' );
81
82      RTEMS.TIMER.CREATE(
83         MPTEST.TIMER_NAME( TEST_SUPPORT.NODE ),
84         MPTEST.TIMER_ID( 1 ),
85         STATUS
86      );
87      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" );
88
89      TEXT_IO.PUT_LINE( "Deleting initialization task" );
90
91      RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
92      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
93
94   end INIT;
95
96--
97--  PROCESS_ASR
98--
99
100   procedure PROCESS_ASR (
101      SIGNAL : in     RTEMS.SIGNAL_SET
102   )
103   is 
104   begin
105
106      if SIGNAL /= MPTEST.EXPECTED_SIGNAL then
107
108         TEXT_IO.PUT( "ERROR: I was expecting signal 0x" );
109         UNSIGNED32_IO.PUT( EXPECTED_SIGNAL, BASE => 16 );
110         TEXT_IO.PUT( " got 0x" );
111         UNSIGNED32_IO.PUT( SIGNAL, BASE => 16 );
112         TEXT_IO.NEW_LINE;
113
114         RTEMS.FATAL.ERROR_OCCURRED( 16#000F_0000# );
115
116      end if;
117
118      MPTEST.SIGNAL_CAUGHT := TRUE;
119
120   end PROCESS_ASR;
121
122--
123--  STOP_TEST_TSR
124--
125
126   procedure STOP_TEST_TSR (
127      IGNORED_ID      : in     RTEMS.ID;
128      IGNORED_ADDRESS : in     RTEMS.ADDRESS
129   ) is
130   begin
131
132      MPTEST.STOP_TEST := TRUE;
133
134   end STOP_TEST_TSR;
135
136--
137--  TEST_TASK
138--
139
140   procedure TEST_TASK (
141      ARGUMENT : in     RTEMS.TASKS.ARGUMENT
142   ) is
143      STATUS  : RTEMS.STATUS_CODES;
144   begin
145
146      MPTEST.STOP_TEST := FALSE;
147
148      MPTEST.SIGNAL_CAUGHT := FALSE;
149      MPTEST.SIGNAL_COUNT  := 0;
150
151      TEXT_IO.PUT_LINE( "signal_catch: initializing signal catcher" );
152      RTEMS.SIGNAL.CATCH( 
153         MPTEST.PROCESS_ASR'ACCESS, 
154         RTEMS.NO_ASR + RTEMS.NO_PREEMPT,
155         STATUS
156      );
157      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH" );
158
159      if TEST_SUPPORT.NODE = 1 then
160         MPTEST.REMOTE_NODE     := 2;
161         MPTEST.REMOTE_SIGNAL   := RTEMS.SIGNAL_18;
162         MPTEST.EXPECTED_SIGNAL := RTEMS.SIGNAL_17;
163      else
164         MPTEST.REMOTE_NODE     := 1;
165         MPTEST.REMOTE_SIGNAL   := RTEMS.SIGNAL_17;
166         MPTEST.EXPECTED_SIGNAL := RTEMS.SIGNAL_18;
167      end if;
168
169      TEXT_IO.PUT( "Remote task's name is : " );
170      TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE );
171
172      TEXT_IO.PUT_LINE( "Getting TID of remote task" );
173      loop
174
175         RTEMS.TASKS.IDENT( 
176            MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ),
177            RTEMS.SEARCH_ALL_NODES,
178            MPTEST.REMOTE_TID,
179            STATUS
180         );
181
182         exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS );
183
184      end loop;
185
186      RTEMS.TIMER.FIRE_AFTER(
187         MPTEST.TIMER_ID( 1 ),
188         3 * TEST_SUPPORT.TICKS_PER_SECOND,
189         MPTEST.STOP_TEST_TSR'ACCESS,
190         RTEMS.NULL_ADDRESS,
191         STATUS
192      );
193      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" );
194
195      if TEST_SUPPORT.NODE = 1 then
196
197         TEXT_IO.PUT_LINE( "Sending signal to remote task" );
198         loop
199            RTEMS.SIGNAL.SEND(
200               MPTEST.REMOTE_TID,
201               MPTEST.REMOTE_SIGNAL,
202               STATUS
203            );
204
205            exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS );
206
207            exit when not RTEMS.ARE_STATUSES_EQUAL(STATUS, RTEMS.NOT_DEFINED);
208   
209         end loop;
210         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" );
211
212      end if;
213
214      loop
215 
216         exit when MPTEST.STOP_TEST = TRUE;
217
218         if MPTEST.SIGNAL_CAUGHT = TRUE then
219
220            MPTEST.SIGNAL_CAUGHT := FALSE;
221            MPTEST.SIGNAL_COUNT  := MPTEST.SIGNAL_COUNT + 1;
222
223            if MPTEST.SIGNAL_COUNT >= MPTEST.SIGNALS_PER_DOT then
224
225               MPTEST.SIGNAL_COUNT := 0;
226
227               TEST_SUPPORT.PUT_DOT( "." );
228
229            end if;
230
231            RTEMS.SIGNAL.SEND(
232               MPTEST.REMOTE_TID,
233               MPTEST.REMOTE_SIGNAL,
234               STATUS
235            );
236            TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" );
237
238         end if;
239
240      end loop;
241
242      TEXT_IO.NEW_LINE;
243      TEXT_IO.PUT_LINE( "*** END OF TEST 5 ***" );
244
245      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
246
247   end TEST_TASK;
248
249end MPTEST;
Note: See TracBrowser for help on using the repository browser.