From c42a686e497601c393a2fa8eb9d604bcf784e1d3 Mon Sep 17 00:00:00 2001 From: prabal Date: Thu, 7 Aug 2008 06:37:05 +0000 Subject: [PATCH] Initial platform support for Epic --- support/make/epic.target | 28 +++++++ support/make/epic/epic.rules | 0 support/make/epic/miniprog.extra | 5 ++ tos/platforms/epic/ActiveMessageC.nc | 75 +++++++++++++++++ tos/platforms/epic/DemoSensorC.nc | 57 +++++++++++++ tos/platforms/epic/DemoSensorNowC.nc | 61 ++++++++++++++ tos/platforms/epic/DemoSensorStreamC.nc | 57 +++++++++++++ tos/platforms/epic/HplUserButtonC.nc | 54 ++++++++++++ tos/platforms/epic/MoteClockC.nc | 48 +++++++++++ tos/platforms/epic/MoteClockP.nc | 107 ++++++++++++++++++++++++ tos/platforms/epic/PlatformC.nc | 46 ++++++++++ tos/platforms/epic/PlatformLedsC.nc | 30 +++++++ tos/platforms/epic/PlatformP.nc | 54 ++++++++++++ tos/platforms/epic/UserButton.h | 44 ++++++++++ tos/platforms/epic/UserButtonC.nc | 63 ++++++++++++++ tos/platforms/epic/UserButtonP.nc | 75 +++++++++++++++++ tos/platforms/epic/VoltageC.nc | 50 +++++++++++ tos/platforms/epic/VoltageStreamC.nc | 50 +++++++++++ tos/platforms/epic/hardware.h | 89 ++++++++++++++++++++ tos/platforms/epic/platform.h | 0 tos/platforms/epic/platform_message.h | 58 +++++++++++++ 21 files changed, 1051 insertions(+) create mode 100644 support/make/epic.target create mode 100644 support/make/epic/epic.rules create mode 100644 support/make/epic/miniprog.extra create mode 100644 tos/platforms/epic/ActiveMessageC.nc create mode 100644 tos/platforms/epic/DemoSensorC.nc create mode 100644 tos/platforms/epic/DemoSensorNowC.nc create mode 100644 tos/platforms/epic/DemoSensorStreamC.nc create mode 100644 tos/platforms/epic/HplUserButtonC.nc create mode 100644 tos/platforms/epic/MoteClockC.nc create mode 100644 tos/platforms/epic/MoteClockP.nc create mode 100644 tos/platforms/epic/PlatformC.nc create mode 100644 tos/platforms/epic/PlatformLedsC.nc create mode 100644 tos/platforms/epic/PlatformP.nc create mode 100644 tos/platforms/epic/UserButton.h create mode 100644 tos/platforms/epic/UserButtonC.nc create mode 100644 tos/platforms/epic/UserButtonP.nc create mode 100644 tos/platforms/epic/VoltageC.nc create mode 100644 tos/platforms/epic/VoltageStreamC.nc create mode 100644 tos/platforms/epic/hardware.h create mode 100644 tos/platforms/epic/platform.h create mode 100644 tos/platforms/epic/platform_message.h diff --git a/support/make/epic.target b/support/make/epic.target new file mode 100644 index 00000000..8f0aadb4 --- /dev/null +++ b/support/make/epic.target @@ -0,0 +1,28 @@ +#-*-Makefile-*- +#$Id$ + +PLATFORM ?= epic + +# Disable MSP430 hardware multiply because it makes MSPGCC die +PFLAGS += -mdisable-hwmul +OPTFLAGS += -O + +# Default BSL assumes telosb-like programming interface +MSP_BSL ?= tos-bsl +MSP_BSL_FLAGS = --telosb + +#Update for Epic AT45 flash +#VOLUME_FILE = volumes-stm25p.xml +#VOLUME_ALLOCATOR = tos-storage-stm25p + +ifdef CC2420_CHANNEL +PFLAGS += -DCC2420_DEF_CHANNEL=$(CC2420_CHANNEL) +endif + +# Include the epic-specific targets +$(call TOSMake_include_platform,epic) +# Include the msp extra targets +$(call TOSMake_include_platform,msp) + +epic: $(BUILD_DEPS) + @: diff --git a/support/make/epic/epic.rules b/support/make/epic/epic.rules new file mode 100644 index 00000000..e69de29b diff --git a/support/make/epic/miniprog.extra b/support/make/epic/miniprog.extra new file mode 100644 index 00000000..1cc4b8e5 --- /dev/null +++ b/support/make/epic/miniprog.extra @@ -0,0 +1,5 @@ +#-*-Makefile-*- +#$Id$ + +# Special flags for Epic USB Mini Programmer +MSP_BSL_FLAGS = --swap-reset-test --invert-reset --invert-test diff --git a/tos/platforms/epic/ActiveMessageC.nc b/tos/platforms/epic/ActiveMessageC.nc new file mode 100644 index 00000000..8f00e430 --- /dev/null +++ b/tos/platforms/epic/ActiveMessageC.nc @@ -0,0 +1,75 @@ +// $Id$ + +/* + * "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 + */ +#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 as PacketTimeStamp32khz; + interface PacketTimeStamp 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; +} diff --git a/tos/platforms/epic/DemoSensorC.nc b/tos/platforms/epic/DemoSensorC.nc new file mode 100644 index 00000000..154a36b0 --- /dev/null +++ b/tos/platforms/epic/DemoSensorC.nc @@ -0,0 +1,57 @@ +/* + * 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 + * @version $Revision$ $Date$ + * + */ + +generic configuration DemoSensorC() +{ + provides interface Read; +} +implementation +{ + components new VoltageC() as DemoSensor; + Read = DemoSensor; +} diff --git a/tos/platforms/epic/DemoSensorNowC.nc b/tos/platforms/epic/DemoSensorNowC.nc new file mode 100644 index 00000000..b361595a --- /dev/null +++ b/tos/platforms/epic/DemoSensorNowC.nc @@ -0,0 +1,61 @@ +/* + * 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 + * @version $Revision$ $Date$ + * + */ + +generic configuration DemoSensorNowC() +{ + provides interface Resource; + provides interface ReadNow; +} +implementation +{ + components new Msp430InternalVoltageC() as DemoSensorNow; + + Resource = DemoSensorNow; + ReadNow = DemoSensorNow; +} diff --git a/tos/platforms/epic/DemoSensorStreamC.nc b/tos/platforms/epic/DemoSensorStreamC.nc new file mode 100644 index 00000000..d94e5eeb --- /dev/null +++ b/tos/platforms/epic/DemoSensorStreamC.nc @@ -0,0 +1,57 @@ +/* + * 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 + * @version $Revision$ $Date$ + * + */ + +generic configuration DemoSensorStreamC() +{ + provides interface ReadStream; +} +implementation +{ + components new VoltageStreamC() as DemoSensor; + ReadStream = DemoSensor; +} diff --git a/tos/platforms/epic/HplUserButtonC.nc b/tos/platforms/epic/HplUserButtonC.nc new file mode 100644 index 00000000..706d79a6 --- /dev/null +++ b/tos/platforms/epic/HplUserButtonC.nc @@ -0,0 +1,54 @@ +/** + * 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 + * @version $Revision$ + */ + +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; +} diff --git a/tos/platforms/epic/MoteClockC.nc b/tos/platforms/epic/MoteClockC.nc new file mode 100644 index 00000000..4fe33910 --- /dev/null +++ b/tos/platforms/epic/MoteClockC.nc @@ -0,0 +1,48 @@ +/* + * 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$ + * + */ + + /** + * @author Vlado Handziski + */ + +configuration MoteClockC +{ + provides interface Init as MoteClockInit; +} +implementation + +{ + components Msp430ClockC, MoteClockP; + + MoteClockInit = Msp430ClockC.Init; + //MoteClockP.Msp430ClockInit -> Msp430ClockC; +} diff --git a/tos/platforms/epic/MoteClockP.nc b/tos/platforms/epic/MoteClockP.nc new file mode 100644 index 00000000..bd3cfdcf --- /dev/null +++ b/tos/platforms/epic/MoteClockP.nc @@ -0,0 +1,107 @@ +/* + * 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$ + * + */ + + /** + * @author Vlado Handziski + * @author Cory Sharp + */ + +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; + } + +} diff --git a/tos/platforms/epic/PlatformC.nc b/tos/platforms/epic/PlatformC.nc new file mode 100644 index 00000000..c0cd4a17 --- /dev/null +++ b/tos/platforms/epic/PlatformC.nc @@ -0,0 +1,46 @@ +// $Id$ + +/* + * "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 + */ +#include "hardware.h" + +configuration PlatformC { + provides { + interface Init; + } +} +implementation { + components PlatformP; + components MoteClockC; + + Init = PlatformP; + PlatformP.MoteClockInit -> MoteClockC; +} diff --git a/tos/platforms/epic/PlatformLedsC.nc b/tos/platforms/epic/PlatformLedsC.nc new file mode 100644 index 00000000..47340eaa --- /dev/null +++ b/tos/platforms/epic/PlatformLedsC.nc @@ -0,0 +1,30 @@ +#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; +} diff --git a/tos/platforms/epic/PlatformP.nc b/tos/platforms/epic/PlatformP.nc new file mode 100644 index 00000000..582e665f --- /dev/null +++ b/tos/platforms/epic/PlatformP.nc @@ -0,0 +1,54 @@ +// $Id$ + +/* + * "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 + */ +#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; + } +} diff --git a/tos/platforms/epic/UserButton.h b/tos/platforms/epic/UserButton.h new file mode 100644 index 00000000..d0207415 --- /dev/null +++ b/tos/platforms/epic/UserButton.h @@ -0,0 +1,44 @@ +/** + * 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 + * @version $Revision$ + */ + +#ifndef USERBUTTON_H +#define USERBUTTON_H + +typedef enum { BUTTON_RELEASED = 0, BUTTON_PRESSED = 1 } button_state_t; + +#endif diff --git a/tos/platforms/epic/UserButtonC.nc b/tos/platforms/epic/UserButtonC.nc new file mode 100644 index 00000000..e44b2af5 --- /dev/null +++ b/tos/platforms/epic/UserButtonC.nc @@ -0,0 +1,63 @@ +/** + * 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 + * @version $Revision$ + */ + +#include + +configuration UserButtonC { + provides interface Get; + provides interface Notify; +} +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; +} diff --git a/tos/platforms/epic/UserButtonP.nc b/tos/platforms/epic/UserButtonP.nc new file mode 100644 index 00000000..7a34fe0b --- /dev/null +++ b/tos/platforms/epic/UserButtonP.nc @@ -0,0 +1,75 @@ +/** + * 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 + * @version $Revision$ + */ + +#include + +module UserButtonP { + provides interface Get; + provides interface Notify; + + uses interface Get as GetLower; + uses interface Notify 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 ); + } + } +} diff --git a/tos/platforms/epic/VoltageC.nc b/tos/platforms/epic/VoltageC.nc new file mode 100644 index 00000000..2da64b63 --- /dev/null +++ b/tos/platforms/epic/VoltageC.nc @@ -0,0 +1,50 @@ +/* + * 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 + * @version $Revision$ $Date$ + */ + +generic configuration VoltageC() { + provides interface Read; +} +implementation { + components new Msp430InternalVoltageC(); + Read = Msp430InternalVoltageC.Read; +} + diff --git a/tos/platforms/epic/VoltageStreamC.nc b/tos/platforms/epic/VoltageStreamC.nc new file mode 100644 index 00000000..2c278344 --- /dev/null +++ b/tos/platforms/epic/VoltageStreamC.nc @@ -0,0 +1,50 @@ +/* + * 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 + * @version $Revision$ $Date$ + */ + +generic configuration VoltageStreamC() { + provides interface ReadStream; +} +implementation { + components new Msp430InternalVoltageC(); + ReadStream = Msp430InternalVoltageC.ReadStream; +} + diff --git a/tos/platforms/epic/hardware.h b/tos/platforms/epic/hardware.h new file mode 100644 index 00000000..c295356e --- /dev/null +++ b/tos/platforms/epic/hardware.h @@ -0,0 +1,89 @@ +// $Id$ + +/* + * "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 diff --git a/tos/platforms/epic/platform.h b/tos/platforms/epic/platform.h new file mode 100644 index 00000000..e69de29b diff --git a/tos/platforms/epic/platform_message.h b/tos/platforms/epic/platform_message.h new file mode 100644 index 00000000..0c4b3b5a --- /dev/null +++ b/tos/platforms/epic/platform_message.h @@ -0,0 +1,58 @@ +/* $Id$ + * "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$ $Date$ + */ + + +#ifndef PLATFORM_MESSAGE_H +#define PLATFORM_MESSAGE_H + +#include +#include + +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 -- 2.39.2