source: rtems/cpukit/include/rtems/score/schedulerpriorityimpl.h @ 878487b0

5
Last change on this file since 878487b0 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: 6.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief Inlined Routines Associated with the Manipulation of the
5 * Priority-Based Scheduling Structures
6 *
7 * This inline file contains all of the inlined routines associated with
8 * the manipulation of the priority-based scheduling structures.
9 */
10
11/*
12 *  Copyright (C) 2010 Gedare Bloom.
13 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.org/license/LICENSE.
18 */
19
20#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYIMPL_H
21#define _RTEMS_SCORE_SCHEDULERPRIORITYIMPL_H
22
23#include <rtems/score/schedulerpriority.h>
24#include <rtems/score/chainimpl.h>
25#include <rtems/score/prioritybitmapimpl.h>
26#include <rtems/score/schedulerimpl.h>
27#include <rtems/score/thread.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/**
34 * @addtogroup ScoreSchedulerDPS
35 */
36/**@{**/
37
38RTEMS_INLINE_ROUTINE Scheduler_priority_Context *
39  _Scheduler_priority_Get_context( const Scheduler_Control *scheduler )
40{
41  return (Scheduler_priority_Context *) _Scheduler_Get_context( scheduler );
42}
43
44RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Thread_get_node(
45  Thread_Control *the_thread
46)
47{
48  return (Scheduler_priority_Node *) _Thread_Scheduler_get_home_node( the_thread );
49}
50
51RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Node_downcast(
52  Scheduler_Node *node
53)
54{
55  return (Scheduler_priority_Node *) node;
56}
57
58/**
59 * @brief Ready queue initialization.
60 *
61 * This routine initializes @a ready_queues for priority-based scheduling.
62 */
63RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize(
64  Chain_Control    *ready_queues,
65  Priority_Control  maximum_priority
66)
67{
68  size_t index;
69
70  for ( index = 0 ; index <= (size_t) maximum_priority ; ++index ) {
71    _Chain_Initialize_empty( &ready_queues[ index ] );
72  }
73}
74
75/**
76 * @brief Enqueues a node on the specified ready queue.
77 *
78 * The node is placed as the last element of its priority group.
79 *
80 * @param[in] node The node to enqueue.
81 * @param[in] ready_queue The ready queue.
82 * @param[in] bit_map The priority bit map of the scheduler instance.
83 */
84RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue(
85  Chain_Node                     *node,
86  Scheduler_priority_Ready_queue *ready_queue,
87  Priority_bit_map_Control       *bit_map
88)
89{
90  Chain_Control *ready_chain = ready_queue->ready_chain;
91
92  _Chain_Append_unprotected( ready_chain, node );
93  _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map );
94}
95
96/**
97 * @brief Enqueues a node on the specified ready queue as first.
98 *
99 * The node is placed as the first element of its priority group.
100 *
101 * @param[in] node The node to enqueue as first.
102 * @param[in] ready_queue The ready queue.
103 * @param[in] bit_map The priority bit map of the scheduler instance.
104 */
105RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first(
106  Chain_Node                     *node,
107  Scheduler_priority_Ready_queue *ready_queue,
108  Priority_bit_map_Control       *bit_map
109)
110{
111  Chain_Control *ready_chain = ready_queue->ready_chain;
112
113  _Chain_Prepend_unprotected( ready_chain, node );
114  _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map );
115}
116
117/**
118 * @brief Extracts a node from the specified ready queue.
119 *
120 * @param[in] node The node to extract.
121 * @param[in] ready_queue The ready queue.
122 * @param[in] bit_map The priority bit map of the scheduler instance.
123 */
124RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(
125  Chain_Node                     *node,
126  Scheduler_priority_Ready_queue *ready_queue,
127  Priority_bit_map_Control       *bit_map
128)
129{
130  Chain_Control *ready_chain = ready_queue->ready_chain;
131
132  if ( _Chain_Has_only_one_node( ready_chain ) ) {
133    _Chain_Initialize_empty( ready_chain );
134    _Chain_Initialize_node( node );
135    _Priority_bit_map_Remove( bit_map, &ready_queue->Priority_map );
136  } else {
137    _Chain_Extract_unprotected( node );
138  }
139}
140
141RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body(
142  const Scheduler_Control *scheduler,
143  Thread_Control          *the_thread,
144  Scheduler_Node          *node
145)
146{
147  Scheduler_priority_Context *context;
148  Scheduler_priority_Node    *the_node;
149
150  context = _Scheduler_priority_Get_context( scheduler );
151  the_node = _Scheduler_priority_Node_downcast( node );
152
153  _Scheduler_priority_Ready_queue_extract(
154    &the_thread->Object.Node,
155    &the_node->Ready_queue,
156    &context->Bit_map
157  );
158}
159
160/**
161 * @brief Return a pointer to the first node.
162 *
163 * This routines returns a pointer to the first node on @a ready_queues.
164 *
165 * @param[in] bit_map The priority bit map of the scheduler instance.
166 * @param[in] ready_queues The ready queues of the scheduler instance.
167 *
168 * @return This method returns the first node.
169 */
170RTEMS_INLINE_ROUTINE Chain_Node *_Scheduler_priority_Ready_queue_first(
171  Priority_bit_map_Control *bit_map,
172  Chain_Control            *ready_queues
173)
174{
175  Priority_Control index = _Priority_bit_map_Get_highest( bit_map );
176  Chain_Node *first = _Chain_First( &ready_queues[ index ] );
177
178  _Assert( first != _Chain_Tail( &ready_queues[ index ] ) );
179
180  return first;
181}
182
183/**
184 * @brief Scheduling decision logic.
185 *
186 * This kernel routine implements scheduling decision logic
187 * for priority-based scheduling.
188 */
189RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(
190  const Scheduler_Control *scheduler,
191  Thread_Control          *the_thread,
192  bool                     force_dispatch
193)
194{
195  Scheduler_priority_Context *context =
196    _Scheduler_priority_Get_context( scheduler );
197  Thread_Control *heir = (Thread_Control *)
198    _Scheduler_priority_Ready_queue_first(
199      &context->Bit_map,
200      &context->Ready[ 0 ]
201    );
202
203  ( void ) the_thread;
204
205  _Scheduler_Update_heir( heir, force_dispatch );
206}
207
208/**
209 * @brief Updates the specified ready queue data according to the new priority
210 * value.
211 *
212 * @param[in] ready_queue The ready queue.
213 * @param[in] new_priority The new priority.
214 * @param[in] bit_map The priority bit map of the scheduler instance.
215 * @param[in] ready_queues The ready queues of the scheduler instance.
216 */
217RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update(
218  Scheduler_priority_Ready_queue *ready_queue,
219  unsigned int                    new_priority,
220  Priority_bit_map_Control       *bit_map,
221  Chain_Control                  *ready_queues
222)
223{
224  ready_queue->current_priority = new_priority;
225  ready_queue->ready_chain = &ready_queues[ new_priority ];
226
227  _Priority_bit_map_Initialize_information(
228    bit_map,
229    &ready_queue->Priority_map,
230    new_priority
231  );
232}
233
234/** @} */
235
236#ifdef __cplusplus
237}
238#endif
239
240#endif
241/* end of include file */
Note: See TracBrowser for help on using the repository browser.