source: rtems/cpukit/score/include/rtems/score/scheduleredfimpl.h @ 64939bc

4.11
Last change on this file since 64939bc was 64939bc, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 12, 2014 at 7:22:22 PM

rbtree: Reduce RBTree_Control size

Remove compare function and is unique indicator from the control
structure. Rename RBTree_Compare_function to RBTree_Compare. Rename
rtems_rbtree_compare_function to rtems_rbtree_compare. Provide C++
compatible initializers. Add compare function and is unique indicator
to _RBTree_Find(), _RBTree_Insert(), rtems_rbtree_find() and
rtems_rbtree_insert(). Remove _RBTree_Is_unique() and
rtems_rbtree_is_unique(). Remove compare function and is unique
indicator from _RBTree_Initialize_empty() and
rtems_rbtree_initialize_empty().

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreSchedulerEDF
5 *
6 * @brief EDF Scheduler Implementation
7 */
8
9/*
10 *  Copryight (c) 2011 Petr Benes.
11 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_SCORE_SCHEDULEREDFIMPL_H
19#define _RTEMS_SCORE_SCHEDULEREDFIMPL_H
20
21#include <rtems/score/scheduleredf.h>
22#include <rtems/score/schedulerimpl.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 * @addtogroup ScoreSchedulerEDF EDF
30 *
31 * @{
32 */
33
34RTEMS_INLINE_ROUTINE Scheduler_EDF_Context *
35  _Scheduler_EDF_Get_context( const Scheduler_Control *scheduler )
36{
37  return (Scheduler_EDF_Context *) _Scheduler_Get_context( scheduler );
38}
39
40RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Thread_get_node(
41  Thread_Control *the_thread
42)
43{
44  return (Scheduler_EDF_Node *) _Scheduler_Thread_get_node( the_thread );
45}
46
47int _Scheduler_EDF_Compare(
48  const RBTree_Node* n1,
49  const RBTree_Node* n2
50);
51
52RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Enqueue(
53  const Scheduler_Control *scheduler,
54  Thread_Control          *the_thread
55)
56{
57  Scheduler_EDF_Context *context =
58    _Scheduler_EDF_Get_context( scheduler );
59  Scheduler_EDF_Node *node = _Scheduler_EDF_Thread_get_node( the_thread );
60
61  _RBTree_Insert(
62    &context->Ready,
63    &node->Node,
64    _Scheduler_EDF_Compare,
65    false
66  );
67  node->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES;
68}
69
70RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract(
71  const Scheduler_Control *scheduler,
72  Thread_Control          *the_thread
73)
74{
75  Scheduler_EDF_Context *context =
76    _Scheduler_EDF_Get_context( scheduler );
77  Scheduler_EDF_Node *node = _Scheduler_EDF_Thread_get_node( the_thread );
78
79  _RBTree_Extract( &context->Ready, &node->Node );
80}
81
82RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
83  const Scheduler_Control *scheduler,
84  Thread_Control          *the_thread,
85  bool                     force_dispatch
86)
87{
88  Scheduler_EDF_Context *context =
89    _Scheduler_EDF_Get_context( scheduler );
90  RBTree_Node *first = _RBTree_First( &context->Ready, RBT_LEFT );
91  Scheduler_EDF_Node *node =
92    _RBTree_Container_of(first, Scheduler_EDF_Node, Node);
93  Thread_Control *heir = node->thread;
94
95  ( void ) the_thread;
96
97  _Scheduler_Update_heir( heir, force_dispatch );
98}
99
100/**@}*/
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif
107/* end of include file */
Note: See TracBrowser for help on using the repository browser.