]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
new platform. much of the subsystem work is dependent upon shimmer.
authorayer1 <ayer1>
Fri, 4 Sep 2009 18:27:46 +0000 (18:27 +0000)
committerayer1 <ayer1>
Fri, 4 Sep 2009 18:27:46 +0000 (18:27 +0000)
22 files changed:
tos/platforms/shimmer2/.platform [new file with mode: 0644]
tos/platforms/shimmer2/ActiveMessageC.nc [new file with mode: 0644]
tos/platforms/shimmer2/HplUserButtonC.nc [new file with mode: 0644]
tos/platforms/shimmer2/Leds.nc [new file with mode: 0644]
tos/platforms/shimmer2/LedsC.nc [new file with mode: 0644]
tos/platforms/shimmer2/LedsP.nc [new file with mode: 0644]
tos/platforms/shimmer2/MoteClockC.nc [new file with mode: 0644]
tos/platforms/shimmer2/MotePlatformC.nc [new file with mode: 0644]
tos/platforms/shimmer2/Msp430Timer32khzMapC.nc [new file with mode: 0644]
tos/platforms/shimmer2/NoLedsC.nc [new file with mode: 0644]
tos/platforms/shimmer2/PlatformC.nc [new file with mode: 0644]
tos/platforms/shimmer2/PlatformLedsC.nc [new file with mode: 0644]
tos/platforms/shimmer2/PlatformP.nc [new file with mode: 0644]
tos/platforms/shimmer2/PlatformSerialC.nc [new file with mode: 0644]
tos/platforms/shimmer2/ShimmerSerialP.nc [new file with mode: 0644]
tos/platforms/shimmer2/SwitchToggleC.nc [new file with mode: 0644]
tos/platforms/shimmer2/UserButton.h [new file with mode: 0644]
tos/platforms/shimmer2/UserButtonC.nc [new file with mode: 0644]
tos/platforms/shimmer2/UserButtonP.nc [new file with mode: 0644]
tos/platforms/shimmer2/hardware.h [new file with mode: 0644]
tos/platforms/shimmer2/platform.h [new file with mode: 0644]
tos/platforms/shimmer2/platform_message.h [new file with mode: 0644]

