1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv=
"Content-Type" content=
"text/html;charset=UTF-8">
3 <title>Xenomai API: include/nucleus/timebase.h Source File
</title>
4 <link href=
"doxygen.css" rel=
"stylesheet" type=
"text/css">
5 <link href=
"tabs.css" rel=
"stylesheet" type=
"text/css">
7 <!-- Generated by Doxygen 1.5.6 -->
8 <div class=
"navigation" id=
"top">
11 <li><a href=
"main.html"><span>Main
Page
</span></a></li>
12 <li><a href=
"pages.html"><span>Related
Pages
</span></a></li>
13 <li><a href=
"modules.html"><span>Modules
</span></a></li>
14 <li><a href=
"annotated.html"><span>Data
Structures
</span></a></li>
15 <li class=
"current"><a href=
"files.html"><span>Files
</span></a></li>
16 <li><a href=
"examples.html"><span>Examples
</span></a></li>
18 <form action=
"search.php" method=
"get">
19 <table cellspacing=
"0" cellpadding=
"0" border=
"0">
21 <td><label> <u>S
</u>earch
for
</label></td>
22 <td><input type=
"text" name=
"query" value=
"" size=
"20" accesskey=
"s"/></td>
29 <h1>include/nucleus/timebase.h
</h1><a href=
"timebase_8h.html">Go to the documentation of this file.
</a><div class=
"fragment"><pre class=
"fragment"><a name=
"l00001"></a>00001
30 <a name=
"l00023"></a>00023 <span class=
"preprocessor">#ifndef _XENO_NUCLEUS_TIMEBASE_H
</span>
31 <a name=
"l00024"></a>00024 <span class=
"preprocessor"></span><span class=
"preprocessor">#define _XENO_NUCLEUS_TIMEBASE_H
</span>
32 <a name=
"l00025"></a>00025 <span class=
"preprocessor"></span>
33 <a name=
"l00029"></a>00029 <span class=
"preprocessor">#include
<nucleus/queue.h
></span>
34 <a name=
"l00030"></a>00030
35 <a name=
"l00031"></a>00031 <span class=
"preprocessor">#if defined(__KERNEL__) || defined(__XENO_SIM__)
</span>
36 <a name=
"l00032"></a>00032 <span class=
"preprocessor"></span>
37 <a name=
"l00033"></a>00033 <span class=
"keyword">struct
</span>xntimer;
38 <a name=
"l00034"></a>00034
39 <a name=
"l00035"></a>00035 <span class=
"keyword">typedef
</span> <span class=
"keyword">struct
</span>xntbops {
40 <a name=
"l00036"></a>00036
41 <a name=
"l00037"></a>00037 int (*start_timer)(
<span class=
"keyword">struct
</span>xntimer *timer,
42 <a name=
"l00038"></a>00038 xnticks_t value,
43 <a name=
"l00039"></a>00039 xnticks_t interval,
44 <a name=
"l00040"></a>00040 xntmode_t mode);
45 <a name=
"l00041"></a>00041 void (*stop_timer)(
<span class=
"keyword">struct
</span>xntimer *timer);
46 <a name=
"l00042"></a>00042 xnticks_t (*get_timer_date)(
<span class=
"keyword">struct
</span>xntimer *timer);
47 <a name=
"l00043"></a>00043 xnticks_t (*get_timer_timeout)(
<span class=
"keyword">struct
</span>xntimer *timer);
48 <a name=
"l00044"></a>00044 xnticks_t (*get_timer_interval)(
<span class=
"keyword">struct
</span>xntimer *timer);
49 <a name=
"l00045"></a>00045 xnticks_t (*get_timer_raw_expiry)(
<span class=
"keyword">struct
</span>xntimer *timer);
50 <a name=
"l00046"></a>00046 void (*move_timer)(
<span class=
"keyword">struct
</span>xntimer *timer);
51 <a name=
"l00047"></a>00047
52 <a name=
"l00048"></a>00048 } xntbops_t;
53 <a name=
"l00049"></a>00049
54 <a name=
"l00050"></a>00050 <span class=
"preprocessor">#define XNTBRUN
0x00000001 </span><span class=
"comment">/* Time base is running. */
</span>
55 <a name=
"l00051"></a>00051 <span class=
"preprocessor">#define XNTBSET
0x00000002 </span><span class=
"comment">/* Time set in time base. */
</span>
56 <a name=
"l00052"></a>00052 <span class=
"preprocessor">#define XNTBLCK
0x00000004 </span><span class=
"comment">/* Time base is locked. */
</span>
57 <a name=
"l00053"></a>00053 <span class=
"preprocessor">#define XNTBISO
0x00000008 </span><span class=
"comment">/* Time base uses private wallclock offset */
</span>
58 <a name=
"l00054"></a>00054
59 <a name=
"l00055"></a>00055 <span class=
"keyword">typedef
</span> <span class=
"keyword">struct
</span>xntbase {
60 <a name=
"l00056"></a>00056
61 <a name=
"l00057"></a>00057 <span class=
"keyword">struct
</span>xntbops *ops;
62 <a name=
"l00059"></a>00059 xnticks_t jiffies;
63 <a name=
"l00061"></a>00061 void (*hook)(void);
64 <a name=
"l00063"></a>00063 xnticks_t wallclock_offset;
65 <a name=
"l00065"></a>00065 u_long tickvalue;
66 <a name=
"l00067"></a>00067 u_long ticks2sec;
67 <a name=
"l00069"></a>00069 u_long status;
68 <a name=
"l00071"></a>00071 <span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span> *name;
<span class=
"comment">/* !
< Name of time base. */
</span>
69 <a name=
"l00072"></a>00072
70 <a name=
"l00073"></a>00073 xnholder_t link;
71 <a name=
"l00074"></a>00074
72 <a name=
"l00075"></a>00075 <span class=
"preprocessor">#define link2tbase(ln) container_of(ln, xntbase_t, link)
</span>
73 <a name=
"l00076"></a>00076 <span class=
"preprocessor"></span>
74 <a name=
"l00077"></a>00077 <span class=
"preprocessor">#ifdef CONFIG_XENO_OPT_STATS
</span>
75 <a name=
"l00078"></a>00078 <span class=
"preprocessor"></span> xnqueue_t timerq;
<span class=
"comment">/* !
< Timer holder in timebase. */
</span>
76 <a name=
"l00079"></a>00079
77 <a name=
"l00080"></a>00080 <span class=
"keywordtype">int
</span> timerq_rev;
<span class=
"comment">/* !
< Revision (for non-atomic list walks). */
</span>
78 <a name=
"l00081"></a>00081 <span class=
"preprocessor">#endif
</span><span class=
"comment">/* CONFIG_XENO_OPT_STATS */
</span>
79 <a name=
"l00082"></a>00082
80 <a name=
"l00083"></a>00083 } xntbase_t;
81 <a name=
"l00084"></a>00084
82 <a name=
"l00085"></a>00085 <span class=
"preprocessor">#ifdef __cplusplus
</span>
83 <a name=
"l00086"></a>00086 <span class=
"preprocessor"></span><span class=
"keyword">extern
</span> <span class=
"stringliteral">"C"</span> {
84 <a name=
"l00087"></a>00087 <span class=
"preprocessor">#endif
</span>
85 <a name=
"l00088"></a>00088 <span class=
"preprocessor"></span>
86 <a name=
"l00089"></a>00089 <span class=
"keyword">extern
</span> xntbase_t nktbase;
87 <a name=
"l00090"></a>00090
88 <a name=
"l00091"></a>00091 <span class=
"keyword">extern
</span> xnqueue_t nktimebaseq;
89 <a name=
"l00092"></a>00092
90 <a name=
"l00093"></a>00093 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> u_long xntbase_get_ticks2sec(xntbase_t *base)
91 <a name=
"l00094"></a>00094 {
92 <a name=
"l00095"></a>00095 <span class=
"keywordflow">return
</span> base-
>ticks2sec;
93 <a name=
"l00096"></a>00096 }
94 <a name=
"l00097"></a>00097
95 <a name=
"l00098"></a>00098 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> u_long xntbase_get_tickval(xntbase_t *base)
96 <a name=
"l00099"></a>00099 {
97 <a name=
"l00100"></a>00100 <span class=
"comment">/* Returns the duration of a tick in nanoseconds */
</span>
98 <a name=
"l00101"></a>00101 <span class=
"keywordflow">return
</span> base-
>tickvalue;
99 <a name=
"l00102"></a>00102 }
100 <a name=
"l00103"></a>00103
101 <a name=
"l00104"></a>00104 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t xntbase_get_wallclock_offset(xntbase_t *base)
102 <a name=
"l00105"></a>00105 {
103 <a name=
"l00106"></a>00106 <span class=
"keywordflow">return
</span> base-
>wallclock_offset;
104 <a name=
"l00107"></a>00107 }
105 <a name=
"l00108"></a>00108
106 <a name=
"l00109"></a>00109 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> xntbase_set_hook(xntbase_t *base,
<span class=
"keywordtype">void
</span> (*hook)(
<span class=
"keywordtype">void
</span>))
107 <a name=
"l00110"></a>00110 {
108 <a name=
"l00111"></a>00111 base-
>hook = hook;
109 <a name=
"l00112"></a>00112 }
110 <a name=
"l00113"></a>00113
111 <a name=
"l00114"></a>00114 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> xntbase_timeset_p(xntbase_t *base)
112 <a name=
"l00115"></a>00115 {
113 <a name=
"l00116"></a>00116 <span class=
"keywordflow">return
</span> !!testbits(base-
>status, XNTBSET);
114 <a name=
"l00117"></a>00117 }
115 <a name=
"l00118"></a>00118
116 <a name=
"l00119"></a>00119 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> xntbase_enabled_p(xntbase_t *base)
117 <a name=
"l00120"></a>00120 {
118 <a name=
"l00121"></a>00121 <span class=
"keywordflow">return
</span> !!testbits(base-
>status, XNTBRUN);
119 <a name=
"l00122"></a>00122 }
120 <a name=
"l00123"></a>00123
121 <a name=
"l00124"></a>00124 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> xntbase_isolated_p(xntbase_t *base)
122 <a name=
"l00125"></a>00125 {
123 <a name=
"l00126"></a>00126 <span class=
"keywordflow">return
</span> !!testbits(base-
>status, XNTBISO);
124 <a name=
"l00127"></a>00127 }
125 <a name=
"l00128"></a>00128
126 <a name=
"l00129"></a>00129 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span> *xntbase_name(xntbase_t *base)
127 <a name=
"l00130"></a>00130 {
128 <a name=
"l00131"></a>00131 <span class=
"keywordflow">return
</span> base-
>name;
129 <a name=
"l00132"></a>00132 }
130 <a name=
"l00133"></a>00133
131 <a name=
"l00134"></a>00134 <span class=
"preprocessor">#ifdef CONFIG_XENO_OPT_TIMING_PERIODIC
</span>
132 <a name=
"l00135"></a>00135 <span class=
"preprocessor"></span>
133 <a name=
"l00136"></a>00136 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xntime_t xntbase_ticks2ns(xntbase_t *base, xnticks_t ticks)
134 <a name=
"l00137"></a>00137 {
135 <a name=
"l00138"></a>00138 <span class=
"comment">/* Convert a count of ticks in nanoseconds */
</span>
136 <a name=
"l00139"></a>00139 <span class=
"keywordflow">return
</span> ticks * xntbase_get_tickval(base);
137 <a name=
"l00140"></a>00140 }
138 <a name=
"l00141"></a>00141
139 <a name=
"l00142"></a>00142 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t xntbase_ns2ticks(xntbase_t *base, xntime_t t)
140 <a name=
"l00143"></a>00143 {
141 <a name=
"l00144"></a>00144 <span class=
"keywordflow">return
</span> xnarch_ulldiv(t, xntbase_get_tickval(base), NULL);
142 <a name=
"l00145"></a>00145 }
143 <a name=
"l00146"></a>00146
144 <a name=
"l00147"></a>00147 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> xntbase_master_p(xntbase_t *base)
145 <a name=
"l00148"></a>00148 {
146 <a name=
"l00149"></a>00149 <span class=
"keywordflow">return
</span> base ==
&nktbase;
147 <a name=
"l00150"></a>00150 }
148 <a name=
"l00151"></a>00151
149 <a name=
"l00152"></a>00152 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> xntbase_periodic_p(xntbase_t *base)
150 <a name=
"l00153"></a>00153 {
151 <a name=
"l00154"></a>00154 <span class=
"keywordflow">return
</span> !xntbase_master_p(base);
152 <a name=
"l00155"></a>00155 }
153 <a name=
"l00156"></a>00156
154 <a name=
"l00157"></a>00157 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t xntbase_get_jiffies(xntbase_t *base)
155 <a name=
"l00158"></a>00158 {
156 <a name=
"l00159"></a>00159 <span class=
"keywordflow">return
</span> xntbase_periodic_p(base) ? base-
>jiffies : xnarch_get_cpu_time();
157 <a name=
"l00160"></a>00160 }
158 <a name=
"l00161"></a>00161
159 <a name=
"l00162"></a>00162 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t xntbase_get_rawclock(xntbase_t *base)
160 <a name=
"l00163"></a>00163 {
161 <a name=
"l00164"></a>00164 <span class=
"keywordflow">return
</span> xntbase_periodic_p(base) ? base-
>jiffies : xnarch_get_cpu_tsc();
162 <a name=
"l00165"></a>00165 }
163 <a name=
"l00166"></a>00166
164 <a name=
"l00167"></a>00167 <span class=
"keywordtype">int
</span> <a class=
"code" href=
"group__timebase.html#gfcb0a76ac26eaaa768db89cb54e3f24a" title=
"Allocate a time base.">xntbase_alloc
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span> *name,
165 <a name=
"l00168"></a>00168 u_long period,
166 <a name=
"l00169"></a>00169 u_long flags,
167 <a name=
"l00170"></a>00170 xntbase_t **basep);
168 <a name=
"l00171"></a>00171
169 <a name=
"l00172"></a>00172 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#gf94b8dda1e4cc484c13cb004689a795e" title=
"Free a time base.">xntbase_free
</a>(xntbase_t *base);
170 <a name=
"l00173"></a>00173
171 <a name=
"l00174"></a>00174 <span class=
"keywordtype">int
</span> <a class=
"code" href=
"group__timebase.html#g71112e6b362918b602e01d86d4c07654" title=
"Change the period of a time base.">xntbase_update
</a>(xntbase_t *base,
172 <a name=
"l00175"></a>00175 u_long period);
173 <a name=
"l00176"></a>00176
174 <a name=
"l00177"></a>00177 <span class=
"keywordtype">int
</span> <a class=
"code" href=
"group__timebase.html#gdf44dc347a2b8cb921cbc9f4e2768320" title=
"Replace a time base.">xntbase_switch
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span> *name,
175 <a name=
"l00178"></a>00178 u_long period,
176 <a name=
"l00179"></a>00179 xntbase_t **basep);
177 <a name=
"l00180"></a>00180
178 <a name=
"l00181"></a>00181 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#ge596e43dbf89abb299aa29ae841ec8e0" title=
"Start a time base.">xntbase_start
</a>(xntbase_t *base);
179 <a name=
"l00182"></a>00182
180 <a name=
"l00183"></a>00183 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#g23ae261bf7e2eaa09f05c4c6069a41e1" title=
"Stop a time base.">xntbase_stop
</a>(xntbase_t *base);
181 <a name=
"l00184"></a>00184
182 <a name=
"l00185"></a>00185 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#g15896b6c498acdc5e2516ad0cc9df5ac" title=
"Announce a clock tick to a time base.">xntbase_tick
</a>(xntbase_t *base);
183 <a name=
"l00186"></a>00186
184 <a name=
"l00187"></a>00187 xnticks_t xntbase_ns2ticks_ceil(xntbase_t *base, xntime_t t);
185 <a name=
"l00188"></a>00188
186 <a name=
"l00189"></a>00189 xnticks_t
<a class=
"code" href=
"group__timebase.html#g61ff1abcbe816dd7ce6be2e2c7f2e44b" title=
"Convert a clock value into another time base.">xntbase_convert
</a>(xntbase_t *srcbase,
187 <a name=
"l00190"></a>00190 xnticks_t ticks,
188 <a name=
"l00191"></a>00191 xntbase_t *dstbase);
189 <a name=
"l00192"></a>00192
190 <a name=
"l00193"></a>00193 <span class=
"preprocessor">#else
</span><span class=
"comment">/* !CONFIG_XENO_OPT_TIMING_PERIODIC */
</span>
191 <a name=
"l00194"></a>00194
192 <a name=
"l00195"></a>00195 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timer.html#g26727f15ac845719913dcb703bf0c3fa" title=
"Process a timer tick for the aperiodic master time base.">xntimer_tick_aperiodic
</a>(
<span class=
"keywordtype">void
</span>);
193 <a name=
"l00196"></a>00196
194 <a name=
"l00197"></a>00197 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xntime_t xntbase_ticks2ns(xntbase_t *base, xnticks_t ticks)
195 <a name=
"l00198"></a>00198 {
196 <a name=
"l00199"></a>00199 <span class=
"keywordflow">return
</span> ticks;
197 <a name=
"l00200"></a>00200 }
198 <a name=
"l00201"></a>00201
199 <a name=
"l00202"></a>00202 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t xntbase_ns2ticks(xntbase_t *base, xntime_t t)
200 <a name=
"l00203"></a>00203 {
201 <a name=
"l00204"></a>00204 <span class=
"keywordflow">return
</span> t;
202 <a name=
"l00205"></a>00205 }
203 <a name=
"l00206"></a>00206
204 <a name=
"l00207"></a>00207 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t xntbase_ns2ticks_ceil(xntbase_t *base, xntime_t t)
205 <a name=
"l00208"></a>00208 {
206 <a name=
"l00209"></a>00209 <span class=
"keywordflow">return
</span> t;
207 <a name=
"l00210"></a>00210 }
208 <a name=
"l00211"></a>00211
209 <a name=
"l00212"></a>00212 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> xntbase_master_p(xntbase_t *base)
210 <a name=
"l00213"></a>00213 {
211 <a name=
"l00214"></a>00214 <span class=
"keywordflow">return
</span> 1;
212 <a name=
"l00215"></a>00215 }
213 <a name=
"l00216"></a>00216
214 <a name=
"l00217"></a>00217 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t
<a class=
"code" href=
"group__timebase.html#g61ff1abcbe816dd7ce6be2e2c7f2e44b" title=
"Convert a clock value into another time base.">xntbase_convert
</a>(xntbase_t *srcbase, xnticks_t ticks, xntbase_t *dstbase)
215 <a name=
"l00218"></a>00218 {
216 <a name=
"l00219"></a>00219 <span class=
"keywordflow">return
</span> ticks;
217 <a name=
"l00220"></a>00220 }
218 <a name=
"l00221"></a>00221
219 <a name=
"l00222"></a>00222 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> xntbase_periodic_p(xntbase_t *base)
220 <a name=
"l00223"></a>00223 {
221 <a name=
"l00224"></a>00224 <span class=
"keywordflow">return
</span> 0;
222 <a name=
"l00225"></a>00225 }
223 <a name=
"l00226"></a>00226
224 <a name=
"l00227"></a>00227 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t xntbase_get_jiffies(xntbase_t *base)
225 <a name=
"l00228"></a>00228 {
226 <a name=
"l00229"></a>00229 <span class=
"keywordflow">return
</span> xnarch_get_cpu_time();
227 <a name=
"l00230"></a>00230 }
228 <a name=
"l00231"></a>00231
229 <a name=
"l00232"></a>00232 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t xntbase_get_rawclock(xntbase_t *base)
230 <a name=
"l00233"></a>00233 {
231 <a name=
"l00234"></a>00234 <span class=
"keywordflow">return
</span> xnarch_get_cpu_tsc();
232 <a name=
"l00235"></a>00235 }
233 <a name=
"l00236"></a>00236
234 <a name=
"l00237"></a>00237 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> <a class=
"code" href=
"group__timebase.html#gfcb0a76ac26eaaa768db89cb54e3f24a" title=
"Allocate a time base.">xntbase_alloc
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span> *name, u_long period, u_long flags, xntbase_t **basep)
235 <a name=
"l00238"></a>00238 {
236 <a name=
"l00239"></a>00239 *basep =
&nktbase;
237 <a name=
"l00240"></a>00240 <span class=
"keywordflow">return
</span> 0;
238 <a name=
"l00241"></a>00241 }
239 <a name=
"l00242"></a>00242
240 <a name=
"l00243"></a>00243 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#gf94b8dda1e4cc484c13cb004689a795e" title=
"Free a time base.">xntbase_free
</a>(xntbase_t *base)
241 <a name=
"l00244"></a>00244 {
242 <a name=
"l00245"></a>00245 }
243 <a name=
"l00246"></a>00246
244 <a name=
"l00247"></a>00247 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> <a class=
"code" href=
"group__timebase.html#g71112e6b362918b602e01d86d4c07654" title=
"Change the period of a time base.">xntbase_update
</a>(xntbase_t *base, u_long period)
245 <a name=
"l00248"></a>00248 {
246 <a name=
"l00249"></a>00249 <span class=
"keywordflow">return
</span> 0;
247 <a name=
"l00250"></a>00250 }
248 <a name=
"l00251"></a>00251
249 <a name=
"l00252"></a>00252 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">int
</span> <a class=
"code" href=
"group__timebase.html#gdf44dc347a2b8cb921cbc9f4e2768320" title=
"Replace a time base.">xntbase_switch
</a>(
<span class=
"keyword">const
</span> <span class=
"keywordtype">char
</span> *name, u_long period, xntbase_t **basep)
250 <a name=
"l00253"></a>00253 {
251 <a name=
"l00254"></a>00254 <span class=
"keywordflow">return
</span> period == XN_APERIODIC_TICK ?
0 : -ENODEV;
252 <a name=
"l00255"></a>00255 }
253 <a name=
"l00256"></a>00256
254 <a name=
"l00257"></a>00257 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#ge596e43dbf89abb299aa29ae841ec8e0" title=
"Start a time base.">xntbase_start
</a>(xntbase_t *base)
255 <a name=
"l00258"></a>00258 {
256 <a name=
"l00259"></a>00259 }
257 <a name=
"l00260"></a>00260
258 <a name=
"l00261"></a>00261 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#g23ae261bf7e2eaa09f05c4c6069a41e1" title=
"Stop a time base.">xntbase_stop
</a>(xntbase_t *base)
259 <a name=
"l00262"></a>00262 {
260 <a name=
"l00263"></a>00263 }
261 <a name=
"l00264"></a>00264
262 <a name=
"l00265"></a>00265 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#g15896b6c498acdc5e2516ad0cc9df5ac" title=
"Announce a clock tick to a time base.">xntbase_tick
</a>(xntbase_t *base)
263 <a name=
"l00266"></a>00266 {
264 <a name=
"l00267"></a>00267 <a class=
"code" href=
"group__timer.html#g26727f15ac845719913dcb703bf0c3fa" title=
"Process a timer tick for the aperiodic master time base.">xntimer_tick_aperiodic
</a>();
265 <a name=
"l00268"></a>00268 }
266 <a name=
"l00269"></a>00269
267 <a name=
"l00270"></a>00270 <span class=
"preprocessor">#endif
</span><span class=
"comment">/* !CONFIG_XENO_OPT_TIMING_PERIODIC */
</span>
268 <a name=
"l00271"></a>00271
269 <a name=
"l00299"></a><a class=
"code" href=
"group__timebase.html#g5246b53b5b2d1b11d4fab4312fd16fda">00299</a> <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> xnticks_t
<a class=
"code" href=
"group__timebase.html#g5246b53b5b2d1b11d4fab4312fd16fda" title=
"Get the clock time for a given time base.">xntbase_get_time
</a>(xntbase_t *base)
270 <a name=
"l00300"></a>00300 {
271 <a name=
"l00301"></a>00301 <span class=
"comment">/* Return an adjusted value of the monotonic time with the
</span>
272 <a name=
"l00302"></a>00302 <span class=
"comment"> translated system wallclock offset. */
</span>
273 <a name=
"l00303"></a>00303 <span class=
"keywordflow">return
</span> xntbase_get_jiffies(base) + base-
>wallclock_offset;
274 <a name=
"l00304"></a>00304 }
275 <a name=
"l00305"></a>00305
276 <a name=
"l00306"></a>00306 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"group__timebase.html#gd5b8cfb5270e9f8b73c167d1c7f7d1b2" title=
"Adjust the clock time for the system.">xntbase_adjust_time
</a>(xntbase_t *base, xnsticks_t delta);
277 <a name=
"l00307"></a>00307
278 <a name=
"l00308"></a>00308 <span class=
"preprocessor">#ifdef __cplusplus
</span>
279 <a name=
"l00309"></a>00309 <span class=
"preprocessor"></span>}
280 <a name=
"l00310"></a>00310 <span class=
"preprocessor">#endif
</span>
281 <a name=
"l00311"></a>00311 <span class=
"preprocessor"></span>
282 <a name=
"l00312"></a>00312 <span class=
"preprocessor">#define xntbase_mount() \
</span>
283 <a name=
"l00313"></a>00313 <span class=
"preprocessor">do { \
</span>
284 <a name=
"l00314"></a>00314 <span class=
"preprocessor"> inith(
&nktbase.link); \
</span>
285 <a name=
"l00315"></a>00315 <span class=
"preprocessor"> appendq(
&nktimebaseq,
&nktbase.link); \
</span>
286 <a name=
"l00316"></a>00316 <span class=
"preprocessor"> xntbase_declare_proc(
&nktbase); \
</span>
287 <a name=
"l00317"></a>00317 <span class=
"preprocessor">} while (
0)
</span>
288 <a name=
"l00318"></a>00318 <span class=
"preprocessor"></span>
289 <a name=
"l00319"></a>00319 <span class=
"preprocessor">#define xntbase_umount() \
</span>
290 <a name=
"l00320"></a>00320 <span class=
"preprocessor">do { \
</span>
291 <a name=
"l00321"></a>00321 <span class=
"preprocessor"> xntbase_remove_proc(
&nktbase); \
</span>
292 <a name=
"l00322"></a>00322 <span class=
"preprocessor"> removeq(
&nktimebaseq,
&nktbase.link); \
</span>
293 <a name=
"l00323"></a>00323 <span class=
"preprocessor">} while (
0)
</span>
294 <a name=
"l00324"></a>00324 <span class=
"preprocessor"></span>
295 <a name=
"l00325"></a>00325 <span class=
"preprocessor">#endif
</span><span class=
"comment">/* __KERNEL__ || __XENO_SIM__ */
</span>
296 <a name=
"l00326"></a>00326
297 <a name=
"l00327"></a>00327 <span class=
"keywordtype">void
</span> xntbase_init_proc(
<span class=
"keywordtype">void
</span>);
298 <a name=
"l00328"></a>00328
299 <a name=
"l00329"></a>00329 <span class=
"keywordtype">void
</span> xntbase_cleanup_proc(
<span class=
"keywordtype">void
</span>);
300 <a name=
"l00330"></a>00330
301 <a name=
"l00331"></a>00331 <span class=
"preprocessor">#ifdef CONFIG_XENO_OPT_STATS
</span>
302 <a name=
"l00332"></a>00332 <span class=
"preprocessor"></span><span class=
"keywordtype">void
</span> xntbase_declare_proc(xntbase_t *base);
303 <a name=
"l00333"></a>00333 <span class=
"keywordtype">void
</span> xntbase_remove_proc(xntbase_t *base);
304 <a name=
"l00334"></a>00334 <span class=
"preprocessor">#else
</span><span class=
"comment">/* !CONFIG_XENO_OPT_STATS */
</span>
305 <a name=
"l00335"></a>00335 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> xntbase_declare_proc(xntbase_t *base) { }
306 <a name=
"l00336"></a>00336 <span class=
"keyword">static
</span> <span class=
"keyword">inline
</span> <span class=
"keywordtype">void
</span> xntbase_remove_proc(xntbase_t *base) { }
307 <a name=
"l00337"></a>00337 <span class=
"preprocessor">#endif
</span><span class=
"comment">/* !CONFIG_XENO_OPT_STATS */
</span>
308 <a name=
"l00338"></a>00338
309 <a name=
"l00341"></a>00341 <span class=
"preprocessor">#endif
</span><span class=
"comment">/* !_XENO_NUCLEUS_TIMEBASE_H */
</span>
311 <hr size=
"1"><address style=
"text-align: right;"><small>Generated on Tue Mar
8 13:
02:
04 2011 for Xenomai API by
312 <a href=
"http://www.doxygen.org/index.html">
313 <img src=
"doxygen.png" alt=
"doxygen" align=
"middle" border=
"0"></a> 1.5.6 </small></address>