summaryrefslogtreecommitdiffstats
path: root/c/src/ada-tests/mptests/mp14/mptest.adb
blob: c795dc28bd9824f567da2543d87095b7e9a2b41d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
--
--  MPTEST / BODY
--
--  DESCRIPTION:
--
--  This package is the implementation for Test 14 of the RTEMS
--  Multiprocessor Test Suite.
--
--  DEPENDENCIES:
--
--
--
--  COPYRIGHT (c) 1989-2011.
--  On-Line Applications Research Corporation (OAR).
--
--  The license and distribution terms for this file may in
--  the file LICENSE in this distribution or at
--  http://www.rtems.org/license/LICENSE.
--

with INTERFACES; use INTERFACES;
with INTERFACES.C;
with RTEMS;
with RTEMS.EVENT;
with RTEMS.MESSAGE_QUEUE;
with RTEMS.PARTITION;
with RTEMS.SEMAPHORE;
with RTEMS.TASKS;
with RTEMS.TIMER;
with TEST_SUPPORT;
with TEXT_IO;
with UNSIGNED32_IO;

with System.Storage_Elements; use System.Storage_Elements;

package body MPTEST is

--
--  STOP_TEST_TSR
--
 
   procedure STOP_TEST_TSR (
      IGNORED_ID      : in     RTEMS.ID;
      IGNORED_ADDRESS : in     RTEMS.ADDRESS
   ) is
   begin
 
      MPTEST.STOP_TEST := TRUE;
 
   end STOP_TEST_TSR;
 
--
--  EXIT_TEST
--
 
   procedure EXIT_TEST is
      OLD_MODE : RTEMS.MODE;
      STATUS   : RTEMS.STATUS_CODES;
      procedure BSP_MPCI_PRINT_STATISTICS;
      pragma Import (C, BSP_MPCI_PRINT_STATISTICS, "MPCI_Print_statistics" );
   begin
 
      RTEMS.TASKS.MODE(RTEMS.NO_PREEMPT, RTEMS.PREEMPT_MASK, OLD_MODE, STATUS);
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );

      BSP_MPCI_PRINT_STATISTICS;

      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
 
   end EXIT_TEST;
 
