source: rtems/cpukit/score/include/rtems/score/schedulerpriority.h @ e0f91da

4.115
Last change on this file since e0f91da was e0f91da, checked in by Alex Ivanov <alexivanov97@…>, on 11/30/12 at 21:34:17

score misc: Score misc: Clean up Doxygen #9 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

https://google-melange.appspot.com/gci/task/view/google/gci2012/7977211

  • Property mode set to 100644
File size: 6.9 KB
Line 
1/**
2 *  @file  rtems/score/schedulerpriority.h
3 *
4 *  This include file contains all the constants and structures associated
5 *  with the manipulation of threads for the priority-based scheduler.
6 */
7
8/*
9 *  Copryight (c) 2010 Gedare Bloom.
10 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#ifndef _RTEMS_SCORE_SCHEDULERPRIORITY_H
18#define _RTEMS_SCORE_SCHEDULERPRIORITY_H
19
20#include <rtems/score/chain.h>
21#include <rtems/score/priority.h>
22#include <rtems/score/scheduler.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 *  @addtogroup ScoreScheduler
30 *
31 */
32/**@{*/
33
34/**
35 *  Entry points for the Deterministic Priority Based Scheduler.
36 */
37#define SCHEDULER_PRIORITY_ENTRY_POINTS \
38  { \
39    _Scheduler_priority_Initialize,       /* initialize entry point */ \
40    _Scheduler_priority_Schedule,         /* schedule entry point */ \
41    _Scheduler_priority_Yield,            /* yield entry point */ \
42    _Scheduler_priority_Block,            /* block entry point */ \
43    _Scheduler_priority_Unblock,          /* unblock entry point */ \
44    _Scheduler_priority_Allocate,         /* allocate entry point */ \
45    _Scheduler_priority_Free,             /* free entry point */ \
46    _Scheduler_priority_Update,           /* update entry point */ \
47    _Scheduler_priority_Enqueue,          /* enqueue entry point */ \
48    _Scheduler_priority_Enqueue_first,    /* enqueue_first entry point */ \
49    _Scheduler_priority_Extract,          /* extract entry point */ \
50    _Scheduler_priority_Priority_compare, /* compares two priorities */ \
51    _Scheduler_priority_Release_job,      /* new period of task */ \
52    _Scheduler_priority_Tick              /* tick entry point */ \
53  }
54
55/**
56 * Per-thread data related to the _Scheduler_PRIORITY scheduling policy.
57 */
58typedef struct {
59  /** This field points to the Ready FIFO for this thread's priority. */
60  Chain_Control                        *ready_chain;
61
62  /** This field contains precalculated priority map indices. */
63  Priority_bit_map_Information          Priority_map;
64} Scheduler_priority_Per_thread;
65
66/**
67 * This routine initializes the priority scheduler.
68 */
69void _Scheduler_priority_Initialize(void);
70
71/**
72 *  @brief Scheduler priority Block
73 *
74 *  This routine removes @a the_thread from the scheduling decision,
75 *  that is, removes it from the ready queue.  It performs
76 *  any necessary scheduling operations including the selection of
77 *  a new heir thread.
78 *
79 *  @param[in] the_thread is the thread to be blocked
80 */
81void _Scheduler_priority_Block(
82  Thread_Control    *the_thread
83);
84
85/**
86 *  @brief schedule entry point
87 *
88 *  This kernel routine sets the heir thread to be the next ready thread
89 *  by invoking the_scheduler->ready_queue->operations->first().
90 */
91void _Scheduler_priority_Schedule(void);
92
93/**
94 *  @brief Allocate Scheduler Priority
95 *
96 *  This routine allocates @a the_thread->scheduler.
97 *
98 *  @param[in] the_thread is the thread the scheduler is allocating
99 *             management memory for
100 */
101void * _Scheduler_priority_Allocate(
102  Thread_Control      *the_thread
103);
104
105/**
106 *  @brief Free Scheduler Priority
107 *
108 *  This routine frees @a the_thread->scheduler.
109 *
110 *  @param[in] the_thread is the thread whose scheduler specific information
111 *             will be deallocated.
112 */
113void _Scheduler_priority_Free(
114  Thread_Control      *the_thread
115);
116
117/**
118 *  @brief Update Scheduler priority
119 *  This routine updates @a the_thread->scheduler based on @a the_scheduler
120 *  structures and thread state.
121 *
122 *  @param[in] the_thread will have its scheduler specific information
123 *             structure updated.
124 */
125void _Scheduler_priority_Update(
126  Thread_Control      *the_thread
127);
128
129/**
130 *  @brief Scheduler Priority Unblock
131 *
132 *  This routine adds @a the_thread to the scheduling decision,
133 *  that is, adds it to the ready queue and
134 *  updates any appropriate scheduling variables, for example the heir thread.
135 *
136 *  @param[in] the_thread will be unblocked
137 */
138void _Scheduler_priority_Unblock(
139  Thread_Control    *the_thread
140);
141
142/**
143 *  @brief Scheduler Priority Yield
144 *
145 *  This routine is invoked when a thread wishes to voluntarily
146 *  transfer control of the processor to another thread in the queue.
147 *
148 *  This routine will remove the running THREAD from the ready queue
149 *  and place it immediately at the rear of this chain.  Reset timeslice
150 *  and yield the processor functions both use this routine, therefore if
151 *  reset is true and this is the only thread on the queue then the
152 *  timeslice counter is reset.  The heir THREAD will be updated if the
153 *  running is also the currently the heir.
154 *
155 *  - INTERRUPT LATENCY:
156 *    + ready chain
157 *    + select heir
158 */
159void _Scheduler_priority_Yield( void );
160
161/**
162 *  @brief Scheduler Priority Enqueue
163 *
164 *  This routine puts @a the_thread on to the priority-based ready queue.
165 *
166 *  @param[in] the_thread will be enqueued at the TAIL of its priority.
167 */
168void _Scheduler_priority_Enqueue(
169  Thread_Control    *the_thread
170);
171
172/**
173 *  @brief Scheduler Priority Enqueue First
174 *
175 *  This routine puts @a the_thread to the head of the ready queue.
176 *  For priority-based ready queues, the thread will be the first thread
177 *  at its priority level.
178 *
179 *  @param[in] the_thread will be enqueued at the HEAD of its priority.
180 */
181void _Scheduler_priority_Enqueue_first(
182  Thread_Control    *the_thread
183);
184
185/**
186 *  @brief Removes a specific thread from scheduler
187 *
188 *  This routine removes a specific thread from the scheduler's set
189 *  of ready threads.
190 *
191 *  @param[in] the_thread will be extracted from the ready set.
192 */
193void _Scheduler_priority_Extract(
194  Thread_Control     *the_thread
195);
196
197/**
198 *  @brief Scheduler priority Priority compare
199 *
200 *  This routine compares two priorities.
201 */
202int _Scheduler_priority_Priority_compare(
203  Priority_Control      p1,
204  Priority_Control      p2
205);
206
207/**
208 *  @brief Scheduler priority Release job
209 *
210 *  This routine is called when a new job of task is released.
211 *
212 *  @param[in] the_thread is the owner of the job.
213 *  @param[in] deadline of the new job from now. If equal to 0,
214 *             the job was cancelled or deleted.
215 */
216void _Scheduler_priority_Release_job (
217  Thread_Control  *the_thread,
218  uint32_t         deadline
219);
220
221/**
222 *  @brief Deterministic Priority Scheduler Tick Method
223 *
224 *  This routine is invoked as part of processing each clock tick.
225 *  It is responsible for determining if the current thread allows
226 *  timeslicing and, if so, when its timeslice expires.
227 */
228void _Scheduler_priority_Tick( void );
229
230/**
231 *  This is the major bit map.
232 */
233extern volatile Priority_bit_map_Control _Priority_Major_bit_map;
234
235/**
236 *  This is the minor bit map.
237 */
238extern Priority_bit_map_Control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
239
240#ifndef __RTEMS_APPLICATION__
241#include <rtems/score/schedulerpriority.inl>
242#endif
243
244#ifdef __cplusplus
245}
246#endif
247
248/**@}*/
249
250#endif
251/* end of include file */
Note: See TracBrowser for help on using the repository browser.