annotate gcc/ada/libgnarl/s-intman__vxworks.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
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 --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNARL is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNARL was developed by the GNARL team at Florida State University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This is the VxWorks version of this package
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -- This package encapsulates and centralizes information about all
kono
parents:
diff changeset
35 -- uses of interrupts (or signals), including the target-dependent
kono
parents:
diff changeset
36 -- mapping of interrupts (or signals) to exceptions.
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 -- Unlike the original design, System.Interrupt_Management can only
kono
parents:
diff changeset
39 -- be used for tasking systems.
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 -- PLEASE DO NOT put any subprogram declarations with arguments of
kono
parents:
diff changeset
42 -- type Interrupt_ID into the visible part of this package. The type
kono
parents:
diff changeset
43 -- Interrupt_ID is used to derive the type in Ada.Interrupts, and
kono
parents:
diff changeset
44 -- adding more operations to that type would be illegal according
kono
parents:
diff changeset
45 -- to the Ada Reference Manual. This is the reason why the signals
kono
parents:
diff changeset
46 -- sets are implemented using visible arrays rather than functions.
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 with System.OS_Interface;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 with Interfaces.C;
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 package System.Interrupt_Management is
kono
parents:
diff changeset
53 pragma Preelaborate;
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 type Interrupt_Mask is limited private;
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 type Interrupt_ID is new Interfaces.C.int
kono
parents:
diff changeset
58 range 0 .. System.OS_Interface.Max_Interrupt;
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 type Interrupt_Set is array (Interrupt_ID) of Boolean;
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 subtype Signal_ID is Interrupt_ID range 0 .. System.OS_Interface.NSIG - 1;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 type Signal_Set is array (Signal_ID) of Boolean;
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 -- The following objects serve as constants, but are initialized in the
kono
parents:
diff changeset
67 -- body to aid portability. This permits us to use more portable names for
kono
parents:
diff changeset
68 -- interrupts, where distinct names may map to the same interrupt ID
kono
parents:
diff changeset
69 -- value.
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 -- For example, suppose SIGRARE is a signal that is not defined on all
kono
parents:
diff changeset
72 -- systems, but is always reserved when it is defined. If we have the
kono
parents:
diff changeset
73 -- convention that ID zero is not used for any "real" signals, and SIGRARE
kono
parents:
diff changeset
74 -- = 0 when SIGRARE is not one of the locally supported signals, we can
kono
parents:
diff changeset
75 -- write:
kono
parents:
diff changeset
76 -- Reserved (SIGRARE) := True;
kono
parents:
diff changeset
77 -- and the initialization code will be portable.
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 Abort_Task_Interrupt : Signal_ID;
kono
parents:
diff changeset
80 -- The signal that is used to implement task abort if an interrupt is used
kono
parents:
diff changeset
81 -- for that purpose. This is one of the reserved signals.
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 Reserve : Interrupt_Set := (others => False);
kono
parents:
diff changeset
84 -- Reserve (I) is true iff the interrupt I is one that cannot be permitted
kono
parents:
diff changeset
85 -- to be attached to a user handler. The possible reasons are many. For
kono
parents:
diff changeset
86 -- example, it may be mapped to an exception used to implement task abort,
kono
parents:
diff changeset
87 -- or used to implement time delays.
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 procedure Initialize_Interrupts;
kono
parents:
diff changeset
90 pragma Import (C, Initialize_Interrupts, "__gnat_install_handler");
kono
parents:
diff changeset
91 -- Under VxWorks, there is no signal inheritance between tasks.
kono
parents:
diff changeset
92 -- This procedure is used to initialize signal-to-exception mapping in
kono
parents:
diff changeset
93 -- each task.
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 procedure Initialize;
kono
parents:
diff changeset
96 -- Initialize the various variables defined in this package. This procedure
kono
parents:
diff changeset
97 -- must be called before accessing any object from this package and can be
kono
parents:
diff changeset
98 -- called multiple times (only the first call has any effect).
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 private
kono
parents:
diff changeset
101 type Interrupt_Mask is new System.OS_Interface.sigset_t;
kono
parents:
diff changeset
102 -- In some implementation Interrupt_Mask can be represented as a linked
kono
parents:
diff changeset
103 -- list.
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 end System.Interrupt_Management;