From a9d7b3d00e681ee3cfe33b00d58ef9d6bd0645df Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 8 Dec 2014 10:28:59 +0100 Subject: 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 --- pbl/Makefile | 1 + pbl/console.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 pbl/console.c (limited to 'pbl') 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 +#include + +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; +} -- cgit v1.2.3