RTEMS
extensions.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
11 /*
12  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef _RTEMS_CONFDEFS_EXTENSIONS_H
37 #define _RTEMS_CONFDEFS_EXTENSIONS_H
38 
39 #ifndef __CONFIGURATION_TEMPLATE_h
40 #error "Do not include this file directly, use <rtems/confdefs.h> instead"
41 #endif
42 
43 #ifdef CONFIGURE_INIT
44 
45 #include <rtems/confdefs/bsp.h>
46 #include <rtems/confdefs/newlib.h>
48 #include <rtems/sysinit.h>
49 
50 #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
51  #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
52 #endif
53 
54 #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
55  #include <rtems/extensiondata.h>
56 #endif
57 
58 #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY
59  #include <rtems/libcsupport.h>
60 #endif
61 
62 #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
63  #if (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS & (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS - 1)) != 0
64  #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be a power of two"
65  #endif
66 
67  #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS < 16
68  #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16"
69  #endif
70 
71  #if defined(CONFIGURE_RECORD_EXTENSIONS_ENABLED) \
72  || defined(CONFIGURE_RECORD_FATAL_DUMP_BASE64) \
73  || defined(CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB)
74  #define _CONFIGURE_RECORD_NEED_EXTENSION
75  #endif
76 
77  #include <rtems/confdefs/percpu.h>
78  #include <rtems/record.h>
79 #else
80  #ifdef CONFIGURE_RECORD_EXTENSIONS_ENABLED
81  #warning "CONFIGURE_RECORD_EXTENSIONS_ENABLED defined without CONFIGURE_RECORD_PER_PROCESSOR_ITEMS"
82  #endif
83  #ifdef CONFIGURE_RECORD_FATAL_DUMP_BASE64
84  #warning "CONFIGURE_RECORD_FATAL_DUMP_BASE64 defined without CONFIGURE_RECORD_PER_PROCESSOR_ITEMS"
85  #endif
86  #ifdef CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB
87  #warning "CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB defined without CONFIGURE_RECORD_PER_PROCESSOR_ITEMS"
88  #endif
89 #endif
90 
91 #ifdef CONFIGURE_STACK_CHECKER_ENABLED
92  #include <rtems/stackchk.h>
93 #endif
94 
95 #ifdef __cplusplus
96 extern "C" {
97 #endif
98 
99 #if defined(_CONFIGURE_RECORD_NEED_EXTENSION) \
100  || defined(_CONFIGURE_ENABLE_NEWLIB_REENTRANCY) \
101  || defined(CONFIGURE_STACK_CHECKER_ENABLED) \
102  || defined(CONFIGURE_INITIAL_EXTENSIONS) \
103  || defined(BSP_INITIAL_EXTENSION)
105  #ifdef _CONFIGURE_RECORD_NEED_EXTENSION
106  {
107  #ifdef CONFIGURE_RECORD_EXTENSIONS_ENABLED
108  _Record_Thread_create,
109  _Record_Thread_start,
110  _Record_Thread_restart,
111  _Record_Thread_delete,
112  _Record_Thread_switch,
113  _Record_Thread_begin,
114  _Record_Thread_exitted,
115  #else
116  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
117  #endif
118  #ifdef CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB
119  _Record_Fatal_dump_base64_zlib,
120  #elif defined(CONFIGURE_RECORD_FATAL_DUMP_BASE64)
121  _Record_Fatal_dump_base64,
122  #else
123  NULL,
124  #endif
125  #ifdef CONFIGURE_RECORD_EXTENSIONS_ENABLED
126  _Record_Thread_terminate
127  #else
128  NULL
129  #endif
130  },
131  #endif
132  #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY
133  RTEMS_NEWLIB_EXTENSION,
134  #endif
135  #ifdef CONFIGURE_STACK_CHECKER_ENABLED
136  RTEMS_STACK_CHECKER_EXTENSION,
137  #endif
138  #ifdef CONFIGURE_INITIAL_EXTENSIONS
140  #endif
141  #ifdef BSP_INITIAL_EXTENSION
143  #endif
144  };
145 
146  const size_t _User_extensions_Initial_count =
148 
151  ];
152 
153  RTEMS_SYSINIT_ITEM(
155  RTEMS_SYSINIT_INITIAL_EXTENSIONS,
156  RTEMS_SYSINIT_ORDER_MIDDLE
157  );
158 #endif
159 
160 #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
162 #endif
163 
164 #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
165  typedef struct {
166  Record_Control Control;
167  rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ];
168  } Record_Configured_control;
169 
170  static Record_Configured_control _Record_Controls[ _CONFIGURE_MAXIMUM_PROCESSORS ];
171 
172  const Record_Configuration _Record_Configuration = {
174  &_Record_Controls[ 0 ].Control
175  };
176 
177  RTEMS_SYSINIT_ITEM(
178  _Record_Initialize,
179  RTEMS_SYSINIT_RECORD,
180  RTEMS_SYSINIT_ORDER_MIDDLE
181  );
182 #endif
183 
184 #ifdef CONFIGURE_VERBOSE_SYSTEM_INITIALIZATION
185  RTEMS_SYSINIT_ITEM(
186  _Sysinit_Verbose,
187  RTEMS_SYSINIT_RECORD,
188  RTEMS_SYSINIT_ORDER_LAST
189  );
190 #endif
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif /* CONFIGURE_INIT */
197 
198 #endif /* _RTEMS_CONFDEFS_EXTENSIONS_H */
Manages the switch callouts.
Definition: userextdata.h:39
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS
This configuration option is an integer define.
Definition: appl-config.h:977
Classic User Extensions Data Structures.
Evaluate Per-CPU Configuration Options.
#define CONFIGURE_INITIAL_EXTENSIONS
This configuration option is an initializer define.
Definition: appl-config.h:2557
const size_t _User_extensions_Initial_count
The count of initial user extensions.
User Extension Handler API.
const User_extensions_Table _User_extensions_Initial_extensions[]
The table of initial user extensions.
#define CONFIGURE_RECORD_PER_PROCESSOR_ITEMS
This configuration option is an integer define.
Definition: appl-config.h:1842
void _User_extensions_Handler_initialization(void)
Initializes the user extensions handler.
Definition: userext.c:24
Evaluate Newlib Configuration Options.
#define EXTENSION_INFORMATION_DEFINE(max)
Macro to define the objects information for the Classic Extensions objects.
Definition: extensiondata.h:54
Standard C Library Support.
User_extensions_Switch_control _User_extensions_Initial_switch_controls[]
A spare switch control for each initial user extension.
Evaluate BSP Related Configuration Options.
#define RTEMS_ARRAY_SIZE(_array)
Returns the element count of the specified array.
Definition: basedefs.h:459
User extension table.
Definition: userext.h:230
#define BSP_INITIAL_EXTENSION
This configuration option is an initializer define.
Definition: appl-config.h:418