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