[Tinyos-2-commits] CVS: tinyos-2.x/doc/html tep102.html, 1.1.2.9, 1.1.2.10

David Gay idgay at users.sourceforge.net
Wed Oct 18 10:27:19 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/doc/html
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28431/html

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	tep102.html 
Log Message:
minor english tweaks


Index: tep102.html
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/doc/html/tep102.html,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -C2 -d -r1.1.2.9 -r1.1.2.10
*** tep102.html	27 Jun 2006 20:23:04 -0000	1.1.2.9
--- tep102.html	18 Oct 2006 17:27:17 -0000	1.1.2.10
***************
*** 4,8 ****
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
! <meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
  <title>Timers</title>
  <meta name="author" content="Cory Sharp, Martin Turon, David Gay" />
--- 4,8 ----
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
! <meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
  <title>Timers</title>
  <meta name="author" content="Cory Sharp, Martin Turon, David Gay" />
***************
*** 304,310 ****
  <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.1.2.4</td>
  </tr>
! <tr class="field"><th class="docinfo-name">Draft-Modified:</th><td class="field-body">2006-06-16</td>
  </tr>
  <tr class="field"><th class="docinfo-name">Draft-Discuss:</th><td class="field-body">TinyOS Developer List &lt;tinyos-devel at mail.millennium.berkeley.edu&gt;</td>
--- 304,310 ----
  <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.1.2.6</td>
  </tr>
! <tr class="field"><th class="docinfo-name">Draft-Modified:</th><td class="field-body">2006-10-17</td>
  </tr>
  <tr class="field"><th class="docinfo-name">Draft-Discuss:</th><td class="field-body">TinyOS Developer List &lt;tinyos-devel at mail.millennium.berkeley.edu&gt;</td>
***************
*** 319,324 ****
  TEP 1.</p>
  </div>
! <div class="section">
! <h1><a id="abstract" name="abstract">Abstract</a></h1>
  <p>This TEP proposes a Timer design that supports common timing
  requirements both in precision and width across common hardware
--- 319,324 ----
  TEP 1.</p>
  </div>
! <div class="section" id="abstract">
! <h1><a name="abstract">Abstract</a></h1>
  <p>This TEP proposes a Timer design that supports common timing
  requirements both in precision and width across common hardware
***************
*** 326,331 ****
  with the three-layer Hardware Abstraction Architecture (HAA).</p>
  </div>
! <div class="section">
! <h1><a id="introduction" name="introduction">1. Introduction</a></h1>
  <p>Most microcontrollers offer a rich timer system, with features like:</p>
  <ul class="simple">
--- 326,331 ----
  with the three-layer Hardware Abstraction Architecture (HAA).</p>
  </div>
! <div class="section" id="introduction">
! <h1><a name="introduction">1. Introduction</a></h1>
  <p>Most microcontrollers offer a rich timer system, with features like:</p>
  <ul class="simple">
***************
*** 341,345 ****
  HAA[_tep2], each microcontroller should expose all this functionality
  via components and interfaces at the HPL and, where appropriate, HAL levels.
! However, two aspects of timers are sufficiently common and important
  that they should be made available in a well-defined way: measuring time,
  and triggering (possibly repeating) events at specific times. The rest
--- 341,345 ----
  HAA[_tep2], each microcontroller should expose all this functionality
  via components and interfaces at the HPL and, where appropriate, HAL levels.
! However, two aspects of timers are sufficiently common and important 
  that they should be made available in a well-defined way: measuring time,
  and triggering (possibly repeating) events at specific times. The rest
***************
*** 350,354 ****
  <li>guidelines on how each microcontroller's HAL SHOULD expose its timer hardware
  in terms of the above interfaces (<a class="reference" href="#hal-guidelines">3. HAL guidelines</a>)</li>
! <li>what components a microcontroller's timer HIL MUST implement
  (<a class="reference" href="#hil-requirements">4. HIL requirements</a>)</li>
  <li>a set of utility components whose use simplifies building the components
--- 350,354 ----
  <li>guidelines on how each microcontroller's HAL SHOULD expose its timer hardware
  in terms of the above interfaces (<a class="reference" href="#hal-guidelines">3. HAL guidelines</a>)</li>
! <li>what components a microcontroller's timer HIL MUST implement 
  (<a class="reference" href="#hil-requirements">4. HIL requirements</a>)</li>
  <li>a set of utility components whose use simplifies building the components
***************
*** 358,368 ****
  timer subsystem implementation.</p>
  </div>
! <div class="section">
! <h1><a id="interfaces" name="interfaces">2. Interfaces</a></h1>
  <p>Before presenting the interfaces (2.2), we start with a general
  discussion of the issues of precision, width and accuracy in
  timer interfaces (2.1).</p>
! <div class="section">
! <h2><a id="precision-width-and-accuracy" name="precision-width-and-accuracy">2.1 Precision, Width and Accuracy.</a></h2>
  <p>Three fundamental properties of timers are <em>precision</em>, <em>width</em> and
  <em>accuracy</em>.</p>
--- 358,368 ----
  timer subsystem implementation.</p>
  </div>
