1 | -- |
---|
2 | -- RTEMS / Body |
---|
3 | -- |
---|
4 | -- DESCRIPTION: |
---|
5 | -- |
---|
6 | -- This package provides the interface to the RTEMS API. |
---|
7 | -- |
---|
8 | -- |
---|
9 | -- DEPENDENCIES: |
---|
10 | -- |
---|
11 | -- |
---|
12 | -- |
---|
13 | -- COPYRIGHT (c) 1997-2011. |
---|
14 | -- On-Line Applications Research Corporation (OAR). |
---|
15 | -- |
---|
16 | -- The license and distribution terms for this file may in |
---|
17 | -- the file LICENSE in this distribution or at |
---|
18 | -- http://www.rtems.com/license/LICENSE. |
---|
19 | -- |
---|
20 | -- $Id$ |
---|
21 | -- |
---|
22 | |
---|
23 | package body RTEMS.Region is |
---|
24 | |
---|
25 | -- |
---|
26 | -- Region Manager |
---|
27 | -- |
---|
28 | |
---|
29 | procedure Create |
---|
30 | (Name : in RTEMS.Name; |
---|
31 | Starting_Address : in RTEMS.Address; |
---|
32 | Length : in RTEMS.Unsigned32; |
---|
33 | Page_Size : in RTEMS.Unsigned32; |
---|
34 | Attribute_Set : in RTEMS.Attribute; |
---|
35 | ID : out RTEMS.ID; |
---|
36 | Result : out RTEMS.Status_Codes) |
---|
37 | is |
---|
38 | function Create_Base |
---|
39 | (Name : RTEMS.Name; |
---|
40 | Starting_Address : RTEMS.Address; |
---|
41 | Length : RTEMS.Unsigned32; |
---|
42 | Page_Size : RTEMS.Unsigned32; |
---|
43 | Attribute_Set : RTEMS.Attribute; |
---|
44 | ID : access RTEMS.ID) |
---|
45 | return RTEMS.Status_Codes; |
---|
46 | pragma Import (C, Create_Base, "rtems_region_create"); |
---|
47 | ID_Base : aliased RTEMS.ID; |
---|
48 | begin |
---|
49 | |
---|
50 | Result := |
---|
51 | Create_Base |
---|
52 | (Name, |
---|
53 | Starting_Address, |
---|
54 | Length, |
---|
55 | Page_Size, |
---|
56 | Attribute_Set, |
---|
57 | ID_Base'Access); |
---|
58 | ID := ID_Base; |
---|
59 | |
---|
60 | end Create; |
---|
61 | |
---|
62 | procedure Ident |
---|
63 | (Name : in RTEMS.Name; |
---|
64 | ID : out RTEMS.ID; |
---|
65 | Result : out RTEMS.Status_Codes) |
---|
66 | is |
---|
67 | function Ident_Base |
---|
68 | (Name : RTEMS.Name; |
---|
69 | ID : access RTEMS.ID) |
---|
70 | return RTEMS.Status_Codes; |
---|
71 | pragma Import (C, Ident_Base, "rtems_region_ident"); |
---|
72 | ID_Base : aliased RTEMS.ID; |
---|
73 | begin |
---|
74 | |
---|
75 | Result := Ident_Base (Name, ID_Base'Access); |
---|
76 | ID := ID_Base; |
---|
77 | |
---|
78 | end Ident; |
---|
79 | |
---|
80 | procedure Delete |
---|
81 | (ID : in RTEMS.ID; |
---|
82 | Result : out RTEMS.Status_Codes) |
---|
83 | is |
---|
84 | function Delete_Base (ID : RTEMS.ID) return RTEMS.Status_Codes; |
---|
85 | pragma Import (C, Delete_Base, "rtems_region_delete"); |
---|
86 | begin |
---|
87 | |
---|
88 | Result := Delete_Base (ID); |
---|
89 | |
---|
90 | end Delete; |
---|
91 | |
---|
92 | procedure Extend |
---|
93 | (ID : in RTEMS.ID; |
---|
94 | Starting_Address : in RTEMS.Address; |
---|
95 | Length : in RTEMS.Unsigned32; |
---|
96 | Result : out RTEMS.Status_Codes) |
---|
97 | is |
---|
98 | function Extend_Base |
---|
99 | (ID : RTEMS.ID; |
---|
100 | Starting_Address : RTEMS.Address; |
---|
101 | Length : RTEMS.Unsigned32) |
---|
102 | return RTEMS.Status_Codes; |
---|
103 | pragma Import (C, Extend_Base, "rtems_region_extend"); |
---|
104 | begin |
---|
105 | |
---|
106 | Result := Extend_Base (ID, Starting_Address, Length); |
---|
107 | |
---|
108 | end Extend; |
---|
109 | |
---|
110 | procedure Get_Segment |
---|
111 | (ID : in RTEMS.ID; |
---|
112 | Size : in RTEMS.Unsigned32; |
---|
113 | Option_Set : in RTEMS.Option; |
---|
114 | Timeout : in RTEMS.Interval; |
---|
115 | Segment : out RTEMS.Address; |
---|
116 | Result : out RTEMS.Status_Codes) |
---|
117 | is |
---|
118 | function Get_Segment_Base |
---|
119 | (ID : RTEMS.ID; |
---|
120 | Size : RTEMS.Unsigned32; |
---|
121 | Option_Set : RTEMS.Option; |
---|
122 | Timeout : RTEMS.Interval; |
---|
123 | Segment : access RTEMS.Address) |
---|
124 | return RTEMS.Status_Codes; |
---|
125 | pragma Import (C, Get_Segment_Base, "rtems_region_get_segment"); |
---|
126 | Segment_Base : aliased RTEMS.Address; |
---|
127 | begin |
---|
128 | |
---|
129 | Result := |
---|
130 | Get_Segment_Base |
---|
131 | (ID, |
---|
132 | Size, |
---|
133 | Option_Set, |
---|
134 | Timeout, |
---|
135 | Segment_Base'Access); |
---|
136 | Segment := Segment_Base; |
---|
137 | |
---|
138 | end Get_Segment; |
---|
139 | |
---|
140 | procedure Get_Segment_Size |
---|
141 | (ID : in RTEMS.ID; |
---|
142 | Segment : in RTEMS.Address; |
---|
143 | Size : out RTEMS.Unsigned32; |
---|
144 | Result : out RTEMS.Status_Codes) |
---|
145 | is |
---|
146 | function Get_Segment_Size_Base |
---|
147 | (ID : RTEMS.ID; |
---|
148 | Segment : RTEMS.Address; |
---|
149 | Size : access RTEMS.Unsigned32) |
---|
150 | return RTEMS.Status_Codes; |
---|
151 | pragma Import |
---|
152 | (C, |
---|
153 | Get_Segment_Size_Base, |
---|
154 | "rtems_region_get_segment_size"); |
---|
155 | Size_Base : aliased RTEMS.Unsigned32; |
---|
156 | begin |
---|
157 | |
---|
158 | Result := Get_Segment_Size_Base (ID, Segment, Size_Base'Access); |
---|
159 | Size := Size_Base; |
---|
160 | |
---|
161 | end Get_Segment_Size; |
---|
162 | |
---|
163 | procedure Return_Segment |
---|
164 | (ID : in RTEMS.ID; |
---|
165 | Segment : in RTEMS.Address; |
---|
166 | Result : out RTEMS.Status_Codes) |
---|
167 | is |
---|
168 | function Return_Segment_Base |
---|
169 | (ID : RTEMS.ID; |
---|
170 | Segment : RTEMS.Address) |
---|
171 | return RTEMS.Status_Codes; |
---|
172 | pragma Import |
---|
173 | (C, |
---|
174 | Return_Segment_Base, |
---|
175 | "rtems_region_return_segment"); |
---|
176 | begin |
---|
177 | |
---|
178 | Result := Return_Segment_Base (ID, Segment); |
---|
179 | |
---|
180 | end Return_Segment; |
---|
181 | |
---|
182 | procedure Resize_Segment |
---|
183 | (ID : in RTEMS.ID; |
---|
184 | Segment : in RTEMS.Address; |
---|
185 | Size : in RTEMS.Unsigned32; |
---|
186 | Old_Size : out RTEMS.Unsigned32; |
---|
187 | Result : out RTEMS.Status_Codes) |
---|
188 | is |
---|
189 | function Resize_Segment_Base |
---|
190 | (ID : RTEMS.ID; |
---|
191 | Segment : RTEMS.Address; |
---|
192 | Size : RTEMS.Unsigned32; |
---|
193 | Old_Size : access RTEMS.Unsigned32) |
---|
194 | return RTEMS.Status_Codes; |
---|
195 | pragma Import |
---|
196 | (C, |
---|
197 | Resize_Segment_Base, |
---|
198 | "rtems_region_resize_segment"); |
---|
199 | Old_Size_Base : aliased RTEMS.Unsigned32; |
---|
200 | begin |
---|
201 | |
---|
202 | Result := |
---|
203 | Resize_Segment_Base (ID, Segment, Size, Old_Size_Base'Access); |
---|
204 | Old_Size := Old_Size_Base; |
---|
205 | |
---|
206 | end Resize_Segment; |
---|
207 | |
---|
208 | end RTEMS.Region; |
---|