RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
schedulerprioritysmpimpl.h
Go to the documentation of this file.
1
9/*
10 * Copyright (c) 2013, 2017 embedded brains GmbH. All rights reserved.
11 *
12 * embedded brains GmbH
13 * Dornierstr. 4
14 * 82178 Puchheim
15 * Germany
16 * <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H
24#define _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H
25
30
31#ifdef __cplusplus
32extern "C" {
33#endif /* __cplusplus */
34
40static inline Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self(
42)
43{
45}
46
47static inline Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Thread_get_node(
48 Thread_Control *thread
49)
50{
52}
53
54static inline Scheduler_priority_SMP_Node *
55_Scheduler_priority_SMP_Node_downcast( Scheduler_Node *node )
56{
57 return (Scheduler_priority_SMP_Node *) node;
58}
59
60static inline bool _Scheduler_priority_SMP_Has_ready( Scheduler_Context *context )
61{
63 _Scheduler_priority_SMP_Get_self( context );
64
65 return !_Priority_bit_map_Is_empty( &self->Bit_map );
66}
67
68static inline void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
70 Scheduler_Node *scheduled_to_ready
71)
72{
74 _Scheduler_priority_SMP_Get_self( context );
76 _Scheduler_priority_SMP_Node_downcast( scheduled_to_ready );
77
78 _Chain_Extract_unprotected( &node->Base.Base.Node.Chain );
80 &node->Base.Base.Node.Chain,
81 &node->Ready_queue,
82 &self->Bit_map
83 );
84}
85
86static inline void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
88 Scheduler_Node *ready_to_scheduled
89)
90{
93 Priority_Control insert_priority;
94
95 self = _Scheduler_priority_SMP_Get_self( context );
96 node = _Scheduler_priority_SMP_Node_downcast( ready_to_scheduled );
97
99 &node->Base.Base.Node.Chain,
100 &node->Ready_queue,
101 &self->Bit_map
102 );
103 insert_priority = _Scheduler_SMP_Node_priority( &node->Base.Base );
104 insert_priority = SCHEDULER_PRIORITY_APPEND( insert_priority );
106 &self->Base.Scheduled,
107 &node->Base.Base.Node.Chain,
108 &insert_priority,
109 _Scheduler_SMP_Priority_less_equal
110 );
111}
112
113static inline void _Scheduler_priority_SMP_Insert_ready(
115 Scheduler_Node *node_base,
116 Priority_Control insert_priority
117)
118{
121
122 self = _Scheduler_priority_SMP_Get_self( context );
123 node = _Scheduler_priority_SMP_Node_downcast( node_base );
124
125 if ( SCHEDULER_PRIORITY_IS_APPEND( insert_priority ) ) {
127 &node->Base.Base.Node.Chain,
128 &node->Ready_queue,
129 &self->Bit_map
130 );
131 } else {
133 &node->Base.Base.Node.Chain,
134 &node->Ready_queue,
135 &self->Bit_map
136 );
137 }
138}
139
140static inline void _Scheduler_priority_SMP_Extract_from_ready(
142 Scheduler_Node *thread
143)
144{
146 _Scheduler_priority_SMP_Get_self( context );
148 _Scheduler_priority_SMP_Node_downcast( thread );
149
151 &node->Base.Base.Node.Chain,
152 &node->Ready_queue,
153 &self->Bit_map
154 );
155}
156
157static inline void _Scheduler_priority_SMP_Do_update(
159 Scheduler_Node *node_to_update,
160 Priority_Control new_priority
161)
162{
165
166 self = _Scheduler_priority_SMP_Get_self( context );
167 node = _Scheduler_priority_SMP_Node_downcast( node_to_update );
168
169 _Scheduler_SMP_Node_update_priority( &node->Base, new_priority );
171 &node->Ready_queue,
172 SCHEDULER_PRIORITY_UNMAP( new_priority ),
173 &self->Bit_map,
174 &self->Ready[ 0 ]
175 );
176}
177
180#ifdef __cplusplus
181}
182#endif /* __cplusplus */
183
184#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H */
RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected(Chain_Node *the_node)
Extracts this node (unprotected).
Definition: chainimpl.h:558
RTEMS_INLINE_ROUTINE void _Chain_Insert_ordered_unprotected(Chain_Control *the_chain, Chain_Node *to_insert, const void *left, Chain_Node_order order)
Inserts a node into the chain according to the order relation.
Definition: chainimpl.h:864
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
RTEMS_INLINE_ROUTINE bool _Priority_bit_map_Is_empty(const Priority_bit_map_Control *bit_map)
Checks if the Priority queue bit map is empty.
Definition: prioritybitmapimpl.h:218
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first(Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map)
Enqueues a node on the specified ready queue as first.
Definition: schedulerpriorityimpl.h:132
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map)
Extracts a node from the specified ready queue.
Definition: schedulerpriorityimpl.h:151
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update(Scheduler_priority_Ready_queue *ready_queue, unsigned int new_priority, Priority_bit_map_Control *bit_map, Chain_Control *ready_queues)
Updates the specified ready queue data according to the new priority value.
Definition: schedulerpriorityimpl.h:256
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue(Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map)
Enqueues a node on the specified ready queue.
Definition: schedulerpriorityimpl.h:111
#define SCHEDULER_PRIORITY_APPEND(priority)
Returns the priority control with the append indicator bit set.
Definition: schedulernodeimpl.h:72
#define SCHEDULER_PRIORITY_UNMAP(priority)
Returns the plain priority value.
Definition: schedulernodeimpl.h:61
#define SCHEDULER_PRIORITY_IS_APPEND(priority)
Returns true, if the item should be appended to its priority group, otherwise returns false and the i...
Definition: schedulernodeimpl.h:80
RTEMS_INLINE_ROUTINE Scheduler_Node * _Thread_Scheduler_get_home_node(const Thread_Control *the_thread)
Gets the scheduler's home node.
Definition: threadimpl.h:1412
Inlined Routines Associated with the Manipulation of the Priority-Based Scheduling Structures.
Deterministic Priority SMP Scheduler API.
Inlined Routines Associated with the Manipulation of the Priority-Based Scheduling Structures.
SMP Scheduler Implementation.
Scheduler context.
Definition: scheduler.h:252
Scheduler node for per-thread data.
Definition: schedulernode.h:79
Chain_Control Scheduled
The chain of scheduled nodes.
Definition: schedulersmp.h:55
Scheduler_Node Base
Basic scheduler node.
Definition: schedulersmp.h:104
Scheduler context specialization for Deterministic Priority SMP schedulers.
Definition: schedulerprioritysmp.h:56
Scheduler node specialization for Deterministic Priority SMP schedulers.
Definition: schedulerprioritysmp.h:66
Scheduler_priority_Ready_queue Ready_queue
The associated ready queue of this node.
Definition: schedulerprioritysmp.h:75
Scheduler_SMP_Node Base
SMP scheduler node.
Definition: schedulerprioritysmp.h:70
Definition: thread.h:732
unsigned context
Definition: tlb.h:1