! <div class="section" id="interfaces">
! <h1><a name="interfaces">2. Interfaces</a></h1>
  <p>Before presenting the interfaces (2.2), we start with a general
  discussion of the issues of precision, width and accuracy in
  timer interfaces (2.1).</p>
! <div class="section" id="precision-width-and-accuracy">
! <h2><a name="precision-width-and-accuracy">2.1 Precision, Width and Accuracy.</a></h2>
  <p>Three fundamental properties of timers are <em>precision</em>, <em>width</em> and
  <em>accuracy</em>.</p>
***************
*** 405,410 ****
  period, whichever is convenient.</p>
  </div>
! <div class="section">
! <h2><a id="timer-interfaces" name="timer-interfaces">2.2 Timer interfaces</a></h2>
  <p>This TEP proposes these timer interfaces:</p>
  <pre class="literal-block">
--- 405,410 ----
  period, whichever is convenient.</p>
  </div>
! <div class="section" id="timer-interfaces">
! <h2><a name="timer-interfaces">2.2 Timer interfaces</a></h2>
  <p>This TEP proposes these timer interfaces:</p>
  <pre class="literal-block">
***************
*** 420,426 ****
  advanced user components.</p>
  </div>
! <div class="section">
! <h2><a id="counter" name="counter">Counter</a></h2>
! <p>A Counter component will increase the width of a low-level hardware timer
  by wrapping the overflow event and incrementing its higher order bits.
  These higher order bits are considered extra state over the HPL register
--- 420,426 ----
  advanced user components.</p>
  </div>
! <div class="section" id="counter">
! <h2><a name="counter">Counter</a></h2>
! <p>A Counter component will increase the width of a low-level hardware timer 
  by wrapping the overflow event and incrementing its higher order bits.
  These higher order bits are considered extra state over the HPL register
***************
*** 440,459 ****
  </pre>
  <dl class="docutils">
! <dt>get()</dt>
  <dd>return the current time.</dd>
! <dt>isOverflowPending()</dt>
! <dd>return TRUE if an overflow interrupt will occur after the outermost
! atomic block is exits.  FALSE otherwise.</dd>
! <dt>clearOverflow()</dt>
! <dd>cancel the pending overflow interrupt.</dd>
! <dt>overflow()</dt>
  <dd>signals that an overflow in the current time.  That is, the current
  time has wrapped around from its maximum value to zero.</dd>
  </dl>
  </div>
! <div class="section">
! <h2><a id="alarm" name="alarm">Alarm</a></h2>
  <p>Alarm components are extensions of Counters that signal an event
! when their Compare register detects the alarm time has been hit.
  All commands and events of the Alarm interface are asynchronous (or
  in &quot;interrupt context&quot;).  The Alarm interface provides a set of
--- 440,466 ----
  </pre>
  <dl class="docutils">
! <dt>get() </dt>
  <dd>return the current time.</dd>
! </dl>
! <p>isOverflowPending()</p>
! <blockquote>
! return TRUE if the overflow flag is set for this counter, i.e., if and
! only if an overflow interrupt will occur after the outermost atomic
! block exits.  Return FALSE otherwise.  This command only returns the
! state of the overflow flag and causes no side effect.  It is expected
! that the underlying hardware platforms sets the overflow flag when
! appropriate.</blockquote>
! <dl class="docutils">
! <dt>clearOverflow() </dt>
! <dd>cancel the pending overflow interrupt clearing the overflow flag.</dd>
! <dt>overflow() </dt>
  <dd>signals that an overflow in the current time.  That is, the current
  time has wrapped around from its maximum value to zero.</dd>
  </dl>
  </div>
! <div class="section" id="alarm">
! <h2><a name="alarm">Alarm</a></h2>
  <p>Alarm components are extensions of Counters that signal an event
! when their compare register detects the alarm time has been hit.
  All commands and events of the Alarm interface are asynchronous (or
  in &quot;interrupt context&quot;).  The Alarm interface provides a set of
***************
*** 476,508 ****
  </pre>
  <dl class="docutils">
! <dt>start(dt)</dt>
  <dd>cancel any previously running alarm and set to fire in dt time units
  from the time of invocation.  The alarm will only fire once then
  stop.</dd>
! <dt>stop()</dt>
  <dd>cancel any previously running alarm.</dd>
! <dt>fired()</dt>
  <dd>signals that the alarm has occurred.</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>
! <dt>startAt(t0,dt)</dt>
! <dd>cancel any previously running alarm and set to fire at time t1 =
! t0+dt.  This form allows a delay to be anchored to some time t0
! taken before the invocation of start.  This is also the form used
! internally in the timer subsystem to allow the use of the full width
! of an alarm while being able to detect if the alarm time for a short
! alarm prematurely elapsed.</dd>
! <dt>getNow()</dt>
  <dd>return the current time in the precision and width of the alarm.</dd>
! <dt>getAlarm()</dt>
  <dd>return the time the currently running alarm will fire or the time
! that the previously running alarm was set to fire.</dd>
  </dl>
  </div>
! <div class="section">
! <h2><a id="busywait" name="busywait">BusyWait</a></h2>
! <p>The BusyWait interface replaces the TOSH_uwait macro from TinyOS
! 1.x.</p>
  <pre class="literal-block">
  interface BusyWait&lt;precision_tag,size_type&gt;
