source: rtems/cpukit/score/include/rtems/score/schedulersimple.h @ 24934e36

4.115
Last change on this file since 24934e36 was 24934e36, checked in by Sebastian Huber <sebastian.huber@…>, on 04/03/14 at 13:03:35

score: Add scheduler control to scheduler ops

Scheduler operations must be free of a global scheduler context to
enable partitioned/clustered scheduling.

  • Property mode set to 100644
File size: 6.0 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.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H
19#define _RTEMS_SCORE_SCHEDULERSIMPLE_H
20
21#include <rtems/score/scheduler.h>
22#include <rtems/score/schedulerpriority.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 *  @defgroup ScoreSchedulerSimple Simple Priority Scheduler
30 *
31 *  @ingroup ScoreScheduler
32 */
33/**@{*/
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_default_Allocate,          /* allocate entry point */ \
46    _Scheduler_default_Free,              /* free entry point */ \
47    _Scheduler_default_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_default_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 Simple scheduler control.
59 */
60typedef struct {
61  /**
62   * @brief One ready queue for all ready threads.
63   */
64  Chain_Control Ready;
65} Scheduler_simple_Control;
66
67/**
68 *  @brief Initialize simple scheduler.
69 *
70 *  This routine initializes the simple scheduler.
71 */
72void _Scheduler_simple_Initialize( void );
73
74/**
75 *  This routine sets the heir thread to be the next ready thread
76 *  on the ready queue by getting the first node in the scheduler
77 *  information.
78 */
79void _Scheduler_simple_Schedule(
80  Scheduler_Control *scheduler,
81  Thread_Control    *the_thread
82);
83
84/**
85 *  @brief Invoked when a thread wishes to voluntarily
86 *  transfer control of the processor to another thread in the queue.
87 *
88 *  This routine is invoked when a thread wishes to voluntarily
89 *  transfer control of the processor to another thread in the queue.
90 *  It will remove the specified THREAD from the scheduler.informaiton
91 *  (where the ready queue is stored) and place it immediately at the
92 *  between the last entry of its priority and the next priority thread.
93 *  Reset timeslice and yield the processor functions both use this routine,
94 *  therefore if reset is true and this is the only thread on the queue then
95 *  the timeslice counter is reset.  The heir THREAD will be updated if the
96 *  running is also the currently the heir.
97 *
98 *  @param[in,out] thread The yielding thread.
99 */
100void _Scheduler_simple_Yield(
101  Scheduler_Control *scheduler,
102  Thread_Control    *the_thread
103);
104
105/**
106 *  @brief Remove a simple-priority-based thread from the queue.
107 *
108 *  This routine removes @a the_thread from the scheduling decision,
109 *  that is, removes it from the ready queue.  It performs
110 *  any necessary scheduling operations including the selection of
111 *  a new heir thread.
112 *
113 *  @param[in] the_thread is the thread that is to be blocked
114 */
115void _Scheduler_simple_Block(
116  Scheduler_Control *scheduler,
117  Thread_Control    *the_thread
118);
119
120/**
121 *  @brief Unblock a simple-priority-based thread.
122 *
123 *  This routine adds @a the_thread to the scheduling decision,
124 *  that is, adds it to the ready queue and
125 *  updates any appropriate scheduling variables, for example the heir thread.
126 *
127 *  @param[in] the_thread is the thread that is to be unblocked
128 */
129void _Scheduler_simple_Unblock(
130  Scheduler_Control *scheduler,
131  Thread_Control    *the_thread
132);
133
134/**
135 *  @brief Removes a simple-priority-based thread from a simple queue.
136 *
137 *  This routine removes a specific thread from the specified
138 *  simple-based ready queue.
139 *
140 *  @param[in] the_thread is the thread to be blocked
141 */
142void _Scheduler_simple_Extract(
143  Scheduler_Control *scheduler,
144  Thread_Control    *the_thread
145);
146
147/**
148 *  @brief Puts simple-priority-based thread onto the ready queue.
149 *
150 *  This routine puts @a the_thread on to the ready queue.
151 *
152 *  @param[in] the_thread is the thread to be enqueued
153 */
154void _Scheduler_simple_Enqueue(
155  Scheduler_Control *scheduler,
156  Thread_Control    *the_thread
157);
158
159/**
160 *  @brief Put simple-priority-based @a the_thread to
161 *  the head of the ready queue.
162 *
163 *  This routine puts @a the_thread to the head of the ready queue.
164 *  The thread will be the first thread at its priority level.
165 *
166 *  @param[in] the_thread is the thread to be blocked
167 */
168void _Scheduler_simple_Enqueue_first(
169  Scheduler_Control *scheduler,
170  Thread_Control    *the_thread
171);
172
173/**
174 *  _Scheduler_simple_Ready_queue_enqueue
175 *
176 *  This routine puts @a the_thread on the ready queue
177 *  at the end of its priority group.
178 *
179 *  @param[in] the_thread - pointer to a thread control block
180 */
181void _Scheduler_simple_Ready_queue_enqueue(
182  Scheduler_Control *scheduler,
183  Thread_Control    *the_thread
184);
185
186/**
187 *  @brief Puts simple-priority-based @a the_thread on to the ready queue
188 *  at the beginning of its priority group.
189 *
190 *  This routine puts @a the_thread on to the ready queue
191 *  at the beginning of its priority group.
192 *
193 *  @param[in] the_thread - pointer to a thread control block
194 */
195void _Scheduler_simple_Ready_queue_enqueue_first(
196  Scheduler_Control *scheduler,
197  Thread_Control    *the_thread
198);
199
200/**@}*/
201
202#ifdef __cplusplus
203}
204#endif
205
206#endif
207/* end of include file */
Note: See TracBrowser for help on using the repository browser.