source: rtems/cpukit/score/src/scheduleredf.c @ bbd6d27a

5
Last change on this file since bbd6d27a was 60fe374, checked in by Sebastian Huber <sebastian.huber@…>, on 08/03/14 at 11:02:58

rbtree: Add and use RBTree_Compare_result

  • 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
23RBTree_Compare_result _Scheduler_EDF_Compare(
24  const RBTree_Node* n1,
25  const RBTree_Node* n2
26)
27{
28  Scheduler_EDF_Node *edf1 =
29    RTEMS_CONTAINER_OF( n1, Scheduler_EDF_Node, Node );
30  Scheduler_EDF_Node *edf2 =
31    RTEMS_CONTAINER_OF( n2, Scheduler_EDF_Node, Node );
32  Priority_Control value1 = edf1->thread->current_priority;
33  Priority_Control value2 = edf2->thread->current_priority;
34
35  /*
36   * This function compares only numbers for the red-black tree,
37   * but priorities have an opposite sense.
38   */
39  return (-1)*_Scheduler_EDF_Priority_compare(value1, value2);
40}
41
42void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler )
43{
44  Scheduler_EDF_Context *context =
45    _Scheduler_EDF_Get_context( scheduler );
46
47  _RBTree_Initialize_empty( &context->Ready );
48}
Note: See TracBrowser for help on using the repository browser.