[9d83f58a] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @brief SMP Scheduler API |
---|
| 5 | * |
---|
| 6 | * @ingroup ScoreSchedulerSMP |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
[494c2e3] | 10 | * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved. |
---|
[9d83f58a] | 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 |
---|
[c499856] | 20 | * http://www.rtems.org/license/LICENSE. |
---|
[9d83f58a] | 21 | */ |
---|
| 22 | |
---|
| 23 | #ifndef _RTEMS_SCORE_SCHEDULERSMP_H |
---|
| 24 | #define _RTEMS_SCORE_SCHEDULERSMP_H |
---|
| 25 | |
---|
| 26 | #include <rtems/score/chain.h> |
---|
[38b59a6] | 27 | #include <rtems/score/scheduler.h> |
---|
[9d83f58a] | 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 | |
---|
[beab7329] | 41 | /** |
---|
| 42 | * @brief Scheduler context specialization for SMP schedulers. |
---|
| 43 | */ |
---|
[9d83f58a] | 44 | typedef struct { |
---|
[e1598a6] | 45 | /** |
---|
| 46 | * @brief Basic scheduler context. |
---|
| 47 | */ |
---|
| 48 | Scheduler_Context Base; |
---|
[494c2e3] | 49 | |
---|
[beab7329] | 50 | /** |
---|
| 51 | * @brief The chain of scheduled nodes. |
---|
| 52 | */ |
---|
[e1598a6] | 53 | Chain_Control Scheduled; |
---|
| 54 | } Scheduler_SMP_Context; |
---|
[6ba15488] | 55 | |
---|
[beab7329] | 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 |
---|
[f39f667a] | 72 | * exactly one processor. The count of scheduled nodes in this scheduler |
---|
| 73 | * instance equals the processor count owned by the scheduler instance. |
---|
[beab7329] | 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 | */ |
---|
[f39f667a] | 83 | SCHEDULER_SMP_NODE_READY |
---|
[beab7329] | 84 | } Scheduler_SMP_Node_state; |
---|
| 85 | |
---|
| 86 | /** |
---|
| 87 | * @brief Scheduler node specialization for SMP schedulers. |
---|
| 88 | */ |
---|
| 89 | typedef struct { |
---|
| 90 | /** |
---|
| 91 | * @brief Basic scheduler node. |
---|
| 92 | */ |
---|
| 93 | Scheduler_Node Base; |
---|
| 94 | |
---|
| 95 | /** |
---|
| 96 | * @brief The state of this node. |
---|
| 97 | */ |
---|
| 98 | Scheduler_SMP_Node_state state; |
---|
| 99 | } Scheduler_SMP_Node; |
---|
| 100 | |
---|
[6359b68] | 101 | void _Scheduler_SMP_Start_idle( |
---|
| 102 | const Scheduler_Control *scheduler, |
---|
| 103 | Thread_Control *thread, |
---|
| 104 | Per_CPU_Control *cpu |
---|
| 105 | ); |
---|
| 106 | |
---|
[9d83f58a] | 107 | /** @} */ |
---|
| 108 | |
---|
| 109 | #ifdef __cplusplus |
---|
| 110 | } |
---|
| 111 | #endif /* __cplusplus */ |
---|
| 112 | |
---|
| 113 | #endif /* _RTEMS_SCORE_SCHEDULERSMP_H */ |
---|