]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
tmimsp platform family better uart abstraction
authorR. Steve McKown <rsmckown@gmail.com>
Thu, 4 Oct 2012 15:27:12 +0000 (09:27 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Thu, 4 Oct 2012 16:36:07 +0000 (10:36 -0600)
12 files changed:
tos/lib/misc/StdToResourceC.nc [new file with mode: 0644]
tos/platforms/tmimsp/.family
tos/platforms/tmimsp/common/PlatformSerialC.nc [deleted file]
tos/platforms/tmimsp/common/PlatformUartC.nc [deleted file]
tos/platforms/tmimsp/common/uart/ConsoleUart.h [new file with mode: 0644]
tos/platforms/tmimsp/common/uart/ConsoleUartC.nc [new file with mode: 0644]
tos/platforms/tmimsp/common/uart/ConsoleUartConfigC.nc [new file with mode: 0644]
tos/platforms/tmimsp/common/uart/ConsoleUartImplP.nc [new file with mode: 0644]
tos/platforms/tmimsp/common/uart/ConsoleUartP.nc [new file with mode: 0644]
tos/platforms/tmimsp/common/uart/DebugUartC.nc [new file with mode: 0644]
tos/platforms/tmimsp/common/uart/PlatformSerialC.nc [new file with mode: 0644]
tos/platforms/tmimsp/common/uart/PlatformUartC.nc [new file with mode: 0644]

diff --git a/tos/lib/misc/StdToResourceC.nc b/tos/lib/misc/StdToResourceC.nc
new file mode 100644 (file)
index 0000000..c6dd9ad
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * Copyright © 2012, 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 Titanium Mirror, Inc 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.
+ */
+
+/**
+ * Implement resource acquisition via the StdControl interface.  Created to
+ * implement PlatformSerialC's StdControl interface using USCI Uart's Resource
+ * interface.
+ *
+ * Avoid using with resources that cannot reliably respond with SUCCESS to
+ * Resource.immediateRequest().  In such cases, it's far smarter to just use the
+ * Resource interface directly.
+ *
+ * @author R. Steve McKown <smckown@titaniummirror.com>
+ */
+
+generic module StdToResourceC() {
+  provides interface StdControl;
+  uses interface Resource;
+}
+implementation {
+  command error_t StdControl.start()
+  {
+    return call Resource.immediateRequest();
+  }
+
+  command error_t StdControl.stop()
+  {
+    return call Resource.release();
+  }
+
+  event void Resource.granted() {}
+}
index bda9749f13ced8ce1a2fef0c3814ed9368b8f8c2..a068ee3f4472168a71aa816b7c5ba79e48d5e749 100644 (file)
@@ -9,6 +9,7 @@ push( @includes, qw(
   %F/common
   %F/common/chips/bq2403x
   %F/common/chips/cp210x
+  %F/common/uart
   %T/platforms/telosa
   %T/chips/msp430
   %T/chips/msp430/adc12
@@ -23,6 +24,7 @@ push( @includes, qw(
   %T/lib/serial
   %T/lib/adc
   %T/lib/power
+  %T/lib/misc
 ) );
 
 @opts = qw(
diff --git a/tos/platforms/tmimsp/common/PlatformSerialC.nc b/tos/platforms/tmimsp/common/PlatformSerialC.nc
deleted file mode 100644 (file)
index a32ffa0..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2008-2010, 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.
- */
-
- /**
- * @author R. Steve McKown <rsmckown@gmail.com>
- */
-
-configuration PlatformSerialC {
-  provides interface StdControl;
-  provides interface UartStream;
-  provides interface UartByte;
-}
-implementation {
-  components PlatformUartC as UartC;
-  UartStream = UartC;
-  UartByte = UartC;
-
-  components PlatformSerialP;
-  StdControl = PlatformSerialP;
-  PlatformSerialP.Resource -> UartC;
-}
diff --git a/tos/platforms/tmimsp/common/PlatformUartC.nc b/tos/platforms/tmimsp/common/PlatformUartC.nc
deleted file mode 100644 (file)
index 10a7cec..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2008-2010, 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.
- */
-
- /**
- * @author R. Steve McKown <rsmckown@gmail.com>
- */
-
-configuration PlatformUartC {
-  provides {
-    interface Resource;
-    interface UartStream;
-    interface UartByte;
-  }
-}
-implementation {
-  components new Msp430UartA1C() as UartC;
-  Resource = UartC;
-  UartStream = UartC;
-  UartByte = UartC;
-
-#if 0 /* If you want to change the Uart's configuration... */
-  components SomeConfigurationComponentC as ConfigC;
-  UartC.AsyncConfigure -> ConfigC;
-#endif
-}
diff --git a/tos/platforms/tmimsp/common/uart/ConsoleUart.h b/tos/platforms/tmimsp/common/uart/ConsoleUart.h
new file mode 100644 (file)
index 0000000..06fb96a
--- /dev/null
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2008-2010, 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.
+ */
+
+/**
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+#ifndef CONSOLE_UART_H
+#define CONSOLE_UART_H
+
+#define CONSOLE_UART_RESOURCE  "Console.Shared.Uart"
+
+#endif
diff --git a/tos/platforms/tmimsp/common/uart/ConsoleUartC.nc b/tos/platforms/tmimsp/common/uart/ConsoleUartC.nc
new file mode 100644 (file)
index 0000000..5dbb145
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2008-2010, 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.
+ */
+
+/**
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+#include "ConsoleUart.h"
+
+generic configuration ConsoleUartC() {
+  provides {
+    interface Resource;
+    interface UartStream;
+    interface UartByte;
+  }
+}
+implementation {
+  enum { CLIENT = unique(CONSOLE_UART_RESOURCE) };
+
+  components ConsoleUartP;
+  Resource = ConsoleUartP.Resource[CLIENT];
+  UartStream = ConsoleUartP.UartStream;
+  UartByte = ConsoleUartP.UartByte;
+}
diff --git a/tos/platforms/tmimsp/common/uart/ConsoleUartConfigC.nc b/tos/platforms/tmimsp/common/uart/ConsoleUartConfigC.nc
new file mode 100644 (file)
index 0000000..9b36223
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2008-2010, 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.
+ */
+
+module ConsoleUartConfigC {
+  provides interface AsyncConfigure<const msp430_usci_uart_t*>;
+}
+implementation {
+  const static msp430_usci_uart_t config = {
+    ctl0: UCMODE_0,            /* async, lsb first, 8N1 */
+    ctl1: UCSWRST | UCSSEL_3,  /* clock uart from SMCLK */
+    brx: UBRX_1MHZ_115200,
+    mctl: UMCTL_1MHZ_115200,
+    irtctl: 0,
+    irrctl: 0,
+    abctl: 0,
+    uclisten: FALSE,
+    ren: USCI_REN_NONE
+  };
+
+  async command const msp430_usci_uart_t* AsyncConfigure.get()
+  {
+    return &config;
+  }
+}
diff --git a/tos/platforms/tmimsp/common/uart/ConsoleUartImplP.nc b/tos/platforms/tmimsp/common/uart/ConsoleUartImplP.nc
new file mode 100644 (file)
index 0000000..9e53e2a
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2008-2010, 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.
+ */
+
+/**
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+#include "ConsoleUart.h"
+
+module ConsoleUartImplP {
+  uses {
+    interface ResourceDefaultOwner;
+    interface Resource as SubResource;
+  }
+}
+implementation {
+  async event void ResourceDefaultOwner.granted()
+  {
+    call SubResource.release();
+  }
+
+  async event void ResourceDefaultOwner.requested()
+  {
+    call SubResource.request();
+  }
+
+  async event void ResourceDefaultOwner.immediateRequested()
+  {
+    if (call SubResource.immediateRequest() == SUCCESS)
+      call ResourceDefaultOwner.release();
+  }
+
+  event void SubResource.granted()
+  {
+    call ResourceDefaultOwner.release();
+  }
+}
diff --git a/tos/platforms/tmimsp/common/uart/ConsoleUartP.nc b/tos/platforms/tmimsp/common/uart/ConsoleUartP.nc
new file mode 100644 (file)
index 0000000..301040d
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2008-2010, 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.
+ */
+
+/**
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+#include "ConsoleUart.h"
+
+configuration ConsoleUartP {
+  provides {
+    interface Resource[uint8_t id];
+    interface UartStream;
+    interface UartByte;
+  }
+}
+implementation {
+  components new SharedArbiterC(CONSOLE_UART_RESOURCE);
+  Resource = SharedArbiterC;
+
+  components ConsoleUartImplP;
+  ConsoleUartImplP.ResourceDefaultOwner -> SharedArbiterC;
+
+  components new Msp430UartA1C() as UartC;
+  UartStream = UartC;
+  UartByte = UartC;
+  ConsoleUartImplP.SubResource -> UartC;
+
+  components ConsoleUartConfigC as ConfigC;
+  UartC.Configure -> ConfigC;
+}
diff --git a/tos/platforms/tmimsp/common/uart/DebugUartC.nc b/tos/platforms/tmimsp/common/uart/DebugUartC.nc
new file mode 100644 (file)
index 0000000..2e7c045
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2008-2010, 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.
+ */
+
+/**
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+configuration DebugUartC {
+  provides {
+    interface Resource;
+    interface UartStream;
+    interface UartByte;
+  }
+}
+implementation {
+  components new ConsoleUartC() as UartC;
+  Resource = UartC;
+  UartStream = UartC;
+  UartByte = UartC;
+}
diff --git a/tos/platforms/tmimsp/common/uart/PlatformSerialC.nc b/tos/platforms/tmimsp/common/uart/PlatformSerialC.nc
new file mode 100644 (file)
index 0000000..0a8d43b
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2008-2010, 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.
+ */
+
+/**
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+configuration PlatformSerialC {
+  provides interface StdControl;
+  provides interface UartStream;
+  provides interface UartByte;
+}
+implementation {
+  components PlatformUartC as UartC;
+  UartStream = UartC;
+  UartByte = UartC;
+
+  components new StdToResourceC() as PlatformSerialP;
+  StdControl = PlatformSerialP;
+  PlatformSerialP.Resource -> UartC;
+}
diff --git a/tos/platforms/tmimsp/common/uart/PlatformUartC.nc b/tos/platforms/tmimsp/common/uart/PlatformUartC.nc
new file mode 100644 (file)
index 0000000..0388fe0
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2008-2010, 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.
+ */
+
+/**
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+configuration PlatformUartC {
+  provides {
+    interface Resource;
+    interface UartStream;
+    interface UartByte;
+  }
+}
+implementation {
+  components new ConsoleUartC() as UartC;
+  Resource = UartC;
+  UartStream = UartC;
+  UartByte = UartC;
+}