source: rtems/c/src/ada-tests/mptests/mp01/mptest.adb @ 3c0534a

4.104.114.84.95
Last change on this file since 3c0534a was 3c0534a, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 20, 2003 at 4:02:19 PM

2003-08-20 Joel Sherrill <joel@…>

  • mptests/mp01/config.h, mptests/mp01/mp01.adb, mptests/mp01/mptest.adb, mptests/mp01/mptest.ads, mptests/mp02/mptest.adb, mptests/mp02/mptest.ads, mptests/mp03/mptest.adb, mptests/mp03/mptest.ads, mptests/mp04/mptest.adb, mptests/mp04/mptest.ads, mptests/mp05/mptest.adb, mptests/mp05/mptest.ads, mptests/mp06/mptest.adb, mptests/mp06/mptest.ads, mptests/mp07/mptest.adb, mptests/mp07/mptest.ads, mptests/mp08/mptest.adb, mptests/mp08/mptest.ads, mptests/mp09/mptest.adb, mptests/mp09/mptest.ads, mptests/mp10/mptest.adb, mptests/mp10/mptest.ads, mptests/mp11/mptest.adb, mptests/mp11/mptest.ads, mptests/mp12/mptest.adb, mptests/mp12/mptest.ads, mptests/mp13/mptest.adb, mptests/mp13/mptest.ads, mptests/mp14/mptest.adb, mptests/mp14/mptest.ads, samples/base_mp/mptest.adb, samples/base_mp/mptest.ads, samples/base_sp/base_sp.adb, samples/base_sp/config.h, samples/base_sp/sptest.adb, samples/base_sp/sptest.ads, samples/hello/config.h, samples/hello/hello.adb, samples/hello/sptest.adb, samples/hello/sptest.ads, samples/ticker/config.h, samples/ticker/sptest.adb, samples/ticker/sptest.ads, samples/ticker/ticker.adb, sptests/sp01/config.h, sptests/sp01/sp01.adb, sptests/sp01/sptest.adb, sptests/sp01/sptest.ads, sptests/sp02/config.h, sptests/sp02/sp02.adb, sptests/sp02/sptest.adb, sptests/sp02/sptest.ads, sptests/sp03/config.h, sptests/sp03/sp03.adb, sptests/sp03/sptest.adb, sptests/sp03/sptest.ads, sptests/sp04/config.h, sptests/sp04/sp04.adb, sptests/sp04/sptest.adb, sptests/sp04/sptest.ads, sptests/sp05/config.h, sptests/sp05/sp05.adb, sptests/sp05/sptest.adb, sptests/sp05/sptest.ads, sptests/sp06/config.h, sptests/sp06/sp06.adb, sptests/sp06/sptest.adb, sptests/sp06/sptest.ads, sptests/sp07/config.h, sptests/sp07/sp07.adb, sptests/sp07/sptest.adb, sptests/sp07/sptest.ads, sptests/sp08/config.h, sptests/sp08/sp08.adb, sptests/sp08/sptest.adb, sptests/sp08/sptest.ads, sptests/sp09/config.h, sptests/sp09/sp09.adb, sptests/sp09/sptest.adb, sptests/sp09/sptest.ads, sptests/sp11/config.h, sptests/sp11/sp11.adb, sptests/sp11/sptest.adb, sptests/sp11/sptest.ads, sptests/sp12/config.h, sptests/sp12/sp12.adb, sptests/sp12/sptest.adb, sptests/sp12/sptest.ads, sptests/sp13/config.h, sptests/sp13/sp13.adb, sptests/sp13/sptest.adb, sptests/sp13/sptest.ads, sptests/sp14/config.h, sptests/sp14/sp14.adb, sptests/sp14/sptest.adb, sptests/sp14/sptest.ads, sptests/sp15/config.h, sptests/sp15/sp15.adb, sptests/sp15/sptest.adb, sptests/sp15/sptest.ads, sptests/sp16/config.h, sptests/sp16/sp16.adb, sptests/sp16/sptest.adb, sptests/sp16/sptest.ads, sptests/sp17/config.h, sptests/sp17/sp17.adb, sptests/sp17/sptest.adb, sptests/sp17/sptest.ads, sptests/sp19/config.h, sptests/sp19/sp19.adb, sptests/sp19/sptest.ads, sptests/sp20/config.h, sptests/sp20/sp20.adb, sptests/sp20/sptest.adb, sptests/sp20/sptest.ads, sptests/sp21/config.h, sptests/sp21/sp21.adb, sptests/sp21/sptest.adb, sptests/sp21/sptest.ads, sptests/sp22/config.h, sptests/sp22/sp22.adb, sptests/sp22/sptest.adb, sptests/sp22/sptest.ads, sptests/sp23/config.h, sptests/sp23/sp23.adb, sptests/sp23/sptest.adb, sptests/sp23/sptest.ads, sptests/sp24/config.h, sptests/sp24/sp24.adb, sptests/sp24/sptest.adb, sptests/sp24/sptest.ads, sptests/sp25/config.h, sptests/sp25/sp25.adb, sptests/sp25/sptest.adb, sptests/sp25/sptest.ads, sptests/spsize/spsize.adb, sptests/spsize/sptest.adb, sptests/spsize/sptest.ads, support/address_io.adb, support/address_io.ads, support/float_io.ads, support/fp.inc, support/integer.inc, support/rtems_calling_overhead.ads, support/status_io.ads, support/test_support.adb, support/test_support.ads, support/time_test_support.adb, support/time_test_support.ads, support/timer_driver.adb, support/timer_driver.ads, support/unsigned32_io.ads, tmtests/tm01/config.h, tmtests/tm01/tm01.adb, tmtests/tm01/tmtest.adb, tmtests/tm01/tmtest.ads, tmtests/tm02/config.h, tmtests/tm02/tm02.adb, tmtests/tm02/tmtest.adb, tmtests/tm02/tmtest.ads, tmtests/tm03/config.h, tmtests/tm03/tm03.adb, tmtests/tm03/tmtest.adb, tmtests/tm03/tmtest.ads, tmtests/tm04/config.h, tmtests/tm04/tm04.adb, tmtests/tm04/tmtest.adb, tmtests/tm04/tmtest.ads, tmtests/tm05/config.h, tmtests/tm05/tm05.adb, tmtests/tm05/tmtest.adb, tmtests/tm05/tmtest.ads, tmtests/tm06/config.h, tmtests/tm06/tm06.adb, tmtests/tm06/tmtest.adb, tmtests/tm06/tmtest.ads, tmtests/tm07/config.h, tmtests/tm07/tm07.adb, tmtests/tm07/tmtest.adb, tmtests/tm07/tmtest.ads, tmtests/tm08/config.h, tmtests/tm08/tm08.adb, tmtests/tm08/tmtest.adb, tmtests/tm08/tmtest.ads, tmtests/tm09/config.h, tmtests/tm09/tm09.adb, tmtests/tm09/tmtest.adb, tmtests/tm09/tmtest.ads, tmtests/tm10/config.h, tmtests/tm10/tm10.adb, tmtests/tm10/tmtest.adb, tmtests/tm10/tmtest.ads, tmtests/tm11/config.h, tmtests/tm11/tm11.adb, tmtests/tm11/tmtest.adb, tmtests/tm11/tmtest.ads, tmtests/tm12/config.h, tmtests/tm12/tm12.adb, tmtests/tm12/tmtest.adb, tmtests/tm12/tmtest.ads, tmtests/tm13/config.h, tmtests/tm13/tm13.adb, tmtests/tm13/tmtest.adb, tmtests/tm13/tmtest.ads, tmtests/tm14/config.h, tmtests/tm14/tm14.adb, tmtests/tm14/tmtest.adb, tmtests/tm14/tmtest.ads, tmtests/tm15/config.h, tmtests/tm15/tm15.adb, tmtests/tm15/tmtest.adb, tmtests/tm15/tmtest.ads, tmtests/tm16/config.h, tmtests/tm16/tm16.adb, tmtests/tm16/tmtest.adb, tmtests/tm16/tmtest.ads, tmtests/tm17/config.h, tmtests/tm17/tm17.adb, tmtests/tm17/tmtest.adb, tmtests/tm17/tmtest.ads, tmtests/tm18/config.h, tmtests/tm18/tm18.adb, tmtests/tm18/tmtest.adb, tmtests/tm18/tmtest.ads, tmtests/tm19/config.h, tmtests/tm19/tm19.adb, tmtests/tm19/tmtest.adb, tmtests/tm19/tmtest.ads, tmtests/tm20/config.h, tmtests/tm20/tm20.adb, tmtests/tm20/tmtest.adb, tmtests/tm20/tmtest.ads, tmtests/tm21/config.h, tmtests/tm21/tm21.adb, tmtests/tm21/tmtest.adb, tmtests/tm21/tmtest.ads, tmtests/tm22/config.h, tmtests/tm22/tm22.adb, tmtests/tm22/tmtest.adb, tmtests/tm22/tmtest.ads, tmtests/tm23/config.h, tmtests/tm23/tm23.adb, tmtests/tm23/tmtest.adb, tmtests/tm23/tmtest.ads, tmtests/tm24/config.h, tmtests/tm24/tm24.adb, tmtests/tm24/tmtest.adb, tmtests/tm24/tmtest.ads, tmtests/tm25/config.h, tmtests/tm25/tm25.adb, tmtests/tm25/tmtest.adb, tmtests/tm25/tmtest.ads, tmtests/tm28/config.h, tmtests/tm28/tm28.adb, tmtests/tm28/tmtest.adb, tmtests/tm28/tmtest.ads, tmtests/tm29/config.h, tmtests/tm29/tm29.adb, tmtests/tm29/tmtest.adb, tmtests/tm29/tmtest.ads, tmtests/tmck/config.h, tmtests/tmck/tmck.adb, tmtests/tmck/tmtest.adb, tmtests/tmck/tmtest.ads, tmtests/tmoverhd/config.h, tmtests/tmoverhd/dummy_rtems.adb, tmtests/tmoverhd/dummy_rtems.ads, tmtests/tmoverhd/tmoverhd.adb, tmtests/tmoverhd/tmtest.adb, tmtests/tmoverhd/tmtest.ads: Correct copyright statements.
  • Property mode set to 100644