--
--  INIT
--

   procedure INIT (
      ARGUMENT : in     RTEMS.TASKS.ARGUMENT
   ) is
      INDEX             : RTEMS.UNSIGNED32;
      STATUS            : RTEMS.STATUS_CODES;
      PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
   begin

      TEXT_IO.NEW_LINE( 2 );
      TEXT_IO.PUT( "*** TEST 14 -- NODE " );
      UNSIGNED32_IO.PUT(
         TEST_SUPPORT.NODE,
         WIDTH => 1
      );
      TEXT_IO.PUT_LINE( " ***" );

      MPTEST.STOP_TIMER_NAME := RTEMS.BUILD_NAME( 'S', 'T', 'O', 'P' );

      MPTEST.STOP_TEST := FALSE;

      RTEMS.TIMER.CREATE(
         MPTEST.STOP_TIMER_NAME,
         MPTEST.STOP_TIMER_ID,
         STATUS
      );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" );

      RTEMS.TIMER.FIRE_AFTER(
         MPTEST.STOP_TIMER_ID,
         TEST_SUPPORT.MAXIMUM_LONG_TEST_DURATION *
            TEST_SUPPORT.TICKS_PER_SECOND,
         MPTEST.STOP_TEST_TSR'ACCESS,
         RTEMS.NULL_ADDRESS,
         STATUS
      );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" );
 
      MPTEST.EVENT_TASK_NAME( 1 ) := RTEMS.BUILD_NAME(  '1', '1', '1', ' ' );
      MPTEST.EVENT_TASK_NAME( 2 ) := RTEMS.BUILD_NAME(  '2', '2', '2', ' ' );

      MPTEST.QUEUE_TASK_NAME( 1 ) := RTEMS.BUILD_NAME(  'M', 'T', '1', ' ' );
      MPTEST.QUEUE_TASK_NAME( 2 ) := RTEMS.BUILD_NAME(  'M', 'T', '2', ' ' );

      MPTEST.PARTITION_TASK_NAME( 1 ) := 
         RTEMS.BUILD_NAME(  'P', 'T', '1', ' ' );
      MPTEST.PARTITION_TASK_NAME( 2 ) := 
         RTEMS.BUILD_NAME(  'P', 'T', '2', ' ' );

      MPTEST.SEMAPHORE_TASK_NAME( 1 ) := 
         RTEMS.BUILD_NAME(  'S', 'M', '1', ' ' );
      MPTEST.SEMAPHORE_TASK_NAME( 2 ) := 
         RTEMS.BUILD_NAME(  'S', 'M', '2', ' ' );

      MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME(  'S', 'E', 'M', ' ' );

      MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME(  'M', 'S', 'G', ' ' );

      MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME(  'P', 'A', 'R', ' ' );

      MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME(  'T', 'M', 'R', ' ' );

      for INDEX in MPTEST.BUFFERS'FIRST .. MPTEST.BUFFERS'LAST
      loop

         MPTEST.BUFFERS( INDEX ) :=
            MPTEST.BUFFER_AREAS( INDEX )'ADDRESS;

      end loop;

      if TEST_SUPPORT.NODE = 1 then

         TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" );
         RTEMS.SEMAPHORE.CREATE(
            MPTEST.SEMAPHORE_NAME( 1 ),
            1,
            RTEMS.GLOBAL,
            MPTEST.SEMAPHORE_ID( 1 ),
            STATUS
         );
         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" );

         TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" );
         RTEMS.MESSAGE_QUEUE.CREATE(
            MPTEST.QUEUE_NAME( 1 ),
            1,
            RTEMS.GLOBAL,
            MPTEST.QUEUE_ID( 1 ),
            STATUS
         );
         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" );

         TEXT_IO.PUT_LINE( "Creating Partition (Global)" );
         RTEMS.PARTITION.CREATE(
            MPTEST.PARTITION_NAME( 1 ),
            MPTEST.PARTITION_AREA( 0 )'ADDRESS,
            16#8000#,
            16#3000#,
            RTEMS.GLOBAL,
            MPTEST.PARTITION_ID( 1 ),
            STATUS
         );
         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE" );

      end if;

      TEXT_IO.PUT_LINE( "Creating Event task (Global)" );
      RTEMS.TASKS.CREATE(
         MPTEST.EVENT_TASK_NAME(
            TEST_SUPPORT.NODE
         ),
         2,
         2048,
         RTEMS.TIMESLICE,
         RTEMS.GLOBAL,
         MPTEST.EVENT_TASK_ID( 1 ),
         STATUS
      ); 
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" );

      TEXT_IO.PUT_LINE( "Starting Event task (Global)" );
      RTEMS.TASKS.START(
         MPTEST.EVENT_TASK_ID( 1 ),
         MPTEST.TEST_TASK'ACCESS,
         0,
         STATUS
      ); 
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" );

      TEXT_IO.PUT_LINE( "Creating Semaphore task (Global)" );
      RTEMS.TASKS.CREATE(
         MPTEST.SEMAPHORE_TASK_NAME(
            TEST_SUPPORT.NODE
         ),
         2,
         2048,
         RTEMS.TIMESLICE,
         RTEMS.GLOBAL,
         MPTEST.SEMAPHORE_TASK_ID( 1 ),
         STATUS
      ); 
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" );

      TEXT_IO.PUT_LINE( "Starting Semaphore task (Global)" );
      RTEMS.TASKS.START(
         MPTEST.SEMAPHORE_TASK_ID( 1 ),
         MPTEST.SEMAPHORE_TASK'ACCESS,
         0,
         STATUS
      ); 
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" );

      TEXT_IO.PUT_LINE( "Creating Message Queue task (Global)" );
      RTEMS.TASKS.CREATE(
         MPTEST.QUEUE_TASK_NAME(
            TEST_SUPPORT.NODE
         ),
         2,
         2048,
         RTEMS.TIMESLICE,
         RTEMS.GLOBAL,
         MPTEST.QUEUE_TASK_ID( 1 ),
         STATUS
      ); 
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" );

      TEXT_IO.PUT_LINE( "Starting Message Queue task (Global)" );
      RTEMS.TASKS.START(
         MPTEST.QUEUE_TASK_ID( 1 ),
         MPTEST.MESSAGE_QUEUE_TASK'ACCESS,
         1,                          -- index of buffer
         STATUS
      ); 
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" );

      TEXT_IO.PUT_LINE( "Creating Partition task (Global)" );
      RTEMS.TASKS.CREATE(
         MPTEST.PARTITION_TASK_NAME(
            TEST_SUPPORT.NODE 
         ),
         2,
         2048,
         RTEMS.TIMESLICE,
         RTEMS.GLOBAL,
         MPTEST.PARTITION_TASK_ID( 1 ),
         STATUS
      ); 
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" );

      TEXT_IO.PUT_LINE( "Starting Partition task (Global)" );
      RTEMS.TASKS.START(
         MPTEST.PARTITION_TASK_ID( 1 ),
         MPTEST.PARTITION_TASK'ACCESS,
         0,
         STATUS
      ); 
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" );
    
      RTEMS.TASKS.SET_PRIORITY( RTEMS.SELF, 2, PREVIOUS_PRIORITY, STATUS );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );

      MPTEST.DELAYED_EVENTS_TASK( 1 );

   end INIT;

