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