source: rtems/cpukit/include/rtems/confdefs/extensions.h @ c46fbb9

Last change on this file since c46fbb9 was c46fbb9, checked in by Sebastian Huber <sebastian.huber@…>, on 12/01/22 at 09:21:25

config: Add CONFIGURE_RECORD_INTERRUPTS_ENABLED

This enables the tracing of interrupt entry/exit events through an
application configuration option. The interrupt processing can be
viewed with Trace Compass using rtems-record-lttng from the RTEMS Tools.

Update #4769.

  • Property mode set to 100644
File size: 6.5 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSImplApplConfig
7 *
8 * @brief This header file evaluates configuration options related to the user
9 *   extensions configuration.
10 */
11
12/*
13 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 *    notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 *    notice, this list of conditions and the following disclaimer in the
22 *    documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _RTEMS_CONFDEFS_EXTENSIONS_H
38#define _RTEMS_CONFDEFS_EXTENSIONS_H
39
40#ifndef __CONFIGURATION_TEMPLATE_h
41#error "Do not include this file directly, use <rtems/confdefs.h> instead"
42#endif
43
44#ifdef CONFIGURE_INIT
45
46#include <rtems/confdefs/bsp.h>
47#include <rtems/confdefs/newlib.h>
48#include <rtems/score/userextimpl.h>
49#include <rtems/sysinit.h>
50
51#ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
52  #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
53#endif
54
55#if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
56  #include <rtems/extensiondata.h>
57#endif
58
59#ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY
60  #include <rtems/libcsupport.h>
61#endif
62
63#if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
64  #if (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS & (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS - 1)) != 0
65    #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be a power of two"
66  #endif
67
68  #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS < 16
69    #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16"
70  #endif
71
72  #if defined(CONFIGURE_RECORD_EXTENSIONS_ENABLED) \
73    || defined(CONFIGURE_RECORD_FATAL_DUMP_BASE64) \
74    || defined(CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB)
75    #define _CONFIGURE_RECORD_NEED_EXTENSION
76  #endif
77
78  #include <rtems/confdefs/percpu.h>
79  #include <rtems/record.h>
80#else
81  #ifdef CONFIGURE_RECORD_EXTENSIONS_ENABLED
82    #warning "CONFIGURE_RECORD_EXTENSIONS_ENABLED defined without CONFIGURE_RECORD_PER_PROCESSOR_ITEMS"
83  #endif
84  #ifdef CONFIGURE_RECORD_FATAL_DUMP_BASE64
85    #warning "CONFIGURE_RECORD_FATAL_DUMP_BASE64 defined without CONFIGURE_RECORD_PER_PROCESSOR_ITEMS"
86  #endif
87  #ifdef CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB
88    #warning "CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB defined without CONFIGURE_RECORD_PER_PROCESSOR_ITEMS"
89  #endif
90#endif
91
92#ifdef CONFIGURE_STACK_CHECKER_ENABLED
93  #include <rtems/stackchk.h>
94#endif
95
96#ifdef CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING
97  #include <rtems/score/exception.h>
98#endif
99
100#ifdef __cplusplus
101extern "C" {
102#endif
103
104#if defined(_CONFIGURE_RECORD_NEED_EXTENSION) \
105  || defined(_CONFIGURE_ENABLE_NEWLIB_REENTRANCY) \
106  || defined(CONFIGURE_STACK_CHECKER_ENABLED) \
107  || defined(CONFIGURE_INITIAL_EXTENSIONS) \
108  || defined(BSP_INITIAL_EXTENSION)
109  const User_extensions_Table _User_extensions_Initial_extensions[] = {
110    #ifdef CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING
111      { .fatal = _Exception_Raise_signal },
112    #endif
113    #ifdef _CONFIGURE_RECORD_NEED_EXTENSION
114      {
115        #ifdef CONFIGURE_RECORD_EXTENSIONS_ENABLED
116          _Record_Thread_create,
117          _Record_Thread_start,
118          _Record_Thread_restart,
119          _Record_Thread_delete,
120          _Record_Thread_switch,
121          _Record_Thread_begin,
122          _Record_Thread_exitted,
123        #else
124           NULL, NULL, NULL, NULL, NULL, NULL, NULL,
125        #endif
126        #ifdef CONFIGURE_RECORD_FATAL_DUMP_BASE64_ZLIB
127          _Record_Fatal_dump_base64_zlib,
128        #elif defined(CONFIGURE_RECORD_FATAL_DUMP_BASE64)
129          _Record_Fatal_dump_base64,
130        #else
131          NULL,
132        #endif
133        #ifdef CONFIGURE_RECORD_EXTENSIONS_ENABLED
134          _Record_Thread_terminate
135        #else
136          NULL
137        #endif
138      },
139    #endif
140    #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY
141      RTEMS_NEWLIB_EXTENSION,
142    #endif
143    #ifdef CONFIGURE_STACK_CHECKER_ENABLED
144      RTEMS_STACK_CHECKER_EXTENSION,
145    #endif
146    #ifdef CONFIGURE_INITIAL_EXTENSIONS
147      CONFIGURE_INITIAL_EXTENSIONS,
148    #endif
149    #if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
150      defined(BSP_INITIAL_EXTENSION)
151      BSP_INITIAL_EXTENSION
152    #endif
153  };
154
155  const size_t _User_extensions_Initial_count =
156    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions );
157
158  User_extensions_Switch_control _User_extensions_Initial_switch_controls[
159    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions )
160  ];
161
162  RTEMS_SYSINIT_ITEM(
163    _User_extensions_Handler_initialization,
164    RTEMS_SYSINIT_INITIAL_EXTENSIONS,
165    RTEMS_SYSINIT_ORDER_MIDDLE
166  );
167#endif
168
169#if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
170  EXTENSION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_USER_EXTENSIONS );
171#endif
172
173#if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
174  typedef struct {
175    Record_Control    Control;
176    rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ];
177  } Record_Configured_control;
178
179  static Record_Configured_control _Record_Controls[ _CONFIGURE_MAXIMUM_PROCESSORS ];
180
181  const Record_Configuration _Record_Configuration = {
182    CONFIGURE_RECORD_PER_PROCESSOR_ITEMS,
183    &_Record_Controls[ 0 ].Control
184  };
185
186  RTEMS_SYSINIT_ITEM(
187    _Record_Initialize,
188    RTEMS_SYSINIT_RECORD,
189    RTEMS_SYSINIT_ORDER_MIDDLE
190  );
191
192  #ifdef CONFIGURE_RECORD_INTERRUPTS_ENABLED
193    RTEMS_SYSINIT_ITEM(
194      _Record_Interrupt_initialize,
195      RTEMS_SYSINIT_LAST,
196      RTEMS_SYSINIT_ORDER_MIDDLE
197    );
198  #endif
199#endif
200
201#ifdef CONFIGURE_VERBOSE_SYSTEM_INITIALIZATION
202  RTEMS_SYSINIT_ITEM(
203    _Sysinit_Verbose,
204    RTEMS_SYSINIT_RECORD,
205    RTEMS_SYSINIT_ORDER_LAST
206  );
207#endif
208
209#ifdef __cplusplus
210}
211#endif
212
213#endif /* CONFIGURE_INIT */
214
215#endif /* _RTEMS_CONFDEFS_EXTENSIONS_H */
Note: See TracBrowser for help on using the repository browser.