--
--  DELAYED_SEND_EVENT
--
--  DESCRIPTION:
--
--  This subprogram is a timer service routine which sends an
--  event set to a waiting task.
--

   procedure DELAYED_SEND_EVENT (
      TIMER_ID        : in     RTEMS.ID;
      IGNORED_ADDRESS : in     RTEMS.ADDRESS
   ) is
      STATUS : RTEMS.STATUS_CODES;
   begin

      RTEMS.EVENT.SEND(
         MPTEST.TASK_ID( RTEMS.GET_INDEX( TIMER_ID ) ),
         RTEMS.EVENT_16,
         STATUS
      );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" );

   end DELAYED_SEND_EVENT;
 
--
--  TEST_TASK
--
--  DESCRIPTION:
--
--  This is one of the test tasks.
--
 
   procedure TEST_TASK ( 
      ARGUMENT : in     RTEMS.TASKS.ARGUMENT
   ) is
      REMOTE_NODE : RTEMS.UNSIGNED32;
      REMOTE_TID  : RTEMS.ID;
      COUNT       : RTEMS.UNSIGNED32;
      EVENT_OUT   : RTEMS.EVENT_SET;
      STATUS      : RTEMS.STATUS_CODES;
   begin

      if TEST_SUPPORT.NODE = 1 then
         REMOTE_NODE := 2;
      else
         REMOTE_NODE := 1;
      end if;

      TEXT_IO.PUT_LINE( "About to go to sleep!" );
      RTEMS.TASKS.WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
      TEXT_IO.PUT_LINE( "Waking up!" );
 
      TEXT_IO.PUT( "Remote task's name is : " );
      TEST_SUPPORT.PUT_NAME( MPTEST.EVENT_TASK_NAME( REMOTE_NODE ), TRUE );

      TEXT_IO.PUT_LINE( "Getting TID of remote task" );

      loop

         RTEMS.TASKS.IDENT(
            MPTEST.EVENT_TASK_NAME( REMOTE_NODE ),
            RTEMS.SEARCH_ALL_NODES,
            REMOTE_TID,
            STATUS
         ); 

         exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS );

         TEXT_IO.PUT_LINE( "task_ident" );

      end loop;

      if TEST_SUPPORT.NODE = 1 then
         TEXT_IO.PUT_LINE( "Sending events to remote task" );

         loop
            exit when MPTEST.STOP_TEST = TRUE;

            for COUNT in 1 .. MPTEST.EVENT_TASK_DOT_COUNT
            loop
               RTEMS.EVENT.SEND(
                  REMOTE_TID,
                  RTEMS.EVENT_16,
                  STATUS
               );
               TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" );

               exit when MPTEST.STOP_TEST = TRUE;

            end loop;

            TEST_SUPPORT.PUT_DOT( "e" );
  
         end loop;

      end if;
          
      TEXT_IO.PUT_LINE( "Receiving events from remote task" );

      loop
         exit when MPTEST.STOP_TEST = TRUE;

         for COUNT in 1 .. MPTEST.EVENT_TASK_DOT_COUNT 
         loop 
            exit when MPTEST.STOP_TEST = TRUE;

            RTEMS.EVENT.RECEIVE(
               RTEMS.EVENT_16,
               RTEMS.DEFAULT_OPTIONS,
               RTEMS.NO_TIMEOUT,
               EVENT_OUT,
               STATUS 
            );   
            TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" );

         end loop;
 
         TEST_SUPPORT.PUT_DOT( "e" );
 
      end loop;

      MPTEST.EXIT_TEST;
 
   end TEST_TASK;
 
