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

4.115
Last change on this file since a344308 was a344308, checked in by Sebastian Huber <sebastian.huber@…>, on 06/06/13 at 13:32:22

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