source: rtems/cpukit/sapi/include/rtems/config.h @ 27f071cd

4.115
Last change on this file since 27f071cd was 27f071cd, checked in by Alex Ivanov <alexivanov97@…>, on 01/08/13 at 13:13:41

sapi: Doxygen Clean Up Task #1

  • Property mode set to 100644
File size: 10.4 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-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  /**
83   * The MPCI Receive server is assumed to have a stack of at least
84   * minimum stack size.  This field specifies the amount of extra
85   * stack this task will be given in bytes.
86   */
87  uint32_t            extra_mpci_receive_server_stack;
88
89  /** This is a pointer to User/BSP provided MPCI Table. */
90  rtems_mpci_table   *User_mpci_table;
91} rtems_multiprocessing_table;
92#endif
93
94/**
95 * @brief Task stack allocator initialization hook.
96 *
97 * @param[in] stack_space_size is the size of the stack space in bytes.
98 */
99typedef void (*rtems_stack_allocate_init_hook)( size_t stack_space_size );
100
101/**
102 * @brief Task stack allocator hook.
103 *
104 * @param[in] stack_size is the Size of the task stack in bytes.
105 *
106 * @retval NULL Not enough memory.
107 * @retval other Pointer to task stack.
108 */
109typedef void *(*rtems_stack_allocate_hook)( size_t stack_size );
110
111/**
112 * @brief Task stack deallocator hook.
113 *
114 * @param[in] addr is a pointer to previously allocated task stack.
115 */
116typedef void (*rtems_stack_free_hook)( void *addr );
117
118/*
119 *  The following records define the Configuration Table.  The
120 *  information contained in this table is required in all
121 *  RTEMS systems, whether single or multiprocessor.  This
122 *  table primarily defines the following:
123 *
124 *     + location and size of the RTEMS Workspace
125 *     + microseconds per clock tick
126 *     + clock ticks per task timeslice
127 *     + required number of each object type for each API configured
128 */
129typedef struct {
130  /**
131   * This field specifies the size in bytes of the RTEMS Workspace.
132   */
133  uintptr_t                      work_space_size;
134
135  /**
136   * This field specifies the size in bytes of the RTEMS thread stack space.
137   */
138  uintptr_t                      stack_space_size;
139
140  /**
141   * This field specifies the maximum number of dynamically installed
142   * used extensions.
143   */
144  uint32_t                       maximum_extensions;
145
146  /**
147   * This field specifies the number of microseconds which elapse
148   * between clock ticks.  This is the basis for RTEMS timing.
149   */
150  uint32_t                       microseconds_per_tick;
151
152  /**
153   * This field specifies the number of nanoseconds which elapse
154   * between clock ticks.  This value is derived from the
155   * microseconds_per_tick field and provided to avoid calculation at
156   * run-time.
157   */
158  uint32_t                       nanoseconds_per_tick;
159
160  /**
161   * This field specifies the number of ticks in each task's timeslice.
162   */
163  uint32_t                       ticks_per_timeslice;
164
165  /**
166   * This element points to the BSP's optional idle task which may override
167   * the default one provided with RTEMS.
168   */
169  Thread                       (*idle_task)( uintptr_t );
170
171  /**
172   * This field specifies the size of the IDLE task's stack.  If less than or
173   * equal to the minimum stack size, then the IDLE task will have the minimum
174   * stack size.
175   */
176  uint32_t                       idle_task_stack_size;
177
178  /**
179   * This field specifies the size of the interrupt stack.  If less than or
180   * equal to the minimum stack size, then the interrupt stack will be of
181   * minimum stack size.
182   */
183  uint32_t                       interrupt_stack_size;
184
185  /**
186   * @brief Optional task stack allocator initialization hook.
187   */
188  rtems_stack_allocate_init_hook stack_allocate_init_hook;
189
190  /**
191   * @brief Optional task stack allocator hook.
192   */
193  rtems_stack_allocate_hook      stack_allocate_hook;
194
195  /**
196   * @brief Optional task stack free hook.
197   */
198  rtems_stack_free_hook          stack_free_hook;
199
200  /**
201   * If this element is TRUE, then RTEMS will zero the Executive Workspace.
202   * When this element is FALSE, it is assumed that the BSP or invoking
203   * environment has ensured that memory was cleared before RTEMS was
204   * invoked.
205   */
206  bool                           do_zero_of_workspace;
207
208  /**
209   * @brief Specifies if a unified work area is used or not.
210   *
211   * If this element is @a true, then the RTEMS Workspace and the C Program
212   * Heap use the same heap, otherwise they use separate heaps.
213   */
214  bool                           unified_work_area;
215
216  /**
217   * @brief Specifies if the stack allocator avoids the work space.
218   *
219   * If this element is @a true, then the stack allocator must not allocate the
220   * thread stacks from the RTEMS Workspace, otherwise it should allocate the
221   * thread stacks from the RTEMS Workspace.
222   */
223  bool                           stack_allocator_avoids_work_space;
224
225  uint32_t                       maximum_drivers;
226  uint32_t                       number_of_device_drivers;
227  rtems_driver_address_table    *Device_driver_table;
228  uint32_t                       number_of_initial_extensions;
229  const rtems_extensions_table  *User_extension_table;
230  #if defined(RTEMS_MULTIPROCESSING)
231    rtems_multiprocessing_table   *User_multiprocessing_table;
232  #endif
233} rtems_configuration_table;
234
235/**
236 * This is the configuration table generated by confdefs.h.
237 */
238extern const rtems_configuration_table Configuration;
239
240#if defined(RTEMS_MULTIPROCESSING)
241  /**
242   *  This points to the multiprocessing configuration table.
243   */
244  SAPI_EXTERN rtems_multiprocessing_table  *_Configuration_MP_table;
245#endif
246
247#if defined(RTEMS_MULTIPROCESSING)
248  /**
249   * @brief RTEMS multiprocessing configuration table.
250   *
251   * This is the RTEMS Multiprocessing Configuration Table expected to
252   * be generated by confdefs.h.
253   */
254  extern rtems_multiprocessing_table  Multiprocessing_configuration;
255#endif
256
257
258/*
259 *  Some handy macros to avoid dependencies on either the BSP
260 *  or the exact format of the configuration table.
261 */
262
263#define rtems_configuration_get_unified_work_area() \
264        (Configuration.unified_work_area)
265
266#define rtems_configuration_get_stack_allocator_avoids_work_space() \
267        (Configuration.stack_allocator_avoids_work_space)
268
269#define rtems_configuration_get_stack_space_size() \
270        (Configuration.stack_space_size)
271
272#define rtems_configuration_get_work_space_size() \
273        (Configuration.work_space_size + \
274          (rtems_configuration_get_stack_allocator_avoids_work_space() ? \
275            0 : rtems_configuration_get_stack_space_size()))
276
277#define rtems_configuration_get_maximum_extensions() \
278        (Configuration.maximum_extensions)
279
280#define rtems_configuration_get_microseconds_per_tick() \
281        (Configuration.microseconds_per_tick)
282#define rtems_configuration_get_milliseconds_per_tick() \
283        (Configuration.microseconds_per_tick / 1000)
284#define rtems_configuration_get_nanoseconds_per_tick() \
285        (Configuration.nanoseconds_per_tick)
286
287#define rtems_configuration_get_ticks_per_timeslice() \
288        (Configuration.ticks_per_timeslice)
289
290#define rtems_configuration_get_idle_task() \
291        (Configuration.idle_task)
292
293#define rtems_configuration_get_idle_task_stack_size() \
294        (Configuration.idle_task_stack_size)
295
296#define rtems_configuration_get_interrupt_stack_size() \
297        (Configuration.interrupt_stack_size)
298
299#define rtems_configuration_get_stack_allocate_init_hook() \
300        (Configuration.stack_allocate_init_hook)
301
302#define rtems_configuration_get_stack_allocate_hook() \
303        (Configuration.stack_allocate_hook)
304
305#define rtems_configuration_get_stack_free_hook() \
306        (Configuration.stack_free_hook)
307
308 /**
309  * This macro assists in accessing the field which indicates whether
310  * RTEMS is responsible for zeroing the Executive Workspace.
311  */
312#define rtems_configuration_get_do_zero_of_workspace() \
313   (Configuration.do_zero_of_workspace)
314
315#define rtems_configuration_get_maximum_drivers() \
316        (Configuration.maximum_drivers)
317
318#define rtems_configuration_get_number_of_device_drivers() \
319        (Configuration.number_of_device_drivers)
320
321#define rtems_configuration_get_device_driver_table() \
322        (Configuration.Device_driver_table)
323
324#define rtems_configuration_get_number_of_initial_extensions() \
325        (Configuration.number_of_initial_extensions)
326
327#define rtems_configuration_get_user_extension_table() \
328        (Configuration.User_extension_table)
329
330#if defined(RTEMS_MULTIPROCESSING)
331  #define rtems_configuration_get_user_multiprocessing_table() \
332        (Configuration.User_multiprocessing_table)
333#else
334  #define rtems_configuration_get_user_multiprocessing_table() \
335        NULL
336#endif
337
338#define rtems_configuration_get_rtems_api_configuration() \
339        (&Configuration_RTEMS_API)
340
341#define rtems_configuration_get_posix_api_configuration() \
342        (&Configuration_POSIX_API)
343
344#ifdef __cplusplus
345}
346#endif
347
348#endif
349/* end of include file */
Note: See TracBrowser for help on using the repository browser.