-- 
--  DELAYED_EVENTS_TASK 
-- 
--  DESCRIPTION: 
-- 
--  This is one of the test tasks. 
-- 
  
   procedure DELAYED_EVENTS_TASK (  
      ARGUMENT : in     RTEMS.TASKS.ARGUMENT 
   ) is
      COUNT         : RTEMS.UNSIGNED32;
      PREVIOUS_MODE : RTEMS.MODE;
      EVENTS_OUT    : RTEMS.EVENT_SET;
      STATUS        : RTEMS.STATUS_CODES;
   begin

      RTEMS.TASKS.MODE(
         RTEMS.PREEMPT + RTEMS.TIMESLICE,
         RTEMS.PREEMPT_MASK + RTEMS.TIMESLICE_MASK,
         PREVIOUS_MODE,
         STATUS
      );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
 
      RTEMS.TIMER.CREATE(
         MPTEST.TIMER_NAME( 1 ),
         MPTEST.TIMER_ID( 1 ),
         STATUS 
      );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" );

      RTEMS.TASKS.IDENT(
         RTEMS.SELF,
         RTEMS.SEARCH_ALL_NODES,
         MPTEST.TASK_ID( RTEMS.GET_INDEX( MPTEST.TIMER_ID( 1 ) ) ),
         STATUS
      );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENTS" );

      loop

         for COUNT in 1 .. MPTEST.DELAYED_EVENT_DOT_COUNT 
         loop 
            RTEMS.TIMER.FIRE_AFTER(
               MPTEST.TIMER_ID( 1 ),
               1,
               MPTEST.DELAYED_SEND_EVENT'ACCESS,
               RTEMS.NULL_ADDRESS,
               STATUS 
            );
            TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" );

            RTEMS.EVENT.RECEIVE(
               RTEMS.EVENT_16,
               RTEMS.DEFAULT_OPTIONS,
               RTEMS.NO_TIMEOUT,
               EVENTS_OUT,
               STATUS 
            );   
            TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" );

         end loop;
 
         TEST_SUPPORT.PUT_DOT( "." );
 
      end loop;
 
      MPTEST.EXIT_TEST;
      
   end DELAYED_EVENTS_TASK; 
 
