source: rtems/doc/user/part.t @ ed11cadf

4.104.114.84.95
Last change on this file since ed11cadf was ed11cadf, checked in by Joel Sherrill <joel.sherrill@…>, on 10/01/99 at 17:44:06

Numerous minor changes required to transition to the latest version
of texinfo and TeX. This version of the tools can produce PDF with
figures included.

  • Property mode set to 100644
File size: 12.9 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter Partition Manager
10
11@section Introduction
12
13The partition manager provides facilities to
14dynamically allocate memory in fixed-size units.  The directives
15provided by the partition manager are:
16
17@itemize @bullet
18@item @code{@value{DIRPREFIX}partition_create} - Create a partition
19@item @code{@value{DIRPREFIX}partition_ident} - Get ID of a partition
20@item @code{@value{DIRPREFIX}partition_delete} - Delete a partition
21@item @code{@value{DIRPREFIX}partition_get_buffer} - Get buffer from a partition
22@item @code{@value{DIRPREFIX}partition_return_buffer} - Return buffer to a partition
23@end itemize
24
25@section Background
26
27@subsection Partition Manager Definitions
28
29A partition is a physically contiguous memory area
30divided into fixed-size buffers that can be dynamically
31allocated and deallocated.
32
33Partitions are managed and maintained as a list of
34buffers.  Buffers are obtained from the front of the partition's
35free buffer chain and returned to the rear of the same chain.
36When a buffer is on the free buffer chain, RTEMS uses eight
37bytes of each buffer as the free buffer chain.  When a buffer is
38allocated, the entire buffer is available for application use.
39Therefore, modifying memory that is outside of an allocated
40buffer could destroy the free buffer chain or the contents of an
41adjacent allocated buffer.
42
43@subsection Building a Partition Attribute Set
44
45In general, an attribute set is built by a bitwise OR
46of the desired attribute components.  The set of valid partition
47attributes is provided in the following table:
48
49@itemize @bullet
50@item @code{@value{RPREFIX}LOCAL} - local task (default)
51@item @code{@value{RPREFIX}GLOBAL} - global task
52@end itemize
53
54
55Attribute values are specifically designed to be
56mutually exclusive, therefore bitwise OR and addition operations
57are equivalent as long as each attribute appears exactly once in
58the component list.  An attribute listed as a default is not
59required to appear in the attribute list, although it is a good
60programming practice to specify default attributes.  If all
61defaults are desired, the attribute
62@code{@value{RPREFIX}DEFAULT_ATTRIBUTES} should be
63specified on this call.  The attribute_set parameter should be
64@code{@value{RPREFIX}GLOBAL} to indicate that the partition
65is to be known globally.
66
67@section Operations
68
69@subsection Creating a Partition
70
71The @code{@value{DIRPREFIX}partition_create} directive creates a partition
72with a user-specified name.  The partition's name, starting
73address, length and buffer size are all specified to the
74@code{@value{DIRPREFIX}partition_create} directive. 
75RTEMS allocates a Partition Control
76Block (PTCB) from the PTCB free list.  This data structure is
77used by RTEMS to manage the newly created partition.  The number
78of buffers in the partition is calculated based upon the
79specified partition length and buffer size, and returned to the
80calling task along with a unique partition ID.
81
82@subsection Obtaining Partition IDs
83
84When a partition is created, RTEMS generates a unique
85partition ID and assigned it to the created partition until it
86is deleted.  The partition ID may be obtained by either of two
87methods.  First, as the result of an invocation of the
88@code{@value{DIRPREFIX}partition_create} directive, the partition
89ID is stored in a user provided location.  Second, the partition
90ID may be obtained later using the @code{@value{DIRPREFIX}partition_ident}
91directive.  The partition ID is used by other partition manager directives
92to access this partition.
93
94@subsection Acquiring a Buffer
95
96A buffer can be obtained by calling the
97@code{@value{DIRPREFIX}partition_get_buffer} directive. 
98If a buffer is available, then
99it is returned immediately with a successful return code.
100Otherwise, an unsuccessful return code is returned immediately
101to the caller.  Tasks cannot block to wait for a buffer to
102become available.
103
104@subsection Releasing a Buffer
105
106Buffers are returned to a partition's free buffer
107chain with the @code{@value{DIRPREFIX}partition_return_buffer} directive.  This
108directive returns an error status code if the returned buffer
109was not previously allocated from this partition.
110
111@subsection Deleting a Partition
112
113The @code{@value{DIRPREFIX}partition_delete} directive allows a partition to
114be removed and returned to RTEMS.  When a partition is deleted,
115the PTCB for that partition is returned to the PTCB free list.
116A partition with buffers still allocated cannot be deleted.  Any
117task attempting to do so will be returned an error status code.
118
119@section Directives
120
121This section details the partition manager's
122directives.  A subsection is dedicated to each of this manager's
123directives and describes the calling sequence, related
124constants, usage, and status codes.
125
126@page
127@subsection PARTITION_CREATE - Create a partition
128
129@subheading CALLING SEQUENCE:
130
131@ifset is-C
132@c @findex rtems_partition_create
133@example
134rtems_status_code rtems_partition_create(
135  rtems_name        name,
136  void             *starting_address,
137  rtems_unsigned32  length,
138  rtems_unsigned32  buffer_size,
139  rtems_attribute   attribute_set,
140  rtems_id         *id
141);
142@end example
143@end ifset
144
145@ifset is-Ada
146@example
147procedure Partition_Create (
148   Name             : in     RTEMS.Name;
149   Starting_Address : in     RTEMS.Address;
150   Length           : in     RTEMS.Unsigned32;
151   Buffer_Size      : in     RTEMS.Unsigned32;
152   Attribute_Set    : in     RTEMS.Attribute;
153   ID               :    out RTEMS.ID;
154   Result           :    out RTEMS.Status_Codes
155);
156@end example
157@end ifset
158
159@subheading DIRECTIVE STATUS CODES:
160@code{@value{RPREFIX}SUCCESSFUL} - partition created successfully@*
161@code{@value{RPREFIX}INVALID_NAME} - invalid task name@*
162@code{@value{RPREFIX}TOO_MANY} - too many partitions created@*
163@code{@value{RPREFIX}INVALID_ADDRESS} - address not on four byte boundary@*
164@code{@value{RPREFIX}INVALID_SIZE} - length or buffer size is 0@*
165@code{@value{RPREFIX}INVALID_SIZE} - length is less than the buffer size@*
166@code{@value{RPREFIX}INVALID_SIZE} - buffer size not a multiple of 4@*
167@code{@value{RPREFIX}MP_NOT_CONFIGURED} - multiprocessing not configured@*
168@code{@value{RPREFIX}TOO_MANY} - too many global objects
169
170@subheading DESCRIPTION:
171
172This directive creates a partition of fixed size
173buffers from a physically contiguous memory space which starts
174at starting_address and is length bytes in size.  Each allocated
175buffer is to be of buffer_length in bytes.  The assigned
176partition id is returned in id.  This partition id is used to
177access the partition with other partition related directives.
178For control and maintenance of the partition, RTEMS allocates a
179PTCB from the local PTCB free pool and initializes it.
180
181@subheading NOTES:
182
183This directive will not cause the calling task to be
184preempted.
185
186The starting_address and buffer_size parameters must
187be multiples of four.
188
189Memory from the partition is not used by RTEMS to
190store the Partition Control Block.
191
192The following partition attribute constants are
193defined by RTEMS:
194
195@itemize @bullet
196@item @code{@value{RPREFIX}LOCAL} - local task (default)
197@item @code{@value{RPREFIX}GLOBAL} - global task
198@end itemize
199
200The PTCB for a global partition is allocated on the
201local node.  The memory space used for the partition must reside
202in shared memory. Partitions should not be made global unless
203remote tasks must interact with the partition.  This is to avoid
204the overhead incurred by the creation of a global partition.
205When a global partition is created, the partition's name and id
206must be transmitted to every node in the system for insertion in
207the local copy of the global object table.
208
209The total number of global objects, including
210partitions, is limited by the maximum_global_objects field in
211the Configuration Table.
212
213@page
214@subsection PARTITION_IDENT - Get ID of a partition
215
216@subheading CALLING SEQUENCE:
217
218@ifset is-C
219@c @findex rtems_partition_ident
220@example
221rtems_status_code rtems_partition_ident(
222  rtems_name        name,
223  rtems_unsigned32  node,
224  rtems_id         *id
225);
226@end example
227@end ifset
228
229@ifset is-Ada
230@example
231procedure Partition_Ident (
232   Name   : in     RTEMS.Name;
233   Node   : in     RTEMS.Unsigned32;
234   ID     :    out RTEMS.ID;
235   Result :    out RTEMS.Status_Codes
236);
237@end example
238@end ifset
239
240@subheading DIRECTIVE STATUS CODES:
241@code{@value{RPREFIX}SUCCESSFUL} - partition identified successfully@*
242@code{@value{RPREFIX}INVALID_NAME} - partition name not found@*
243@code{@value{RPREFIX}INVALID_NODE} - invalid node id
244
245@subheading DESCRIPTION:
246
247This directive obtains the partition id associated
248with the partition name.  If the partition name is not unique,
249then the partition id will match one of the partitions with that
250name.  However, this partition id is not guaranteed to
251correspond to the desired partition.  The partition id is used
252with other partition related directives to access the partition.
253
254@subheading NOTES:
255
256This directive will not cause the running task to be
257preempted.
258
259If node is @code{@value{RPREFIX}SEARCH_ALL_NODES}, all nodes are searched
260with the local node being searched first.  All other nodes are
261searched with the lowest numbered node searched first.
262
263If node is a valid node number which does not
264represent the local node, then only the partitions exported by
265the designated node are searched.
266
267This directive does not generate activity on remote
268nodes.  It accesses only the local copy of the global object
269table.
270
271@page
272@subsection PARTITION_DELETE - Delete a partition
273
274@subheading CALLING SEQUENCE:
275
276@ifset is-C
277@c @findex rtems_partition_delete
278@example
279rtems_status_code rtems_partition_delete(
280  rtems_id id
281);
282@end example
283@end ifset
284
285@ifset is-Ada
286@example
287procedure Partition_Delete (
288   ID     : in     RTEMS.ID;
289   Result :    out RTEMS.Status_Codes
290);
291@end example
292@end ifset
293
294@subheading DIRECTIVE STATUS CODES:
295@code{@value{RPREFIX}SUCCESSFUL} - partition deleted successfully@*
296@code{@value{RPREFIX}INVALID_ID} - invalid partition id@*
297@code{@value{RPREFIX}RESOURCE_IN_USE} - buffers still in use@*
298@code{@value{RPREFIX}ILLEGAL_ON_REMOTE_OBJECT} - cannot delete remote partition
299
300@subheading DESCRIPTION:
301
302This directive deletes the partition specified by id.
303The partition cannot be deleted if any of its buffers are still
304allocated.  The PTCB for the deleted partition is reclaimed by
305RTEMS.
306
307@subheading NOTES:
308
309This directive will not cause the calling task to be
310preempted.
311
312The calling task does not have to be the task that
313created the partition.  Any local task that knows the partition
314id can delete the partition.
315
316When a global partition is deleted, the partition id
317must be transmitted to every node in the system for deletion
318from the local copy of the global object table.
319
320The partition must reside on the local node, even if
321the partition was created with the @code{@value{RPREFIX}GLOBAL} option.
322
323@page
324@subsection PARTITION_GET_BUFFER - Get buffer from a partition
325
326@subheading CALLING SEQUENCE:
327
328@ifset is-C
329@c @findex rtems_partition_get_buffer
330@example
331rtems_status_code rtems_partition_get_buffer(
332  rtems_id   id,
333  void     **buffer
334);
335@end example
336@end ifset
337
338@ifset is-Ada
339@example
340procedure Partition_Get_Buffer (
341   ID     : in     RTEMS.ID;
342   Buffer :    out RTEMS.Address;
343   Result :    out RTEMS.Status_Codes
344);
345@end example
346@end ifset
347
348@subheading DIRECTIVE STATUS CODES:
349@code{@value{RPREFIX}SUCCESSFUL} - buffer obtained successfully@*
350@code{@value{RPREFIX}INVALID_ID} - invalid partition id@*
351@code{@value{RPREFIX}UNSATISFIED} - all buffers are allocated
352
353@subheading DESCRIPTION:
354
355This directive allows a buffer to be obtained from
356the partition specified in id.  The address of the allocated
357buffer is returned in buffer.
358
359@subheading NOTES:
360
361This directive will not cause the running task to be
362preempted.
363
364All buffers begin on a four byte boundary.
365
366A task cannot wait on a buffer to become available.
367
368Getting a buffer from a global partition which does
369not reside on the local node will generate a request telling the
370remote node to allocate a buffer from the specified partition.
371
372@page
373@subsection PARTITION_RETURN_BUFFER - Return buffer to a partition
374
375@subheading CALLING SEQUENCE:
376
377@ifset is-C
378@c @findex rtems_partition_return_buffer
379@example
380rtems_status_code rtems_partition_return_buffer(
381  rtems_id  id,
382  void     *buffer
383);
384@end example
385@end ifset
386
387@ifset is-Ada
388@example
389procedure Partition_Return_Buffer (
390   ID     : in     RTEMS.ID;
391   Buffer : in     RTEMS.Address;
392   Result :    out RTEMS.Status_Codes
393);
394@end example
395@end ifset
396
397@subheading DIRECTIVE STATUS CODES:
398@code{@value{RPREFIX}SUCCESSFUL} - buffer returned successfully@*
399@code{@value{RPREFIX}INVALID_ID} - invalid partition id@*
400@code{@value{RPREFIX}INVALID_ADDRESS} - buffer address not in partition
401
402@subheading DESCRIPTION:
403
404This directive returns the buffer specified by buffer
405to the partition specified by id.
406
407@subheading NOTES:
408
409This directive will not cause the running task to be
410preempted.
411
412Returning a buffer to a global partition which does
413not reside on the local node will generate a request telling the
414remote node to return the buffer to the specified partition.
Note: See TracBrowser for help on using the repository browser.