source: rtems/cpukit/score/src/scheduleredf.c @ 2369b10

4.115
Last change on this file since 2369b10 was beab7329, checked in by Sebastian Huber <sebastian.huber@…>, on 05/13/14 at 14:03:05

score: Introduce scheduler nodes

Rename scheduler per-thread information into scheduler nodes using
Scheduler_Node as the base type. Use inheritance for specialized
schedulers.

Move the scheduler specific states from the thread control block into
the scheduler node structure.

Validate the SMP scheduler node state transitions in case RTEMS_DEBUG is
defined.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief Scheduler EDF Initialize and Support
5 * @ingroup ScoreScheduler
6 */
7
8/*
9 *  Copyright (C) 2011 Petr Benes.
10 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/scheduleredfimpl.h>
22
23static int _Scheduler_EDF_RBTree_compare_function
24(
25  const RBTree_Node* n1,
26  const RBTree_Node* n2
27)
28{
29  Priority_Control value1 = _RBTree_Container_of
30    (n1,Scheduler_EDF_Node,Node)->thread->current_priority;
31  Priority_Control value2 = _RBTree_Container_of
32    (n2,Scheduler_EDF_Node,Node)->thread->current_priority;
33
34  /*
35   * This function compares only numbers for the red-black tree,
36   * but priorities have an opposite sense.
37   */
38  return (-1)*_Scheduler_EDF_Priority_compare(value1, value2);
39}
40
41void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler )
42{
43  Scheduler_EDF_Context *context =
44    _Scheduler_EDF_Get_context( scheduler );
45
46  _RBTree_Initialize_empty(
47    &context->Ready,
48    _Scheduler_EDF_RBTree_compare_function,
49    0
50  );
51}
Note: See TracBrowser for help on using the repository browser.