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

Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on Dec 23, 2017 at 7:18:56 AM

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: 6.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief Classic Input/Output Manager API
5 *
6 * This file emulates the old Classic RTEMS IO manager directives
7 * which register and lookup names using the in-memory filesystem.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2008.
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_IO_H
20#define _RTEMS_IO_H
21
22#include <rtems/rtems/status.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 * @defgroup ClassicIO Input/Output
30 *
31 * @ingroup ClassicRTEMS
32 *
33 */
34/**@{**/
35
36typedef uint32_t rtems_device_major_number;
37
38typedef uint32_t rtems_device_minor_number;
39
40typedef rtems_status_code rtems_device_driver;
41
42typedef rtems_device_driver (*rtems_device_driver_entry)(
43  rtems_device_major_number,
44  rtems_device_minor_number,
45  void *
46);
47
48typedef struct {
49  rtems_device_driver_entry initialization_entry;
50  rtems_device_driver_entry open_entry;
51  rtems_device_driver_entry close_entry;
52  rtems_device_driver_entry read_entry;
53  rtems_device_driver_entry write_entry;
54  rtems_device_driver_entry control_entry;
55} rtems_driver_address_table;
56
57/**
58 * @name Device Driver Maintainance
59 */
60/**@{**/
61
62/**
63 * @brief Returns @c RTEMS_IO_ERROR.
64 *
65 * @retval RTEMS_IO_ERROR Only this one.
66 */
67rtems_status_code rtems_io_driver_io_error(
68  rtems_device_major_number major,
69  rtems_device_minor_number minor,
70  void *arg
71);
72
73/**
74 * @brief Registers and initializes the device with the device driver table
75 * @a driver_table and major number @a major.
76 *
77 * If the major number equals zero a major number will be obtained.  The major
78 * number of the registered driver will be returned in @a registered_major.
79 *
80 * After a successful registration rtems_io_initialize() will be called to
81 * initialize the device.
82 *
83 * @retval RTEMS_SUCCESSFUL Device successfully registered and initialized.
84 * @retval RTEMS_INVALID_ADDRESS Pointer to driver table or to registered
85 * major number are invalid.  Device driver table is empty.
86 * @retval RTEMS_INVALID_NUMBER Invalid major number.
87 * @retval RTEMS_TOO_MANY No major number available.
88 * @retval RTEMS_RESOURCE_IN_USE Major number in use.
89 * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context.
90 * @retval * Status code depends on rtems_io_initialize().
91 */
92rtems_status_code rtems_io_register_driver(
93  rtems_device_major_number major,
94  const rtems_driver_address_table *driver_table,
95  rtems_device_major_number *registered_major
96);
97
98/**
99 * @brief Unregister a driver from the device driver table.
100 *
101 * @param[in] major is the device major number.
102 *
103 * @retval RTEMS_SUCCESSFUL Device driver successfully unregistered.
104 * @retval RTEMS_UNSATISFIED Invalid major number.
105 * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context.
106 */
107rtems_status_code rtems_io_unregister_driver(
108  rtems_device_major_number major
109);
110
111/**
112 * @brief Registers the name @a device_name in the file system for the device
113 * with number tuple @a major and @a minor.
114 *
115 * This assumes that all registered devices are character devices.
116 *
117 * @retval RTEMS_SUCCESSFUL Name successfully registered.
118 * @retval RTEMS_TOO_MANY Name already in use or other errors.
119 */
120rtems_status_code rtems_io_register_name(
121  const char *device_name,
122  rtems_device_major_number major,
123  rtems_device_minor_number minor
124);
125
126/** @} */
127
128/**
129 * @brief IO driver initialization.
130 *
131 * This routine is the initialization directive of the IO manager.
132 *
133 * @param[in] major is the device drive number
134 * @param[in] minor is the device number
135 * @param[in] argument is the pointer to the argument(s)
136 *
137 * @return status code
138 */
139rtems_status_code rtems_io_initialize(
140  rtems_device_major_number  major,
141  rtems_device_minor_number  minor,
142  void                      *argument
143);
144
145/**
146 * @brief Opening for the IO manager.
147 * 
148 * Opens a device driver with the number @a major.
149 *
150 * @param[in] major is the device driver number.
151 * @param[in] minor is the device number.
152 * @param[in] argument is the pointer to the argument(s).
153 *
154 * @return Status code.
155 */
156rtems_status_code rtems_io_open(
157  rtems_device_major_number  major,
158  rtems_device_minor_number  minor,
159  void                      *argument
160);
161
162/**
163 * @brief Closing for the IO manager.
164 * 
165 * This routine is the close directive of the IO manager.
166 *
167 * @param[in] major is the device driver number.
168 * @param[in] minor is the device number.
169 * @param[in] argument is the pointer to the argument(s).
170 *
171 * @return Status code.
172 */
173rtems_status_code rtems_io_close(
174  rtems_device_major_number  major,
175  rtems_device_minor_number  minor,
176  void                      *argument
177);
178
179/**
180 * @brief Reading for the IO manager.
181 * 
182 * This routine is the read directive of the IO manager.
183 *
184 * @param[in] major is the device driver number.
185 * @param[in] minor is the device number.
186 * @param[in] argument is the pointer to the argument(s).
187 *
188 * @return Status code.
189 */
190rtems_status_code rtems_io_read(
191  rtems_device_major_number  major,
192  rtems_device_minor_number  minor,
193  void                      *argument
194);
195
196/**
197 * @brief Writing for the IO manager.
198 * 
199 * This routine is the write directive of the IO manager.
200 *
201 * @param[in] major is the device driver number.
202 * @param[in] minor is the device number.
203 * @param[in] argument is the pointer to the argument(s).
204 *
205 * @return Status code.
206 */
207rtems_status_code rtems_io_write(
208  rtems_device_major_number  major,
209  rtems_device_minor_number  minor,
210  void                      *argument
211);
212
213/**
214 * @brief Control for the IO manager.
215 * 
216 * This routine is the control directive of the IO manager.
217 *
218 * @param[in] major is the device driver number.
219 * @param[in] minor is the device number.
220 * @param[in] argument is the pointer to the argument(s).
221 *
222 * @return Status code.
223 */
224rtems_status_code rtems_io_control(
225  rtems_device_major_number  major,
226  rtems_device_minor_number  minor,
227  void                      *argument
228);
229
230/** @} */
231
232/** @} */
233
234typedef struct {
235    const char               *device_name;
236    size_t                    device_name_length;
237    rtems_device_major_number major;
238    rtems_device_minor_number minor;
239} rtems_driver_name_t;
240
241/**
242 * @deprecated Use stat() instead.
243 */
244rtems_status_code rtems_io_lookup_name(
245    const char           *name,
246    rtems_driver_name_t  *device_info
247) RTEMS_DEPRECATED;
248
249#ifdef __cplusplus
250}
251#endif
252
253#endif
254/* end of include file */
Note: See TracBrowser for help on using the repository browser.