File: group__timebase.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 (555 lines) | stat: -rw-r--r-- 32,379 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
546
547
548
549
550
551
552
553
554
555
<!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: Time base 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>Time base services.<br>
<small>
[<a class="el" href="group__nucleus.html">Xenomai nucleus.</a>]</small>
</h1>
<p>
<div class="dynheader">
Collaboration diagram for Time base services.:</div>
<div class="dynsection">
<center><table><tr><td><img src="group__timebase.png" border="0" alt="" usemap="#group____timebase_map">
<map name="group____timebase_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>
Xenomai implements the notion of time base, by which software timers that belong to different skins may be clocked separately according to distinct frequencies, or aperiodically. In the periodic case, delays and timeouts are given in counts of ticks; the duration of a tick is specified by the time base. In the aperiodic case, timings are directly specified in nanoseconds.<p>
Only a single aperiodic (i.e. tick-less) time base may exist in the system, and the nucleus provides for it through the nktbase object. All skins depending on aperiodic timings should bind to the latter (see <a class="el" href="group__timebase.html#gfcb0a76ac26eaaa768db89cb54e3f24a" title="Allocate a time base.">xntbase_alloc()</a>), also known as the master time base.<p>
Skins depending on periodic timings may create and bind to their own time base. Such a periodic time base is managed as a timed slave object of the master time base. A cascading software timer fired by the master time base according to the appropriate frequency, triggers in turn the update process of the associated timed slave, which eventually fires the elapsed software timers controlled by the periodic time base. In other words, Xenomai emulates periodic timing over an aperiodic policy.<p>
Xenomai always controls the underlying timer hardware in a tick-less fashion, also known as the oneshot mode. 
<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="timebase_8h.html">timebase.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="timebase_8c.html">timebase.c</a></td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timebase.html#gfcb0a76ac26eaaa768db89cb54e3f24a">xntbase_alloc</a> (const char *name, u_long period, u_long flags, xntbase_t **basep)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate a time base.  <a href="#gfcb0a76ac26eaaa768db89cb54e3f24a"></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__timebase.html#gf94b8dda1e4cc484c13cb004689a795e">xntbase_free</a> (xntbase_t *base)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Free a time base.  <a href="#gf94b8dda1e4cc484c13cb004689a795e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timebase.html#g71112e6b362918b602e01d86d4c07654">xntbase_update</a> (xntbase_t *base, u_long period)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Change the period of a time base.  <a href="#g71112e6b362918b602e01d86d4c07654"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timebase.html#gdf44dc347a2b8cb921cbc9f4e2768320">xntbase_switch</a> (const char *name, u_long period, xntbase_t **basep)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Replace a time base.  <a href="#gdf44dc347a2b8cb921cbc9f4e2768320"></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__timebase.html#ge596e43dbf89abb299aa29ae841ec8e0">xntbase_start</a> (xntbase_t *base)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start a time base.  <a href="#ge596e43dbf89abb299aa29ae841ec8e0"></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__timebase.html#g23ae261bf7e2eaa09f05c4c6069a41e1">xntbase_stop</a> (xntbase_t *base)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Stop a time base.  <a href="#g23ae261bf7e2eaa09f05c4c6069a41e1"></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__timebase.html#g15896b6c498acdc5e2516ad0cc9df5ac">xntbase_tick</a> (xntbase_t *base)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Announce a clock tick to a time base.  <a href="#g15896b6c498acdc5e2516ad0cc9df5ac"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">xnticks_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timebase.html#g61ff1abcbe816dd7ce6be2e2c7f2e44b">xntbase_convert</a> (xntbase_t *srcbase, xnticks_t ticks, xntbase_t *dstbase)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Convert a clock value into another time base.  <a href="#g61ff1abcbe816dd7ce6be2e2c7f2e44b"></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__timebase.html#g5246b53b5b2d1b11d4fab4312fd16fda">xntbase_get_time</a> (xntbase_t *base)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the clock time for a given time base.  <a href="#g5246b53b5b2d1b11d4fab4312fd16fda"></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__timebase.html#gd5b8cfb5270e9f8b73c167d1c7f7d1b2">xntbase_adjust_time</a> (xntbase_t *base, xnsticks_t delta)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adjust the clock time for the system.  <a href="#gd5b8cfb5270e9f8b73c167d1c7f7d1b2"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="gd5b8cfb5270e9f8b73c167d1c7f7d1b2"></a><!-- doxytag: member="timebase.h::xntbase_adjust_time" ref="gd5b8cfb5270e9f8b73c167d1c7f7d1b2" args="(xntbase_t *base, xnsticks_t delta)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntbase_adjust_time           </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">xnsticks_t&nbsp;</td>
          <td class="paramname"> <em>delta</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Adjust the clock time for the system. 
