[debug] change the dgetc signature to match external sources
diff --git a/include/debug.h b/include/debug.h
index e5ebc19..2944cb7 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -57,7 +57,7 @@
#define dvprintf(level, x...) do { if ((level) <= DEBUGLEVEL) { _dvprintf(x); } } while (0)
/* input */
-int dgetc(char *c);
+int dgetc(char *c, bool wait);
/* systemwide halts */
void halt(void) __NO_RETURN;
diff --git a/lib/libc/printf.c b/lib/libc/printf.c
index b7bf2bb..8a3aeb6 100644
--- a/lib/libc/printf.c
+++ b/lib/libc/printf.c
@@ -39,7 +39,7 @@
int getc(char *c)
{
- return dgetc(c);
+ return dgetc(c, true);
}
int printf(const char *fmt, ...)
diff --git a/platform/omap5912/debug.c b/platform/omap5912/debug.c
index d190fa0..e576208 100644
--- a/platform/omap5912/debug.c
+++ b/platform/omap5912/debug.c
@@ -94,12 +94,15 @@
uart_putc(0, c);
}
-int dgetc(char *c)
+int dgetc(char *c, bool wait)
{
int _c;
- if ((_c = uart_getc(0, false)) < 0)
- return -1;
+ while ((_c = uart_getc(0, false)) < 0) {
+ if (!wait) {
+ return -1;
+ }
+ }
*c = _c;
return 0;