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

4.104.114.84.95
Last change on this file since 4ca27cf was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

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