<p>
Xenomai tracks the current time as a monotonously increasing count of ticks since the epoch. The epoch is initially the same as the underlying machine time, and it is always synchronised across all active time bases.<p>
This service changes the epoch for the system by applying the specified tick delta on the master's wallclock offset and resynchronizing all other time bases.<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>base</em>&nbsp;</td><td>The address of the initiating time base.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>delta</em>&nbsp;</td><td>The adjustment of the system time expressed in ticks of the specified time base.</td></tr>
  </table>
</dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This routine must be entered nklock locked, interrupts off.</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>Referenced by <a class="el" href="clock_8c-source.html#l00157">clock_settime()</a>.</p>

</div>
</div><p>
<a class="anchor" name="gfcb0a76ac26eaaa768db89cb54e3f24a"></a><!-- doxytag: member="timebase.h::xntbase_alloc" ref="gfcb0a76ac26eaaa768db89cb54e3f24a" args="(const char *name, u_long period, u_long flags, xntbase_t **basep)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int xntbase_alloc           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u_long&nbsp;</td>
          <td class="paramname"> <em>period</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u_long&nbsp;</td>
          <td class="paramname"> <em>flags</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xntbase_t **&nbsp;</td>
          <td class="paramname"> <em>basep</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Allocate a time base. 
<p>
A time base is an abstraction used to provide private clocking information to real-time skins, by which they may operate either in aperiodic or periodic mode, possibly according to distinct clock frequencies in the latter case. This abstraction is required in order to support several RTOS emulators running concurrently, which may exhibit different clocking policies and/or period.<p>
Once allocated, a time base may be attached to all software timers created directly or indirectly by a given skin, and influences all timed services accordingly.<p>
The <a class="el" href="group__timebase.html#gfcb0a76ac26eaaa768db89cb54e3f24a" title="Allocate a time base.">xntbase_alloc()</a> service allocates a new time base to the caller, and returns the address of its descriptor. The new time base is left in a disabled state (unless <em>period</em> equals XN_APERIODIC_TICK), calling <a class="el" href="group__timebase.html#ge596e43dbf89abb299aa29ae841ec8e0" title="Start a time base.">xntbase_start()</a> is needed to enable it.<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>name</em>&nbsp;</td><td>The symbolic name of the new time base. This information is used to report status information when reading from /proc/xenomai/timebases; it has currently no other usage.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>period</em>&nbsp;</td><td>The duration of the clock tick for the new time base, given as a count of nanoseconds. The special <em>XN_APERIODIC_TICK</em> value may be used to retrieve the master - aperiodic - time base, which is always up and running when a real-time skin has called the <a class="el" href="group__pod.html#g167bb3b4251ac8b8a3e7f358d236908a" title="Initialize the core pod.">xnpod_init()</a> service. All other values are meant to define the clock rate of a periodic time base. For instance, passing 1000000 (ns) in the <em>period</em> parameter will create a periodic time base clocked at a frequency of 1Khz.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>flags</em>&nbsp;</td><td>A bitmask composed as follows:</td></tr>
  </table>
