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