summaryrefslogtreecommitdiffstats
path: root/testsuites/ada/tmtests/tm11
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/ada/tmtests/tm11')
-rw-r--r--testsuites/ada/tmtests/tm11/Makefile.am13
-rw-r--r--testsuites/ada/tmtests/tm11/config.h32
-rw-r--r--testsuites/ada/tmtests/tm11/tm11.adb55
-rw-r--r--testsuites/ada/tmtests/tm11/tmtest.adb218
-rw-r--r--testsuites/ada/tmtests/tm11/tmtest.ads115
5 files changed, 433 insertions, 0 deletions
diff --git a/testsuites/ada/tmtests/tm11/Makefile.am b/testsuites/ada/tmtests/tm11/Makefile.am
new file mode 100644
index 0000000000..8779d31500
--- /dev/null
+++ b/testsuites/ada/tmtests/tm11/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_tm11
+ada_tm11_SOURCES = tm11.adb config.h tmtest.adb tmtest.ads
+ada_tm11_SOURCES += ../../support/init.c
+
+ada_tm11$(EXEEXT): tm11.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/tmtests/tm11/config.h b/testsuites/ada/tmtests/tm11/config.h
new file mode 100644
index 0000000000..a5064b6e92
--- /dev/null
+++ b/testsuites/ada/tmtests/tm11/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/tm11/tm11.adb b/testsuites/ada/tmtests/tm11/tm11.adb
new file mode 100644
index 0000000000..bcc91aa905
--- /dev/null
+++ b/testsuites/ada/tmtests/tm11/tm11.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test TM11 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 TM11 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 TM11;
+
diff --git a/testsuites/ada/tmtests/tm11/tmtest.adb b/testsuites/ada/tmtests/tm11/tmtest.adb
new file mode 100644
index 0000000000..610c248d57
--- /dev/null
+++ b/testsuites/ada/tmtests/tm11/tmtest.adb
@@ -0,0 +1,218 @@
+--
+-- TMTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 11 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.MESSAGE_QUEUE;
+
+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 11 ***" );
+
+ RTEMS.TASKS.CREATE(
+ 1,
+ 251,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ TASK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" );
+
+ RTEMS.TASKS.START(
+ TASK_ID,
+ TMTEST.TEST_INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" );
+
+ 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);
+ TASK_ENTRY : RTEMS.TASKS.ENTRY_POINT;
+ PRIORITY : RTEMS.TASKS.PRIORITY;
+ TASK_ID : RTEMS.ID;
+ BUFFER : TMTEST.BUFFER;
+ BUFFER_POINTER : RTEMS.ADDRESS;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ BUFFER_POINTER := BUFFER'ADDRESS;
+
+-- As each task is started, it preempts this task and performs a blocking
+-- MESSAGE_QUEUE_RECEIVE. Upon completion of this loop all created tasks
+-- are blocked.
+
+ RTEMS.MESSAGE_QUEUE.CREATE(
+ RTEMS.BUILD_NAME( 'M', 'Q', '1', ' ' ),
+ TIME_TEST_SUPPORT.OPERATION_COUNT,
+ 16,
+ RTEMS.DEFAULT_OPTIONS,
+ TMTEST.QUEUE_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" );
+
+ PRIORITY := 250;
+
+ for INDEX in 0 .. TIME_TEST_SUPPORT.OPERATION_COUNT - 1
+ loop
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'T', 'I', 'M', 'E' ),
+ PRIORITY,
+ 1024,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ TASK_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" );
+
+ PRIORITY := PRIORITY - 1;
+
+ if INDEX = TIME_TEST_SUPPORT.OPERATION_COUNT - 1 then
+ TASK_ENTRY := TMTEST.HIGH_TASK'ACCESS;
+ else
+ TASK_ENTRY := TMTEST.MIDDLE_TASKS'ACCESS;
+ end if;
+
+ RTEMS.TASKS.START( TASK_ID, TASK_ENTRY, 0, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" );
+
+ end loop;
+
+ TIMER_DRIVER.INITIALIZE;
+ RTEMS.MESSAGE_QUEUE.SEND(
+ TMTEST.QUEUE_ID,
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ end TEST_INIT;
+
+--
+-- HIGH_TASK
+--
+
+ procedure HIGH_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ BUFFER : TMTEST.BUFFER;
+ BUFFER_POINTER : RTEMS.ADDRESS;
+ MESSAGE_SIZE : RTEMS.UNSIGNED32 := 0;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ BUFFER_POINTER := BUFFER'ADDRESS;
+
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ TMTEST.QUEUE_ID,
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+
+ TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
+
+ TIME_TEST_SUPPORT.PUT_TIME(
+ "MESSAGE_QUEUE_SEND (preemptive)",
+ TMTEST.END_TIME,
+ TIME_TEST_SUPPORT.OPERATION_COUNT,
+ 0,
+ RTEMS_CALLING_OVERHEAD.MESSAGE_QUEUE_SEND
+ );
+
+ TEXT_IO.PUT_LINE( "*** END OF TIME TEST 11 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end HIGH_TASK;
+
+--
+-- MIDDLE_TASKS
+--
+
+ procedure MIDDLE_TASKS (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ BUFFER : TMTEST.BUFFER;
+ BUFFER_POINTER : RTEMS.ADDRESS;
+ MESSAGE_SIZE : RTEMS.UNSIGNED32 := 0;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ BUFFER_POINTER := BUFFER'ADDRESS;
+
+ RTEMS.MESSAGE_QUEUE.RECEIVE(
+ TMTEST.QUEUE_ID,
+ BUFFER_POINTER,
+ RTEMS.DEFAULT_OPTIONS,
+ RTEMS.NO_TIMEOUT,
+ MESSAGE_SIZE,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" );
+
+ RTEMS.MESSAGE_QUEUE.SEND(
+ TMTEST.QUEUE_ID,
+ BUFFER_POINTER,
+ 16,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" );
+
+ end MIDDLE_TASKS;
+
+end TMTEST;
diff --git a/testsuites/ada/tmtests/tm11/tmtest.ads b/testsuites/ada/tmtests/tm11/tmtest.ads
new file mode 100644
index 0000000000..6718933b04
--- /dev/null
+++ b/testsuites/ada/tmtests/tm11/tmtest.ads
@@ -0,0 +1,115 @@
+--
+-- TMTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 11 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
+
+--
+-- 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;
+
+--
+-- The following is the ID of the message queue used for timing operations.
+--
+
+ QUEUE_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. As each application
+-- task is created and started, it will preempt this task and
+-- perform a blocking MESSAGE_QUEUE_RECEIVE. Once all of the
+-- initialization is completed, the timer is started and the first
+-- preemptive MESSAGE_QUEUE_SEND is executed.
+--
+
+ procedure TEST_INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TEST_INIT);
+
+--
+-- HIGH_TASK
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task is the highest priority task in the system.
+-- It performs a blocking blocking MESSAGE_QUEUE_RECEIVE. It is
+-- the last test task created and started. Thus it is the last
+-- task to be enqueued waiting for a message and the last task
+-- to receive the message. Once it receives the message, it
+-- stops the timer and reports the execution time for a
+-- preemptive MESSAGE_QUEUE_SEND.
+--
+
+ procedure HIGH_TASK (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, HIGH_TASK);
+
+--
+-- MIDDLE_TASKS
+--
+-- DESCRIPTION:
+--
+-- As each of these RTEMS tasks is created and started, it preempts
+-- the initialization task and perform a blocking MESSAGE_QUEUE_RECEIVE.
+--
+
+ procedure MIDDLE_TASKS (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, MIDDLE_TASKS);
+
+end TMTEST;