<ahref="chvt_8c.html">Go to the documentation of this file.</a><divclass="fragment"><preclass="fragment"><aname="l00001"></a>00001 <spanclass="comment">/*</span>
<aname="l00036"></a>00036 <spanclass="preprocessor">#include "<aclass="code"href="ch_8h.html"title="ChibiOS/RT main include file.">ch.h</a>"</span>
<aname="l00041"></a><aclass="code"href="group__time.html#gaf86fafcf8f7ea15d07e55f45dd80e3ac">00041</a><aclass="code"href="struct_v_t_list.html"title="Virtual timers list header.">VTList</a><aclass="code"href="group__time.html#gaf86fafcf8f7ea15d07e55f45dd80e3ac"title="Virtual timers delta list header.">vtlist</a>;
<aname="l00049"></a>00049 vtlist.<aclass="code"href="struct_v_t_list.html#a18ed6321ebb9d1d4977bc3b1a8d6531d"title="Next timer in the delta list.">vt_next</a> = vtlist.<aclass="code"href="struct_v_t_list.html#a0e89630d5a1b82bb6bfbca1465cfa1f7"title="Last timer in the delta list.">vt_prev</a> = (<spanclass="keywordtype">void</span> *)&vtlist;
<aname="l00050"></a>00050 vtlist.<aclass="code"href="struct_v_t_list.html#a565bf88a53b8ee8a5cd20f42d94b05c6"title="Must be initialized to -1.">vt_time</a> = (systime_t)-1;
<aname="l00073"></a>00073 <aclass="code"href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844"title="Function parameter check.">chDbgCheck</a>((vtp != NULL) && (vtfunc != NULL) && (time != <aclass="code"href="group__scheduler.html#gae1568cf3090c973c3bc47f86ae2f5afb"title="Infinite time specification for all the syscalls with a timeout specification.">TIME_INFINITE</a>),
<aname="l00076"></a>00076 vtp-><aclass="code"href="struct_virtual_timer.html#aa86e3ff1de8fa6c58f2267ed6bc09cb1"title="Timer callback function parameter.">vt_par</a> = par;
<aname="l00077"></a>00077 vtp-><aclass="code"href="struct_virtual_timer.html#aac8307916bebf903e4f3e783910cf0e6"title="Timer callback function pointer.">vt_func</a> = vtfunc;
<aname="l00078"></a>00078 p = vtlist.<aclass="code"href="struct_v_t_list.html#a18ed6321ebb9d1d4977bc3b1a8d6531d"title="Next timer in the delta list.">vt_next</a>;
<aname="l00079"></a>00079 <spanclass="keywordflow">while</span> (p-><aclass="code"href="struct_virtual_timer.html#a81422ae4e1d42f486d678bf85772573f"title="Time delta before timeout.">vt_time</a>< time) {
<aname="l00080"></a>00080 time -= p-><aclass="code"href="struct_virtual_timer.html#a81422ae4e1d42f486d678bf85772573f"title="Time delta before timeout.">vt_time</a>;
<aname="l00081"></a>00081 p = p-><aclass="code"href="struct_virtual_timer.html#a7130d3aa62ec1ee1c71a1034278cd60f"title="Next timer in the delta list.">vt_next</a>;
<aname="l00082"></a>00082 }
<aname="l00083"></a>00083
<aname="l00084"></a>00084 vtp-><aclass="code"href="struct_virtual_timer.html#ab2a1ca6407192845f2cb04ba9775c593"title="Previous timer in the delta list.">vt_prev</a> = (vtp-><aclass="code"href="struct_virtual_timer.html#a7130d3aa62ec1ee1c71a1034278cd60f"title="Next timer in the delta list.">vt_next</a> = p)->vt_prev;
<aname="l00085"></a>00085 vtp-><aclass="code"href="struct_virtual_timer.html#ab2a1ca6407192845f2cb04ba9775c593"title="Previous timer in the delta list.">vt_prev</a>-><aclass="code"href="struct_virtual_timer.html#a7130d3aa62ec1ee1c71a1034278cd60f"title="Next timer in the delta list.">vt_next</a> = p-><aclass="code"href="struct_virtual_timer.html#ab2a1ca6407192845f2cb04ba9775c593"title="Previous timer in the delta list.">vt_prev</a> = vtp;
<aname="l00086"></a>00086 vtp-><aclass="code"href="struct_virtual_timer.html#a81422ae4e1d42f486d678bf85772573f"title="Time delta before timeout.">vt_time</a> = time;
<aname="l00102"></a>00102 <spanclass="stringliteral">"timer not set or already triggered"</span>);
<aname="l00103"></a>00103
<aname="l00104"></a>00104 <spanclass="keywordflow">if</span> (vtp-><aclass="code"href="struct_virtual_timer.html#a7130d3aa62ec1ee1c71a1034278cd60f"title="Next timer in the delta list.">vt_next</a> != (<spanclass="keywordtype">void</span> *)&vtlist)
<aname="l00105"></a>00105 vtp-><aclass="code"href="struct_virtual_timer.html#a7130d3aa62ec1ee1c71a1034278cd60f"title="Next timer in the delta list.">vt_next</a>-><aclass="code"href="struct_virtual_timer.html#a81422ae4e1d42f486d678bf85772573f"title="Time delta before timeout.">vt_time</a> += vtp-><aclass="code"href="struct_virtual_timer.html#a81422ae4e1d42f486d678bf85772573f"title="Time delta before timeout.">vt_time</a>;
<aname="l00106"></a>00106 vtp-><aclass="code"href="struct_virtual_timer.html#ab2a1ca6407192845f2cb04ba9775c593"title="Previous timer in the delta list.">vt_prev</a>-><aclass="code"href="struct_virtual_timer.html#a7130d3aa62ec1ee1c71a1034278cd60f"title="Next timer in the delta list.">vt_next</a> = vtp-><aclass="code"href="struct_virtual_timer.html#a7130d3aa62ec1ee1c71a1034278cd60f"title="Next timer in the delta list.">vt_next</a>;
<aname="l00107"></a>00107 vtp-><aclass="code"href="struct_virtual_timer.html#a7130d3aa62ec1ee1c71a1034278cd60f"title="Next timer in the delta list.">vt_next</a>-><aclass="code"href="struct_virtual_timer.html#ab2a1ca6407192845f2cb04ba9775c593"title="Previous timer in the delta list.">vt_prev</a> = vtp-><aclass="code"href="struct_virtual_timer.html#ab2a1ca6407192845f2cb04ba9775c593"title="Previous timer in the delta list.">vt_prev</a>;
<aname="l00122"></a><aclass="code"href="group__time.html#ga47933e7381151ab9cc0888e53ced3847">00122</a><aclass="code"href="group__types.html#ga7556af1cb61728b53228fa3af1c851de"title="Boolean, recommended the fastest signed.">bool_t</a><aclass="code"href="group__time.html#ga47933e7381151ab9cc0888e53ced3847"title="Checks if the current system time is within the specified time window.">chTimeIsWithin</a>(<aclass="code"href="group__types.html#gae3e32a98d431a02106616da3071832dd"title="System Time, recommended fastest unsigned.">systime_t</a> start, <aclass="code"href="group__types.html#gae3e32a98d431a02106616da3071832dd"title="System Time, recommended fastest unsigned.">systime_t</a> end) {
<aname="l00123"></a>00123
<aname="l00124"></a>00124 <aclass="code"href="group__types.html#gae3e32a98d431a02106616da3071832dd"title="System Time, recommended fastest unsigned.">systime_t</a> time = <aclass="code"href="group__time.html#ga137c8f67c450f34416a786d169be90e2"title="Current system time.">chTimeNow</a>();
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>