1 ------------------------------------------------------------------------------
3 -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T --
9 -- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
11 -- GNARL is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNARL; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNARL was developed by the GNARL team at Florida State University. --
30 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
32 ------------------------------------------------------------------------------
34 -- This is the VxWorks version of this package.
36 -- This package encapsulates and centralizes information about all
37 -- uses of interrupts (or signals), including the target-dependent
38 -- mapping of interrupts (or signals) to exceptions.
40 -- Unlike the original design, System.Interrupt_Management can only
41 -- be used for tasking systems.
43 -- PLEASE DO NOT remove the Elaborate_Body pragma from this package.
44 -- Elaboration of this package should happen early, as most other
45 -- initializations depend on it. Forcing immediate elaboration of
46 -- the body also helps to enforce the design assumption that this
47 -- is a second-level package, just one level above System.OS_Interface
48 -- with no cross-dependencies.
50 -- PLEASE DO NOT put any subprogram declarations with arguments of
51 -- type Interrupt_ID into the visible part of this package. The type
52 -- Interrupt_ID is used to derive the type in Ada.Interrupts, and
53 -- adding more operations to that type would be illegal according
54 -- to the Ada Reference Manual. This is the reason why the signals
55 -- sets are implemeneted using visible arrays rather than functions.
57 with System
.OS_Interface
;
63 package System
.Interrupt_Management
is
65 pragma Elaborate_Body
;
67 type Interrupt_Mask
is limited private;
69 type Interrupt_ID
is new Interfaces
.C
.int
70 range 0 .. System
.OS_Interface
.Max_Interrupt
;
72 type Interrupt_Set
is array (Interrupt_ID
) of Boolean;
74 subtype Signal_ID
is Interrupt_ID
75 range 0 .. Interfaces
.C
."-" (System
.OS_Interface
.NSIG
, 1);
77 type Signal_Set
is array (Signal_ID
) of Boolean;
79 -- The following objects serve as constants, but are initialized
80 -- in the body to aid portability. This permits us to use more
81 -- portable names for interrupts, where distinct names may map to
82 -- the same interrupt ID value.
84 -- For example, suppose SIGRARE is a signal that is not defined on
85 -- all systems, but is always reserved when it is defined. If we
86 -- have the convention that ID zero is not used for any "real"
87 -- signals, and SIGRARE = 0 when SIGRARE is not one of the locally
88 -- supported signals, we can write
89 -- Reserved (SIGRARE) := true;
90 -- and the initialization code will be portable.
92 Abort_Task_Signal
: Signal_ID
;
93 -- The signal that is used to implement task abortion if
94 -- an interrupt is used for that purpose. This is one of the
97 Keep_Unmasked
: Signal_Set
:= (others => False);
98 -- Keep_Unmasked (I) is true iff the signal I is one that must
99 -- that must be kept unmasked at all times, except (perhaps) for
100 -- short critical sections. This includes signals that are
101 -- mapped to exceptions, but may also include interrupts
102 -- (e.g. timer) that need to be kept unmasked for other
103 -- reasons. Where signal masking is per-task, the signal should be
104 -- unmasked in ALL TASKS.
106 Reserve
: Interrupt_Set
:= (others => False);
107 -- Reserve (I) is true iff the interrupt I is one that cannot be
108 -- permitted to be attached to a user handler. The possible reasons
109 -- are many. For example, it may be mapped to an exception used to
110 -- implement task abortion, or used to implement time delays.
112 procedure Initialize_Interrupts
;
113 -- On systems where there is no signal inheritance between tasks (e.g
114 -- VxWorks, GNU/LinuxThreads), this procedure is used to initialize
115 -- interrupts handling in each task. Otherwise this function should
116 -- only be called by initialize in this package body.
119 type Interrupt_Mask
is new System
.OS_Interface
.sigset_t
;
120 -- In some implementation Interrupt_Mask can be represented
123 end System
.Interrupt_Management
;