9
0
Fork 0

Flush consoles before exiting

We use FIFOs on some devices, so flush them before exiting so
we do not get funny characters in the output.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2009-02-21 01:22:48 +01:00
parent 0b5a776c1e
commit 8a2e721fc5
4 changed files with 15 additions and 0 deletions

View File

@ -58,6 +58,8 @@ static int do_go (cmd_tbl_t *cmdtp, int argc, char *argv[])
printf ("## Starting application at 0x%08lX ...\n", addr);
console_flush();
#ifdef ARCH_HAS_EXECUTE
rcode = arch_execute(addr, argc, &argv[1]);
#else

View File

@ -301,6 +301,17 @@ int fputs(int fd, const char *s)
}
EXPORT_SYMBOL(fputs);
void console_flush(void)
{
struct console_device *cdev;
for_each_console(cdev) {
if (cdev->flush)
cdev->flush(cdev);
}
}
EXPORT_SYMBOL(console_flush);
void fprintf (int file, const char *fmt, ...)
{
va_list args;

View File

@ -38,6 +38,7 @@ struct console_device {
void (*putc)(struct console_device *cdev, char c);
int (*getc)(struct console_device *cdev);
int (*setbrg)(struct console_device *cdev, int baudrate);
void (*flush)(struct console_device *cdev);
struct list_head list;

View File

@ -18,6 +18,7 @@ int tstc(void);
void console_putc(unsigned int ch, const char c);
int getc(void);
void console_puts(unsigned int ch, const char *s);
void console_flush(void);
static inline void puts(const char *s) {
console_puts(CONSOLE_STDOUT, s);