1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) |
---|
4 | .. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR) |
---|
5 | |
---|
6 | .. This file is part of the RTEMS quality process and was automatically |
---|
7 | .. generated. If you find something that needs to be fixed or |
---|
8 | .. worded better please post a report or patch to an RTEMS mailing list |
---|
9 | .. or raise a bug report: |
---|
10 | .. |
---|
11 | .. https://docs.rtems.org/branches/master/user/support/bugs.html |
---|
12 | .. |
---|
13 | .. For information on updating and regenerating please refer to: |
---|
14 | .. |
---|
15 | .. https://docs.rtems.org/branches/master/eng/req/howto.html |
---|
16 | |
---|
17 | .. _PartitionManagerDirectives: |
---|
18 | |
---|
19 | Directives |
---|
20 | ========== |
---|
21 | |
---|
22 | This section details the directives of the Partition Manager. A subsection is |
---|
23 | dedicated to each of this manager's directives and lists the calling sequence, |
---|
24 | parameters, description, return values, and notes of the directive. |
---|
25 | |
---|
26 | .. Generated from spec:/rtems/part/if/create |
---|
27 | |
---|
28 | .. raw:: latex |
---|
29 | |
---|
30 | \clearpage |
---|
31 | |
---|
32 | .. index:: rtems_partition_create() |
---|
33 | .. index:: create a partition |
---|
34 | |
---|
35 | .. _InterfaceRtemsPartitionCreate: |
---|
36 | |
---|
37 | rtems_partition_create() |
---|
38 | ------------------------ |
---|
39 | |
---|
40 | Creates a partition. |
---|
41 | |
---|
42 | .. rubric:: CALLING SEQUENCE: |
---|
43 | |
---|
44 | .. code-block:: c |
---|
45 | |
---|
46 | rtems_status_code rtems_partition_create( |
---|
47 | rtems_name name, |
---|
48 | void *starting_address, |
---|
49 | uintptr_t length, |
---|
50 | size_t buffer_size, |
---|
51 | rtems_attribute attribute_set, |
---|
52 | rtems_id *id |
---|
53 | ); |
---|
54 | |
---|
55 | .. rubric:: PARAMETERS: |
---|
56 | |
---|
57 | ``name`` |
---|
58 | This parameter is the name of the partition. |
---|
59 | |
---|
60 | ``starting_address`` |
---|
61 | This parameter is the starting address of the buffer area used by the |
---|
62 | partition. |
---|
63 | |
---|
64 | ``length`` |
---|
65 | This parameter is the length in bytes of the buffer area used by the |
---|
66 | partition. |
---|
67 | |
---|
68 | ``buffer_size`` |
---|
69 | This parameter is the size in bytes of a buffer managed by the partition. |
---|
70 | |
---|
71 | ``attribute_set`` |
---|
72 | This parameter is the attribute set of the partition. |
---|
73 | |
---|
74 | ``id`` |
---|
75 | This parameter is the pointer to an object identifier variable. The |
---|
76 | identifier of the created partition object will be stored in this variable, |
---|
77 | in case of a successful operation. |
---|
78 | |
---|
79 | .. rubric:: DESCRIPTION: |
---|
80 | |
---|
81 | This directive creates a partition of fixed size buffers from a physically |
---|
82 | contiguous memory space which starts at ``starting_address`` and is ``length`` |
---|
83 | bytes in size. Each allocated buffer is to be of ``buffer_size`` in bytes. |
---|
84 | The assigned object identifier is returned in ``id``. This identifier is used |
---|
85 | to access the partition with other partition related directives. |
---|
86 | |
---|
87 | The **attribute set** specified in ``attribute_set`` is built through a |
---|
88 | *bitwise or* of the attribute constants described below. Attributes not |
---|
89 | mentioned below are not evaluated by this directive and have no effect. |
---|
90 | |
---|
91 | The partition can have **local** or **global** scope in a multiprocessing |
---|
92 | network (this attribute does not refer to SMP systems). |
---|
93 | |
---|
94 | * A **local** scope is the default and can be emphasized through the use of the |
---|
95 | :c:macro:`RTEMS_LOCAL` attribute. A local partition can be only used by the |
---|
96 | node which created it. |
---|
97 | |
---|
98 | * A **global** scope is established if the :c:macro:`RTEMS_GLOBAL` attribute is |
---|
99 | set. The memory space used for the partition must reside in shared memory. |
---|
100 | Setting the global attribute in a single node system has no effect. |
---|
101 | |
---|
102 | .. rubric:: RETURN VALUES: |
---|
103 | |
---|
104 | :c:macro:`RTEMS_SUCCESSFUL` |
---|
105 | The requested operation was successful. |
---|
106 | |
---|
107 | :c:macro:`RTEMS_INVALID_NAME` |
---|
108 | The partition name was invalid. |
---|
109 | |
---|
110 | :c:macro:`RTEMS_INVALID_ADDRESS` |
---|
111 | The ``id`` parameter was `NULL |
---|
112 | <https://en.cppreference.com/w/c/types/NULL>`_. |
---|
113 | |
---|
114 | :c:macro:`RTEMS_INVALID_SIZE` |
---|
115 | The ``length`` parameter was 0. |
---|
116 | |
---|
117 | :c:macro:`RTEMS_INVALID_SIZE` |
---|
118 | The ``buffer_size`` parameter was 0. |
---|
119 | |
---|
120 | :c:macro:`RTEMS_INVALID_SIZE` |
---|
121 | The ``length`` parameter was less than the ``buffer_size`` parameter. |
---|
122 | |
---|
123 | :c:macro:`RTEMS_INVALID_SIZE` |
---|
124 | The ``buffer_size`` parameter was not an integral multiple of the pointer |
---|
125 | size. |
---|
126 | |
---|
127 | :c:macro:`RTEMS_INVALID_SIZE` |
---|
128 | The ``buffer_size`` parameter was less than two times the pointer size. |
---|
129 | |
---|
130 | :c:macro:`RTEMS_INVALID_ADDRESS` |
---|
131 | The ``starting_address`` parameter was not on a pointer size boundary. |
---|
132 | |
---|
133 | :c:macro:`RTEMS_TOO_MANY` |
---|
134 | There was no inactive object available to create a new partition. The |
---|
135 | number of partitions available to the application is configured through the |
---|
136 | :ref:`CONFIGURE_MAXIMUM_PARTITIONS` configuration option. |
---|
137 | |
---|
138 | .. rubric:: NOTES: |
---|
139 | |
---|
140 | This directive may cause the calling task to be preempted due to an obtain and |
---|
141 | release of the object allocator mutex. |
---|
142 | |
---|
143 | The partition buffer area specified by the ``starting_address`` must be |
---|
144 | properly aligned. It must be possible to directly store target architecture |
---|
145 | pointers and also the user data. For example, if the user data contains some |
---|
146 | long double or vector data types, the partition buffer area and the buffer size |
---|
147 | must take the alignment of these types into account which is usually larger |
---|
148 | than the pointer alignment. A cache line alignment may be also a factor. Use |
---|
149 | :c:macro:`RTEMS_PARTITION_ALIGNMENT` to specify the minimum alignment of a |
---|
150 | partition buffer type. |
---|
151 | |
---|
152 | The ``buffer_size`` parameter must be an integral multiple of the pointer size |
---|
153 | on the target architecture. Additionally, ``buffer_size`` must be large enough |
---|
154 | to hold two pointers on the target architecture. This is required for RTEMS to |
---|
155 | manage the buffers when they are free. |
---|
156 | |
---|
157 | For control and maintenance of the partition, RTEMS allocates a :term:`PTCB` |
---|
158 | from the local PTCB free pool and initializes it. Memory from the partition |
---|
159 | buffer area is not used by RTEMS to store the PTCB. |
---|
160 | |
---|
161 | The PTCB for a global partition is allocated on the local node. Partitions |
---|
162 | should not be made global unless remote tasks must interact with the partition. |
---|
163 | This is to avoid the overhead incurred by the creation of a global partition. |
---|
164 | When a global partition is created, the partition's name and identifier must be |
---|
165 | transmitted to every node in the system for insertion in the local copy of the |
---|
166 | global object table. |
---|
167 | |
---|
168 | The total number of global objects, including partitions, is limited by the |
---|
169 | value of the :ref:`CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS` application |
---|
170 | configuration option. |
---|
171 | |
---|
172 | .. Generated from spec:/rtems/part/if/ident |
---|
173 | |
---|
174 | .. raw:: latex |
---|
175 | |
---|
176 | \clearpage |
---|
177 | |
---|
178 | .. index:: rtems_partition_ident() |
---|
179 | .. index:: get ID of a partition |
---|
180 | .. index:: obtain ID of a partition |
---|
181 | |
---|
182 | .. _InterfaceRtemsPartitionIdent: |
---|
183 | |
---|
184 | rtems_partition_ident() |
---|
185 | ----------------------- |
---|
186 | |
---|
187 | Identifies a partition by the object name. |
---|
188 | |
---|
189 | .. rubric:: CALLING SEQUENCE: |
---|
190 | |
---|
191 | .. code-block:: c |
---|
192 | |
---|
193 | rtems_status_code rtems_partition_ident( |
---|
194 | rtems_name name, |
---|
195 | uint32_t node, |
---|
196 | rtems_id *id |
---|
197 | ); |
---|
198 | |
---|
199 | .. rubric:: PARAMETERS: |
---|
200 | |
---|
201 | ``name`` |
---|
202 | This parameter is the object name to look up. |
---|
203 | |
---|
204 | ``node`` |
---|
205 | This parameter is the node or node set to search for a matching object. |
---|
206 | |
---|
207 | ``id`` |
---|
208 | This parameter is the pointer to an object identifier variable. The object |
---|
209 | identifier of an object with the specified name will be stored in this |
---|
210 | variable, in case of a successful operation. |
---|
211 | |
---|
212 | .. rubric:: DESCRIPTION: |
---|
213 | |
---|
214 | This directive obtains a partition identifier associated with the partition |
---|
215 | name specified in ``name``. |
---|
216 | |
---|
217 | The node to search is specified in ``node``. It shall be |
---|
218 | |
---|
219 | * a valid node number, |
---|
220 | |
---|
221 | * the constant :c:macro:`RTEMS_SEARCH_ALL_NODES` to search in all nodes, |
---|
222 | |
---|
223 | * the constant :c:macro:`RTEMS_SEARCH_LOCAL_NODE` to search in the local node |
---|
224 | only, or |
---|
225 | |
---|
226 | * the constant :c:macro:`RTEMS_SEARCH_OTHER_NODES` to search in all nodes |
---|
227 | except the local node. |
---|
228 | |
---|
229 | .. rubric:: RETURN VALUES: |
---|
230 | |
---|
231 | :c:macro:`RTEMS_SUCCESSFUL` |
---|
232 | The requested operation was successful. |
---|
233 | |
---|
234 | :c:macro:`RTEMS_INVALID_ADDRESS` |
---|
235 | The ``id`` parameter was `NULL |
---|
236 | <https://en.cppreference.com/w/c/types/NULL>`_. |
---|
237 | |
---|
238 | :c:macro:`RTEMS_INVALID_NAME` |
---|
239 | The ``name`` parameter was 0. |
---|
240 | |
---|
241 | :c:macro:`RTEMS_INVALID_NAME` |
---|
242 | There was no object with the specified name on the specified nodes. |
---|
243 | |
---|
244 | :c:macro:`RTEMS_INVALID_NODE` |
---|
245 | In multiprocessing configurations, the specified node was invalid. |
---|
246 | |
---|
247 | .. rubric:: NOTES: |
---|
248 | |
---|
249 | If the partition name is not unique, then the partition identifier will match |
---|
250 | the first partition with that name in the search order. However, this |
---|
251 | partition identifier is not guaranteed to correspond to the desired partition. |
---|
252 | The partition identifier is used with other partition related directives to |
---|
253 | access the partition. |
---|
254 | |
---|
255 | If node is :c:macro:`RTEMS_SEARCH_ALL_NODES`, all nodes are searched with the |
---|
256 | local node being searched first. All other nodes are searched with the lowest |
---|
257 | numbered node searched first. |
---|
258 | |
---|
259 | If node is a valid node number which does not represent the local node, then |
---|
260 | only the partitions exported by the designated node are searched. |
---|
261 | |
---|
262 | This directive does not generate activity on remote nodes. It accesses only |
---|
263 | the local copy of the global object table. |
---|
264 | |
---|
265 | .. Generated from spec:/rtems/part/if/delete |
---|
266 | |
---|
267 | .. raw:: latex |
---|
268 | |
---|
269 | \clearpage |
---|
270 | |
---|
271 | .. index:: rtems_partition_delete() |
---|
272 | .. index:: delete a partition |
---|
273 | |
---|
274 | .. _InterfaceRtemsPartitionDelete: |
---|
275 | |
---|
276 | rtems_partition_delete() |
---|
277 | ------------------------ |
---|
278 | |
---|
279 | Deletes the partition. |
---|
280 | |
---|
281 | .. rubric:: CALLING SEQUENCE: |
---|
282 | |
---|
283 | .. code-block:: c |
---|
284 | |
---|
285 | rtems_status_code rtems_partition_delete( rtems_id id ); |
---|
286 | |
---|
287 | .. rubric:: PARAMETERS: |
---|
288 | |
---|
289 | ``id`` |
---|
290 | This parameter is the partition identifier. |
---|
291 | |
---|
292 | .. rubric:: DESCRIPTION: |
---|
293 | |
---|
294 | This directive deletes the partition specified by the ``id`` parameter. The |
---|
295 | partition cannot be deleted if any of its buffers are still allocated. |
---|
296 | |
---|
297 | .. rubric:: RETURN VALUES: |
---|
298 | |
---|
299 | :c:macro:`RTEMS_SUCCESSFUL` |
---|
300 | The requested operation was successful. |
---|
301 | |
---|
302 | :c:macro:`RTEMS_INVALID_ID` |
---|
303 | There was no partition with the specified identifier. |
---|
304 | |
---|
305 | :c:macro:`RTEMS_ILLEGAL_ON_REMOTE_OBJECT` |
---|
306 | The partition resided on a remote node. |
---|
307 | |
---|
308 | :c:macro:`RTEMS_RESOURCE_IN_USE` |
---|
309 | There were buffers of the partition still in use. |
---|
310 | |
---|
311 | .. rubric:: NOTES: |
---|
312 | |
---|
313 | This directive may cause the calling task to be preempted due to an obtain and |
---|
314 | release of the object allocator mutex. |
---|
315 | |
---|
316 | The :term:`PTCB` for the deleted partition is reclaimed by RTEMS. |
---|
317 | |
---|
318 | The calling task does not have to be the task that created the partition. Any |
---|
319 | local task that knows the partition identifier can delete the partition. |
---|
320 | |
---|
321 | When a global partition is deleted, the partition identifier must be |
---|
322 | transmitted to every node in the system for deletion from the local copy of the |
---|
323 | global object table. |
---|
324 | |
---|
325 | The partition must reside on the local node, even if the partition was created |
---|
326 | with the :c:macro:`RTEMS_GLOBAL` attribute. |
---|
327 | |
---|
328 | .. Generated from spec:/rtems/part/if/get-buffer |
---|
329 | |
---|
330 | .. raw:: latex |
---|
331 | |
---|
332 | \clearpage |
---|
333 | |
---|
334 | .. index:: rtems_partition_get_buffer() |
---|
335 | .. index:: get buffer from partition |
---|
336 | .. index:: obtain buffer from partition |
---|
337 | |
---|
338 | .. _InterfaceRtemsPartitionGetBuffer: |
---|
339 | |
---|
340 | rtems_partition_get_buffer() |
---|
341 | ---------------------------- |
---|
342 | |
---|
343 | Tries to get a buffer from the partition. |
---|
344 | |
---|
345 | .. rubric:: CALLING SEQUENCE: |
---|
346 | |
---|
347 | .. code-block:: c |
---|
348 | |
---|
349 | rtems_status_code rtems_partition_get_buffer( rtems_id id, void **buffer ); |
---|
350 | |
---|
351 | .. rubric:: PARAMETERS: |
---|
352 | |
---|
353 | ``id`` |
---|
354 | This parameter is the partition identifier. |
---|
355 | |
---|
356 | ``buffer`` |
---|
357 | This parameter is the pointer to a buffer pointer variable. The pointer to |
---|
358 | the allocated buffer will be stored in this variable, in case of a |
---|
359 | successful operation. |
---|
360 | |
---|
361 | .. rubric:: DESCRIPTION: |
---|
362 | |
---|
363 | This directive allows a buffer to be obtained from the partition specified in |
---|
364 | the ``id`` parameter. The address of the allocated buffer is returned through |
---|
365 | the ``buffer`` parameter. |
---|
366 | |
---|
367 | .. rubric:: RETURN VALUES: |
---|
368 | |
---|
369 | :c:macro:`RTEMS_SUCCESSFUL` |
---|
370 | The requested operation was successful. |
---|
371 | |
---|
372 | :c:macro:`RTEMS_INVALID_ID` |
---|
373 | There was no partition with the specified identifier. |
---|
374 | |
---|
375 | :c:macro:`RTEMS_INVALID_ADDRESS` |
---|
376 | The ``buffer`` parameter was `NULL |
---|
377 | <https://en.cppreference.com/w/c/types/NULL>`_. |
---|
378 | |
---|
379 | :c:macro:`RTEMS_UNSATISFIED` |
---|
380 | There was no free buffer available to allocate and return. |
---|
381 | |
---|
382 | .. rubric:: NOTES: |
---|
383 | |
---|
384 | This directive will not cause the running task to be preempted. |
---|
385 | |
---|
386 | The buffer start alignment is determined by the memory area and buffer size |
---|
387 | used to create the partition. |
---|
388 | |
---|
389 | A task cannot wait on a buffer to become available. |
---|
390 | |
---|
391 | Getting a buffer from a global partition which does not reside on the local |
---|
392 | node will generate a request telling the remote node to allocate a buffer from |
---|
393 | the partition. |
---|
394 | |
---|
395 | .. Generated from spec:/rtems/part/if/return-buffer |
---|
396 | |
---|
397 | .. raw:: latex |
---|
398 | |
---|
399 | \clearpage |
---|
400 | |
---|
401 | .. index:: rtems_partition_return_buffer() |
---|
402 | .. index:: return buffer to partition |
---|
403 | |
---|
404 | .. _InterfaceRtemsPartitionReturnBuffer: |
---|
405 | |
---|
406 | rtems_partition_return_buffer() |
---|
407 | ------------------------------- |
---|
408 | |
---|
409 | Returns the buffer to the partition. |
---|
410 | |
---|
411 | .. rubric:: CALLING SEQUENCE: |
---|
412 | |
---|
413 | .. code-block:: c |
---|
414 | |
---|
415 | rtems_status_code rtems_partition_return_buffer( rtems_id id, void *buffer ); |
---|
416 | |
---|
417 | .. rubric:: PARAMETERS: |
---|
418 | |
---|
419 | ``id`` |
---|
420 | This parameter is the partition identifier. |
---|
421 | |
---|
422 | ``buffer`` |
---|
423 | This parameter is the pointer to the buffer to return. |
---|
424 | |
---|
425 | .. rubric:: DESCRIPTION: |
---|
426 | |
---|
427 | This directive returns the buffer specified by ``buffer`` to the partition |
---|
428 | specified by ``id``. |
---|
429 | |
---|
430 | .. rubric:: RETURN VALUES: |
---|
431 | |
---|
432 | :c:macro:`RTEMS_SUCCESSFUL` |
---|
433 | The requested operation was successful. |
---|
434 | |
---|
435 | :c:macro:`RTEMS_INVALID_ID` |
---|
436 | There was no partition with the specified identifier. |
---|
437 | |
---|
438 | :c:macro:`RTEMS_INVALID_ADDRESS` |
---|
439 | The buffer referenced by ``buffer`` was not in the partition. |
---|
440 | |
---|
441 | .. rubric:: NOTES: |
---|
442 | |
---|
443 | This directive will not cause the running task to be preempted. |
---|
444 | |
---|
445 | Returning a buffer to a global partition which does not reside on the local |
---|
446 | node will generate a request telling the remote node to return the buffer to |
---|
447 | the partition. |
---|
448 | |
---|
449 | Returning a buffer multiple times is an error. It will corrupt the internal |
---|
450 | state of the partition. |
---|