<p>ChibiOS/RT queues are mostly used in serial-like device drivers. The device drivers are usually designed to have a lower side (lower driver, it is usually an interrupt service routine) and an upper side (upper driver, accessed by the application threads).<br/>
There are several kind of queues:<br/>
</p>
<ul>
<li><b>Input queue</b>, unidirectional queue where the writer is the lower side and the reader is the upper side.</li>
<li><b>Output queue</b>, unidirectional queue where the writer is the upper side and the reader is the lower side.</li>
<li><b>Full duplex queue</b>, bidirectional queue. Full duplex queues are implemented by pairing an input queue and an output queue together.</li>
</ul>
<p>In order to use the I/O queues the <code>CH_USE_QUEUES</code> option must be enabled in <code><aclass="el"href="chconf_8h.html"title="Configuration file template.">chconf.h</a></code>.<br/>
I/O queues are usually used as an implementation layer for the I/O channels interface, also see <aclass="el"href="group__io__channels.html">I/O Channels</a>. </p>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returned by the queue functions if the operation is successful. <ahref="#gadfbe2a9b3e7477d3fd4026d61caf1fcd"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returned by the queue functions if a timeout occurs. <ahref="#gaed5efaf47ab37022f69e8080610bcb8b"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returned by the queue functions if the queue is reset. <ahref="#gaef6ed06ced720075658356892318f92d"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returned by the queue functions if the queue is empty. <ahref="#ga9d3fcfacb433cb513882db4515ac348b"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returned by the queue functions if the queue is full. <ahref="#ga6c462ef0a5b01afbd0d94a8e1ac8575a"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Evaluates to <code>TRUE</code> if the specified Input Queue is empty. <ahref="#ga01d87285eb173d213eb9849514969d7d"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Evaluates to <code>TRUE</code> if the specified Input Queue is full. <ahref="#ga3b87d6f7e4110c882b13870930db5cbb"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Data part of a static input queue initializer. <ahref="#ga4103f441ac5c12c89180194b7a3044f2"></a><br/></td></tr>
<tr><tdclass="memItemLeft"align="right"valign="top">#define </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group__io__queues.html#ga49e3c172ebb6efca6579bf97ca82569d">INPUTQUEUE_DECL</a>(name, buffer, size, inotify) <aclass="el"href="struct_generic_queue.html">InputQueue</a> name = _INPUTQUEUE_DATA(name, buffer, size, inotify)</td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Evaluates to <code>TRUE</code> if the specified Output Queue is empty. <ahref="#gabf0eb1ba20cde6d4d9afa1139eaac19d"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Evaluates to <code>TRUE</code> if the specified Output Queue is full. <ahref="#gaca8b2bc8aae722ba9f47f21c358420f9"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Data part of a static output queue initializer. <ahref="#gafc29412cc872c152eadcb24183010a52"></a><br/></td></tr>
<tr><tdclass="memItemLeft"align="right"valign="top">#define </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group__io__queues.html#ga9381af63d682d4e0883bc9336a2366eb">OUTPUTQUEUE_DECL</a>(name, buffer, size, onotify) <aclass="el"href="struct_generic_queue.html">InputQueue</a> name = _OUTPUTQUEUE_DATA(name, buffer, size, onotify)</td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Initializes an output queue. <ahref="#gae2a5a0ef7c488ac02762e76933baa7b1"></a><br/></td></tr>
<p>Referenced by <aclass="el"href="group___s_e_r_i_a_l.html#gac94544bc991e2b85a601459463604346">sdIncomingDataI()</a>, and <aclass="el"href="group___s_e_r_i_a_l.html#gafa1753aa30a6b79cc7e6de3e8a156fdc">sdRequestDataI()</a>.</p>
<p>Evaluates to <code>TRUE</code> if the specified Input Queue is empty. </p>
<p>Definition at line <aclass="el"href="chqueues_8h_source.html#l00108">108</a> of file <aclass="el"href="chqueues_8h_source.html">chqueues.h</a>.</p>
<p>Referenced by <aclass="el"href="group__io__queues.html#gaddf6fc39af7d905c9f23afde14d8d764">chIQReadTimeout()</a>, and <aclass="el"href="group___s_e_r_i_a_l.html#gac94544bc991e2b85a601459463604346">sdIncomingDataI()</a>.</p>
<p>This function reads a byte value from an input queue. If the queue is empty then the calling thread is suspended until a byte arrives in the queue.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>iqp</em> </td><td>pointer to an <code>InputQueue</code> structure </td></tr>
</table>
</dd>
</dl>
<dlclass="return"><dt><b>Returns:</b></dt><dd>A byte value from the queue or: </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"></td><tdvalign="top"><em>Q_RESET</em> </td><td>if the queue was reset. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chqueues_8h_source.html#l00123">123</a> of file <aclass="el"href="chqueues_8h_source.html">chqueues.h</a>.</p>
<aclass="code"href="group__semaphores.html#ga1100c867cc8bd8328f7a7db5e7c74f6d"title="Data part of a static semaphore initializer.">_SEMAPHORE_DATA</a>(name.q_sem, 0), \
inotify \
}
</pre></div>
<p>Data part of a static input queue initializer. </p>
<p>This macro should be used when statically initializing an input queue that is part of a bigger structure.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>name</em> </td><td>the name of the input queue variable </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>buffer</em> </td><td>pointer to the queue buffer area </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>size of the queue buffer area </td></tr>
<p>Statically initialized input queues require no explicit initialization using <code><aclass="el"href="group__io__queues.html#ga0d3a250e6572526b165d2c61f69230e5"title="Initializes an input queue.">chIQInit()</a></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>name</em> </td><td>the name of the input queue variable </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>buffer</em> </td><td>pointer to the queue buffer area </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>size of the queue buffer area </td></tr>
<p>This function writes a byte value to an output queue. If the queue is full then the calling thread is suspended until there is space in the queue.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>oqp</em> </td><td>pointer to an <code>OutputQueue</code> structure </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>b</em> </td><td>the byte value to be written in the queue </td></tr>
<aclass="code"href="group__semaphores.html#ga1100c867cc8bd8328f7a7db5e7c74f6d"title="Data part of a static semaphore initializer.">_SEMAPHORE_DATA</a>(name.q_sem, size), \
onotify \
}
</pre></div>
<p>Data part of a static output queue initializer. </p>
<p>This macro should be used when statically initializing an output queue that is part of a bigger structure.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>name</em> </td><td>the name of the output queue variable. </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>buffer</em> </td><td>pointer to the queue buffer area </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>size of the queue buffer area </td></tr>
<p>Statically initialized output queues require no explicit initialization using <code><aclass="el"href="group__io__queues.html#gae2a5a0ef7c488ac02762e76933baa7b1"title="Initializes an output queue.">chOQInit()</a></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>name</em> </td><td>the name of the output queue variable </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>buffer</em> </td><td>pointer to the queue buffer area </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>size of the queue buffer area </td></tr>
<p>This structure represents a generic asymmetrical input queue. Writing in the queue is non-blocking and can be performed from interrupt handlers or from within a kernel lock zone (see <b>I-Locked</b> and <b>S-Locked</b> states in <aclass="el"href="concepts.html#system_states">System States</a>). Reading the queue can be a blocking operation and is supposed to be performed by a system thread. </p>
<p>Definition at line <aclass="el"href="chqueues_8h_source.html#l00105">105</a> of file <aclass="el"href="chqueues_8h_source.html">chqueues.h</a>.</p>
<p>This structure represents a generic asymmetrical output queue. Reading from the queue is non-blocking and can be performed from interrupt handlers or from within a kernel lock zone (see <b>I-Locked</b> and <b>S-Locked</b> states in <aclass="el"href="concepts.html#system_states">System States</a>). Writing the queue can be a blocking operation and is supposed to be performed by a system thread. </p>
<p>Definition at line <aclass="el"href="chqueues_8h_source.html#l00168">168</a> of file <aclass="el"href="chqueues_8h_source.html">chqueues.h</a>.</p>
<p>A <aclass="el"href="struct_semaphore.html"title="Semaphore structure.">Semaphore</a> is internally initialized and works as a counter of the bytes contained in the queue. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>The callback is invoked from within the S-Locked system state, see <aclass="el"href="concepts.html#system_states">System States</a>.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[out]</tt> </td><tdvalign="top"><em>iqp</em> </td><td>pointer to an <code>InputQueue</code> structure </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>bp</em> </td><td>pointer to a memory area allocated as queue buffer </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>size of the queue buffer </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>infy</em> </td><td>pointer to a callback function that is invoked when data is read from the queue. The value can be <code>NULL</code>. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chqueues_8c_source.html#l00069">69</a> of file <aclass="el"href="chqueues_8c_source.html">chqueues.c</a>.</p>
<p>References <aclass="el"href="group__semaphores.html#gafe8fc6155a871074e8017efd908b2c58">chSemInit()</a>, <aclass="el"href="struct_generic_queue.html#a644ac8a420048012cf562a31e8c144c6">GenericQueue::q_buffer</a>, <aclass="el"href="struct_generic_queue.html#ab8c8dc77de2c387f8a980a9c179388e1">GenericQueue::q_notify</a>, <aclass="el"href="struct_generic_queue.html#acc1453d7bc5a4ceddba2166b72ba3b47">GenericQueue::q_rdptr</a>, <aclass="el"href="struct_generic_queue.html#a21fa1b28fa19bbb1b036c396b44d9fd5">GenericQueue::q_sem</a>, <aclass="el"href="struct_generic_queue.html#a2345976305f32ce54981ad1ee36e77be">GenericQueue::q_top</a>, and <aclass="el"href="struct_generic_queue.html#a5cf5a39a1a57b15d1a2491edcbd72442">GenericQueue::q_wrptr</a>.</p>
<p>Referenced by <aclass="el"href="group___s_e_r_i_a_l.html#gacb9838adcf51106f4e481f41a851cc34">sdObjectInit()</a>.</p>
<areashape="rect"id="node3"href="group__semaphores.html#gafe8fc6155a871074e8017efd908b2c58"title="Initializes a semaphore with the specified counter value."alt=""coords="113,5,180,32"/></map>
<p>All the data in the input queue is erased and lost, any waiting thread is resumed with status <code>Q_RESET</code>. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>A reset operation can be used by a low level driver in order to obtain immediate attention from the high level layers.</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>iqp</em> </td><td>pointer to an <code>InputQueue</code> structure </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chqueues_8c_source.html#l00086">86</a> of file <aclass="el"href="chqueues_8c_source.html">chqueues.c</a>.</p>
<p>References <aclass="el"href="group__semaphores.html#gae7972b6b22b80ac09bac5a186277ab81">chSemResetI()</a>, <aclass="el"href="struct_generic_queue.html#a644ac8a420048012cf562a31e8c144c6">GenericQueue::q_buffer</a>, <aclass="el"href="struct_generic_queue.html#acc1453d7bc5a4ceddba2166b72ba3b47">GenericQueue::q_rdptr</a>, <aclass="el"href="struct_generic_queue.html#a21fa1b28fa19bbb1b036c396b44d9fd5">GenericQueue::q_sem</a>, and <aclass="el"href="struct_generic_queue.html#a5cf5a39a1a57b15d1a2491edcbd72442">GenericQueue::q_wrptr</a>.</p>
<p>Referenced by <aclass="el"href="group___s_e_r_i_a_l.html#gacb106a30f8007afdf9eeaf8681dbd3cf">sdStop()</a>.</p>
<areashape="rect"id="node3"href="group__semaphores.html#gae7972b6b22b80ac09bac5a186277ab81"title="Performs a reset operation on the semaphore."alt=""coords="128,31,213,57"/><areashape="rect"id="node5"href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298"title="Inserts a thread in the Ready List."alt=""coords="263,5,348,32"/><areashape="rect"id="node7"href="group__internals.html#gacacfe77140cab62948e63d898bf4dfba"title="Removes the last-out Thread from a queue and returns it."alt=""coords="267,56,344,83"/></map>
<areashape="rect"id="node3"href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d"title="Performs a signal operation on a semaphore."alt=""coords="116,31,201,57"/><areashape="rect"id="node5"href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298"title="Inserts a thread in the Ready List."alt=""coords="252,5,337,32"/><areashape="rect"id="node7"href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a"title="Removes the first-out Thread from a queue and returns it."alt=""coords="255,56,335,83"/></map>
<p>This function reads a byte value from an input queue. If the queue is empty then the calling thread is suspended until a byte arrives in the queue or a timeout occurs.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>iqp</em> </td><td>pointer to an <code>InputQueue</code> structure </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 following special values are allowed:</p>
<areashape="rect"id="node3"href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03"title="Performs a wait operation on a semaphore with timeout specification."alt=""coords="152,5,272,32"/><areashape="rect"id="node5"href="group__scheduler.html#ga306e564f678c1a39139639490c77e78b"title="Puts the current thread to sleep into the specified state with timeout specification."alt=""coords="320,5,459,32"/></map>
<p>The function reads data from an input queue into a buffer. The operation completes when the specified amount of data has been transferred or after the specified timeout or if the queue has been reset. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>The function is not atomic, if you need atomicity it is suggested to use a semaphore or a mutex for mutual exclusion. </dd>
<dd>
The queue callback is invoked before entering a sleep state and at the end of the transfer.</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>iqp</em> </td><td>pointer to an <code>InputQueue</code> structure </td></tr>
<tr><tdvalign="top"><tt>[out]</tt> </td><tdvalign="top"><em>bp</em> </td><td>pointer to the data buffer </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>n</em> </td><td>the maximum amount of data to be transferred, the value 0 is reserved </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 following special values are allowed:</p>
<areashape="rect"id="node3"href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03"title="Performs a wait operation on a semaphore with timeout specification."alt=""coords="160,5,280,32"/><areashape="rect"id="node5"href="group__scheduler.html#ga306e564f678c1a39139639490c77e78b"title="Puts the current thread to sleep into the specified state with timeout specification."alt=""coords="328,5,467,32"/></map>
<p>A <aclass="el"href="struct_semaphore.html"title="Semaphore structure.">Semaphore</a> is internally initialized and works as a counter of the free bytes in the queue. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>The callback is invoked from within the S-Locked system state, see <aclass="el"href="concepts.html#system_states">System States</a>.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[out]</tt> </td><tdvalign="top"><em>oqp</em> </td><td>pointer to an <code>OutputQueue</code> structure </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>bp</em> </td><td>pointer to a memory area allocated as queue buffer </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>size of the queue buffer </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>onfy</em> </td><td>pointer to a callback function that is invoked when data is written to the queue. The value can be <code>NULL</code>. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chqueues_8c_source.html#l00224">224</a> of file <aclass="el"href="chqueues_8c_source.html">chqueues.c</a>.</p>
<p>References <aclass="el"href="group__semaphores.html#gafe8fc6155a871074e8017efd908b2c58">chSemInit()</a>, <aclass="el"href="struct_generic_queue.html#a644ac8a420048012cf562a31e8c144c6">GenericQueue::q_buffer</a>, <aclass="el"href="struct_generic_queue.html#ab8c8dc77de2c387f8a980a9c179388e1">GenericQueue::q_notify</a>, <aclass="el"href="struct_generic_queue.html#acc1453d7bc5a4ceddba2166b72ba3b47">GenericQueue::q_rdptr</a>, <aclass="el"href="struct_generic_queue.html#a21fa1b28fa19bbb1b036c396b44d9fd5">GenericQueue::q_sem</a>, <aclass="el"href="struct_generic_queue.html#a2345976305f32ce54981ad1ee36e77be">GenericQueue::q_top</a>, and <aclass="el"href="struct_generic_queue.html#a5cf5a39a1a57b15d1a2491edcbd72442">GenericQueue::q_wrptr</a>.</p>
<p>Referenced by <aclass="el"href="group___s_e_r_i_a_l.html#gacb9838adcf51106f4e481f41a851cc34">sdObjectInit()</a>.</p>
<areashape="rect"id="node3"href="group__semaphores.html#gafe8fc6155a871074e8017efd908b2c58"title="Initializes a semaphore with the specified counter value."alt=""coords="119,5,185,32"/></map>
<p>All the data in the output queue is erased and lost, any waiting thread is resumed with status <code>Q_RESET</code>. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>A reset operation can be used by a low level driver in order to obtain immediate attention from the high level layers.</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>oqp</em> </td><td>pointer to an <code>OutputQueue</code> structure </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chqueues_8c_source.html#l00241">241</a> of file <aclass="el"href="chqueues_8c_source.html">chqueues.c</a>.</p>
<p>References <aclass="el"href="group__semaphores.html#gae7972b6b22b80ac09bac5a186277ab81">chSemResetI()</a>, <aclass="el"href="struct_generic_queue.html#a644ac8a420048012cf562a31e8c144c6">GenericQueue::q_buffer</a>, <aclass="el"href="struct_generic_queue.html#acc1453d7bc5a4ceddba2166b72ba3b47">GenericQueue::q_rdptr</a>, <aclass="el"href="struct_generic_queue.html#a21fa1b28fa19bbb1b036c396b44d9fd5">GenericQueue::q_sem</a>, <aclass="el"href="struct_generic_queue.html#a2345976305f32ce54981ad1ee36e77be">GenericQueue::q_top</a>, and <aclass="el"href="struct_generic_queue.html#a5cf5a39a1a57b15d1a2491edcbd72442">GenericQueue::q_wrptr</a>.</p>
<p>Referenced by <aclass="el"href="group___s_e_r_i_a_l.html#gacb106a30f8007afdf9eeaf8681dbd3cf">sdStop()</a>.</p>
<areashape="rect"id="node3"href="group__semaphores.html#gae7972b6b22b80ac09bac5a186277ab81"title="Performs a reset operation on the semaphore."alt=""coords="133,31,219,57"/><areashape="rect"id="node5"href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298"title="Inserts a thread in the Ready List."alt=""coords="268,5,353,32"/><areashape="rect"id="node7"href="group__internals.html#gacacfe77140cab62948e63d898bf4dfba"title="Removes the last-out Thread from a queue and returns it."alt=""coords="272,56,349,83"/></map>
<p>This function writes a byte value to an output queue. If the queue is full then the calling thread is suspended until there is space in the queue or a timeout occurs.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>oqp</em> </td><td>pointer to an <code>OutputQueue</code> structure </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>b</em> </td><td>the byte value to be written in the queue </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 following special values are allowed:</p>
<areashape="rect"id="node3"href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03"title="Performs a wait operation on a semaphore with timeout specification."alt=""coords="157,5,277,32"/><areashape="rect"id="node5"href="group__scheduler.html#ga306e564f678c1a39139639490c77e78b"title="Puts the current thread to sleep into the specified state with timeout specification."alt=""coords="325,5,464,32"/></map>
<areashape="rect"id="node3"href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d"title="Performs a signal operation on a semaphore."alt=""coords="124,31,209,57"/><areashape="rect"id="node5"href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298"title="Inserts a thread in the Ready List."alt=""coords="260,5,345,32"/><areashape="rect"id="node7"href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a"title="Removes the first-out Thread from a queue and returns it."alt=""coords="263,56,343,83"/></map>
<p>The function writes data from a buffer to an output queue. The operation completes when the specified amount of data has been transferred or after the specified timeout or if the queue has been reset. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>The function is not atomic, if you need atomicity it is suggested to use a semaphore or a mutex for mutual exclusion. </dd>
<dd>
The queue callback is invoked before entering a sleep state and at the end of the transfer.</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>oqp</em> </td><td>pointer to an <code>OutputQueue</code> structure </td></tr>
<tr><tdvalign="top"><tt>[out]</tt> </td><tdvalign="top"><em>bp</em> </td><td>pointer to the data buffer </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>n</em> </td><td>the maximum amount of data to be transferred, the value 0 is reserved </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 following special values are allowed:</p>
<areashape="rect"id="node3"href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03"title="Performs a wait operation on a semaphore with timeout specification."alt=""coords="165,5,285,32"/><areashape="rect"id="node5"href="group__scheduler.html#ga306e564f678c1a39139639490c77e78b"title="Puts the current thread to sleep into the specified state with timeout specification."alt=""coords="333,5,472,32"/></map>
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>