From 9854a8748c8fdd69784a1fa1c4758c696621c88d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 8 Nov 2015 23:47:48 -0700 Subject: 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 --- common/board_f.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common/board_f.c') diff --git a/common/board_f.c b/common/board_f.c index 09baa5c550..b035c90ff3 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -737,6 +737,15 @@ static int mark_bootstage(void) return 0; } +static int initf_console_record(void) +{ +#if defined(CONFIG_CONSOLE_RECORD) && defined(CONFIG_SYS_MALLOC_F_LEN) + return console_record_init(); +#else + return 0; +#endif +} + static int initf_dm(void) { #if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F_LEN) @@ -773,6 +782,7 @@ static init_fnc_t init_sequence_f[] = { trace_early_init, #endif initf_malloc, + initf_console_record, #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) /* TODO: can this go into arch_cpu_init()? */ probecpu, -- cgit v1.2.3