]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/uprintf/UprintP.nc
Add uprintf library; use it in tmimsp platforms
[tinyos-2.x.git] / tos / lib / uprintf / UprintP.nc
diff --git a/tos/lib/uprintf/UprintP.nc b/tos/lib/uprintf/UprintP.nc
new file mode 100644 (file)
index 0000000..5a8f083
--- /dev/null
@@ -0,0 +1,31 @@
+/* Copyright (c) 2006-2007 by Sporian Microsystems, Inc.
+ * All Rights Reserved.
+ *
+ * This document is the proprietary and confidential property of Sporian
+ * Microsystems, Inc.  All use, distribution, reproduction or re-distribution
+ * is disallowed without the prior express written consent of Sporian
+ * Microsystems, Inc.
+ */
+
+/* A shim for printf on a uart.
+ */
+
+#include <stdarg.h>
+#include "Uprint.h"
+
+generic module UprintP() {
+  provides interface Uprint;
+  uses interface UartByte;
+}
+implementation {
+  int uart_putc(int c)
+  {
+    call UartByte.send((uint8_t)c);
+    return c;
+  }
+
+  async command uprint_ptr_t Uprint.uptr()
+  {
+    return uart_putc;
+  }
+}