1 ------------------------------------------------------------------------------
3 -- GNAT 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-2010, AdaCore --
12 -- GNAT 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 3, or (at your option) any later ver- --
15 -- sion. GNAT 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. --
19 -- As a special exception under Section 7 of GPL version 3, you are granted --
20 -- additional permissions described in the GCC Runtime Library Exception, --
21 -- version 3.1, as published by the Free Software Foundation. --
23 -- You should have received a copy of the GNU General Public License and --
24 -- a copy of the GCC Runtime Library Exception along with this program; --
25 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
26 -- <http://www.gnu.org/licenses/>. --
28 -- GNARL was developed by the GNARL team at Florida State University. --
29 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
31 ------------------------------------------------------------------------------
33 with Ada.Unchecked_Conversion;
35 package body Ada.Interrupts is
37 package SI renames System.Interrupts;
39 function To_System is new Ada.Unchecked_Conversion
40 (Parameterless_Handler, SI.Parameterless_Handler);
42 function To_Ada is new Ada.Unchecked_Conversion
43 (SI.Parameterless_Handler, Parameterless_Handler);
49 procedure Attach_Handler
50 (New_Handler : Parameterless_Handler;
51 Interrupt : Interrupt_ID)
55 (To_System (New_Handler), SI.Interrupt_ID (Interrupt), False);
62 function Current_Handler
63 (Interrupt : Interrupt_ID) return Parameterless_Handler
66 return To_Ada (SI.Current_Handler (SI.Interrupt_ID (Interrupt)));
73 procedure Detach_Handler (Interrupt : Interrupt_ID) is
75 SI.Detach_Handler (SI.Interrupt_ID (Interrupt), False);
78 ----------------------
79 -- Exchange_Handler --
80 ----------------------
82 procedure Exchange_Handler
83 (Old_Handler : out Parameterless_Handler;
84 New_Handler : Parameterless_Handler;
85 Interrupt : Interrupt_ID)
87 H : SI.Parameterless_Handler;
91 (H, To_System (New_Handler),
92 SI.Interrupt_ID (Interrupt), False);
93 Old_Handler := To_Ada (H);
100 function Is_Attached (Interrupt : Interrupt_ID) return Boolean is
102 return SI.Is_Handler_Attached (SI.Interrupt_ID (Interrupt));
109 function Is_Reserved (Interrupt : Interrupt_ID) return Boolean is
111 return SI.Is_Reserved (SI.Interrupt_ID (Interrupt));
118 function Reference (Interrupt : Interrupt_ID) return System.Address is
120 return SI.Reference (SI.Interrupt_ID (Interrupt));