--- 483,526 ----
  </pre>
  <dl class="docutils">
! <dt>start(dt) </dt>
  <dd>cancel any previously running alarm and set to fire in dt time units
  from the time of invocation.  The alarm will only fire once then
  stop.</dd>
! <dt>stop() </dt>
  <dd>cancel any previously running alarm.</dd>
! <dt>fired() </dt>
  <dd>signals that the alarm has occurred.</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>
! </dl>
! <p>startAt(t0,dt)</p>
! <blockquote>
! cancel any previously running alarm and set to fire at time t1 =
! t0+dt.  This form allows a delay to be anchored to some time t0 taken
! before the invocation of startAt.  The timer subsystem uses this form
! internally, to be able to use of the full width of an alarm while also
! detecting when a short alarm elapses prematurely.</blockquote>
! <dl class="docutils">
! <dt>getNow() </dt>
  <dd>return the current time in the precision and width of the alarm.</dd>
! <dt>getAlarm() </dt>
  <dd>return the time the currently running alarm will fire or the time
! that the previously running alarm was set to fire.  getAlarm can
! be used with startAt to set an alarm from the previous alarm time,
! as in startAt(getAlarm(),dt).  This pattern is used within the
! fired() event to construct periodic alarms.</dd>
  </dl>
  </div>
! <div class="section" id="busywait">
! <h2><a name="busywait">BusyWait</a></h2>
! <p>The BusyWait interface allows for very short synchronous delays.
! BusyWait should be used sparingly and when an Alarm would not be
! reasonably efficient or accurate.  The BusyWait interface replaces
! 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
! the specified amount of time has elapsed.</p>
  <pre class="literal-block">
  interface BusyWait&lt;precision_tag,size_type&gt;
***************
*** 513,521 ****
  <dl class="docutils">
  <dt>wait(dt)</dt>
! <dd>block for no less than the specified amount of time.</dd>
  </dl>
  </div>
! <div class="section">
! <h2><a id="localtime" name="localtime">LocalTime</a></h2>
  <p>The LocalTime interface exposes a 32-bit counter without overflow
  utilities.  This is primarily for application code that does not
--- 531,539 ----
  <dl class="docutils">
  <dt>wait(dt)</dt>
! <dd>block until at least dt time units have elapsed</dd>
  </dl>
  </div>
! <div class="section" id="localtime">
! <h2><a name="localtime">LocalTime</a></h2>
  <p>The LocalTime interface exposes a 32-bit counter without overflow
  utilities.  This is primarily for application code that does not
***************
*** 528,537 ****
  </pre>
  <dl class="docutils">
! <dt>get()</dt>
  <dd>return the current time.</dd>
  </dl>
  </div>
! <div class="section">
! <h2><a id="timer" name="timer">Timer</a></h2>
  <p>All commands and events of the Timer interface are synchronous (or
  in &quot;task context&quot;).  The Timer interface provides a set of &quot;basic&quot;
--- 546,555 ----
  </pre>
  <dl class="docutils">
! <dt>get() </dt>
  <dd>return the current time.</dd>
  </dl>
  </div>
! <div class="section" id="timer">
! <h2><a name="timer">Timer</a></h2>
  <p>All commands and events of the Timer interface are synchronous (or
  in &quot;task context&quot;).  The Timer interface provides a set of &quot;basic&quot;
***************
*** 558,640 ****
  </pre>
  <dl class="docutils">
! <dt>startPeriodic(dt)</dt>
  <dd>cancel any previously running timer and set to fire in dt time units
  from the time of invocation.  The timer will fire periodically every
  dt time units until stopped.</dd>
! <dt>startOneShot(dt)</dt>
  <dd>cancel any previously running timer and set to fire in dt time units
  from the time of invocation.  The timer will only fire once then
  stop.</dd>
! <dt>stop()</dt>
  <dd>cancel any previously running timer.</dd>
  <dt>fired()</dt>
  <dd>signals that the timer has occurred.</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
  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
  otherwise if the timer is a periodic timer.</dd>
! <dt>startPeriodicAt(t0,dt)</dt>
  <dd>cancel any previously running timer and set to fire at time t1 =
  t0+dt.  The timer will fire periodically every dt time units until
  stopped.</dd>
! <dt>startOneShotAt(t0,dt)</dt>
  <dd>cancel any previously running timer and set to fire at time t1 =
  t0+dt.  The timer will fire once then stop.</dd>
! <dt>getNow()</dt>
  <dd>return the current time in the precision and width of the timer.</dd>
! <dt>gett0()</dt>
  <dd>return the time anchor for the previously started timer or the time
  of the previous event for periodic timers.</dd>
! <dt>getdt()</dt>
  <dd>return the delay or period for the previously started timer.</dd>
  </dl>
  </div>
  </div>
