summaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-rw-r--r--include/printk.h15
-rw-r--r--include/stdio.h20
2 files changed, 21 insertions, 14 deletions
diff --git a/include/printk.h b/include/printk.h
index 22c6c732f7..a27ad514cf 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -22,18 +22,23 @@
/* debugging and troubleshooting/diagnostic helpers. */
#ifndef CONFIG_CONSOLE_NONE
-int pr_print(int level, const char *format, ...)
- __attribute__ ((format(__printf__, 2, 3)));
-
int dev_printf(int level, const struct device_d *dev, const char *format, ...)
__attribute__ ((format(__printf__, 3, 4)));
#else
-static inline int pr_print(int level, const char *format, ...)
+static inline int dev_printf(int level, const struct device_d *dev, const char *format, ...)
{
return 0;
}
+#endif
-static inline int dev_printf(int level, const struct device_d *dev, const char *format, ...)
+#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
+ (defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
+int pr_print(int level, const char *format, ...)
+ __attribute__ ((format(__printf__, 2, 3)));
+#else
+static int pr_print(int level, const char *format, ...)
+ __attribute__ ((format(__printf__, 2, 3)));
+static inline int pr_print(int level, const char *format, ...)
{
return 0;
}
diff --git a/include/stdio.h b/include/stdio.h
index 71dbae35ca..f190911762 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -29,8 +29,6 @@ int getc(void);
int console_puts(unsigned int ch, const char *s);
void console_flush(void);
-
-int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
int vprintf(const char *fmt, va_list args);
#else
static inline int tstc(void)
@@ -52,13 +50,6 @@ static inline void console_putc(unsigned int ch, char c) {}
static inline void console_flush(void) {}
-static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
-static inline int printf(const char *fmt, ...)
-{
- return 0;
-}
-
-
static inline int vprintf(const char *fmt, va_list args)
{
return 0;
@@ -74,6 +65,17 @@ static inline int ctrlc (void)
#endif
+#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
+ (defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
+int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
+#else
+static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
+static inline int printf(const char *fmt, ...)
+{
+ return 0;
+}
+#endif
+
static inline int puts(const char *s)
{
return console_puts(CONSOLE_STDOUT, s);