]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Initial revision
authorkristinwright <kristinwright>
Sat, 5 Nov 2005 16:38:03 +0000 (16:38 +0000)
committerkristinwright <kristinwright>
Sat, 5 Nov 2005 16:38:03 +0000 (16:38 +0000)
18 files changed:
apps/tests/TestSleep/Makefile [new file with mode: 0644]
apps/tests/TestSleep/TestSleepC.nc [new file with mode: 0644]
apps/tests/TestSleep/TestSleepM.nc [new file with mode: 0644]
apps/tests/mica2/ADC/Makefile [new file with mode: 0644]
apps/tests/mica2/ADC/TestADCC.nc [new file with mode: 0644]
apps/tests/mica2/ADC/TestADCM.nc [new file with mode: 0644]
apps/tests/mica2/I2C/Makefile [new file with mode: 0644]
apps/tests/mica2/I2C/TestI2CC.nc [new file with mode: 0644]
apps/tests/mica2/I2C/TestI2CM.nc [new file with mode: 0644]
apps/tests/mica2/Radio/Makefile [new file with mode: 0644]
apps/tests/mica2/Radio/TestRadioC.nc [new file with mode: 0644]
apps/tests/mica2/Radio/TestRadioM.nc [new file with mode: 0644]
apps/tests/mica2/Timer/BlinkC.nc [new file with mode: 0644]
apps/tests/mica2/Timer/BlinkM.nc [new file with mode: 0644]
apps/tests/mica2/Timer/Makefile [new file with mode: 0644]
apps/tests/mica2/mts300/Makefile [new file with mode: 0644]
apps/tests/mica2/mts300/TestMts300C.nc [new file with mode: 0644]
apps/tests/mica2/mts300/TestMts300P.nc [new file with mode: 0644]

