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

4.115
Last change on this file since eea7c937 was 4b48ece0, checked in by Sebastian Huber <sebastian.huber@…>, on 07/22/13 at 08:21:03

score: Create watchdog implementation header

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

  • Property mode set to 100644
File size: 1.2 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#include <rtems/score/watchdogimpl.h>
26
27int _Scheduler_EDF_Priority_compare (
28  Priority_Control p1,
29  Priority_Control p2
30)
31{
32  Watchdog_Interval time = _Watchdog_Ticks_since_boot;
33
34  /*
35   * Reorder priorities to separate deadline driven and background tasks.
36   *
37   * The background tasks have p1 or p2 > SCHEDULER_EDF_PRIO_MSB.
38   * The deadline driven tasks need to have subtracted current time in order
39   * to see which deadline is closer wrt. current time.
40   */
41  if (!(p1 & SCHEDULER_EDF_PRIO_MSB))
42    p1 = (p1 - time) & ~SCHEDULER_EDF_PRIO_MSB;
43  if (!(p2 & SCHEDULER_EDF_PRIO_MSB))
44    p2 = (p2 - time) & ~SCHEDULER_EDF_PRIO_MSB;
45
46  return ((p1<p2) - (p1>p2));
47}
Note: See TracBrowser for help on using the repository browser.