1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief SMP Scheduler API |
---|
5 | * |
---|
6 | * @ingroup ScoreSchedulerSMP |
---|
7 | */ |
---|
8 | |
---|
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_SCHEDULERSMP_H |
---|
24 | #define _RTEMS_SCORE_SCHEDULERSMP_H |
---|
25 | |
---|
26 | #include <rtems/score/chain.h> |
---|
27 | #include <rtems/score/scheduler.h> |
---|
28 | |
---|
29 | #ifdef __cplusplus |
---|
30 | extern "C" { |
---|
31 | #endif /* __cplusplus */ |
---|
32 | |
---|
33 | /** |
---|
34 | * @defgroup ScoreSchedulerSMP SMP Scheduler |
---|
35 | * |
---|
36 | * @ingroup ScoreScheduler |
---|
37 | * |
---|
38 | * @{ |
---|
39 | */ |
---|
40 | |
---|
41 | /** |
---|
42 | * @brief Scheduler context specialization for SMP schedulers. |
---|
43 | */ |
---|
44 | typedef struct { |
---|
45 | /** |
---|
46 | * @brief Basic scheduler context. |
---|
47 | */ |
---|
48 | Scheduler_Context Base; |
---|
49 | |
---|
50 | /** |
---|
51 | * @brief The chain of scheduled nodes. |
---|
52 | */ |
---|
53 | Chain_Control Scheduled; |
---|
54 | } Scheduler_SMP_Context; |
---|
55 | |
---|
56 | /** |
---|
57 | * @brief SMP scheduler node states. |
---|
58 | */ |
---|
59 | typedef enum { |
---|
60 | /** |
---|
61 | * @brief This scheduler node is blocked. |
---|
62 | * |
---|
63 | * A scheduler node is blocked if the corresponding thread is not ready. |
---|
64 | */ |
---|
65 | SCHEDULER_SMP_NODE_BLOCKED, |
---|
66 | |
---|
67 | /** |
---|
68 | * @brief The scheduler node is scheduled. |
---|
69 | * |
---|
70 | * A scheduler node is scheduled if the corresponding thread is ready and the |
---|
71 | * scheduler allocated a processor for it. A scheduled node is assigned to |
---|
72 | * exactly one processor. The sum of scheduled and in the air nodes equals |
---|
73 | * the processor count owned by a scheduler instance. |
---|
74 | */ |
---|
75 | SCHEDULER_SMP_NODE_SCHEDULED, |
---|
76 | |
---|
77 | /** |
---|
78 | * @brief This scheduler node is ready. |
---|
79 | * |
---|
80 | * A scheduler node is ready if the corresponding thread is ready and the |
---|
81 | * scheduler did not allocate a processor for it. |
---|
82 | */ |
---|
83 | SCHEDULER_SMP_NODE_READY, |
---|
84 | |
---|
85 | /** |
---|
86 | * @brief This scheduler node is in the air. |
---|
87 | * |
---|
88 | * A scheduled node is in the air if it has an allocated processor and the |
---|
89 | * corresponding thread is in a transient state. Such a node is not an |
---|
90 | * element of the set of scheduled nodes. The extract operation on a |
---|
91 | * scheduled node will produce a scheduler node in the air (see also |
---|
92 | * _Thread_Set_transient()). The next enqueue or schedule operation will |
---|
93 | * decide what to do based on this state indication. It can either place the |
---|
94 | * scheduler node back on the set of scheduled nodes and the thread can keep |
---|
95 | * its allocated processor, or it can take the processor away from the thread |
---|
96 | * and give the processor to another thread of higher priority. |
---|
97 | */ |
---|
98 | SCHEDULER_SMP_NODE_IN_THE_AIR |
---|
99 | } Scheduler_SMP_Node_state; |
---|
100 | |
---|
101 | /** |
---|
102 | * @brief Scheduler node specialization for SMP schedulers. |
---|
103 | */ |
---|
104 | typedef struct { |
---|
105 | /** |
---|
106 | * @brief Basic scheduler node. |
---|
107 | */ |
---|
108 | Scheduler_Node Base; |
---|
109 | |
---|
110 | /** |
---|
111 | * @brief The state of this node. |
---|
112 | */ |
---|
113 | Scheduler_SMP_Node_state state; |
---|
114 | } Scheduler_SMP_Node; |
---|
115 | |
---|
116 | /** @} */ |
---|
117 | |
---|
118 | #ifdef __cplusplus |
---|
119 | } |
---|
120 | #endif /* __cplusplus */ |
---|
121 | |
---|
122 | #endif /* _RTEMS_SCORE_SCHEDULERSMP_H */ |
---|