diff --git a/tos/platforms/shimmer2/.platform b/tos/platforms/shimmer2/.platform
new file mode 100644 (file)
index 0000000..0040b07
--- /dev/null
@@ -0,0 +1,84 @@
+# SHIMMER2 - platform includes
+# Steve Ayer, June 2009; derived from Konrad Lorincz's SHIMMER platform
+#
+# 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/shimmer2
+  %T/platforms/shimmer2/chips/msp430
+  %T/platforms/shimmer2/chips/cc2420
+  %T/platforms/shimmer2/chips/mma7260
+  %T/platforms/shimmer2/chips/sd
+  %T/platforms/shimmer2/chips/bluetooth
+  %T/platforms/shimmer
+  %T/platforms/shimmer/chips/msp430
+  %T/platforms/shimmer/chips/cc2420
+  %T/platforms/shimmer/chips/mma7260
+  %T/platforms/shimmer/chips/sd
+  %T/platforms/shimmer/chips/bluetooth
+  %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;
+
+$ENV{'CIL_MACHINE'} =
+    "version_major=3 " .
+    "version_minor=2 " .
+    "version=msp430-3.2.3 " .
+    "short=2,2 " .
+    "int=2,2 " .
+    "long=4,2 " .
+    "long_long=8,2 " .
+    "pointer=2,2 " .
+    "enum=2,2 " .
+    "float=4,2 " .
+    "double=4,2 " .
+    "long_double=4,2 " .
+    "void=1,1 " .
+    "fun=1,2 " .
+    "wchar_size_size=2,2 " .
+    "alignof_string=1 " .
+    "max_alignment=1 " .
+    "char_wchar_signed=true,true " .
+    "const_string_literals=true " .
+    "big_endian=false " .
+    "underscore_name=false " .
+    "__builtin_va_list=true " .
+    "__thread_is_keyword=true";
diff --git a/tos/platforms/shimmer2/ActiveMessageC.nc b/tos/platforms/shimmer2/ActiveMessageC.nc
new file mode 100644 (file)
index 0000000..3bc6d82
--- /dev/null
@@ -0,0 +1,75 @@
+// $Id$
+
+/*
+ * "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 SHIMMER platform. This is a naming wrapper
+ * around the CC2420 Active Message layer.
+ *
+ * @author Konrad Lorincz
+ */
+#include "Timer.h"
+
+configuration ActiveMessageC {
+  provides {
+    interface SplitControl;
+
+    interface AMSend[uint8_t id];
+    interface Receive[uint8_t id];
+    interface Receive as Snoop[uint8_t id];
+
+    interface Packet;
+    interface AMPacket;
+    interface PacketAcknowledgements;
+    interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+    interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
+  }
+}
+implementation {
+  components CC2420ActiveMessageC as AM;
+
+  SplitControl = AM;
+  
+  AMSend       = AM;
+  Receive      = AM.Receive;
+  Snoop        = AM.Snoop;
+  Packet       = AM;
+  AMPacket     = AM;
+  PacketAcknowledgements = AM;
+
+  components CC2420PacketC;
+  PacketTimeStamp32khz = CC2420PacketC;
+  PacketTimeStampMilli = CC2420PacketC;
+}
diff --git a/tos/platforms/shimmer2/HplUserButtonC.nc b/tos/platforms/shimmer2/HplUserButtonC.nc
new file mode 100644 (file)
index 0000000..13437d8
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2007 Arch Rock Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Arch Rock Corporation nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE
+ */
+
+/**
+ * Implementation of the user button for the telos platform
+ *
+ * @author Gilman Tolle <gtolle@archrock.com>
+ * @version $Revision$
+ *
+ * @author Mike Healy
+ * @date May 9, 2009 - modified for use with SHIMMER2
+ */
+
+configuration HplUserButtonC {
+  provides interface GeneralIO;
+  provides interface GpioInterrupt;
+}
+implementation {
+  components HplMsp430GeneralIOC as GeneralIOC;
+  components HplMsp430InterruptC as InterruptC;
+
+  components new Msp430GpioC() as UserButtonC;
+  UserButtonC -> GeneralIOC.Port20;
+  GeneralIO = UserButtonC;
+
+  components new Msp430InterruptC() as InterruptUserButtonC;
+  InterruptUserButtonC.HplInterrupt -> InterruptC.Port20;
+  GpioInterrupt = InterruptUserButtonC.Interrupt;
+}
diff --git a/tos/platforms/shimmer2/Leds.nc b/tos/platforms/shimmer2/Leds.nc
new file mode 100644 (file)
index 0000000..631b106
--- /dev/null
@@ -0,0 +1,125 @@
+// $Id$
+
+/*
+ * "Copyright (c) 2005-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."
+ */
+
+/**
+ * Commands for controlling three LEDs. A platform can provide this
+ * interface if it has more than or fewer than three LEDs. In the
+ * former case, these commands refer to the first three LEDs. In the
+ * latter case, some of the commands are null operations, and the set
+ * of non-null operations must be contiguous and start at Led1. That
+ * is, on platforms with 2 LEDs, LED 3's commands are null operations,
+ * while on platforms with 1 LED, LED 2 and LED 3's commands are null
+ * opertations.
+ *
+ * @author Joe Polastre
+ * @author Philip Levis
+ *
+ */
+
+#include "Leds.h"
+
+interface Leds {
+
+  /**
+   * Turn on LED 0. The color of this LED depends on the platform.
+   */
+  async command void led0On();
+
+  /**
+   * Turn off LED 0. The color of this LED depends on the platform.
+   */
+  async command void led0Off();
+
+  /**
+   * Toggle LED 0; if it was off, turn it on, if was on, turn it off.
+   * The color of this LED depends on the platform.
+   */
+  async command void led0Toggle();
+
+  /**
+   * Turn on LED 1. The color of this LED depends on the platform.
+   */
+  async command void led1On();
+
+  /**
+   * Turn off LED 1. The color of this LED depends on the platform.
+   */
+  async command void led1Off();
+
+   /**
+   * Toggle LED 1; if it was off, turn it on, if was on, turn it off.
+   * The color of this LED depends on the platform.
+   */
+  async command void led1Toggle();
+
+  /**
+   * Turn on LED 2. The color of this LED depends on the platform.
+   */
+  async command void led2On();
+
+  /**
+   * Turn off LED 2. The color of this LED depends on the platform.
+   */
+  async command void led2Off();
+
+   /**
+   * Toggle LED 2; if it was off, turn it on, if was on, turn it off.
+   * The color of this LED depends on the platform.
+   */
+  async command void led2Toggle();
+  
+  /**
+   * Get the current LED settings as a bitmask. Each bit corresponds to
+   * whether an LED is on; bit 0 is LED 0, bit 1 is LED 1, etc. You can
+   * also use the enums LEDS_LED0, LEDS_LED1. For example, this expression
+   * will determine whether LED 2 is on:
+   *
+   * <pre> (call Leds.get() & LEDS_LED2) </pre>
+   *
+   * This command supports up to 8 LEDs; if a platform has fewer, then
+   * those LEDs should always be off (their bit is zero). Also see
+   * <tt>set()</tt>.
+   *
+   * @return a bitmask describing which LEDs are on and which are off
+   */ 
+  async command uint8_t get();
+
+  
+  /**
+   * Set the current LED configuration using a bitmask.  Each bit
+   * corresponds to whether an LED is on; bit 0 is LED 0, bit 1 is LED
+   * 1, etc. You can also use the enums LEDS_LED0, LEDS_LED1. For example,
+   * this statement will configure the LEDs so LED 0 and LED 2 are on:
+   *
+   * <pre> call Leds.set(LEDS_LED0 | LEDS_LED2); </pre>
+   *
+   * This statement will turn LED 1 on if it was not already:
+   *
+   * <pre>call Leds.set(call Leds.get() | LEDS_LED1);</pre>
+   *
+   * @param  val   a bitmask describing the on/off settings of the LEDs
+   */
+   async command void set(uint8_t val);
+  
+}
diff --git a/tos/platforms/shimmer2/LedsC.nc b/tos/platforms/shimmer2/LedsC.nc
new file mode 100644 (file)
index 0000000..c3634bb
--- /dev/null
@@ -0,0 +1,48 @@
+// $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."
+ */
+/**
+ *
+ * The basic TinyOS LEDs abstraction.
+ *
+ * @author Phil Buonadonna
+ * @author David Gay
+ * @author Philip Levis
+ * @author Joe Polastre
+ *
+ */
+
+
+configuration LedsC {
+  provides interface Leds;
+}
+implementation {
+  components LedsP, PlatformLedsC;
+
+  Leds = LedsP;
+
+  LedsP.Init <- PlatformLedsC.Init;
+  LedsP.Led0 -> PlatformLedsC.Led0;
+  LedsP.Led1 -> PlatformLedsC.Led1;
+  LedsP.Led2 -> PlatformLedsC.Led2;
+}
+
diff --git a/tos/platforms/shimmer2/LedsP.nc b/tos/platforms/shimmer2/LedsP.nc
new file mode 100644 (file)
index 0000000..1daa36c
--- /dev/null
@@ -0,0 +1,148 @@
+// $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."
+ */
+
+/**
+ * The implementation of the standard 3 LED mote abstraction.
+ *
+ * @author Joe Polastre
+ * @author Philip Levis
+ *
+ * @date   March 21, 2005
+ *
+ */
+
+module LedsP @safe() {
+  provides {
+    interface Init;
+    interface Leds;
+  }
+  uses {
+    interface GeneralIO as Led0;
+    interface GeneralIO as Led1;
+    interface GeneralIO as Led2;
+  }
+}
+implementation {
+  command error_t Init.init() {
+    atomic {
+      dbg("Init", "LEDS: initialized.\n");
+      call Led0.makeOutput();
+      call Led1.makeOutput();
+      call Led2.makeOutput();
+      call Led0.set();
+      call Led1.set();
+      call Led2.set();
+    }
+    return SUCCESS;
+  }
+
+  /* Note: the call is inside the dbg, as it's typically a read of a volatile
+     location, so can't be deadcode eliminated */
+#define DBGLED(n) \
+  dbg("LedsC", "LEDS: Led" #n " %s.\n", call Led ## n .get() ? "off" : "on");
+
+  async command void Leds.led0On() {
+    call Led0.clr();
+    DBGLED(0);
+  }
+
+  async command void Leds.led0Off() {
+    call Led0.set();
+    DBGLED(0);
+  }
+
+  async command void Leds.led0Toggle() {
+    call Led0.toggle();
+    DBGLED(0);
+  }
+
+  async command void Leds.led1On() {
+    call Led1.clr();
+    DBGLED(1);
+  }
+
+  async command void Leds.led1Off() {
+    call Led1.set();
+    DBGLED(1);
+  }
+
+  async command void Leds.led1Toggle() {
+    call Led1.toggle();
+    DBGLED(1);
+  }
+
+  async command void Leds.led2On() {
+    call Led2.clr();
+    DBGLED(2);
+  }
+
+  async command void Leds.led2Off() {
+    call Led2.set();
+    DBGLED(2);
+  }
+
+  async command void Leds.led2Toggle() {
+    call Led2.toggle();
+    DBGLED(2);
+  }
+
+  async command uint8_t Leds.get() {
+    uint8_t rval;
+    atomic {
+      rval = 0;
+      if (!call Led0.get()) {
+             rval |= LEDS_LED0;
+      }
+      if (!call Led1.get()) {
+             rval |= LEDS_LED1;
+      }
+      if (!call Led2.get()) {
+             rval |= LEDS_LED2;
+      }
+    }
+    return rval;
+  }
+
+  async command void Leds.set(uint8_t val) {
+    atomic {
+      if (val & LEDS_LED0) {
+             call Leds.led0On();
+      }
+      else {
+             call Leds.led0Off();
+      }
+      if (val & LEDS_LED1) {
+             call Leds.led1On();
+      }
+      else {
+             call Leds.led1Off();
+      }
+      if (val & LEDS_LED2) {
+             call Leds.led2On();
+      }
+      else {
+             call Leds.led2Off();
+      }
+    }
+  }
+}
diff --git a/tos/platforms/shimmer2/MoteClockC.nc b/tos/platforms/shimmer2/MoteClockC.nc
new file mode 100644 (file)
index 0000000..12df90b
--- /dev/null
@@ -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 <handzisk@tkn.tu-berlind.de>
+ */
+configuration MoteClockC
+{
+  provides interface Init as MoteClockInit;
+}
+implementation
+
+{
+  components Msp430ClockC;
+  
+  MoteClockInit = Msp430ClockC.Init;
+}
diff --git a/tos/platforms/shimmer2/MotePlatformC.nc b/tos/platforms/shimmer2/MotePlatformC.nc
new file mode 100644 (file)
index 0000000..327d17b
--- /dev/null
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2007, 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   July 2007
+ * 
+ * tos-2.x port June 2009
+ *
+ */
+
+module MotePlatformC {
+  provides interface Init;
+}
+
+implementation {
+
+  command error_t Init.init() {
+    
+    register uint8_t i;
+    
+    // have to tell mux to connect path from msp430 to sd
+    TOSH_SEL_DOCK_N_IOFUNC();
+    TOSH_MAKE_DOCK_N_OUTPUT();
+    TOSH_SET_DOCK_N_PIN();
+
+    // bus arbitration pins 
+    TOSH_SEL_SW_SD_PWR_N_IOFUNC();
+    TOSH_MAKE_SW_SD_PWR_N_OUTPUT();
+
+    TOSH_SEL_SD_CS_N_IOFUNC();
+    TOSH_MAKE_SD_CS_N_OUTPUT();
+
+    TOSH_SEL_SD_CLK_IOFUNC();
+    TOSH_MAKE_SD_CLK_OUTPUT();
+    TOSH_SEL_SD_DO_IOFUNC();
+    TOSH_MAKE_SD_DO_INPUT();
+    TOSH_SEL_SD_DI_IOFUNC();
+    TOSH_MAKE_SD_DI_OUTPUT();
+  
+    // power down sd module; overridden by dock pin on programming board
+    /*
+     * other pins are zeroed to reset card
+     * at end of this routine, we raise them again (they have pullups, too)
+     */
+    TOSH_SET_SW_SD_PWR_N_PIN();     
+    TOSH_CLR_SD_CS_N_PIN();
+    TOSH_CLR_SD_DI_PIN();
+    TOSH_CLR_SD_CLK_PIN();
+  
+    TOSH_SEL_SW_BT_PWR_N_IOFUNC();
+    TOSH_MAKE_SW_BT_PWR_N_OUTPUT();
+    TOSH_SET_SW_BT_PWR_N_PIN();     // power down bt module; overridden by dock pin on programming board
+
+    //LEDS
+    TOSH_SEL_RED_LED_IOFUNC();
+    TOSH_MAKE_RED_LED_OUTPUT();
+    TOSH_SEL_YELLOW_LED_IOFUNC();
+    TOSH_MAKE_YELLOW_LED_OUTPUT();
+    TOSH_SEL_GREEN_LED_IOFUNC();
+    TOSH_MAKE_GREEN_LED_OUTPUT();
+
+    //RADIO PINS
+    //CC2420 pins
+    TOSH_MAKE_RADIO_VREF_OUTPUT();
+    TOSH_SEL_RADIO_VREF_IOFUNC();
+    TOSH_CLR_RADIO_VREF_PIN();    // power down 
+
+    TOSH_MAKE_RADIO_CSN_OUTPUT();
+    TOSH_SEL_RADIO_CSN_IOFUNC();
+    TOSH_SET_RADIO_CSN_PIN();
+
+    // should be reset_n
+    TOSH_MAKE_RADIO_RESET_OUTPUT();
+    TOSH_SEL_RADIO_RESET_IOFUNC();
+    TOSH_CLR_RADIO_RESET_PIN();
+
+    TOSH_SEL_RADIO_CCA_IOFUNC();
+    TOSH_MAKE_RADIO_CCA_INPUT();
+    TOSH_SEL_RADIO_FIFO_IOFUNC();
+    TOSH_MAKE_RADIO_FIFO_INPUT();
+    TOSH_SEL_RADIO_FIFOP_IOFUNC();
+    TOSH_MAKE_RADIO_FIFOP_INPUT();
+    TOSH_SEL_RADIO_SFD_IOFUNC();
+    TOSH_MAKE_RADIO_SFD_INPUT();
+
+    TOSH_SEL_TILT_IOFUNC();
+    TOSH_MAKE_TILT_INPUT();
+
+    // 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_INPUT();
+    TOSH_SEL_BT_PIO_IOFUNC();
+
+    TOSH_MAKE_BT_CTS_OUTPUT();
+    TOSH_SEL_BT_CTS_IOFUNC();
+
+    TOSH_MAKE_BT_TXD_OUTPUT();
+    TOSH_SEL_BT_TXD_IOFUNC();
+
+    TOSH_MAKE_BT_RXD_INPUT();
+    TOSH_SEL_BT_RXD_IOFUNC();
+
+    // 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_SEL_ADC_0_IOFUNC();
+    TOSH_MAKE_ADC_0_OUTPUT();
+    TOSH_SEL_ADC_1_IOFUNC();
+    TOSH_MAKE_ADC_1_OUTPUT();
+    TOSH_SEL_ADC_2_IOFUNC();
+    TOSH_MAKE_ADC_2_OUTPUT();
+    TOSH_SEL_ADC_6_IOFUNC();
+    TOSH_MAKE_ADC_6_OUTPUT();
+    TOSH_SEL_ADC_7_IOFUNC();
+    TOSH_MAKE_ADC_7_OUTPUT();
+
+    TOSH_SEL_ADC_ACCELZ_IOFUNC();
+    TOSH_MAKE_ADC_ACCELZ_INPUT();
+    TOSH_SEL_ADC_ACCELY_IOFUNC();
+    TOSH_MAKE_ADC_ACCELY_INPUT();
+    TOSH_SEL_ADC_ACCELX_IOFUNC();
+    TOSH_MAKE_ADC_ACCELX_INPUT();
+  
+    TOSH_SEL_ROSC_IOFUNC();
+    TOSH_MAKE_ROSC_INPUT();
+
+    // 1-wire function
+    TOSH_SEL_ONEWIRE_IOFUNC();
+    TOSH_MAKE_ONEWIRE_OUTPUT();
+    TOSH_SET_ONEWIRE_PIN();
+
+    /*
+     *  Accelerometer pin definitions
+     * 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_SEL_ACCEL_SEL0_IOFUNC();
+    TOSH_MAKE_ACCEL_SEL0_OUTPUT();
+    TOSH_CLR_ACCEL_SEL0_PIN();
+    TOSH_SEL_ACCEL_SEL1_IOFUNC();
+    TOSH_MAKE_ACCEL_SEL1_OUTPUT();
+    TOSH_CLR_ACCEL_SEL1_PIN();
+    TOSH_SEL_ACCEL_SLEEP_N_IOFUNC();
+    TOSH_MAKE_ACCEL_SLEEP_N_OUTPUT();
+    TOSH_CLR_ACCEL_SLEEP_N_PIN();
+
+    // idle expansion header pins
+    TOSH_SEL_SER0_CTS_IOFUNC();
+    TOSH_MAKE_SER0_CTS_OUTPUT();
+    TOSH_SEL_SER0_RTS_IOFUNC();
+    TOSH_MAKE_SER0_RTS_OUTPUT();
+
+    // this pin is now tied to the user button on the prog board
+    TOSH_SEL_GIO0_IOFUNC();
+    TOSH_MAKE_GIO0_INPUT();
+
+    TOSH_SEL_GIO1_IOFUNC();
+    TOSH_MAKE_GIO1_OUTPUT();
+
+    TOSH_SEL_UTXD0_IOFUNC();
+    TOSH_MAKE_UTXD0_OUTPUT();
+    TOSH_SEL_URXD0_IOFUNC();
+    TOSH_MAKE_URXD0_OUTPUT();
+
+    TOSH_SEL_UTXD1_IOFUNC();
+    TOSH_MAKE_UTXD1_OUTPUT();
+    TOSH_SEL_URXD1_IOFUNC();
+    TOSH_MAKE_URXD1_OUTPUT();
+    TOSH_SEL_UCLK1_IOFUNC();
+    TOSH_MAKE_UCLK1_OUTPUT();
+    TOSH_SEL_SIMO1_IOFUNC();
+    TOSH_MAKE_SIMO1_OUTPUT();
+    TOSH_SEL_SOMI1_IOFUNC();
+    TOSH_MAKE_SOMI1_INPUT();
+
+    /*
+     * sd pins are raised as part of power-cyling card
+     * and, they have pullups.
+     *
+  
+    for (i = 0; i < 20; i++)
+      TOSH_uwait(1000);                // one millisecond
+    */
+  
+    TOSH_SET_SD_CS_N_PIN();
+    TOSH_SET_SD_DI_PIN();
+    TOSH_SET_SD_CLK_PIN();
+
+    // these are attached to the same pullup as above
+    TOSH_SET_SIMO1_PIN();
+    TOSH_SET_UCLK1_PIN();
+
+    // set it back to default state
+    TOSH_MAKE_DOCK_N_INPUT();
+
+    return SUCCESS;
+  }
+}
diff --git a/tos/platforms/shimmer2/Msp430Timer32khzMapC.nc b/tos/platforms/shimmer2/Msp430Timer32khzMapC.nc
new file mode 100644 (file)
index 0000000..c3e6d19
--- /dev/null
@@ -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 <cssharp@eecs.berkeley.edu>
+ * @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/shimmer2/NoLedsC.nc b/tos/platforms/shimmer2/NoLedsC.nc
new file mode 100644 (file)
index 0000000..1ad2bde
--- /dev/null
@@ -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."
+ */
+
+/**
+ * A null operation replacement for the LedsC component. As many
+ * components might concurrently signal information through LEDs,
+ * using LedsC and NoLedsC allows an application builder to select
+ * which components control the LEDs.
+ *
+ * @author Philip Levis
+ * @date   March 19, 2005
+ *
+ */
+
+module NoLedsC {
+  provides interface Init;
+  provides interface Leds;
+}
+implementation {
+
+  command error_t Init.init() {return SUCCESS;}
+
+  async command void Leds.led0On() {}
+  async command void Leds.led0Off() {}
+  async command void Leds.led0Toggle() {}
+
+  async command void Leds.led1On() {}
+  async command void Leds.led1Off() {}
+  async command void Leds.led1Toggle() {}
+
+  async command void Leds.led2On() {}
+  async command void Leds.led2Off() {}
+  async command void Leds.led2Toggle() {}
+
+  async command uint8_t Leds.get() {return 0;}
+  async command void Leds.set(uint8_t val) {}
+}
diff --git a/tos/platforms/shimmer2/PlatformC.nc b/tos/platforms/shimmer2/PlatformC.nc
new file mode 100644 (file)
index 0000000..b8a67b7
--- /dev/null
@@ -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/shimmer2/PlatformLedsC.nc b/tos/platforms/shimmer2/PlatformLedsC.nc
new file mode 100644 (file)
index 0000000..8a19ba9
--- /dev/null
@@ -0,0 +1,58 @@
+// $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.Port42;
+
+  Led2 = Led2Impl;
+  Led2Impl -> GeneralIOC.Port43;
+
+}
+
diff --git a/tos/platforms/shimmer2/PlatformP.nc b/tos/platforms/shimmer2/PlatformP.nc
new file mode 100644 (file)
index 0000000..b8dc943
--- /dev/null
@@ -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/shimmer2/PlatformSerialC.nc b/tos/platforms/shimmer2/PlatformSerialC.nc
new file mode 100644 (file)
index 0000000..967e9da
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2009, Shimmer Research, Ltd.
+ * 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 Shimmer Research, Ltd. 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.
+ *
+ * mostly copied from shimmer
+ *
+ * @author Steve Ayer
+ * @date   June 2009
+ */
+
+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/shimmer2/ShimmerSerialP.nc b/tos/platforms/shimmer2/ShimmerSerialP.nc
new file mode 100644 (file)
index 0000000..a1f61ea
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2009, Shimmer Research, Ltd.
+ * 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 Shimmer Research, Ltd. 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 Steve Ayer
+ * @date June 2009
+ */
+
+module ShimmerSerialP {
+  provides interface StdControl;
+  provides interface Msp430UartConfigure;
+  uses interface Resource;
+}
+
+implementation {
+  msp430_uart_union_config_t msp430_uart_shimmer2_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_shimmer2_config;
+  }
+}
diff --git a/tos/platforms/shimmer2/SwitchToggleC.nc b/tos/platforms/shimmer2/SwitchToggleC.nc
new file mode 100644 (file)
index 0000000..d04990a
--- /dev/null
@@ -0,0 +1,97 @@
+/**
+ * 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
+ */
+
+/**
+ * Generic layer to translate a GIO into a toggle switch
+ *
+ * @author Gilman Tolle <gtolle@archrock.com>
+ * @version $Revision$
+ *
+ * @author Mike Healy
+ * @date May 9, 2009 - modified for use with SHIMMER2
+ */
+
+#include <UserButton.h>
+
+generic module SwitchToggleC() {
+  provides interface Get<bool>;
+  provides interface Notify<bool>;
+
+  uses interface GeneralIO;
+  uses interface GpioInterrupt;
+}
+
+implementation {
+  norace bool m_pinHigh;
+
+  task void sendEvent();
+
+  command bool Get.get() { return call GeneralIO.get(); }
+
+  command error_t Notify.enable() {
+    call GeneralIO.makeInput();
+
+    if ( call GeneralIO.get() ) {
+      m_pinHigh = TRUE;
+      return call GpioInterrupt.enableFallingEdge();
+    } 
+    else {
+      m_pinHigh = FALSE;
+      return call GpioInterrupt.enableRisingEdge();
+    }
+  }
+
+  command error_t Notify.disable() {
+    return call GpioInterrupt.disable();
+  }
+
+  async event void GpioInterrupt.fired() {
+    call GpioInterrupt.disable();
+
+    m_pinHigh = !m_pinHigh;
+
+    post sendEvent();
+  }
+
+  task void sendEvent() {
+    bool pinHigh;
+    pinHigh = m_pinHigh;
+    
+    signal Notify.notify( pinHigh );
+    
+    if ( pinHigh ) {
+      call GpioInterrupt.enableFallingEdge();
+    } 
+    else {
+      call GpioInterrupt.enableRisingEdge();
+    }
+  }
+}
diff --git a/tos/platforms/shimmer2/UserButton.h b/tos/platforms/shimmer2/UserButton.h
new file mode 100644 (file)
index 0000000..d020741
--- /dev/null
@@ -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 <gtolle@archrock.com>
+ * @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/shimmer2/UserButtonC.nc b/tos/platforms/shimmer2/UserButtonC.nc
new file mode 100644 (file)
index 0000000..e44b2af
--- /dev/null
@@ -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 <gtolle@archrock.com>
+ * @version $Revision$
+ */
+
+#include <UserButton.h>
+
+configuration UserButtonC {
+  provides interface Get<button_state_t>;
+  provides interface Notify<button_state_t>;
+}
+implementation {
+  components HplUserButtonC;
+  components new SwitchToggleC();
+  SwitchToggleC.GpioInterrupt -> HplUserButtonC.GpioInterrupt;
+  SwitchToggleC.GeneralIO -> HplUserButtonC.GeneralIO;
+
+  components UserButtonP;
+  Get = UserButtonP;
+  Notify = UserButtonP;
+
+  UserButtonP.GetLower -> SwitchToggleC.Get;
+  UserButtonP.NotifyLower -> SwitchToggleC.Notify;
+}
diff --git a/tos/platforms/shimmer2/UserButtonP.nc b/tos/platforms/shimmer2/UserButtonP.nc
new file mode 100644 (file)
index 0000000..90df16c
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) 2007 Arch Rock Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Arch Rock Corporation nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE
+ */
+
+/**
+ * Implementation of the user button for the telosb platform
+ *
+ * @author Gilman Tolle <gtolle@archrock.com>
+ * @version $Revision$
+ *
+ * @author Mike Healy
+ * @date May 9, 2009 - modified for use with SHIMMER2
+ */
+
+#include <UserButton.h>
+
+module UserButtonP {
+  provides interface Get<button_state_t>;
+  provides interface Notify<button_state_t>;
+
+  uses interface Get<bool> as GetLower;
+  uses interface Notify<bool> as NotifyLower;
+}
+implementation {
+  
+  command button_state_t Get.get() { 
+    // shimmer user button pin is high when pressed 
+    if ( call GetLower.get() ) {
+      return BUTTON_PRESSED;
+    } else {
+      return BUTTON_RELEASED;
+    }
+  }
+
+  command error_t Notify.enable() {
+    return call NotifyLower.enable();
+  }
+
+  command error_t Notify.disable() {
+    return call NotifyLower.disable();
+  }
+
+  event void NotifyLower.notify( bool val ) {
+    // shimmer user button pin is high when pressed 
+    if ( val ) {
+      signal Notify.notify( BUTTON_PRESSED );
+    } else {
+      signal Notify.notify( BUTTON_RELEASED ) ;
+    }
+  }
+  
+  default event void Notify.notify( button_state_t val ) { }
+}
diff --git a/tos/platforms/shimmer2/hardware.h b/tos/platforms/shimmer2/hardware.h
new file mode 100644 (file)
index 0000000..c8380f4
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2007, 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   July 2007
+ */
+
+
+#ifndef _H_hardware_h
+#define _H_hardware_h
+
+#include "msp430hardware.h"
+/*
+ * these left from tos-1.x...
+ *
+ *#include "MSP430ADC12.h"
+ *
+ *#include "CC2420Const.h"
+ */
+
+
+// LEDs
+TOSH_ASSIGN_PIN(RED_LED,    4, 0);
+TOSH_ASSIGN_PIN(YELLOW_LED, 4, 2);
+TOSH_ASSIGN_PIN(GREEN_LED,  4, 3);
+
+// CC2420 RADIO
+TOSH_ASSIGN_PIN(RADIO_FIFO,  1, 5);
+TOSH_ASSIGN_PIN(RADIO_FIFOP, 1, 2);
+TOSH_ASSIGN_PIN(RADIO_CCA,   2, 7);
+
+// vref is legacy from telos and cc2420 lib; schematic and cc2420 pin say vreg_en
+TOSH_ASSIGN_PIN(RADIO_VREF,  5, 6);   
+
+TOSH_ASSIGN_PIN(RADIO_SFD,   1, 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(RADIO_RESET, 5, 7);
+
+// BT pins
+TOSH_ASSIGN_PIN(BT_PIO,      2, 6);
+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);
+
+TOSH_ASSIGN_PIN(TILT,  2, 4);
+
+// 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);
+
+TOSH_ASSIGN_PIN(VSENSE_ADC6, 6, 6);
+TOSH_ASSIGN_PIN(VSENSE_ADC7,  6, 7);
+
+// bus arbitration pins
+TOSH_ASSIGN_PIN(SW_SD_PWR_N, 4, 5);
+TOSH_ASSIGN_PIN(SW_BT_PWR_N, 4, 6);
+
+// if used as expansion GPIOs
+TOSH_ASSIGN_PIN(SER0_RTS, 1, 3);
+TOSH_ASSIGN_PIN(SER0_CTS, 1, 4);
+
+TOSH_ASSIGN_PIN(SIMO0, 3, 1);
+TOSH_ASSIGN_PIN(SOMI0, 3, 2);
+TOSH_ASSIGN_PIN(UCLK0, 3, 3);
+TOSH_ASSIGN_PIN(UTXD0, 3, 4);
+TOSH_ASSIGN_PIN(URXD0, 3, 5);
+
+// redefinitions for the sd card driver
+TOSH_ASSIGN_PIN(SD_DI, 3, 1);
+TOSH_ASSIGN_PIN(SD_DO, 3, 2);
+TOSH_ASSIGN_PIN(SD_CLK, 3, 3);
+
+
+TOSH_ASSIGN_PIN(SIMO1, 5, 1);
+TOSH_ASSIGN_PIN(SOMI1, 5, 2);
+TOSH_ASSIGN_PIN(UCLK1, 5, 3);
+TOSH_ASSIGN_PIN(UTXD1, 3, 6);
+TOSH_ASSIGN_PIN(URXD1, 3, 7);
+
+TOSH_ASSIGN_PIN(GIO0, 2, 0);
+TOSH_ASSIGN_PIN(GIO1, 2, 1);
+
+// 1-Wire
+TOSH_ASSIGN_PIN(ONEWIRE, 4, 7);
+
+// ROSC
+TOSH_ASSIGN_PIN(ROSC, 2, 5);
+
+// docked signal from programming board
+TOSH_ASSIGN_PIN(DOCK_N, 2, 3);
+
+// ACCEL
+TOSH_ASSIGN_PIN(ACCEL_SEL0,  4, 1);
+TOSH_ASSIGN_PIN(ACCEL_SEL1,  4, 4);
+TOSH_ASSIGN_PIN(ACCEL_SLEEP_N, 5, 0);
+
+#endif // _H_hardware_h
+
diff --git a/tos/platforms/shimmer2/platform.h b/tos/platforms/shimmer2/platform.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tos/platforms/shimmer2/platform_message.h b/tos/platforms/shimmer2/platform_message.h
new file mode 100644 (file)
index 0000000..75532b9
--- /dev/null
@@ -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 <CC2420.h>
+#include <Serial.h>
+
+typedef union message_header {
+  cc2420_header_t cc2420;
+  serial_header_t serial;
+} message_header_t;
+
+typedef union TOSRadioFooter {
+  cc2420_footer_t cc2420;
+} message_footer_t;
+
+typedef union TOSRadioMetadata {
+  cc2420_metadata_t cc2420;
+  serial_metadata_t serial;
+} message_metadata_t;
+
+#endif