1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup RTEMSScoreSchedulerSimple |
---|
5 | * |
---|
6 | * @brief Manipulation of Threads Simple-Priority-Based Ready Queue |
---|
7 | * |
---|
8 | * This include file contains all the constants and structures associated |
---|
9 | * with the manipulation of threads on a simple-priority-based ready queue. |
---|
10 | */ |
---|
11 | |
---|
12 | /* |
---|
13 | * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). |
---|
14 | * |
---|
15 | * The license and distribution terms for this file may be |
---|
16 | * found in the file LICENSE in this distribution or at |
---|
17 | * http://www.rtems.org/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H |
---|
21 | #define _RTEMS_SCORE_SCHEDULERSIMPLE_H |
---|
22 | |
---|
23 | #include <rtems/score/scheduler.h> |
---|
24 | #include <rtems/score/schedulerpriority.h> |
---|
25 | |
---|
26 | #ifdef __cplusplus |
---|
27 | extern "C" { |
---|
28 | #endif |
---|
29 | |
---|
30 | /** |
---|
31 | * @defgroup RTEMSScoreSchedulerSimple Simple Priority Scheduler |
---|
32 | * |
---|
33 | * @ingroup RTEMSScoreScheduler |
---|
34 | * |
---|
35 | * @brief Simple Priority Scheduler |
---|
36 | * |
---|
37 | * @{ |
---|
38 | */ |
---|
39 | |
---|
40 | #define SCHEDULER_SIMPLE_MAXIMUM_PRIORITY 255 |
---|
41 | |
---|
42 | /** |
---|
43 | * Entry points for Scheduler Simple |
---|
44 | */ |
---|
45 | #define SCHEDULER_SIMPLE_ENTRY_POINTS \ |
---|
46 | { \ |
---|
47 | _Scheduler_simple_Initialize, /* initialize entry point */ \ |
---|
48 | _Scheduler_simple_Schedule, /* schedule entry point */ \ |
---|
49 | _Scheduler_simple_Yield, /* yield entry point */ \ |
---|
50 | _Scheduler_simple_Block, /* block entry point */ \ |
---|
51 | _Scheduler_simple_Unblock, /* unblock entry point */ \ |
---|
52 | _Scheduler_simple_Update_priority, /* update priority entry point */ \ |
---|
53 | _Scheduler_default_Map_priority, /* map priority entry point */ \ |
---|
54 | _Scheduler_default_Unmap_priority, /* unmap priority entry point */ \ |
---|
55 | SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \ |
---|
56 | _Scheduler_default_Node_initialize, /* node initialize entry point */ \ |
---|
57 | _Scheduler_default_Node_destroy, /* node destroy entry point */ \ |
---|
58 | _Scheduler_default_Release_job, /* new period of task */ \ |
---|
59 | _Scheduler_default_Cancel_job, /* cancel period of task */ \ |
---|
60 | _Scheduler_default_Tick, /* tick entry point */ \ |
---|
61 | _Scheduler_default_Start_idle /* start idle entry point */ \ |
---|
62 | SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \ |
---|
63 | } |
---|
64 | |
---|
65 | /** |
---|
66 | * @brief Simple scheduler context. |
---|
67 | */ |
---|
68 | typedef struct { |
---|
69 | /** |
---|
70 | * @brief Basic scheduler context. |
---|
71 | */ |
---|
72 | Scheduler_Context Base; |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief One ready queue for all ready threads. |
---|
76 | */ |
---|
77 | Chain_Control Ready; |
---|
78 | } Scheduler_simple_Context; |
---|
79 | |
---|
80 | /** |
---|
81 | * @brief Initializes simple scheduler. |
---|
82 | * |
---|
83 | * This routine initializes the simple scheduler. |
---|
84 | * |
---|
85 | * @param scheduler The scheduler to be initialized. |
---|
86 | */ |
---|
87 | void _Scheduler_simple_Initialize( const Scheduler_Control *scheduler ); |
---|
88 | |
---|
89 | /** |
---|
90 | * @brief Schedules threads. |
---|
91 | * |
---|
92 | * This routine sets the heir thread to be the next ready thread |
---|
93 | * on the ready queue by getting the first node in the scheduler |
---|
94 | * information. |
---|
95 | * |
---|
96 | * @param scheduler The scheduler instance. |
---|
97 | * @param the_thread causing the scheduling operation. |
---|
98 | */ |
---|
99 | void _Scheduler_simple_Schedule( |
---|
100 | const Scheduler_Control *scheduler, |
---|
101 | Thread_Control *the_thread |
---|
102 | ); |
---|
103 | |
---|
104 | /** |
---|
105 | * @brief Performs the yield of a thread. |
---|
106 | * |
---|
107 | * @param scheduler The scheduler instance. |
---|
108 | * @param[in, out] the_thread The thread that performed the yield operation. |
---|
109 | * @param node The scheduler node of @a the_thread. |
---|
110 | */ |
---|
111 | void _Scheduler_simple_Yield( |
---|
112 | const Scheduler_Control *scheduler, |
---|
113 | Thread_Control *the_thread, |
---|
114 | Scheduler_Node *node |
---|
115 | ); |
---|
116 | |
---|
117 | /** |
---|
118 | * @brief Blocks the thread. |
---|
119 | * |
---|
120 | * @param scheduler The scheduler instance. |
---|
121 | * @param[in, out] the_thread The thread to block. |
---|
122 | * @param[in, out] node The @a thread's scheduler node. |
---|
123 | */ |
---|
124 | void _Scheduler_simple_Block( |
---|
125 | const Scheduler_Control *scheduler, |
---|
126 | Thread_Control *the_thread, |
---|
127 | Scheduler_Node *node |
---|
128 | ); |
---|
129 | |
---|
130 | /** |
---|
131 | * @brief Unblocks the thread. |
---|
132 | * |
---|
133 | * @param scheduler The scheduler instance. |
---|
134 | * @param[in, out] the_thread The thread to unblock. |
---|
135 | * @param[in, out] node The @a thread's scheduler node. |
---|
136 | */ |
---|
137 | void _Scheduler_simple_Unblock( |
---|
138 | const Scheduler_Control *scheduler, |
---|
139 | Thread_Control *the_thread, |
---|
140 | Scheduler_Node *node |
---|
141 | ); |
---|
142 | |
---|
143 | /** |
---|
144 | * @brief Updates the priority of the node. |
---|
145 | * |
---|
146 | * @param scheduler The scheduler instance. |
---|
147 | * @param the_thread The thread for the operation. |
---|
148 | * @param node The thread's scheduler node. |
---|
149 | */ |
---|
150 | void _Scheduler_simple_Update_priority( |
---|
151 | const Scheduler_Control *scheduler, |
---|
152 | Thread_Control *the_thread, |
---|
153 | Scheduler_Node *node |
---|
154 | ); |
---|
155 | |
---|
156 | /** @} */ |
---|
157 | |
---|
158 | #ifdef __cplusplus |
---|
159 | } |
---|
160 | #endif |
---|
161 | |
---|
162 | #endif |
---|
163 | /* end of include file */ |
---|