OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [ada/] [a-interr.adb] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
------------------------------------------------------------------------------
2
--                                                                          --
3
--                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
4
--                                                                          --
5
--                         A D A . I N T E R R U P T S                      --
6
--                                                                          --
7
--                                  B o d y                                 --
8
--                                                                          --
9
--             Copyright (C) 1991-1994, Florida State University            --
10
--                     Copyright (C) 1995-2005, AdaCore                     --
11
--                                                                          --
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,  51  Franklin  Street,  Fifth  Floor, --
21
-- Boston, MA 02110-1301, USA.                                              --
22
--                                                                          --
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.                                      --
29
--                                                                          --
30
-- GNARL was developed by the GNARL team at Florida State University.       --
31
-- Extensive contributions were provided by Ada Core Technologies, Inc.     --
32
--                                                                          --
33
------------------------------------------------------------------------------
34
 
35
with System.Interrupts;
36
--  used for Interrupt_ID
37
--           Parameterless_Handler
38
--           Is_Reserved
39
--           Is_Handler_Attached
40
--           Current_Handler
41
--           Attach_Handler
42
--           Exchange_Handler
43
--           Detach_Handler
44
--           Reference
45
 
46
with Unchecked_Conversion;
47
 
48
package body Ada.Interrupts is
49
 
50
   package SI renames System.Interrupts;
51
 
52
   function To_System is new Unchecked_Conversion
53
     (Parameterless_Handler, SI.Parameterless_Handler);
54
 
55
   function To_Ada is new Unchecked_Conversion
56
     (SI.Parameterless_Handler, Parameterless_Handler);
57
 
58
   --------------------
59
   -- Attach_Handler --
60
   --------------------
61
 
62
   procedure Attach_Handler
63
     (New_Handler : Parameterless_Handler;
64
      Interrupt   : Interrupt_ID)
65
   is
66
   begin
67
      SI.Attach_Handler
68
        (To_System (New_Handler), SI.Interrupt_ID (Interrupt), False);
69
   end Attach_Handler;
70
 
71
   ---------------------
72
   -- Current_Handler --
73
   ---------------------
74
 
75
   function Current_Handler
76
     (Interrupt : Interrupt_ID) return Parameterless_Handler
77
   is
78
   begin
79
      return To_Ada (SI.Current_Handler (SI.Interrupt_ID (Interrupt)));
80
   end Current_Handler;
81
 
82
   --------------------
83
   -- Detach_Handler --
84
   --------------------
85
 
86
   procedure Detach_Handler (Interrupt : Interrupt_ID) is
87
   begin
88
      SI.Detach_Handler (SI.Interrupt_ID (Interrupt), False);
89
   end Detach_Handler;
90
 
91
   ----------------------
92
   -- Exchange_Handler --
93
   ----------------------
94
 
95
   procedure Exchange_Handler
96
     (Old_Handler : out Parameterless_Handler;
97
      New_Handler : Parameterless_Handler;
98
      Interrupt   : Interrupt_ID)
99
   is
100
      H : SI.Parameterless_Handler;
101
 
102
   begin
103
      SI.Exchange_Handler
104
        (H, To_System (New_Handler),
105
         SI.Interrupt_ID (Interrupt), False);
106
      Old_Handler := To_Ada (H);
107
   end Exchange_Handler;
108
 
109
   -----------------
110
   -- Is_Attached --
111
   -----------------
112
 
113
   function Is_Attached (Interrupt : Interrupt_ID) return Boolean is
114
   begin
115
      return SI.Is_Handler_Attached (SI.Interrupt_ID (Interrupt));
116
   end Is_Attached;
117
 
118
   -----------------
119
   -- Is_Reserved --
120
   -----------------
121
 
122
   function Is_Reserved (Interrupt : Interrupt_ID) return Boolean is
123
   begin
124
      return SI.Is_Reserved (SI.Interrupt_ID (Interrupt));
125
   end Is_Reserved;
126
 
127
   ---------------
128
   -- Reference --
129
   ---------------
130
 
131
   function Reference (Interrupt : Interrupt_ID) return System.Address is
132
   begin
133
      return SI.Reference (SI.Interrupt_ID (Interrupt));
134
   end Reference;
135
 
136
end Ada.Interrupts;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.