summaryrefslogtreecommitdiffstats
path: root/testsuites/ada/tmtests/tm19
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/ada/tmtests/tm19')
-rw-r--r--testsuites/ada/tmtests/tm19/Makefile.am13
-rw-r--r--testsuites/ada/tmtests/tm19/config.h32
-rw-r--r--testsuites/ada/tmtests/tm19/tm19.adb55
-rw-r--r--testsuites/ada/tmtests/tm19/tmtest.adb287
-rw-r--r--testsuites/ada/tmtests/tm19/tmtest.ads147
5 files changed, 534 insertions, 0 deletions
diff --git a/testsuites/ada/tmtests/tm19/Makefile.am b/testsuites/ada/tmtests/tm19/Makefile.am
new file mode 100644
index 0000000000..c21692b9f5
--- /dev/null
+++ b/testsuites/ada/tmtests/tm19/Makefile.am
@@ -0,0 +1,13 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_tm19
+ada_tm19_SOURCES = tm19.adb config.h tmtest.adb tmtest.ads
+ada_tm19_SOURCES += ../../support/init.c
+
+ada_tm19$(EXEEXT): tm19.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/tmtests/tm19/config.h b/testsuites/ada/tmtests/tm19/config.h
new file mode 100644
index 0000000000..a5064b6e92
--- /dev/null
+++ b/testsuites/ada/tmtests/tm19/config.h
@@ -0,0 +1,32 @@
+/* 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_TMTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+#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/tmtests/tm19/tm19.adb b/testsuites/ada/tmtests/tm19/tm19.adb
new file mode 100644
index 0000000000..0b232d833a
--- /dev/null
+++ b/testsuites/ada/tmtests/tm19/tm19.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test TM19 of the Timing 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 TMTEST;
+with TEST_SUPPORT;
+
+procedure TM19 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,
+ TMTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end TM19;
+
diff --git a/testsuites/ada/tmtests/tm19/tmtest.adb b/testsuites/ada/tmtests/tm19/tmtest.adb
new file mode 100644
index 0000000000..288a6a799d
--- /dev/null
+++ b/testsuites/ada/tmtests/tm19/tmtest.adb
@@ -0,0 +1,287 @@
+--
+-- TMTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 19 of the RTEMS
+-- Timing 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_CALLING_OVERHEAD;
+with TEST_SUPPORT;
+with TEXT_IO;
+with TIME_TEST_SUPPORT;
+with TIMER_DRIVER;
+with RTEMS.SIGNAL;
+
+package body TMTEST 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( "*** TIME TEST 19 ***" );
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'T', 'I', 'M', 'E' ),
+ 128,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ TMTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TASK1" );
+
+ RTEMS.TASKS.START(
+ TMTEST.TASK_ID( 1 ),
+ TMTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TASK1" );
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'T', 'I', 'M', 'E' ),
+ 127,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ TMTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TASK2" );
+
+ RTEMS.TASKS.START(
+ TMTEST.TASK_ID( 2 ),
+ TMTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TASK2" );
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'T', 'I', 'M', 'E' ),
+ 126,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ TMTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TASK3" );
+
+ RTEMS.TASKS.START(
+ TMTEST.TASK_ID( 3 ),
+ TMTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TASK3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- PROCESS_ASR_FOR_PASS_1
+--
+
+ procedure PROCESS_ASR_FOR_PASS_1 (
+ SIGNALS : in RTEMS.SIGNAL_SET
+ ) is
+ pragma Unreferenced(SIGNALS);
+ begin
+
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "SIGNAL_SEND (self)",
+ TMTEST.END_TIME,
+ 1,
+ 0,
+ RTEMS_CALLING_OVERHEAD.SIGNAL_SEND
+ );
+
+ TEXT_IO.PUT_LINE( "SIGNAL_ENTER (preemptive) na" );
+
+ TIMER_DRIVER.INITIALIZE;
+
+ end PROCESS_ASR_FOR_PASS_1;
+
+--
+-- PROCESS_ASR_FOR_PASS_2
+--
+
+ procedure PROCESS_ASR_FOR_PASS_2 (
+ SIGNALS : in RTEMS.SIGNAL_SET
+ ) is
+ pragma Unreferenced(SIGNALS);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "SIGNAL_ENTER (preemptive) na" );
+
+ RTEMS.TASKS.RESUME( TMTEST.TASK_ID( 3 ), STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME" );
+
+ TIMER_DRIVER.INITIALIZE;
+
+ end PROCESS_ASR_FOR_PASS_2;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TIMER_DRIVER.INITIALIZE;
+ RTEMS.SIGNAL.CATCH(
+ TMTEST.PROCESS_ASR_FOR_PASS_1'ACCESS,
+ RTEMS.DEFAULT_MODES,
+ STATUS
+ );
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH" );
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "SIGNAL_CATCH",
+ TMTEST.END_TIME,
+ 1,
+ 0,
+ RTEMS_CALLING_OVERHEAD.SIGNAL_CATCH
+ );
+
+ TIMER_DRIVER.INITIALIZE;
+ RTEMS.SIGNAL.SEND( TMTEST.TASK_ID( 2 ), RTEMS.SIGNAL_1, STATUS );
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" );
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "SIGNAL_SEND (non-preemptive)",
+ TMTEST.END_TIME,
+ 1,
+ 0,
+ RTEMS_CALLING_OVERHEAD.SIGNAL_SEND
+ );
+
+ TIMER_DRIVER.INITIALIZE;
+ RTEMS.SIGNAL.SEND( RTEMS.SELF, RTEMS.SIGNAL_1, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" );
+
+ -- end time is done in ASR
+
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "SIGNAL_RETURN (non-preemptive)",
+ TMTEST.END_TIME,
+ 1,
+ 0,
+ 0
+ );
+
+ RTEMS.SIGNAL.CATCH(
+ TMTEST.PROCESS_ASR_FOR_PASS_2'ACCESS,
+ RTEMS.NO_PREEMPT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH" );
+
+ TIMER_DRIVER.INITIALIZE;
+ RTEMS.SIGNAL.SEND( RTEMS.SELF, RTEMS.SIGNAL_1, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" );
+
+ end TASK_1;
+
+--
+-- PROCESS_ASR_FOR_TASK_2
+--
+
+ procedure PROCESS_ASR_FOR_TASK_2 (
+ SIGNALS : in RTEMS.SIGNAL_SET
+ ) is
+ begin
+
+ NULL;
+
+ end PROCESS_ASR_FOR_TASK_2;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.SIGNAL.CATCH(
+ TMTEST.PROCESS_ASR_FOR_TASK_2'ACCESS,
+ RTEMS.DEFAULT_MODES,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH" );
+
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" );
+
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "SIGNAL_RETURN (preemptive)",
+ TMTEST.END_TIME,
+ 1,
+ 0,
+ 0
+ );
+
+ TEXT_IO.PUT_LINE( "*** END OF TIME TEST 19 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_3;
+
+end TMTEST;
diff --git a/testsuites/ada/tmtests/tm19/tmtest.ads b/testsuites/ada/tmtests/tm19/tmtest.ads
new file mode 100644
index 0000000000..7776b41b35
--- /dev/null
+++ b/testsuites/ada/tmtests/tm19/tmtest.ads
@@ -0,0 +1,147 @@
+--
+-- TMTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 19 of the RTEMS
+-- Timing 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 TMTEST is
+
+--
+-- This array contains the IDs of all RTEMS tasks created by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+
+--
+-- The following variable is set to the execution time returned
+-- by the timer.
+--
+
+ END_TIME : RTEMS.UNSIGNED32;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- PROCESS_ASR_FOR_PASS_1
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the ASR used to measure and report the
+-- execution time of a SIGNAL_SEND to SELF. Before it exits
+-- it starts the timer so that the execution time required to
+-- exit from an ASR back to the same task can be measured.
+--
+
+ procedure PROCESS_ASR_FOR_PASS_1 (
+ SIGNALS : in RTEMS.SIGNAL_SET
+ );
+ pragma Convention (C, PROCESS_ASR_FOR_PASS_1);
+
+--
+-- PROCESS_ASR_FOR_PASS_2
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the ASR which sets up for a preemptive
+-- return from an ASR. Before it exits it starts the timer
+-- so that the execution time required to exit from an ASR
+-- and transfer control to the another task can be measured.
+--
+
+ procedure PROCESS_ASR_FOR_PASS_2 (
+ SIGNALS : in RTEMS.SIGNAL_SET
+ );
+ pragma Convention (C, PROCESS_ASR_FOR_PASS_2);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task is responsible for measuring and reporting
+-- the following execution times:
+--
+-- + SIGNAL_CATCH
+-- + non-preemptive SIGNAL_SEND
+-- + non-preemptive return from an ASR
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- PROCESS_ASR_FOR_TASK_2
+--
+-- DESCRIPTION:
+--
+-- This subprogram is the ASR for TASK_2. It performs no actions.
+--
+
+ procedure PROCESS_ASR_FOR_TASK_2 (
+ SIGNALS : in RTEMS.SIGNAL_SET
+ );
+ pragma Convention (C, PROCESS_ASR_FOR_TASK_2);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task is used as the recipient of a SIGNAL_SEND.
+-- After establishing an ASR, it suspends itself to insure
+-- that it does not execute again.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task is used as the recipient of a preemptive
+-- SIGNAL_SEND. This task suspends itself and is resumed by
+-- an ASR for TASK_1. Once the task executes, it stops the
+-- timer and reports the execution time for a preemptive
+-- return from an ASR.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+end TMTEST;