[Tinyos-beta-commits] CVS: tinyos-1.x/beta/teps/txt tep102.txt, 1.5, 1.6

Cory Sharp cssharp at users.sourceforge.net
Wed May 18 03:49:31 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/teps/txt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18356

Modified Files:
	tep102.txt 
Log Message:

TEP 102 Timers has undergone a sorely needed overhaul.  It is now up-to-date
with the current implementation in TinyOS 2.x.



Index: tep102.txt
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/teps/txt/tep102.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** tep102.txt	14 Feb 2005 20:28:17 -0000	1.5
--- tep102.txt	18 May 2005 10:49:29 -0000	1.6
***************
*** 26,31 ****
  ====================================================================
  
! This TEP proposes a Timer design that supports both common timing
! requirements in precision and resolution across common hardware
  configurations.  This TEP focuses on aligning the Timer abstraction
  with the three-layer Hardware Abstraction Architecture (HAA).
--- 26,31 ----
  ====================================================================
  
! This TEP proposes a Timer design that supports common timing
! requirements both in precision and width across common hardware
  configurations.  This TEP focuses on aligning the Timer abstraction
  with the three-layer Hardware Abstraction Architecture (HAA).
***************
*** 35,324 ****
  ====================================================================
  
! Timer interfaces impact to a number of aspects of the operating
! system:
  
! * Low frequency alarms, synchronous, periodic and oneshot, for
!   user/app timers
! * High frequency alarms, asynchronous, periodic and oneshot, for adc
!   sampling
! * Stop watches, timing information
! * Local time, time origin
! * Time synchronization
  
! Two fundamental properties of timers are *precision* and *resolution*.
! Satisfying all possible precisions (milli, 32khz, micro, etc) and
! resolutions (16-bit, 32-bit, 48-bit, 64-bit, etc) is both burdens
! system developers and encumbers application programming.  To reduce
! interface complexity, we assert that a variety in precision is more
! beneficial than a variety in resolution.  So for simplicity, we specify
! the following about timer resolution
  
! * All exposed timer values should be unsigned 32-bit integers (uint32_t)
!   regardless of precision
  
! A single timer interface common across all precisions would enable subtle
! wiring errors that are hard to detect at run-time.  To prevent this, we
! make timer interfaces for different precisions mutually incompatible.
! But, instead of creating a wholly distinct interface for each precision,
! we define generic timer interfaces parameterized by these frequency type
! tags::
  
    typedef struct { } TMilli;
    typedef struct { } T32khz;
    typedef struct { } TMicro;
-   typedef struct { } TNano; //as an example of a future extension
- 
- These tags allow a single interface specification to be common across all
- precisions while making instances of them mutually incompatible in wiring.
- As long as application developers are comfortable with the syntax of nesC
- generics, this makes the code overall more clear.  This design pattern
- further allows for classes of generic modules that are not possible using
- wholly distinct interfaces per precision.
  
! See TEP 2 for the general background on the HAA.
  
  
! Quick Summary
  ====================================================================
  
! Five interfaces are presented:
  
! * Counter<frequency_tag>
! * Alarm<frequency_tag>
! * Timer<frequency_tag>
! * TimerAsync<frequency_tag>
! * Stopwatch<frequency_tag>
  
! Low frequency alarms are satisfied by Timer<frequency_tag>, derived from
! one or more Alarm's.  TinyOS will provide Timer<TMilli> through the
! standard timer component TimerC.
  
! High frequency alarms are satisfied by TimerAsync<frequency_tag>, derived
! from some number of Alarm's.  TinyOS will provide TimerAsync<T32khz> and
! possibly TimerAsync<TMicro> also through the standard timer component
! TimerC.
  
! Time elapsed measurements are provided by Stopwatch<frequency_tag>, which
! are derived from a Counter.
  
! Local time is provided by Counter.  The time origin is relative to when
! the mote was booted.
  
! Time synchronization and the time origin are not addressed directly in
! this TEP.  It is presumed that they can be built as a nearly parallel
! layer on top of this layer of timers.
  
  
! Hardware differences between the current platforms
! ====================================================================
  
