RTEMS  5.0.0
scheduleredf.h
Go to the documentation of this file.
1 
10 /*
11  * Copryight (c) 2011 Petr Benes.
12  * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
13  *
14  * The license and distribution terms for this file may be
15  * found in the file LICENSE in this distribution or at
16  * http://www.rtems.org/license/LICENSE.
17  */
18 
19 #ifndef _RTEMS_SCORE_SCHEDULEREDF_H
20 #define _RTEMS_SCORE_SCHEDULEREDF_H
21 
22 #include <rtems/score/priority.h>
23 #include <rtems/score/scheduler.h>
25 #include <rtems/score/rbtree.h>
26 
27 #include <limits.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
40 /*
41  * Actually the EDF scheduler supports a maximum priority of
42  * 0x7fffffffffffffff, but the user API is limited to uint32_t or int for
43  * thread priorities. Ignore ILP64 targets for now.
44  */
45 #define SCHEDULER_EDF_MAXIMUM_PRIORITY INT_MAX
46 
50 #define SCHEDULER_EDF_ENTRY_POINTS \
51  { \
52  _Scheduler_EDF_Initialize, /* initialize entry point */ \
53  _Scheduler_EDF_Schedule, /* schedule entry point */ \
54  _Scheduler_EDF_Yield, /* yield entry point */ \
55  _Scheduler_EDF_Block, /* block entry point */ \
56  _Scheduler_EDF_Unblock, /* unblock entry point */ \
57  _Scheduler_EDF_Update_priority, /* update priority entry point */ \
58  _Scheduler_EDF_Map_priority, /* map priority entry point */ \
59  _Scheduler_EDF_Unmap_priority, /* unmap priority entry point */ \
60  SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
61  _Scheduler_EDF_Node_initialize, /* node initialize entry point */ \
62  _Scheduler_default_Node_destroy, /* node destroy entry point */ \
63  _Scheduler_EDF_Release_job, /* new period of task */ \
64  _Scheduler_EDF_Cancel_job, /* cancel period of task */ \
65  _Scheduler_default_Tick, /* tick entry point */ \
66  _Scheduler_default_Start_idle /* start idle entry point */ \
67  SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
68  }
69 
70 typedef struct {
75 
79  RBTree_Control Ready;
81 
85 typedef struct {
90 
95 
101 
109 void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
110 
111 void _Scheduler_EDF_Block(
112  const Scheduler_Control *scheduler,
113  Thread_Control *the_thread,
114  Scheduler_Node *node
115 );
116 
128  const Scheduler_Control *scheduler,
129  Thread_Control *the_thread
130 );
131 
141  const Scheduler_Control *scheduler,
142  Scheduler_Node *node,
143  Thread_Control *the_thread,
144  Priority_Control priority
145 );
146 
147 void _Scheduler_EDF_Unblock(
148  const Scheduler_Control *scheduler,
149  Thread_Control *the_thread,
150  Scheduler_Node *node
151 );
152 
153 void _Scheduler_EDF_Update_priority(
154  const Scheduler_Control *scheduler,
155  Thread_Control *the_thread,
156  Scheduler_Node *node
157 );
158 
159 Priority_Control _Scheduler_EDF_Map_priority(
160  const Scheduler_Control *scheduler,
161  Priority_Control priority
162 );
163 
164 Priority_Control _Scheduler_EDF_Unmap_priority(
165  const Scheduler_Control *scheduler,
166  Priority_Control priority
167 );
168 
169 void _Scheduler_EDF_Yield(
170  const Scheduler_Control *scheduler,
171  Thread_Control *the_thread,
172  Scheduler_Node *node
173 );
174 
175 void _Scheduler_EDF_Release_job(
176  const Scheduler_Control *scheduler,
177  Thread_Control *the_thread,
178  Priority_Node *priority_node,
179  uint64_t deadline,
180  Thread_queue_Context *queue_context
181 );
182 
183 void _Scheduler_EDF_Cancel_job(
184  const Scheduler_Control *scheduler,
185  Thread_Control *the_thread,
186  Priority_Node *priority_node,
187  Thread_queue_Context *queue_context
188 );
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
196 #endif
197 /* end of include file */
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.
Definition: scheduleredfschedule.c:23
Scheduler context.
Definition: scheduler.h:249
Scheduler node specialization for EDF schedulers.
Definition: scheduleredf.h:85
Thread queue context for the thread queue methods.
Definition: threadq.h:193
The priority node to build up a priority aggregation.
Definition: priority.h:94
Thread Manipulation with the Priority-Based Scheduler.
Red-black tree node.
Definition: rbtree.h:50
Scheduler_Context Base
Basic scheduler context.
Definition: scheduleredf.h:74
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:66
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.
Definition: scheduleredfnodeinit.c:23
Definition: thread.h:728
void _Scheduler_EDF_Initialize(const Scheduler_Control *scheduler)
Initialize EDF scheduler.
Definition: scheduleredf.c:23
Constants and Structures Associated with the Red-Black Tree Handler.
Priority Handler API.
Priority_Control priority
The thread priority currently used for this scheduler instance.
Definition: scheduleredf.h:99
RBTree_Node Node
Definition: scheduleredf.h:94
Scheduler_Node Base
Basic scheduler node.
Definition: scheduleredf.h:89
Definition: scheduleredf.h:70
Scheduler control.
Definition: scheduler.h:266
Scheduler node for per-thread data.
Definition: schedulernode.h:65
RBTree_Control Ready
Definition: scheduleredf.h:79
Constants and Structures Associated with the Scheduler.