source: rtems/cpukit/score/include/rtems/score/schedulersimple.h @ 439c494

4.115
Last change on this file since 439c494 was 439c494, checked in by Sebastian Huber <sebastian.huber@…>, on 04/03/14 at 10:02:09

score: Add and use Scheduler_simple_Control

  • Property mode set to 100644
File size: 5.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.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( Thread_Control *thread );
80
81/**
82 *  @brief Invoked when a thread wishes to voluntarily
83 *  transfer control of the processor to another thread in the queue.
84 *
85 *  This routine is invoked when a thread wishes to voluntarily
86 *  transfer control of the processor to another thread in the queue.
87 *  It will remove the specified THREAD from the scheduler.informaiton
88 *  (where the ready queue is stored) and place it immediately at the
89 *  between the last entry of its priority and the next priority thread.
90 *  Reset timeslice and yield the processor functions both use this routine,
91 *  therefore if reset is true and this is the only thread on the queue then
92 *  the timeslice counter is reset.  The heir THREAD will be updated if the
93 *  running is also the currently the heir.
94 *
95 *  @param[in,out] thread The yielding thread.
96 */
97void _Scheduler_simple_Yield( Thread_Control *thread );
98
99/**
100 *  @brief Remove a simple-priority-based thread from the queue.
101 *
102 *  This routine removes @a the_thread from the scheduling decision,
103 *  that is, removes it from the ready queue.  It performs
104 *  any necessary scheduling operations including the selection of
105 *  a new heir thread.
106 *
107 *  @param[in] the_thread is the thread that is to be blocked
108 */
109void _Scheduler_simple_Block(
110  Thread_Control *the_thread
111);
112
113/**
114 *  @brief Unblock a simple-priority-based thread.
115 *
116 *  This routine adds @a the_thread to the scheduling decision,
117 *  that is, adds it to the ready queue and
118 *  updates any appropriate scheduling variables, for example the heir thread.
119 *
120 *  @param[in] the_thread is the thread that is to be unblocked
121 */
122void _Scheduler_simple_Unblock(
123  Thread_Control *the_thread
124);
125
126/**
127 *  @brief Removes a simple-priority-based thread from a simple queue.
128 *
129 *  This routine removes a specific thread from the specified
130 *  simple-based ready queue.
131 *
132 *  @param[in] the_thread is the thread to be blocked
133 */
134void _Scheduler_simple_Extract(
135  Thread_Control *the_thread
136);
137
138/**
139 *  @brief Puts simple-priority-based thread onto the ready queue.
140 *
141 *  This routine puts @a the_thread on to the ready queue.
142 *
143 *  @param[in] the_thread is the thread to be enqueued
144 */
145void _Scheduler_simple_Enqueue(
146  Thread_Control *the_thread
147);
148
149/**
150 *  @brief Put simple-priority-based @a the_thread to
151 *  the head of the ready queue.
152 *
153 *  This routine puts @a the_thread to the head of the ready queue.
154 *  The thread will be the first thread at its priority level.
155 *
156 *  @param[in] the_thread is the thread to be blocked
157 */
158void _Scheduler_simple_Enqueue_first(
159  Thread_Control *the_thread
160);
161
162/**
163 *  _Scheduler_simple_Ready_queue_enqueue
164 *
165 *  This routine puts @a the_thread on the ready queue
166 *  at the end of its priority group.
167 *
168 *  @param[in] the_thread - pointer to a thread control block
169 */
170void _Scheduler_simple_Ready_queue_enqueue(
171  Thread_Control    *the_thread
172);
173
174/**
175 *  @brief Puts simple-priority-based @a the_thread on to the ready queue
176 *  at the beginning of its priority group.
177 *
178 *  This routine puts @a the_thread on to the ready queue
179 *  at the beginning of its priority group.
180 *
181 *  @param[in] the_thread - pointer to a thread control block
182 */
183void _Scheduler_simple_Ready_queue_enqueue_first(
184  Thread_Control    *the_thread
185);
186
187/**@}*/
188
189#ifdef __cplusplus
190}
191#endif
192
193#endif
194/* end of include file */
Note: See TracBrowser for help on using the repository browser.