]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
new span platform, first check-in
authorayer1 <ayer1>
Wed, 24 Mar 2010 17:42:14 +0000 (17:42 +0000)
committerayer1 <ayer1>
Wed, 24 Mar 2010 17:42:14 +0000 (17:42 +0000)
24 files changed:
tos/platforms/span/.platform [new file with mode: 0644]
tos/platforms/span/ActiveMessageC.nc [new file with mode: 0644]
tos/platforms/span/Ieee154MessageC.nc [new file with mode: 0644]
tos/platforms/span/Leds.nc [new file with mode: 0644]
tos/platforms/span/LedsC.nc [new file with mode: 0644]
tos/platforms/span/LedsP.nc [new file with mode: 0644]
tos/platforms/span/MoteClockC.nc [new file with mode: 0644]
tos/platforms/span/MotePlatformC.nc [new file with mode: 0644]
tos/platforms/span/Msp430Timer32khzMapC.nc [new file with mode: 0644]
tos/platforms/span/PlatformC.nc [new file with mode: 0644]
tos/platforms/span/PlatformLedsC.nc [new file with mode: 0644]
tos/platforms/span/PlatformP.nc [new file with mode: 0644]
tos/platforms/span/PlatformSerialC.nc [new file with mode: 0644]
tos/platforms/span/SpanSerialP.nc [new file with mode: 0644]
tos/platforms/span/TimeSyncMessageC.nc [new file with mode: 0644]
tos/platforms/span/chips/cc2420/HplCC2420AlarmC.nc [new file with mode: 0644]
tos/platforms/span/chips/cc2420/HplCC2420InterruptsC.nc [new file with mode: 0644]
tos/platforms/span/chips/cc2420/HplCC2420InterruptsP.nc [new file with mode: 0644]
tos/platforms/span/chips/cc2420/HplCC2420PinsC.nc [new file with mode: 0644]
tos/platforms/span/chips/cc2420/HplCC2420SpiC.nc [new file with mode: 0644]
tos/platforms/span/chips/msp430/msp430hardware.h [new file with mode: 0644]
tos/platforms/span/hardware.h [new file with mode: 0644]
tos/platforms/span/platform.h [new file with mode: 0644]
tos/platforms/span/platform_message.h [new file with mode: 0644]

