summaryrefslogtreecommitdiffstats
path: root/testsuites/ada/tmtests/tm24
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/ada/tmtests/tm24')
-rw-r--r--testsuites/ada/tmtests/tm24/Makefile.am13
-rw-r--r--testsuites/ada/tmtests/tm24/config.h31
-rw-r--r--testsuites/ada/tmtests/tm24/tm24.adb55
-rw-r--r--testsuites/ada/tmtests/tm24/tmtest.adb161
-rw-r--r--testsuites/ada/tmtests/tm24/tmtest.ads99
5 files changed, 359 insertions, 0 deletions
diff --git a/testsuites/ada/tmtests/tm24/Makefile.am b/testsuites/ada/tmtests/tm24/Makefile.am
new file mode 100644
index 0000000000..9c7ec2e996
--- /dev/null
+++ b/testsuites/ada/tmtests/tm24/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_tm24
+ada_tm24_SOURCES = tm24.adb config.h tmtest.adb tmtest.ads
+ada_tm24_SOURCES += ../../support/init.c
+
+ada_tm24$(EXEEXT): tm24.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/tmtests/tm24/config.h b/testsuites/ada/tmtests/tm24/config.h
new file mode 100644
index 0000000000..85640d92a9
--- /dev/null
+++ b/testsuites/ada/tmtests/tm24/config.h
@@ -0,0 +1,31 @@
+/* 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_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/tm24/tm24.adb b/testsuites/ada/tmtests/tm24/tm24.adb
new file mode 100644
index 0000000000..a5ca5d4f7f
--- /dev/null
+++ b/testsuites/ada/tmtests/tm24/tm24.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test TM24 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 TM24 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 TM24;
+
diff --git a/testsuites/ada/tmtests/tm24/tmtest.adb b/testsuites/ada/tmtests/tm24/tmtest.adb
new file mode 100644
index 0000000000..2bcd220516
--- /dev/null
+++ b/testsuites/ada/tmtests/tm24/tmtest.adb
@@ -0,0 +1,161 @@
+--
+-- TMTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 24 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 INTERFACES; use INTERFACES;
+with RTEMS_CALLING_OVERHEAD;
+with TEST_SUPPORT;
+with TEXT_IO;
+with TIME_TEST_SUPPORT;
+with TIMER_DRIVER;
+
+package body TMTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TIME TEST 24 ***" );
+
+ TIMER_DRIVER.INITIALIZE;
+ for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
+ loop
+ TIMER_DRIVER.EMPTY_FUNCTION;
+ end loop;
+ TMTEST.OVERHEAD := TIMER_DRIVER.READ_TIMER;
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'H', 'I', 'G', 'H' ),
+ 10,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE HIGH" );
+
+ RTEMS.TASKS.START( ID, TMTEST.HIGH_TASK'ACCESS, 0, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START HIGH" );
+
+ for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
+ loop
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'R', 'E', 'S', 'T' ),
+ 128,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
+
+ RTEMS.TASKS.START( ID, TMTEST.TASKS'ACCESS, 0, 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;
+
+--
+-- HIGH_TASK
+--
+
+ procedure HIGH_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TIMER_DRIVER.INITIALIZE;
+ for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
+ loop
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ end loop;
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "TASK_WAKE_AFTER (no context switch)",
+ TMTEST.END_TIME,
+ TIME_TEST_SUPPORT.OPERATION_COUNT,
+ TMTEST.OVERHEAD,
+ RTEMS_CALLING_OVERHEAD.TASK_WAKE_AFTER
+ );
+
+ TMTEST.TASK_COUNT := 0;
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end HIGH_TASK;
+
+--
+-- TASKS
+--
+
+ procedure TASKS (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TMTEST.TASK_COUNT := TMTEST.TASK_COUNT + 1;
+
+ if TMTEST.TASK_COUNT = 1 then
+
+ TIMER_DRIVER.INITIALIZE;
+
+ elsif TMTEST.TASK_COUNT = TIME_TEST_SUPPORT.OPERATION_COUNT then
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "TASK_WAKE_AFTER (context switch)",
+ TMTEST.END_TIME,
+ TIME_TEST_SUPPORT.OPERATION_COUNT,
+ TMTEST.OVERHEAD,
+ RTEMS_CALLING_OVERHEAD.TASK_WAKE_AFTER
+ );
+
+ TEXT_IO.PUT_LINE( "*** END OF TIME TEST 24 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end if;
+
+ RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ end TASKS;
+
+end TMTEST;
diff --git a/testsuites/ada/tmtests/tm24/tmtest.ads b/testsuites/ada/tmtests/tm24/tmtest.ads
new file mode 100644
index 0000000000..fb6203d5c1
--- /dev/null
+++ b/testsuites/ada/tmtests/tm24/tmtest.ads
@@ -0,0 +1,99 @@
+--
+-- TMTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 24 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
+
+--
+-- 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;
+
+--
+-- This variable is used to determine which task should
+-- start the timer and which task should stop the timer
+-- and report the execution time.
+--
+
+ TASK_COUNT : RTEMS.UNSIGNED32;
+
+--
+-- This variable contains the execution time required of the
+-- loop used to execute the directive.
+--
+
+ OVERHEAD : RTEMS.UNSIGNED32;
+
+--
+-- 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);
+
+--
+-- HIGH_TASK
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task is responsible for measuring and reporting the
+-- execution time for an invocation of TASK_WAKE_AFTER which
+-- attempts to yield but does not result in a context switch.
+--
+
+ procedure HIGH_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, HIGH_TASK);
+
+--
+-- TASKS
+--
+-- DESCRIPTION:
+--
+-- These RTEMS tasks are responsible for measuring and reporting the
+-- execution time for an invocation of TASK_WAKE_AFTER which
+-- attempts to yield but does result in a context switch.
+--
+
+ procedure TASKS (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASKS);
+
+end TMTEST;