source: rtems/cpukit/score/include/rtems/score/schedulerpriority.h @ 63e2ca1b

5
Last change on this file since 63e2ca1b was 63e2ca1b, checked in by Sebastian Huber <sebastian.huber@…>, on 10/31/16 at 08:13:35

score: Simplify yield and unblock scheduler ops

Update #2556.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/**
2 *  @file  rtems/score/schedulerpriority.h
3 *
4 *  @brief Thread Manipulation with the Priority-Based Scheduler
5 *
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.
12 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
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.org/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/prioritybitmap.h>
24#include <rtems/score/scheduler.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 * @defgroup ScoreSchedulerDPS Deterministic Priority Scheduler
32 *
33 * @ingroup ScoreScheduler
34 */
35/**@{*/
36
37/**
38 *  Entry points for the Deterministic Priority Based Scheduler.
39 */
40#define SCHEDULER_PRIORITY_ENTRY_POINTS \
41  { \
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_Update_priority,  /* update priority entry point */ \
48    _Scheduler_default_Map_priority,      /* map priority entry point */ \
49    _Scheduler_default_Unmap_priority,    /* unmap priority entry point */ \
50    SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
51    _Scheduler_priority_Node_initialize,  /* node initialize entry point */ \
52    _Scheduler_default_Node_destroy,      /* node destroy entry point */ \
53    _Scheduler_default_Release_job,       /* new period of task */ \
54    _Scheduler_default_Cancel_job,        /* cancel period of task */ \
55    _Scheduler_default_Tick,              /* tick entry point */ \
56    _Scheduler_default_Start_idle         /* start idle entry point */ \
57    SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
58  }
59
60typedef struct {
61  /**
62   * @brief Basic scheduler context.
63   */
64  Scheduler_Context Base;
65
66  /**
67   * @brief Bit map to indicate non-empty ready queues.
68   */
69  Priority_bit_map_Control Bit_map;
70
71  /**
72   * @brief One ready queue per priority level.
73   */
74  Chain_Control Ready[ 0 ];
75} Scheduler_priority_Context;
76
77/**
78 * @brief Data for ready queue operations.
79 */
80typedef struct {
81  /**
82   * @brief The thread priority currently used by the scheduler.
83   */
84  unsigned int current_priority;
85
86  /** This field points to the Ready FIFO for this thread's priority. */
87  Chain_Control                        *ready_chain;
88
89  /** This field contains precalculated priority map indices. */
90  Priority_bit_map_Information          Priority_map;
91} Scheduler_priority_Ready_queue;
92
93/**
94 * @brief Scheduler node specialization for Deterministic Priority schedulers.
95 */
96typedef struct {
97  /**
98   * @brief Basic scheduler node.
99   */
100  Scheduler_Node Base;
101
102  /**
103   * @brief The associated ready queue of this node.
104   */
105  Scheduler_priority_Ready_queue Ready_queue;
106} Scheduler_priority_Node;
107
108/**
109 * @brief Initializes the priority scheduler.
110 * This routine initializes the priority scheduler.
111 */
112void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler );
113
114void _Scheduler_priority_Block(
115  const Scheduler_Control *scheduler,
116  Thread_Control          *the_thread,
117  Scheduler_Node          *node
118);
119
120/**
121 *  @brief Sets the heir thread to be the next ready thread.
122 *
123 *  This kernel routine sets the heir thread to be the next ready thread
124 *  by invoking the_scheduler->ready_queue->operations->first().
125 */
126void _Scheduler_priority_Schedule(
127  const Scheduler_Control *scheduler,
128  Thread_Control          *the_thread
129);
130
131Scheduler_Void_or_bool _Scheduler_priority_Unblock(
132  const Scheduler_Control *scheduler,
133  Thread_Control          *the_thread,
134  Scheduler_Node          *node
135);
136
137void _Scheduler_priority_Update_priority(
138  const Scheduler_Control *scheduler,
139  Thread_Control          *the_thread,
140  Scheduler_Node          *base_node
141);
142
143void _Scheduler_priority_Node_initialize(
144  const Scheduler_Control *scheduler,
145  Scheduler_Node          *node,
146  Thread_Control          *the_thread,
147  Priority_Control         priority
148);
149
150Scheduler_Void_or_bool _Scheduler_priority_Yield(
151  const Scheduler_Control *scheduler,
152  Thread_Control          *the_thread,
153  Scheduler_Node          *node
154);
155
156/**@}*/
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif
163/* end of include file */
Note: See TracBrowser for help on using the repository browser.