diff --git a/tos/platforms/span/.platform b/tos/platforms/span/.platform
new file mode 100644 (file)
index 0000000..6df216e
--- /dev/null
@@ -0,0 +1,76 @@
+# span - platform includes
+# Steve Ayer, December 2009
+#
+# 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/span
+  %T/platforms/span/chips/cc2420
+  %T/platforms/span/chips/msp430
+  %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/cc2420/security
+  %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/span/ActiveMessageC.nc b/tos/platforms/span/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/span/Ieee154MessageC.nc b/tos/platforms/span/Ieee154MessageC.nc
new file mode 100644 (file)
index 0000000..2099d1b
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * "Copyright (c) 2008 The Regents of the University  of California.
+ * All rights reserved."
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose, without fee, and without written agreement is
+ * hereby granted, provided that the above copyright notice, the following
+ * two paragraphs and the author appear in all copies of this software.
+ *
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+ * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+ * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
+ *
+ */
+
+
+/**
+ *
+ * @author Stephen Dawson-Haggerty
+ */
+configuration Ieee154MessageC  {
+  provides {
+    interface SplitControl;
+
+    interface Resource as SendResource[uint8_t clientId];
+    interface Ieee154Send;
+    interface Receive as Ieee154Receive;
+
+    interface Ieee154Packet;
+    interface Packet;
+
+    interface PacketAcknowledgements;
+    interface LinkPacketMetadata;
+    interface LowPowerListening;
+    interface PacketLink;
+  }
+
+} implementation {
+  components CC2420Ieee154MessageC as Msg;
+
+  SplitControl = Msg;
+  SendResource = Msg;
+  Ieee154Send  = Msg;
+  Ieee154Receive = Msg;
+  Ieee154Packet = Msg;
+  Packet = Msg;
+  
+  PacketAcknowledgements = Msg;
+  LinkPacketMetadata = Msg;
+  LowPowerListening = Msg;
+  PacketLink = Msg;
+}
diff --git a/tos/platforms/span/Leds.nc b/tos/platforms/span/Leds.nc
new file mode 100644 (file)
index 0000000..98c3e8a
--- /dev/null
@@ -0,0 +1,92 @@
+// $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();
+
+  /**
+   * 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>.
+n   *
+   * @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/span/LedsC.nc b/tos/platforms/span/LedsC.nc
new file mode 100644 (file)
index 0000000..f628ab6
--- /dev/null
@@ -0,0 +1,46 @@
+// $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;
+}
+
diff --git a/tos/platforms/span/LedsP.nc b/tos/platforms/span/LedsP.nc
new file mode 100644 (file)
index 0000000..d556cdf
--- /dev/null
@@ -0,0 +1,94 @@
+// $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;
+  }
+}
+implementation {
+  command error_t Init.init() {
+    atomic {
+      dbg("Init", "LEDS: initialized.\n");
+      call Led0.makeOutput();
+      call Led0.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 uint8_t Leds.get() {
+    uint8_t rval;
+    atomic {
+      rval = 0;
+      if (!call Led0.get()) {
+             rval |= LEDS_LED0;
+      }
+    }
+    return rval;
+  }
+
+  async command void Leds.set(uint8_t val) {
+    atomic {
+      if (val & LEDS_LED0) {
+             call Leds.led0On();
+      }
+      else {
+             call Leds.led0Off();
+      }
+    }
+  }
+}
diff --git a/tos/platforms/span/MoteClockC.nc b/tos/platforms/span/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/span/MotePlatformC.nc b/tos/platforms/span/MotePlatformC.nc
new file mode 100644 (file)
index 0000000..6604d7c
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * 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    May, 2009
+ */
+
+module MotePlatformC {
+  provides interface Init;
+}
+implementation {
+  command error_t Init.init() {
+    
+    //LEDS
+    TOSH_MAKE_GREEN_LED_OUTPUT();
+    TOSH_SEL_GREEN_LED_IOFUNC();
+
+    //RADIO PINS
+    //CC2420 pins
+    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_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_RADIO_VREF_OUTPUT();
+    TOSH_SEL_RADIO_VREF_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();
+
+    // USART lines, attached to a pullup and cc2420
+    TOSH_SEL_UCLK1_IOFUNC();
+    TOSH_MAKE_UCLK1_OUTPUT();
+    TOSH_SET_UCLK1_PIN();
+
+    TOSH_SEL_SIMO1_IOFUNC();
+    TOSH_MAKE_SIMO1_OUTPUT();
+    TOSH_SET_SIMO1_PIN();
+    TOSH_SEL_SOMI1_IOFUNC();
+    TOSH_MAKE_SOMI1_INPUT();
+
+    TOSH_SEL_ROSC_IOFUNC();
+    TOSH_MAKE_ROSC_INPUT();
+
+    // 1-wire function
+    TOSH_MAKE_ONEWIRE_INPUT();
+    TOSH_SEL_ONEWIRE_IOFUNC();
+
+    TOSH_MAKE_ADC_7_OUTPUT();
+    TOSH_SEL_ADC_7_IOFUNC();
+
+    TOSH_SEL_GIO0_IOFUNC();
+    TOSH_MAKE_GIO0_OUTPUT();
+    TOSH_SEL_GIO1_IOFUNC();
+    TOSH_MAKE_GIO1_OUTPUT();
+    TOSH_SEL_GIO2_IOFUNC();
+    TOSH_MAKE_GIO2_OUTPUT();
+
+    TOSH_SEL_FTDI_ADBUS_7_IOFUNC();
+    TOSH_MAKE_FTDI_ADBUS_7_INPUT();
+    TOSH_SEL_FTDI_ADBUS_3_IOFUNC();
+    TOSH_MAKE_FTDI_ADBUS_7_INPUT();
+
+    // 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_UTXD0_OUTPUT();
+    TOSH_SEL_UTXD0_IOFUNC();
+    TOSH_MAKE_URXD0_OUTPUT();
+    TOSH_SEL_URXD0_IOFUNC();
+
+    /*
+     * assignments for nc pins
+     */
+    TOSH_MAKE_NC_GIO0_OUTPUT();
+    TOSH_SEL_NC_GIO0_IOFUNC();
+    TOSH_MAKE_NC_GIO1_OUTPUT();
+    TOSH_SEL_NC_GIO1_IOFUNC();
+    TOSH_MAKE_NC_CS_OUTPUT();
+    TOSH_SEL_NC_CS_IOFUNC();
+    TOSH_MAKE_SIMO0_OUTPUT();
+    TOSH_SEL_SIMO0_IOFUNC();
+    TOSH_MAKE_SOMI0_OUTPUT();
+    TOSH_SEL_SOMI0_IOFUNC();
+    TOSH_MAKE_UTXD1_OUTPUT();
+    TOSH_SEL_UTXD1_IOFUNC();
+    TOSH_MAKE_URXD1_OUTPUT();
+    TOSH_SEL_URXD1_IOFUNC();
+    TOSH_MAKE_NC_LED0_INPUT();
+    TOSH_SEL_NC_LED0_IOFUNC();
+    TOSH_MAKE_NC_LED1_OUTPUT();
+    TOSH_SEL_NC_LED1_IOFUNC();
+    TOSH_MAKE_NC_LED2_OUTPUT();
+    TOSH_SEL_NC_LED2_IOFUNC();
+    TOSH_MAKE_NC_ACCEL0_OUTPUT();
+    TOSH_SEL_NC_ACCEL0_IOFUNC();
+    TOSH_MAKE_NC_ACCEL1_OUTPUT();
+    TOSH_SEL_NC_ACCEL1_IOFUNC();
+    TOSH_MAKE_NC_ACCELS_OUTPUT();
+    TOSH_SEL_NC_ACCELS_IOFUNC();
+    TOSH_MAKE_NC_TB0_OUTPUT();
+    TOSH_SEL_NC_TB0_IOFUNC();
+    TOSH_MAKE_NC_GIO2_OUTPUT();
+    TOSH_SEL_NC_GIO2_IOFUNC();
+    TOSH_MAKE_NC_SVS_OUTPUT();
+    TOSH_SEL_NC_SVS_IOFUNC();
+    TOSH_MAKE_NC_ADC_0_OUTPUT();
+    TOSH_SEL_NC_ADC_0_IOFUNC();
+    TOSH_MAKE_NC_ADC_1_OUTPUT();
+    TOSH_SEL_NC_ADC_1_IOFUNC();
+    TOSH_MAKE_NC_ADC_2_OUTPUT();
+    TOSH_SEL_NC_ADC_2_IOFUNC();
+    TOSH_MAKE_NC_ADC_3_OUTPUT();
+    TOSH_SEL_NC_ADC_3_IOFUNC();
+    TOSH_MAKE_NC_ADC_4_OUTPUT();
+    TOSH_SEL_NC_ADC_4_IOFUNC();
+    TOSH_MAKE_NC_ADC_5_OUTPUT();
+    TOSH_SEL_NC_ADC_5_IOFUNC();
+    TOSH_MAKE_NC_ADC_6_OUTPUT();
+    TOSH_SEL_NC_ADC_6_IOFUNC();
+
+    return SUCCESS;
+
+  }
+
+}
diff --git a/tos/platforms/span/Msp430Timer32khzMapC.nc b/tos/platforms/span/Msp430Timer32khzMapC.nc
new file mode 100644 (file)
index 0000000..38f0d97
--- /dev/null
@@ -0,0 +1,78 @@
+//$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$
+ * port to span
+ * @author Steve Ayer
+ * @date   January, 2010
+ */
+
+configuration Msp430Timer32khzMapC
+{
+  provides interface Msp430Timer[ uint8_t id ];
+  provides interface Msp430TimerControl[ uint8_t id ];
+  provides interface Msp430Compare[ uint8_t id ];
+}
+implementation
+{
+  components Msp430TimerC;
+
+  // Timer pin B0 is used by the CC2420 radio's SFD pin
+  // this is the only difference between the default 32khz map
+  // and the map on span
+
+  Msp430Timer[0] = Msp430TimerC.TimerB;
+  Msp430TimerControl[0] = Msp430TimerC.ControlB1;
+  Msp430Compare[0] = Msp430TimerC.CompareB1;
+
+  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/span/PlatformC.nc b/tos/platforms/span/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/span/PlatformLedsC.nc b/tos/platforms/span/PlatformLedsC.nc
new file mode 100644 (file)
index 0000000..9d2b504
--- /dev/null
@@ -0,0 +1,50 @@
+// $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$
+ *
+ * @author Steve Ayer
+ * @date December, 2009, reducing down to one led
+ */
+
+#include "hardware.h"
+
+configuration PlatformLedsC {
+  provides interface GeneralIO as Led0;
+  uses interface Init;
+}
+implementation
+{
+  components 
+      HplMsp430GeneralIOC as GeneralIOC
+    , new Msp430GpioC() as Led0Impl
+    ;
+  components PlatformP;
+
+  Init = PlatformP.LedsInit;
+
+  Led0 = Led0Impl;
+  Led0Impl -> GeneralIOC.Port43;
+}
+
diff --git a/tos/platforms/span/PlatformP.nc b/tos/platforms/span/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/span/PlatformSerialC.nc b/tos/platforms/span/PlatformSerialC.nc
new file mode 100644 (file)
index 0000000..0240658
--- /dev/null
@@ -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.
+ */
+/**
+ * From Konrad's SHIMMER conversbion
+ *
+ * @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 SpanSerialP;
+    StdControl = SpanSerialP;
+    SpanSerialP.Msp430UartConfigure <- UartC.Msp430UartConfigure;
+    SpanSerialP.Resource -> UartC.Resource;
+}
diff --git a/tos/platforms/span/SpanSerialP.nc b/tos/platforms/span/SpanSerialP.nc
new file mode 100644 (file)
index 0000000..0879974
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+/**
+ * Conversion of Konrad's conversion
+ *
+ * @author Konrad Lorincz
+ * @date May 14, 2008
+ * @author Steve Ayer
+ * @date December 2009
+ */
+module SpanSerialP 
+{
+    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/span/TimeSyncMessageC.nc b/tos/platforms/span/TimeSyncMessageC.nc
new file mode 100644 (file)
index 0000000..01f1170
--- /dev/null
@@ -0,0 +1,84 @@
+// $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.
+ */
+
+/**
+ *
+ * The Active Message layer on the shimmer platform. This is a naming wrapper
+ * around the CC2420 Active Message layer that implemets timesync interface (TEP 133).
+ *
+ * @author Konrad Lorincz
+ * @author Brano Kusy
+ * @date June 19 2005
+ */
+
+configuration TimeSyncMessageC {
+  provides
+  {
+    interface SplitControl;
+    interface Receive[am_id_t id];
+    interface Receive as Snoop[am_id_t id];
+    interface Packet;
+    interface AMPacket;
+    interface PacketAcknowledgements;
+    interface LowPowerListening;
+
+    interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+    interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
+
+    interface TimeSyncAMSend<T32khz, uint32_t> as TimeSyncAMSend32khz[am_id_t id];
+    interface TimeSyncPacket<T32khz, uint32_t> as TimeSyncPacket32khz;
+
+    interface TimeSyncAMSend<TMilli, uint32_t> as TimeSyncAMSendMilli[am_id_t id];
+    interface TimeSyncPacket<TMilli, uint32_t> as TimeSyncPacketMilli;
+  }
+}
+implementation {
+  components CC2420TimeSyncMessageC as AM;
+
+  SplitControl = AM;
+
+  Receive      = AM.Receive;
+  Snoop        = AM.Snoop;
+  Packet       = AM;
+  AMPacket     = AM;
+  PacketAcknowledgements = AM;
+  LowPowerListening = AM;
+
+  TimeSyncAMSend32khz       = AM;
+  TimeSyncAMSendMilli       = AM;
+  TimeSyncPacket32khz       = AM;
+  TimeSyncPacketMilli       = AM;
+
+  components CC2420PacketC;
+  PacketTimeStamp32khz = CC2420PacketC;
+  PacketTimeStampMilli = CC2420PacketC;
+}
+
diff --git a/tos/platforms/span/chips/cc2420/HplCC2420AlarmC.nc b/tos/platforms/span/chips/cc2420/HplCC2420AlarmC.nc
new file mode 100644 (file)
index 0000000..0d56a8b
--- /dev/null
@@ -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 <jhui@archrock.com>
+ * @version $Revision$ $Date$
+ */
+
+generic configuration HplCC2420AlarmC() {
+
+  provides interface Init;
+  provides interface Alarm<T32khz,uint32_t> as Alarm32khz32;
+
+}
+
+implementation {
+
+  components new Alarm32khz32C();
+
+  Init = Alarm32khz32C;
+  Alarm32khz32 = Alarm32khz32C;
+  
+}
diff --git a/tos/platforms/span/chips/cc2420/HplCC2420InterruptsC.nc b/tos/platforms/span/chips/cc2420/HplCC2420InterruptsC.nc
new file mode 100644 (file)
index 0000000..e204915
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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 <jhui@archrock.com>
+ * @version $Revision$ $Date$
+ */
+/**
+ * Ported to the span platform. 
+ *
+ * @author Steve Ayer
+ * @date January, 2010
+ */
+
+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.ControlB0;
+  CaptureSFDC.Msp430Capture -> Msp430TimerC.CaptureB0;
+  CaptureSFDC.GeneralIO -> GeneralIOC.Port40;
+
+  components HplMsp430InterruptC;
+  components new Msp430InterruptC() as InterruptCCAC;
+  components new Msp430InterruptC() as InterruptFIFOPC;
+
+  InterruptCCAC.HplInterrupt -> HplMsp430InterruptC.Port26;
+  InterruptFIFOPC.HplInterrupt -> HplMsp430InterruptC.Port23;
+
+  CaptureSFD = CaptureSFDC.Capture;
+  InterruptCCA = InterruptCCAC.Interrupt;
+  InterruptFIFOP = InterruptFIFOPC.Interrupt;
+}
diff --git a/tos/platforms/span/chips/cc2420/HplCC2420InterruptsP.nc b/tos/platforms/span/chips/cc2420/HplCC2420InterruptsP.nc
new file mode 100644 (file)
index 0000000..3da44d5
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010, 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   January, 2010
+ *
+ * this implements an interrupt-driven capture interface for the cc2420
+ * tx-mode use of sfd.  span does not have sfd routed to a timer capture pin
+ * on the msp430, so cc2420's capture mechanism fails.  
+ * this module will trigger a capture.captured event after receiving the
+ * appropriate interrupt from the span sfd pin (2.7)
+ */
+
+module HplCC2420InterruptsP @safe() {
+  provides{
+    interface GpioCapture as CaptureSFD;
+  }
+
+  uses{
+    interface GpioInterrupt as InterruptSFD;
+    interface LocalTime<TMilli>;
+  }
+}
+
+implementation {
+  async command error_t CaptureSFD.captureRisingEdge() { 
+    call InterruptSFD.enableRisingEdge();
+    return SUCCESS;
+  }
+
+  async command error_t CaptureSFD.captureFallingEdge() { 
+    call InterruptSFD.enableFallingEdge();
+    return SUCCESS;
+  }
+  
+  async command void CaptureSFD.disable() {
+    call InterruptSFD.disable();
+  }
+
+  async event void InterruptSFD.fired() {
+    uint32_t t = call LocalTime.get();
+
+    signal CaptureSFD.captured((uint16_t)(t & 0x0000ffff));
+  }
+}
+
diff --git a/tos/platforms/span/chips/cc2420/HplCC2420PinsC.nc b/tos/platforms/span/chips/cc2420/HplCC2420PinsC.nc
new file mode 100644 (file)
index 0000000..4a7cdff
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * 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 <jhui@archrock.com>
+ * @version $Revision$ $Date$
+ */
+/**
+ * Ported to the span
+ *
+ * @author Konrad Lorincz
+ * @date May 14, 2008
+ * @author Steve Ayer
+ * @date December, 2009
+ */
+
+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.Port26;
+  CSNM -> GeneralIOC.Port54;
+  FIFOM -> GeneralIOC.Port24;
+  FIFOPM -> GeneralIOC.Port23;
+  RSTNM -> GeneralIOC.Port33;
+  //SFDM -> GeneralIOC.Port27;
+  SFDM -> GeneralIOC.Port40;
+  VRENM -> GeneralIOC.Port55;
+
+  CCA = CCAM;
+  CSN = CSNM;
+  FIFO = FIFOM;
+  FIFOP = FIFOPM;
+  RSTN = RSTNM;
+  SFD = SFDM;
+  VREN = VRENM;
+  
+}
+
diff --git a/tos/platforms/span/chips/cc2420/HplCC2420SpiC.nc b/tos/platforms/span/chips/cc2420/HplCC2420SpiC.nc
new file mode 100644 (file)
index 0000000..0179f93
--- /dev/null
@@ -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 <jhui@archrock.com>
+ * @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/span/chips/msp430/msp430hardware.h b/tos/platforms/span/chips/msp430/msp430hardware.h
new file mode 100644 (file)
index 0000000..7911e9b
--- /dev/null
@@ -0,0 +1,288 @@
+
+/* "Copyright (c) 2000-2003 The Regents of the University of California.  
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose, without fee, and without written agreement
+ * is hereby granted, provided that the above copyright notice, the following
+ * two paragraphs and the author appear in all copies of this software.
+ * 
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+ * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
+ * OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
+ */
+
+// @author Vlado Handziski <handzisk@tkn.tu-berlin.de>
+// @author Joe Polastre <polastre@cs.berkeley.edu>
+// @author Cory Sharp <cssharp@eecs.berkeley.edu>
+
+#ifndef _H_msp430hardware_h
+#define _H_msp430hardware_h
+
+#include <io.h>
+#include <signal.h>
+#include "msp430regtypes.h"
+#include "Msp430DcoSpec.h"
+
+// CPU memory-mapped register access will cause nesc to issue race condition
+// warnings.  Race conditions are a significant conern when accessing CPU
+// memory-mapped registers, because they can change even while interrupts
+// are disabled.  This means that the standard nesc tools for resolving race
+// conditions, atomic statements that disable interrupt handling, do not
+// resolve CPU register race conditions.  So, CPU registers access must be
+// treated seriously and carefully.
+
+// The macro MSP430REG_NORACE allows individual modules to internally
+// redeclare CPU registers as norace, eliminating nesc's race condition
+// warnings for their access.  This macro should only be used after the
+// specific CPU register use has been verified safe and correct.  Example
+// use:
+//
+//    module MyLowLevelModule
+//    {
+//      // ...
+//    }
+//    implementation
+//    {
+//      MSP430REG_NORACE(TACCTL0);
+//      // ...
+//    }
+
+#undef norace
+
+#define MSP430REG_NORACE_EXPAND(type,name,addr) \
+norace static volatile type name asm(#addr)
+
+#define MSP430REG_NORACE3(type,name,addr) \
+MSP430REG_NORACE_EXPAND(type,name,addr)
+
+// MSP430REG_NORACE and MSP430REG_NORACE2 presume naming conventions among
+// type, name, and addr, which are defined in the local header
+// msp430regtypes.h and mspgcc's header io.h and its children.
+
+#define MSP430REG_NORACE2(rename,name) \
+MSP430REG_NORACE3(TYPE_##name,rename,name##_)
+
+#define MSP430REG_NORACE(name) \
+MSP430REG_NORACE3(TYPE_##name,name,name##_)
+
+// Avoid the type-punned pointer warnings from gcc 3.3, which are warning about
+// creating potentially broken object code.  Union casts are the appropriate work
+// around.  Unfortunately, they require a function definiton.
+#define DEFINE_UNION_CAST(func_name,to_type,from_type) \
+to_type func_name(from_type x) @safe() { union {from_type f; to_type t;} c = {f:x}; return c.t; }
+
+// redefine ugly defines from msp-gcc
+#ifndef DONT_REDEFINE_SR_FLAGS
+#undef C
+#undef Z
+#undef N
+#undef V
+#undef GIE
+#undef CPUOFF
+#undef OSCOFF
+#undef SCG0
+#undef SCG1
+#undef LPM0_bits
+#undef LPM1_bits
+#undef LPM2_bits
+#undef LPM3_bits
+#undef LPM4_bits
+#define SR_C       0x0001
+#define SR_Z       0x0002
+#define SR_N       0x0004
+#define SR_V       0x0100
+#define SR_GIE     0x0008
+#define SR_CPUOFF  0x0010
+#define SR_OSCOFF  0x0020
+#define SR_SCG0    0x0040
+#define SR_SCG1    0x0080
+#define LPM0_bits           SR_CPUOFF
+#define LPM1_bits           SR_SCG0+SR_CPUOFF
+#define LPM2_bits           SR_SCG1+SR_CPUOFF
+#define LPM3_bits           SR_SCG1+SR_SCG0+SR_CPUOFF
+#define LPM4_bits           SR_SCG1+SR_SCG0+SR_OSCOFF+SR_CPUOFF
+#endif//DONT_REDEFINE_SR_FLAGS
+
+#ifdef interrupt
+#undef interrupt
+#endif
+
+#ifdef wakeup
+#undef wakeup
+#endif
+
+#ifdef signal
+#undef signal
+#endif
+
+
+// Re-definitions for safe tinyOS
+// These rely on io.h being included at the top of this file
+// thus pulling the affected header files before the re-definitions
+#ifdef SAFE_TINYOS
+#undef ADC12MEM
+#define ADC12MEM            TCAST(int* ONE, ADC12MEM_) /* ADC12 Conversion Memory (for C) */
+#undef ADC12MCTL
+#define ADC12MCTL           TCAST(char * ONE, ADC12MCTL_)
+#endif
+
+// define platform constants that can be changed for different compilers
+// these are all msp430-gcc specific (add as necessary)
+
+#ifdef __msp430_headers_adc10_h
+#define __msp430_have_adc10
+#endif
+
+#ifdef __msp430_headers_adc12_h
+#define __msp430_have_adc12
+#endif
+
+// backwards compatibility to older versions of the header files
+#ifdef __MSP430_HAS_I2C__
+#define __msp430_have_usart0_with_i2c
+#endif
+
+// I2CBusy flag is not defined by current MSP430-GCC
+#ifdef __msp430_have_usart0_with_i2c
+#ifndef I2CBUSY
+#define I2CBUSY   (0x01 << 5)
+#endif
+MSP430REG_NORACE2(U0CTLnr,U0CTL);
+MSP430REG_NORACE2(I2CTCTLnr,I2CTCTL);
+MSP430REG_NORACE2(I2CDCTLnr,I2CDCTL);
+#endif
+
+// The signal attribute has opposite meaning in msp430-gcc than in avr-gcc
+#define TOSH_SIGNAL(signame) \
+  void sig_##signame() __attribute__((interrupt (signame), wakeup)) @C()
+
+// TOSH_INTERRUPT allows nested interrupts
+#define TOSH_INTERRUPT(signame) \
+  void isr_##signame() __attribute__((interrupt (signame), signal, wakeup)) @C()
+
+inline void TOSH_wait(void)
+{
+  nop(); nop();
+}
+
+// #define TOSH_CYCLE_TIME_NS 250
+// Our worst case is 250 ns = 1 cycle.
+
+inline void TOSH_wait_250ns(void)
+{
+  nop();
+}
+
+/* 
+   Following the suggestion of the mspgcc.sourceforge.net site
+   for an intelligent pause routine
+*/
+void brief_pause(register unsigned int n)
+{
+  asm volatile(        "1: \n\t"
+               "dec    %0 \n\t"
+               "jne    1b\n\t"
+               :  "+r" (n));
+}
+
+#define TOSH_uwait(n)   brief_pause((((unsigned long long)n) * TARGET_DCO_KHZ * 1024 / 1000000 - 2) / 3)
+
+#define SET_FLAG(port, flag) ((port) |= (flag))
+#define CLR_FLAG(port, flag) ((port) &= ~(flag))
+#define READ_FLAG(port, flag) ((port) & (flag))
+
+// TOSH_ASSIGN_PIN creates functions that are effectively marked as
+// "norace".  This means race conditions that result from their use will not
+// be detectde by nesc.
+
+#define TOSH_ASSIGN_PIN_HEX(name, port, hex) \
+void TOSH_SET_##name##_PIN() @safe() { MSP430REG_NORACE2(r,P##port##OUT); r |= hex; } \
+void TOSH_CLR_##name##_PIN() @safe() { MSP430REG_NORACE2(r,P##port##OUT); r &= ~hex; } \
+void TOSH_TOGGLE_##name##_PIN() @safe(){ MSP430REG_NORACE2(r,P##port##OUT); r ^= hex; } \
+uint8_t TOSH_READ_##name##_PIN() @safe() { MSP430REG_NORACE2(r,P##port##IN); return (r & hex); } \
+void TOSH_MAKE_##name##_OUTPUT() @safe() { MSP430REG_NORACE2(r,P##port##DIR); r |= hex; } \
+void TOSH_MAKE_##name##_INPUT() @safe() { MSP430REG_NORACE2(r,P##port##DIR); r &= ~hex; } \
+void TOSH_SEL_##name##_MODFUNC() @safe() { MSP430REG_NORACE2(r,P##port##SEL); r |= hex; } \
+void TOSH_SEL_##name##_IOFUNC() @safe() { MSP430REG_NORACE2(r,P##port##SEL); r &= ~hex; }
+
+#define TOSH_ASSIGN_PIN(name, port, bit) \
+TOSH_ASSIGN_PIN_HEX(name,port,(1<<(bit)))
+
+typedef uint8_t mcu_power_t @combine("mcombine");
+mcu_power_t mcombine(mcu_power_t m1, mcu_power_t m2) @safe() {
+  return (m1 < m2) ? m1: m2;
+}
+enum {
+  MSP430_POWER_ACTIVE = 0,
+  MSP430_POWER_LPM0   = 1,
+  MSP430_POWER_LPM1   = 2,
+  MSP430_POWER_LPM2   = 3,
+  MSP430_POWER_LPM3   = 4,
+  MSP430_POWER_LPM4   = 5
+};
+
+void __nesc_disable_interrupt(void) @safe()
+{
+  dint();
+  nop();
+}
+
+void __nesc_enable_interrupt(void) @safe()
+{
+  eint();
+}
+
+typedef bool __nesc_atomic_t;
+__nesc_atomic_t __nesc_atomic_start(void);
+void __nesc_atomic_end(__nesc_atomic_t reenable_interrupts);
+
+#ifndef NESC_BUILD_BINARY
+/* @spontaneous() functions should not be included when NESC_BUILD_BINARY
+   is #defined, to avoid duplicate functions definitions when binary
+   components are used. Such functions do need a prototype in all cases,
+   though. */
+__nesc_atomic_t __nesc_atomic_start(void) @spontaneous() @safe()
+{
+  __nesc_atomic_t result = ((READ_SR & SR_GIE) != 0);
+  __nesc_disable_interrupt();
+  asm volatile("" : : : "memory"); /* ensure atomic section effect visibility */
+  return result;
+}
+
+void __nesc_atomic_end(__nesc_atomic_t reenable_interrupts) @spontaneous() @safe()
+{
+  asm volatile("" : : : "memory"); /* ensure atomic section effect visibility */
+  if( reenable_interrupts )
+    __nesc_enable_interrupt();
+}
+#endif
+
+/* Floating-point network-type support.
+   These functions must convert to/from a 32-bit big-endian integer that follows
+   the layout of Java's java.lang.float.floatToRawIntBits method.
+   Conveniently, for the MSP430 family, this is a straight byte copy...
+*/
+
+typedef float nx_float __attribute__((nx_base_be(afloat)));
+
+inline float __nesc_ntoh_afloat(const void *COUNT(sizeof(float)) source) @safe() {
+  float f;
+  memcpy(&f, source, sizeof(float));
+  return f;
+}
+
+inline float __nesc_hton_afloat(void *COUNT(sizeof(float)) target, float value) @safe() {
+  memcpy(target, &value, sizeof(float));
+  return value;
+}
+
+#endif//_H_msp430hardware_h
+
diff --git a/tos/platforms/span/hardware.h b/tos/platforms/span/hardware.h
new file mode 100644 (file)
index 0000000..14c3749
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * 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    May, 2009
+ */
+
+#ifndef _H_hardware_h
+#define _H_hardware_h
+
+#include "msp430hardware.h"
+
+//#include "CC2420Const.h"
+
+// enum so components can override power saving,
+// as per TEP 112.
+enum {
+  TOS_SLEEP_NONE = MSP430_POWER_ACTIVE,
+};
+
+TOSH_ASSIGN_PIN(GREEN_LED,  4, 3);
+
+// CC2420 RADIO #defines
+TOSH_ASSIGN_PIN(RADIO_FIFOP,     2, 3);
+TOSH_ASSIGN_PIN(RADIO_FIFO,      2, 4);
+TOSH_ASSIGN_PIN(RADIO_CCA,       2, 6);
+TOSH_ASSIGN_PIN(RADIO_SFD,       2, 7);
+
+TOSH_ASSIGN_PIN(RADIO_VREF,      5, 5);   
+
+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,     3, 3);
+
+// for mainstream tos...
+TOSH_ASSIGN_PIN(CC_FIFOP, 2, 3);
+TOSH_ASSIGN_PIN(CC_FIFO,  2, 4);
+TOSH_ASSIGN_PIN(CC_SFD,   2, 7);
+TOSH_ASSIGN_PIN(CC_VREN,  5, 5);
+TOSH_ASSIGN_PIN(CC_RSTN,  3, 3);
+
+
+// UART pins
+// SPI1 attached to cc2420
+TOSH_ASSIGN_PIN(UCLK1, 5, 3);
+TOSH_ASSIGN_PIN(SOMI1, 5, 2);
+TOSH_ASSIGN_PIN(SIMO1, 5, 1);
+
+// 1-Wire
+TOSH_ASSIGN_PIN(ONEWIRE, 5, 6);
+
+//BSL Pins
+TOSH_ASSIGN_PIN(PROG_OUT,  1, 1);
+TOSH_ASSIGN_PIN(PROG_IN,   2, 2);
+
+// ADC lines on the testpoints
+TOSH_ASSIGN_PIN(ADC_7,   6, 7);
+TOSH_ASSIGN_PIN(DAC1_AN, 6, 7);
+
+// connected to external UART 
+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, 1, 0);
+TOSH_ASSIGN_PIN(GIO1, 1, 5);
+TOSH_ASSIGN_PIN(GIO2, 1, 6);
+
+TOSH_ASSIGN_PIN(FTDI_ADBUS_7, 1, 2);
+TOSH_ASSIGN_PIN(FTDI_ADBUS_3, 2, 0);
+
+/*
+ * NC Pins below
+ */
+TOSH_ASSIGN_PIN(NC_GIO0,     1, 7);
+TOSH_ASSIGN_PIN(NC_GIO1,     2, 1);
+TOSH_ASSIGN_PIN(NC_CS,       3, 0);
+TOSH_ASSIGN_PIN(SIMO0,       3, 1);
+TOSH_ASSIGN_PIN(SOMI0,       3, 2);
+TOSH_ASSIGN_PIN(UCLK0,       3, 3);
+TOSH_ASSIGN_PIN(NC_LED0,     4, 0);
+TOSH_ASSIGN_PIN(NC_LED1,     4, 1);
+TOSH_ASSIGN_PIN(NC_LED2,     4, 2);
+TOSH_ASSIGN_PIN(NC_ACCEL0,   4, 4);
+TOSH_ASSIGN_PIN(NC_ACCEL1,   4, 5);
+TOSH_ASSIGN_PIN(NC_ACCELS,   4, 6);
+TOSH_ASSIGN_PIN(NC_TB0,      4, 7);
+TOSH_ASSIGN_PIN(NC_GIO2,     5, 0);
+TOSH_ASSIGN_PIN(NC_SVS,      5, 7);
+TOSH_ASSIGN_PIN(NC_ADC_0,    6, 0);
+TOSH_ASSIGN_PIN(NC_ADC_1,    6, 1);
+TOSH_ASSIGN_PIN(NC_ADC_2,    6, 2);
+TOSH_ASSIGN_PIN(NC_ADC_3,    6, 3);
+TOSH_ASSIGN_PIN(NC_ADC_4,    6, 4);
+TOSH_ASSIGN_PIN(NC_ADC_5,    6, 5);
+TOSH_ASSIGN_PIN(NC_ADC_6,     6, 6);
+
+#endif // _H_hardware_h
+
diff --git a/tos/platforms/span/platform.h b/tos/platforms/span/platform.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tos/platforms/span/platform_message.h b/tos/platforms/span/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