!   a. Mica2 (ATmega128)
  
!     i. Two 8-bit timers, each with
  
!       * 10-bit prescaler
!       * One compare register
  
!     ii. Two 16-bit timers, each with
  
!       * Limited prescalers
!       * Three compare registers
  
!   b. Telos/EYES (MSP430)
  
!     i. Two 16-bit timers with
  
!       * One with three compare registers
!       * One with eight compare registers
!       * Each from distinct clock source
!       * Each with limited prescalers
  
!   c. Both platforms have a 32kHz clock and a high frequency clock
!   d. Platforms' timers are similar
  
  
! Hardware Presentation Layer (HPL)
! ====================================================================
  
!   a. Implementatin: Hardware-level
!   b. Presentation: System dependent
!   c. Stateless
!   d. Expose common hardware resources via common interfaces
  
!     i. Timers
!     ii. Compares
!     iii. This allows HAL's to switch between hardware resources with only
!          a wiring change
  
!   e. See for instance under tos/platform/msp430/
  
!     i. MSP430Timer, MSP430TimerControl, MSP430Compare, MSP430Capture
!     ii. MSP430TimerC, MSP430TimerM
  
  
! Hardware Adaptation Layer (HAL)
  ====================================================================
  
!   a. Implementaiton: System dependent
!   b. Presentation: System independent
!   c. Async
!   d. Counter<frequency_tag>
  
!     i. Get current time as a uint32_t in whatever units are specified by
!        the interface tag frequency_tag
!     ii. Manage overflows
  
!       * Allows for properly deriving higher resolution counters
  
!     iii. Interface::
  
!            interface Counter<frequency_tag>
!            {
!              async command uint32_t get();
!              async command bool isOverflowPending();
!              async command bool clearOverflow();
!              async event void overflow();
!            }
  
!   e. Alarm<frequency_tag>
  
!     i. Manages a single alarm
!     ii. Set is special, sets alarm delta from explicit t0 not implicit "now"
  
!       * Avoids race condition from setting short alarms in absolute time
!       * Allows for precise periodic timers, no alarm time slip
  
!     iii. The time base of an Alarm must correspond to an appropriate Counter
  
!     iv. Interface::
  
!           interface Alarm<frequency_tag>
!           {
!              async command uint32_t get();
!              async command bool isSet();
!              async command void cancel();
!              async command void set( uint32_t t0, uint32_t dt );
!              async event void fired();
!           }
  
!     v. The AlarmC configuration exposes a distinct set of alarms
!     *required* by standard TinyOS components.  This is necessary if the
!     HIL is to be wholly independent of system implementation.  AlarmC may
!     also expose additional alarms to be used by TinyOS applications. ::
  
!       configuration AlarmC
!       {
!         // alarms required by standard tinyos components
!         provides interface Alarm<TMilli> as AlarmTimerMilli;
!         provides interface Alarm<T32khz> as AlarmTimer32khz;
!         provides interface AlarmAsync<T32khz> as AlarmTimerAsync32khz;
  
!         // extra alarms to be used by applications
!         provides interface Alarm<T32khz> as Alarm32khz1;
!         provides interface Alarm<T32khz> as Alarm32khz2;
!         //...
  
!         provides interface Alarm<TMicro> as AlarmMicro1;
!         provides interface Alarm<TMicro> as AlarmMicro2;
!         provides interface Alarm<TMicro> as AlarmMicro3;
!         //...
!       }
  
!   f. Alarm downsample example.  These generic interfaces prevent, for
!   instance, an Alarm<TMilli> from being wired to an Alarm<T32khz>.  And,
!   because each interface isn't totally distinct (such as AlarmMilli or
!   Alarm32khz), we can create a generic module to downsample one alarm to
!   another::
  
