<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<title>Timers</title>
<meta name="author" content="Cory Sharp, Martin Turon, David Gay" />
<style type="text/css">
dd {
margin-bottom: 0.5em }
-/* Uncomment (& remove this text!) to get bold-faced definition list terms
-dt {
- font-weight: bold }
-*/
-
div.abstract {
margin: 2em 5em }
<tr class="field"><th class="docinfo-name">Type:</th><td class="field-body">Documentary</td>
</tr>
<tr><th class="docinfo-name">Status:</th>
-<td>Draft</td></tr>
+<td>Final</td></tr>
<tr class="field"><th class="docinfo-name">TinyOS-Version:</th><td class="field-body">2.x</td>
</tr>
<tr><th class="docinfo-name">Author:</th>
<td>Cory Sharp, Martin Turon, David Gay</td></tr>
-<tr class="field"><th class="docinfo-name">Draft-Created:</th><td class="field-body">22-Sep-2004</td>
-</tr>
-<tr class="field"><th class="docinfo-name">Draft-Version:</th><td class="field-body">1.8</td>
-</tr>
-<tr class="field"><th class="docinfo-name">Draft-Modified:</th><td class="field-body">2007-05-23</td>
-</tr>
-<tr class="field"><th class="docinfo-name">Draft-Discuss:</th><td class="field-body">TinyOS Developer List <tinyos-devel at mail.millennium.berkeley.edu></td>
-</tr>
</tbody>
</table>
<div class="note">
is motivated by the common availability of hardware clocks driven
by a 32768Hz crystal.</p>
<p>Examples of widths are 8-bit, 16-bit, 32-bit, and 64-bit. The width
-for timer interfaces and components SHOULD be 32-bits. That is, for
-lack of a good reason, timer interfaces should expose a 32-bit
-interface. In a number of circumstances there are good reasons not
-to expose a 32-bit interface. This TEP emphasizes 32-bit widths
-while reasonably accommodating other widths.</p>
+for timer interfaces and components SHOULD be 32-bits. This TEP
+emphasizes 32-bit widths while reasonably accommodating other widths -
+a particular platform may have good reasons not to expose a 32-bit
+interface.</p>
<p>Accuracy reflects how closely a component conforms to the precision it
claims to provide. Accuracy is affected by issues such as clock drift (much
higher for internal vs crystal oscillators) and hardware limitations. As an
<dt>stop()</dt>
<dd>cancel any previously running alarm.</dd>
<dt>fired()</dt>
-<dd>signals that the alarm has occurred.</dd>
+<dd>signals that the alarm has expired.</dd>
<dt>isRunning()</dt>
<dd>return TRUE if the alarm has been started and has not been cancelled
or has not yet fired. FALSE is returned otherwise.</dd>
the TOSH_uwait macro from TinyOS 1.x.</p>
<p>BusyWait blocks for no less than the specified amount of time. No
explicit upper bound is imposed on the enacted delay, though it is
-expected the underlying implementation spins in a busy loop until
+expected that the underlying implementation spins in a busy loop until
the specified amount of time has elapsed.</p>
<pre class="literal-block">
interface BusyWait<precision_tag,size_type>
<dt>stop()</dt>
<dd>cancel any previously running timer.</dd>
<dt>fired()</dt>
-<dd>signals that the timer has occurred.</dd>
+<dd>signals that the timer has expired (one-shot) or repeated (periodic).</dd>
<dt>isRunning()</dt>
<dd>return TRUE if the timer has been started and has not been cancelled
-and has not fired for the case of one-shot timers. One a periodic
+and has not fired for the case of one-shot timers. Once a periodic
timer is started, isRunning will return TRUE until it is cancelled.</dd>
<dt>isOneShot()</dt>
<dd>return TRUE if the timer is a one-shot timer. Return FALSE
provides interface Alarm< T32khz, uint8_t >;
}
</pre>
-<p>This pattern MAY be used to defined components for the platform that
-are mutually incompatible in single application. Incompatible
+<p>This pattern MAY be used to define components for the platform that
+are mutually incompatible in a single application. Incompatible
components SHOULD produce compile-time errors when compiled
together.</p>
</div>
<div class="section">
<h1><a id="hil-requirements" name="hil-requirements">4. HIL requirements</a></h1>
-<dl class="docutils">
-<dt>The following component MUST be provided on all platforms::</dt>
-<dd>HilTimerMilliC
-BusyWaitMicroC</dd>
-</dl>
+<p>The following component MUST be provided on all platforms</p>
+<pre class="literal-block">
+HilTimerMilliC
+BusyWaitMicroC
+</pre>
+<p>Both of these components use "binary" units, i.e., 1/1024s for
+HilTimerMilliC and 1/1048576s for BusyWaitMicroC. Components using
+other precisions (e.g., regular, non-binary milliseconds) MAY also be
+provided.</p>
<div class="section">
<h2><a id="hiltimermillic" name="hiltimermillic">HilTimerMilliC</a></h2>
<pre class="literal-block">
<li><tt class="docutils literal"><span class="pre">VirtualizeTimerC.nc</span></tt></li>
</ul>
</blockquote>
-<p>The implementation of Timers for the MSP430 is in
+<p>The implementation of timers for the MSP430 is in
<tt class="docutils literal"><span class="pre">tinyos-2.x/tos/chips/msp430/timer</span></tt>:</p>
<blockquote>
<ul class="simple">
special function registers</li>
</ul>
</blockquote>
+<p>Implementation of timers for the ATmega128 and PXA27x may be found in
+<tt class="docutils literal"><span class="pre">tinyos-2.x/tos/chips/atm128/timer</span></tt> and
+<tt class="docutils literal"><span class="pre">tinyos-2.x/tos/chips/pxa27x/timer</span></tt> respectively.</p>
</div>
<div class="section">
<h1><a id="author-s-address" name="author-s-address">7. Author's Address</a></h1>