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-1998. |
---|
17 | * On-Line Applications Research Corporation (OAR). |
---|
18 | * Copyright assigned to U.S. Government, 1994. |
---|
19 | * |
---|
20 | * The license and distribution terms for this file may be |
---|
21 | * found in the file LICENSE in this distribution or at |
---|
22 | * http://www.OARcorp.com/rtems/license.html. |
---|
23 | * |
---|
24 | * $Id$ |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef __RTEMS_PARTITION_h |
---|
28 | #define __RTEMS_PARTITION_h |
---|
29 | |
---|
30 | #ifdef __cplusplus |
---|
31 | extern "C" { |
---|
32 | #endif |
---|
33 | |
---|
34 | #include <rtems/score/address.h> |
---|
35 | #include <rtems/score/object.h> |
---|
36 | #include <rtems/rtems/attr.h> |
---|
37 | #include <rtems/rtems/types.h> |
---|
38 | |
---|
39 | /* |
---|
40 | * The following defines the control block used to manage each partition. |
---|
41 | */ |
---|
42 | |
---|
43 | typedef struct { |
---|
44 | Objects_Control Object; |
---|
45 | void *starting_address; /* physical address */ |
---|
46 | unsigned32 length; /* in bytes */ |
---|
47 | unsigned32 buffer_size; /* in bytes */ |
---|
48 | rtems_attribute attribute_set; /* attributes */ |
---|
49 | unsigned32 number_of_used_blocks; /* or allocated buffers */ |
---|
50 | Chain_Control Memory; /* buffer chain */ |
---|
51 | } Partition_Control; |
---|
52 | |
---|
53 | /* |
---|
54 | * The following defines the information control block used to |
---|
55 | * manage this class of objects. |
---|
56 | */ |
---|
57 | |
---|
58 | RTEMS_EXTERN Objects_Information _Partition_Information; |
---|
59 | |
---|
60 | /* |
---|
61 | * _Partition_Manager_initialization |
---|
62 | * |
---|
63 | * DESCRIPTION: |
---|
64 | * |
---|
65 | * This routine performs the initialization necessary for this manager. |
---|
66 | */ |
---|
67 | |
---|
68 | void _Partition_Manager_initialization( |
---|
69 | unsigned32 maximum_partitions |
---|
70 | ); |
---|
71 | |
---|
72 | /* |
---|
73 | * rtems_partition_create |
---|
74 | * |
---|
75 | * DESCRIPTION: |
---|
76 | * |
---|
77 | * This routine implements the rtems_partition_create directive. The |
---|
78 | * partition will have the name name. The memory area managed by |
---|
79 | * the partition is of length bytes and starts at starting_address. |
---|
80 | * The memory area will be divided into as many buffers of |
---|
81 | * buffer_size bytes as possible. The attribute_set determines if |
---|
82 | * the partition is global or local. It returns the id of the |
---|
83 | * created partition in ID. |
---|
84 | */ |
---|
85 | |
---|
86 | rtems_status_code rtems_partition_create( |
---|
87 | rtems_name name, |
---|
88 | void *starting_address, |
---|
89 | unsigned32 length, |
---|
90 | unsigned32 buffer_size, |
---|
91 | rtems_attribute attribute_set, |
---|
92 | Objects_Id *id |
---|
93 | ); |
---|
94 | |
---|
95 | /* |
---|
96 | * rtems_partition_ident |
---|
97 | * |
---|
98 | * DESCRIPTION: |
---|
99 | * |
---|
100 | * This routine implements the rtems_partition_ident directive. |
---|
101 | * This directive returns the partition ID associated with name. |
---|
102 | * If more than one partition is named name, then the partition |
---|
103 | * to which the ID belongs is arbitrary. node indicates the |
---|
104 | * extent of the search for the ID of the partition named name. |
---|
105 | * The search can be limited to a particular node or allowed to |
---|
106 | * encompass all nodes. |
---|
107 | */ |
---|
108 | |
---|
109 | rtems_status_code rtems_partition_ident( |
---|
110 | rtems_name name, |
---|
111 | unsigned32 node, |
---|
112 | Objects_Id *id |
---|
113 | ); |
---|
114 | |
---|
115 | /* |
---|
116 | * rtems_partition_delete |
---|
117 | * |
---|
118 | * DESCRIPTION: |
---|
119 | * |
---|
120 | * This routine implements the rtems_partition_delete directive. The |
---|
121 | * partition indicated by ID is deleted. |
---|
122 | */ |
---|
123 | |
---|
124 | rtems_status_code rtems_partition_delete( |
---|
125 | Objects_Id id |
---|
126 | ); |
---|
127 | |
---|
128 | /* |
---|
129 | * rtems_partition_get_buffer |
---|
130 | * |
---|
131 | * DESCRIPTION: |
---|
132 | * |
---|
133 | * This routine implements the rtems_partition_get_buffer directive. It |
---|
134 | * attempts to allocate a buffer from the partition associated with ID. |
---|
135 | * If a buffer is allocated, its address is returned in buffer. |
---|
136 | */ |
---|
137 | |
---|
138 | rtems_status_code rtems_partition_get_buffer( |
---|
139 | Objects_Id id, |
---|
140 | void **buffer |
---|
141 | ); |
---|
142 | |
---|
143 | /* |
---|
144 | * rtems_partition_return_buffer |
---|
145 | * |
---|
146 | * DESCRIPTION: |
---|
147 | * |
---|
148 | * This routine implements the rtems_partition_return_buffer directive. It |
---|
149 | * frees the buffer to the partition associated with ID. The buffer must |
---|
150 | * have been previously allocated from the same partition. |
---|
151 | */ |
---|
152 | |
---|
153 | rtems_status_code rtems_partition_return_buffer( |
---|
154 | Objects_Id id, |
---|
155 | void *buffer |
---|
156 | ); |
---|
157 | |
---|
158 | #ifndef __RTEMS_APPLICATION__ |
---|
159 | #include <rtems/rtems/part.inl> |
---|
160 | #endif |
---|
161 | #if defined(RTEMS_MULTIPROCESSING) |
---|
162 | #include <rtems/rtems/partmp.h> |
---|
163 | #endif |
---|
164 | |
---|
165 | #ifdef __cplusplus |
---|
166 | } |
---|
167 | #endif |
---|
168 | |
---|
169 | #endif |
---|
170 | /* end of include file */ |
---|