From bef408170ad6af964a2a8950ea57c5d8fda75678 Mon Sep 17 00:00:00 2001 From: konradlorincz Date: Wed, 21 May 2008 22:07:24 +0000 Subject: [PATCH] Imported initial SHIMMER platform code. --- tos/platforms/shimmer/.platform | 48 +++ tos/platforms/shimmer/ActiveMessageC.nc | 68 ++++ tos/platforms/shimmer/DemoSensorC.nc | 57 ++++ tos/platforms/shimmer/MoteClockC.nc | 47 +++ tos/platforms/shimmer/MotePlatformC.nc | 48 +++ tos/platforms/shimmer/Msp430Timer32khzMapC.nc | 75 +++++ tos/platforms/shimmer/PlatformC.nc | 38 +++ tos/platforms/shimmer/PlatformLedsC.nc | 57 ++++ tos/platforms/shimmer/PlatformP.nc | 19 ++ tos/platforms/shimmer/PlatformSerialC.nc | 52 +++ tos/platforms/shimmer/README.txt | 67 ++++ tos/platforms/shimmer/ShimmerSerialP.nc | 62 ++++ tos/platforms/shimmer/VoltageC.nc | 50 +++ .../shimmer/chips/cc2420/HplCC2420AlarmC.nc | 54 ++++ .../chips/cc2420/HplCC2420InterruptsC.nc | 72 +++++ .../shimmer/chips/cc2420/HplCC2420PinsC.nc | 86 +++++ .../shimmer/chips/cc2420/HplCC2420SpiC.nc | 62 ++++ tos/platforms/shimmer/hardware.h | 296 ++++++++++++++++++ tos/platforms/shimmer/platform.h | 0 tos/platforms/shimmer/platform_message.h | 59 ++++ 20 files changed, 1317 insertions(+) create mode 100644 tos/platforms/shimmer/.platform create mode 100644 tos/platforms/shimmer/ActiveMessageC.nc create mode 100644 tos/platforms/shimmer/DemoSensorC.nc create mode 100644 tos/platforms/shimmer/MoteClockC.nc create mode 100644 tos/platforms/shimmer/MotePlatformC.nc create mode 100644 tos/platforms/shimmer/Msp430Timer32khzMapC.nc create mode 100644 tos/platforms/shimmer/PlatformC.nc create mode 100644 tos/platforms/shimmer/PlatformLedsC.nc create mode 100644 tos/platforms/shimmer/PlatformP.nc create mode 100644 tos/platforms/shimmer/PlatformSerialC.nc create mode 100644 tos/platforms/shimmer/README.txt create mode 100644 tos/platforms/shimmer/ShimmerSerialP.nc create mode 100644 tos/platforms/shimmer/VoltageC.nc create mode 100644 tos/platforms/shimmer/chips/cc2420/HplCC2420AlarmC.nc create mode 100644 tos/platforms/shimmer/chips/cc2420/HplCC2420InterruptsC.nc create mode 100644 tos/platforms/shimmer/chips/cc2420/HplCC2420PinsC.nc create mode 100644 tos/platforms/shimmer/chips/cc2420/HplCC2420SpiC.nc create mode 100644 tos/platforms/shimmer/hardware.h create mode 100644 tos/platforms/shimmer/platform.h create mode 100644 tos/platforms/shimmer/platform_message.h diff --git a/tos/platforms/shimmer/.platform b/tos/platforms/shimmer/.platform new file mode 100644 index 00000000..760dd36b --- /dev/null +++ b/tos/platforms/shimmer/.platform @@ -0,0 +1,48 @@ +# SHIMMER - platform includes +# Konrad Lorincz 5/14/08 +# +# Includes that should take precedence come first. Platforms come before +# chips because they may override files. These must be specified as +# @includes instead of -I's to @opts, otherwise the %T won't be processed +# by ncc. + +push( @includes, qw( + + %T/platforms/shimmer + %T/platforms/shimmer/chips/cc2420 + %T/chips/cc2420 + %T/chips/cc2420/alarm + %T/chips/cc2420/control + %T/chips/cc2420/csma + %T/chips/cc2420/interfaces + %T/chips/cc2420/link + %T/chips/cc2420/lowpan + %T/chips/cc2420/lpl + %T/chips/cc2420/packet + %T/chips/cc2420/receive + %T/chips/cc2420/spi + %T/chips/cc2420/transmit + %T/chips/cc2420/unique + %T/chips/msp430 + %T/chips/msp430/adc12 + %T/chips/msp430/dma + %T/chips/msp430/pins + %T/chips/msp430/timer + %T/chips/msp430/usart + %T/chips/msp430/sensors + %T/lib/timer + %T/lib/serial + %T/lib/adc + %T/lib/power + ) ); + +@opts = qw( + + -gcc=msp430-gcc + -mmcu=msp430x1611 + -fnesc-target=msp430 + -fnesc-no-debug +); + +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; +push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/shimmer/ActiveMessageC.nc b/tos/platforms/shimmer/ActiveMessageC.nc new file mode 100644 index 00000000..9c705b7e --- /dev/null +++ b/tos/platforms/shimmer/ActiveMessageC.nc @@ -0,0 +1,68 @@ +// $Id$ + +/* tab:4 + * "Copyright (c) 2004-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) 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. + */ +/* + * + * Authors: Philip Levis + * Date last modified: $Id$ + * + */ +/** + * The Active Message layer on the SHIMER platform. This is a naming wrapper + * around the CC2420 Active Message layer. + * + * @author Konrad Lorincz + */ + +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; + } +} +implementation { + components CC2420ActiveMessageC as AM; + + SplitControl = AM; + + AMSend = AM; + Receive = AM.Receive; + Snoop = AM.Snoop; + Packet = AM; + AMPacket = AM; + PacketAcknowledgements = AM; +} diff --git a/tos/platforms/shimmer/DemoSensorC.nc b/tos/platforms/shimmer/DemoSensorC.nc new file mode 100644 index 00000000..154a36b0 --- /dev/null +++ b/tos/platforms/shimmer/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/shimmer/MoteClockC.nc b/tos/platforms/shimmer/MoteClockC.nc new file mode 100644 index 00000000..12df90bd --- /dev/null +++ b/tos/platforms/shimmer/MoteClockC.nc @@ -0,0 +1,47 @@ +/* + * 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; + + MoteClockInit = Msp430ClockC.Init; +} diff --git a/tos/platforms/shimmer/MotePlatformC.nc b/tos/platforms/shimmer/MotePlatformC.nc new file mode 100644 index 00000000..d00231cf --- /dev/null +++ b/tos/platforms/shimmer/MotePlatformC.nc @@ -0,0 +1,48 @@ +module MotePlatformC { + provides interface Init; +} +implementation { + command error_t Init.init() { + //LEDS + TOSH_SET_RED_LED_PIN(); + TOSH_SET_GREEN_LED_PIN(); + TOSH_SET_YELLOW_LED_PIN(); + TOSH_MAKE_RED_LED_OUTPUT(); + TOSH_MAKE_GREEN_LED_OUTPUT(); + TOSH_MAKE_YELLOW_LED_OUTPUT(); + + //RADIO PINS + //CC2420 pins + TOSH_MAKE_SOMI0_INPUT(); + TOSH_MAKE_SIMO0_INPUT(); + TOSH_MAKE_UCLK0_INPUT(); + TOSH_MAKE_SOMI1_INPUT(); + TOSH_MAKE_SIMO1_INPUT(); + TOSH_MAKE_UCLK1_INPUT(); + TOSH_SET_RADIO_RESET_PIN(); + TOSH_MAKE_RADIO_RESET_OUTPUT(); + TOSH_CLR_RADIO_VREF_PIN(); + TOSH_MAKE_RADIO_VREF_OUTPUT(); + TOSH_SET_RADIO_CSN_PIN(); + TOSH_MAKE_RADIO_CSN_OUTPUT(); + TOSH_MAKE_RADIO_FIFOP_INPUT(); + TOSH_MAKE_RADIO_SFD_INPUT(); + + TOSH_MAKE_RADIO_1V8_EN_OUTPUT(); + TOSH_SEL_RADIO_1V8_EN_IOFUNC(); + TOSH_CLR_RADIO_1V8_EN_PIN(); + + TOSH_MAKE_CSN_OUTPUT(); + TOSH_SEL_CSN_IOFUNC(); + TOSH_SET_CSN_PIN(); + + + //UART PINS + TOSH_MAKE_UTXD0_INPUT(); + TOSH_MAKE_URXD0_INPUT(); + TOSH_MAKE_UTXD1_INPUT(); + TOSH_MAKE_URXD1_INPUT(); + + return SUCCESS; + } +} diff --git a/tos/platforms/shimmer/Msp430Timer32khzMapC.nc b/tos/platforms/shimmer/Msp430Timer32khzMapC.nc new file mode 100644 index 00000000..c3e6d192 --- /dev/null +++ b/tos/platforms/shimmer/Msp430Timer32khzMapC.nc @@ -0,0 +1,75 @@ +//$Id$ + +/* "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." + */ + +/** + * MSP430Timer32khzMapC presents as paramaterized interfaces all of + * the 32khz hardware timers on the MSP430 that are available for + * compile time allocation by "new Alarm32khz16C()", "new + * AlarmMilli32C()", and so on. + * + * Platforms based on the MSP430 are * encouraged to copy in and + * override this file, presenting only the * hardware timers that are + * available for allocation on that platform. + * + * @author Cory Sharp + * @version $Revision$ $Date$ + */ + +configuration Msp430Timer32khzMapC +{ + provides interface Msp430Timer[ uint8_t id ]; + provides interface Msp430TimerControl[ uint8_t id ]; + provides interface Msp430Compare[ uint8_t id ]; +} +implementation +{ + components Msp430TimerC; + + Msp430Timer[0] = Msp430TimerC.TimerB; + Msp430TimerControl[0] = Msp430TimerC.ControlB0; + Msp430Compare[0] = Msp430TimerC.CompareB0; + + // Timer pin B1 is used by the CC2420 radio's SFD pin + // this is the only difference between the default 32khz map + // and the map on telos + + Msp430Timer[1] = Msp430TimerC.TimerB; + Msp430TimerControl[1] = Msp430TimerC.ControlB2; + Msp430Compare[1] = Msp430TimerC.CompareB2; + + Msp430Timer[2] = Msp430TimerC.TimerB; + Msp430TimerControl[2] = Msp430TimerC.ControlB3; + Msp430Compare[2] = Msp430TimerC.CompareB3; + + Msp430Timer[3] = Msp430TimerC.TimerB; + Msp430TimerControl[3] = Msp430TimerC.ControlB4; + Msp430Compare[3] = Msp430TimerC.CompareB4; + + Msp430Timer[4] = Msp430TimerC.TimerB; + Msp430TimerControl[4] = Msp430TimerC.ControlB5; + Msp430Compare[4] = Msp430TimerC.CompareB5; + + Msp430Timer[5] = Msp430TimerC.TimerB; + Msp430TimerControl[5] = Msp430TimerC.ControlB6; + Msp430Compare[5] = Msp430TimerC.CompareB6; +} + diff --git a/tos/platforms/shimmer/PlatformC.nc b/tos/platforms/shimmer/PlatformC.nc new file mode 100644 index 00000000..b8a67b71 --- /dev/null +++ b/tos/platforms/shimmer/PlatformC.nc @@ -0,0 +1,38 @@ +/* "Copyright (c) 2000-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 Joe Polastre and Cory Sharp + * @version $Revision$ $Date$ + */ +#include "hardware.h" + +configuration PlatformC +{ + provides interface Init; +} +implementation +{ + components PlatformP, MotePlatformC, MoteClockC; + + Init = PlatformP; + PlatformP.MoteClockInit -> MoteClockC; + PlatformP.MoteInit -> MotePlatformC; +} diff --git a/tos/platforms/shimmer/PlatformLedsC.nc b/tos/platforms/shimmer/PlatformLedsC.nc new file mode 100644 index 00000000..5fc1d274 --- /dev/null +++ b/tos/platforms/shimmer/PlatformLedsC.nc @@ -0,0 +1,57 @@ +// $Id$ + +/* "Copyright (c) 2000-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 Joe Polastre + * @version $Revision$ $Date$ + */ +#include "hardware.h" + +configuration PlatformLedsC { + provides interface GeneralIO as Led0; + provides interface GeneralIO as Led1; + provides interface GeneralIO as Led2; + uses interface Init; +} +implementation +{ + components + HplMsp430GeneralIOC as GeneralIOC + , new Msp430GpioC() as Led0Impl + , new Msp430GpioC() as Led1Impl + , new Msp430GpioC() as Led2Impl + ; + components PlatformP; + + Init = PlatformP.LedsInit; + + Led0 = Led0Impl; + Led0Impl -> GeneralIOC.Port40; + + Led1 = Led1Impl; + Led1Impl -> GeneralIOC.Port41; + + Led2 = Led2Impl; + Led2Impl -> GeneralIOC.Port42; + +} + diff --git a/tos/platforms/shimmer/PlatformP.nc b/tos/platforms/shimmer/PlatformP.nc new file mode 100644 index 00000000..b8dc9438 --- /dev/null +++ b/tos/platforms/shimmer/PlatformP.nc @@ -0,0 +1,19 @@ +#include "hardware.h" + +module PlatformP{ + provides interface Init; + uses interface Init as MoteClockInit; + uses interface Init as MoteInit; + uses interface Init as LedsInit; +} +implementation { + command error_t Init.init() { + call MoteClockInit.init(); + call MoteInit.init(); + call LedsInit.init(); + return SUCCESS; + } + + default command error_t LedsInit.init() { return SUCCESS; } + +} diff --git a/tos/platforms/shimmer/PlatformSerialC.nc b/tos/platforms/shimmer/PlatformSerialC.nc new file mode 100644 index 00000000..d8184464 --- /dev/null +++ b/tos/platforms/shimmer/PlatformSerialC.nc @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008 + * The President and Fellows of Harvard College. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of the University 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 UNIVERSITY 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 UNIVERSITY 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. + */ +/** + * Ported to the SHIMMER platform: uses Uart0 instead of Uart1 (telos). + * + * @author Konrad Lorincz + * @date May 14, 2008 + */ + +configuration PlatformSerialC +{ + provides interface StdControl; + provides interface UartStream; + provides interface UartByte; +} +implementation +{ + components new Msp430Uart0C() as UartC; + UartStream = UartC; + UartByte = UartC; + + components ShimmerSerialP; + StdControl = ShimmerSerialP; + ShimmerSerialP.Msp430UartConfigure <- UartC.Msp430UartConfigure; + ShimmerSerialP.Resource -> UartC.Resource; +} diff --git a/tos/platforms/shimmer/README.txt b/tos/platforms/shimmer/README.txt new file mode 100644 index 00000000..08ff4d7d --- /dev/null +++ b/tos/platforms/shimmer/README.txt @@ -0,0 +1,67 @@ +*** SHIMMER - TinyOS 2.x platform support *** +============================================= +Konrad Lorincz +May 6, 2008 + +This directory contains tinyos 2.x platform support for the Intel +SHIMMER mote. Please use the mailing list given below to post +questions and comments. + + +Usage +----- +You can compile and install applications for the SHIMMER platform just +like with any standard platform, "make shimmer install ..." (Note: +you must have a shimmer programming board). + +For example, to complie and install Blink, do the following: + + $ cd $TOSROOT/apps/Blink + $ make shimmer install bsl,X + +where X is your serial port. + +You may also want to test the radio. Do this by compiling and +installing "$TOSROOT/apps/RadioCountToLeds" on TWO shimmers (for +sending and receiving radio messages). + + +Support +------- + - Official documentation + http://docs.tinyos.net/index.php/SHIMMER + - Mailing list (requires subscription to post) + https://www.eecs.harvard.edu/mailman/listinfo/shimmer-users + + +Copyright +--------- +/* + * Copyright (c) 2008 + * The President and Fellows of Harvard College. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of the University 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 UNIVERSITY 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 UNIVERSITY 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. + */ + diff --git a/tos/platforms/shimmer/ShimmerSerialP.nc b/tos/platforms/shimmer/ShimmerSerialP.nc new file mode 100644 index 00000000..b62f0948 --- /dev/null +++ b/tos/platforms/shimmer/ShimmerSerialP.nc @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2008 + * The President and Fellows of Harvard College. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of the University 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 UNIVERSITY 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 UNIVERSITY 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. + */ +/** + * Ported to the SHIMMER platform: uses Uart0 instead of Uart1 (telos). + * + * @author Konrad Lorincz + * @date May 14, 2008 + */ +module ShimmerSerialP +{ + provides interface StdControl; + provides interface Msp430UartConfigure; + uses interface Resource; +} +implementation +{ + msp430_uart_union_config_t msp430_uart_telos_config = { {ubr: UBR_1MHZ_115200, umctl: UMCTL_1MHZ_115200, ssel: 0x02, pena: 0, pev: 0, spb: 0, clen: 1, listen: 0, mm: 0, ckpl: 0, urxse: 0, urxeie: 1, urxwie: 0, utxe : 1, urxe : 1} }; + + command error_t StdControl.start() + { + return call Resource.immediateRequest(); + } + + command error_t StdControl.stop() + { + call Resource.release(); + return SUCCESS; + } + + event void Resource.granted(){} + + async command msp430_uart_union_config_t* Msp430UartConfigure.getConfig() + { + return &msp430_uart_telos_config; + } +} diff --git a/tos/platforms/shimmer/VoltageC.nc b/tos/platforms/shimmer/VoltageC.nc new file mode 100644 index 00000000..2da64b63 --- /dev/null +++ b/tos/platforms/shimmer/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/shimmer/chips/cc2420/HplCC2420AlarmC.nc b/tos/platforms/shimmer/chips/cc2420/HplCC2420AlarmC.nc new file mode 100644 index 00000000..0d56a8b2 --- /dev/null +++ b/tos/platforms/shimmer/chips/cc2420/HplCC2420AlarmC.nc @@ -0,0 +1,54 @@ +/* + * 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 + */ + +/** + * HPL implementation of 32khz alarms for the ChipCon CC2420 radio + * connected to a TI MSP430 processor. + * + * @author Jonathan Hui + * @version $Revision$ $Date$ + */ + +generic configuration HplCC2420AlarmC() { + + provides interface Init; + provides interface Alarm as Alarm32khz32; + +} + +implementation { + + components new Alarm32khz32C(); + + Init = Alarm32khz32C; + Alarm32khz32 = Alarm32khz32C; + +} diff --git a/tos/platforms/shimmer/chips/cc2420/HplCC2420InterruptsC.nc b/tos/platforms/shimmer/chips/cc2420/HplCC2420InterruptsC.nc new file mode 100644 index 00000000..82aa0c6b --- /dev/null +++ b/tos/platforms/shimmer/chips/cc2420/HplCC2420InterruptsC.nc @@ -0,0 +1,72 @@ +/* + * 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 + */ + +/** + * HPL implementation of interrupts and captures for the ChipCon + * CC2420 radio connected to a TI MSP430 processor. + * + * @author Jonathan Hui + * @version $Revision$ $Date$ + */ +/** + * Ported to the SHIMMER platform. + * + * @author Konrad Lorincz + * @date May 14, 2008 + */ + +configuration HplCC2420InterruptsC { + + provides interface GpioCapture as CaptureSFD; + provides interface GpioInterrupt as InterruptCCA; + provides interface GpioInterrupt as InterruptFIFOP; + +} + +implementation { + + components HplMsp430GeneralIOC as GeneralIOC; + components Msp430TimerC; + components new GpioCaptureC() as CaptureSFDC; + CaptureSFDC.Msp430TimerControl -> Msp430TimerC.ControlA1; + CaptureSFDC.Msp430Capture -> Msp430TimerC.CaptureA1; + CaptureSFDC.GeneralIO -> GeneralIOC.Port12; + + components HplMsp430InterruptC; + components new Msp430InterruptC() as InterruptCCAC; + components new Msp430InterruptC() as InterruptFIFOPC; + InterruptCCAC.HplInterrupt -> HplMsp430InterruptC.Port27; + InterruptFIFOPC.HplInterrupt -> HplMsp430InterruptC.Port26; + + CaptureSFD = CaptureSFDC.Capture; + InterruptCCA = InterruptCCAC.Interrupt; + InterruptFIFOP = InterruptFIFOPC.Interrupt; +} diff --git a/tos/platforms/shimmer/chips/cc2420/HplCC2420PinsC.nc b/tos/platforms/shimmer/chips/cc2420/HplCC2420PinsC.nc new file mode 100644 index 00000000..e0b5bab3 --- /dev/null +++ b/tos/platforms/shimmer/chips/cc2420/HplCC2420PinsC.nc @@ -0,0 +1,86 @@ +/* + * 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 + */ + +/** + * HPL implementation of general-purpose I/O for the ChipCon CC2420 + * radio connected to a TI MSP430 processor. + * + * @author Jonathan Hui + * @version $Revision$ $Date$ + */ +/** + * Ported to the SHIMMER platform. + * + * @author Konrad Lorincz + * @date May 14, 2008 + */ + +configuration HplCC2420PinsC { + + provides interface GeneralIO as CCA; + provides interface GeneralIO as CSN; + provides interface GeneralIO as FIFO; + provides interface GeneralIO as FIFOP; + provides interface GeneralIO as RSTN; + provides interface GeneralIO as SFD; + provides interface GeneralIO as VREN; + +} + +implementation { + + components HplMsp430GeneralIOC as GeneralIOC; + components new Msp430GpioC() as CCAM; + components new Msp430GpioC() as CSNM; + components new Msp430GpioC() as FIFOM; + components new Msp430GpioC() as FIFOPM; + components new Msp430GpioC() as RSTNM; + components new Msp430GpioC() as SFDM; + components new Msp430GpioC() as VRENM; + + CCAM -> GeneralIOC.Port27; + CSNM -> GeneralIOC.Port54; + FIFOM -> GeneralIOC.Port10; + FIFOPM -> GeneralIOC.Port26; + RSTNM -> GeneralIOC.Port57; + SFDM -> GeneralIOC.Port50; + VRENM -> GeneralIOC.Port56; + + CCA = CCAM; + CSN = CSNM; + FIFO = FIFOM; + FIFOP = FIFOPM; + RSTN = RSTNM; + SFD = SFDM; + VREN = VRENM; + +} + diff --git a/tos/platforms/shimmer/chips/cc2420/HplCC2420SpiC.nc b/tos/platforms/shimmer/chips/cc2420/HplCC2420SpiC.nc new file mode 100644 index 00000000..0179f933 --- /dev/null +++ b/tos/platforms/shimmer/chips/cc2420/HplCC2420SpiC.nc @@ -0,0 +1,62 @@ +/* + * 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 + */ + +/** + * HPL implementation of the SPI bus for the ChipCon CC2420 radio + * connected to a TI MSP430 processor. + * + * @author Jonathan Hui + * @version $Revision$ $Date$ + */ +/** + * Ported to the SHIMMER platform. + * + * @author Konrad Lorincz + */ + +generic configuration HplCC2420SpiC() { + + provides interface Resource; + provides interface SpiByte; + provides interface SpiPacket; + +} + +implementation { + + components new Msp430Spi1C() as SpiC; + + Resource = SpiC; + SpiByte = SpiC; + SpiPacket = SpiC; + +} + diff --git a/tos/platforms/shimmer/hardware.h b/tos/platforms/shimmer/hardware.h new file mode 100644 index 00000000..06013f1a --- /dev/null +++ b/tos/platforms/shimmer/hardware.h @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2006, Intel 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 Intel 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 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. + * + * @author Steven Ayer + * @date June 2006 + */ + + +#ifndef _H_hardware_h +#define _H_hardware_h + +#include "msp430hardware.h" + +#define SHIMMER 1 + +// LEDs +TOSH_ASSIGN_PIN(RED_LED, 4, 0); +TOSH_ASSIGN_PIN(ORANGE_LED, 4, 1); +TOSH_ASSIGN_PIN(YELLOW_LED, 4, 2); +TOSH_ASSIGN_PIN(GREEN_LED, 4, 3); + +// CC2420 RADIO #defines +TOSH_ASSIGN_PIN(RADIO_FIFO, 1, 0); +TOSH_ASSIGN_PIN(RADIO_TIMED_SFD, 1, 2); +TOSH_ASSIGN_PIN(RADIO_FIFOP, 2, 6); +TOSH_ASSIGN_PIN(RADIO_CCA, 2, 7); + +TOSH_ASSIGN_PIN(RADIO_1V8_EN, 4, 7); +TOSH_ASSIGN_PIN(RADIO_VREF, 5, 6); // unused in shimmer +TOSH_ASSIGN_PIN(SW_BT_PWR_N, 5, 6); // " " " +TOSH_ASSIGN_PIN(SW_SD_PWR_N, 5, 6); // " " " + +TOSH_ASSIGN_PIN(RADIO_SFD, 5, 0); +TOSH_ASSIGN_PIN(RADIO_SIMO1, 5, 1); +TOSH_ASSIGN_PIN(RADIO_SOMI1, 5, 2); +TOSH_ASSIGN_PIN(RADIO_CSN, 5, 4); +TOSH_ASSIGN_PIN(CSN, 5, 4); +TOSH_ASSIGN_PIN(RADIO_RESET, 5, 7); + + +// Don't think these are needed +TOSH_ASSIGN_PIN(CC_FIFOP, 2, 6); +TOSH_ASSIGN_PIN(CC_FIFO, 1, 0); +TOSH_ASSIGN_PIN(CC_SFD, 1, 2); +TOSH_ASSIGN_PIN(CC_VREN, 5, 6); +TOSH_ASSIGN_PIN(CC_RSTN, 5, 7); + +// BT pins +TOSH_ASSIGN_PIN(BT_PIO, 1, 5); +TOSH_ASSIGN_PIN(BT_RTS, 1, 6); +TOSH_ASSIGN_PIN(BT_CTS, 1, 7); +TOSH_ASSIGN_PIN(BT_TXD, 3, 6); +TOSH_ASSIGN_PIN(BT_RXD, 3, 7); +TOSH_ASSIGN_PIN(BT_RESET, 5, 5); + +//BSL Pins +TOSH_ASSIGN_PIN(PROG_OUT, 1, 1); +TOSH_ASSIGN_PIN(PROG_IN, 2, 2); + +// SD uart chip-select +TOSH_ASSIGN_PIN(SD_CS_N, 3, 0); + +// ADC +TOSH_ASSIGN_PIN(ADC0, 6, 5); +TOSH_ASSIGN_PIN(ADC1, 6, 4); +TOSH_ASSIGN_PIN(ADC2, 6, 3); + +// ADC lines on the testpoints +TOSH_ASSIGN_PIN(ADC_0, 6, 0); +TOSH_ASSIGN_PIN(ADC_1, 6, 1); +TOSH_ASSIGN_PIN(ADC_2, 6, 2); +TOSH_ASSIGN_PIN(ADC_6, 6, 6); +TOSH_ASSIGN_PIN(ADC_7, 6, 7); + +TOSH_ASSIGN_PIN(ADC_ACCELZ, 6, 3); +TOSH_ASSIGN_PIN(ADC_ACCELY, 6, 4); +TOSH_ASSIGN_PIN(ADC_ACCELX, 6, 5); + +TOSH_ASSIGN_PIN(DAC0_AN, 6, 6); +TOSH_ASSIGN_PIN(DAC1_AN, 6, 7); + + +// UART pins +// SPI1 attached to bt, cc2420 +TOSH_ASSIGN_PIN(UCLK1, 5, 3); +TOSH_ASSIGN_PIN(SOMI1, 5, 2); +TOSH_ASSIGN_PIN(SIMO1, 5, 1); + +// used as GPIOs +TOSH_ASSIGN_PIN(UCLK0, 3, 3); +TOSH_ASSIGN_PIN(SOMI0, 3, 2); +TOSH_ASSIGN_PIN(SIMO0, 3, 1); + +// connected to UART (0 and 1) +TOSH_ASSIGN_PIN(UTXD0, 3, 4); +TOSH_ASSIGN_PIN(URXD0, 3, 5); +TOSH_ASSIGN_PIN(UTXD1, 3, 6); +TOSH_ASSIGN_PIN(URXD1, 3, 7); + +// GIO pins +TOSH_ASSIGN_PIN(SER0_RTS, 1, 3); +TOSH_ASSIGN_PIN(SER0_CTS, 1, 4); + +TOSH_ASSIGN_PIN(ROSC, 2, 5); + +TOSH_ASSIGN_PIN(GIO0, 2, 0); +TOSH_ASSIGN_PIN(GIO1, 2, 1); + + +// 1-Wire +TOSH_ASSIGN_PIN(ONEWIRE_PWR, 2, 3); +TOSH_ASSIGN_PIN(ONEWIRE, 2, 4); + +// ACCEL +TOSH_ASSIGN_PIN(ACCEL_SEL0, 4, 4); +TOSH_ASSIGN_PIN(ACCEL_SEL1, 4, 5); +TOSH_ASSIGN_PIN(ACCEL_SLEEP_N, 4, 6); + +void TOSH_SET_PIN_DIRECTIONS(void) +{ + //LEDS + TOSH_MAKE_RED_LED_OUTPUT(); + TOSH_MAKE_YELLOW_LED_OUTPUT(); + TOSH_MAKE_ORANGE_LED_OUTPUT(); + TOSH_MAKE_GREEN_LED_OUTPUT(); + TOSH_SEL_RED_LED_IOFUNC(); + TOSH_SEL_YELLOW_LED_IOFUNC(); + TOSH_SEL_ORANGE_LED_IOFUNC(); + TOSH_SEL_GREEN_LED_IOFUNC(); + + //RADIO PINS + //CC2420 pins + TOSH_MAKE_RADIO_CSN_OUTPUT(); + TOSH_SEL_RADIO_CSN_IOFUNC(); + TOSH_SET_RADIO_CSN_PIN(); + + TOSH_MAKE_CSN_OUTPUT(); + TOSH_SEL_CSN_IOFUNC(); + TOSH_SET_CSN_PIN(); + + // should be reset_n + TOSH_MAKE_RADIO_RESET_OUTPUT(); + TOSH_SEL_RADIO_RESET_IOFUNC(); + TOSH_CLR_RADIO_RESET_PIN(); + + TOSH_MAKE_RADIO_1V8_EN_OUTPUT(); + TOSH_SEL_RADIO_1V8_EN_IOFUNC(); + TOSH_CLR_RADIO_1V8_EN_PIN(); + + TOSH_MAKE_RADIO_CCA_INPUT(); + TOSH_MAKE_RADIO_FIFO_INPUT(); + TOSH_MAKE_RADIO_FIFOP_INPUT(); + TOSH_MAKE_RADIO_SFD_INPUT(); + TOSH_SEL_RADIO_CCA_IOFUNC(); + TOSH_SEL_RADIO_FIFO_IOFUNC(); + TOSH_SEL_RADIO_FIFOP_IOFUNC(); + TOSH_SEL_RADIO_SFD_IOFUNC(); + + TOSH_MAKE_ONEWIRE_PWR_OUTPUT(); + TOSH_SET_ONEWIRE_PWR_PIN(); + + TOSH_SEL_SD_CS_N_IOFUNC(); + TOSH_MAKE_SD_CS_N_OUTPUT(); + TOSH_SET_SD_CS_N_PIN(); + + // BT PINS + TOSH_MAKE_BT_RESET_OUTPUT(); + TOSH_SEL_BT_RESET_IOFUNC(); + TOSH_CLR_BT_RESET_PIN(); // mitsumi module disabled by clr + + TOSH_MAKE_BT_RTS_INPUT(); + TOSH_SEL_BT_RTS_IOFUNC(); + + TOSH_MAKE_BT_PIO_OUTPUT(); + TOSH_SEL_BT_PIO_IOFUNC(); + + TOSH_MAKE_BT_CTS_OUTPUT(); + TOSH_SEL_BT_CTS_IOFUNC(); + + TOSH_MAKE_BT_TXD_OUTPUT(); + TOSH_SEL_BT_TXD_MODFUNC(); + + TOSH_MAKE_BT_RXD_INPUT(); + TOSH_SEL_BT_RXD_MODFUNC(); + + // BSL Prog Pins tristate em + TOSH_MAKE_PROG_IN_OUTPUT(); + TOSH_MAKE_PROG_OUT_OUTPUT(); + TOSH_SEL_PROG_IN_IOFUNC(); + TOSH_SEL_PROG_OUT_IOFUNC(); + + + // ADC lines + TOSH_MAKE_ADC_0_OUTPUT(); + TOSH_MAKE_ADC_1_OUTPUT(); + TOSH_MAKE_ADC_2_OUTPUT(); + TOSH_MAKE_ADC_6_OUTPUT(); + TOSH_MAKE_ADC_7_OUTPUT(); + + TOSH_SEL_ADC_0_IOFUNC(); + TOSH_SEL_ADC_1_IOFUNC(); + TOSH_SEL_ADC_2_IOFUNC(); + TOSH_SEL_ADC_6_IOFUNC(); + TOSH_SEL_ADC_7_IOFUNC(); + + TOSH_MAKE_ADC_ACCELZ_INPUT(); + TOSH_MAKE_ADC_ACCELY_INPUT(); + TOSH_MAKE_ADC_ACCELX_INPUT(); + TOSH_SEL_ADC_ACCELZ_MODFUNC(); + TOSH_SEL_ADC_ACCELY_MODFUNC(); + TOSH_SEL_ADC_ACCELX_MODFUNC(); + + TOSH_SEL_ROSC_IOFUNC(); + TOSH_MAKE_ROSC_INPUT(); + + // DAC lines + // Default is not to use DAC mode. Please define pin usage if you want to use them + + // UART pins + // These declarations are to allow the UART module to work since it's using the names. + // The UART module will set them to the right direction when initialized + + // ftdi/gio pins. Unused for now so we do not set directionality or function + + + // 1-wire function + TOSH_MAKE_ONEWIRE_PWR_OUTPUT(); + TOSH_SEL_ONEWIRE_PWR_IOFUNC(); + TOSH_SEL_ONEWIRE_IOFUNC(); + + // Accelerometer pin definitions + TOSH_SEL_ACCEL_SEL0_IOFUNC(); + TOSH_SEL_ACCEL_SEL1_IOFUNC(); + TOSH_SEL_ACCEL_SLEEP_N_IOFUNC(); + + TOSH_MAKE_ACCEL_SEL0_OUTPUT(); + TOSH_MAKE_ACCEL_SEL1_OUTPUT(); + TOSH_MAKE_ACCEL_SLEEP_N_OUTPUT(); + + /* + * unless the accel_sel0 pin is cleared, + * a severe quiescent power hit occurs on the msp430 + * we go from 3.7 ua to 65.1 ua when asleep! + */ + TOSH_CLR_ACCEL_SEL0_PIN(); + TOSH_CLR_ACCEL_SEL1_PIN(); + TOSH_CLR_ACCEL_SLEEP_N_PIN(); + + + // idle expansion header pins + TOSH_MAKE_SER0_CTS_OUTPUT(); + TOSH_SEL_SER0_CTS_IOFUNC(); + TOSH_MAKE_SER0_RTS_OUTPUT(); + TOSH_SEL_SER0_RTS_IOFUNC(); + TOSH_MAKE_GIO0_OUTPUT(); + TOSH_SEL_GIO0_IOFUNC(); + TOSH_MAKE_GIO1_OUTPUT(); + TOSH_SEL_GIO1_IOFUNC(); + TOSH_MAKE_UTXD0_OUTPUT(); + TOSH_SEL_UTXD0_IOFUNC(); + TOSH_MAKE_URXD0_OUTPUT(); + TOSH_SEL_URXD0_IOFUNC(); + TOSH_MAKE_RADIO_VREF_OUTPUT(); + TOSH_SEL_RADIO_VREF_IOFUNC(); + +} + +#endif // _H_hardware_h + diff --git a/tos/platforms/shimmer/platform.h b/tos/platforms/shimmer/platform.h new file mode 100644 index 00000000..e69de29b diff --git a/tos/platforms/shimmer/platform_message.h b/tos/platforms/shimmer/platform_message.h new file mode 100644 index 00000000..75532b9d --- /dev/null +++ b/tos/platforms/shimmer/platform_message.h @@ -0,0 +1,59 @@ +/* $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; + serial_metadata_t serial; +} message_metadata_t; + +#endif -- 2.39.2