source: rtems/doc/user/part.t @ 78287f41

4.104.114.84.95
Last change on this file since 78287f41 was 6449498, checked in by Joel Sherrill <joel.sherrill@…>, on 01/17/02 at 21:47:47

2001-01-17 Joel Sherrill <joel@…>

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