|
|
1.1 root 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 "libopenbios/bindings.h"
10: #include "kernel/kernel.h"
11: #include "drivers/drivers.h"
12: #include "libopenbios/fontdata.h"
13: #include "openbios.h"
14: #include "libc/vsprintf.h"
15: #include "libopenbios/sys_info.h"
16: #include "boot.h"
17:
18: /* ******************************************************************
19: * simple polling video/keyboard console functions
20: * ****************************************************************** */
21:
22: #ifdef CONFIG_DEBUG_CONSOLE
23: /* ******************************************************************
24: * common functions, implementing simple concurrent console
25: * ****************************************************************** */
26:
27: int putchar(int c)
28: {
29: #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
30: serial_putchar(c);
31: #endif
32: return c;
33: }
34:
35: int availchar(void)
36: {
37: #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
38: if (uart_charav(CONFIG_SERIAL_PORT))
39: return 1;
40: #endif
41: #ifdef CONFIG_DEBUG_CONSOLE_VGA
42: if (pc_kbd_dataready())
43: return 1;
44: #endif
45: return 0;
46: }
47:
48: int getchar(void)
49: {
50: #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
51: if (uart_charav(CONFIG_SERIAL_PORT))
52: return (uart_getchar(CONFIG_SERIAL_PORT));
53: #endif
54: #ifdef CONFIG_DEBUG_CONSOLE_VGA
55: if (pc_kbd_dataready())
56: return (pc_kbd_readdata());
57: #endif
58: return 0;
59: }
60:
61: void cls(void)
62: {
63: #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
64: serial_putchar(27);
65: serial_putchar('[');
66: serial_putchar('H');
67: serial_putchar(27);
68: serial_putchar('[');
69: serial_putchar('J');
70: #endif
71: }
72:
73: #endif // CONFIG_DEBUG_CONSOLE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.