RTEMS
scheduleredf.h
Go to the documentation of this file.
1 
12 /*
13  * Copryight (c) 2011 Petr Benes.
14  * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
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_SCORE_SCHEDULEREDF_H
22 #define _RTEMS_SCORE_SCHEDULEREDF_H
23 
24 #include <rtems/score/priority.h>
25 #include <rtems/score/scheduler.h>
27 #include <rtems/score/rbtree.h>
28 
29 #include <limits.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
45 /*
46  * Actually the EDF scheduler supports a maximum priority of
47  * 0x7fffffffffffffff, but the user API is limited to uint32_t or int for
48  * thread priorities. Ignore ILP64 targets for now.
49  */
50 #define SCHEDULER_EDF_MAXIMUM_PRIORITY INT_MAX
51 
55 #define SCHEDULER_EDF_ENTRY_POINTS \
56  { \
57  _Scheduler_EDF_Initialize, /* initialize entry point */ \
58  _Scheduler_EDF_Schedule, /* schedule entry point */ \
59  _Scheduler_EDF_Yield, /* yield entry point */ \
60  _Scheduler_EDF_Block, /* block entry point */ \
61  _Scheduler_EDF_Unblock, /* unblock entry point */ \
62  _Scheduler_EDF_Update_priority, /* update priority entry point */ \
63  _Scheduler_EDF_Map_priority, /* map priority entry point */ \
64  _Scheduler_EDF_Unmap_priority, /* unmap priority entry point */ \
65  SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
66  _Scheduler_EDF_Node_initialize, /* node initialize entry point */ \
67  _Scheduler_default_Node_destroy, /* node destroy entry point */ \
68  _Scheduler_EDF_Release_job, /* new period of task */ \
69  _Scheduler_EDF_Cancel_job, /* cancel period of task */ \
70  _Scheduler_default_Tick, /* tick entry point */ \
71  _Scheduler_default_Start_idle /* start idle entry point */ \
72  SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
73  }
74 
75 typedef struct {
80 
84  RBTree_Control Ready;
86 
90 typedef struct {
95 
100 
106 
114 void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
115 
125  const Scheduler_Control *scheduler,
126  Thread_Control *the_thread,
127  Scheduler_Node *node
128 );
129 
141  const Scheduler_Control *scheduler,
142  Thread_Control *the_thread
143 );
144 
154  const Scheduler_Control *scheduler,
155  Scheduler_Node *node,
156  Thread_Control *the_thread,
157  Priority_Control priority
158 );
159 
168  const Scheduler_Control *scheduler,
169  Thread_Control *the_thread,
170  Scheduler_Node *node
171 );
172 
181  const Scheduler_Control *scheduler,
182  Thread_Control *the_thread,
183  Scheduler_Node *node
184 );
185 
195  const Scheduler_Control *scheduler,
196  Priority_Control priority
197 );
198 
208  const Scheduler_Control *scheduler,
209  Priority_Control priority
210 );
211 
220  const Scheduler_Control *scheduler,
221  Thread_Control *the_thread,
222  Scheduler_Node *node
223 );
224 
235  const Scheduler_Control *scheduler,
236  Thread_Control *the_thread,
237  Priority_Node *priority_node,
238  uint64_t deadline,
239  Thread_queue_Context *queue_context
240 );
241 
251  const Scheduler_Control *scheduler,
252  Thread_Control *the_thread,
253  Priority_Node *priority_node,
254  Thread_queue_Context *queue_context
255 );
256 
257 #ifdef __cplusplus
258 }
259 #endif
260 
263 #endif
264 /* end of include file */
void _Scheduler_EDF_Initialize(const Scheduler_Control *scheduler)
Initializes EDF scheduler.
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
void _Scheduler_EDF_Update_priority(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Updates the priority of the scheduler node.
Scheduler context.
Definition: scheduler.h:247
Scheduler node specialization for EDF schedulers.
Definition: scheduleredf.h:90
Thread queue context for the thread queue methods.
Definition: threadq.h:198
The priority node to build up a priority aggregation.
Definition: priority.h:98
void _Scheduler_EDF_Block(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Removes the blocking thread from the ready queue and schedules is only again if the thread is executi...
Constants and Structures Associated with the Red-Black Tree Handler.
Thread Manipulation with the Priority-Based Scheduler.
Red-black tree node.
Definition: rbtree.h:55
void _Scheduler_EDF_Release_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, uint64_t deadline, Thread_queue_Context *queue_context)
Releases a EDF job.
Scheduler_Context Base
Basic scheduler context.
Definition: scheduleredf.h:79
Priority Handler API.
Priority_Control priority
The thread priority currently used for this scheduler instance.
Definition: scheduleredf.h:104
void _Scheduler_EDF_Cancel_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Cancels a job and removes the thread from the queue context.
void _Scheduler_EDF_Node_initialize(const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
Initializes an EDF specific scheduler node of the_thread.
Priority_Control _Scheduler_EDF_Unmap_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Gets the unmapped priority map of the priority control.
RBTree_Node Node
Definition: scheduleredf.h:99
Scheduler_Node Base
Basic scheduler node.
Definition: scheduleredf.h:94
Priority_Control _Scheduler_EDF_Map_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Gets the mapped priority map of the priority control.
Scheduler control.
Definition: scheduler.h:264
Scheduler node for per-thread data.
Definition: schedulernode.h:79
RBTree_Control Ready
Definition: scheduleredf.h:84
void _Scheduler_EDF_Schedule(const Scheduler_Control *scheduler, Thread_Control *the_thread)
Sets the heir thread to be the next ready thread in the rbtree ready queue.
Constants and Structures Associated with the Scheduler.
void _Scheduler_EDF_Unblock(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Performs an unblocking of the thread.
void _Scheduler_EDF_Yield(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Executes a thread yield for the thread.