summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-09-05 12:31:19 +0300
committerTom Rini <trini@konsulko.com>2022-09-24 18:34:37 +0300
commit78b5243182be8fa222f6d496e7d49675fde4d09e (patch)
tree126ed9de35861d001877adb0414e272427a61b97 /common
parent016e2be96d4247ceacca05932f2e94d31607cc57 (diff)
downloadu-boot-78b5243182be8fa222f6d496e7d49675fde4d09e.tar.xz
serial: Implement serial_flush() function for console flush() fallback
Like in all other console functions, implement also serial_flush() function as a fallback int console flush() function. Flush support is available only when config option CONSOLE_FLUSH_SUPPORT is enabled. So when it is disabled then provides just empty static inline function serial_flush(). Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/console.c3
-rw-r--r--common/stdio.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/common/console.c b/common/console.c
index ce0c9b69f5..0c9bf66c3f 100644
--- a/common/console.c
+++ b/common/console.c
@@ -797,6 +797,9 @@ void flush(void)
if (gd->flags & GD_FLG_DEVINIT) {
/* Send to the standard output */
fflush(stdout);
+ } else {
+ /* Send directly to the handler */
+ serial_flush();
}
}
#endif
diff --git a/common/stdio.c b/common/stdio.c
index 92161a0df8..13083842cb 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -87,6 +87,13 @@ static void stdio_serial_puts(struct stdio_dev *dev, const char *s)
serial_puts(s);
}
+#ifdef CONFIG_CONSOLE_FLUSH_SUPPORT
+static void stdio_serial_flush(struct stdio_dev *dev)
+{
+ serial_flush();
+}
+#endif
+
static int stdio_serial_getc(struct stdio_dev *dev)
{
return serial_getc();
@@ -112,6 +119,7 @@ static void drv_system_init (void)
dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
dev.putc = stdio_serial_putc;
dev.puts = stdio_serial_puts;
+ STDIO_DEV_ASSIGN_FLUSH(&dev, stdio_serial_flush);
dev.getc = stdio_serial_getc;
dev.tstc = stdio_serial_tstc;
stdio_register (&dev);