1 ------------------------------------------------------------------------------
3 -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- A D A . I N T E R R U P T S --
9 -- Copyright (C) 1991-1994, Florida State University --
10 -- Copyright (C) 1995-2003, Ada Core Technologies --
12 -- GNARL is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNARL; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
30 -- GNARL was developed by the GNARL team at Florida State University. --
31 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
33 ------------------------------------------------------------------------------
35 with System.Interrupts;
36 -- used for Interrupt_ID
37 -- Parameterless_Handler
39 -- Is_Handler_Attached
46 with Unchecked_Conversion;
48 package body Ada.Interrupts is
50 package SI renames System.Interrupts;
52 function To_System is new Unchecked_Conversion
53 (Parameterless_Handler, SI.Parameterless_Handler);
55 function To_Ada is new Unchecked_Conversion
56 (SI.Parameterless_Handler, Parameterless_Handler);
62 procedure Attach_Handler
63 (New_Handler : Parameterless_Handler;
64 Interrupt : Interrupt_ID)
68 (To_System (New_Handler), SI.Interrupt_ID (Interrupt), False);
75 function Current_Handler
76 (Interrupt : Interrupt_ID)
77 return Parameterless_Handler
80 return To_Ada (SI.Current_Handler (SI.Interrupt_ID (Interrupt)));
87 procedure Detach_Handler (Interrupt : in Interrupt_ID) is
89 SI.Detach_Handler (SI.Interrupt_ID (Interrupt), False);
92 ----------------------
93 -- Exchange_Handler --
94 ----------------------
96 procedure Exchange_Handler
97 (Old_Handler : out Parameterless_Handler;
98 New_Handler : Parameterless_Handler;
99 Interrupt : Interrupt_ID)
101 H : SI.Parameterless_Handler;
105 (H, To_System (New_Handler),
106 SI.Interrupt_ID (Interrupt), False);
107 Old_Handler := To_Ada (H);
108 end Exchange_Handler;
114 function Is_Attached (Interrupt : Interrupt_ID) return Boolean is
116 return SI.Is_Handler_Attached (SI.Interrupt_ID (Interrupt));
123 function Is_Reserved (Interrupt : Interrupt_ID) return Boolean is
125 return SI.Is_Reserved (SI.Interrupt_ID (Interrupt));
132 function Reference (Interrupt : Interrupt_ID) return System.Address is
134 return SI.Reference (SI.Interrupt_ID (Interrupt));