diff options
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h | 137 |
1 files changed, 114 insertions, 23 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h b/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h index 2d8d1a5aed..a8196218c1 100644 --- a/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h +++ b/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h @@ -23,9 +23,9 @@ #ifndef _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H #define _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H -#include <rtems/score/scheduler.h> -#include <rtems/score/schedulerpriority.h> -#include <rtems/score/schedulersmp.h> +#include <rtems/score/schedulerprioritysmp.h> +#include <rtems/score/schedulerpriorityimpl.h> +#include <rtems/score/schedulersimpleimpl.h> #ifdef __cplusplus extern "C" { @@ -36,44 +36,135 @@ extern "C" { * @{ */ -Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self( +static inline Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self( Scheduler_Context *context -); +) +{ + return (Scheduler_priority_SMP_Context *) context; +} -Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get( +static inline Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get( Thread_Control *thread -); +) +{ + return (Scheduler_priority_SMP_Node *) _Scheduler_Node_get( thread ); +} -void _Scheduler_priority_SMP_Insert_ready_fifo( +static Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_downcast( + Scheduler_Node *node +) +{ + return (Scheduler_priority_SMP_Node *) node; +} + +static inline void _Scheduler_priority_SMP_Move_from_scheduled_to_ready( Scheduler_Context *context, - Thread_Control *thread -); + Thread_Control *scheduled_to_ready +) +{ + Scheduler_priority_SMP_Context *self = + _Scheduler_priority_SMP_Get_self( context ); + Scheduler_priority_SMP_Node *node = + _Scheduler_priority_SMP_Node_get( scheduled_to_ready ); + + _Chain_Extract_unprotected( &scheduled_to_ready->Object.Node ); + _Scheduler_priority_Ready_queue_enqueue_first( + scheduled_to_ready, + &node->Ready_queue, + &self->Bit_map + ); +} -void _Scheduler_priority_SMP_Insert_ready_lifo( +static inline void _Scheduler_priority_SMP_Move_from_ready_to_scheduled( Scheduler_Context *context, - Thread_Control *thread -); + Thread_Control *ready_to_scheduled +) +{ + Scheduler_priority_SMP_Context *self = + _Scheduler_priority_SMP_Get_self( context ); + Scheduler_priority_SMP_Node *node = + _Scheduler_priority_SMP_Node_get( ready_to_scheduled ); + + _Scheduler_priority_Ready_queue_extract( + ready_to_scheduled, + &node->Ready_queue, + &self->Bit_map + ); + _Scheduler_simple_Insert_priority_fifo( + &self->Base.Scheduled, + ready_to_scheduled + ); +} -void _Scheduler_priority_SMP_Move_from_scheduled_to_ready( +static inline void _Scheduler_priority_SMP_Insert_ready_lifo( Scheduler_Context *context, - Thread_Control *scheduled_to_ready -); + Thread_Control *thread +) +{ + Scheduler_priority_SMP_Context *self = + _Scheduler_priority_SMP_Get_self( context ); + Scheduler_priority_SMP_Node *node = + _Scheduler_priority_SMP_Node_get( thread ); + + _Scheduler_priority_Ready_queue_enqueue( + thread, + &node->Ready_queue, + &self->Bit_map + ); +} -void _Scheduler_priority_SMP_Move_from_ready_to_scheduled( +static inline void _Scheduler_priority_SMP_Insert_ready_fifo( Scheduler_Context *context, - Thread_Control *ready_to_scheduled -); + Thread_Control *thread +) +{ + Scheduler_priority_SMP_Context *self = + _Scheduler_priority_SMP_Get_self( context ); + Scheduler_priority_SMP_Node *node = + _Scheduler_priority_SMP_Node_get( thread ); + + _Scheduler_priority_Ready_queue_enqueue_first( + thread, + &node->Ready_queue, + &self->Bit_map + ); +} -void _Scheduler_priority_SMP_Extract_from_ready( +static inline void _Scheduler_priority_SMP_Extract_from_ready( Scheduler_Context *context, Thread_Control *thread -); +) +{ + Scheduler_priority_SMP_Context *self = + _Scheduler_priority_SMP_Get_self( context ); + Scheduler_priority_SMP_Node *node = + _Scheduler_priority_SMP_Node_get( thread ); + + _Scheduler_priority_Ready_queue_extract( + thread, + &node->Ready_queue, + &self->Bit_map + ); +} -void _Scheduler_priority_SMP_Do_update( +static inline void _Scheduler_priority_SMP_Do_update( Scheduler_Context *context, Scheduler_Node *base_node, Priority_Control new_priority -); +) +{ + Scheduler_priority_SMP_Context *self = + _Scheduler_priority_SMP_Get_self( context ); + Scheduler_priority_SMP_Node *node = + _Scheduler_priority_SMP_Node_downcast( base_node ); + + _Scheduler_priority_Ready_queue_update( + &node->Ready_queue, + new_priority, + &self->Bit_map, + &self->Ready[ 0 ] + ); +} /** @} */ |