source: rtems/c/src/exec/rtems/headers/part.h @ eb5a7e07

4.104.114.84.95
Last change on this file since eb5a7e07 was 5e9b32b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/26/95 at 19:27:15

posix support initially added

  • Property mode set to 100644
File size: 7.0 KB
Line 
1/*  partition.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with the Partition Manager.  This manager provides facilities to
5 *  dynamically allocate memory in fixed-sized units which are returned
6 *  as buffers.
7 *
8 *  Directives provided are:
9 *
10 *     + create a partition
11 *     + get an ID of a partition
12 *     + delete a partition
13 *     + get a buffer from a partition
14 *     + return a buffer to a partition
15 *
16 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
17 *  On-Line Applications Research Corporation (OAR).
18 *  All rights assigned to U.S. Government, 1994.
19 *
20 *  This material may be reproduced by or for the U.S. Government pursuant
21 *  to the copyright license under the clause at DFARS 252.227-7013.  This
22 *  notice must appear in all copies of this file and its derivatives.
23 *
24 *  $Id$
25 */
26
27#ifndef __RTEMS_PARTITION_h
28#define __RTEMS_PARTITION_h
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include <rtems/score/address.h>
35#include <rtems/score/object.h>
36#include <rtems/rtems/attr.h>
37#include <rtems/rtems/types.h>
38
39/*
40 *  The following defines the control block used to manage each partition.
41 */
42
43typedef struct {
44  Objects_Control     Object;
45  void               *starting_address;      /* physical address */
46  unsigned32          length;                /* in bytes */
47  unsigned32          buffer_size;           /* in bytes */
48  rtems_attribute  attribute_set;         /* attributes */
49  unsigned32          number_of_used_blocks; /* or allocated buffers */
50  Chain_Control       Memory;                /* buffer chain */
51}   Partition_Control;
52
53/*
54 *  The following defines the information control block used to
55 *  manage this class of objects.
56 */
57
58EXTERN Objects_Information _Partition_Information;
59
60/*
61 *  _Partition_Manager_initialization
62 *
63 *  DESCRIPTION:
64 *
65 *  This routine performs the initialization necessary for this manager.
66 */
67
68void _Partition_Manager_initialization(
69  unsigned32 maximum_partitions
70);
71
72/*
73 *  rtems_partition_create
74 *
75 *  DESCRIPTION:
76 *
77 *  This routine implements the rtems_partition_create directive.  The
78 *  partition will have the name name.  The memory area managed by
79 *  the partition is of length bytes and starts at starting_address.
80 *  The memory area will be divided into as many buffers of
81 *  buffer_size bytes as possible.   The attribute_set determines if
82 *  the partition is global or local.  It returns the id of the
83 *  created partition in ID.
84 */
85
86rtems_status_code rtems_partition_create(
87  rtems_name          name,
88  void               *starting_address,
89  unsigned32          length,
90  unsigned32          buffer_size,
91  rtems_attribute  attribute_set,
92  Objects_Id         *id
93);
94
95/*
96 *  rtems_partition_ident
97 *
98 *  DESCRIPTION:
99 *
100 *  This routine implements the rtems_partition_ident directive.
101 *  This directive returns the partition ID associated with name.
102 *  If more than one partition is named name, then the partition
103 *  to which the ID belongs is arbitrary.  node indicates the
104 *  extent of the search for the ID of the partition named name.
105 *  The search can be limited to a particular node or allowed to
106 *  encompass all nodes.
107 */
108
109rtems_status_code rtems_partition_ident(
110  rtems_name    name,
111  unsigned32    node,
112  Objects_Id   *id
113);
114
115/*
116 *  rtems_partition_delete
117 *
118 *  DESCRIPTION:
119 *
120 *  This routine implements the rtems_partition_delete directive.  The
121 *  partition indicated by ID is deleted.
122 */
123
124rtems_status_code rtems_partition_delete(
125  Objects_Id id
126);
127
128/*
129 *  rtems_partition_get_buffer
130 *
131 *  DESCRIPTION:
132 *
133 *  This routine implements the rtems_partition_get_buffer directive.  It
134 *  attempts to allocate a buffer from the partition associated with ID.
135 *  If a buffer is allocated, its address is returned in buffer.
136 */
137
138rtems_status_code rtems_partition_get_buffer(
139  Objects_Id  id,
140  void       **buffer
141);
142
143/*
144 *  rtems_partition_return_buffer
145 *
146 *  DESCRIPTION:
147 *
148 *  This routine implements the rtems_partition_return_buffer directive.  It
149 *  frees the buffer to the partition associated with ID.  The buffer must
150 *  have been previously allocated from the same partition.
151 */
152
153rtems_status_code rtems_partition_return_buffer(
154  Objects_Id  id,
155  void       *buffer
156);
157
158/*
159 *  _Partition_Allocate_buffer
160 *
161 *  DESCRIPTION:
162 *
163 *  This function attempts to allocate a buffer from the_partition.
164 *  If successful, it returns the address of the allocated buffer.
165 *  Otherwise, it returns NULL.
166 */
167
168STATIC INLINE void *_Partition_Allocate_buffer (
169   Partition_Control *the_partition
170);
171
172/*
173 *  _Partition_Free_buffer
174 *
175 *  DESCRIPTION:
176 *
177 *  This routine frees the_buffer to the_partition.
178 */
179
180STATIC INLINE void _Partition_Free_buffer (
181  Partition_Control *the_partition,
182  Chain_Node        *the_buffer
183);
184
185/*
186 *  _Partition_Is_buffer_on_boundary
187 *
188 *  DESCRIPTION:
189 *
190 *  This function returns TRUE if the_buffer is on a valid buffer
191 *  boundary for the_partition, and FALSE otherwise.
192 */
193
194STATIC INLINE boolean _Partition_Is_buffer_on_boundary (
195  void              *the_buffer,
196  Partition_Control *the_partition
197);
198
199/*
200 *  _Partition_Is_buffer_valid
201 *
202 *  DESCRIPTION:
203 *
204 *  This function returns TRUE if the_buffer is a valid buffer from
205 *  the_partition, otherwise FALSE is returned.
206 */
207
208STATIC INLINE boolean _Partition_Is_buffer_valid (
209  Chain_Node        *the_buffer,
210  Partition_Control *the_partition
211);
212
213/*
214 *  _Partition_Is_buffer_size_aligned
215 *
216 *  DESCRIPTION:
217 *
218 *  This function returns TRUE if the use of the specified buffer_size
219 *  will result in the allocation of buffers whose first byte is
220 *  properly aligned, and FALSE otherwise.
221 */
222
223STATIC INLINE boolean _Partition_Is_buffer_size_aligned (
224  unsigned32 buffer_size
225);
226
227/*
228 *  _Partition_Allocate
229 *
230 *  DESCRIPTION:
231 *
232 *  This function allocates a partition control block from
233 *  the inactive chain of free partition control blocks.
234 */
235
236STATIC INLINE Partition_Control *_Partition_Allocate ( void );
237
238/*
239 *  _Partition_Free
240 *
241 *  DESCRIPTION:
242 *
243 *  This routine frees a partition control block to the
244 *  inactive chain of free partition control blocks.
245 */
246
247STATIC INLINE void _Partition_Free (
248  Partition_Control *the_partition
249);
250
251/*
252 *  _Partition_Get
253 *
254 *  DESCRIPTION:
255 *
256 *  This function maps partition IDs to partition control blocks.
257 *  If ID corresponds to a local partition, then it returns
258 *  the_partition control pointer which maps to ID and location
259 *  is set to OBJECTS_LOCAL.  If the partition ID is global and
260 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
261 *  and the_partition is undefined.  Otherwise, location is set
262 *  to OBJECTS_ERROR and the_partition is undefined.
263 */
264
265STATIC INLINE Partition_Control *_Partition_Get (
266  Objects_Id         id,
267  Objects_Locations *location
268);
269
270/*
271 *  _Partition_Is_null
272 *
273 *  DESCRIPTION:
274 *
275 *  This function returns TRUE if the_partition is NULL
276 *  and FALSE otherwise.
277 */
278
279STATIC INLINE boolean _Partition_Is_null (
280  Partition_Control *the_partition
281);
282
283#include <rtems/rtems/part.inl>
284#include <rtems/rtems/partmp.h>
285
286#ifdef __cplusplus
287}
288#endif
289
290#endif
291/* end of include file */
Note: See TracBrowser for help on using the repository browser.