</dl>
<ul>
<li>XNTBISO causes the target timebase to be isolated from global wallclock offset updates as performed by <a class="el" href="group__timebase.html#gd5b8cfb5270e9f8b73c167d1c7f7d1b2" title="Adjust the clock time for the system.">xntbase_adjust_time()</a>.</li></ul>
<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>basep</em>&nbsp;</td><td>A pointer to a memory location which will be written upon success with the address of the allocated time base. If <em>period</em> equals XN_APERIODIC_TICK, the address of the built-in master time base descriptor will be copied back to this location.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise:</dd></dl>
<ul>
<li>-ENOMEM is returned if no system memory is available to allocate a new time base descriptor.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization code</li><li>User-space task in secondary mode</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Any periodic time base allocated by a real-time skin must be released by a call to <a class="el" href="group__timebase.html#gf94b8dda1e4cc484c13cb004689a795e" title="Free a time base.">xntbase_free()</a> before the kernel module implementing the skin may be unloaded. </dd></dl>

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

</div>
</div><p>
<a class="anchor" name="g61ff1abcbe816dd7ce6be2e2c7f2e44b"></a><!-- doxytag: member="timebase.h::xntbase_convert" ref="g61ff1abcbe816dd7ce6be2e2c7f2e44b" args="(xntbase_t *srcbase, xnticks_t ticks, xntbase_t *dstbase)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">xnticks_t xntbase_convert           </td>
          <td>(</td>
          <td class="paramtype">xntbase_t *&nbsp;</td>
          <td class="paramname"> <em>srcbase</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xnticks_t&nbsp;</td>
          <td class="paramname"> <em>ticks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xntbase_t *&nbsp;</td>
          <td class="paramname"> <em>dstbase</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Convert a clock value into another time base. 
<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>srcbase</em>&nbsp;</td><td>The descriptor address of the source time base.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>ticks</em>&nbsp;</td><td>The clock value expressed in the source time base to convert to the destination time base.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>dstbase</em>&nbsp;</td><td>The descriptor address of the destination time base.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The converted count of ticks in the destination time base is returned.</dd></dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
Rescheduling: never. 
</div>
</div><p>
<a class="anchor" name="gf94b8dda1e4cc484c13cb004689a795e"></a><!-- doxytag: member="timebase.h::xntbase_free" ref="gf94b8dda1e4cc484c13cb004689a795e" args="(xntbase_t *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntbase_free           </td>
          <td>(</td>
          <td class="paramtype">xntbase_t *&nbsp;</td>
          <td class="paramname"> <em>base</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Free a time base. 
<p>
This service disarms all outstanding timers from the affected periodic time base, destroys the aperiodic cascading timer, then releases the time base descriptor.<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>base</em>&nbsp;</td><td>The address of the time base descriptor to release.</td></tr>
  </table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization/cleanup code</li><li>User-space task in secondary mode</li></ul>
<p>
Rescheduling: never.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Requests to free the master time base are silently caught and discarded; in such a case, outstanding aperiodic timers are left untouched. </dd></dl>

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

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

<p>
Get the clock time for a given time base. 
<p>
This service returns the (external) clock time as maintained by the specified time base. This value is adjusted with the wallclock offset as defined by <a class="el" href="group__timebase.html#gd5b8cfb5270e9f8b73c167d1c7f7d1b2" title="Adjust the clock time for the system.">xntbase_adjust_time()</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>base</em>&nbsp;</td><td>The address of the time base to query.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The current time (in jiffies) if the specified time base runs in periodic mode, or the machine time (converted to nanoseconds) as maintained by the hardware if <em>base</em> refers to the master time base.</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>Referenced by <a class="el" href="clock_8c-source.html#l00114">clock_gettime()</a>, <a class="el" href="clock_8c-source.html#l00157">clock_settime()</a>, <a class="el" href="ksrc_2skins_2native_2task_8c-source.html#l00992">rt_task_sleep_until()</a>, <a class="el" href="ksrc_2skins_2native_2timer_8c-source.html#l00073">rt_timer_inquire()</a>, and <a class="el" href="nucleus_2registry_8c-source.html#l00715">xnregistry_bind()</a>.</p>

</div>
</div><p>
<a class="anchor" name="ge596e43dbf89abb299aa29ae841ec8e0"></a><!-- doxytag: member="timebase.h::xntbase_start" ref="ge596e43dbf89abb299aa29ae841ec8e0" args="(xntbase_t *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntbase_start           </td>
          <td>(</td>
          <td class="paramtype">xntbase_t *&nbsp;</td>
          <td class="paramname"> <em>base</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Start a time base. 
<p>
This service enables a time base, using a cascading timer running in the master time base as the source of periodic clock ticks. The time base is synchronised on the Xenomai system clock. Timers attached to the started time base are immediated armed.<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>base</em>&nbsp;</td><td>The address of the time base descriptor to start.</td></tr>
  </table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization code</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>Requests to enable the master time base are silently caught and discarded; only the internal service <a class="el" href="group__pod.html#g10d3c13efa3ab06ac23017710b13314e" title="Activate the core time source.">xnpod_enable_timesource()</a> is allowed to start the latter. The master time base remains enabled until no real-time skin remains attached to the nucleus. </dd></dl>

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

</div>
</div><p>
<a class="anchor" name="g23ae261bf7e2eaa09f05c4c6069a41e1"></a><!-- doxytag: member="timebase.h::xntbase_stop" ref="g23ae261bf7e2eaa09f05c4c6069a41e1" args="(xntbase_t *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntbase_stop           </td>
          <td>(</td>
          <td class="paramtype">xntbase_t *&nbsp;</td>
          <td class="paramname"> <em>base</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Stop a time base. 
<p>
This service disables a time base, stopping the cascading timer running in the master time base which is used to clock it. Outstanding timers attached to the stopped time base are immediated disarmed.<p>
Stopping a time base also invalidates its clock setting.<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>base</em>&nbsp;</td><td>The address of the time base descriptor to stop.</td></tr>
  </table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization code</li><li>Kernel-based task</li><li>User-space task</li></ul>
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Requests to disable the master time base are silently caught and discarded; only the internal service <a class="el" href="group__pod.html#g179f47d6e98446843f059790112dcce3" title="Stop the core time source.">xnpod_disable_timesource()</a> is allowed to stop the latter. The master time base remains enabled until no real-time skin remains attached to the nucleus. </dd></dl>

</div>
</div><p>
<a class="anchor" name="gdf44dc347a2b8cb921cbc9f4e2768320"></a><!-- doxytag: member="timebase.h::xntbase_switch" ref="gdf44dc347a2b8cb921cbc9f4e2768320" args="(const char *name, u_long period, xntbase_t **basep)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int xntbase_switch           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u_long&nbsp;</td>
          <td class="paramname"> <em>period</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xntbase_t **&nbsp;</td>
          <td class="paramname"> <em>basep</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Replace a time base. 
<p>
This service is useful for switching the current time base of a real-time skin between aperiodic and periodic modes, by providing a new time base descriptor as needed. The original time base descriptor is freed as a result of this operation (unless it refers to the master time base). The new time base is automatically started by a call to <a class="el" href="group__timebase.html#ge596e43dbf89abb299aa29ae841ec8e0" title="Start a time base.">xntbase_start()</a> if the original time base was enabled at the time of the call, or left in a disabled state otherwise.<p>
This call handles all mode transitions and configuration changes carefully, i.e. periodic &lt;-&gt; periodic, aperiodic &lt;-&gt; aperiodic, periodic &lt;-&gt; aperiodic.<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>name</em>&nbsp;</td><td>The symbolic name of the new time base. This information is used to report status information when reading from /proc/xenomai/timebases; it has currently no other usage.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>period</em>&nbsp;</td><td>The duration of the clock tick for the time base, given as a count of nanoseconds. This value is meant to define the new clock rate of the new periodic time base (i.e. 1e9 / period).</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>basep</em>&nbsp;</td><td>A pointer to a memory location which will be first read to pick the address of the original time base to be replaced, then written back upon success with the address of the new time base. A null pointer is allowed on input in <em>basep</em>, in which case the new time base will be created as if <a class="el" href="group__timebase.html#gfcb0a76ac26eaaa768db89cb54e3f24a" title="Allocate a time base.">xntbase_alloc()</a> had been called directly.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise:</dd></dl>
<ul>
<li>-ENOMEM is returned if no system memory is available to allocate a new time base descriptor.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization code</li><li>User-space task in secondary mode</li></ul>
<p>
Rescheduling: never. 
<p>References <a class="el" href="timebase_8c-source.html#l00125">xntbase_alloc()</a>, <a class="el" href="timebase_8c-source.html#l00200">xntbase_free()</a>, <a class="el" href="timebase_8c-source.html#l00379">xntbase_start()</a>, and <a class="el" href="timebase_8c-source.html#l00249">xntbase_update()</a>.</p>

<p>Referenced by <a class="el" href="ksrc_2skins_2native_2timer_8c-source.html#l00173">rt_timer_set_mode()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g15896b6c498acdc5e2516ad0cc9df5ac"></a><!-- doxytag: member="timebase.h::xntbase_tick" ref="g15896b6c498acdc5e2516ad0cc9df5ac" args="(xntbase_t *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void xntbase_tick           </td>
          <td>(</td>
          <td class="paramtype">xntbase_t *&nbsp;</td>
          <td class="paramname"> <em>base</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Announce a clock tick to a time base. 
<p>
This service announces a new clock tick to a time base. Normally, only specialized nucleus code would announce clock ticks. However, under certain circumstances, it may be useful to allow client code to send such notifications on their own.<p>
Notifying a clock tick to a time base causes the timer management code to check for outstanding timers, which may in turn fire off elapsed timeout handlers. Additionally, periodic time bases (i.e. all but the master time base) would also update their count of elapsed jiffies, in case the current processor has been defined as the internal time keeper (i.e. CPU# == XNTIMER_KEEPER_ID).<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>base</em>&nbsp;</td><td>The address of the time base descriptor to announce a tick to.</td></tr>
  </table>
</dl>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Interrupt context only.</li></ul>
<p>
Rescheduling: never. 
<p>References <a class="el" href="ksrc_2nucleus_2timer_8c-source.html#l00341">xntimer_tick_aperiodic()</a>.</p>

</div>
</div><p>
<a class="anchor" name="g71112e6b362918b602e01d86d4c07654"></a><!-- doxytag: member="timebase.h::xntbase_update" ref="g71112e6b362918b602e01d86d4c07654" args="(xntbase_t *base, u_long period)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int xntbase_update           </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">u_long&nbsp;</td>
          <td class="paramname"> <em>period</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Change the period of a time base. 
<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>base</em>&nbsp;</td><td>The address of the time base descriptor to update.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>period</em>&nbsp;</td><td>The duration of the clock tick for the time base, given as a count of nanoseconds. This value is meant to define the new clock rate of the affected periodic time base (i.e. 1e9 / period).</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 is returned on success. Otherwise:</dd></dl>
<ul>
<li>-EINVAL is returned if an attempt is made to set a null period.</li></ul>
<p>
Environments:<p>
This service can be called from:<p>
<ul>
<li>Kernel module initialization code</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>Requests to update the master time base are silently caught and discarded. The master time base has a fixed aperiodic policy which may not be changed. </dd></dl>

<p>Referenced by <a class="el" href="timebase_8c-source.html#l00316">xntbase_switch()</a>.</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>