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

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
scheduler.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2014, 2018 embedded brains GmbH. All rights reserved.
9 *
10 * embedded brains GmbH
11 * Dornierstr. 4
12 * 82178 Puchheim
13 * Germany
14 * <rtems@embedded-brains.de>
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.org/license/LICENSE.
19 */
20
21#ifndef _RTEMS_SAPI_SCHEDULER_H
22#define _RTEMS_SAPI_SCHEDULER_H
23
24#include <rtems/score/scheduler.h>
25
26#define SCHEDULER_CONTEXT_NAME( name ) \
27 _Configuration_Scheduler_ ## name
28
29#if defined(RTEMS_SMP)
30 #define SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( value ) \
31 , value
32#else
33 #define SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( value )
34#endif
35
36#if defined(RTEMS_SMP)
37 /* This object doesn't exist and indicates a configuration error */
38 extern const Scheduler_Control RTEMS_SCHEDULER_INVALID_INDEX;
39
40 #define RTEMS_SCHEDULER_ASSIGN_DEFAULT \
41 SCHEDULER_ASSIGN_DEFAULT
42
43 #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \
44 SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL
45
46 #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY \
47 SCHEDULER_ASSIGN_PROCESSOR_MANDATORY
48
49 #define RTEMS_SCHEDULER_ASSIGN( index, attr ) \
50 { \
51 ( index ) < RTEMS_ARRAY_SIZE( _Scheduler_Table ) ? \
52 &_Scheduler_Table[ ( index ) ] : &RTEMS_SCHEDULER_INVALID_INDEX, \
53 ( attr ) \
54 }
55
56 #define RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER { NULL, 0 }
57#endif
58
59/*
60 * This file should be only included in the context of <rtems/confdefs.h>.
61 * Define the scheduler configuration macros only in case the corresponding
62 * configure symbol is defined. This is necessary to prevent invalid workspace
63 * size estimates since we have to account for the per-thread scheduler
64 * information.
65 */
66
67#ifdef CONFIGURE_SCHEDULER_CBS
68 #include <rtems/score/schedulercbs.h>
69
70 #define SCHEDULER_CBS_CONTEXT_NAME( name ) \
71 SCHEDULER_CONTEXT_NAME( CBS_ ## name )
72
73 #define RTEMS_SCHEDULER_CBS( name ) \
74 static Scheduler_EDF_Context SCHEDULER_CBS_CONTEXT_NAME( name )
75
76 #define RTEMS_SCHEDULER_TABLE_CBS( name, obj_name ) \
77 { \
78 &SCHEDULER_CBS_CONTEXT_NAME( name ).Base, \
79 SCHEDULER_CBS_ENTRY_POINTS, \
80 SCHEDULER_CBS_MAXIMUM_PRIORITY, \
81 ( obj_name ) \
82 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
83 }
84
85 /* Provided for backward compatibility */
86
87 #define RTEMS_SCHEDULER_CONTEXT_CBS( name ) \
88 RTEMS_SCHEDULER_CBS( name )
89
90 #define RTEMS_SCHEDULER_CONTROL_CBS( name, obj_name ) \
91 RTEMS_SCHEDULER_TABLE_CBS( name, obj_name )
92#endif
93
94#ifdef CONFIGURE_SCHEDULER_EDF
95 #include <rtems/score/scheduleredf.h>
96
97 #define SCHEDULER_EDF_CONTEXT_NAME( name ) \
98 SCHEDULER_CONTEXT_NAME( EDF_ ## name )
99
100 #define RTEMS_SCHEDULER_EDF( name ) \
101 static Scheduler_EDF_Context SCHEDULER_EDF_CONTEXT_NAME( name )
102
103 #define RTEMS_SCHEDULER_TABLE_EDF( name, obj_name ) \
104 { \
105 &SCHEDULER_EDF_CONTEXT_NAME( name ).Base, \
106 SCHEDULER_EDF_ENTRY_POINTS, \
107 SCHEDULER_EDF_MAXIMUM_PRIORITY, \
108 ( obj_name ) \
109 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
110 }
111
112 /* Provided for backward compatibility */
113
114 #define RTEMS_SCHEDULER_CONTEXT_EDF( name ) \
115 RTEMS_SCHEDULER_EDF( name )
116
117 #define RTEMS_SCHEDULER_CONTROL_EDF( name, obj_name ) \
118 RTEMS_SCHEDULER_TABLE_EDF( name, obj_name )
119#endif
120
121#ifdef CONFIGURE_SCHEDULER_EDF_SMP
122 #include <rtems/score/scheduleredfsmp.h>
123
124 #ifndef CONFIGURE_MAXIMUM_PROCESSORS
125 #error "CONFIGURE_MAXIMUM_PROCESSORS must be defined to configure the EDF SMP scheduler"
126 #endif
127
128 #define SCHEDULER_EDF_SMP_CONTEXT_NAME( name ) \
129 SCHEDULER_CONTEXT_NAME( EDF_SMP_ ## name )
130
131 #define RTEMS_SCHEDULER_EDF_SMP( name ) \
132 static struct { \
133 Scheduler_EDF_SMP_Context Base; \
134 Scheduler_EDF_SMP_Ready_queue Ready[ CONFIGURE_MAXIMUM_PROCESSORS + 1 ]; \
135 } SCHEDULER_EDF_SMP_CONTEXT_NAME( name )
136
137 #define RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name ) \
138 { \
139 &SCHEDULER_EDF_SMP_CONTEXT_NAME( name ).Base.Base.Base, \
140 SCHEDULER_EDF_SMP_ENTRY_POINTS, \
141 SCHEDULER_EDF_MAXIMUM_PRIORITY, \
142 ( obj_name ) \
143 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
144 }
145
146 /* Provided for backward compatibility */
147
148 #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP( name, max_cpu_count ) \
149 RTEMS_SCHEDULER_EDF_SMP( name )
150
151 #define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \
152 RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name )
153#endif
154
155#ifdef CONFIGURE_SCHEDULER_PRIORITY
156 #include <rtems/score/schedulerpriority.h>
157
158 #define SCHEDULER_PRIORITY_CONTEXT_NAME( name ) \
159 SCHEDULER_CONTEXT_NAME( priority_ ## name )
160
161 #define RTEMS_SCHEDULER_PRIORITY( name, prio_count ) \
162 static struct { \
163 Scheduler_priority_Context Base; \
164 Chain_Control Ready[ ( prio_count ) ]; \
165 } SCHEDULER_PRIORITY_CONTEXT_NAME( name )
166
167 #define RTEMS_SCHEDULER_TABLE_PRIORITY( name, obj_name ) \
168 { \
169 &SCHEDULER_PRIORITY_CONTEXT_NAME( name ).Base.Base, \
170 SCHEDULER_PRIORITY_ENTRY_POINTS, \
171 RTEMS_ARRAY_SIZE( \
172 SCHEDULER_PRIORITY_CONTEXT_NAME( name ).Ready \
173 ) - 1, \
174 ( obj_name ) \
175 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
176 }
177
178 /* Provided for backward compatibility */
179
180 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \
181 RTEMS_SCHEDULER_PRIORITY( name, prio_count )
182
183 #define RTEMS_SCHEDULER_CONTROL_PRIORITY( name, obj_name ) \
184 RTEMS_SCHEDULER_TABLE_PRIORITY( name, obj_name )
185#endif
186
187#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
188 #include <rtems/score/schedulerpriorityaffinitysmp.h>
189
190 #define SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ) \
191 SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name )
192
193 #define RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( name, prio_count ) \
194 static struct { \
195 Scheduler_priority_SMP_Context Base; \
196 Chain_Control Ready[ ( prio_count ) ]; \
197 } SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name )
198
199 #define RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( name, obj_name ) \
200 { \
201 &SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ).Base.Base.Base, \
202 SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS, \
203 RTEMS_ARRAY_SIZE( \
204 SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ).Ready \
205 ) - 1, \
206 ( obj_name ) \
207 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
208 }
209
210 /* Provided for backward compatibility */
211
212 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \
213 RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( name, prio_count )
214
215 #define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name, obj_name ) \
216 RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( name, obj_name )
217#endif
218
219#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
220 #include <rtems/score/schedulerprioritysmp.h>
221
222 #define SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ) \
223 SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name )
224
225 #define RTEMS_SCHEDULER_PRIORITY_SMP( name, prio_count ) \
226 static struct { \
227 Scheduler_priority_SMP_Context Base; \
228 Chain_Control Ready[ ( prio_count ) ]; \
229 } SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name )
230
231 #define RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( name, obj_name ) \
232 { \
233 &SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ).Base.Base.Base, \
234 SCHEDULER_PRIORITY_SMP_ENTRY_POINTS, \
235 RTEMS_ARRAY_SIZE( \
236 SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ).Ready \
237 ) - 1, \
238 ( obj_name ) \
239 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
240 }
241
242 /* Provided for backward compatibility */
243
244 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \
245 RTEMS_SCHEDULER_PRIORITY_SMP( name, prio_count )
246
247 #define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name, obj_name ) \
248 RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( name, obj_name )
249#endif
250
251#ifdef CONFIGURE_SCHEDULER_STRONG_APA
252 #include <rtems/score/schedulerstrongapa.h>
253
254 #define SCHEDULER_STRONG_APA_CONTEXT_NAME( name ) \
255 SCHEDULER_CONTEXT_NAME( strong_APA_ ## name )
256
257 #define RTEMS_SCHEDULER_STRONG_APA( name, prio_count ) \
258 static struct { \
259 Scheduler_strong_APA_Context Base; \
260 Chain_Control Ready[ ( prio_count ) ]; \
261 } SCHEDULER_STRONG_APA_CONTEXT_NAME( name )
262
263 #define RTEMS_SCHEDULER_TABLE_STRONG_APA( name, obj_name ) \
264 { \
265 &SCHEDULER_STRONG_APA_CONTEXT_NAME( name ).Base.Base.Base, \
266 SCHEDULER_STRONG_APA_ENTRY_POINTS, \
267 RTEMS_ARRAY_SIZE( \
268 SCHEDULER_STRONG_APA_CONTEXT_NAME( name ).Ready \
269 ) - 1, \
270 ( obj_name ) \
271 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
272 }
273
274 /* Provided for backward compatibility */
275
276 #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA( name, prio_count ) \
277 RTEMS_SCHEDULER_STRONG_APA( name, prio_count )
278
279 #define RTEMS_SCHEDULER_CONTROL_STRONG_APA( name, obj_name ) \
280 RTEMS_SCHEDULER_TABLE_STRONG_APA( name, obj_name )
281#endif
282
283#ifdef CONFIGURE_SCHEDULER_SIMPLE
284 #include <rtems/score/schedulersimple.h>
285
286 #define SCHEDULER_SIMPLE_CONTEXT_NAME( name ) \
287 SCHEDULER_CONTEXT_NAME( simple_ ## name )
288
289 #define RTEMS_SCHEDULER_SIMPLE( name ) \
290 static Scheduler_simple_Context \
291 SCHEDULER_SIMPLE_CONTEXT_NAME( name )
292
293 #define RTEMS_SCHEDULER_TABLE_SIMPLE( name, obj_name ) \
294 { \
295 &SCHEDULER_SIMPLE_CONTEXT_NAME( name ).Base, \
296 SCHEDULER_SIMPLE_ENTRY_POINTS, \
297 SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \
298 ( obj_name ) \
299 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
300 }
301
302 /* Provided for backward compatibility */
303
304 #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \
305 RTEMS_SCHEDULER_SIMPLE( name )
306
307 #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name, obj_name ) \
308 RTEMS_SCHEDULER_TABLE_SIMPLE( name, obj_name )
309#endif
310
311#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
312 #include <rtems/score/schedulersimplesmp.h>
313
314 #define SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name ) \
315 SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name )
316
317 #define RTEMS_SCHEDULER_SIMPLE_SMP( name ) \
318 static Scheduler_simple_SMP_Context \
319 SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name )
320
321 #define RTEMS_SCHEDULER_TABLE_SIMPLE_SMP( name, obj_name ) \
322 { \
323 &SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name ).Base.Base, \
324 SCHEDULER_SIMPLE_SMP_ENTRY_POINTS, \
325 SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \
326 ( obj_name ) \
327 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
328 }
329
330 /* Provided for backward compatibility */
331
332 #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \
333 RTEMS_SCHEDULER_SIMPLE_SMP( name )
334
335 #define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name, obj_name ) \
336 RTEMS_SCHEDULER_TABLE_SIMPLE_SMP( name, obj_name )
337#endif
338
339#endif /* _RTEMS_SAPI_SCHEDULER_H */
schedulercbs.h
Thread manipulation for the CBS scheduler.
scheduleredf.h
Data Related to the Manipulation of Threads for the EDF Scheduler.
scheduleredfsmp.h
EDF SMP Scheduler API.
schedulerpriority.h
Thread Manipulation with the Priority-Based Scheduler.
schedulerpriorityaffinitysmp.h
Deterministic Priority Affinity SMP Scheduler API.
schedulerprioritysmp.h
Deterministic Priority SMP Scheduler API.
schedulersimple.h
Manipulation of Threads Simple-Priority-Based Ready Queue.
schedulersimplesmp.h
Simple SMP Scheduler API.
schedulerstrongapa.h
Strong APA Scheduler API.
scheduler.h
Constants and Structures Associated with the Scheduler.
_Scheduler_Control
Scheduler control.
Definition: scheduler.h:269