!     generic module AlarmDownsample
!     ( 
!       typedef to_freq_tag, 
!       typedef from_freq_tag, 
!       int difflog2freq
!     )
!     {
!       provides interface Alarm<to_freq_tag> as SlowerAlarm;
!       uses interface Alarm<from_freq_tag> as FasterAlarm;
!     }
!     implementation
!     {
!       components new AlarmDownsampleM(to_freq_tag,from_freq_tag,difflog2freq) as ADM;
!       ADM.SlowerAlarm = SlowerAlarm;
!       ADM.FasterAlarm = FasterAlarm;
!     }
  
  
! Hardware Interface Layer (HIL)
  ====================================================================
  
!   a. Implementation: System independent
!   b. Presentation: OS service
!   c. Timer interface
!   
!     i.   Synchronous
!     ii.  Parameterized by time precision
!     iii. Provides periodic and one shot timers
!     iv.  May have moderate computational overhead, probably all Timers for
!          a given timer precision are multiplexed from a single hardware
!          resource
  
!     v. Interface::
  
!         interface Timer<frequency_tag>
!         {
!           command result_t setPeriodic( uint32_t dt );
!           command result_t setOneShot( uint32_t dt );
!           command result_t stop();
!           command bool isSet();
!           command bool isPeriodic();
!           command bool isOneShot();
!           command uint32_t getPeriod();
!           event void fired();
!         }
  
!   d. TimerAsync interface
!   
!     i. Asynchronous
!     ii. Parameterized by time precision
!     iii. Provides periodic and one shot timers
!     iv. Should have minimal computational overhead, probably each
!         TimerAsync is based on a single hardware resource
  
!     v. Interface::
  
!         interface TimerAsync<frequency_tag>
!         {
!           async command result_t setPeriodic( uint32_t dt );
!           async command result_t setOneShot( uint32_t dt );
!           async command result_t stop();
!           async command bool isSet();
!           async command bool isPeriodic();
!           async command bool isOneShot();
!           async command uint32_t getPeriod();
!           async event void fired();
!         }
  
!   e. Stopwatch interface
  
!     i. Asynchronous
!     ii. Parameterized by time precision
!     iii. Provides elapsed time readings from a specified start
!     iv. Indicates if an overflow occurred for the returned value
!     v. Stopwatches only depend on measurements from an appropriate
!        Counter.
!     vi. Interface::
  
!           typedef struct
!           {
!             uint32_t value;
!             bool overflow;
!           } stopwatch_t;
  
!           interface Stopwatch<frequency_tag>
!           {
!             async command void start();
!             async command stopwatch_t read();
!             async command stopwatch_t stop();
!           }
  
  
--- 35,557 ----
  ====================================================================
  
! This TEP proposes all timer interfaces be parameterized by
! precision.  All precisions are in "binary" units with respect to one
! second.  Precision is expressed an empty type
  
! * TMilli
! * T32khz
! * TMicro
  
! This TEP proposes these timer interfaces:
  
! * Alarm
! * BusyWait
! * Counter
! * LocalTime
! * Timer
  
! The LocalTime and Timer interfaces are used primarily by user
! applications and use a fixed width of 32-bits.
! 
! The Alarm, BusyWait, and Counter interfaces are used by the TinyOS
! timer system and advanced user components.  They are parameterized
! by precision and size.  The most common sizes are 16-bit and 32-bit.
! Some platforms will likely use 8-bit for internal implementation,
! and it is expected that some future platforms will use 64-bit.
! 
! A number of platform independent generic components are provided by
! the TinyOS timer system:
! 
! * AlarmToTimerC
! * BusyWaitCounterC
! * CounterToLocalTimeC
! * TransformAlarmC
! * TransformCounterC
! * VirtualizeTimerC
! 
! A number of platform dependent components MUST exist:
! 
! * Alarm32khzC
! * AlarmMilliC
! * BusyWait32khzC
! * BusyWaitMicroC
! * Counter32khzC
! * CounterMilliC
! * TimerMilliC
! 
! It is expected that a platform need only implement in code concise
! Alarm and Counter components expressed in native precision and
! native width.  The platform independent components may use the native
! Alarm's and Counter's to implement the platform dependent timer
! components using only configurations.
! 
! 
! Precision and Width
! ====================================================================
! 
! Two fundamental properties of timers are *precision* and *width*.
! 
! Examples of precision are millisecond, a cycle of a 32kHz clock, and
! microseconds.  All precisions are in "binary" units with respect to
! one second.  That is, one second contains 1024 binary milliseconds,
! 32768 32kHz ticks, or 1048576 microseconds.  This TEP emphasizes
! millisecond and 32kHz tick precisions while reasonably accommodating
! other precisions.
! 
! 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.
! 
! This TEP parameterizes all interfaces by precision and some
! interfaces by width.  This intentionally makes similar timer
! interfaces with different precision or width mutually incompatible.
! It also allows user code to clearly express and understand the
! precision and width for a given timer interface.
! 
! Precision is expressed as an empty type -- TMilli, T32khz, and
! TMicro -- written in the standard Timer.h header like this::
  
    typedef struct { } TMilli;
    typedef struct { } T32khz;
    typedef struct { } TMicro;
  
