1 | Region Manager |
---|
2 | ############## |
---|
3 | |
---|
4 | .. index:: regions |
---|
5 | |
---|
6 | Introduction |
---|
7 | ============ |
---|
8 | |
---|
9 | The region manager provides facilities to dynamically |
---|
10 | allocate memory in variable sized units. The directives |
---|
11 | provided by the region manager are: |
---|
12 | |
---|
13 | - ``rtems.region_create`` - Create a region |
---|
14 | |
---|
15 | - ``rtems.region_ident`` - Get ID of a region |
---|
16 | |
---|
17 | - ``rtems.region_delete`` - Delete a region |
---|
18 | |
---|
19 | - ``rtems.region_extend`` - Add memory to a region |
---|
20 | |
---|
21 | - ``rtems.region_get_segment`` - Get segment from a region |
---|
22 | |
---|
23 | - ``rtems.region_return_segment`` - Return segment to a region |
---|
24 | |
---|
25 | - ``rtems.region_get_segment_size`` - Obtain size of a segment |
---|
26 | |
---|
27 | - ``rtems.region_resize_segment`` - Change size of a segment |
---|
28 | |
---|
29 | Background |
---|
30 | ========== |
---|
31 | |
---|
32 | Region Manager Definitions |
---|
33 | -------------------------- |
---|
34 | .. index:: region, definition |
---|
35 | .. index:: segment, definition |
---|
36 | |
---|
37 | A region makes up a physically contiguous memory |
---|
38 | space with user-defined boundaries from which variable-sized |
---|
39 | segments are dynamically allocated and deallocated. A segment |
---|
40 | is a variable size section of memory which is allocated in |
---|
41 | multiples of a user-defined page size. This page size is |
---|
42 | required to be a multiple of four greater than or equal to four. |
---|
43 | For example, if a request for a 350-byte segment is made in a |
---|
44 | region with 256-byte pages, then a 512-byte segment is allocated. |
---|
45 | |
---|
46 | Regions are organized as doubly linked chains of |
---|
47 | variable sized memory blocks. Memory requests are allocated |
---|
48 | using a first-fit algorithm. If available, the requester |
---|
49 | receives the number of bytes requested (rounded up to the next |
---|
50 | page size). RTEMS requires some overhead from the regionâs |
---|
51 | memory for each segment that is allocated. Therefore, an |
---|
52 | application should only modify the memory of a segment that has |
---|
53 | been obtained from the region. The application should NOT |
---|
54 | modify the memory outside of any obtained segments and within |
---|
55 | the regionâs boundaries while the region is currently active in |
---|
56 | the system. |
---|
57 | |
---|
58 | Upon return to the region, the free block is |
---|
59 | coalesced with its neighbors (if free) on both sides to produce |
---|
60 | the largest possible unused block. |
---|
61 | |
---|
62 | Building an Attribute Set |
---|
63 | ------------------------- |
---|
64 | .. index:: region attribute set, building |
---|
65 | |
---|
66 | In general, an attribute set is built by a bitwise OR |
---|
67 | of the desired attribute components. The set of valid region |
---|
68 | attributes is provided in the following table: |
---|
69 | |
---|
70 | - ``RTEMS.FIFO`` - tasks wait by FIFO (default) |
---|
71 | |
---|
72 | - ``RTEMS.PRIORITY`` - tasks wait by priority |
---|
73 | |
---|
74 | Attribute values are specifically designed to be |
---|
75 | mutually exclusive, therefore bitwise OR and addition operations |
---|
76 | are equivalent as long as each attribute appears exactly once in |
---|
77 | the component list. An attribute listed as a default is not |
---|
78 | required to appear in the attribute list, although it is a good |
---|
79 | programming practice to specify default attributes. If all |
---|
80 | defaults are desired, the attribute``RTEMS.DEFAULT_ATTRIBUTES`` should be |
---|
81 | specified on this call. |
---|
82 | |
---|
83 | This example demonstrates the attribute_set parameter |
---|
84 | needed to create a region with the task priority waiting queue |
---|
85 | discipline. The attribute_set parameter to the``rtems.region_create`` |
---|
86 | directive should be ``RTEMS.PRIORITY``. |
---|
87 | |
---|
88 | Building an Option Set |
---|
89 | ---------------------- |
---|
90 | |
---|
91 | In general, an option is built by a bitwise OR of the |
---|
92 | desired option components. The set of valid options for the``rtems.region_get_segment`` directive are |
---|
93 | listed in the following table: |
---|
94 | |
---|
95 | - ``RTEMS.WAIT`` - task will wait for segment (default) |
---|
96 | |
---|
97 | - ``RTEMS.NO_WAIT`` - task should not wait |
---|
98 | |
---|
99 | Option values are specifically designed to be |
---|
100 | mutually exclusive, therefore bitwise OR and addition operations |
---|
101 | are equivalent as long as each option appears exactly once in |
---|
102 | the component list. An option listed as a default is not |
---|
103 | required to appear in the option list, although it is a good |
---|
104 | programming practice to specify default options. If all |
---|
105 | defaults are desired, the option``RTEMS.DEFAULT_OPTIONS`` should be |
---|
106 | specified on this call. |
---|
107 | |
---|
108 | This example demonstrates the option parameter needed |
---|
109 | to poll for a segment. The option parameter passed to the``rtems.region_get_segment`` directive should |
---|
110 | be ``RTEMS.NO_WAIT``. |
---|
111 | |
---|
112 | Operations |
---|
113 | ========== |
---|
114 | |
---|
115 | Creating a Region |
---|
116 | ----------------- |
---|
117 | |
---|
118 | The ``rtems.region_create`` directive creates a region with the |
---|
119 | user-defined name. The user may select FIFO or task priority as |
---|
120 | the method for placing waiting tasks in the task wait queue. |
---|
121 | RTEMS allocates a Region Control Block (RNCB) from the RNCB free |
---|
122 | list to maintain the newly created region. RTEMS also generates |
---|
123 | a unique region ID which is returned to the calling task. |
---|
124 | |
---|
125 | It is not possible to calculate the exact number of |
---|
126 | bytes available to the user since RTEMS requires overhead for |
---|
127 | each segment allocated. For example, a region with one segment |
---|
128 | that is the size of the entire region has more available bytes |
---|
129 | than a region with two segments that collectively are the size |
---|
130 | of the entire region. This is because the region with one |
---|
131 | segment requires only the overhead for one segment, while the |
---|
132 | other region requires the overhead for two segments. |
---|
133 | |
---|
134 | Due to automatic coalescing, the number of segments |
---|
135 | in the region dynamically changes. Therefore, the total |
---|
136 | overhead required by RTEMS dynamically changes. |
---|
137 | |
---|
138 | Obtaining Region IDs |
---|
139 | -------------------- |
---|
140 | |
---|
141 | When a region is created, RTEMS generates a unique |
---|
142 | region ID and assigns it to the created region until it is |
---|
143 | deleted. The region ID may be obtained by either of two |
---|
144 | methods. First, as the result of an invocation of the``rtems.region_create`` directive, |
---|
145 | the region ID is stored in a user |
---|
146 | provided location. Second, the region ID may be obtained later |
---|
147 | using the ``rtems.region_ident`` directive. |
---|
148 | The region ID is used by other region manager directives to |
---|
149 | access this region. |
---|
150 | |
---|
151 | Adding Memory to a Region |
---|
152 | ------------------------- |
---|
153 | |
---|
154 | The ``rtems.region_extend`` directive may be used to add memory |
---|
155 | to an existing region. The caller specifies the size in bytes |
---|
156 | and starting address of the memory being added. |
---|
157 | |
---|
158 | NOTE: Please see the release notes or RTEMS source |
---|
159 | code for information regarding restrictions on the location of |
---|
160 | the memory being added in relation to memory already in the |
---|
161 | region. |
---|
162 | |
---|
163 | Acquiring a Segment |
---|
164 | ------------------- |
---|
165 | |
---|
166 | The ``rtems.region_get_segment`` directive attempts to acquire |
---|
167 | a segment from a specified region. If the region has enough |
---|
168 | available free memory, then a segment is returned successfully |
---|
169 | to the caller. When the segment cannot be allocated, one of the |
---|
170 | following situations applies: |
---|
171 | |
---|
172 | - By default, the calling task will wait forever to acquire the segment. |
---|
173 | |
---|
174 | - Specifying the ``RTEMS.NO_WAIT`` option forces |
---|
175 | an immediate return with an error status code. |
---|
176 | |
---|
177 | - Specifying a timeout limits the interval the task will |
---|
178 | wait before returning with an error status code. |
---|
179 | |
---|
180 | If the task waits for the segment, then it is placed |
---|
181 | in the regionâs task wait queue in either FIFO or task priority |
---|
182 | order. All tasks waiting on a region are returned an error when |
---|
183 | the message queue is deleted. |
---|
184 | |
---|
185 | Releasing a Segment |
---|
186 | ------------------- |
---|
187 | |
---|
188 | When a segment is returned to a region by the``rtems.region_return_segment`` directive, it is merged with its |
---|
189 | unallocated neighbors to form the largest possible segment. The |
---|
190 | first task on the wait queue is examined to determine if its |
---|
191 | segment request can now be satisfied. If so, it is given a |
---|
192 | segment and unblocked. This process is repeated until the first |
---|
193 | taskâs segment request cannot be satisfied. |
---|
194 | |
---|
195 | Obtaining the Size of a Segment |
---|
196 | ------------------------------- |
---|
197 | |
---|
198 | The ``rtems.region_get_segment_size`` directive returns the |
---|
199 | size in bytes of the specified segment. The size returned |
---|
200 | includes any "extra" memory included in the segment because of |
---|
201 | rounding up to a page size boundary. |
---|
202 | |
---|
203 | Changing the Size of a Segment |
---|
204 | ------------------------------ |
---|
205 | |
---|
206 | The ``rtems.region_resize_segment`` directive is used |
---|
207 | to change the size in bytes of the specified segment. The size may be |
---|
208 | increased or decreased. When increasing the size of a segment, it is |
---|
209 | possible that the request cannot be satisfied. This directive provides |
---|
210 | functionality similar to the ``realloc()`` function in the Standard |
---|
211 | C Library. |
---|
212 | |
---|
213 | Deleting a Region |
---|
214 | ----------------- |
---|
215 | |
---|
216 | A region can be removed from the system and returned |
---|
217 | to RTEMS with the ``rtems.region_delete`` |
---|
218 | directive. When a region is |
---|
219 | deleted, its control block is returned to the RNCB free list. A |
---|
220 | region with segments still allocated is not allowed to be |
---|
221 | deleted. Any task attempting to do so will be returned an |
---|
222 | error. As a result of this directive, all tasks blocked waiting |
---|
223 | to obtain a segment from the region will be readied and returned |
---|
224 | a status code which indicates that the region was deleted. |
---|
225 | |
---|
226 | Directives |
---|
227 | ========== |
---|
228 | |
---|
229 | This section details the region managerâs directives. |
---|
230 | A subsection is dedicated to each of this managerâs directives |
---|
231 | and describes the calling sequence, related constants, usage, |
---|
232 | and status codes. |
---|
233 | |
---|
234 | REGION_CREATE - Create a region |
---|
235 | ------------------------------- |
---|
236 | .. index:: create a region |
---|
237 | |
---|
238 | **CALLING SEQUENCE:** |
---|
239 | |
---|
240 | .. code:: c |
---|
241 | |
---|
242 | procedure Region_Create ( |
---|
243 | Name : in RTEMS.Name; |
---|
244 | Starting_Address : in RTEMS.Address; |
---|
245 | Length : in RTEMS.Unsigned32; |
---|
246 | Page_Size : in RTEMS.Unsigned32; |
---|
247 | Attribute_Set : in RTEMS.Attribute; |
---|
248 | ID : out RTEMS.ID; |
---|
249 | Result : out RTEMS.Status_Codes |
---|
250 | ); |
---|
251 | |
---|
252 | **DIRECTIVE STATUS CODES:** |
---|
253 | |
---|
254 | ``RTEMS.SUCCESSFUL`` - region created successfully |
---|
255 | ``RTEMS.INVALID_NAME`` - invalid region name |
---|
256 | ``RTEMS.INVALID_ADDRESS`` - ``id`` is NULL |
---|
257 | ``RTEMS.INVALID_ADDRESS`` - ``starting_address`` is NULL |
---|
258 | ``RTEMS.INVALID_ADDRESS`` - address not on four byte boundary |
---|
259 | ``RTEMS.TOO_MANY`` - too many regions created |
---|
260 | ``RTEMS.INVALID_SIZE`` - invalid page size |
---|
261 | |
---|
262 | **DESCRIPTION:** |
---|
263 | |
---|
264 | This directive creates a region from a physically |
---|
265 | contiguous memory space which starts at starting_address and is |
---|
266 | length bytes long. Segments allocated from the region will be a |
---|
267 | multiple of page_size bytes in length. The assigned region id |
---|
268 | is returned in id. This region id is used as an argument to |
---|
269 | other region related directives to access the region. |
---|
270 | |
---|
271 | For control and maintenance of the region, RTEMS |
---|
272 | allocates and initializes an RNCB from the RNCB free pool. Thus |
---|
273 | memory from the region is not used to store the RNCB. However, |
---|
274 | some overhead within the region is required by RTEMS each time a |
---|
275 | segment is constructed in the region. |
---|
276 | |
---|
277 | Specifying ``RTEMS.PRIORITY`` in attribute_set causes tasks |
---|
278 | waiting for a segment to be serviced according to task priority. |
---|
279 | Specifying ``RTEMS.FIFO`` in attribute_set or selecting``RTEMS.DEFAULT_ATTRIBUTES`` will cause waiting tasks to |
---|
280 | be serviced in First In-First Out order. |
---|
281 | |
---|
282 | The ``starting_address`` parameter must be aligned on a |
---|
283 | four byte boundary. The ``page_size`` parameter must be a multiple |
---|
284 | of four greater than or equal to eight. |
---|
285 | |
---|
286 | **NOTES:** |
---|
287 | |
---|
288 | This directive will not cause the calling task to be |
---|
289 | preempted. |
---|
290 | |
---|
291 | The following region attribute constants are defined |
---|
292 | by RTEMS: |
---|
293 | |
---|
294 | - ``RTEMS.FIFO`` - tasks wait by FIFO (default) |
---|
295 | |
---|
296 | - ``RTEMS.PRIORITY`` - tasks wait by priority |
---|
297 | |
---|
298 | REGION_IDENT - Get ID of a region |
---|
299 | --------------------------------- |
---|
300 | .. index:: get ID of a region |
---|
301 | .. index:: obtain ID of a region |
---|
302 | |
---|
303 | **CALLING SEQUENCE:** |
---|
304 | |
---|
305 | .. code:: c |
---|
306 | |
---|
307 | procedure Region_Ident ( |
---|
308 | Name : in RTEMS.Name; |
---|
309 | ID : out RTEMS.ID; |
---|
310 | Result : out RTEMS.Status_Codes |
---|
311 | ); |
---|
312 | |
---|
313 | **DIRECTIVE STATUS CODES:** |
---|
314 | |
---|
315 | ``RTEMS.SUCCESSFUL`` - region identified successfully |
---|
316 | ``RTEMS.INVALID_ADDRESS`` - ``id`` is NULL |
---|
317 | ``RTEMS.INVALID_NAME`` - region name not found |
---|
318 | |
---|
319 | **DESCRIPTION:** |
---|
320 | |
---|
321 | This directive obtains the region id associated with |
---|
322 | the region name to be acquired. If the region name is not |
---|
323 | unique, then the region id will match one of the regions with |
---|
324 | that name. However, this region id is not guaranteed to |
---|
325 | correspond to the desired region. The region id is used to |
---|
326 | access this region in other region manager directives. |
---|
327 | |
---|
328 | **NOTES:** |
---|
329 | |
---|
330 | This directive will not cause the running task to be preempted. |
---|
331 | |
---|
332 | REGION_DELETE - Delete a region |
---|
333 | ------------------------------- |
---|
334 | .. index:: delete a region |
---|
335 | |
---|
336 | **CALLING SEQUENCE:** |
---|
337 | |
---|
338 | .. code:: c |
---|
339 | |
---|
340 | procedure Region_Delete ( |
---|
341 | ID : in RTEMS.ID; |
---|
342 | Result : out RTEMS.Status_Codes |
---|
343 | ); |
---|
344 | |
---|
345 | **DIRECTIVE STATUS CODES:** |
---|
346 | |
---|
347 | ``RTEMS.SUCCESSFUL`` - region deleted successfully |
---|
348 | ``RTEMS.INVALID_ID`` - invalid region id |
---|
349 | ``RTEMS.RESOURCE_IN_USE`` - segments still in use |
---|
350 | |
---|
351 | **DESCRIPTION:** |
---|
352 | |
---|
353 | This directive deletes the region specified by id. |
---|
354 | The region cannot be deleted if any of its segments are still |
---|
355 | allocated. The RNCB for the deleted region is reclaimed by |
---|
356 | RTEMS. |
---|
357 | |
---|
358 | **NOTES:** |
---|
359 | |
---|
360 | This directive will not cause the calling task to be preempted. |
---|
361 | |
---|
362 | The calling task does not have to be the task that |
---|
363 | created the region. Any local task that knows the region id can |
---|
364 | delete the region. |
---|
365 | |
---|
366 | REGION_EXTEND - Add memory to a region |
---|
367 | -------------------------------------- |
---|
368 | .. index:: add memory to a region |
---|
369 | .. index:: region, add memory |
---|
370 | |
---|
371 | **CALLING SEQUENCE:** |
---|
372 | |
---|
373 | .. code:: c |
---|
374 | |
---|
375 | procedure Region_Extend ( |
---|
376 | ID : in RTEMS.ID; |
---|
377 | Starting_Address : in RTEMS.Address; |
---|
378 | Length : in RTEMS.Unsigned32; |
---|
379 | Result : out RTEMS.Status_Codes |
---|
380 | ); |
---|
381 | |
---|
382 | **DIRECTIVE STATUS CODES:** |
---|
383 | |
---|
384 | ``RTEMS.SUCCESSFUL`` - region extended successfully |
---|
385 | ``RTEMS.INVALID_ADDRESS`` - ``starting_address`` is NULL |
---|
386 | ``RTEMS.INVALID_ID`` - invalid region id |
---|
387 | ``RTEMS.INVALID_ADDRESS`` - invalid address of area to add |
---|
388 | |
---|
389 | **DESCRIPTION:** |
---|
390 | |
---|
391 | This directive adds the memory which starts at |
---|
392 | starting_address for length bytes to the region specified by id. |
---|
393 | |
---|
394 | **NOTES:** |
---|
395 | |
---|
396 | This directive will not cause the calling task to be preempted. |
---|
397 | |
---|
398 | The calling task does not have to be the task that |
---|
399 | created the region. Any local task that knows the region id can |
---|
400 | extend the region. |
---|
401 | |
---|
402 | REGION_GET_SEGMENT - Get segment from a region |
---|
403 | ---------------------------------------------- |
---|
404 | .. index:: get segment from region |
---|
405 | |
---|
406 | **CALLING SEQUENCE:** |
---|
407 | |
---|
408 | .. code:: c |
---|
409 | |
---|
410 | procedure Region_Get_Segment ( |
---|
411 | ID : in RTEMS.ID; |
---|
412 | Size : in RTEMS.Unsigned32; |
---|
413 | Option_Set : in RTEMS.Option; |
---|
414 | Timeout : in RTEMS.Interval; |
---|
415 | Segment : out RTEMS.Address; |
---|
416 | Result : out RTEMS.Status_Codes |
---|
417 | ); |
---|
418 | |
---|
419 | **DIRECTIVE STATUS CODES:** |
---|
420 | |
---|
421 | ``RTEMS.SUCCESSFUL`` - segment obtained successfully |
---|
422 | ``RTEMS.INVALID_ADDRESS`` - ``segment`` is NULL |
---|
423 | ``RTEMS.INVALID_ID`` - invalid region id |
---|
424 | ``RTEMS.INVALID_SIZE`` - request is for zero bytes or exceeds |
---|
425 | the size of maximum segment which is possible for this region |
---|
426 | ``RTEMS.UNSATISFIED`` - segment of requested size not available |
---|
427 | ``RTEMS.TIMEOUT`` - timed out waiting for segment |
---|
428 | ``RTEMS.OBJECT_WAS_DELETED`` - region deleted while waiting |
---|
429 | |
---|
430 | **DESCRIPTION:** |
---|
431 | |
---|
432 | This directive obtains a variable size segment from |
---|
433 | the region specified by id. The address of the allocated |
---|
434 | segment is returned in segment. The ``RTEMS.WAIT`` |
---|
435 | and ``RTEMS.NO_WAIT`` components |
---|
436 | of the options parameter are used to specify whether the calling |
---|
437 | tasks wish to wait for a segment to become available or return |
---|
438 | immediately if no segment is available. For either option, if a |
---|
439 | sufficiently sized segment is available, then the segment is |
---|
440 | successfully acquired by returning immediately with the``RTEMS.SUCCESSFUL`` status code. |
---|
441 | |
---|
442 | If the calling task chooses to return immediately and |
---|
443 | a segment large enough is not available, then an error code |
---|
444 | indicating this fact is returned. If the calling task chooses |
---|
445 | to wait for the segment and a segment large enough is not |
---|
446 | available, then the calling task is placed on the regionâs |
---|
447 | segment wait queue and blocked. If the region was created with |
---|
448 | the ``RTEMS.PRIORITY`` option, then the calling |
---|
449 | task is inserted into the |
---|
450 | wait queue according to its priority. However, if the region |
---|
451 | was created with the ``RTEMS.FIFO`` option, then the calling |
---|
452 | task is placed at the rear of the wait queue. |
---|
453 | |
---|
454 | The timeout parameter specifies the maximum interval |
---|
455 | that a task is willing to wait to obtain a segment. If timeout |
---|
456 | is set to ``RTEMS.NO_TIMEOUT``, then the |
---|
457 | calling task will wait forever. |
---|
458 | |
---|
459 | **NOTES:** |
---|
460 | |
---|
461 | The actual length of the allocated segment may be |
---|
462 | larger than the requested size because a segment size is always |
---|
463 | a multiple of the regionâs page size. |
---|
464 | |
---|
465 | The following segment acquisition option constants |
---|
466 | are defined by RTEMS: |
---|
467 | |
---|
468 | - ``RTEMS.WAIT`` - task will wait for segment (default) |
---|
469 | |
---|
470 | - ``RTEMS.NO_WAIT`` - task should not wait |
---|
471 | |
---|
472 | A clock tick is required to support the timeout functionality of |
---|
473 | this directive. |
---|
474 | |
---|
475 | REGION_RETURN_SEGMENT - Return segment to a region |
---|
476 | -------------------------------------------------- |
---|
477 | .. index:: return segment to region |
---|
478 | |
---|
479 | **CALLING SEQUENCE:** |
---|
480 | |
---|
481 | .. code:: c |
---|
482 | |
---|
483 | procedure Region_Return_Segment ( |
---|
484 | ID : in RTEMS.ID; |
---|
485 | Segment : in RTEMS.Address; |
---|
486 | Result : out RTEMS.Status_Codes |
---|
487 | ); |
---|
488 | |
---|
489 | **DIRECTIVE STATUS CODES:** |
---|
490 | |
---|
491 | ``RTEMS.SUCCESSFUL`` - segment returned successfully |
---|
492 | ``RTEMS.INVALID_ADDRESS`` - ``segment`` is NULL |
---|
493 | ``RTEMS.INVALID_ID`` - invalid region id |
---|
494 | ``RTEMS.INVALID_ADDRESS`` - segment address not in region |
---|
495 | |
---|
496 | **DESCRIPTION:** |
---|
497 | |
---|
498 | This directive returns the segment specified by |
---|
499 | segment to the region specified by id. The returned segment is |
---|
500 | merged with its neighbors to form the largest possible segment. |
---|
501 | The first task on the wait queue is examined to determine if its |
---|
502 | segment request can now be satisfied. If so, it is given a |
---|
503 | segment and unblocked. This process is repeated until the first |
---|
504 | taskâs segment request cannot be satisfied. |
---|
505 | |
---|
506 | **NOTES:** |
---|
507 | |
---|
508 | This directive will cause the calling task to be |
---|
509 | preempted if one or more local tasks are waiting for a segment |
---|
510 | and the following conditions exist: |
---|
511 | |
---|
512 | - a waiting task has a higher priority than the calling task |
---|
513 | |
---|
514 | - the size of the segment required by the waiting task |
---|
515 | is less than or equal to the size of the segment returned. |
---|
516 | |
---|
517 | REGION_GET_SEGMENT_SIZE - Obtain size of a segment |
---|
518 | -------------------------------------------------- |
---|
519 | .. index:: get size of segment |
---|
520 | |
---|
521 | **CALLING SEQUENCE:** |
---|
522 | |
---|
523 | .. code:: c |
---|
524 | |
---|
525 | procedure Region_Get_Segment_Size ( |
---|
526 | ID : in RTEMS.ID; |
---|
527 | Segment : in RTEMS.Address; |
---|
528 | Size : out RTEMS.Unsigned32; |
---|
529 | Result : out RTEMS.Status_Codes |
---|
530 | ); |
---|
531 | |
---|
532 | **DIRECTIVE STATUS CODES:** |
---|
533 | |
---|
534 | ``RTEMS.SUCCESSFUL`` - segment obtained successfully |
---|
535 | ``RTEMS.INVALID_ADDRESS`` - ``segment`` is NULL |
---|
536 | ``RTEMS.INVALID_ADDRESS`` - ``size`` is NULL |
---|
537 | ``RTEMS.INVALID_ID`` - invalid region id |
---|
538 | ``RTEMS.INVALID_ADDRESS`` - segment address not in region |
---|
539 | |
---|
540 | **DESCRIPTION:** |
---|
541 | |
---|
542 | This directive obtains the size in bytes of the specified segment. |
---|
543 | |
---|
544 | **NOTES:** |
---|
545 | |
---|
546 | The actual length of the allocated segment may be |
---|
547 | larger than the requested size because a segment size is always |
---|
548 | a multiple of the regionâs page size. |
---|
549 | |
---|
550 | REGION_RESIZE_SEGMENT - Change size of a segment |
---|
551 | ------------------------------------------------ |
---|
552 | .. index:: resize segment |
---|
553 | |
---|
554 | **CALLING SEQUENCE:** |
---|
555 | |
---|
556 | .. code:: c |
---|
557 | |
---|
558 | procedure Region_Resize_Segment ( |
---|
559 | ID : in RTEMS.ID; |
---|
560 | Segment : in RTEMS.Address; |
---|
561 | Size : in RTEMS.Unsigned32; |
---|
562 | Old_Size : out RTEMS.Unsigned32; |
---|
563 | Result : out RTEMS.Status_Codes |
---|
564 | ); |
---|
565 | |
---|
566 | **DIRECTIVE STATUS CODES:** |
---|
567 | |
---|
568 | ``RTEMS.SUCCESSFUL`` - segment obtained successfully |
---|
569 | ``RTEMS.INVALID_ADDRESS`` - ``segment`` is NULL |
---|
570 | ``RTEMS.INVALID_ADDRESS`` - ``old_size`` is NULL |
---|
571 | ``RTEMS.INVALID_ID`` - invalid region id |
---|
572 | ``RTEMS.INVALID_ADDRESS`` - segment address not in region``RTEMS.UNSATISFIED`` - unable to make segment larger |
---|
573 | |
---|
574 | **DESCRIPTION:** |
---|
575 | |
---|
576 | This directive is used to increase or decrease the size of |
---|
577 | a segment. When increasing the size of a segment, it |
---|
578 | is possible that there is not memory available contiguous |
---|
579 | to the segment. In this case, the request is unsatisfied. |
---|
580 | |
---|
581 | **NOTES:** |
---|
582 | |
---|
583 | If an attempt to increase the size of a segment fails, then |
---|
584 | the application may want to allocate a new segment of the desired |
---|
585 | size, copy the contents of the original segment to the new, larger |
---|
586 | segment and then return the original segment. |
---|
587 | |
---|
588 | .. COMMENT: COPYRIGHT (c) 1988-2002. |
---|
589 | |
---|
590 | .. COMMENT: On-Line Applications Research Corporation (OAR). |
---|
591 | |
---|
592 | .. COMMENT: All rights reserved. |
---|
593 | |
---|