]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
debug: add cfprintf macro
authorR. Steve McKown <rsmckown@gmail.com>
Sun, 28 Oct 2012 20:01:40 +0000 (14:01 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Sun, 28 Oct 2012 20:01:40 +0000 (14:01 -0600)
Where cprintf implicitly uses a Uprint interface, cfprintf is provided
the interface name.

tos/lib/uprintf/Uprint.h

index 0e05ebbce94b7a1675ae27b4bd319e4241595ffa..bcb4066d0633b92059c61be27f31e00b42f4ff61 100644 (file)
 #ifndef UPRINT_H
 #define UPRINT_H
 
 #ifndef UPRINT_H
 #define UPRINT_H
 
+/* Console printf macro implicitly uses the Uprint interface used by the module
+ * within which this macro is called.
+ */
+#define cprintf(fmt, args...) uprintf(call Uprint.uptr(), fmt, ## args)
+
+/* Console fprintf macro prints to the channel wired to the Uprint interface
+ * provided as the uprint_interface argument.  Allows for printing to multiple
+ * channels from within the same module.
+ */
+#define cfprintf(uprint_interface, fmt, args...) \
+    uprintf(call uprint_interface.uptr(), fmt, ## args)
+
 typedef int (*uprint_ptr_t)();
 
 #endif /* end of include guard: UPRINT_H */
 typedef int (*uprint_ptr_t)();
 
 #endif /* end of include guard: UPRINT_H */