source: rtems/cpukit/score/src/scheduleredfprioritycompare.c @ 4fc370e

4.115
Last change on this file since 4fc370e was d4d7899, checked in by Christopher Kerl <zargyyoyo@…>, on 11/28/12 at 19:31:53

score misc: Clean up Doxygen #2 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/7986213

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief Compares Priorities of Threads
5 *
6 * @ingroup ScoreScheduler
7 */
8
9/*
10 *  Copyright (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.com/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/system.h>
23#include <rtems/config.h>
24#include <rtems/score/scheduleredf.h>
25
26int _Scheduler_EDF_Priority_compare (
27  Priority_Control p1,
28  Priority_Control p2
29)
30{
31  Watchdog_Interval time = _Watchdog_Ticks_since_boot;
32
33  /*
34   * Reorder priorities to separate deadline driven and background tasks.
35   *
36   * The background tasks have p1 or p2 > SCHEDULER_EDF_PRIO_MSB.
37   * The deadline driven tasks need to have subtracted current time in order
38   * to see which deadline is closer wrt. current time.
39   */
40  if (!(p1 & SCHEDULER_EDF_PRIO_MSB))
41    p1 = (p1 - time) & ~SCHEDULER_EDF_PRIO_MSB;
42  if (!(p2 & SCHEDULER_EDF_PRIO_MSB))
43    p2 = (p2 - time) & ~SCHEDULER_EDF_PRIO_MSB;
44
45  return ((p1<p2) - (p1>p2));
46}
Note: See TracBrowser for help on using the repository browser.