summaryrefslogtreecommitdiffstats
path: root/pbl
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-12-08 10:28:59 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-01-05 11:30:59 +0100
commita9d7b3d00e681ee3cfe33b00d58ef9d6bd0645df (patch)
tree62eaf077255196c57cdd59193c1118615f7242cb /pbl
parent017da2273a1bfef0b2b24e50cc124bdc1845e0f3 (diff)
downloadbarebox-a9d7b3d00e681ee3cfe33b00d58ef9d6bd0645df.tar.gz
barebox-a9d7b3d00e681ee3cfe33b00d58ef9d6bd0645df.tar.xz
Add PBL console support
This adds simple console support to the PBL which makes it possible to print more complex messages in the PBL than just strings or hex numbers. For now puts_ll is used to print the messages, so it depends on CONFIG_DEBUG_LL which makes it more a debugging option. However, this could be extended later to get regular output from the PBL if desired. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'pbl')
-rw-r--r--pbl/Makefile1
-rw-r--r--pbl/console.c32
2 files changed, 33 insertions, 0 deletions
diff --git a/pbl/Makefile b/pbl/Makefile
index a2d7468687..c5a08c1354 100644
--- a/pbl/Makefile
+++ b/pbl/Makefile
@@ -4,3 +4,4 @@
pbl-y += misc.o
pbl-y += string.o
pbl-y += decomp.o
+pbl-$(CONFIG_PBL_CONSOLE) += console.o
diff --git a/pbl/console.c b/pbl/console.c
new file mode 100644
index 0000000000..3875e2aafd
--- /dev/null
+++ b/pbl/console.c
@@ -0,0 +1,32 @@
+#include <common.h>
+#include <debug_ll.h>
+
+int printf(const char *fmt, ...)
+{
+ va_list args;
+ uint i;
+ char printbuffer[CFG_PBSIZE];
+
+ va_start(args, fmt);
+ i = vsprintf(printbuffer, fmt, args);
+ va_end(args);
+
+ puts_ll(printbuffer);
+
+ return i;
+}
+
+int pr_print(int level, const char *fmt, ...)
+{
+ va_list args;
+ uint i;
+ char printbuffer[CFG_PBSIZE];
+
+ va_start(args, fmt);
+ i = vsprintf(printbuffer, fmt, args);
+ va_end(args);
+
+ puts_ll(printbuffer);
+
+ return i;
+}