1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Table of User Defined Configuration Parameters |
---|
5 | * |
---|
6 | * This include file contains the table of user defined configuration |
---|
7 | * parameters. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2014. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_CONFIG_H |
---|
20 | #define _RTEMS_CONFIG_H |
---|
21 | |
---|
22 | #ifdef __cplusplus |
---|
23 | extern "C" { |
---|
24 | #endif |
---|
25 | |
---|
26 | /* |
---|
27 | * Unlimited object support. Changes the configuration table entry for POSIX |
---|
28 | * or RTEMS APIs to bounded only by the memory of the work-space. |
---|
29 | * |
---|
30 | * Use the macro to define the resource unlimited before placing in |
---|
31 | * the configuration table. |
---|
32 | */ |
---|
33 | |
---|
34 | #include <rtems/score/object.h> |
---|
35 | #define RTEMS_UNLIMITED_OBJECTS OBJECTS_UNLIMITED_OBJECTS |
---|
36 | |
---|
37 | #define rtems_resource_unlimited(resource) \ |
---|
38 | ( resource | RTEMS_UNLIMITED_OBJECTS ) |
---|
39 | |
---|
40 | #define rtems_resource_is_unlimited(resource) \ |
---|
41 | _Objects_Is_unlimited(resource) |
---|
42 | |
---|
43 | #define rtems_resource_maximum_per_allocation(resource) \ |
---|
44 | _Objects_Maximum_per_allocation(resource) |
---|
45 | |
---|
46 | /* |
---|
47 | * This is kind of kludgy but it allows targets to totally ignore the |
---|
48 | * optional APIs like POSIX safely. |
---|
49 | */ |
---|
50 | |
---|
51 | #ifdef RTEMS_POSIX_API |
---|
52 | #include <rtems/posix/config.h> |
---|
53 | #else |
---|
54 | typedef void *posix_api_configuration_table; |
---|
55 | #endif |
---|
56 | |
---|
57 | #include <rtems/rtems/config.h> |
---|
58 | |
---|
59 | #include <rtems/extension.h> |
---|
60 | #if defined(RTEMS_MULTIPROCESSING) |
---|
61 | #include <rtems/score/mpci.h> |
---|
62 | #endif |
---|
63 | |
---|
64 | #if defined(RTEMS_MULTIPROCESSING) |
---|
65 | /* |
---|
66 | * The following records define the Multiprocessor Configuration |
---|
67 | * Table. This table defines the multiprocessor system |
---|
68 | * characteristics which must be known by RTEMS in a multiprocessor |
---|
69 | * system. |
---|
70 | */ |
---|
71 | typedef struct { |
---|
72 | /** This is the local node number. */ |
---|
73 | uint32_t node; |
---|
74 | /** This is the maximum number of nodes in system. */ |
---|
75 | uint32_t maximum_nodes; |
---|
76 | /** This is the maximum number of global objects. */ |
---|
77 | uint32_t maximum_global_objects; |
---|
78 | /** This is the maximum number of proxies. */ |
---|
79 | uint32_t maximum_proxies; |
---|
80 | |
---|
81 | /** |
---|
82 | * The MPCI Receive server is assumed to have a stack of at least |
---|
83 | * minimum stack size. This field specifies the amount of extra |
---|
84 | * stack this task will be given in bytes. |
---|
85 | */ |
---|
86 | uint32_t extra_mpci_receive_server_stack; |
---|
87 | |
---|
88 | /** This is a pointer to User/BSP provided MPCI Table. */ |
---|
89 | rtems_mpci_table *User_mpci_table; |
---|
90 | } rtems_multiprocessing_table; |
---|
91 | #endif |
---|
92 | |
---|
93 | /** |
---|
94 | * @brief Task stack allocator initialization hook. |
---|
95 | * |
---|
96 | * @param[in] stack_space_size is the size of the stack space in bytes. |
---|
97 | */ |
---|
98 | typedef void (*rtems_stack_allocate_init_hook)( size_t stack_space_size ); |
---|
99 | |
---|
100 | /** |
---|
101 | * @brief Task stack allocator hook. |
---|
102 | * |
---|
103 | * @param[in] stack_size is the Size of the task stack in bytes. |
---|
104 | * |
---|
105 | * @retval NULL Not enough memory. |
---|
106 | * @retval other Pointer to task stack. |
---|
107 | */ |
---|
108 | typedef void *(*rtems_stack_allocate_hook)( size_t stack_size ); |
---|
109 | |
---|
110 | /** |
---|
111 | * @brief Task stack deallocator hook. |
---|
112 | * |
---|
113 | * @param[in] addr is a pointer to previously allocated task stack. |
---|
114 | */ |
---|
115 | typedef void (*rtems_stack_free_hook)( void *addr ); |
---|
116 | |
---|
117 | /* |
---|
118 | * The following records define the Configuration Table. The |
---|
119 | * information contained in this table is required in all |
---|
120 | * RTEMS systems, whether single or multiprocessor. This |
---|
121 | * table primarily defines the following: |
---|
122 | * |
---|
123 | * + location and size of the RTEMS Workspace |
---|
124 | * + microseconds per clock tick |
---|
125 | * + clock ticks per task timeslice |
---|
126 | * + required number of each object type for each API configured |
---|
127 | */ |
---|
128 | typedef struct { |
---|
129 | /** |
---|
130 | * This field specifies the size in bytes of the RTEMS Workspace. |
---|
131 | */ |
---|
132 | uintptr_t work_space_size; |
---|
133 | |
---|
134 | /** |
---|
135 | * This field specifies the size in bytes of the RTEMS thread stack space. |
---|
136 | */ |
---|
137 | uintptr_t stack_space_size; |
---|
138 | |
---|
139 | /** |
---|
140 | * This field specifies the maximum number of dynamically installed |
---|
141 | * used extensions. |
---|
142 | */ |
---|
143 | uint32_t maximum_extensions; |
---|
144 | |
---|
145 | /** |
---|
146 | * This field contains the maximum number of POSIX API |
---|
147 | * keys which are configured for this application. |
---|
148 | */ |
---|
149 | uint32_t maximum_keys; |
---|
150 | |
---|
151 | /** |
---|
152 | * This field contains the maximum number of POSIX API |
---|
153 | * key value pairs which are configured for this application. |
---|
154 | * |
---|
155 | * @note There can be potentially be a key/value pair for |
---|
156 | * every thread to use every key. But normally this |
---|
157 | * many are not needed in a system. |
---|
158 | */ |
---|
159 | uint32_t maximum_key_value_pairs; |
---|
160 | |
---|
161 | /** |
---|
162 | * This field specifies the number of microseconds which elapse |
---|
163 | * between clock ticks. This is the basis for RTEMS timing. |
---|
164 | */ |
---|
165 | uint32_t microseconds_per_tick; |
---|
166 | |
---|
167 | /** |
---|
168 | * This field specifies the number of nanoseconds which elapse |
---|
169 | * between clock ticks. This value is derived from the |
---|
170 | * microseconds_per_tick field and provided to avoid calculation at |
---|
171 | * run-time. |
---|
172 | */ |
---|
173 | uint32_t nanoseconds_per_tick; |
---|
174 | |
---|
175 | /** |
---|
176 | * This field specifies the number of ticks in each task's timeslice. |
---|
177 | */ |
---|
178 | uint32_t ticks_per_timeslice; |
---|
179 | |
---|
180 | /** |
---|
181 | * This element points to the BSP's optional idle task which may override |
---|
182 | * the default one provided with RTEMS. |
---|
183 | */ |
---|
184 | void *(*idle_task)( uintptr_t ); |
---|
185 | |
---|
186 | /** |
---|
187 | * This field specifies the size of the IDLE task's stack. If less than or |
---|
188 | * equal to the minimum stack size, then the IDLE task will have the minimum |
---|
189 | * stack size. |
---|
190 | */ |
---|
191 | uint32_t idle_task_stack_size; |
---|
192 | |
---|
193 | /** |
---|
194 | * This field specifies the size of the interrupt stack. If less than or |
---|
195 | * equal to the minimum stack size, then the interrupt stack will be of |
---|
196 | * minimum stack size. |
---|
197 | */ |
---|
198 | uint32_t interrupt_stack_size; |
---|
199 | |
---|
200 | /** |
---|
201 | * @brief Optional task stack allocator initialization hook. |
---|
202 | */ |
---|
203 | rtems_stack_allocate_init_hook stack_allocate_init_hook; |
---|
204 | |
---|
205 | /** |
---|
206 | * @brief Optional task stack allocator hook. |
---|
207 | */ |
---|
208 | rtems_stack_allocate_hook stack_allocate_hook; |
---|
209 | |
---|
210 | /** |
---|
211 | * @brief Optional task stack free hook. |
---|
212 | */ |
---|
213 | rtems_stack_free_hook stack_free_hook; |
---|
214 | |
---|
215 | /** |
---|
216 | * If this element is TRUE, then RTEMS will zero the Executive Workspace. |
---|
217 | * When this element is FALSE, it is assumed that the BSP or invoking |
---|
218 | * environment has ensured that memory was cleared before RTEMS was |
---|
219 | * invoked. |
---|
220 | */ |
---|
221 | bool do_zero_of_workspace; |
---|
222 | |
---|
223 | /** |
---|
224 | * @brief Specifies if a unified work area is used or not. |
---|
225 | * |
---|
226 | * If this element is @a true, then the RTEMS Workspace and the C Program |
---|
227 | * Heap use the same heap, otherwise they use separate heaps. |
---|
228 | */ |
---|
229 | bool unified_work_area; |
---|
230 | |
---|
231 | /** |
---|
232 | * @brief Specifies if the stack allocator avoids the work space. |
---|
233 | * |
---|
234 | * If this element is @a true, then the stack allocator must not allocate the |
---|
235 | * thread stacks from the RTEMS Workspace, otherwise it should allocate the |
---|
236 | * thread stacks from the RTEMS Workspace. |
---|
237 | */ |
---|
238 | bool stack_allocator_avoids_work_space; |
---|
239 | |
---|
240 | #ifdef RTEMS_SMP |
---|
241 | bool smp_enabled; |
---|
242 | #endif |
---|
243 | |
---|
244 | uint32_t number_of_initial_extensions; |
---|
245 | const rtems_extensions_table *User_extension_table; |
---|
246 | #if defined(RTEMS_MULTIPROCESSING) |
---|
247 | rtems_multiprocessing_table *User_multiprocessing_table; |
---|
248 | #endif |
---|
249 | #ifdef RTEMS_SMP |
---|
250 | uint32_t maximum_processors; |
---|
251 | #endif |
---|
252 | } rtems_configuration_table; |
---|
253 | |
---|
254 | /** |
---|
255 | * This is the configuration table generated by confdefs.h. |
---|
256 | */ |
---|
257 | extern const rtems_configuration_table Configuration; |
---|
258 | |
---|
259 | #if defined(RTEMS_MULTIPROCESSING) |
---|
260 | /** |
---|
261 | * This points to the multiprocessing configuration table. |
---|
262 | */ |
---|
263 | extern rtems_multiprocessing_table *_Configuration_MP_table; |
---|
264 | #endif |
---|
265 | |
---|
266 | #if defined(RTEMS_MULTIPROCESSING) |
---|
267 | /** |
---|
268 | * @brief RTEMS multiprocessing configuration table. |
---|
269 | * |
---|
270 | * This is the RTEMS Multiprocessing Configuration Table expected to |
---|
271 | * be generated by confdefs.h. |
---|
272 | */ |
---|
273 | extern rtems_multiprocessing_table Multiprocessing_configuration; |
---|
274 | |
---|
275 | /* |
---|
276 | * This is the default Multiprocessing Configuration Table. |
---|
277 | * It is used in single processor configurations. |
---|
278 | */ |
---|
279 | extern const rtems_multiprocessing_table |
---|
280 | _Initialization_Default_multiprocessing_table; |
---|
281 | #endif |
---|
282 | |
---|
283 | |
---|
284 | /* |
---|
285 | * Some handy macros to avoid dependencies on either the BSP |
---|
286 | * or the exact format of the configuration table. |
---|
287 | */ |
---|
288 | |
---|
289 | #define rtems_configuration_get_unified_work_area() \ |
---|
290 | (Configuration.unified_work_area) |
---|
291 | |
---|
292 | #define rtems_configuration_get_stack_allocator_avoids_work_space() \ |
---|
293 | (Configuration.stack_allocator_avoids_work_space) |
---|
294 | |
---|
295 | #define rtems_configuration_get_stack_space_size() \ |
---|
296 | (Configuration.stack_space_size) |
---|
297 | |
---|
298 | #define rtems_configuration_get_work_space_size() \ |
---|
299 | (Configuration.work_space_size + \ |
---|
300 | (rtems_configuration_get_stack_allocator_avoids_work_space() ? \ |
---|
301 | 0 : rtems_configuration_get_stack_space_size())) |
---|
302 | |
---|
303 | #define rtems_configuration_get_maximum_extensions() \ |
---|
304 | (Configuration.maximum_extensions) |
---|
305 | |
---|
306 | #define rtems_configuration_get_microseconds_per_tick() \ |
---|
307 | (Configuration.microseconds_per_tick) |
---|
308 | #define rtems_configuration_get_milliseconds_per_tick() \ |
---|
309 | (Configuration.microseconds_per_tick / 1000) |
---|
310 | #define rtems_configuration_get_nanoseconds_per_tick() \ |
---|
311 | (Configuration.nanoseconds_per_tick) |
---|
312 | |
---|
313 | #define rtems_configuration_get_ticks_per_timeslice() \ |
---|
314 | (Configuration.ticks_per_timeslice) |
---|
315 | |
---|
316 | #define rtems_configuration_get_idle_task() \ |
---|
317 | (Configuration.idle_task) |
---|
318 | |
---|
319 | #define rtems_configuration_get_idle_task_stack_size() \ |
---|
320 | (Configuration.idle_task_stack_size) |
---|
321 | |
---|
322 | #define rtems_configuration_get_interrupt_stack_size() \ |
---|
323 | (Configuration.interrupt_stack_size) |
---|
324 | |
---|
325 | #define rtems_configuration_get_stack_allocate_init_hook() \ |
---|
326 | (Configuration.stack_allocate_init_hook) |
---|
327 | |
---|
328 | #define rtems_configuration_get_stack_allocate_hook() \ |
---|
329 | (Configuration.stack_allocate_hook) |
---|
330 | |
---|
331 | #define rtems_configuration_get_stack_free_hook() \ |
---|
332 | (Configuration.stack_free_hook) |
---|
333 | |
---|
334 | /** |
---|
335 | * This macro assists in accessing the field which indicates whether |
---|
336 | * RTEMS is responsible for zeroing the Executive Workspace. |
---|
337 | */ |
---|
338 | #define rtems_configuration_get_do_zero_of_workspace() \ |
---|
339 | (Configuration.do_zero_of_workspace) |
---|
340 | |
---|
341 | #define rtems_configuration_get_number_of_initial_extensions() \ |
---|
342 | (Configuration.number_of_initial_extensions) |
---|
343 | |
---|
344 | #define rtems_configuration_get_user_extension_table() \ |
---|
345 | (Configuration.User_extension_table) |
---|
346 | |
---|
347 | #if defined(RTEMS_MULTIPROCESSING) |
---|
348 | #define rtems_configuration_get_user_multiprocessing_table() \ |
---|
349 | (Configuration.User_multiprocessing_table) |
---|
350 | #else |
---|
351 | #define rtems_configuration_get_user_multiprocessing_table() \ |
---|
352 | NULL |
---|
353 | #endif |
---|
354 | |
---|
355 | /** |
---|
356 | * @brief Returns true if the SMP mode of operation is enabled, and false |
---|
357 | * otherwise. |
---|
358 | * |
---|
359 | * On single-processor configurations this is a compile time constant which |
---|
360 | * evaluates to false. |
---|
361 | * |
---|
362 | * @retval true SMP mode of operation is enabled. |
---|
363 | * @retval false Otherwise. |
---|
364 | */ |
---|
365 | #ifdef RTEMS_SMP |
---|
366 | #define rtems_configuration_is_smp_enabled() \ |
---|
367 | (Configuration.smp_enabled) |
---|
368 | #else |
---|
369 | #define rtems_configuration_is_smp_enabled() \ |
---|
370 | false |
---|
371 | #endif |
---|
372 | |
---|
373 | /** |
---|
374 | * @brief Returns the configured maximum count of processors. |
---|
375 | * |
---|
376 | * The actual number of processors available for the application will be less |
---|
377 | * than or equal to the configured maximum count of processors. |
---|
378 | * |
---|
379 | * On single-processor configurations this is a compile time constant which |
---|
380 | * evaluates to one. |
---|
381 | * |
---|
382 | * @return The configured maximum count of processors. |
---|
383 | */ |
---|
384 | #ifdef RTEMS_SMP |
---|
385 | #define rtems_configuration_get_maximum_processors() \ |
---|
386 | (Configuration.maximum_processors) |
---|
387 | #else |
---|
388 | #define rtems_configuration_get_maximum_processors() \ |
---|
389 | 1 |
---|
390 | #endif |
---|
391 | |
---|
392 | #define rtems_configuration_get_rtems_api_configuration() \ |
---|
393 | (&Configuration_RTEMS_API) |
---|
394 | |
---|
395 | #define rtems_configuration_get_posix_api_configuration() \ |
---|
396 | (&Configuration_POSIX_API) |
---|
397 | |
---|
398 | #ifdef __cplusplus |
---|
399 | } |
---|
400 | #endif |
---|
401 | |
---|
402 | #endif |
---|
403 | /* end of include file */ |
---|