u-boot/include/console.h
Simon Glass 9854a8748c console: Add a console buffer
It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-19 20:27:50 -07:00

52 lines
1.4 KiB
C

/*
* (C) Copyright 2000-2009
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __CONSOLE_H
#define __CONSOLE_H
extern char console_buffer[];
/* common/console.c */
int console_init_f(void); /* Before relocation; uses the serial stuff */
int console_init_r(void); /* After relocation; uses the console stuff */
int console_assign(int file, const char *devname); /* Assign the console */
int ctrlc(void);
int had_ctrlc(void); /* have we had a Control-C since last clear? */
void clear_ctrlc(void); /* clear the Control-C condition */
int disable_ctrlc(int); /* 1 to disable, 0 to enable Control-C detect */
int confirm_yesno(void); /* 1 if input is "y", "Y", "yes" or "YES" */
/**
* console_record_init() - set up the console recording buffers
*
* This should be called as soon as malloc() is available so that the maximum
* amount of console output can be recorded.
*/
int console_record_init(void);
/**
* console_record_reset() - reset the console recording buffers
*
* Removes any data in the buffers
*/
void console_record_reset(void);
/**
* console_record_reset_enable() - reset and enable the console buffers
*
* This should be called to enable the console buffer.
*/
void console_record_reset_enable(void);
/*
* CONSOLE multiplexing.
*/
#ifdef CONFIG_CONSOLE_MUX
#include <iomux.h>
#endif
#endif