blob: a94303b8bd2202182810fc8232adf011e1c4ac15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/*
* <console.c>
*
* Simple text console
*
* Copyright (C) 2005 Stefan Reinauer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*
*/
#include "config.h"
#include "libopenbios/bindings.h"
#include "libopenbios/console.h"
#include "drivers/drivers.h"
#ifdef CONFIG_DEBUG_CONSOLE
/* ******************************************************************
* common functions, implementing simple concurrent console
* ****************************************************************** */
static int mac_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
escc_uart_putchar(c & 0xff);
#endif
return c;
}
static int mac_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (escc_uart_charav(CONFIG_SERIAL_PORT))
return 1;
#endif
return 0;
}
static int mac_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (escc_uart_charav(CONFIG_SERIAL_PORT))
return (escc_uart_getchar(CONFIG_SERIAL_PORT));
#endif
return 0;
}
struct _console_ops mac_console_ops = {
.putchar = mac_putchar,
.availchar = mac_availchar,
.getchar = mac_getchar
};
static int prep_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
uart_putchar(c & 0xff);
#endif
return c;
}
static int prep_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
return 1;
#endif
return 0;
}
static int prep_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
return (uart_getchar(CONFIG_SERIAL_PORT));
#endif
return 0;
}
struct _console_ops prep_console_ops = {
.putchar = prep_putchar,
.availchar = prep_availchar,
.getchar = prep_getchar
};
#endif // CONFIG_DEBUG_CONSOLE
|