source: rtems/cpukit/sapi/include/rtems/config.h @ 9ab091e

4.115
Last change on this file since 9ab091e was 9ab091e, checked in by Mathew Kallada <matkallada@…>, on 12/28/12 at 16:35:32

Header File Doxygen Enhancement Task #2

  • Property mode set to 100644
File size: 10.4 KB
Line 
1/**
2 * @file rtems/config.h
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-2011.
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.com/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#include <rtems/io.h>
61#if defined(RTEMS_MULTIPROCESSING)
62#include <rtems/score/mpci.h>
63#endif
64
65#if defined(RTEMS_MULTIPROCESSING)
66/*
67 *  The following records define the Multiprocessor Configuration
68 *  Table.  This table defines the multiprocessor system
69 *  characteristics which must be known by RTEMS in a multiprocessor
70 *  system.
71 */
72typedef struct {
73  /** This is the local node number. */
74  uint32_t            node;
75  /** This is the maximum number of nodes in system. */
76  uint32_t            maximum_nodes;
77  /** This is the maximum number of global objects. */
78  uint32_t            maximum_global_objects;
79  /** This is the maximum number of proxies. */
80  uint32_t            maximum_proxies;
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 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 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 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  /** This field specifies the size in bytes of the RTEMS Workspace.
130   */
131  uintptr_t                      work_space_size;
132
133  /** This field specifies the size in bytes of the RTEMS thread stack space.
134   */
135  uintptr_t                      stack_space_size;
136
137  /** This field specifies the maximum number of dynamically installed
138   *  used extensions.
139   */
140  uint32_t                       maximum_extensions;
141
142  /** This field specifies the number of microseconds which elapse
143   *  between clock ticks.  This is the basis for RTEMS timing.
144   */
145  uint32_t                       microseconds_per_tick;
146
147  /** This field specifies the number of nanoseconds which elapse
148   *  between clock ticks.  This value is derived from the
149   *  microseconds_per_tick field and provided to avoid calculation at
150   *  run-time.
151   */
152  uint32_t                       nanoseconds_per_tick;
153
154  /** This field specifies the number of ticks in each task's timeslice.
155   */
156  uint32_t                       ticks_per_timeslice;
157
158  /** This element points to the BSP's optional idle task which may override
159   *  the default one provided with RTEMS.
160   */
161  Thread                       (*idle_task)( uintptr_t );
162
163  /** This field specifies the size of the IDLE task's stack.  If less than or
164   *  equal to the minimum stack size, then the IDLE task will have the minimum
165   *  stack size.
166   */
167  uint32_t                       idle_task_stack_size;
168
169  /** This field specifies the size of the interrupt stack.  If less than or
170   *  equal to the minimum stack size, then the interrupt stack will be of
171   *  minimum stack size.
172   */
173  uint32_t                       interrupt_stack_size;
174
175  /**
176   * @brief Optional task stack allocator initialization hook.
177   */
178  rtems_stack_allocate_init_hook stack_allocate_init_hook;
179
180  /**
181   * @brief Optional task stack allocator hook.
182   */
183  rtems_stack_allocate_hook      stack_allocate_hook;
184
185  /**
186   * @brief Optional task stack free hook.
187   */
188  rtems_stack_free_hook          stack_free_hook;
189
190  /** If this element is TRUE, then RTEMS will zero the Executive Workspace.
191   *  When this element is FALSE, it is assumed that the BSP or invoking
192   *  environment has ensured that memory was cleared before RTEMS was
193   *  invoked.
194   */
195  bool                           do_zero_of_workspace;
196
197  /**
198   * @brief Specifies if a unified work area is used or not.
199   *
200   * If this element is @a true, then the RTEMS Workspace and the C Program
201   * Heap use the same heap, otherwise they use separate heaps.
202   */
203  bool                           unified_work_area;
204
205  /**
206   * @brief Specifies if the stack allocator avoids the work space.
207   *
208   * If this element is @a true, then the stack allocator must not allocate the
209   * thread stacks from the RTEMS Workspace, otherwise it should allocate the
210   * thread stacks from the RTEMS Workspace.
211   */
212  bool                           stack_allocator_avoids_work_space;
213
214  uint32_t                       maximum_drivers;
215  uint32_t                       number_of_device_drivers;
216  rtems_driver_address_table    *Device_driver_table;
217  uint32_t                       number_of_initial_extensions;
218  const rtems_extensions_table  *User_extension_table;
219  #if defined(RTEMS_MULTIPROCESSING)
220    rtems_multiprocessing_table   *User_multiprocessing_table;
221  #endif
222} rtems_configuration_table;
223
224/**
225 *   This is the configuration table generated by confdefs.h.
226 */
227extern const rtems_configuration_table Configuration;
228
229#if defined(RTEMS_MULTIPROCESSING)
230  /**
231   *   This points to the multiprocessing configuration table.
232   */
233  SAPI_EXTERN rtems_multiprocessing_table  *_Configuration_MP_table;
234#endif
235
236#if defined(RTEMS_MULTIPROCESSING)
237  /**
238   *  @brief RTEMS Multiprocessing Configuration Table
239   *
240   *  This is the RTEMS Multiprocessing Configuration Table expected to
241   *  be generated by confdefs.h.
242   */
243  extern rtems_multiprocessing_table  Multiprocessing_configuration;
244#endif
245
246
247/*
248 *  Some handy macros to avoid dependencies on either the BSP
249 *  or the exact format of the configuration table.
250 */
251
252#define rtems_configuration_get_unified_work_area() \
253        (Configuration.unified_work_area)
254
255#define rtems_configuration_get_stack_allocator_avoids_work_space() \
256        (Configuration.stack_allocator_avoids_work_space)
257
258#define rtems_configuration_get_stack_space_size() \
259        (Configuration.stack_space_size)
260
261#define rtems_configuration_get_work_space_size() \
262        (Configuration.work_space_size + \
263          (rtems_configuration_get_stack_allocator_avoids_work_space() ? \
264            0 : rtems_configuration_get_stack_space_size()))
265
266#define rtems_configuration_get_maximum_extensions() \
267        (Configuration.maximum_extensions)
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        (Configuration.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        (Configuration.interrupt_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_maximum_drivers() \
305        (Configuration.maximum_drivers)
306
307#define rtems_configuration_get_number_of_device_drivers() \
308        (Configuration.number_of_device_drivers)
309
310#define rtems_configuration_get_device_driver_table() \
311        (Configuration.Device_driver_table)
312
313#define rtems_configuration_get_number_of_initial_extensions() \
314        (Configuration.number_of_initial_extensions)
315
316#define rtems_configuration_get_user_extension_table() \
317        (Configuration.User_extension_table)
318
319#if defined(RTEMS_MULTIPROCESSING)
320  #define rtems_configuration_get_user_multiprocessing_table() \
321        (Configuration.User_multiprocessing_table)
322#else
323  #define rtems_configuration_get_user_multiprocessing_table() \
324        NULL
325#endif
326
327#define rtems_configuration_get_rtems_api_configuration() \
328        (&Configuration_RTEMS_API)
329
330#define rtems_configuration_get_posix_api_configuration() \
331        (&Configuration_POSIX_API)
332
333#ifdef __cplusplus
334}
335#endif
336
337#endif
338/* end of include file */
Note: See TracBrowser for help on using the repository browser.