![]() |
|
|||
File indexing completed on 2025-05-11 08:24:13
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @ingroup RTEMSScoreSchedulerPrioritySMP 0007 * 0008 * @brief This header file provides interfaces of the 0009 * @ref RTEMSScoreSchedulerPrioritySMP which are used by the implementation 0010 * and the @ref RTEMSImplApplConfig. 0011 */ 0012 0013 /* 0014 * Copyright (C) 2013, 2018 embedded brains GmbH & Co. KG 0015 * 0016 * Redistribution and use in source and binary forms, with or without 0017 * modification, are permitted provided that the following conditions 0018 * are met: 0019 * 1. Redistributions of source code must retain the above copyright 0020 * notice, this list of conditions and the following disclaimer. 0021 * 2. Redistributions in binary form must reproduce the above copyright 0022 * notice, this list of conditions and the following disclaimer in the 0023 * documentation and/or other materials provided with the distribution. 0024 * 0025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0028 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0029 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0030 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0031 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0032 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0033 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0034 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0035 * POSSIBILITY OF SUCH DAMAGE. 0036 */ 0037 0038 #ifndef _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H 0039 #define _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H 0040 0041 #include <rtems/score/scheduler.h> 0042 #include <rtems/score/schedulerpriority.h> 0043 #include <rtems/score/schedulersmp.h> 0044 0045 #ifdef __cplusplus 0046 extern "C" { 0047 #endif /* __cplusplus */ 0048 0049 /** 0050 * @defgroup RTEMSScoreSchedulerPrioritySMP Deterministic Priority SMP Scheduler 0051 * 0052 * @ingroup RTEMSScoreSchedulerSMP 0053 * 0054 * @brief This group contains the Deterministic Priority SMP Scheduler implementation. 0055 * 0056 * This is an implementation of the global fixed priority scheduler (G-FP). It 0057 * uses one ready chain per priority to ensure constant time insert operations. 0058 * The scheduled chain uses linear insert operations and has at most processor 0059 * count entries. Since the processor and priority count are constants all 0060 * scheduler operations complete in a bounded execution time. 0061 * 0062 * The thread preempt mode will be ignored. 0063 * 0064 * @{ 0065 */ 0066 0067 /** 0068 * @brief Scheduler context specialization for Deterministic Priority SMP 0069 * schedulers. 0070 */ 0071 typedef struct { 0072 Scheduler_SMP_Context Base; 0073 Chain_Control *idle_ready_queue; 0074 Priority_bit_map_Control Bit_map; 0075 Chain_Control Ready[ RTEMS_ZERO_LENGTH_ARRAY ]; 0076 } Scheduler_priority_SMP_Context; 0077 0078 /** 0079 * @brief Scheduler node specialization for Deterministic Priority SMP 0080 * schedulers. 0081 */ 0082 typedef struct { 0083 /** 0084 * @brief SMP scheduler node. 0085 */ 0086 Scheduler_SMP_Node Base; 0087 0088 /** 0089 * @brief The associated ready queue of this node. 0090 */ 0091 Scheduler_priority_Ready_queue Ready_queue; 0092 } Scheduler_priority_SMP_Node; 0093 0094 /** 0095 * @brief Entry points for the Priority SMP Scheduler. 0096 */ 0097 #define SCHEDULER_PRIORITY_SMP_ENTRY_POINTS \ 0098 { \ 0099 _Scheduler_priority_SMP_Initialize, \ 0100 _Scheduler_default_Schedule, \ 0101 _Scheduler_priority_SMP_Yield, \ 0102 _Scheduler_priority_SMP_Block, \ 0103 _Scheduler_priority_SMP_Unblock, \ 0104 _Scheduler_priority_SMP_Update_priority, \ 0105 _Scheduler_default_Map_priority, \ 0106 _Scheduler_default_Unmap_priority, \ 0107 _Scheduler_priority_SMP_Ask_for_help, \ 0108 _Scheduler_priority_SMP_Reconsider_help_request, \ 0109 _Scheduler_priority_SMP_Withdraw_node, \ 0110 _Scheduler_priority_SMP_Make_sticky, \ 0111 _Scheduler_priority_SMP_Clean_sticky, \ 0112 _Scheduler_default_Pin_or_unpin_not_supported, \ 0113 _Scheduler_default_Pin_or_unpin_not_supported, \ 0114 _Scheduler_priority_SMP_Add_processor, \ 0115 _Scheduler_priority_SMP_Remove_processor, \ 0116 _Scheduler_priority_SMP_Node_initialize, \ 0117 _Scheduler_default_Node_destroy, \ 0118 _Scheduler_default_Release_job, \ 0119 _Scheduler_default_Cancel_job, \ 0120 _Scheduler_SMP_Start_idle \ 0121 SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \ 0122 } 0123 0124 /** 0125 * @brief Initializes the priority SMP scheduler. 0126 * 0127 * This routine initializes the priority SMP scheduler. 0128 * 0129 * @param scheduler The scheduler to initialize. 0130 */ 0131 void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler ); 0132 0133 /** 0134 * @brief Initializes the node with the given priority. 0135 * 0136 * @param scheduler The scheduler instance. 0137 * @param[out] node The node to initialize. 0138 * @param the_thread The thread of the scheduler node. 0139 * @param priority The priority for the initialization. 0140 */ 0141 void _Scheduler_priority_SMP_Node_initialize( 0142 const Scheduler_Control *scheduler, 0143 Scheduler_Node *node, 0144 Thread_Control *the_thread, 0145 Priority_Control priority 0146 ); 0147 0148 /** 0149 * @brief Blocks the thread. 0150 * 0151 * @param scheduler The scheduler instance. 0152 * @param[in, out] the_thread The thread to block. 0153 * @param[in, out] node The @a thread's scheduler node. 0154 */ 0155 void _Scheduler_priority_SMP_Block( 0156 const Scheduler_Control *scheduler, 0157 Thread_Control *thread, 0158 Scheduler_Node *node 0159 ); 0160 0161 /** 0162 * @brief Unblocks the thread. 0163 * 0164 * @param scheduler The scheduler instance. 0165 * @param[in, out] the_thread The thread to unblock. 0166 * @param[in, out] node The @a thread's scheduler node. 0167 */ 0168 void _Scheduler_priority_SMP_Unblock( 0169 const Scheduler_Control *scheduler, 0170 Thread_Control *thread, 0171 Scheduler_Node *node 0172 ); 0173 0174 /** 0175 * @brief Updates the priority of the node. 0176 * 0177 * @param scheduler The scheduler instance. 0178 * @param the_thread The thread for the operation. 0179 * @param base_node The thread's scheduler node. 0180 */ 0181 void _Scheduler_priority_SMP_Update_priority( 0182 const Scheduler_Control *scheduler, 0183 Thread_Control *the_thread, 0184 Scheduler_Node *node 0185 ); 0186 0187 /** 0188 * @brief Asks for help operation. 0189 * 0190 * @param scheduler The scheduler instance to ask for help. 0191 * @param the_thread The thread needing help. 0192 * @param node The scheduler node. 0193 * 0194 * @retval true Ask for help was successful. 0195 * @retval false Ask for help was not successful. 0196 */ 0197 bool _Scheduler_priority_SMP_Ask_for_help( 0198 const Scheduler_Control *scheduler, 0199 Thread_Control *the_thread, 0200 Scheduler_Node *node 0201 ); 0202 0203 /** 0204 * @brief Reconsiders help operation. 0205 * 0206 * @param scheduler The scheduler instance to reconsider the help 0207 * request. 0208 * @param the_thread The thread reconsidering a help request. 0209 * @param node The scheduler node. 0210 */ 0211 void _Scheduler_priority_SMP_Reconsider_help_request( 0212 const Scheduler_Control *scheduler, 0213 Thread_Control *the_thread, 0214 Scheduler_Node *node 0215 ); 0216 0217 /** 0218 * @brief Withdraws node operation. 0219 * 0220 * @param scheduler The scheduler instance to withdraw the node. 0221 * @param the_thread The thread using the node. 0222 * @param node The scheduler node to withdraw. 0223 * @param next_state The next thread scheduler state in case the node is 0224 * scheduled. 0225 */ 0226 void _Scheduler_priority_SMP_Withdraw_node( 0227 const Scheduler_Control *scheduler, 0228 Thread_Control *the_thread, 0229 Scheduler_Node *node, 0230 Thread_Scheduler_state next_state 0231 ); 0232 0233 /** 0234 * @brief Makes the node sticky. 0235 * 0236 * @param scheduler is the scheduler of the node. 0237 * 0238 * @param[in, out] the_thread is the thread owning the node. 0239 * 0240 * @param[in, out] node is the scheduler node to make sticky. 0241 */ 0242 void _Scheduler_priority_SMP_Make_sticky( 0243 const Scheduler_Control *scheduler, 0244 Thread_Control *the_thread, 0245 Scheduler_Node *node 0246 ); 0247 0248 /** 0249 * @brief Cleans the sticky property from the node. 0250 * 0251 * @param scheduler is the scheduler of the node. 0252 * 0253 * @param[in, out] the_thread is the thread owning the node. 0254 * 0255 * @param[in, out] node is the scheduler node to clean the sticky property. 0256 */ 0257 void _Scheduler_priority_SMP_Clean_sticky( 0258 const Scheduler_Control *scheduler, 0259 Thread_Control *the_thread, 0260 Scheduler_Node *node 0261 ); 0262 0263 /** 0264 * @brief Adds @a idle to @a scheduler. 0265 * 0266 * @param[in, out] scheduler The scheduler instance to add the processor to. 0267 * @param idle The idle thrad control. 0268 */ 0269 void _Scheduler_priority_SMP_Add_processor( 0270 const Scheduler_Control *scheduler, 0271 Thread_Control *idle 0272 ); 0273 0274 /** 0275 * @brief Removes an idle thread from the given cpu. 0276 * 0277 * @param scheduler The scheduler instance. 0278 * @param cpu The cpu control to remove from @a scheduler. 0279 * 0280 * @return The idle thread of the processor. 0281 */ 0282 Thread_Control *_Scheduler_priority_SMP_Remove_processor( 0283 const Scheduler_Control *scheduler, 0284 struct Per_CPU_Control *cpu 0285 ); 0286 0287 /** 0288 * @brief Performs the yield of a thread. 0289 * 0290 * @param scheduler The scheduler instance. 0291 * @param[in, out] the_thread The thread that performed the yield operation. 0292 * @param node The scheduler node of @a the_thread. 0293 */ 0294 void _Scheduler_priority_SMP_Yield( 0295 const Scheduler_Control *scheduler, 0296 Thread_Control *thread, 0297 Scheduler_Node *node 0298 ); 0299 0300 /** @} */ 0301 0302 #ifdef __cplusplus 0303 } 0304 #endif /* __cplusplus */ 0305 0306 #endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |