summaryrefslogtreecommitdiffstats
path: root/testsuites/ada/tmtests/tm03
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/ada/tmtests/tm03')
-rw-r--r--testsuites/ada/tmtests/tm03/Makefile.am13
-rw-r--r--testsuites/ada/tmtests/tm03/config.h33
-rw-r--r--testsuites/ada/tmtests/tm03/tm03.adb55
-rw-r--r--testsuites/ada/tmtests/tm03/tmtest.adb190
-rw-r--r--testsuites/ada/tmtests/tm03/tmtest.ads96
5 files changed, 387 insertions, 0 deletions
diff --git a/testsuites/ada/tmtests/tm03/Makefile.am b/testsuites/ada/tmtests/tm03/Makefile.am
new file mode 100644
index 0000000000..81aa66358f
--- /dev/null
+++ b/testsuites/ada/tmtests/tm03/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_tm03
+ada_tm03_SOURCES = tm03.adb config.h tmtest.adb tmtest.ads
+ada_tm03_SOURCES += ../../support/init.c
+
+ada_tm03$(EXEEXT): tm03.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/tmtests/tm03/config.h b/testsuites/ada/tmtests/tm03/config.h
new file mode 100644
index 0000000000..b03802dcc5
--- /dev/null
+++ b/testsuites/ada/tmtests/tm03/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_TMTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 111
+#define CONFIGURE_MAXIMUM_TIMERS 110
+#define CONFIGURE_MAXIMUM_SEMAPHORES 101
+#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/tm03/tm03.adb b/testsuites/ada/tmtests/tm03/tm03.adb
new file mode 100644
index 0000000000..9a95e5e1d0
--- /dev/null
+++ b/testsuites/ada/tmtests/tm03/tm03.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test TM03 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 TM03 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 TM03;
+
diff --git a/testsuites/ada/tmtests/tm03/tmtest.adb b/testsuites/ada/tmtests/tm03/tmtest.adb
new file mode 100644
index 0000000000..a6e7606920
--- /dev/null
+++ b/testsuites/ada/tmtests/tm03/tmtest.adb
@@ -0,0 +1,190 @@
+--
+-- TMTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 3 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;
+with RTEMS.SEMAPHORE;
+
+package body TMTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TASK_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TIME TEST 3 ***" );
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ),
+ 252,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ TASK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TEST_INIT" );
+
+ RTEMS.TASKS.START( TASK_ID, TMTEST.TEST_INIT'ACCESS, 0, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TEST_INIT" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TEST_INIT
+--
+
+ procedure TEST_INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ PRIORITY : RTEMS.TASKS.PRIORITY;
+ TASK_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ PRIORITY := 250;
+
+ RTEMS.SEMAPHORE.CREATE(
+ RTEMS.BUILD_NAME( 'S', 'M', '1', ' ' ),
+ 0,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ RTEMS.TASKS.NO_PRIORITY,
+ TMTEST.SEMAPHORE_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE OF SM1" );
+
+ for INDEX in 2 .. TIME_TEST_SUPPORT.OPERATION_COUNT
+ loop
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'M', 'I', 'D', ' ' ),
+ PRIORITY,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ TASK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE MIDDLE" );
+
+ PRIORITY := PRIORITY - 1;
+
+ RTEMS.TASKS.START( TASK_ID, TMTEST.MIDDLE_TASKS'ACCESS, 0, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START MIDDLE" );
+
+ end loop;
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'H', 'I', 'G', 'H' ),
+ PRIORITY,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ TASK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF HIGH TASK" );
+
+ RTEMS.TASKS.START( TASK_ID, TMTEST.HIGH_TASK'ACCESS, 0, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF HIGH TASK" );
+
+ TIMER_DRIVER.INITIALIZE;
+ RTEMS.SEMAPHORE.RELEASE( TMTEST.SEMAPHORE_ID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" );
+
+ end TEST_INIT;
+
+--
+-- MIDDLE_TASKS
+--
+
+ procedure MIDDLE_TASKS (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.SEMAPHORE.OBTAIN(
+ TMTEST.SEMAPHORE_ID,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" );
+
+ RTEMS.SEMAPHORE.RELEASE( TMTEST.SEMAPHORE_ID, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" );
+
+ end MIDDLE_TASKS;
+
+--
+-- HIGH_TASK
+--
+
+ procedure HIGH_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.SEMAPHORE.OBTAIN(
+ TMTEST.SEMAPHORE_ID,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ STATUS
+ );
+
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "LAST CALL DID NOT WORK" );
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "SEMAPHORE_RELEASE (preemptive)",
+ TMTEST.END_TIME,
+ TIME_TEST_SUPPORT.OPERATION_COUNT,
+ 0,
+ RTEMS_CALLING_OVERHEAD.SEMAPHORE_RELEASE
+ );
+
+ TEXT_IO.PUT_LINE( "*** END OF TIME TEST 3 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end HIGH_TASK;
+
+end TMTEST;
diff --git a/testsuites/ada/tmtests/tm03/tmtest.ads b/testsuites/ada/tmtests/tm03/tmtest.ads
new file mode 100644
index 0000000000..4acd5f7a77
--- /dev/null
+++ b/testsuites/ada/tmtests/tm03/tmtest.ads
@@ -0,0 +1,96 @@
+--
+-- TMTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 3 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
+
+--
+-- The following is the ID of the semaphore used for timing operations.
+--
+
+ SEMAPHORE_ID : 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);
+
+--
+-- TEST_INIT
+--
+-- DESCRIPTION:
+--
+-- This subprogram performs test initialization. After completion
+-- of test initialization, the timer is started and a preemptive
+-- SEMAPHORE_RELEASE is performed.
+--
+
+ procedure TEST_INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TEST_INIT);
+
+--
+-- MIDDLE_TASKS
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task performs a blocking SEMAPHORE_OBTAIN. Once
+-- is obtains the semaphore unit and executes again, it performs
+-- a preemptive SEMAPHORE_RELEASE.
+--
+
+ procedure MIDDLE_TASKS (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, MIDDLE_TASKS);
+
+--
+-- HIGH_TASK
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task stops the timer and reports the execution
+-- timer for a preemptive SEMAPHORE_RELEASE.
+--
+
+ procedure HIGH_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, HIGH_TASK);
+
+end TMTEST;