[981eed2] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup ScoreSchedulerStrongAPA |
---|
| 5 | * |
---|
| 6 | * @brief Strong APA Scheduler API |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * Copyright (c) 2013, 2016 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_SCHEDULERSTRONGAPA_H |
---|
| 24 | #define _RTEMS_SCORE_SCHEDULERSTRONGAPA_H |
---|
| 25 | |
---|
| 26 | #include <rtems/score/scheduler.h> |
---|
| 27 | #include <rtems/score/schedulerpriority.h> |
---|
| 28 | #include <rtems/score/schedulersmp.h> |
---|
| 29 | |
---|
| 30 | #ifdef __cplusplus |
---|
| 31 | extern "C" { |
---|
| 32 | #endif /* __cplusplus */ |
---|
| 33 | |
---|
| 34 | /** |
---|
| 35 | * @defgroup ScoreSchedulerStrongAPA Strong APA Scheduler |
---|
| 36 | * |
---|
| 37 | * @ingroup ScoreSchedulerSMP |
---|
| 38 | * |
---|
| 39 | * This is an implementation of the global fixed priority scheduler (G-FP). It |
---|
| 40 | * uses one ready chain per priority to ensure constant time insert operations. |
---|
| 41 | * The scheduled chain uses linear insert operations and has at most processor |
---|
| 42 | * count entries. Since the processor and priority count are constants all |
---|
| 43 | * scheduler operations complete in a bounded execution time. |
---|
| 44 | * |
---|
| 45 | * The the_thread preempt mode will be ignored. |
---|
| 46 | * |
---|
| 47 | * @{ |
---|
| 48 | */ |
---|
| 49 | |
---|
| 50 | /** |
---|
| 51 | * @brief Scheduler context specialization for Strong APA |
---|
| 52 | * schedulers. |
---|
| 53 | */ |
---|
| 54 | typedef struct { |
---|
| 55 | Scheduler_SMP_Context Base; |
---|
| 56 | Priority_bit_map_Control Bit_map; |
---|
| 57 | Chain_Control Ready[ RTEMS_ZERO_LENGTH_ARRAY ]; |
---|
| 58 | } Scheduler_strong_APA_Context; |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | * @brief Scheduler node specialization for Strong APA |
---|
| 62 | * schedulers. |
---|
| 63 | */ |
---|
| 64 | typedef struct { |
---|
| 65 | /** |
---|
| 66 | * @brief SMP scheduler node. |
---|
| 67 | */ |
---|
| 68 | Scheduler_SMP_Node Base; |
---|
| 69 | |
---|
| 70 | /** |
---|
| 71 | * @brief The associated ready queue of this node. |
---|
| 72 | */ |
---|
| 73 | Scheduler_priority_Ready_queue Ready_queue; |
---|
| 74 | } Scheduler_strong_APA_Node; |
---|
| 75 | |
---|
| 76 | /** |
---|
| 77 | * @brief Entry points for the Strong APA Scheduler. |
---|
| 78 | */ |
---|
| 79 | #define SCHEDULER_STRONG_APA_ENTRY_POINTS \ |
---|
| 80 | { \ |
---|
| 81 | _Scheduler_strong_APA_Initialize, \ |
---|
| 82 | _Scheduler_default_Schedule, \ |
---|
| 83 | _Scheduler_strong_APA_Yield, \ |
---|
| 84 | _Scheduler_strong_APA_Block, \ |
---|
| 85 | _Scheduler_strong_APA_Unblock, \ |
---|
[9bfad8c] | 86 | _Scheduler_strong_APA_Update_priority, \ |
---|
[77ff5599] | 87 | _Scheduler_default_Map_priority, \ |
---|
| 88 | _Scheduler_default_Unmap_priority, \ |
---|
[351c14d] | 89 | _Scheduler_strong_APA_Ask_for_help, \ |
---|
| 90 | _Scheduler_strong_APA_Reconsider_help_request, \ |
---|
| 91 | _Scheduler_strong_APA_Withdraw_node, \ |
---|
[981eed2] | 92 | _Scheduler_strong_APA_Node_initialize, \ |
---|
| 93 | _Scheduler_default_Node_destroy, \ |
---|
| 94 | _Scheduler_default_Release_job, \ |
---|
[21bdca4] | 95 | _Scheduler_default_Cancel_job, \ |
---|
[981eed2] | 96 | _Scheduler_default_Tick, \ |
---|
| 97 | _Scheduler_SMP_Start_idle \ |
---|
| 98 | SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \ |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | void _Scheduler_strong_APA_Initialize( const Scheduler_Control *scheduler ); |
---|
| 102 | |
---|
| 103 | void _Scheduler_strong_APA_Node_initialize( |
---|
| 104 | const Scheduler_Control *scheduler, |
---|
[df2177ab] | 105 | Scheduler_Node *node, |
---|
[9bfad8c] | 106 | Thread_Control *the_thread, |
---|
| 107 | Priority_Control priority |
---|
[981eed2] | 108 | ); |
---|
| 109 | |
---|
| 110 | void _Scheduler_strong_APA_Block( |
---|
| 111 | const Scheduler_Control *scheduler, |
---|
[e382a1b] | 112 | Thread_Control *the_thread, |
---|
| 113 | Scheduler_Node *node |
---|
[981eed2] | 114 | ); |
---|
| 115 | |
---|
| 116 | Thread_Control *_Scheduler_strong_APA_Unblock( |
---|
| 117 | const Scheduler_Control *scheduler, |
---|
[72e0bdb] | 118 | Thread_Control *the_thread, |
---|
| 119 | Scheduler_Node *node |
---|
[981eed2] | 120 | ); |
---|
| 121 | |
---|
[9c238e1] | 122 | void _Scheduler_strong_APA_Update_priority( |
---|
[981eed2] | 123 | const Scheduler_Control *scheduler, |
---|
[501043a] | 124 | Thread_Control *the_thread, |
---|
| 125 | Scheduler_Node *node |
---|
[981eed2] | 126 | ); |
---|
| 127 | |
---|
[351c14d] | 128 | bool _Scheduler_strong_APA_Ask_for_help( |
---|
| 129 | const Scheduler_Control *scheduler, |
---|
| 130 | Thread_Control *the_thread, |
---|
| 131 | Scheduler_Node *node |
---|
| 132 | ); |
---|
| 133 | |
---|
| 134 | void _Scheduler_strong_APA_Reconsider_help_request( |
---|
| 135 | const Scheduler_Control *scheduler, |
---|
| 136 | Thread_Control *the_thread, |
---|
| 137 | Scheduler_Node *node |
---|
| 138 | ); |
---|
| 139 | |
---|
| 140 | void _Scheduler_strong_APA_Withdraw_node( |
---|
| 141 | const Scheduler_Control *scheduler, |
---|
| 142 | Thread_Control *the_thread, |
---|
| 143 | Scheduler_Node *node, |
---|
| 144 | Thread_Scheduler_state next_state |
---|
| 145 | ); |
---|
| 146 | |
---|
[981eed2] | 147 | Thread_Control *_Scheduler_strong_APA_Yield( |
---|
| 148 | const Scheduler_Control *scheduler, |
---|
[2df4abc] | 149 | Thread_Control *the_thread, |
---|
| 150 | Scheduler_Node *node |
---|
[981eed2] | 151 | ); |
---|
| 152 | |
---|
| 153 | /** @} */ |
---|
| 154 | |
---|
| 155 | #ifdef __cplusplus |
---|
| 156 | } |
---|
| 157 | #endif /* __cplusplus */ |
---|
| 158 | |
---|
| 159 | #endif /* _RTEMS_SCORE_SCHEDULERSTRONGAPA_H */ |
---|