21 #ifndef _RTEMS_SAPI_SCHEDULER_H 22 #define _RTEMS_SAPI_SCHEDULER_H 26 #define SCHEDULER_CONTEXT_NAME( name ) \ 27 _Configuration_Scheduler_ ## name 29 #if defined(RTEMS_SMP) 30 #define SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( value ) \ 33 #define SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( value ) 36 #if defined(RTEMS_SMP) 40 #define RTEMS_SCHEDULER_ASSIGN_DEFAULT \ 41 SCHEDULER_ASSIGN_DEFAULT 43 #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \ 44 SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL 46 #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY \ 47 SCHEDULER_ASSIGN_PROCESSOR_MANDATORY 49 #define RTEMS_SCHEDULER_ASSIGN( index, attr ) \ 51 ( index ) < RTEMS_ARRAY_SIZE( _Scheduler_Table ) ? \ 52 &_Scheduler_Table[ ( index ) ] : &RTEMS_SCHEDULER_INVALID_INDEX, \ 56 #define RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER { NULL, 0 } 67 #ifdef CONFIGURE_SCHEDULER_CBS 68 #include <rtems/score/schedulercbs.h> 70 #define SCHEDULER_CBS_CONTEXT_NAME( name ) \ 71 SCHEDULER_CONTEXT_NAME( CBS_ ## name ) 73 #define RTEMS_SCHEDULER_CBS( name ) \ 74 static Scheduler_EDF_Context SCHEDULER_CBS_CONTEXT_NAME( name ) 76 #define RTEMS_SCHEDULER_TABLE_CBS( name, obj_name ) \ 78 &SCHEDULER_CBS_CONTEXT_NAME( name ).Base, \ 79 SCHEDULER_CBS_ENTRY_POINTS, \ 80 SCHEDULER_CBS_MAXIMUM_PRIORITY, \ 82 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \ 87 #define RTEMS_SCHEDULER_CONTEXT_CBS( name ) \ 88 RTEMS_SCHEDULER_CBS( name ) 90 #define RTEMS_SCHEDULER_CONTROL_CBS( name, obj_name ) \ 91 RTEMS_SCHEDULER_TABLE_CBS( name, obj_name ) 94 #ifdef CONFIGURE_SCHEDULER_EDF 97 #define SCHEDULER_EDF_CONTEXT_NAME( name ) \ 98 SCHEDULER_CONTEXT_NAME( EDF_ ## name ) 100 #define RTEMS_SCHEDULER_EDF( name ) \ 101 static Scheduler_EDF_Context SCHEDULER_EDF_CONTEXT_NAME( name ) 103 #define RTEMS_SCHEDULER_TABLE_EDF( name, obj_name ) \ 105 &SCHEDULER_EDF_CONTEXT_NAME( name ).Base, \ 106 SCHEDULER_EDF_ENTRY_POINTS, \ 107 SCHEDULER_EDF_MAXIMUM_PRIORITY, \ 109 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \ 114 #define RTEMS_SCHEDULER_CONTEXT_EDF( name ) \ 115 RTEMS_SCHEDULER_EDF( name ) 117 #define RTEMS_SCHEDULER_CONTROL_EDF( name, obj_name ) \ 118 RTEMS_SCHEDULER_TABLE_EDF( name, obj_name ) 121 #ifdef CONFIGURE_SCHEDULER_EDF_SMP 124 #ifndef CONFIGURE_MAXIMUM_PROCESSORS 125 #error "CONFIGURE_MAXIMUM_PROCESSORS must be defined to configure the EDF SMP scheduler" 128 #define SCHEDULER_EDF_SMP_CONTEXT_NAME( name ) \ 129 SCHEDULER_CONTEXT_NAME( EDF_SMP_ ## name ) 131 #define RTEMS_SCHEDULER_EDF_SMP( name ) \ 133 Scheduler_EDF_SMP_Context Base; \ 134 Scheduler_EDF_SMP_Ready_queue Ready[ CONFIGURE_MAXIMUM_PROCESSORS + 1 ]; \ 135 } SCHEDULER_EDF_SMP_CONTEXT_NAME( name ) 137 #define RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name ) \ 139 &SCHEDULER_EDF_SMP_CONTEXT_NAME( name ).Base.Base.Base, \ 140 SCHEDULER_EDF_SMP_ENTRY_POINTS, \ 141 SCHEDULER_EDF_MAXIMUM_PRIORITY, \ 143 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \ 148 #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP( name, max_cpu_count ) \ 149 RTEMS_SCHEDULER_EDF_SMP( name ) 151 #define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \ 152 RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name ) 155 #ifdef CONFIGURE_SCHEDULER_PRIORITY 158 #define SCHEDULER_PRIORITY_CONTEXT_NAME( name ) \ 159 SCHEDULER_CONTEXT_NAME( priority_ ## name ) 161 #define RTEMS_SCHEDULER_PRIORITY( name, prio_count ) \ 163 Scheduler_priority_Context Base; \ 164 Chain_Control Ready[ ( prio_count ) ]; \ 165 } SCHEDULER_PRIORITY_CONTEXT_NAME( name ) 167 #define RTEMS_SCHEDULER_TABLE_PRIORITY( name, obj_name ) \ 169 &SCHEDULER_PRIORITY_CONTEXT_NAME( name ).Base.Base, \ 170 SCHEDULER_PRIORITY_ENTRY_POINTS, \ 172 SCHEDULER_PRIORITY_CONTEXT_NAME( name ).Ready \ 175 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \ 180 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \ 181 RTEMS_SCHEDULER_PRIORITY( name, prio_count ) 183 #define RTEMS_SCHEDULER_CONTROL_PRIORITY( name, obj_name ) \ 184 RTEMS_SCHEDULER_TABLE_PRIORITY( name, obj_name ) 187 #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP 188 #include <rtems/score/schedulerpriorityaffinitysmp.h> 190 #define SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ) \ 191 SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name ) 193 #define RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( name, prio_count ) \ 195 Scheduler_priority_SMP_Context Base; \ 196 Chain_Control Ready[ ( prio_count ) ]; \ 197 } SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ) 199 #define RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( name, obj_name ) \ 201 &SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ).Base.Base.Base, \ 202 SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS, \ 204 SCHEDULER_PRIORITY_AFFINITY_SMP_CONTEXT_NAME( name ).Ready \ 207 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \ 212 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \ 213 RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( name, prio_count ) 215 #define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name, obj_name ) \ 216 RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( name, obj_name ) 219 #ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP 220 #include <rtems/score/schedulerprioritysmp.h> 222 #define SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ) \ 223 SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name ) 225 #define RTEMS_SCHEDULER_PRIORITY_SMP( name, prio_count ) \ 227 Scheduler_priority_SMP_Context Base; \ 228 Chain_Control Ready[ ( prio_count ) ]; \ 229 } SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ) 231 #define RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( name, obj_name ) \ 233 &SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ).Base.Base.Base, \ 234 SCHEDULER_PRIORITY_SMP_ENTRY_POINTS, \ 236 SCHEDULER_PRIORITY_SMP_CONTEXT_NAME( name ).Ready \ 239 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \ 244 #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \ 245 RTEMS_SCHEDULER_PRIORITY_SMP( name, prio_count ) 247 #define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name, obj_name ) \ 248 RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( name, obj_name ) 251 #ifdef CONFIGURE_SCHEDULER_STRONG_APA 252 #include <rtems/score/schedulerstrongapa.h> 254 #define SCHEDULER_STRONG_APA_CONTEXT_NAME( name ) \ 255 SCHEDULER_CONTEXT_NAME( strong_APA_ ## name ) 257 #define RTEMS_SCHEDULER_STRONG_APA( name, prio_count ) \ 259 Scheduler_strong_APA_Context Base; \ 260 Chain_Control Ready[ ( prio_count ) ]; \ 261 } SCHEDULER_STRONG_APA_CONTEXT_NAME( name ) 263 #define RTEMS_SCHEDULER_TABLE_STRONG_APA( name, obj_name ) \ 265 &SCHEDULER_STRONG_APA_CONTEXT_NAME( name ).Base.Base.Base, \ 266 SCHEDULER_STRONG_APA_ENTRY_POINTS, \ 268 SCHEDULER_STRONG_APA_CONTEXT_NAME( name ).Ready \ 271 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \ 276 #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA( name, prio_count ) \ 277 RTEMS_SCHEDULER_STRONG_APA( name, prio_count ) 279 #define RTEMS_SCHEDULER_CONTROL_STRONG_APA( name, obj_name ) \ 280 RTEMS_SCHEDULER_TABLE_STRONG_APA( name, obj_name ) 283 #ifdef CONFIGURE_SCHEDULER_SIMPLE 286 #define SCHEDULER_SIMPLE_CONTEXT_NAME( name ) \ 287 SCHEDULER_CONTEXT_NAME( simple_ ## name ) 289 #define RTEMS_SCHEDULER_SIMPLE( name ) \ 290 static Scheduler_simple_Context \ 291 SCHEDULER_SIMPLE_CONTEXT_NAME( name ) 293 #define RTEMS_SCHEDULER_TABLE_SIMPLE( name, obj_name ) \ 295 &SCHEDULER_SIMPLE_CONTEXT_NAME( name ).Base, \ 296 SCHEDULER_SIMPLE_ENTRY_POINTS, \ 297 SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \ 299 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \ 304 #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \ 305 RTEMS_SCHEDULER_SIMPLE( name ) 307 #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name, obj_name ) \ 308 RTEMS_SCHEDULER_TABLE_SIMPLE( name, obj_name ) 311 #ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP 312 #include <rtems/score/schedulersimplesmp.h> 314 #define SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name ) \ 315 SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name ) 317 #define RTEMS_SCHEDULER_SIMPLE_SMP( name ) \ 318 static Scheduler_simple_SMP_Context \ 319 SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name ) 321 #define RTEMS_SCHEDULER_TABLE_SIMPLE_SMP( name, obj_name ) \ 323 &SCHEDULER_SIMPLE_SMP_CONTEXT_NAME( name ).Base.Base, \ 324 SCHEDULER_SIMPLE_SMP_ENTRY_POINTS, \ 325 SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \ 327 SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \ 332 #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \ 333 RTEMS_SCHEDULER_SIMPLE_SMP( name ) 335 #define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name, obj_name ) \ 336 RTEMS_SCHEDULER_TABLE_SIMPLE_SMP( name, obj_name ) Thread Manipulation with the Priority-Based Scheduler.
Data Related to the Manipulation of Threads for the EDF Scheduler.
Manipulation of Threads Simple-Priority-Based Ready Queue.
Constants and Structures Associated with the Scheduler.