File: group__timer.html

package info (click to toggle)
xenomai 2.5.4-3squeeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 36,140 kB
  • ctags: 35,509
  • sloc: ansic: 109,084; sh: 11,745; makefile: 2,205; xml: 1,356; asm: 613; php: 316; perl: 155
file content (545 lines) | stat: -rw-r--r-- 30,343 bytes parent folder | download
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
<!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: Timer services.</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.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><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>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Timer services.<br>
<small>
[<a class="el" href="group__nucleus.html">Xenomai nucleus.</a>]</small>
</h1>
<p>
<div class="dynheader">
Collaboration diagram for Timer services.:</div>
<div class="dynsection">
<center><table><tr><td><img src="group__timer.png" border="0" alt="" usemap="#group____timer_map">
<map name="group____timer_map">
<area shape="rect" href="group__nucleus.html" title="Xenomai nucleus." alt="" coords="5,5,141,32"></map></td></tr></table></center>
</div>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The Xenomai timer facility always operate the timer hardware in oneshot mode, regardless of the time base in effect. Periodic timing is obtained through a software emulation, using cascading timers.<p>
Depending on the time base used, the timer object stores time values either as count of jiffies (periodic), or as count of CPU ticks (aperiodic). 
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Files</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="include_2nucleus_2timer_8h.html">timer.h</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ksrc_2nucleus_2timer_8c.html">timer.c</a></td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g0ad3c70bed7fe1a45b45ee0875f031ab">xntimer_start</a> (xntimer_t *timer, xnticks_t value, xnticks_t interval, xntmode_t mode)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Arm a timer.  <a href="#g0ad3c70bed7fe1a45b45ee0875f031ab"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g1244411df9784d63d3e2f99016d62643">xntimer_stop</a> (xntimer_t *timer)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Disarm a timer.  <a href="#g1244411df9784d63d3e2f99016d62643"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static xnticks_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#ge87b875cf9f6831afffcfee8dabd67a8">xntimer_get_date</a> (xntimer_t *timer)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the absolute expiration date.  <a href="#ge87b875cf9f6831afffcfee8dabd67a8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static xnticks_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g00d603a038b09e436717b84975b00abf">xntimer_get_timeout</a> (xntimer_t *timer)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the relative expiration date.  <a href="#g00d603a038b09e436717b84975b00abf"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static xnticks_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#gb0d00a02bf04fdd48987d5d4efa68190">xntimer_get_interval</a> (xntimer_t *timer)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the timer interval value.  <a href="#gb0d00a02bf04fdd48987d5d4efa68190"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g26727f15ac845719913dcb703bf0c3fa">xntimer_tick_aperiodic</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Process a timer tick for the aperiodic master time base.  <a href="#g26727f15ac845719913dcb703bf0c3fa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g9b5391e752a8e16d89fb6a99c76bb7b1">xntimer_tick_periodic</a> (xntimer_t *mtimer)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Process a timer tick for a slave periodic time base.  <a href="#g9b5391e752a8e16d89fb6a99c76bb7b1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g834e46fb4c1ecaab949eea77b9dee284">xntimer_init</a> (xntimer_t *timer, xntbase_t *base, void(*handler)(xntimer_t *timer))</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize a timer object.  <a href="#g834e46fb4c1ecaab949eea77b9dee284"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g782e10b2cd24a5c303b316375940ca15">xntimer_destroy</a> (xntimer_t *timer)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Release a timer object.  <a href="#g782e10b2cd24a5c303b316375940ca15"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned long&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g5609dd2602efe2c5b04eda28b22b9720">xntimer_get_overruns</a> (xntimer_t *timer, xnticks_t now)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the count of overruns for the last tick.  <a href="#g5609dd2602efe2c5b04eda28b22b9720"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#g5cad677279089ef19d3710b1b6452a71">xntimer_freeze</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Freeze all timers (from every time bases).  <a href="#g5cad677279089ef19d3710b1b6452a71"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g782e10b2cd24a5c303b316375940ca15"></a><!-- doxytag: member="timer.c::xntimer_destroy" ref="g782e10b2cd24a5c303b316375940ca15" args="(xntimer_t *timer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntimer_destroy           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>timer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Release a timer object. 
<p>
Destroys a timer. After it has been destroyed, all resources associated with the timer have been released. The timer is automatically deactivated before deletion if active on entry.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>The address of a valid timer descriptor.</td></tr>
  </table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never. 
