RTEMS 6.1-rc6
Loading...
Searching...
No Matches
modesimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/* COPYRIGHT (c) 1989-2008.
13 * On-Line Applications Research Corporation (OAR).
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _RTEMS_RTEMS_MODESIMPL_H
38#define _RTEMS_RTEMS_MODESIMPL_H
39
40#include <rtems/rtems/modes.h>
42#include <rtems/score/smpimpl.h>
45#include <rtems/config.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
67static inline bool _Modes_Is_asr_disabled (
68 rtems_mode mode_set
69)
70{
71 return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR;
72}
73
80static inline bool _Modes_Is_preempt (
81 rtems_mode mode_set
82)
83{
84 return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT;
85}
86
93static inline bool _Modes_Is_timeslice (
94 rtems_mode mode_set
95)
96{
97 return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE;
98}
99
105static inline ISR_Level _Modes_Get_interrupt_level (
106 rtems_mode mode_set
107)
108{
109 return ( mode_set & RTEMS_INTERRUPT_MASK );
110}
111
112#if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
122static inline bool _Modes_Is_interrupt_level_supported(
123 rtems_mode mode_set
124)
125{
126 return _Modes_Get_interrupt_level( mode_set ) == 0
127#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
128 || !_SMP_Need_inter_processor_interrupts()
129#endif
130 ;
131}
132#endif
133
134#if defined(RTEMS_SMP)
145static inline bool _Modes_Is_preempt_mode_supported(
146 rtems_mode mode_set,
147 const Thread_Control *the_thread
148)
149{
150 return _Modes_Is_preempt( mode_set ) ||
151 _Scheduler_Is_non_preempt_mode_supported(
152 _Thread_Scheduler_get_home( the_thread )
153 );
154}
155#endif
156
165static inline void _Modes_Apply_timeslice_to_thread(
166 rtems_mode mode_set,
167 Thread_Control *the_thread
168)
169{
170 if ( _Modes_Is_timeslice( mode_set ) ) {
172 the_thread->CPU_budget.available =
174 } else {
175 the_thread->CPU_budget.operations = NULL;
176 }
177}
178
179#ifdef __cplusplus
180}
181#endif
182
185#endif
186/* end of include file */
#define RTEMS_TIMESLICE
This task mode constant indicates that timeslicing is enabled.
Definition: modes.h:246
#define RTEMS_ASR_MASK
This mode constant corresponds to the signal enable/disable bit.
Definition: modes.h:101
uint32_t rtems_mode
This type represents a Classic API task mode set.
Definition: modes.h:174
#define RTEMS_NO_ASR
This task mode constant indicates that signal processing is disabled.
Definition: modes.h:200
#define RTEMS_PREEMPT_MASK
This task mode constant corresponds to the preemption enable/disable bit.
Definition: modes.h:237
#define RTEMS_TIMESLICE_MASK
This task mode constant corresponds to the timeslice enable/disable bit.
Definition: modes.h:256
#define RTEMS_INTERRUPT_MASK
This task mode constant corresponds to the interrupt enable/disable bits.
Definition: modes.h:130
#define RTEMS_PREEMPT
This task mode constant indicates that preemption is enabled.
Definition: modes.h:227
#define rtems_configuration_get_ticks_per_timeslice()
Gets the clock ticks per timeslice configured for this application.
Definition: config.h:741
uint32_t ISR_Level
Definition: isrlevel.h:60
const Thread_CPU_budget_operations _Thread_CPU_budget_reset_timeslice
These CPU budget operations allocate timeslices to the thread.
Definition: threadresettimeslice.c:87
This header file provides the task modes API of the Task Manager.
This header file provides interfaces of the Scheduler Handler which are only used by the implementati...
This header file provides interfaces of the SMP Support which are only used by the implementation.
uint32_t available
This member contains the count of the time quantum that this thread is allowed to consume until an ac...
Definition: thread.h:224
const Thread_CPU_budget_operations * operations
If this member is not NULL, then it references the CPU budget operations used to manage the CPU budge...
Definition: thread.h:217
Definition: thread.h:837
Thread_CPU_budget_control CPU_budget
This member contains the CPU budget control used to manage the CPU budget of the thread.
Definition: thread.h:938
This header file provides interfaces used to implement the CPU budget management of threads.
This header file provides interfaces of the Thread Handler which are only used by the implementation.