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

4.115
Last change on this file since eea7c937 was c6e21ee1, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 11:12:38

score: Create scheduler implementation header

Move implementation specific parts of scheduler.h and scheduler.inl into
new header file schedulerimpl.h. The scheduler.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 1.3 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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/scheduleredf.h>
22#include <rtems/score/schedulerimpl.h>
23#include <rtems/score/thread.h>
24
25static int _Scheduler_EDF_RBTree_compare_function
26(
27  const RBTree_Node* n1,
28  const RBTree_Node* n2
29)
30{
31  Priority_Control value1 = _RBTree_Container_of
32    (n1,Scheduler_EDF_Per_thread,Node)->thread->current_priority;
33  Priority_Control value2 = _RBTree_Container_of
34    (n2,Scheduler_EDF_Per_thread,Node)->thread->current_priority;
35
36  /*
37   * This function compares only numbers for the red-black tree,
38   * but priorities have an opposite sense.
39   */
40  return (-1)*_Scheduler_Priority_compare(value1, value2);
41}
42
43void _Scheduler_EDF_Initialize(void)
44{
45  _RBTree_Initialize_empty(
46      &_Scheduler_EDF_Ready_queue,
47      &_Scheduler_EDF_RBTree_compare_function,
48      0
49  );
50}
51
52/* Instantiate any global variables needed by the EDF scheduler */
53RBTree_Control _Scheduler_EDF_Ready_queue;
Note: See TracBrowser for help on using the repository browser.