<p>References <a class="el" href="include_2nucleus_2timer_8h-source.html#l00505">xntimer_stop()</a>.</p>

<p>Referenced by <a class="el" href="ksrc_2skins_2native_2alarm_8c-source.html#l00269">rt_alarm_delete()</a>, <a class="el" href="drvlib_8c-source.html#l00527">rtdm_timer_destroy()</a>, <a class="el" href="pod_8c-source.html#l01078">xnpod_delete_thread()</a>, and <a class="el" href="pod_8c-source.html#l00461">xnpod_shutdown()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g5cad677279089ef19d3710b1b6452a71"></a><!-- doxytag: member="timer.c::xntimer_freeze" ref="g5cad677279089ef19d3710b1b6452a71" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntimer_freeze           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Freeze all timers (from every time bases). 
<p>
<p><b>For internal use only.</b></p>
<p>
This routine deactivates all active timers atomically.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never. </p>

<p>Referenced by <a class="el" href="pod_8c-source.html#l02774">xnpod_disable_timesource()</a>.</p>

</div>
</div><p>
<a class="anchor" name="ge87b875cf9f6831afffcfee8dabd67a8"></a><!-- doxytag: member="timer.h::xntimer_get_date" ref="ge87b875cf9f6831afffcfee8dabd67a8" args="(xntimer_t *timer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">xnticks_t xntimer_get_date           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>timer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Return the absolute expiration date. 
<p>
Return the next expiration date of a timer in absolute clock ticks (see note).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>The address of a valid timer descriptor.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The expiration date converted to the current time unit. The special value XN_INFINITE is returned if <em>timer</em> is currently inactive.</dd></dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This service is sensitive to the current operation mode of the associated time base, as defined by the xnpod_init_timebase() service. In periodic mode, clock ticks are interpreted as periodic jiffies. In oneshot mode, clock ticks are interpreted as nanoseconds. </dd></dl>

<p>Referenced by <a class="el" href="clock_8c-source.html#l00221">clock_nanosleep()</a>, and <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l01126">rt_task_inquire()</a>.</p>

</div>
</div><p>
<a class="anchor" name="gb0d00a02bf04fdd48987d5d4efa68190"></a><!-- doxytag: member="timer.h::xntimer_get_interval" ref="gb0d00a02bf04fdd48987d5d4efa68190" args="(xntimer_t *timer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">xnticks_t xntimer_get_interval           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>timer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Return the timer interval value. 
<p>
Return the timer interval value in clock ticks (see note).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>The address of a valid timer descriptor.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The expiration date converted to the current time unit. The special value XN_INFINITE is returned if <em>timer</em> is currently inactive or aperiodic.</dd></dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This service is sensitive to the current operation mode of the associated time base, as defined by the xnpod_init_timebase() service. In periodic mode, clock ticks are interpreted as periodic jiffies. In oneshot mode, clock ticks are interpreted as nanoseconds. </dd></dl>

</div>
</div><p>
<a class="anchor" name="g5609dd2602efe2c5b04eda28b22b9720"></a><!-- doxytag: member="timer.c::xntimer_get_overruns" ref="g5609dd2602efe2c5b04eda28b22b9720" args="(xntimer_t *timer, xnticks_t now)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned long xntimer_get_overruns           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>timer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xnticks_t&nbsp;</td>
          <td class="paramname"> <em>now</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get the count of overruns for the last tick. 
<p>
This service returns the count of pending overruns for the last tick of a given timer, as measured by the difference between the expected expiry date of the timer and the date <em>now</em> passed as argument.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>The address of a valid timer descriptor.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>now</em>&nbsp;</td><td>current date (in the monotonic time base)</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the number of overruns of <em>timer</em> at date <em>now</em> </dd></dl>

