[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/telosb/mac/tkn154/timer Alarm32khz32VirtualizedP.nc, NONE, 1.1 Alarm32khzTo62500hzTransformC.nc, NONE, 1.1 Alarm62500hz32VirtualizedC.nc, NONE, 1.1 Alarm62500hz32VirtualizedHilC.nc, NONE, 1.1 Alarm62500hz32VirtualizedHilP.nc, NONE, 1.1 HilTimer62500hzC.nc, NONE, 1.1 LocalTime62500hzC.nc, NONE, 1.1 LocalTime62500hzP.nc, NONE, 1.1 Timer62500C.nc, NONE, 1.1 Timer62500P.nc, NONE, 1.1 Timer62500hz.h, NONE, 1.1

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Mon Jun 16 11:05:17 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/telosb/mac/tkn154/timer
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv438/tos/platforms/telosb/mac/tkn154/timer

Added Files:
	Alarm32khz32VirtualizedP.nc Alarm32khzTo62500hzTransformC.nc 
	Alarm62500hz32VirtualizedC.nc Alarm62500hz32VirtualizedHilC.nc 
	Alarm62500hz32VirtualizedHilP.nc HilTimer62500hzC.nc 
	LocalTime62500hzC.nc LocalTime62500hzP.nc Timer62500C.nc 
	Timer62500P.nc Timer62500hz.h 
Log Message:
TKN15.4 "platform glue code" for the TelosB platform (see tinyos-2.x/tos/lib/mac/tkn154/README.txt)

--- NEW FILE: Alarm32khz32VirtualizedP.nc ---
#include "Timer62500hz.h"
configuration Alarm32khz32VirtualizedP
{
  provides interface Alarm<T32khz,uint32_t> as Alarm[ uint8_t num ];
}
implementation
{
  components new Alarm32khz32C(), MainC;
  components new VirtualizeAlarmC(T32khz, uint32_t, uniqueCount(UQ_ALARM_32KHZ32));

  Alarm = VirtualizeAlarmC;

  MainC -> Alarm32khz32C.Init;
  MainC -> VirtualizeAlarmC.Init;
  VirtualizeAlarmC.AlarmFrom -> Alarm32khz32C;
}

--- NEW FILE: Alarm32khzTo62500hzTransformC.nc ---
// here we introduce an error
generic module Alarm32khzTo62500hzTransformC()
{
  provides interface Alarm<T62500hz,uint32_t> as Alarm;
  uses interface Alarm<T32khz,uint32_t> as AlarmFrom;
}
implementation
{
  async command void Alarm.start(uint32_t dt){ call AlarmFrom.start(dt >> 1);}
  async command void Alarm.stop(){ call AlarmFrom.stop();}
  async event void AlarmFrom.fired(){ signal Alarm.fired();}
  async command bool Alarm.isRunning(){ return call AlarmFrom.isRunning();}
  async command void Alarm.startAt(uint32_t t0, uint32_t dt){ call AlarmFrom.startAt(t0 >> 1, dt >> 1);}
  async command uint32_t Alarm.getNow(){ return call AlarmFrom.getNow() << 1;}
  async command uint32_t Alarm.getAlarm(){ return call AlarmFrom.getAlarm() << 1;}
  default async event void Alarm.fired(){}
}

--- NEW FILE: Alarm62500hz32VirtualizedC.nc ---

/* "Copyright (c) 2000-2003 The Regents of the University of California.
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement
 * is hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 *
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
 * OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 */

/**
 * Alarm62500hzC is the alarm for async 62500hz alarms (virtualized)
 * This is the place where we cheat: since we don't have a clock source
 * running at 62500 Hz, we cast 2 symbols to 1 tick of the 32768
 * clock, which introduces a small error.
 *
 * @author Cory Sharp <cssharp at eecs.berkeley.edu>
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * @see  Please refer to TEP 102 for more information about this component and its
 *          intended use.
 */

//#include "Timer.h"
#include "Timer62500hz.h"
generic configuration Alarm62500hz32VirtualizedC()
{
  provides interface Alarm<T62500hz,uint32_t>;
}
implementation
{
#warning "Warning: MAC timing is not standard compliant (the symbol clock is based on the 32768 Hz oscillator)!"
  components new Alarm32khzTo62500hzTransformC();
  components Alarm32khz32VirtualizedP;
  
  Alarm = Alarm32khzTo62500hzTransformC;
  Alarm32khzTo62500hzTransformC.AlarmFrom -> Alarm32khz32VirtualizedP.Alarm[unique(UQ_ALARM_32KHZ32)];
}


--- NEW FILE: Alarm62500hz32VirtualizedHilC.nc ---

/* "Copyright (c) 2000-2003 The Regents of the University of California.
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement
 * is hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 *
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
 * OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 */

/**
 * Alarm62500hzC is the alarm for async 62500hz alarms (virtualized)
 * This is the place where we cheat: since we don't have a clock source
 * running at 62500 Hz, we cast 2 symbols to 1 tick of the 32768
 * clock, which introduces a small error.
 *
 * @author Cory Sharp <cssharp at eecs.berkeley.edu>
 * @author: Jan Hauer <hauer at tkn.tu-berlin.de>
 * @see  Please refer to TEP 102 for more information about this component and its
 *          intended use.
 */

//#include "Timer.h"
#include "Timer62500hz.h"
generic configuration Alarm62500hz32VirtualizedHilC()
{
  provides interface Alarm<T62500hz,uint32_t>;
}
implementation
{
  components new Alarm32khzTo62500hzTransformC();
  components Alarm62500hz32VirtualizedHilP;
  
  Alarm = Alarm32khzTo62500hzTransformC;
  Alarm32khzTo62500hzTransformC.AlarmFrom -> Alarm62500hz32VirtualizedHilP.Alarm[unique(UQ_ALARM_32KHZ32)];
}


--- NEW FILE: Alarm62500hz32VirtualizedHilP.nc ---
#include "Timer62500hz.h"
configuration Alarm62500hz32VirtualizedHilP
{
  provides interface Alarm<T32khz,uint32_t> as Alarm[ uint8_t num ];
}
implementation
{
  components new Alarm32khz32C(), MainC;
  components new VirtualizeAlarmC(T32khz, uint32_t, uniqueCount(UQ_ALARM_32KHZ32));

  Alarm = VirtualizeAlarmC;

  MainC -> Alarm32khz32C.Init;
  MainC -> VirtualizeAlarmC.Init;
  VirtualizeAlarmC.AlarmFrom -> Alarm32khz32C;
}

--- NEW FILE: HilTimer62500hzC.nc ---

/* "Copyright (c) 2000-2003 The Regents of the University of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement
 * is hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
 * OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 */

/**
 *
 * @author Cory Sharp <cssharp at eecs.berkeley.edu>
 * @author: Jan Hauer <hauer at tkn.tu-berlin.de> (62500hz)
 * @see  Please refer to TEP 102 for more information about this component and its
 *          intended use.
 */

#include "Timer.h"
#include "Timer62500hz.h"
configuration HilTimer62500hzC
{
  provides interface Timer<T62500hz> as Timer62500hz[ uint8_t num ];
}
implementation
{
  components new Alarm62500hz32VirtualizedHilC() as Alarm;
  components new AlarmToTimerC(T62500hz);
  components new VirtualizeTimerC(T62500hz,uniqueCount(UQ_TIMER_62500HZ));

  Timer62500hz = VirtualizeTimerC;

  VirtualizeTimerC.TimerFrom -> AlarmToTimerC;
  AlarmToTimerC.Alarm -> Alarm;
}

--- NEW FILE: LocalTime62500hzC.nc ---
#include "Timer62500hz.h"
configuration LocalTime62500hzC
{
  provides interface LocalTime<T62500hz>;
}
implementation
{
  // should be done properly one day (not wasting an alarm slot)
  components new Alarm62500hz32VirtualizedC(), LocalTime62500hzP;
  LocalTime = LocalTime62500hzP;
  LocalTime62500hzP.Alarm -> Alarm62500hz32VirtualizedC.Alarm;
}


--- NEW FILE: LocalTime62500hzP.nc ---
#include "Timer62500hz.h"
module LocalTime62500hzP
{
  provides interface LocalTime<T62500hz>;
  uses interface Alarm<T62500hz,uint32_t>;
}
implementation
{
  async command uint32_t LocalTime.get()
  {
    return call Alarm.getNow();
  }
  async event void Alarm.fired(){}
}


--- NEW FILE: Timer62500C.nc ---
// $Id: Timer62500C.nc,v 1.1 2008/06/16 18:05:14 janhauer Exp $
/*
 * "Copyright (c) 2005 Stanford University. All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and
 * its documentation for any purpose, without fee, and without written
 * agreement is hereby granted, provided that the above copyright
 * notice, the following two paragraphs and the author appear in all
 * copies of this software.
 * 
 * IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
 * IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 * 
 * STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE
 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
 * HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
 * ENHANCEMENTS, OR MODIFICATIONS."
 */

/**
 * The virtualized 62500 Hz timer abstraction. Instantiating this 
 * component gives an 62500 Hz granularity timer.
 *
 * @author Philip Levis
 * @author: Jan Hauer <hauer at tkn.tu-berlin.de> (62500hz)
 * @date   January 16 2006
 * @see    TEP 102: Timers
 */ 

#include "Timer62500hz.h"

generic configuration Timer62500C() {
  provides interface Timer<T62500hz>;
}
implementation {
  components Timer62500P;
  Timer = Timer62500P.Timer62500[unique(UQ_TIMER_62500HZ)];
}


--- NEW FILE: Timer62500P.nc ---
// $Id: Timer62500P.nc,v 1.1 2008/06/16 18:05:15 janhauer Exp $
/*									tab:4
 * "Copyright (c) 2005 The Regents of the University  of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */
/*
 *
 * @author Philip Levis
 * @author Cory Sharp
 * @author: Jan Hauer <hauer at tkn.tu-berlin.de> (62500hz)
 * @date   May 16 2005
 */ 

#include "Timer.h"

configuration Timer62500P {
  provides interface Timer<T62500hz> as Timer62500[uint8_t id];
}
implementation {
  components HilTimer62500hzC;
  Timer62500 = HilTimer62500hzC;
}


--- NEW FILE: Timer62500hz.h ---
#ifndef _H_Timer_62500hz_h
#define _H_Timer_62500hz_h

typedef struct { } T62500hz;

#define UQ_ALARM_32KHZ32 "Virtual.32khz32Alarm"
#define UQ_ALARM_62500HZ32 "Virtual.62500hzAlarm"
#define UQ_TIMER_62500HZ "HilTimer62500hzC.Timer"
#endif




More information about the Tinyos-2-commits mailing list