RTEMS: cpukit/include/rtems/score/scheduleredf.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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>
26#include <rtems/score/schedulerpriority.h>
27#include <rtems/score/rbtree.h>
28
29#include <limits.h>
30
31#ifdef __cplusplus
32extern "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 {
79 Scheduler_Context Base;
80
84 RBTree_Control Ready;
85} Scheduler_EDF_Context;
86
90 typedef struct {
94 Scheduler_Node Base;
95
99 RBTree_Node Node;
100
104 Priority_Control priority;
105} Scheduler_EDF_Node;
106
114void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
115
124void _Scheduler_EDF_Block(
125 const Scheduler_Control *scheduler,
126 Thread_Control *the_thread,
127 Scheduler_Node *node
128);
129
140void _Scheduler_EDF_Schedule(
141 const Scheduler_Control *scheduler,
142 Thread_Control *the_thread
143);
144
153void _Scheduler_EDF_Node_initialize(
154 const Scheduler_Control *scheduler,
155 Scheduler_Node *node,
156 Thread_Control *the_thread,
157 Priority_Control priority
158);
159
167void _Scheduler_EDF_Unblock(
168 const Scheduler_Control *scheduler,
169 Thread_Control *the_thread,
170 Scheduler_Node *node
171);
172
180void _Scheduler_EDF_Update_priority(
181 const Scheduler_Control *scheduler,
182 Thread_Control *the_thread,
183 Scheduler_Node *node
184);
185
194 Priority_Control _Scheduler_EDF_Map_priority(
195 const Scheduler_Control *scheduler,
196 Priority_Control priority
197);
198
207 Priority_Control _Scheduler_EDF_Unmap_priority(
208 const Scheduler_Control *scheduler,
209 Priority_Control priority
210);
211
219void _Scheduler_EDF_Yield(
220 const Scheduler_Control *scheduler,
221 Thread_Control *the_thread,
222 Scheduler_Node *node
223);
224
234void _Scheduler_EDF_Release_job(
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
250void _Scheduler_EDF_Cancel_job(
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 */
Priority_Control
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
_Scheduler_EDF_Unblock
void _Scheduler_EDF_Unblock(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Performs an unblocking of the thread.
Definition: scheduleredfunblock.c:26
_Scheduler_EDF_Yield
void _Scheduler_EDF_Yield(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Executes a thread yield for the thread.
Definition: scheduleredfyield.c:24
_Scheduler_EDF_Node_initialize
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
_Scheduler_EDF_Cancel_job
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.
Definition: scheduleredfreleasejob.c:77
_Scheduler_EDF_Initialize
void _Scheduler_EDF_Initialize(const Scheduler_Control *scheduler)
Initializes EDF scheduler.
Definition: scheduleredf.c:24
_Scheduler_EDF_Release_job
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.
Definition: scheduleredfreleasejob.c:40
_Scheduler_EDF_Block
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...
Definition: scheduleredfblock.c:24
_Scheduler_EDF_Map_priority
Priority_Control _Scheduler_EDF_Map_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Gets the mapped priority map of the priority control.
Definition: scheduleredfreleasejob.c:24
_Scheduler_EDF_Unmap_priority
Priority_Control _Scheduler_EDF_Unmap_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Gets the unmapped priority map of the priority control.
Definition: scheduleredfreleasejob.c:32
_Scheduler_EDF_Update_priority
void _Scheduler_EDF_Update_priority(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Updates the priority of the scheduler node.
Definition: scheduleredfchangepriority.c:23
_Scheduler_EDF_Schedule
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
priority.h
Priority Handler API.
rbtree.h
Constants and Structures Associated with the Red-Black Tree Handler.
schedulerpriority.h
Thread Manipulation with the Priority-Based Scheduler.
scheduler.h
Constants and Structures Associated with the Scheduler.
Priority_Node
The priority node to build up a priority aggregation.
Definition: priority.h:98
RBTree_Node
Red-black tree node.
Definition: rbtree.h:55
Scheduler_Context
Scheduler context.
Definition: scheduler.h:252
Scheduler_EDF_Context
Definition: scheduleredf.h:75
Scheduler_EDF_Context::Base
Scheduler_Context Base
Basic scheduler context.
Definition: scheduleredf.h:79
Scheduler_EDF_Context::Ready
RBTree_Control Ready
Definition: scheduleredf.h:84
Scheduler_EDF_Node
Scheduler node specialization for EDF schedulers.
Definition: scheduleredf.h:90
Scheduler_EDF_Node::priority
Priority_Control priority
The thread priority currently used for this scheduler instance.
Definition: scheduleredf.h:104
Scheduler_EDF_Node::Node
RBTree_Node Node
Definition: scheduleredf.h:99
Scheduler_EDF_Node::Base
Scheduler_Node Base
Basic scheduler node.
Definition: scheduleredf.h:94
Scheduler_Node
Scheduler node for per-thread data.
Definition: schedulernode.h:79
Thread_queue_Context
Thread queue context for the thread queue methods.
Definition: threadq.h:198
_Scheduler_Control
Scheduler control.
Definition: scheduler.h:269
_Thread_Control
Definition: thread.h:732