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

Last change on this file since f3d9f228 was f3d9f228, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 26, 2017 at 8:35:45 AM

score: Add SMP EDF scheduler

Update #3056.

  • Property mode set to 100644
File size: 7.5 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 ) \
103    static Scheduler_EDF_SMP_Context RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name )
104
105  #define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \
106    { \
107      &RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ).Base.Base, \
108      SCHEDULER_EDF_SMP_ENTRY_POINTS, \
109      SCHEDULER_EDF_MAXIMUM_PRIORITY, \
110      ( obj_name ) \
111    }
112#endif
113
114#ifdef CONFIGURE_SCHEDULER_PRIORITY
115  #include <rtems/score/schedulerpriority.h>
116
117  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ) \
118    RTEMS_SCHEDULER_CONTEXT_NAME( priority_ ## name )
119
120  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \
121    static struct { \
122      Scheduler_priority_Context Base; \
123      Chain_Control              Ready[ ( prio_count ) ]; \
124    } RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name )
125
126  #define RTEMS_SCHEDULER_CONTROL_PRIORITY( name, obj_name ) \
127    { \
128      &RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Base.Base, \
129      SCHEDULER_PRIORITY_ENTRY_POINTS, \
130      RTEMS_ARRAY_SIZE( \
131        RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Ready \
132      ) - 1, \
133      ( obj_name ) \
134    }
135#endif
136
137#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
138  #include <rtems/score/schedulerpriorityaffinitysmp.h>
139
140  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ) \
141    RTEMS_SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name )
142
143  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \
144    static struct { \
145      Scheduler_priority_SMP_Context Base; \
146      Chain_Control                  Ready[ ( prio_count ) ]; \
147    } RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name )
148
149  #define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name, obj_name ) \
150    { \
151      &RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Base.Base.Base, \
152      SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS, \
153      RTEMS_ARRAY_SIZE( \
154        RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Ready \
155      ) - 1, \
156      ( obj_name ) \
157    }
158#endif
159
160#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
161  #include <rtems/score/schedulerprioritysmp.h>
162
163  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ) \
164    RTEMS_SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name )
165
166  #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \
167    static struct { \
168      Scheduler_priority_SMP_Context Base; \
169      Chain_Control                  Ready[ ( prio_count ) ]; \
170    } RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name )
171
172  #define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name, obj_name ) \
173    { \
174      &RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Base.Base.Base, \
175      SCHEDULER_PRIORITY_SMP_ENTRY_POINTS, \
176      RTEMS_ARRAY_SIZE( \
177        RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Ready \
178      ) - 1, \
179      ( obj_name ) \
180    }
181#endif
182
183#ifdef CONFIGURE_SCHEDULER_STRONG_APA
184  #include <rtems/score/schedulerstrongapa.h>
185
186  #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ) \
187    RTEMS_SCHEDULER_CONTEXT_NAME( strong_APA_ ## name )
188
189  #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA( name, prio_count ) \
190    static struct { \
191      Scheduler_strong_APA_Context Base; \
192      Chain_Control                Ready[ ( prio_count ) ]; \
193    } RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name )
194
195  #define RTEMS_SCHEDULER_CONTROL_STRONG_APA( name, obj_name ) \
196    { \
197      &RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Base.Base.Base, \
198      SCHEDULER_STRONG_APA_ENTRY_POINTS, \
199      RTEMS_ARRAY_SIZE( \
200        RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Ready \
201      ) - 1, \
202      ( obj_name ) \
203    }
204#endif
205
206#ifdef CONFIGURE_SCHEDULER_SIMPLE
207  #include <rtems/score/schedulersimple.h>
208
209  #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ) \
210    RTEMS_SCHEDULER_CONTEXT_NAME( simple_ ## name )
211
212  #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \
213    static Scheduler_simple_Context \
214      RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name )
215
216  #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name, obj_name ) \
217    { \
218      &RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ).Base, \
219      SCHEDULER_SIMPLE_ENTRY_POINTS, \
220      SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \
221      ( obj_name ) \
222    }
223#endif
224
225#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
226  #include <rtems/score/schedulersimplesmp.h>
227
228  #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ) \
229    RTEMS_SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name )
230
231  #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \
232    static Scheduler_simple_SMP_Context \
233      RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name )
234
235  #define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name, obj_name ) \
236    { \
237      &RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ).Base.Base, \
238      SCHEDULER_SIMPLE_SMP_ENTRY_POINTS, \
239      SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \
240      ( obj_name ) \
241    }
242#endif
243
244#endif /* _RTEMS_SAPI_SCHEDULER_H */
Note: See TracBrowser for help on using the repository browser.