<areashape="rect"id="node1"href="group__base.html"title="Base Kernel Services"alt=""coords="7,7,132,33"/><areashape="rect"id="node2"href="group___s_t_m8___c_o_r_e.html"title="STM8 specific port code, structures and macros."alt=""coords="356,7,495,33"/></map>
<p>This module provides the default portable scheduler code, scheduler functions can be individually captured by the port layer in order to provide architecture optimized equivalents. When a function is captured its default code is not built into the OS image, the optimized version is included instead. </p>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Low level message sent to a thread awakened by a timeout. <ahref="#gaf28d5427eeeb8f737cc7db495157780c"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Low level message sent to a thread awakened by a reset operation. <ahref="#ga3a606c833796229f23adcb3f6c404a81"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Zero time specification for some syscalls with a timeout specification. <ahref="#gad1ac15e9e5fc17810a94a779257f3d29"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Infinite time specification for all the syscalls with a timeout specification. <ahref="#gae1568cf3090c973c3bc47f86ae2f5afb"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the priority of the first thread on the given ready list. <ahref="#gaa3e744fe83212f48d7373b764b9abb2d"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Determines if the current thread must reschedule. <ahref="#ga146230c1fe7e6dab4bc6649f2a71444c"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Determines if yielding is possible. <ahref="#gac45d5a97963db4129d95645429e2dd8b"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Inserts a thread in the Ready List. <ahref="#ga535d58cfb3436c8d4e4586c31c062298"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Puts the current thread to sleep into the specified state. <ahref="#ga97c1c514b755a1e71caf2f19c1ccf986"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Puts the current thread to sleep into the specified state with timeout specification. <ahref="#ga306e564f678c1a39139639490c77e78b"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Switches to the first thread on the runnable queue. <ahref="#ga0257cf203e72a766a52059750cb97e6e"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Performs a reschedule if a higher priority thread is runnable. <ahref="#ga4e38b4bee3d2330f6a0f1cdb7660af20"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Evaluates if a reschedule is required. <ahref="#ga5fa012ef9d1e920983fe2aea2695a52a"></a><br/></td></tr>
<p>Referenced by <aclass="el"href="group___a_d_c.html#ga026ac46dfe36031ab177e35f3aff5b09">adcWaitConversion()</a>, <aclass="el"href="group__condvars.html#ga9cf6ebe4c9f28cb206fab14984a18d29">chCondWaitTimeoutS()</a>, <aclass="el"href="group___m_a_c.html#ga151a33674ef86c2403ac7797fa87805c">macWaitReceiveDescriptor()</a>, and <aclass="el"href="group___m_a_c.html#ga7304721038db1d7c0cb616c9c4d3f0ce">macWaitTransmitDescriptor()</a>.</p>
<p>Referenced by <aclass="el"href="group__threads.html#gac6de13d4044b32d3ae9e2066b5d4c030">chThdCreateI()</a>, and <aclass="el"href="group__threads.html#ga5a5d9388c64e4c1a3aec129d2831eefe">chThdSetPriority()</a>.</p>
<p>Zero time specification for some syscalls with a timeout specification. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>Not all functions accept <code>TIME_IMMEDIATE</code> as timeout parameter, see the specific function documentation. </dd></dl>
<p>Definition at line <aclass="el"href="chschd_8h_source.html#l00058">58</a> of file <aclass="el"href="chschd_8h_source.html">chschd.h</a>.</p>
<p>Referenced by <aclass="el"href="group__events.html#ga90d702300eecee3d05f83e95b155c3ee">chEvtWaitAllTimeout()</a>, <aclass="el"href="group__events.html#gaf690406ccc833e2c9235e7e2041a6715">chEvtWaitAnyTimeout()</a>, <aclass="el"href="group__events.html#ga2944a7fc82e7cc15537f5a7c04f457d3">chEvtWaitOneTimeout()</a>, and <aclass="el"href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03">chSemWaitTimeoutS()</a>.</p>
<p>Infinite time specification for all the syscalls with a timeout specification. </p>
<p>Definition at line <aclass="el"href="chschd_8h_source.html#l00064">64</a> of file <aclass="el"href="chschd_8h_source.html">chschd.h</a>.</p>
<p>Referenced by <aclass="el"href="group__scheduler.html#ga306e564f678c1a39139639490c77e78b">chSchGoSleepTimeoutS()</a>, <aclass="el"href="group__threads.html#ga8b10a49e2ec522a5ddecabdc453afcab">chThdSleep()</a>, <aclass="el"href="group__time.html#ga1c44c3a0bc64b2954d95cd98b2e7124e">chVTSetI()</a>, <aclass="el"href="group___m_a_c.html#ga151a33674ef86c2403ac7797fa87805c">macWaitReceiveDescriptor()</a>, and <aclass="el"href="group___m_a_c.html#ga7304721038db1d7c0cb616c9c4d3f0ce">macWaitTransmitDescriptor()</a>.</p>
<dlclass="note"><dt><b>Note:</b></dt><dd>This macro is not meant to be used in the application code but only from within the kernel, use the <code><aclass="el"href="group__threads.html#gaa36662628234799d205ff8c0cc6745c5"title="Returns a pointer to the current Thread.">chThdSelf()</a></code> API instead. </dd>
<dd>
It is forbidden to use this macro in order to change the pointer (currp = something), use <code><aclass="el"href="group__scheduler.html#ga226bd98a30b2db31dbb1ecc572c18da2"title="Current thread pointer change macro.">setcurrp()</a></code> instead. </dd></dl>
<p>Definition at line <aclass="el"href="chschd_8h_source.html#l00111">111</a> of file <aclass="el"href="chschd_8h_source.html">chschd.h</a>.</p>
<dlclass="note"><dt><b>Note:</b></dt><dd>This macro is not meant to be used in the application code but only from within the kernel. </dd></dl>
<p>Definition at line <aclass="el"href="chschd_8h_source.html#l00123">123</a> of file <aclass="el"href="chschd_8h_source.html">chschd.h</a>.</p>
<p>Referenced by <aclass="el"href="group__scheduler.html#ga0257cf203e72a766a52059750cb97e6e">chSchDoRescheduleI()</a>, <aclass="el"href="group__scheduler.html#ga97c1c514b755a1e71caf2f19c1ccf986">chSchGoSleepS()</a>, <aclass="el"href="group__scheduler.html#gae47a8819a21ef2d521124e76bfb37c95">chSchWakeupS()</a>, and <aclass="el"href="group__system.html#gafe2c7de6567e98e487e009e81e3be10b">chSysInit()</a>.</p>
<spanclass="keywordflow">if</span> (<aclass="code"href="group__scheduler.html#gac45d5a97963db4129d95645429e2dd8b"title="Determines if yielding is possible.">chSchCanYieldS</a>()) \
<aclass="code"href="group__scheduler.html#ga0257cf203e72a766a52059750cb97e6e"title="Switches to the first thread on the runnable queue.">chSchDoRescheduleI</a>(); \
}
</pre></div>
<p>Yields the time slot. </p>
<p>Yields the CPU control to the next thread in the ready list with equal or higher priority, if any. </p>
<p>Definition at line <aclass="el"href="chschd_8h_source.html#l00182">182</a> of file <aclass="el"href="chschd_8h_source.html">chschd.h</a>.</p>
<p>Referenced by <aclass="el"href="group__threads.html#gacb0a8f22a8358487eaebab3c84b1c4a1">chThdYield()</a>.</p>
<dlclass="note"><dt><b>Note:</b></dt><dd>Internally invoked by the <code><aclass="el"href="group__system.html#gafe2c7de6567e98e487e009e81e3be10b"title="ChibiOS/RT initialization.">chSysInit()</a></code>, not an API. </dd></dl>
<p>Definition at line <aclass="el"href="chschd_8c_source.html#l00053">53</a> of file <aclass="el"href="chschd_8c_source.html">chschd.c</a>.</p>
<dlclass="note"><dt><b>Note:</b></dt><dd>The function does not reschedule, the <code><aclass="el"href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20"title="Performs a reschedule if a higher priority thread is runnable.">chSchRescheduleS()</a></code> should be called soon after.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>tp</em> </td><td>the <aclass="el"href="struct_thread.html"title="Structure representing a thread.">Thread</a> to be made ready </td></tr>
</table>
</dd>
</dl>
<dlclass="return"><dt><b>Returns:</b></dt><dd>The <aclass="el"href="struct_thread.html"title="Structure representing a thread.">Thread</a> pointer. </dd></dl>
<p>Definition at line <aclass="el"href="chschd_8c_source.html#l00078">78</a> of file <aclass="el"href="chschd_8c_source.html">chschd.c</a>.</p>
<p>References <aclass="el"href="struct_thread.html#a49d3270919a6e423a47de20bc57beaa1">Thread::p_next</a>, <aclass="el"href="struct_thread.html#a3c3e9d6abccb62c3a5fab6ef043a391f">Thread::p_state</a>, and <aclass="el"href="struct_ready_list.html#a7577e36ac8500b0364cd3d4157e260d1">ReadyList::r_queue</a>.</p>
<p>Puts the current thread to sleep into the specified state. </p>
<p>The thread goes into a sleeping state. The <aclass="el"href="concepts.html#thread_states">Threads States</a> are described into <code>threads.h</code>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>newstate</em> </td><td>the new thread state </td></tr>
<areashape="rect"id="node3"href="group__debug.html#gac7f8f0653faf2e3a93108ff5333821b7"title="Inserts in the circular debug trace buffer a context switch record."alt=""coords="156,5,236,32"/><areashape="rect"id="node5"href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a"title="Removes the first-out Thread from a queue and returns it."alt=""coords="156,56,236,83"/></map>
<p>Puts the current thread to sleep into the specified state with timeout specification. </p>
<p>The thread goes into a sleeping state, if it is not awakened explicitly within the specified timeout then it is forcibly awakened with a <code>RDY_TIMEOUT</code> low level message. The <aclass="el"href="concepts.html#thread_states">Threads States</a> are described into <code>threads.h</code>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>newstate</em> </td><td>the new thread state </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>time</em> </td><td>the number of ticks before the operation timeouts, the special values are handled as follow:</p>
<ul>
<li><em>TIME_INFINITE</em> the thread enters an infinite sleep state, this is equivalent to invoking <code><aclass="el"href="group__scheduler.html#ga97c1c514b755a1e71caf2f19c1ccf986"title="Puts the current thread to sleep into the specified state.">chSchGoSleepS()</a></code> but, of course, less efficient.</li>
<li><em>TIME_IMMEDIATE</em> this value is accepted but interpreted as a normal time specification not as an immediate timeout specification.</li>
<p>References <aclass="el"href="group__scheduler.html#ga97c1c514b755a1e71caf2f19c1ccf986">chSchGoSleepS()</a>, <aclass="el"href="group__time.html#gae54e6dd40bc7b9cdeb409393ec9e134a">chVTIsArmedI</a>, <aclass="el"href="group__time.html#ga680d851a74e594cc965101e79891840f">chVTResetI()</a>, <aclass="el"href="group__time.html#ga1c44c3a0bc64b2954d95cd98b2e7124e">chVTSetI()</a>, <aclass="el"href="group__scheduler.html#ga1a5fddde56420e8accd0c09c1abb32a7">currp</a>, and <aclass="el"href="group__scheduler.html#gae1568cf3090c973c3bc47f86ae2f5afb">TIME_INFINITE</a>.</p>
<p>Referenced by <aclass="el"href="group__condvars.html#ga9cf6ebe4c9f28cb206fab14984a18d29">chCondWaitTimeoutS()</a>, <aclass="el"href="group__events.html#ga90d702300eecee3d05f83e95b155c3ee">chEvtWaitAllTimeout()</a>, <aclass="el"href="group__events.html#gaf690406ccc833e2c9235e7e2041a6715">chEvtWaitAnyTimeout()</a>, <aclass="el"href="group__events.html#ga2944a7fc82e7cc15537f5a7c04f457d3">chEvtWaitOneTimeout()</a>, and <aclass="el"href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03">chSemWaitTimeoutS()</a>.</p>
<areashape="rect"id="node3"href="group__scheduler.html#ga97c1c514b755a1e71caf2f19c1ccf986"title="Puts the current thread to sleep into the specified state."alt=""coords="192,31,293,57"/><areashape="rect"id="node9"href="group__time.html#ga680d851a74e594cc965101e79891840f"title="Disables a Virtual Timer."alt=""coords="204,81,281,108"/><areashape="rect"id="node11"href="group__time.html#ga1c44c3a0bc64b2954d95cd98b2e7124e"title="Enables a virtual timer."alt=""coords="209,132,276,159"/><areashape="rect"id="node5"href="group__debug.html#gac7f8f0653faf2e3a93108ff5333821b7"title="Inserts in the circular debug trace buffer a context switch record."alt=""coords="343,5,423,32"/><areashape="rect"id="node7"href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a"title="Removes the first-out Thread from a queue and returns it."alt=""coords="343,56,423,83"/></map>
<p>The thread is inserted into the ready list or immediately made running depending on its relative priority compared to the current thread. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>It is equivalent to a <code><aclass="el"href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298"title="Inserts a thread in the Ready List.">chSchReadyI()</a></code> followed by a <code><aclass="el"href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20"title="Performs a reschedule if a higher priority thread is runnable.">chSchRescheduleS()</a></code> but much more efficient. </dd>
<dd>
The function assumes that the current thread has the highest priority.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>ntp</em> </td><td>the <aclass="el"href="struct_thread.html"title="Structure representing a thread.">Thread</a> to be made ready </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>msg</em> </td><td>message to the awakened thread </td></tr>
<areashape="rect"id="node3"href="group__debug.html#gac7f8f0653faf2e3a93108ff5333821b7"title="Inserts in the circular debug trace buffer a context switch record."alt=""coords="156,5,236,32"/><areashape="rect"id="node5"href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298"title="Inserts a thread in the Ready List."alt=""coords="153,56,239,83"/></map>
<areashape="rect"id="node3"href="group__debug.html#gac7f8f0653faf2e3a93108ff5333821b7"title="Inserts in the circular debug trace buffer a context switch record."alt=""coords="183,5,263,32"/><areashape="rect"id="node5"href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298"title="Inserts a thread in the Ready List."alt=""coords="180,56,265,83"/><areashape="rect"id="node7"href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a"title="Removes the first-out Thread from a queue and returns it."alt=""coords="183,107,263,133"/></map>
<p>References <aclass="el"href="group__scheduler.html#ga0257cf203e72a766a52059750cb97e6e">chSchDoRescheduleI()</a>, and <aclass="el"href="group__scheduler.html#ga146230c1fe7e6dab4bc6649f2a71444c">chSchIsRescRequiredI</a>.</p>
<p>Referenced by <aclass="el"href="group___a_d_c.html#gabce14d8f240e85715cded02c85b6585a">adcStopConversion()</a>, <aclass="el"href="group___c_a_n.html#ga97caf4f277c09588c225ea2328a74cba">canSleep()</a>, <aclass="el"href="group___c_a_n.html#ga4e89a7d246119e077d27431a02586133">canStop()</a>, <aclass="el"href="group___c_a_n.html#ga09737d4ae5be724bf791a309e8a28dff">canWakeup()</a>, <aclass="el"href="group__condvars.html#ga60c24a8060a884313efe82b8404e77f6">chCondBroadcast()</a>, <aclass="el"href="group__events.html#ga44015af4dd20f74b0f73824ff1c1b2f4">chEvtBroadcast()</a>, <aclass="el"href="group__events.html#ga75a812ae99ce83a3689f51d797a038de">chEvtSignal()</a>, <aclass="el"href="group__mailboxes.html#gadc562242a8854497a1f9539cb9ffea09">chMBFetchS()</a>, <aclass="el"href="group__mailboxes.html#gaa9c91c0b781bec0df3540407d75b1bb3">chMBPostAheadS()</a>, <aclass="el"href="group__mailboxes.html#gac6514c185ae87c2633132478ea48d689">chMBPostS()</a>, <aclass="el"href="group__mailboxes.html#ga4199e224456395c3dbc74dbc889dff94">chMBReset()</a>, <aclass="el"href="group__mutexes.html#ga853b4ced43d22fb5d82678dd2f0aba75">chMtxUnlockAll()</a>, <aclass="el"href="group__semaphores.html#ga58e266e609cfd3dbc67f299b3ae9debb">chSemReset()</a>, <aclass="el"href="group__semaphores.html#ga0dc7b4339506de346d67b4560b271e44">chSemSignalWait()</a>, <aclass="el"href="group__threads.html#ga5a5d9388c64e4c1a3aec129d2831eefe">chThdSetPriority()</a>, and <aclass="el"href="group___s_e_r_i_a_l.html#gacb106a30f8007afdf9eeaf8681dbd3cf">sdStop()</a>.</p>
<areashape="rect"id="node3"href="group__scheduler.html#ga0257cf203e72a766a52059750cb97e6e"title="Switches to the first thread on the runnable queue."alt=""coords="171,56,296,83"/><areashape="rect"id="node5"href="group__debug.html#gac7f8f0653faf2e3a93108ff5333821b7"title="Inserts in the circular debug trace buffer a context switch record."alt=""coords="348,5,428,32"/><areashape="rect"id="node7"href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298"title="Inserts a thread in the Ready List."alt=""coords="345,56,431,83"/><areashape="rect"id="node9"href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a"title="Removes the first-out Thread from a queue and returns it."alt=""coords="348,107,428,133"/></map>
<p>The decision is taken by comparing the relative priorities and depending on the state of the round robin timeout counter. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>This function is meant to be used in the timer interrupt handler where <code><aclass="el"href="group__time.html#ga3cc8210175b310d62e2043f752ccafee"title="Virtual timers ticker.">chVTDoTickI()</a></code> is invoked.</dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"></td><tdvalign="top"><em>TRUE</em> </td><td>if there is a thread that should go in running state. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em>FALSE</em> </td><td>if a reschedule is not required. </td></tr>
<p>References <aclass="el"href="group__scheduler.html#ga1a5fddde56420e8accd0c09c1abb32a7">currp</a>, <aclass="el"href="group__scheduler.html#gaa3e744fe83212f48d7373b764b9abb2d">firstprio</a>, and <aclass="el"href="struct_ready_list.html#a7577e36ac8500b0364cd3d4157e260d1">ReadyList::r_queue</a>.</p>
<p>Definition at line <aclass="el"href="chschd_8c_source.html#l00046">46</a> of file <aclass="el"href="chschd_8c_source.html">chschd.c</a>.</p>
<p>Referenced by <aclass="el"href="group__registry.html#ga55c0a485b40cf4acbfce0dd333f28513">chRegFirstThread()</a>, <aclass="el"href="group__registry.html#gaefff43a49fb7888a596319d67cf01dab">chRegNextThread()</a>, and <aclass="el"href="group__system.html#ga1e42ee112f4a5d2c95be07d523c247be">chSysTimerHandlerI()</a>.</p>
Generated on Sun Oct 24 2010 09:40:46 for ChibiOS/RT by <ahref="http://www.doxygen.org/index.html"><imgsrc="doxygen.png"alt="doxygen"align="middle"border="0"></a> 1.7.1</small></address>