6 * Copyright (C) 2005 Stefan Reinauer <stepan@openbios.org>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation
15 #include "libopenbios/bindings.h"
16 #include "libopenbios/console.h"
17 #include "drivers/drivers.h"
19 #ifdef CONFIG_DEBUG_CONSOLE
20 /* ******************************************************************
21 * common functions, implementing simple concurrent console
22 * ****************************************************************** */
24 static int mac_putchar(int c)
26 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
27 escc_uart_putchar(c & 0xff);
32 static int mac_availchar(void)
34 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
35 if (escc_uart_charav(CONFIG_SERIAL_PORT))
41 static int mac_getchar(void)
43 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
44 if (escc_uart_charav(CONFIG_SERIAL_PORT))
45 return (escc_uart_getchar(CONFIG_SERIAL_PORT));
50 struct _console_ops mac_console_ops = {
51 .putchar = mac_putchar,
52 .availchar = mac_availchar,
53 .getchar = mac_getchar
56 static int prep_putchar(int c)
58 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
59 uart_putchar(c & 0xff);
64 static int prep_availchar(void)
66 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
67 if (uart_charav(CONFIG_SERIAL_PORT))
73 static int prep_getchar(void)
75 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
76 if (uart_charav(CONFIG_SERIAL_PORT))
77 return (uart_getchar(CONFIG_SERIAL_PORT));
82 struct _console_ops prep_console_ops = {
83 .putchar = prep_putchar,
84 .availchar = prep_availchar,
85 .getchar = prep_getchar
88 #endif // CONFIG_DEBUG_CONSOLE