Ticket #1895: pluggable_scheduler.diff
File pluggable_scheduler.diff, 14.1 KB (added by Petr Benes, on 08/11/11 at 13:28:33) |
---|
-
cpukit/rtems/src/ratemoncancel.c
diff --git a/cpukit/rtems/src/ratemoncancel.c b/cpukit/rtems/src/ratemoncancel.c index 47776e2..1854d2a 100644
a b rtems_status_code rtems_rate_monotonic_cancel( 53 53 } 54 54 (void) _Watchdog_Remove( &the_period->Timer ); 55 55 the_period->state = RATE_MONOTONIC_INACTIVE; 56 _Scheduler_Release_job(the_period->owner, 0); 56 57 _Thread_Enable_dispatch(); 57 58 return RTEMS_SUCCESSFUL; 58 59 -
cpukit/rtems/src/ratemondelete.c
diff --git a/cpukit/rtems/src/ratemondelete.c b/cpukit/rtems/src/ratemondelete.c index 53dfa8d..b313667 100644
a b rtems_status_code rtems_rate_monotonic_delete( 51 51 (void) _Watchdog_Remove( &the_period->Timer ); 52 52 the_period->state = RATE_MONOTONIC_INACTIVE; 53 53 _Rate_monotonic_Free( the_period ); 54 _Scheduler_Release_job(the_period->owner, 0); 54 55 _Thread_Enable_dispatch(); 55 56 return RTEMS_SUCCESSFUL; 56 57 -
cpukit/rtems/src/ratemonperiod.c
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c index 037d1fd..f1d4102 100644
a b void _Rate_monotonic_Initiate_statistics( 143 143 _Timespec_Add_to( &the_period->cpu_usage_period_initiated, &ran ); 144 144 } 145 145 #endif 146 147 _Scheduler_Release_job(the_period->owner, the_period->next_length); 146 148 } 147 149 148 150 void _Rate_monotonic_Update_statistics( … … rtems_status_code rtems_rate_monotonic_period( 282 284 if ( the_period->state == RATE_MONOTONIC_INACTIVE ) { 283 285 _ISR_Enable( level ); 284 286 287 the_period->next_length = length; 288 285 289 /* 286 290 * Baseline statistics information for the beginning of a period. 287 291 */ … … rtems_status_code rtems_rate_monotonic_period( 295 299 NULL 296 300 ); 297 301 298 the_period->next_length = length;299 300 302 _Watchdog_Insert_ticks( &the_period->Timer, length ); 301 303 _Thread_Enable_dispatch(); 302 304 return RTEMS_SUCCESSFUL; … … rtems_status_code rtems_rate_monotonic_period( 353 355 the_period->next_length = length; 354 356 355 357 _Watchdog_Insert_ticks( &the_period->Timer, length ); 358 _Scheduler_Release_job(the_period->owner, the_period->next_length); 356 359 _Thread_Enable_dispatch(); 357 360 return RTEMS_TIMEOUT; 358 361 } -
cpukit/score/Makefile.am
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index c314c84..85e9caf 100644
a b libscore_a_SOURCES += src/schedulerpriority.c \ 203 203 src/schedulerpriorityenqueuefirst.c \ 204 204 src/schedulerpriorityextract.c \ 205 205 src/schedulerpriorityfree.c \ 206 src/schedulerpriorityprioritycompare.c \ 207 src/schedulerpriorityreleasejob.c \ 206 208 src/schedulerpriorityschedule.c \ 207 209 src/schedulerpriorityunblock.c \ 208 210 src/schedulerpriorityupdate.c \ -
cpukit/score/include/rtems/score/scheduler.h
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h index 19dcc06..1c22ed2 100644
a b typedef struct { 77 77 /** extract a thread from the ready set */ 78 78 void ( *extract )(Thread_Control *); 79 79 80 /** 81 * Compares two priorities (returns 1 for higher priority, 0 for equal 82 * and -1 for lower priority). 83 */ 84 int ( *priority_compare )(Priority_Control, Priority_Control); 85 86 /** This routine is called upon release of a new job. */ 87 void ( *release_job ) (Thread_Control *, uint32_t); 88 80 89 /** perform scheduler update actions required at each clock tick */ 81 90 void ( *tick )(void); 91 82 92 } Scheduler_Operations; 83 93 84 94 /** … … typedef struct { 107 117 extern Scheduler_Control _Scheduler; 108 118 109 119 /** 120 * Macro testing whether @a p1 has lower priority than @a p2 121 * in the intuitive sense of priority. 122 */ 123 #define _Scheduler_Is_priority_lower_than( _p1, _p2 ) \ 124 (_Scheduler_Priority_compare(_p1,_p2) == -1) 125 126 /** 127 * Macro testing whether @a p1 has higher priority than @a p2 128 * in the intuitive sense of priority. 129 */ 130 #define _Scheduler_Is_priority_higher_than( _p1, _p2 ) \ 131 (_Scheduler_Priority_compare(_p1,_p2) == 1) 132 133 /** 110 134 * This routine initializes the scheduler to the policy chosen by the user 111 135 * through confdefs, or to the priority scheduler with ready chains by 112 136 * default. -
cpukit/score/include/rtems/score/schedulerpriority.h
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h index 7f6876d..2b062aa 100644
a b extern "C" { 38 38 */ 39 39 #define SCHEDULER_PRIORITY_ENTRY_POINTS \ 40 40 { \ 41 _Scheduler_priority_Initialize, /* initialize entry point */ \ 42 _Scheduler_priority_Schedule, /* schedule entry point */ \ 43 _Scheduler_priority_Yield, /* yield entry point */ \ 44 _Scheduler_priority_Block, /* block entry point */ \ 45 _Scheduler_priority_Unblock, /* unblock entry point */ \ 46 _Scheduler_priority_Allocate, /* allocate entry point */ \ 47 _Scheduler_priority_Free, /* free entry point */ \ 48 _Scheduler_priority_Update, /* update entry point */ \ 49 _Scheduler_priority_Enqueue, /* enqueue entry point */ \ 50 _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \ 51 _Scheduler_priority_Extract, /* extract entry point */ \ 52 _Scheduler_priority_Tick /* tick entry point */ \ 41 _Scheduler_priority_Initialize, /* initialize entry point */ \ 42 _Scheduler_priority_Schedule, /* schedule entry point */ \ 43 _Scheduler_priority_Yield, /* yield entry point */ \ 44 _Scheduler_priority_Block, /* block entry point */ \ 45 _Scheduler_priority_Unblock, /* unblock entry point */ \ 46 _Scheduler_priority_Allocate, /* allocate entry point */ \ 47 _Scheduler_priority_Free, /* free entry point */ \ 48 _Scheduler_priority_Update, /* update entry point */ \ 49 _Scheduler_priority_Enqueue, /* enqueue entry point */ \ 50 _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \ 51 _Scheduler_priority_Extract, /* extract entry point */ \ 52 _Scheduler_priority_Priority_compare, /* compares two priorities */ \ 53 _Scheduler_priority_Release_job, /* new period of task */ \ 54 _Scheduler_priority_Tick /* tick entry point */ \ 53 55 } 54 56 55 57 /** … … void _Scheduler_priority_Extract( 172 174 ); 173 175 174 176 /** 177 * @brief Scheduler priority Priority compare 178 * 179 * This routine compares two priorities. 180 */ 181 int _Scheduler_priority_Priority_compare( 182 Priority_Control p1, 183 Priority_Control p2 184 ); 185 186 /** 187 * @brief Scheduler priority Release job 188 * 189 * This routine is called when a new job of task is released. 190 * 191 * @param[in] the_thread is the owner of the job. 192 * @param[in] deadline of the new job from now. If equal to 0, 193 * the job was cancelled or deleted. 194 */ 195 void _Scheduler_priority_Release_job ( 196 Thread_Control *the_thread, 197 uint32_t deadline 198 ); 199 200 /** 175 201 * @brief Deterministic Priority Scheduler Tick Method 176 202 * 177 203 * This routine is invoked as part of processing each clock tick. -
cpukit/score/include/rtems/score/schedulersimple.h
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h index e95385e..83e95a1 100644
a b extern "C" { 35 35 */ 36 36 #define SCHEDULER_SIMPLE_ENTRY_POINTS \ 37 37 { \ 38 _Scheduler_simple_Initialize, /* initialize entry point */ \ 39 _Scheduler_simple_Schedule, /* schedule entry point */ \ 40 _Scheduler_simple_Yield, /* yield entry point */ \ 41 _Scheduler_simple_Block, /* block entry point */ \ 42 _Scheduler_simple_Unblock, /* unblock entry point */ \ 43 _Scheduler_simple_Allocate, /* allocate entry point */ \ 44 _Scheduler_simple_Free, /* free entry point */ \ 45 _Scheduler_simple_Update, /* update entry point */ \ 46 _Scheduler_simple_Enqueue, /* enqueue entry point */ \ 47 _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \ 48 _Scheduler_simple_Extract, /* extract entry point */ \ 49 _Scheduler_priority_Tick /* tick entry point */ \ 38 _Scheduler_simple_Initialize, /* initialize entry point */ \ 39 _Scheduler_simple_Schedule, /* schedule entry point */ \ 40 _Scheduler_simple_Yield, /* yield entry point */ \ 41 _Scheduler_simple_Block, /* block entry point */ \ 42 _Scheduler_simple_Unblock, /* unblock entry point */ \ 43 _Scheduler_simple_Allocate, /* allocate entry point */ \ 44 _Scheduler_simple_Free, /* free entry point */ \ 45 _Scheduler_simple_Update, /* update entry point */ \ 46 _Scheduler_simple_Enqueue, /* enqueue entry point */ \ 47 _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \ 48 _Scheduler_simple_Extract, /* extract entry point */ \ 49 _Scheduler_priority_Priority_compare, /* compares two priorities */ \ 50 _Scheduler_priority_Release_job, /* new period of task */ \ 51 _Scheduler_priority_Tick /* tick entry point */ \ 50 52 } 51 53 52 54 /** -
cpukit/score/include/rtems/score/schedulersimplesmp.h
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h index 74424dc..fd36cf0 100644
a b extern "C" { 40 40 41 41 #include <rtems/score/scheduler.h> 42 42 #include <rtems/score/schedulersimple.h> 43 #include <rtems/score/schedulerpriority.h> 43 44 44 45 /** 45 46 * Entry points for Scheduler Simple SMP 46 47 */ 47 48 #define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \ 48 49 { \ 49 _Scheduler_simple_Initialize, /* initialize entry point */ \ 50 _Scheduler_simple_smp_Schedule, /* schedule entry point */ \ 51 _Scheduler_simple_Yield, /* yield entry point */ \ 52 _Scheduler_simple_smp_Block, /* block entry point */ \ 53 _Scheduler_simple_smp_Unblock, /* unblock entry point */ \ 54 _Scheduler_simple_Allocate, /* allocate entry point */ \ 55 _Scheduler_simple_Free, /* free entry point */ \ 56 _Scheduler_simple_Update, /* update entry point */ \ 57 _Scheduler_simple_Enqueue, /* enqueue entry point */ \ 58 _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \ 59 _Scheduler_simple_Extract, /* extract entry point */ \ 60 _Scheduler_simple_smp_Tick /* tick entry point */ \ 50 _Scheduler_simple_Initialize, /* initialize entry point */ \ 51 _Scheduler_simple_smp_Schedule, /* schedule entry point */ \ 52 _Scheduler_simple_Yield, /* yield entry point */ \ 53 _Scheduler_simple_smp_Block, /* block entry point */ \ 54 _Scheduler_simple_smp_Unblock, /* unblock entry point */ \ 55 _Scheduler_simple_Allocate, /* allocate entry point */ \ 56 _Scheduler_simple_Free, /* free entry point */ \ 57 _Scheduler_simple_Update, /* update entry point */ \ 58 _Scheduler_simple_Enqueue, /* enqueue entry point */ \ 59 _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \ 60 _Scheduler_simple_Extract, /* extract entry point */ \ 61 _Scheduler_priority_Priority_compare, /* compares two priorities */ \ 62 _Scheduler_priority_Release_job, /* new period of task */ \ 63 _Scheduler_simple_smp_Tick /* tick entry point */ \ 61 64 } 62 65 63 66 /** -
cpukit/score/inline/rtems/score/scheduler.inl
diff --git a/cpukit/score/inline/rtems/score/scheduler.inl b/cpukit/score/inline/rtems/score/scheduler.inl index 0bd3dc7..36c99c7 100644
a b RTEMS_INLINE_ROUTINE void _Scheduler_Extract( 159 159 _Scheduler.Operations.extract( the_thread ); 160 160 } 161 161 162 /** 163 * @brief Scheduler Priority compare 164 * 165 * This routine compares two priorities. 166 */ 167 RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare( 168 Priority_Control p1, 169 Priority_Control p2 170 ) 171 { 172 return _Scheduler.Operations.priority_compare(p1, p2); 173 } 174 175 /** 176 * @brief Scheduler Release job 177 * 178 * This routine is called when a new period of task is issued. 179 */ 180 RTEMS_INLINE_ROUTINE void _Scheduler_Release_job( 181 Thread_Control *the_thread, 182 uint32_t length 183 ) 184 { 185 _Scheduler.Operations.release_job(the_thread, length); 186 } 187 162 188 /** @brief Scheduler Method Invoked at Each Clock Tick 163 189 * 164 190 * This method is invoked at each clock tick to allow the scheduler -
cpukit/score/inline/rtems/score/schedulerpriority.inl
diff --git a/cpukit/score/inline/rtems/score/schedulerpriority.inl b/cpukit/score/inline/rtems/score/schedulerpriority.inl index 0eddbf5..1c0263c 100644
a b RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(void) 185 185 ); 186 186 } 187 187 188 /** 189 * @brief Scheduler priority Priority compare body 190 * 191 * This routine implements priority comparison for priority-based 192 * scheduling. 193 * 194 * @return 1 for higher priority, 0 for equal and -1 for lower priority. 195 */ 196 RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body( 197 Priority_Control p1, 198 Priority_Control p2 199 ) 200 { 201 /* High priority in priority scheduler is represented by low numbers. */ 202 return ((p1<p2) - (p1>p2)); 203 } 204 188 205 /**@}*/ 189 206 190 207 #endif -
cpukit/score/src/coremutexseize.c
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c index bab9293..c7bfcd8 100644
a b void _CORE_mutex_Seize_interrupt_blocking( 60 60 61 61 executing = _Thread_Executing; 62 62 if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) { 63 if ( the_mutex->holder->current_priority > executing->current_priority ) { 63 if ( _Scheduler_Is_priority_higher_than( 64 executing->current_priority, 65 the_mutex->holder->current_priority)) { 64 66 _Thread_Change_priority( 65 67 the_mutex->holder, 66 68 executing->current_priority,