RTEMS  5.0.0
schedulernode.h
1 /*
2  * Copyright (c) 2014, 2016 embedded brains GmbH. All rights reserved.
3  *
4  * embedded brains GmbH
5  * Dornierstr. 4
6  * 82178 Puchheim
7  * Germany
8  * <rtems@embedded-brains.de>
9  *
10  * The license and distribution terms for this file may be
11  * found in the file LICENSE in this distribution or at
12  * http://www.rtems.org/license/LICENSE.
13  */
14 
15 #ifndef _RTEMS_SCORE_SCHEDULERNODE_H
16 #define _RTEMS_SCORE_SCHEDULERNODE_H
17 
18 #include <rtems/score/basedefs.h>
19 #include <rtems/score/chain.h>
20 #include <rtems/score/priority.h>
21 #include <rtems/score/smplockseq.h>
22 
23 struct _Thread_Control;
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28 
29 #if defined(RTEMS_SMP)
30 
33 typedef enum {
37  SCHEDULER_NODE_REQUEST_NOT_PENDING,
38 
43  SCHEDULER_NODE_REQUEST_ADD,
44 
49  SCHEDULER_NODE_REQUEST_REMOVE,
50 
55  SCHEDULER_NODE_REQUEST_NOTHING,
56 
57 } Scheduler_Node_request;
58 #endif
59 
60 typedef struct Scheduler_Node Scheduler_Node;
61 
66 #if defined(RTEMS_SMP)
67 
76  union {
77  Chain_Node Chain;
78  RBTree_Node RBTree;
79  } Node;
80 
86  int sticky_level;
87 
93  struct _Thread_Control *user;
94 
103  struct _Thread_Control *idle;
104 #endif
105 
110 
111 #if defined(RTEMS_SMP)
112 
116  struct {
121  Chain_Node Wait_node;
122 
127  union {
131  Chain_Node Chain;
132 
138  Scheduler_Node *next;
139  } Scheduler_node;
140 
145  Scheduler_Node *next_request;
146 
150  Scheduler_Node_request request;
151  } Thread;
152 #endif
153 
157  struct {
158  Priority_Aggregation Priority;
159  } Wait;
160 
172  struct {
186 
187 #if defined(RTEMS_SMP)
188 
191  SMP_sequence_lock_Control Lock;
192 #endif
193  } Priority;
194 };
195 
196 #if defined(RTEMS_SMP)
197 
202 extern const size_t _Scheduler_Node_size;
203 #endif
204 
205 #if defined(RTEMS_SMP)
206 #define SCHEDULER_NODE_OF_THREAD_WAIT_NODE( node ) \
207  RTEMS_CONTAINER_OF( node, Scheduler_Node, Thread.Wait_node )
208 
209 #define SCHEDULER_NODE_OF_THREAD_SCHEDULER_NODE( node ) \
210  RTEMS_CONTAINER_OF( node, Scheduler_Node, Thread.Scheduler_node.Chain )
211 #endif
212 
213 #ifdef __cplusplus
214 }
215 #endif /* __cplusplus */
216 
217 #endif /* _RTEMS_SCORE_SCHEDULERNODE_H */
The priority aggregation.
Definition: priority.h:129
Definition: chain.h:65
Red-black tree node.
Definition: rbtree.h:50
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:66
Definition: thread.h:728
struct _Thread_Control * owner
The thread owning this node.
Definition: schedulernode.h:109
Priority Handler API.
SMP Lock API.
struct Scheduler_Node::@3976 Wait
Thread wait support block.
Chain Handler API.
Scheduler node for per-thread data.
Definition: schedulernode.h:65
Basic Definitions.
Priority_Control value
The thread priority value of this scheduler node.
Definition: schedulernode.h:185