RTEMS 6.1-rc2
Loading...
Searching...
No Matches
scheduleredf.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
13/*
14 * Copryight (c) 2011 Petr Benes.
15 * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef _RTEMS_SCORE_SCHEDULEREDF_H
40#define _RTEMS_SCORE_SCHEDULEREDF_H
41
45#include <rtems/score/rbtree.h>
46
47#include <limits.h>
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
63/*
64 * Actually the EDF scheduler supports a maximum priority of
65 * 0x7fffffffffffffff, but the user API is limited to uint32_t or int for
66 * thread priorities. Ignore ILP64 targets for now.
67 */
68#define SCHEDULER_EDF_MAXIMUM_PRIORITY INT_MAX
69
73#define SCHEDULER_EDF_ENTRY_POINTS \
74 { \
75 _Scheduler_EDF_Initialize, /* initialize entry point */ \
76 _Scheduler_EDF_Schedule, /* schedule entry point */ \
77 _Scheduler_EDF_Yield, /* yield entry point */ \
78 _Scheduler_EDF_Block, /* block entry point */ \
79 _Scheduler_EDF_Unblock, /* unblock entry point */ \
80 _Scheduler_EDF_Update_priority, /* update priority entry point */ \
81 _Scheduler_EDF_Map_priority, /* map priority entry point */ \
82 _Scheduler_EDF_Unmap_priority, /* unmap priority entry point */ \
83 SCHEDULER_DEFAULT_SMP_OPERATIONS \
84 _Scheduler_EDF_Node_initialize, /* node initialize entry point */ \
85 _Scheduler_default_Node_destroy, /* node destroy entry point */ \
86 _Scheduler_EDF_Release_job, /* new period of task */ \
87 _Scheduler_EDF_Cancel_job, /* cancel period of task */ \
88 _Scheduler_default_Start_idle /* start idle entry point */ \
89 SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \
90 }
91
92typedef struct {
97
101 RBTree_Control Ready;
103
107typedef struct {
112
117
123
131void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
132
142 const Scheduler_Control *scheduler,
143 Thread_Control *the_thread,
144 Scheduler_Node *node
145);
146
158 const Scheduler_Control *scheduler,
159 Thread_Control *the_thread
160);
161
171 const Scheduler_Control *scheduler,
172 Scheduler_Node *node,
173 Thread_Control *the_thread,
174 Priority_Control priority
175);
176
185 const Scheduler_Control *scheduler,
186 Thread_Control *the_thread,
187 Scheduler_Node *node
188);
189
198 const Scheduler_Control *scheduler,
199 Thread_Control *the_thread,
200 Scheduler_Node *node
201);
202
212 const Scheduler_Control *scheduler,
213 Priority_Control priority
214);
215
225 const Scheduler_Control *scheduler,
226 Priority_Control priority
227);
228
237 const Scheduler_Control *scheduler,
238 Thread_Control *the_thread,
239 Scheduler_Node *node
240);
241
252 const Scheduler_Control *scheduler,
253 Thread_Control *the_thread,
254 Priority_Node *priority_node,
255 uint64_t deadline,
256 Thread_queue_Context *queue_context
257);
258
268 const Scheduler_Control *scheduler,
269 Thread_Control *the_thread,
270 Priority_Node *priority_node,
271 Thread_queue_Context *queue_context
272);
273
274#ifdef __cplusplus
275}
276#endif
277
280#endif
281/* end of include file */
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:91
void _Scheduler_EDF_Unblock(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Performs an unblocking of the thread.
Definition: scheduleredfunblock.c:46
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:44
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:44
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:98
void _Scheduler_EDF_Initialize(const Scheduler_Control *scheduler)
Initializes EDF scheduler.
Definition: scheduleredf.c:44
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:61
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:44
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:45
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:53
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:44
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:44
This header file provides interfaces of the Priority Handler which are used by the implementation and...
This header file provides interfaces of the Red-Black Tree Handler which are used by the implementati...
This header file provides interfaces of the Deterministic Priority Scheduler which are used by the im...
This header file provides interfaces of the Scheduler Handler which are used by the implementation an...
The priority node to build up a priority aggregation.
Definition: priority.h:112
Red-black tree node.
Definition: rbtree.h:73
Scheduler context.
Definition: scheduler.h:318
Definition: scheduleredf.h:92
Scheduler_Context Base
Basic scheduler context.
Definition: scheduleredf.h:96
RBTree_Control Ready
Definition: scheduleredf.h:101
Scheduler node specialization for EDF schedulers.
Definition: scheduleredf.h:107
Priority_Control priority
The thread priority currently used for this scheduler instance.
Definition: scheduleredf.h:121
RBTree_Node Node
Definition: scheduleredf.h:116
Scheduler_Node Base
Basic scheduler node.
Definition: scheduleredf.h:111
Scheduler node for per-thread data.
Definition: schedulernode.h:94
Thread queue context for the thread queue methods.
Definition: threadq.h:216
Scheduler control.
Definition: scheduler.h:335
Definition: thread.h:812