1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSApplicationConfiguration |
---|
7 | * |
---|
8 | * @brief Evaluate User Extensions Configuration Options |
---|
9 | */ |
---|
10 | |
---|
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> |
---|
47 | #include <rtems/score/userextimpl.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 | #include <rtems/confdefs/percpu.h> |
---|
64 | #include <rtems/record.h> |
---|
65 | #endif |
---|
66 | |
---|
67 | #ifdef CONFIGURE_STACK_CHECKER_ENABLED |
---|
68 | #include <rtems/stackchk.h> |
---|
69 | #endif |
---|
70 | |
---|
71 | #ifdef __cplusplus |
---|
72 | extern "C" { |
---|
73 | #endif |
---|
74 | |
---|
75 | #if defined(BSP_INITIAL_EXTENSION) \ |
---|
76 | || defined(CONFIGURE_INITIAL_EXTENSIONS) \ |
---|
77 | || defined(CONFIGURE_STACK_CHECKER_ENABLED) \ |
---|
78 | || defined(_CONFIGURE_ENABLE_NEWLIB_REENTRANCY) |
---|
79 | const User_extensions_Table _User_extensions_Initial_extensions[] = { |
---|
80 | #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0 \ |
---|
81 | && defined(CONFIGURE_RECORD_EXTENSIONS_ENABLED) |
---|
82 | { |
---|
83 | _Record_Thread_create, |
---|
84 | _Record_Thread_start, |
---|
85 | _Record_Thread_restart, |
---|
86 | _Record_Thread_delete, |
---|
87 | _Record_Thread_switch, |
---|
88 | _Record_Thread_begin, |
---|
89 | _Record_Thread_exitted, |
---|
90 | #ifdef CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB |
---|
91 | _Record_Fatal_dump_base64_zlib, |
---|
92 | #elif defined(CONFIGURE_RECORD_FATAL_DUMP_BASE64) |
---|
93 | _Record_Fatal_dump_base64, |
---|
94 | #else |
---|
95 | NULL, |
---|
96 | #endif |
---|
97 | _Record_Thread_terminate |
---|
98 | }, |
---|
99 | #endif |
---|
100 | #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY |
---|
101 | RTEMS_NEWLIB_EXTENSION, |
---|
102 | #endif |
---|
103 | #ifdef CONFIGURE_STACK_CHECKER_ENABLED |
---|
104 | RTEMS_STACK_CHECKER_EXTENSION, |
---|
105 | #endif |
---|
106 | #ifdef CONFIGURE_INITIAL_EXTENSIONS |
---|
107 | CONFIGURE_INITIAL_EXTENSIONS, |
---|
108 | #endif |
---|
109 | #ifdef BSP_INITIAL_EXTENSION |
---|
110 | BSP_INITIAL_EXTENSION |
---|
111 | #endif |
---|
112 | }; |
---|
113 | |
---|
114 | const size_t _User_extensions_Initial_count = |
---|
115 | RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions ); |
---|
116 | |
---|
117 | User_extensions_Switch_control _User_extensions_Initial_switch_controls[ |
---|
118 | RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions ) |
---|
119 | ]; |
---|
120 | |
---|
121 | RTEMS_SYSINIT_ITEM( |
---|
122 | _User_extensions_Handler_initialization, |
---|
123 | RTEMS_SYSINIT_INITIAL_EXTENSIONS, |
---|
124 | RTEMS_SYSINIT_ORDER_MIDDLE |
---|
125 | ); |
---|
126 | #endif |
---|
127 | |
---|
128 | #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0 |
---|
129 | EXTENSION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_USER_EXTENSIONS ); |
---|
130 | #endif |
---|
131 | |
---|
132 | #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0 |
---|
133 | #if (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS & (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS - 1)) != 0 |
---|
134 | #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be a power of two" |
---|
135 | #endif |
---|
136 | |
---|
137 | #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS < 16 |
---|
138 | #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16" |
---|
139 | #endif |
---|
140 | |
---|
141 | typedef struct { |
---|
142 | Record_Control Control; |
---|
143 | rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ]; |
---|
144 | } Record_Configured_control; |
---|
145 | |
---|
146 | static Record_Configured_control _Record_Controls[ _CONFIGURE_MAXIMUM_PROCESSORS ]; |
---|
147 | |
---|
148 | const Record_Configuration _Record_Configuration = { |
---|
149 | CONFIGURE_RECORD_PER_PROCESSOR_ITEMS, |
---|
150 | &_Record_Controls[ 0 ].Control |
---|
151 | }; |
---|
152 | |
---|
153 | RTEMS_SYSINIT_ITEM( |
---|
154 | _Record_Initialize, |
---|
155 | RTEMS_SYSINIT_RECORD, |
---|
156 | RTEMS_SYSINIT_ORDER_MIDDLE |
---|
157 | ); |
---|
158 | #endif |
---|
159 | |
---|
160 | #ifdef CONFIGURE_VERBOSE_SYSTEM_INITIALIZATION |
---|
161 | RTEMS_SYSINIT_ITEM( |
---|
162 | _Sysinit_Verbose, |
---|
163 | RTEMS_SYSINIT_RECORD, |
---|
164 | RTEMS_SYSINIT_ORDER_LAST |
---|
165 | ); |
---|
166 | #endif |
---|
167 | |
---|
168 | #ifdef __cplusplus |
---|
169 | } |
---|
170 | #endif |
---|
171 | |
---|
172 | #endif /* CONFIGURE_INIT */ |
---|
173 | |
---|
174 | #endif /* _RTEMS_CONFDEFS_EXTENSIONS_H */ |
---|