1 |
12 |
jlechner |
------------------------------------------------------------------------------
|
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 |
|
|
-- O P E R A T I O N S --
|
7 |
|
|
-- --
|
8 |
|
|
-- S p e c --
|
9 |
|
|
-- --
|
10 |
|
|
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
|
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 |
|
|
package System.Interrupt_Management.Operations is
|
36 |
|
|
|
37 |
|
|
procedure Thread_Block_Interrupt (Interrupt : Interrupt_ID);
|
38 |
|
|
pragma Inline (Thread_Block_Interrupt);
|
39 |
|
|
-- Mask the calling thread for the interrupt
|
40 |
|
|
|
41 |
|
|
procedure Thread_Unblock_Interrupt (Interrupt : Interrupt_ID);
|
42 |
|
|
pragma Inline (Thread_Unblock_Interrupt);
|
43 |
|
|
-- Unmask the calling thread for the interrupt
|
44 |
|
|
|
45 |
|
|
procedure Set_Interrupt_Mask (Mask : access Interrupt_Mask);
|
46 |
|
|
-- Set the interrupt mask of the calling thread
|
47 |
|
|
|
48 |
|
|
procedure Set_Interrupt_Mask
|
49 |
|
|
(Mask : access Interrupt_Mask;
|
50 |
|
|
OMask : access Interrupt_Mask);
|
51 |
|
|
pragma Inline (Set_Interrupt_Mask);
|
52 |
|
|
-- Set the interrupt mask of the calling thread while returning the
|
53 |
|
|
-- previous Mask.
|
54 |
|
|
|
55 |
|
|
procedure Get_Interrupt_Mask (Mask : access Interrupt_Mask);
|
56 |
|
|
pragma Inline (Get_Interrupt_Mask);
|
57 |
|
|
-- Get the interrupt mask of the calling thread
|
58 |
|
|
|
59 |
|
|
function Interrupt_Wait (Mask : access Interrupt_Mask) return Interrupt_ID;
|
60 |
|
|
pragma Inline (Interrupt_Wait);
|
61 |
|
|
-- Wait for the interrupts specified in Mask and return
|
62 |
|
|
-- the interrupt received. Return 0 upon error.
|
63 |
|
|
|
64 |
|
|
procedure Install_Default_Action (Interrupt : Interrupt_ID);
|
65 |
|
|
pragma Inline (Install_Default_Action);
|
66 |
|
|
-- Set the sigaction of the Interrupt to default (SIG_DFL)
|
67 |
|
|
|
68 |
|
|
procedure Install_Ignore_Action (Interrupt : Interrupt_ID);
|
69 |
|
|
pragma Inline (Install_Ignore_Action);
|
70 |
|
|
-- Set the sigaction of the Interrupt to ignore (SIG_IGN)
|
71 |
|
|
|
72 |
|
|
procedure Fill_Interrupt_Mask (Mask : access Interrupt_Mask);
|
73 |
|
|
pragma Inline (Fill_Interrupt_Mask);
|
74 |
|
|
-- Get a Interrupt_Mask with all the interrupt masked
|
75 |
|
|
|
76 |
|
|
procedure Empty_Interrupt_Mask (Mask : access Interrupt_Mask);
|
77 |
|
|
pragma Inline (Empty_Interrupt_Mask);
|
78 |
|
|
-- Get a Interrupt_Mask with all the interrupt unmasked
|
79 |
|
|
|
80 |
|
|
procedure Add_To_Interrupt_Mask
|
81 |
|
|
(Mask : access Interrupt_Mask;
|
82 |
|
|
Interrupt : Interrupt_ID);
|
83 |
|
|
pragma Inline (Add_To_Interrupt_Mask);
|
84 |
|
|
-- Mask the given interrupt in the Interrupt_Mask
|
85 |
|
|
|
86 |
|
|
procedure Delete_From_Interrupt_Mask
|
87 |
|
|
(Mask : access Interrupt_Mask;
|
88 |
|
|
Interrupt : Interrupt_ID);
|
89 |
|
|
pragma Inline (Delete_From_Interrupt_Mask);
|
90 |
|
|
-- Unmask the given interrupt in the Interrupt_Mask
|
91 |
|
|
|
92 |
|
|
function Is_Member
|
93 |
|
|
(Mask : access Interrupt_Mask;
|
94 |
|
|
Interrupt : Interrupt_ID) return Boolean;
|
95 |
|
|
pragma Inline (Is_Member);
|
96 |
|
|
-- See if a given interrupt is masked in the Interrupt_Mask
|
97 |
|
|
|
98 |
|
|
procedure Copy_Interrupt_Mask (X : out Interrupt_Mask; Y : Interrupt_Mask);
|
99 |
|
|
pragma Inline (Copy_Interrupt_Mask);
|
100 |
|
|
-- Assigment needed for limited private type Interrupt_Mask
|
101 |
|
|
|
102 |
|
|
procedure Interrupt_Self_Process (Interrupt : Interrupt_ID);
|
103 |
|
|
pragma Inline (Interrupt_Self_Process);
|
104 |
|
|
-- Raise an Interrupt process-level
|
105 |
|
|
|
106 |
|
|
procedure Setup_Interrupt_Mask;
|
107 |
|
|
-- Mask Environment task for all signals
|
108 |
|
|
-- This function should be called by the elaboration of System.Interrupt
|
109 |
|
|
-- to set up proper signal masking in all tasks.
|
110 |
|
|
|
111 |
|
|
-- The following objects serve as constants, but are initialized in the
|
112 |
|
|
-- body to aid portability. These should be in System.Interrupt_Management
|
113 |
|
|
-- but since Interrupt_Mask is private type we cannot have them declared
|
114 |
|
|
-- there.
|
115 |
|
|
|
116 |
|
|
-- Why not make these deferred constants that are initialized using
|
117 |
|
|
-- function calls in the private part???
|
118 |
|
|
|
119 |
|
|
Environment_Mask : aliased Interrupt_Mask;
|
120 |
|
|
-- This mask represents the mask of Environment task when this package is
|
121 |
|
|
-- being elaborated, except the signals being forced to be unmasked by RTS
|
122 |
|
|
-- (items in Keep_Unmasked)
|
123 |
|
|
|
124 |
|
|
All_Tasks_Mask : aliased Interrupt_Mask;
|
125 |
|
|
-- This is the mask of all tasks created in RTS. Only one task in RTS
|
126 |
|
|
-- is responsible for masking/unmasking signals (see s-interr.adb).
|
127 |
|
|
|
128 |
|
|
end System.Interrupt_Management.Operations;
|