-- 
--  MESSAGE_QUEUE_TASK 
-- 
--  DESCRIPTION: 
-- 
--  This is one of the test tasks. 
-- 
  
   procedure MESSAGE_QUEUE_TASK (  
      INDEX : in     RTEMS.TASKS.ARGUMENT 
   ) is
      COUNT          : RTEMS.UNSIGNED32;
      YIELD_COUNT    : RTEMS.UNSIGNED32;
      OVERFLOW_COUNT : RTEMS.UNSIGNED32_POINTER;
      BUFFER_COUNT   : RTEMS.UNSIGNED32_POINTER;
      STATUS         : RTEMS.STATUS_CODES;
   begin

      MPTEST.BUFFERS( INDEX ).FIELD1 := 0;
      MPTEST.BUFFERS( INDEX ).FIELD2 := 0;
      MPTEST.BUFFERS( INDEX ).FIELD3 := 0;
      MPTEST.BUFFERS( INDEX ).FIELD4 := 0;

      TEXT_IO.PUT_LINE( "Getting ID of message queue" );

      loop

         RTEMS.MESSAGE_QUEUE.IDENT(
            MPTEST.QUEUE_NAME( 1 ),
            RTEMS.SEARCH_ALL_NODES,
            MPTEST.QUEUE_ID( 1 ),
            STATUS
         );
         exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS );

         TEXT_IO.PUT_LINE( "message_queue_ident FAILED!!" );

      end loop;

      if TEST_SUPPORT.NODE = 1 then

         RTEMS.MESSAGE_QUEUE.SEND(
            MPTEST.QUEUE_ID( 1 ),
            MPTEST.BUFFERS( INDEX ),
            STATUS
         );
         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );

         OVERFLOW_COUNT := RTEMS.TO_UNSIGNED32_POINTER( 
                              MPTEST.BUFFERS( INDEX ).FIELD1'ADDRESS
                           );
                
         BUFFER_COUNT := RTEMS.TO_UNSIGNED32_POINTER( 
                              MPTEST.BUFFERS( INDEX ).FIELD2'ADDRESS
                           );
                
      else

         OVERFLOW_COUNT := RTEMS.TO_UNSIGNED32_POINTER( 
                              MPTEST.BUFFERS( INDEX ).FIELD3'ADDRESS
                           );
                
         BUFFER_COUNT := RTEMS.TO_UNSIGNED32_POINTER( 
                              MPTEST.BUFFERS( INDEX ).FIELD4'ADDRESS
                           );

      end if;

      loop

         exit when MPTEST.STOP_TEST = TRUE;

         YIELD_COUNT := 100;

         for COUNT in 1 .. MPTEST.MESSAGE_DOT_COUNT
         loop

           exit when MPTEST.STOP_TEST = TRUE;

            RTEMS.MESSAGE_QUEUE.RECEIVE(
               MPTEST.QUEUE_ID( 1 ),
               MPTEST.BUFFERS( INDEX ),
               RTEMS.DEFAULT_OPTIONS,
               RTEMS.NO_TIMEOUT,
               STATUS
            );
            TEST_SUPPORT.DIRECTIVE_FAILED( 
               STATUS, 
               "MESSAGE_QUEUE_RECEIVE" 
            );

            if BUFFER_COUNT.ALL = RTEMS.UNSIGNED32'LAST then
               BUFFER_COUNT.ALL   := 0;
               OVERFLOW_COUNT.ALL := OVERFLOW_COUNT.ALL + 1;
            else
               BUFFER_COUNT.ALL := BUFFER_COUNT.ALL + 1;
            end if;

            RTEMS.MESSAGE_QUEUE.SEND(
               MPTEST.QUEUE_ID( 1 ),
               MPTEST.BUFFERS( INDEX ),
               STATUS
            );
            TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );

            if MPTEST.STOP_TEST = FALSE then
               if TEST_SUPPORT.NODE = 1 then

                  YIELD_COUNT := YIELD_COUNT - 1;

                  if YIELD_COUNT = 0 then

                     RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
                     TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" );

                     YIELD_COUNT := 100;

                  end if;

               end if;

            end if;
         
         end loop;

         TEST_SUPPORT.PUT_DOT( "m" );

      end loop;

      MPTEST.EXIT_TEST;

   end MESSAGE_QUEUE_TASK;
 
