From 13e400e82fdf39ec7807c7b290136408044d6273 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Sun, 28 Oct 2012 14:01:40 -0600 Subject: [PATCH] debug: add cfprintf macro Where cprintf implicitly uses a Uprint interface, cfprintf is provided the interface name. --- tos/lib/uprintf/Uprint.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tos/lib/uprintf/Uprint.h b/tos/lib/uprintf/Uprint.h index 0e05ebbc..bcb4066d 100644 --- a/tos/lib/uprintf/Uprint.h +++ b/tos/lib/uprintf/Uprint.h @@ -16,6 +16,18 @@ #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 */ -- 2.39.2