summaryrefslogtreecommitdiff
path: root/irq_test/interrupt_pkg.adb
diff options
context:
space:
mode:
Diffstat (limited to 'irq_test/interrupt_pkg.adb')
-rw-r--r--irq_test/interrupt_pkg.adb37
1 files changed, 32 insertions, 5 deletions
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;