! Note that the precision names are expressed as either frequency or
! period, whichever is convenient.
  
  
! Interfaces
  ====================================================================
  
! This TEP proposes these timer interfaces::
  
!   interface Alarm< precision_tag, size_type >
!   interface BusyWait< precision_tag, size_type >
!   interface Counter< precision_tag, size_type >
!   interface LocalTime< precision_tag >
!   interface Timer< precision_tag >
  
! The LocalTime and Timer interfaces are used primarily by user
! applications and use a fixed width of 32-bits.  The Alarm, BusyWait,
! and Counter interfaces are used by the TinyOS timer system and
! advanced user components.  by precision and size.
  
! Alarm::
  
!   interface Alarm<precision_tag,size_type>
!   {
!     // basic interface
!     async command void startNow( size_type dt );
!     async command void stop();
!     async event void fired();
  
!     // extended interface
!     async command bool isRunning();
!     async command void start( size_type t0, size_type dt );
!     async command size_type getNow();
!     async command size_type getAlarm();
!   }
  
! All commands and events of the Alarm interface are asynchronous (or
! in "interrupt context").  The Alarm interface provides a set of
! "basic" commands for common usage and provides a set of "extended"
! commands for advanced use.
  
+ startNow(dt) -- 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.
  
! stop() -- cancel any previously running alarm.
  
! fired() -- signals that the alarm has occurred.
  
! isRunning() -- return TRUE if the alarm has been started and has not
! been cancelled or has not yet fired.  FALSE is returned otherwise.
  
! start(t0,dt) -- 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.
  
! getNow() -- return the current time in the precision and width of
! the alarm.
  
! getAlarm() -- return the time the currently running alarm will fire
! or the time that the previously running alarm was set to fire.
  
! BusyWait::
  
!   interface BusyWait<precision_tag,size_type>
!   {
!     async command void wait( size_type dt );
!   }
  
! The BusyWait interface replaces the TOSH_uwait macro from TinyOS
! 1.x.
  
! wait(dt) -- block for no less than the specified amount of time.
  
+ Counter::
  
!   interface Counter<precision_tag,size_type>
!   {
!     async command size_type get();
!     async command bool isOverflowPending();
!     async command void clearOverflow();
!     async event void overflow();
!   }
  
! The Counter interface returns the current time and provides commands
! and an event for managing overflow conditions.  These overflow
! commands and events are necessary for properly deriving larger width
! Counters from smaller widths.
  
! get() -- return the current time.
  
! isOverflowPending() -- return TRUE if an overflow interrupt will
! occur after the outermost atomic block is exits.  FALSE otherwise.
  
! clearOverflow() -- cancel the pending overflow interrupt.
  
+ overflow() -- signals that an overflow in the current time.  That
+ is, the current time has wrapped around from its maximum value to
+ zero.
  
