Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / sparc32 / console.c
1 /*
2  * Copyright (C) 2003, 2004 Stefan Reinauer
3  *
4  * See the file "COPYING" for further information about
5  * the copyright and warranty status of this work.
6  */
7
8 #include "config.h"
9 #include "kernel/kernel.h"
10 #include "drivers/drivers.h"
11 #include "openbios.h"
12 #include "libopenbios/console.h"
13 #include "libopenbios/ofmem.h"
14 #include "libopenbios/video.h"
15
16 #ifdef CONFIG_DEBUG_CONSOLE
17
18 /* ******************************************************************
19  *      common functions, implementing simple concurrent console
20  * ****************************************************************** */
21
22 static int arch_putchar(int c)
23 {
24 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
25         escc_uart_putchar(c);
26 #endif
27         return c;
28 }
29
30 static int arch_availchar(void)
31 {
32 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
33         if (escc_uart_charav(CONFIG_SERIAL_PORT))
34                 return 1;
35 #endif
36 #ifdef CONFIG_DEBUG_CONSOLE_VIDEO
37         if (keyboard_dataready())
38                 return 1;
39 #endif
40         return 0;
41 }
42
43 static int arch_getchar(void)
44 {
45 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
46         if (escc_uart_charav(CONFIG_SERIAL_PORT))
47                 return (escc_uart_getchar(CONFIG_SERIAL_PORT));
48 #endif
49 #ifdef CONFIG_DEBUG_CONSOLE_VIDEO
50         if (keyboard_dataready())
51                 return (keyboard_readdata());
52 #endif
53         return 0;
54 }
55
56 struct _console_ops arch_console_ops = {
57         .putchar = arch_putchar,
58         .availchar = arch_availchar,
59         .getchar = arch_getchar
60 };
61
62 #endif                          // CONFIG_DEBUG_CONSOLE