source: rtems/cpukit/include/rtems/score/processormask.h @ 21275b58

Last change on this file since 21275b58 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.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief Processor Mask API
5 *
6 * @ingroup ScoreProcessorMask
7 */
8
9/*
10 * Copyright (c) 2016, 2017 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _RTEMS_SCORE_PROCESSORMASK_H
24#define _RTEMS_SCORE_PROCESSORMASK_H
25
26#include <rtems/score/cpu.h>
27
28#include <sys/cpuset.h>
29
30#include <strings.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif /* __cplusplus */
35
36/**
37 * @defgroup ScoreProcessorMask Processor Mask
38 *
39 * @ingroup Score
40 *
41 * The processor mask provides a bit map large enough to provide one bit for
42 * each processor in the system.  It is a fixed size internal data type
43 * provided for efficiency in addition to the API level cpu_set_t.
44 *
45 * @{
46 */
47
48/**
49 * @brief A bit map which is large enough to provide one bit for each processor
50 * in the system.
51 */
52typedef BITSET_DEFINE( Processor_mask, CPU_MAXIMUM_PROCESSORS ) Processor_mask;
53
54RTEMS_INLINE_ROUTINE void _Processor_mask_Zero( Processor_mask *mask )
55{
56  BIT_ZERO( CPU_MAXIMUM_PROCESSORS, mask );
57}
58
59RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_zero( const Processor_mask *mask )
60{
61  return BIT_EMPTY( CPU_MAXIMUM_PROCESSORS, mask );
62}
63
64RTEMS_INLINE_ROUTINE void _Processor_mask_Fill( Processor_mask *mask )
65{
66  BIT_FILL( CPU_MAXIMUM_PROCESSORS, mask );
67}
68
69RTEMS_INLINE_ROUTINE void _Processor_mask_Assign(
70  Processor_mask *dst, const Processor_mask *src
71)
72{
73  BIT_COPY( CPU_MAXIMUM_PROCESSORS, src, dst );
74}
75
76RTEMS_INLINE_ROUTINE void _Processor_mask_Set(
77  Processor_mask *mask,
78  uint32_t        index
79)
80{
81  BIT_SET( CPU_MAXIMUM_PROCESSORS, index, mask );
82}
83
84RTEMS_INLINE_ROUTINE void _Processor_mask_Clear(
85  Processor_mask *mask,
86  uint32_t        index
87)
88{
89  BIT_CLR( CPU_MAXIMUM_PROCESSORS, index, mask );
90}
91
92RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_set(
93  const Processor_mask *mask,
94  uint32_t              index
95)
96{
97  return BIT_ISSET( CPU_MAXIMUM_PROCESSORS, index, mask );
98}
99
100/**
101 * @brief Returns true if the processor sets a and b are equal, and false
102 * otherwise.
103 */
104RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_equal(
105  const Processor_mask *a,
106  const Processor_mask *b
107)
108{
109  return !BIT_CMP( CPU_MAXIMUM_PROCESSORS, a, b );
110}
111
112/**
113 * @brief Returns true if the intersection of the processor sets a and b is
114 * non-empty, and false otherwise.
115 */
116RTEMS_INLINE_ROUTINE bool _Processor_mask_Has_overlap(
117  const Processor_mask *a,
118  const Processor_mask *b
119)
120{
121  return BIT_OVERLAP( CPU_MAXIMUM_PROCESSORS, a, b );
122}
123
124/**
125 * @brief Returns true if the processor set small is a subset of processor set
126 * big, and false otherwise.
127 */
128RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_subset(
129  const Processor_mask *big,
130  const Processor_mask *small
131)
132{
133  return BIT_SUBSET( CPU_MAXIMUM_PROCESSORS, big, small );
134}
135
136/**
137 * @brief Performs a bitwise a = b & c.
138 */
139RTEMS_INLINE_ROUTINE void _Processor_mask_And(
140  Processor_mask       *a,
141  const Processor_mask *b,
142  const Processor_mask *c
143)
144{
145  BIT_AND2( CPU_MAXIMUM_PROCESSORS, a, b, c );
146}
147
148/**
149 * @brief Performs a bitwise a = b & ~c.
150 */
151RTEMS_INLINE_ROUTINE void _Processor_mask_Nand(
152  Processor_mask       *a,
153  const Processor_mask *b,
154  const Processor_mask *c
155)
156{
157  BIT_NAND2( CPU_MAXIMUM_PROCESSORS, a, b, c );
158}
159
160/**
161 * @brief Performs a bitwise a = b | c.
162 */
163RTEMS_INLINE_ROUTINE void _Processor_mask_Or(
164  Processor_mask       *a,
165  const Processor_mask *b,
166  const Processor_mask *c
167)
168{
169  BIT_OR2( CPU_MAXIMUM_PROCESSORS, a, b, c );
170}
171
172/**
173 * @brief Performs a bitwise a = b ^ c.
174 */
175RTEMS_INLINE_ROUTINE void _Processor_mask_Xor(
176  Processor_mask       *a,
177  const Processor_mask *b,
178  const Processor_mask *c
179)
180{
181  BIT_XOR2( CPU_MAXIMUM_PROCESSORS, a, b, c );
182}
183
184RTEMS_INLINE_ROUTINE uint32_t _Processor_mask_Count( const Processor_mask *a )
185{
186  return (uint32_t) BIT_COUNT( CPU_MAXIMUM_PROCESSORS, a );
187}
188
189RTEMS_INLINE_ROUTINE uint32_t _Processor_mask_Find_last_set( const Processor_mask *a )
190{
191  return (uint32_t) BIT_FLS( CPU_MAXIMUM_PROCESSORS, a );
192}
193
194/**
195 * @brief Returns the subset of 32 processors containing the specified index as
196 * an unsigned 32-bit integer.
197 */
198RTEMS_INLINE_ROUTINE uint32_t _Processor_mask_To_uint32_t(
199  const Processor_mask *mask,
200  uint32_t              index
201)
202{
203  long bits = mask->__bits[ __bitset_words( index ) ];
204
205  return (uint32_t) (bits >> (32 * (index % _BITSET_BITS) / 32));
206}
207
208/**
209 * @brief Creates a processor set from an unsigned 32-bit integer relative to
210 * the specified index.
211 */
212RTEMS_INLINE_ROUTINE void _Processor_mask_From_uint32_t(
213  Processor_mask *mask,
214  uint32_t        bits,
215  uint32_t        index
216)
217{
218  _Processor_mask_Zero( mask );
219  mask->__bits[ __bitset_words( index ) ] = ((long) bits) << (32 * (index % _BITSET_BITS) / 32);
220}
221
222/**
223 * @brief Creates a processor set from the specified index.
224 */
225RTEMS_INLINE_ROUTINE void _Processor_mask_From_index(
226  Processor_mask *mask,
227  uint32_t        index
228)
229{
230  BIT_SETOF( CPU_MAXIMUM_PROCESSORS, (int) index, mask );
231}
232
233typedef enum {
234  PROCESSOR_MASK_COPY_LOSSLESS,
235  PROCESSOR_MASK_COPY_PARTIAL_LOSS,
236  PROCESSOR_MASK_COPY_COMPLETE_LOSS,
237  PROCESSOR_MASK_COPY_INVALID_SIZE
238} Processor_mask_Copy_status;
239
240RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_at_most_partial_loss(
241  Processor_mask_Copy_status status
242)
243{
244  return (unsigned int) status <= PROCESSOR_MASK_COPY_PARTIAL_LOSS;
245}
246
247Processor_mask_Copy_status _Processor_mask_Copy(
248  long       *dst,
249  size_t      dst_size,
250  const long *src,
251  size_t      src_size
252);
253
254RTEMS_INLINE_ROUTINE Processor_mask_Copy_status _Processor_mask_To_cpu_set_t(
255  const Processor_mask *src,
256  size_t                dst_size,
257  cpu_set_t            *dst
258)
259{
260  return _Processor_mask_Copy(
261    &dst->__bits[ 0 ],
262    dst_size,
263    &src->__bits[ 0 ],
264    sizeof( *src )
265  );
266}
267
268RTEMS_INLINE_ROUTINE Processor_mask_Copy_status _Processor_mask_From_cpu_set_t(
269  Processor_mask  *dst,
270  size_t           src_size,
271  const cpu_set_t *src
272)
273{
274  return _Processor_mask_Copy(
275    &dst->__bits[ 0 ],
276    sizeof( *dst ),
277    &src->__bits[ 0 ],
278    src_size
279  );
280}
281
282extern const Processor_mask _Processor_mask_The_one_and_only;
283
284/** @} */
285
286#ifdef __cplusplus
287}
288#endif /* __cplusplus */
289
290#endif /* _RTEMS_SCORE_PROCESSORMASK_H */
Note: See TracBrowser for help on using the repository browser.