From e024cd39a877ea1b37b9004dbd8f33448418cb36 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 26 Mar 2012 17:25:08 +0100 Subject: [console] Allow usage to be defined independently for each console Add the concept of a "console usage", such as "standard output" or "debug messages". Allow usages to be associated with each console independently. For example, to send debugging output via the serial port, while preventing it from appearing on the local console: #define CONSOLE_SERIAL CONSOLE_USAGE_ALL #define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG ) If no usages are explicitly specified, then a default set of usages will be applied. For example: #define CONSOLE_SERIAL will have the same affect as #define CONSOLE_SERIAL CONSOLE_USAGE_ALL Signed-off-by: Michael Brown --- src/core/serial_console.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/core/serial_console.c') diff --git a/src/core/serial_console.c b/src/core/serial_console.c index b05a06b17..52bd53760 100644 --- a/src/core/serial_console.c +++ b/src/core/serial_console.c @@ -1,6 +1,7 @@ #include #include #include +#include /** @file * @@ -8,6 +9,12 @@ * */ +/* Set default console usage if applicable */ +#if ! ( defined ( CONSOLE_SERIAL ) && CONSOLE_EXPLICIT ( CONSOLE_SERIAL ) ) +#undef CONSOLE_SERIAL +#define CONSOLE_SERIAL CONSOLE_USAGE_ALL +#endif + struct console_driver serial_console __console_driver; static void serial_console_init ( void ) { @@ -21,6 +28,7 @@ struct console_driver serial_console __console_driver = { .getchar = serial_getc, .iskey = serial_ischar, .disabled = 1, + .usage = CONSOLE_SERIAL, }; /** -- cgit v1.2.3-55-g7522