1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Xenomai API: include/native/timer.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label> <u>S</u>earch for </label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul>
</div>
<h1>include/native/timer.h</h1><a href="include_2native_2timer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _XENO_TIMER_H</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _XENO_TIMER_H</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include <native/types.h></span>
<a name="l00026"></a>00026
<a name="l00027"></a>00027 <span class="preprocessor">#define TM_ONESHOT XN_APERIODIC_TICK</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="keyword">typedef</span> <span class="keyword">struct </span>rt_timer_info {
<a name="l00030"></a>00030
<a name="l00031"></a>00031 RTIME period; <span class="comment">/* !< Current status (unset, aperiodic, period). */</span>
<a name="l00032"></a>00032 RTIME date; <span class="comment">/* !< Current wallclock time. */</span>
<a name="l00033"></a>00033 RTIME tsc; <span class="comment">/* !< Current tsc count. */</span>
<a name="l00034"></a>00034
<a name="l00035"></a>00035 } RT_TIMER_INFO;
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#if defined(__KERNEL__) || defined(__XENO_SIM__)</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00039"></a>00039 <span class="preprocessor">#include <nucleus/timer.h></span>
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="keyword">extern</span> xntbase_t *__native_tbase;
<a name="l00042"></a>00042
<a name="l00043"></a>00043 <span class="preprocessor">#endif </span><span class="comment">/* __KERNEL__ || __XENO_SIM__ */</span>
<a name="l00044"></a>00044
<a name="l00045"></a>00045 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00047"></a>00047 <span class="preprocessor">#endif</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span>
<a name="l00049"></a>00049 <span class="preprocessor">#if (defined(__KERNEL__) || defined(__XENO_SIM__)) && !defined(DOXYGEN_CPP)</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keyword">inline</span> SRTIME <a class="code" href="include_2native_2timer_8h.html#67fb7c8759946b77e0bee05dfe7b7181" title="Convert nanoseconds to local CPU clock ticks.">rt_timer_ns2tsc</a>(SRTIME ns)
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052 <span class="keywordflow">return</span> xnarch_ns_to_tsc(ns);
<a name="l00053"></a>00053 }
<a name="l00054"></a>00054
<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keyword">inline</span> SRTIME <a class="code" href="include_2native_2timer_8h.html#493cc6fd8d90059a21f6f8249546b541" title="Convert local CPU clock ticks to nanoseconds.">rt_timer_tsc2ns</a>(SRTIME ticks)
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057 <span class="keywordflow">return</span> xnarch_tsc_to_ns(ticks);
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059
<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keyword">inline</span> RTIME <a class="code" href="include_2native_2timer_8h.html#a589af3dafaeaa5dcbf2ef7b6dde6af8" title="Return the current TSC value.">rt_timer_tsc</a>(<span class="keywordtype">void</span>)
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062 <span class="keywordflow">return</span> xnarch_get_cpu_tsc();
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="keyword">static</span> <span class="keyword">inline</span> RTIME <a class="code" href="include_2native_2timer_8h.html#9665d6947e29d1a19dafb5401b0f6285" title="Return the current system time.">rt_timer_read</a>(<span class="keywordtype">void</span>)
<a name="l00066"></a>00066 {
<a name="l00067"></a>00067 <span class="keywordflow">return</span> <a class="code" href="group__timebase.html#g5246b53b5b2d1b11d4fab4312fd16fda" title="Get the clock time for a given time base.">xntbase_get_time</a>(__native_tbase);
<a name="l00068"></a>00068 }
<a name="l00069"></a>00069
<a name="l00070"></a>00070 <span class="keyword">static</span> <span class="keyword">inline</span> SRTIME <a class="code" href="include_2native_2timer_8h.html#ad812d18e51f398fbb0e5392b2acdf2f" title="Convert nanoseconds to internal clock ticks.">rt_timer_ns2ticks</a>(SRTIME ns)
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072 <span class="keywordflow">return</span> xntbase_ns2ticks(__native_tbase, ns);
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074
<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keyword">inline</span> SRTIME <a class="code" href="include_2native_2timer_8h.html#a41e1976c4df9929c1a1238cc1195f48" title="Convert internal clock ticks to nanoseconds.">rt_timer_ticks2ns</a>(SRTIME ticks)
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077 <span class="keywordflow">return</span> xntbase_ticks2ns(__native_tbase, ticks);
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <span class="preprocessor">#else </span><span class="comment">/* !(__KERNEL__ || __XENO_SIM__) */</span>
<a name="l00081"></a>00081
<a name="l00105"></a>00105 SRTIME <a class="code" href="include_2native_2timer_8h.html#67fb7c8759946b77e0bee05dfe7b7181" title="Convert nanoseconds to local CPU clock ticks.">rt_timer_ns2tsc</a>(SRTIME ns);
<a name="l00106"></a>00106
<a name="l00130"></a>00130 SRTIME <a class="code" href="include_2native_2timer_8h.html#493cc6fd8d90059a21f6f8249546b541" title="Convert local CPU clock ticks to nanoseconds.">rt_timer_tsc2ns</a>(SRTIME ticks);
<a name="l00131"></a>00131
<a name="l00153"></a>00153 RTIME <a class="code" href="include_2native_2timer_8h.html#a589af3dafaeaa5dcbf2ef7b6dde6af8" title="Return the current TSC value.">rt_timer_tsc</a>(<span class="keywordtype">void</span>);
<a name="l00154"></a>00154
<a name="l00179"></a>00179 RTIME <a class="code" href="include_2native_2timer_8h.html#9665d6947e29d1a19dafb5401b0f6285" title="Return the current system time.">rt_timer_read</a>(<span class="keywordtype">void</span>);
<a name="l00180"></a>00180
<a name="l00204"></a>00204 SRTIME <a class="code" href="include_2native_2timer_8h.html#ad812d18e51f398fbb0e5392b2acdf2f" title="Convert nanoseconds to internal clock ticks.">rt_timer_ns2ticks</a>(SRTIME ns);
<a name="l00205"></a>00205
<a name="l00229"></a>00229 SRTIME <a class="code" href="include_2native_2timer_8h.html#a41e1976c4df9929c1a1238cc1195f48" title="Convert internal clock ticks to nanoseconds.">rt_timer_ticks2ns</a>(SRTIME ticks);
<a name="l00230"></a>00230
<a name="l00231"></a>00231 <span class="preprocessor">#endif </span><span class="comment">/* !(__KERNEL__ || __XENO_SIM__) */</span>
<a name="l00232"></a>00232
<a name="l00233"></a>00233 <span class="keywordtype">int</span> <a class="code" href="group__native__timer.html#g66f026b0ac68ef3acde0e6d1bdb6baaf" title="Inquire about the timer.">rt_timer_inquire</a>(RT_TIMER_INFO *info);
<a name="l00234"></a>00234
<a name="l00235"></a>00235 RTIME <a class="code" href="include_2native_2timer_8h.html#9665d6947e29d1a19dafb5401b0f6285" title="Return the current system time.">rt_timer_read</a>(<span class="keywordtype">void</span>);
<a name="l00236"></a>00236
<a name="l00237"></a>00237 <span class="keywordtype">void</span> <a class="code" href="group__native__timer.html#g7d3f782ce7b642a2759c62649777d2c7" title="Busy wait burning CPU cycles.">rt_timer_spin</a>(RTIME ns);
<a name="l00238"></a>00238
<a name="l00239"></a>00239 <span class="keywordtype">int</span> <a class="code" href="group__native__timer.html#gffcb5eaef6c3a64a05445f6dafdbb155" title="Set the system clock rate.">rt_timer_set_mode</a>(RTIME nstick);
<a name="l00240"></a>00240
<a name="l00241"></a>00241 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __deprecated_call__
<a name="l00242"></a>00242 rt_timer_start(RTIME nstick __attribute__((unused)))
<a name="l00243"></a>00243 {
<a name="l00244"></a>00244 <span class="keywordflow">return</span> 0;
<a name="l00245"></a>00245 }
<a name="l00246"></a>00246
<a name="l00247"></a>00247 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __deprecated_call__ rt_timer_stop(<span class="keywordtype">void</span>)
<a name="l00248"></a>00248 {
<a name="l00249"></a>00249 }
<a name="l00250"></a>00250
<a name="l00251"></a>00251 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00252"></a>00252 <span class="preprocessor"></span>}
<a name="l00253"></a>00253 <span class="preprocessor">#endif</span>
<a name="l00254"></a>00254 <span class="preprocessor"></span>
<a name="l00255"></a>00255 <span class="preprocessor">#endif </span><span class="comment">/* !_XENO_TIMER_H */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jun 8 18:08:49 2008 for Xenomai API by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>
|