! <div class="section">
! <h1><a id="hal-guidelines" name="hal-guidelines">3. HAL guidelines</a></h1>
! <p>Platforms typically select a clocking option for each of their
! hardware counters, based on their hardware design (e.g., the mica
! family of motes all run their hardware timer 0 at 32kHz, and the micaz
! mote runs its timer 1 at cpu frequency/256). Platforms SHOULD expose
! the timing functionality of these timers using the Alarm and Counter
! interfaces, in the fashion described below. Platforms MAY expose the
! same hardware timer with different frequencies - use of conflicting
! frequences in the same program SHOULD produce compile-time
! errors.</p>
! <p>A hardware timer with precision <em>P</em> and width <em>W</em> SHOULD be exposed as a
! several components:</p>
  <pre class="literal-block">
! configuration CounterPWC {
!   provides interface Counter&lt;TP, uintW_t&gt;;
! } ...
! generic configuration AlarmPWC {
!   provides interface Alarm&lt;TP,uintW_t&gt;;
! } ...
  </pre>
! <p>and, except if <em>W</em> is 32:</p>
  <pre class="literal-block">
! configuration CounterP32C {
!   provides interface Counter&lt;TP, uint32_t&gt;;
! } ...
! generic configuration AlarmP32C {
!   provides interface Alarm&lt;TP,uint32_t&gt;;
! } ...
  </pre>
! <p>Instantiating the Alarm... components provides a new Alarm independent
! of all prior instantiations. Instantiating such a component &quot;consumes&quot;
! a compare register from the corresponding hardware timer; when no more
! compare registers are available, instantiation SHOULD produce a
! compile-time error (see Appendix B for an example of how to achieve
! this).</p>
! <p>For example, the micaz platform includes an AlarmMilli8C and
! AlarmMilli32C components for timer 0 (one instantiation allowed), and
! Alarm32kHz16C and Alarm32kHz32C for timer 1 (three instantiations
! allowed).</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>
--- 576,663 ----
  </pre>
  <dl class="docutils">
! <dt>startPeriodic(dt) </dt>
  <dd>cancel any previously running timer and set to fire in dt time units
  from the time of invocation.  The timer will fire periodically every
  dt time units until stopped.</dd>
! <dt>startOneShot(dt) </dt>
  <dd>cancel any previously running timer and set to fire in dt time units
  from the time of invocation.  The timer will only fire once then
  stop.</dd>
! <dt>stop() </dt>
  <dd>cancel any previously running timer.</dd>
  <dt>fired()</dt>
  <dd>signals that the timer has occurred.</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
  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
  otherwise if the timer is a periodic timer.</dd>
! <dt>startPeriodicAt(t0,dt) </dt>
  <dd>cancel any previously running timer and set to fire at time t1 =
  t0+dt.  The timer will fire periodically every dt time units until
  stopped.</dd>
! <dt>startOneShotAt(t0,dt) </dt>
  <dd>cancel any previously running timer and set to fire at time t1 =
  t0+dt.  The timer will fire once then stop.</dd>
! <dt>getNow() </dt>
  <dd>return the current time in the precision and width of the timer.</dd>
! <dt>gett0() </dt>
  <dd>return the time anchor for the previously started timer or the time
  of the previous event for periodic timers.</dd>
! <dt>getdt() </dt>
  <dd>return the delay or period for the previously started timer.</dd>
  </dl>
  </div>
  </div>
! <div class="section" id="hal-guidelines">
! <h1><a name="hal-guidelines">3. HAL guidelines</a></h1>
! <p>Platforms SHOULD expose their relevant timing capabilities using
! standard Alarm and Counter interfaces.  The design pattern presented
! here defines a component naming convention to allow platform
! independent access to particular Alarms and Counters if they exist
! and to cause compile errors if they do not.</p>
! <p>A platform specific hardware timer with precision ${P} and width
! ${W} SHOULD be exposed as these two conventional Counter and Alarm
! components:</p>
  <pre class="literal-block">
! configuration Counter${P}${W}C
! {
!   provides interface Counter&lt; T${P}, uint${W}_t &gt;;
! }
! 
! generic configuration Alarm${P}${W}C
! {
!   provides interface Alarm&lt; T${P}, uint${W}_t &gt;;
! }
  </pre>
! <p>Instantiating a Alarm${P}${W}C component provides a new and
! independent Alarm.  If the platform presents a limited number of
! Alarm resources, then allocating more Alarms in an application than
! are available for the platform SHOULD produce a compile-time error.
! See Appendix B for an example of how to make allocatable Alarms that
! are each implemented on independent hardware timers.</p>
! <p>For example, if a platform has an 8-bit 32kHz counter and three
! 8-bit 32kHz alarms, then the Counter and Alarm interfaces for
! ${P}=32khz and ${W}=16 are:</p>
  <pre class="literal-block">
! configuration Counter32khz8C
! {
!   provides interface Counter&lt; T32khz, uint8_t &gt;;
! }
! 
! generic configuration Alarm32khz8C
! {
!   provides interface Alarm&lt; T32khz, uint8_t &gt;;
! }
  </pre>
! <p>This pattern MAY be used to defined components for the platform that
! are mutually incompatible in single application.  Incompatible
! components SHOULD produce compile-time errors when compiled
! together.</p>
  </div>
! <div class="section" id="hil-requirements">
! <h1><a name="hil-requirements">4. HIL requirements</a></h1>
  <dl class="docutils">
  <dt>The following component MUST be provided on all platforms::</dt>
