mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-17 14:18:14 +01:00
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>
This commit is contained in:
parent
016e2be96d
commit
78b5243182
@ -797,6 +797,9 @@ void flush(void)
|
|||||||
if (gd->flags & GD_FLG_DEVINIT) {
|
if (gd->flags & GD_FLG_DEVINIT) {
|
||||||
/* Send to the standard output */
|
/* Send to the standard output */
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
} else {
|
||||||
|
/* Send directly to the handler */
|
||||||
|
serial_flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -87,6 +87,13 @@ static void stdio_serial_puts(struct stdio_dev *dev, const char *s)
|
|||||||
serial_puts(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)
|
static int stdio_serial_getc(struct stdio_dev *dev)
|
||||||
{
|
{
|
||||||
return serial_getc();
|
return serial_getc();
|
||||||
@ -112,6 +119,7 @@ static void drv_system_init (void)
|
|||||||
dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
|
dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
|
||||||
dev.putc = stdio_serial_putc;
|
dev.putc = stdio_serial_putc;
|
||||||
dev.puts = stdio_serial_puts;
|
dev.puts = stdio_serial_puts;
|
||||||
|
STDIO_DEV_ASSIGN_FLUSH(&dev, stdio_serial_flush);
|
||||||
dev.getc = stdio_serial_getc;
|
dev.getc = stdio_serial_getc;
|
||||||
dev.tstc = stdio_serial_tstc;
|
dev.tstc = stdio_serial_tstc;
|
||||||
stdio_register (&dev);
|
stdio_register (&dev);
|
||||||
|
@ -327,6 +327,16 @@ void serial_puts(const char *str)
|
|||||||
_serial_puts(gd->cur_serial_dev, str);
|
_serial_puts(gd->cur_serial_dev, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_CONSOLE_FLUSH_SUPPORT
|
||||||
|
void serial_flush(void)
|
||||||
|
{
|
||||||
|
if (!gd->cur_serial_dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_serial_flush(gd->cur_serial_dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int serial_getc(void)
|
int serial_getc(void)
|
||||||
{
|
{
|
||||||
if (!gd->cur_serial_dev)
|
if (!gd->cur_serial_dev)
|
||||||
|
@ -362,6 +362,11 @@ void serial_setbrg(void);
|
|||||||
void serial_putc(const char ch);
|
void serial_putc(const char ch);
|
||||||
void serial_putc_raw(const char ch);
|
void serial_putc_raw(const char ch);
|
||||||
void serial_puts(const char *str);
|
void serial_puts(const char *str);
|
||||||
|
#if defined(CONFIG_CONSOLE_FLUSH_SUPPORT) && CONFIG_IS_ENABLED(DM_SERIAL)
|
||||||
|
void serial_flush(void);
|
||||||
|
#else
|
||||||
|
static inline void serial_flush(void) {}
|
||||||
|
#endif
|
||||||
int serial_getc(void);
|
int serial_getc(void);
|
||||||
int serial_tstc(void);
|
int serial_tstc(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user