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

5
Last change on this file since 21275b58 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: 4.7 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreSchedulerPrioritySMP
5 *
6 * @brief Deterministic Priority SMP Scheduler API
7 */
8
9/*
10 * Copyright (c) 2013, 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_SCHEDULERPRIORITYSMPIMPL_H
24#define _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H
25
26#include <rtems/score/schedulerprioritysmp.h>
27#include <rtems/score/schedulerpriorityimpl.h>
28#include <rtems/score/schedulersimpleimpl.h>
29#include <rtems/score/schedulersmpimpl.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif /* __cplusplus */
34
35/**
36 * @ingroup ScoreSchedulerPrioritySMP
37 * @{
38 */
39
40static inline Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self(
41  Scheduler_Context *context
42)
43{
44  return (Scheduler_priority_SMP_Context *) context;
45}
46
47static inline Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Thread_get_node(
48  Thread_Control *thread
49)
50{
51  return (Scheduler_priority_SMP_Node *) _Thread_Scheduler_get_home_node( thread );
52}
53
54static inline Scheduler_priority_SMP_Node *
55_Scheduler_priority_SMP_Node_downcast( Scheduler_Node *node )
56{
57  return (Scheduler_priority_SMP_Node *) node;
58}
59
60static inline bool _Scheduler_priority_SMP_Has_ready( Scheduler_Context *context )
61{
62  Scheduler_priority_SMP_Context *self =
63    _Scheduler_priority_SMP_Get_self( context );
64
65  return !_Priority_bit_map_Is_empty( &self->Bit_map );
66}
67
68static inline void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
69  Scheduler_Context *context,
70  Scheduler_Node    *scheduled_to_ready
71)
72{
73  Scheduler_priority_SMP_Context *self =
74    _Scheduler_priority_SMP_Get_self( context );
75  Scheduler_priority_SMP_Node *node =
76    _Scheduler_priority_SMP_Node_downcast( scheduled_to_ready );
77
78  _Chain_Extract_unprotected( &node->Base.Base.Node.Chain );
79  _Scheduler_priority_Ready_queue_enqueue_first(
80    &node->Base.Base.Node.Chain,
81    &node->Ready_queue,
82    &self->Bit_map
83  );
84}
85
86static inline void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
87  Scheduler_Context *context,
88  Scheduler_Node    *ready_to_scheduled
89)
90{
91  Scheduler_priority_SMP_Context *self;
92  Scheduler_priority_SMP_Node    *node;
93  Priority_Control                insert_priority;
94
95  self = _Scheduler_priority_SMP_Get_self( context );
96  node = _Scheduler_priority_SMP_Node_downcast( ready_to_scheduled );
97
98  _Scheduler_priority_Ready_queue_extract(
99    &node->Base.Base.Node.Chain,
100    &node->Ready_queue,
101    &self->Bit_map
102  );
103  insert_priority = _Scheduler_SMP_Node_priority( &node->Base.Base );
104  insert_priority = SCHEDULER_PRIORITY_APPEND( insert_priority );
105  _Chain_Insert_ordered_unprotected(
106    &self->Base.Scheduled,
107    &node->Base.Base.Node.Chain,
108    &insert_priority,
109    _Scheduler_SMP_Priority_less_equal
110  );
111}
112
113static inline void _Scheduler_priority_SMP_Insert_ready(
114  Scheduler_Context *context,
115  Scheduler_Node    *node_base,
116  Priority_Control   insert_priority
117)
118{
119  Scheduler_priority_SMP_Context *self;
120  Scheduler_priority_SMP_Node    *node;
121
122  self = _Scheduler_priority_SMP_Get_self( context );
123  node = _Scheduler_priority_SMP_Node_downcast( node_base );
124
125  if ( SCHEDULER_PRIORITY_IS_APPEND( insert_priority ) ) {
126    _Scheduler_priority_Ready_queue_enqueue(
127      &node->Base.Base.Node.Chain,
128      &node->Ready_queue,
129      &self->Bit_map
130    );
131  } else {
132    _Scheduler_priority_Ready_queue_enqueue_first(
133      &node->Base.Base.Node.Chain,
134      &node->Ready_queue,
135      &self->Bit_map
136    );
137  }
138}
139
140static inline void _Scheduler_priority_SMP_Extract_from_ready(
141  Scheduler_Context *context,
142  Scheduler_Node    *thread
143)
144{
145  Scheduler_priority_SMP_Context *self =
146    _Scheduler_priority_SMP_Get_self( context );
147  Scheduler_priority_SMP_Node *node =
148    _Scheduler_priority_SMP_Node_downcast( thread );
149
150  _Scheduler_priority_Ready_queue_extract(
151    &node->Base.Base.Node.Chain,
152    &node->Ready_queue,
153    &self->Bit_map
154  );
155}
156
157static inline void _Scheduler_priority_SMP_Do_update(
158  Scheduler_Context *context,
159  Scheduler_Node    *node_to_update,
160  Priority_Control   new_priority
161)
162{
163  Scheduler_priority_SMP_Context *self;
164  Scheduler_priority_SMP_Node    *node;
165
166  self = _Scheduler_priority_SMP_Get_self( context );
167  node = _Scheduler_priority_SMP_Node_downcast( node_to_update );
168
169  _Scheduler_SMP_Node_update_priority( &node->Base, new_priority );
170  _Scheduler_priority_Ready_queue_update(
171    &node->Ready_queue,
172    SCHEDULER_PRIORITY_UNMAP( new_priority ),
173    &self->Bit_map,
174    &self->Ready[ 0 ]
175  );
176}
177
178/** @} */
179
180#ifdef __cplusplus
181}
182#endif /* __cplusplus */
183
184#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H */
Note: See TracBrowser for help on using the repository browser.