! LocalTime::
! 
!   interface LocalTime<precision_tag>
!   {
!     async command uint32_t get();
!   }
! 
! The LocalTime interface exposes a 32-bit counter without overflow
! utilities.  This is primarily for application code that does not
! care about overflow conditions.
! 
! get() -- return the current time.
! 
! Timer::
! 
!   interface Timer<precision_tag>
!   {
!     // basic interface
!     command void startPeriodicNow( uint32_t dt );
!     command void startOneShotNow( uint32_t dt );
!     command void stop();
!     event void fired( uint32_t when, uint32_t numMissed );
! 
!     // extended interface
!     command bool isRunning();
!     command bool isOneShot();
!     command void startPeriodic( uint32_t t0, uint32_t dt );
!     command void startOneShot( uint32_t t0, uint32_t dt );
!     command uint32_t getNow();
!     command uint32_t gett0();
!     command uint32_t getdt();
!   }
! 
! All commands and events of the Timer interface are synchronous (or
! in "task context").  The Timer interface provides a set of "basic"
! commands for common usage and provides a set of "extended" commands
! for advanced use.  The Timer interface allows for periodic events.
! 
! startPeriodicNow(dt) -- 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.
! 
! startOneShotNow(dt) -- 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.
! 
! stop() -- cancel any previously running timer.
! 
! fired(when,numMissed) -- signals that the timer has occurred.  The
! when parameter indicates when the timer should have fired.  Because
! the timers fire in synchronous context, some time may have elapsed
! from "when" until now.  For periodic timers, numMissed indicates how
! many events were outright missed and when indicates the time of the
! most recent event.  For one-shot timers, numMissed is always 0 and
! when is the time of the event.
! 
! isRunning() -- 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.
! 
! isOneShot() -- return TRUE if the timer is a one-shot timer.  Return
! FALSE otherwise if the timer is a periodic timer.
! 
! startPeriodic(t0,dt) -- 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.
! 
! startOneShot(t0,dt) -- cancel any previously running timer and set to fire
! at time t1 = t0+dt.  The timer will fire once then stop.
! 
! getNow() -- return the current time in the precision and width of
! the timer.
! 
! gett0() -- return the time anchor for the previously started timer
! or the time of the previous event for periodic timers.
! 
! getdt() -- return the delay or period for the previously started
! timer.
! 
! 
! Platform independent components
  ====================================================================
  
! A number of platform independent generic components are provided by
! the TinyOS timer system:
  
! * AlarmToTimerC
! * BusyWaitCounterC
! * CounterToLocalTimeC
! * TransformAlarmC
! * TransformCounterC
! * VirtualizeTimerC
  
! The platform independent components are used to help derive the
! platform dependent components discussed in the next section.
  
! AlarmToTimerC::
  
!   generic component AlarmToTimerC( typedef precision_tag )
!   {
!     provides interface Timer<precision_tag>;
!     uses interface Alarm<precision_tag,uint32_t>;
!   }
  
! AlarmToTimerC converts a 32-bit Alarm to a Timer.
  
! BusyWaitCounterC::
  
!   generic component BusyWaitC( typedef precision_tag,
!     typedef size_type @integer() )
!   {
!     provides interface BusyWait<precision_tag,size_type>;
!     uses interface Counter<precision_tag,size_type>;
!   }
  
! BusyWaitCounterC uses a Counter to block until a specified amount of
! time elapses.
  
! CounterToLocalTimeC::
  
!   generic component CounterToLocalTimeC( precision_tag )
!   {
!     provides interface LocalTime<precision_tag>;
!     uses interface Counter<precision_tag,uint32_t>;
!   }
  
! CounterToLocalTimeC converts from a 32-bit Counter to LocalTime.
  
! TransformAlarmC::
  
!   generic component TransformAlarmC( 
!     typedef to_precision_tag,
!     typedef to_size_type @integer(),
!     typedef from_precision_tag,
!     typedef from_size_type @integer(),
!     uint8_t bit_shift_right )
!   {
!     provides interface Alarm<to_precision_tag,to_size_type> as Alarm;
!     uses interface Counter<to_precision_tag,to_size_type> as Counter;
!     uses interface Alarm<from_precision_tag,from_size_type> as AlarmFrom;
!   }
  