***************
*** 642,649 ****
  BusyWaitMicroC</dd>
  </dl>
! <div class="section">
! <h2><a id="timermillic" name="timermillic">TimerMilliC</a></h2>
  <pre class="literal-block">
- #define TIMERMILLIC_SERVICE ...
  configuration TimerMilliC
  {
--- 665,671 ----
  BusyWaitMicroC</dd>
  </dl>
! <div class="section" id="timermillic">
! <h2><a name="timermillic">TimerMilliC</a></h2>
  <pre class="literal-block">
  configuration TimerMilliC
  {
***************
*** 653,662 ****
  }
  </pre>
! <p>A timer is allocated using unique(TIMERMILLIC_SERVICE) to obtain a new
! unique timer number. This timer number is used to index the TimerMilli
! parameterised interface.</p>
  </div>
! <div class="section">
! <h2><a id="busywaitmicroc" name="busywaitmicroc">BusyWaitMicroC</a></h2>
  <pre class="literal-block">
  configuration BusyWaitMicroC
--- 675,685 ----
  }
  </pre>
! <p>A new timer is allocated using unique(UQ_TIMER_MILLI) to obtain a
! new unique timer number.  This timer number is used to index the
! TimerMilli parameterised interface.  UQ_TIMER_MILLI is defined in
! Timer.h.</p>
  </div>
! <div class="section" id="busywaitmicroc">
! <h2><a name="busywaitmicroc">BusyWaitMicroC</a></h2>
  <pre class="literal-block">
  configuration BusyWaitMicroC
***************
*** 666,676 ****
  </pre>
  <p>BusyWaitMicroC allows applications to busy-wait for a number of
! microseconds. It's use should be restricted to situations where the
  delay is small and setting a timer or alarm would be impractical,
  inefficient or insufficiently precise.</p>
  </div>
  </div>
! <div class="section">
! <h1><a id="utility-components" name="utility-components">5. Utility components</a></h1>
  <p>A number of platform independent generic components are provided to
  help implementers and advanced users of the TinyOS timer system:</p>
--- 689,699 ----
  </pre>
  <p>BusyWaitMicroC allows applications to busy-wait for a number of
! microseconds. Its use should be restricted to situations where the
  delay is small and setting a timer or alarm would be impractical,
  inefficient or insufficiently precise.</p>
  </div>
  </div>
! <div class="section" id="utility-components">
! <h1><a name="utility-components">5. Utility components</a></h1>
  <p>A number of platform independent generic components are provided to
  help implementers and advanced users of the TinyOS timer system:</p>
***************
*** 685,690 ****
  <p>Appendices B and C show how these can be used to help implement
  the timer HAL and HIL.</p>
! <div class="section">
! <h2><a id="alarmtotimerc" name="alarmtotimerc">AlarmToTimerC</a></h2>
  <p>AlarmToTimerC converts a 32-bit Alarm to a Timer.</p>
  <pre class="literal-block">
--- 708,713 ----
  <p>Appendices B and C show how these can be used to help implement
  the timer HAL and HIL.</p>
! <div class="section" id="alarmtotimerc">
! <h2><a name="alarmtotimerc">AlarmToTimerC</a></h2>
  <p>AlarmToTimerC converts a 32-bit Alarm to a Timer.</p>
  <pre class="literal-block">
***************
*** 696,701 ****
  </pre>
  </div>
! <div class="section">
! <h2><a id="busywaitcounterc" name="busywaitcounterc">BusyWaitCounterC</a></h2>
  <p>BusyWaitCounterC uses a Counter to block until a specified amount of
  time elapses.</p>
--- 719,724 ----
  </pre>
  </div>
! <div class="section" id="busywaitcounterc">
! <h2><a name="busywaitcounterc">BusyWaitCounterC</a></h2>
  <p>BusyWaitCounterC uses a Counter to block until a specified amount of
  time elapses.</p>
***************
*** 709,714 ****
  </pre>
  </div>
! <div class="section">
! <h2><a id="countertolocaltimec" name="countertolocaltimec">CounterToLocalTimeC</a></h2>
  <p>CounterToLocalTimeC converts from a 32-bit Counter to LocalTime.</p>
  <pre class="literal-block">
--- 732,737 ----
  </pre>
  </div>
! <div class="section" id="countertolocaltimec">
! <h2><a name="countertolocaltimec">CounterToLocalTimeC</a></h2>
  <p>CounterToLocalTimeC converts from a 32-bit Counter to LocalTime.</p>
  <pre class="literal-block">
***************
*** 720,729 ****
  </pre>
  </div>
! <div class="section">
! <h2><a id="transformalarmc" name="transformalarmc">TransformAlarmC</a></h2>
  <p>TransformAlarmC decreases precision and/or widens an Alarm.  An
  already widened Counter component is used to help.</p>
  <pre class="literal-block">
