dm: console/serial: add flushc() support
Flush console data. Change-Id: If347b6c8d1126452a1f6386040693b30c66eb5fb Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
3bee194f53
commit
c1e72b20c9
|
|
@ -256,6 +256,18 @@ static inline void console_doenv(int file, struct stdio_dev *dev)
|
||||||
{
|
{
|
||||||
iomux_doenv(file, dev->name);
|
iomux_doenv(file, dev->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void console_clear(int file)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct stdio_dev *dev;
|
||||||
|
|
||||||
|
for (i = 0; i < cd_count[file]; i++) {
|
||||||
|
dev = console_devices[file][i];
|
||||||
|
if (dev->clear != NULL)
|
||||||
|
dev->clear(dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static inline int console_getc(int file)
|
static inline int console_getc(int file)
|
||||||
{
|
{
|
||||||
|
|
@ -283,6 +295,12 @@ static inline void console_puts(int file, const char *s)
|
||||||
stdio_devices[file]->puts(stdio_devices[file], s);
|
stdio_devices[file]->puts(stdio_devices[file], s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void console_clear(int file)
|
||||||
|
{
|
||||||
|
if (stdio_devices[file]->clear)
|
||||||
|
stdio_devices[file]->clear(stdio_devices[file]);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void console_doenv(int file, struct stdio_dev *dev)
|
static inline void console_doenv(int file, struct stdio_dev *dev)
|
||||||
{
|
{
|
||||||
console_setfile(file, dev);
|
console_setfile(file, dev);
|
||||||
|
|
@ -361,6 +379,12 @@ void fputs(int file, const char *s)
|
||||||
console_puts(file, s);
|
console_puts(file, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fclear(int file)
|
||||||
|
{
|
||||||
|
if (file < MAX_FILES)
|
||||||
|
console_clear(file);
|
||||||
|
}
|
||||||
|
|
||||||
int fprintf(int file, const char *fmt, ...)
|
int fprintf(int file, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
@ -434,6 +458,19 @@ int tstc(void)
|
||||||
return serial_tstc();
|
return serial_tstc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void flushc(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_DISABLE_CONSOLE
|
||||||
|
if (gd->flags & GD_FLG_DISABLE_CONSOLE)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (gd->flags & GD_FLG_DEVINIT)
|
||||||
|
fclear(stdout);
|
||||||
|
else
|
||||||
|
serial_clear();
|
||||||
|
}
|
||||||
|
|
||||||
#define PRE_CONSOLE_FLUSHPOINT1_SERIAL 0
|
#define PRE_CONSOLE_FLUSHPOINT1_SERIAL 0
|
||||||
#define PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL 1
|
#define PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,18 @@ void serial_setbrg(void)
|
||||||
ops->setbrg(gd->cur_serial_dev, gd->baudrate);
|
ops->setbrg(gd->cur_serial_dev, gd->baudrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void serial_clear(void)
|
||||||
|
{
|
||||||
|
struct dm_serial_ops *ops;
|
||||||
|
|
||||||
|
if (!gd->cur_serial_dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ops = serial_get_ops(gd->cur_serial_dev);
|
||||||
|
if (ops->setbrg)
|
||||||
|
ops->clear(gd->cur_serial_dev);
|
||||||
|
}
|
||||||
|
|
||||||
void serial_stdio_init(void)
|
void serial_stdio_init(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -548,6 +548,7 @@ void smp_kick_all_cpus(void);
|
||||||
int serial_init (void);
|
int serial_init (void);
|
||||||
void serial_setbrg (void);
|
void serial_setbrg (void);
|
||||||
void serial_putc (const char);
|
void serial_putc (const char);
|
||||||
|
void serial_clear (void);
|
||||||
void serial_putc_raw(const char);
|
void serial_putc_raw(const char);
|
||||||
void serial_puts (const char *);
|
void serial_puts (const char *);
|
||||||
int serial_getc (void);
|
int serial_getc (void);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ int tstc(void);
|
||||||
defined(CONFIG_SPL_SERIAL_SUPPORT))
|
defined(CONFIG_SPL_SERIAL_SUPPORT))
|
||||||
void putc(const char c);
|
void putc(const char c);
|
||||||
void puts(const char *s);
|
void puts(const char *s);
|
||||||
|
void flushc(void);
|
||||||
int __printf(1, 2) printf(const char *fmt, ...);
|
int __printf(1, 2) printf(const char *fmt, ...);
|
||||||
int vprintf(const char *fmt, va_list args);
|
int vprintf(const char *fmt, va_list args);
|
||||||
#else
|
#else
|
||||||
|
|
@ -26,6 +27,10 @@ static inline void puts(const char *s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void flushc(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static inline int __printf(1, 2) printf(const char *fmt, ...)
|
static inline int __printf(1, 2) printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,9 @@ struct stdio_dev {
|
||||||
/* To put a string (accelerator) */
|
/* To put a string (accelerator) */
|
||||||
void (*puts)(struct stdio_dev *dev, const char *s);
|
void (*puts)(struct stdio_dev *dev, const char *s);
|
||||||
|
|
||||||
|
/* Clear functions */
|
||||||
|
void (*clear)(struct stdio_dev *dev);
|
||||||
|
|
||||||
/* INPUT functions */
|
/* INPUT functions */
|
||||||
|
|
||||||
/* To test if a char is ready... */
|
/* To test if a char is ready... */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue