source: rtems/cpukit/sapi/include/rtems/config.h @ 6bf44a5

5
Last change on this file since 6bf44a5 was ccd5434, checked in by Sebastian Huber <sebastian.huber@…>, on 01/07/16 at 08:55:45

score: Introduce Thread_Entry_information

This avoids potential dead code in _Thread_Handler(). It gets rid of
the dangerous function pointer casts.

Update #2514.

  • Property mode set to 100644
File size: 11.6 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#ifdef __cplusplus
23extern "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
54typedef 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 */
71typedef 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 */
98typedef 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 */
108typedef 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 */
115typedef 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 */
128typedef 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 */
257extern const rtems_configuration_table Configuration;
258
259#if defined(RTEMS_MULTIPROCESSING)
260  /**
261   *  This points to the multiprocessing configuration table.
262   */
263  SAPI_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#endif
275
276
277/*
278 *  Some handy macros to avoid dependencies on either the BSP
279 *  or the exact format of the configuration table.
280 */
281
282#define rtems_configuration_get_unified_work_area() \
283        (Configuration.unified_work_area)
284
285#define rtems_configuration_get_stack_allocator_avoids_work_space() \
286        (Configuration.stack_allocator_avoids_work_space)
287
288#define rtems_configuration_get_stack_space_size() \
289        (Configuration.stack_space_size)
290
291#define rtems_configuration_get_work_space_size() \
292        (Configuration.work_space_size + \
293          (rtems_configuration_get_stack_allocator_avoids_work_space() ? \
294            0 : rtems_configuration_get_stack_space_size()))
295
296#define rtems_configuration_get_maximum_extensions() \
297        (Configuration.maximum_extensions)
298
299#define rtems_configuration_get_microseconds_per_tick() \
300        (Configuration.microseconds_per_tick)
301#define rtems_configuration_get_milliseconds_per_tick() \
302        (Configuration.microseconds_per_tick / 1000)
303#define rtems_configuration_get_nanoseconds_per_tick() \
304        (Configuration.nanoseconds_per_tick)
305
306#define rtems_configuration_get_ticks_per_timeslice() \
307        (Configuration.ticks_per_timeslice)
308
309#define rtems_configuration_get_idle_task() \
310        (Configuration.idle_task)
311
312#define rtems_configuration_get_idle_task_stack_size() \
313        (Configuration.idle_task_stack_size)
314
315#define rtems_configuration_get_interrupt_stack_size() \
316        (Configuration.interrupt_stack_size)
317
318#define rtems_configuration_get_stack_allocate_init_hook() \
319        (Configuration.stack_allocate_init_hook)
320
321#define rtems_configuration_get_stack_allocate_hook() \
322        (Configuration.stack_allocate_hook)
323
324#define rtems_configuration_get_stack_free_hook() \
325        (Configuration.stack_free_hook)
326
327 /**
328  * This macro assists in accessing the field which indicates whether
329  * RTEMS is responsible for zeroing the Executive Workspace.
330  */
331#define rtems_configuration_get_do_zero_of_workspace() \
332   (Configuration.do_zero_of_workspace)
333
334#define rtems_configuration_get_number_of_initial_extensions() \
335        (Configuration.number_of_initial_extensions)
336
337#define rtems_configuration_get_user_extension_table() \
338        (Configuration.User_extension_table)
339
340#if defined(RTEMS_MULTIPROCESSING)
341  #define rtems_configuration_get_user_multiprocessing_table() \
342        (Configuration.User_multiprocessing_table)
343#else
344  #define rtems_configuration_get_user_multiprocessing_table() \
345        NULL
346#endif
347
348/**
349 * @brief Returns true if the SMP mode of operation is enabled, and false
350 * otherwise.
351 *
352 * On single-processor configurations this is a compile time constant which
353 * evaluates to false.
354 *
355 * @retval true SMP mode of operation is enabled.
356 * @retval false Otherwise.
357 */
358#ifdef RTEMS_SMP
359  #define rtems_configuration_is_smp_enabled() \
360        (Configuration.smp_enabled)
361#else
362  #define rtems_configuration_is_smp_enabled() \
363        false
364#endif
365
366/**
367 * @brief Returns the configured maximum count of processors.
368 *
369 * The actual number of processors available for the application will be less
370 * than or equal to the configured maximum count of processors.
371 *
372 * On single-processor configurations this is a compile time constant which
373 * evaluates to one.
374 *
375 * @return The configured maximum count of processors.
376 */
377#ifdef RTEMS_SMP
378  #define rtems_configuration_get_maximum_processors() \
379        (Configuration.maximum_processors)
380#else
381  #define rtems_configuration_get_maximum_processors() \
382        1
383#endif
384
385#define rtems_configuration_get_rtems_api_configuration() \
386        (&Configuration_RTEMS_API)
387
388#define rtems_configuration_get_posix_api_configuration() \
389        (&Configuration_POSIX_API)
390
391#ifdef __cplusplus
392}
393#endif
394
395#endif
396/* end of include file */
Note: See TracBrowser for help on using the repository browser.