source: rtems/cpukit/include/rtems/rtems/region.h @ 0b9e307

Last change on this file since 0b9e307 was 96559b3, checked in by Sebastian Huber <sebastian.huber@…>, on 06/04/20 at 14:54:36

rtems: Include missing header file

  • Property mode set to 100644
File size: 8.7 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicRegion
5 *
6 * @brief Classic Region Manager API
7 */
8
9/* COPYRIGHT (c) 1989-2013.
10 * On-Line Applications Research Corporation (OAR).
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.org/license/LICENSE.
15 */
16
17#ifndef _RTEMS_RTEMS_REGION_H
18#define _RTEMS_RTEMS_REGION_H
19
20#include <rtems/rtems/attr.h>
21#include <rtems/rtems/options.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/types.h>
24#include <rtems/score/heapinfo.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 *  @defgroup ClassicRegion Regions
32 *
33 *  @ingroup RTEMSAPIClassic
34 *
35 *  This encapsulates functionality related to the Classic API Region
36 *  Manager.
37 */
38/**@{*/
39
40/**
41 *  @brief rtems_region_create
42 *
43 *  Region Manager
44 *
45 *  This routine implements the rtems_region_create directive.  The
46 *  region will have the name name.  The memory area managed by
47 *  the region is of length bytes and starts at starting_address.
48 *  The memory area will be divided into as many allocatable units of
49 *  page_size bytes as possible.   The attribute_set determines which
50 *  thread queue discipline is used by the region.  It returns the
51 *  id of the created region in ID.
52 */
53rtems_status_code rtems_region_create(
54  rtems_name          name,
55  void               *starting_address,
56  uintptr_t           length,
57  uintptr_t           page_size,
58  rtems_attribute     attribute_set,
59  rtems_id           *id
60);
61
62/**
63 * @brief RTEMS Extend Region
64 *
65 * This routine implements the rtems_region_extend directive. The
66 * region will have the name name. The memory area managed by
67 * the region will be attempted to be grown by length bytes using
68 * the memory starting at starting_address.
69 *
70 * @param[in] id is the id of region to grow
71 * @param[in] starting_address starting address of memory area for extension
72 * @param[in] length is the physical length in bytes to grow the region
73 *
74 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
75 *         error. Otherwise, a status code is returned indicating the
76 *         source of the error.
77 */
78rtems_status_code rtems_region_extend(
79  rtems_id            id,
80  void               *starting_address,
81  uintptr_t           length
82);
83
84/**
85 * @brief RTEMS Region Name to Id
86 *
87 * This routine implements the rtems_region_ident directive.
88 * This directive returns the region ID associated with name.
89 * If more than one region is named name, then the region
90 * to which the ID belongs is arbitrary.
91 *
92 * @param[in] name is the user defined region name
93 * @param[in] id is the pointer to region id
94 *
95 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
96 *         error. Otherwise, a status code is returned indicating the
97 *         source of the error. If successful, the id will
98 *         be filled in with the region id.
99 */
100rtems_status_code rtems_region_ident(
101  rtems_name    name,
102  rtems_id     *id
103);
104
105/**
106 * @brief RTEMS Get Region Information
107 *
108 * This routine implements the rtems_region_get_information directive.
109 * This directive returns information about the heap associated with
110 * this region.
111 *
112 * @param[in] id is the region id
113 * @param[in] the_info is the pointer to region information block
114 *
115 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful and
116 * *id filled with the region information block
117 */
118rtems_status_code rtems_region_get_information(
119  rtems_id                id,
120  Heap_Information_block *the_info
121);
122
123/**
124 * @brief RTEMS Get Region Free Information
125 *
126 * This routine implements the rtems_region_get_free_information directive.
127 * This directive returns information about the free blocks in the
128 * heap associated with this region. Information about the used blocks
129 * will be returned as zero.
130 *
131 * @param[in] id is the region id
132 * @param[in] the_info is the pointer to region information block
133 *
134 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
135 *         error. Otherwise, a status code is returned indicating the
136 *         source of the error. If successful, the the_info will
137 *         be filled in with the region information block.
138 */
139rtems_status_code rtems_region_get_free_information(
140  rtems_id                id,
141  Heap_Information_block *the_info
142);
143
144/**
145 * @brief RTEMS Delete Region
146 *
147 * This routine implements the rtems_region_delete directive. The
148 * region indicated by ID is deleted, provided that none of its segments are
149 * still allocated.
150 *
151 * @param[in] id is the region id
152 *
153 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
154 *         error. Otherwise, a status code is returned indicating the
155 *         source of the error.
156 */
157rtems_status_code rtems_region_delete(
158  rtems_id   id
159);
160
161/**
162 * @brief RTEMS Get Region Segment
163 *
164 * This routine implements the rtems_region_get_segment directive. It
165 * attempts to allocate a segment from the region associated with @a id.
166 * If a segment of the requested @a size size can be allocated, its address
167 * is returned in @a segment. If no segment is available, then the task
168 * may return immediately or block waiting for a segment with an optional
169 * timeout of @a timeout clock ticks. Whether the task blocks or returns
170 * immediately is based on the no_wait option in the @a option_set.
171 *
172 * @param[in] id is the region id
173 * @param[in] size is the segment size in bytes
174 * @param[in] option_set is the wait option
175 * @param[in] timeout is the number of ticks to wait (0 means wait forever)
176 * @param[in] segment is the pointer to segment address
177 *
178 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
179 *         error. Otherwise, a status code is returned indicating the
180 *         source of the error. If successful, the segment will
181 *         be filled in with the segment address.
182 */
183rtems_status_code rtems_region_get_segment(
184  rtems_id           id,
185  uintptr_t          size,
186  rtems_option       option_set,
187  rtems_interval     timeout,
188  void             **segment
189);
190
191/**
192 * @brief RTEMS Get Region Segment Size
193 *
194 * This routine implements the rtems_region_get_segment_size directive. It
195 * returns the size in bytes of the specified user memory area.
196 *
197 * @param[in] id is the region id
198 * @param[in] segment is the segment address
199 * @param[in] size is the pointer to segment size in bytes
200 *
201 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
202 *         error. Otherwise, a status code is returned indicating the
203 *         source of the error. If successful, the size will
204 *         be filled in with the segment size in bytes.
205 */
206rtems_status_code rtems_region_get_segment_size(
207  rtems_id           id,
208  void              *segment,
209  uintptr_t         *size
210);
211
212/**
213 * @brief RTEMS Return Region Segment
214 *
215 * This routine implements the rtems_region_return_segment directive. It
216 * frees the segment to the region associated with ID. The segment must
217 * have been previously allocated from the same region. If freeing the
218 * segment results in enough memory being available to satisfy the
219 * rtems_region_get_segment of the first blocked task, then that task and as
220 * many subsequent tasks as possible will be unblocked with their requests
221 * satisfied.
222 *
223 * @param[in] id is the region id
224 * @param[in] segment is the pointer to segment address
225 *
226 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful
227 */
228rtems_status_code rtems_region_return_segment(
229  rtems_id    id,
230  void       *segment
231);
232
233/**
234 * @brief Resize RTEMS Region Segment
235 *
236 * This routine implements the rtems_region_resize_segment directive. It
237 * tries to resize segment in the region associated with 'id' to the new size
238 * 'size' in place. The first 'size' or old size bytes of the segment
239 * (whatever is less) are guaranteed to remain unmodified. The segment must
240 * have been previously allocated from the same region. If resizing the
241 * segment results in enough memory being available to satisfy the
242 * rtems_region_get_segment of the first blocked task, then that task and as
243 * many subsequent tasks as possible will be unblocked with their requests
244 * satisfied.
245 *
246 * @param[in] id is the region id
247 * @param[in] segment is the pointer to segment address
248 * @param[in] size is the new required size
249 * @retval RTEMS_SUCCESSFUL if operation successful, RTEMS_UNSATISFIED if the
250 *         the segment can't be resized in place or any other code at failure
251 *
252 * @note On RTEMS_SUCCESSFUL or RTEMS_UNSATISFIED exit it returns into the
253 *       'old_size' the old size in bytes of the user memory area of the
254 *       specified segment.
255 */
256rtems_status_code rtems_region_resize_segment(
257  rtems_id    id,
258  void       *segment,
259  uintptr_t   size,
260  uintptr_t  *old_size
261);
262
263/**@}*/
264
265#ifdef __cplusplus
266}
267#endif
268
269#endif
270/* end of include file */
Note: See TracBrowser for help on using the repository browser.