! generic component TransformAlarmC(
    typedef to_precision_tag,
    typedef to_size_type &#64;integer(),
--- 743,752 ----
  </pre>
  </div>
! <div class="section" id="transformalarmc">
! <h2><a name="transformalarmc">TransformAlarmC</a></h2>
  <p>TransformAlarmC decreases precision and/or widens an Alarm.  An
  already widened Counter component is used to help.</p>
  <pre class="literal-block">
! generic component TransformAlarmC( 
    typedef to_precision_tag,
    typedef to_size_type &#64;integer(),
***************
*** 748,754 ****
  new TransformAlarmC( TMilli, uint32_t, T32khz, uint16_t, 5 )
  </pre>
  </div>
! <div class="section">
! <h2><a id="transformcounterc" name="transformcounterc">TransformCounterC</a></h2>
  <p>TransformCounterC decreases precision and/or widens a Counter.</p>
  <pre class="literal-block">
--- 771,781 ----
  new TransformAlarmC( TMilli, uint32_t, T32khz, uint16_t, 5 )
  </pre>
+ <p>It is the exclusive responsibility of the developer using
+ TransformAlarmC to ensure that all five of its arguments are self
+ consistent.  No compile errors are generated if the parameters
+ passed to TransformAlarmC are inconsistent.</p>
  </div>
! <div class="section" id="transformcounterc">
! <h2><a name="transformcounterc">TransformCounterC</a></h2>
  <p>TransformCounterC decreases precision and/or widens a Counter.</p>
  <pre class="literal-block">
***************
*** 781,786 ****
  </pre>
  </div>
! <div class="section">
! <h2><a id="virtualizetimerc" name="virtualizetimerc">VirtualizeTimerC</a></h2>
  <p>VirtualizeTimerC uses a single Timer to create up to 255 virtual
  timers.</p>
--- 808,813 ----
  </pre>
  </div>
! <div class="section" id="virtualizetimerc">
! <h2><a name="virtualizetimerc">VirtualizeTimerC</a></h2>
  <p>VirtualizeTimerC uses a single Timer to create up to 255 virtual
  timers.</p>
***************
*** 795,800 ****
  </div>
  </div>
! <div class="section">
! <h1><a id="appendix-a-timer-hardware-on-various-microcontrollers" name="appendix-a-timer-hardware-on-various-microcontrollers">Appendix A: Timer hardware on various microcontrollers</a></h1>
  <blockquote>
  <ol class="loweralpha simple">
--- 822,925 ----
  </div>
  </div>
! <div class="section" id="implementation">
! <h1><a name="implementation">6. Implementation</a></h1>
! <p>The definition of the HIL interfaces are found in <tt class="docutils literal"><span class="pre">tinyos-2.x/tos/lib/timer</span></tt>:</p>
! <blockquote>
! <ul class="simple">
! <li><tt class="docutils literal"><span class="pre">Alarm.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">BusyWait.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">Counter.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">LocalTime.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">Timer.h</span></tt> defines precision tags and strings for unique()</li>
! <li><tt class="docutils literal"><span class="pre">Timer.nc</span></tt></li>
! </ul>
! </blockquote>
! <p>The implementation of the utility components are also found in
! <tt class="docutils literal"><span class="pre">tinyos-2.x/tos/lib/timer</span></tt>:</p>
! <blockquote>
! <ul class="simple">
! <li><tt class="docutils literal"><span class="pre">AlarmToTimerC.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">BusyWaitCounterC.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">CounterToLocalTimeC.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">TransformAlarmC.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">TransformAlarmCounterC.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">TransformCounterC.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">VirtualizeAlarmC.nc</span></tt></li>
! <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
! <tt class="docutils literal"><span class="pre">tinyos-2.x/tos/chips/msp430/timer</span></tt>:</p>
! <blockquote>
! <ul class="simple">
! <li><tt class="docutils literal"><span class="pre">Alarm32khzC.nc</span></tt> is generic and provides a new <tt class="docutils literal"><span class="pre">Alarm&lt;T32khz,uint16_t&gt;</span></tt>
! and <tt class="docutils literal"><span class="pre">Alarm&lt;T32khz,uint32_t&gt;</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">AlarmMilliC.nc</span></tt> is generic and provides a new <tt class="docutils literal"><span class="pre">Alarm&lt;TMilli,uint32_t&gt;</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">BusyWait32khzC.nc</span></tt> provides <tt class="docutils literal"><span class="pre">BusyWait&lt;T32khz,uint16_t&gt;</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">BusyWaitMicroC.nc</span></tt> provides <tt class="docutils literal"><span class="pre">BusyWait&lt;TMicro,uint16_t&gt;</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">Counter32khzC.nc</span></tt> provides <tt class="docutils literal"><span class="pre">Counter&lt;T32khz,uint16_t&gt;</span></tt>,
! <tt class="docutils literal"><span class="pre">Counter&lt;T32khz,uint32_t&gt;</span></tt>, and <tt class="docutils literal"><span class="pre">LocalTime&lt;T32khz&gt;</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">CounterMilliC.nc</span></tt> provides <tt class="docutils literal"><span class="pre">Counter&lt;TMilli,uint32_t&gt;</span></tt> and <tt class="docutils literal"><span class="pre">LocalTime&lt;TMilli&gt;</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">GpioCaptureC.nc</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">HilTimerMilliC.nc</span></tt> provides <tt class="docutils literal"><span class="pre">Timer&lt;TMilli&gt;</span> <span class="pre">as</span> <span class="pre">TimerMilli[uint8_t</span> <span class="pre">num]</span></tt></li>
! <li><tt class="docutils literal"><span class="pre">Msp430AlarmC.nc</span></tt> is generic and converts an MSP430 timer to a 16-bit Alarm</li>
! <li><tt class="docutils literal"><span class="pre">Msp430Capture.nc</span></tt> HPL interface definition for MSP430 timer captures</li>
! <li><tt class="docutils literal"><span class="pre">Msp430ClockC.nc</span></tt> exposes MSP430 hardware clock initialization</li>
! <li><tt class="docutils literal"><span class="pre">Msp430ClockInit.nc</span></tt> HPL interface definition for hardware clock initialization</li>
! <li><tt class="docutils literal"><span class="pre">Msp430ClockP.nc</span></tt> implements MSP430 hardware clock initialization and
! calibration and startup</li>
! <li><tt class="docutils literal"><span class="pre">Msp430Compare.nc</span></tt> HPL interface definition for MSP430 timer compares</li>
! <li><tt class="docutils literal"><span class="pre">Msp430Counter32khzC.nc</span></tt> provides <tt class="docutils literal"><span class="pre">Counter&lt;T32khz,uint16_t&gt;</span></tt> based on
! MSP430 TimerB</li>
! <li><tt class="docutils literal"><span class="pre">Msp430CounterC.nc</span></tt> is generic and converts an Msp430Timer to a Counter</li>
! <li><tt class="docutils literal"><span class="pre">Msp430CounterMicroC.nc</span></tt> provides <tt class="docutils literal"><span class="pre">Counter&lt;TMicro,uint16_t&gt;</span></tt> based on
! MSP430 TimerA</li>
! <li><tt class="docutils literal"><span class="pre">Msp430Timer.h</span></tt> defines additional MSP430 timer bitmasks and structs</li>
! <li><tt class="docutils literal"><span class="pre">Msp430Timer.nc</span></tt> HPL interface definition</li>
! <li><tt class="docutils literal"><span class="pre">Msp430Timer32khzC.nc</span></tt> is generic and allocates a new 32khz hardware timer</li>
! <li><tt class="docutils literal"><span class="pre">Msp430Timer32khzMapC.nc</span></tt> exposes the MSP430 hardware timers as a
! parameterized interface allocatable using Msp430Timer32khzC</li>
! <li><tt class="docutils literal"><span class="pre">Msp430TimerC.nc</span></tt> exposes the MSP430 hardware timers</li>
! <li><tt class="docutils literal"><span class="pre">Msp430TimerCapComP.nc</span></tt> is generic and implements the HPL for MSP430
! capture/compare special function registers</li>
! <li><tt class="docutils literal"><span class="pre">Msp430TimerCommonP.nc</span></tt> maps the MSP430 timer interrupts to Msp430TimerEvents</li>
! <li><tt class="docutils literal"><span class="pre">Msp430TimerControl.nc</span></tt> HPL interface definition</li>
! <li><tt class="docutils literal"><span class="pre">Msp430TimerEvent.nc</span></tt> HPL interface definition</li>
! <li><tt class="docutils literal"><span class="pre">Msp430TimerP.nc</span></tt> is generic and implements the HPL for MSP430 timer
! special function registers</li>
! </ul>
! </blockquote>
! </div>
! <div class="section" id="author-s-address">
! <h1><a name="author-s-address">7. Author's Address</a></h1>
! <div class="line-block">
! <div class="line">Cory Sharp</div>
! <div class="line">Moteiv Corporation</div>
! <div class="line">55 Hawthorne St, Suite 550</div>
! <div class="line">San Francisco, CA 94105</div>
! <div class="line"><br /></div>
! <div class="line">phone - +1 415 692 0963</div>
! <div class="line">email - <a class="reference" href="mailto:cory&#64;moteiv.com">cory&#64;moteiv.com</a></div>
! <div class="line"><br /></div>
! <div class="line"><br /></div>
! <div class="line">Martin Turon</div>
! <div class="line">P.O. Box 8525</div>
! <div class="line">Berkeley, CA 94707</div>
! <div class="line"><br /></div>
! <div class="line">phone - +1 408 965 3355</div>
! <div class="line">email - <a class="reference" href="mailto:mturon&#64;xbow.com">mturon&#64;xbow.com</a></div>
! <div class="line"><br /></div>
! <div class="line"><br /></div>
! <div class="line">David Gay</div>
! <div class="line">2150 Shattuck Ave, Suite 1300</div>
! <div class="line">Intel Research</div>
! <div class="line">Berkeley, CA 94704</div>
! <div class="line"><br /></div>
! <div class="line">phone - +1 510 495 3055</div>
! <div class="line">email - <a class="reference" href="mailto:david.e.gay&#64;intel.com">david.e.gay&#64;intel.com</a></div>
! </div>
! </div>
! <div class="section" id="appendix-a-timer-hardware-on-various-microcontrollers">
! <h1><a name="appendix-a-timer-hardware-on-various-microcontrollers">Appendix A: Timer hardware on various microcontrollers</a></h1>
  <blockquote>
  <ol class="loweralpha simple">
***************
*** 872,877 ****
  </blockquote>
  </div>
! <div class="section">
! <h1><a id="appendix-b-a-microcontroller-atmega-128-timer-subsystem" name="appendix-b-a-microcontroller-atmega-128-timer-subsystem">Appendix B: a microcontroller: Atmega 128 timer subsystem</a></h1>
  <p>The Atmega128 exposes its four timers through a common set of interfaces:</p>
  <blockquote>
--- 997,1002 ----
  </blockquote>
  </div>
! <div class="section" id="appendix-b-a-microcontroller-atmega-128-timer-subsystem">
! <h1><a name="appendix-b-a-microcontroller-atmega-128-timer-subsystem">Appendix B: a microcontroller: Atmega 128 timer subsystem</a></h1>
  <p>The Atmega128 exposes its four timers through a common set of interfaces:</p>
  <blockquote>
***************
*** 903,907 ****
  
    /// Clock initialization interface
!   async command void    off();                     //&lt;! Turn off the clock
    async command void    setScale( uint8_t scale);  //&lt;! Turn on the clock
    async command uint8_t getScale();                //&lt;! Get prescaler setting
--- 1028,1032 ----
  
    /// Clock initialization interface
!   async command void    off();                     //&lt;! Turn off the clock 
    async command void    setScale( uint8_t scale);  //&lt;! Turn on the clock
    async command uint8_t getScale();                //&lt;! Get prescaler setting
***************
*** 934,938 ****
    async event void captured(size_type t);  //&lt;! Signalled on capture int
  
!   /// Interrupt flag utilites: Bit level set/clr
    async command void reset();          //&lt;! Clear the capture interrupt flag
    async command void start();          //&lt;! Enable the capture interrupt
--- 1059,1063 ----
    async event void captured(size_type t);  //&lt;! Signalled on capture int
  
!   /// Interrupt flag utilites: Bit level set/clr  
    async command void reset();          //&lt;! Clear the capture interrupt flag
    async command void start();          //&lt;! Enable the capture interrupt
***************
*** 972,977 ****
  </pre>
  </div>
! <div class="section">
! <h1><a id="appendix-c-a-mote-mica-family-timer-subsystem" name="appendix-c-a-mote-mica-family-timer-subsystem">Appendix C: a mote: Mica family timer subsystem</a></h1>
  <p>Members of the mica family (mica2, mica2dot, micaz) use the Atmega128
  microprocessor and have external crystals at 4 or 7.37MHz. Additionally,
--- 1097,1102 ----
  </pre>
  </div>
! <div class="section" id="appendix-c-a-mote-mica-family-timer-subsystem">
! <h1><a name="appendix-c-a-mote-mica-family-timer-subsystem">Appendix C: a mote: Mica family timer subsystem</a></h1>
  <p>Members of the mica family (mica2, mica2dot, micaz) use the Atmega128
  microprocessor and have external crystals at 4 or 7.37MHz. Additionally,
***************
*** 995,999 ****
  However, the set of dividers for timer 1 is limited to 1, 8,
  64, 256 and 1024. So, when clocked at 2 or 4MHz, a divider of 1 is
! selected and timer 1 runs at 2 or 4MHz. To reflect this fact, the
  HAL components exposing timer 1 are named <tt class="docutils literal"><span class="pre">CounterOne16C</span></tt> and
  <tt class="docutils literal"><span class="pre">AlarmOne16C</span></tt> (rather than the <tt class="docutils literal"><span class="pre">CounterMicro16C</span></tt> <tt class="docutils literal"><span class="pre">AlarmMicro16C</span></tt>
--- 1120,1124 ----
  However, the set of dividers for timer 1 is limited to 1, 8,
  64, 256 and 1024. So, when clocked at 2 or 4MHz, a divider of 1 is
! selected and timer 1 runs at 2 or 4MHz. To reflect this fact, the 
  HAL components exposing timer 1 are named <tt class="docutils literal"><span class="pre">CounterOne16C</span></tt> and
  <tt class="docutils literal"><span class="pre">AlarmOne16C</span></tt> (rather than the <tt class="docutils literal"><span class="pre">CounterMicro16C</span></tt> <tt class="docutils literal"><span class="pre">AlarmMicro16C</span></tt>
***************
*** 1016,1020 ****
  32768Hz, if possible. As with timer 1, the limited set of dividers makes
  this impossible at some clock frequencies, so the 16-bit timer 3 HAL
! components are named <tt class="docutils literal"><span class="pre">CounterThree16C</span></tt> and <tt class="docutils literal"><span class="pre">AlarmThree16C</span></tt>. As
  with timer 1, the rate of timer 3 is adjusted in software when
  building the 32-bit counter and 32-bit alarms, giving components
--- 1141,1145 ----
  32768Hz, if possible. As with timer 1, the limited set of dividers makes
  this impossible at some clock frequencies, so the 16-bit timer 3 HAL
! components are named <tt class="docutils literal"><span class="pre">CounterThree16C</span></tt> and <tt class="docutils literal"><span class="pre">AlarmThree16C</span></tt>. As 
  with timer 1, the rate of timer 3 is adjusted in software when
  building the 32-bit counter and 32-bit alarms, giving components



More information about the Tinyos-2-commits mailing list