! TransformAlarmC decreases precision and/or widens an Alarm.  An
! already widened Counter component is used to help.  to_precision_tag
! and to_size_type describe the final precision and final width for
! the provided Alarm.  from_precision_tag and from_size_type describe
! the precision and width for the source AlarmFrom.  bit_shift_right
! describes the bit-shift necessary to convert from the used
! precision to the provided precision.
  
! For instance to convert from an Alarm<T32khz,uint16_t> to an
! Alarm<TMilli,uint32_t>, the following TransformAlarmC would be
! created::
  
!   new TransformAlarmC( TMilli, uint32_t, T32khz, uint16_t, 5 )
  
+ TransformCounterC::
  
!   generic component TransformCounterC(
!     typedef to_precision_tag,
!     typedef to_size_type @integer(),
!     typedef from_precision_tag,
!     typedef from_size_type @integer(),
!     uint8_t bit_shift_right,
!     typedef upper_count_type @integer() )
!   {
!     provides interface Counter<to_precision_tag,to_size_type> as Counter;
!     uses interface Counter<from_precision_tag,from_size_type> as CounterFrom;
!   }
! 
! TransformCounterC decreases precision and/or widens a Counter.
! to_precision_tag and to_size_type describe the final precision and
! final width for the provided Counter.  from_precision_tag and
! from_size_type describe the precision and width for the source
! AlarmFrom.  bit_shift_right describes the bit-shift necessary to
! convert from the used precision to the provided precision.
! upper_count_type describes the numeric type used to store the
! additional counter bits.  upper_count_type MUST be a type with width
! greater than or equal to the additional bits in to_size_type plus
! bit_shift_right.
! 
! For instance to convert from a Counter<T32khz,uint16_t> to a
! Counter<TMilli,uint32_t>, the following TransformCounterC would be
! created::
! 
!   new TransformCounterC( TMilli, uint32_t, T32khz, uint16_t, 5, uint32_t )
! 
! VirtualizeTimerC::
! 
!   generic component VirtualizeTimerC( typedef precision_tag,
!     int max_timers )
!   {
!     provides interface Init;
!     provides interface Timer<precision_tag> as Timer[ uint8_t num ];
!     uses interface Timer<precision_tag> as TimerFrom;
!   }
! 
! VirtualizeTimerC uses a single Timer to create up to 255 virtual
! timers.
! 
! 
! Platform dependent components
  ====================================================================
  
! A number of platform dependent components MUST exist:
  
! * Alarm32khzC
! * AlarmMilliC
! * BusyWait32khzC
! * BusyWaitMicroC
! * Counter32khzC
! * CounterMilliC
! * TimerMilliC
  
! Alarm32khzC::
  
!   generic configuration Alarm32khzC()
!   {
!     provides interface Init;
!     provides interface Alarm<T32khz,uint16_t> as Alarm32khz16;
!     provides interface Alarm<T32khz,uint32_t> as Alarm32khz32;
!   }
  
! Alarm32khzC MUST provide Init and Alarm<T32khz,uint32_t> as
! Alarm32khz32.  The configuration MAY provide additional
! hardware-specific Alarm interfaces.  Alarm32khzC is a generic
! component.  Each instantiation allocates a new, distinct Alarm.
! Each instance of an Alarm32khzC MAY directly map to a hardware
! timer.
  
! AlarmMilliC::
  
!   generic configuration AlarmMilliC()
!   {
!     provides interface Init;
!     provides interface Alarm<TMilli,uint32_t> as AlarmMilli32;
!   }
  
! AlarmMilliC MUST provide Init and Alarm<TMilli,uint32_t> as
! AlarmMilli32.  The configuration MAY provide additional
! hardware-specific Alarm interfaces.  AlarmMilliC is a generic
! component.  Each instantiation allocates a new, distinct Alarm.
! Each instance of an AlarmMilliC MAY directly map to a hardware
! timer.
  
! BusyWait32khzC::
  
