]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
The AT25DF part is not compatible with the AT45DB nor the STM25P, apparently.
authorsmckown <smckown@4bc1554a-c7f2-4f65-a403-e0be01f0239c>
Thu, 11 Sep 2008 02:34:55 +0000 (02:34 +0000)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 1 Dec 2009 03:00:56 +0000 (20:00 -0700)
It is quite close to the STM25P, but mapping the chip to that code failed to
get good results using the tests/storage/Block application.  However, the
part does work correctly with a test application written directly to its SPI
API.

tos/chips/msp430/pins/NoMsp430GpioC.nc [new file with mode: 0644]
tos/chips/msp430/usci/Msp430SpiA0C.nc [new file with mode: 0644]
tos/chips/msp430/usci/Msp430SpiB0C.nc [new file with mode: 0644]
tos/platforms/tmicore/.platform

diff --git a/tos/chips/msp430/pins/NoMsp430GpioC.nc b/tos/chips/msp430/pins/NoMsp430GpioC.nc
new file mode 100644 (file)
index 0000000..2b9cc17
--- /dev/null
@@ -0,0 +1,44 @@
+
+/* "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."
+ */
+
+/**
+ * A noop version of Msp430GpioC.
+ *
+ * @author Joe Polastre
+ * @see  Please refer to TEP 117 for more information about this component and its
+ *          intended use.
+ */
+
+generic module NoMsp430GpioC() @safe() {
+  provides interface GeneralIO;
+}
+implementation {
+
+  async command void GeneralIO.set() {}
+  async command void GeneralIO.clr() {}
+  async command void GeneralIO.toggle() {}
+  async command bool GeneralIO.get() { return FALSE; }
+  async command void GeneralIO.makeInput() {}
+  async command bool GeneralIO.isInput() { return TRUE; }
+  async command void GeneralIO.makeOutput() {}
+  async command bool GeneralIO.isOutput() { return FALSE; }
+
+}
diff --git a/tos/chips/msp430/usci/Msp430SpiA0C.nc b/tos/chips/msp430/usci/Msp430SpiA0C.nc
new file mode 100644 (file)
index 0000000..546c81a
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2008, Titanium Mirror, Inc.
+ * 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.
+ */
+/**
+ * This configuration provides the interface for using USCI_A0 in its SPI
+ * mode.
+ *
+ * The instantiator should set the blockSize, which represents the maximum
+ * number of bytes the underlying SPI stack will transmit or receive in a
+ * single interrupt service.  Increasing the block size decreases SPI
+ * communications time at the expense of reducing system responsiveness to
+ * other events.
+ *
+ * The blockSize is best set by considering the maximum time the SPI stack
+ * should be able to delay other events.  A rule of thumb formula would be:
+ *
+ * block_time = block_size / (spi_bitclock/8)
+ *
+ * For example, using a 500KHZ SPI bitclock, a block size of 64 bytes
+ * equates to a block time of 1 ms.  Note that this calculation is rough
+ * because it does not take into account ISR overhead and other factors.
+ *
+ * The implementation will use a default blockSize if set to 0 here.
+ *
+ * @author R. Steve McKown <smckown@gmail.com>
+ */
+#if !defined(__MSP430_HAS_USCI_AB0__)
+#error "Target does not have a USCI_A0 peripheral (SPI)"
+#endif
+
+#include "Msp430Usci.h"
+
+generic configuration Msp430SpiA0C(uint16_t blockSize) {
+  provides {
+    interface Resource;
+    interface ResourceRequested;
+    interface SpiByte;
+    interface SpiPacket;
+    interface ArbiterInfo; /* ??? */
+  }
+  uses interface AsyncConfigure<const msp430_usci_spi_t*> as Configure;
+}
+implementation {
+  enum {
+    CLIENT_ID = unique(MSP430_USCIA0_RESOURCE)
+  };
+
+  components new Msp430SpiP(blockSize) as SpiP;
+  SpiByte = SpiP;
+  SpiPacket = SpiP;
+  Configure = SpiP;
+
+  components Msp430UsciA0C as UsciC;
+  Resource = UsciC.Resource[CLIENT_ID];
+  ResourceRequested = UsciC.ResourceRequested[CLIENT_ID];
+  ArbiterInfo = UsciC.ArbiterInfo;
+  SpiP -> UsciC.Registers;
+  SpiP -> UsciC.Interrupts[CLIENT_ID];
+  SpiP -> UsciC.ArbiterInfo;
+  UsciC.ResourceConfigure[CLIENT_ID] -> SpiP;
+
+  components HplMsp430GeneralIOC as IOC;
+  SpiP.STE -> IOC.UCA0STE;
+  SpiP.SIMO -> IOC.UCA0SIMO;
+  SpiP.SOMI -> IOC.UCA0SOMI;
+  SpiP.CLK -> IOC.UCA0CLK;
+}
diff --git a/tos/chips/msp430/usci/Msp430SpiB0C.nc b/tos/chips/msp430/usci/Msp430SpiB0C.nc
new file mode 100644 (file)
index 0000000..533a1ef
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2008, Titanium Mirror, Inc.
+ * 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.
+ */
+/**
+ * This configuration provides the interface for using USCI_B0 in its SPI
+ * mode.
+ *
+ * The instantiator should set the blockSize, which represents the maximum
+ * number of bytes the underlying SPI stack will transmit or receive in a
+ * single interrupt service.  Increasing the block size decreases SPI
+ * communications time at the expense of reducing system responsiveness to
+ * other events.
+ *
+ * The blockSize is best set by considering the maximum time the SPI stack
+ * should be able to delay other events.  A rule of thumb formula would be:
+ *
+ * block_time = block_size / (spi_bitclock/8)
+ *
+ * For example, using a 500KHZ SPI bitclock, a block size of 64 bytes
+ * equates to a block time of 1 ms.  Note that this calculation is rough
+ * because it does not take into account ISR overhead and other factors.
+ *
+ * The implementation will use a default blockSize if set to 0 here.
+ *
+ * @author R. Steve McKown <smckown@gmail.com>
+ */
+#if !defined(__MSP430_HAS_USCI_AB0__)
+#error "Target does not have a USCI_B0 peripheral (SPI)"
+#endif
+
+#include "Msp430Usci.h"
+
+generic configuration Msp430SpiB0C(uint16_t blockSize) {
+  provides {
+    interface Resource;
+    interface ResourceRequested;
+    interface SpiByte;
+    interface SpiPacket;
+    interface ArbiterInfo; /* ??? */
+  }
+  uses interface AsyncConfigure<const msp430_usci_spi_t*> as Configure;
+}
+implementation {
+  enum {
+    CLIENT_ID = unique(MSP430_USCIB0_RESOURCE)
+  };
+
+  components new Msp430SpiP(blockSize) as SpiP;
+  SpiByte = SpiP;
+  SpiPacket = SpiP;
+  Configure = SpiP;
+
+  components Msp430UsciB0C as UsciC;
+  Resource = UsciC.Resource[CLIENT_ID];
+  ResourceRequested = UsciC.ResourceRequested[CLIENT_ID];
+  ArbiterInfo = UsciC.ArbiterInfo;
+  SpiP -> UsciC.Registers;
+  SpiP -> UsciC.Interrupts[CLIENT_ID];
+  SpiP -> UsciC.ArbiterInfo;
+  UsciC.ResourceConfigure[CLIENT_ID] -> SpiP;
+
+  components HplMsp430GeneralIOC as IOC;
+  SpiP.STE -> IOC.UCB0STE;
+  SpiP.SIMO -> IOC.UCB0SIMO;
+  SpiP.SOMI -> IOC.UCB0SOMI;
+  SpiP.CLK -> IOC.UCB0CLK;
+}
index 3e8fdb1bce8bec397485e667dcd4e0b242fb0ed4..f80694a5d88c5f76d69b5ad5b812d125d7bccef2 100755 (executable)
@@ -15,7 +15,6 @@ push( @includes, qw(
   %T/chips/msp430/timer
   %T/chips/msp430/usci
   %T/chips/msp430/sensors
-  %T/chips/at45db
   %T/chips/bq2403x
   %T/chips/cp210x
   %T/lib/timer