1 | /* region.inl |
---|
2 | * |
---|
3 | * This file contains the macro implementation of the inlined |
---|
4 | * routines from the Region Manager. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1997. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may in |
---|
11 | * the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __REGION_inl |
---|
18 | #define __REGION_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Region_Allocate |
---|
23 | * |
---|
24 | * DESCRIPTION: |
---|
25 | * |
---|
26 | * This function allocates a region control block from |
---|
27 | * the inactive chain of free region control blocks. |
---|
28 | */ |
---|
29 | |
---|
30 | RTEMS_INLINE_ROUTINE Region_Control *_Region_Allocate( void ) |
---|
31 | { |
---|
32 | return (Region_Control *) _Objects_Allocate( &_Region_Information ); |
---|
33 | } |
---|
34 | |
---|
35 | /*PAGE |
---|
36 | * |
---|
37 | * _Region_Free |
---|
38 | * |
---|
39 | * DESCRIPTION: |
---|
40 | * |
---|
41 | * This routine frees a region control block to the |
---|
42 | * inactive chain of free region control blocks. |
---|
43 | */ |
---|
44 | |
---|
45 | RTEMS_INLINE_ROUTINE void _Region_Free ( |
---|
46 | Region_Control *the_region |
---|
47 | ) |
---|
48 | { |
---|
49 | _Objects_Free( &_Region_Information, &the_region->Object ); |
---|
50 | } |
---|
51 | |
---|
52 | /*PAGE |
---|
53 | * |
---|
54 | * _Region_Get |
---|
55 | * |
---|
56 | * DESCRIPTION: |
---|
57 | * |
---|
58 | * This function maps region IDs to region control blocks. |
---|
59 | * If ID corresponds to a local region, then it returns |
---|
60 | * the_region control pointer which maps to ID and location |
---|
61 | * is set to OBJECTS_LOCAL. Otherwise, location is set |
---|
62 | * to OBJECTS_ERROR and the_region is undefined. |
---|
63 | */ |
---|
64 | |
---|
65 | RTEMS_INLINE_ROUTINE Region_Control *_Region_Get ( |
---|
66 | Objects_Id id, |
---|
67 | Objects_Locations *location |
---|
68 | ) |
---|
69 | { |
---|
70 | return (Region_Control *) |
---|
71 | _Objects_Get( &_Region_Information, id, location ); |
---|
72 | } |
---|
73 | |
---|
74 | /*PAGE |
---|
75 | * |
---|
76 | * _Region_Allocate_segment |
---|
77 | * |
---|
78 | * DESCRIPTION: |
---|
79 | * |
---|
80 | * This function attempts to allocate a segment from the_region. |
---|
81 | * If successful, it returns the address of the allocated segment. |
---|
82 | * Otherwise, it returns NULL. |
---|
83 | */ |
---|
84 | |
---|
85 | RTEMS_INLINE_ROUTINE void *_Region_Allocate_segment ( |
---|
86 | Region_Control *the_region, |
---|
87 | unsigned32 size |
---|
88 | ) |
---|
89 | { |
---|
90 | return _Heap_Allocate( &the_region->Memory, size ); |
---|
91 | } |
---|
92 | |
---|
93 | /*PAGE |
---|
94 | * |
---|
95 | * _Region_Free_segment |
---|
96 | * |
---|
97 | * DESCRIPTION: |
---|
98 | * |
---|
99 | * This function frees the_segment to the_region. |
---|
100 | */ |
---|
101 | |
---|
102 | RTEMS_INLINE_ROUTINE boolean _Region_Free_segment ( |
---|
103 | Region_Control *the_region, |
---|
104 | void *the_segment |
---|
105 | ) |
---|
106 | { |
---|
107 | return _Heap_Free( &the_region->Memory, the_segment ); |
---|
108 | } |
---|
109 | |
---|
110 | /*PAGE |
---|
111 | * |
---|
112 | * _Region_Is_null |
---|
113 | * |
---|
114 | * DESCRIPTION: |
---|
115 | * |
---|
116 | * This function returns TRUE if the_region is NULL and FALSE otherwise. |
---|
117 | */ |
---|
118 | |
---|
119 | RTEMS_INLINE_ROUTINE boolean _Region_Is_null ( |
---|
120 | Region_Control *the_region |
---|
121 | ) |
---|
122 | { |
---|
123 | return ( the_region == NULL ); |
---|
124 | } |
---|
125 | |
---|
126 | #endif |
---|
127 | /* end of include file */ |
---|