summaryrefslogtreecommitdiffstats
path: root/irq_test
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-10-17 20:55:06 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-10-17 20:55:06 +0000
commit14f44a3474b5177a73aede9d3ab142ab003f5796 (patch)
treeeeab866e741b2a851d712497384f45ea56717863 /irq_test
parent2007-10-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadada-examples-14f44a3474b5177a73aede9d3ab142ab003f5796.tar.bz2
2007-10-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile, Makefile.shared, rtems_init.c, irq_test/interrupt_pkg.adb, irq_test/interrupt_pkg.ads, irq_test/irqforce.c, irq_test/irqtest.adb, rootfs/etc/hosts: Adding new tests as improvements are made to the RTEMS port of the GNAT run-time. * empty/Makefile, empty/README, empty/empty.adb, hello_via_task/.cvsignore, hello_via_task/Makefile, hello_via_task/hello.adb, irq_test/.cvsignore, irq_test/Makefile, irq_test/README, irq_test_c/.cvsignore, irq_test_c/Makefile, irq_test_c/README, irq_test_c/init.c, irq_test_c/irqforce.c: New files.
Diffstat (limited to 'irq_test')
-rw-r--r--irq_test/.cvsignore8
-rw-r--r--irq_test/Makefile29
-rw-r--r--irq_test/README26
-rw-r--r--irq_test/interrupt_pkg.adb37
-rw-r--r--irq_test/interrupt_pkg.ads8
-rw-r--r--irq_test/irqforce.c10
-rw-r--r--irq_test/irqtest.adb10
7 files changed, 121 insertions, 7 deletions
diff --git a/irq_test/.cvsignore b/irq_test/.cvsignore
new file mode 100644
index 0000000..494c67d
--- /dev/null
+++ b/irq_test/.cvsignore
@@ -0,0 +1,8 @@
+*.swp
+.gdbinit
+b~irqtest.adb
+b~irqtest.ads
+b~irqtest.ali
+interrupt_pkg.ali
+irqtest
+irqtest.ali
diff --git a/irq_test/Makefile b/irq_test/Makefile
new file mode 100644
index 0000000..697d6c3
--- /dev/null
+++ b/irq_test/Makefile
@@ -0,0 +1,29 @@
+#
+# Makefile for Ada Dump URL example
+#
+# See README.Makefiles in the main ada-examples directory.
+#
+
+PROGRAM=irqtest
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+# stack size for the first Ada thread
+CFLAGS +=-DGNAT_MAIN_STACKSPACE=100
+
+# initialize the network stack -- assumes existence of networkconfig.h
+# CFLAGS +=-DMAIN_USE_NETWORKING=1
+
+# Should we prompt for command line arguments?
+# DEFINES +=-DMAIN_USE_REQUIRES_COMMAND_LINE
+
+# If you want to hard-code the command line, define this to a string
+# DEFINES += -DMAIN_COMMAND_LINE="ARGS"
+
+EXTRA_OBJS = irqforce.o
+
+include ../Makefile.shared
+
+irqforce.o: irqforce.c
diff --git a/irq_test/README b/irq_test/README
new file mode 100644
index 0000000..9a0fac6
--- /dev/null
+++ b/irq_test/README
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+
+WARNING!!! Code is ERC32 specific.
+
+The directories irq_test and irq_test_c are related and provided
+for performance comparisons.
+
+This directory contains a simple benchmark in Ada of a forced interrupt
+and provides a baseline comparison point for the performance
+of the GNAT implementation of Ada interrupt tasks on RTEMS.
+
+On 17 October 2007, this program run on TSIM reported that
+this program took 315 microseconds on a 14 Mhz SPARC/ERC32 to complete
+the following sequence:
+
+ + itest: Start Timer
+ + itest: Force IRQ
+ + hidden Ada ISR Handler: Release a simple binary semaphore
+ + Handler Task: Wake up from an Ada entry
+ + Handler Task: Stop Timer
+
+In comparison, the irq_test_c program implementing the same
+sequence but using C interrupt tasks took only 158 microseconds
+on the same target.
diff --git a/irq_test/interrupt_pkg.adb b/irq_test/interrupt_pkg.adb
index 2097ba8..729b284 100644
--- a/irq_test/interrupt_pkg.adb
+++ b/irq_test/interrupt_pkg.adb
@@ -12,11 +12,19 @@
-- Written by Tullio Vardanega and Jiri Gaisler
-- European Space Agency, 1999.
--
+-- The license and distribution terms for this file may be
+-- found in the file LICENSE in this distribution or at
+-- http://www.rtems.com/license/LICENSE.
+--
+-- $Id$
+--
+
with Ada.Interrupts;
with System;
with Ada.Text_IO;
+with Ada.Real_Time; use Ada.Real_Time;
package body Interrupt_pkg is
@@ -25,6 +33,9 @@ package body Interrupt_pkg is
Protected_Priority : constant System.Interrupt_Priority :=
System.Interrupt_Priority'First;
+ Start_Time : Ada.Real_Time.Time;
+ Stop_Time : Ada.Real_Time.Time;
+
-- Protected object, including interrupt handler (Signal) and conditional entry.
protected Handler is
@@ -41,25 +52,32 @@ package body Interrupt_pkg is
begin
BARRIER := LOW;
end Signal;
+
entry Wait when (BARRIER = LOW) is
+ Took : Time_Span;
begin
+ Stop_Time := Ada.Real_Time.Clock;
BARRIER := HIGH;
+
+ Took := Stop_Time - Start_Time;
+
+ Ada.Text_IO.Put_line ( "Interrupt took: " &
+ Duration'Image(To_Duration(Took)));
end Wait;
end Handler;
-- Sporadic task, waiting on entry (Wait) for the interrupt.
task sporadic is
- pragma Priority (8);
+ pragma Priority (100);
end sporadic;
task body sporadic is
- Message : constant STRING :=
- "sporadic activated";
+ Message : constant STRING := "sporadic activated";
begin
loop
Handler.Wait;
- Ada.Text_IO.Put_line (Message);
+
end loop;
end sporadic;
@@ -69,7 +87,15 @@ package body Interrupt_pkg is
procedure irqforce(irq : integer);
pragma Import (C, irqforce, "irqforce");
begin
+
+ Start_Time := Ada.Real_Time.Clock;
+ Stop_Time := Ada.Real_Time.Clock;
+
+ Ada.Text_IO.Put_line ( "Timer Overhead: " &
+ Duration'Image(To_Duration(Stop_Time - Start_Time)));
+
for i in 1..10 loop
+ Start_Time := Ada.Real_Time.Clock;
irqforce(1);
delay(0.05);
end loop;
@@ -80,7 +106,8 @@ package body Interrupt_pkg is
begin
- itest;
+ -- itest;
+ NULL;
end Interrupt_pkg;
diff --git a/irq_test/interrupt_pkg.ads b/irq_test/interrupt_pkg.ads
index 6bc597e..2d24f3b 100644
--- a/irq_test/interrupt_pkg.ads
+++ b/irq_test/interrupt_pkg.ads
@@ -1,3 +1,11 @@
+--
+-- The license and distribution terms for this file may be
+-- found in the file LICENSE in this distribution or at
+-- http://www.rtems.com/license/LICENSE.
+--
+-- $Id$
+--
+
package Interrupt_pkg is
procedure itest;
end Interrupt_pkg;
diff --git a/irq_test/irqforce.c b/irq_test/irqforce.c
index 78ae91a..ad46b8b 100644
--- a/irq_test/irqforce.c
+++ b/irq_test/irqforce.c
@@ -1,6 +1,14 @@
+/*
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
#include <bsp.h>
-irqforce(int irq)
+void irqforce(int irq)
{
ERC32_Unmask_interrupt(irq);
ERC32_Force_interrupt(irq);
diff --git a/irq_test/irqtest.adb b/irq_test/irqtest.adb
index 1a9dfad..ad23c65 100644
--- a/irq_test/irqtest.adb
+++ b/irq_test/irqtest.adb
@@ -1,7 +1,15 @@
+--
+-- The license and distribution terms for this file may be
+-- found in the file LICENSE in this distribution or at
+-- http://www.rtems.com/license/LICENSE.
+--
+-- $Id$
+--
+
with Interrupt_pkg;
procedure irqtest is
begin
- null;
+ Interrupt_pkg.itest;
end irqtest;