RTEMS CPU Kit with SuperCore  4.11.2
schedulerprioritysmpimpl.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2013-2014 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
32 extern "C" {
33 #endif /* __cplusplus */
34 
40 static inline Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self(
41  Scheduler_Context *context
42 )
43 {
44  return (Scheduler_priority_SMP_Context *) context;
45 }
46 
47 static inline Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Thread_get_node(
48  Thread_Control *thread
49 )
50 {
51  return (Scheduler_priority_SMP_Node *) _Scheduler_Thread_get_node( thread );
52 }
53 
54 static inline Scheduler_priority_SMP_Node *
55 _Scheduler_priority_SMP_Node_downcast( Scheduler_Node *node )
56 {
57  return (Scheduler_priority_SMP_Node *) node;
58 }
59 
60 static inline void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
61  Scheduler_Context *context,
62  Scheduler_Node *scheduled_to_ready
63 )
64 {
66  _Scheduler_priority_SMP_Get_self( context );
68  _Scheduler_priority_SMP_Node_downcast( scheduled_to_ready );
69 
70  _Chain_Extract_unprotected( &node->Base.Base.Node );
72  &node->Base.Base.Node,
73  &node->Ready_queue,
74  &self->Bit_map
75  );
76 }
77 
78 static inline void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
79  Scheduler_Context *context,
80  Scheduler_Node *ready_to_scheduled
81 )
82 {
84  _Scheduler_priority_SMP_Get_self( context );
86  _Scheduler_priority_SMP_Node_downcast( ready_to_scheduled );
87 
89  &node->Base.Base.Node,
90  &node->Ready_queue,
91  &self->Bit_map
92  );
94  &self->Base.Scheduled,
95  &node->Base.Base.Node,
96  _Scheduler_SMP_Insert_priority_fifo_order
97  );
98 }
99 
100 static inline void _Scheduler_priority_SMP_Insert_ready_lifo(
101  Scheduler_Context *context,
102  Scheduler_Node *thread
103 )
104 {
106  _Scheduler_priority_SMP_Get_self( context );
108  _Scheduler_priority_SMP_Node_downcast( thread );
109 
111  &node->Base.Base.Node,
112  &node->Ready_queue,
113  &self->Bit_map
114  );
115 }
116 
117 static inline void _Scheduler_priority_SMP_Insert_ready_fifo(
118  Scheduler_Context *context,
119  Scheduler_Node *thread
120 )
121 {
123  _Scheduler_priority_SMP_Get_self( context );
125  _Scheduler_priority_SMP_Node_downcast( thread );
126 
128  &node->Base.Base.Node,
129  &node->Ready_queue,
130  &self->Bit_map
131  );
132 }
133 
134 static inline void _Scheduler_priority_SMP_Extract_from_ready(
135  Scheduler_Context *context,
136  Scheduler_Node *thread
137 )
138 {
140  _Scheduler_priority_SMP_Get_self( context );
142  _Scheduler_priority_SMP_Node_downcast( thread );
143 
145  &node->Base.Base.Node,
146  &node->Ready_queue,
147  &self->Bit_map
148  );
149 }
150 
151 static inline void _Scheduler_priority_SMP_Do_update(
152  Scheduler_Context *context,
153  Scheduler_Node *node_to_update,
154  Priority_Control new_priority
155 )
156 {
158  _Scheduler_priority_SMP_Get_self( context );
160  _Scheduler_priority_SMP_Node_downcast( node_to_update );
161 
162  _Scheduler_SMP_Node_update_priority( &node->Base, new_priority );
164  &node->Ready_queue,
165  new_priority,
166  &self->Bit_map,
167  &self->Ready[ 0 ]
168  );
169 }
170 
173 #ifdef __cplusplus
174 }
175 #endif /* __cplusplus */
176 
177 #endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H */
Inlined Routines Associated with the Manipulation of the Priority-Based Scheduling Structures...
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:97
Scheduler context.
Definition: scheduler.h:180
RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected(Chain_Node *the_node)
Extract this node (unprotected).
Definition: chainimpl.h:639
Scheduler_SMP_Node Base
SMP scheduler node.
Definition: schedulerprioritysmp.h:68
Inlined Routines Associated with the Manipulation of the Priority-Based Scheduling Structures...
Deterministic Priority SMP Scheduler API.
uint32_t Priority_Control
The following type defines the control block used to manage thread priorities.
Definition: priority.h:56
Scheduler context specialization for Deterministic Priority SMP schedulers.
Definition: schedulerprioritysmp.h:54
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:116
Scheduler_priority_Ready_queue Ready_queue
The associated ready queue of this node.
Definition: schedulerprioritysmp.h:73
This structure defines the Thread Control Block (TCB).
Definition: thread.h:671
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update(Scheduler_priority_Ready_queue *ready_queue, Priority_Control 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:205
SMP Scheduler Implementation.
Scheduler_Node Base
Basic scheduler node.
Definition: schedulersmp.h:102
Scheduler node for per-thread data.
Definition: scheduler.h:281
Scheduler node specialization for Deterministic Priority SMP schedulers.
Definition: schedulerprioritysmp.h:64
RTEMS_INLINE_ROUTINE void _Chain_Insert_ordered_unprotected(Chain_Control *chain, Chain_Node *to_insert, Chain_Node_order order)
Inserts a node into the chain according to the order relation.
Definition: chainimpl.h:934
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:76