source: rtems/cpukit/score/include/rtems/score/schedulerpriority.h @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 6.5 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 *  This routine removes @a the_thread from the scheduling decision,
73 *  that is, removes it from the ready queue.  It performs
74 *  any necessary scheduling operations including the selection of
75 *  a new heir thread.
76 *
77 *  @param[in] the_thread is the thread to be blocked
78 */
79void _Scheduler_priority_Block(
80  Thread_Control    *the_thread
81);
82
83/**
84 *  This kernel routine sets the heir thread to be the next ready thread
85 *  by invoking the_scheduler->ready_queue->operations->first().
86 */
87void _Scheduler_priority_Schedule(void);
88
89/**
90 *  This routine allocates @a the_thread->scheduler.
91 *
92 *  @param[in] the_thread is the thread the scheduler is allocating
93 *             management memory for
94 */
95void * _Scheduler_priority_Allocate(
96  Thread_Control      *the_thread
97);
98
99/**
100 *  This routine frees @a the_thread->scheduler.
101 *
102 *  @param[in] the_thread is the thread whose scheduler specific information
103 *             will be deallocated.
104 */
105void _Scheduler_priority_Free(
106  Thread_Control      *the_thread
107);
108
109/**
110 *  This routine updates @a the_thread->scheduler based on @a the_scheduler
111 *  structures and thread state.
112 *
113 *  @param[in] the_thread will have its scheduler specific information
114 *             structure updated.
115 */
116void _Scheduler_priority_Update(
117  Thread_Control      *the_thread
118);
119
120/**
121 *  This routine adds @a the_thread to the scheduling decision,
122 *  that is, adds it to the ready queue and
123 *  updates any appropriate scheduling variables, for example the heir thread.
124 *
125 *  @param[in] the_thread will be unblocked
126 */
127void _Scheduler_priority_Unblock(
128  Thread_Control    *the_thread
129);
130
131/**
132 *  This routine is invoked when a thread wishes to voluntarily
133 *  transfer control of the processor to another thread in the queue.
134 *
135 *  This routine will remove the running THREAD from the ready queue
136 *  and place it immediately at the rear of this chain.  Reset timeslice
137 *  and yield the processor functions both use this routine, therefore if
138 *  reset is true and this is the only thread on the queue then the
139 *  timeslice counter is reset.  The heir THREAD will be updated if the
140 *  running is also the currently the heir.
141 */
142void _Scheduler_priority_Yield( void );
143
144/**
145 *  This routine puts @a the_thread on to the priority-based ready queue.
146 *
147 *  @param[in] the_thread will be enqueued at the TAIL of its priority.
148 */
149void _Scheduler_priority_Enqueue(
150  Thread_Control    *the_thread
151);
152
153/**
154 *  This routine puts @a the_thread to the head of the ready queue.
155 *  For priority-based ready queues, the thread will be the first thread
156 *  at its priority level.
157 *
158 *  @param[in] the_thread will be enqueued at the HEAD of its priority.
159 */
160void _Scheduler_priority_Enqueue_first(
161  Thread_Control    *the_thread
162);
163
164/**
165 *  This routine removes a specific thread from the scheduler's set
166 *  of ready threads.
167 *
168 *  @param[in] the_thread will be extracted from the ready set.
169 */
170void _Scheduler_priority_Extract(
171  Thread_Control     *the_thread
172);
173
174/**
175 *  @brief Scheduler priority Priority compare
176 *
177 *  This routine compares two priorities.
178 */
179int _Scheduler_priority_Priority_compare(
180  Priority_Control      p1,
181  Priority_Control      p2
182);
183
184/**
185 *  @brief Scheduler priority Release job
186 *
187 *  This routine is called when a new job of task is released.
188 *
189 *  @param[in] the_thread is the owner of the job.
190 *  @param[in] deadline of the new job from now. If equal to 0,
191 *             the job was cancelled or deleted.
192 */
193void _Scheduler_priority_Release_job (
194  Thread_Control  *the_thread,
195  uint32_t         deadline
196);
197
198/**
199 *  @brief Deterministic Priority Scheduler Tick Method
200 *
201 *  This routine is invoked as part of processing each clock tick.
202 *  It is responsible for determining if the current thread allows
203 *  timeslicing and, if so, when its timeslice expires.
204 */
205void _Scheduler_priority_Tick( void );
206
207/**
208 *  This is the major bit map.
209 */
210extern volatile Priority_bit_map_Control _Priority_Major_bit_map;
211
212/**
213 *  This is the minor bit map.
214 */
215extern Priority_bit_map_Control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
216
217#ifndef __RTEMS_APPLICATION__
218#include <rtems/score/schedulerpriority.inl>
219#endif
220
221#ifdef __cplusplus
222}
223#endif
224
225/**@}*/
226
227#endif
228/* end of include file */
Note: See TracBrowser for help on using the repository browser.