diff options
Diffstat (limited to 'cpukit/include/rtems/score/scheduleredfimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/scheduleredfimpl.h | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/cpukit/include/rtems/score/scheduleredfimpl.h b/cpukit/include/rtems/score/scheduleredfimpl.h index f87102d913..8aa0388537 100644 --- a/cpukit/include/rtems/score/scheduleredfimpl.h +++ b/cpukit/include/rtems/score/scheduleredfimpl.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -11,16 +13,33 @@ * Copryight (c) 2011 Petr Benes. * 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_SCHEDULEREDFIMPL_H #define _RTEMS_SCORE_SCHEDULEREDFIMPL_H #include <rtems/score/scheduleredf.h> -#include <rtems/score/schedulerimpl.h> +#include <rtems/score/scheduleruniimpl.h> #ifdef __cplusplus extern "C" { @@ -48,7 +67,7 @@ extern "C" { * * @return The scheduler context of @a scheduler. */ -RTEMS_INLINE_ROUTINE Scheduler_EDF_Context * +static inline Scheduler_EDF_Context * _Scheduler_EDF_Get_context( const Scheduler_Control *scheduler ) { return (Scheduler_EDF_Context *) _Scheduler_Get_context( scheduler ); @@ -61,7 +80,7 @@ RTEMS_INLINE_ROUTINE Scheduler_EDF_Context * * * @return The EDF scheduler node of @a the_thread. */ -RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Thread_get_node( +static inline Scheduler_EDF_Node *_Scheduler_EDF_Thread_get_node( Thread_Control *the_thread ) { @@ -75,7 +94,7 @@ RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Thread_get_node( * * @return The corresponding scheduler EDF node. */ -RTEMS_INLINE_ROUTINE Scheduler_EDF_Node * _Scheduler_EDF_Node_downcast( +static inline Scheduler_EDF_Node * _Scheduler_EDF_Node_downcast( Scheduler_Node *node ) { @@ -91,7 +110,7 @@ RTEMS_INLINE_ROUTINE Scheduler_EDF_Node * _Scheduler_EDF_Node_downcast( * @retval true @a left is less than the priority of @a right. * @retval false @a left is greater or equal than the priority of @a right. */ -RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Less( +static inline bool _Scheduler_EDF_Less( const void *left, const RBTree_Node *right ) @@ -101,7 +120,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Less( Priority_Control prio_left; Priority_Control prio_right; - the_left = left; + the_left = (const Priority_Control *) left; the_right = RTEMS_CONTAINER_OF( right, Scheduler_EDF_Node, Node ); prio_left = *the_left; @@ -119,7 +138,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Less( * @retval true @a left is less or equal than the priority of @a right. * @retval false @a left is greater than the priority of @a right. */ -RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Priority_less_equal( +static inline bool _Scheduler_EDF_Priority_less_equal( const void *left, const RBTree_Node *right ) @@ -129,7 +148,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Priority_less_equal( Priority_Control prio_left; Priority_Control prio_right; - the_left = left; + the_left = (const Priority_Control *) left; the_right = RTEMS_CONTAINER_OF( right, Scheduler_EDF_Node, Node ); prio_left = *the_left; @@ -146,7 +165,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Priority_less_equal( * @param node The node to be inserted. * @param insert_priority The priority with which the node will be inserted. */ -RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Enqueue( +static inline void _Scheduler_EDF_Enqueue( Scheduler_EDF_Context *context, Scheduler_EDF_Node *node, Priority_Control insert_priority @@ -166,7 +185,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Enqueue( * @param[in, out] context The context to extract the node from. * @param[in, out] node The node to extract. */ -RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract( +static inline void _Scheduler_EDF_Extract( Scheduler_EDF_Context *context, Scheduler_EDF_Node *node ) @@ -181,7 +200,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract( * @param the_thread The thread is not used in this method. * @param[in, out] node The node to be extracted. */ -RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract_body( +static inline void _Scheduler_EDF_Extract_body( const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node @@ -197,30 +216,23 @@ RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract_body( } /** - * @brief Schedules the next ready thread as the heir. + * @brief Gets the highest priority ready thread of the scheduler. * - * @param scheduler The scheduler instance to schedule the minimum of the context of. - * @param the_thread This parameter is not used. - * @param force_dispatch Indicates whether the current heir is blocked even if it is - * not set as preemptible. + * @param scheduler is the scheduler. */ -RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body( - const Scheduler_Control *scheduler, - Thread_Control *the_thread, - bool force_dispatch +static inline Thread_Control *_Scheduler_EDF_Get_highest_ready( + const Scheduler_Control *scheduler ) { Scheduler_EDF_Context *context; RBTree_Node *first; Scheduler_EDF_Node *node; - (void) the_thread; - context = _Scheduler_EDF_Get_context( scheduler ); first = _RBTree_Minimum( &context->Ready ); node = RTEMS_CONTAINER_OF( first, Scheduler_EDF_Node, Node ); - _Scheduler_Update_heir( node->Base.owner, force_dispatch ); + return node->Base.owner; } /** @} */ |