File size: 5.9 KB
Line 
1--
2--  MPTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation for Test 1 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--
16--  The license and distribution terms for this file may in
17--  the file LICENSE in this distribution or at
18--  http://www.OARcorp.com/rtems/license.html.
19--
20--  $Id$
21--
22
23with INTERFACES; use INTERFACES;
24with RTEMS;
25with TEST_SUPPORT;
26with TEXT_IO;
27with UNSIGNED32_IO;
28
29package body MPTEST is
30
31   package body PER_NODE_CONFIGURATION is separate;
32
33--PAGE
34--
35--  INIT
36--
37
38   procedure INIT (
39      ARGUMENT : in     RTEMS.TASK_ARGUMENT
40   ) is
41      C      : RTEMS.CHARACTER;
42      TIME   : RTEMS.TIME_OF_DAY;
43      STATUS : RTEMS.STATUS_CODES;
44   begin
45
46      TEXT_IO.NEW_LINE( 2 );
47      TEXT_IO.PUT( "*** TEST 1 -- NODE " );
48      UNSIGNED32_IO.PUT(
49         MPTEST.MULTIPROCESSING_CONFIGURATION.NODE,
50         WIDTH => 1
51      );
52      TEXT_IO.PUT_LINE( " ***" );
53     
54      if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE /= 1 then
55         C := 'S';
56      else
57         C := 'M';
58      end if;
59
60      MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME(  C, 'A', '1', ' ' );
61      MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME(  C, 'A', '2', ' ' );
62      MPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME(  C, 'A', '3', ' ' );
63
64      TIME := ( 1988, 12, 31, 9, 0, 0, 0 );
65
66      RTEMS.CLOCK_SET( TIME, STATUS );
67      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" );
68
69      TEXT_IO.PUT_LINE( "Creating task 1 (Global)" );
70
71      RTEMS.TASK_CREATE( 
72         MPTEST.TASK_NAME( 1 ), 
73         1, 
74         2048, 
75         RTEMS.DEFAULT_MODES,
76         RTEMS.GLOBAL,
77         MPTEST.TASK_ID( 1 ),
78         STATUS
79      );
80      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
81
82      TEXT_IO.PUT_LINE( "Creating task 2 (Global)" );
83
84      RTEMS.TASK_CREATE( 
85         MPTEST.TASK_NAME( 2 ), 
86         1, 
87         2048, 
88         RTEMS.TIMESLICE,
89         RTEMS.GLOBAL,
90         MPTEST.TASK_ID( 2 ),
91         STATUS
92      );
93      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
94
95      TEXT_IO.PUT_LINE( "Creating task 3 (Local)" );
96
97      RTEMS.TASK_CREATE( 
98         MPTEST.TASK_NAME( 3 ), 
99         1, 
100         2048, 
101         RTEMS.DEFAULT_MODES,
102         RTEMS.DEFAULT_ATTRIBUTES,
103         MPTEST.TASK_ID( 3 ),
104         STATUS
105      );
106      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
107
108      RTEMS.TASK_START(
109         MPTEST.TASK_ID( 1 ),
110         MPTEST.TEST_TASK'ACCESS,
111         0,
112         STATUS
113      );
114      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
115
116      RTEMS.TASK_START(
117         MPTEST.TASK_ID( 2 ),
118         MPTEST.TEST_TASK'ACCESS,
119         0,
120         STATUS
121      );
122      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
123
124      RTEMS.TASK_START(
125         MPTEST.TASK_ID( 3 ),
126         MPTEST.TEST_TASK'ACCESS,
127         0,
128         STATUS
129      );
130      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
131
132      RTEMS.TASK_DELETE( RTEMS.SELF, STATUS );
133      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
134
135   end INIT;
136
137--PAGE
138--
139--  TEST_TASK
140--
141
142   procedure TEST_TASK (
143      ARGUMENT : in     RTEMS.TASK_ARGUMENT
144   ) is
145      TIME   : RTEMS.TIME_OF_DAY;
146      TID    : RTEMS.ID;
147      STATUS : RTEMS.STATUS_CODES;
148   begin
149
150      RTEMS.TASK_IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS );
151      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" );
152   
153      RTEMS.CLOCK_GET( RTEMS.CLOCK_GET_TOD, TIME'ADDRESS, STATUS );
154      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET" );
155
156      TEST_SUPPORT.PUT_NAME( 
157         MPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
158         FALSE
159      );
160
161      TEST_SUPPORT.PRINT_TIME( "- clock_get - ", TIME, "" );
162      TEXT_IO.NEW_LINE;
163
164      RTEMS.TASK_WAKE_AFTER( 
165         TEST_SUPPORT.TASK_NUMBER( TID ) * 5 * 
166           TEST_SUPPORT.TICKS_PER_SECOND, 
167         STATUS
168      );
169      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
170         
171      RTEMS.CLOCK_GET( RTEMS.CLOCK_GET_TOD, TIME'ADDRESS, STATUS );
172      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET" );
173
174      TEST_SUPPORT.PUT_NAME( 
175         MPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
176         FALSE
177      );
178
179      TEST_SUPPORT.PRINT_TIME( "- clock_get - ", TIME, "" );
180      TEXT_IO.NEW_LINE;
181
182      if TEST_SUPPORT.TASK_NUMBER( TID ) = 1 then         -- TASK 1
183
184         TEST_SUPPORT.PUT_NAME( 
185            MPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
186            FALSE
187         );
188
189         TEXT_IO.PUT_LINE( " - deleting self" );
190
191         RTEMS.TASK_DELETE( RTEMS.SELF, STATUS );
192         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
193
194      else if TEST_SUPPORT.TASK_NUMBER( TID ) = 2 then    -- TASK 2
195
196         TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), FALSE );
197         TEXT_IO.PUT( " - waiting to be deleted by " );
198         TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), TRUE );
199
200         loop
201            TEST_SUPPORT.DO_NOTHING;   -- can't be optimized away
202         end loop;
203
204      else                                                -- TASK 3
205
206         TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), FALSE );
207         TEXT_IO.PUT( " - getting TID of " );
208         TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), TRUE );
209         
210         RTEMS.TASK_IDENT( 
211            MPTEST.TASK_NAME( 2 ),
212            RTEMS.SEARCH_ALL_NODES,
213            TID,
214            STATUS
215         );
216         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA2" );
217
218         TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), FALSE );
219         TEXT_IO.PUT( " - deleting " );
220         TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), TRUE );
221
222         RTEMS.TASK_DELETE( TID, STATUS );
223         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" );
224
225      end if;
226      end if;
227
228      TEXT_IO.PUT_LINE( "*** END OF TEST 1 ***" );
229
230      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
231
232   end TEST_TASK;
233
234end MPTEST;
Note: See TracBrowser for help on using the repository browser.