diff --git a/apps/tests/TestSleep/Makefile b/apps/tests/TestSleep/Makefile
new file mode 100644 (file)
index 0000000..4129adb
--- /dev/null
@@ -0,0 +1,3 @@
+COMPONENT=TestSleepC
+include $(MAKERULES)
+
diff --git a/apps/tests/TestSleep/TestSleepC.nc b/apps/tests/TestSleep/TestSleepC.nc
new file mode 100644 (file)
index 0000000..df397d5
--- /dev/null
@@ -0,0 +1,44 @@
+/// $Id$
+
+/**
+ * "Copyright (c) 2005 Crossbow Technology, Inc. 
+ *  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 COPYRIGHT HOLDERS AND CONTRIBUTORS 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 COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE BEEN ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * THE COPYRIGHT HOLDERS AND CONTRIBUTORS SPECIFICALLY DISCLAIM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE NO OBLIGATION
+ * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
+ */
+
+/// @author Martin Turon <mturon@xbow.com>
+
+/** 
+ * TestSleep simple puts the processor into sleep mode and stays there.
+ * The instananeous and average current should be ~20 uA on the ATmega128.
+ */
+configuration TestSleepC
+{
+}
+implementation
+{
+  components MainC, TestSleepM, 
+      HplSleepC;  // Low-level control just for test purposes
+
+  TestSleepM -> MainC.Boot;
+
+  TestSleepM.PowerManager -> HplSleepC;
+}
+
diff --git a/apps/tests/TestSleep/TestSleepM.nc b/apps/tests/TestSleep/TestSleepM.nc
new file mode 100644 (file)
index 0000000..aad4386
--- /dev/null
@@ -0,0 +1,41 @@
+/// $Id$
+
+/**
+ * "Copyright (c) 2005 Crossbow Technology, Inc. 
+ *  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 COPYRIGHT HOLDERS AND CONTRIBUTORS 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 COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE BEEN ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * THE COPYRIGHT HOLDERS AND CONTRIBUTORS SPECIFICALLY DISCLAIM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE NO OBLIGATION
+ * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
+ */
+
+/// @author Martin Turon <mturon@xbow.com>
+
+module TestSleepM
+{
+  uses interface Boot;
+
+  uses interface McuSleep as PowerManager;
+}
+implementation
+{
+  event void Boot.booted()
+  {
+      call PowerManager.enable();
+  }
+}
+
diff --git a/apps/tests/mica2/ADC/Makefile b/apps/tests/mica2/ADC/Makefile
new file mode 100644 (file)
index 0000000..83ee403
--- /dev/null
@@ -0,0 +1,4 @@
+COMPONENT=TestADCC\r
+CFLAGS += -I%T/lib/adc -I%T/oski/services -I%T/oski/interfaces -I%T/oski/types -I%T/oski/impls\r
+include $(MAKERULES)\r
+\r
diff --git a/apps/tests/mica2/ADC/TestADCC.nc b/apps/tests/mica2/ADC/TestADCC.nc
new file mode 100644 (file)
index 0000000..dd453f9
--- /dev/null
@@ -0,0 +1,70 @@
+// $Id$\r
+\r
+/*                                                                     tab:4\r
+ * "Copyright (c) 2000-2005 The Regents of the University  of California.  \r
+ * All rights reserved.\r
+ *\r
+ * Permission to use, copy, modify, and distribute this software and its\r
+ * documentation for any purpose, without fee, and without written agreement is\r
+ * hereby granted, provided that the above copyright notice, the following\r
+ * two paragraphs and the author appear in all copies of this software.\r
+ * \r
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR\r
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT\r
+ * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF\r
+ * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * \r
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\r
+ * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS\r
+ * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO\r
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."\r
+ *\r
+ * Copyright (c) 2002-2005 Intel Corporation\r
+ * All rights reserved.\r
+ *\r
+ * This file is distributed under the terms in the attached INTEL-LICENSE     \r
+ * file. If you do not find these files, copies can be found by writing to\r
+ * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, \r
+ * 94704.  Attention:  Intel License Inquiry.\r
+ *\r
+ * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.  \r
+ *\r
+ * Permission to use, copy, modify, and distribute this software and its\r
+ * documentation for any purpose, without fee, and without written agreement is\r
+ * hereby granted, provided that the above copyright notice, the following\r
+ * two paragraphs and the author appear in all copies of this software. \r
+ * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO \r
+ * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL \r
+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN\r
+ * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH \r
+ * DAMAGE. \r
+ *\r
+ * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY \r
+ * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS \r
+ * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY \r
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR \r
+ * MODIFICATIONS. \r
+ */\r
+\r
+/**\r
+ *\r
+ * @author tinyos-help@millennium.berkeley.edu\r
+ * @author Hu Siquan <husq@xbow.com>\r
+ **/\r
+\r
+configuration TestADCC\r
+{\r
+}\r
+implementation\r
+{\r
+  components Main, TestADCM, DemoSensorC, LedsC;\r
+\r
+  TestADCM -> Main.Boot;\r
+  Main.SoftwareInit -> LedsC;\r
+  TestADCM.Leds -> LedsC;\r
+  TestADCM.SensorControl -> DemoSensorC;   \r
+  TestADCM.AcquireData -> DemoSensorC; \r
+}\r
+\r
diff --git a/apps/tests/mica2/ADC/TestADCM.nc b/apps/tests/mica2/ADC/TestADCM.nc
new file mode 100644 (file)
index 0000000..5d678b9
--- /dev/null
@@ -0,0 +1,89 @@
+// $Id$\r
+\r
+/*                                                                     tab:4\r
+ * "Copyright (c) 2000-2005 The Regents of the University  of California.  \r
+ * All rights reserved.\r
+ *\r
+ * Permission to use, copy, modify, and distribute this software and its\r
+ * documentation for any purpose, without fee, and without written agreement is\r
+ * hereby granted, provided that the above copyright notice, the following\r
+ * two paragraphs and the author appear in all copies of this software.\r
+ * \r
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR\r
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT\r
+ * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF\r
+ * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * \r
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\r
+ * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS\r
+ * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO\r
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."\r
+ *\r
+ * Copyright (c) 2002-2003 Intel Corporation\r
+ * All rights reserved.\r
+ *\r
+ * This file is distributed under the terms in the attached INTEL-LICENSE     \r
+ * file. If you do not find these files, copies can be found by writing to\r
+ * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, \r
+ * 94704.  Attention:  Intel License Inquiry.\r
+ * \r
+ * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved. \r
+ *\r
+ * Permission to use, copy, modify, and distribute this software and its\r
+ * documentation for any purpose, without fee, and without written agreement is\r
+ * hereby granted, provided that the above copyright notice, the following\r
+ * two paragraphs and the author appear in all copies of this software. \r
+ *\r
+ * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO \r
+ * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL \r
+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN\r
+ * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH \r
+ * DAMAGE. \r
+ *\r
+ * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY \r
+ * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS \r
+ * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY \r
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR \r
+ * MODIFICATIONS. \r
+ */\r
+/**\r
+ *\r
+ * @author Hu Siquan <husq@xbow.com>\r
+ *\r
+ * Implementation for TestADC application. \r
+ * Toggle the green LED when a dataReady event fires.\r
+ **/\r
+\r
+\r
+module TestADCM\r
+{\r
+  uses interface StdControl as SensorControl;\r
+  uses interface AcquireData;\r
+  uses interface Leds;\r
+  uses interface Boot;\r
+}\r
+implementation\r
+{\r
+  event void Boot.booted()\r
+  {\r
+    call Leds.led0Toggle();\r
+       call SensorControl.start();\r
+    call AcquireData.getData();\r
+  }\r
+\r
+  event void AcquireData.dataReady(uint16_t data) {\r
+       call SensorControl.stop();\r
+    call Leds.led1Toggle();\r
+    if (data & 1)\r
+      call Leds.led2On();\r
+    else\r
+      call Leds.led2Off();\r
+  }\r
+\r
+  event void AcquireData.error(uint16_t info) {\r
+       call SensorControl.stop();      \r
+  }\r
+}\r
+\r
diff --git a/apps/tests/mica2/I2C/Makefile b/apps/tests/mica2/I2C/Makefile
new file mode 100644 (file)
index 0000000..e8079e1
--- /dev/null
@@ -0,0 +1,4 @@
+COMPONENT=TestI2CC
+CFLAGS += -I%T/lib/oski
+include $(MAKERULES)
+
diff --git a/apps/tests/mica2/I2C/TestI2CC.nc b/apps/tests/mica2/I2C/TestI2CC.nc
new file mode 100644 (file)
index 0000000..49e4dde
--- /dev/null
@@ -0,0 +1,47 @@
+// $Id$
+
+/**
+ * Copyright (c) 2004-2005 Crossbow Technology, Inc.  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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
+ * DAMAGE. 
+ *
+ * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL 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 NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
+ * MODIFICATIONS.
+ */
+
+/// @author Martin Turon <mturon@xbow.com>
+
+/** This version of TestI2C is designed to test the ATmega128 I2C subsystem. */
+configuration TestI2CC
+{
+}
+implementation
+{
+  components 
+      MainC, TestI2CM, LedsC, 
+      new OskiTimerMilliC() as Timer0,
+      HplI2CBusC as I2C;
+      //new HalI2CMasterC(0x58) as I2CPot;  // ad5242 for mag on MTS310
+
+  TestI2CM -> MainC.Boot;
+  MainC.SoftwareInit -> LedsC;
+
+  TestI2CM.Timer0 -> Timer0;
+  TestI2CM.Leds -> LedsC;  
+  TestI2CM.I2C -> I2C;
+  I2C.Leds -> LedsC;
+}
+
diff --git a/apps/tests/mica2/I2C/TestI2CM.nc b/apps/tests/mica2/I2C/TestI2CM.nc
new file mode 100644 (file)
index 0000000..bca6c2c
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ *  Copyright (c) 2004-2005 Crossbow Technology, Inc.
+ *  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 (updated) modification history and the author appear in
+ *  all copies of this source code.
+ *
+ *  Permission is also granted to distribute this software under the
+ *  standard BSD license as contained in the TinyOS distribution.
+ *
+ *  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 HOLDERS OR CONTRIBUTORS 
+ *  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, 
+ *  OR PROFITS) 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 Martin Turon <mturon@xbow.com>
+ *
+ *  $Id$
+ */
+
+/**
+ * Implementation for TestI2C application:  
+ *   Yellow      == Every timer, post task for I2C ping if not already running
+ *   Red & GREEN == task started
+ *   Red         == Device ping FAIL
+ *   Green       == Device ping SUCCESS
+ *
+ * @version    2005/9/11    mturon     Initial version
+ */
+
+#define I2C_DEVICE      I2C_MTS300_MIC
+
+#define I2C_MTS310_MAG  0x58
+#define I2C_MTS300_MIC  0x5A
+#define I2C_MDA300_ADC  0x94
+#define I2C_MDA300_EE   0xAE
+
+includes Timer;
+
+module TestI2CM
+{
+  uses interface Timer<TMilli> as Timer0;
+  uses interface Leds;
+  uses interface Boot;
+  uses interface HplI2CBus    as I2C;
+}
+implementation
+{
+    bool    working;
+
+    task void i2c_test() {
+       call Leds.led1On();
+       call Leds.led0On();
+       
+       if (call I2C.ping(I2C_DEVICE) == SUCCESS) {
+           call Leds.led0Off();
+       } else {
+           call Leds.led1Off();
+       }
+
+       working = FALSE;
+    }
+
+    void i2c_test_start() {
+       atomic {
+           if (!working) {
+               working = TRUE;
+               post i2c_test();
+           }
+       }
+    }
+
+    event void Boot.booted() {
+       working = FALSE;
+       call I2C.init();
+
+       call Timer0.startPeriodic( 10000 );
+
+       call Leds.led2On();
+       i2c_test_start();
+    }
+    
+    event void Timer0.fired() {
+       call Leds.led2Toggle();
+       i2c_test_start();
+    }  
+
+    async event void I2C.symbolSent() { }
+
+}
+
diff --git a/apps/tests/mica2/Radio/Makefile b/apps/tests/mica2/Radio/Makefile
new file mode 100644 (file)
index 0000000..67dc77b
--- /dev/null
@@ -0,0 +1,4 @@
+COMPONENT=TestRadioC
+CFLAGS += -I%T/oski/services -I%T/oski/interfaces -I%T/oski/types -I%T/oski/impls
+include $(MAKERULES)
+
diff --git a/apps/tests/mica2/Radio/TestRadioC.nc b/apps/tests/mica2/Radio/TestRadioC.nc
new file mode 100644 (file)
index 0000000..809562d
--- /dev/null
@@ -0,0 +1,58 @@
+// $Id$
+
+/*                                                                     tab:4
+ * "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."
+ *
+ * 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.
+ */
+
+/**
+ * Blink is a basic application that toggles the a mote LED periodically.
+ * It does so by starting a Timer that fires every second. It uses the
+ * OSKI TimerMilli service to achieve this goal.
+ *
+ * @author tinyos-help@millennium.berkeley.edu
+ **/
+
+configuration TestRadioC
+{
+}
+implementation
+{
+  components Main, TestRadioM, new TimerMilli() as Timer0, LedsC, CSMARadioC;
+
+  TestRadioM -> Main.Boot;
+  Main.SoftwareInit -> LedsC;
+  Main.SoftwareInit -> CSMARadioC;
+
+  TestRadioM.SplitControl -> CSMARadioC;
+  TestRadioM.Send -> CSMARadioC;
+  TestRadioM.Receive -> CSMARadioC;
+  TestRadioM.Timer0 -> Timer0;
+  TestRadioM.Leds -> LedsC;
+
+}
+
diff --git a/apps/tests/mica2/Radio/TestRadioM.nc b/apps/tests/mica2/Radio/TestRadioM.nc
new file mode 100644 (file)
index 0000000..3778ee0
--- /dev/null
@@ -0,0 +1,84 @@
+// $Id$
+
+/*                                                                     tab:4
+ * "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."
+ *
+ * Copyright (c) 2002-2003 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.
+ */
+
+/**
+ * Implementation for TestRadio application.  Toggle the red LED when a
+ * Timer fires.
+ **/
+
+includes Timer;
+
+module TestRadioM
+{
+  uses interface Timer<TMilli> as Timer0;
+  uses interface SplitControl;
+  uses interface Send;
+  uses interface Receive;
+  uses interface Leds;
+  uses interface Boot;
+}
+implementation
+{
+  message_t msg;
+
+  event void Boot.booted()
+  {
+    call SplitControl.start();
+  }
+
+  event void SplitControl.startDone(error_t error) {
+    call Timer0.startPeriodic( 1000 );
+  }
+
+  event void SplitControl.stopDone(error_t error) {
+  }
+
+  event void Timer0.fired()
+  {
+    call Leds.led0Toggle();
+    msg.header.addr = 0xffff;
+    msg.header.group = 0x42;
+    msg.data[0] = 0xaa;
+    msg.data[1] = 0xbb;
+    msg.header.length = 2;
+    if (call Send.send(&msg, 2) == SUCCESS)
+      call Leds.led1Toggle();
+  }
+
+  event void Send.sendDone(message_t* mmsg, error_t error) {
+    call Leds.led2Toggle();
+  }
+
+  event message_t* Receive.receive(message_t* mmsg, void* payload, uint8_t len) {
+    return mmsg;
+  }
+}
+
diff --git a/apps/tests/mica2/Timer/BlinkC.nc b/apps/tests/mica2/Timer/BlinkC.nc
new file mode 100644 (file)
index 0000000..e1cc844
--- /dev/null
@@ -0,0 +1,45 @@
+// $Id$
+
+/**
+ * Copyright (c) 2004-2005 Crossbow Technology, Inc.  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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
+ * DAMAGE. 
+ *
+ * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL 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 NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
+ * MODIFICATIONS.
+ */
+
+/// @author Martin Turon <mturon@xbow.com>
+
+/** This version of Blink is designed to test ATmega128 AVR timers. */
+configuration BlinkC
+{
+}
+implementation
+{
+    components MainC, new BlinkM(uint8_t), LedsC, HplTimerC;
+
+    BlinkM.Boot -> MainC;
+    MainC.SoftwareInit -> LedsC;
+    BlinkM.Leds -> LedsC;
+    
+    BlinkM.Timer -> HplTimerC.Timer0;
+    BlinkM.Compare -> HplTimerC.Compare0;
+
+    BlinkM.FastTimer -> HplTimerC.Timer1;
+    BlinkM.FastCompare -> HplTimerC.Compare1A;
+}
+
diff --git a/apps/tests/mica2/Timer/BlinkM.nc b/apps/tests/mica2/Timer/BlinkM.nc
new file mode 100644 (file)
index 0000000..47999db
--- /dev/null
@@ -0,0 +1,127 @@
+// $Id$
+
+/**
+ * Copyright (c) 2004-2005 Crossbow Technology, Inc.  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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
+ * DAMAGE. 
+ *
+ * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL 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 NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
+ * MODIFICATIONS.
+ */
+
+/// @author Martin Turon <mturon@xbow.com>
+
+#define SLOW_COMPARE            50  
+#define SLOW_COMPARE_ON_CYCLE   320  
+#define SLOW_OVERFLOW_CYCLES    500
+
+#define FAST_COMPARE            16000
+#define FAST_COMPARE_ON_CYCLE   4
+#define FAST_OVERFLOW_CYCLES    5
+
+#include <ATm128Timer.h>
+
+/**
+ * This version of Blink is designed to test ATmega128 AVR timers.
+ */
+generic module BlinkM(typedef timer_size @integer())
+{
+  uses interface HplTimer<timer_size> as Timer;
+  uses interface HplCompare<timer_size> as Compare;
+  uses interface HplTimer<uint16_t> as FastTimer;
+  uses interface HplCompare<uint16_t> as FastCompare;
+  uses interface Boot;
+  uses interface Leds;
+}
+implementation
+{
+  norace int scycle = SLOW_OVERFLOW_CYCLES;
+  norace int fcycle = FAST_OVERFLOW_CYCLES;
+
+  void slow_timer_init() {
+      atomic {
+         CLR_BIT(ASSR, AS0);  // set Timer/Counter0 to use 32,768khz crystal
+
+         call Timer.setScale(ATM128_CLK8_DIVIDE_32); 
+         call Compare.set(SLOW_COMPARE); // trigger compare in middle of range
+         call Compare.start();
+
+         call Timer.start();
+         call Timer.set(0);      // overflow after 256-6 = 250 cycles
+      }
+  }
+
+  void fast_timer_init() {
+
+      atomic {
+         call FastTimer.setScale(AVR_CLOCK_DIVIDE_8); 
+         call FastCompare.set(FAST_COMPARE);  // trigger compare mid pulse
+         call FastCompare.start();
+
+         call FastTimer.start();
+         call FastTimer.set(0);      // overflow after 256-6 = 250 cycles
+      }
+  }
+  
+  event void Boot.booted() {
+      slow_timer_init();
+      fast_timer_init();
+
+      while(1) {}
+  }
+  async event void Compare.fired() {
+      call Leds.led0On();
+      call Compare.stop();
+  }
+
+  async event void Timer.overflow() {
+      call Timer.reset();
+
+      if (scycle == SLOW_COMPARE_ON_CYCLE) {
+         call Compare.reset();
+         call Compare.start();
+      }
+
+      if (scycle++ > SLOW_OVERFLOW_CYCLES) {
+         scycle = 0;
+         call Leds.led0Off();
+      }
+  }
+
+  async event void FastCompare.fired() {
+      if (fcycle == FAST_COMPARE_ON_CYCLE) {
+         call Leds.led2On();
+         call FastCompare.stop();
+      }
+  }
+
+  async event void FastTimer.overflow() {
+      call FastTimer.reset();
+
+      if (fcycle == FAST_COMPARE_ON_CYCLE) {
+         call FastCompare.reset();
+         call FastCompare.start();
+      }
+
+      if (fcycle++ > FAST_OVERFLOW_CYCLES) {
+         fcycle = 0;
+         call Leds.led1Toggle(); // toggle overflow led
+         call Leds.led2Off();    // clear compare led
+      }
+  }
+}
+
diff --git a/apps/tests/mica2/Timer/Makefile b/apps/tests/mica2/Timer/Makefile
new file mode 100644 (file)
index 0000000..57038bd
--- /dev/null
@@ -0,0 +1,3 @@
+COMPONENT=BlinkC
+include $(MAKERULES)
+
diff --git a/apps/tests/mica2/mts300/Makefile b/apps/tests/mica2/mts300/Makefile
new file mode 100644 (file)
index 0000000..ba11c40
--- /dev/null
@@ -0,0 +1,5 @@
+COMPONENT=TestMts300C
+SENSORBOARD=mts300
+CFLAGS += -I%T/lib/oski 
+#CFLAGS += -I%T/sensorboards/mts300
+include $(MAKERULES)
diff --git a/apps/tests/mica2/mts300/TestMts300C.nc b/apps/tests/mica2/mts300/TestMts300C.nc
new file mode 100644 (file)
index 0000000..658fd86
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ *  Copyright (c) 2004-2005 Crossbow Technology, Inc.
+ *  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 (updated) modification history and the author appear in
+ *  all copies of this source code.
+ *
+ *  Permission is also granted to distribute this software under the
+ *  standard BSD license as contained in the TinyOS distribution.
+ *
+ *  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 HOLDERS OR CONTRIBUTORS 
+ *  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, 
+ *  OR PROFITS) 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 Martin Turon <mturon@xbow.com>
+ *
+ *  $Id$
+ */
+
+/**
+ * This application tests the mts300 sensorboard.
+ * Specifically, this handles the thermistor and light sensors.
+ * 
+ * @author  Martin Turon
+ * @date    October 19, 2005
+ */
+configuration TestMts300C {
+}
+implementation
+{
+  components MainC, TestMts300P, LedsC, new OskiTimerMilliC(),
+      SensorMts300C;
+
+  MainC.SoftwareInit -> LedsC;
+  MainC.SoftwareInit -> SensorMts300C;
+
+  TestMts300P -> MainC.Boot;
+  TestMts300P.Leds -> LedsC;
+  TestMts300P.AppTimer -> OskiTimerMilliC;
+
+  TestMts300P.SensorControl -> SensorMts300C;
+  TestMts300P.Temp -> SensorMts300C.Temp;
+  TestMts300P.Light -> SensorMts300C.Light;
+}
+
diff --git a/apps/tests/mica2/mts300/TestMts300P.nc b/apps/tests/mica2/mts300/TestMts300P.nc
new file mode 100644 (file)
index 0000000..65992a9
--- /dev/null
@@ -0,0 +1,79 @@
+/**
+ *  Copyright (c) 2004-2005 Crossbow Technology, Inc.
+ *  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 (updated) modification history and the author appear in
+ *  all copies of this source code.
+ *
+ *  Permission is also granted to distribute this software under the
+ *  standard BSD license as contained in the TinyOS distribution.
+ *
+ *  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 HOLDERS OR CONTRIBUTORS 
+ *  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, 
+ *  OR PROFITS) 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 Martin Turon <mturon@xbow.com>
+ *
+ *  $Id$
+ */
+
+includes Timer;
+
+/**
+ * This application tests the mts300 sensorboard.
+ * Specifically, this handles the thermistor and light sensors.
+ * 
+ * @author  Martin Turon
+ * @date    October 19, 2005
+ */
+module TestMts300P
+{
+    uses {
+       interface Boot;
+       interface Leds;
+       interface Timer<TMilli> as AppTimer;
+
+       interface StdControl as SensorControl;
+       interface AcquireData as Temp;
+       interface AcquireData as Light;
+    }
+}
+implementation
+{
+    event void Boot.booted() {
+       call Leds.led0On();
+       call Leds.led1On();        // power led
+       call SensorControl.start();
+    }
+    
+    event void AppTimer.fired() {
+       call Leds.led0Toggle();    // heartbeat indicator 
+       call Light.getData();
+       call Temp.getData();
+    }
+
+    event void Light.dataReady(uint16_t data) {
+       call Leds.led1Toggle();
+    }
+
+    event void Temp.dataReady(uint16_t data) {
+       call Leds.led2Toggle();
+    }
+
+    event void Light.error(uint16_t info) {
+    }
+
+    event void Temp.error(uint16_t info) {
+    }
+}
+