source: rtems/cpukit/include/rtems/config.h @ 21275b58

Last change on this file since 21275b58 was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 22, 2018 at 6:14:51 PM

score: Static Objects_Information initialization

Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.

  • Property mode set to 100644
File size: 10.8 KB
Line 
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/watchdogticks.h>
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
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#define RTEMS_UNLIMITED_OBJECTS OBJECTS_UNLIMITED_OBJECTS
45
46#define rtems_resource_unlimited(resource) \
47  ( resource | RTEMS_UNLIMITED_OBJECTS )
48
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
55#if defined(RTEMS_MULTIPROCESSING)
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 */
62typedef struct {
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;
71
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.
76   */
77  uint32_t            extra_mpci_receive_server_stack;
78
79  /** This is a pointer to User/BSP provided MPCI Table. */
80  rtems_mpci_table   *User_mpci_table;
81} rtems_multiprocessing_table;
82#endif
83
84/**
85 * @brief Task stack allocator initialization hook.
86 *
87 * @param[in] stack_space_size is the size of the stack space in bytes.
88 */
89typedef void (*rtems_stack_allocate_init_hook)( size_t stack_space_size );
90
91/**
92 * @brief Task stack allocator hook.
93 *
94 * @param[in] stack_size is the Size of the task stack in bytes.
95 *
96 * @retval NULL Not enough memory.
97 * @retval other Pointer to task stack.
98 */
99typedef void *(*rtems_stack_allocate_hook)( size_t stack_size );
100
101/**
102 * @brief Task stack deallocator hook.
103 *
104 * @param[in] addr is a pointer to previously allocated task stack.
105 */
106typedef void (*rtems_stack_free_hook)( void *addr );
107
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
117 *     + required number of each object type for each API configured
118 */
119typedef struct {
120  /**
121   * This field specifies the size in bytes of the RTEMS Workspace.
122   */
123  uintptr_t                      work_space_size;
124
125  /**
126   * This field specifies the size in bytes of the RTEMS thread stack space.
127   */
128  uintptr_t                      stack_space_size;
129
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
140  /**
141   * This field specifies the number of microseconds which elapse
142   * between clock ticks.  This is the basis for RTEMS timing.
143   */
144  uint32_t                       microseconds_per_tick;
145
146  /**
147   * This field specifies the number of ticks in each task's timeslice.
148   */
149  uint32_t                       ticks_per_timeslice;
150
151  /**
152   * This element points to the BSP's optional idle task which may override
153   * the default one provided with RTEMS.
154   */
155  void                        *(*idle_task)( uintptr_t );
156
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.
161   */
162  uint32_t                       idle_task_stack_size;
163
164  /**
165   * @brief Optional task stack allocator initialization hook.
166   */
167  rtems_stack_allocate_init_hook stack_allocate_init_hook;
168
169  /**
170   * @brief Optional task stack allocator hook.
171   */
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;
178
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.
184   */
185  bool                           do_zero_of_workspace;
186
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
204  #ifdef RTEMS_SMP
205    bool                         smp_enabled;
206  #endif
207
208  uint32_t                       number_of_initial_extensions;
209  const rtems_extensions_table  *User_extension_table;
210  #if defined(RTEMS_MULTIPROCESSING)
211    rtems_multiprocessing_table   *User_multiprocessing_table;
212  #endif
213  #ifdef RTEMS_SMP
214    uint32_t                     maximum_processors;
215  #endif
216} rtems_configuration_table;
217
218/**
219 * This is the configuration table generated by confdefs.h.
220 */
221extern const rtems_configuration_table Configuration;
222
223#if defined(RTEMS_MULTIPROCESSING)
224  /**
225   *  This points to the multiprocessing configuration table.
226   */
227  extern rtems_multiprocessing_table *_Configuration_MP_table;
228#endif
229
230#if defined(RTEMS_MULTIPROCESSING)
231  /**
232   * @brief RTEMS multiprocessing configuration table.
233   *
234   * This is the RTEMS Multiprocessing Configuration Table expected to
235   * be generated by confdefs.h.
236   */
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;
245#endif
246
247
248/*
249 *  Some handy macros to avoid dependencies on either the BSP
250 *  or the exact format of the configuration table.
251 */
252
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
262#define rtems_configuration_get_work_space_size() \
263        (Configuration.work_space_size + \
264          (rtems_configuration_get_stack_allocator_avoids_work_space() ? \
265            0 : rtems_configuration_get_stack_space_size()))
266
267uint32_t rtems_configuration_get_maximum_extensions( void );
268
269#define rtems_configuration_get_microseconds_per_tick() \
270        (Configuration.microseconds_per_tick)
271#define rtems_configuration_get_milliseconds_per_tick() \
272        (Configuration.microseconds_per_tick / 1000)
273#define rtems_configuration_get_nanoseconds_per_tick() \
274        (_Watchdog_Nanoseconds_per_tick)
275
276#define rtems_configuration_get_ticks_per_timeslice() \
277        (Configuration.ticks_per_timeslice)
278
279#define rtems_configuration_get_idle_task() \
280        (Configuration.idle_task)
281
282#define rtems_configuration_get_idle_task_stack_size() \
283        (Configuration.idle_task_stack_size)
284
285#define rtems_configuration_get_interrupt_stack_size() \
286        ((size_t) _ISR_Stack_size)
287
288#define rtems_configuration_get_stack_allocate_init_hook() \
289        (Configuration.stack_allocate_init_hook)
290
291#define rtems_configuration_get_stack_allocate_hook() \
292        (Configuration.stack_allocate_hook)
293
294#define rtems_configuration_get_stack_free_hook() \
295        (Configuration.stack_free_hook)
296
297 /**
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() \
302   (Configuration.do_zero_of_workspace)
303
304#define rtems_configuration_get_number_of_initial_extensions() \
305        (Configuration.number_of_initial_extensions)
306
307#define rtems_configuration_get_user_extension_table() \
308        (Configuration.User_extension_table)
309
310#if defined(RTEMS_MULTIPROCESSING)
311  #define rtems_configuration_get_user_multiprocessing_table() \
312        (Configuration.User_multiprocessing_table)
313#else
314  #define rtems_configuration_get_user_multiprocessing_table() \
315        NULL
316#endif
317
318/**
319 * @brief Returns true if the SMP mode of operation is enabled, and false
320 * otherwise.
321 *
322 * In uni-processor configurations this is a compile-time constant which
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() \
330        (Configuration.smp_enabled)
331#else
332  #define rtems_configuration_is_smp_enabled() \
333        false
334#endif
335
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 *
342 * On single-processor configurations this is a compile time constant which
343 * evaluates to one.
344 *
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
355#define rtems_configuration_get_rtems_api_configuration() \
356        (&Configuration_RTEMS_API)
357
358#define rtems_configuration_get_posix_api_configuration() \
359        (&Configuration_POSIX_API)
360
361#ifdef __cplusplus
362}
363#endif
364
365#endif
366/* end of include file */
Note: See TracBrowser for help on using the repository browser.