[b96254f] | 1 | /** |
---|
[27f071cd] | 2 | * @file |
---|
[21242c2] | 3 | * |
---|
[9ab091e] | 4 | * @brief Table of User Defined Configuration Parameters |
---|
| 5 | * |
---|
[21242c2] | 6 | * This include file contains the table of user defined configuration |
---|
| 7 | * parameters. |
---|
[b96254f] | 8 | */ |
---|
[28352fae] | 9 | |
---|
[b96254f] | 10 | /* |
---|
[e6c87f7] | 11 | * COPYRIGHT (c) 1989-2014. |
---|
[ac7d5ef0] | 12 | * On-Line Applications Research Corporation (OAR). |
---|
| 13 | * |
---|
[98e4ebf5] | 14 | * The license and distribution terms for this file may be |
---|
| 15 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 16 | * http://www.rtems.org/license/LICENSE. |
---|
[ac7d5ef0] | 17 | */ |
---|
| 18 | |
---|
[092f142a] | 19 | #ifndef _RTEMS_CONFIG_H |
---|
| 20 | #define _RTEMS_CONFIG_H |
---|
[ac7d5ef0] | 21 | |
---|
| 22 | #ifdef __cplusplus |
---|
| 23 | extern "C" { |
---|
| 24 | #endif |
---|
| 25 | |
---|
[f4a8ee1] | 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 | * |
---|
[352c9b2] | 30 | * Use the macro to define the resource unlimited before placing in |
---|
| 31 | * the configuration table. |
---|
[f4a8ee1] | 32 | */ |
---|
| 33 | |
---|
| 34 | #include <rtems/score/object.h> |
---|
| 35 | #define RTEMS_UNLIMITED_OBJECTS OBJECTS_UNLIMITED_OBJECTS |
---|
[8486081] | 36 | |
---|
[f4a8ee1] | 37 | #define rtems_resource_unlimited(resource) \ |
---|
| 38 | ( resource | RTEMS_UNLIMITED_OBJECTS ) |
---|
[8486081] | 39 | |
---|
[5eb434e] | 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 | |
---|
[2eba45d] | 46 | /* |
---|
| 47 | * This is kind of kludgy but it allows targets to totally ignore the |
---|
[1a5f4bc7] | 48 | * optional APIs like POSIX safely. |
---|
[2eba45d] | 49 | */ |
---|
| 50 | |
---|
| 51 | #ifdef RTEMS_POSIX_API |
---|
[e6d4b1d] | 52 | #include <rtems/posix/config.h> |
---|
[2eba45d] | 53 | #else |
---|
| 54 | typedef void *posix_api_configuration_table; |
---|
| 55 | #endif |
---|
| 56 | |
---|
[e6d4b1d] | 57 | #include <rtems/rtems/config.h> |
---|
| 58 | |
---|
[3a4ae6c] | 59 | #include <rtems/extension.h> |
---|
[97e2729d] | 60 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[5e9b32b] | 61 | #include <rtems/score/mpci.h> |
---|
[97e2729d] | 62 | #endif |
---|
[ac7d5ef0] | 63 | |
---|
[976162a6] | 64 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 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 | */ |
---|
[3a4ae6c] | 71 | typedef struct { |
---|
[c2564b6c] | 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; |
---|
[976162a6] | 80 | |
---|
[27f071cd] | 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. |
---|
[976162a6] | 85 | */ |
---|
| 86 | uint32_t extra_mpci_receive_server_stack; |
---|
| 87 | |
---|
[c2564b6c] | 88 | /** This is a pointer to User/BSP provided MPCI Table. */ |
---|
| 89 | rtems_mpci_table *User_mpci_table; |
---|
[3a4ae6c] | 90 | } rtems_multiprocessing_table; |
---|
[976162a6] | 91 | #endif |
---|
[ac7d5ef0] | 92 | |
---|
[9fa3cf0d] | 93 | /** |
---|
| 94 | * @brief Task stack allocator initialization hook. |
---|
| 95 | * |
---|
[27f071cd] | 96 | * @param[in] stack_space_size is the size of the stack space in bytes. |
---|
[9fa3cf0d] | 97 | */ |
---|
| 98 | typedef void (*rtems_stack_allocate_init_hook)( size_t stack_space_size ); |
---|
| 99 | |
---|
| 100 | /** |
---|
| 101 | * @brief Task stack allocator hook. |
---|
| 102 | * |
---|
[27f071cd] | 103 | * @param[in] stack_size is the Size of the task stack in bytes. |
---|
[9fa3cf0d] | 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 | * |
---|
[27f071cd] | 113 | * @param[in] addr is a pointer to previously allocated task stack. |
---|
[9fa3cf0d] | 114 | */ |
---|
| 115 | typedef void (*rtems_stack_free_hook)( void *addr ); |
---|
| 116 | |
---|
[ac7d5ef0] | 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 |
---|
[e6d4b1d] | 126 | * + required number of each object type for each API configured |
---|
[ac7d5ef0] | 127 | */ |
---|
[3a4ae6c] | 128 | typedef struct { |
---|
[27f071cd] | 129 | /** |
---|
| 130 | * This field specifies the size in bytes of the RTEMS Workspace. |
---|
[ecf0f4c] | 131 | */ |
---|
[7f12879] | 132 | uintptr_t work_space_size; |
---|
[ecf0f4c] | 133 | |
---|
[27f071cd] | 134 | /** |
---|
| 135 | * This field specifies the size in bytes of the RTEMS thread stack space. |
---|
[b4f635e] | 136 | */ |
---|
| 137 | uintptr_t stack_space_size; |
---|
| 138 | |
---|
[27f071cd] | 139 | /** |
---|
| 140 | * This field specifies the maximum number of dynamically installed |
---|
| 141 | * used extensions. |
---|
[ecf0f4c] | 142 | */ |
---|
[ff3f8c85] | 143 | uint32_t maximum_extensions; |
---|
[ecf0f4c] | 144 | |
---|
[e6c87f7] | 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 | |
---|
[27f071cd] | 161 | /** |
---|
| 162 | * This field specifies the number of microseconds which elapse |
---|
| 163 | * between clock ticks. This is the basis for RTEMS timing. |
---|
[ecf0f4c] | 164 | */ |
---|
[ff3f8c85] | 165 | uint32_t microseconds_per_tick; |
---|
[ecf0f4c] | 166 | |
---|
[27f071cd] | 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. |
---|
[50fc8f6] | 172 | */ |
---|
| 173 | uint32_t nanoseconds_per_tick; |
---|
| 174 | |
---|
[27f071cd] | 175 | /** |
---|
| 176 | * This field specifies the number of ticks in each task's timeslice. |
---|
[ecf0f4c] | 177 | */ |
---|
[ff3f8c85] | 178 | uint32_t ticks_per_timeslice; |
---|
[976162a6] | 179 | |
---|
[27f071cd] | 180 | /** |
---|
| 181 | * This element points to the BSP's optional idle task which may override |
---|
| 182 | * the default one provided with RTEMS. |
---|
[976162a6] | 183 | */ |
---|
[ccd5434] | 184 | void *(*idle_task)( uintptr_t ); |
---|
[976162a6] | 185 | |
---|
[27f071cd] | 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. |
---|
[976162a6] | 190 | */ |
---|
| 191 | uint32_t idle_task_stack_size; |
---|
| 192 | |
---|
[27f071cd] | 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. |
---|
[6aa25da] | 197 | */ |
---|
| 198 | uint32_t interrupt_stack_size; |
---|
| 199 | |
---|
[9fa3cf0d] | 200 | /** |
---|
| 201 | * @brief Optional task stack allocator initialization hook. |
---|
[976162a6] | 202 | */ |
---|
[9fa3cf0d] | 203 | rtems_stack_allocate_init_hook stack_allocate_init_hook; |
---|
[976162a6] | 204 | |
---|
[9fa3cf0d] | 205 | /** |
---|
| 206 | * @brief Optional task stack allocator hook. |
---|
[976162a6] | 207 | */ |
---|
[9fa3cf0d] | 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; |
---|
[976162a6] | 214 | |
---|
[27f071cd] | 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. |
---|
[976162a6] | 220 | */ |
---|
[484a769] | 221 | bool do_zero_of_workspace; |
---|
[976162a6] | 222 | |
---|
[b4f635e] | 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 | |
---|
[f913c79] | 240 | #ifdef RTEMS_SMP |
---|
| 241 | bool smp_enabled; |
---|
| 242 | #endif |
---|
| 243 | |
---|
[ff3f8c85] | 244 | uint32_t number_of_initial_extensions; |
---|
[2195fd27] | 245 | const rtems_extensions_table *User_extension_table; |
---|
[aac75d3b] | 246 | #if defined(RTEMS_MULTIPROCESSING) |
---|
| 247 | rtems_multiprocessing_table *User_multiprocessing_table; |
---|
| 248 | #endif |
---|
[6c2eedc] | 249 | #ifdef RTEMS_SMP |
---|
| 250 | uint32_t maximum_processors; |
---|
| 251 | #endif |
---|
[3a4ae6c] | 252 | } rtems_configuration_table; |
---|
[ac7d5ef0] | 253 | |
---|
[aac75d3b] | 254 | /** |
---|
[27f071cd] | 255 | * This is the configuration table generated by confdefs.h. |
---|
[ac7d5ef0] | 256 | */ |
---|
[ae4f125e] | 257 | extern const rtems_configuration_table Configuration; |
---|
[ac7d5ef0] | 258 | |
---|
[f16ea90] | 259 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[aac75d3b] | 260 | /** |
---|
[27f071cd] | 261 | * This points to the multiprocessing configuration table. |
---|
[aac75d3b] | 262 | */ |
---|
[8ca372e] | 263 | extern rtems_multiprocessing_table *_Configuration_MP_table; |
---|
[f16ea90] | 264 | #endif |
---|
[ac7d5ef0] | 265 | |
---|
[584ab9e] | 266 | #if defined(RTEMS_MULTIPROCESSING) |
---|
| 267 | /** |
---|
[27f071cd] | 268 | * @brief RTEMS multiprocessing configuration table. |
---|
[584ab9e] | 269 | * |
---|
[27f071cd] | 270 | * This is the RTEMS Multiprocessing Configuration Table expected to |
---|
| 271 | * be generated by confdefs.h. |
---|
[584ab9e] | 272 | */ |
---|
[8ca372e] | 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; |
---|
[584ab9e] | 281 | #endif |
---|
| 282 | |
---|
| 283 | |
---|
[f817b02] | 284 | /* |
---|
| 285 | * Some handy macros to avoid dependencies on either the BSP |
---|
| 286 | * or the exact format of the configuration table. |
---|
| 287 | */ |
---|
| 288 | |
---|
[b4f635e] | 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 | |
---|
[f817b02] | 298 | #define rtems_configuration_get_work_space_size() \ |
---|
[b4f635e] | 299 | (Configuration.work_space_size + \ |
---|
| 300 | (rtems_configuration_get_stack_allocator_avoids_work_space() ? \ |
---|
| 301 | 0 : rtems_configuration_get_stack_space_size())) |
---|
| 302 | |
---|
[f817b02] | 303 | #define rtems_configuration_get_maximum_extensions() \ |
---|
[aac75d3b] | 304 | (Configuration.maximum_extensions) |
---|
[f817b02] | 305 | |
---|
| 306 | #define rtems_configuration_get_microseconds_per_tick() \ |
---|
[aac75d3b] | 307 | (Configuration.microseconds_per_tick) |
---|
[f817b02] | 308 | #define rtems_configuration_get_milliseconds_per_tick() \ |
---|
[aac75d3b] | 309 | (Configuration.microseconds_per_tick / 1000) |
---|
[2b9968a] | 310 | #define rtems_configuration_get_nanoseconds_per_tick() \ |
---|
[50fc8f6] | 311 | (Configuration.nanoseconds_per_tick) |
---|
[f817b02] | 312 | |
---|
| 313 | #define rtems_configuration_get_ticks_per_timeslice() \ |
---|
[aac75d3b] | 314 | (Configuration.ticks_per_timeslice) |
---|
[f817b02] | 315 | |
---|
[113e8512] | 316 | #define rtems_configuration_get_idle_task() \ |
---|
[aac75d3b] | 317 | (Configuration.idle_task) |
---|
[113e8512] | 318 | |
---|
| 319 | #define rtems_configuration_get_idle_task_stack_size() \ |
---|
[aac75d3b] | 320 | (Configuration.idle_task_stack_size) |
---|
[113e8512] | 321 | |
---|
[6aa25da] | 322 | #define rtems_configuration_get_interrupt_stack_size() \ |
---|
[9124a69e] | 323 | (Configuration.interrupt_stack_size) |
---|
[6aa25da] | 324 | |
---|
[9fa3cf0d] | 325 | #define rtems_configuration_get_stack_allocate_init_hook() \ |
---|
| 326 | (Configuration.stack_allocate_init_hook) |
---|
| 327 | |
---|
[113e8512] | 328 | #define rtems_configuration_get_stack_allocate_hook() \ |
---|
[aac75d3b] | 329 | (Configuration.stack_allocate_hook) |
---|
[113e8512] | 330 | |
---|
| 331 | #define rtems_configuration_get_stack_free_hook() \ |
---|
[aac75d3b] | 332 | (Configuration.stack_free_hook) |
---|
[28352fae] | 333 | |
---|
[27f071cd] | 334 | /** |
---|
[976162a6] | 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() \ |
---|
[aac75d3b] | 339 | (Configuration.do_zero_of_workspace) |
---|
[976162a6] | 340 | |
---|
[f817b02] | 341 | #define rtems_configuration_get_number_of_initial_extensions() \ |
---|
[aac75d3b] | 342 | (Configuration.number_of_initial_extensions) |
---|
[f817b02] | 343 | |
---|
| 344 | #define rtems_configuration_get_user_extension_table() \ |
---|
[35693ae2] | 345 | (Configuration.User_extension_table) |
---|
[f817b02] | 346 | |
---|
[6aa25da] | 347 | #if defined(RTEMS_MULTIPROCESSING) |
---|
| 348 | #define rtems_configuration_get_user_multiprocessing_table() \ |
---|
[b4f635e] | 349 | (Configuration.User_multiprocessing_table) |
---|
[6aa25da] | 350 | #else |
---|
[b4f635e] | 351 | #define rtems_configuration_get_user_multiprocessing_table() \ |
---|
| 352 | NULL |
---|
[6aa25da] | 353 | #endif |
---|
[f817b02] | 354 | |
---|
[f913c79] | 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 | |
---|
[6c2eedc] | 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 | * |
---|
[f913c79] | 379 | * On single-processor configurations this is a compile time constant which |
---|
| 380 | * evaluates to one. |
---|
| 381 | * |
---|
[6c2eedc] | 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 | |
---|
[f817b02] | 392 | #define rtems_configuration_get_rtems_api_configuration() \ |
---|
[aac75d3b] | 393 | (&Configuration_RTEMS_API) |
---|
[f817b02] | 394 | |
---|
| 395 | #define rtems_configuration_get_posix_api_configuration() \ |
---|
[aac75d3b] | 396 | (&Configuration_POSIX_API) |
---|
[f817b02] | 397 | |
---|
[ac7d5ef0] | 398 | #ifdef __cplusplus |
---|
| 399 | } |
---|
| 400 | #endif |
---|
| 401 | |
---|
| 402 | #endif |
---|
| 403 | /* end of include file */ |
---|