RTEMS: cpukit/include/rtems/confdefs/scheduler.h Source File

| RTEMS 5.4-rc2

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