[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/epic ActiveMessageC.nc, NONE, 1.1 DemoSensorC.nc, NONE, 1.1 DemoSensorNowC.nc, NONE, 1.1 DemoSensorStreamC.nc, NONE, 1.1 HplUserButtonC.nc, NONE, 1.1 MoteClockC.nc, NONE, 1.1 MoteClockP.nc, NONE, 1.1 PlatformC.nc, NONE, 1.1 PlatformLedsC.nc, NONE, 1.1 PlatformP.nc, NONE, 1.1 UserButton.h, NONE, 1.1 UserButtonC.nc, NONE, 1.1 UserButtonP.nc, NONE, 1.1 VoltageC.nc, NONE, 1.1 VoltageStreamC.nc, NONE, 1.1 hardware.h, NONE, 1.1 platform.h, NONE, 1.1 platform_message.h, NONE, 1.1
Prabal Dutta
prabal at users.sourceforge.net
Wed Aug 6 23:37:08 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/epic
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20178
Added Files:
ActiveMessageC.nc DemoSensorC.nc DemoSensorNowC.nc
DemoSensorStreamC.nc HplUserButtonC.nc MoteClockC.nc
MoteClockP.nc PlatformC.nc PlatformLedsC.nc PlatformP.nc
UserButton.h UserButtonC.nc UserButtonP.nc VoltageC.nc
VoltageStreamC.nc hardware.h platform.h platform_message.h
Log Message:
Initial platform support for Epic
--- NEW FILE: ActiveMessageC.nc ---
// $Id: ActiveMessageC.nc,v 1.1 2008/08/07 06:37:05 prabal Exp $
/*
* "Copyright (c) 2004-2008 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."
*
* Copyright (c) 2004-2005 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached
* INTEL-LICENSE file. If you do not find these files, copies can be
* found by writing to Intel Research Berkeley, 2150 Shattuck Avenue,
* Suite 1300, Berkeley, CA, 94704. Attention: Intel License Inquiry.
*/
/**
* The Active Message layer on the Epic platform. This is a naming
* wrapper around the CC2420 Active Message layer.
*
* @author Philip Levis
* @author Prabal Dutta <prabal at cs.berkeley.edu>
*/
#include "Timer.h"
configuration ActiveMessageC {
provides {
interface SplitControl;
interface AMSend[uint8_t id];
interface Receive[uint8_t id];
interface Receive as Snoop[uint8_t id];
interface Packet;
interface AMPacket;
interface PacketAcknowledgements;
interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
}
}
implementation {
components CC2420ActiveMessageC as AM;
components CC2420PacketC;
SplitControl = AM;
AMSend = AM;
Receive = AM.Receive;
Snoop = AM.Snoop;
Packet = AM;
AMPacket = AM;
PacketAcknowledgements = AM;
PacketTimeStamp32khz = CC2420PacketC;
PacketTimeStampMilli = CC2420PacketC;
}
--- NEW FILE: DemoSensorC.nc ---
/*
* Copyright (c) 2005-2006 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* DemoSensorC is a generic sensor device that provides a 16-bit
* value. The platform author chooses which sensor actually sits
* behind DemoSensorC, and though it's probably Voltage, Light, or
* Temperature, there are no guarantees.
*
* This particular DemoSensorC on the telosb platform provides a
* voltage reading, using VoltageC.
*
* To convert from ADC counts to actual voltage, divide this reading
* by 4096 and multiply by 3.
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $ $Date: 2008/08/07 06:37:05 $
*
*/
generic configuration DemoSensorC()
{
provides interface Read<uint16_t>;
}
implementation
{
components new VoltageC() as DemoSensor;
Read = DemoSensor;
}
--- NEW FILE: DemoSensorNowC.nc ---
/*
* Copyright (c) 2005-2006 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* DemoSensorNowC is a generic sensor device that provides a 16-bit
* value that can be read from async context. The platform author
* chooses which sensor actually sits behind DemoSensorNowC, and
* though it's probably Voltage, Light, or Temperature, there are no
* guarantees.
*
* This particular DemoSensorNowC on the telosb platform provides a
* voltage reading, using VoltageC.
*
* To convert from ADC counts to actual voltage, divide this reading
* by 4096 and multiply by 3.
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $ $Date: 2008/08/07 06:37:05 $
*
*/
generic configuration DemoSensorNowC()
{
provides interface Resource;
provides interface ReadNow<uint16_t>;
}
implementation
{
components new Msp430InternalVoltageC() as DemoSensorNow;
Resource = DemoSensorNow;
ReadNow = DemoSensorNow;
}
--- NEW FILE: DemoSensorStreamC.nc ---
/*
* Copyright (c) 2005-2006 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* DemoSensorStreamC is a generic sensor device that provides a 16-bit
* value. The platform author chooses which sensor actually sits
* behind DemoSensorStreamC, and though it's probably Voltage, Light, or
* Temperature, there are no guarantees.
*
* This particular DemoSensorStreamC on the telosb platform provides a
* voltage reading, using VoltageStreamC.
*
* To convert from ADC counts to actual voltage, divide this reading
* by 4096 and multiply by 3.
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $ $Date: 2008/08/07 06:37:05 $
*
*/
generic configuration DemoSensorStreamC()
{
provides interface ReadStream<uint16_t>;
}
implementation
{
components new VoltageStreamC() as DemoSensor;
ReadStream = DemoSensor;
}
--- NEW FILE: HplUserButtonC.nc ---
/**
* Copyright (c) 2007 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Implementation of the user button for the telos platform
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $
*/
configuration HplUserButtonC {
provides interface GeneralIO;
provides interface GpioInterrupt;
}
implementation {
components HplMsp430GeneralIOC as GeneralIOC;
components HplMsp430InterruptC as InterruptC;
components new Msp430GpioC() as UserButtonC;
UserButtonC -> GeneralIOC.Port27;
GeneralIO = UserButtonC;
components new Msp430InterruptC() as InterruptUserButtonC;
InterruptUserButtonC.HplInterrupt -> InterruptC.Port27;
GpioInterrupt = InterruptUserButtonC.Interrupt;
}
--- NEW FILE: MoteClockC.nc ---
/*
* Copyright (c) 2007, Technische Universitaet Berlin
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the Technische Universität Berlin nor the names
* of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: MoteClockC.nc,v 1.1 2008/08/07 06:37:05 prabal Exp $
*
*/
/**
* @author Vlado Handziski <handzisk at tkn.tu-berlind.de>
*/
configuration MoteClockC
{
provides interface Init as MoteClockInit;
}
implementation
{
components Msp430ClockC, MoteClockP;
MoteClockInit = Msp430ClockC.Init;
//MoteClockP.Msp430ClockInit -> Msp430ClockC;
}
--- NEW FILE: MoteClockP.nc ---
/*
* Copyright (c) 2007, Technische Universitaet Berlin
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the Technische Universität Berlin nor the names
* of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: MoteClockP.nc,v 1.1 2008/08/07 06:37:05 prabal Exp $
*
*/
/**
* @author Vlado Handziski <handzisk at tkn.tu-berlind.de>
* @author Cory Sharp <cssharp at eecs.berkeley.edu>
*/
module MoteClockP {
uses interface Msp430ClockInit;
}
implementation {
event void Msp430ClockInit.setupDcoCalibrate()
{
// --- setup ---
TACTL = TASSEL1 | MC1; // source SMCLK, continuous mode, everything else 0
TBCTL = TBSSEL0 | MC1;
BCSCTL1 = XT2OFF | RSEL2;
BCSCTL2 = DCOR; // enable DCOR
TBCCTL0 = CM0;
}
event void Msp430ClockInit.initClocks()
{
// BCSCTL1
// .XT2OFF = 1; disable the external oscillator for SCLK and MCLK
// .XTS = 0; set low frequency mode for LXFT1
// .DIVA = 0; set the divisor on ACLK to 1
// .RSEL, do not modify
BCSCTL1 = XT2OFF | (BCSCTL1 & (RSEL2|RSEL1|RSEL0));
// BCSCTL2
// .SELM = 0; select DCOCLK as source for MCLK
// .DIVM = 0; set the divisor of MCLK to 1
// .SELS = 0; select DCOCLK as source for SCLK
// .DIVS = 2; set the divisor of SCLK to 4
// .DCOR = 1; select internal resistor for DCO
BCSCTL2 = DIVS1 | DCOR;
// IE1.OFIE = 0; no interrupt for oscillator fault
CLR_FLAG( IE1, OFIE );
}
event void Msp430ClockInit.initTimerA()
{
TAR = 0;
// TACTL
// .TACLGRP = 0; each TACL group latched independently
// .CNTL = 0; 16-bit counter
// .TASSEL = 2; source SMCLK = DCO/4
// .ID = 0; input divisor of 1
// .MC = 0; initially disabled
// .TACLR = 0; reset timer A
// .TAIE = 1; enable timer A interrupts
TACTL = TASSEL1 | TAIE;
}
event void Msp430ClockInit.initTimerB()
{
TBR = 0;
// TBCTL
// .TBCLGRP = 0; each TBCL group latched independently
// .CNTL = 0; 16-bit counter
// .TBSSEL = 1; source ACLK
// .ID = 0; input divisor of 1
// .MC = 0; initially disabled
// .TBCLR = 0; reset timer B
// .TBIE = 1; enable timer B interrupts
TBCTL = TBSSEL0 | TBIE;
}
}
--- NEW FILE: PlatformC.nc ---
// $Id: PlatformC.nc,v 1.1 2008/08/07 06:37:05 prabal Exp $
/*
* "Copyright (c) 2004-2008 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."
*
*/
/**
* Initialization code responsible for booting Epic to a usable state.
*
* @author Prabal Dutta <prabal at cs.berkeley.edu>
*/
#include "hardware.h"
configuration PlatformC {
provides {
interface Init;
}
}
implementation {
components PlatformP;
components MoteClockC;
Init = PlatformP;
PlatformP.MoteClockInit -> MoteClockC;
}
--- NEW FILE: PlatformLedsC.nc ---
#include "hardware.h"
configuration PlatformLedsC {
provides {
interface GeneralIO as Led0;
interface GeneralIO as Led1;
interface GeneralIO as Led2;
}
uses {
interface Init;
}
}
implementation {
components HplMsp430GeneralIOC as GeneralIOC;
components new Msp430GpioC() as Led0Impl;
components new Msp430GpioC() as Led1Impl;
components new Msp430GpioC() as Led2Impl;
components PlatformP;
Init = PlatformP.LedsInit;
Led0 = Led0Impl;
Led0Impl -> GeneralIOC.Port40;
Led1 = Led1Impl;
Led1Impl -> GeneralIOC.Port43;
Led2 = Led2Impl;
Led2Impl -> GeneralIOC.Port47;
}
--- NEW FILE: PlatformP.nc ---
// $Id: PlatformP.nc,v 1.1 2008/08/07 06:37:05 prabal Exp $
/*
* "Copyright (c) 2004-2008 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."
*
*/
/**
* Initialization code responsible for booting Epic to a usable state.
*
* @author Prabal Dutta <prabal at cs.berkeley.edu>
*/
#include "hardware.h"
module PlatformP {
provides {
interface Init;
}
uses {
interface Init as MoteClockInit;
interface Init as LedsInit;
}
}
implementation {
command error_t Init.init() {
call MoteClockInit.init();
call LedsInit.init();
return SUCCESS;
}
default command error_t LedsInit.init() {
return SUCCESS;
}
}
--- NEW FILE: UserButton.h ---
/**
* Copyright (c) 2007 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Implementation of the user button for the telosb platform
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $
*/
#ifndef USERBUTTON_H
#define USERBUTTON_H
typedef enum { BUTTON_RELEASED = 0, BUTTON_PRESSED = 1 } button_state_t;
#endif
--- NEW FILE: UserButtonC.nc ---
/**
* Copyright (c) 2007 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Implementation of the user button for the telosb platform. Get
* returns the current state of the button by reading the pin,
* regardless of whether enable() or disable() has been called on the
* Interface. Notify.enable() and Notify.disable() modify the
* underlying interrupt state of the pin, and have the effect of
* enabling or disabling notifications that the button has changed
* state.
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $
*/
#include <UserButton.h>
configuration UserButtonC {
provides interface Get<button_state_t>;
provides interface Notify<button_state_t>;
}
implementation {
components HplUserButtonC;
components new SwitchToggleC();
SwitchToggleC.GpioInterrupt -> HplUserButtonC.GpioInterrupt;
SwitchToggleC.GeneralIO -> HplUserButtonC.GeneralIO;
components UserButtonP;
Get = UserButtonP;
Notify = UserButtonP;
UserButtonP.GetLower -> SwitchToggleC.Get;
UserButtonP.NotifyLower -> SwitchToggleC.Notify;
}
--- NEW FILE: UserButtonP.nc ---
/**
* Copyright (c) 2007 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Implementation of the user button for the telosb platform
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $
*/
#include <UserButton.h>
module UserButtonP {
provides interface Get<button_state_t>;
provides interface Notify<button_state_t>;
uses interface Get<bool> as GetLower;
uses interface Notify<bool> as NotifyLower;
}
implementation {
command button_state_t Get.get() {
// telosb user button pin is high when released - invert state
if ( call GetLower.get() ) {
return BUTTON_RELEASED;
} else {
return BUTTON_PRESSED;
}
}
command error_t Notify.enable() {
return call NotifyLower.enable();
}
command error_t Notify.disable() {
return call NotifyLower.disable();
}
event void NotifyLower.notify( bool val ) {
// telosb user button pin is high when released - invert state
if ( val ) {
signal Notify.notify( BUTTON_RELEASED );
} else {
signal Notify.notify( BUTTON_PRESSED );
}
}
}
--- NEW FILE: VoltageC.nc ---
/*
* Copyright (c) 2005-2006 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* VoltageC is a common name for the Msp430InternalVoltageC voltage
* sensor available on the telosb platform.
*
* To convert from ADC counts to actual voltage, divide by 4096 and
* multiply by 3.
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $ $Date: 2008/08/07 06:37:05 $
*/
generic configuration VoltageC() {
provides interface Read<uint16_t>;
}
implementation {
components new Msp430InternalVoltageC();
Read = Msp430InternalVoltageC.Read;
}
--- NEW FILE: VoltageStreamC.nc ---
/*
* Copyright (c) 2005-2006 Arch Rock Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Arch Rock Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* VoltageC is a common name for the Msp430InternalVoltageC voltage
* sensor available on the telosb platform.
*
* To convert from ADC counts to actual voltage, divide by 4096 and
* multiply by 3.
*
* @author Gilman Tolle <gtolle at archrock.com>
* @version $Revision: 1.1 $ $Date: 2008/08/07 06:37:05 $
*/
generic configuration VoltageStreamC() {
provides interface ReadStream<uint16_t>;
}
implementation {
components new Msp430InternalVoltageC();
ReadStream = Msp430InternalVoltageC.ReadStream;
}
--- NEW FILE: hardware.h ---
// $Id: hardware.h,v 1.1 2008/08/07 06:37:05 prabal Exp $
/*
* "Copyright (c) 2007-2008 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."
*
* Copyright (c) 2004-2005 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached
* INTEL-LICENSE file. If you do not find these files, copies can be
* found by writing to Intel Research Berkeley, 2150 Shattuck Avenue,
* Suite 1300, Berkeley, CA, 94704. Attention: Intel License Inquiry.
*/
/**
* Hardware definition for the Epic platform.
*
* @author Prabal Dutta
*/
#ifndef _H_hardware_h
#define _H_hardware_h
#include "msp430hardware.h"
// LEDS
TOSH_ASSIGN_PIN(RED_LED, 4, 0);
TOSH_ASSIGN_PIN(GREEN_LED, 4, 3);
TOSH_ASSIGN_PIN(YELLOW_LED, 4, 7);
// CC2420 RADIO
TOSH_ASSIGN_PIN(RADIO_CSN, 4, 2);
TOSH_ASSIGN_PIN(RADIO_VREF, 4, 5);
TOSH_ASSIGN_PIN(RADIO_RESET, 4, 6);
TOSH_ASSIGN_PIN(RADIO_FIFOP, 1, 0);
TOSH_ASSIGN_PIN(RADIO_SFD, 4, 1);
TOSH_ASSIGN_PIN(RADIO_GIO0, 1, 3);
TOSH_ASSIGN_PIN(RADIO_FIFO, 1, 3);
TOSH_ASSIGN_PIN(RADIO_GIO1, 1, 4);
TOSH_ASSIGN_PIN(RADIO_CCA, 1, 4);
TOSH_ASSIGN_PIN(CC_FIFOP, 1, 0);
TOSH_ASSIGN_PIN(CC_FIFO, 1, 3);
TOSH_ASSIGN_PIN(CC_SFD, 4, 1);
TOSH_ASSIGN_PIN(CC_VREN, 4, 5);
TOSH_ASSIGN_PIN(CC_RSTN, 4, 6);
// USART0
TOSH_ASSIGN_PIN(SIMO0, 3, 1);
TOSH_ASSIGN_PIN(SOMI0, 3, 2);
TOSH_ASSIGN_PIN(UCLK0, 3, 3);
// USART1
TOSH_ASSIGN_PIN(SIMO1, 5, 1);
TOSH_ASSIGN_PIN(SOMI1, 5, 2);
TOSH_ASSIGN_PIN(UCLK1, 5, 3);
// UART1
TOSH_ASSIGN_PIN(UTXD0, 3, 4);
TOSH_ASSIGN_PIN(URXD0, 3, 5);
TOSH_ASSIGN_PIN(UTXD1, 3, 6);
TOSH_ASSIGN_PIN(URXD1, 3, 7);
// 1-Wire
TOSH_ASSIGN_PIN(ONEWIRE, 2, 4);
// need to undef atomic inside header files or nesC ignores the directive
#undef atomic
#endif // _H_hardware_h
--- NEW FILE: platform.h ---
--- NEW FILE: platform_message.h ---
/* $Id: platform_message.h,v 1.1 2008/08/07 06:37:06 prabal Exp $
* "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."
*
* Copyright (c) 2002-2005 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
/**
* Defining the platform-independently named packet structures to be the
* chip-specific CC1000 packet structures.
*
* @author Philip Levis
* @version $Revision: 1.1 $ $Date: 2008/08/07 06:37:06 $
*/
#ifndef PLATFORM_MESSAGE_H
#define PLATFORM_MESSAGE_H
#include <CC2420.h>
#include <Serial.h>
typedef union message_header {
cc2420_header_t cc2420;
serial_header_t serial;
} message_header_t;
typedef union TOSRadioFooter {
cc2420_footer_t cc2420;
} message_footer_t;
typedef union TOSRadioMetadata {
cc2420_metadata_t cc2420;
} message_metadata_t;
#endif
More information about the Tinyos-2-commits
mailing list