<ahref="serial_8c.html">Go to the documentation of this file.</a><divclass="fragment"><preclass="fragment"><aname="l00001"></a>00001 <spanclass="comment">/*</span>
<aname="l00035"></a>00035 <spanclass="preprocessor">#include "<aclass="code"href="ch_8h.html"title="ChibiOS/RT main include file.">ch.h</a>"</span>
<aname="l00059"></a>00059 <spanclass="keywordflow">return</span><aclass="code"href="group__io__queues.html#ga1e90d41fa021107d72b1bed81186aae8"title="Output queue write with timeout.">chOQWriteTimeout</a>(&((<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *)ip)->oqueue, bp,
<aname="l00060"></a>00060 n, <aclass="code"href="group__scheduler.html#gae1568cf3090c973c3bc47f86ae2f5afb"title="Infinite time specification for all the syscalls with a timeout specification.">TIME_INFINITE</a>);
<aname="l00065"></a>00065 <spanclass="keywordflow">return</span><aclass="code"href="group__io__queues.html#gaddf6fc39af7d905c9f23afde14d8d764"title="Input queue read with timeout.">chIQReadTimeout</a>(&((<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *)ip)->iqueue, bp,
<aname="l00066"></a>00066 n, <aclass="code"href="group__scheduler.html#gae1568cf3090c973c3bc47f86ae2f5afb"title="Infinite time specification for all the syscalls with a timeout specification.">TIME_INFINITE</a>);
<aname="l00067"></a>00067 }
<aname="l00068"></a>00068
<aname="l00069"></a>00069 <spanclass="keyword">static</span><aclass="code"href="group__types.html#ga7556af1cb61728b53228fa3af1c851de"title="Boolean, recommended the fastest signed.">bool_t</a> putwouldblock(<spanclass="keywordtype">void</span> *ip) {
<aname="l00070"></a>00070
<aname="l00071"></a>00071 <spanclass="keywordflow">return</span><aclass="code"href="group__io__queues.html#gaca8b2bc8aae722ba9f47f21c358420f9"title="Evaluates to TRUE if the specified Output Queue is full.">chOQIsFull</a>(&((<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *)ip)->oqueue);
<aname="l00072"></a>00072 }
<aname="l00073"></a>00073
<aname="l00074"></a>00074 <spanclass="keyword">static</span><aclass="code"href="group__types.html#ga7556af1cb61728b53228fa3af1c851de"title="Boolean, recommended the fastest signed.">bool_t</a> getwouldblock(<spanclass="keywordtype">void</span> *ip) {
<aname="l00075"></a>00075
<aname="l00076"></a>00076 <spanclass="keywordflow">return</span><aclass="code"href="group__io__queues.html#ga01d87285eb173d213eb9849514969d7d"title="Evaluates to TRUE if the specified Input Queue is empty.">chIQIsEmpty</a>(&((<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *)ip)->iqueue);
<aname="l00077"></a>00077 }
<aname="l00078"></a>00078
<aname="l00079"></a>00079 <spanclass="keyword">static</span><aclass="code"href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3"title="Message, use signed pointer equivalent.">msg_t</a> putt(<spanclass="keywordtype">void</span> *ip, <aclass="code"href="group___s_t_m8___c_o_r_e.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> b, <aclass="code"href="group__types.html#gae3e32a98d431a02106616da3071832dd"title="System Time, recommended fastest unsigned.">systime_t</a> timeout) {
<aname="l00080"></a>00080
<aname="l00081"></a>00081 <spanclass="keywordflow">return</span><aclass="code"href="group__io__queues.html#ga3df1926602eb698119990b311b097ad9"title="Output queue write with timeout.">chOQPutTimeout</a>(&((<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *)ip)->oqueue, b, timeout);
<aname="l00082"></a>00082 }
<aname="l00083"></a>00083
<aname="l00084"></a>00084 <spanclass="keyword">static</span><aclass="code"href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3"title="Message, use signed pointer equivalent.">msg_t</a> gett(<spanclass="keywordtype">void</span> *ip, <aclass="code"href="group__types.html#gae3e32a98d431a02106616da3071832dd"title="System Time, recommended fastest unsigned.">systime_t</a> timeout) {
<aname="l00085"></a>00085
<aname="l00086"></a>00086 <spanclass="keywordflow">return</span><aclass="code"href="group__io__queues.html#ga142d0e885ac3a695f5f033a65f49abd0"title="Input queue read with timeout.">chIQGetTimeout</a>(&((<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *)ip)->iqueue, timeout);
<aname="l00087"></a>00087 }
<aname="l00088"></a>00088
<aname="l00089"></a>00089 <spanclass="keyword">static</span><spanclass="keywordtype">size_t</span> writet(<spanclass="keywordtype">void</span> *ip, <spanclass="keyword">const</span><aclass="code"href="group___s_t_m8___c_o_r_e.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *bp, <spanclass="keywordtype">size_t</span> n, <aclass="code"href="group__types.html#gae3e32a98d431a02106616da3071832dd"title="System Time, recommended fastest unsigned.">systime_t</a> time) {
<aname="l00090"></a>00090
<aname="l00091"></a>00091 <spanclass="keywordflow">return</span><aclass="code"href="group__io__queues.html#ga1e90d41fa021107d72b1bed81186aae8"title="Output queue write with timeout.">chOQWriteTimeout</a>(&((<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *)ip)->oqueue, bp, n, time);
<aname="l00092"></a>00092 }
<aname="l00093"></a>00093
<aname="l00094"></a>00094 <spanclass="keyword">static</span><spanclass="keywordtype">size_t</span> readt(<spanclass="keywordtype">void</span> *ip, <aclass="code"href="group___s_t_m8___c_o_r_e.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *bp, <spanclass="keywordtype">size_t</span> n, <aclass="code"href="group__types.html#gae3e32a98d431a02106616da3071832dd"title="System Time, recommended fastest unsigned.">systime_t</a> time) {
<aname="l00095"></a>00095
<aname="l00096"></a>00096 <spanclass="keywordflow">return</span><aclass="code"href="group__io__queues.html#gaddf6fc39af7d905c9f23afde14d8d764"title="Input queue read with timeout.">chIQReadTimeout</a>(&((<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *)ip)->iqueue, bp, n, time);
<aname="l00131"></a>00131 <aclass="code"href="group__events.html#gab8d0fdc09be629dfb438c32a0523db42"title="Initializes an Event Source.">chEvtInit</a>(&sdp->ievent);
<aname="l00132"></a>00132 <aclass="code"href="group__events.html#gab8d0fdc09be629dfb438c32a0523db42"title="Initializes an Event Source.">chEvtInit</a>(&sdp->oevent);
<aname="l00133"></a>00133 <aclass="code"href="group__events.html#gab8d0fdc09be629dfb438c32a0523db42"title="Initializes an Event Source.">chEvtInit</a>(&sdp->sevent);
<aname="l00148"></a><aclass="code"href="group___s_e_r_i_a_l.html#ga5e77658b4f3b559927705dc8fbfbdfad">00148</a><spanclass="keywordtype">void</span><aclass="code"href="group___s_e_r_i_a_l.html#ga5e77658b4f3b559927705dc8fbfbdfad"title="Configures and starts the driver.">sdStart</a>(<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *sdp, <spanclass="keyword">const</span><aclass="code"href="struct_serial_config.html"title="Generic Serial Driver configuration structure.">SerialConfig</a> *config) {
<aname="l00156"></a>00156 <aclass="code"href="group___s_e_r_i_a_l___l_l_d.html#gacc3752a7b00b668a651ab76902074e92"title="Low level serial driver configuration and (re)start.">sd_lld_start</a>(sdp, config);
<aname="l00168"></a><aclass="code"href="group___s_e_r_i_a_l.html#gacb106a30f8007afdf9eeaf8681dbd3cf">00168</a><spanclass="keywordtype">void</span><aclass="code"href="group___s_e_r_i_a_l.html#gacb106a30f8007afdf9eeaf8681dbd3cf"title="Stops the driver.">sdStop</a>(<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *sdp) {
<aname="l00178"></a>00178 <aclass="code"href="group__io__queues.html#ga0a35a7de945e4b56b5fb5f5c8567e296"title="Resets an output queue.">chOQResetI</a>(&sdp->oqueue);
<aname="l00179"></a>00179 <aclass="code"href="group__io__queues.html#ga2252ca3e5d6ee6d8d323d025365aee59"title="Resets an input queue.">chIQResetI</a>(&sdp->iqueue);
<aname="l00180"></a>00180 <aclass="code"href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20"title="Performs a reschedule if a higher priority thread is runnable.">chSchRescheduleS</a>();
<aname="l00181"></a>00181 <aclass="code"href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e"title="Leaves the kernel lock mode.">chSysUnlock</a>();
<aname="l00202"></a>00202 <spanclass="keywordflow">if</span> (<aclass="code"href="group__io__queues.html#ga01d87285eb173d213eb9849514969d7d"title="Evaluates to TRUE if the specified Input Queue is empty.">chIQIsEmpty</a>(&sdp->iqueue))
<aname="l00203"></a>00203 <aclass="code"href="group__events.html#gaa24d9bed5b676b577200c4a8ebe3b8a3"title="Signals all the Event Listeners registered on the specified Event Source.">chEvtBroadcastI</a>(&sdp->ievent);
<aname="l00204"></a>00204 <spanclass="keywordflow">if</span> (<aclass="code"href="group__io__queues.html#ga23b72ba9803de5a20caa84ffd0c193fc"title="Input queue write.">chIQPutI</a>(&sdp->iqueue, b) <<aclass="code"href="group__io__queues.html#gadfbe2a9b3e7477d3fd4026d61caf1fcd"title="Returned by the queue functions if the operation is successful.">Q_OK</a>)
<aname="l00205"></a>00205 <aclass="code"href="group___s_e_r_i_a_l.html#ga6c0462b840ea6364ca266a8d3fcb0945"title="Handles communication events/errors.">sdAddFlagsI</a>(sdp, <aclass="code"href="group___s_e_r_i_a_l.html#ga81b11923717a67da5a0b8177821fcad2"title="Overflow happened.">SD_OVERRUN_ERROR</a>);
<aname="l00221"></a><aclass="code"href="group___s_e_r_i_a_l.html#gafa1753aa30a6b79cc7e6de3e8a156fdc">00221</a><aclass="code"href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3"title="Message, use signed pointer equivalent.">msg_t</a><aclass="code"href="group___s_e_r_i_a_l.html#gafa1753aa30a6b79cc7e6de3e8a156fdc"title="Handles outgoing data.">sdRequestDataI</a>(<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *sdp) {
<aname="l00222"></a>00222 <aclass="code"href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3"title="Message, use signed pointer equivalent.">msg_t</a> b;
<aname="l00226"></a>00226 b = <aclass="code"href="group__io__queues.html#ga34a5a71f39e94fcfdd88935da92a8ce9"title="Output queue read.">chOQGetI</a>(&sdp->oqueue);
<aname="l00227"></a>00227 <spanclass="keywordflow">if</span> (b <<aclass="code"href="group__io__queues.html#gadfbe2a9b3e7477d3fd4026d61caf1fcd"title="Returned by the queue functions if the operation is successful.">Q_OK</a>)
<aname="l00228"></a>00228 <aclass="code"href="group__events.html#gaa24d9bed5b676b577200c4a8ebe3b8a3"title="Signals all the Event Listeners registered on the specified Event Source.">chEvtBroadcastI</a>(&sdp->oevent);
<aname="l00245"></a>00245 <aclass="code"href="group__events.html#gaa24d9bed5b676b577200c4a8ebe3b8a3"title="Signals all the Event Listeners registered on the specified Event Source.">chEvtBroadcastI</a>(&sdp->sevent);
<aname="l00255"></a><aclass="code"href="group___s_e_r_i_a_l.html#gaa83db03502662f959e29b9fae964512d">00255</a><aclass="code"href="group___s_e_r_i_a_l___l_l_d.html#gaf851732a0f47524edd346fe8ce24dcb8"title="Serial Driver condition flags type.">sdflags_t</a><aclass="code"href="group___s_e_r_i_a_l.html#gaa83db03502662f959e29b9fae964512d"title="Returns and clears the errors mask associated to the driver.">sdGetAndClearFlags</a>(<aclass="code"href="struct___serial_driver.html"title="Full duplex serial driver class.">SerialDriver</a> *sdp) {
Generated on Sun Oct 24 2010 09:40:37 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>