source: rtems/cpukit/include/rtems/extension.h @ 2afb22b

5
Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 10.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief User Extensions API.
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2008.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#ifndef _RTEMS_EXTENSION_H
17#define _RTEMS_EXTENSION_H
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <rtems/score/object.h>
24#include <rtems/score/userext.h>
25#include <rtems/rtems/status.h>
26#include <rtems/rtems/types.h>
27
28typedef struct {
29  Objects_Control          Object;
30  User_extensions_Control  Extension;
31}   Extension_Control;
32
33typedef User_extensions_routine
34  rtems_extension RTEMS_DEPRECATED;
35
36/**
37 * @defgroup ClassicUserExtensions User Extensions
38 *
39 * @ingroup ClassicRTEMS
40 *
41 * @brief The User Extensions Manager allows the application developer to
42 * augment the executive by allowing them to supply extension routines which
43 * are invoked at critical system events.
44 *
45 * @section ClassicUserExtensionsSets Extension Sets
46 *
47 * An @ref User_extensions_Table "extension set" is defined as a set of
48 * routines which are invoked at each of the critical system events at which
49 * user extension routines are invoked.  Together a set of these routines
50 * typically perform a specific functionality such as performance monitoring or
51 * debugger support.
52 *
53 * RTEMS allows the user to have multiple extension sets active at the same
54 * time. First, a single static extension set may be defined as the
55 * application's User Extension Table which is included as part of the
56 * Configuration Table. This extension set is active for the entire life of the
57 * system and may not be deleted. This extension set is especially important
58 * because it is the only way the application can provided a fatal error
59 * extension which is invoked if RTEMS fails during the
60 * rtems_initialize_data_structures() directive. The static extension set is
61 * optional and may be configured as @c NULL if no static extension set is
62 * required.
63 *
64 * Second, the user can install dynamic extensions using the
65 * rtems_extension_create() directive. These extensions are RTEMS objects in
66 * that they have a name, an ID, and can be dynamically created and deleted. In
67 * contrast to the static extension set, these extensions can only be created
68 * and installed after the rtems_initialize_data_structures() directive
69 * successfully completes execution. Dynamic extensions are useful for
70 * encapsulating the functionality of an extension set. For example, the
71 * application could use extensions to manage a special coprocessor, do
72 * performance monitoring, and to do stack bounds checking. Each of these
73 * extension sets could be written and installed independently of the others.
74 *
75 * All user extensions are optional and RTEMS places no naming restrictions on
76 * the user. The user extension entry points are copied into an internal RTEMS
77 * structure. This means the user does not need to keep the table after
78 * creating it, and changing the handler entry points dynamically in a table
79 * once created has no effect. Creating a table local to a function can save
80 * space in space limited applications.
81 *
82 * Extension switches do not effect the context switch overhead if no switch
83 * handler is installed.
84 *
85 * @section ClassicUserExtensionsTCB Task Control Block Area
86 *
87 * RTEMS provides for a pointer to a user-defined data area for each extension
88 * set to be linked to each task's control block (TCB). This area is only
89 * available for the dynamic extensions. This set of pointers is an extension
90 * of the TCB and can be used to store additional data required by the user's
91 * extension functions.
92 *
93 * The TCB extension is an array of pointers in the TCB. The index into the
94 * table can be obtained from the extension identifier returned when the
95 * extension is created:
96 *
97 * @code
98 * rtems_tcb *task = some_task;
99 * size_t index = rtems_object_id_get_index(extension_id);
100 * void *extension_data = task->extensions [index];
101 * @endcode
102 *
103 * The number of pointers in the area is the same as the number of user
104 * extension sets configured. This allows an application to augment the TCB
105 * with user-defined information. For example, an application could implement
106 * task profiling by storing timing statistics in the TCB's extended memory
107 * area. When a task context switch is being executed, the task switch
108 * extension could read a real-time clock to calculate how long the task being
109 * swapped out has run as well as timestamp the starting time for the task
110 * being swapped in.
111 *
112 * If used, the extended memory area for the TCB should be allocated and the
113 * TCB extension pointer should be set at the time the task is created or
114 * started by either the task create or task start extension. The application
115 * is responsible for managing this extended memory area for the TCBs. The
116 * memory may be reinitialized by the task restart extension and should be
117 * deallocated by the task delete extension when the task is deleted. Since the
118 * TCB extension buffers would most likely be of a fixed size, the RTEMS
119 * partition manager could be used to manage the application's extended memory
120 * area. The application could create a partition of fixed size TCB extension
121 * buffers and use the partition manager's allocation and deallocation
122 * directives to obtain and release the extension buffers.
123 *
124 * @section ClassicUserExtensionsOrder Order of Invokation
125 *
126 * When one of the critical system events occur, the user extensions are
127 * invoked in either @a forward or @a reverse order. Forward order indicates
128 * that the static extension set is invoked followed by the dynamic extension
129 * sets in the order in which they were created. Reverse order means that the
130 * dynamic extension sets are invoked in the opposite of the order in which
131 * they were created followed by the static extension set. By invoking the
132 * extension sets in this order, extensions can be built upon one another. At
133 * the following system events, the extensions are invoked in forward order:
134 *
135 * - Task creation
136 * - Task start
137 * - Task restart
138 * - Task context switch
139 * - Post task context switch
140 * - Task begins to execute
141 *
142 * At the following system events, the extensions are invoked in reverse order:
143 *
144 * - Task exit
145 * - Task deletion
146 * - Fatal error detection
147 *
148 * At these system events, the extensions are invoked in reverse order to
149 * insure that if an extension set is built upon another, the more complicated
150 * extension is invoked before the extension set it is built upon. For example,
151 * by invoking the static extension set last it is known that the "system"
152 * fatal error extension will be the last fatal error extension executed.
153 * Another example is use of the task delete extension by the Standard C
154 * Library. Extension sets which are installed after the Standard C Library
155 * will operate correctly even if they utilize the C Library because the C
156 * Library's task delete extension is invoked after that of the other
157 * extensions.
158 */
159/**@{**/
160
161typedef User_extensions_thread_create_extension   rtems_task_create_extension;
162typedef User_extensions_thread_delete_extension   rtems_task_delete_extension;
163typedef User_extensions_thread_start_extension    rtems_task_start_extension;
164typedef User_extensions_thread_restart_extension  rtems_task_restart_extension;
165typedef User_extensions_thread_switch_extension   rtems_task_switch_extension;
166typedef User_extensions_thread_begin_extension    rtems_task_begin_extension;
167typedef User_extensions_thread_exitted_extension  rtems_task_exitted_extension;
168typedef User_extensions_fatal_extension           rtems_fatal_extension;
169typedef User_extensions_thread_terminate_extension rtems_task_terminate_extension;
170
171typedef User_extensions_Table                     rtems_extensions_table;
172
173typedef Internal_errors_Source rtems_fatal_source;
174
175typedef Internal_errors_t rtems_fatal_code;
176
177/**
178 * @brief Creates an extension set object.
179 *
180 * This directive creates a extension set object from the extension table
181 * @a extension_table.  The assigned extension set identifier is returned in
182 * @a id.  The identifier is used to access this extension set in other
183 * extension set related directives.  The name @a name will be assigned to the
184 * extension set object.
185 *
186 * Newly created extension sets are immediately installed and are invoked upon
187 * the next system event supporting an extension.
188 *
189 * This directive will not cause the calling task to be preempted.
190 *
191 * @retval RTEMS_SUCCESSFUL Extension set created successfully.
192 * @retval RTEMS_INVALID_ADDRESS Identifier pointer is @c NULL.
193 * @retval RTEMS_INVALID_NAME Invalid extension set name.
194 * @retval RTEMS_TOO_MANY Too many extension sets created.
195 */
196rtems_status_code rtems_extension_create(
197  rtems_name                    name,
198  const rtems_extensions_table *extension_table,
199  rtems_id                     *id
200);
201
202/**
203 * @brief Identifies an extension set object by a name.
204 *
205 * This directive obtains an extension set identifier in @a id associated with
206 * the extension set name @a name. If the extension set name is not unique,
207 * then the extension set identifier will match one of the extension sets with
208 * that name.  However, this extension set identifier is not guaranteed to
209 * correspond to the desired extension set. The extension set identifier is
210 * used to access this extension set in other extension set related directives.
211 *
212 * This directive will not cause the calling task to be preempted.
213 *
214 * @retval RTEMS_SUCCESSFUL Extension set identified successfully.
215 * @retval RTEMS_INVALID_ADDRESS Identifier pointer is @c NULL.
216 * @retval RTEMS_INVALID_NAME Extension set name not found or invalid name.
217 */
218rtems_status_code rtems_extension_ident(
219  rtems_name  name,
220  rtems_id   *id
221);
222
223/**
224 * @brief Deletes an extension set object specified by the identifier @a id.
225 *
226 * Any subsequent references to the extension's name and identifier are
227 * invalid.
228 *
229 * This directive will not cause the calling task to be preempted.
230 *
231 * @retval RTEMS_SUCCESSFUL Extension set deleted successfully.
232 * @retval RTEMS_INVALID_ID Invalid extension set identifier.
233 */
234rtems_status_code rtems_extension_delete(
235  rtems_id id
236);
237
238/** @} */
239
240#ifdef __cplusplus
241}
242#endif
243
244#endif
245/* end of include file */
Note: See TracBrowser for help on using the repository browser.