<p>Referenced by <a class="el" href="pod_8c-source.html#l02961">xnpod_wait_thread_period()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g00d603a038b09e436717b84975b00abf"></a><!-- doxytag: member="timer.h::xntimer_get_timeout" ref="g00d603a038b09e436717b84975b00abf" args="(xntimer_t *timer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">xnticks_t xntimer_get_timeout           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>timer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Return the relative expiration date. 
<p>
Return the next expiration date of a timer in relative clock ticks (see note).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>The address of a valid timer descriptor.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The expiration date converted to the current time unit. The special value XN_INFINITE is returned if <em>timer</em> is currently inactive. In oneshot mode, it might happen that the timer has already expired when this service is run (even if the associated handler has not been fired yet); in such a case, 1 is returned.</dd></dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This service is sensitive to the current operation mode of the associated time base, as defined by the xnpod_init_timebase() service. In periodic mode, clock ticks are interpreted as periodic jiffies. In oneshot mode, clock ticks are interpreted as nanoseconds. </dd></dl>

<p>Referenced by <a class="el" href="ksrc_2skins_2native_2alarm_8c-source.html#l00468">rt_alarm_inquire()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g834e46fb4c1ecaab949eea77b9dee284"></a><!-- doxytag: member="timer.c::xntimer_init" ref="g834e46fb4c1ecaab949eea77b9dee284" args="(xntimer_t *timer, xntbase_t *base, void(*handler)(xntimer_t *timer))" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntimer_init           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>timer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xntbase_t *&nbsp;</td>
          <td class="paramname"> <em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(xntimer_t *timer)&nbsp;</td>
          <td class="paramname"> <em>handler</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Initialize a timer object. 
<p>
Creates a timer. When created, a timer is left disarmed; it must be started using <a class="el" href="group__timer.html#g0ad3c70bed7fe1a45b45ee0875f031ab" title="Arm a timer.">xntimer_start()</a> in order to be activated.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>The address of a timer descriptor the nucleus will use to store the object-specific data. This descriptor must always be valid while the object is active therefore it must be allocated in permanent memory.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>base</em>&nbsp;</td><td>The descriptor address of the time base the new timer depends on. See <a class="el" href="group__timebase.html#gfcb0a76ac26eaaa768db89cb54e3f24a" title="Allocate a time base.">xntbase_alloc()</a> for detailed explanations about time bases.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>handler</em>&nbsp;</td><td>The routine to call upon expiration of the timer.</td></tr>
  </table>
</dl>
There is no limitation on the number of timers which can be created/active concurrently.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never. 
<p>Referenced by <a class="el" href="ksrc_2skins_2native_2alarm_8c-source.html#l00187">rt_alarm_create()</a>, <a class="el" href="ksrc_2skins_2posix_2timer_8c-source.html#l00133">timer_create()</a>, and <a class="el" href="pod_8c-source.html#l00339">xnpod_init()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g0ad3c70bed7fe1a45b45ee0875f031ab"></a><!-- doxytag: member="timer.h::xntimer_start" ref="g0ad3c70bed7fe1a45b45ee0875f031ab" args="(xntimer_t *timer, xnticks_t value, xnticks_t interval, xntmode_t mode)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntimer_start           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>timer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xnticks_t&nbsp;</td>
          <td class="paramname"> <em>value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xnticks_t&nbsp;</td>
          <td class="paramname"> <em>interval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xntmode_t&nbsp;</td>
          <td class="paramname"> <em>mode</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Arm a timer. 
<p>
Activates a timer so that the associated timeout handler will be fired after each expiration time. A timer can be either periodic or single-shot, depending on the reload value passed to this routine. The given timer must have been previously initialized, and will be clocked according to the policy defined by the time base specified in <a class="el" href="group__timer.html#g834e46fb4c1ecaab949eea77b9dee284" title="Initialize a timer object.">xntimer_init()</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>The address of a valid timer descriptor.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>The date of the initial timer shot, expressed in clock ticks (see note).</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>interval</em>&nbsp;</td><td>The reload value of the timer. It is a periodic interval value to be used for reprogramming the next timer shot, expressed in clock ticks (see note). If <em>interval</em> is equal to XN_INFINITE, the timer will not be reloaded after it has expired.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>mode</em>&nbsp;</td><td>The timer mode. It can be XN_RELATIVE if <em>value</em> shall be interpreted as a relative date, XN_ABSOLUTE for an absolute date based on the monotonic clock of the related time base (as returned my xntbase_get_jiffies()), or XN_REALTIME if the absolute date is based on the adjustable real-time clock of the time base (as returned by <a class="el" href="group__timebase.html#g5246b53b5b2d1b11d4fab4312fd16fda" title="Get the clock time for a given time base.">xntbase_get_time()</a>.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned upon success, or -ETIMEDOUT if an absolute date in the past has been given.</dd></dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This service is sensitive to the current operation mode of the associated time base, as defined by the xnpod_init_timebase() service. In periodic mode, clock ticks are interpreted as periodic jiffies. In oneshot mode, clock ticks are interpreted as nanoseconds.<p>
Must be called with nklock held, IRQs off. </dd></dl>

<p>Referenced by <a class="el" href="ksrc_2skins_2native_2alarm_8c-source.html#l00358">rt_alarm_start()</a>, <a class="el" href="drvlib_8c-source.html#l00565">rtdm_timer_start()</a>, <a class="el" href="ksrc_2skins_2posix_2timer_8c-source.html#l00335">timer_settime()</a>, <a class="el" href="pod_8c-source.html#l02669">xnpod_enable_timesource()</a>, <a class="el" href="pod_8c-source.html#l02860">xnpod_set_thread_periodic()</a>, <a class="el" href="pod_8c-source.html#l03058">xnpod_set_thread_tslice()</a>, and <a class="el" href="pod_8c-source.html#l01361">xnpod_suspend_thread()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g1244411df9784d63d3e2f99016d62643"></a><!-- doxytag: member="timer.h::xntimer_stop" ref="g1244411df9784d63d3e2f99016d62643" args="(xntimer_t *timer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int xntimer_stop           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>timer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Disarm a timer. 
<p>
This service deactivates a timer previously armed using <a class="el" href="group__timer.html#g0ad3c70bed7fe1a45b45ee0875f031ab" title="Arm a timer.">xntimer_start()</a>. Once disarmed, the timer can be subsequently re-armed using the latter service.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>The address of a valid timer descriptor.</td></tr>
  </table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>Interrupt service routine</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Must be called with nklock held, IRQs off. </dd></dl>

<p>Referenced by <a class="el" href="ksrc_2skins_2native_2alarm_8c-source.html#l00408">rt_alarm_stop()</a>, <a class="el" href="drvlib_8c-source.html#l00598">rtdm_timer_stop()</a>, <a class="el" href="ksrc_2skins_2posix_2timer_8c-source.html#l00335">timer_settime()</a>, <a class="el" href="pod_8c-source.html#l01575">xnpod_resume_thread()</a>, <a class="el" href="pod_8c-source.html#l02860">xnpod_set_thread_periodic()</a>, <a class="el" href="pod_8c-source.html#l03058">xnpod_set_thread_tslice()</a>, and <a class="el" href="ksrc_2nucleus_2timer_8c-source.html#l00903">xntimer_destroy()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g26727f15ac845719913dcb703bf0c3fa"></a><!-- doxytag: member="timer.c::xntimer_tick_aperiodic" ref="g26727f15ac845719913dcb703bf0c3fa" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntimer_tick_aperiodic           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Process a timer tick for the aperiodic master time base. 
<p>
<p><b>For internal use only.</b></p>
<p>
This routine informs all active timers that the clock has been updated by processing the outstanding timer list. Elapsed timer actions will be fired.<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Interrupt service routine, nklock locked, interrupts off</li></ul>
<p>
Rescheduling: never. </p>

<p>References <a class="el" href="sched_8h-source.html#l00077">xnsched::htimer</a>, <a class="el" href="sched_8h-source.html#l00062">xnsched::status</a>, and <a class="el" href="sched_8h-source.html#l00075">xnsched::timerqueue</a>.</p>

<p>Referenced by <a class="el" href="timebase_8c-source.html#l00476">xntbase_tick()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g9b5391e752a8e16d89fb6a99c76bb7b1"></a><!-- doxytag: member="timer.c::xntimer_tick_periodic" ref="g9b5391e752a8e16d89fb6a99c76bb7b1" args="(xntimer_t *mtimer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntimer_tick_periodic           </td>
          <td>(</td>
          <td class="paramtype">xntimer_t *&nbsp;</td>
          <td class="paramname"> <em>mtimer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Process a timer tick for a slave periodic time base. 
<p>
<p><b>For internal use only.</b></p>
<p>
The periodic timer tick is cascaded from a software timer managed from the master aperiodic time base; in other words, periodic timing is emulated by software timers running in aperiodic timing mode. There may be several concurrent periodic time bases (albeit a single aperiodic time base - i.e. the master one called "nktbase" - may exist at any point in time).<p>
This routine informs all active timers that the clock has been updated by processing the timer wheel. Elapsed timer actions will be fired.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>mtimer</em>&nbsp;</td><td>The address of the cascading timer running in the master time base which announced the tick.</td></tr>
  </table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Interrupt service routine, nklock locked, interrupts off</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Only active timers are inserted into the timer wheel. </dd></dl>
</p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Aug 2 12:48:38 2010 for Xenomai API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>