!   configuration BusyWait32khzC
!   {
!     provides interface BusyWait<T32khz,uint16_t> as BusyWait32khz16;
!   }
! 
! BusyWait32khzC MUST provide BusyWait<T32khz,uint16_t> as
! BusyWait32khz16.  The configuration MAY provide additional
! hardware-specific BusyWait interfaces.
! 
! BusyWaitMicroC::
! 
!   configuration BusyWaitMicroC
!   {
!     provides interface BusyWait<TMicro,uint16_t> as BusyWaitMicro16;
!   }
! 
! BusyWaitMicroC MUST provide BusyWait<TMicro,uint16_t> as
! BusyWaitMicro16.  The configuration MAY provide additional
! hardware-specific BusyWait interfaces.
! 
! Counter32khzC::
! 
!   configuration Counter32khzC
!   {
!     provides interface Counter<T32khz,uint32_t> as Counter32khz32;
!     provides interface LocalTime<T32khz> as LocalTime32khz;
!   }
! 
! Counter32khz MUST provide Counter<T32khz,uint32_t> as Counter32khz32
! and LocalTime<T32khz> as LocalTime32khz.  The configuration MAY
! provide additional hardware-specific Counter interfaces.
! 
! CounterMilliC::
! 
!   configuration CounterMilliC
!   {
!     provides interface Counter<TMilli,uint32_t> as CounterMilli32;
!     provides interface LocalTime<TMilli> as LocalTimeMilli;
!   }
! 
! CounterMilli MUST provide Counter<TMilli,uint32_t> as CounterMilli32
! and LocalTime<TMilli> as LocalTimeMilli.  The configuration MAY
! provide additional hardware-specific Counter interfaces.
! 
! TimerMilliC::
! 
!   configuration TimerMilliC
!   {
!     provides interface Init;
!     provides interface Timer<TMilli> as TimerMilli[ uint8_t num ];
!   }
! 
! TimerMilliC MUST provide Init and Timer<TMilli> as
! TimerMilli[uint8_t num].  TimerMilliC is used by OSKI to implement
! the generic component TimerMilli that allocates a new, virtual timer
! with each instantiation.
! 
! 
! Hardware differences between the current platforms
! ====================================================================
! 
!   a. Mica2 (ATmega128)
! 
!     i. Two 8-bit timers, each with
! 
!       * 10-bit prescaler
!       * One compare register
! 
!     ii. Two 16-bit timers, each with
! 
!       * Limited prescalers
!       * Three compare registers
! 
!   b. Telos/EYES (MSP430)
! 
!     i. Two 16-bit timers with
! 
!       * One with three compare registers
!       * One with eight compare registers
!       * Each from distinct clock source
!       * Each with limited prescalers
! 
!   c. Both platforms have a 32kHz clock and a high frequency clock
!   d. Platforms' timers are similar
  
  
***************
*** 326,331 ****
  ====================================================================
  
! See the tinyos-2.x/tos/ tree.  Interfaces are in interfaces/ and
! implementations are in platforms/ or chips/.
  
  
--- 559,588 ----
  ====================================================================
  
! For platform independent headers, interfaces, and components, see
! 
! * tinyos-2.x/tos/lib/timer/
! 
! For platform dependent implementations, see specific chip
! directories, such as
! 
! * tinyos-2.x/tos/chips/msp430/timer/
! * tinyos-2.x/tos/chips/ATmega128/timer/
! * tinyos-2.x/tos/chips/pxa27a/timer/
! 
! 
! Hints
! ====================================================================
! 
! In implementing Alarm32khzC.nc and AlarmMilliC.nc for the MSP430 in
! tinyos-2.x/tos/chips/msp430/timer/, see MSP430Timer32khzC.nc and
! MSP430Timer32khzMapC.nc for an example of how a set of similar
! hardware resources can be exposed through a parameterized interface
! for compile-time allocation.  See how Alarm32khzC.nc and
! AlarmMilliC.nc call new MSP430Timer32khzC() to allocate a new,
! arbitrary hardware timer.  Using this methodology, specific
! platforms can override MSP430Timer32khzMapC.nc to remove statically
! allocated hardware timers from the set available for compile-time
! allocation, such as the Telos platform in
! tinyos-2.x/tos/platform/telosa.
  
  



More information about the Tinyos-beta-commits mailing list