source: rtems/cpukit/include/rtems/config.h @ ccc6695

Last change on this file since ccc6695 was ccc6695, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 8, 2018 at 10:50:24 AM

score: Introduce <rtems/score/watchdogticks.h>

Separate the definitions related to watchdog ticks from the watchdog
structures.

Update #3598.

  • Property mode set to 100644
File size: 11.2 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 specifies the maximum number of dynamically installed
132   * used extensions.
133   */
134  uint32_t                       maximum_extensions;
135
136  /**
137   * This field contains the maximum number of POSIX API
138   * keys which are configured for this application.
139   */
140  uint32_t                       maximum_keys;
141
142  /**
143   * This field contains the maximum number of POSIX API
144   * key value pairs which are configured for this application.
145   *
146   * @note There can be potentially be a key/value pair for
147   *       every thread to use every key. But normally this
148   *       many are not needed in a system.
149   */
150  uint32_t                            maximum_key_value_pairs;
151
152  /**
153   * This field specifies the number of microseconds which elapse
154   * between clock ticks.  This is the basis for RTEMS timing.
155   */
156  uint32_t                       microseconds_per_tick;
157
158  /**
159   * This field specifies the number of ticks in each task's timeslice.
160   */
161  uint32_t                       ticks_per_timeslice;
162
163  /**
164   * This element points to the BSP's optional idle task which may override
165   * the default one provided with RTEMS.
166   */
167  void                        *(*idle_task)( uintptr_t );
168
169  /**
170   * This field specifies the size of the IDLE task's stack.  If less than or
171   * equal to the minimum stack size, then the IDLE task will have the minimum
172   * stack size.
173   */
174  uint32_t                       idle_task_stack_size;
175
176  /**
177   * @brief Optional task stack allocator initialization hook.
178   */
179  rtems_stack_allocate_init_hook stack_allocate_init_hook;
180
181  /**
182   * @brief Optional task stack allocator hook.
183   */
184  rtems_stack_allocate_hook      stack_allocate_hook;
185
186  /**
187   * @brief Optional task stack free hook.
188   */
189  rtems_stack_free_hook          stack_free_hook;
190
191  /**
192   * If this element is TRUE, then RTEMS will zero the Executive Workspace.
193   * When this element is FALSE, it is assumed that the BSP or invoking
194   * environment has ensured that memory was cleared before RTEMS was
195   * invoked.
196   */
197  bool                           do_zero_of_workspace;
198
199  /**
200   * @brief Specifies if a unified work area is used or not.
201   *
202   * If this element is @a true, then the RTEMS Workspace and the C Program
203   * Heap use the same heap, otherwise they use separate heaps.
204   */
205  bool                           unified_work_area;
206
207  /**
208   * @brief Specifies if the stack allocator avoids the work space.
209   *
210   * If this element is @a true, then the stack allocator must not allocate the
211   * thread stacks from the RTEMS Workspace, otherwise it should allocate the
212   * thread stacks from the RTEMS Workspace.
213   */
214  bool                           stack_allocator_avoids_work_space;
215
216  #ifdef RTEMS_SMP
217    bool                         smp_enabled;
218  #endif
219
220  uint32_t                       number_of_initial_extensions;
221  const rtems_extensions_table  *User_extension_table;
222  #if defined(RTEMS_MULTIPROCESSING)
223    rtems_multiprocessing_table   *User_multiprocessing_table;
224  #endif
225  #ifdef RTEMS_SMP
226    uint32_t                     maximum_processors;
227  #endif
228} rtems_configuration_table;
229
230/**
231 * This is the configuration table generated by confdefs.h.
232 */
233extern const rtems_configuration_table Configuration;
234
235#if defined(RTEMS_MULTIPROCESSING)
236  /**
237   *  This points to the multiprocessing configuration table.
238   */
239  extern rtems_multiprocessing_table *_Configuration_MP_table;
240#endif
241
242#if defined(RTEMS_MULTIPROCESSING)
243  /**
244   * @brief RTEMS multiprocessing configuration table.
245   *
246   * This is the RTEMS Multiprocessing Configuration Table expected to
247   * be generated by confdefs.h.
248   */
249  extern rtems_multiprocessing_table Multiprocessing_configuration;
250
251  /*
252   *  This is the default Multiprocessing Configuration Table.
253   *  It is used in single processor configurations.
254   */
255  extern const rtems_multiprocessing_table
256    _Initialization_Default_multiprocessing_table;
257#endif
258
259
260/*
261 *  Some handy macros to avoid dependencies on either the BSP
262 *  or the exact format of the configuration table.
263 */
264
265#define rtems_configuration_get_unified_work_area() \
266        (Configuration.unified_work_area)
267
268#define rtems_configuration_get_stack_allocator_avoids_work_space() \
269        (Configuration.stack_allocator_avoids_work_space)
270
271#define rtems_configuration_get_stack_space_size() \
272        (Configuration.stack_space_size)
273
274#define rtems_configuration_get_work_space_size() \
275        (Configuration.work_space_size + \
276          (rtems_configuration_get_stack_allocator_avoids_work_space() ? \
277            0 : rtems_configuration_get_stack_space_size()))
278
279#define rtems_configuration_get_maximum_extensions() \
280        (Configuration.maximum_extensions)
281
282#define rtems_configuration_get_microseconds_per_tick() \
283        (Configuration.microseconds_per_tick)
284#define rtems_configuration_get_milliseconds_per_tick() \
285        (Configuration.microseconds_per_tick / 1000)
286#define rtems_configuration_get_nanoseconds_per_tick() \
287        (_Watchdog_Nanoseconds_per_tick)
288
289#define rtems_configuration_get_ticks_per_timeslice() \
290        (Configuration.ticks_per_timeslice)
291
292#define rtems_configuration_get_idle_task() \
293        (Configuration.idle_task)
294
295#define rtems_configuration_get_idle_task_stack_size() \
296        (Configuration.idle_task_stack_size)
297
298#define rtems_configuration_get_interrupt_stack_size() \
299        ((size_t) _ISR_Stack_size)
300
301#define rtems_configuration_get_stack_allocate_init_hook() \
302        (Configuration.stack_allocate_init_hook)
303
304#define rtems_configuration_get_stack_allocate_hook() \
305        (Configuration.stack_allocate_hook)
306
307#define rtems_configuration_get_stack_free_hook() \
308        (Configuration.stack_free_hook)
309
310 /**
311  * This macro assists in accessing the field which indicates whether
312  * RTEMS is responsible for zeroing the Executive Workspace.
313  */
314#define rtems_configuration_get_do_zero_of_workspace() \
315   (Configuration.do_zero_of_workspace)
316
317#define rtems_configuration_get_number_of_initial_extensions() \
318        (Configuration.number_of_initial_extensions)
319
320#define rtems_configuration_get_user_extension_table() \
321        (Configuration.User_extension_table)
322
323#if defined(RTEMS_MULTIPROCESSING)
324  #define rtems_configuration_get_user_multiprocessing_table() \
325        (Configuration.User_multiprocessing_table)
326#else
327  #define rtems_configuration_get_user_multiprocessing_table() \
328        NULL
329#endif
330
331/**
332 * @brief Returns true if the SMP mode of operation is enabled, and false
333 * otherwise.
334 *
335 * In uni-processor configurations this is a compile-time constant which
336 * evaluates to false.
337 *
338 * @retval true SMP mode of operation is enabled.
339 * @retval false Otherwise.
340 */
341#ifdef RTEMS_SMP
342  #define rtems_configuration_is_smp_enabled() \
343        (Configuration.smp_enabled)
344#else
345  #define rtems_configuration_is_smp_enabled() \
346        false
347#endif
348
349/**
350 * @brief Returns the configured maximum count of processors.
351 *
352 * The actual number of processors available for the application will be less
353 * than or equal to the configured maximum count of processors.
354 *
355 * On single-processor configurations this is a compile time constant which
356 * evaluates to one.
357 *
358 * @return The configured maximum count of processors.
359 */
360#ifdef RTEMS_SMP
361  #define rtems_configuration_get_maximum_processors() \
362        (Configuration.maximum_processors)
363#else
364  #define rtems_configuration_get_maximum_processors() \
365        1
366#endif
367
368#define rtems_configuration_get_rtems_api_configuration() \
369        (&Configuration_RTEMS_API)
370
371#define rtems_configuration_get_posix_api_configuration() \
372        (&Configuration_POSIX_API)
373
374#ifdef __cplusplus
375}
376#endif
377
378#endif
379/* end of include file */
Note: See TracBrowser for help on using the repository browser.