2 * Copyright (C) 2003, 2004 Stefan Reinauer
4 * See the file "COPYING" for further information about
5 * the copyright and warranty status of this work.
9 #include "kernel/kernel.h"
10 #include "drivers/drivers.h"
12 #include "libopenbios/console.h"
13 #include "libopenbios/ofmem.h"
14 #include "libopenbios/video.h"
16 #ifdef CONFIG_DEBUG_CONSOLE
18 /* ******************************************************************
19 * common functions, implementing simple concurrent console
20 * ****************************************************************** */
22 static int arch_putchar(int c)
24 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
30 static int arch_availchar(void)
32 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
33 if (escc_uart_charav(CONFIG_SERIAL_PORT))
36 #ifdef CONFIG_DEBUG_CONSOLE_VIDEO
37 if (keyboard_dataready())
43 static int arch_getchar(void)
45 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
46 if (escc_uart_charav(CONFIG_SERIAL_PORT))
47 return (escc_uart_getchar(CONFIG_SERIAL_PORT));
49 #ifdef CONFIG_DEBUG_CONSOLE_VIDEO
50 if (keyboard_dataready())
51 return (keyboard_readdata());
56 struct _console_ops arch_console_ops = {
57 .putchar = arch_putchar,
58 .availchar = arch_availchar,
59 .getchar = arch_getchar
62 #endif // CONFIG_DEBUG_CONSOLE