source: rtems/cpukit/sapi/include/rtems/scheduler.h @ 34487537

Last change on this file since 34487537 was 34487537, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 4, 2017 at 7:57:30 AM

score: Add simple affinity support to EDF SMP

Update #3059.

  • Property mode set to 100644
File size: 7.7 KB
Line 
1/**
2 * @file
3 *
4 * @brief Scheduler Configuration API
5 */
6
7/*
8 * Copyright (c) 2014, 2017 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 RTEMS_SCHEDULER_CONTEXT_NAME( name ) \
27  _Configuration_Scheduler_ ## name
28
29#if defined(RTEMS_SMP)
30  /* This object doesn't exist and indicates a configuration error */
31  extern const Scheduler_Control RTEMS_SCHEDULER_INVALID_INDEX;
32
33  #define RTEMS_SCHEDULER_ASSIGN_DEFAULT \
34    SCHEDULER_ASSIGN_DEFAULT
35
36  #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \
37    SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL
38
39  #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY \
40    SCHEDULER_ASSIGN_PROCESSOR_MANDATORY
41
42  #define RTEMS_SCHEDULER_ASSIGN( index, attr ) \
43    { \
44      ( index ) < RTEMS_ARRAY_SIZE( _Scheduler_Table ) ? \
45        &_Scheduler_Table[ ( index ) ] : &RTEMS_SCHEDULER_INVALID_INDEX, \
46      ( attr ) \
47    }
48
49  #define RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER { NULL, 0 }
50#endif
51
52/*
53 * This file should be only included in the context of <rtems/confdefs.h>.
54 * Define the scheduler configuration macros only in case the corresponding
55 * configure symbol is defined.  This is necessary to prevent invalid workspace
56 * size estimates since we have to account for the per-thread scheduler
57 * information.
58 */
59
60#ifdef CONFIGURE_SCHEDULER_CBS
61  #include <rtems/score/schedulercbs.h>
62
63  #define RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ) \
64    RTEMS_SCHEDULER_CONTEXT_NAME( CBS_ ## name )
65
66  #define RTEMS_SCHEDULER_CONTEXT_CBS( name ) \
67    static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name )
68
69  #define RTEMS_SCHEDULER_CONTROL_CBS( name, obj_name ) \
70    { \
71      &RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ).Base, \
72      SCHEDULER_CBS_ENTRY_POINTS, \
73      SCHEDULER_CBS_MAXIMUM_PRIORITY, \
74      ( obj_name ) \
75    }
76#endif
77
78#ifdef CONFIGURE_SCHEDULER_EDF
79  #include <rtems/score/scheduleredf.h>
80
81  #define RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ) \
82    RTEMS_SCHEDULER_CONTEXT_NAME( EDF_ ## name )
83
84  #define RTEMS_SCHEDULER_CONTEXT_EDF( name ) \
85    static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name )
86
87  #define RTEMS_SCHEDULER_CONTROL_EDF( name, obj_name ) \
88    { \
89      &RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ).Base, \
90      SCHEDULER_EDF_ENTRY_POINTS, \
91      SCHEDULER_EDF_MAXIMUM_PRIORITY, \
92      ( obj_name ) \
93    }
94#endif
95
96#ifdef CONFIGURE_SCHEDULER_EDF_SMP
97  #include <rtems/score/scheduleredfsmp.h>
98
99  #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ) \
100    RTEMS_SCHEDULER_CONTEXT_NAME( EDF_SMP_ ## name )
101
102  #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP( name, max_cpu_count ) \
103    static struct { \
104      Scheduler_EDF_SMP_Context Base; \
105      Scheduler_EDF_SMP_Ready_queue Ready[ ( max_cpu_count ) + 1 ]; \
106    } RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name )
107
108  #define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \
109    { \
110      &RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ).Base.Base.Base, \
111      SCHEDULER_EDF_SMP_ENTRY_POINTS, \
112      SCHEDULER_EDF_MAXIMUM_PRIORITY, \
113      ( obj_name ) \
114    }
115#endif
116
117#ifdef CONFIGURE_SCHEDULER_PRIORITY
118  #include <rtems/score/schedulerpriority.h>
119
120  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ) \
121    RTEMS_SCHEDULER_CONTEXT_NAME( priority_ ## name )
122
123  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \
124    static struct { \
125      Scheduler_priority_Context Base; \
126      Chain_Control              Ready[ ( prio_count ) ]; \
127    } RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name )
128
129  #define RTEMS_SCHEDULER_CONTROL_PRIORITY( name, obj_name ) \
130    { \
131      &RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Base.Base, \
132      SCHEDULER_PRIORITY_ENTRY_POINTS, \
133      RTEMS_ARRAY_SIZE( \
134        RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Ready \
135      ) - 1, \
136      ( obj_name ) \
137    }
138#endif
139
140#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
141  #include <rtems/score/schedulerpriorityaffinitysmp.h>
142
143  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ) \
144    RTEMS_SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name )
145
146  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \
147    static struct { \
148      Scheduler_priority_SMP_Context Base; \
149      Chain_Control                  Ready[ ( prio_count ) ]; \
150    } RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name )
151
152  #define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name, obj_name ) \
153    { \
154      &RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Base.Base.Base, \
155      SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS, \
156      RTEMS_ARRAY_SIZE( \
157        RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Ready \
158      ) - 1, \
159      ( obj_name ) \
160    }
161#endif
162
163#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
164  #include <rtems/score/schedulerprioritysmp.h>
165
166  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ) \
167    RTEMS_SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name )
168
169  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \
170    static struct { \
171      Scheduler_priority_SMP_Context Base; \
172      Chain_Control                  Ready[ ( prio_count ) ]; \
173    } RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name )
174
175  #define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name, obj_name ) \
176    { \
177      &RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Base.Base.Base, \
178      SCHEDULER_PRIORITY_SMP_ENTRY_POINTS, \
179      RTEMS_ARRAY_SIZE( \
180        RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Ready \
181      ) - 1, \
182      ( obj_name ) \
183    }
184#endif
185
186#ifdef CONFIGURE_SCHEDULER_STRONG_APA
187  #include <rtems/score/schedulerstrongapa.h>
188
189  #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ) \
190    RTEMS_SCHEDULER_CONTEXT_NAME( strong_APA_ ## name )
191
192  #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA( name, prio_count ) \
193    static struct { \
194      Scheduler_strong_APA_Context Base; \
195      Chain_Control                Ready[ ( prio_count ) ]; \
196    } RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name )
197
198  #define RTEMS_SCHEDULER_CONTROL_STRONG_APA( name, obj_name ) \
199    { \
200      &RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Base.Base.Base, \
201      SCHEDULER_STRONG_APA_ENTRY_POINTS, \
202      RTEMS_ARRAY_SIZE( \
203        RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Ready \
204      ) - 1, \
205      ( obj_name ) \
206    }
207#endif
208
209#ifdef CONFIGURE_SCHEDULER_SIMPLE
210  #include <rtems/score/schedulersimple.h>
211
212  #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ) \
213    RTEMS_SCHEDULER_CONTEXT_NAME( simple_ ## name )
214
215  #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \
216    static Scheduler_simple_Context \
217      RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name )
218
219  #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name, obj_name ) \
220    { \
221      &RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ).Base, \
222      SCHEDULER_SIMPLE_ENTRY_POINTS, \
223      SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \
224      ( obj_name ) \
225    }
226#endif
227
228#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
229  #include <rtems/score/schedulersimplesmp.h>
230
231  #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ) \
232    RTEMS_SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name )
233
234  #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \
235    static Scheduler_simple_SMP_Context \
236      RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name )
237
238  #define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name, obj_name ) \
239    { \
240      &RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ).Base.Base, \
241      SCHEDULER_SIMPLE_SMP_ENTRY_POINTS, \
242      SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \
243      ( obj_name ) \
244    }
245#endif
246
247#endif /* _RTEMS_SAPI_SCHEDULER_H */
Note: See TracBrowser for help on using the repository browser.