![]() |
|
|||
File indexing completed on 2025-05-11 08:24:13
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @ingroup RTEMSScoreSchedulerPriority 0007 * 0008 * @brief This header file provides interfaces of the 0009 * @ref RTEMSScoreSchedulerPriority which are used by the implementation and the 0010 * @ref RTEMSImplApplConfig. 0011 */ 0012 0013 /* 0014 * Copryight (c) 2010 Gedare Bloom. 0015 * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). 0016 * 0017 * Redistribution and use in source and binary forms, with or without 0018 * modification, are permitted provided that the following conditions 0019 * are met: 0020 * 1. Redistributions of source code must retain the above copyright 0021 * notice, this list of conditions and the following disclaimer. 0022 * 2. Redistributions in binary form must reproduce the above copyright 0023 * notice, this list of conditions and the following disclaimer in the 0024 * documentation and/or other materials provided with the distribution. 0025 * 0026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0027 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0029 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0030 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0031 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0032 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0035 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0036 * POSSIBILITY OF SUCH DAMAGE. 0037 */ 0038 0039 #ifndef _RTEMS_SCORE_SCHEDULERPRIORITY_H 0040 #define _RTEMS_SCORE_SCHEDULERPRIORITY_H 0041 0042 #include <rtems/score/chain.h> 0043 #include <rtems/score/prioritybitmap.h> 0044 #include <rtems/score/scheduler.h> 0045 0046 #ifdef __cplusplus 0047 extern "C" { 0048 #endif 0049 0050 /** 0051 * @defgroup RTEMSScoreSchedulerPriority Deterministic Priority Scheduler 0052 * 0053 * @ingroup RTEMSScoreScheduler 0054 * 0055 * @brief This group contains the Deterministic Priority Scheduler 0056 * implementation. 0057 * 0058 * @{ 0059 */ 0060 0061 /** 0062 * Entry points for the Deterministic Priority Based Scheduler. 0063 */ 0064 #define SCHEDULER_PRIORITY_ENTRY_POINTS \ 0065 { \ 0066 _Scheduler_priority_Initialize, /* initialize entry point */ \ 0067 _Scheduler_priority_Schedule, /* schedule entry point */ \ 0068 _Scheduler_priority_Yield, /* yield entry point */ \ 0069 _Scheduler_priority_Block, /* block entry point */ \ 0070 _Scheduler_priority_Unblock, /* unblock entry point */ \ 0071 _Scheduler_priority_Update_priority, /* update priority entry point */ \ 0072 _Scheduler_default_Map_priority, /* map priority entry point */ \ 0073 _Scheduler_default_Unmap_priority, /* unmap priority entry point */ \ 0074 SCHEDULER_DEFAULT_SMP_OPERATIONS \ 0075 _Scheduler_priority_Node_initialize, /* node initialize entry point */ \ 0076 _Scheduler_default_Node_destroy, /* node destroy entry point */ \ 0077 _Scheduler_default_Release_job, /* new period of task */ \ 0078 _Scheduler_default_Cancel_job, /* cancel period of task */ \ 0079 _Scheduler_default_Start_idle /* start idle entry point */ \ 0080 SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \ 0081 } 0082 0083 typedef struct { 0084 /** 0085 * @brief Basic scheduler context. 0086 */ 0087 Scheduler_Context Base; 0088 0089 /** 0090 * @brief Bit map to indicate non-empty ready queues. 0091 */ 0092 Priority_bit_map_Control Bit_map; 0093 0094 /** 0095 * @brief One ready queue per priority level. 0096 */ 0097 Chain_Control Ready[ RTEMS_ZERO_LENGTH_ARRAY ]; 0098 } Scheduler_priority_Context; 0099 0100 /** 0101 * @brief Data for ready queue operations. 0102 */ 0103 typedef struct { 0104 /** 0105 * @brief The thread priority currently used by the scheduler. 0106 */ 0107 unsigned int current_priority; 0108 0109 /** This field points to the Ready FIFO for this thread's priority. */ 0110 Chain_Control *ready_chain; 0111 0112 /** This field contains precalculated priority map indices. */ 0113 Priority_bit_map_Information Priority_map; 0114 } Scheduler_priority_Ready_queue; 0115 0116 /** 0117 * @brief Scheduler node specialization for Deterministic Priority schedulers. 0118 */ 0119 typedef struct { 0120 /** 0121 * @brief Basic scheduler node. 0122 */ 0123 Scheduler_Node Base; 0124 0125 /** 0126 * @brief The associated ready queue of this node. 0127 */ 0128 Scheduler_priority_Ready_queue Ready_queue; 0129 } Scheduler_priority_Node; 0130 0131 /** 0132 * @brief Initializes the priority scheduler. 0133 * 0134 * This routine initializes the priority scheduler. 0135 * 0136 * @param scheduler The scheduler to initialize. 0137 */ 0138 void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler ); 0139 0140 /** 0141 * @brief Blocks the thread. 0142 * 0143 * @param scheduler The scheduler instance. 0144 * @param[in, out] the_thread The thread to block. 0145 * @param[in, out] node The @a thread's scheduler node. 0146 */ 0147 void _Scheduler_priority_Block( 0148 const Scheduler_Control *scheduler, 0149 Thread_Control *the_thread, 0150 Scheduler_Node *node 0151 ); 0152 0153 /** 0154 * @brief Sets the heir thread to be the next ready thread. 0155 * 0156 * This kernel routine sets the heir thread to be the next ready thread 0157 * by invoking the_scheduler->ready_queue->operations->first(). 0158 * 0159 * @param scheduler The scheduler instance. 0160 * @param the_thread The thread for the operation. 0161 */ 0162 void _Scheduler_priority_Schedule( 0163 const Scheduler_Control *scheduler, 0164 Thread_Control *the_thread 0165 ); 0166 0167 /** 0168 * @brief Unblocks the thread. 0169 * 0170 * @param scheduler The scheduler instance. 0171 * @param[in, out] the_thread The thread to unblock. 0172 * @param[in, out] node The @a thread's scheduler node. 0173 */ 0174 void _Scheduler_priority_Unblock( 0175 const Scheduler_Control *scheduler, 0176 Thread_Control *the_thread, 0177 Scheduler_Node *node 0178 ); 0179 0180 /** 0181 * @brief Updates the priority of the node. 0182 * 0183 * @param scheduler The scheduler instance. 0184 * @param the_thread The thread for the operation. 0185 * @param base_node The thread's scheduler node. 0186 */ 0187 void _Scheduler_priority_Update_priority( 0188 const Scheduler_Control *scheduler, 0189 Thread_Control *the_thread, 0190 Scheduler_Node *base_node 0191 ); 0192 0193 /** 0194 * @brief Initializes the node with the given priority. 0195 * 0196 * @param scheduler The scheduler instance. 0197 * @param[out] node The node to initialize. 0198 * @param the_thread The thread of the scheduler node. 0199 * @param priority The priority for the initialization. 0200 */ 0201 void _Scheduler_priority_Node_initialize( 0202 const Scheduler_Control *scheduler, 0203 Scheduler_Node *node, 0204 Thread_Control *the_thread, 0205 Priority_Control priority 0206 ); 0207 0208 /** 0209 * @brief Performs the yield of a thread. 0210 * 0211 * @param scheduler The scheduler instance. 0212 * @param[in, out] the_thread The thread that performed the yield operation. 0213 * @param node The scheduler node of @a the_thread. 0214 */ 0215 void _Scheduler_priority_Yield( 0216 const Scheduler_Control *scheduler, 0217 Thread_Control *the_thread, 0218 Scheduler_Node *node 0219 ); 0220 0221 /** @} */ 0222 0223 #ifdef __cplusplus 0224 } 0225 #endif 0226 0227 #endif 0228 /* end of include file */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |