diff options
Diffstat (limited to 'cpukit/include/rtems/score/schedulerpriorityimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/schedulerpriorityimpl.h | 81 |
1 files changed, 44 insertions, 37 deletions
diff --git a/cpukit/include/rtems/score/schedulerpriorityimpl.h b/cpukit/include/rtems/score/schedulerpriorityimpl.h index 64901d52b7..5e80918b20 100644 --- a/cpukit/include/rtems/score/schedulerpriorityimpl.h +++ b/cpukit/include/rtems/score/schedulerpriorityimpl.h @@ -1,19 +1,38 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * - * @ingroup RTEMSScoreSchedulerDPS + * @ingroup RTEMSScoreSchedulerPriority * * @brief This header file provides interfaces of the - * @ref RTEMSScoreSchedulerDPS which are only used by the implementation. + * @ref RTEMSScoreSchedulerPriority which are only used by the implementation. */ /* * Copyright (C) 2010 Gedare Bloom. * 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.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RTEMS_SCORE_SCHEDULERPRIORITYIMPL_H @@ -22,7 +41,7 @@ #include <rtems/score/schedulerpriority.h> #include <rtems/score/chainimpl.h> #include <rtems/score/prioritybitmapimpl.h> -#include <rtems/score/schedulerimpl.h> +#include <rtems/score/scheduleruniimpl.h> #include <rtems/score/thread.h> #ifdef __cplusplus @@ -30,7 +49,7 @@ extern "C" { #endif /** - * @addtogroup RTEMSScoreSchedulerDPS + * @addtogroup RTEMSScoreSchedulerPriority * * @{ */ @@ -42,7 +61,7 @@ extern "C" { * * @return The context of the scheduler. */ -RTEMS_INLINE_ROUTINE Scheduler_priority_Context * +static inline Scheduler_priority_Context * _Scheduler_priority_Get_context( const Scheduler_Control *scheduler ) { return (Scheduler_priority_Context *) _Scheduler_Get_context( scheduler ); @@ -55,7 +74,7 @@ RTEMS_INLINE_ROUTINE Scheduler_priority_Context * * * @return The scheduler node of @a the_thread. */ -RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Thread_get_node( +static inline Scheduler_priority_Node *_Scheduler_priority_Thread_get_node( Thread_Control *the_thread ) { @@ -69,7 +88,7 @@ RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Thread_get_nod * * @return The priority node. */ -RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Node_downcast( +static inline Scheduler_priority_Node *_Scheduler_priority_Node_downcast( Scheduler_Node *node ) { @@ -84,7 +103,7 @@ RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Node_downcast( * @param[out] ready_queues The ready queue to initialize. * @param maximum_priority The maximum priority in the ready queue. */ -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize( +static inline void _Scheduler_priority_Ready_queue_initialize( Chain_Control *ready_queues, Priority_Control maximum_priority ) @@ -105,7 +124,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize( * @param[in, out] ready_queue The ready queue. * @param[out] bit_map The priority bit map of the scheduler instance. */ -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue( +static inline void _Scheduler_priority_Ready_queue_enqueue( Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map @@ -126,7 +145,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue( * @param[in, out] ready_queue The ready queue. * @param[out] bit_map The priority bit map of the scheduler instance. */ -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first( +static inline void _Scheduler_priority_Ready_queue_enqueue_first( Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map @@ -145,7 +164,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first( * @param[in, out] ready_queue The ready queue. * @param[out] bit_map The priority bit map of the scheduler instance. */ -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract( +static inline void _Scheduler_priority_Ready_queue_extract( Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map @@ -169,7 +188,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract( * @param the_thread The thread of which the node will be extracted. * @param[in, out] The node which preserves the ready queue. */ -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body( +static inline void _Scheduler_priority_Extract_body( const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node @@ -198,7 +217,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body( * * @return This method returns the first node. */ -RTEMS_INLINE_ROUTINE Chain_Node *_Scheduler_priority_Ready_queue_first( +static inline Chain_Node *_Scheduler_priority_Ready_queue_first( Priority_bit_map_Control *bit_map, Chain_Control *ready_queues ) @@ -212,33 +231,21 @@ RTEMS_INLINE_ROUTINE Chain_Node *_Scheduler_priority_Ready_queue_first( } /** - * @brief Scheduling decision logic. + * @brief Gets the highest priority ready thread of the scheduler. * - * This kernel routine implements scheduling decision logic - * for priority-based scheduling. - * - * @param[in, out] scheduler The scheduler instance. - * @param the_thread This parameter is unused. - * @param force_dispatch Indicates whether the dispatch happens also if - * the currently executing thread is set as not preemptible. + * @param scheduler is the scheduler. */ -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body( - const Scheduler_Control *scheduler, - Thread_Control *the_thread, - bool force_dispatch +static inline Thread_Control *_Scheduler_priority_Get_highest_ready( + const Scheduler_Control *scheduler ) { Scheduler_priority_Context *context = _Scheduler_priority_Get_context( scheduler ); - Thread_Control *heir = (Thread_Control *) - _Scheduler_priority_Ready_queue_first( - &context->Bit_map, - &context->Ready[ 0 ] - ); - - ( void ) the_thread; - _Scheduler_Update_heir( heir, force_dispatch ); + return (Thread_Control *) _Scheduler_priority_Ready_queue_first( + &context->Bit_map, + &context->Ready[ 0 ] + ); } /** @@ -250,7 +257,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body( * @param bit_map The priority bit map of the scheduler instance. * @param ready_queues The ready queues of the scheduler instance. */ -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update( +static inline void _Scheduler_priority_Ready_queue_update( Scheduler_priority_Ready_queue *ready_queue, unsigned int new_priority, Priority_bit_map_Control *bit_map, |