PR c++/43856
[official-gcc/constexpr.git] / gcc / ada / s-intman-vxworks.ads
blobbe1165db44874186a2ea171a6c4b6398ebb91abc
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
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 --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
10 -- --
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 3, or (at your option) any later ver- --
14 -- sion. GNAT 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. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNARL was developed by the GNARL team at Florida State University. --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This is the VxWorks version of this package
34 -- This package encapsulates and centralizes information about all
35 -- uses of interrupts (or signals), including the target-dependent
36 -- mapping of interrupts (or signals) to exceptions.
38 -- Unlike the original design, System.Interrupt_Management can only
39 -- be used for tasking systems.
41 -- PLEASE DO NOT put any subprogram declarations with arguments of
42 -- type Interrupt_ID into the visible part of this package. The type
43 -- Interrupt_ID is used to derive the type in Ada.Interrupts, and
44 -- adding more operations to that type would be illegal according
45 -- to the Ada Reference Manual. This is the reason why the signals
46 -- sets are implemented using visible arrays rather than functions.
48 with System.OS_Interface;
50 with Interfaces.C;
52 package System.Interrupt_Management is
53 pragma Preelaborate;
55 type Interrupt_Mask is limited private;
57 type Interrupt_ID is new Interfaces.C.int
58 range 0 .. System.OS_Interface.Max_Interrupt;
60 type Interrupt_Set is array (Interrupt_ID) of Boolean;
62 subtype Signal_ID is Interrupt_ID
63 range 0 .. Interfaces.C."-" (System.OS_Interface.NSIG, 1);
65 type Signal_Set is array (Signal_ID) of Boolean;
67 -- The following objects serve as constants, but are initialized in the
68 -- body to aid portability. This permits us to use more portable names for
69 -- interrupts, where distinct names may map to the same interrupt ID
70 -- value.
72 -- For example, suppose SIGRARE is a signal that is not defined on all
73 -- systems, but is always reserved when it is defined. If we have the
74 -- convention that ID zero is not used for any "real" signals, and SIGRARE
75 -- = 0 when SIGRARE is not one of the locally supported signals, we can
76 -- write:
77 -- Reserved (SIGRARE) := true;
78 -- and the initialization code will be portable.
80 Abort_Task_Interrupt : Signal_ID;
81 -- The signal that is used to implement task abort if an interrupt is used
82 -- for that purpose. This is one of the reserved signals.
84 Keep_Unmasked : Signal_Set := (others => False);
85 -- Keep_Unmasked (I) is true iff the signal I is one that must that must
86 -- be kept unmasked at all times, except (perhaps) for short critical
87 -- sections. This includes signals that are mapped to exceptions, but may
88 -- also include interrupts (e.g. timer) that need to be kept unmasked for
89 -- other reasons. Where signal masking is per-task, the signal should be
90 -- unmasked in ALL TASKS.
92 Reserve : Interrupt_Set := (others => False);
93 -- Reserve (I) is true iff the interrupt I is one that cannot be permitted
94 -- to be attached to a user handler. The possible reasons are many. For
95 -- example, it may be mapped to an exception used to implement task abort,
96 -- or used to implement time delays.
98 procedure Initialize_Interrupts;
99 -- Under VxWorks, there is no signal inheritance between tasks.
100 -- This procedure is used to initialize signal-to-exception mapping in
101 -- each task.
103 procedure Initialize;
104 -- Initialize the various variables defined in this package. This procedure
105 -- must be called before accessing any object from this package and can be
106 -- called multiple times (only the first call has any effect).
108 private
109 type Interrupt_Mask is new System.OS_Interface.sigset_t;
110 -- In some implementation Interrupt_Mask can be represented as a linked
111 -- list.
113 end System.Interrupt_Management;