source: rtems/cpukit/score/include/rtems/score/schedulersimple.h @ a344308

4.115
Last change on this file since a344308 was a344308, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 6, 2013 at 1:32:22 PM

scheduler: Add and use _Scheduler_default_Tick()

Delete _Scheduler_priority_Tick(). Use _SMP_Get_processor_count() for
default tick operation. Delete _Scheduler_simple_smp_Tick().

  • Property mode set to 100644
File size: 6.7 KB
Line 
1/**
2 *  @file  rtems/score/schedulersimple.h
3 *
4 *  @brief Manipulation of Threads Simple-Priority-Based Ready Queue
5 *
6 *  This include file contains all the constants and structures associated
7 *  with the manipulation of threads on a simple-priority-based ready queue.
8 */
9
10/*
11 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H
19#define _RTEMS_SCORE_SCHEDULERSIMPLE_H
20
21/**
22 *  @defgroup ScoreSchedulerSimple Simple Priority Scheduler
23 *
24 *  @ingroup ScoreScheduler
25 */
26/**@{*/
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <rtems/score/scheduler.h>
33#include <rtems/score/schedulerpriority.h>
34
35/**
36 *  Entry points for Scheduler Simple
37 */
38#define SCHEDULER_SIMPLE_ENTRY_POINTS \
39  { \
40    _Scheduler_simple_Initialize,         /* initialize entry point */ \
41    _Scheduler_simple_Schedule,           /* schedule entry point */ \
42    _Scheduler_simple_Yield,              /* yield entry point */ \
43    _Scheduler_simple_Block,              /* block entry point */ \
44    _Scheduler_simple_Unblock,            /* unblock entry point */ \
45    _Scheduler_simple_Allocate,           /* allocate entry point */ \
46    _Scheduler_simple_Free,               /* free entry point */ \
47    _Scheduler_simple_Update,             /* update entry point */ \
48    _Scheduler_simple_Enqueue,            /* enqueue entry point */ \
49    _Scheduler_simple_Enqueue_first,      /* enqueue_first entry point */ \
50    _Scheduler_simple_Extract,            /* extract entry point */ \
51    _Scheduler_priority_Priority_compare, /* compares two priorities */ \
52    _Scheduler_priority_Release_job,      /* new period of task */ \
53    _Scheduler_default_Tick,              /* tick entry point */ \
54    _Scheduler_default_Start_idle         /* start idle entry point */ \
55  }
56
57/**
58 *  @brief Initialize simple scheduler.
59 *
60 *  This routine initializes the simple scheduler.
61 */
62void _Scheduler_simple_Initialize( void );
63
64/**
65 *  This routine sets the heir thread to be the next ready thread
66 *  on the ready queue by getting the first node in the scheduler
67 *  information.
68 */
69void _Scheduler_simple_Schedule( void );
70
71/**
72 *  @brief Invoked when a thread wishes to voluntarily
73 *  transfer control of the processor to another thread in the queue.
74 *
75 *  This routine is invoked when a thread wishes to voluntarily
76 *  transfer control of the processor to another thread in the queue.
77 *  It will remove the specified THREAD from the scheduler.informaiton
78 *  (where the ready queue is stored) and place it immediately at the
79 *  between the last entry of its priority and the next priority thread.
80 *  Reset timeslice and yield the processor functions both use this routine,
81 *  therefore if reset is true and this is the only thread on the queue then
82 *  the timeslice counter is reset.  The heir THREAD will be updated if the
83 *  running is also the currently the heir.
84 *
85 *  @param[in/out] thread The yielding thread.
86 */
87void _Scheduler_simple_Yield( Thread_Control *thread );
88
89/**
90 *  @brief Remove a simple-priority-based thread from the queue.
91 *
92 *  This routine removes @a the_thread from the scheduling decision,
93 *  that is, removes it from the ready queue.  It performs
94 *  any necessary scheduling operations including the selection of
95 *  a new heir thread.
96 *
97 *  @param[in] the_thread is the thread that is to be blocked
98 */
99void _Scheduler_simple_Block(
100  Thread_Control *the_thread
101);
102
103/**
104 *  @brief Unblock a simple-priority-based thread.
105 *
106 *  This routine adds @a the_thread to the scheduling decision,
107 *  that is, adds it to the ready queue and
108 *  updates any appropriate scheduling variables, for example the heir thread.
109 *
110 *  @param[in] the_thread is the thread that is to be unblocked
111 */
112void _Scheduler_simple_Unblock(
113  Thread_Control *the_thread
114);
115
116/**
117 *  @brief Removes a simple-priority-based thread from a simple queue.
118 *
119 *  This routine removes a specific thread from the specified
120 *  simple-based ready queue.
121 *
122 *  @param[in] the_thread is the thread to be blocked
123 */
124void _Scheduler_simple_Extract(
125  Thread_Control *the_thread
126);
127
128/**
129 *  @brief Puts simple-priority-based thread onto the ready queue.
130 *
131 *  This routine puts @a the_thread on to the ready queue.
132 *
133 *  @param[in] the_thread is the thread to be enqueued
134 */
135void _Scheduler_simple_Enqueue(
136  Thread_Control *the_thread
137);
138
139/**
140 *  @brief Put simple-priority-based @a the_thread to
141 *  the head of the ready queue.
142 *
143 *  This routine puts @a the_thread to the head of the ready queue.
144 *  The thread will be the first thread at its priority level.
145 *
146 *  @param[in] the_thread is the thread to be blocked
147 */
148void _Scheduler_simple_Enqueue_first(
149  Thread_Control *the_thread
150);
151
152/**
153 *  @brief Return empty placeholder for the simple scheduler.
154 *
155 *  This routine is a place holder for any memeory allocation needed
156 *  by the scheduler.  For the simple scheduler the routine is an empty
157 *  place holder.
158 *
159 *  @param[in] the_thread is the thread the scheduler is allocating
160 *             management memory for
161 *
162 *  @retval this routine returns -1 since this is just an empty placeholder
163 *  and the return value may be defined differently by each scheduler.
164 */
165void *_Scheduler_simple_Allocate(
166  Thread_Control *the_thread
167);
168
169/**
170 *  @brief Stub for simple schedule update.
171 *
172 *  This routine does nothing, and is used as a stub for Schedule update
173 *  The overhead of a function call will still be imposed.
174 *
175 *  @param[in] the_thread is the thread to be blocked
176 */
177void _Scheduler_simple_Update(
178  Thread_Control *the_thread
179);
180
181/**
182 *  @brief Stub for simple schedule free.
183 *
184 *  This routine does nothing, and is used as a stub for Schedule free
185 *  The overhead of a function call will still be imposed.
186 *
187 *  @param[in] the_thread is the thread to be blocked
188 */
189void _Scheduler_simple_Free(
190  Thread_Control *the_thread
191);
192
193/**
194 *  _Scheduler_simple_Ready_queue_enqueue
195 *
196 *  This routine puts @a the_thread on the ready queue
197 *  at the end of its priority group.
198 *
199 *  @param[in] the_thread - pointer to a thread control block
200 */
201void _Scheduler_simple_Ready_queue_enqueue(
202  Thread_Control    *the_thread
203);
204
205/**
206 *  @brief Puts simple-priority-based @a the_thread on to the ready queue
207 *  at the beginning of its priority group.
208 *
209 *  This routine puts @a the_thread on to the ready queue
210 *  at the beginning of its priority group.
211 *
212 *  @param[in] the_thread - pointer to a thread control block
213 */
214void _Scheduler_simple_Ready_queue_enqueue_first(
215  Thread_Control    *the_thread
216);
217
218#ifndef __RTEMS_APPLICATION__
219#include <rtems/score/schedulersimple.inl>
220#endif
221
222#ifdef __cplusplus
223}
224#endif
225
226/**@}*/
227
228#endif
229/* end of include file */
Note: See TracBrowser for help on using the repository browser.