RTEMS 6.1-rc6
Loading...
Searching...
No Matches
scheduler.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * Copyright (C) 2020 embedded brains GmbH & Co. KG
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _RTEMS_CONFDEFS_SCHEDULER_H
38#define _RTEMS_CONFDEFS_SCHEDULER_H
39
40#ifndef __CONFIGURATION_TEMPLATE_h
41#error "Do not include this file directly, use <rtems/confdefs.h> instead"
42#endif
43
44#ifdef CONFIGURE_INIT
45
47
48#if !defined(CONFIGURE_SCHEDULER_CBS) \
49 && !defined(CONFIGURE_SCHEDULER_EDF) \
50 && !defined(CONFIGURE_SCHEDULER_EDF_SMP) \
51 && !defined(CONFIGURE_SCHEDULER_PRIORITY) \
52 && !defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) \
53 && !defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) \
54 && !defined(CONFIGURE_SCHEDULER_SIMPLE) \
55 && !defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) \
56 && !defined(CONFIGURE_SCHEDULER_STRONG_APA) \
57 && !defined(CONFIGURE_SCHEDULER_USER)
58 #if defined(RTEMS_SMP) && _CONFIGURE_MAXIMUM_PROCESSORS > 1
59 #define CONFIGURE_SCHEDULER_EDF_SMP
60 #else
61 #define CONFIGURE_SCHEDULER_PRIORITY
62 #endif
63#endif
64
65#include <rtems/scheduler.h>
66
67#ifdef __cplusplus
68extern "C" {
69#endif
70
71#ifndef CONFIGURE_MAXIMUM_PRIORITY
72 #define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM
73#endif
74
75#if CONFIGURE_MAXIMUM_PRIORITY != 3 \
76 && CONFIGURE_MAXIMUM_PRIORITY != 7 \
77 && CONFIGURE_MAXIMUM_PRIORITY != 15 \
78 && CONFIGURE_MAXIMUM_PRIORITY != 31 \
79 && CONFIGURE_MAXIMUM_PRIORITY != 63 \
80 && CONFIGURE_MAXIMUM_PRIORITY != 127 \
81 && CONFIGURE_MAXIMUM_PRIORITY != 255
82 #error "CONFIGURE_MAXIMUM_PRIORITY must be one of 3, 7, 15, 31, 63, 127, and 255"
83#endif
84
85#if CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM
86 #error "CONFIGURE_SCHEDULER_PRIORITY must be less than or equal to the architecture defined maximum priority"
87#endif
88
89#ifdef CONFIGURE_SCHEDULER_PRIORITY
90 #ifndef CONFIGURE_SCHEDULER_NAME
91 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'U', 'P', 'D', ' ' )
92 #endif
93
94 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
95 #define CONFIGURE_SCHEDULER \
96 RTEMS_SCHEDULER_PRIORITY( \
97 dflt, \
98 CONFIGURE_MAXIMUM_PRIORITY + 1 \
99 )
100
101 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
102 RTEMS_SCHEDULER_TABLE_PRIORITY( dflt, CONFIGURE_SCHEDULER_NAME )
103 #endif
104#endif
105
106#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
107 #ifndef CONFIGURE_SCHEDULER_NAME
108 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'P', 'D', ' ' )
109 #endif
110
111 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
112 #define CONFIGURE_SCHEDULER \
113 RTEMS_SCHEDULER_PRIORITY_SMP( \
114 dflt, \
115 CONFIGURE_MAXIMUM_PRIORITY + 1 \
116 )
117
118 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
119 RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( dflt, CONFIGURE_SCHEDULER_NAME )
120 #endif
121#endif
122
123#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
124 #ifndef CONFIGURE_SCHEDULER_NAME
125 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'P', 'A', ' ' )
126 #endif
127
128 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
129 #define CONFIGURE_SCHEDULER \
130 RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( \
131 dflt, \
132 CONFIGURE_MAXIMUM_PRIORITY + 1 \
133 )
134
135 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
136 RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( \
137 dflt, \
138 CONFIGURE_SCHEDULER_NAME \
139 )
140 #endif
141#endif
142
143#ifdef CONFIGURE_SCHEDULER_STRONG_APA
144 #ifndef CONFIGURE_SCHEDULER_NAME
145 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'A', 'P', 'A' )
146 #endif
147
148 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
149 #define CONFIGURE_SCHEDULER \
150 RTEMS_SCHEDULER_STRONG_APA( \
151 dflt, \
152 CONFIGURE_MAXIMUM_PRIORITY + 1 \
153 )
154
155 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
156 RTEMS_SCHEDULER_TABLE_STRONG_APA( dflt, CONFIGURE_SCHEDULER_NAME )
157 #endif
158#endif
159
160#ifdef CONFIGURE_SCHEDULER_SIMPLE
161 #ifndef CONFIGURE_SCHEDULER_NAME
162 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'U', 'P', 'S', ' ' )
163 #endif
164
165 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
166 #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_SIMPLE( dflt )
167
168 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
169 RTEMS_SCHEDULER_TABLE_SIMPLE( dflt, CONFIGURE_SCHEDULER_NAME )
170 #endif
171#endif
172
173#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
174 #ifndef CONFIGURE_SCHEDULER_NAME
175 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'P', 'S', ' ' )
176 #endif
177
178 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
179 #define CONFIGURE_SCHEDULER \
180 RTEMS_SCHEDULER_SIMPLE_SMP( dflt )
181
182 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
183 RTEMS_SCHEDULER_TABLE_SIMPLE_SMP( dflt, CONFIGURE_SCHEDULER_NAME )
184 #endif
185#endif
186
187#ifdef CONFIGURE_SCHEDULER_EDF
188 #ifndef CONFIGURE_SCHEDULER_NAME
189 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'U', 'E', 'D', 'F' )
190 #endif
191
192 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
193 #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_EDF( dflt )
194
195 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
196 RTEMS_SCHEDULER_TABLE_EDF( dflt, CONFIGURE_SCHEDULER_NAME )
197 #endif
198#endif
199
200#ifdef CONFIGURE_SCHEDULER_EDF_SMP
201 #ifndef CONFIGURE_SCHEDULER_NAME
202 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'E', 'D', 'F' )
203 #endif
204
205 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
206 #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_EDF_SMP( dflt )
207
208 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
209 RTEMS_SCHEDULER_TABLE_EDF_SMP( dflt, CONFIGURE_SCHEDULER_NAME )
210 #endif
211#endif
212
213#ifdef CONFIGURE_SCHEDULER_CBS
214 #ifndef CONFIGURE_SCHEDULER_NAME
215 #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'U', 'C', 'B', 'S' )
216 #endif
217
218 #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES
219 #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_CBS( dflt )
220
221 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
222 RTEMS_SCHEDULER_TABLE_CBS( dflt, CONFIGURE_SCHEDULER_NAME )
223 #endif
224
225 #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
226 #define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS
227 #endif
228
229 const uint32_t _Scheduler_CBS_Maximum_servers =
231
234#endif
235
236#ifdef CONFIGURE_SCHEDULER
237 /*
238 * Ignore these warnings:
239 *
240 * - invalid use of structure with flexible array member
241 *
242 * - struct has no members
243 */
244 #pragma GCC diagnostic push
245 #pragma GCC diagnostic ignored "-Wpedantic"
246 CONFIGURE_SCHEDULER;
247 #pragma GCC diagnostic pop
248#endif
249
252};
253
254#define _CONFIGURE_SCHEDULER_COUNT RTEMS_ARRAY_SIZE( _Scheduler_Table )
255
256#ifdef RTEMS_SMP
257
258const size_t _Scheduler_Count = _CONFIGURE_SCHEDULER_COUNT;
259
260const Scheduler_Assignment _Scheduler_Initial_assignments[] = {
261 #ifdef CONFIGURE_SCHEDULER_ASSIGNMENTS
263 #else
264 #define _CONFIGURE_SCHEDULER_ASSIGN \
265 RTEMS_SCHEDULER_ASSIGN( \
266 0, \
267 RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \
268 )
269 _CONFIGURE_SCHEDULER_ASSIGN
270 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 2
271 , _CONFIGURE_SCHEDULER_ASSIGN
272 #endif
273 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 3
274 , _CONFIGURE_SCHEDULER_ASSIGN
275 #endif
276 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 4
277 , _CONFIGURE_SCHEDULER_ASSIGN
278 #endif
279 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 5
280 , _CONFIGURE_SCHEDULER_ASSIGN
281 #endif
282 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 6
283 , _CONFIGURE_SCHEDULER_ASSIGN
284 #endif
285 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 7
286 , _CONFIGURE_SCHEDULER_ASSIGN
287 #endif
288 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 8
289 , _CONFIGURE_SCHEDULER_ASSIGN
290 #endif
291 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 9
292 , _CONFIGURE_SCHEDULER_ASSIGN
293 #endif
294 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 10
295 , _CONFIGURE_SCHEDULER_ASSIGN
296 #endif
297 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 11
298 , _CONFIGURE_SCHEDULER_ASSIGN
299 #endif
300 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 12
301 , _CONFIGURE_SCHEDULER_ASSIGN
302 #endif
303 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 13
304 , _CONFIGURE_SCHEDULER_ASSIGN
305 #endif
306 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 14
307 , _CONFIGURE_SCHEDULER_ASSIGN
308 #endif
309 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 15
310 , _CONFIGURE_SCHEDULER_ASSIGN
311 #endif
312 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 16
313 , _CONFIGURE_SCHEDULER_ASSIGN
314 #endif
315 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 17
316 , _CONFIGURE_SCHEDULER_ASSIGN
317 #endif
318 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 18
319 , _CONFIGURE_SCHEDULER_ASSIGN
320 #endif
321 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 19
322 , _CONFIGURE_SCHEDULER_ASSIGN
323 #endif
324 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 20
325 , _CONFIGURE_SCHEDULER_ASSIGN
326 #endif
327 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 21
328 , _CONFIGURE_SCHEDULER_ASSIGN
329 #endif
330 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 22
331 , _CONFIGURE_SCHEDULER_ASSIGN
332 #endif
333 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 23
334 , _CONFIGURE_SCHEDULER_ASSIGN
335 #endif
336 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 24
337 , _CONFIGURE_SCHEDULER_ASSIGN
338 #endif
339 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 25
340 , _CONFIGURE_SCHEDULER_ASSIGN
341 #endif
342 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 26
343 , _CONFIGURE_SCHEDULER_ASSIGN
344 #endif
345 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 27
346 , _CONFIGURE_SCHEDULER_ASSIGN
347 #endif
348 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 28
349 , _CONFIGURE_SCHEDULER_ASSIGN
350 #endif
351 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 29
352 , _CONFIGURE_SCHEDULER_ASSIGN
353 #endif
354 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 30
355 , _CONFIGURE_SCHEDULER_ASSIGN
356 #endif
357 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 31
358 , _CONFIGURE_SCHEDULER_ASSIGN
359 #endif
360 #if _CONFIGURE_MAXIMUM_PROCESSORS >= 32
361 , _CONFIGURE_SCHEDULER_ASSIGN
362 #endif
363 #undef _CONFIGURE_SCHEDULER_ASSIGN
364 #endif
365};
366
368 _CONFIGURE_MAXIMUM_PROCESSORS
369 == RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ),
370 _Scheduler_Initial_assignments
371);
372
373#endif /* RTEMS_SMP */
374
375#ifdef __cplusplus
376}
377#endif
378
379#endif /* CONFIGURE_INIT */
380
381#endif /* _RTEMS_CONFDEFS_SCHEDULER_H */
This header file evaluates configuration options related to the per-CPU configuration.
#define RTEMS_STATIC_ASSERT(_cond, _msg)
It is defined if a static analysis run is performed.
Definition: basedefs.h:841
#define RTEMS_ARRAY_SIZE(_array)
Gets the element count of the array.
Definition: basedefs.h:244
#define CONFIGURE_SCHEDULER_TABLE_ENTRIES
This configuration option is an initializer define.
Definition: appl-config.h:5024
#define CONFIGURE_SCHEDULER_ASSIGNMENTS
This configuration option is an initializer define.
Definition: appl-config.h:4615
#define CONFIGURE_CBS_MAXIMUM_SERVERS
This configuration option is an integer define.
Definition: appl-config.h:4503
Scheduler_CBS_Server _Scheduler_CBS_Server_list[]
const uint32_t _Scheduler_CBS_Maximum_servers
#define _Scheduler_Count
This constant contains the count of configured schedulers.
Definition: scheduler.h:395
const Scheduler_Control _Scheduler_Table[]
This table contains the configured schedulers.
Definition: schedulercbs.h:133
Scheduler control.
Definition: scheduler.h:337