]> rtime.felk.cvut.cz Git - rtems-pluggable-edf.git/commitdiff
Added RTEMS patch
authorPetr Benes <benesp16@fel.cvut.cz>
Tue, 3 May 2011 10:23:26 +0000 (12:23 +0200)
committerPetr Benes <benesp16@fel.cvut.cz>
Tue, 3 May 2011 10:23:26 +0000 (12:23 +0200)
rtems-patches/290411.diff [new file with mode: 0644]

diff --git a/rtems-patches/290411.diff b/rtems-patches/290411.diff
new file mode 100644 (file)
index 0000000..9a7da60
--- /dev/null
@@ -0,0 +1,145 @@
+diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
+index 0d07a9a..a241768 100644
+--- a/cpukit/score/include/rtems/score/scheduler.h
++++ b/cpukit/score/include/rtems/score/scheduler.h
+@@ -74,6 +74,10 @@ typedef struct {
+   /** extract a thread from the ready set */
+   void ( *extract )(Thread_Control *);
++
++  /** compares two priorities (returns 1 for p1>p2, 0 for p1==p2 
++   * and -1 for p1<p2) */
++  int ( *priority_compare )(Priority_Control, Priority_Control);
+ } Scheduler_Operations;
+ /**
+diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
+index 3a75dee..a14be2e 100644
+--- a/cpukit/score/include/rtems/score/schedulerpriority.h
++++ b/cpukit/score/include/rtems/score/schedulerpriority.h
+@@ -48,7 +48,8 @@ extern "C" {
+     _Scheduler_priority_Update,        /* update entry point */ \
+     _Scheduler_priority_Enqueue,       /* enqueue entry point */ \
+     _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \
+-    _Scheduler_priority_Extract        /* extract entry point */ \
++    _Scheduler_priority_Extract,        /* extract entry point */ \
++    _Scheduler_priority_Priority_compare /* compares two priorities */ \
+   }
+ /**
+@@ -171,6 +172,15 @@ void _Scheduler_priority_Extract(
+ );
+ /**
++ *  This routine compares two priorities.
++ */
++int _Scheduler_priority_Priority_compare(
++  Priority_Control      p1,
++  Priority_Control      p2
++  );
++    
++
++/**
+  *  This is the major bit map.
+  */
+ extern volatile Priority_bit_map_Control _Priority_Major_bit_map;
+diff --git a/cpukit/score/inline/rtems/score/scheduler.inl b/cpukit/score/inline/rtems/score/scheduler.inl
+index c2d3dd3..128f901 100644
+--- a/cpukit/score/inline/rtems/score/scheduler.inl
++++ b/cpukit/score/inline/rtems/score/scheduler.inl
+@@ -159,6 +159,18 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
+   _Scheduler.Operations.extract( the_thread );
+ }
++/** @brief _Scheduler_Priority_compare
++ *
++ * This routine compares two priorities
++ */
++RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
++  Priority_Control p1,
++  Priority_Control p2
++)
++{
++  _Scheduler.Operations.priority_compare(p1, p2);
++}
++
+ /**@}*/
+ #endif
+diff --git a/cpukit/score/inline/rtems/score/schedulerpriority.inl b/cpukit/score/inline/rtems/score/schedulerpriority.inl
+index 02e21a2..c1094d3 100644
+--- a/cpukit/score/inline/rtems/score/schedulerpriority.inl
++++ b/cpukit/score/inline/rtems/score/schedulerpriority.inl
+@@ -189,6 +189,25 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(void)
+   );
+ }
++
++/**
++ *  @brief _Scheduler_priority_Priority_compare_body
++ *
++ *  This routine implements priority comparison for priority-based
++ *  scheduling.
++ */
++RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body(
++  Priority_Control      p1,
++  Priority_Control      p2
++)
++{
++  if (p1 > p2) return 1;
++  else if (p1 < p2) return -1;
++  else return 0;
++}
++
++
++
+ /**@}*/
+ #endif
+diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
+index b692d0f..0f62659 100644
+--- a/cpukit/score/src/coremutexseize.c
++++ b/cpukit/score/src/coremutexseize.c
+@@ -61,7 +61,7 @@ void _CORE_mutex_Seize_interrupt_blocking(
+   executing = _Thread_Executing;
+   if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
+-    if ( the_mutex->holder->current_priority > executing->current_priority ) {
++    if ( _Scheduler_Priority_compare(the_mutex->holder->current_priority, executing->current_priority) == 1 ) {
+       _Thread_Change_priority(
+         the_mutex->holder,
+         executing->current_priority,
+diff --git a/cpukit/score/src/schedulerpriorityprioritycompare.c b/cpukit/score/src/schedulerpriorityprioritycompare.c
+new file mode 100644
+index 0000000..8bf86d4
+--- /dev/null
++++ b/cpukit/score/src/schedulerpriorityprioritycompare.c
+@@ -0,0 +1,28 @@
++/*  Scheduler Simple Handler / Priority compare
++ *
++ *  COPYRIGHT (c) 2011.
++ *  On-Line Applications Research Corporation (OAR).
++ *
++ *  The license and distribution terms for this file may be
++ *  found in the file LICENSE in this distribution or at
++ *  http://www.rtems.com/license/LICENSE.
++ *
++ *  $Id: schedulerpriorityprioritycompare.c,v 1.2 2011/02/28 00:10:38 joel Exp $
++ */
++
++#if HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++#include <rtems/system.h>
++#include <rtems/config.h>
++#include <rtems/score/chain.h>
++#include <rtems/score/schedulerpriority.h>
++
++void _Scheduler_priority_Priority_compare( 
++  Priority_Control      p1,
++  Priority_Control    p2
++)
++{
++  _Scheduler_priority_Priority_compare_body( p1, p2 );
++}