RTEMS CPU Kit with SuperCore  4.11.2
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 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
41 #define SCHEDULER_EDF_ENTRY_POINTS \
42  { \
43  _Scheduler_EDF_Initialize, /* initialize entry point */ \
44  _Scheduler_EDF_Schedule, /* schedule entry point */ \
45  _Scheduler_EDF_Yield, /* yield entry point */ \
46  _Scheduler_EDF_Block, /* block entry point */ \
47  _Scheduler_EDF_Unblock, /* unblock entry point */ \
48  _Scheduler_EDF_Change_priority, /* change priority entry point */ \
49  SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
50  _Scheduler_EDF_Node_initialize, /* node initialize entry point */ \
51  _Scheduler_default_Node_destroy, /* node destroy entry point */ \
52  _Scheduler_EDF_Update_priority, /* update priority entry point */ \
53  _Scheduler_EDF_Priority_compare, /* compares two priorities */ \
54  _Scheduler_EDF_Release_job, /* new period of task */ \
55  _Scheduler_default_Tick, /* tick entry point */ \
56  _Scheduler_default_Start_idle /* start idle entry point */ \
57  SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
58  }
59 
67 #define SCHEDULER_EDF_PRIO_MSB 0x80000000
68 
69 typedef struct {
74 
80 
87 typedef enum {
88  SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY,
89  SCHEDULER_EDF_QUEUE_STATE_YES,
90  SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN
92 
96 typedef struct {
101 
113  Scheduler_EDF_Queue_state queue_state;
115 
123 void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
124 
137  const Scheduler_Control *scheduler,
138  Thread_Control *the_thread
139 );
140 
152  const Scheduler_Control *scheduler,
153  Thread_Control *the_thread
154 );
155 
163  const Scheduler_Control *scheduler,
164  Thread_Control *the_thread
165 );
166 
178  const Scheduler_Control *scheduler,
179  Thread_Control *the_thread,
180  Priority_Control new_priority
181 );
182 
193 Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
194  const Scheduler_Control *scheduler,
195  Thread_Control *the_thread
196 );
197 
198 Scheduler_Void_or_thread _Scheduler_EDF_Change_priority(
199  const Scheduler_Control *scheduler,
200  Thread_Control *the_thread,
201  Priority_Control new_priority,
202  bool prepend_it
203 );
204 
221 Scheduler_Void_or_thread _Scheduler_EDF_Yield(
222  const Scheduler_Control *scheduler,
223  Thread_Control *the_thread
224 );
225 
235  Priority_Control p1,
237 );
238 
253  const Scheduler_Control *scheduler,
254  Thread_Control *the_thread,
255  uint32_t deadline
256 );
257 
258 #ifdef __cplusplus
259 }
260 #endif
261 
264 #endif
265 /* end of include file */
Thread Priority Manipulation Routines.
void _Scheduler_EDF_Node_initialize(const Scheduler_Control *scheduler, Thread_Control *the_thread)
Initializes an EDF specific scheduler node of the_thread.
Definition: scheduleredfnodeinit.c:23
Scheduler control.
Definition: scheduler.h:192
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:180
Scheduler node specialization for EDF schedulers.
Definition: scheduleredf.h:96
Thread Manipulation with the Priority-Based Scheduler.
Thread_Control * thread
Pointer to corresponding Thread Control Block.
Definition: scheduleredf.h:105
Scheduler_Context Base
Basic scheduler context.
Definition: scheduleredf.h:73
Scheduler_Void_or_thread _Scheduler_EDF_Yield(const Scheduler_Control *scheduler, Thread_Control *the_thread)
invoked when a thread wishes to voluntarily transfer control of the processor to another thread with ...
Definition: scheduleredfyield.c:24
uint32_t Priority_Control
The following type defines the control block used to manage thread priorities.
Definition: priority.h:56
Scheduler_EDF_Queue_state
This enumeration distiguishes state of a thread with respect to the ready queue.
Definition: scheduleredf.h:87
Constants and Structures Associated with the Red-Black Tree Handler.
This structure defines the Thread Control Block (TCB).
Definition: thread.h:671
void _Scheduler_EDF_Initialize(const Scheduler_Control *scheduler)
Initialize EDF scheduler.
Definition: scheduleredf.c:42
int _Scheduler_EDF_Priority_compare(Priority_Control p1, Priority_Control p2)
Explicitly compare absolute dedlines (priorities) of threads.
Definition: scheduleredfprioritycompare.c:27
Constants and Structures Associated with the Scheduler.
RBTree_Node Node
Rbtree node related to this thread.
Definition: scheduleredf.h:109
Scheduler_Node Base
Basic scheduler node.
Definition: scheduleredf.h:100
Scheduler_Void_or_thread _Scheduler_EDF_Unblock(const Scheduler_Control *scheduler, Thread_Control *the_thread)
Adds the_thread to the scheduling decision.
Definition: scheduleredfunblock.c:25
This is used to manage a RBT.
Definition: rbtree.h:138
Definition: scheduleredf.h:69
void _Scheduler_EDF_Release_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, uint32_t deadline)
Called when a new job of task is released.
Definition: scheduleredfreleasejob.c:25
Scheduler node for per-thread data.
Definition: scheduler.h:281
RBTree_Control Ready
Top of the ready queue.
Definition: scheduleredf.h:78
Scheduler_EDF_Queue_state queue_state
State of the thread with respect to ready queue.
Definition: scheduleredf.h:113
void _Scheduler_EDF_Block(const Scheduler_Control *scheduler, Thread_Control *the_thread)
Removes thread from ready queue.
Definition: scheduleredfblock.c:24
This is used to manage each element (node) which is placed on a RBT.
Definition: rbtree.h:75
void _Scheduler_EDF_Update_priority(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Control new_priority)
Updates position in the ready queue of the_thread.
Definition: scheduleredfupdate.c:23