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