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 | /* |
---|
23 | * Unlimited object support. Changes the configuration table entry for POSIX |
---|
24 | * or RTEMS APIs to bounded only by the memory of the work-space. |
---|
25 | * |
---|
26 | * Use the macro to define the resource unlimited before placing in |
---|
27 | * the configuration table. |
---|
28 | */ |
---|
29 | |
---|
30 | #include <rtems/score/object.h> |
---|
31 | #include <rtems/score/isr.h> |
---|
32 | #include <rtems/score/memory.h> |
---|
33 | #include <rtems/score/stack.h> |
---|
34 | #include <rtems/score/userextdata.h> |
---|
35 | #include <rtems/score/watchdogticks.h> |
---|
36 | #include <rtems/rtems/config.h> |
---|
37 | #include <rtems/extension.h> |
---|
38 | #if defined(RTEMS_MULTIPROCESSING) |
---|
39 | #include <rtems/rtems/types.h> |
---|
40 | #endif |
---|
41 | |
---|
42 | #ifdef __cplusplus |
---|
43 | extern "C" { |
---|
44 | #endif |
---|
45 | |
---|
46 | #define RTEMS_UNLIMITED_OBJECTS OBJECTS_UNLIMITED_OBJECTS |
---|
47 | |
---|
48 | #define rtems_resource_unlimited(resource) \ |
---|
49 | ( resource | RTEMS_UNLIMITED_OBJECTS ) |
---|
50 | |
---|
51 | #define rtems_resource_is_unlimited(resource) \ |
---|
52 | _Objects_Is_unlimited(resource) |
---|
53 | |
---|
54 | #define rtems_resource_maximum_per_allocation(resource) \ |
---|
55 | _Objects_Maximum_per_allocation(resource) |
---|
56 | |
---|
57 | /** |
---|
58 | * @copydoc Stack_Allocator_initialize |
---|
59 | */ |
---|
60 | typedef Stack_Allocator_initialize rtems_stack_allocate_init_hook; |
---|
61 | |
---|
62 | /** |
---|
63 | * @copydoc Stack_Allocator_allocate |
---|
64 | */ |
---|
65 | typedef Stack_Allocator_allocate rtems_stack_allocate_hook; |
---|
66 | |
---|
67 | /** |
---|
68 | * @copydoc Stack_Allocator_free |
---|
69 | */ |
---|
70 | typedef Stack_Allocator_free rtems_stack_free_hook; |
---|
71 | |
---|
72 | /* |
---|
73 | * The following records define the Configuration Table. The |
---|
74 | * information contained in this table is required in all |
---|
75 | * RTEMS systems, whether single or multiprocessor. This |
---|
76 | * table primarily defines the following: |
---|
77 | * |
---|
78 | * + location and size of the RTEMS Workspace |
---|
79 | * + microseconds per clock tick |
---|
80 | * + clock ticks per task timeslice |
---|
81 | * + required number of each object type for each API configured |
---|
82 | */ |
---|
83 | typedef struct { |
---|
84 | /** |
---|
85 | * This field specifies the size in bytes of the RTEMS Workspace. |
---|
86 | */ |
---|
87 | uintptr_t work_space_size; |
---|
88 | |
---|
89 | /** |
---|
90 | * This field specifies the number of microseconds which elapse |
---|
91 | * between clock ticks. This is the basis for RTEMS timing. |
---|
92 | */ |
---|
93 | uint32_t microseconds_per_tick; |
---|
94 | |
---|
95 | /** |
---|
96 | * This field specifies the number of ticks in each task's timeslice. |
---|
97 | */ |
---|
98 | uint32_t ticks_per_timeslice; |
---|
99 | |
---|
100 | /** |
---|
101 | * This element points to the BSP's optional idle task which may override |
---|
102 | * the default one provided with RTEMS. |
---|
103 | */ |
---|
104 | void *(*idle_task)( uintptr_t ); |
---|
105 | |
---|
106 | /** |
---|
107 | * This field specifies the size of the IDLE task's stack. If less than or |
---|
108 | * equal to the minimum stack size, then the IDLE task will have the minimum |
---|
109 | * stack size. |
---|
110 | */ |
---|
111 | uint32_t idle_task_stack_size; |
---|
112 | |
---|
113 | /** |
---|
114 | * @brief Specifies if a unified work area is used or not. |
---|
115 | * |
---|
116 | * If this element is @a true, then the RTEMS Workspace and the C Program |
---|
117 | * Heap use the same heap, otherwise they use separate heaps. |
---|
118 | */ |
---|
119 | bool unified_work_area; |
---|
120 | |
---|
121 | #ifdef RTEMS_SMP |
---|
122 | bool smp_enabled; |
---|
123 | #endif |
---|
124 | |
---|
125 | #ifdef RTEMS_SMP |
---|
126 | uint32_t maximum_processors; |
---|
127 | #endif |
---|
128 | } rtems_configuration_table; |
---|
129 | |
---|
130 | /** |
---|
131 | * This is the configuration table generated by confdefs.h. |
---|
132 | */ |
---|
133 | extern const rtems_configuration_table Configuration; |
---|
134 | |
---|
135 | /* |
---|
136 | * Some handy macros to avoid dependencies on either the BSP |
---|
137 | * or the exact format of the configuration table. |
---|
138 | */ |
---|
139 | |
---|
140 | #define rtems_configuration_get_unified_work_area() \ |
---|
141 | (Configuration.unified_work_area) |
---|
142 | |
---|
143 | /** |
---|
144 | * @brief Return if the stack allocator avoids the work space. |
---|
145 | * |
---|
146 | * @retval true The stack allocator must not allocate the thread stacks from the |
---|
147 | * RTEMS Workspace |
---|
148 | * |
---|
149 | * @retval false The stack allocator should allocate the thread stacks from the |
---|
150 | * RTEMS Workspace. |
---|
151 | */ |
---|
152 | #define rtems_configuration_get_stack_allocator_avoids_work_space() \ |
---|
153 | (_Stack_Allocator_avoids_workspace) |
---|
154 | |
---|
155 | uintptr_t rtems_configuration_get_stack_space_size( void ); |
---|
156 | |
---|
157 | #define rtems_configuration_get_work_space_size() \ |
---|
158 | (Configuration.work_space_size + \ |
---|
159 | (rtems_configuration_get_stack_allocator_avoids_work_space() ? \ |
---|
160 | 0 : rtems_configuration_get_stack_space_size())) |
---|
161 | |
---|
162 | uint32_t rtems_configuration_get_maximum_extensions( void ); |
---|
163 | |
---|
164 | #define rtems_configuration_get_microseconds_per_tick() \ |
---|
165 | (Configuration.microseconds_per_tick) |
---|
166 | #define rtems_configuration_get_milliseconds_per_tick() \ |
---|
167 | (Configuration.microseconds_per_tick / 1000) |
---|
168 | #define rtems_configuration_get_nanoseconds_per_tick() \ |
---|
169 | (_Watchdog_Nanoseconds_per_tick) |
---|
170 | |
---|
171 | #define rtems_configuration_get_ticks_per_timeslice() \ |
---|
172 | (Configuration.ticks_per_timeslice) |
---|
173 | |
---|
174 | #define rtems_configuration_get_idle_task() \ |
---|
175 | (Configuration.idle_task) |
---|
176 | |
---|
177 | #define rtems_configuration_get_idle_task_stack_size() \ |
---|
178 | (Configuration.idle_task_stack_size) |
---|
179 | |
---|
180 | #define rtems_configuration_get_interrupt_stack_size() \ |
---|
181 | ((size_t) _ISR_Stack_size) |
---|
182 | |
---|
183 | #define rtems_configuration_get_stack_allocate_init_hook() \ |
---|
184 | (_Stack_Allocator_initialize) |
---|
185 | |
---|
186 | #define rtems_configuration_get_stack_allocate_hook() \ |
---|
187 | (_Stack_Allocator_allocate) |
---|
188 | |
---|
189 | #define rtems_configuration_get_stack_free_hook() \ |
---|
190 | (_Stack_Allocator_free) |
---|
191 | |
---|
192 | /** |
---|
193 | * This macro assists in accessing the field which indicates whether |
---|
194 | * RTEMS is responsible for zeroing the Executive Workspace. |
---|
195 | */ |
---|
196 | #define rtems_configuration_get_do_zero_of_workspace() \ |
---|
197 | _Memory_Zero_before_use |
---|
198 | |
---|
199 | #define rtems_configuration_get_number_of_initial_extensions() \ |
---|
200 | ((uint32_t) _User_extensions_Initial_count) |
---|
201 | |
---|
202 | #define rtems_configuration_get_user_extension_table() \ |
---|
203 | (&_User_extensions_Initial_extensions[ 0 ]) |
---|
204 | |
---|
205 | #if defined(RTEMS_MULTIPROCESSING) |
---|
206 | #define rtems_configuration_get_user_multiprocessing_table() \ |
---|
207 | (&_MPCI_Configuration) |
---|
208 | #else |
---|
209 | #define rtems_configuration_get_user_multiprocessing_table() \ |
---|
210 | NULL |
---|
211 | #endif |
---|
212 | |
---|
213 | /** |
---|
214 | * @brief Returns true if the SMP mode of operation is enabled, and false |
---|
215 | * otherwise. |
---|
216 | * |
---|
217 | * In uni-processor configurations this is a compile-time constant which |
---|
218 | * evaluates to false. |
---|
219 | * |
---|
220 | * @retval true SMP mode of operation is enabled. |
---|
221 | * @retval false Otherwise. |
---|
222 | */ |
---|
223 | #ifdef RTEMS_SMP |
---|
224 | #define rtems_configuration_is_smp_enabled() \ |
---|
225 | (Configuration.smp_enabled) |
---|
226 | #else |
---|
227 | #define rtems_configuration_is_smp_enabled() \ |
---|
228 | false |
---|
229 | #endif |
---|
230 | |
---|
231 | /** |
---|
232 | * @brief Returns the configured maximum count of processors. |
---|
233 | * |
---|
234 | * The actual number of processors available for the application will be less |
---|
235 | * than or equal to the configured maximum count of processors. |
---|
236 | * |
---|
237 | * On single-processor configurations this is a compile time constant which |
---|
238 | * evaluates to one. |
---|
239 | * |
---|
240 | * @return The configured maximum count of processors. |
---|
241 | */ |
---|
242 | #ifdef RTEMS_SMP |
---|
243 | #define rtems_configuration_get_maximum_processors() \ |
---|
244 | (Configuration.maximum_processors) |
---|
245 | #else |
---|
246 | #define rtems_configuration_get_maximum_processors() \ |
---|
247 | 1 |
---|
248 | #endif |
---|
249 | |
---|
250 | #ifdef __cplusplus |
---|
251 | } |
---|
252 | #endif |
---|
253 | |
---|
254 | #endif |
---|
255 | /* end of include file */ |
---|