source: rtems/doc/user/part.t @ 29e6637e

4.115
Last change on this file since 29e6637e was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

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