RTEMS 6.1-rc4
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) 2014, 2018 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_SAPI_SCHEDULER_H
38#define _RTEMS_SAPI_SCHEDULER_H
39
41
42#define SCHEDULER_CONTEXT_NAME( name ) \
43 _Configuration_Scheduler_ ## name
44
45#if defined(RTEMS_SMP)
46 #define SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( value ) \
47 , value
48#else
49 #define SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( value )
50#endif
51
52#if defined(RTEMS_SMP)
53 /* This object doesn't exist and indicates a configuration error */
54 extern const Scheduler_Control RTEMS_SCHEDULER_INVALID_INDEX;
55
65 #define RTEMS_SCHEDULER_ASSIGN_DEFAULT \
66 SCHEDULER_ASSIGN_DEFAULT
67
80 #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \
81 SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL
82
96 #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY \
97 SCHEDULER_ASSIGN_PROCESSOR_MANDATORY
98
111 #define RTEMS_SCHEDULER_ASSIGN( index, attr ) \
112 { \
113 ( index ) < RTEMS_ARRAY_SIZE( _Scheduler_Table ) ? \
114 &_Scheduler_Table[ ( index ) ] : &RTEMS_SCHEDULER_INVALID_INDEX, \
115 ( attr ) \
116 }
117
128 #define RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER { NULL, 0 }
129#endif
130
131/*
132 * This file should be only included in the context of <rtems/confdefs.h>.
133 * Define the scheduler configuration macros only in case the corresponding
134 * configure symbol is defined. This is necessary to prevent invalid workspace
135 * size estimates since we have to account for the per-thread scheduler
136 * information.
137 */
138
145#define SCHEDULER_CBS_CONTEXT_NAME( name ) \
146 SCHEDULER_CONTEXT_NAME( CBS_ ## name )
147
155#define RTEMS_SCHEDULER_CBS( name ) \
156 static Scheduler_EDF_Context SCHEDULER_CBS_CONTEXT_NAME( name )
157
170#define RTEMS_SCHEDULER_TABLE_CBS( name, obj_name ) \
171 { \
172 &SCHEDULER_CBS_CONTEXT_NAME( name ).Base, \
173 SCHEDULER_CBS_ENTRY_POINTS, \
174 SCHEDULER_CBS_MAXIMUM_PRIORITY, \
175 ( obj_name ) \
176 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
177 }
178
179#ifdef CONFIGURE_SCHEDULER_CBS
181
182 /* Provided for backward compatibility */
183
184 #define RTEMS_SCHEDULER_CONTEXT_CBS( name ) \
185 RTEMS_SCHEDULER_CBS( name )
186
187 #define RTEMS_SCHEDULER_CONTROL_CBS( name, obj_name ) \
188 RTEMS_SCHEDULER_TABLE_CBS( name, obj_name )
189#endif
190
197#define SCHEDULER_EDF_CONTEXT_NAME( name ) \
198 SCHEDULER_CONTEXT_NAME( EDF_ ## name )
199
207#define RTEMS_SCHEDULER_EDF( name ) \
208 static Scheduler_EDF_Context SCHEDULER_EDF_CONTEXT_NAME( name )
209
222#define RTEMS_SCHEDULER_TABLE_EDF( name, obj_name ) \
223 { \
224 &SCHEDULER_EDF_CONTEXT_NAME( name ).Base, \
225 SCHEDULER_EDF_ENTRY_POINTS, \
226 SCHEDULER_EDF_MAXIMUM_PRIORITY, \
227 ( obj_name ) \
228 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
229 }
230
231#ifdef CONFIGURE_SCHEDULER_EDF
233
234 /* Provided for backward compatibility */
235
236 #define RTEMS_SCHEDULER_CONTEXT_EDF( name ) \
237 RTEMS_SCHEDULER_EDF( name )
238
239 #define RTEMS_SCHEDULER_CONTROL_EDF( name, obj_name ) \
240 RTEMS_SCHEDULER_TABLE_EDF( name, obj_name )
241#endif
242
249#define SCHEDULER_EDF_SMP_CONTEXT_NAME( name ) \
250 SCHEDULER_CONTEXT_NAME( EDF_SMP_ ## name )
251
259#define RTEMS_SCHEDULER_EDF_SMP( name ) \
260 static struct { \
261 Scheduler_EDF_SMP_Context Base; \
262 Scheduler_EDF_SMP_Ready_queue Ready[ CONFIGURE_MAXIMUM_PROCESSORS + 1 ]; \
263 } SCHEDULER_EDF_SMP_CONTEXT_NAME( name )
264
277#define RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name ) \
278 { \
279 &SCHEDULER_EDF_SMP_CONTEXT_NAME( name ).Base.Base.Base, \
280 SCHEDULER_EDF_SMP_ENTRY_POINTS, \
281 SCHEDULER_EDF_MAXIMUM_PRIORITY, \
282 ( obj_name ) \
283 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
284 }
285
286#ifdef CONFIGURE_SCHEDULER_EDF_SMP
287 #ifndef RTEMS_SMP
288 #error "CONFIGURE_SCHEDULER_EDF_SMP cannot be used if RTEMS_SMP is disabled"
289 #endif
290
291 #ifndef CONFIGURE_MAXIMUM_PROCESSORS
292 #error "CONFIGURE_MAXIMUM_PROCESSORS must be defined to configure the EDF SMP Scheduler"
293 #endif
294
296
297 /* Provided for backward compatibility */
298
299 #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP( name, max_cpu_count ) \
300 RTEMS_SCHEDULER_EDF_SMP( name )
301
302 #define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \
303 RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name )
304#endif
305
312#define SCHEDULER_PRIORITY_CONTEXT_NAME( name ) \
313 SCHEDULER_CONTEXT_NAME( priority_ ## name )
314
324#define RTEMS_SCHEDULER_PRIORITY( name, prio_count ) \
325 static struct { \
326 Scheduler_priority_Context Base; \
327 Chain_Control Ready[ ( prio_count ) ]; \
328 } SCHEDULER_PRIORITY_CONTEXT_NAME( name )
329
343#define RTEMS_SCHEDULER_TABLE_PRIORITY( name, obj_name ) \
344 { \
345 &SCHEDULER_PRIORITY_CONTEXT_NAME( name ).Base.Base, \
346 SCHEDULER_PRIORITY_ENTRY_POINTS, \
347 RTEMS_ARRAY_SIZE( \
348 SCHEDULER_PRIORITY_CONTEXT_NAME( name ).Ready \
349 ) - 1, \
350 ( obj_name ) \
351 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
352 }
353
354#ifdef CONFIGURE_SCHEDULER_PRIORITY
356
357 /* Provided for backward compatibility */
358
359 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \
360 RTEMS_SCHEDULER_PRIORITY( name, prio_count )
361
362 #define RTEMS_SCHEDULER_CONTROL_PRIORITY( name, obj_name ) \
363 RTEMS_SCHEDULER_TABLE_PRIORITY( name, obj_name )
364#endif
365
372#define SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ) \
373 SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name )
374
385#define RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( name, prio_count ) \
386 static struct { \
387 Scheduler_priority_SMP_Context Base; \
388 Chain_Control Ready[ ( prio_count ) ]; \
389 } SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name )
390
404#define RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( name, obj_name ) \
405 { \
406 &SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ).Base.Base.Base, \
407 SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS, \
408 RTEMS_ARRAY_SIZE( \
409 SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ).Ready \
410 ) - 1, \
411 ( obj_name ) \
412 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
413 }
414
415#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
416 #ifndef RTEMS_SMP
417 #error "CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP cannot be used if RTEMS_SMP is disabled"
418 #endif
419
421
422 /* Provided for backward compatibility */
423
424 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \
425 RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( name, prio_count )
426
427 #define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name, obj_name ) \
428 RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( name, obj_name )
429#endif
430
437#define SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ) \
438 SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name )
439
449#define RTEMS_SCHEDULER_PRIORITY_SMP( name, prio_count ) \
450 static struct { \
451 Scheduler_priority_SMP_Context Base; \
452 Chain_Control Ready[ ( prio_count ) ]; \
453 } SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name )
454
468#define RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( name, obj_name ) \
469 { \
470 &SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ).Base.Base.Base, \
471 SCHEDULER_PRIORITY_SMP_ENTRY_POINTS, \
472 RTEMS_ARRAY_SIZE( \
473 SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ).Ready \
474 ) - 1, \
475 ( obj_name ) \
476 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
477 }
478
479#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
480 #ifndef RTEMS_SMP
481 #error "CONFIGURE_SCHEDULER_PRIORITY_SMP cannot be used if RTEMS_SMP is disabled"
482 #endif
483
485
486 /* Provided for backward compatibility */
487
488 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \
489 RTEMS_SCHEDULER_PRIORITY_SMP( name, prio_count )
490
491 #define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name, obj_name ) \
492 RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( name, obj_name )
493#endif
494
501#define SCHEDULER_STRONG_APA_CONTEXT_NAME( name ) \
502 SCHEDULER_CONTEXT_NAME( strong_APA_ ## name )
503
511#define RTEMS_SCHEDULER_STRONG_APA( name, prio_count ) \
512 static struct { \
513 Scheduler_strong_APA_Context Base; \
514 Scheduler_strong_APA_CPU CPU[ CONFIGURE_MAXIMUM_PROCESSORS ]; \
515 } SCHEDULER_STRONG_APA_CONTEXT_NAME( name )
516
529#define RTEMS_SCHEDULER_TABLE_STRONG_APA( name, obj_name ) \
530 { \
531 &SCHEDULER_STRONG_APA_CONTEXT_NAME( name ).Base.Base.Base, \
532 SCHEDULER_STRONG_APA_ENTRY_POINTS, \
533 SCHEDULER_STRONG_APA_MAXIMUM_PRIORITY, \
534 ( obj_name ) \
535 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
536 }
537
538#ifdef CONFIGURE_SCHEDULER_STRONG_APA
539 #ifndef RTEMS_SMP
540 #error "CONFIGURE_SCHEDULER_STRONG_APA cannot be used if RTEMS_SMP is disabled"
541 #endif
542
543 #ifndef CONFIGURE_MAXIMUM_PROCESSORS
544 #error "CONFIGURE_MAXIMUM_PROCESSORS must be defined to configure the Strong APA Scheduler"
545 #endif
546
548
549 /* Provided for backward compatibility */
550
551 #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA( name, prio_count ) \
552 RTEMS_SCHEDULER_STRONG_APA( name, prio_count )
553
554 #define RTEMS_SCHEDULER_CONTROL_STRONG_APA( name, obj_name ) \
555 RTEMS_SCHEDULER_TABLE_STRONG_APA( name, obj_name )
556#endif
557
564#define SCHEDULER_SIMPLE_CONTEXT_NAME( name ) \
565 SCHEDULER_CONTEXT_NAME( simple_ ## name )
566
574#define RTEMS_SCHEDULER_SIMPLE( name ) \
575 static Scheduler_simple_Context \
576 SCHEDULER_SIMPLE_CONTEXT_NAME( name )
577
590#define RTEMS_SCHEDULER_TABLE_SIMPLE( name, obj_name ) \
591 { \
592 &SCHEDULER_SIMPLE_CONTEXT_NAME( name ).Base, \
593 SCHEDULER_SIMPLE_ENTRY_POINTS, \
594 SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \
595 ( obj_name ) \
596 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
597 }
598
599#ifdef CONFIGURE_SCHEDULER_SIMPLE
601
602 /* Provided for backward compatibility */
603
604 #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \
605 RTEMS_SCHEDULER_SIMPLE( name )
606
607 #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name, obj_name ) \
608 RTEMS_SCHEDULER_TABLE_SIMPLE( name, obj_name )
609#endif
610
617#define SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name ) \
618 SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name )
619
627#define RTEMS_SCHEDULER_SIMPLE_SMP( name ) \
628 static Scheduler_simple_SMP_Context \
629 SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name )
630
643#define RTEMS_SCHEDULER_TABLE_SIMPLE_SMP( name, obj_name ) \
644 { \
645 &SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name ).Base.Base, \
646 SCHEDULER_SIMPLE_SMP_ENTRY_POINTS, \
647 SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \
648 ( obj_name ) \
649 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
650 }
651
652#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
653 #ifndef RTEMS_SMP
654 #error "CONFIGURE_SCHEDULER_SIMPLE_SMP cannot be used if RTEMS_SMP is disabled"
655 #endif
656
658
659 /* Provided for backward compatibility */
660
661 #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \
662 RTEMS_SCHEDULER_SIMPLE_SMP( name )
663
664 #define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name, obj_name ) \
665 RTEMS_SCHEDULER_TABLE_SIMPLE_SMP( name, obj_name )
666#endif
667
668#endif /* _RTEMS_SAPI_SCHEDULER_H */
This header file provides interfaces of the Constant Bandwidth Server (CBS) Scheduler which are used ...
This header file provides interfaces of the EDF Scheduler which are used by the implementation and th...
This header file provides the interfaces of the Earliest Deadline First (EDF) Priority SMP Scheduler.
This header file provides interfaces of the Deterministic Priority Scheduler which are used by the im...
This header file provides the interfaces of the Deterministic Priority Affinity SMP Scheduler.
This header file provides interfaces of the Deterministic Priority SMP Scheduler which are used by th...
This header file provides interfaces of the Simple Priority Scheduler which are used by the implement...
This header file provides the interfaces of the Simple Priority SMP Scheduler.
This header file provides the interfaces of the Strong APA Scheduler.
This header file provides interfaces of the Scheduler Handler which are used by the implementation an...
Scheduler control.
Definition: scheduler.h:337