summaryrefslogtreecommitdiffstats
path: root/testsuites/ada/sptests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-12 10:00:10 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-12 10:53:16 +0200
commitee537ea3dd964d4de3565a36b4857af31fb5a3f4 (patch)
treead8b328a58469ca0632e3e61cd94f37c9d97cc25 /testsuites/ada/sptests
parentada-tests: Use _SUBDIRS instead of SUBDIRS (diff)
downloadrtems-ee537ea3dd964d4de3565a36b4857af31fb5a3f4.tar.bz2
ada-tests: Move to testsuites/ada
This solves a build dependency issue, e.g. building tests before librtemsbsp.a exists. Close #3079.
Diffstat (limited to 'testsuites/ada/sptests')
-rw-r--r--testsuites/ada/sptests/Makefile.am28
-rw-r--r--testsuites/ada/sptests/sp01/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp01/ada_sp01.scn16
-rw-r--r--testsuites/ada/sptests/sp01/config.h30
-rw-r--r--testsuites/ada/sptests/sp01/sp01.adb55
-rw-r--r--testsuites/ada/sptests/sp01/sptest.adb159
-rw-r--r--testsuites/ada/sptests/sp01/sptest.ads60
-rw-r--r--testsuites/ada/sptests/sp02/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp02/ada_sp02.scn15
-rw-r--r--testsuites/ada/sptests/sp02/config.h30
-rw-r--r--testsuites/ada/sptests/sp02/sp02.adb55
-rw-r--r--testsuites/ada/sptests/sp02/sptest.adb327
-rw-r--r--testsuites/ada/sptests/sp02/sptest.ads102
-rw-r--r--testsuites/ada/sptests/sp03/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp03/ada_sp03.scn26
-rw-r--r--testsuites/ada/sptests/sp03/config.h30
-rw-r--r--testsuites/ada/sptests/sp03/sp03.adb55
-rw-r--r--testsuites/ada/sptests/sp03/sptest.adb169
-rw-r--r--testsuites/ada/sptests/sp03/sptest.ads75
-rw-r--r--testsuites/ada/sptests/sp04/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp04/README9
-rw-r--r--testsuites/ada/sptests/sp04/ada_sp04.scn25
-rw-r--r--testsuites/ada/sptests/sp04/config.h33
-rw-r--r--testsuites/ada/sptests/sp04/sp04.adb55
-rw-r--r--testsuites/ada/sptests/sp04/sptest.adb348
-rw-r--r--testsuites/ada/sptests/sp04/sptest.ads136
-rw-r--r--testsuites/ada/sptests/sp05/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp05/ada_sp05.scn47
-rw-r--r--testsuites/ada/sptests/sp05/config.h32
-rw-r--r--testsuites/ada/sptests/sp05/sp05.adb55
-rw-r--r--testsuites/ada/sptests/sp05/sptest.adb224
-rw-r--r--testsuites/ada/sptests/sp05/sptest.ads86
-rw-r--r--testsuites/ada/sptests/sp06/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp06/ada_sp06.scn38
-rw-r--r--testsuites/ada/sptests/sp06/config.h32
-rw-r--r--testsuites/ada/sptests/sp06/sp06.adb55
-rw-r--r--testsuites/ada/sptests/sp06/sptest.adb216
-rw-r--r--testsuites/ada/sptests/sp06/sptest.ads93
-rw-r--r--testsuites/ada/sptests/sp07/Makefile.am17
-rw-r--r--testsuites/ada/sptests/sp07/ada_sp07.scn23
-rw-r--r--testsuites/ada/sptests/sp07/config.h33
-rw-r--r--testsuites/ada/sptests/sp07/sp07.adb55
-rw-r--r--testsuites/ada/sptests/sp07/sptest.adb513
-rw-r--r--testsuites/ada/sptests/sp07/sptest.ads194
-rw-r--r--testsuites/ada/sptests/sp08/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp08/ada_sp08.scn20
-rw-r--r--testsuites/ada/sptests/sp08/config.h32
-rw-r--r--testsuites/ada/sptests/sp08/sp08.adb55
-rw-r--r--testsuites/ada/sptests/sp08/sptest.adb346
-rw-r--r--testsuites/ada/sptests/sp08/sptest.ads74
-rw-r--r--testsuites/ada/sptests/sp09/Makefile.am21
-rw-r--r--testsuites/ada/sptests/sp09/ada_sp09.scn246
-rw-r--r--testsuites/ada/sptests/sp09/config.h38
-rw-r--r--testsuites/ada/sptests/sp09/sp09.adb55
-rw-r--r--testsuites/ada/sptests/sp09/sptest.adb3117
-rw-r--r--testsuites/ada/sptests/sp09/sptest.ads393
-rw-r--r--testsuites/ada/sptests/sp11/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp11/ada_sp11.scn74
-rw-r--r--testsuites/ada/sptests/sp11/config.h32
-rw-r--r--testsuites/ada/sptests/sp11/sp11.adb55
-rw-r--r--testsuites/ada/sptests/sp11/sptest.adb906
-rw-r--r--testsuites/ada/sptests/sp11/sptest.ads186
-rw-r--r--testsuites/ada/sptests/sp12/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp12/ada_sp12.scn78
-rw-r--r--testsuites/ada/sptests/sp12/config.h32
-rw-r--r--testsuites/ada/sptests/sp12/sp12.adb56
-rw-r--r--testsuites/ada/sptests/sp12/sptest.adb809
-rw-r--r--testsuites/ada/sptests/sp12/sptest.ads147
-rw-r--r--testsuites/ada/sptests/sp13/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp13/ada_sp13.scn78
-rw-r--r--testsuites/ada/sptests/sp13/config.h32
-rw-r--r--testsuites/ada/sptests/sp13/sp13.adb55
-rw-r--r--testsuites/ada/sptests/sp13/sptest.adb891
-rw-r--r--testsuites/ada/sptests/sp13/sptest.ads134
-rw-r--r--testsuites/ada/sptests/sp14/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp14/ada_sp14.scn33
-rw-r--r--testsuites/ada/sptests/sp14/config.h32
-rw-r--r--testsuites/ada/sptests/sp14/sp14.adb55
-rw-r--r--testsuites/ada/sptests/sp14/sptest.adb325
-rw-r--r--testsuites/ada/sptests/sp14/sptest.ads134
-rw-r--r--testsuites/ada/sptests/sp15/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp15/ada_sp15.scn16
-rw-r--r--testsuites/ada/sptests/sp15/config.h32
-rw-r--r--testsuites/ada/sptests/sp15/sp15.adb55
-rw-r--r--testsuites/ada/sptests/sp15/sptest.adb278
-rw-r--r--testsuites/ada/sptests/sp15/sptest.ads118
-rw-r--r--testsuites/ada/sptests/sp16/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp16/ada_sp16.scn58
-rw-r--r--testsuites/ada/sptests/sp16/config.h32
-rw-r--r--testsuites/ada/sptests/sp16/sp16.adb55
-rw-r--r--testsuites/ada/sptests/sp16/sptest.adb789
-rw-r--r--testsuites/ada/sptests/sp16/sptest.ads202
-rw-r--r--testsuites/ada/sptests/sp17/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp17/ada_sp17.scn8
-rw-r--r--testsuites/ada/sptests/sp17/config.h32
-rw-r--r--testsuites/ada/sptests/sp17/sp17.adb55
-rw-r--r--testsuites/ada/sptests/sp17/sptest.adb170
-rw-r--r--testsuites/ada/sptests/sp17/sptest.ads95
-rw-r--r--testsuites/ada/sptests/sp19/Makefile.am20
-rw-r--r--testsuites/ada/sptests/sp19/README19
-rw-r--r--testsuites/ada/sptests/sp19/ada_sp19.scn55
-rw-r--r--testsuites/ada/sptests/sp19/config.h30
-rw-r--r--testsuites/ada/sptests/sp19/sp19.adb55
-rw-r--r--testsuites/ada/sptests/sp19/sptest.adp397
-rw-r--r--testsuites/ada/sptests/sp19/sptest.ads119
-rw-r--r--testsuites/ada/sptests/sp20/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp20/ada_sp20.scn40
-rw-r--r--testsuites/ada/sptests/sp20/config.h31
-rw-r--r--testsuites/ada/sptests/sp20/sp20.adb54
-rw-r--r--testsuites/ada/sptests/sp20/sptest.adb310
-rw-r--r--testsuites/ada/sptests/sp20/sptest.ads105
-rw-r--r--testsuites/ada/sptests/sp22/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp22/ada_sp22.scn29
-rw-r--r--testsuites/ada/sptests/sp22/config.h31
-rw-r--r--testsuites/ada/sptests/sp22/sp22.adb55
-rw-r--r--testsuites/ada/sptests/sp22/sptest.adb297
-rw-r--r--testsuites/ada/sptests/sp22/sptest.ads93
-rw-r--r--testsuites/ada/sptests/sp23/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp23/ada_sp23.scn9
-rw-r--r--testsuites/ada/sptests/sp23/config.h31
-rw-r--r--testsuites/ada/sptests/sp23/sp23.adb55
-rw-r--r--testsuites/ada/sptests/sp23/sptest.adb175
-rw-r--r--testsuites/ada/sptests/sp23/sptest.ads118
-rw-r--r--testsuites/ada/sptests/sp24/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp24/ada_sp24.scn16
-rw-r--r--testsuites/ada/sptests/sp24/config.h31
-rw-r--r--testsuites/ada/sptests/sp24/sp24.adb55
-rw-r--r--testsuites/ada/sptests/sp24/sptest.adb167
-rw-r--r--testsuites/ada/sptests/sp24/sptest.ads83
-rw-r--r--testsuites/ada/sptests/sp25/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp25/ada_sp25.scn29
-rw-r--r--testsuites/ada/sptests/sp25/config.h31
-rw-r--r--testsuites/ada/sptests/sp25/sp25.adb55
-rw-r--r--testsuites/ada/sptests/sp25/sptest.adb362
-rw-r--r--testsuites/ada/sptests/sp25/sptest.ads103
-rw-r--r--testsuites/ada/sptests/spatcb01/Makefile.am16
-rw-r--r--testsuites/ada/sptests/spatcb01/ada_spatcb01.scn3
-rw-r--r--testsuites/ada/sptests/spatcb01/config.h16
-rw-r--r--testsuites/ada/sptests/spatcb01/spatcb01.adb26
-rw-r--r--testsuites/ada/sptests/spname01/Makefile.am18
-rw-r--r--testsuites/ada/sptests/spname01/ada_spname01.scn3
-rw-r--r--testsuites/ada/sptests/spname01/config.h31
-rw-r--r--testsuites/ada/sptests/spname01/spname01.adb28
-rw-r--r--testsuites/ada/sptests/spname01/sptest.adb62
-rw-r--r--testsuites/ada/sptests/spname01/sptest.ads25
145 files changed, 17679 insertions, 0 deletions
diff --git a/testsuites/ada/sptests/Makefile.am b/testsuites/ada/sptests/Makefile.am
new file mode 100644
index 0000000000..fda256fe4c
--- /dev/null
+++ b/testsuites/ada/sptests/Makefile.am
@@ -0,0 +1,28 @@
+_SUBDIRS =
+_SUBDIRS += sp01
+_SUBDIRS += sp02
+_SUBDIRS += sp03
+_SUBDIRS += sp04
+_SUBDIRS += sp05
+_SUBDIRS += sp06
+_SUBDIRS += sp07
+_SUBDIRS += sp08
+_SUBDIRS += sp09
+_SUBDIRS += sp11
+_SUBDIRS += sp12
+_SUBDIRS += sp13
+_SUBDIRS += sp14
+_SUBDIRS += sp15
+_SUBDIRS += sp16
+_SUBDIRS += sp17
+_SUBDIRS += sp19
+_SUBDIRS += sp20
+_SUBDIRS += sp22
+_SUBDIRS += sp23
+_SUBDIRS += sp24
+_SUBDIRS += sp25
+_SUBDIRS += spname01
+_SUBDIRS += spatcb01
+
+include $(top_srcdir)/../automake/subdirs.am
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp01/Makefile.am b/testsuites/ada/sptests/sp01/Makefile.am
new file mode 100644
index 0000000000..0fc6a6d6d6
--- /dev/null
+++ b/testsuites/ada/sptests/sp01/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp01
+ada_sp01_SOURCES = sp01.adb config.h sptest.adb sptest.ads
+ada_sp01_SOURCES += ../../support/init.c
+
+ada_sp01$(EXEEXT): sp01.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp01.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp01/ada_sp01.scn b/testsuites/ada/sptests/sp01/ada_sp01.scn
new file mode 100644
index 0000000000..7ba3bea626
--- /dev/null
+++ b/testsuites/ada/sptests/sp01/ada_sp01.scn
@@ -0,0 +1,16 @@
+*** TEST 1 ***
+TA1 - clock_get - 9: 0: 0 12/31/1988
+TA2 - clock_get - 9: 0: 0 12/31/1988
+TA3 - clock_get - 9: 0: 0 12/31/1988
+TA1 - clock_get - 9: 0: 5 12/31/1988
+TA1 - clock_get - 9: 0:10 12/31/1988
+TA2 - clock_get - 9: 0:10 12/31/1988
+TA1 - clock_get - 9: 0:15 12/31/1988
+TA3 - clock_get - 9: 0:15 12/31/1988
+TA1 - clock_get - 9: 0:20 12/31/1988
+TA2 - clock_get - 9: 0:20 12/31/1988
+TA1 - clock_get - 9: 0:25 12/31/1988
+TA1 - clock_get - 9: 0:30 12/31/1988
+TA3 - clock_get - 9: 0:30 12/31/1988
+TA2 - clock_get - 9: 0:30 12/31/1988
+*** END OF TEST 1 ***
diff --git a/testsuites/ada/sptests/sp01/config.h b/testsuites/ada/sptests/sp01/config.h
new file mode 100644
index 0000000000..3a11342306
--- /dev/null
+++ b/testsuites/ada/sptests/sp01/config.h
@@ -0,0 +1,30 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-1997.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp01/sp01.adb b/testsuites/ada/sptests/sp01/sp01.adb
new file mode 100644
index 0000000000..656a6ff009
--- /dev/null
+++ b/testsuites/ada/sptests/sp01/sp01.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP01 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP01 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP01;
+
diff --git a/testsuites/ada/sptests/sp01/sptest.adb b/testsuites/ada/sptests/sp01/sptest.adb
new file mode 100644
index 0000000000..46e48e9b04
--- /dev/null
+++ b/testsuites/ada/sptests/sp01/sptest.adb
@@ -0,0 +1,159 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 1 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with RTEMS.CLOCK;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 1 ***" );
+
+ TIME := ( 1988, 12, 31, 9, 0, 0, 0 );
+
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.INTERRUPT_LEVEL( 31 ),
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1_THROUGH_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_1_THROUGH_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_1_THROUGH_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1_THROUGH_3
+--
+
+ procedure TASK_1_THROUGH_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TID : RTEMS.ID;
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" );
+
+ loop
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ if TIME.SECOND >= 35 then
+ TEXT_IO.PUT_LINE( "*** END OF TEST 1 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
+ FALSE
+ );
+
+ TEST_SUPPORT.PRINT_TIME( "- clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.TASKS.WAKE_AFTER(
+ TEST_SUPPORT.TASK_NUMBER( TID ) * 5 *
+ TEST_SUPPORT.TICKS_PER_SECOND,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ end loop;
+
+ end TASK_1_THROUGH_3;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp01/sptest.ads b/testsuites/ada/sptests/sp01/sptest.ads
new file mode 100644
index 0000000000..8753d3edad
--- /dev/null
+++ b/testsuites/ada/sptests/sp01/sptest.ads
@@ -0,0 +1,60 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 1 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1_THROUGH_3
+--
+-- DESCRIPTION:
+--
+-- This is the body of the RTEMS tasks which constitute this test.
+--
+
+ procedure TASK_1_THROUGH_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1_THROUGH_3);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp02/Makefile.am b/testsuites/ada/sptests/sp02/Makefile.am
new file mode 100644
index 0000000000..7e681207ef
--- /dev/null
+++ b/testsuites/ada/sptests/sp02/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp02
+ada_sp02_SOURCES = sp02.adb config.h sptest.adb sptest.ads
+ada_sp02_SOURCES += ../../support/init.c
+
+ada_sp02$(EXEEXT): sp02.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp02.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp02/ada_sp02.scn b/testsuites/ada/sptests/sp02/ada_sp02.scn
new file mode 100644
index 0000000000..722dfff1de
--- /dev/null
+++ b/testsuites/ada/sptests/sp02/ada_sp02.scn
@@ -0,0 +1,15 @@
+*** TEST 2 ***
+INIT - task_wake_after - yielding processor
+PREEMPT - task_delete - deleting self
+INIT - suspending TA2 while middle task on a ready chain
+TA1 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 minute
+TA3 - task_wake_after - sleep 5 seconds
+TA1 - task_ident - tid of TA2 (16#A010004#)
+TA1 - task_ident - tid of TA3 (16#A010002#)
+TA1 - task_set_priority - set TA3's priority to 2
+TA1 - task_suspend - suspend TA2
+TA1 - task_delete - delete TA2
+TA1 - task_wake_after - sleep for 5 seconds
+TA3 - task_delete - delete self
+*** END OF TEST 2 ***
diff --git a/testsuites/ada/sptests/sp02/config.h b/testsuites/ada/sptests/sp02/config.h
new file mode 100644
index 0000000000..17d957c94a
--- /dev/null
+++ b/testsuites/ada/sptests/sp02/config.h
@@ -0,0 +1,30 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp02/sp02.adb b/testsuites/ada/sptests/sp02/sp02.adb
new file mode 100644
index 0000000000..adbc97f66c
--- /dev/null
+++ b/testsuites/ada/sptests/sp02/sp02.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP02 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP02 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP02;
+
diff --git a/testsuites/ada/sptests/sp02/sptest.adb b/testsuites/ada/sptests/sp02/sptest.adb
new file mode 100644
index 0000000000..45fb4ac5c2
--- /dev/null
+++ b/testsuites/ada/sptests/sp02/sptest.adb
@@ -0,0 +1,327 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 2 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 2 ***" );
+
+ SPTEST.PREEMPT_TASK_NAME := RTEMS.BUILD_NAME( 'P', 'R', 'M', 'T' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.PREEMPT_TASK_NAME,
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.PREEMPT_TASK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF PREEMPT" );
+
+ RTEMS.TASKS.START(
+ SPTEST.PREEMPT_TASK_ID,
+ SPTEST.PREEMPT_TASK'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF PREEMPT" );
+
+ TEXT_IO.PUT_LINE( "INIT - task_wake_after - yielding processor" );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 3,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 3,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 3,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ TEXT_IO.PUT_LINE(
+ "INIT - suspending TA2 while middle task on a ready chain"
+ );
+
+ RTEMS.TASKS.SUSPEND( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA1" );
+
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" );
+
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA3" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 3,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 3,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- PREEMPT_TASK
+--
+
+ procedure PREEMPT_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "PREEMPT - task_delete - deleting self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF PREEMPT" );
+
+ end PREEMPT_TASK;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TID2 : RTEMS.ID;
+ TID3 : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 1 second" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ RTEMS.TASKS.IDENT(
+ SPTEST.TASK_NAME( 2 ),
+ RTEMS.SEARCH_ALL_NODES,
+ TID2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA2" );
+
+ TEXT_IO.PUT( "TA1 - task_ident - tid of TA2 (" );
+ UNSIGNED32_IO.PUT( TID2, WIDTH => 8, BASE => 10#16# );
+ TEXT_IO.PUT_LINE( ")" );
+
+ RTEMS.TASKS.IDENT(
+ SPTEST.TASK_NAME( 3 ),
+ RTEMS.SEARCH_ALL_NODES,
+ TID3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA3" );
+
+ TEXT_IO.PUT( "TA1 - task_ident - tid of TA3 (" );
+ UNSIGNED32_IO.PUT( TID3, WIDTH => 8, BASE => 10#16# );
+ TEXT_IO.PUT_LINE( ")" );
+
+ RTEMS.TASKS.SET_PRIORITY( TID3, 2, PREVIOUS_PRIORITY, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_set_priority - set TA3's priority to 2"
+ );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - suspend TA2" );
+ RTEMS.TASKS.SUSPEND( TID2, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - delete TA2" );
+ RTEMS.TASKS.DELETE( TID2, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep for 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 2 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA2 - task_wake_after - sleep 1 minute" );
+ RTEMS.TASKS.WAKE_AFTER( 60 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER IN TA2" );
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA3 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER IN TA3" );
+
+ TEXT_IO.PUT_LINE( "TA3 - task_delete - delete self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA3" );
+
+ end TASK_3;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp02/sptest.ads b/testsuites/ada/sptests/sp02/sptest.ads
new file mode 100644
index 0000000000..20122e3cbd
--- /dev/null
+++ b/testsuites/ada/sptests/sp02/sptest.ads
@@ -0,0 +1,102 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 2 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+ PREEMPT_TASK_ID : RTEMS.ID;
+ PREEMPT_TASK_NAME : RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- PREEMPT_TASK
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the basic preemption capability.
+--
+
+ procedure PREEMPT_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, PREEMPT_TASK);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp03/Makefile.am b/testsuites/ada/sptests/sp03/Makefile.am
new file mode 100644
index 0000000000..9a7ccfa1b8
--- /dev/null
+++ b/testsuites/ada/sptests/sp03/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp03
+ada_sp03_SOURCES = sp03.adb config.h sptest.adb sptest.ads
+ada_sp03_SOURCES += ../../support/init.c
+
+ada_sp03$(EXEEXT): sp03.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp03.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp03/ada_sp03.scn b/testsuites/ada/sptests/sp03/ada_sp03.scn
new file mode 100644
index 0000000000..a2a04c6951
--- /dev/null
+++ b/testsuites/ada/sptests/sp03/ada_sp03.scn
@@ -0,0 +1,26 @@
+*** TEST 3 ***
+TA1 sets clock: 9:15: 0 12/31/1988
+TA1 going to sleep: 9:15: 0 12/31/1988
+TA2 9:15: 1 12/31/1988
+TA2 9:15: 2 12/31/1988
+TA2 9:15: 3 12/31/1988
+TA2 9:15: 4 12/31/1988
+TA1 awakened: 9:15: 5 12/31/1988
+TA1 going to sleep: 9:15: 5 12/31/1988
+TA2 9:15: 5 12/31/1988
+TA2 9:15: 6 12/31/1988
+TA2 9:15: 7 12/31/1988
+TA2 9:15: 8 12/31/1988
+TA2 9:15: 9 12/31/1988
+TA1 awakened: 9:15:10 12/31/1988
+TA1 going to sleep: 9:15:10 12/31/1988
+TA2 9:15:10 12/31/1988
+TA2 9:15:11 12/31/1988
+TA2 9:15:12 12/31/1988
+TA2 9:15:13 12/31/1988
+TA2 9:15:14 12/31/1988
+TA1 awakened: 9:15:15 12/31/1988
+TA1 going to sleep: 9:15:15 12/31/1988
+TA2 9:15:15 12/31/1988
+TA2 9:15:16 12/31/1988
+*** END OF TEST 3 ***
diff --git a/testsuites/ada/sptests/sp03/config.h b/testsuites/ada/sptests/sp03/config.h
new file mode 100644
index 0000000000..393afc4b28
--- /dev/null
+++ b/testsuites/ada/sptests/sp03/config.h
@@ -0,0 +1,30 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 3
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp03/sp03.adb b/testsuites/ada/sptests/sp03/sp03.adb
new file mode 100644
index 0000000000..5f081d4879
--- /dev/null
+++ b/testsuites/ada/sptests/sp03/sp03.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP03 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP03 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP03;
+
diff --git a/testsuites/ada/sptests/sp03/sptest.adb b/testsuites/ada/sptests/sp03/sptest.adb
new file mode 100644
index 0000000000..24be47eb1c
--- /dev/null
+++ b/testsuites/ada/sptests/sp03/sptest.adb
@@ -0,0 +1,169 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 3 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with RTEMS.CLOCK;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 3 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TIME := ( 1988, 12, 31, 9, 15, 0, 0 );
+
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" );
+
+ TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( 1 ), FALSE );
+ TEST_SUPPORT.PRINT_TIME( "sets clock: ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ loop
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( 1 ), FALSE );
+ TEST_SUPPORT.PRINT_TIME( "going to sleep: ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ TIME.SECOND := TIME.SECOND + 5;
+ TIME.MINUTE := TIME.MINUTE + (TIME.SECOND / 60 );
+ TIME.SECOND := TIME.SECOND mod 60;
+ TIME.HOUR := TIME.HOUR + (TIME.MINUTE / 60 );
+ TIME.MINUTE := TIME.MINUTE mod 60;
+ TIME.HOUR := TIME.HOUR mod 24;
+
+ RTEMS.TASKS.WAKE_WHEN( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_WHEN" );
+
+ TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( 1 ), FALSE );
+ TEST_SUPPORT.PRINT_TIME( "awakened: ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ end loop;
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ loop
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ if TIME.SECOND >= 17 then
+ TEXT_IO.PUT_LINE( "*** END OF TEST 3 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( 2 ), FALSE );
+ TEST_SUPPORT.PRINT_TIME( " ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ end loop;
+
+ end TASK_2;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp03/sptest.ads b/testsuites/ada/sptests/sp03/sptest.ads
new file mode 100644
index 0000000000..60a2531ba1
--- /dev/null
+++ b/testsuites/ada/sptests/sp03/sptest.ads
@@ -0,0 +1,75 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 3 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the TASK_WAKE_WHEN directive of
+-- the Task Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the TASK_WAKE_AFTER directive of
+-- the Task Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp04/Makefile.am b/testsuites/ada/sptests/sp04/Makefile.am
new file mode 100644
index 0000000000..fc5d2be018
--- /dev/null
+++ b/testsuites/ada/sptests/sp04/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp04
+ada_sp04_SOURCES = sp04.adb config.h sptest.adb sptest.ads
+ada_sp04_SOURCES += ../../support/init.c
+
+ada_sp04$(EXEEXT): sp04.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp04.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp04/README b/testsuites/ada/sptests/sp04/README
new file mode 100644
index 0000000000..43ff165261
--- /dev/null
+++ b/testsuites/ada/sptests/sp04/README
@@ -0,0 +1,9 @@
+This test is broken as it is currently implemented. It is illegal for
+a task to do Ada IO during a extension since the Ada run-time uses
+locks to safeguard data structures. Dispatching is disabled and the
+call to Text_IO in the Switch extension will lock the system up.
+
+The proper solution is to have the Switch extension lock task and
+time when it a switch occurs and have a single task print this
+information as necessary.
+
diff --git a/testsuites/ada/sptests/sp04/ada_sp04.scn b/testsuites/ada/sptests/sp04/ada_sp04.scn
new file mode 100644
index 0000000000..76d9f0c665
--- /dev/null
+++ b/testsuites/ada/sptests/sp04/ada_sp04.scn
@@ -0,0 +1,25 @@
+*** TEST 4 ***
+TA1 - task_suspend - on Task 2
+TA1 - task_suspend - on Task 3
+TA1 - killing time
+TA1 - task_resume - on Task 2
+TA1 - task_resume - on Task 3
+TA1 - task_mode - change mode to NO PREEMPT
+TA1 - 9:15:10 12/31/1988
+TA1 - 9:15:11 12/31/1988
+TA1 - 9:15:12 12/31/1988
+TA1 - 9:15:13 12/31/1988
+TA1 - 9:15:14 12/31/1988
+TA1 - 9:15:15 12/31/1988
+TA1 - task_mode - change mode to PREEMPT
+TA1 - 9:15: 0 12/31/1988
+TA2 - 9:15: 4 12/31/1988
+TA3 - 9:15: 5 12/31/1988
+TA1 - 9:15: 6 12/31/1988
+TA2 - 9:15: 7 12/31/1988
+TA3 - 9:15: 8 12/31/1988
+TA1 - 9:15: 9 12/31/1988
+TA2 - 9:15:16 12/31/1988
+TA3 - 9:15:17 12/31/1988
+TA1 - 9:15:18 12/31/1988
+*** END OF TEST 4 ***
diff --git a/testsuites/ada/sptests/sp04/config.h b/testsuites/ada/sptests/sp04/config.h
new file mode 100644
index 0000000000..45fc324df8
--- /dev/null
+++ b/testsuites/ada/sptests/sp04/config.h
@@ -0,0 +1,33 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-1997.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp04/sp04.adb b/testsuites/ada/sptests/sp04/sp04.adb
new file mode 100644
index 0000000000..9d91593b36
--- /dev/null
+++ b/testsuites/ada/sptests/sp04/sp04.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP04 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP04 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP04;
+
diff --git a/testsuites/ada/sptests/sp04/sptest.adb b/testsuites/ada/sptests/sp04/sptest.adb
new file mode 100644
index 0000000000..01283d3fec
--- /dev/null
+++ b/testsuites/ada/sptests/sp04/sptest.adb
@@ -0,0 +1,348 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 4 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with RTEMS.CLOCK;
+with RTEMS.EXTENSION;
+with RTEMS.FATAL;
+
+package body SPTEST is
+
+ TestsFinished : Boolean := False;
+ pragma Volatile (TestsFinished);
+
+ type Task_Event is record
+ Task_Index : RTEMS.Unsigned32;
+ When_Switched : RTEMS.Time_Of_Day;
+ end record;
+
+ Task_Events : array (1 .. 15) of Task_Event;
+ Task_Events_Index : Natural := Task_Events'First;
+
+ procedure Log_Task_Event (
+ Task_Index : RTEMS.Unsigned32;
+ When_Switched : RTEMS.Time_Of_Day
+ ) is
+ begin
+ if Task_Events_Index = Task_Events'Last then
+ RTEMS.Fatal.Error_Occurred ( 1 ); -- no other choice
+ else
+ Task_Events (Task_Events_Index).Task_Index := Task_Index;
+ Task_Events (Task_Events_Index).When_Switched := When_Switched;
+ Task_Events_Index := Task_Events_Index + 1;
+ end if;
+ end Log_Task_Event;
+
+ procedure Flush_Task_Event_Log is
+ begin
+ for I in Task_Events'First .. Task_Events_Index - 1 loop
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( Task_Events (I).Task_Index ), FALSE
+ );
+ TEST_SUPPORT.PRINT_TIME( "- ", Task_Events (I).When_Switched, "" );
+ TEXT_IO.NEW_LINE;
+
+ end loop;
+
+ end Flush_Task_Event_Log;
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 4 ***" );
+
+ TIME := ( 1988, 12, 31, 9, 15, 0, 0 );
+
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" );
+
+ SPTEST.EXTENSION_NAME( 1 ) := RTEMS.BUILD_NAME( 'E', 'X', 'T', ' ' );
+
+ RTEMS.EXTENSION.CREATE(
+ SPTEST.EXTENSION_NAME( 1 ),
+ SPTEST.EXTENSIONS'ACCESS,
+ EXTENSION_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EXTENSION_CREATE" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+
+ SPTEST.RUN_COUNT( 1 ) := 0;
+ SPTEST.RUN_COUNT( 2 ) := 0;
+ SPTEST.RUN_COUNT( 3 ) := 0;
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.TIMESLICE,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ 2048,
+ RTEMS.TIMESLICE,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 1,
+ 2048,
+ RTEMS.TIMESLICE,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ SECONDS : RTEMS.UNSIGNED32;
+ OLD_SECONDS : RTEMS.UNSIGNED32;
+ PREVIOUS_MODE : RTEMS.MODE;
+ TIME : RTEMS.TIME_OF_DAY;
+ START_TIME : RTEMS.INTERVAL;
+ END_TIME : RTEMS.INTERVAL;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - on Task 2" );
+ RTEMS.TASKS.SUSPEND( TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - on Task 3" );
+ RTEMS.TASKS.SUSPEND( TASK_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA3" );
+
+ TEXT_IO.PUT_LINE( "TA1 - killing time" );
+
+ RTEMS.CLOCK.GET_SECONDS_SINCE_EPOCH( START_TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_SECONDS_SINCE_EPOCH" );
+
+ loop
+ RTEMS.CLOCK.GET_SECONDS_SINCE_EPOCH( START_TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(STATUS, "CLOCK_GET_SECONDS_SINCE_EPOCH");
+
+ exit when END_TIME > (START_TIME + 2);
+ end loop;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_resume - on Task 2" );
+ RTEMS.TASKS.RESUME( TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_resume - on Task 3" );
+ RTEMS.TASKS.RESUME( TASK_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME OF TA3" );
+
+ loop
+
+ if SPTEST.RUN_COUNT( 1 ) = 3 then
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_mode - change mode to NO PREEMPT"
+ );
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_PREEMPT,
+ RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ OLD_SECONDS := TIME.SECOND;
+
+ SECONDS := 0;
+ loop
+
+ exit when SECONDS >= 6;
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ if TIME.SECOND /= OLD_SECONDS then
+ OLD_SECONDS := TIME.SECOND;
+ SECONDS := SECONDS + 1;
+ TEST_SUPPORT.PRINT_TIME( "TA1 - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+ end if;
+
+ end loop;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_mode - change mode to PREEMPT"
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.PREEMPT,
+ RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+
+ while not TestsFinished loop
+ NULL;
+ END LOOP;
+ Flush_Task_Event_Log;
+ TEXT_IO.PUT_LINE( "*** END OF TEST 4 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end if;
+
+ end loop;
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ begin
+
+ LOOP
+ NULL;
+ END LOOP;
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ begin
+
+ LOOP
+ NULL;
+ END LOOP;
+
+ end TASK_3;
+
+--
+-- TASK_SWITCH
+--
+
+ procedure TASK_SWITCH (
+ UNUSED : in RTEMS.TCB_POINTER;
+ HEIR : in RTEMS.TCB_POINTER
+ ) is
+ pragma Unreferenced(UNUSED);
+ INDEX : RTEMS.UNSIGNED32;
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ function TCB_To_ID (
+ TCB : RTEMS.TCB_POINTER
+ ) return RTEMS.ID;
+ pragma Import (C, TCB_To_ID, "tcb_to_id" );
+
+ begin
+
+ INDEX := TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( HEIR ) );
+
+ case INDEX is
+ when 1 | 2 | 3 =>
+ SPTEST.RUN_COUNT( INDEX ) := SPTEST.RUN_COUNT( INDEX ) + 1;
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ Log_Task_Event ( INDEX, TIME );
+
+ if TIME.SECOND >= 16 then
+ TestsFinished := True;
+ end if;
+
+ when others =>
+ NULL;
+ end case;
+
+ end TASK_SWITCH;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp04/sptest.ads b/testsuites/ada/sptests/sp04/sptest.ads
new file mode 100644
index 0000000000..36f1202118
--- /dev/null
+++ b/testsuites/ada/sptests/sp04/sptest.ads
@@ -0,0 +1,136 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 4 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS extensions created
+-- by this test.
+--
+
+ EXTENSION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ EXTENSION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- This array contains the number of times each of the test tasks has
+-- been context switched TO.
+--
+
+ RUN_COUNT : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.UNSIGNED32;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task is used as a background task to suspend, resume,
+-- and context switch to.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task is used as a background task to suspend, resume,
+-- and context switch to.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+--
+-- TASK_SWITCH
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the TASK_SWITCH extension for this test.
+-- It is invoked at each context switch and counts the number
+-- of times each application task has been context switched to.
+--
+
+ procedure TASK_SWITCH (
+ UNUSED : in RTEMS.TCB_POINTER;
+ HEIR : in RTEMS.TCB_POINTER
+ );
+ pragma Convention (C, TASK_SWITCH);
+
+--
+-- This is the User Extension Table for this test.
+--
+
+ EXTENSIONS : aliased RTEMS.EXTENSIONS_TABLE :=
+ (
+ NULL, -- Task create
+ NULL, -- Task start
+ NULL, -- Task restart
+ NULL, -- Task delete
+ SPTEST.TASK_SWITCH'ACCESS, -- Task switch
+ NULL, -- Task post switch
+ NULL, -- Task begin
+ NULL, -- Task exitted
+ NULL -- Fatal error
+ );
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp05/Makefile.am b/testsuites/ada/sptests/sp05/Makefile.am
new file mode 100644
index 0000000000..d206e1b5da
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp05
+ada_sp05_SOURCES = sp05.adb config.h sptest.adb sptest.ads
+ada_sp05_SOURCES += ../../support/init.c
+
+ada_sp05$(EXEEXT): sp05.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp05.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp05/ada_sp05.scn b/testsuites/ada/sptests/sp05/ada_sp05.scn
new file mode 100644
index 0000000000..591397f760
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/ada_sp05.scn
@@ -0,0 +1,47 @@
+*** TEST 5 ***
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - task_suspend - suspend self
+TA3 - task_suspend - suspend self
+TA1 - task_suspend - suspend TA3
+TA1 - task_resume - resume TA2
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA2
+TA1 - task_resume - resume TA3
+TA1 - task_wake_after - sleep 5 seconds
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA3
+TA1 - task_resume - resume TA2
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA2
+TA1 - task_resume - resume TA3
+TA1 - task_wake_after - sleep 5 seconds
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA3
+TA1 - task_resume - resume TA2
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA2
+TA1 - task_resume - resume TA3
+*** END OF TEST 5 ***
diff --git a/testsuites/ada/sptests/sp05/config.h b/testsuites/ada/sptests/sp05/config.h
new file mode 100644
index 0000000000..d85c77e62b
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp05/sp05.adb b/testsuites/ada/sptests/sp05/sp05.adb
new file mode 100644
index 0000000000..842657a699
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/sp05.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP05 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP05 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP05;
+
diff --git a/testsuites/ada/sptests/sp05/sptest.adb b/testsuites/ada/sptests/sp05/sptest.adb
new file mode 100644
index 0000000000..1a9b974419
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/sptest.adb
@@ -0,0 +1,224 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 5 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 5 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TID2 : RTEMS.ID;
+ TID3 : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.IDENT(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ TID2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA2" );
+
+ RTEMS.TASKS.IDENT(
+ SPTEST.TASK_NAME( 3 ),
+ 1,
+ TID3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA3" );
+
+ for PASS in 1 .. 3
+ loop
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER OF TA1" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - suspend TA3" );
+ RTEMS.TASKS.SUSPEND( TID3, STATUS );
+ if PASS = 1 then
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.ALREADY_SUSPENDED,
+ "TASK_SUSPEND OF TA3"
+ );
+ else
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA3" );
+ end if;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_resume - resume TA2" );
+ RTEMS.TASKS.RESUME( TID2, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - suspend TA2" );
+ RTEMS.TASKS.SUSPEND( TID2, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_resume - resume TA3" );
+ RTEMS.TASKS.RESUME( TID3, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME OF TA3" );
+
+ end loop;
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 5 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA2 - task_suspend - suspend self" );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ loop
+ TEXT_IO.PUT_LINE( "TA2 - task_wake_after - sleep 1 second" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER OF TA2" );
+ end loop;
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA3 - task_suspend - suspend self" );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA3" );
+
+ loop
+ TEXT_IO.PUT_LINE( "TA3 - task_wake_after - sleep 1 second" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER OF TA3" );
+ end loop;
+
+ end TASK_3;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp05/sptest.ads b/testsuites/ada/sptests/sp05/sptest.ads
new file mode 100644
index 0000000000..9fe136ec8b
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/sptest.ads
@@ -0,0 +1,86 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 5 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Message Queue Manager.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp06/Makefile.am b/testsuites/ada/sptests/sp06/Makefile.am
new file mode 100644
index 0000000000..145423b0b4
--- /dev/null
+++ b/testsuites/ada/sptests/sp06/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp06
+ada_sp06_SOURCES = sp06.adb config.h sptest.adb sptest.ads
+ada_sp06_SOURCES += ../../support/init.c
+
+ada_sp06$(EXEEXT): sp06.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp06.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp06/ada_sp06.scn b/testsuites/ada/sptests/sp06/ada_sp06.scn
new file mode 100644
index 0000000000..8dc6c6afae
--- /dev/null
+++ b/testsuites/ada/sptests/sp06/ada_sp06.scn
@@ -0,0 +1,38 @@
+*** TEST 6 ***
+TA1 - is beginning to run
+TA1 - restarting TA3
+TA2 - is beginning to run
+TA2 - task_wake_after - sleep 1/2 second
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - task_wake_after - sleep 1/2 second
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - task_restart - restarting self
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - is beginning to run
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - task_wake_after - sleep 1/2 second
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - task_restart - restarting self
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - is beginning to run
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - task_wake_after - sleep 1/2 second
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - task_restart - restarting self
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - is beginning to run
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - task_restart - restarting TA2
+TA2 - is beginning to run
+TA2 - task_wake_after - sleep 1/2 second
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - task_restart - restarting self
+TA2 - task_wake_after - sleep 1/2 second
+TA1 - is beginning to run
+*** END OF TEST 6 ***
diff --git a/testsuites/ada/sptests/sp06/config.h b/testsuites/ada/sptests/sp06/config.h
new file mode 100644
index 0000000000..d85c77e62b
--- /dev/null
+++ b/testsuites/ada/sptests/sp06/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp06/sp06.adb b/testsuites/ada/sptests/sp06/sp06.adb
new file mode 100644
index 0000000000..4caba9ae73
--- /dev/null
+++ b/testsuites/ada/sptests/sp06/sp06.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP06 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP06 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP06;
+
diff --git a/testsuites/ada/sptests/sp06/sptest.adb b/testsuites/ada/sptests/sp06/sptest.adb
new file mode 100644
index 0000000000..f19fd068ee
--- /dev/null
+++ b/testsuites/ada/sptests/sp06/sptest.adb
@@ -0,0 +1,216 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 6 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 6 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+
+ SPTEST.ARGUMENT := 0;
+ SPTEST.RESTART_ARGUMENT := 1;
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 10,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ SPTEST.ARGUMENT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ SPTEST.ARGUMENT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.SET_PRIORITY(
+ SPTEST.TASK_ID( 3 ),
+ 5,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY OF TA3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ PASS : RTEMS.UNSIGNED32;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA1 - is beginning to run" );
+
+ PASS := ARGUMENT + 1;
+
+ if PASS = 5 then
+ TEXT_IO.PUT_LINE( "*** END OF TEST 6 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ if PASS = 1 then
+ TEXT_IO.PUT_LINE( "TA1 - restarting TA3" );
+ RTEMS.TASKS.RESTART(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.RESTART_ARGUMENT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESTART OF TA3" );
+
+ RTEMS.TASKS.WAKE_AFTER( 2 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ end if;
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_restart - restarting TA2" );
+ RTEMS.TASKS.RESTART(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.RESTART_ARGUMENT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESTART OF TA2" );
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_restart - restarting self" );
+ RTEMS.TASKS.RESTART( SPTEST.TASK_ID( 1 ), PASS, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESTART OF SELF" );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA2 - is beginning to run" );
+
+ if ARGUMENT = SPTEST.ARGUMENT then
+ RTEMS.TASKS.WAKE_AFTER( 2 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+ end if;
+
+ loop
+
+ TEXT_IO.PUT_LINE( "TA2 - task_wake_after - sleep 1/2 second" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND / 2, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ end loop;
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end TASK_3;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp06/sptest.ads b/testsuites/ada/sptests/sp06/sptest.ads
new file mode 100644
index 0000000000..29fa897210
--- /dev/null
+++ b/testsuites/ada/sptests/sp06/sptest.ads
@@ -0,0 +1,93 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 6 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- The following are used as arguments to the various RTEMS tasks
+-- in this test to indicate when a restart should be performed.
+
+ ARGUMENT : RTEMS.UNSIGNED32;
+ RESTART_ARGUMENT : RTEMS.UNSIGNED32;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp07/Makefile.am b/testsuites/ada/sptests/sp07/Makefile.am
new file mode 100644
index 0000000000..076b97d64c
--- /dev/null
+++ b/testsuites/ada/sptests/sp07/Makefile.am
@@ -0,0 +1,17 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp07
+
+ada_sp07_SOURCES = sp07.adb config.h sptest.adb sptest.ads
+ada_sp07_SOURCES += ../../support/init.c
+
+ada_sp07$(EXEEXT): sp07.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp07.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp07/ada_sp07.scn b/testsuites/ada/sptests/sp07/ada_sp07.scn
new file mode 100644
index 0000000000..9748dda74c
--- /dev/null
+++ b/testsuites/ada/sptests/sp07/ada_sp07.scn
@@ -0,0 +1,23 @@
+*** TEST 7 ***
+TASKS_CREATE - TA1 - created.
+TASKS_CREATE - TA2 - created.
+TASKS_CREATE - TA3 - created.
+TASKS_CREATE - TA4 - created.
+TASKS_START - TA1 - started.
+TASKS_START - TA2 - started.
+TASKS_START - TA3 - started.
+TASKS_START - TA4 - started.
+TASKS_RESTART - TA3 - restarted.
+<pause>
+TA1 - task_set_priority - get initial priority of self: 4
+TA1 - task_set_priority - set TA2's priority: 3
+TA2 - task_set_priority - set TA1's priority: 2
+TA1 - task_set_priority - set TA2's priority: 1
+TA2 - task_suspend - suspend TA1
+TA2 - task_set_priority - set priority of TA1 ( blocked )
+TASKS_DELETE - TA2 deleting TA1
+TASKS_DELETE - TA2 deleting TA3
+TASKS_DELETE - TA2 deleting TA2
+TA4 - exitting task
+TASK_EXITTED - user extension invoked correctly
+*** END OF TEST 7 ***
diff --git a/testsuites/ada/sptests/sp07/config.h b/testsuites/ada/sptests/sp07/config.h
new file mode 100644
index 0000000000..2aa307a46c
--- /dev/null
+++ b/testsuites/ada/sptests/sp07/config.h
@@ -0,0 +1,33 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 5
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp07/sp07.adb b/testsuites/ada/sptests/sp07/sp07.adb
new file mode 100644
index 0000000000..177de946b8
--- /dev/null
+++ b/testsuites/ada/sptests/sp07/sp07.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP07 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP07 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP07;
+
diff --git a/testsuites/ada/sptests/sp07/sptest.adb b/testsuites/ada/sptests/sp07/sptest.adb
new file mode 100644
index 0000000000..d55aa73bf8
--- /dev/null
+++ b/testsuites/ada/sptests/sp07/sptest.adb
@@ -0,0 +1,513 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 7 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.EXTENSION;
+with RTEMS.FATAL;
+
+package body SPTEST is
+
+ type Task_Event_Type is (
+ Created,
+ Deleted,
+ Restarted,
+ Started
+ );
+
+ type Task_Event is record
+ The_Event : Task_Event_Type;
+ Task1 : RTEMS.Unsigned32;
+ Task2 : RTEMS.Unsigned32;
+ end record;
+
+ Task_Events : array (1 .. 10) of Task_Event;
+ Task_Events_Index : Natural := Task_Events'First;
+
+ procedure Log_Task_Event (
+ The_Event : in Task_Event_Type;
+ Task1 : in RTEMS.Unsigned32;
+ Task2 : in RTEMS.Unsigned32
+ ) is
+ begin
+ if Task_Events_Index = Task_Events'Last then
+ RTEMS.Fatal.Error_Occurred ( 1 ); -- no other choice
+ else
+ Task_Events (Task_Events_Index).The_Event := The_Event;
+ Task_Events (Task_Events_Index).Task1 := Task1;
+ Task_Events (Task_Events_Index).Task2 := Task2;
+ Task_Events_Index := Task_Events_Index + 1;
+ end if;
+ end Log_Task_Event;
+
+ procedure Flush_Task_Event_Log is
+ begin
+ for I in Task_Events'First .. Task_Events_Index - 1 loop
+
+ case Task_Events (I).The_Event is
+
+ when Created =>
+ TEXT_IO.PUT( "TASKS_CREATE - " );
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( Task_Events (I).Task1 ),
+ FALSE
+ );
+ TEXT_IO.PUT_LINE( " - created." );
+
+ when Deleted =>
+ TEXT_IO.PUT( "TASKS_DELETE - " );
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( Task_Events (I).Task1 ),
+ FALSE
+ );
+
+ TEXT_IO.PUT( " deleting " );
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( Task_Events (I).Task2 ),
+ TRUE
+ );
+
+ when Restarted =>
+ TEXT_IO.PUT( "TASKS_RESTART - " );
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( Task_Events (I).Task1 ),
+ FALSE
+ );
+ TEXT_IO.PUT_LINE( " - restarted." );
+
+ when Started =>
+ TEXT_IO.PUT( "TASKS_START - " );
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( Task_Events (I).Task1 ),
+ FALSE
+ );
+ TEXT_IO.PUT_LINE( " - started." );
+
+ end case;
+ end loop;
+
+ -- Reset the events list
+ Task_Events_Index := Task_Events'First;
+
+ end Flush_Task_Event_Log;
+
+--
+-- TCB_To_ID
+--
+
+ function TCB_To_ID (
+ TCB : RTEMS.TCB_POINTER
+ ) return RTEMS.ID;
+ pragma Import (C, TCB_To_ID, "tcb_to_id" );
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 7 ***" );
+
+ SPTEST.EXTENSION_NAME( 1 ) := RTEMS.BUILD_NAME( 'E', 'X', 'T', ' ' );
+
+ RTEMS.EXTENSION.CREATE(
+ SPTEST.EXTENSION_NAME( 1 ),
+ SPTEST.EXTENSIONS'ACCESS,
+ EXTENSION_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EXTENSION_CREATE" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+ SPTEST.TASK_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'A', '4', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 4,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 4,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 250,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 4 ),
+ 254,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 4 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA4" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 4 ),
+ SPTEST.TASK_4'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA4" );
+
+ RTEMS.TASKS.RESTART( SPTEST.TASK_ID( 3 ), 0, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESTART OF TA3" );
+
+ Flush_Task_Event_Log;
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ THE_PRIORITY : RTEMS.TASKS.PRIORITY;
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ begin
+
+ TEST_SUPPORT.PAUSE;
+
+ RTEMS.TASKS.SET_PRIORITY(
+ RTEMS.SELF,
+ RTEMS.TASKS.CURRENT_PRIORITY,
+ THE_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
+ TEXT_IO.PUT( "TA1 - task_set_priority - ");
+ TEXT_IO.PUT( "get initial priority of self: ");
+ UNSIGNED32_IO.PUT( THE_PRIORITY, BASE => 10, WIDTH => 2 );
+ TEXT_IO.NEW_LINE;
+
+ loop
+
+ THE_PRIORITY := THE_PRIORITY - 1;
+
+ if THE_PRIORITY = 0 then
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - suspend TA2" );
+ RTEMS.TASKS.SUSPEND( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ TEXT_IO.PUT( "TA1 - task_set_priority - ");
+ TEXT_IO.PUT_LINE( "set priority of TA2 ( blocked )");
+ RTEMS.TASKS.SET_PRIORITY(
+ SPTEST.TASK_ID( 2 ),
+ 5,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
+
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end if;
+
+ TEXT_IO.PUT("TA1 - task_set_priority - set TA2's priority: ");
+ UNSIGNED32_IO.PUT( THE_PRIORITY, BASE => 10, WIDTH => 2 );
+ TEXT_IO.NEW_LINE;
+ RTEMS.TASKS.SET_PRIORITY(
+ SPTEST.TASK_ID( 2 ),
+ THE_PRIORITY,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
+
+ end loop;
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ THE_PRIORITY : RTEMS.TASKS.PRIORITY;
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ begin
+
+ loop
+
+ THE_PRIORITY := THE_PRIORITY - 1;
+
+ if THE_PRIORITY = 0 then
+ TEXT_IO.PUT_LINE( "TA2 - task_suspend - suspend TA1" );
+ RTEMS.TASKS.SUSPEND( SPTEST.TASK_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ TEXT_IO.PUT( "TA2 - task_set_priority - ");
+ TEXT_IO.PUT_LINE( "set priority of TA1 ( blocked )");
+ RTEMS.TASKS.SET_PRIORITY(
+ SPTEST.TASK_ID( 1 ),
+ 5,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
+
+ RTEMS.TASKS.DELETE(
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ ); -- TA1 is blocked
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA1" );
+
+ RTEMS.TASKS.DELETE(
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ ); -- TA3 is ready
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ else
+
+ TEXT_IO.PUT( "TA2 - task_set_priority - ");
+ TEXT_IO.PUT( "set TA1's priority: ");
+ UNSIGNED32_IO.PUT( THE_PRIORITY, BASE => 10, WIDTH => 2);
+ TEXT_IO.NEW_LINE;
+ RTEMS.TASKS.SET_PRIORITY(
+ SPTEST.TASK_ID( 1 ),
+ THE_PRIORITY,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
+
+ end if;
+
+ end loop;
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ loop
+
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ end loop;
+
+ end TASK_3;
+
+--
+-- TASK_4
+--
+
+ procedure TASK_4 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ begin
+
+ Flush_Task_Event_Log;
+
+ TEXT_IO.PUT_LINE( "TA4 - exitting task" );
+
+ end TASK_4;
+
+--
+-- TASK_EXIT_EXTENSION
+--
+
+ procedure TASK_EXIT_EXTENSION (
+ RUNNING_TASK : in RTEMS.TCB_POINTER
+ ) is
+ begin
+
+ if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RUNNING_TASK ) ) > 0 then
+ TEXT_IO.PUT_LINE( "TASK_EXITTED - user extension invoked correctly" );
+ end if;
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 7 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_EXIT_EXTENSION;
+
+--
+-- TASK_CREATE_EXTENSION
+--
+
+ function TASK_CREATE_EXTENSION (
+ UNUSED : in RTEMS.TCB_POINTER;
+ CREATED_TASK : in RTEMS.TCB_POINTER
+ ) return RTEMS.Boolean is
+ pragma Unreferenced(UNUSED);
+ begin
+
+ if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( CREATED_TASK ) ) > 0 then
+ Log_Task_Event (
+ Created,
+ TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( CREATED_TASK ) ),
+ 0
+ );
+ end if;
+
+ return RTEMS.True;
+
+ end TASK_CREATE_EXTENSION;
+
+--
+-- TASK_DELETE_EXTENSION
+--
+
+ procedure TASK_DELETE_EXTENSION (
+ RUNNING_TASK : in RTEMS.TCB_POINTER;
+ DELETED_TASK : in RTEMS.TCB_POINTER
+ ) is
+ begin
+
+ if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RUNNING_TASK ) ) > 0 and
+ TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( DELETED_TASK ) ) > 0 then
+ Log_Task_Event (
+ Deleted,
+ TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RUNNING_TASK ) ),
+ TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( DELETED_TASK ) )
+ );
+ end if;
+
+ end TASK_DELETE_EXTENSION;
+
+--
+-- TASK_RESTART_EXTENSION
+--
+
+ procedure TASK_RESTART_EXTENSION (
+ UNUSED : in RTEMS.TCB_POINTER;
+ RESTARTED_TASK : in RTEMS.TCB_POINTER
+ ) is
+ pragma Unreferenced(UNUSED);
+ begin
+
+ if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RESTARTED_TASK ) ) > 0 then
+ Log_Task_Event (
+ Restarted,
+ TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RESTARTED_TASK ) ),
+ 0
+ );
+ end if;
+
+ end TASK_RESTART_EXTENSION;
+
+--
+-- TASK_START_EXTENSION
+--
+
+ procedure TASK_START_EXTENSION (
+ UNUSED : in RTEMS.TCB_POINTER;
+ STARTED_TASK : in RTEMS.TCB_POINTER
+ ) is
+ pragma Unreferenced(UNUSED);
+ begin
+
+ if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( STARTED_TASK ) ) > 0 then
+ Log_Task_Event (
+ Started,
+ TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( STARTED_TASK ) ),
+ 0
+ );
+ end if;
+
+ end TASK_START_EXTENSION;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp07/sptest.ads b/testsuites/ada/sptests/sp07/sptest.ads
new file mode 100644
index 0000000000..3984c64ee1
--- /dev/null
+++ b/testsuites/ada/sptests/sp07/sptest.ads
@@ -0,0 +1,194 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 7 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS extensions created
+-- by this test.
+--
+
+ EXTENSION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ EXTENSION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+--
+-- TASK_4
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Message Queue Manager.
+--
+
+ procedure TASK_4 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_4);
+
+--
+-- TASK_CREATE_EXTENSION
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the TASK_CREATE extension for this test.
+--
+
+ function TASK_CREATE_EXTENSION (
+ UNUSED : in RTEMS.TCB_POINTER;
+ CREATED_TASK : in RTEMS.TCB_POINTER
+ ) return RTEMS.Boolean;
+ pragma Convention (C, TASK_CREATE_EXTENSION);
+
+--
+-- TASK_DELETE_EXTENSION
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the TASK_DELETE extension for this test.
+--
+
+ procedure TASK_DELETE_EXTENSION (
+ RUNNING_TASK : in RTEMS.TCB_POINTER;
+ DELETED_TASK : in RTEMS.TCB_POINTER
+ );
+ pragma Convention (C, TASK_DELETE_EXTENSION);
+
+--
+-- TASK_RESTART_EXTENSION
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the TASK_RESTART extension for this test.
+--
+
+ procedure TASK_RESTART_EXTENSION (
+ UNUSED : in RTEMS.TCB_POINTER;
+ RESTARTED_TASK : in RTEMS.TCB_POINTER
+ );
+ pragma Convention (C, TASK_RESTART_EXTENSION);
+
+--
+-- TASK_START_EXTENSION
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the TASK_START extension for this test.
+--
+
+ procedure TASK_START_EXTENSION (
+ UNUSED : in RTEMS.TCB_POINTER;
+ STARTED_TASK : in RTEMS.TCB_POINTER
+ );
+ pragma Convention (C, TASK_START_EXTENSION);
+
+--
+-- TASK_EXIT_EXTENSION
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the TASK_EXIT extension for this test.
+-- It is invoked when a RTEMS task exits from its entry point.
+--
+
+ procedure TASK_EXIT_EXTENSION (
+ RUNNING_TASK : in RTEMS.TCB_POINTER
+ );
+ pragma Convention (C, TASK_EXIT_EXTENSION);
+
+--
+-- This is the User Extension Table for this test.
+--
+
+ EXTENSIONS : aliased RTEMS.EXTENSIONS_TABLE :=
+ (
+ SPTEST.TASK_CREATE_EXTENSION'ACCESS, -- Task create
+ SPTEST.TASK_START_EXTENSION'ACCESS, -- Task start
+ SPTEST.TASK_RESTART_EXTENSION'ACCESS, -- Task restart
+ SPTEST.TASK_DELETE_EXTENSION'ACCESS, -- Task delete
+ NULL, -- Task switch
+ NULL, -- Task post switch
+ NULL, -- Task begin
+ SPTEST.TASK_EXIT_EXTENSION'ACCESS, -- Task exitted
+ NULL -- Fatal error
+ );
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp08/Makefile.am b/testsuites/ada/sptests/sp08/Makefile.am
new file mode 100644
index 0000000000..5c6fc3e74e
--- /dev/null
+++ b/testsuites/ada/sptests/sp08/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp08
+ada_sp08_SOURCES = sp08.adb config.h sptest.adb sptest.ads
+ada_sp08_SOURCES += ../../support/init.c
+
+ada_sp08$(EXEEXT): sp08.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp08.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp08/ada_sp08.scn b/testsuites/ada/sptests/sp08/ada_sp08.scn
new file mode 100644
index 0000000000..d0081437fe
--- /dev/null
+++ b/testsuites/ada/sptests/sp08/ada_sp08.scn
@@ -0,0 +1,20 @@
+*** TEST 8 ***
+TA1 - task_mode - ASR - previous mode: 16#0#
+TA1 - task_mode - NO_ASR - previous mode: 16#0#
+TA1 - task_mode - NO_ASR - previous mode: 16#400#
+TA1 - task_mode - ASR - previous mode: 16#400#
+TA1 - task_mode - NO_TIMESLICE - previous mode: 16#0#
+TA1 - task_mode - TIMESLICE - previous mode: 16#0#
+TA1 - task_mode - TIMESLICE - previous mode: 16#200#
+TA1 - task_mode - NO_TIMESLICE - previous mode: 16#200#
+TA1 - task_mode - PREEMPT - previous mode: 16#0#
+TA1 - task_mode - NO_PREEMPT - previous mode: 16#0#
+TA1 - task_mode - NO_PREEMPT - previous mode: 16#100#
+TA1 - task_mode - PREEMPT - previous mode: 16#100#
+TA1 - task_mode - INTERRUPT_LEVEL( 3 ) - previous mode: 16#0#
+TA1 - task_mode - INTERRUPT_LEVEL( 5 ) - previous mode: 16#1#
+TA1 - task_mode - set all modes - previous mode: 16#1#
+TA1 - task_mode - set all modes - previous mode: 16#701#
+TA1 - task_mode - clear all modes - previous mode: 16#701#
+TA1 - task_mode - get current mode - previous mode: 16#0#
+*** END OF TEST 8 ***
diff --git a/testsuites/ada/sptests/sp08/config.h b/testsuites/ada/sptests/sp08/config.h
new file mode 100644
index 0000000000..6ada011600
--- /dev/null
+++ b/testsuites/ada/sptests/sp08/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp08/sp08.adb b/testsuites/ada/sptests/sp08/sp08.adb
new file mode 100644
index 0000000000..f881ad4e71
--- /dev/null
+++ b/testsuites/ada/sptests/sp08/sp08.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP08 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP08 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP08;
+
diff --git a/testsuites/ada/sptests/sp08/sptest.adb b/testsuites/ada/sptests/sp08/sptest.adb
new file mode 100644
index 0000000000..2bec479285
--- /dev/null
+++ b/testsuites/ada/sptests/sp08/sptest.adb
@@ -0,0 +1,346 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 8 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 8 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- PUT_MODE
+--
+
+ procedure PUT_MODE(
+ COMMENT : in STRING;
+ OUTPUT_MODE : in RTEMS.MODE
+ ) is
+ begin
+
+ TEXT_IO.PUT( COMMENT );
+ UNSIGNED32_IO.PUT( OUTPUT_MODE, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ end PUT_MODE;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ PREVIOUS_MODE : RTEMS.MODE;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+-- BEGINNING OF ASR
+
+ RTEMS.TASKS.MODE(
+ RTEMS.ASR,
+ RTEMS.ASR_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - ASR - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_ASR,
+ RTEMS.ASR_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - NO_ASR - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_ASR,
+ RTEMS.ASR_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - NO_ASR - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.ASR,
+ RTEMS.ASR_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - ASR - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+-- END OF ASR
+
+-- BEGINNING OF TIMESLICE
+
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_TIMESLICE,
+ RTEMS.TIMESLICE_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - NO_TIMESLICE - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.TIMESLICE,
+ RTEMS.TIMESLICE_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - TIMESLICE - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.TIMESLICE,
+ RTEMS.TIMESLICE_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - TIMESLICE - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_TIMESLICE,
+ RTEMS.TIMESLICE_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - NO_TIMESLICE - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+-- END OF TIMESLICE
+
+-- BEGINNING OF PREEMPT
+
+ RTEMS.TASKS.MODE(
+ RTEMS.PREEMPT,
+ RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - PREEMPT - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_PREEMPT,
+ RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - NO_PREEMPT - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_PREEMPT,
+ RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - NO_PREEMPT - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.PREEMPT,
+ RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - PREEMPT - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+-- END OF PREEMPT
+
+-- BEGINNING OF INTERRUPT_LEVEL
+
+ RTEMS.TASKS.MODE(
+ RTEMS.INTERRUPT_LEVEL( 3 ),
+ RTEMS.INTERRUPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - INTERRUPT_LEVEL( 3 ) - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.INTERRUPT_LEVEL( 5 ),
+ RTEMS.INTERRUPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - INTERRUPT_LEVEL( 5 ) - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+-- END OF INTERRUPT_LEVEL
+
+-- BEGINNING OF COMBINATIONS
+
+ RTEMS.TASKS.MODE(
+ RTEMS.INTERRUPT_LEVEL( 3 ) + RTEMS.NO_ASR +
+ RTEMS.TIMESLICE + RTEMS.NO_PREEMPT,
+ RTEMS.INTERRUPT_MASK + RTEMS.ASR_MASK +
+ RTEMS.TIMESLICE_MASK + RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - set all modes - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.INTERRUPT_LEVEL( 3 ) + RTEMS.NO_ASR +
+ RTEMS.TIMESLICE + RTEMS.NO_PREEMPT,
+ RTEMS.INTERRUPT_MASK + RTEMS.ASR_MASK +
+ RTEMS.TIMESLICE_MASK + RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - set all modes - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+ RTEMS.TASKS.MODE(
+ RTEMS.INTERRUPT_LEVEL( 0 ) + RTEMS.ASR +
+ RTEMS.NO_TIMESLICE + RTEMS.PREEMPT,
+ RTEMS.INTERRUPT_MASK + RTEMS.ASR_MASK +
+ RTEMS.TIMESLICE_MASK + RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - clear all modes - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+-- END OF COMBINATIONS
+
+-- BEGINNING OF CURRENT MODE
+
+ RTEMS.TASKS.MODE(
+ RTEMS.CURRENT_MODE,
+ RTEMS.CURRENT_MODE,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+ SPTEST.PUT_MODE(
+ "TA1 - task_mode - get current mode - previous mode: ",
+ PREVIOUS_MODE
+ );
+
+-- END OF CURRENT MODE
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 8 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end TASK_1;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp08/sptest.ads b/testsuites/ada/sptests/sp08/sptest.ads
new file mode 100644
index 0000000000..09e9f8383f
--- /dev/null
+++ b/testsuites/ada/sptests/sp08/sptest.ads
@@ -0,0 +1,74 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 8 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- PUT_MODE
+--
+-- DESCRIPTION:
+--
+-- This subprogram prints the COMMENT and the OUTPUT_MODE followed
+-- by a carriage return.
+--
+
+ procedure PUT_MODE(
+ COMMENT : in STRING;
+ OUTPUT_MODE : in RTEMS.MODE
+ );
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the TASK_MODE directive of the Task Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp09/Makefile.am b/testsuites/ada/sptests/sp09/Makefile.am
new file mode 100644
index 0000000000..8956a388d5
--- /dev/null
+++ b/testsuites/ada/sptests/sp09/Makefile.am
@@ -0,0 +1,21 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+# Prevents Ada from raising a constraint so that the error
+# handling can be verified in the binding.
+AM_ADAFLAGS += -gnatp
+
+noinst_PROGRAMS = ada_sp09
+
+ada_sp09_SOURCES = sp09.adb config.h sptest.adb sptest.ads
+ada_sp09_SOURCES += ../../support/init.c
+
+ada_sp09$(EXEEXT): sp09.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp09.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp09/ada_sp09.scn b/testsuites/ada/sptests/sp09/ada_sp09.scn
new file mode 100644
index 0000000000..de199d7dd5
--- /dev/null
+++ b/testsuites/ada/sptests/sp09/ada_sp09.scn
@@ -0,0 +1,246 @@
+*** TEST 9 ***
+INIT - task_create - INVALID_PRIORITY
+INIT - task_restart - INCORRECT_STATE
+TA1 - task_delete - INVALID_ID
+TA1 - task_ident - current task SUCCESSFUL
+TA1 - task_ident - global INVALID_NAME
+TA1 - task_ident - local INVALID_NAME
+TA1 - task_ident - INVALID_NODE
+TA1 - task_restart - INVALID_ID
+TA1 - task_resume - INVALID_ID
+TA1 - task_resume - INCORRECT_STATE
+TA1 - task_set_priority - INVALID_PRIORITY
+TA1 - task_set_priority - INVALID_ID
+TA1 - task_start - INVALID_ID
+TA1 - task_start - INCORRECT_STATE
+TA1 - task_suspend - INVALID_ID
+<pause - screen 2>
+TA1 - clock_get - NOT_DEFINED
+TA1 - task_wake_when - NOT_DEFINED
+TA1 - timer_fire_when - NOT_DEFINED
+TA1 - clock_set - 8:30:45 2/ 5/1987 - INVALID_CLOCK
+TA1 - clock_set - 8:30:45 15/ 5/1988 - INVALID_CLOCK
+TA1 - clock_set - 8:30:45 2/32/1988 - INVALID_CLOCK
+TA1 - clock_set - 25:30:45 2/ 5/1988 - INVALID_CLOCK
+TA1 - clock_set - 8:61:45 2/ 5/1988 - INVALID_CLOCK
+TA1 - clock_set - 8:30:61 2/ 5/1988 - INVALID_CLOCK
+TA1 - clock_set - 8:30:45 2/ 5/1988 - INVALID_CLOCK
+TA1 - clock_set - 8:30:45 2/ 5/1988 - SUCCESSFUL
+TA1 - task_wake_when - TICK INVALID - sleep about 3 seconds
+TA1 - task_wake_when - TICK INVALID - woke up SUCCESSFUL
+TA1 - task_wake_when - 8:30:48 2/ 5/1961 - INVALID_CLOCK
+TA1 - task_wake_when - 25:30:48 2/ 5/1988 - INVALID_CLOCK
+TA1 - current time - 8:30:48 2/ 5/1988
+TA1 - task_wake_when - 8:30:48 1/ 5/1988 - INVALID_CLOCK
+<pause - screen 3>
+TA1 - task_create - INVALID_NAME
+TA1 - task_create - stack size - UNSATISFIED
+TA1 - task_create - TA2 created - SUCCESSFUL
+TA1 - task_suspend - suspend TA2 - SUCCESSFUL
+TA1 - task_suspend - suspend TA2 - ALREADY_SUSPENDED
+TA1 - task_resume - TA2 resumed - SUCCESSFUL
+TA1 - task_create - TA3 created - SUCCESSFUL
+TA1 - task_create - 4 created - SUCCESSFUL
+TA1 - task_create - 5 created - SUCCESSFUL
+TA1 - task_create - 6 created - SUCCESSFUL
+TA1 - task_create - 7 created - SUCCESSFUL
+TA1 - task_create - 8 created - SUCCESSFUL
+TA1 - task_create - 9 created - SUCCESSFUL
+TA1 - task_create - 10 created - SUCCESSFUL
+TA1 - task_create - 11 - TOO_MANY
+TA1 - task_create - MP_NOT_CONFIGURED
+<pause - screen 4>
+TA1 - event_receive - UNSATISFIED ( all conditions )
+TA1 - event_receive - UNSATISFIED ( any conditions )
+TA1 - event_receive - timeout in 3 seconds
+TA1 - event_receive - woke with TIMEOUT
+TA1 - event_send - INVALID_ID
+TA1 - task_wake_after - sleep 1 second - SUCCESSFUL
+TA1 - clock_set - 8:30:45 2/ 5/1988 - SUCCESSFUL
+<pause - screen 5>
+TA1 - semaphore_create - INVALID_NAME
+TA1 - semaphore_create - 1 - SUCCESSFUL
+TA1 - semaphore_create - 2 - SUCCESSFUL
+TA1 - semaphore_create - 3 - TOO_MANY
+TA1 - semaphore_create - NOT_DEFINED
+TA1 - semaphore_create - NOT_DEFINED
+TA1 - semaphore_create - INVALID_NUMBER
+TA1 - semaphore_create - MP_NOT_CONFIGURED
+TA1 - semaphore_delete - unknown INVALID_ID
+TA1 - semaphore_delete - local INVALID_ID
+TA1 - semaphore_ident - global INVALID_NAME
+TA1 - semaphore_ident - local INVALID_NAME
+<pause - screen 6>
+TA1 - semaphore_obtain - INVALID_ID
+TA1 - semaphore_obtain - got sem 1 - SUCCESSFUL
+TA1 - semaphore_obtain - UNSATISFIED
+TA1 - semaphore_obtain - timeout in 3 seconds
+TA1 - semaphore_obtain - woke with TIMEOUT
+TA1 - semaphore_release - NOT_OWNER_OF_RESOURCE
+TA1 - semaphore_release - INVALID_ID
+TA1 - task_start - start TA2 - SUCCESSFUL
+TA1 - task_wake_after - yield processor - SUCCESSFUL
+TA2 - semaphore_obtain - sem 1 - WAIT FOREVER
+TA1 - semaphore_delete - delete sem 1 - SUCCESSFUL
+TA1 - semaphore_obtain - binary semaphore
+TA1 - semaphore_delete - delete sem 2 - RESOURCE_IN_USE
+TA1 - task_wake_after - yield processor - SUCCESSFUL
+TA2 - semaphore_obtain - woke up with OBJECT_WAS_DELETED
+TA2 - task_delete - delete self - SUCCESSFUL
+TA1 - task_delete TA2 - already deleted INVALID_ID
+<pause - screen 7>
+TA1 - message_queue_broadcast - INVALID_ID
+TA1 - message_queue_create - Q 1 - INVALID_NAME
+TA1 - message_queue_create - Q 1 - MP_NOT_CONFIGURED
+TA1 - message_queue_create - Q 1 - 2 DEEP - SUCCESSFUL
+TA1 - message_queue_create - Q 2 - TOO_MANY
+TA1 - message_queue_delete - unknown INVALID_ID
+TA1 - message_queue_delete - local INVALID_ID
+TA1 - message_queue_ident - INVALID_NAME
+TA1 - message_queue_get_number_pending - INVALID_ID
+TA1 - message_queue_flush - INVALID_ID
+TA1 - message_queue_receive - INVALID_ID
+TA1 - message_queue_receive - Q 1 - UNSATISFIED
+TA1 - message_queue_receive - Q 1 - timeout in 3 seconds
+TA1 - message_queue_receive - Q 1 - woke up with TIMEOUT
+TA1 - message_queue_send - INVALID_ID
+TA1 - message_queue_send - BUFFER 1 TO Q 1 - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 2 TO Q 1 - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 3 TO Q 1 - TOO_MANY
+<pause - screen 8>
+TA1 - message_queue_delete - Q 1 - SUCCESSFUL
+TA1 - message_queue_create - Q 1 - 2 DEEP - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 1 TO Q 1 - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 2 TO Q 1 - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 3 TO Q 1 - TOO_MANY
+TA1 - message_queue_delete - Q 1 - SUCCESSFUL
+TA1 - message_queue_create - Q 1 - 3 DEEP - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 1 TO Q 1 - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 2 TO Q 1 - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 3 TO Q 1 - SUCCESSFUL
+TA1 - message_queue_send - BUFFER 4 TO Q 1 - TOO_MANY
+TA1 - message_queue_delete - Q 1 - SUCCESSFUL
+TA1 - message_queue_create - Q 1 - 3 DEEP - SUCCESSFUL
+TA1 - task_start - start TA3 - SUCCESSFUL
+TA1 - task_wake_after - yield processor - SUCCESSFUL
+TA3 - message_queue_receive - Q 1 - WAIT FOREVER
+TA1 - message_queue_delete - delete Q 1 - SUCCESSFUL
+TA1 - task_wake_after - yield processor - SUCCESSFUL
+TA3 - message_queue_receive - woke up with OBJECT_WAS_DELETED
+TA3 - task_delete - delete self - SUCCESSFUL
+<pause - screen 9>
+TA1 - port_create - INVALID_NAME
+TA1 - port_create - INVALID_ADDRESS
+TA1 - port_create - TOO_MANY
+TA1 - port_delete - INVALID_ID
+TA1 - port_ident - INVALID_NAME
+TA1 - port_internal_to_external - INVALID_ID
+TA1 - port_external_to_internal - INVALID_ID
+<pause - screen 10>
+TA1 - rate_monotonic_create - INVALID_NAME
+TA1 - rate_monotonic_create - SUCCESSFUL
+TA1 - rate_monotonic_create - TOO_MANY
+TA1 - rate_monotonic_ident - INVALID_NAME
+TA1 - rate_monotonic_period - unknown INVALID_ID
+TA1 - rate_monotonic_period - local INVALID_ID
+TA1 - rate_monotonic_period( STATUS ) - NOT_DEFINED
+TA1 - rate_monotonic_period - 100 ticks - SUCCESSFUL
+TA1 - rate_monotonic_period( STATUS ) - SUCCESSFUL
+TA1 - rate_monotonic_period( STATUS ) - TIMEOUT
+TA1 - rate_monotonic_cancel - unknown INVALID_ID
+TA1 - rate_monotonic_cancel - local INVALID_ID
+TA1 - rate_monotonic_cancel - SUCCESSFUL
+TA1 - rate_monotonic_period - 5 ticks - TIMEOUT
+TA1 - task_wake_after - yielding to TA4
+TA4 - rate_monotonic_cancel - NOT_OWNER_OF_RESOURCE
+TA4 - rate_monotonic_period - NOT_OWNER_OF_RESOURCE
+TA4 - task_delete - delete self - SUCCESSFUL
+TA1 - rate_monotonic_delete - unknown INVALID_ID
+TA1 - rate_monotonic_delete - local INVALID_ID
+TA1 - rate_monotonic_delete - SUCCESSFUL
+<pause - screen 11>
+TA1 - partition_create - INVALID_NAME
+TA1 - partition_create - length - INVALID_SIZE
+TA1 - partition_create - buffer size - INVALID_SIZE
+TA1 - partition_create - length < buffer size - INVALID_SIZE
+TA1 - partition_create - MP_NOT_CONFIGURED
+TA1 - partition_create - INVALID_ADDRESS
+TA1 - partition_create - INVALID_SIZE
+TA1 - partition_delete - unknown INVALID_ID
+TA1 - partition_delete - local INVALID_ID
+TA1 - partition_get_buffer - INVALID_ID
+TA1 - partition_ident - INVALID_NAME
+TA1 - partition_return_buffer - INVALID_ID
+TA1 - partition_create - SUCCESSFUL
+TA1 - partition_create - TOO_MANY
+TA1 - partition_get_buffer - SUCCESSFUL
+TA1 - partition_get_buffer - SUCCESSFUL
+TA1 - partition_get_buffer - UNSATISFIED
+TA1 - partition_delete - RESOURCE_IN_USE
+TA1 - partition_return_buffer - INVALID_ADDRESS - out of range
+TA1 - partition_return_buffer - INVALID_ADDRESS - not on boundary
+<pause - screen 12>
+TA1 - region_create - INVALID_NAME
+TA1 - region_create - INVALID_ADDRESS
+TA1 - region_create - INVALID_SIZE
+TA1 - region_create - SUCCESSFUL
+TA1 - region_create - TOO_MANY
+TA1 - region_delete - unknown INVALID_ID
+TA1 - region_delete - local INVALID_ID
+TA1 - region_ident - INVALID_NAME
+TA1 - region_get_segment - INVALID_ID
+TA1 - region_get_segment - INVALID_SIZE
+TA1 - region_get_segment - SUCCESSFUL
+TA1 - region_get_segment - UNSATISFIED
+TA1 - region_get_segment - timeout in 3 seconds
+TA1 - region_get_segment - woke up with TIMEOUT
+TA1 - region_delete - RESOURCE_IN_USE
+TA1 - region_return_segment - INVALID_ID
+TA1 - region_return_segment - INVALID_ADDRESS
+TA1 - debug_disable - DEBUG_REGION
+TA1 - region_return_segment - INVALID_ADDRESS - SKIPPED
+TA1 - region_return_segment - INVALID_ADDRESS - SKIPPED
+TA1 - debug_enable - DEBUG_REGION
+TA1 - region_extend - INVALID_ID
+TA1 - region_extend - within heap - INVALID_ADDRESS
+TA1 - region_extend - non-contiguous lower - NOT_IMPLEMENTED
+TA1 - region_extend - contiguous lower - NOT_IMPLEMENTED
+TA1 - region_extend - non-contiguous higher - NOT_IMPLEMENTED
+<pause - screen 13>
+TA1 - clock_set - 23:59:59 12/31/2000 - SUCCESSFUL
+TA1 - clock_get - 0: 0: 0 1/ 1/2001 - SUCCESSFUL
+TA1 - clock_set - 23:59:59 12/31/1999 - SUCCESSFUL
+TA1 - clock_get - 0: 0: 0 1/ 1/2000 - SUCCESSFUL
+TA1 - clock_set - 23:59:59 12/31/2100 - SUCCESSFUL
+TA1 - clock_get - 17:31:44 11/25/1964 - SUCCESSFUL
+TA1 - clock_set - 23:59:59 12/31/2099 - SUCCESSFUL
+TA1 - clock_get - 17:31:44 11/25/1963 - SUCCESSFUL
+TA1 - clock_set - 23:59:59 12/31/1991 - SUCCESSFUL
+TA1 - clock_get - 0: 0: 0 1/ 1/1992 - SUCCESSFUL
+<pause - screen 14>
+TA1 - timer_create - INVALID_NAME
+TA1 - timer_create - 1 - SUCCESSFUL
+TA1 - timer_create - 2 - TOO_MANY
+TA1 - timer_delete - local INVALID_ID
+TA1 - timer_delete - global INVALID_ID
+TA1 - timer_ident - INVALID_NAME
+TA1 - timer_cancel - INVALID_ID
+TA1 - timer_reset - INVALID_ID
+TA1 - timer_reset - NOT_DEFINED
+TA1 - timer_fire_after - INVALID_ID
+TA1 - timer_fire_when - INVALID_ID
+TA1 - timer_fire_after - INVALID_NUMBER
+TA1 - timer_fire_when - 8:30:45 2/ 5/1987 - INVALID_CLOCK
+TA1 - clock_get - 0: 0: 0 1/ 1/1992
+TA1 - timer_fire_when - 8:30:45 2/ 5/1990 - before INVALID_CLOCK
+TA1 - timer_server_fire_after - INCORRECT_STATE
+TA1 - timer_server_fire_when - INCORRECT_STATE
+TA1 - timer_initiate_server - INVALID_PRIORITY
+TA1 - timer_initiate_server
+TA1 - timer_server_fire_after - INVALID_ID
+TA1 - timer_server_fire_when - INVALID_ID
+TA1 - timer_server_fire_after - INVALID_NUMBER
+TA1 - timer_server_fire_when - 8:30:45 2/ 5/1987 - INVALID_CLOCK
+TA1 - clock_get - 0: 0: 0 1/ 1/1992
+TA1 - timer_server_fire_when - 8:30:45 2/ 5/1990 - before INVALID_CLOCK
+*** END OF TEST 9 ***
diff --git a/testsuites/ada/sptests/sp09/config.h b/testsuites/ada/sptests/sp09/config.h
new file mode 100644
index 0000000000..a94c222fa1
--- /dev/null
+++ b/testsuites/ada/sptests/sp09/config.h
@@ -0,0 +1,38 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 10
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_MAXIMUM_SEMAPHORES 2
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#define CONFIGURE_MAXIMUM_REGIONS 1
+#define CONFIGURE_MAXIMUM_PERIODS 1
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp09/sp09.adb b/testsuites/ada/sptests/sp09/sp09.adb
new file mode 100644
index 0000000000..de3a8a91a0
--- /dev/null
+++ b/testsuites/ada/sptests/sp09/sp09.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP09 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP09 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP09;
+
diff --git a/testsuites/ada/sptests/sp09/sptest.adb b/testsuites/ada/sptests/sp09/sptest.adb
new file mode 100644
index 0000000000..218fbaed49
--- /dev/null
+++ b/testsuites/ada/sptests/sp09/sptest.adb
@@ -0,0 +1,3117 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 9 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with RTEMS.CLOCK;
+with RTEMS.EVENT;
+with RTEMS.MESSAGE_QUEUE;
+with RTEMS.PARTITION;
+with RTEMS.PORT;
+with RTEMS.RATE_MONOTONIC;
+with RTEMS.REGION;
+with RTEMS.SEMAPHORE;
+with RTEMS.TIMER;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 9 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+ SPTEST.TASK_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'A', '4', ' ' );
+ SPTEST.TASK_NAME( 5 ) := RTEMS.BUILD_NAME( 'T', 'A', '5', ' ' );
+ SPTEST.TASK_NAME( 6 ) := RTEMS.BUILD_NAME( 'T', 'A', '6', ' ' );
+ SPTEST.TASK_NAME( 7 ) := RTEMS.BUILD_NAME( 'T', 'A', '7', ' ' );
+ SPTEST.TASK_NAME( 8 ) := RTEMS.BUILD_NAME( 'T', 'A', '8', ' ' );
+ SPTEST.TASK_NAME( 9 ) := RTEMS.BUILD_NAME( 'T', 'A', '9', ' ' );
+ SPTEST.TASK_NAME( 10 ) := RTEMS.BUILD_NAME( 'T', 'A', 'A', ' ' );
+
+ SPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' );
+
+ SPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'M', '1', ' ' );
+ SPTEST.SEMAPHORE_NAME( 2 ) := RTEMS.BUILD_NAME( 'S', 'M', '2', ' ' );
+ SPTEST.SEMAPHORE_NAME( 3 ) := RTEMS.BUILD_NAME( 'S', 'M', '3', ' ' );
+
+ SPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'Q', '1', ' ' );
+ SPTEST.QUEUE_NAME( 2 ) := RTEMS.BUILD_NAME( 'M', 'Q', '2', ' ' );
+
+ SPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME( 'P', 'T', '1', ' ' );
+
+ SPTEST.REGION_NAME( 1 ) := RTEMS.BUILD_NAME( 'R', 'N', '1', ' ' );
+
+ SPTEST.PORT_NAME( 1 ) := RTEMS.BUILD_NAME( 'D', 'P', '1', ' ' );
+
+ SPTEST.PERIOD_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 0,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_PRIORITY,
+ "TASK_CREATE WITH ILLEGAL PRIORITY"
+ );
+ TEXT_IO.PUT_LINE( "INIT - task_create - INVALID_PRIORITY" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.RESTART(
+ SPTEST.TASK_ID( 1 ),
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INCORRECT_STATE,
+ "TASK_RESTART OF DORMANT TASK"
+ );
+ TEXT_IO.PUT_LINE( "INIT - task_restart - INCORRECT_STATE" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- DELAYED_SUBPROGRAM
+--
+
+ procedure DELAYED_SUBPROGRAM (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ ) is
+ begin
+
+ NULL;
+
+ end DELAYED_SUBPROGRAM;
+
+--
+-- SCREEN_1
+--
+
+ procedure SCREEN_1
+ is
+ SELF_ID : RTEMS.ID;
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.DELETE( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TASK_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - INVALID_ID" );
+
+ RTEMS.TASKS.IDENT(
+ RTEMS.SELF,
+ RTEMS.SEARCH_ALL_NODES,
+ SELF_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" );
+ if SELF_ID /= SPTEST.TASK_ID( 1 ) then
+ TEXT_IO.PUT_LINE( "ERROR - task_ident - incorrect ID returned!" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_ident - current task SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.IDENT(
+ 100,
+ RTEMS.SEARCH_ALL_NODES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "TASK_IDENT WITH ILLEGAL NAME (local)"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_ident - global INVALID_NAME" );
+
+ RTEMS.TASKS.IDENT( 100, 1, SPTEST.JUNK_ID, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "TASK_IDENT WITH ILLEGAL NAME (global)"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_ident - local INVALID_NAME" );
+
+ RTEMS.TASKS.IDENT( 100, 2, SPTEST.JUNK_ID, STATUS );
+ if TEST_SUPPORT.Is_Configured_Multiprocessing then
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NODE,
+ "TASK_IDENT WITH ILLEGAL NODE"
+ );
+ else
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "TASK_IDENT WITH ILLEGAL NODE"
+ );
+ end if;
+ TEXT_IO.PUT_LINE( "TA1 - task_ident - INVALID_NODE" );
+
+ RTEMS.TASKS.RESTART( 100, 0, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TASK_RESTART WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_restart - INVALID_ID" );
+
+ RTEMS.TASKS.RESUME( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TASK_RESUME WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_resume - INVALID_ID" );
+
+ RTEMS.TASKS.RESUME( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INCORRECT_STATE,
+ "TASK_RESUME OF READY TASK"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_resume - INCORRECT_STATE" );
+
+ begin
+ RTEMS.TASKS.SET_PRIORITY( RTEMS.SELF, 512, PREVIOUS_PRIORITY, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_PRIORITY,
+ "TASK_SET_PRIORITY WITH ILLEGAL PRIORITY"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_set_priority - INVALID_PRIORITY"
+ );
+ exception
+ when others =>
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_set_priority - INVALID_PRIORITY -- constraint error"
+ );
+ end;
+
+ RTEMS.TASKS.SET_PRIORITY( 100, 8, PREVIOUS_PRIORITY, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TASK_SET_PRIORITY WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_set_priority - INVALID_ID" );
+
+ RTEMS.TASKS.START( 100, SPTEST.TASK_1'ACCESS, 0, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TASK_START WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_start - INVALID_ID" );
+
+ RTEMS.TASKS.START( RTEMS.SELF, SPTEST.TASK_1'ACCESS, 0, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INCORRECT_STATE,
+ "TASK_START OF READY TASK"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_start - INCORRECT_STATE" );
+
+ RTEMS.TASKS.SUSPEND( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TASK_SUSPEND WITH INVALID ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - INVALID_ID" );
+
+ end SCREEN_1;
+
+--
+-- SCREEN_2
+--
+
+ procedure SCREEN_2
+ is
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+-- errors before clock is set
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ if RTEMS.IS_STATUS_SUCCESSFUL( STATUS ) then
+ TEXT_IO.PUT_LINE(
+ "TA1 - clock_get - NOT_DEFINED -- DID THE BSP SET THE TIME OF DAY?"
+ );
+ else
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_DEFINED,
+ "CLOCK_GET BEFORE CLOCK IS SET"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - clock_get - NOT_DEFINED" );
+ end if;
+
+ RTEMS.TASKS.WAKE_WHEN( TIME, STATUS );
+ if RTEMS.IS_STATUS_SUCCESSFUL( STATUS ) then
+ TEXT_IO.PUT( "TA1 - task_wake_when - NOT_DEFINED -- " );
+ TEXT_IO.PUT_LINE( "DID THE BSP SET THE TIME OF DAY?" );
+ else
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_DEFINED,
+ "TASK_WAKE_WHEN BEFORE CLOCK IS SET"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_when - NOT_DEFINED" );
+ end if;
+
+ RTEMS.TIMER.FIRE_WHEN(
+ 0,
+ TIME,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+
+ if RTEMS.IS_STATUS_SUCCESSFUL( STATUS ) then
+ TEXT_IO.PUT( "TA1 - task_fire_when - NOT_DEFINED -- " );
+ TEXT_IO.PUT_LINE( "DID THE BSP SET THE TIME OF DAY?" );
+ else
+
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_DEFINED,
+ "TIMER_FIRE_WHEN BEFORE CLOCK IS SET"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_fire_when - NOT_DEFINED" );
+
+ end if;
+
+-- invalid time of day field
+
+ TIME := ( 1987, 2, 5, 8, 30, 45, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "CLOCK_SET WITH INVALID YEAR"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ TIME := ( 1988, 15, 5, 8, 30, 45, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "CLOCK_SET WITH INVALID MONTH"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ TIME := ( 1988, 2, 32, 8, 30, 45, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "CLOCK_SET WITH INVALID DAY"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ TIME := ( 1988, 2, 5, 25, 30, 45, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "CLOCK_SET WITH INVALID HOUR"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ TIME := ( 1988, 2, 5, 8, 61, 45, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "CLOCK_SET WITH INVALID MINUTE"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ TIME := ( 1988, 2, 5, 8, 30, 61, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "CLOCK_SET WITH INVALID SECOND"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ TIME := ( 1988, 2, 5, 8, 30, 45, TEST_SUPPORT.TICKS_PER_SECOND + 1 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "CLOCK_SET WITH INVALID TICKS PER SECOND"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ TIME := ( 1988, 2, 5, 8, 30, 45, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET SUCCESSFUL" );
+ TEXT_IO.PUT_LINE( " - SUCCESSFUL" );
+
+-- task_wake_when
+
+ TIME := ( 1988, 2, 5, 8, 30, 48, TEST_SUPPORT.TICKS_PER_SECOND + 1 );
+ TEXT_IO.PUT( "TA1 - task_wake_when - TICK INVALID - " );
+ TEXT_IO.PUT_LINE( "sleep about 3 seconds" );
+ RTEMS.TASKS.WAKE_WHEN( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "TASK_WAKE_WHEN WITH INVALID TICKS PER SECOND"
+ );
+ TEXT_IO.PUT( "TA1 - task_wake_when - TICK INVALID - " );
+ TEXT_IO.PUT_LINE( "woke up SUCCESSFUL" );
+
+ TIME := ( 1961, 2, 5, 8, 30, 48, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - task_wake_when - ", TIME, "" );
+ RTEMS.TASKS.WAKE_WHEN( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "TASK_WAKE_WHEN WITH INVALID YEAR"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ TIME := ( 1988, 2, 5, 25, 30, 48, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - task_wake_when - ", TIME, "" );
+ RTEMS.TASKS.WAKE_WHEN( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "TASK_WAKE_WHEN WITH INVALID HOUR"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - current time - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ TIME.MONTH := 1;
+ TEST_SUPPORT.PRINT_TIME( "TA1 - task_wake_when - ", TIME, "" );
+ RTEMS.TASKS.WAKE_WHEN( TIME, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "TASK_WAKE_WHEN BEFORE CURRENT TIME"
+ );
+ TEXT_IO.PUT_LINE( " - INVALID_CLOCK" );
+
+ end SCREEN_2;
+
+--
+-- SCREEN_3
+--
+
+ procedure SCREEN_3
+ is
+ TASK_NAME : RTEMS.NAME;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TASK_NAME := 1;
+
+ RTEMS.TASKS.CREATE(
+ 0,
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "TASK_CREATE WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - INVALID_NAME"
+ );
+
+ RTEMS.TASKS.CREATE(
+ TASK_NAME,
+ 1,
+ TEST_SUPPORT.WORK_SPACE_SIZE,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "TASK_CREATE WITH A STACK SIZE LARGER THAN THE WORKSPACE"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - stack size - UNSATISFIED"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - TA2 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.SUSPEND( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_suspend - suspend TA2 - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.SUSPEND( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.ALREADY_SUSPENDED,
+ "TASK_SUSPEND ON SUSPENDED TA2"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_suspend - suspend TA2 - ALREADY_SUSPENDED"
+ );
+
+ RTEMS.TASKS.RESUME( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME OF TA2" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_resume - TA2 resumed - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - TA3 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 4 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 4 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA4" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - 4 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 5 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 5 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA5" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - 5 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 6 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 6 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA6" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - 6 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 7 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 7 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA7" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - 7 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 8 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 8 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA8" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - 8 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 9 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 9 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA9" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - 9 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 10 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 10 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA10" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_create - 10 created - SUCCESSFUL"
+ );
+
+ RTEMS.TASKS.CREATE(
+ TASK_NAME,
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "TASK_CREATE FOR TOO MANY TASKS"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_create - 11 - TOO_MANY" );
+
+ if TEST_SUPPORT.Is_Configured_Multiprocessing then
+ RTEMS.TASKS.CREATE(
+ TASK_NAME,
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.GLOBAL,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.MP_NOT_CONFIGURED,
+ "TASK_CREATE OF GLOBAL TASK IN SINGLE CPU SYSTEM"
+ );
+ end if;
+ TEXT_IO.PUT_LINE( "TA1 - task_create - MP_NOT_CONFIGURED" );
+
+ end SCREEN_3;
+
+--
+-- SCREEN_4
+--
+
+ procedure SCREEN_4
+ is
+ EVENT_OUT : RTEMS.EVENT_SET;
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_16,
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ EVENT_OUT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "EVENT_RECEIVE UNSATISFIED (ALL)"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive - UNSATISFIED ( all conditions )"
+ );
+
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_16,
+ RTEMS.NO_WAIT + RTEMS.EVENT_ANY,
+ RTEMS.NO_TIMEOUT,
+ EVENT_OUT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "EVENT_RECEIVE UNSATISFIED (ANY)"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive - UNSATISFIED ( any conditions )"
+ );
+
+ TEXT_IO.PUT_LINE( "TA1 - event_receive - timeout in 3 seconds" );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_16,
+ RTEMS.DEFAULT_OPTIONS,
+ 3 * TEST_SUPPORT.TICKS_PER_SECOND,
+ EVENT_OUT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TIMEOUT,
+ "EVENT_RECEIVE AFTER 3 SECOND TIMEOUT"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive - woke with TIMEOUT"
+ );
+
+ RTEMS.EVENT.SEND(
+ 100,
+ RTEMS.EVENT_16,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "EVENT_SEND WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - INVALID_ID"
+ );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_wake_after - sleep 1 second - SUCCESSFUL"
+ );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER (1 SECOND)" );
+
+ TIME := ( 1988, 2, 5, 8, 30, 45, 0 );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET SUCCESSFUL" );
+ TEXT_IO.PUT_LINE( " - SUCCESSFUL" );
+
+ end SCREEN_4;
+
+--
+-- SCREEN_5
+--
+
+ procedure SCREEN_5
+ is
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.SEMAPHORE.CREATE(
+ 0,
+ 1,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "SEMAPHORE_CREATE WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_create - INVALID_NAME" );
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 1 ),
+ 1,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.SEMAPHORE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SEMAPHORE_CREATE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_create - 1 - SUCCESSFUL" );
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 2 ),
+ 1,
+ (RTEMS.BINARY_SEMAPHORE or RTEMS.PRIORITY or RTEMS.INHERIT_PRIORITY),
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SEMAPHORE_CREATE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_create - 2 - SUCCESSFUL" );
+
+ loop
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 3 ),
+ 1,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+
+ exit when not RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.SUCCESSFUL );
+ end loop;
+
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "SEMAPHORE_CREATE OF TOO MANY"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_create - 3 - TOO_MANY" );
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 1 ),
+ 1,
+ RTEMS.INHERIT_PRIORITY + RTEMS.BINARY_SEMAPHORE + RTEMS.FIFO,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_DEFINED,
+ "SEMAPHORE_CREATE OF FIFO INHERIT PRIORITY"
+ );
+ TEXT_IO.PUT_LINE("TA1 - semaphore_create - NOT_DEFINED");
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 1 ),
+ 1,
+ RTEMS.INHERIT_PRIORITY + RTEMS.COUNTING_SEMAPHORE + RTEMS.PRIORITY,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_DEFINED,
+ "SEMAPHORE_CREATE OF COUNTING_SEMAPHORE INHERIT PRIORITY"
+ );
+ TEXT_IO.PUT_LINE("TA1 - semaphore_create - NOT_DEFINED");
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 1 ),
+ 2,
+ RTEMS.BINARY_SEMAPHORE,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NUMBER,
+ "SEMAPHORE_CREATE OF BINARY_SEMAPHORE with COUNT > 1"
+ );
+ TEXT_IO.PUT_LINE("TA1 - semaphore_create - INVALID_NUMBER");
+
+ if TEST_SUPPORT.Is_Configured_Multiprocessing then
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 3 ),
+ 1,
+ RTEMS.GLOBAL,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.MP_NOT_CONFIGURED,
+ "SEMAPHORE_CREATE OF MP_NOT_CONFIGURED"
+ );
+ end if;
+ TEXT_IO.PUT_LINE("TA1 - semaphore_create - MP_NOT_CONFIGURED");
+
+ RTEMS.SEMAPHORE.DELETE( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "SEMAPHORE_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_delete - unknown INVALID_ID"
+ );
+
+ RTEMS.SEMAPHORE.DELETE( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "SEMAPHORE_DELETE WITH LOCAL ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_delete - local INVALID_ID"
+ );
+
+ RTEMS.SEMAPHORE.IDENT(
+ 100,
+ RTEMS.SEARCH_ALL_NODES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "SEMAPHORE_IDENT WITH ILLEGAL NAME (local)"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_ident - global INVALID_NAME"
+ );
+
+ RTEMS.SEMAPHORE.IDENT( 100, 1, SPTEST.JUNK_ID, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "SEMAPHORE_IDENT WITH ILLEGAL NAME (global)"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_ident - local INVALID_NAME"
+ );
+
+ end SCREEN_5;
+
+--
+-- SCREEN_6
+--
+
+ procedure SCREEN_6
+ is
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.SEMAPHORE.OBTAIN(
+ 100,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "SEMAPHORE_OBTAIN WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_obtain - INVALID_ID" );
+
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(STATUS, "SEMAPHORE_OBTAIN SUCCESSFUL");
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_obtain - got sem 1 - SUCCESSFUL"
+ );
+
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "SEMAPHORE_OBTAIN NOT AVAILABLE"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_obtain - UNSATISFIED" );
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_obtain - timeout in 3 seconds" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.DEFAULT_OPTIONS,
+ 3 * TEST_SUPPORT.TICKS_PER_SECOND,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TIMEOUT,
+ "SEMAPHORE_OBTAIN NOT AVAILABLE"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_obtain - woke with TIMEOUT"
+ );
+
+ RTEMS.SEMAPHORE.RELEASE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_OWNER_OF_RESOURCE,
+ "SEMAPHORE_RELEASE AND NOT OWNER"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_release - NOT_OWNER_OF_RESOURCE"
+ );
+
+ RTEMS.SEMAPHORE.RELEASE( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "SEMAPHORE_RELEASE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_release - INVALID_ID" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_start - start TA2 - SUCCESSFUL"
+ );
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_wake_after - yield processor - SUCCESSFUL"
+ );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER (yield)" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_delete - delete sem 1 - SUCCESSFUL"
+ );
+ RTEMS.SEMAPHORE.DELETE( SPTEST.SEMAPHORE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_DELETE OF SM1" );
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_obtain - binary semaphore" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_delete - delete sem 2 - RESOURCE_IN_USE"
+ );
+ RTEMS.SEMAPHORE.DELETE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.RESOURCE_IN_USE,
+ "SEMAPHORE_DELETE OF SM2"
+ );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_wake_after - yield processor - SUCCESSFUL"
+ );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER (yield)" );
+
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TASK_DELETE AFTER THE TASK HAS BEEN DELETED"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_delete TA2 - already deleted INVALID_ID"
+ );
+
+ end SCREEN_6;
+
+--
+-- SCREEN_7
+--
+
+ procedure SCREEN_7
+ is
+ BUFFER : SPTEST.BUFFER;
+ BUFFER_POINTER : RTEMS.ADDRESS;
+ COUNT : RTEMS.UNSIGNED32;
+ MESSAGE_SIZE : RTEMS.UNSIGNED32 := 0;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ BUFFER_POINTER := BUFFER'ADDRESS;
+
+ RTEMS.MESSAGE_QUEUE.BROADCAST(
+ 100,
+ BUFFER_POINTER,
+ 16,
+ COUNT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "MESSAGE_QUEUE_BROADCAST WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_broadcast - INVALID_ID"
+ );
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ 0,
+ 3,
+ 16,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "MESSAGE_QUEUE_CREATE WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_create - Q 1 - INVALID_NAME"
+ );
+
+ if TEST_SUPPORT.Is_Configured_Multiprocessing then
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 1,
+ 16,
+ RTEMS.GLOBAL,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.MP_NOT_CONFIGURED,
+ "MESSAGE_QUEUE_CREATE OF MP NOT CONFIGURED"
+ );
+ end if;
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_create - Q 1 - MP_NOT_CONFIGURED");
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 2,
+ 16,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.QUEUE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "MESSAGE_QUEUE_CREATE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_create - Q 1 - 2 DEEP - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 2 ),
+ 1,
+ 16,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "MESSAGE_QUEUE_CREATE OF TOO MANY"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_create - Q 2 - TOO_MANY"
+ );
+
+ RTEMS.MESSAGE_QUEUE.DELETE( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "MESSAGE_QUEUE_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_delete - unknown INVALID_ID"
+ );
+
+ RTEMS.MESSAGE_QUEUE.DELETE( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "MESSAGE_QUEUE_DELETE WITH LOCAL ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_delete - local INVALID_ID"
+ );
+
+ RTEMS.MESSAGE_QUEUE.IDENT(
+ 100,
+ RTEMS.SEARCH_ALL_NODES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "MESSAGE_QUEUE_IDENT WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_ident - INVALID_NAME" );
+
+ RTEMS.MESSAGE_QUEUE.GET_NUMBER_PENDING( 100, COUNT, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "MESSAGE_QUEUE_GET_NUMBER_PENDING WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE("TA1 - message_queue_get_number_pending - INVALID_ID");
+
+ RTEMS.MESSAGE_QUEUE.FLUSH( 100, COUNT, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "MESSAGE_QUEUE_FLUSH WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_flush - INVALID_ID" );
+
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ 100,
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "MESSAGE_QUEUE_RECEIVE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_receive - INVALID_ID" );
+
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "MESSAGE_QUEUE_RECEIVE UNSATISFIED"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_receive - Q 1 - UNSATISFIED"
+ );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_receive - Q 1 - timeout in 3 seconds"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ 3 * TEST_SUPPORT.TICKS_PER_SECOND,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TIMEOUT,
+ "MESSAGE_QUEUE_RECEIVE 3 SECOND TIMEOUT"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_receive - Q 1 - woke up with TIMEOUT"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND( 100, BUFFER_POINTER, 16, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "MESSAGE_QUEUE_SEND WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - INVALID_ID" );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 1 TO Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 2 TO Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "MESSAGE_QUEUE_SEND TOO MANY TO LIMITED QUEUE"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 3 TO Q 1 - TOO_MANY"
+ );
+
+ end SCREEN_7;
+
+--
+-- SCREEN_8
+--
+
+ procedure SCREEN_8
+ is
+ BUFFER : SPTEST.BUFFER;
+ BUFFER_POINTER : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ BUFFER_POINTER := BUFFER'ADDRESS;
+
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "MESSAGE_QUEUE_DELETE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_delete - Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 2,
+ 16,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.QUEUE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "MESSAGE_QUEUE_CREATE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_create - Q 1 - 2 DEEP - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 1 TO Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 2 TO Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "MESSAGE_QUEUE_SEND TOO MANY TO LIMITED QUEUE"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 3 TO Q 1 - TOO_MANY"
+ );
+
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "MESSAGE_QUEUE_DELETE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_delete - Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 3,
+ 16,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.QUEUE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "MESSAGE_QUEUE_CREATE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_create - Q 1 - 3 DEEP - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 1 TO Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 2 TO Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 3 TO Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "MESSAGE_QUEUE_SEND TOO MANY TO LIMITED QUEUE"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - BUFFER 4 TO Q 1 - TOO_MANY"
+ );
+
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "MESSAGE_QUEUE_DELETE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_delete - Q 1 - SUCCESSFUL"
+ );
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 2,
+ 16,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.QUEUE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "MESSAGE_QUEUE_CREATE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_create - Q 1 - 3 DEEP - SUCCESSFUL"
+ );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_start - start TA3 - SUCCESSFUL"
+ );
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_wake_after - yield processor - SUCCESSFUL"
+ );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER (yield)" );
+
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "MESSAGE_QUEUE_DELETE SUCCESSFUL"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_delete - delete Q 1 - SUCCESSFUL"
+ );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_wake_after - yield processor - SUCCESSFUL"
+ );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER (yield)" );
+
+ end SCREEN_8;
+
+--
+-- SCREEN_9
+--
+
+ procedure SCREEN_9
+ is
+ CONVERTED : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.PORT.CREATE(
+ 0,
+ SPTEST.INTERNAL_PORT_AREA'ADDRESS,
+ SPTEST.EXTERNAL_PORT_AREA'ADDRESS,
+ SPTEST.INTERNAL_PORT_AREA'LENGTH,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "PORT_CREATE WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - port_create - INVALID_NAME" );
+
+ RTEMS.PORT.CREATE(
+ SPTEST.PORT_NAME( 1 ),
+ SPTEST.INTERNAL_PORT_AREA( 1 )'ADDRESS,
+ SPTEST.EXTERNAL_PORT_AREA'ADDRESS,
+ SPTEST.INTERNAL_PORT_AREA'LENGTH,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ADDRESS,
+ "PORT_CREATE WITH ILLEGAL ADDRESS"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - port_create - INVALID_ADDRESS" );
+
+ RTEMS.PORT.CREATE(
+ SPTEST.PORT_NAME( 1 ),
+ SPTEST.INTERNAL_PORT_AREA'ADDRESS,
+ SPTEST.EXTERNAL_PORT_AREA'ADDRESS,
+ SPTEST.INTERNAL_PORT_AREA'LENGTH,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "PORT_CREATE OF TOO MANY"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - port_create - TOO_MANY" );
+
+ RTEMS.PORT.DELETE( 0, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "PORT_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - port_delete - INVALID_ID" );
+
+ RTEMS.PORT.IDENT( 0, SPTEST.JUNK_ID, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "PORT_IDENT WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - port_ident - INVALID_NAME" );
+
+ RTEMS.PORT.INTERNAL_TO_EXTERNAL(
+ 100,
+ SPTEST.INTERNAL_PORT_AREA'ADDRESS,
+ CONVERTED,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "PORT_INTERNAL_TO_EXTERNAL WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - port_internal_to_external - INVALID_ID"
+ );
+
+ RTEMS.PORT.EXTERNAL_TO_INTERNAL(
+ 100,
+ SPTEST.EXTERNAL_PORT_AREA'ADDRESS,
+ CONVERTED,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "PORT_EXTERNAL_TO_INTERNAL WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - port_external_to_internal - INVALID_ID"
+ );
+
+ end SCREEN_9;
+
+--
+-- SCREEN_10
+--
+
+ procedure SCREEN_10
+ is
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.RATE_MONOTONIC.CREATE( 0, SPTEST.JUNK_ID, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "RATE_MONOTONIC_CREATE WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_create - INVALID_NAME"
+ );
+
+ RTEMS.RATE_MONOTONIC.CREATE(
+ SPTEST.PERIOD_NAME( 1 ),
+ SPTEST.PERIOD_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "RATE_MONOTONIC_CREATE" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_create - SUCCESSFUL"
+ );
+
+ RTEMS.RATE_MONOTONIC.CREATE(
+ SPTEST.PERIOD_NAME( 1 ),
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "RATE_MONOTONIC_CREATE FOR TOO MANY"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - rate_monotonic_create - TOO_MANY" );
+
+ RTEMS.RATE_MONOTONIC.IDENT( 0, SPTEST.JUNK_ID, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "RATE_MONOTONIC_IDENT WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_ident - INVALID_NAME"
+ );
+
+ RTEMS.RATE_MONOTONIC.PERIOD( 100, 5, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "RATE_MONOTONIC_PERIOD WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_period - unknown INVALID_ID"
+ );
+
+ RTEMS.RATE_MONOTONIC.PERIOD( 16#10100#, 5, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "RATE_MONOTONIC_PERIOD WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_period - local INVALID_ID"
+ );
+
+ RTEMS.RATE_MONOTONIC.PERIOD(
+ SPTEST.PERIOD_ID( 1 ),
+ RTEMS.RATE_MONOTONIC_PERIOD_STATUS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_DEFINED,
+ "RATE_MONOTONIC_PERIOD STATUS NOT DEFINED"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_period( STATUS ) - NOT_DEFINED"
+ );
+
+ RTEMS.RATE_MONOTONIC.PERIOD( SPTEST.PERIOD_ID( 1 ), 100, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "RATE_MONOTONIC_PERIOD 100 TICKS"
+ );
+ TEXT_IO.PUT( "TA1 - rate_monotonic_period - 100 ticks - " );
+ TEXT_IO.PUT_LINE( "SUCCESSFUL" );
+
+ RTEMS.RATE_MONOTONIC.PERIOD(
+ SPTEST.PERIOD_ID( 1 ),
+ RTEMS.RATE_MONOTONIC_PERIOD_STATUS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "RATE_MONOTONIC_PERIOD STATUS"
+ );
+ TEXT_IO.PUT( "TA1 - rate_monotonic_period( STATUS ) - " );
+ TEXT_IO.PUT_LINE( "SUCCESSFUL" );
+
+ loop
+
+ RTEMS.RATE_MONOTONIC.PERIOD(
+ SPTEST.PERIOD_ID( 1 ),
+ RTEMS.RATE_MONOTONIC_PERIOD_STATUS,
+ STATUS
+ );
+
+ exit when RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.TIMEOUT );
+
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "RATE_MONOTONIC_PERIOD STATUS WAITING FOR TIMEOUT"
+ );
+
+ end loop;
+ TEXT_IO.PUT( "TA1 - rate_monotonic_period( STATUS ) - " );
+ TEXT_IO.PUT_LINE( "TIMEOUT" );
+
+ RTEMS.RATE_MONOTONIC.CANCEL( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "RATE_MONOTONIC_CANCEL WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_cancel - unknown INVALID_ID"
+ );
+
+ RTEMS.RATE_MONOTONIC.CANCEL( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "RATE_MONOTONIC_CANCEL WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_cancel - local INVALID_ID"
+ );
+
+ RTEMS.RATE_MONOTONIC.CANCEL( SPTEST.PERIOD_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "RATE_MONOTONIC_CANCEL" );
+ TEXT_IO.PUT_LINE( "TA1 - rate_monotonic_cancel - SUCCESSFUL" );
+
+ RTEMS.RATE_MONOTONIC.PERIOD( SPTEST.PERIOD_ID( 1 ), 5, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "RATE_MONOTONIC_PERIOD RESTART"
+ );
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ RTEMS.RATE_MONOTONIC.PERIOD( SPTEST.PERIOD_ID( 1 ), 5, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TIMEOUT,
+ "RATE_MONOTONIC_PERIOD TIMED OUT"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_period - 5 ticks - TIMEOUT"
+ );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 4 ),
+ SPTEST.TASK_4'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA4" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - yielding to TA4" );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER (yield)" );
+
+ RTEMS.RATE_MONOTONIC.DELETE( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "RATE_MONOTONIC_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_delete - unknown INVALID_ID"
+ );
+
+ RTEMS.RATE_MONOTONIC.DELETE( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "RATE_MONOTONIC_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_delete - local INVALID_ID"
+ );
+
+ RTEMS.RATE_MONOTONIC.DELETE( SPTEST.PERIOD_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "RATE_MONOTONIC_DELETE" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - rate_monotonic_delete - SUCCESSFUL"
+ );
+
+ end SCREEN_10;
+
+--
+-- SCREEN_11
+--
+
+ procedure SCREEN_11
+ is
+ BUFFER_ADDRESS_1 : RTEMS.ADDRESS;
+ BUFFER_ADDRESS_2 : RTEMS.ADDRESS;
+ BUFFER_ADDRESS_3 : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.PARTITION.CREATE(
+ 0,
+ SPTEST.PARTITION_GOOD_AREA'ADDRESS,
+ 128,
+ 40,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "PARTITION_CREATE WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - partition_create - INVALID_NAME" );
+
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ SPTEST.PARTITION_GOOD_AREA'ADDRESS,
+ 0,
+ 80,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_SIZE,
+ "PARTITION_CREATE WITH ILLEGAL LENGTH"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - partition_create - length - INVALID_SIZE"
+ );
+
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ SPTEST.PARTITION_GOOD_AREA'ADDRESS,
+ 128,
+ 0,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_SIZE,
+ "PARTITION_CREATE WITH ILLEGAL BUFFER_SIZE"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - partition_create - buffer size - INVALID_SIZE"
+ );
+
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ SPTEST.PARTITION_GOOD_AREA'ADDRESS,
+ 128,
+ 256,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_SIZE,
+ "PARTITION_CREATE WITH BUFFER_SIZE > LENGTH"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - partition_create - length < buffer size - INVALID_SIZE"
+ );
+
+ if TEST_SUPPORT.Is_Configured_Multiprocessing then
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ SPTEST.PARTITION_GOOD_AREA'ADDRESS,
+ 128,
+ 64,
+ RTEMS.GLOBAL,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.MP_NOT_CONFIGURED,
+ "PARTITION_CREATE OF GLOBAL"
+ );
+ end if;
+ TEXT_IO.PUT_LINE("TA1 - partition_create - MP_NOT_CONFIGURED");
+
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ SPTEST.PARTITION_BAD_AREA'ADDRESS,
+ 128,
+ 64,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ADDRESS,
+ "PARTITION_CREATE WITH BAD ADDRESS"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - partition_create - INVALID_ADDRESS" );
+
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ SPTEST.PARTITION_GOOD_AREA'ADDRESS,
+ 128,
+ 34,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_SIZE,
+ "PARTITION_CREATE WITH UNALIGNED BUFFER_SIZE"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - partition_create - INVALID_SIZE" );
+
+ RTEMS.PARTITION.DELETE( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "PARTITION_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - partition_delete - unknown INVALID_ID"
+ );
+
+ RTEMS.PARTITION.DELETE( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "PARTITION_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - partition_delete - local INVALID_ID"
+ );
+
+ RTEMS.PARTITION.GET_BUFFER( 100, BUFFER_ADDRESS_1, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "PARTITION_GET_BUFFER WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - partition_get_buffer - INVALID_ID" );
+
+ RTEMS.PARTITION.IDENT(
+ 0,
+ RTEMS.SEARCH_ALL_NODES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "PARTITION_IDENT WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - partition_ident - INVALID_NAME" );
+
+ RTEMS.PARTITION.RETURN_BUFFER( 100, BUFFER_ADDRESS_1, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "PARTITION_RETURN WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - partition_return_buffer - INVALID_ID"
+ );
+
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ SPTEST.PARTITION_GOOD_AREA'ADDRESS,
+ 128,
+ 64,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.PARTITION_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE" );
+ TEXT_IO.PUT_LINE( "TA1 - partition_create - SUCCESSFUL" );
+
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ SPTEST.PARTITION_GOOD_AREA'ADDRESS,
+ 128,
+ 64,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "PARTITION_CREATE OF TOO MANY"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - partition_create - TOO_MANY" );
+
+ RTEMS.PARTITION.GET_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ BUFFER_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
+ TEXT_IO.PUT_LINE( "TA1 - partition_get_buffer - SUCCESSFUL" );
+
+ RTEMS.PARTITION.GET_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ BUFFER_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
+ TEXT_IO.PUT_LINE( "TA1 - partition_get_buffer - SUCCESSFUL" );
+
+ RTEMS.PARTITION.GET_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ BUFFER_ADDRESS_3,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "PARTITION_GET_BUFFER UNSATISFIED"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - partition_get_buffer - UNSATISFIED" );
+
+ RTEMS.PARTITION.DELETE(
+ SPTEST.PARTITION_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.RESOURCE_IN_USE,
+ "PARTITION_DELETE WITH BUFFERS IN USE"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - partition_delete - RESOURCE_IN_USE" );
+
+ RTEMS.PARTITION.RETURN_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ SPTEST.REGION_GOOD_AREA( 0 )'ADDRESS, -- NOTE: REGION
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ADDRESS,
+ "PARTITION_RETURN WITH BUFFER ADDRESS OUT OF PARTITION"
+ );
+ TEXT_IO.PUT( "TA1 - partition_return_buffer - " );
+ TEXT_IO.PUT_LINE( "INVALID_ADDRESS - out of range" );
+
+ RTEMS.PARTITION.RETURN_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ SPTEST.PARTITION_GOOD_AREA( 7 )'ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ADDRESS,
+ "PARTITION_RETURN WITH BUFFER ADDRESS NOT ON BOUNDARY"
+ );
+ TEXT_IO.PUT( "TA1 - partition_return_buffer - " );
+ TEXT_IO.PUT_LINE( "INVALID_ADDRESS - not on boundary" );
+
+
+ end SCREEN_11;
+
+--
+-- SCREEN_12
+--
+
+ procedure SCREEN_12
+ is
+ SEGMENT_ADDRESS_1 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_2 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_3 : RTEMS.ADDRESS;
+-- OFFSET : RTEMS.UNSIGNED32;
+-- GOOD_FRONT_FLAG : RTEMS.UNSIGNED32;
+-- GOOD_BACK_FLAG : RTEMS.UNSIGNED32;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.REGION.CREATE(
+ 0,
+ SPTEST.REGION_GOOD_AREA'ADDRESS,
+ 16#40#,
+ 32,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "REGION_CREATE WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_create - INVALID_NAME" );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 1 ),
+ SPTEST.REGION_BAD_AREA'ADDRESS,
+ 16#40#,
+ 32,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ADDRESS,
+ "REGION_CREATE WITH ILLEGAL ADDRESS"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_create - INVALID_ADDRESS" );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 1 ),
+ SPTEST.REGION_GOOD_AREA'ADDRESS,
+ 34,
+ 34,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_SIZE,
+ "REGION_CREATE WITH ILLEGAL SIZE"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_create - INVALID_SIZE" );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 1 ),
+ SPTEST.REGION_GOOD_AREA( SPTEST.REGION_START_OFFSET )'ADDRESS,
+ SPTEST.REGION_LENGTH,
+ 16#40#,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.REGION_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE" );
+ TEXT_IO.PUT_LINE( "TA1 - region_create - SUCCESSFUL" );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 1 ),
+ SPTEST.REGION_GOOD_AREA'ADDRESS,
+ SPTEST.REGION_LENGTH,
+ 16#40#,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "REGION_CREATE FOR TOO MANY"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_create - TOO_MANY" );
+
+ RTEMS.REGION.DELETE( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "REGION_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_delete - unknown INVALID_ID" );
+
+ RTEMS.REGION.DELETE( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "REGION_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_delete - local INVALID_ID" );
+
+ RTEMS.REGION.IDENT( 0, SPTEST.JUNK_ID, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "REGION_IDENT WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_ident - INVALID_NAME" );
+
+ RTEMS.REGION.GET_SEGMENT(
+ 100,
+ 16#40#,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "REGION_GET_SEGMENT WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_get_segment - INVALID_ID" );
+
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ (SPTEST.REGION_GOOD_AREA'SIZE / 8) * 2,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_SIZE,
+ "REGION_GET_SEGMENT WITH ILLEGAL SIZE"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_get_segment - INVALID_SIZE" );
+
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 384,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT_LINE( "TA1 - region_get_segment - SUCCESSFUL" );
+
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SPTEST.REGION_LENGTH / 2,
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "REGION_GET_SEGMENT UNSATISFIED"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_get_segment - UNSATISFIED" );
+
+ TEXT_IO.PUT_LINE( "TA1 - region_get_segment - timeout in 3 seconds" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 128,
+ RTEMS.DEFAULT_OPTIONS,
+ 3 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SEGMENT_ADDRESS_3,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TIMEOUT,
+ "REGION_GET_SEGMENT TIMEOUT"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_get_segment - woke up with TIMEOUT"
+ );
+
+ RTEMS.REGION.DELETE( SPTEST.REGION_ID( 1 ), STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.RESOURCE_IN_USE,
+ "REGION_DELETE WITH BUFFERS IN USE"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_delete - RESOURCE_IN_USE" );
+
+ RTEMS.REGION.RETURN_SEGMENT(
+ 100,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "REGION_RETURN_SEGMENT WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - region_return_segment - INVALID_ID" );
+
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SPTEST.REGION_GOOD_AREA'ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ADDRESS,
+ "REGION_RETURN_SEGMENT WITH ILLEGAL SEGMENT"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_return_segment - INVALID_ADDRESS"
+ );
+
+-- OFFSET := 0;
+-- GOOD_BACK_FLAG := 0;
+-- GOOD_FRONT_FLAG := 0;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_return_segment - INVALID_ADDRESS - SKIPPED"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_return_segment - INVALID_ADDRESS - SKIPPED"
+ );
+
+
+-- OFFSET := RTEMS.SUBTRACT(
+-- SEGMENT_ADDRESS_1,
+-- SPTEST.REGION_GOOD_AREA'ADDRESS
+-- ) / 4;
+--
+--
+-- -- bad FRONT_FLAG error
+--
+-- GOOD_FRONT_FLAG := SPTEST.REGION_GOOD_AREA( OFFSET - 1 );
+-- SPTEST.REGION_GOOD_AREA( OFFSET - 1 ) := GOOD_FRONT_FLAG + 2;
+--
+-- RTEMS.REGION.RETURN_SEGMENT(
+-- SPTEST.REGION_ID( 1 ),
+-- SEGMENT_ADDRESS_1,
+-- STATUS
+-- );
+-- TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+-- STATUS,
+-- RTEMS.INVALID_ADDRESS,
+-- "REGION_RETURN_SEGMENT WITH BACK_FLAG /= FRONT_FLAG"
+-- );
+-- TEXT_IO.PUT_LINE(
+-- "TA1 - region_return_segment - INVALID_ADDRESS"
+-- );
+--
+-- SPTEST.REGION_GOOD_AREA( OFFSET - 1 ) := GOOD_FRONT_FLAG;
+--
+-- -- bad BACK_FLAG error
+--
+-- GOOD_BACK_FLAG := SPTEST.REGION_GOOD_AREA( OFFSET - 2 );
+-- SPTEST.REGION_GOOD_AREA( OFFSET - 2 ) := 1024;
+--
+-- RTEMS.REGION.RETURN_SEGMENT(
+-- SPTEST.REGION_ID( 1 ),
+-- SEGMENT_ADDRESS_1,
+-- STATUS
+-- );
+-- TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+-- STATUS,
+-- RTEMS.INVALID_ADDRESS,
+-- "REGION_RETURN_SEGMENT WITH BACK_FLAG /= FRONT_FLAG"
+-- );
+-- TEXT_IO.PUT_LINE(
+-- "TA1 - region_return_segment - INVALID_ADDRESS"
+-- );
+--
+-- SPTEST.REGION_GOOD_AREA( OFFSET - 2 ) := GOOD_BACK_FLAG;
+
+ RTEMS.REGION.EXTEND(
+ 100,
+ SPTEST.REGION_GOOD_AREA'ADDRESS,
+ 128,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "REGION_EXTEND WITH INVALID_ID"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_extend - INVALID_ID"
+ );
+
+ RTEMS.REGION.EXTEND(
+ SPTEST.REGION_ID( 1 ),
+ SPTEST.REGION_GOOD_AREA( SPTEST.REGION_START_OFFSET + 16 )'ADDRESS,
+ 128,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ADDRESS,
+ "REGION_EXTEND WITH INVALID_ADDRESS"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_extend - within heap - INVALID_ADDRESS"
+ );
+
+ RTEMS.REGION.EXTEND(
+ SPTEST.REGION_ID( 1 ),
+ SPTEST.REGION_BAD_AREA'ADDRESS,
+ 128,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_IMPLEMENTED,
+ "REGION_EXTEND WITH NOT_IMPLEMENTED"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_extend - non-contiguous lower - NOT_IMPLEMENTED"
+ );
+
+ RTEMS.REGION.EXTEND(
+ SPTEST.REGION_ID( 1 ),
+ SPTEST.REGION_GOOD_AREA(
+ SPTEST.REGION_START_OFFSET - SPTEST.REGION_LENGTH )'ADDRESS,
+ 128,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_IMPLEMENTED,
+ "REGION_EXTEND WITH NOT_IMPLEMENTED"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_extend - contiguous lower - NOT_IMPLEMENTED"
+ );
+
+ RTEMS.REGION.EXTEND(
+ SPTEST.REGION_ID( 1 ),
+ SPTEST.REGION_GOOD_AREA(
+ SPTEST.REGION_START_OFFSET + SPTEST.REGION_LENGTH + 16 )'ADDRESS,
+ 128,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_IMPLEMENTED,
+ "REGION_EXTEND WITH NOT_IMPLEMENTED"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_extend - non-contiguous higher - NOT_IMPLEMENTED"
+ );
+
+ end SCREEN_12;
+
+--
+-- SCREEN_13
+--
+
+ procedure SCREEN_13
+ is
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+ TIME := ( 2000, 12, 31, 23, 59, 59, 0 );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET SUCCESSFUL" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_set - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_get - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+
+ TIME := ( 1999, 12, 31, 23, 59, 59, 0 );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET SUCCESSFUL" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_set - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_get - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+
+ TIME := ( 2100, 12, 31, 23, 59, 59, 0 );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET SUCCESSFUL" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_set - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_get - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+
+ TIME := ( 2099, 12, 31, 23, 59, 59, 0 );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET SUCCESSFUL" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_set - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_get - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+
+ TIME := ( 1991, 12, 31, 23, 59, 59, 0 );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET SUCCESSFUL" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_set - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - clock_get - ",
+ TIME,
+ " - SUCCESSFUL"
+ );
+ TEXT_IO.NEW_LINE;
+
+ end SCREEN_13;
+
+--
+-- SCREEN_14
+--
+
+ procedure SCREEN_14
+ is
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TIMER.CREATE( 0, SPTEST.JUNK_ID, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "TIMER_CREATE WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_create - INVALID_NAME" );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 1 ),
+ SPTEST.TIMER_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" );
+ TEXT_IO.PUT_LINE( "TA1 - timer_create - 1 - SUCCESSFUL" );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 1 ),
+ SPTEST.JUNK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.TOO_MANY,
+ "TIMER_CREATE FOR TOO MANY"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_create - 2 - TOO_MANY" );
+
+ RTEMS.TIMER.DELETE( 100, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TIMER_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_delete - local INVALID_ID" );
+
+ RTEMS.TIMER.DELETE( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TIMER_DELETE WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_delete - global INVALID_ID" );
+
+ RTEMS.TIMER.IDENT( 0, SPTEST.JUNK_ID, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NAME,
+ "TIMER_IDENT WITH ILLEGAL NAME"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_ident - INVALID_NAME" );
+
+ RTEMS.TIMER.CANCEL( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TIMER_CANCEL WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_cancel - INVALID_ID" );
+
+ RTEMS.TIMER.RESET( 16#10100#, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TIMER_RESET WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_reset - INVALID_ID" );
+
+ RTEMS.TIMER.RESET( SPTEST.TIMER_ID( 1 ), STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_DEFINED,
+ "TIMER_RESET BEFORE INITIATED"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_reset - NOT_DEFINED" );
+
+ RTEMS.TIMER.FIRE_AFTER(
+ 16#10100#,
+ 5 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TIMER_FIRE_AFTER WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_fire_after - INVALID_ID" );
+
+ TIME := ( 1994, 12, 31, 1, 0, 0, 0 );
+ RTEMS.TIMER.FIRE_WHEN(
+ 16#10100#,
+ TIME,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TIMER_FIRE_WHEN WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_fire_when - INVALID_ID" );
+
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ 0,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NUMBER,
+ "TIMER_FIRE_AFTER WITH 0 TICKS"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_fire_after - INVALID_NUMBER" );
+
+ TIME := ( 1987, 2, 5, 8, 30, 45, 0 );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 1 ),
+ TIME,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "TIMER_FIRE_WHEN WITH ILLEGAL TIME"
+ );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - timer_fire_when - ",
+ TIME,
+ " - INVALID_CLOCK"
+ );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET SUCCESSFUL" );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ TIME := ( 1990, 2, 5, 8, 30, 45, 0 );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 1 ),
+ TIME,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "TIMER_FIRE_WHEN BEFORE CURRENT TIME"
+ );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - timer_fire_when - ",
+ TIME,
+ " - before INVALID_CLOCK"
+ );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.TIMER.SERVER_FIRE_AFTER(
+ 0, 5, SPTEST.DELAYED_SUBPROGRAM'ACCESS, RTEMS.NULL_ADDRESS, STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INCORRECT_STATE,
+ "TIMER_SERVER_FIRE_AFTER INCORRECT STATE"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_after - INCORRECT_STATE" );
+
+ RTEMS.TIMER.SERVER_FIRE_WHEN(
+ 0, TIME, SPTEST.DELAYED_SUBPROGRAM'ACCESS, RTEMS.NULL_ADDRESS, STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INCORRECT_STATE,
+ "TIMER_SERVER_FIRE_WHEN INCORRECT STATE"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_when - INCORRECT_STATE" );
+
+ RTEMS.TIMER.INITIATE_SERVER( 0, 0, 0, STATUS );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_PRIORITY,
+ "timer_initiate_server invalid priority"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_initiate_server - INVALID_PRIORITY" );
+
+ RTEMS.TIMER.INITIATE_SERVER(
+-- XXX ask Joel
+-- RTEMS.TIMER.SERVER_DEFAULT_PRIORITY, 0, 0, STATUS
+ -1, 0, 0, STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "timer_initiate_server" );
+ TEXT_IO.PUT_LINE( "TA1 - timer_initiate_server" );
+
+ RTEMS.TIMER.SERVER_FIRE_AFTER(
+ 16#010100#,
+ 5 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TIMER_SERVER_FIRE_AFTER ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_after - INVALID_ID" );
+
+ TIME := ( 1994, 12, 31, 9, 0, 0, 0 );
+ RTEMS.TIMER.SERVER_FIRE_WHEN(
+ 16#010100#,
+ TIME,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_ID,
+ "TIMER_SERVER_FIRE_WHEN WITH ILLEGAL ID"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_when - INVALID_ID" );
+
+ RTEMS.TIMER.SERVER_FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ 0,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_NUMBER,
+ "TIMER_SERVER_FIRE_AFTER WITH 0 TICKS"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_after - INVALID_NUMBER" );
+
+ TIME := ( 1987, 2, 5, 8, 30, 45, 0 );
+ RTEMS.TIMER.SERVER_FIRE_WHEN(
+ SPTEST.TIMER_ID( 1 ),
+ TIME,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "TIMER_SERVER_FIRE_WHEN WITH ILLEGAL TIME"
+ );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - timer_server_fire_when - ",
+ TIME,
+ " - INVALID_CLOCK"
+ );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "clock_set" );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ TIME := ( 1990, 2, 5, 8, 30, 45, 0 );
+ RTEMS.TIMER.SERVER_FIRE_WHEN(
+ SPTEST.TIMER_ID( 1 ),
+ TIME,
+ SPTEST.DELAYED_SUBPROGRAM'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.INVALID_CLOCK,
+ "TIMER_SERVER_FIRE_WHEN BEFORE CURRENT TIME"
+ );
+ TEST_SUPPORT.PRINT_TIME(
+ "TA1 - timer_server_fire_when - ",
+ TIME,
+ " - before INVALID_CLOCK"
+ );
+ TEXT_IO.NEW_LINE;
+
+ end SCREEN_14;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ begin
+
+ SPTEST.SCREEN_1;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 2 );
+
+ SPTEST.SCREEN_2;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 3 );
+
+ SPTEST.SCREEN_3;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 4 );
+
+ SPTEST.SCREEN_4;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 5 );
+
+ SPTEST.SCREEN_5;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 6 );
+
+ SPTEST.SCREEN_6;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 7 );
+
+ SPTEST.SCREEN_7;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 8 );
+
+ SPTEST.SCREEN_8;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 9 );
+
+ SPTEST.SCREEN_9;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 10 );
+
+ SPTEST.SCREEN_10;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 11 );
+
+ SPTEST.SCREEN_11;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 12 );
+
+ SPTEST.SCREEN_12;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 13 );
+
+ SPTEST.SCREEN_13;
+ TEST_SUPPORT.PAUSE_AND_SCREEN_NUMBER( 14 );
+
+ SPTEST.SCREEN_14;
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 9 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA2 - semaphore_obtain - sem 1 - WAIT FOREVER" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.OBJECT_WAS_DELETED,
+ "SEMAPHORE_OBTAIN WAITING TO BE DELETED"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA2 - semaphore_obtain - woke up with OBJECT_WAS_DELETED"
+ );
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - task_delete - delete self - SUCCESSFUL"
+ );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" );
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ BUFFER : SPTEST.BUFFER;
+ BUFFER_POINTER : RTEMS.ADDRESS;
+ MESSAGE_SIZE : RTEMS.UNSIGNED32 := 0;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ BUFFER_POINTER := BUFFER'ADDRESS;
+
+ TEXT_IO.PUT_LINE(
+ "TA3 - message_queue_receive - Q 1 - WAIT FOREVER"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.OBJECT_WAS_DELETED,
+ "MESSAGE_QUEUE_RECEIVE WAITING TO BE DELETED"
+ );
+ TEXT_IO.PUT( "TA3 - message_queue_receive - woke up " );
+ TEXT_IO.PUT_LINE( "with OBJECT_WAS_DELETED" );
+
+ TEXT_IO.PUT_LINE(
+ "TA3 - task_delete - delete self - SUCCESSFUL"
+ );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA3" );
+
+ end TASK_3;
+
+--
+-- TASK_4
+--
+
+ procedure TASK_4 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.RATE_MONOTONIC.CANCEL(
+ SPTEST.PERIOD_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_OWNER_OF_RESOURCE,
+ "RATE_MONOTONIC_CANCEL NOT THE OWNER"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA4 - rate_monotonic_cancel - NOT_OWNER_OF_RESOURCE"
+ );
+
+ RTEMS.RATE_MONOTONIC.PERIOD(
+ SPTEST.PERIOD_ID( 1 ),
+ 5,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.NOT_OWNER_OF_RESOURCE,
+ "RATE_MONOTONIC_PERIOD NOT THE OWNER"
+ );
+ TEXT_IO.PUT_LINE(
+ "TA4 - rate_monotonic_period - NOT_OWNER_OF_RESOURCE"
+ );
+
+ TEXT_IO.PUT_LINE(
+ "TA4 - task_delete - delete self - SUCCESSFUL"
+ );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA4" );
+
+
+ end TASK_4;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp09/sptest.ads b/testsuites/ada/sptests/sp09/sptest.ads
new file mode 100644
index 0000000000..9fdad75c3a
--- /dev/null
+++ b/testsuites/ada/sptests/sp09/sptest.ads
@@ -0,0 +1,393 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 9 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SYSTEM;
+with System.Storage_Elements;
+
+package SPTEST is
+
+--
+-- Buffer Record similar to that used by RTEMS 3.2.1. Using this
+-- avoids changes to the test.
+--
+
+ type BUFFER is
+ record
+ FIELD1 : RTEMS.UNSIGNED32; -- TEMPORARY UNTIL VARIABLE LENGTH
+ FIELD2 : RTEMS.UNSIGNED32;
+ FIELD3 : RTEMS.UNSIGNED32;
+ FIELD4 : RTEMS.UNSIGNED32;
+ end record;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 11 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 11 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS timers created
+-- by this test.
+--
+
+ TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS semaphores created
+-- by this test.
+--
+
+ SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS message queues
+-- created by this test.
+--
+
+ QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID;
+ QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS partitions created
+-- by this test.
+--
+
+ PARTITION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ PARTITION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS regions created
+-- by this test.
+--
+
+ REGION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ REGION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS ports created
+-- by this test.
+--
+
+ PORT_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ PORT_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS periods created
+-- by this test.
+--
+
+ PERIOD_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ PERIOD_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- This variable is used as the output ID on directives which return
+-- an ID but are invoked in a manner which returns a non-SUCCESSFUL
+-- status code.
+--
+
+ JUNK_ID : RTEMS.ID;
+
+--
+-- The following area defines a memory area to be used as the
+-- internal address space of the port.
+--
+
+ INTERNAL_PORT_AREA_ADDRESS : constant System.Address :=
+ System.Storage_Elements.To_Address(16#00001000#);
+
+ INTERNAL_PORT_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for INTERNAL_PORT_AREA'Address use INTERNAL_PORT_AREA_ADDRESS;
+
+--
+-- The following area defines a memory area to be used as the
+-- external address space of the port.
+--
+
+ EXTERNAL_PORT_AREA_ADDRESS : constant System.Address :=
+ System.Storage_Elements.To_Address(16#00002000#);
+
+ EXTERNAL_PORT_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for EXTERNAL_PORT_AREA'Address use EXTERNAL_PORT_AREA_ADDRESS;
+
+--
+-- The following area defines a memory area to be used as the
+-- memory space for a partition.
+--
+
+ PARTITION_GOOD_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for PARTITION_GOOD_AREA'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+--
+-- The following area defines a memory area to be used as the
+-- memory space for a partition which starts at an invalid address.
+--
+
+ PARTITION_BAD_AREA_ADDRESS : constant System.Address :=
+ System.Storage_Elements.To_Address(16#00000006#);
+
+ PARTITION_BAD_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for PARTITION_BAD_AREA'Address use PARTITION_BAD_AREA_ADDRESS;
+
+--
+-- The following area defines a memory area to be used as the
+-- memory space for a region and constants used to define the regions
+-- starting area and length.
+--
+
+ REGION_GOOD_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 4095 )
+ of RTEMS.UNSIGNED32;
+ for REGION_GOOD_AREA'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+ REGION_START_OFFSET : constant RTEMS.UNSIGNED32 := 1024;
+ REGION_LENGTH : constant RTEMS.UNSIGNED32 := 512;
+
+--
+-- The following area defines a memory area to be used as the
+-- memory space for a region which starts at an invalid address.
+--
+
+ REGION_BAD_AREA_ADDRESS : constant System.Address :=
+ System.Storage_Elements.To_Address(16#00000006#);
+
+ REGION_BAD_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for REGION_BAD_AREA'Address use REGION_BAD_AREA_ADDRESS;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- DELAYED_SUBPROGRAM
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled as a timer service routine.
+-- It performs no actions if it fires.
+--
+
+ procedure DELAYED_SUBPROGRAM (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, DELAYED_SUBPROGRAM);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests numerous error conditions.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests numerous error conditions.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests numerous error conditions.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+--
+-- TASK_4
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests numerous error conditions.
+--
+
+ procedure TASK_4 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_4);
+
+--
+-- SCREEN_1
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_1;
+
+--
+-- SCREEN_2
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_2;
+
+--
+-- SCREEN_3
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_3;
+
+--
+-- SCREEN_4
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_4;
+
+--
+-- SCREEN_5
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_5;
+
+--
+-- SCREEN_6
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_6;
+
+--
+-- SCREEN_7
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_7;
+
+--
+-- SCREEN_8
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_8;
+
+--
+-- SCREEN_9
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_9;
+
+--
+-- SCREEN_10
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_10;
+
+--
+-- SCREEN_11
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_11;
+
+--
+-- SCREEN_12
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_12;
+
+--
+-- SCREEN_13
+--
+-- DESCRIPTION:
+--
+-- This subprogram processes the a single output screen of this test.
+--
+
+ procedure SCREEN_13;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp11/Makefile.am b/testsuites/ada/sptests/sp11/Makefile.am
new file mode 100644
index 0000000000..ec4ded6183
--- /dev/null
+++ b/testsuites/ada/sptests/sp11/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp11
+ada_sp11_SOURCES = sp11.adb config.h sptest.adb sptest.ads
+ada_sp11_SOURCES += ../../support/init.c
+
+ada_sp11$(EXEEXT): sp11.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp11.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp11/ada_sp11.scn b/testsuites/ada/sptests/sp11/ada_sp11.scn
new file mode 100644
index 0000000000..cbb6c4ab88
--- /dev/null
+++ b/testsuites/ada/sptests/sp11/ada_sp11.scn
@@ -0,0 +1,74 @@
+*** TEST 11 ***
+TA1 - event_send - send EVENT_16 to TA2
+TA1 - event_receive - waiting forever on EVENT_14 and EVENT_15
+TA2 - event_receive - waiting forever on EVENT_16
+TA2 - EVENT_16 received - eventout => 16#10000#
+TA2 - event_send - send EVENT_14 and EVENT_15 to TA1
+TA2 - event_receive - waiting forever on EVENT_17 or EVENT_18 - EVENT_ANY
+TA1 - EVENT_14 and EVENT_15 received - eventout => 16#C000#
+TA1 - event_send - send EVENT_18 to TA2
+TA1 - event_receive - waiting with 10 second timeout on EVENT_14
+TA2 - EVENT_17 or EVENT_18 received - eventout => 16#40000#
+TA2 - event_send - send EVENT_14 to TA1
+TA2 - clock_set - 8:15: 0 2/12/1988
+TA2 - event_send - sending EVENT_10 to self after 5 seconds
+TA2 - event_receive - waiting forever on EVENT_10
+TA1 - EVENT_14 received - eventout => 16#4000#
+TA1 - event_send - send EVENT_19 to TA2
+TA1 - clock_get - 8:15: 0 2/12/1988
+<pause>
+TA1 - event_send - send EVENT_18 to self after 5 seconds
+TA1 - event_receive - waiting forever on EVENT_18
+TA2 - EVENT_10 received - eventout => 16#400#
+TA1 - clock_get - 8:15: 5 2/12/1988
+TA2 - event_receive - PENDING_EVENTS
+TA2 - eventout => 16#80000#
+TA2 - event_receive - EVENT_19 - NO_WAIT
+TA2 - EVENT_19 received - eventout => 16#80000#
+TA2 - task_delete - deletes self
+TA1 - EVENT_18 received - eventout => 16#40000#
+TA1 - clock_get - 8:15: 5 2/12/1988
+TA1 - event_send - send EVENT_3 to self
+TA1 - event_receive - EVENT_3 or EVENT_22 - NO_WAIT and EVENT_ANY
+TA1 - EVENT_3 received - eventout => 16#8#
+TA1 - event_send - send EVENT_4 to self
+TA1 - event_receive - waiting forever on EVENT_4 or EVENT_5 - EVENT_ANY
+TA1 - EVENT_4 received - eventout => 16#10#
+<pause>
+TA1 - event_send - send EVENT_18 to self after 5 seconds
+TA1 - timer_cancel - cancelling timer for event EVENT_18
+TA1 - event_send - send EVENT_8 to self after 60 seconds
+TA1 - event_send - send EVENT_9 to self after 60 seconds
+TA1 - event_send - send EVENT_10 to self after 60 seconds
+TA1 - timer_cancel - cancelling timer for event EVENT_8
+TA1 - clock_set - 8:15: 0 2/12/1988
+TA1 - event_send - send EVENT_1 every second
+TA1 - EVENT_1 received - eventout => 16#2# - at 8:15: 1 2/12/1988
+TA1 - EVENT_1 received - eventout => 16#2# - at 8:15: 2 2/12/1988
+TA1 - EVENT_1 received - eventout => 16#2# - at 8:15: 3 2/12/1988
+TA1 - timer_cancel - cancelling timer for event EVENT_1
+<pause>
+TA1 - event_send - send EVENT_11 to self in 1 day
+TA1 - event_send - send EVENT_11 to self in 1 day
+TA1 - event_send - send EVENT_11 to self in 2 days
+TA1 - timer_cancel - cancelling EVENT_11 to self in 1 day
+TA1 - timer_cancel - cancelling EVENT_11 to self in 2 days
+TA1 - event_send - resending EVENT_11 to self in 2 days
+TA1 - clock_set - 8:15: 3 2/15/1988
+TA1 - event_receive - waiting forever on EVENT_11
+TA1 - EVENT_11 received - eventout => 16#800#
+<pause>
+TA1 - event_send/event_receive combination
+TA1 - clock_set - 8:15: 0 2/12/1988
+TA1 - event_receive all outstanding events
+TA1 - event_send - send EVENT_10 to self in 1 day
+TA1 - event_send - send EVENT_11 to self in 2 days
+TA1 - clock_set - 7:15: 0 2/12/1988
+TA1 - set time backwards
+TA1 - no events received
+TA1 - clock_set - 7:15: 0 2/14/1988
+TA1 - set time forwards (leave a timer)
+TA1 - EVENT_10 received
+TA1 - event_send - send EVENT_11 to self in 100 ticks
+TA1 - event_send - send EVENT_11 to self in 200 ticks
+*** END OF TEST 11 ***
diff --git a/testsuites/ada/sptests/sp11/config.h b/testsuites/ada/sptests/sp11/config.h
new file mode 100644
index 0000000000..41506d08ee
--- /dev/null
+++ b/testsuites/ada/sptests/sp11/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 3
+#define CONFIGURE_MAXIMUM_TIMERS 6
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp11/sp11.adb b/testsuites/ada/sptests/sp11/sp11.adb
new file mode 100644
index 0000000000..b39fd4b2be
--- /dev/null
+++ b/testsuites/ada/sptests/sp11/sp11.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP11 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP11 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP11;
+
diff --git a/testsuites/ada/sptests/sp11/sptest.adb b/testsuites/ada/sptests/sp11/sptest.adb
new file mode 100644
index 0000000000..95dd17846b
--- /dev/null
+++ b/testsuites/ada/sptests/sp11/sptest.adb
@@ -0,0 +1,906 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 11 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.CLOCK;
+with RTEMS.EVENT;
+with RTEMS.TIMER;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 11 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ SPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' );
+ SPTEST.TIMER_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'M', '2', ' ' );
+ SPTEST.TIMER_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'M', '3', ' ' );
+ SPTEST.TIMER_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'M', '4', ' ' );
+ SPTEST.TIMER_NAME( 5 ) := RTEMS.BUILD_NAME( 'T', 'M', '5', ' ' );
+ SPTEST.TIMER_NAME( 6 ) := RTEMS.BUILD_NAME( 'T', 'M', '6', ' ' );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 1 ),
+ SPTEST.TIMER_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE OF TM1" );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 2 ),
+ SPTEST.TIMER_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE OF TM2" );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 3 ),
+ SPTEST.TIMER_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE OF TM3" );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 4 ),
+ SPTEST.TIMER_ID( 4 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE OF TM4" );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 5 ),
+ SPTEST.TIMER_ID( 5 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE OF TM5" );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 6 ),
+ SPTEST.TIMER_ID( 6 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE OF TM6" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ EVENTOUT : RTEMS.EVENT_SET;
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ INDEX : RTEMS.UNSIGNED32;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA1 - event_send - send EVENT_16 to TA2" );
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 2 ), RTEMS.EVENT_16, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 16" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive - waiting forever on EVENT_14 and EVENT_15"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_14 + RTEMS.EVENT_15,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 14 and 15" );
+ TEXT_IO.PUT( "TA1 - EVENT_14 and EVENT_15 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - event_send - send EVENT_18 to TA2" );
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 2 ), RTEMS.EVENT_18, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 18" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive - waiting with 10 second timeout on EVENT_14"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_14,
+ RTEMS.DEFAULT_OPTIONS,
+ 10 * TEST_SUPPORT.TICKS_PER_SECOND,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 14" );
+ TEXT_IO.PUT( "TA1 - EVENT_14 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - event_send - send EVENT_19 to TA2" );
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 2 ), RTEMS.EVENT_19, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 19" );
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_18 to self after 5 seconds"
+ );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ 5 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.TA1_SEND_18_TO_SELF_5_SECONDS'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 5 seconds" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive - waiting forever on EVENT_18"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_18,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 18" );
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ TEXT_IO.PUT( "TA1 - EVENT_18 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - event_send - send EVENT_3 to self" );
+ RTEMS.EVENT.SEND( RTEMS.SELF, RTEMS.EVENT_3, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 3" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive - EVENT_3 or EVENT_22 - NO_WAIT and EVENT_ANY"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_3 + RTEMS.EVENT_22,
+ RTEMS.NO_WAIT + RTEMS.EVENT_ANY,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 3 and 22" );
+ TEXT_IO.PUT( "TA1 - EVENT_3 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - event_send - send EVENT_4 to self" );
+ RTEMS.EVENT.SEND( RTEMS.SELF, RTEMS.EVENT_4, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 4" );
+
+ TEXT_IO.PUT_LINE(
+"TA1 - event_receive - waiting forever on EVENT_4 or EVENT_5 - EVENT_ANY"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_4 + RTEMS.EVENT_5,
+ RTEMS.EVENT_ANY,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 4 and 5" );
+ TEXT_IO.PUT( "TA1 - EVENT_4 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_18 to self after 5 seconds"
+ );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ 5 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.TA1_SEND_18_TO_SELF_5_SECONDS'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 5 seconds" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - timer_cancel - cancelling timer for event EVENT_18"
+ );
+ RTEMS.TIMER.CANCEL( SPTEST.TIMER_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CANCEL" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_8 to self after 60 seconds"
+ );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ 60 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.TA1_SEND_8_TO_SELF_60_SECONDS'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 60 secs" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_9 to self after 60 seconds"
+ );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 2 ),
+ 60 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.TA1_SEND_9_TO_SELF_60_SECONDS'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 60 secs" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_10 to self after 60 seconds"
+ );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 3 ),
+ 60 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.TA1_SEND_10_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 60 secs" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - timer_cancel - cancelling timer for event EVENT_8"
+ );
+ RTEMS.TIMER.CANCEL( SPTEST.TIMER_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CANCEL" );
+
+ TIME := ( 1988, 2, 12, 8, 15, 0, 0 );
+
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TA1 CLOCK_SET" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_1 every second"
+ );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.TA1_SEND_1_TO_SELF_EVERY_SECOND'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 1 SECOND" );
+
+ INDEX := 0;
+
+ loop
+
+ exit when INDEX = 3;
+
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_1,
+ RTEMS.EVENT_ANY,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 1" );
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ TEXT_IO.PUT( "TA1 - EVENT_1 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEST_SUPPORT.PRINT_TIME( " - at ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ if INDEX < 2 then
+ RTEMS.TIMER.RESET( SPTEST.TIMER_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TA1 TIMER RESET" );
+ end if;
+
+ INDEX := INDEX + 1;
+ end loop;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - timer_cancel - cancelling timer for event EVENT_1"
+ );
+ RTEMS.TIMER.CANCEL( SPTEST.TIMER_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CANCEL" );
+
+ TEST_SUPPORT.PAUSE;
+
+ TIME.DAY := 13;
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_11 to self in 1 day"
+ );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 1 ),
+ TIME,
+ SPTEST.TA1_SEND_11_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN 1 day" );
+
+ TIME.HOUR := 7;
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_11 to self in 1 day"
+ );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 2 ),
+ TIME,
+ SPTEST.TA1_SEND_11_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN 1 day" );
+ TIME.HOUR := 8;
+
+ TIME.DAY := 14;
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_11 to self in 2 days"
+ );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 3 ),
+ TIME,
+ SPTEST.TA1_SEND_11_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN 2 days" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - timer_cancel - cancelling EVENT_11 to self in 1 day"
+ );
+ RTEMS.TIMER.CANCEL( SPTEST.TIMER_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CANCEL" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - timer_cancel - cancelling EVENT_11 to self in 2 days"
+ );
+ RTEMS.TIMER.CANCEL( SPTEST.TIMER_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CANCEL" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - resending EVENT_11 to self in 2 days"
+ );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 3 ),
+ TIME,
+ SPTEST.TA1_SEND_11_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN 2 days" );
+
+ TIME.DAY := 15;
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TA1 CLOCK_SET" );
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive - waiting forever on EVENT_11"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_11,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 11" );
+ TEXT_IO.PUT( "TA1 - EVENT_11 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEST_SUPPORT.PAUSE;
+
+-- The following code tests the case of deleting a timer ???
+
+ TEXT_IO.PUT_LINE( "TA1 - event_send/event_receive combination" );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ 10,
+ SPTEST.TA1_SEND_11_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 10 ticks" );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_11,
+ RTEMS.DEFAULT_OPTIONS,
+ 11,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" );
+
+ TIME := ( 1988, 2, 12, 8, 15, 0, 0 );
+
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TA1 CLOCK_SET" );
+
+ TIME.DAY := 13;
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_receive all outstanding events"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.ALL_EVENTS,
+ RTEMS.NO_WAIT + RTEMS.EVENT_ANY,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "EVENT_RECEIVE all events"
+ );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_10 to self in 1 day"
+ );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 1 ),
+ TIME,
+ SPTEST.TA1_SEND_10_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN 1 day" );
+
+ TIME.DAY := 14;
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_11 to self in 2 days"
+ );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 2 ),
+ TIME,
+ SPTEST.TA1_SEND_11_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN 2 days" );
+
+ TIME := ( 1988, 2, 12, 7, 15, 0, 0 );
+
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+ TEXT_IO.PUT_LINE( "TA1 - set time backwards" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TA1 CLOCK_SET" );
+
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.ALL_EVENTS,
+ RTEMS.NO_WAIT + RTEMS.EVENT_ANY,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ if EVENTOUT >= RTEMS.EVENT_0 then
+ TEXT_IO.PUT( "ERROR - " );
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.PUT_LINE( " events received" );
+ else
+ TEXT_IO.PUT_LINE( "TA1 - no events received" );
+ end if;
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "EVENT_RECEIVE all events"
+ );
+
+ TIME := ( 1988, 2, 14, 7, 15, 0, 0 );
+
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_set - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+ TEXT_IO.PUT_LINE( "TA1 - set time forwards (leave a timer)" );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TA1 CLOCK_SET" );
+
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.ALL_EVENTS,
+ RTEMS.NO_WAIT + RTEMS.EVENT_ANY,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE all events" );
+ if EVENTOUT = RTEMS.EVENT_10 then
+ TEXT_IO.PUT_LINE( "TA1 - EVENT_10 received" );
+ else
+ TEXT_IO.PUT( "ERROR - " );
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.PUT_LINE( " events received" );
+ end if;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_11 to self in 100 ticks"
+ );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ 100,
+ SPTEST.TA1_SEND_11_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 100 ticks" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - event_send - send EVENT_11 to self in 200 ticks"
+ );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 2 ),
+ 100,
+ SPTEST.TA1_SEND_11_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER 200 ticks" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 11 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ EVENTOUT : RTEMS.EVENT_SET;
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - event_receive - waiting forever on EVENT_16"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_16,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 16" );
+ TEXT_IO.PUT( "TA2 - EVENT_16 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - event_send - send EVENT_14 and EVENT_15 to TA1"
+ );
+ RTEMS.EVENT.SEND(
+ SPTEST.TASK_ID( 1 ),
+ RTEMS.EVENT_14 + RTEMS.EVENT_15,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 14 and 15" );
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - event_receive - waiting forever on EVENT_17 or EVENT_18 - EVENT_ANY"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_17 + RTEMS.EVENT_18,
+ RTEMS.EVENT_ANY,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 17 and 18" );
+ TEXT_IO.PUT( "TA2 - EVENT_17 or EVENT_18 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - event_send - send EVENT_14 to TA1"
+ );
+ RTEMS.EVENT.SEND(
+ SPTEST.TASK_ID( 1 ),
+ RTEMS.EVENT_14,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 14" );
+
+ TIME := ( 1988, 2, 12, 8, 15, 0, 0 );
+
+ TEST_SUPPORT.PRINT_TIME( "TA2 - clock_set - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TA2 CLOCK_SET" );
+
+ TIME.SECOND := TIME.SECOND + 5;
+ TEXT_IO.PUT_LINE(
+ "TA2 - event_send - sending EVENT_10 to self after 5 seconds"
+ );
+ RTEMS.TIMER.FIRE_WHEN(
+ SPTEST.TIMER_ID( 5 ),
+ TIME,
+ SPTEST.TA2_SEND_10_TO_SELF'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN 5 SECONDS" );
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - event_receive - waiting forever on EVENT_10"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_10,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 10" );
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ TEXT_IO.PUT( "TA2 - EVENT_10 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEST_SUPPORT.PRINT_TIME( "TA1 - clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA2 - event_receive - PENDING_EVENTS" );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.PENDING_EVENTS,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 10" );
+ TEXT_IO.PUT( "TA2 - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - event_receive - EVENT_19 - NO_WAIT"
+ );
+ RTEMS.EVENT.RECEIVE(
+ RTEMS.EVENT_19,
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ EVENTOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE of 10" );
+ TEXT_IO.PUT( "TA2 - EVENT_19 received - eventout => ");
+ UNSIGNED32_IO.PUT( EVENTOUT, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA2 - task_delete - deletes self" );
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE of TA2" );
+
+ end TASK_2;
+
+--
+-- TA1_SEND_18_TO_SELF_5_SECONDS
+--
+
+ procedure TA1_SEND_18_TO_SELF_5_SECONDS (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ )
+ is
+ pragma Unreferenced(IGNORED_ID);
+ pragma Unreferenced(IGNORED_ADDRESS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 1 ), RTEMS.EVENT_18, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 18" );
+
+ end TA1_SEND_18_TO_SELF_5_SECONDS;
+
+--
+-- TA1_SEND_8_TO_SELF_60_SECONDS
+--
+
+ procedure TA1_SEND_8_TO_SELF_60_SECONDS (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ )
+ is
+ pragma Unreferenced(IGNORED_ID);
+ pragma Unreferenced(IGNORED_ADDRESS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 1 ), RTEMS.EVENT_8, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 8" );
+
+ end TA1_SEND_8_TO_SELF_60_SECONDS;
+
+--
+-- TA1_SEND_9_TO_SELF_60_SECONDS
+--
+
+ procedure TA1_SEND_9_TO_SELF_60_SECONDS (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ )
+ is
+ pragma Unreferenced(IGNORED_ID);
+ pragma Unreferenced(IGNORED_ADDRESS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 1 ), RTEMS.EVENT_9, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 9" );
+
+ end TA1_SEND_9_TO_SELF_60_SECONDS;
+
+--
+-- TA1_SEND_10_TO_SELF
+--
+
+ procedure TA1_SEND_10_TO_SELF (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ )
+ is
+ pragma Unreferenced(IGNORED_ID);
+ pragma Unreferenced(IGNORED_ADDRESS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 1 ), RTEMS.EVENT_10, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 10" );
+
+ end TA1_SEND_10_TO_SELF;
+
+--
+-- TA1_SEND_1_TO_SELF_EVERY_SECOND
+--
+
+ procedure TA1_SEND_1_TO_SELF_EVERY_SECOND (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ )
+ is
+ pragma Unreferenced(IGNORED_ID);
+ pragma Unreferenced(IGNORED_ADDRESS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 1 ), RTEMS.EVENT_1, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 1" );
+
+ end TA1_SEND_1_TO_SELF_EVERY_SECOND;
+
+--
+-- TA1_SEND_11_TO_SELF
+--
+
+ procedure TA1_SEND_11_TO_SELF (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ )
+ is
+ pragma Unreferenced(IGNORED_ID);
+ pragma Unreferenced(IGNORED_ADDRESS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 1 ), RTEMS.EVENT_11, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 11" );
+
+ end TA1_SEND_11_TO_SELF;
+
+--
+-- TA2_SEND_10_TO_SELF
+--
+
+ procedure TA2_SEND_10_TO_SELF (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ )
+ is
+ pragma Unreferenced(IGNORED_ID);
+ pragma Unreferenced(IGNORED_ADDRESS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.EVENT.SEND( SPTEST.TASK_ID( 2 ), RTEMS.EVENT_10, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND of 10" );
+
+ end TA2_SEND_10_TO_SELF;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp11/sptest.ads b/testsuites/ada/sptests/sp11/sptest.ads
new file mode 100644
index 0000000000..b7f03b8f4c
--- /dev/null
+++ b/testsuites/ada/sptests/sp11/sptest.ads
@@ -0,0 +1,186 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 11 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS timers created
+-- by this test.
+--
+
+ TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 6 ) of RTEMS.ID;
+ TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 6 ) of RTEMS.NAME;
+
+--
+-- TA1_SEND_18_TO_SELF_5_SECONDS
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled to be fired by a timer after 5 seconds
+-- and to send EVENT_18 to TASK_1.
+--
+
+ procedure TA1_SEND_18_TO_SELF_5_SECONDS (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, TA1_SEND_18_TO_SELF_5_SECONDS);
+
+--
+-- TA1_SEND_8_TO_SELF_60_SECONDS
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled to be fired by a timer after 60 seconds
+-- and to send EVENT_8 to TASK_1.
+--
+
+ procedure TA1_SEND_8_TO_SELF_60_SECONDS (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, TA1_SEND_8_TO_SELF_60_SECONDS);
+
+--
+-- TA1_SEND_9_TO_SELF_5_SECONDS
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled to be fired by a timer after 60 seconds
+-- and to send EVENT_9 to TASK_1.
+--
+
+ procedure TA1_SEND_9_TO_SELF_60_SECONDS (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, TA1_SEND_9_TO_SELF_60_SECONDS);
+
+--
+-- TA1_SEND_10_TO_SELF
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled to be fired by a timer after 60 seconds
+-- and to send EVENT_10 to TASK_1.
+--
+
+ procedure TA1_SEND_10_TO_SELF (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, TA1_SEND_10_TO_SELF);
+
+--
+-- TA1_SEND_1_TO_SELF_EVERY_SECOND
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled to be fired by a timer every second
+-- and to send EVENT_1 to TASK_1 until the timer is cancelled.
+--
+
+ procedure TA1_SEND_1_TO_SELF_EVERY_SECOND (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, TA1_SEND_1_TO_SELF_EVERY_SECOND);
+
+--
+-- TA1_SEND_11_TO_SELF
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled to be fired by a timer at a
+-- specific time of day and to send EVENT_11 to TASK_1.
+--
+
+ procedure TA1_SEND_11_TO_SELF (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, TA1_SEND_11_TO_SELF);
+
+--
+-- TA2_SEND_10_TO_SELF
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled to be fired by a timer after 5 seconds
+-- and to send EVENT_10 to TASK_2.
+--
+
+ procedure TA2_SEND_10_TO_SELF (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, TA2_SEND_10_TO_SELF);
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Event and Timer Managers.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Event and Timer Managers.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp12/Makefile.am b/testsuites/ada/sptests/sp12/Makefile.am
new file mode 100644
index 0000000000..0a99682f1a
--- /dev/null
+++ b/testsuites/ada/sptests/sp12/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp12
+ada_sp12_SOURCES = sp12.adb config.h sptest.adb sptest.ads
+ada_sp12_SOURCES += ../../support/init.c
+
+ada_sp12$(EXEEXT): sp12.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp12.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp12/ada_sp12.scn b/testsuites/ada/sptests/sp12/ada_sp12.scn
new file mode 100644
index 0000000000..d1753e5ace
--- /dev/null
+++ b/testsuites/ada/sptests/sp12/ada_sp12.scn
@@ -0,0 +1,78 @@
+*** TEST 12 ***
+INIT - Forward priority queue test
+PRI1 - semaphore_obtain - wait forever on SM2
+PRI2 - semaphore_obtain - wait forever on SM2
+PRI3 - semaphore_obtain - wait forever on SM2
+PRI4 - semaphore_obtain - wait forever on SM2
+PRI5 - semaphore_obtain - wait forever on SM2
+INIT - Backward priority queue test
+PRI5 - semaphore_obtain - wait forever on SM2
+PRI4 - semaphore_obtain - wait forever on SM2
+PRI3 - semaphore_obtain - wait forever on SM2
+PRI2 - semaphore_obtain - wait forever on SM2
+PRI1 - semaphore_obtain - wait forever on SM2
+<pause>
+INIT - Binary Semaphore and Priority Inheritance Test
+INIT - semaphore_create - allocated binary semaphore
+INIT - semaphore_release - allocated binary semaphore
+INIT - semaphore_delete - allocated binary semaphore
+PRI5 - semaphore_obtain - wait forever on SM2
+PRI5 - task_suspend - until all priority tasks blocked
+PDRV - priority of PRI5 is 67
+PRI4 - semaphore_obtain - wait forever on SM2
+PDRV - change priority of PRI5 from 67 to 68
+PDRV - priority of PRI5 is 67
+PRI3 - semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 67
+PRI2 - semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 66
+PRI1 - semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 65
+PDRV - task_resume - PRI5
+PRI5 - task_delete - all tasks waiting on SM2
+PRI5 - semaphore_obtain - nested
+PRI5 - semaphore_release - nested
+PRI5 - semaphore_release - restore priority
+PRI5 - priority of PRI5 is 68
+<pause>
+TA1 - semaphore_ident - smid => 16#1A010009#
+TA1 - semaphore_obtain - wait forever on SM2
+TA1 - got SM2
+TA1 - semaphore_obtain - wait forever on SM3
+TA1 - got SM3
+TA1 - semaphore_obtain - get SM1 - NO_WAIT
+TA1 - got SM1
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - semaphore_obtain - wait forever on SM1
+TA3 - semaphore_obtain - wait forever on SM2
+<pause>
+TA1 - semaphore_release - release SM1
+TA1 - semaphore_obtain - waiting for SM1 with 10 second timeout
+TA2 - got SM1
+TA2 - semaphore_release - release SM1
+TA2 - task_set_priority - make self highest priority task
+TA2 - semaphore_obtain - wait forever on SM2
+TA1 - got SM1
+TA1 - semaphore_release - release SM2
+TA2 - got SM2
+TA2 - semaphore_release - release SM2
+TA2 - task_delete - delete self
+TA1 - task_wake_after - sleep 5 seconds
+TA3 - got SM2
+TA3 - semaphore_release - release SM2
+TA3 - semaphore_obtain - wait forever on SM3
+<pause>
+TA1 - task_delete - delete TA3
+TA1 - task_wake_after - sleep 5 seconds
+TA4 - semaphore_obtain - wait forever on SM1
+TA5 - semaphore_obtain - wait forever on SM1
+TA1 - task_delete - delete TA4
+TA1 - semaphore_release - release SM1
+TA1 - task_wake_after - sleep 5 seconds
+TA5 - got SM1
+TA5 - semaphore_obtain - wait forever on SM1
+TA1 - semaphore_delete - delete SM1
+TA1 - semaphore_delete - delete SM3
+TA1 - task_delete - delete self
+TA5 - SM1 deleted by TA1
+*** END OF TEST 12 ***
diff --git a/testsuites/ada/sptests/sp12/config.h b/testsuites/ada/sptests/sp12/config.h
new file mode 100644
index 0000000000..cd574e737f
--- /dev/null
+++ b/testsuites/ada/sptests/sp12/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 8
+#define CONFIGURE_MAXIMUM_SEMAPHORES 10
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp12/sp12.adb b/testsuites/ada/sptests/sp12/sp12.adb
new file mode 100644
index 0000000000..62a5761e51
--- /dev/null
+++ b/testsuites/ada/sptests/sp12/sp12.adb
@@ -0,0 +1,56 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP12 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP12 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE * 2,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP12;
+
diff --git a/testsuites/ada/sptests/sp12/sptest.adb b/testsuites/ada/sptests/sp12/sptest.adb
new file mode 100644
index 0000000000..c1d9f627f8
--- /dev/null
+++ b/testsuites/ada/sptests/sp12/sptest.adb
@@ -0,0 +1,809 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 12 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.SEMAPHORE;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 12 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+ SPTEST.TASK_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'A', '4', ' ' );
+ SPTEST.TASK_NAME( 5 ) := RTEMS.BUILD_NAME( 'T', 'A', '5', ' ' );
+
+ SPTEST.PRIORITY_TASK_NAME( 1 ) :=
+ RTEMS.BUILD_NAME( 'P', 'R', 'I', '1' );
+ SPTEST.PRIORITY_TASK_NAME( 2 ) :=
+ RTEMS.BUILD_NAME( 'P', 'R', 'I', '2' );
+ SPTEST.PRIORITY_TASK_NAME( 3 ) :=
+ RTEMS.BUILD_NAME( 'P', 'R', 'I', '3' );
+ SPTEST.PRIORITY_TASK_NAME( 4 ) :=
+ RTEMS.BUILD_NAME( 'P', 'R', 'I', '4' );
+ SPTEST.PRIORITY_TASK_NAME( 5 ) :=
+ RTEMS.BUILD_NAME( 'P', 'R', 'I', '5' );
+
+ SPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'M', '1', ' ' );
+ SPTEST.SEMAPHORE_NAME( 2 ) := RTEMS.BUILD_NAME( 'S', 'M', '2', ' ' );
+ SPTEST.SEMAPHORE_NAME( 3 ) := RTEMS.BUILD_NAME( 'S', 'M', '3', ' ' );
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 1 ),
+ 1,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.SEMAPHORE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE OF SM1" );
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 2 ),
+ 0,
+ RTEMS.PRIORITY,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE OF SM2" );
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 3 ),
+ 1,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.SEMAPHORE_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE OF SM3" );
+
+ TEXT_IO.PUT_LINE( "INIT - Forward priority queue test" );
+ SPTEST.PRIORITY_TEST_DRIVER( 0 );
+
+ TEXT_IO.PUT_LINE( "INIT - Backward priority queue test" );
+ SPTEST.PRIORITY_TEST_DRIVER( 32 );
+
+TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE(
+ "INIT - Binary Semaphore and Priority Inheritance Test"
+ );
+
+ RTEMS.SEMAPHORE.DELETE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_DELETE OF SM2" );
+
+ TEXT_IO.PUT_LINE(
+ "INIT - semaphore_create - allocated binary semaphore"
+ );
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 2 ),
+ 0,
+ RTEMS.BINARY_SEMAPHORE + RTEMS.PRIORITY + RTEMS.INHERIT_PRIORITY,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE OF SM2" );
+
+ TEXT_IO.PUT_LINE(
+ "INIT - semaphore_release - allocated binary semaphore"
+ );
+ RTEMS.SEMAPHORE.RELEASE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE OF SM2" );
+
+ TEXT_IO.PUT_LINE(
+ "INIT - semaphore_delete - allocated binary semaphore"
+ );
+ RTEMS.SEMAPHORE.DELETE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_DELETE OF SM2" );
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 2 ),
+ 1,
+ RTEMS.BINARY_SEMAPHORE + RTEMS.PRIORITY + RTEMS.INHERIT_PRIORITY,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE OF SM2" );
+
+ SPTEST.PRIORITY_TEST_DRIVER( 64 );
+
+TEST_SUPPORT.PAUSE;
+
+ RTEMS.SEMAPHORE.DELETE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_DELETE OF SM2" );
+
+ RTEMS.SEMAPHORE.CREATE(
+ SPTEST.SEMAPHORE_NAME( 2 ),
+ 0,
+ RTEMS.PRIORITY,
+ RTEMS.TASKS.NO_PRIORITY,
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE OF SM2" );
+
+ RTEMS.SEMAPHORE.RELEASE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE OF SM2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- PRIORITY_TEST_DRIVER
+--
+
+ procedure PRIORITY_TEST_DRIVER (
+ PRIORITY_BASE : in RTEMS.UNSIGNED32
+ ) is
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ for INDEX in 1 .. 5
+ loop
+
+ case INDEX is
+ when 1 | 2 | 3 =>
+ SPTEST.TASK_PRIORITY( INDEX ) :=
+ PRIORITY_BASE + RTEMS.TASKS.PRIORITY( INDEX );
+ when others =>
+ SPTEST.TASK_PRIORITY( INDEX ) := PRIORITY_BASE + 3;
+ end case;
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.PRIORITY_TASK_NAME( INDEX ),
+ SPTEST.TASK_PRIORITY( INDEX ),
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.PRIORITY_TASK_ID( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
+
+ end loop;
+
+ if PRIORITY_BASE = 0 then
+
+ for INDEX in 1 .. 5
+ loop
+
+ RTEMS.TASKS.START(
+ SPTEST.PRIORITY_TASK_ID( INDEX ),
+ SPTEST.PRIORITY_TASK'ACCESS,
+ RTEMS.TASKS.ARGUMENT( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
+
+ end loop;
+
+ else
+
+ for INDEX in reverse 1 .. 5
+ loop
+
+ RTEMS.TASKS.START(
+ SPTEST.PRIORITY_TASK_ID( INDEX ),
+ SPTEST.PRIORITY_TASK'ACCESS,
+ RTEMS.TASKS.ARGUMENT( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER LOOP" );
+
+ if PRIORITY_BASE = 64 then
+ if INDEX = 4 then
+ RTEMS.TASKS.SET_PRIORITY(
+ SPTEST.PRIORITY_TASK_ID( 5 ),
+ PRIORITY_BASE + 4,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEXT_IO.PUT( "PDRV - change priority of PRI5 from " );
+ UNSIGNED32_IO.PUT( PREVIOUS_PRIORITY );
+ TEXT_IO.PUT( " to " );
+ UNSIGNED32_IO.PUT( PRIORITY_BASE + 4 );
+ TEXT_IO.NEW_LINE;
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "PDRV TASK_SET_PRIORITY"
+ );
+ end if;
+
+ RTEMS.TASKS.SET_PRIORITY(
+ SPTEST.PRIORITY_TASK_ID( 5 ),
+ RTEMS.TASKS.CURRENT_PRIORITY,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEXT_IO.PUT( "PDRV - priority of PRI5 is " );
+ UNSIGNED32_IO.PUT( PREVIOUS_PRIORITY );
+ TEXT_IO.NEW_LINE;
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "PDRV TASK_SET_PRIORITY"
+ );
+ end if;
+
+ end loop;
+
+ end if;
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER AFTER LOOP" );
+
+ if PRIORITY_BASE = 0 then
+ for INDEX in 1 .. 5
+ loop
+
+ RTEMS.SEMAPHORE.RELEASE(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SEMAPHORE_RELEASE LOOP"
+ );
+
+ end loop;
+ end if;
+
+ if PRIORITY_BASE = 64 then
+
+ TEXT_IO.PUT_LINE( "PDRV - task_resume - PRI5" );
+ RTEMS.TASKS.RESUME( SPTEST.PRIORITY_TASK_ID( 5 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME" );
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "TASK_WAKE_AFTER SO PRI5 can run"
+ );
+
+ RTEMS.TASKS.DELETE( SPTEST.PRIORITY_TASK_ID( 5 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF PRI5" );
+ else
+
+ for INDEX in 1 .. 5
+ loop
+
+ RTEMS.TASKS.DELETE(
+ SPTEST.PRIORITY_TASK_ID( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE LOOP" );
+
+ end loop;
+ end if;
+
+
+ end PRIORITY_TEST_DRIVER;
+
+--
+-- PRIORITY_TASK
+--
+
+ procedure PRIORITY_TASK (
+ ITS_INDEX : in RTEMS.TASKS.ARGUMENT
+ ) is
+ TIMEOUT : RTEMS.INTERVAL;
+ ITS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ CURRENT_PRIORITY : RTEMS.TASKS.PRIORITY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ ITS_PRIORITY := SPTEST.TASK_PRIORITY( INTEGER( ITS_INDEX ) );
+
+ if ITS_PRIORITY < 3 then
+ TIMEOUT := 5 * TEST_SUPPORT.TICKS_PER_SECOND;
+ else
+ TIMEOUT := RTEMS.NO_TIMEOUT;
+ end if;
+
+ TEST_SUPPORT.PUT_NAME( PRIORITY_TASK_NAME( INTEGER(ITS_INDEX) ), FALSE );
+ TEXT_IO.PUT_LINE( " - semaphore_obtain - wait forever on SM2" );
+
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ RTEMS.DEFAULT_OPTIONS,
+ TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN OF SM2" );
+
+ if ITS_PRIORITY < 64 then
+ TEXT_IO.PUT( "PRI" );
+ UNSIGNED32_IO.PUT( ITS_INDEX );
+ TEXT_IO.PUT( " - WHY AM I HERE? (priority = " );
+ UNSIGNED32_IO.PUT( ITS_PRIORITY );
+ TEXT_IO.PUT_LINE( " )" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ if ITS_INDEX = 5 then
+ TEXT_IO.PUT_LINE(
+ "PRI5 - task_suspend - until all priority tasks blocked"
+ );
+ end if;
+
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ TEXT_IO.PUT_LINE( "PRI5 - task_delete - all tasks waiting on SM2" );
+ for INDEX in 1 .. 4
+ loop
+
+ RTEMS.TASKS.DELETE( SPTEST.PRIORITY_TASK_ID( INDEX ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE LOOP" );
+
+ end loop;
+
+ TEXT_IO.PUT_LINE( "PRI5 - semaphore_obtain - nested" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ RTEMS.DEFAULT_OPTIONS,
+ TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN NESTED" );
+
+ TEXT_IO.PUT_LINE( "PRI5 - semaphore_release - nested" );
+ RTEMS.SEMAPHORE.RELEASE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE NESTED" );
+
+ TEXT_IO.PUT_LINE( "PRI5 - semaphore_release - restore priority" );
+ RTEMS.SEMAPHORE.RELEASE( SPTEST.SEMAPHORE_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" );
+
+ RTEMS.TASKS.SET_PRIORITY(
+ SPTEST.PRIORITY_TASK_ID( 5 ),
+ RTEMS.TASKS.CURRENT_PRIORITY,
+ CURRENT_PRIORITY,
+ STATUS
+ );
+ TEXT_IO.PUT( "PRI5 - priority of PRI5 is " );
+ UNSIGNED32_IO.PUT( CURRENT_PRIORITY );
+ TEXT_IO.NEW_LINE;
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "PRI5 TASK_SET_PRIORITY CURRENT"
+ );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ -- DOES NOT RETURN. Following check makes compiler happy
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ end PRIORITY_TASK;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ SMID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.SEMAPHORE.IDENT(
+ SPTEST.SEMAPHORE_NAME( 1 ),
+ RTEMS.SEARCH_ALL_NODES,
+ SMID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_IDENT OF SM1" );
+ TEXT_IO.PUT( "TA1 - semaphore_ident - smid => " );
+ UNSIGNED32_IO.PUT( SMID, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_obtain - wait forever on SM2" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - got SM2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_obtain - wait forever on SM3" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 3 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM3" );
+
+ TEXT_IO.PUT_LINE( "TA1 - got SM3" );
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_obtain - get SM1 - NO_WAIT" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM1" );
+
+ TEXT_IO.PUT_LINE( "TA1 - got SM1" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_release - release SM1" );
+ RTEMS.SEMAPHORE.RELEASE( SPTEST.SEMAPHORE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE ON SM1" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - semaphore_obtain - waiting for SM1 with 10 second timeout"
+ );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.DEFAULT_MODES,
+ 10 * TEST_SUPPORT.TICKS_PER_SECOND,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM3" );
+
+ TEXT_IO.PUT_LINE( "TA1 - got SM1" );
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_release - release SM2" );
+ RTEMS.SEMAPHORE.RELEASE(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE ON SM2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - delete TA3" );
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA3" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 4 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 4 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA4" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 5 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 5 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA5" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 4 ),
+ SPTEST.TASK_4'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA4" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 5 ),
+ SPTEST.TASK_5'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA5" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - delete TA4" );
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 4 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA4" );
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_release - release SM1" );
+ RTEMS.SEMAPHORE.RELEASE(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE ON SM1" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_delete - delete SM1" );
+ RTEMS.SEMAPHORE.DELETE( SPTEST.SEMAPHORE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_DELETE OF SM1" );
+
+ TEXT_IO.PUT_LINE( "TA1 - semaphore_delete - delete SM3" );
+ RTEMS.SEMAPHORE.DELETE( SPTEST.SEMAPHORE_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_DELETE OF SM3" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - delete self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA1" );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA2 - semaphore_obtain - wait forever on SM1" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM1" );
+
+ TEXT_IO.PUT_LINE( "TA2 - got SM1" );
+
+ TEXT_IO.PUT_LINE( "TA2 - semaphore_release - release SM1" );
+ RTEMS.SEMAPHORE.RELEASE(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE ON SM1" );
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - task_set_priority - make self highest priority task"
+ );
+ RTEMS.TASKS.SET_PRIORITY(
+ RTEMS.SELF,
+ 3,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY ON TA2" );
+
+ TEXT_IO.PUT_LINE( "TA2 - semaphore_obtain - wait forever on SM2" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM2" );
+
+ TEXT_IO.PUT_LINE( "TA2 - got SM2" );
+
+ TEXT_IO.PUT_LINE( "TA2 - semaphore_release - release SM2" );
+ RTEMS.SEMAPHORE.RELEASE(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE ON SM2" );
+
+ TEXT_IO.PUT_LINE( "TA2 - task_delete - delete self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" );
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA3 - semaphore_obtain - wait forever on SM2" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM2" );
+ TEXT_IO.PUT_LINE( "TA3 - got SM2" );
+
+ TEXT_IO.PUT_LINE( "TA3 - semaphore_release - release SM2" );
+ RTEMS.SEMAPHORE.RELEASE(
+ SPTEST.SEMAPHORE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE ON SM2" );
+
+ TEXT_IO.PUT_LINE( "TA3 - semaphore_obtain - wait forever on SM3" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 3 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM3" );
+
+ end TASK_3;
+
+--
+-- TASK_4
+--
+
+ procedure TASK_4 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA4 - semaphore_obtain - wait forever on SM1" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM1" );
+
+ end TASK_4;
+
+--
+-- TASK_5
+--
+
+ procedure TASK_5 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA5 - semaphore_obtain - wait forever on SM1" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN ON SM1" );
+
+ TEXT_IO.PUT_LINE( "TA5 - got SM1" );
+
+ TEXT_IO.PUT_LINE( "TA5 - semaphore_obtain - wait forever on SM1" );
+ RTEMS.SEMAPHORE.OBTAIN(
+ SPTEST.SEMAPHORE_ID( 1 ),
+ RTEMS.DEFAULT_MODES,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.OBJECT_WAS_DELETED,
+ "SEMAPHORE_OBTAIN ON SM1"
+ );
+ TEXT_IO.PUT_LINE( "TA5 - SM1 deleted by TA1" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 12 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_5;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp12/sptest.ads b/testsuites/ada/sptests/sp12/sptest.ads
new file mode 100644
index 0000000000..663faa7686
--- /dev/null
+++ b/testsuites/ada/sptests/sp12/sptest.ads
@@ -0,0 +1,147 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 12 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 5 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 5 ) of RTEMS.NAME;
+
+ PRIORITY_TASK_ID : array ( 1 .. 5 ) of RTEMS.ID;
+ PRIORITY_TASK_NAME : array ( 1 .. 5 ) of RTEMS.NAME;
+ TASK_PRIORITY : array ( 1 .. 5 ) of RTEMS.TASKS.PRIORITY;
+
+ SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- PRIORITY_TEST_DRIVER
+--
+-- DESCRIPTION:
+--
+-- This subprogram creates and starts RTEMS tasks of different priority
+-- so that those tasks may exercise the priority blocking algorithm.
+--
+
+ procedure PRIORITY_TEST_DRIVER (
+ PRIORITY_BASE : in RTEMS.UNSIGNED32
+ );
+
+--
+-- PRIORITY_TASK
+--
+-- DESCRIPTION:
+--
+-- Copies of this RTEMS are executed at different priorities and each
+-- instantiation blocks on a semaphore with priority blocking. This
+-- is done to exercise the priority blocking algorithms.
+--
+
+ procedure PRIORITY_TASK (
+ ITS_INDEX : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, PRIORITY_TASK);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Semaphore Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Semaphore Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Semaphore Manager.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+--
+-- TASK_4
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Semaphore Manager.
+--
+
+ procedure TASK_4 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_4);
+
+--
+-- TASK_5
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Semaphore Manager.
+--
+
+ procedure TASK_5 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_5);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp13/Makefile.am b/testsuites/ada/sptests/sp13/Makefile.am
new file mode 100644
index 0000000000..19a8ed23ff
--- /dev/null
+++ b/testsuites/ada/sptests/sp13/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp13
+ada_sp13_SOURCES = sp13.adb config.h sptest.adb sptest.ads
+ada_sp13_SOURCES += ../../support/init.c
+
+ada_sp13$(EXEEXT): sp13.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp13.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp13/ada_sp13.scn b/testsuites/ada/sptests/sp13/ada_sp13.scn
new file mode 100644
index 0000000000..f54a497a58
--- /dev/null
+++ b/testsuites/ada/sptests/sp13/ada_sp13.scn
@@ -0,0 +1,78 @@
+*** TEST 13 ***
+TA1 - message_queue_ident - qid => 16#22010001#
+TA1 - message_queue_send - BUFFER 1 TO Q 1
+TA1 - message_queue_send - BUFFER 2 TO Q 1
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - message_queue_receive - receive from queue 1 - NO_WAIT
+TA2 - buffer received: BUFFER 1 TO Q 1
+TA2 - message_queue_receive - receive from queue 1 - WAIT FOREVER
+TA2 - buffer received: BUFFER 2 TO Q 1
+TA2 - message_queue_receive - receive from queue 1 - WAIT FOREVER
+TA3 - message_queue_receive - receive from queue 2 - WAIT FOREVER
+TA1 - message_queue_send - BUFFER 3 TO Q 1
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - buffer received: BUFFER 3 TO Q 1
+TA2 - task_set_priority - make self highest priority task
+TA2 - message_queue_receive - receive from queue 2 - WAIT FOREVER
+<pause>
+TA1 - message_queue_send - BUFFER 1 TO Q 2
+TA2 - buffer received: BUFFER 1 TO Q 2
+TA2 - message_queue_send - BUFFER 2 TO Q 2
+TA2 - message_queue_receive - receive from queue 1 - 10 second timeout
+TA1 - message_queue_receive - receive from queue 1 - 10 second timeout
+TA3 - buffer received: BUFFER 2 TO Q 2
+TA3 - message_queue_broadcast - BUFFER 3 TO Q 1
+TA2 - buffer received: BUFFER 3 TO Q 1
+TA2 - message_queue_receive - receive from queue 3 - WAIT FOREVER
+TA3 - number of tasks awakened = 2
+TA3 - message_queue_receive - receive from queue 3 - WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 1
+TA1 - task_delete - delete TA2
+TA1 - message_queue_send - BUFFER 1 TO Q 3
+TA1 - task_wake_after - sleep 5 seconds
+TA3 - buffer received: BUFFER 1 TO Q 3
+TA3 - task_delete - delete self
+<pause>
+TA1 - message_queue_send - BUFFER 2 TO Q 3
+TA1 - message_queue_send - BUFFER 3 TO Q 3
+TA1 - message_queue_send - BUFFER 4 TO Q 3
+TA1 - message_queue_urgent - BUFFER 5 TO Q 3
+TA1 - message_queue_receive - receive from queue 3 - WAIT FOREVER
+TA1 - buffer received: BUFFER 5 TO Q 3
+TA1 - message_queue_receive - receive from queue 3 - WAIT FOREVER
+TA1 - buffer received: BUFFER 2 TO Q 3
+TA1 - message_queue_receive - receive from queue 3 - WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 3
+TA1 - message_queue_receive - receive from queue 3 - WAIT FOREVER
+TA1 - buffer received: BUFFER 4 TO Q 3
+TA1 - message_queue_urgent - BUFFER 3 TO Q 2
+TA1 - message_queue_receive - receive from queue 2 - WAIT FOREVER
+TA1 - buffer received: BUFFER 3 TO Q 2
+<pause>
+TA1 - message_queue_delete - delete queue 1
+TA1 - message_queue_urgent - BUFFER 3 TO Q 2
+TA1 - message_queue_delete - delete queue 2
+TA1 - message_queue_get_number_pending - check Q 3
+TA1 - 0 messages are pending on Q 3
+TA1 - message_queue_flush - empty Q 3
+TA1 - 0 messages were flushed from Q 3
+TA1 - message_queue_send - BUFFER 1 TO Q 3
+TA1 - message_queue_send - BUFFER 2 TO Q 3
+TA1 - message_queue_broadcast - NO BUFFER TO Q1
+TA1 - number of tasks awakened = 0
+TA1 - message_queue_get_number_pending - check Q 3
+TA1 - 2 messages are pending on Q 3
+TA1 - message_queue_send - BUFFER 3 TO Q 3
+TA1 - message_queue_flush - Q 3
+TA1 - 3 messages were flushed from Q 3
+TA1 - message_queue_send - until all message buffers consumed
+TA1 - message_queue_send - all message buffers consumed
+TA1 - message_queue_flush - Q 3
+TA1 - 100 messages were flushed from Q 3
+<pause>
+TA1 - create message queue of 20 bytes on queue 1
+TA1 - message_queue_delete - delete queue 1
+<pause>
+TA1 - message_queue_create - variable sizes
+TA1 - message_queue_create and send - variable sizes
+*** END OF TEST 13 ***
diff --git a/testsuites/ada/sptests/sp13/config.h b/testsuites/ada/sptests/sp13/config.h
new file mode 100644
index 0000000000..8e7821e061
--- /dev/null
+++ b/testsuites/ada/sptests/sp13/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp13/sp13.adb b/testsuites/ada/sptests/sp13/sp13.adb
new file mode 100644
index 0000000000..503e8fb989
--- /dev/null
+++ b/testsuites/ada/sptests/sp13/sp13.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP13 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP13 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP13;
+
diff --git a/testsuites/ada/sptests/sp13/sptest.adb b/testsuites/ada/sptests/sp13/sptest.adb
new file mode 100644
index 0000000000..7b61b9e7ba
--- /dev/null
+++ b/testsuites/ada/sptests/sp13/sptest.adb
@@ -0,0 +1,891 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 13 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.MESSAGE_QUEUE;
+with TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+use type RTEMS.STATUS_CODES;
+
+package body SPTEST is
+
+ type BIG_BUFFER_TYPE is array (1 .. 2048) of RTEMS.UNSIGNED8;
+
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 13 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ SPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'Q', '1', ' ', ' ' );
+ SPTEST.QUEUE_NAME( 2 ) := RTEMS.BUILD_NAME( 'Q', '2', ' ', ' ' );
+ SPTEST.QUEUE_NAME( 3 ) := RTEMS.BUILD_NAME( 'Q', '3', ' ', ' ' );
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 100,
+ 16,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.QUEUE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "QUEUE_CREATE OF Q1" );
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 2 ),
+ 10,
+ 16,
+ RTEMS.PRIORITY,
+ SPTEST.QUEUE_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "QUEUE_CREATE OF Q2" );
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 3 ),
+ 100,
+ 16,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.QUEUE_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "QUEUE_CREATE OF Q3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- FILL_BUFFER
+--
+
+--
+-- Depends on tricks to make the copy work.
+--
+
+ procedure FILL_BUFFER (
+ SOURCE : in STRING;
+ BUFFER : out SPTEST.BUFFER
+ ) is
+ begin
+
+ BUFFER.FIELD1 := RTEMS.BUILD_NAME(
+ SOURCE( SOURCE'FIRST ),
+ SOURCE( SOURCE'FIRST + 1 ),
+ SOURCE( SOURCE'FIRST + 2 ),
+ SOURCE( SOURCE'FIRST + 3 )
+ );
+
+ BUFFER.FIELD2 := RTEMS.BUILD_NAME(
+ SOURCE( SOURCE'FIRST + 4 ),
+ SOURCE( SOURCE'FIRST + 5 ),
+ SOURCE( SOURCE'FIRST + 6 ),
+ SOURCE( SOURCE'FIRST + 7 )
+ );
+
+ BUFFER.FIELD3 := RTEMS.BUILD_NAME(
+ SOURCE( SOURCE'FIRST + 8 ),
+ SOURCE( SOURCE'FIRST + 9 ),
+ SOURCE( SOURCE'FIRST + 10 ),
+ SOURCE( SOURCE'FIRST + 11 )
+ );
+
+ BUFFER.FIELD4 := RTEMS.BUILD_NAME(
+ SOURCE( SOURCE'FIRST + 12 ),
+ SOURCE( SOURCE'FIRST + 13 ),
+ SOURCE( SOURCE'FIRST + 14 ),
+ SOURCE( SOURCE'FIRST + 15 )
+ );
+
+ end FILL_BUFFER;
+
+--
+-- PUT_BUFFER
+--
+
+--
+-- Depends on tricks to make the output work.
+--
+
+ procedure PUT_BUFFER (
+ BUFFER : in SPTEST.BUFFER
+ ) is
+ begin
+
+ TEST_SUPPORT.PUT_NAME( BUFFER.FIELD1, FALSE );
+ TEST_SUPPORT.PUT_NAME( BUFFER.FIELD2, FALSE );
+ TEST_SUPPORT.PUT_NAME( BUFFER.FIELD3, FALSE );
+ TEST_SUPPORT.PUT_NAME( BUFFER.FIELD4, FALSE );
+
+ end PUT_BUFFER;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ QID : RTEMS.ID;
+ BIG_SEND_BUFFER : BIG_BUFFER_TYPE;
+ BIG_SEND_BUFFER_POINTER : constant RTEMS.ADDRESS
+ := BIG_SEND_BUFFER'ADDRESS;
+ BIG_RECEIVE_BUFFER : BIG_BUFFER_TYPE;
+ BIG_RECEIVE_BUFFER_POINTER : constant RTEMS.ADDRESS
+ := BIG_RECEIVE_BUFFER'ADDRESS;
+ BUFFER : SPTEST.BUFFER;
+ BUFFER_POINTER : constant RTEMS.ADDRESS := BUFFER'ADDRESS;
+ COUNT : RTEMS.UNSIGNED32;
+ MESSAGE_SIZE : RTEMS.UNSIGNED32 := 0;
+ STATUS : RTEMS.STATUS_CODES;
+ SIZE : RTEMS.UNSIGNED32 := 0;
+ begin
+
+ RTEMS.MESSAGE_QUEUE.IDENT(
+ SPTEST.QUEUE_NAME( 1 ),
+ RTEMS.SEARCH_ALL_NODES,
+ QID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_IDENT" );
+ TEXT_IO.PUT( "TA1 - message_queue_ident - qid => " );
+ UNSIGNED32_IO.PUT( QID, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ SPTEST.FILL_BUFFER( "BUFFER 1 TO Q 1 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 1 TO Q 1" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 2 TO Q 1 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 2 TO Q 1" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 3 TO Q 1 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 3 TO Q 1" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+TEST_SUPPORT.PAUSE;
+
+ SPTEST.FILL_BUFFER( "BUFFER 1 TO Q 2 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 1 TO Q 2" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 2 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ TEXT_IO.PUT(
+ "TA1 - message_queue_receive - receive from queue 1 - "
+ );
+ TEXT_IO.PUT_LINE( "10 second timeout" );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ 10 * TEST_SUPPORT.TICKS_PER_SECOND,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA1 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - delete TA2" );
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 1 TO Q 3 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 1 TO Q 3" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+TEST_SUPPORT.PAUSE;
+
+ SPTEST.FILL_BUFFER( "BUFFER 2 TO Q 3 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 2 TO Q 3" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 3 TO Q 3 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 3 TO Q 3" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 4 TO Q 3 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 4 TO Q 3" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 5 TO Q 3 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_urgent - BUFFER 5 TO Q 3" );
+ RTEMS.MESSAGE_QUEUE.URGENT(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_URGENT" );
+
+ for TIMES in 1 .. 4
+ loop
+ TEXT_IO.PUT(
+ "TA1 - message_queue_receive - receive from queue 3 - "
+ );
+ TEXT_IO.PUT_LINE( "WAIT FOREVER" );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA1 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+ end loop;
+
+ SPTEST.FILL_BUFFER( "BUFFER 3 TO Q 2 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_urgent - BUFFER 3 TO Q 2" );
+ RTEMS.MESSAGE_QUEUE.URGENT(
+ SPTEST.QUEUE_ID( 2 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_URGENT" );
+
+ TEXT_IO.PUT(
+ "TA1 - message_queue_receive - receive from queue 2 - "
+ );
+ TEXT_IO.PUT_LINE( "WAIT FOREVER" );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 2 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA1 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_delete - delete queue 1" );
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_DELETE" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 3 TO Q 2 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_urgent - BUFFER 3 TO Q 2" );
+ RTEMS.MESSAGE_QUEUE.URGENT(
+ SPTEST.QUEUE_ID( 2 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_URGENT" );
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_delete - delete queue 2" );
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_DELETE" );
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_get_number_pending - check Q 3" );
+ RTEMS.MESSAGE_QUEUE.GET_NUMBER_PENDING(
+ SPTEST.QUEUE_ID( 3 ), COUNT, STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS, "MESSAGE_QUEUE_GET_NUMBER_PENDING"
+ );
+ TEXT_IO.PUT( "TA1 - " );
+ UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 );
+ TEXT_IO.PUT_LINE( " messages are pending on Q 3" );
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_flush - empty Q 3" );
+ RTEMS.MESSAGE_QUEUE.FLUSH( SPTEST.QUEUE_ID( 3 ), COUNT, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_FLUSH" );
+ TEXT_IO.PUT( "TA1 - " );
+ UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 );
+ TEXT_IO.PUT_LINE( " messages were flushed from Q 3" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 1 TO Q 3 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 1 TO Q 3" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 2 TO Q 3 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 2 TO Q 3" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ -- this broadcast should have no effect on the queue
+ SPTEST.FIlL_BUFFER( "NO BUFFER TO Q1 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_broadcast - NO BUFFER TO Q1" );
+ RTEMS.MESSAGE_QUEUE.BROADCAST(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ COUNT,
+ STATUS
+ );
+ TEXT_IO.PUT( "TA1 - number of tasks awakened = " );
+ UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_get_number_pending - check Q 3" );
+ RTEMS.MESSAGE_QUEUE.GET_NUMBER_PENDING(
+ SPTEST.QUEUE_ID( 3 ), COUNT, STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS, "MESSAGE_QUEUE_GET_NUMBER_PENDING"
+ );
+ TEXT_IO.PUT( "TA1 - " );
+ UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 );
+ TEXT_IO.PUT_LINE( " messages are pending on Q 3" );
+
+ SPTEST.FILL_BUFFER( "BUFFER 3 TO Q 3 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 3 TO Q 3" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_flush - Q 3" );
+ RTEMS.MESSAGE_QUEUE.FLUSH( SPTEST.QUEUE_ID( 3 ), COUNT, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_FLUSH" );
+ TEXT_IO.PUT( "TA1 - " );
+ UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 );
+ TEXT_IO.PUT_LINE( " messages were flushed from Q 3" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - until all message buffers consumed"
+ );
+ loop
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+
+ exit when RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.TOO_MANY );
+
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ end loop;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_send - all message buffers consumed"
+ );
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_flush - Q 3" );
+ RTEMS.MESSAGE_QUEUE.FLUSH( SPTEST.QUEUE_ID( 3 ), COUNT, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_FLUSH" );
+ TEXT_IO.PUT( "TA1 - " );
+ UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 );
+ TEXT_IO.PUT_LINE( " messages were flushed from Q 3" );
+
+TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE( "TA1 - create message queue of 20 bytes on queue 1" );
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 100,
+ 20,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.QUEUE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS, "MESSAGE_QUEUE_CREATE of Q1; 20 bytes each"
+ );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ), BIG_SEND_BUFFER_POINTER, 40, STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS, RTEMS.INVALID_SIZE, "expected INVALID_SIZE"
+ );
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_delete - delete queue 1" );
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_DELETE" );
+
+TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE( "TA1 - message_queue_create - variable sizes " );
+ for QUEUE_SIZE in 1 .. 1029 loop
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 2, -- just 2 msgs each
+ RTEMS.UNSIGNED32( QUEUE_SIZE ),
+ RTEMS.DEFAULT_ATTRIBUTES,
+ QUEUE_ID( 1 ),
+ STATUS
+ );
+ if STATUS /= RTEMS.SUCCESSFUL then
+ TEXT_IO.PUT( "TA1 - msq que size: " );
+ UNSIGNED32_IO.PUT(
+ RTEMS.UNSIGNED32( QUEUE_SIZE ), WIDTH => 3, BASE => 10
+ );
+ TEXT_IO.NEW_LINE;
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS, "message_queue_create of Q1"
+ );
+ end if;
+
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "message_queue_delete" );
+ end loop;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - message_queue_create and send - variable sizes "
+ );
+ for QUEUE_SIZE in 1 .. 1029 loop
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ SPTEST.QUEUE_NAME( 1 ),
+ 2, -- just 2 msgs each
+ RTEMS.UNSIGNED32( QUEUE_SIZE ),
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.QUEUE_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(status, "message_queue_create of Q1");
+
+ BIG_SEND_BUFFER := (others => CHARACTER'POS( 'A' ));
+ BIG_RECEIVE_BUFFER := (others => CHARACTER'POS( 'Z' ));
+
+ -- send a msg too big
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BIG_SEND_BUFFER_POINTER,
+ RTEMS.UNSIGNED32( QUEUE_SIZE + 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS, RTEMS.INVALID_SIZE, "message_queue_send too large"
+ );
+
+ -- send a msg that is just right
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 1 ),
+ BIG_SEND_BUFFER_POINTER,
+ RTEMS.UNSIGNED32( QUEUE_SIZE ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS, "message_queue_send exact size"
+ );
+
+ -- now read and verify the message just sent
+ SIZE := INTERFACES.UNSIGNED_32(QUEUE_SIZE);
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BIG_RECEIVE_BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ 1 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS, "message_queue_receive exact size"
+ );
+ if SIZE /= RTEMS.UNSIGNED32( QUEUE_SIZE ) then
+ TEXT_IO.PUT(
+ "TA1 - exact size size match failed for queue_size = "
+ );
+ UNSIGNED32_IO.PUT(
+ RTEMS.UNSIGNED32( QUEUE_SIZE ), WIDTH => 3, BASE => 10
+ );
+ TEXT_IO.NEW_LINE;
+ end if;
+
+ if (BIG_SEND_BUFFER( BIG_SEND_BUFFER'FIRST .. Integer( SIZE )) /=
+ BIG_RECEIVE_BUFFER( BIG_RECEIVE_BUFFER'FIRST .. Integer( SIZE )))
+ then
+ TEXT_IO.PUT_LINE("TA1 - exact size data match failed");
+ end if;
+
+ for I in Integer( SIZE + 1 ) .. BIG_RECEIVE_BUFFER'LAST loop
+ if BIG_RECEIVE_BUFFER( I ) /= CHARACTER'POS( 'Z' ) then
+ TEXT_IO.PUT_LINE("TA1 - exact size overrun match failed");
+ end if;
+ end loop;
+
+ -- all done with this one; delete it
+ RTEMS.MESSAGE_QUEUE.DELETE( SPTEST.QUEUE_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "message_queue_delete" );
+ end loop;
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 13 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ BUFFER : SPTEST.BUFFER;
+ BUFFER_POINTER : RTEMS.ADDRESS;
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ MESSAGE_SIZE : RTEMS.UNSIGNED32 := 0;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ BUFFER_POINTER := BUFFER'ADDRESS;
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - message_queue_receive - receive from queue 1 - NO_WAIT"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA2 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - message_queue_receive - receive from queue 1 - WAIT FOREVER"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA2 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - message_queue_receive - receive from queue 1 - WAIT FOREVER"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA2 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - task_set_priority - make self highest priority task"
+ );
+ RTEMS.TASKS.SET_PRIORITY(
+ RTEMS.SELF,
+ 3,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - message_queue_receive - receive from queue 2 - WAIT FOREVER"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 2 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA2 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ SPTEST.FILL_BUFFER( "BUFFER 2 TO Q 2 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA2 - message_queue_send - BUFFER 2 TO Q 2" );
+ RTEMS.MESSAGE_QUEUE.SEND(
+ SPTEST.QUEUE_ID( 2 ),
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - message_queue_receive - receive from queue 1 - 10 second timeout"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ 10 * TEST_SUPPORT.TICKS_PER_SECOND,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA2 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - message_queue_receive - receive from queue 3 - WAIT FOREVER"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA2 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ BUFFER : SPTEST.BUFFER;
+ BUFFER_POINTER : RTEMS.ADDRESS;
+ COUNT : RTEMS.UNSIGNED32;
+ MESSAGE_SIZE : RTEMS.UNSIGNED32 := 0;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ BUFFER_POINTER := BUFFER'ADDRESS;
+
+ TEXT_IO.PUT_LINE(
+ "TA3 - message_queue_receive - receive from queue 2 - WAIT FOREVER"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 2 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA3 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ SPTEST.FILL_BUFFER( "BUFFER 3 TO Q 1 ", BUFFER );
+ TEXT_IO.PUT_LINE( "TA3 - message_queue_broadcast - BUFFER 3 TO Q 1" );
+ RTEMS.MESSAGE_QUEUE.BROADCAST(
+ SPTEST.QUEUE_ID( 1 ),
+ BUFFER_POINTER,
+ 16,
+ COUNT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_BROADCAST" );
+ TEXT_IO.PUT( "TA3 - number of tasks awakened = " );
+ UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA3 - message_queue_receive - receive from queue 3 - WAIT FOREVER"
+ );
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ SPTEST.QUEUE_ID( 3 ),
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+ TEXT_IO.PUT( "TA3 - buffer received: " );
+ SPTEST.PUT_BUFFER( BUFFER );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA3 - task_delete - delete self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end TASK_3;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp13/sptest.ads b/testsuites/ada/sptests/sp13/sptest.ads
new file mode 100644
index 0000000000..9b92b3ba61
--- /dev/null
+++ b/testsuites/ada/sptests/sp13/sptest.ads
@@ -0,0 +1,134 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 13 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- Buffer Record similar to that used by RTEMS 3.2.1. Using this
+-- avoids changes to the test.
+--
+
+ type BUFFER is
+ record
+ FIELD1 : RTEMS.NAME; -- TEMPORARY UNTIL VARIABLE LENGTH
+ FIELD2 : RTEMS.NAME;
+ FIELD3 : RTEMS.NAME;
+ FIELD4 : RTEMS.NAME;
+ end record;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS message
+-- queues created by this test.
+--
+
+ QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- FILL_BUFFER
+--
+-- DESCRIPTION:
+--
+-- This subprogram takes the SOURCE input string and places
+-- up to the first sixteen characters of that string into
+-- the message BUFFER.
+--
+
+ procedure FILL_BUFFER (
+ SOURCE : in STRING;
+ BUFFER : out SPTEST.BUFFER
+ );
+
+--
+-- PUT_BUFFER
+--
+-- DESCRIPTION:
+--
+-- This subprogram prints the specified message BUFFER.
+--
+
+ procedure PUT_BUFFER (
+ BUFFER : in SPTEST.BUFFER
+ );
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Message Queue Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Message Queue Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Message Queue Manager.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp14/Makefile.am b/testsuites/ada/sptests/sp14/Makefile.am
new file mode 100644
index 0000000000..501cd32ea1
--- /dev/null
+++ b/testsuites/ada/sptests/sp14/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp14
+ada_sp14_SOURCES = sp14.adb config.h sptest.adb sptest.ads
+ada_sp14_SOURCES += ../../support/init.c
+
+ada_sp14$(EXEEXT): sp14.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp14.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp14/ada_sp14.scn b/testsuites/ada/sptests/sp14/ada_sp14.scn
new file mode 100644
index 0000000000..09b33721ef
--- /dev/null
+++ b/testsuites/ada/sptests/sp14/ada_sp14.scn
@@ -0,0 +1,33 @@
+*** TEST 14 ***
+TA1 - signal_catch - INTERRUPT_LEVEL( 3 )
+TA1 - signal_send - SIGNAL_16 to self
+ASR - ENTRY - signal => 16#10000#
+ASR - EXIT - signal => 16#10000#
+TA1 - signal_send - SIGNAL_0 to self
+ASR - ENTRY - signal => 16#1#
+ASR - task_wake_after - yield processor
+TA2 - signal_send - SIGNAL_17 to TA1
+TA2 - task_wake_after - yield processor
+ASR - ENTRY - signal => 16#20000#
+ASR - EXIT - signal => 16#20000#
+ASR - EXIT - signal => 16#1#
+TA1 - signal_catch - NO_ASR
+<pause>
+TA1 - signal_send - SIGNAL_1 to self
+ASR - ENTRY - signal => 16#2#
+ASR - task_wake_after - yield processor
+TA2 - signal_send - SIGNAL_18 and SIGNAL_19 to TA1
+TA2 - task_wake_after - yield processor
+ASR - EXIT - signal => 16#2#
+ASR - ENTRY - signal => 16#C0000#
+ASR - EXIT - signal => 16#C0000#
+TA1 - task_mode - disable ASRs
+TA1 - sending signal to SELF from timer
+TA1 - waiting for signal to arrive
+TA1 - timer routine got the correct arguments
+TA1 - task_mode - enable ASRs
+ASR - ENTRY - signal => 16#8#
+ASR - EXIT - signal => 16#8#
+TA1 - signal_catch - ASR ADDRESS of NULL
+TA1 - task_delete - delete self
+*** END OF TEST 14 ***
diff --git a/testsuites/ada/sptests/sp14/config.h b/testsuites/ada/sptests/sp14/config.h
new file mode 100644
index 0000000000..2c046d6db3
--- /dev/null
+++ b/testsuites/ada/sptests/sp14/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 3
+#define CONFIGURE_MAXIMUM_TIMERS 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp14/sp14.adb b/testsuites/ada/sptests/sp14/sp14.adb
new file mode 100644
index 0000000000..2149694ecc
--- /dev/null
+++ b/testsuites/ada/sptests/sp14/sp14.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP14 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP14 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP14;
+
diff --git a/testsuites/ada/sptests/sp14/sptest.adb b/testsuites/ada/sptests/sp14/sptest.adb
new file mode 100644
index 0000000000..3b74c9f256
--- /dev/null
+++ b/testsuites/ada/sptests/sp14/sptest.adb
@@ -0,0 +1,325 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 14 of the RTEMS
+-- Single Processor 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 ADDRESS_IO;
+with TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with INTERFACES; use INTERFACES;
+with RTEMS.TIMER;
+with RTEMS.SIGNAL;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 14 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE * 2,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE * 2,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ SPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 1 ),
+ SPTEST.TIMER_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE OF TM1" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- SIGNAL_3_TO_TASK_1
+--
+
+ procedure SIGNAL_3_TO_TASK_1 (
+ ID : in RTEMS.ID;
+ POINTER : in RTEMS.ADDRESS
+ ) is
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.SIGNAL.SEND( SPTEST.TASK_ID( 1 ), RTEMS.SIGNAL_3, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND of 3" );
+
+ SPTEST.TIMER_GOT_THIS_ID := ID;
+ SPTEST.TIMER_GOT_THIS_POINTER := POINTER;
+
+ SPTEST.SIGNAL_SENT := TRUE;
+
+ end SIGNAL_3_TO_TASK_1;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ PREVIOUS_MODE : RTEMS.MODE;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA1 - signal_catch - INTERRUPT_LEVEL( 3 )" );
+ RTEMS.SIGNAL.CATCH(
+ SPTEST.PROCESS_ASR'ACCESS,
+ RTEMS.INTERRUPT_LEVEL( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH INTERRUPT(3)" );
+
+ TEXT_IO.PUT_LINE( "TA1 - signal_send - SIGNAL_16 to self" );
+ RTEMS.SIGNAL.SEND( RTEMS.SELF, RTEMS.SIGNAL_16, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SIGNAL_SEND - SIGNAL_16 to SELF"
+ );
+
+ TEXT_IO.PUT_LINE( "TA1 - signal_send - SIGNAL_0 to self" );
+ RTEMS.SIGNAL.SEND( RTEMS.SELF, RTEMS.SIGNAL_0, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SIGNAL_SEND - SIGNAL_0 to SELF"
+ );
+
+ TEXT_IO.PUT_LINE( "TA1 - signal_catch - NO_ASR" );
+ RTEMS.SIGNAL.CATCH(SPTEST.PROCESS_ASR'ACCESS, RTEMS.NO_ASR, STATUS);
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH - NO_ASR" );
+
+ TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT_LINE( "TA1 - signal_send - SIGNAL_1 to self" );
+ RTEMS.SIGNAL.SEND( RTEMS.SELF, RTEMS.SIGNAL_1, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SIGNAL_SEND - SIGNAL_1 to SELF"
+ );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_mode - disable ASRs" );
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_ASR,
+ RTEMS.ASR_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+
+ SPTEST.TIMER_GOT_THIS_ID := 0;
+ SPTEST.TIMER_GOT_THIS_POINTER := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT_LINE( "TA1 - sending signal to SELF from timer" );
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( 1 ),
+ TEST_SUPPORT.TICKS_PER_SECOND / 2,
+ SPTEST.SIGNAL_3_TO_TASK_1'ACCESS,
+ SPTEST.TASK_1'ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - waiting for signal to arrive" );
+
+ SPTEST.SIGNAL_SENT := FALSE;
+ SPTEST.ASR_FIRED := FALSE;
+
+ loop
+ exit when SPTEST.SIGNAL_SENT;
+ end loop;
+
+ if SPTEST.TIMER_GOT_THIS_ID = SPTEST.TIMER_ID( 1 ) and then
+ RTEMS.ARE_EQUAL(SPTEST.TIMER_GOT_THIS_POINTER,
+ SPTEST.TASK_1'ADDRESS) then
+
+ TEXT_IO.PUT_LINE( "TA1 - timer routine got the correct arguments" );
+
+ else
+
+ TEXT_IO.PUT( "TA1 - timer got (" );
+ UNSIGNED32_IO.PUT( SPTEST.TIMER_GOT_THIS_ID );
+ TEXT_IO.PUT( "," );
+ ADDRESS_IO.PUT( SPTEST.TIMER_GOT_THIS_POINTER );
+ TEXT_IO.PUT( ") instead of (" );
+ UNSIGNED32_IO.PUT( SPTEST.TIMER_ID( 1 ) );
+ TEXT_IO.PUT( "," );
+ ADDRESS_IO.PUT( SPTEST.TASK_1'ADDRESS );
+ TEXT_IO.PUT_LINE( ")!!!!" );
+
+ end if;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_mode - enable ASRs" );
+ RTEMS.TASKS.MODE(
+ RTEMS.ASR,
+ RTEMS.ASR_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" );
+
+ TEXT_IO.PUT_LINE( "TA1 - signal_catch - ASR ADDRESS of NULL" );
+ RTEMS.SIGNAL.CATCH( NULL, RTEMS.DEFAULT_MODES, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SIGNAL_CATCH - NULL ADDRESS"
+ );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - delete self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA2 - signal_send - SIGNAL_17 to TA1" );
+ RTEMS.SIGNAL.SEND( SPTEST.TASK_ID( 1 ), RTEMS.SIGNAL_17, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SIGNAL_SEND - SIGNAL_17 to TA1"
+ );
+
+ TEXT_IO.PUT_LINE( "TA2 - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER YIELD" );
+
+ TEXT_IO.PUT_LINE(
+ "TA2 - signal_send - SIGNAL_18 and SIGNAL_19 to TA1"
+ );
+ RTEMS.SIGNAL.SEND(
+ SPTEST.TASK_ID( 1 ),
+ RTEMS.SIGNAL_18 + RTEMS.SIGNAL_19,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "SIGNAL_SEND - SIGNAL_18 and SIGNAL_19 to TA1"
+ );
+
+ TEXT_IO.PUT_LINE( "TA2 - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER YIELD" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 14 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_2;
+
+--
+-- PROCESS_ASR
+--
+
+ procedure PROCESS_ASR (
+ THE_SIGNAL_SET : in RTEMS.SIGNAL_SET
+ ) is
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT( "ASR - ENTRY - signal => " );
+ UNSIGNED32_IO.PUT( THE_SIGNAL_SET, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ if THE_SIGNAL_SET = RTEMS.SIGNAL_16 or else
+ THE_SIGNAL_SET = RTEMS.SIGNAL_17 or else
+ THE_SIGNAL_SET = RTEMS.SIGNAL_18 + RTEMS.SIGNAL_19 then
+ NULL;
+
+ elsif THE_SIGNAL_SET = RTEMS.SIGNAL_0 or else
+ THE_SIGNAL_SET = RTEMS.SIGNAL_1 then
+ TEXT_IO.PUT_LINE( "ASR - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "TASK_WAKE_AFTER YIELD"
+ );
+
+ elsif THE_SIGNAL_SET = RTEMS.SIGNAL_3 then
+
+ SPTEST.ASR_FIRED := TRUE;
+
+ end if;
+
+ TEXT_IO.PUT( "ASR - EXIT - signal => " );
+ UNSIGNED32_IO.PUT( THE_SIGNAL_SET, BASE => 16, WIDTH => 8 );
+ TEXT_IO.NEW_LINE;
+
+ end PROCESS_ASR;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp14/sptest.ads b/testsuites/ada/sptests/sp14/sptest.ads
new file mode 100644
index 0000000000..ecf6f93dff
--- /dev/null
+++ b/testsuites/ada/sptests/sp14/sptest.ads
@@ -0,0 +1,134 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 14 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS timers created
+-- by this test.
+--
+
+ TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID;
+ TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME;
+
+--
+-- SIGNAL_SENT is set to TRUE to indicate that a signal set has
+-- been sent from an ISR to the executing task.
+--
+
+ SIGNAL_SENT : BOOLEAN;
+ pragma volatile( SIGNAL_SENT );
+
+--
+-- These hold the arguments passed to the timer service routine.
+--
+
+ TIMER_GOT_THIS_ID : RTEMS.ID;
+ pragma volatile( TIMER_GOT_THIS_ID );
+
+ TIMER_GOT_THIS_POINTER : RTEMS.ADDRESS;
+ pragma volatile( TIMER_GOT_THIS_POINTER );
+
+--
+-- ASR_FIRED is set to TRUE to indicate that the ASR has executed
+-- and was passed the correct signal set.
+--
+
+ ASR_FIRED : BOOLEAN;
+ pragma volatile( ASR_FIRED );
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- SIGNAL_3_TO_TASK_1
+--
+-- DESCRIPTION:
+--
+-- This subprogram sends signal 3 to TASK_1.
+--
+
+ procedure SIGNAL_3_TO_TASK_1 (
+ ID : in RTEMS.ID;
+ POINTER : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, SIGNAL_3_TO_TASK_1);
+
+--
+-- PROCESS_ASR
+--
+-- DESCRIPTION:
+--
+-- This subprogram is an ASR for TASK_1.
+--
+
+ procedure PROCESS_ASR (
+ THE_SIGNAL_SET : in RTEMS.SIGNAL_SET
+ );
+ pragma Convention (C, PROCESS_ASR);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Signal Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Signal Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp15/Makefile.am b/testsuites/ada/sptests/sp15/Makefile.am
new file mode 100644
index 0000000000..e1fe83bcd5
--- /dev/null
+++ b/testsuites/ada/sptests/sp15/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp15
+ada_sp15_SOURCES = sp15.adb config.h sptest.adb sptest.ads
+ada_sp15_SOURCES += ../../support/init.c
+
+ada_sp15$(EXEEXT): sp15.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp15.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp15/ada_sp15.scn b/testsuites/ada/sptests/sp15/ada_sp15.scn
new file mode 100644
index 0000000000..9c9e68f3d7
--- /dev/null
+++ b/testsuites/ada/sptests/sp15/ada_sp15.scn
@@ -0,0 +1,16 @@
+*** TEST 15 ***
+INIT - partition_create - partition 1
+INIT - partition_create - partition 2
+TA1 - partition_ident - partition 1 id = 16#2A010001#
+TA1 - partition_ident - partition 2 id = 16#2A010002#
+TA1 - partition_get_buffer - get buffer 1 from partition 1 - 16#0#
+TA1 - partition_get_buffer - get buffer 2 from partition 1 - 16#200#
+TA1 - partition_get_buffer - get buffer 1 from partition 2 - 16#0#
+TA1 - partition_get_buffer - get buffer 2 from partition 2 - 16#80#
+TA1 - partition_return_buffer - return buffer 1 to partition 1 - 16#0#
+TA1 - partition_return_buffer - return buffer 2 to partition 1 - 16#200#
+TA1 - partition_return_buffer - return buffer 1 to partition 2 - 16#0#
+TA1 - partition_return_buffer - return buffer 2 to partition 2 - 16#80#
+TA1 - partition_delete - delete partition 1
+TA1 - partition_delete - delete partition 2
+*** END OF TEST 15 ***
diff --git a/testsuites/ada/sptests/sp15/config.h b/testsuites/ada/sptests/sp15/config.h
new file mode 100644
index 0000000000..7774f3563c
--- /dev/null
+++ b/testsuites/ada/sptests/sp15/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_PARTITIONS 2
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp15/sp15.adb b/testsuites/ada/sptests/sp15/sp15.adb
new file mode 100644
index 0000000000..77e8f27144
--- /dev/null
+++ b/testsuites/ada/sptests/sp15/sp15.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP15 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP15 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP15;
+
diff --git a/testsuites/ada/sptests/sp15/sptest.adb b/testsuites/ada/sptests/sp15/sptest.adb
new file mode 100644
index 0000000000..39e887dd2f
--- /dev/null
+++ b/testsuites/ada/sptests/sp15/sptest.adb
@@ -0,0 +1,278 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 15 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.PARTITION;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 15 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+
+ SPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME( 'P', 'T', '1', ' ' );
+ SPTEST.PARTITION_NAME( 2 ) := RTEMS.BUILD_NAME( 'P', 'T', '2', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 4,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ TEXT_IO.PUT_LINE( "INIT - partition_create - partition 1" );
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 1 ),
+ AREA_1'ADDRESS,
+ 4096,
+ 512,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.PARTITION_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE OF PT1" );
+
+ TEXT_IO.PUT_LINE( "INIT - partition_create - partition 2" );
+ RTEMS.PARTITION.CREATE(
+ SPTEST.PARTITION_NAME( 2 ),
+ AREA_2'ADDRESS,
+ 274,
+ 128,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.PARTITION_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE OF PT2" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- PUT_ADDRESS_FROM_AREA_1
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_1 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ ) is
+
+ begin
+
+ UNSIGNED32_IO.PUT(
+ RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_1'ADDRESS ),
+ WIDTH => 8,
+ BASE => 16
+ );
+
+ end PUT_ADDRESS_FROM_AREA_1;
+
+--
+-- PUT_ADDRESS_FROM_AREA_2
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_2 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ ) is
+ begin
+
+ UNSIGNED32_IO.PUT(
+ RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_2'ADDRESS ),
+ WIDTH => 8,
+ BASE => 16
+ );
+
+ end PUT_ADDRESS_FROM_AREA_2;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ PTID_1 : RTEMS.ID;
+ PTID_2 : RTEMS.ID;
+ BUFFER_ADDRESS_1 : RTEMS.ADDRESS;
+ BUFFER_ADDRESS_2 : RTEMS.ADDRESS;
+ BUFFER_ADDRESS_3 : RTEMS.ADDRESS;
+ BUFFER_ADDRESS_4 : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT( "TA1 - partition_ident - partition 1 id = " );
+ RTEMS.PARTITION.IDENT(
+ SPTEST.PARTITION_NAME( 1 ),
+ RTEMS.SEARCH_ALL_NODES,
+ PTID_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_IDENT OF PT1" );
+ UNSIGNED32_IO.PUT( PTID_1, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - partition_ident - partition 2 id = " );
+ RTEMS.PARTITION.IDENT(
+ SPTEST.PARTITION_NAME( 2 ),
+ RTEMS.SEARCH_ALL_NODES,
+ PTID_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_IDENT OF PT2" );
+ UNSIGNED32_IO.PUT( PTID_2, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA1 - partition_get_buffer - get buffer 1 from partition 1 - "
+ );
+ RTEMS.PARTITION.GET_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ BUFFER_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( BUFFER_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA1 - partition_get_buffer - get buffer 2 from partition 1 - "
+ );
+ RTEMS.PARTITION.GET_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ BUFFER_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( BUFFER_ADDRESS_2 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA1 - partition_get_buffer - get buffer 1 from partition 2 - "
+ );
+ RTEMS.PARTITION.GET_BUFFER(
+ SPTEST.PARTITION_ID( 2 ),
+ BUFFER_ADDRESS_3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( BUFFER_ADDRESS_3 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA1 - partition_get_buffer - get buffer 2 from partition 2 - "
+ );
+ RTEMS.PARTITION.GET_BUFFER(
+ SPTEST.PARTITION_ID( 2 ),
+ BUFFER_ADDRESS_4,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( BUFFER_ADDRESS_4 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA1 - partition_return_buffer - return buffer 1 to partition 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( BUFFER_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+ RTEMS.PARTITION.RETURN_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ BUFFER_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
+
+ TEXT_IO.PUT(
+ "TA1 - partition_return_buffer - return buffer 2 to partition 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( BUFFER_ADDRESS_2 );
+ TEXT_IO.NEW_LINE;
+ RTEMS.PARTITION.RETURN_BUFFER(
+ SPTEST.PARTITION_ID( 1 ),
+ BUFFER_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
+
+ TEXT_IO.PUT(
+ "TA1 - partition_return_buffer - return buffer 1 to partition 2 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( BUFFER_ADDRESS_3 );
+ TEXT_IO.NEW_LINE;
+ RTEMS.PARTITION.RETURN_BUFFER(
+ SPTEST.PARTITION_ID( 2 ),
+ BUFFER_ADDRESS_3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
+
+ TEXT_IO.PUT(
+ "TA1 - partition_return_buffer - return buffer 2 to partition 2 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( BUFFER_ADDRESS_4 );
+ TEXT_IO.NEW_LINE;
+ RTEMS.PARTITION.RETURN_BUFFER(
+ SPTEST.PARTITION_ID( 2 ),
+ BUFFER_ADDRESS_4,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - partition_delete - delete partition 1" );
+ RTEMS.PARTITION.DELETE( SPTEST.PARTITION_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_DELETE OF SELF" );
+
+ TEXT_IO.PUT_LINE( "TA1 - partition_delete - delete partition 2" );
+ RTEMS.PARTITION.DELETE( SPTEST.PARTITION_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_DELETE OF SELF" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 15 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp15/sptest.ads b/testsuites/ada/sptests/sp15/sptest.ads
new file mode 100644
index 0000000000..5af0e61503
--- /dev/null
+++ b/testsuites/ada/sptests/sp15/sptest.ads
@@ -0,0 +1,118 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 15 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS partitions created
+-- by this test.
+--
+
+ PARTITION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ PARTITION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- These arrays define the memory areas used for the partitions in
+-- this test.
+--
+
+ AREA_1 : array ( RTEMS.UNSIGNED32 range 0 .. 4095 ) of RTEMS.UNSIGNED8;
+ for AREA_1'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+ AREA_2 : array ( RTEMS.UNSIGNED32 range 0 .. 273 ) of RTEMS.UNSIGNED8;
+ for AREA_2'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- PUT_ADDRESS_FROM_AREA_1
+--
+-- DESCRIPTION:
+--
+-- This subpgram prints the offset of the address TO_BE_PRINTED
+-- from the first byte of AREA_1.
+--
+-- NOTE:
+--
+-- This subprogram is used because the actual address of AREA_1
+-- varies based upon the size of the executable, the target board,
+-- and the target processor.
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_1 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ );
+
+--
+-- PUT_ADDRESS_FROM_AREA_2
+--
+-- DESCRIPTION:
+--
+-- This subprogram prints the offset of the address TO_BE_PRINTED
+-- from the first byte of AREA_2.
+--
+-- NOTE:
+--
+-- This subprogram is used because the actual address of AREA_1
+-- varies based upon the size of the executable, the target board,
+-- and the target processor.
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_2 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ );
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Partition Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp16/Makefile.am b/testsuites/ada/sptests/sp16/Makefile.am
new file mode 100644
index 0000000000..4959ca2d62
--- /dev/null
+++ b/testsuites/ada/sptests/sp16/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp16
+ada_sp16_SOURCES = sp16.adb config.h sptest.adb sptest.ads
+ada_sp16_SOURCES += ../../support/init.c
+
+ada_sp16$(EXEEXT): sp16.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp16.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp16/ada_sp16.scn b/testsuites/ada/sptests/sp16/ada_sp16.scn
new file mode 100644
index 0000000000..928dc4a9cf
--- /dev/null
+++ b/testsuites/ada/sptests/sp16/ada_sp16.scn
@@ -0,0 +1,58 @@
+*** TEST 16 ***
+TA1 - region_ident - rnid => 16#32010001#
+TA1 - region_get_segment - wait on 100 byte segment from region 2
+TA1 - got segment from region 2 - 16#70#
+TA1 - region_get_segment - wait on 3K segment from region 3
+TA1 - got segment from region 3 - 16#70#
+TA1 - region_get_segment - get 3080 byte segment from region 1 - NO_WAIT
+TA1 - got segment from region 1 - 16#60#
+TA1 - task_wake_after - yield processor
+TA2 - region_get_segment - wait on 2K segment from region 1
+TA3 - region_get_segment - wait on 3950 byte segment from region 2
+<pause>
+TA1 - region_return_segment - return segment to region 1 - 16#60#
+TA1 - region_get_segment - wait 10 seconds for 3K segment from region 1
+TA2 - got segment from region 1 - 16#60#
+TA2 - region_return_segment - return segment to region 1 - 16#60#
+TA2 - task_set_priority - make self highest priority task
+TA2 - region_get_segment - wait on 3950 byte segment from region 2
+TA1 - got segment from region 1 - 16#60#
+TA1 - region_return_segment - return segment to region 2 - 16#70#
+TA2 - got segment from region 2 - 16#70#
+TA2 - region_return_segment - return segment to region 2 - 16#70#
+TA2 - task_delete - delete self
+TA1 - task_wake_after - yield processor
+TA3 - got segment from region 2 - 16#70#
+TA3 - region_get_segment - wait on 2K segment from region 3
+TA1 - task_delete - delete TA3
+<pause>
+TA1 - task_wake_after - yield processor
+TA4 - region_get_segment - wait on 1.5K segment from region 1
+TA5 - region_get_segment - wait on 1.5K segment from region 1
+TA1 - region_return_segment - return segment to region 1 - 16#60#
+TA1 - task_wake_after - yield processor
+TA4 - got and returned 16#60#
+TA5 - got and returned 16#6E0#
+TA1 - region_get_segment - wait 10 seconds for 3K segment from region 1
+TA1 - got segment from region 1 - 16#60#
+TA1 - task_wake_after - yield processor
+TA5 - region_get_segment - wait on 3K segment from region 1
+TA4 - region_get_segment - wait on 3K segment from region 1
+TA1 - task_delete - delete TA4
+TA1 - region_return_segment - return segment to region 1 - 16#60#
+TA1 - task_wake_after - yield processor
+TA5 - got segment from region 1 - 16#60#
+TA5 - region_return_segment - return segment to region 1 - 16#60#
+TA5 - task_delete - delete self
+TA1 - region_delete - delete region 1
+TA1 - region_get_segment - get 3K segment from region 4
+TA1 - got segment from region 4 - 16#70#
+TA1 - region_get_segment - attempt to get 3K segment from region 4
+TA1 - task_get_note - UNSATISFIED
+TA1 - region_extend - extend region 4 by 4K
+TA1 - region_get_segment - attempt to get 3K segment from region 4
+TA1 - got 3K segment from region 4 - 16#CF0#
+TA1 - return_segment - return segment to region 4 - 16#70#
+TA1 - region_return_segment - return segment to region 4 - 16#CF0#
+TA1 - region_delete - delete region 4
+*** END OF TEST 16 ***
diff --git a/testsuites/ada/sptests/sp16/config.h b/testsuites/ada/sptests/sp16/config.h
new file mode 100644
index 0000000000..087a4c5a49
--- /dev/null
+++ b/testsuites/ada/sptests/sp16/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+#define CONFIGURE_MAXIMUM_REGIONS 4
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp16/sp16.adb b/testsuites/ada/sptests/sp16/sp16.adb
new file mode 100644
index 0000000000..4280c67665
--- /dev/null
+++ b/testsuites/ada/sptests/sp16/sp16.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP16 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP16 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP16;
+
diff --git a/testsuites/ada/sptests/sp16/sptest.adb b/testsuites/ada/sptests/sp16/sptest.adb
new file mode 100644
index 0000000000..a62eedd104
--- /dev/null
+++ b/testsuites/ada/sptests/sp16/sptest.adb
@@ -0,0 +1,789 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 16 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.REGION;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 16 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+ SPTEST.TASK_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'A', '4', ' ' );
+ SPTEST.TASK_NAME( 5 ) := RTEMS.BUILD_NAME( 'T', 'A', '5', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ SPTEST.BASE_PRIORITY,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ SPTEST.BASE_PRIORITY,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ SPTEST.BASE_PRIORITY,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ SPTEST.REGION_NAME( 1 ) := RTEMS.BUILD_NAME( 'R', 'N', '1', ' ' );
+ SPTEST.REGION_NAME( 2 ) := RTEMS.BUILD_NAME( 'R', 'N', '2', ' ' );
+ SPTEST.REGION_NAME( 3 ) := RTEMS.BUILD_NAME( 'R', 'N', '3', ' ' );
+ SPTEST.REGION_NAME( 4 ) := RTEMS.BUILD_NAME( 'R', 'N', '4', ' ' );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 1 ),
+ SPTEST.AREA_1'ADDRESS,
+ 4096,
+ 128,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.REGION_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE OF RN1" );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 2 ),
+ SPTEST.AREA_2'ADDRESS,
+ 4096,
+ 128,
+ RTEMS.PRIORITY,
+ SPTEST.REGION_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE OF RN2" );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 3 ),
+ SPTEST.AREA_3'ADDRESS,
+ 4096,
+ 128,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.REGION_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE OF RN3" );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 4 ),
+ SPTEST.AREA_4'ADDRESS,
+ 4096,
+ 128,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.REGION_ID( 4 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE OF RN4" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- PUT_ADDRESS_FROM_AREA_1
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_1 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ ) is
+
+ begin
+
+ UNSIGNED32_IO.PUT(
+ RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_1'ADDRESS ),
+ WIDTH => 8,
+ BASE => 16
+ );
+
+ end PUT_ADDRESS_FROM_AREA_1;
+
+--
+-- PUT_ADDRESS_FROM_AREA_2
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_2 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ ) is
+ begin
+
+ UNSIGNED32_IO.PUT(
+ RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_2'ADDRESS ),
+ WIDTH => 8,
+ BASE => 16
+ );
+
+ end PUT_ADDRESS_FROM_AREA_2;
+
+--
+-- PUT_ADDRESS_FROM_AREA_3
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_3 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ ) is
+ begin
+
+ UNSIGNED32_IO.PUT(
+ RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_3'ADDRESS ),
+ WIDTH => 8,
+ BASE => 16
+ );
+
+ end PUT_ADDRESS_FROM_AREA_3;
+
+--
+-- PUT_ADDRESS_FROM_AREA_4
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_4 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ ) is
+ begin
+
+ UNSIGNED32_IO.PUT(
+ RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_4'ADDRESS ),
+ WIDTH => 8,
+ BASE => 16
+ );
+
+ end PUT_ADDRESS_FROM_AREA_4;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ RNID : RTEMS.ID;
+ SEGMENT_ADDRESS_1 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_2 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_3 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_4 : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.REGION.IDENT( SPTEST.REGION_NAME( 1 ), RNID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_IDENT OF RN1" );
+ TEXT_IO.PUT( "TA1 - region_ident - rnid => " );
+ UNSIGNED32_IO.PUT( RNID, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "100 byte segment from region 2" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 2 ),
+ 100,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 2 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( SEGMENT_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "3K segment from region 3" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 3 ),
+ 3072,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 3 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_3( SEGMENT_ADDRESS_2 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - get 3080 byte segment " );
+ TEXT_IO.PUT_LINE( "from region 1 - NO_WAIT" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 3080,
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_3 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_3 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait 10 seconds for 3K " );
+ TEXT_IO.PUT_LINE( "segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 3072,
+ RTEMS.DEFAULT_OPTIONS,
+ 10 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SEGMENT_ADDRESS_4,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 2 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( SEGMENT_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 2 ),
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - delete TA3" );
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA3" );
+
+TEST_SUPPORT.PAUSE;
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 4 ),
+ SPTEST.BASE_PRIORITY,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 4 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA4" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 5 ),
+ SPTEST.BASE_PRIORITY,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 5 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA5" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 4 ),
+ SPTEST.TASK_4'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA4" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 5 ),
+ SPTEST.TASK_5'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA5" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_4,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait 10 seconds for 3K " );
+ TEXT_IO.PUT_LINE( "segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 3072,
+ RTEMS.DEFAULT_OPTIONS,
+ 10 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SEGMENT_ADDRESS_4,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_delete - delete TA4" );
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 4 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA4" );
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_4,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - yield processor" );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - region_delete - delete region 1" );
+ RTEMS.REGION.DELETE( SPTEST.REGION_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_DELETE OF RN1" );
+--XXX
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_get_segment - get 3K segment from region 4"
+ );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 4 ),
+ 3072,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ segment_address_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "region_get_segment" );
+ TEXT_IO.PUT( "TA1 - got segment from region 4 - " );
+ PUT_ADDRESS_FROM_AREA_4( segment_address_1 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_get_segment - attempt to get 3K segment from region 4"
+ );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 4 ),
+ 3072,
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.UNSATISFIED,
+ "task_get_segment with no memory left"
+ );
+ TEXT_IO.PUT_LINE( "TA1 - task_get_note - UNSATISFIED" );
+
+ TEXT_IO.PUT_LINE( "TA1 - region_extend - extend region 4 by 4K" );
+ RTEMS.REGION.EXTEND(
+ SPTEST.REGION_ID( 4 ),
+ SPTEST.AREA_4( 4096 )'ADDRESS,
+ 4096,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_extend" );
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_get_segment - attempt to get 3K segment from region 4"
+ );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 4 ),
+ 3072,
+ RTEMS.NO_WAIT,
+ RTEMS.NO_TIMEOUT,
+ segment_address_3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_get_segment" );
+ TEXT_IO.PUT( "TA1 - got 3K segment from region 4 - " );
+ PUT_ADDRESS_FROM_AREA_4( segment_address_3 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA1 - return_segment - return segment to region 4 - "
+ );
+ PUT_ADDRESS_FROM_AREA_4( segment_address_1 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 4 ), segment_address_1, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_return_segment" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 4 - "
+ );
+ PUT_ADDRESS_FROM_AREA_4( segment_address_3 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 4 ), segment_address_3, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_return_segment" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - region_delete - delete region 4" );
+ RTEMS.REGION.DELETE( SPTEST.REGION_ID( 4 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_delete" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 16 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY;
+ SEGMENT_ADDRESS_1 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_2 : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT( "TA2 - region_get_segment - wait on 2K segment " );
+ TEXT_IO.PUT_LINE( "from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 2048,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA2 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA2 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_1 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA2 - task_set_priority - make self " );
+ TEXT_IO.PUT_LINE( "highest priority task" );
+ RTEMS.TASKS.SET_PRIORITY(
+ RTEMS.SELF,
+ SPTEST.BASE_PRIORITY - 1,
+ PREVIOUS_PRIORITY,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" );
+
+ TEXT_IO.PUT(
+ "TA2 - region_get_segment - wait on 3950 byte segment "
+ );
+ TEXT_IO.PUT_LINE( "from region 2" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 2 ),
+ 3950,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA2 - got segment from region 2 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( SEGMENT_ADDRESS_2 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT(
+ "TA2 - region_return_segment - return segment to region 2 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( SEGMENT_ADDRESS_2 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 2 ),
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA2 - task_delete - delete self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" );
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ SEGMENT_ADDRESS_1 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_2 : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT( "TA3 - region_get_segment - wait on 3950 byte segment " );
+ TEXT_IO.PUT_LINE( "from region 2" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 2 ),
+ 3950,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA3 - got segment from region 2 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_2( SEGMENT_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA3 - region_get_segment - wait on 2K segment " );
+ TEXT_IO.PUT_LINE( "from region 3" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 3 ),
+ 2048,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+
+ end TASK_3;
+
+--
+-- TASK_4
+--
+
+ procedure TASK_4 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ SEGMENT_ADDRESS_1 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_2 : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT( "TA4 - region_get_segment - wait on 1.5K segment " );
+ TEXT_IO.PUT_LINE( "from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 1536,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.PUT( "TA4 - got and returned " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT( "TA4 - region_get_segment - wait on 3K segment " );
+ TEXT_IO.PUT_LINE( "from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 3072,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+
+ end TASK_4;
+
+--
+-- TASK_5
+--
+
+ procedure TASK_5 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ SEGMENT_ADDRESS_1 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_2 : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT( "TA5 - region_get_segment - wait on 1.5K segment " );
+ TEXT_IO.PUT_LINE( "from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 1536,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.PUT( "TA5 - got and returned " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT( "TA5 - region_get_segment - wait on 3K segment " );
+ TEXT_IO.PUT_LINE( "from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 3072,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA5 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_2 );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.PUT(
+ "TA5 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_2 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA5 - task_delete - delete self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA5" );
+
+ end TASK_5;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp16/sptest.ads b/testsuites/ada/sptests/sp16/sptest.ads
new file mode 100644
index 0000000000..7f028a0274
--- /dev/null
+++ b/testsuites/ada/sptests/sp16/sptest.ads
@@ -0,0 +1,202 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 16 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 5 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 5 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS regions created
+-- by this test.
+--
+
+ REGION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID;
+ REGION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME;
+
+--
+-- The following constant defines the priority of most of the
+-- RTEMS tasks in this test. This allows one of the tasks to
+-- easily set itself to a higher priority than the rest.
+--
+
+ BASE_PRIORITY : constant RTEMS.TASKS.PRIORITY := 140;
+
+--
+-- These arrays define the memory areas used for the regions in
+-- this test.
+--
+
+ AREA_1 : array ( RTEMS.UNSIGNED32 range 0 .. 4095 ) of RTEMS.UNSIGNED8;
+ for AREA_1'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+ AREA_2 : array ( RTEMS.UNSIGNED32 range 0 .. 4095 ) of RTEMS.UNSIGNED8;
+ for AREA_2'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+ AREA_3 : array ( RTEMS.UNSIGNED32 range 0 .. 4095 ) of RTEMS.UNSIGNED8;
+ for AREA_3'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+ AREA_4 : array ( RTEMS.UNSIGNED32 range 0 .. 8191 ) of RTEMS.UNSIGNED8;
+ for AREA_4'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- PUT_ADDRESS_FROM_AREA_1
+--
+-- DESCRIPTION:
+--
+-- This subprogram prints the offset of the address TO_BE_PRINTED
+-- from the first byte of AREA_1.
+--
+-- NOTE:
+--
+-- This subprogram is used because the actual address of AREA_1
+-- varies based upon the size of the executable, the target board,
+-- and the target processor.
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_1 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ );
+
+--
+-- PUT_ADDRESS_FROM_AREA_2
+--
+-- DESCRIPTION:
+--
+-- This subprogram prints the offset of the address TO_BE_PRINTED
+-- from the first byte of AREA_2.
+--
+-- NOTE:
+--
+-- This subprogram is used because the actual address of AREA_2
+-- varies based upon the size of the executable, the target board,
+-- and the target processor.
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_2 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ );
+
+--
+-- PUT_ADDRESS_FROM_AREA_3
+--
+-- DESCRIPTION:
+--
+-- This subprogram prints the offset of the address TO_BE_PRINTED
+-- from the first byte of AREA_3.
+--
+-- NOTE:
+--
+-- This subprogram is used because the actual address of AREA_3
+-- varies based upon the size of the executable, the target board,
+-- and the target processor.
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_3 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ );
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Region Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Region Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Region Manager.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+--
+-- TASK_4
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Region Manager.
+--
+
+ procedure TASK_4 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_4);
+
+--
+-- TASK_5
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Region Manager.
+--
+
+ procedure TASK_5 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_5);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp17/Makefile.am b/testsuites/ada/sptests/sp17/Makefile.am
new file mode 100644
index 0000000000..9a5b2a3505
--- /dev/null
+++ b/testsuites/ada/sptests/sp17/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp17
+ada_sp17_SOURCES = sp17.adb config.h sptest.adb sptest.ads
+ada_sp17_SOURCES += ../../support/init.c
+
+ada_sp17$(EXEEXT): sp17.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp17.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp17/ada_sp17.scn b/testsuites/ada/sptests/sp17/ada_sp17.scn
new file mode 100644
index 0000000000..887284d877
--- /dev/null
+++ b/testsuites/ada/sptests/sp17/ada_sp17.scn
@@ -0,0 +1,8 @@
+*** TEST 17 ***
+TA2 - Suspending self
+TA1 - signal_catch: initializing signal catcher
+TA1 - Sending signal to self
+TA2 - signal_return preempted correctly
+TA1 - TA2 correctly preempted me
+TA1 - Got Back!!!
+*** END OF TEST 17 ***
diff --git a/testsuites/ada/sptests/sp17/config.h b/testsuites/ada/sptests/sp17/config.h
new file mode 100644
index 0000000000..0ceab6f736
--- /dev/null
+++ b/testsuites/ada/sptests/sp17/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 3
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(25)
+#define CONFIGURE_TICKS_PER_TIMESLICE 1000
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp17/sp17.adb b/testsuites/ada/sptests/sp17/sp17.adb
new file mode 100644
index 0000000000..5c06ef0b44
--- /dev/null
+++ b/testsuites/ada/sptests/sp17/sp17.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP17 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP17 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP17;
+
diff --git a/testsuites/ada/sptests/sp17/sptest.adb b/testsuites/ada/sptests/sp17/sptest.adb
new file mode 100644
index 0000000000..e2402a50cf
--- /dev/null
+++ b/testsuites/ada/sptests/sp17/sptest.adb
@@ -0,0 +1,170 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 17 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with RTEMS.SIGNAL;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 17 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+
+ SPTEST.TASK_2_PREEMPTED := FALSE;
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 2,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- PROCESS_ASR
+--
+
+ procedure PROCESS_ASR (
+ SIGNALS : in RTEMS.SIGNAL_SET
+ ) is
+ pragma Unreferenced(SIGNALS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.RESUME( SPTEST.TASK_ID( 2 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "ASR - TASK_RESUME OF TA2" );
+
+ end PROCESS_ASR;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA1 - signal_catch: initializing signal catcher" );
+ RTEMS.SIGNAL.CATCH(
+ SPTEST.PROCESS_ASR'ACCESS,
+ RTEMS.NO_ASR + RTEMS.NO_PREEMPT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH" );
+
+ TEXT_IO.PUT_LINE( "TA1 - Sending signal to self" );
+ RTEMS.SIGNAL.SEND(
+ SPTEST.TASK_ID( 1 ),
+ RTEMS.SIGNAL_16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" );
+
+ if SPTEST.TASK_2_PREEMPTED then
+ TEXT_IO.PUT_LINE( "TA1 - TA2 correctly preempted me" );
+ end if;
+
+ TEXT_IO.PUT_LINE( "TA1 - Got Back!!!" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 17 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ SPTEST.TASK_2_PREEMPTED := FALSE;
+
+ TEXT_IO.PUT_LINE( "TA2 - Suspending self" );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA2 - signal_return preempted correctly" );
+
+ SPTEST.TASK_2_PREEMPTED := TRUE;
+
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ end TASK_2;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp17/sptest.ads b/testsuites/ada/sptests/sp17/sptest.ads
new file mode 100644
index 0000000000..428114c9a0
--- /dev/null
+++ b/testsuites/ada/sptests/sp17/sptest.ads
@@ -0,0 +1,95 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 17 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- The following is set to TRUE by TASK_2 when it preempts TASK_1.
+--
+
+ TASK_2_PREEMPTED : STANDARD.BOOLEAN;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- PROCESS_ASR
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the ASR for TASK_1.
+--
+
+ procedure PROCESS_ASR (
+ SIGNALS : in RTEMS.SIGNAL_SET
+ );
+ pragma Convention (C, PROCESS_ASR);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests that when the transfer from the task
+-- to the ASR (and vice-versa) is performed, that the new mode
+-- is taken into account. If this occurs, then TASK_2 will be
+-- able to preempt upon completion of the ASR of TASK_1.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task is designed to preempt TASK_1.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp19/Makefile.am b/testsuites/ada/sptests/sp19/Makefile.am
new file mode 100644
index 0000000000..27e7d7ca28
--- /dev/null
+++ b/testsuites/ada/sptests/sp19/Makefile.am
@@ -0,0 +1,20 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+AM_ADAFLAGS += -I.
+
+noinst_PROGRAMS = ada_sp19
+ada_sp19_SOURCES = sp19.adb sptest.adb config.h sptest.ads
+ada_sp19_SOURCES += ../../support/init.c
+
+CLEANFILES += sptest.adb
+
+ada_sp19$(EXEEXT): sp19.adb sptest.adb sptest.ads init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp19.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp19/README b/testsuites/ada/sptests/sp19/README
new file mode 100644
index 0000000000..4fd698381e
--- /dev/null
+++ b/testsuites/ada/sptests/sp19/README
@@ -0,0 +1,19 @@
+This is a "problem" test in Ada versus the C equivalent. In C,
+we used macros to :
+
+ + declare a LOT of local integer and floating point variables
+ + load them with values
+ + check them at certain times
+ + to avoid floating point operations on CPUs w/o hardware support
+
+The macros are not equivalent to subprograms doing the same thing.
+We are trying to insure that the register set is fully utilized and
+checking that it survives context switches. If the routines are
+subprograms, then calling conventions and scoping rules apply. Thus
+the variables do not exist throughout the entire life of the task
+as in the C test.
+
+It seems to point out that although the conditional compilation
+and macro capabilities of C are often abused, they do provide
+capabilities which are difficult if not impossible to mimic entirely
+with subprograms.
diff --git a/testsuites/ada/sptests/sp19/ada_sp19.scn b/testsuites/ada/sptests/sp19/ada_sp19.scn
new file mode 100644
index 0000000000..573860bb59
--- /dev/null
+++ b/testsuites/ada/sptests/sp19/ada_sp19.scn
@@ -0,0 +1,55 @@
+*** TEST 19 ***
+FP1 - integer base = ( 16#6000#)
+FP1 - float base = ( 6.00060E+03)
+FP1 - integer base = ( 16#6000#)
+FP1 - float base = ( 6.00060E+03)
+TA1 - integer base = ( 16#1000#)
+TA1 - clock_get - 9: 0: 0 12/31/1988
+TA2 - integer base = ( 16#2000#)
+TA2 - clock_get - 9: 0: 0 12/31/1988
+TA3 - integer base = ( 16#3000#)
+TA3 - clock_get - 9: 0: 0 12/31/1988
+TA4 - integer base = ( 16#4000#)
+TA4 - float base = ( 4.00040E+03)
+TA4 - clock_get - 9: 0: 0 12/31/1988
+TA5 - integer base = ( 16#5000#)
+TA5 - float base = ( 5.00050E+03)
+TA5 - clock_get - 9: 0: 0 12/31/1988
+TA4 - clock_get - 9: 0: 1 12/31/1988
+TA5 - clock_get - 9: 0: 1 12/31/1988
+TA4 - clock_get - 9: 0: 2 12/31/1988
+TA5 - clock_get - 9: 0: 2 12/31/1988
+TA4 - clock_get - 9: 0: 3 12/31/1988
+TA5 - clock_get - 9: 0: 3 12/31/1988
+TA4 - clock_get - 9: 0: 4 12/31/1988
+TA5 - clock_get - 9: 0: 4 12/31/1988
+TA1 - clock_get - 9: 0: 5 12/31/1988
+TA4 - clock_get - 9: 0: 5 12/31/1988
+TA5 - clock_get - 9: 0: 5 12/31/1988
+TA4 - clock_get - 9: 0: 6 12/31/1988
+TA5 - clock_get - 9: 0: 6 12/31/1988
+TA4 - clock_get - 9: 0: 7 12/31/1988
+TA5 - clock_get - 9: 0: 7 12/31/1988
+TA4 - clock_get - 9: 0: 8 12/31/1988
+TA5 - clock_get - 9: 0: 8 12/31/1988
+TA4 - clock_get - 9: 0: 9 12/31/1988
+TA5 - clock_get - 9: 0: 9 12/31/1988
+TA2 - clock_get - 9: 0:10 12/31/1988
+TA1 - clock_get - 9: 0:10 12/31/1988
+TA4 - clock_get - 9: 0:10 12/31/1988
+TA5 - clock_get - 9: 0:10 12/31/1988
+TA4 - clock_get - 9: 0:11 12/31/1988
+TA5 - clock_get - 9: 0:11 12/31/1988
+TA4 - clock_get - 9: 0:12 12/31/1988
+TA5 - clock_get - 9: 0:12 12/31/1988
+TA4 - clock_get - 9: 0:13 12/31/1988
+TA5 - clock_get - 9: 0:13 12/31/1988
+TA4 - clock_get - 9: 0:14 12/31/1988
+TA5 - clock_get - 9: 0:14 12/31/1988
+TA1 - clock_get - 9: 0:15 12/31/1988
+TA3 - clock_get - 9: 0:15 12/31/1988
+TA4 - clock_get - 9: 0:15 12/31/1988
+TA5 - clock_get - 9: 0:15 12/31/1988
+TA4 - task_delete - self
+TA5 - task_delete - TA3
+*** END OF TEST 19 ***
diff --git a/testsuites/ada/sptests/sp19/config.h b/testsuites/ada/sptests/sp19/config.h
new file mode 100644
index 0000000000..278aaf69b0
--- /dev/null
+++ b/testsuites/ada/sptests/sp19/config.h
@@ -0,0 +1,30 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 7
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp19/sp19.adb b/testsuites/ada/sptests/sp19/sp19.adb
new file mode 100644
index 0000000000..f2cfddb97a
--- /dev/null
+++ b/testsuites/ada/sptests/sp19/sp19.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP19 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP19 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.FLOATING_POINT,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP19;
+
diff --git a/testsuites/ada/sptests/sp19/sptest.adp b/testsuites/ada/sptests/sp19/sptest.adp
new file mode 100644
index 0000000000..d49bf41aac
--- /dev/null
+++ b/testsuites/ada/sptests/sp19/sptest.adp
@@ -0,0 +1,397 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 19 of the RTEMS
+-- Single Processor Test Suite.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+-- On-Line Applications Research Corporation (OAR).
+--
+
+with INTERFACES; use INTERFACES;
+with FLOAT_IO;
+with TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.CLOCK;
+
+include(../../support/fp.inc)
+include(../../support/integer.inc)
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 19 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+ SPTEST.TASK_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'A', '4', ' ' );
+ SPTEST.TASK_NAME( 5 ) := RTEMS.BUILD_NAME( 'T', 'A', '5', ' ' );
+ SPTEST.TASK_NAME( 6 ) := RTEMS.BUILD_NAME( 'F', 'P', '1', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 2,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.FLOATING_POINT,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 2,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 2,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 4 ),
+ 2,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.FLOATING_POINT,
+ SPTEST.TASK_ID( 4 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA4" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 5 ),
+ 2,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.FLOATING_POINT,
+ SPTEST.TASK_ID( 5 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA5" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 6 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.FLOATING_POINT,
+ SPTEST.TASK_ID( 6 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF FP1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 6 ),
+ SPTEST.FIRST_FP_TASK'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF FP1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 4 ),
+ SPTEST.FP_TASK'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA4" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 5 ),
+ SPTEST.FP_TASK'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA5" );
+
+ --
+ -- Load "task dependent factors" in the context areas
+ --
+
+ SPTEST.FP_FACTORS( 0 ) := 0.0;
+ SPTEST.FP_FACTORS( 1 ) := 1000.1;
+ SPTEST.FP_FACTORS( 2 ) := 2000.2;
+ SPTEST.FP_FACTORS( 3 ) := 3000.3;
+ SPTEST.FP_FACTORS( 4 ) := 4000.4;
+ SPTEST.FP_FACTORS( 5 ) := 5000.5;
+ SPTEST.FP_FACTORS( 6 ) := 6000.6;
+ SPTEST.FP_FACTORS( 7 ) := 7000.7;
+ SPTEST.FP_FACTORS( 8 ) := 8000.8;
+ SPTEST.FP_FACTORS( 9 ) := 9000.9;
+
+ SPTEST.INTEGER_FACTORS( 0 ) := 16#0000#;
+ SPTEST.INTEGER_FACTORS( 1 ) := 16#1000#;
+ SPTEST.INTEGER_FACTORS( 2 ) := 16#2000#;
+ SPTEST.INTEGER_FACTORS( 3 ) := 16#3000#;
+ SPTEST.INTEGER_FACTORS( 4 ) := 16#4000#;
+ SPTEST.INTEGER_FACTORS( 5 ) := 16#5000#;
+ SPTEST.INTEGER_FACTORS( 6 ) := 16#6000#;
+ SPTEST.INTEGER_FACTORS( 7 ) := 16#7000#;
+ SPTEST.INTEGER_FACTORS( 8 ) := 16#8000#;
+ SPTEST.INTEGER_FACTORS( 9 ) := 16#9000#;
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- FIRST_FP_TASK
+--
+
+ procedure FIRST_FP_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ STATUS : RTEMS.STATUS_CODES;
+ TID : RTEMS.ID;
+ TIME : RTEMS.TIME_OF_DAY;
+ TASK_INDEX : RTEMS.UNSIGNED32;
+ INTEGER_DECLARE;
+ FP_DECLARE;
+ begin
+
+ RTEMS.TASKS.IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" );
+
+ TASK_INDEX := TEST_SUPPORT.TASK_NUMBER( TID );
+
+ INTEGER_LOAD( INTEGER_FACTORS( TASK_INDEX ) );
+ FP_LOAD( FP_FACTORS( TASK_INDEX ) );
+
+ TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( TASK_INDEX ), FALSE );
+ TEXT_IO.PUT( " - integer base = (" );
+ UNSIGNED32_IO.PUT( INTEGER_FACTORS( TASK_INDEX ), BASE => 16 );
+ TEXT_IO.PUT_LINE( ")" );
+
+ --
+ -- C implementation prints NA if no hardware FP support.
+ --
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
+ FALSE
+ );
+ TEXT_IO.PUT( " - float base = (" );
+ FLOAT_IO.PUT( FP_FACTORS( TASK_INDEX ) );
+ TEXT_IO.PUT_LINE( ")" );
+
+ FP_CHECK( FP_FACTORS( TASK_INDEX ) );
+ INTEGER_CHECK( INTEGER_FACTORS( TASK_INDEX ) );
+ if ARGUMENT = 0 then
+ RTEMS.TASKS.RESTART(
+ RTEMS.SELF,
+ 1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESTART OF SELF" );
+ else
+ TIME := ( 1988, 12, 31, 9, 0, 0, 0 );
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+ end if;
+
+ end FIRST_FP_TASK;
+
+--
+-- FP_TASK
+--
+
+ procedure FP_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ TID : RTEMS.ID;
+ TIME : RTEMS.TIME_OF_DAY;
+ TASK_INDEX : RTEMS.UNSIGNED32;
+ INTEGER_DECLARE;
+ FP_DECLARE;
+ begin
+
+ RTEMS.TASKS.IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" );
+
+ TASK_INDEX := TEST_SUPPORT.TASK_NUMBER( TID );
+
+ INTEGER_LOAD( INTEGER_FACTORS( TASK_INDEX ) );
+ FP_LOAD( FP_FACTORS( TASK_INDEX ) );
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
+ FALSE
+ );
+ TEXT_IO.PUT( " - integer base = (" );
+ UNSIGNED32_IO.PUT( INTEGER_FACTORS( TASK_INDEX ), BASE => 16 );
+ TEXT_IO.PUT_LINE( ")" );
+
+ --
+ -- C implementation prints NA if no hardware FP support.
+ --
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
+ FALSE
+ );
+ TEXT_IO.PUT( " - float base = (" );
+ FLOAT_IO.PUT( FP_FACTORS( TASK_INDEX ) );
+ TEXT_IO.PUT_LINE( ")" );
+
+ loop
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ if TIME.SECOND >= 16 then
+
+ if TEST_SUPPORT.TASK_NUMBER( TID ) = 4 then
+ TEXT_IO.PUT_LINE( "TA4 - task_delete - self" );
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA4" );
+ end if;
+
+ TEXT_IO.PUT_LINE( "TA5 - task_delete - TA3" );
+ RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA3" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 19 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
+ FALSE
+ );
+
+ TEST_SUPPORT.PRINT_TIME( " - clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ INTEGER_CHECK( INTEGER_FACTORS( TASK_INDEX ) );
+ FP_CHECK( FP_FACTORS( TASK_INDEX ) );
+
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ end loop;
+
+ end FP_TASK;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ TID : RTEMS.ID;
+ TIME : RTEMS.TIME_OF_DAY;
+ TASK_INDEX : RTEMS.UNSIGNED32;
+ INTEGER_DECLARE;
+ FP_DECLARE;
+ begin
+
+ RTEMS.TASKS.IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" );
+
+ TASK_INDEX := TEST_SUPPORT.TASK_NUMBER( TID );
+
+ INTEGER_LOAD( INTEGER_FACTORS( TASK_INDEX ) );
+ FP_LOAD( FP_FACTORS( TASK_INDEX ) );
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
+ FALSE
+ );
+ TEXT_IO.PUT( " - integer base = (" );
+ UNSIGNED32_IO.PUT( INTEGER_FACTORS( TASK_INDEX ), BASE => 16 );
+ TEXT_IO.PUT_LINE( ")" );
+
+ loop
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ),
+ FALSE
+ );
+
+ TEST_SUPPORT.PRINT_TIME( " - clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ INTEGER_CHECK( INTEGER_FACTORS( TASK_INDEX ) );
+ FP_CHECK( FP_FACTORS( TASK_INDEX ) );
+
+ RTEMS.TASKS.WAKE_AFTER(
+ TEST_SUPPORT.TASK_NUMBER( TID ) * 5 *
+ TEST_SUPPORT.TICKS_PER_SECOND,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ end loop;
+
+ end TASK_1;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp19/sptest.ads b/testsuites/ada/sptests/sp19/sptest.ads
new file mode 100644
index 0000000000..3befd7cc3a
--- /dev/null
+++ b/testsuites/ada/sptests/sp19/sptest.ads
@@ -0,0 +1,119 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 19 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 6 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 6 ) of RTEMS.NAME;
+
+--
+-- This array contains the floating point factors used by the
+-- floating point tasks in this test.
+--
+
+ FP_FACTORS : array ( RTEMS.UNSIGNED32 range 0 .. 9 ) of FLOAT;
+
+--
+-- This array contains the integer factors used by the
+-- integer tasks in this test.
+--
+
+ INTEGER_FACTORS : array ( RTEMS.UNSIGNED32 range 0 .. 9 ) of
+ RTEMS.UNSIGNED32;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- FIRST_FP_TASK
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the restart and deletion of floating point tasks.
+--
+
+ procedure FIRST_FP_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, FIRST_FP_TASK);
+
+--
+-- FP_TASK
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the basic capabilities of a floating point
+-- task.
+--
+
+ procedure FP_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, FP_TASK);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task provides a non-floating point task to test
+-- that an application can utilize a mixture of floating point
+-- and non-floating point tasks.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- Add_Float
+--
+-- DESCRIPTION:
+--
+-- This method ensures the compilers thinks we are using the variables.
+--
+
+ function Add_Float(
+ n : in Float;
+ factor : in Float
+ ) return Float;
+ pragma Interface (C, Add_Float);
+ pragma Interface_Name (Add_Float, "add_float");
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp20/Makefile.am b/testsuites/ada/sptests/sp20/Makefile.am
new file mode 100644
index 0000000000..de7b240d5c
--- /dev/null
+++ b/testsuites/ada/sptests/sp20/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp20
+ada_sp20_SOURCES = sp20.adb config.h sptest.adb sptest.ads
+ada_sp20_SOURCES += ../../support/init.c
+
+ada_sp20$(EXEEXT): sp20.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp20.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp20/ada_sp20.scn b/testsuites/ada/sptests/sp20/ada_sp20.scn
new file mode 100644
index 0000000000..5411361d76
--- /dev/null
+++ b/testsuites/ada/sptests/sp20/ada_sp20.scn
@@ -0,0 +1,40 @@
+*** TEST 20 ***
+TA1 - rate_monotonic_create id = 16#42010001#
+TA1 - rate_monotonic_ident id = 16#42010001#
+TA1 - (16#42010001#) period 2
+TA2 - rate_monotonic_create id = 16#42010002#
+TA2 - rate_monotonic_ident id = 16#42010002#
+TA2 - (16#42010002#) period 2
+TA3 - rate_monotonic_create id = 16#42010003#
+TA3 - rate_monotonic_ident id = 16#42010003#
+TA3 - (16#42010003#) period 2
+TA4 - rate_monotonic_create id = 16#42010004#
+TA4 - rate_monotonic_ident id = 16#42010004#
+TA4 - (16#42010004#) period 2
+TA5 - rate_monotonic_create id = 16#42010005#
+TA5 - rate_monotonic_ident id = 16#42010005#
+TA5 - (16#42010005#) period 100
+TA6 - rate_monotonic_create id = 16#42010006#
+TA6 - rate_monotonic_ident id = 16#42010006#
+TA6 - (16#42010006#) period 0
+TA5 - PERIODS CHECK OK (1)
+TA5 - PERIODS CHECK OK (2)
+TA5 - PERIODS CHECK OK (3)
+TA5 - PERIODS CHECK OK (4)
+TA5 - PERIODS CHECK OK (5)
+TA6 - Actual: 10 Expected: 10 - OK
+TA6 - Actual: 20 Expected: 20 - OK
+TA6 - Actual: 30 Expected: 30 - OK
+TA6 - Actual: 40 Expected: 40 - OK
+TA6 - Actual: 50 Expected: 50 - OK
+TA6 - Actual: 60 Expected: 60 - OK
+TA6 - Actual: 70 Expected: 70 - OK
+TA6 - Actual: 80 Expected: 80 - OK
+TA6 - Actual: 90 Expected: 90 - OK
+TA6 - Actual: 100 Expected: 100 - OK
+TA5 - PERIODS CHECK OK (6)
+TA5 - PERIODS CHECK OK (7)
+TA5 - PERIODS CHECK OK (8)
+TA5 - PERIODS CHECK OK (9)
+TA5 - PERIODS CHECK OK (10)
+*** END OF TEST 20 ***
diff --git a/testsuites/ada/sptests/sp20/config.h b/testsuites/ada/sptests/sp20/config.h
new file mode 100644
index 0000000000..daf598bf4c
--- /dev/null
+++ b/testsuites/ada/sptests/sp20/config.h
@@ -0,0 +1,31 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 7
+#define CONFIGURE_MAXIMUM_PERIODS 10
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp20/sp20.adb b/testsuites/ada/sptests/sp20/sp20.adb
new file mode 100644
index 0000000000..898b96c119
--- /dev/null
+++ b/testsuites/ada/sptests/sp20/sp20.adb
@@ -0,0 +1,54 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP20 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP20 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 10,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP20;
+
diff --git a/testsuites/ada/sptests/sp20/sptest.adb b/testsuites/ada/sptests/sp20/sptest.adb
new file mode 100644
index 0000000000..1929fd958f
--- /dev/null
+++ b/testsuites/ada/sptests/sp20/sptest.adb
@@ -0,0 +1,310 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 20 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.CLOCK;
+with RTEMS.RATE_MONOTONIC;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 20 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+ SPTEST.TASK_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'A', '4', ' ' );
+ SPTEST.TASK_NAME( 5 ) := RTEMS.BUILD_NAME( 'T', 'A', '5', ' ' );
+ SPTEST.TASK_NAME( 6 ) := RTEMS.BUILD_NAME( 'T', 'A', '6', ' ' );
+
+ for INDEX in 1 .. 6
+ loop
+
+ SPTEST.COUNT( INDEX ) := 0;
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( INDEX ),
+ SPTEST.PRIORITIES( INDEX ),
+ 4096,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
+
+ end loop;
+
+ for INDEX in 1 .. 6
+ loop
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( INDEX ),
+ SPTEST.TASK_1_THROUGH_6'ACCESS,
+ RTEMS.TASKS.ARGUMENT( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
+
+ end loop;
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1_THROUGH_6
+--
+
+ procedure TASK_1_THROUGH_6 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ RMID : RTEMS.ID;
+ TEST_RMID : RTEMS.ID;
+ PASS : RTEMS.UNSIGNED32;
+ FAILED : RTEMS.UNSIGNED32;
+ STATUS : RTEMS.STATUS_CODES;
+ TIME : array( 0 .. 10 ) of RTEMS.INTERVAL;
+ PERIOD : RTEMS.INTERVAL;
+ MEASURE : RTEMS.INTERVAL;
+ begin
+
+ RTEMS.RATE_MONOTONIC.CREATE( ARGUMENT, RMID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "RATE_MONOTONIC_CREATE" );
+ TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( INTEGER( ARGUMENT ) ), FALSE );
+ TEXT_IO.PUT( "- rate_monotonic_create id = " );
+ UNSIGNED32_IO.PUT( RMID, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.RATE_MONOTONIC.IDENT( ARGUMENT, TEST_RMID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "RATE_MONOTONIC_IDENT" );
+ TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( INTEGER( ARGUMENT ) ), FALSE );
+ TEXT_IO.PUT( "- rate_monotonic_ident id = " );
+ UNSIGNED32_IO.PUT( RMID, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+ if TEST_RMID /= RMID then
+ TEXT_IO.PUT_LINE( "RMID's DO NOT MATCH!!!" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( INTEGER( ARGUMENT ) ), FALSE );
+ TEXT_IO.PUT( " - (" );
+ UNSIGNED32_IO.PUT( RMID, WIDTH => 1, BASE => 16 );
+ TEXT_IO.PUT( ") period " );
+ UNSIGNED32_IO.PUT(
+ SPTEST.PERIODS( INTEGER( ARGUMENT ) ),
+ WIDTH => 1,
+ BASE => 10
+ );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.TASKS.WAKE_AFTER( 2, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ case ARGUMENT is
+ when 1 .. 4 =>
+ loop
+ RTEMS.RATE_MONOTONIC.PERIOD(
+ RMID,
+ SPTEST.PERIODS( INTEGER( ARGUMENT ) ),
+ STATUS
+ );
+
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "RATE_MONOTONIC_PERIOD"
+ );
+
+ SPTEST.COUNT( INTEGER( ARGUMENT ) ) :=
+ SPTEST.COUNT( INTEGER( ARGUMENT ) ) + 1;
+
+ end loop;
+
+ when 5 =>
+
+ PASS := 0;
+ FAILED := 0;
+
+ RTEMS.RATE_MONOTONIC.PERIOD(
+ RMID,
+ SPTEST.PERIODS( INTEGER( ARGUMENT ) ),
+ STATUS
+ );
+
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "RATE_MONOTONIC_PERIOD 1 OF TA5"
+ );
+
+ SPTEST.GET_ALL_COUNTERS;
+
+ loop
+
+ RTEMS.RATE_MONOTONIC.PERIOD(
+ RMID,
+ SPTEST.PERIODS( INTEGER( ARGUMENT ) ),
+ STATUS
+ );
+
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS,
+ "RATE_MONOTONIC_PERIOD 2 OF TA5"
+ );
+
+ SPTEST.GET_ALL_COUNTERS;
+
+ for INDEX in 1 .. 4 loop
+
+ if SPTEST.TEMPORARY_COUNT( INDEX ) /=
+ SPTEST.ITERATIONS( INDEX ) then
+
+ TEXT_IO.PUT( "FAIL -- " );
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( INDEX ),
+ FALSE
+ );
+ TEXT_IO.PUT( "ACTUAL=" );
+ UNSIGNED32_IO.PUT(
+ SPTEST.TEMPORARY_COUNT( INDEX ),
+ WIDTH => 3,
+ BASE => 10
+ );
+ TEXT_IO.PUT( " EXPECTED=" );
+ UNSIGNED32_IO.PUT(
+ SPTEST.ITERATIONS( INDEX ),
+ WIDTH => 3,
+ BASE => 10
+ );
+ TEXT_IO.NEW_LINE;
+
+ FAILED := FAILED + 1;
+
+ end if;
+
+ end loop;
+
+ if FAILED = 5 then
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ PASS := PASS + 1;
+ TEXT_IO.PUT( "TA5 - PERIODS CHECK OK (" );
+ UNSIGNED32_IO.PUT( PASS, WIDTH => 1, BASE => 10 );
+ TEXT_IO.PUT_LINE( ")" );
+
+ if PASS = 10 then
+ TEXT_IO.PUT_LINE( "*** END OF TEST 20 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ end loop;
+
+ when 6 =>
+ -- test changing periods
+ for INDEX in 0 .. 10 loop
+ PERIOD := RTEMS.INTERVAL( ( INDEX + 1 ) * 10 );
+ RTEMS.RATE_MONOTONIC.PERIOD( RMID, PERIOD, STATUS);
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS, "rate_monotonic_period of TA6"
+ );
+
+ -- timestamp
+ Time( INDEX ) := RTEMS.CLOCK.GET_TICKS_SINCE_BOOT;
+ end loop;
+
+ for INDEX in 1 .. 10 loop
+ MEASURE := TIME( INDEX ) - TIME( INDEX - 1 );
+ PERIOD := RTEMS.INTERVAL( INDEX * 10 );
+ TEXT_IO.PUT( "TA6 - Actual: " );
+ UNSIGNED32_IO.PUT( MEASURE, WIDTH => 3, BASE => 10 );
+ TEXT_IO.PUT( " Expected: " );
+ UNSIGNED32_IO.PUT( PERIOD, WIDTH => 3, BASE => 10 );
+ if PERIOD = MEASURE then
+ TEXT_IO.PUT_LINE( " - OK" );
+ else
+ TEXT_IO.PUT_LINE( " - FAILED" );
+ end if;
+ end loop;
+
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED(
+ STATUS, "task_suspend of TA6"
+ );
+
+ when others =>
+ NULL;
+
+ end case;
+
+ end TASK_1_THROUGH_6;
+
+--
+-- GET_ALL_COUNTERS
+--
+
+ procedure GET_ALL_COUNTERS
+ is
+ PREVIOUS_MODE : RTEMS.MODE;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.MODE(
+ RTEMS.NO_PREEMPT,
+ RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE TO NO_PREEMPT" );
+
+ SPTEST.TEMPORARY_COUNT := SPTEST.COUNT;
+
+ for INDEX in 1 .. 5
+ loop
+
+ SPTEST.COUNT( INDEX ) := 0;
+
+ end loop;
+
+ RTEMS.TASKS.MODE(
+ RTEMS.PREEMPT,
+ RTEMS.PREEMPT_MASK,
+ PREVIOUS_MODE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE TO PREEMPT" );
+
+ end GET_ALL_COUNTERS;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp20/sptest.ads b/testsuites/ada/sptests/sp20/sptest.ads
new file mode 100644
index 0000000000..384cc1dac5
--- /dev/null
+++ b/testsuites/ada/sptests/sp20/sptest.ads
@@ -0,0 +1,105 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 20 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( 1 .. 6 ) of RTEMS.ID;
+ TASK_NAME : array ( 1 .. 6 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the parameters which define the execution
+-- characteristics and periods of each instantiation of the
+-- copies of the RTEMS task TASKS_1_THROUGH_6.
+--
+
+ PERIODS : constant array ( 1 .. 6 )
+ of RTEMS.UNSIGNED32 := ( 2, 2, 2, 2, 100, 0 );
+
+ ITERATIONS : constant array ( 1 .. 6 )
+ of RTEMS.UNSIGNED32 := ( 50, 50, 50, 50, 1, 10 );
+
+ PRIORITIES : constant array ( 1 .. 6 )
+ of RTEMS.UNSIGNED32 := ( 1, 1, 3, 4, 5, 1 );
+
+--
+-- The following type defines the array used to manage the
+-- execution counts of each task's period.
+--
+
+ type COUNT_ARRAY is array ( 1 .. 6 ) of RTEMS.UNSIGNED32;
+
+--
+-- These arrays contains the number of periods successfully completed
+-- by each of the tasks. At each of its periods, the fifth task
+-- will copy the contents of the COUNT array to TEMPORARY_COUNT,
+-- and clear the COUNT array. The copy is performed to insure
+-- that no periods fire while it is verifying the correctness
+-- of the test's execution.
+--
+
+ COUNT : SPTEST.COUNT_ARRAY;
+ TEMPORARY_COUNT : SPTEST.COUNT_ARRAY;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1_THROUGH_6
+--
+-- DESCRIPTION:
+--
+-- These RTEMS tasks test the Rate Monotonic Manager.
+--
+
+ procedure TASK_1_THROUGH_6 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1_THROUGH_6);
+
+--
+-- GET_ALL_COUNTERS
+--
+-- DESCRIPTION:
+--
+-- This subprogram atomically copies the contents of COUNTER to
+-- TEMPORARY_COUNTER.
+--
+
+ procedure GET_ALL_COUNTERS;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp22/Makefile.am b/testsuites/ada/sptests/sp22/Makefile.am
new file mode 100644
index 0000000000..8b24be6768
--- /dev/null
+++ b/testsuites/ada/sptests/sp22/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp22
+ada_sp22_SOURCES = sp22.adb config.h sptest.adb sptest.ads
+ada_sp22_SOURCES += ../../support/init.c
+
+ada_sp22$(EXEEXT): sp22.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp22.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp22/ada_sp22.scn b/testsuites/ada/sptests/sp22/ada_sp22.scn
new file mode 100644
index 0000000000..3e96936e24
--- /dev/null
+++ b/testsuites/ada/sptests/sp22/ada_sp22.scn
@@ -0,0 +1,29 @@
+*** TEST 22 ***
+INIT - timer_create - creating timer 1
+INIT - timer 1 has id (16#12010001#)
+TA1 - timer_ident - identing timer 1
+TA1 - timer 1 has id (16#12010001#)
+TA1 - clock_get - 9: 0: 0 12/31/1988
+TA1 - timer_after - timer 1 in 3 seconds
+TA1 - task_suspend( SELF )
+TA1 - clock_get - 9: 0: 3 12/31/1988
+TA1 - timer_after - timer 1 in 3 seconds
+TA1 - task_wake_after - 1 second
+TA1 - clock_get - 9: 0: 4 12/31/1988
+TA1 - timer_reset - timer 1
+TA1 - task_suspend( SELF )
+TA1 - clock_get - 9: 0: 7 12/31/1988
+<pause>
+TA1 - timer_after - timer 1 in 3 seconds
+TA1 - timer_cancel - timer 1
+TA1 - clock_get - 9: 0: 7 12/31/1988
+TA1 - timer_when - timer 1 in 3 seconds
+TA1 - task_suspend( SELF )
+TA1 - clock_get - 9: 0:10 12/31/1988
+TA1 - timer_when - timer 1 in 3 seconds
+TA1 - task_wake_after - 1 second
+TA1 - clock_get - 9: 0:11 12/31/1988
+TA1 - timer_cancel - timer 1
+TA1 - task_wake_after - YIELD (only task at priority)
+TA1 - timer_delete - timer 1
+*** END OF TEST 22 ***
diff --git a/testsuites/ada/sptests/sp22/config.h b/testsuites/ada/sptests/sp22/config.h
new file mode 100644
index 0000000000..b8ed5c97d0
--- /dev/null
+++ b/testsuites/ada/sptests/sp22/config.h
@@ -0,0 +1,31 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_TIMERS 2
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp22/sp22.adb b/testsuites/ada/sptests/sp22/sp22.adb
new file mode 100644
index 0000000000..842bc7338e
--- /dev/null
+++ b/testsuites/ada/sptests/sp22/sp22.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP22 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP22 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP22;
+
diff --git a/testsuites/ada/sptests/sp22/sptest.adb b/testsuites/ada/sptests/sp22/sptest.adb
new file mode 100644
index 0000000000..a947628db5
--- /dev/null
+++ b/testsuites/ada/sptests/sp22/sptest.adb
@@ -0,0 +1,297 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 22 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.CLOCK;
+with RTEMS.TIMER;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 22 ***" );
+
+ TIME := ( 1988, 12, 31, 9, 0, 0, 0 );
+
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ TEXT_IO.PUT_LINE( "INIT - timer_create - creating timer 1" );
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( 1 ),
+ SPTEST.TIMER_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE OF TM1" );
+ TEXT_IO.PUT( "INIT - timer 1 has id (" );
+ UNSIGNED32_IO.PUT( SPTEST.TIMER_ID( 1 ), WIDTH => 8, BASE => 16 );
+ TEXT_IO.PUT_LINE( ")" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- DELAYED_RESUME
+--
+
+ procedure DELAYED_RESUME (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ ) is
+ pragma Unreferenced(IGNORED_ID);
+ pragma Unreferenced(IGNORED_ADDRESS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.RESUME( SPTEST.TASK_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME OF SELF" );
+
+ end DELAYED_RESUME;
+
+--
+-- PRINT_TIME
+--
+
+ procedure PRINT_TIME
+ is
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( 1 ),
+ FALSE
+ );
+
+ TEST_SUPPORT.PRINT_TIME( "- clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ end PRINT_TIME;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TMID : RTEMS.ID;
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+-- GET ID
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_ident - identing timer 1" );
+ RTEMS.TIMER.IDENT( SPTEST.TIMER_NAME( 1 ), TMID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_IDENT OF TM1" );
+ TEXT_IO.PUT( "TA1 - timer 1 has id (" );
+ UNSIGNED32_IO.PUT( SPTEST.TIMER_ID( 1 ), WIDTH => 8, BASE => 16 );
+ TEXT_IO.PUT_LINE( ")" );
+
+-- AFTER WHICH IS ALLOWED TO FIRE
+
+ SPTEST.PRINT_TIME;
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_after - timer 1 in 3 seconds" );
+ RTEMS.TIMER.FIRE_AFTER(
+ TMID,
+ 3 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.DELAYED_RESUME'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend( SELF )" );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ SPTEST.PRINT_TIME;
+
+-- AFTER WHICH IS RESET AND ALLOWED TO FIRE
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_after - timer 1 in 3 seconds" );
+ RTEMS.TIMER.FIRE_AFTER(
+ TMID,
+ 3 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.DELAYED_RESUME'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - 1 second" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ SPTEST.PRINT_TIME;
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_reset - timer 1" );
+ RTEMS.TIMER.RESET( TMID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_RESET" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend( SELF )" );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ SPTEST.PRINT_TIME;
+
+TEST_SUPPORT.PAUSE;
+
+--
+-- Reset the time since we do not know how long the user waited
+-- before pressing <cr> at the pause. This insures that the
+-- actual output matches the screen.
+--
+
+ TIME := ( 1988, 12, 31, 9, 0, 7, 0 );
+
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" );
+
+-- after which is canceled
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_after - timer 1 in 3 seconds" );
+ RTEMS.TIMER.FIRE_AFTER(
+ TMID,
+ 3 * TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.DELAYED_RESUME'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_cancel - timer 1" );
+ RTEMS.TIMER.CANCEL( TMID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CANCEL" );
+
+-- when which is allowed to fire
+
+ SPTEST.PRINT_TIME;
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ TIME.SECOND := TIME.SECOND + 3;
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_when - timer 1 in 3 seconds" );
+ RTEMS.TIMER.FIRE_WHEN(
+ TMID,
+ TIME,
+ SPTEST.DELAYED_RESUME'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend( SELF )" );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ SPTEST.PRINT_TIME;
+
+-- when which is canceled
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ TIME.SECOND := TIME.SECOND + 3;
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_when - timer 1 in 3 seconds" );
+ RTEMS.TIMER.FIRE_WHEN(
+ TMID,
+ TIME,
+ SPTEST.DELAYED_RESUME'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_WHEN" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - 1 second" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ SPTEST.PRINT_TIME;
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_cancel - timer 1" );
+ RTEMS.TIMER.CANCEL( TMID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CANCEL" );
+
+-- delete
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - task_wake_after - YIELD (only task at priority)"
+ );
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER YIELD" );
+
+ TEXT_IO.PUT_LINE( "TA1 - timer_delete - timer 1" );
+ RTEMS.TIMER.DELETE( TMID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_DELETE" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 22 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp22/sptest.ads b/testsuites/ada/sptests/sp22/sptest.ads
new file mode 100644
index 0000000000..af312fafb8
--- /dev/null
+++ b/testsuites/ada/sptests/sp22/sptest.ads
@@ -0,0 +1,93 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 22 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS timers created
+-- by this test.
+--
+
+ TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- DELAYED_RESUME
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled to be fired as a timer service
+-- routine. When fired this subprogram resumes TASK_1.
+--
+
+ procedure DELAYED_RESUME (
+ IGNORED_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, DELAYED_RESUME);
+
+--
+-- PRINT_TIME
+--
+-- DESCRIPTION:
+--
+-- This subprogram prints the name of TASK_1 and the current TIME of day.
+--
+
+ procedure PRINT_TIME;
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Timer Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp23/Makefile.am b/testsuites/ada/sptests/sp23/Makefile.am
new file mode 100644
index 0000000000..ccd4bfe4ec
--- /dev/null
+++ b/testsuites/ada/sptests/sp23/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp23
+ada_sp23_SOURCES = sp23.adb config.h sptest.adb sptest.ads
+ada_sp23_SOURCES += ../../support/init.c
+
+ada_sp23$(EXEEXT): sp23.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp23.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp23/ada_sp23.scn b/testsuites/ada/sptests/sp23/ada_sp23.scn
new file mode 100644
index 0000000000..2fc1e74582
--- /dev/null
+++ b/testsuites/ada/sptests/sp23/ada_sp23.scn
@@ -0,0 +1,9 @@
+*** TEST 23 ***
+INIT - port_create - DP1 - internal = 16#1000# external = 16#2000#
+TA1 - port_ident - 16#3A010001#
+TA1 - port_external_to_internal - external: 16#200E# => internal: 16#100E#
+TA1 - port_internal_to_external - internal: 16#100E# => external: 16#200E#
+TA1 - port_external_to_internal - external: 16#300E# => internal: 16#300E#
+TA1 - port_internal_to_external - internal: 16#50E# => external: 16#50E#
+TA1 - port_delete - DP1
+*** END OF TEST 23 ***
diff --git a/testsuites/ada/sptests/sp23/config.h b/testsuites/ada/sptests/sp23/config.h
new file mode 100644
index 0000000000..277e38b708
--- /dev/null
+++ b/testsuites/ada/sptests/sp23/config.h
@@ -0,0 +1,31 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_PORTS 1
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp23/sp23.adb b/testsuites/ada/sptests/sp23/sp23.adb
new file mode 100644
index 0000000000..5a6a728e1d
--- /dev/null
+++ b/testsuites/ada/sptests/sp23/sp23.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP23 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP23 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP23;
+
diff --git a/testsuites/ada/sptests/sp23/sptest.adb b/testsuites/ada/sptests/sp23/sptest.adb
new file mode 100644
index 0000000000..e3a2871ab6
--- /dev/null
+++ b/testsuites/ada/sptests/sp23/sptest.adb
@@ -0,0 +1,175 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 23 of the RTEMS
+-- Single Processor 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 ADDRESS_IO;
+with TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.PORT;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ INTERNAL_AREA : RTEMS.ADDRESS;
+ EXTERNAL_AREA : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 23 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ SPTEST.PORT_NAME( 1 ) := RTEMS.BUILD_NAME( 'D', 'P', '1', ' ' );
+
+ INTERNAL_AREA := SPTEST.INTERNAL_PORT_AREA( 0 )'ADDRESS;
+ EXTERNAL_AREA := SPTEST.EXTERNAL_PORT_AREA( 0 )'ADDRESS;
+ RTEMS.PORT.CREATE(
+ SPTEST.PORT_NAME( 1 ),
+ INTERNAL_AREA,
+ EXTERNAL_AREA,
+ SPTEST.INTERNAL_PORT_AREA'LENGTH,
+ SPTEST.PORT_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PORT_CREATE OF DP1" );
+ TEXT_IO.PUT( "INIT - port_create - DP1 - internal = " );
+ ADDRESS_IO.PUT( INTERNAL_AREA, WIDTH => 8, BASE => 16 );
+ TEXT_IO.PUT( " external = " );
+ ADDRESS_IO.PUT( EXTERNAL_AREA, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ DPID : RTEMS.ID;
+ TO_BE_CONVERTED : RTEMS.ADDRESS;
+ CONVERTED : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.PORT.IDENT( SPTEST.PORT_NAME( 1 ), DPID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PORT_IDENT" );
+ TEXT_IO.PUT( "TA1 - port_ident - " );
+ UNSIGNED32_IO.PUT( DPID, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TO_BE_CONVERTED := SPTEST.EXTERNAL_PORT_AREA( 16#E# )'ADDRESS;
+ RTEMS.PORT.EXTERNAL_TO_INTERNAL(
+ SPTEST.PORT_ID( 1 ),
+ TO_BE_CONVERTED,
+ CONVERTED,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PORT_EXTERNAL_TO_INTERNAL" );
+ TEXT_IO.PUT( "TA1 - port_external_to_internal - external: " );
+ ADDRESS_IO.PUT( TO_BE_CONVERTED, WIDTH => 8, BASE => 16 );
+ TEXT_IO.PUT( " => internal: " );
+ ADDRESS_IO.PUT( CONVERTED, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TO_BE_CONVERTED := SPTEST.INTERNAL_PORT_AREA( 16#E# )'ADDRESS;
+ RTEMS.PORT.INTERNAL_TO_EXTERNAL(
+ SPTEST.PORT_ID( 1 ),
+ TO_BE_CONVERTED,
+ CONVERTED,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PORT_INTERNAL_TO_EXTERNAL" );
+ TEXT_IO.PUT( "TA1 - port_internal_to_external - internal: " );
+ ADDRESS_IO.PUT( TO_BE_CONVERTED, WIDTH => 8, BASE => 16 );
+ TEXT_IO.PUT( " => external: " );
+ ADDRESS_IO.PUT( CONVERTED, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TO_BE_CONVERTED := SPTEST.ABOVE_PORT_AREA( 16#E# )'ADDRESS;
+ RTEMS.PORT.EXTERNAL_TO_INTERNAL(
+ SPTEST.PORT_ID( 1 ),
+ TO_BE_CONVERTED,
+ CONVERTED,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PORT_EXTERNAL_TO_INTERNAL" );
+ TEXT_IO.PUT( "TA1 - port_external_to_internal - external: " );
+ ADDRESS_IO.PUT( TO_BE_CONVERTED, WIDTH => 8, BASE => 16 );
+ TEXT_IO.PUT( " => internal: " );
+ ADDRESS_IO.PUT( CONVERTED, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TO_BE_CONVERTED := SPTEST.BELOW_PORT_AREA( 16#E# )'ADDRESS;
+ RTEMS.PORT.INTERNAL_TO_EXTERNAL(
+ SPTEST.PORT_ID( 1 ),
+ TO_BE_CONVERTED,
+ CONVERTED,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PORT_INTERNAL_TO_EXTERNAL" );
+ TEXT_IO.PUT( "TA1 - port_internal_to_external - internal: " );
+ ADDRESS_IO.PUT( TO_BE_CONVERTED, WIDTH => 8, BASE => 16 );
+ TEXT_IO.PUT( " => external: " );
+ ADDRESS_IO.PUT( CONVERTED, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT_LINE( "TA1 - port_delete - DP1" );
+ RTEMS.PORT.DELETE( SPTEST.PORT_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PORT_DELETE" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 23 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp23/sptest.ads b/testsuites/ada/sptests/sp23/sptest.ads
new file mode 100644
index 0000000000..b5faf7b87a
--- /dev/null
+++ b/testsuites/ada/sptests/sp23/sptest.ads
@@ -0,0 +1,118 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 23 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SYSTEM;
+with System.Storage_Elements;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS ports created
+-- by this test.
+--
+
+ PORT_ID : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.ID;
+ PORT_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 1 ) of RTEMS.NAME;
+
+--
+-- The following area defines a memory area to be used as the
+-- internal address space of the port.
+--
+
+ INTERNAL_PORT_AREA_ADDRESS : constant System.Address :=
+ System.Storage_Elements.To_Address(16#00001000#);
+
+ INTERNAL_PORT_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for INTERNAL_PORT_AREA'Address use INTERNAL_PORT_AREA_ADDRESS;
+
+--
+-- The following area defines a memory area to be used as the
+-- external address space of the port.
+--
+
+ EXTERNAL_PORT_AREA_ADDRESS : constant System.Address :=
+ System.Storage_Elements.To_Address(16#00002000#);
+
+ EXTERNAL_PORT_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for EXTERNAL_PORT_AREA'Address use EXTERNAL_PORT_AREA_ADDRESS;
+
+--
+-- The following area defines a memory area to be used for
+-- addresses which are below the address space of the port.
+--
+
+ BELOW_PORT_AREA_ADDRESS : constant System.Address :=
+ System.Storage_Elements.To_Address(16#00000500#);
+
+ BELOW_PORT_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for BELOW_PORT_AREA'Address use BELOW_PORT_AREA_ADDRESS;
+
+--
+-- The following area defines a memory area to be used for
+-- addresses which are above the address space of the port.
+--
+
+ ABOVE_PORT_AREA_ADDRESS : constant System.Address :=
+ System.Storage_Elements.To_Address(16#00003000#);
+
+ ABOVE_PORT_AREA : array ( RTEMS.UNSIGNED32 range 0 .. 255 )
+ of RTEMS.UNSIGNED8;
+ for ABOVE_PORT_AREA'Address use ABOVE_PORT_AREA_ADDRESS;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Dual Ported Memory Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp24/Makefile.am b/testsuites/ada/sptests/sp24/Makefile.am
new file mode 100644
index 0000000000..a8ebaecb52
--- /dev/null
+++ b/testsuites/ada/sptests/sp24/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp24
+ada_sp24_SOURCES = sp24.adb config.h sptest.adb sptest.ads
+ada_sp24_SOURCES += ../../support/init.c
+
+ada_sp24$(EXEEXT): sp24.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp24.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp24/ada_sp24.scn b/testsuites/ada/sptests/sp24/ada_sp24.scn
new file mode 100644
index 0000000000..eb626eb6b2
--- /dev/null
+++ b/testsuites/ada/sptests/sp24/ada_sp24.scn
@@ -0,0 +1,16 @@
+*** TEST 24 ***
+TA1 - clock_get - 9: 0: 0 12/31/1988
+TA2 - clock_get - 9: 0: 0 12/31/1988
+TA3 - clock_get - 9: 0: 0 12/31/1988
+TA1 - clock_get - 9: 0: 5 12/31/1988
+TA1 - clock_get - 9: 0:10 12/31/1988
+TA2 - clock_get - 9: 0:10 12/31/1988
+TA1 - clock_get - 9: 0:15 12/31/1988
+TA3 - clock_get - 9: 0:15 12/31/1988
+TA1 - clock_get - 9: 0:20 12/31/1988
+TA2 - clock_get - 9: 0:20 12/31/1988
+TA1 - clock_get - 9: 0:25 12/31/1988
+TA1 - clock_get - 9: 0:30 12/31/1988
+TA3 - clock_get - 9: 0:30 12/31/1988
+TA2 - clock_get - 9: 0:30 12/31/1988
+*** END OF TEST 24 ***
diff --git a/testsuites/ada/sptests/sp24/config.h b/testsuites/ada/sptests/sp24/config.h
new file mode 100644
index 0000000000..a72dd35dac
--- /dev/null
+++ b/testsuites/ada/sptests/sp24/config.h
@@ -0,0 +1,31 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+#define CONFIGURE_MAXIMUM_TIMERS 3
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp24/sp24.adb b/testsuites/ada/sptests/sp24/sp24.adb
new file mode 100644
index 0000000000..e56802640b
--- /dev/null
+++ b/testsuites/ada/sptests/sp24/sp24.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP24 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP24 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP24;
+
diff --git a/testsuites/ada/sptests/sp24/sptest.adb b/testsuites/ada/sptests/sp24/sptest.adb
new file mode 100644
index 0000000000..4245036995
--- /dev/null
+++ b/testsuites/ada/sptests/sp24/sptest.adb
@@ -0,0 +1,167 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 24 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with RTEMS.CLOCK;
+with RTEMS.TIMER;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 24 ***" );
+
+ TIME := ( 1988, 12, 31, 9, 0, 0, 0 );
+
+ RTEMS.CLOCK.SET( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+
+ SPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' );
+ SPTEST.TIMER_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'M', '2', ' ' );
+ SPTEST.TIMER_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'M', '3', ' ' );
+
+ for INDEX in 1 .. 3
+ loop
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( INDEX ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
+
+ RTEMS.TIMER.CREATE(
+ SPTEST.TIMER_NAME( INDEX ),
+ SPTEST.TIMER_ID( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE LOOP" );
+
+ end loop;
+
+ for INDEX in 1 .. 3
+ loop
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( INDEX ),
+ SPTEST.TASK_1_THROUGH_3'ACCESS,
+ RTEMS.TASKS.ARGUMENT( INDEX ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
+
+ end loop;
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- RESUME_TASK
+--
+
+ procedure RESUME_TASK (
+ TIMER_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ ) is
+ pragma Unreferenced(IGNORED_ADDRESS);
+ TASK_TO_RESUME : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TASK_TO_RESUME := SPTEST.TASK_ID(INTEGER( RTEMS.GET_INDEX( TIMER_ID ) ));
+ RTEMS.TASKS.RESUME( TASK_TO_RESUME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME" );
+
+ end RESUME_TASK;
+
+--
+-- TASK_1_THROUGH_3
+--
+
+ procedure TASK_1_THROUGH_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ TID : RTEMS.ID;
+ TIME : RTEMS.TIME_OF_DAY;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" );
+
+ loop
+
+ RTEMS.TIMER.FIRE_AFTER(
+ SPTEST.TIMER_ID( INTEGER( ARGUMENT ) ),
+ TEST_SUPPORT.TASK_NUMBER( TID ) * 5 *
+ TEST_SUPPORT.TICKS_PER_SECOND,
+ SPTEST.RESUME_TASK'ACCESS,
+ RTEMS.NULL_ADDRESS,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" );
+
+ RTEMS.CLOCK.GET_TOD( TIME, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" );
+
+ if TIME.SECOND >= 35 then
+ TEXT_IO.PUT_LINE( "*** END OF TEST 24 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+ end if;
+
+ TEST_SUPPORT.PUT_NAME(
+ SPTEST.TASK_NAME( INTEGER( TEST_SUPPORT.TASK_NUMBER( TID ) ) ),
+ FALSE
+ );
+
+ TEST_SUPPORT.PRINT_TIME( " - clock_get - ", TIME, "" );
+ TEXT_IO.NEW_LINE;
+
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ end loop;
+
+ end TASK_1_THROUGH_3;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp24/sptest.ads b/testsuites/ada/sptests/sp24/sptest.ads
new file mode 100644
index 0000000000..166ee812b3
--- /dev/null
+++ b/testsuites/ada/sptests/sp24/sptest.ads
@@ -0,0 +1,83 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 24 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS timers created
+-- by this test.
+--
+
+ TIMER_ID : array ( 1 .. 3 ) of RTEMS.ID;
+ TIMER_NAME : array ( 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- RESUME_TASK
+--
+-- DESCRIPTION:
+--
+-- This subprogram is scheduled as a timer service routine. When
+-- it fires it resumes the task which is mapped to this timer.
+--
+
+ procedure RESUME_TASK (
+ TIMER_ID : in RTEMS.ID;
+ IGNORED_ADDRESS : in RTEMS.ADDRESS
+ );
+ pragma Convention (C, RESUME_TASK);
+
+--
+-- TASK_1_THROUGH_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Timer Manager.
+--
+
+ procedure TASK_1_THROUGH_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1_THROUGH_3);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp25/Makefile.am b/testsuites/ada/sptests/sp25/Makefile.am
new file mode 100644
index 0000000000..b4b864d8d7
--- /dev/null
+++ b/testsuites/ada/sptests/sp25/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp25
+ada_sp25_SOURCES = sp25.adb config.h sptest.adb sptest.ads
+ada_sp25_SOURCES += ../../support/init.c
+
+ada_sp25$(EXEEXT): sp25.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp25.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp25/ada_sp25.scn b/testsuites/ada/sptests/sp25/ada_sp25.scn
new file mode 100644
index 0000000000..bb568001ac
--- /dev/null
+++ b/testsuites/ada/sptests/sp25/ada_sp25.scn
@@ -0,0 +1,29 @@
+*** TEST 25 ***
+TA1 - region_ident - rnid => 16#32010001#
+TA1 - region_get_segment - wait on 64 byte segment from region 1
+TA1 - got segment from region 1 - 16#10#
+TA1 - region_get_segment - wait on 128 byte segment from region 1
+TA1 - got segment from region 1 - 16#70#
+TA1 - region_get_segment - wait on 256 byte segment from region 1
+TA1 - got segment from region 1 - 16#110#
+TA1 - region_get_segment - wait on 512 byte segment from region 1
+TA1 - got segment from region 1 - 16#230#
+TA1 - region_get_segment - wait on 1024 byte segment from region 1
+TA1 - got segment from region 1 - 16#450#
+TA1 - region_get_segment - wait on 2048 byte segment from region 1
+TA1 - got segment from region 1 - 16#870#
+TA1 - region_get_segment - wait on 4096 byte segment from region 1
+TA1 - got segment from region 1 - 16#1090#
+TA1 - region_get_segment - wait on 8192 byte segment from region 1
+TA1 - got segment from region 1 - 16#20B0#
+<pause>
+TA1 - region_return_segment - return segment to region 1 - 16#110#
+TA1 - region_return_segment - return segment to region 1 - 16#230#
+TA1 - region_return_segment - return segment to region 1 - 16#10#
+TA1 - region_return_segment - return segment to region 1 - 16#70#
+TA1 - region_return_segment - return segment to region 1 - 16#1090#
+TA1 - region_return_segment - return segment to region 1 - 16#870#
+TA1 - region_return_segment - return segment to region 1 - 16#20B0#
+TA1 - region_return_segment - return segment to region 1 - 16#450#
+TA1 - region_delete - walks heap if debug enabled
+*** END OF TEST 25 ***
diff --git a/testsuites/ada/sptests/sp25/config.h b/testsuites/ada/sptests/sp25/config.h
new file mode 100644
index 0000000000..aa74afdd45
--- /dev/null
+++ b/testsuites/ada/sptests/sp25/config.h
@@ -0,0 +1,31 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_REGIONS 1
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp25/sp25.adb b/testsuites/ada/sptests/sp25/sp25.adb
new file mode 100644
index 0000000000..00db138fa9
--- /dev/null
+++ b/testsuites/ada/sptests/sp25/sp25.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP25 of the Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP25 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP25;
+
diff --git a/testsuites/ada/sptests/sp25/sptest.adb b/testsuites/ada/sptests/sp25/sptest.adb
new file mode 100644
index 0000000000..1fb103e966
--- /dev/null
+++ b/testsuites/ada/sptests/sp25/sptest.adb
@@ -0,0 +1,362 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 25 of the RTEMS
+-- Single Processor 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 TEST_SUPPORT;
+with TEXT_IO;
+with UNSIGNED32_IO;
+with RTEMS.REGION;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 25 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ SPTEST.BASE_PRIORITY,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ SPTEST.REGION_NAME( 1 ) := RTEMS.BUILD_NAME( 'R', 'N', '1', ' ' );
+
+ RTEMS.REGION.CREATE(
+ SPTEST.REGION_NAME( 1 ),
+ SPTEST.AREA_1'ADDRESS,
+ 64000,
+ 32,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.REGION_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE OF RN1" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- PUT_ADDRESS_FROM_AREA_1
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_1 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ ) is
+
+ begin
+
+ UNSIGNED32_IO.PUT(
+ RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_1'ADDRESS ),
+ WIDTH => 8,
+ BASE => 16
+ );
+
+ end PUT_ADDRESS_FROM_AREA_1;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ RNID : RTEMS.ID;
+ SEGMENT_ADDRESS_1 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_2 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_3 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_4 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_5 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_6 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_7 : RTEMS.ADDRESS;
+ SEGMENT_ADDRESS_8 : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.REGION.IDENT( SPTEST.REGION_NAME( 1 ), RNID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_IDENT OF RN1" );
+ TEXT_IO.PUT( "TA1 - region_ident - rnid => " );
+ UNSIGNED32_IO.PUT( RNID, WIDTH => 8, BASE => 16 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "64 byte segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 64,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_1 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "128 byte segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 128,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_2 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "256 byte segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 256,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_3 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "512 byte segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 512,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_4,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "1024 byte segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 1024,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_5,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_5 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "2048 byte segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 2048,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_6,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_6 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "4096 byte segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 4096,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_7,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_7 );
+ TEXT_IO.NEW_LINE;
+
+ TEXT_IO.PUT( "TA1 - region_get_segment - wait on " );
+ TEXT_IO.PUT_LINE( "8192 byte segment from region 1" );
+ RTEMS.REGION.GET_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ 8192,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ SEGMENT_ADDRESS_8,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_GET_SEGMENT" );
+ TEXT_IO.PUT( "TA1 - got segment from region 1 - " );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_8 );
+ TEXT_IO.NEW_LINE;
+
+TEST_SUPPORT.PAUSE;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_3 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+ -- SEGMENT_ADDRESS_3 := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_4,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+ -- SEGMENT_ADDRESS_4 := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_1 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_1,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+ -- SEGMENT_ADDRESS_1 := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_2 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+ -- SEGMENT_ADDRESS_2 := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_7 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_7,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+ -- SEGMENT_ADDRESS_7 := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_6 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_6,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+ -- SEGMENT_ADDRESS_6 := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_8 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_8,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+ -- SEGMENT_ADDRESS_8 := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT(
+ "TA1 - region_return_segment - return segment to region 1 - "
+ );
+ SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_5 );
+ RTEMS.REGION.RETURN_SEGMENT(
+ SPTEST.REGION_ID( 1 ),
+ SEGMENT_ADDRESS_5,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_RETURN_SEGMENT" );
+ TEXT_IO.NEW_LINE;
+ -- SEGMENT_ADDRESS_5 := RTEMS.NULL_ADDRESS;
+
+ TEXT_IO.PUT_LINE(
+ "TA1 - region_delete - walks heap if debug enabled"
+ );
+ RTEMS.REGION.DELETE( SPTEST.REGION_ID( 1 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_DELETE OF RN1" );
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 25 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp25/sptest.ads b/testsuites/ada/sptests/sp25/sptest.ads
new file mode 100644
index 0000000000..21c27a38db
--- /dev/null
+++ b/testsuites/ada/sptests/sp25/sptest.ads
@@ -0,0 +1,103 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 25 of the RTEMS
+-- Single Processor 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 RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME;
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS regions created
+-- by this test.
+--
+
+ REGION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID;
+ REGION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME;
+
+--
+-- The following constant defines the priority of most of the
+-- RTEMS tasks in this test. This allows one of the tasks to
+-- easily set itself to a higher priority than the rest.
+--
+
+ BASE_PRIORITY : constant RTEMS.TASKS.PRIORITY := 140;
+
+--
+-- These arrays define the memory areas used for the regions in
+-- this test.
+--
+
+ AREA_1 : array ( RTEMS.UNSIGNED32 range 0 .. 64000 ) of RTEMS.UNSIGNED8;
+ for AREA_1'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- PUT_ADDRESS_FROM_AREA_1
+--
+-- DESCRIPTION:
+--
+-- This subprogram prints the offset of the address TO_BE_PRINTED
+-- from the first byte of AREA_1.
+--
+-- NOTE:
+--
+-- This subprogram is used because the actual address of AREA_1
+-- varies based upon the size of the executable, the target board,
+-- and the target processor.
+--
+
+ procedure PUT_ADDRESS_FROM_AREA_1 (
+ TO_BE_PRINTED : in RTEMS.ADDRESS
+ );
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Region Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/spatcb01/Makefile.am b/testsuites/ada/sptests/spatcb01/Makefile.am
new file mode 100644
index 0000000000..0e5dbaf652
--- /dev/null
+++ b/testsuites/ada/sptests/spatcb01/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_spatcb01
+ada_spatcb01_SOURCES = spatcb01.adb config.h
+ada_spatcb01_SOURCES += ../../support/init.c
+
+ada_spatcb01$(EXEEXT): spatcb01.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_spatcb01.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/spatcb01/ada_spatcb01.scn b/testsuites/ada/sptests/spatcb01/ada_spatcb01.scn
new file mode 100644
index 0000000000..7738ff8a0e
--- /dev/null
+++ b/testsuites/ada/sptests/spatcb01/ada_spatcb01.scn
@@ -0,0 +1,3 @@
+*** BEGIN OF TEST SPATCB 1 ***
+foreign thread
+*** END OF TEST SPATCB 1 ***
diff --git a/testsuites/ada/sptests/spatcb01/config.h b/testsuites/ada/sptests/spatcb01/config.h
new file mode 100644
index 0000000000..405b536c82
--- /dev/null
+++ b/testsuites/ada/sptests/spatcb01/config.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2017 embedded brains GmbH
+ *
+ * The license and distribution terms for this file may in
+ * the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/ada/sptests/spatcb01/spatcb01.adb b/testsuites/ada/sptests/spatcb01/spatcb01.adb
new file mode 100644
index 0000000000..19aaa8031f
--- /dev/null
+++ b/testsuites/ada/sptests/spatcb01/spatcb01.adb
@@ -0,0 +1,26 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- Ensure that the SYSTEM.TASK_PRIMITIVES.OPERATIONS.SPECIFIC implementation
+-- works.
+--
+-- Copyright (c) 2017 embedded brains GmbH
+--
+-- 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 TEXT_IO;
+with System.Task_Primitives.Operations;
+with System.Tasking;
+
+procedure SPATCB01 is
+ Self_Id : constant System.Tasking.Task_Id := System.Task_Primitives.Operations.Self;
+begin
+ TEXT_IO.PUT_LINE( "*** BEGIN OF TEST SPATCB 1 ***" );
+ TEXT_IO.PUT_LINE( Self_Id.Common.Task_Image( 1 .. Self_Id.Common.Task_Image_Len ) );
+ TEXT_IO.PUT_LINE( "*** END OF TEST SPATCB 1 ***" );
+end SPATCB01;
diff --git a/testsuites/ada/sptests/spname01/Makefile.am b/testsuites/ada/sptests/spname01/Makefile.am
new file mode 100644
index 0000000000..fccab37289
--- /dev/null
+++ b/testsuites/ada/sptests/spname01/Makefile.am
@@ -0,0 +1,18 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_spname01
+ada_spname01_SOURCES = spname01.adb config.h sptest.adb sptest.ads
+
+ada_spname01$(EXEEXT): spname01.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+init.$(OBJEXT): ../../support/init.c
+ $(COMPILE.c) -I$(srcdir) -c $<
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_spname01.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/spname01/ada_spname01.scn b/testsuites/ada/sptests/spname01/ada_spname01.scn
new file mode 100644
index 0000000000..825cd14437
--- /dev/null
+++ b/testsuites/ada/sptests/spname01/ada_spname01.scn
@@ -0,0 +1,3 @@
+*** Ada Task Name TEST ***
+TBD
+*** END OF Ada Task Name TEST ***
diff --git a/testsuites/ada/sptests/spname01/config.h b/testsuites/ada/sptests/spname01/config.h
new file mode 100644
index 0000000000..2be186cc2a
--- /dev/null
+++ b/testsuites/ada/sptests/spname01/config.h
@@ -0,0 +1,31 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2008.
+ * 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.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION
+
+/* NOTICE: the clock driver is explicitly disabled */
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/spname01/spname01.adb b/testsuites/ada/sptests/spname01/spname01.adb
new file mode 100644
index 0000000000..863e64f24e
--- /dev/null
+++ b/testsuites/ada/sptests/spname01/spname01.adb
@@ -0,0 +1,28 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test Hello of the Sample Test Suite.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989-2009.
+-- 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.
+--
+
+procedure SPNAME01 is
+begin
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SPNAME01;
+
diff --git a/testsuites/ada/sptests/spname01/sptest.adb b/testsuites/ada/sptests/spname01/sptest.adb
new file mode 100644
index 0000000000..5dd78d8e4a
--- /dev/null
+++ b/testsuites/ada/sptests/spname01/sptest.adb
@@ -0,0 +1,62 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of the Ada Task Name test of the RTEMS
+-- Ada Single Processor Test Suite.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989-2009.
+-- 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 RTEMS;
+with TEST_SUPPORT;
+with TEXT_IO;
+with System; use System; -- for Null Pointer comparison
+
+package body SPTEST is
+
+ task body AdaTask is
+ Status : RTEMS.Status_Codes;
+ Pointer : RTEMS.Address;
+ StringName : String(1 .. 120) := (1 .. 120 => '*' );
+ NewName : constant String := "Josiah";
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** Ada Task Name TEST ***" );
+
+ RTEMS.Object_Get_Name( RTEMS.Self, StringName, Pointer );
+ if Pointer = RTEMS.Null_Address then
+ TEXT_IO.PUT_LINE( "Object_Get_Name_Failed" );
+ else
+ TEXT_IO.PUT_LINE( "My name is (" & StringName & ")" );
+ end if;
+
+ TEXT_IO.PUT_LINE( "Setting name to (Josiah)" );
+ RTEMS.Object_Set_Name( RTEMS.Self, NewName, Status );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "Object_Set_Name" );
+
+ RTEMS.Object_Get_Name( RTEMS.Self, StringName, Pointer );
+ if Pointer = RTEMS.Null_Address then
+ TEXT_IO.PUT_LINE( "Object_Get_Name_Failed" );
+ else
+ TEXT_IO.PUT_LINE( "My name is (" & StringName & ")" );
+ end if;
+
+ TEXT_IO.PUT_LINE( "*** END OF Ada Task Name TEST ***" );
+
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end AdaTask;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/spname01/sptest.ads b/testsuites/ada/sptests/spname01/sptest.ads
new file mode 100644
index 0000000000..5e4f682221
--- /dev/null
+++ b/testsuites/ada/sptests/spname01/sptest.ads
@@ -0,0 +1,25 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for the Hello World Test of the RTEMS
+-- Sample Test Suite.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989-2009.
+-- 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.
+--
+
+package SPTEST is
+
+ task AdaTask;
+
+end SPTEST;