]> rtime.felk.cvut.cz Git - rtems-pluggable-edf.git/blob - rtems-patches/290411.diff
Test_CBS: test updated for testing a basic part of reps_lib API
[rtems-pluggable-edf.git] / rtems-patches / 290411.diff
1 diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
2 index 0d07a9a..a241768 100644
3 --- a/cpukit/score/include/rtems/score/scheduler.h
4 +++ b/cpukit/score/include/rtems/score/scheduler.h
5 @@ -74,6 +74,10 @@ typedef struct {
6  
7    /** extract a thread from the ready set */
8    void ( *extract )(Thread_Control *);
9 +
10 +  /** compares two priorities (returns 1 for p1>p2, 0 for p1==p2 
11 +   * and -1 for p1<p2) */
12 +  int ( *priority_compare )(Priority_Control, Priority_Control);
13  } Scheduler_Operations;
14  
15  /**
16 diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
17 index 3a75dee..a14be2e 100644
18 --- a/cpukit/score/include/rtems/score/schedulerpriority.h
19 +++ b/cpukit/score/include/rtems/score/schedulerpriority.h
20 @@ -48,7 +48,8 @@ extern "C" {
21      _Scheduler_priority_Update,        /* update entry point */ \
22      _Scheduler_priority_Enqueue,       /* enqueue entry point */ \
23      _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \
24 -    _Scheduler_priority_Extract        /* extract entry point */ \
25 +    _Scheduler_priority_Extract,        /* extract entry point */ \
26 +    _Scheduler_priority_Priority_compare /* compares two priorities */ \
27    }
28  
29  /**
30 @@ -171,6 +172,15 @@ void _Scheduler_priority_Extract(
31  );
32  
33  /**
34 + *  This routine compares two priorities.
35 + */
36 +int _Scheduler_priority_Priority_compare(
37 +  Priority_Control      p1,
38 +  Priority_Control      p2
39 +  );
40 +    
41 +
42 +/**
43   *  This is the major bit map.
44   */
45  extern volatile Priority_bit_map_Control _Priority_Major_bit_map;
46 diff --git a/cpukit/score/inline/rtems/score/scheduler.inl b/cpukit/score/inline/rtems/score/scheduler.inl
47 index c2d3dd3..128f901 100644
48 --- a/cpukit/score/inline/rtems/score/scheduler.inl
49 +++ b/cpukit/score/inline/rtems/score/scheduler.inl
50 @@ -159,6 +159,18 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
51    _Scheduler.Operations.extract( the_thread );
52  }
53  
54 +/** @brief _Scheduler_Priority_compare
55 + *
56 + * This routine compares two priorities
57 + */
58 +RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
59 +  Priority_Control p1,
60 +  Priority_Control p2
61 +)
62 +{
63 +  _Scheduler.Operations.priority_compare(p1, p2);
64 +}
65 +
66  /**@}*/
67  
68  #endif
69 diff --git a/cpukit/score/inline/rtems/score/schedulerpriority.inl b/cpukit/score/inline/rtems/score/schedulerpriority.inl
70 index 02e21a2..c1094d3 100644
71 --- a/cpukit/score/inline/rtems/score/schedulerpriority.inl
72 +++ b/cpukit/score/inline/rtems/score/schedulerpriority.inl
73 @@ -189,6 +189,25 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(void)
74    );
75  }
76  
77 +
78 +/**
79 + *  @brief _Scheduler_priority_Priority_compare_body
80 + *
81 + *  This routine implements priority comparison for priority-based
82 + *  scheduling.
83 + */
84 +RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body(
85 +  Priority_Control      p1,
86 +  Priority_Control      p2
87 +)
88 +{
89 +  if (p1 > p2) return 1;
90 +  else if (p1 < p2) return -1;
91 +  else return 0;
92 +}
93 +
94 +
95 +
96  /**@}*/
97  
98  #endif
99 diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
100 index b692d0f..0f62659 100644
101 --- a/cpukit/score/src/coremutexseize.c
102 +++ b/cpukit/score/src/coremutexseize.c
103 @@ -61,7 +61,7 @@ void _CORE_mutex_Seize_interrupt_blocking(
104  
105    executing = _Thread_Executing;
106    if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
107 -    if ( the_mutex->holder->current_priority > executing->current_priority ) {
108 +    if ( _Scheduler_Priority_compare(the_mutex->holder->current_priority, executing->current_priority) == 1 ) {
109        _Thread_Change_priority(
110          the_mutex->holder,
111          executing->current_priority,
112 diff --git a/cpukit/score/src/schedulerpriorityprioritycompare.c b/cpukit/score/src/schedulerpriorityprioritycompare.c
113 new file mode 100644
114 index 0000000..8bf86d4
115 --- /dev/null
116 +++ b/cpukit/score/src/schedulerpriorityprioritycompare.c
117 @@ -0,0 +1,28 @@
118 +/*  Scheduler Simple Handler / Priority compare
119 + *
120 + *  COPYRIGHT (c) 2011.
121 + *  On-Line Applications Research Corporation (OAR).
122 + *
123 + *  The license and distribution terms for this file may be
124 + *  found in the file LICENSE in this distribution or at
125 + *  http://www.rtems.com/license/LICENSE.
126 + *
127 + *  $Id: schedulerpriorityprioritycompare.c,v 1.2 2011/02/28 00:10:38 joel Exp $
128 + */
129 +
130 +#if HAVE_CONFIG_H
131 +#include "config.h"
132 +#endif
133 +
134 +#include <rtems/system.h>
135 +#include <rtems/config.h>
136 +#include <rtems/score/chain.h>
137 +#include <rtems/score/schedulerpriority.h>
138 +
139 +void _Scheduler_priority_Priority_compare( 
140 +  Priority_Control      p1,
141 +  Priority_Control     p2
142 +)
143 +{
144 +  _Scheduler_priority_Priority_compare_body( p1, p2 );
145 +}