doc: regenerate
[xenomai-head.git] / doc / generated / html / api / sched_8h_source.html
blobcf2dac957cfbc4f203557790f68076a97405397d
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <title>Xenomai API: include/nucleus/sched.h Source File</title>
6 <link href="tabs.css" rel="stylesheet" type="text/css"/>
7 <link href="doxygen.css" rel="stylesheet" type="text/css"/>
8 </head>
9 <body>
10 <!-- Generated by Doxygen 1.7.1 -->
11 <div class="navigation" id="top">
12 <div class="tabs">
13 <ul class="tablist">
14 <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
15 <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
16 <li><a href="modules.html"><span>Modules</span></a></li>
17 <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
18 <li class="current"><a href="files.html"><span>Files</span></a></li>
19 <li><a href="examples.html"><span>Examples</span></a></li>
20 </ul>
21 </div>
22 <div class="tabs2">
23 <ul class="tablist">
24 <li><a href="files.html"><span>File&nbsp;List</span></a></li>
25 <li><a href="globals.html"><span>Globals</span></a></li>
26 </ul>
27 </div>
28 <div class="header">
29 <div class="headertitle">
30 <h1>include/nucleus/sched.h</h1> </div>
31 </div>
32 <div class="contents">
33 <a href="sched_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
34 <a name="l00025"></a>00025 <span class="preprocessor">#ifndef _XENO_NUCLEUS_SCHED_H</span>
35 <a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define _XENO_NUCLEUS_SCHED_H</span>
36 <a name="l00027"></a>00027 <span class="preprocessor"></span>
37 <a name="l00031"></a>00031 <span class="preprocessor">#include &lt;nucleus/thread.h&gt;</span>
38 <a name="l00032"></a>00032
39 <a name="l00033"></a>00033 <span class="preprocessor">#if defined(__KERNEL__) || defined(__XENO_SIM__)</span>
40 <a name="l00034"></a>00034 <span class="preprocessor"></span>
41 <a name="l00035"></a>00035 <span class="preprocessor">#include &lt;nucleus/schedqueue.h&gt;</span>
42 <a name="l00036"></a>00036 <span class="preprocessor">#include &lt;<a class="code" href="sched-tp_8h.html" title="Definitions for the TP scheduling class.">nucleus/sched-tp.h</a>&gt;</span>
43 <a name="l00037"></a>00037 <span class="preprocessor">#include &lt;<a class="code" href="sched-sporadic_8h.html" title="Definitions for the SSP scheduling class.">nucleus/sched-sporadic.h</a>&gt;</span>
44 <a name="l00038"></a>00038 <span class="preprocessor">#include &lt;<a class="code" href="vfile_8h.html" title="This file is part of the Xenomai project.">nucleus/vfile.h</a>&gt;</span>
45 <a name="l00039"></a>00039
46 <a name="l00040"></a>00040 <span class="comment">/* Sched status flags */</span>
47 <a name="l00041"></a>00041 <span class="preprocessor">#define XNKCOUT 0x80000000 </span><span class="comment">/* Sched callout context */</span>
48 <a name="l00042"></a>00042 <span class="preprocessor">#define XNINTCK 0x40000000 </span><span class="comment">/* In master tick handler context */</span>
49 <a name="l00043"></a>00043 <span class="preprocessor">#define XNSWLOCK 0x20000000 </span><span class="comment">/* In context switch */</span>
50 <a name="l00044"></a>00044 <span class="preprocessor">#define XNRESCHED 0x10000000 </span><span class="comment">/* Needs rescheduling */</span>
51 <a name="l00045"></a>00045
52 <a name="l00046"></a>00046 <span class="comment">/* Sched local flags */</span>
53 <a name="l00047"></a>00047 <span class="preprocessor">#define XNHTICK 0x00008000 </span><span class="comment">/* Host tick pending */</span>
54 <a name="l00048"></a>00048 <span class="preprocessor">#define XNINIRQ 0x00004000 </span><span class="comment">/* In IRQ handling context */</span>
55 <a name="l00049"></a>00049 <span class="preprocessor">#define XNHDEFER 0x00002000 </span><span class="comment">/* Host tick deferred */</span>
56 <a name="l00050"></a>00050
57 <a name="l00051"></a>00051 <span class="comment">/* Sched RPI status flags */</span>
58 <a name="l00052"></a>00052 <span class="preprocessor">#define XNRPICK 0x80000000 </span><span class="comment">/* Check RPI state */</span>
59 <a name="l00053"></a>00053
60 <a name="l00054"></a>00054 <span class="keyword">struct </span>xnsched_rt {
61 <a name="l00055"></a>00055 xnsched_queue_t runnable;
62 <a name="l00056"></a>00056 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_PRIOCPL</span>
63 <a name="l00057"></a>00057 <span class="preprocessor"></span> xnsched_queue_t relaxed;
64 <a name="l00058"></a>00058 <span class="preprocessor">#endif </span><span class="comment">/* CONFIG_XENO_OPT_PRIOCPL */</span>
65 <a name="l00059"></a>00059 };
66 <a name="l00060"></a>00060
67 <a name="l00065"></a><a class="code" href="structxnsched.html">00065</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> {
68 <a name="l00066"></a>00066
69 <a name="l00067"></a><a class="code" href="structxnsched.html#ad700d0003b158a60599221047b2fc52e">00067</a> xnflags_t <a class="code" href="structxnsched.html#ad700d0003b158a60599221047b2fc52e">status</a>;
70 <a name="l00068"></a><a class="code" href="structxnsched.html#a4e9ca82832cb0709308e7d78e7f9d694">00068</a> xnflags_t <a class="code" href="structxnsched.html#a4e9ca82832cb0709308e7d78e7f9d694">lflags</a>;
71 <a name="l00069"></a>00069 <span class="keywordtype">int</span> cpu;
72 <a name="l00070"></a><a class="code" href="structxnsched.html#afd2e6c15e470a38b385930c613856e7b">00070</a> <span class="keyword">struct </span>xnthread *<a class="code" href="structxnsched.html#afd2e6c15e470a38b385930c613856e7b">curr</a>;
73 <a name="l00071"></a>00071 <span class="preprocessor">#ifdef CONFIG_SMP</span>
74 <a name="l00072"></a>00072 <span class="preprocessor"></span> xnarch_cpumask_t resched;
75 <a name="l00073"></a>00073 <span class="preprocessor">#endif</span>
76 <a name="l00074"></a>00074 <span class="preprocessor"></span>
77 <a name="l00075"></a><a class="code" href="structxnsched.html#a0890af51db917d0e6c02d1ff487daad5">00075</a> <span class="keyword">struct </span>xnsched_rt <a class="code" href="structxnsched.html#a0890af51db917d0e6c02d1ff487daad5">rt</a>;
78 <a name="l00076"></a>00076 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_SCHED_TP</span>
79 <a name="l00077"></a>00077 <span class="preprocessor"></span> <span class="keyword">struct </span>xnsched_tp tp;
80 <a name="l00078"></a>00078 <span class="preprocessor">#endif</span>
81 <a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#ifdef CONFIG_XENO_OPT_SCHED_SPORADIC</span>
82 <a name="l00080"></a>00080 <span class="preprocessor"></span> <span class="keyword">struct </span>xnsched_sporadic pss;
83 <a name="l00081"></a>00081 <span class="preprocessor">#endif</span>
84 <a name="l00082"></a>00082 <span class="preprocessor"></span>
85 <a name="l00083"></a>00083 xntimerq_t timerqueue; <span class="comment">/* !&lt; Core timer queue. */</span>
86 <a name="l00084"></a><a class="code" href="structxnsched.html#ac9262f830ab6073df75a6f22e905556d">00084</a> <span class="keyword">volatile</span> <span class="keywordtype">unsigned</span> <a class="code" href="structxnsched.html#ac9262f830ab6073df75a6f22e905556d">inesting</a>;
87 <a name="l00085"></a><a class="code" href="structxnsched.html#ae2818d36a93ef25f121c67f2ff34d236">00085</a> <span class="keyword">struct </span>xntimer <a class="code" href="structxnsched.html#ae2818d36a93ef25f121c67f2ff34d236">htimer</a>;
88 <a name="l00086"></a>00086 <span class="keyword">struct </span>xnthread *zombie;
89 <a name="l00087"></a><a class="code" href="structxnsched.html#a0804d68b819bdf478bb74b8baa3954bb">00087</a> <span class="keyword">struct </span>xnthread <a class="code" href="structxnsched.html#a0804d68b819bdf478bb74b8baa3954bb">rootcb</a>;
90 <a name="l00089"></a>00089 <span class="preprocessor">#ifdef CONFIG_XENO_HW_UNLOCKED_SWITCH</span>
91 <a name="l00090"></a>00090 <span class="preprocessor"></span> <span class="keyword">struct </span>xnthread *last;
92 <a name="l00091"></a>00091 <span class="preprocessor">#endif</span>
93 <a name="l00092"></a>00092 <span class="preprocessor"></span>
94 <a name="l00093"></a>00093 <span class="preprocessor">#ifdef CONFIG_XENO_HW_FPU</span>
95 <a name="l00094"></a>00094 <span class="preprocessor"></span> <span class="keyword">struct </span>xnthread *fpuholder;
96 <a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
97 <a name="l00096"></a>00096 <span class="preprocessor"></span>
98 <a name="l00097"></a>00097 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_WATCHDOG</span>
99 <a name="l00098"></a>00098 <span class="preprocessor"></span> <span class="keyword">struct </span>xntimer wdtimer;
100 <a name="l00099"></a>00099 <span class="keywordtype">int</span> wdcount;
101 <a name="l00100"></a>00100 <span class="preprocessor">#endif</span>
102 <a name="l00101"></a>00101 <span class="preprocessor"></span>
103 <a name="l00102"></a>00102 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_STATS</span>
104 <a name="l00103"></a>00103 <span class="preprocessor"></span> xnticks_t last_account_switch;
105 <a name="l00104"></a>00104 xnstat_exectime_t *current_account;
106 <a name="l00105"></a>00105 <span class="preprocessor">#endif</span>
107 <a name="l00106"></a>00106 <span class="preprocessor"></span>
108 <a name="l00107"></a>00107 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_PRIOCPL</span>
109 <a name="l00108"></a>00108 <span class="preprocessor"></span> DECLARE_XNLOCK(rpilock);
110 <a name="l00109"></a>00109 xnflags_t rpistatus;
111 <a name="l00110"></a>00110 <span class="preprocessor">#endif</span>
112 <a name="l00111"></a>00111 <span class="preprocessor"></span>
113 <a name="l00112"></a>00112 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_PERVASIVE</span>
114 <a name="l00113"></a>00113 <span class="preprocessor"></span> <span class="keyword">struct </span>task_struct *gatekeeper;
115 <a name="l00114"></a>00114 <span class="keyword">struct </span>semaphore gksync;
116 <a name="l00115"></a>00115 <span class="keyword">struct </span>xnthread *gktarget;
117 <a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
118 <a name="l00117"></a>00117 <span class="preprocessor"></span>
119 <a name="l00118"></a>00118 } <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched_t</a>;
120 <a name="l00119"></a>00119
121 <a name="l00120"></a>00120 <span class="keyword">union </span>xnsched_policy_param;
122 <a name="l00121"></a>00121
123 <a name="l00122"></a>00122 <span class="keyword">struct </span>xnsched_class {
124 <a name="l00123"></a>00123
125 <a name="l00124"></a>00124 void (*sched_init)(<span class="keyword">struct </span><a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
126 <a name="l00125"></a>00125 void (*sched_enqueue)(<span class="keyword">struct </span>xnthread *thread);
127 <a name="l00126"></a>00126 void (*sched_dequeue)(<span class="keyword">struct </span>xnthread *thread);
128 <a name="l00127"></a>00127 void (*sched_requeue)(<span class="keyword">struct </span>xnthread *thread);
129 <a name="l00128"></a>00128 <span class="keyword">struct </span>xnthread *(*sched_pick)(<span class="keyword">struct </span><a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
130 <a name="l00129"></a>00129 void (*sched_tick)(<span class="keyword">struct </span>xnthread *curr);
131 <a name="l00130"></a>00130 void (*sched_rotate)(<span class="keyword">struct </span><a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched,
132 <a name="l00131"></a>00131 <span class="keyword">const</span> <span class="keyword">union </span>xnsched_policy_param *p);
133 <a name="l00132"></a>00132 void (*sched_migrate)(<span class="keyword">struct </span>xnthread *thread,
134 <a name="l00133"></a>00133 <span class="keyword">struct </span><a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
135 <a name="l00134"></a>00134 void (*sched_setparam)(<span class="keyword">struct </span>xnthread *thread,
136 <a name="l00135"></a>00135 <span class="keyword">const</span> <span class="keyword">union </span>xnsched_policy_param *p);
137 <a name="l00136"></a>00136 void (*sched_getparam)(<span class="keyword">struct </span>xnthread *thread,
138 <a name="l00137"></a>00137 <span class="keyword">union </span>xnsched_policy_param *p);
139 <a name="l00138"></a>00138 void (*sched_trackprio)(<span class="keyword">struct </span>xnthread *thread,
140 <a name="l00139"></a>00139 <span class="keyword">const</span> <span class="keyword">union </span>xnsched_policy_param *p);
141 <a name="l00140"></a>00140 int (*sched_declare)(<span class="keyword">struct </span>xnthread *thread,
142 <a name="l00141"></a>00141 <span class="keyword">const</span> <span class="keyword">union </span>xnsched_policy_param *p);
143 <a name="l00142"></a>00142 void (*sched_forget)(<span class="keyword">struct </span>xnthread *thread);
144 <a name="l00143"></a>00143 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_PRIOCPL</span>
145 <a name="l00144"></a>00144 <span class="preprocessor"></span> <span class="keyword">struct </span>xnthread *(*sched_push_rpi)(<span class="keyword">struct </span><a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched,
146 <a name="l00145"></a>00145 <span class="keyword">struct </span>xnthread *thread);
147 <a name="l00146"></a>00146 void (*sched_pop_rpi)(<span class="keyword">struct </span>xnthread *thread);
148 <a name="l00147"></a>00147 <span class="keyword">struct </span>xnthread *(*sched_peek_rpi)(<span class="keyword">struct </span><a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
149 <a name="l00148"></a>00148 void (*sched_suspend_rpi)(<span class="keyword">struct </span>xnthread *thread);
150 <a name="l00149"></a>00149 void (*sched_resume_rpi)(<span class="keyword">struct </span>xnthread *thread);
151 <a name="l00150"></a>00150 <span class="preprocessor">#endif</span>
152 <a name="l00151"></a>00151 <span class="preprocessor"></span><span class="preprocessor">#ifdef CONFIG_XENO_OPT_VFILE</span>
153 <a name="l00152"></a>00152 <span class="preprocessor"></span> int (*sched_init_vfile)(<span class="keyword">struct </span>xnsched_class *schedclass,
154 <a name="l00153"></a>00153 <span class="keyword">struct </span>xnvfile_directory *vfroot);
155 <a name="l00154"></a>00154 void (*sched_cleanup_vfile)(<span class="keyword">struct </span>xnsched_class *schedclass);
156 <a name="l00155"></a>00155 <span class="preprocessor">#endif</span>
157 <a name="l00156"></a>00156 <span class="preprocessor"></span> <span class="keywordtype">int</span> nthreads;
158 <a name="l00157"></a>00157 <span class="keyword">struct </span>xnsched_class *next;
159 <a name="l00158"></a>00158 <span class="keywordtype">int</span> weight;
160 <a name="l00159"></a>00159 <span class="keyword">const</span> <span class="keywordtype">char</span> *name;
161 <a name="l00160"></a>00160 };
162 <a name="l00161"></a>00161
163 <a name="l00162"></a>00162 <span class="preprocessor">#define XNSCHED_CLASS_MAX_THREADS 32768</span>
164 <a name="l00163"></a>00163 <span class="preprocessor"></span><span class="preprocessor">#define XNSCHED_CLASS_WEIGHT(n) (n * XNSCHED_CLASS_MAX_THREADS)</span>
165 <a name="l00164"></a>00164 <span class="preprocessor"></span>
166 <a name="l00165"></a>00165 <span class="comment">/* Placeholder for current thread priority */</span>
167 <a name="l00166"></a>00166 <span class="preprocessor">#define XNSCHED_RUNPRIO 0x80000000</span>
168 <a name="l00167"></a>00167 <span class="preprocessor"></span>
169 <a name="l00168"></a>00168 <span class="preprocessor">#ifdef CONFIG_SMP</span>
170 <a name="l00169"></a>00169 <span class="preprocessor"></span><span class="preprocessor">#define xnsched_cpu(__sched__) ((__sched__)-&gt;cpu)</span>
171 <a name="l00170"></a>00170 <span class="preprocessor"></span><span class="preprocessor">#else </span><span class="comment">/* !CONFIG_SMP */</span>
172 <a name="l00171"></a>00171 <span class="preprocessor">#define xnsched_cpu(__sched__) ({ (void)__sched__; 0; })</span>
173 <a name="l00172"></a>00172 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* CONFIG_SMP */</span>
174 <a name="l00173"></a>00173
175 <a name="l00174"></a>00174 <span class="comment">/* Test resched flag of given sched. */</span>
176 <a name="l00175"></a>00175 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> xnsched_resched_p(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched)
177 <a name="l00176"></a>00176 {
178 <a name="l00177"></a>00177 <span class="keywordflow">return</span> testbits(sched-&gt;<a class="code" href="structxnsched.html#ad700d0003b158a60599221047b2fc52e">status</a>, XNRESCHED);
179 <a name="l00178"></a>00178 }
180 <a name="l00179"></a>00179
181 <a name="l00180"></a>00180 <span class="comment">/* Set self resched flag for the given scheduler. */</span>
182 <a name="l00181"></a>00181 <span class="preprocessor">#define xnsched_set_self_resched(__sched__) do { \</span>
183 <a name="l00182"></a>00182 <span class="preprocessor"> XENO_BUGON(NUCLEUS, __sched__ != xnpod_current_sched()); \</span>
184 <a name="l00183"></a>00183 <span class="preprocessor"> __setbits((__sched__)-&gt;status, XNRESCHED); \</span>
185 <a name="l00184"></a>00184 <span class="preprocessor">} while (0)</span>
186 <a name="l00185"></a>00185 <span class="preprocessor"></span>
187 <a name="l00186"></a>00186 <span class="comment">/* Set resched flag for the given scheduler. */</span>
188 <a name="l00187"></a>00187 <span class="preprocessor">#ifdef CONFIG_SMP</span>
189 <a name="l00188"></a>00188 <span class="preprocessor"></span><span class="preprocessor">#define xnsched_set_resched(__sched__) do { \</span>
190 <a name="l00189"></a>00189 <span class="preprocessor"> xnsched_t *current_sched = xnpod_current_sched(); \</span>
191 <a name="l00190"></a>00190 <span class="preprocessor"> if (current_sched == (__sched__)) \</span>
192 <a name="l00191"></a>00191 <span class="preprocessor"> __setbits(current_sched-&gt;status, XNRESCHED); \</span>
193 <a name="l00192"></a>00192 <span class="preprocessor"> else if (!xnsched_resched_p(__sched__)) { \</span>
194 <a name="l00193"></a>00193 <span class="preprocessor"> xnarch_cpu_set(xnsched_cpu(__sched__), current_sched-&gt;resched); \</span>
195 <a name="l00194"></a>00194 <span class="preprocessor"> __setbits((__sched__)-&gt;status, XNRESCHED); \</span>
196 <a name="l00195"></a>00195 <span class="preprocessor"> __setbits(current_sched-&gt;status, XNRESCHED); \</span>
197 <a name="l00196"></a>00196 <span class="preprocessor"> } \</span>
198 <a name="l00197"></a>00197 <span class="preprocessor">} while (0)</span>
199 <a name="l00198"></a>00198 <span class="preprocessor"></span><span class="preprocessor">#else </span><span class="comment">/* !CONFIG_SMP */</span>
200 <a name="l00199"></a>00199 <span class="preprocessor">#define xnsched_set_resched xnsched_set_self_resched</span>
201 <a name="l00200"></a>00200 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* !CONFIG_SMP */</span>
202 <a name="l00201"></a>00201
203 <a name="l00202"></a>00202 <span class="keywordtype">void</span> xnsched_zombie_hooks(<span class="keyword">struct</span> xnthread *thread);
204 <a name="l00203"></a>00203
205 <a name="l00204"></a>00204 <span class="keywordtype">void</span> __xnsched_finalize_zombie(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
206 <a name="l00205"></a>00205
207 <a name="l00206"></a>00206 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_finalize_zombie(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched)
208 <a name="l00207"></a>00207 {
209 <a name="l00208"></a>00208 <span class="keywordflow">if</span> (sched-&gt;zombie)
210 <a name="l00209"></a>00209 __xnsched_finalize_zombie(sched);
211 <a name="l00210"></a>00210 }
212 <a name="l00211"></a>00211
213 <a name="l00212"></a>00212 <span class="preprocessor">#ifdef CONFIG_XENO_HW_UNLOCKED_SWITCH</span>
214 <a name="l00213"></a>00213 <span class="preprocessor"></span>
215 <a name="l00214"></a>00214 <span class="keyword">struct </span><a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *xnsched_finish_unlocked_switch(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
216 <a name="l00215"></a>00215
217 <a name="l00216"></a>00216 <span class="preprocessor">#define xnsched_resched_after_unlocked_switch() xnpod_schedule()</span>
218 <a name="l00217"></a>00217 <span class="preprocessor"></span>
219 <a name="l00218"></a>00218 <span class="keyword">static</span> <span class="keyword">inline</span>
220 <a name="l00219"></a>00219 <span class="keywordtype">int</span> xnsched_maybe_resched_after_unlocked_switch(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched)
221 <a name="l00220"></a>00220 {
222 <a name="l00221"></a>00221 <span class="keywordflow">return</span> testbits(sched-&gt;<a class="code" href="structxnsched.html#ad700d0003b158a60599221047b2fc52e">status</a>, XNRESCHED);
223 <a name="l00222"></a>00222 }
224 <a name="l00223"></a>00223
225 <a name="l00224"></a>00224 <span class="preprocessor">#else </span><span class="comment">/* !CONFIG_XENO_HW_UNLOCKED_SWITCH */</span>
226 <a name="l00225"></a>00225
227 <a name="l00226"></a>00226 <span class="preprocessor">#ifdef CONFIG_SMP</span>
228 <a name="l00227"></a>00227 <span class="preprocessor"></span><span class="preprocessor">#define xnsched_finish_unlocked_switch(__sched__) \</span>
229 <a name="l00228"></a>00228 <span class="preprocessor"> ({ XENO_BUGON(NUCLEUS, !irqs_disabled_hw()); \</span>
230 <a name="l00229"></a>00229 <span class="preprocessor"> xnpod_current_sched(); })</span>
231 <a name="l00230"></a>00230 <span class="preprocessor"></span><span class="preprocessor">#else </span><span class="comment">/* !CONFIG_SMP */</span>
232 <a name="l00231"></a>00231 <span class="preprocessor">#define xnsched_finish_unlocked_switch(__sched__) \</span>
233 <a name="l00232"></a>00232 <span class="preprocessor"> ({ XENO_BUGON(NUCLEUS, !irqs_disabled_hw()); \</span>
234 <a name="l00233"></a>00233 <span class="preprocessor"> (__sched__); })</span>
235 <a name="l00234"></a>00234 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* !CONFIG_SMP */</span>
236 <a name="l00235"></a>00235
237 <a name="l00236"></a>00236 <span class="preprocessor">#define xnsched_resched_after_unlocked_switch() do { } while(0)</span>
238 <a name="l00237"></a>00237 <span class="preprocessor"></span>
239 <a name="l00238"></a>00238 <span class="preprocessor">#define xnsched_maybe_resched_after_unlocked_switch(sched) \</span>
240 <a name="l00239"></a>00239 <span class="preprocessor"> ({ (void)(sched); 0; })</span>
241 <a name="l00240"></a>00240 <span class="preprocessor"></span>
242 <a name="l00241"></a>00241 <span class="preprocessor">#endif </span><span class="comment">/* !CONFIG_XENO_HW_UNLOCKED_SWITCH */</span>
243 <a name="l00242"></a>00242
244 <a name="l00243"></a>00243 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_WATCHDOG</span>
245 <a name="l00244"></a>00244 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_reset_watchdog(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched)
246 <a name="l00245"></a>00245 {
247 <a name="l00246"></a>00246 sched-&gt;wdcount = 0;
248 <a name="l00247"></a>00247 }
249 <a name="l00248"></a>00248 <span class="preprocessor">#else </span><span class="comment">/* !CONFIG_XENO_OPT_WATCHDOG */</span>
250 <a name="l00249"></a>00249 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_reset_watchdog(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched)
251 <a name="l00250"></a>00250 {
252 <a name="l00251"></a>00251 }
253 <a name="l00252"></a>00252 <span class="preprocessor">#endif </span><span class="comment">/* CONFIG_XENO_OPT_WATCHDOG */</span>
254 <a name="l00253"></a>00253
255 <a name="l00254"></a>00254 <span class="preprocessor">#include &lt;<a class="code" href="sched-idle_8h.html" title="Definitions for the IDLE scheduling class.">nucleus/sched-idle.h</a>&gt;</span>
256 <a name="l00255"></a>00255 <span class="preprocessor">#include &lt;<a class="code" href="sched-rt_8h.html" title="Definitions for the RT scheduling class.">nucleus/sched-rt.h</a>&gt;</span>
257 <a name="l00256"></a>00256
258 <a name="l00257"></a>00257 <span class="keywordtype">int</span> xnsched_init_proc(<span class="keywordtype">void</span>);
259 <a name="l00258"></a>00258
260 <a name="l00259"></a>00259 <span class="keywordtype">void</span> xnsched_cleanup_proc(<span class="keywordtype">void</span>);
261 <a name="l00260"></a>00260
262 <a name="l00261"></a>00261 <span class="keywordtype">void</span> xnsched_register_classes(<span class="keywordtype">void</span>);
263 <a name="l00262"></a>00262
264 <a name="l00263"></a>00263 <span class="keywordtype">void</span> xnsched_init(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched, <span class="keywordtype">int</span> cpu);
265 <a name="l00264"></a>00264
266 <a name="l00265"></a>00265 <span class="keywordtype">void</span> xnsched_destroy(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
267 <a name="l00266"></a>00266
268 <a name="l00267"></a>00267 <span class="keyword">struct </span>xnthread *xnsched_pick_next(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
269 <a name="l00268"></a>00268
270 <a name="l00269"></a>00269 <span class="keywordtype">void</span> xnsched_putback(<span class="keyword">struct</span> xnthread *thread);
271 <a name="l00270"></a>00270
272 <a name="l00271"></a>00271 <span class="keywordtype">int</span> xnsched_set_policy(<span class="keyword">struct</span> xnthread *thread,
273 <a name="l00272"></a>00272 <span class="keyword">struct</span> xnsched_class *sched_class,
274 <a name="l00273"></a>00273 <span class="keyword">const</span> <span class="keyword">union</span> xnsched_policy_param *p);
275 <a name="l00274"></a>00274
276 <a name="l00275"></a>00275 <span class="keywordtype">void</span> xnsched_track_policy(<span class="keyword">struct</span> xnthread *thread,
277 <a name="l00276"></a>00276 <span class="keyword">struct</span> xnthread *target);
278 <a name="l00277"></a>00277
279 <a name="l00278"></a>00278 <span class="keywordtype">void</span> xnsched_migrate(<span class="keyword">struct</span> xnthread *thread,
280 <a name="l00279"></a>00279 <span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
281 <a name="l00280"></a>00280
282 <a name="l00281"></a>00281 <span class="keywordtype">void</span> xnsched_migrate_passive(<span class="keyword">struct</span> xnthread *thread,
283 <a name="l00282"></a>00282 <span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
284 <a name="l00283"></a>00283
285 <a name="l00315"></a><a class="code" href="group__sched.html#ga4cb702f4a99401c3c1c73811f55e990f">00315</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__sched.html#ga4cb702f4a99401c3c1c73811f55e990f" title="Rotate a scheduler runqueue.">xnsched_rotate</a>(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched,
286 <a name="l00316"></a>00316 <span class="keyword">struct</span> xnsched_class *sched_class,
287 <a name="l00317"></a>00317 <span class="keyword">const</span> <span class="keyword">union</span> xnsched_policy_param *sched_param)
288 <a name="l00318"></a>00318 {
289 <a name="l00319"></a>00319 sched_class-&gt;sched_rotate(sched, sched_param);
290 <a name="l00320"></a>00320 }
291 <a name="l00321"></a>00321
292 <a name="l00322"></a>00322 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> xnsched_init_tcb(<span class="keyword">struct</span> xnthread *thread)
293 <a name="l00323"></a>00323 {
294 <a name="l00324"></a>00324 <span class="keywordtype">int</span> ret = 0;
295 <a name="l00325"></a>00325
296 <a name="l00326"></a>00326 xnsched_idle_init_tcb(thread);
297 <a name="l00327"></a>00327 xnsched_rt_init_tcb(thread);
298 <a name="l00328"></a>00328 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_SCHED_TP</span>
299 <a name="l00329"></a>00329 <span class="preprocessor"></span> ret = xnsched_tp_init_tcb(thread);
300 <a name="l00330"></a>00330 <span class="keywordflow">if</span> (ret)
301 <a name="l00331"></a>00331 <span class="keywordflow">return</span> ret;
302 <a name="l00332"></a>00332 <span class="preprocessor">#endif </span><span class="comment">/* CONFIG_XENO_OPT_SCHED_TP */</span>
303 <a name="l00333"></a>00333 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_SCHED_SPORADIC</span>
304 <a name="l00334"></a>00334 <span class="preprocessor"></span> ret = xnsched_sporadic_init_tcb(thread);
305 <a name="l00335"></a>00335 <span class="keywordflow">if</span> (ret)
306 <a name="l00336"></a>00336 <span class="keywordflow">return</span> ret;
307 <a name="l00337"></a>00337 <span class="preprocessor">#endif </span><span class="comment">/* CONFIG_XENO_OPT_SCHED_SPORADIC */</span>
308 <a name="l00338"></a>00338 <span class="keywordflow">return</span> ret;
309 <a name="l00339"></a>00339 }
310 <a name="l00340"></a>00340
311 <a name="l00341"></a>00341 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> xnsched_root_priority(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched)
312 <a name="l00342"></a>00342 {
313 <a name="l00343"></a>00343 <span class="keywordflow">return</span> sched-&gt;<a class="code" href="structxnsched.html#a0804d68b819bdf478bb74b8baa3954bb">rootcb</a>.cprio;
314 <a name="l00344"></a>00344 }
315 <a name="l00345"></a>00345
316 <a name="l00346"></a>00346 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keyword">struct </span>xnsched_class *xnsched_root_class(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched)
317 <a name="l00347"></a>00347 {
318 <a name="l00348"></a>00348 <span class="keywordflow">return</span> sched-&gt;<a class="code" href="structxnsched.html#a0804d68b819bdf478bb74b8baa3954bb">rootcb</a>.sched_class;
319 <a name="l00349"></a>00349 }
320 <a name="l00350"></a>00350
321 <a name="l00351"></a>00351 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_tick(<span class="keyword">struct</span> xnthread *curr, <span class="keyword">struct</span> xntbase *tbase)
322 <a name="l00352"></a>00352 {
323 <a name="l00353"></a>00353 <span class="keyword">struct </span>xnsched_class *sched_class = curr-&gt;sched_class;
324 <a name="l00354"></a>00354 <span class="comment">/*</span>
325 <a name="l00355"></a>00355 <span class="comment"> * A thread that undergoes round-robin scheduling only</span>
326 <a name="l00356"></a>00356 <span class="comment"> * consumes its time slice when it runs within its own</span>
327 <a name="l00357"></a>00357 <span class="comment"> * scheduling class, which excludes temporary PIP boosts.</span>
328 <a name="l00358"></a>00358 <span class="comment"> */</span>
329 <a name="l00359"></a>00359 <span class="keywordflow">if</span> (xnthread_time_base(curr) == tbase &amp;&amp;
330 <a name="l00360"></a>00360 sched_class != &amp;xnsched_class_idle &amp;&amp;
331 <a name="l00361"></a>00361 sched_class == curr-&gt;base_class &amp;&amp;
332 <a name="l00362"></a>00362 xnthread_test_state(curr, XNTHREAD_BLOCK_BITS|<a class="code" href="group__nucleus__state__flags.html#ga2defcfb1f04f077baeac9881cbdda627" title="Holds the scheduler lock (i.e.">XNLOCK</a>|<a class="code" href="group__nucleus__state__flags.html#ga6f451131910f816dd01fe1ec1fb50fe9" title="Undergoes a round-robin scheduling.">XNRRB</a>) == <a class="code" href="group__nucleus__state__flags.html#ga6f451131910f816dd01fe1ec1fb50fe9" title="Undergoes a round-robin scheduling.">XNRRB</a>)
333 <a name="l00363"></a>00363 sched_class-&gt;sched_tick(curr);
334 <a name="l00364"></a>00364 }
335 <a name="l00365"></a>00365
336 <a name="l00366"></a>00366 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_SCHED_CLASSES</span>
337 <a name="l00367"></a>00367 <span class="preprocessor"></span>
338 <a name="l00368"></a>00368 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_enqueue(<span class="keyword">struct</span> xnthread *thread)
339 <a name="l00369"></a>00369 {
340 <a name="l00370"></a>00370 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
341 <a name="l00371"></a>00371
342 <a name="l00372"></a>00372 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
343 <a name="l00373"></a>00373 sched_class-&gt;sched_enqueue(thread);
344 <a name="l00374"></a>00374 }
345 <a name="l00375"></a>00375
346 <a name="l00376"></a>00376 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_dequeue(<span class="keyword">struct</span> xnthread *thread)
347 <a name="l00377"></a>00377 {
348 <a name="l00378"></a>00378 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
349 <a name="l00379"></a>00379
350 <a name="l00380"></a>00380 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
351 <a name="l00381"></a>00381 sched_class-&gt;sched_dequeue(thread);
352 <a name="l00382"></a>00382 }
353 <a name="l00383"></a>00383
354 <a name="l00384"></a>00384 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_requeue(<span class="keyword">struct</span> xnthread *thread)
355 <a name="l00385"></a>00385 {
356 <a name="l00386"></a>00386 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
357 <a name="l00387"></a>00387
358 <a name="l00388"></a>00388 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
359 <a name="l00389"></a>00389 sched_class-&gt;sched_requeue(thread);
360 <a name="l00390"></a>00390 }
361 <a name="l00391"></a>00391
362 <a name="l00392"></a>00392 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> xnsched_weighted_bprio(<span class="keyword">struct</span> xnthread *thread)
363 <a name="l00393"></a>00393 {
364 <a name="l00394"></a>00394 <span class="keywordflow">return</span> thread-&gt;bprio + thread-&gt;sched_class-&gt;weight;
365 <a name="l00395"></a>00395 }
366 <a name="l00396"></a>00396
367 <a name="l00397"></a>00397 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> xnsched_weighted_cprio(<span class="keyword">struct</span> xnthread *thread)
368 <a name="l00398"></a>00398 {
369 <a name="l00399"></a>00399 <span class="keywordflow">return</span> thread-&gt;cprio + thread-&gt;sched_class-&gt;weight;
370 <a name="l00400"></a>00400 }
371 <a name="l00401"></a>00401
372 <a name="l00402"></a>00402 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_setparam(<span class="keyword">struct</span> xnthread *thread,
373 <a name="l00403"></a>00403 <span class="keyword">const</span> <span class="keyword">union</span> xnsched_policy_param *p)
374 <a name="l00404"></a>00404 {
375 <a name="l00405"></a>00405 thread-&gt;sched_class-&gt;sched_setparam(thread, p);
376 <a name="l00406"></a>00406 }
377 <a name="l00407"></a>00407
378 <a name="l00408"></a>00408 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_getparam(<span class="keyword">struct</span> xnthread *thread,
379 <a name="l00409"></a>00409 <span class="keyword">union</span> xnsched_policy_param *p)
380 <a name="l00410"></a>00410 {
381 <a name="l00411"></a>00411 thread-&gt;sched_class-&gt;sched_getparam(thread, p);
382 <a name="l00412"></a>00412 }
383 <a name="l00413"></a>00413
384 <a name="l00414"></a>00414 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_trackprio(<span class="keyword">struct</span> xnthread *thread,
385 <a name="l00415"></a>00415 <span class="keyword">const</span> <span class="keyword">union</span> xnsched_policy_param *p)
386 <a name="l00416"></a>00416 {
387 <a name="l00417"></a>00417 thread-&gt;sched_class-&gt;sched_trackprio(thread, p);
388 <a name="l00418"></a>00418 }
389 <a name="l00419"></a>00419
390 <a name="l00420"></a>00420 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_forget(<span class="keyword">struct</span> xnthread *thread)
391 <a name="l00421"></a>00421 {
392 <a name="l00422"></a>00422 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;base_class;
393 <a name="l00423"></a>00423
394 <a name="l00424"></a>00424 --sched_class-&gt;nthreads;
395 <a name="l00425"></a>00425
396 <a name="l00426"></a>00426 <span class="keywordflow">if</span> (sched_class-&gt;sched_forget)
397 <a name="l00427"></a>00427 sched_class-&gt;sched_forget(thread);
398 <a name="l00428"></a>00428 }
399 <a name="l00429"></a>00429
400 <a name="l00430"></a>00430 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_PRIOCPL</span>
401 <a name="l00431"></a>00431 <span class="preprocessor"></span>
402 <a name="l00432"></a>00432 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keyword">struct </span>xnthread *xnsched_push_rpi(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched,
403 <a name="l00433"></a>00433 <span class="keyword">struct</span> xnthread *thread)
404 <a name="l00434"></a>00434 {
405 <a name="l00435"></a>00435 <span class="keywordflow">return</span> thread-&gt;sched_class-&gt;sched_push_rpi(sched, thread);
406 <a name="l00436"></a>00436 }
407 <a name="l00437"></a>00437
408 <a name="l00438"></a>00438 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_pop_rpi(<span class="keyword">struct</span> xnthread *thread)
409 <a name="l00439"></a>00439 {
410 <a name="l00440"></a>00440 thread-&gt;sched_class-&gt;sched_pop_rpi(thread);
411 <a name="l00441"></a>00441 }
412 <a name="l00442"></a>00442
413 <a name="l00443"></a>00443 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_suspend_rpi(<span class="keyword">struct</span> xnthread *thread)
414 <a name="l00444"></a>00444 {
415 <a name="l00445"></a>00445 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
416 <a name="l00446"></a>00446
417 <a name="l00447"></a>00447 <span class="keywordflow">if</span> (sched_class-&gt;sched_suspend_rpi)
418 <a name="l00448"></a>00448 sched_class-&gt;sched_suspend_rpi(thread);
419 <a name="l00449"></a>00449 }
420 <a name="l00450"></a>00450
421 <a name="l00451"></a>00451 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_resume_rpi(<span class="keyword">struct</span> xnthread *thread)
422 <a name="l00452"></a>00452 {
423 <a name="l00453"></a>00453 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
424 <a name="l00454"></a>00454
425 <a name="l00455"></a>00455 <span class="keywordflow">if</span> (sched_class-&gt;sched_resume_rpi)
426 <a name="l00456"></a>00456 sched_class-&gt;sched_resume_rpi(thread);
427 <a name="l00457"></a>00457 }
428 <a name="l00458"></a>00458
429 <a name="l00459"></a>00459 <span class="preprocessor">#endif </span><span class="comment">/* CONFIG_XENO_OPT_PRIOCPL */</span>
430 <a name="l00460"></a>00460
431 <a name="l00461"></a>00461 <span class="preprocessor">#else </span><span class="comment">/* !CONFIG_XENO_OPT_SCHED_CLASSES */</span>
432 <a name="l00462"></a>00462
433 <a name="l00463"></a>00463 <span class="comment">/*</span>
434 <a name="l00464"></a>00464 <span class="comment"> * If only the RT and IDLE scheduling classes are compiled in, we can</span>
435 <a name="l00465"></a>00465 <span class="comment"> * fully inline common helpers for dealing with those.</span>
436 <a name="l00466"></a>00466 <span class="comment"> */</span>
437 <a name="l00467"></a>00467
438 <a name="l00468"></a>00468 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_enqueue(<span class="keyword">struct</span> xnthread *thread)
439 <a name="l00469"></a>00469 {
440 <a name="l00470"></a>00470 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
441 <a name="l00471"></a>00471
442 <a name="l00472"></a>00472 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
443 <a name="l00473"></a>00473 __xnsched_rt_enqueue(thread);
444 <a name="l00474"></a>00474 }
445 <a name="l00475"></a>00475
446 <a name="l00476"></a>00476 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_dequeue(<span class="keyword">struct</span> xnthread *thread)
447 <a name="l00477"></a>00477 {
448 <a name="l00478"></a>00478 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
449 <a name="l00479"></a>00479
450 <a name="l00480"></a>00480 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
451 <a name="l00481"></a>00481 __xnsched_rt_dequeue(thread);
452 <a name="l00482"></a>00482 }
453 <a name="l00483"></a>00483
454 <a name="l00484"></a>00484 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_requeue(<span class="keyword">struct</span> xnthread *thread)
455 <a name="l00485"></a>00485 {
456 <a name="l00486"></a>00486 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
457 <a name="l00487"></a>00487
458 <a name="l00488"></a>00488 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
459 <a name="l00489"></a>00489 __xnsched_rt_requeue(thread);
460 <a name="l00490"></a>00490 }
461 <a name="l00491"></a>00491
462 <a name="l00492"></a>00492 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> xnsched_weighted_bprio(<span class="keyword">struct</span> xnthread *thread)
463 <a name="l00493"></a>00493 {
464 <a name="l00494"></a>00494 <span class="keywordflow">return</span> thread-&gt;bprio;
465 <a name="l00495"></a>00495 }
466 <a name="l00496"></a>00496
467 <a name="l00497"></a>00497 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> xnsched_weighted_cprio(<span class="keyword">struct</span> xnthread *thread)
468 <a name="l00498"></a>00498 {
469 <a name="l00499"></a>00499 <span class="keywordflow">return</span> thread-&gt;cprio;
470 <a name="l00500"></a>00500 }
471 <a name="l00501"></a>00501
472 <a name="l00502"></a>00502 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_setparam(<span class="keyword">struct</span> xnthread *thread,
473 <a name="l00503"></a>00503 <span class="keyword">const</span> <span class="keyword">union</span> xnsched_policy_param *p)
474 <a name="l00504"></a>00504 {
475 <a name="l00505"></a>00505 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
476 <a name="l00506"></a>00506
477 <a name="l00507"></a>00507 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
478 <a name="l00508"></a>00508 __xnsched_rt_setparam(thread, p);
479 <a name="l00509"></a>00509 <span class="keywordflow">else</span>
480 <a name="l00510"></a>00510 __xnsched_idle_setparam(thread, p);
481 <a name="l00511"></a>00511 }
482 <a name="l00512"></a>00512
483 <a name="l00513"></a>00513 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_getparam(<span class="keyword">struct</span> xnthread *thread,
484 <a name="l00514"></a>00514 <span class="keyword">union</span> xnsched_policy_param *p)
485 <a name="l00515"></a>00515 {
486 <a name="l00516"></a>00516 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
487 <a name="l00517"></a>00517
488 <a name="l00518"></a>00518 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
489 <a name="l00519"></a>00519 __xnsched_rt_getparam(thread, p);
490 <a name="l00520"></a>00520 <span class="keywordflow">else</span>
491 <a name="l00521"></a>00521 __xnsched_idle_getparam(thread, p);
492 <a name="l00522"></a>00522 }
493 <a name="l00523"></a>00523
494 <a name="l00524"></a>00524 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_trackprio(<span class="keyword">struct</span> xnthread *thread,
495 <a name="l00525"></a>00525 <span class="keyword">const</span> <span class="keyword">union</span> xnsched_policy_param *p)
496 <a name="l00526"></a>00526 {
497 <a name="l00527"></a>00527 <span class="keyword">struct </span>xnsched_class *sched_class = thread-&gt;sched_class;
498 <a name="l00528"></a>00528
499 <a name="l00529"></a>00529 <span class="keywordflow">if</span> (sched_class != &amp;xnsched_class_idle)
500 <a name="l00530"></a>00530 __xnsched_rt_trackprio(thread, p);
501 <a name="l00531"></a>00531 <span class="keywordflow">else</span>
502 <a name="l00532"></a>00532 __xnsched_idle_trackprio(thread, p);
503 <a name="l00533"></a>00533 }
504 <a name="l00534"></a>00534
505 <a name="l00535"></a>00535 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_forget(<span class="keyword">struct</span> xnthread *thread)
506 <a name="l00536"></a>00536 {
507 <a name="l00537"></a>00537 --thread-&gt;base_class-&gt;nthreads;
508 <a name="l00538"></a>00538 __xnsched_rt_forget(thread);
509 <a name="l00539"></a>00539 }
510 <a name="l00540"></a>00540
511 <a name="l00541"></a>00541 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_PRIOCPL</span>
512 <a name="l00542"></a>00542 <span class="preprocessor"></span>
513 <a name="l00543"></a>00543 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keyword">struct </span>xnthread *xnsched_push_rpi(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched,
514 <a name="l00544"></a>00544 <span class="keyword">struct</span> xnthread *thread)
515 <a name="l00545"></a>00545 {
516 <a name="l00546"></a>00546 <span class="keywordflow">return</span> __xnsched_rt_push_rpi(sched, thread);
517 <a name="l00547"></a>00547 }
518 <a name="l00548"></a>00548
519 <a name="l00549"></a>00549 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_pop_rpi(<span class="keyword">struct</span> xnthread *thread)
520 <a name="l00550"></a>00550 {
521 <a name="l00551"></a>00551 __xnsched_rt_pop_rpi(thread);
522 <a name="l00552"></a>00552 }
523 <a name="l00553"></a>00553
524 <a name="l00554"></a>00554 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_suspend_rpi(<span class="keyword">struct</span> xnthread *thread)
525 <a name="l00555"></a>00555 {
526 <a name="l00556"></a>00556 __xnsched_rt_suspend_rpi(thread);
527 <a name="l00557"></a>00557 }
528 <a name="l00558"></a>00558
529 <a name="l00559"></a>00559 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> xnsched_resume_rpi(<span class="keyword">struct</span> xnthread *thread)
530 <a name="l00560"></a>00560 {
531 <a name="l00561"></a>00561 __xnsched_rt_resume_rpi(thread);
532 <a name="l00562"></a>00562 }
533 <a name="l00563"></a>00563
534 <a name="l00564"></a>00564 <span class="preprocessor">#endif </span><span class="comment">/* CONFIG_XENO_OPT_PRIOCPL */</span>
535 <a name="l00565"></a>00565
536 <a name="l00566"></a>00566 <span class="preprocessor">#endif </span><span class="comment">/* !CONFIG_XENO_OPT_SCHED_CLASSES */</span>
537 <a name="l00567"></a>00567
538 <a name="l00568"></a>00568 <span class="keywordtype">void</span> xnsched_renice_root(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched,
539 <a name="l00569"></a>00569 <span class="keyword">struct</span> xnthread *target);
540 <a name="l00570"></a>00570
541 <a name="l00571"></a>00571 <span class="keyword">struct </span>xnthread *xnsched_peek_rpi(<span class="keyword">struct</span> <a class="code" href="structxnsched.html" title="Scheduling information structure.">xnsched</a> *sched);
542 <a name="l00572"></a>00572
543 <a name="l00573"></a>00573 <span class="preprocessor">#else </span><span class="comment">/* !(__KERNEL__ || __XENO_SIM__) */</span>
544 <a name="l00574"></a>00574
545 <a name="l00575"></a>00575 <span class="preprocessor">#include &lt;<a class="code" href="sched-idle_8h.html" title="Definitions for the IDLE scheduling class.">nucleus/sched-idle.h</a>&gt;</span>
546 <a name="l00576"></a>00576 <span class="preprocessor">#include &lt;<a class="code" href="sched-rt_8h.html" title="Definitions for the RT scheduling class.">nucleus/sched-rt.h</a>&gt;</span>
547 <a name="l00577"></a>00577
548 <a name="l00578"></a>00578 <span class="preprocessor">#endif </span><span class="comment">/* !(__KERNEL__ || __XENO_SIM__) */</span>
549 <a name="l00579"></a>00579
550 <a name="l00582"></a>00582 <span class="preprocessor">#endif </span><span class="comment">/* !_XENO_NUCLEUS_SCHED_H */</span>
551 </pre></div></div>
552 </div>
553 <hr class="footer"/><address class="footer"><small>Generated on Wed Nov 2 2011 18:01:06 for Xenomai API by&nbsp;
554 <a href="http://www.doxygen.org/index.html">
555 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
556 </body>
557 </html>