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

4.104.114.84.95
Last change on this file since f331481c was f331481c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/27/98 at 13:24:52

Conditionally adding RTEMS_ and rtems_ prefixes.

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