-- 
--  PARTITION_TASK 
--
--  DESCRIPTION: 
-- 
--  This is one of the test tasks. 
-- 
  
   procedure PARTITION_TASK (  
      IGNORED : in     RTEMS.TASKS.ARGUMENT 
   ) is
      COUNT  : RTEMS.UNSIGNED32;
      BUFFER : RTEMS.ADDRESS;
      STATUS : RTEMS.STATUS_CODES;
   begin

      TEXT_IO.PUT_LINE( "Getting ID of partition" );
 
      loop

         RTEMS.PARTITION.IDENT(
            MPTEST.PARTITION_NAME( 1 ),
            RTEMS.SEARCH_ALL_NODES,
            MPTEST.PARTITION_ID( 1 ),
            STATUS
         );
         exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS );

         TEXT_IO.PUT_LINE( "partition_ident FAILED!!" );

      end loop;

      loop

         exit when MPTEST.STOP_TEST = TRUE;

         for COUNT in 1 .. MPTEST.PARTITION_DOT_COUNT
         loop

            exit when MPTEST.STOP_TEST = TRUE;

            RTEMS.PARTITION.GET_BUFFER(
               MPTEST.PARTITION_ID( 1 ),
               BUFFER,
               STATUS
            );
            TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );

            RTEMS.PARTITION.RETURN_BUFFER(
               MPTEST.PARTITION_ID( 1 ),
               BUFFER,
               STATUS
            );
            TEST_SUPPORT.DIRECTIVE_FAILED( 
               STATUS, 
               "PARTITION_RETURN_BUFFER" 
            );

            if TEST_SUPPORT.NODE = 1 then

               RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
               TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" );

            end if;

         end loop;

         TEST_SUPPORT.PUT_DOT( "p" );

      end loop;

      MPTEST.EXIT_TEST;

   end PARTITION_TASK; 
 
-- 
--  SEMAPHORE_TASK 
-- 
--  DESCRIPTION: 
-- 
--  This is one of the test tasks. 
-- 
  
   procedure SEMAPHORE_TASK (  
      ARGUMENT : in     RTEMS.TASKS.ARGUMENT 
   ) is
      COUNT          : RTEMS.UNSIGNED32;
      YIELD_COUNT    : RTEMS.UNSIGNED32;
      STATUS         : RTEMS.STATUS_CODES;
   begin

      TEXT_IO.PUT_LINE( "Getting ID of semaphore" );

      loop

         RTEMS.SEMAPHORE.IDENT(
            MPTEST.SEMAPHORE_NAME( 1 ),
            RTEMS.SEARCH_ALL_NODES,
            MPTEST.SEMAPHORE_ID( 1 ),
            STATUS
         );
         exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS );

         TEXT_IO.PUT_LINE( "semaphore_ident FAILED!!" );

      end loop;

      loop

         YIELD_COUNT := 100;

         exit when MPTEST.STOP_TEST = TRUE;

         for COUNT in 1 .. MPTEST.SEMAPHORE_DOT_COUNT
         loop

            exit when MPTEST.STOP_TEST = TRUE;

            RTEMS.SEMAPHORE.OBTAIN(
               MPTEST.SEMAPHORE_ID( 1 ),
               RTEMS.DEFAULT_OPTIONS,
               RTEMS.NO_TIMEOUT,
               STATUS
            );
            TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" );

            RTEMS.SEMAPHORE.RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS );
            TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" );

            if TEST_SUPPORT.NODE = 1 then

               YIELD_COUNT := YIELD_COUNT - 1;

               if YIELD_COUNT = 0 then

                  RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
                  TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" );

                  YIELD_COUNT := 100;

               end if;

            end if;
         
         end loop;

         TEST_SUPPORT.PUT_DOT( "s" );

      end loop;

      MPTEST.EXIT_TEST;

   end SEMAPHORE_TASK; 
 
end MPTEST;