diff options
Diffstat (limited to 'cpukit/include/rtems/rtems/modesimpl.h')
-rw-r--r-- | cpukit/include/rtems/rtems/modesimpl.h | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/cpukit/include/rtems/rtems/modesimpl.h b/cpukit/include/rtems/rtems/modesimpl.h index 924e12fbee..8cbf655cbb 100644 --- a/cpukit/include/rtems/rtems/modesimpl.h +++ b/cpukit/include/rtems/rtems/modesimpl.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -10,9 +12,26 @@ /* COPYRIGHT (c) 1989-2008. * 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_RTEMS_MODESIMPL_H @@ -22,6 +41,7 @@ #include <rtems/score/schedulerimpl.h> #include <rtems/score/smpimpl.h> #include <rtems/score/threadimpl.h> +#include <rtems/score/threadcpubudget.h> #include <rtems/config.h> #ifdef __cplusplus @@ -44,7 +64,7 @@ extern "C" { * This function returns TRUE if mode_set indicates that Asynchronous * Signal Processing is disabled, and FALSE otherwise. */ -RTEMS_INLINE_ROUTINE bool _Modes_Is_asr_disabled ( +static inline bool _Modes_Is_asr_disabled ( rtems_mode mode_set ) { @@ -57,7 +77,7 @@ RTEMS_INLINE_ROUTINE bool _Modes_Is_asr_disabled ( * This function returns TRUE if mode_set indicates that preemption * is enabled, and FALSE otherwise. */ -RTEMS_INLINE_ROUTINE bool _Modes_Is_preempt ( +static inline bool _Modes_Is_preempt ( rtems_mode mode_set ) { @@ -70,7 +90,7 @@ RTEMS_INLINE_ROUTINE bool _Modes_Is_preempt ( * This function returns TRUE if mode_set indicates that timeslicing * is enabled, and FALSE otherwise. */ -RTEMS_INLINE_ROUTINE bool _Modes_Is_timeslice ( +static inline bool _Modes_Is_timeslice ( rtems_mode mode_set ) { @@ -82,7 +102,7 @@ RTEMS_INLINE_ROUTINE bool _Modes_Is_timeslice ( * * This function returns the interrupt level portion of the mode_set. */ -RTEMS_INLINE_ROUTINE ISR_Level _Modes_Get_interrupt_level ( +static inline ISR_Level _Modes_Get_interrupt_level ( rtems_mode mode_set ) { @@ -99,7 +119,7 @@ RTEMS_INLINE_ROUTINE ISR_Level _Modes_Get_interrupt_level ( * @return Returns true, if support for the interrupt level is implemented, * otherwise returns false. */ -RTEMS_INLINE_ROUTINE bool _Modes_Is_interrupt_level_supported( +static inline bool _Modes_Is_interrupt_level_supported( rtems_mode mode_set ) { @@ -122,7 +142,7 @@ RTEMS_INLINE_ROUTINE bool _Modes_Is_interrupt_level_supported( * @return Returns true, if support for the preempt mode is implemented, * otherwise returns false. */ -RTEMS_INLINE_ROUTINE bool _Modes_Is_preempt_mode_supported( +static inline bool _Modes_Is_preempt_mode_supported( rtems_mode mode_set, const Thread_Control *the_thread ) @@ -142,16 +162,17 @@ RTEMS_INLINE_ROUTINE bool _Modes_Is_preempt_mode_supported( * * @param[out] the_thread is the thread to apply the timeslice mode. */ -RTEMS_INLINE_ROUTINE void _Modes_Apply_timeslice_to_thread( +static inline void _Modes_Apply_timeslice_to_thread( rtems_mode mode_set, Thread_Control *the_thread ) { if ( _Modes_Is_timeslice( mode_set ) ) { - the_thread->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; - the_thread->cpu_time_budget = rtems_configuration_get_ticks_per_timeslice(); + the_thread->CPU_budget.operations = &_Thread_CPU_budget_reset_timeslice; + the_thread->CPU_budget.available = + rtems_configuration_get_ticks_per_timeslice(); } else { - the_thread->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; + the_thread->CPU_budget.operations = NULL; } } |